mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
minor fixes
This commit is contained in:
parent
98acac3fc2
commit
6bdfe11c1a
2 changed files with 23 additions and 9 deletions
|
@ -134,10 +134,11 @@ void initSampleBuffer(uint32_t *sample_size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) {
|
void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) {
|
||||||
|
|
||||||
if (sample_size == NULL) {
|
if (sample_size == NULL) {
|
||||||
Dbprintf("initSampleBufferEx, param NULL");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigBuf_free_keep_EM();
|
BigBuf_free_keep_EM();
|
||||||
|
|
||||||
// We can't erase the buffer now, it would drastically delay the acquisition
|
// We can't erase the buffer now, it would drastically delay the acquisition
|
||||||
|
@ -181,14 +182,26 @@ void logSampleSimple(uint8_t sample) {
|
||||||
|
|
||||||
void logSample(uint8_t sample, uint8_t decimation, uint8_t bits_per_sample, bool avg) {
|
void logSample(uint8_t sample, uint8_t decimation, uint8_t bits_per_sample, bool avg) {
|
||||||
|
|
||||||
if (!data.buffer) return;
|
if (!data.buffer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// keep track of total gather samples regardless how many was discarded.
|
// keep track of total gather samples regardless how many was discarded.
|
||||||
if (samples.counter-- == 0) return;
|
if (samples.counter-- == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (bits_per_sample == 0) bits_per_sample = 1;
|
if (bits_per_sample == 0) {
|
||||||
if (bits_per_sample > 8) bits_per_sample = 8;
|
bits_per_sample = 1;
|
||||||
if (decimation == 0) decimation = 1;
|
}
|
||||||
|
|
||||||
|
if (bits_per_sample > 8) {
|
||||||
|
bits_per_sample = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decimation == 0) {
|
||||||
|
decimation = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (avg) {
|
if (avg) {
|
||||||
samples.sum += sample;
|
samples.sum += sample;
|
||||||
|
@ -198,7 +211,9 @@ void logSample(uint8_t sample, uint8_t decimation, uint8_t bits_per_sample, bool
|
||||||
if (decimation > 1) {
|
if (decimation > 1) {
|
||||||
samples.dec_counter++;
|
samples.dec_counter++;
|
||||||
|
|
||||||
if (samples.dec_counter < decimation) return;
|
if (samples.dec_counter < decimation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
samples.dec_counter = 0;
|
samples.dec_counter = 0;
|
||||||
}
|
}
|
||||||
|
@ -542,7 +557,6 @@ out:
|
||||||
LED_D_OFF();
|
LED_D_OFF();
|
||||||
|
|
||||||
// DoAcquisition() end
|
// DoAcquisition() end
|
||||||
|
|
||||||
StopTicks();
|
StopTicks();
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
return return_value;
|
return return_value;
|
||||||
|
|
|
@ -2769,7 +2769,7 @@ static int CmdAsn1Decoder(const char *Cmd) {
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_str0("d", NULL, "<hex>", "ASN1 encoded byte array"),
|
arg_str0("d", NULL, "<hex>", "ASN1 encoded byte array"),
|
||||||
arg_lit0("t", "test", "perform self test"),
|
arg_lit0(NULL, "test", "perform self tests"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue