mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 06:13:51 -07:00
Merge pull request #1880 from wh201906/fix_lf_bps
Fix the lf sampling when bits_per_sample is less than 8
This commit is contained in:
commit
6856cf54a8
3 changed files with 11 additions and 4 deletions
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
||||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||||
|
|
||||||
## [unreleased][unreleased]
|
## [unreleased][unreleased]
|
||||||
|
- Fixed the lf sampling when bits_per_sample is less than 8 (@wh201906)
|
||||||
- Added `lf em 4x70 brute` command (@adite)
|
- Added `lf em 4x70 brute` command (@adite)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,9 @@ void LFSetupFPGAForADC(int divisor, bool reader_field) {
|
||||||
uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, int16_t trigger_threshold,
|
uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, int16_t trigger_threshold,
|
||||||
bool verbose, uint32_t sample_size, uint32_t cancel_after, int32_t samples_to_skip, bool ledcontrol) {
|
bool verbose, uint32_t sample_size, uint32_t cancel_after, int32_t samples_to_skip, bool ledcontrol) {
|
||||||
|
|
||||||
initSampleBuffer(&sample_size);
|
initSampleBuffer(&sample_size); // sample size in bytes
|
||||||
|
sample_size <<= 3; // sample size in bits
|
||||||
|
sample_size /= bits_per_sample; // sample count
|
||||||
|
|
||||||
if (g_dbglevel >= DBG_DEBUG) {
|
if (g_dbglevel >= DBG_DEBUG) {
|
||||||
printSamples();
|
printSamples();
|
||||||
|
@ -368,8 +370,12 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that DC offset removal and noise check is performed for any device-side processing
|
// Ensure that DC offset removal and noise check is performed for any device-side processing
|
||||||
|
if (bits_per_sample == 8)
|
||||||
|
{
|
||||||
|
// these functions only consider bps==8
|
||||||
removeSignalOffset(data.buffer, samples.total_saved);
|
removeSignalOffset(data.buffer, samples.total_saved);
|
||||||
computeSignalProperties(data.buffer, samples.total_saved);
|
computeSignalProperties(data.buffer, samples.total_saved);
|
||||||
|
}
|
||||||
return data.numbits;
|
return data.numbits;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1779,7 +1779,7 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose, bool ignore_lf_conf
|
||||||
|
|
||||||
BitstreamOut_t bout = { got, bits_per_sample * n, 0};
|
BitstreamOut_t bout = { got, bits_per_sample * n, 0};
|
||||||
uint32_t j = 0;
|
uint32_t j = 0;
|
||||||
for (j = 0; j * bits_per_sample < n * 8 && j < n; j++) {
|
for (j = 0; j * bits_per_sample < n * 8 && j * bits_per_sample < MAX_GRAPH_TRACE_LEN * 8; j++) {
|
||||||
uint8_t sample = getByte(bits_per_sample, &bout);
|
uint8_t sample = getByte(bits_per_sample, &bout);
|
||||||
g_GraphBuffer[j] = ((int) sample) - 127;
|
g_GraphBuffer[j] = ((int) sample) - 127;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue