mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Adjusts LF ADC raw data processing
Adjusts the bit shift for ADC raw data conversion to refine the value range.
This commit is contained in:
@@ -45,7 +45,7 @@ bool raw_read_to_buffer(uint8_t *data, size_t maxlen, uint32_t timeout_ms, size_
|
||||
while (NO_TIMEOUT_1MS(p_at, timeout_ms) && *outlen < maxlen) {
|
||||
uint16_t val = 0;
|
||||
while (cb_pop_front(&cb, &val) && *outlen < maxlen) {
|
||||
val = val >> 6; // 14 bit ADC to 8 bit value
|
||||
val = val >> 5; // 14 bit ADC to 8 bit value and /2 range
|
||||
data[*outlen] = val > 0xff ? 0xff : val;
|
||||
++(*outlen);
|
||||
}
|
||||
|
||||
@@ -3267,7 +3267,7 @@ class LFADCGenericRead(ReaderRequiredUnit):
|
||||
for i in range(0, len(resp), width):
|
||||
chunk = resp[i : i + width]
|
||||
hexpart = " ".join(f"{b:02x}" for b in chunk)
|
||||
binpart = "".join('1' if b >= 0x5f else '0' for b in chunk)
|
||||
binpart = "".join('1' if b >= 0xbf else '0' for b in chunk)
|
||||
print(f"{i:04x} {hexpart:<{width * 3}} {binpart}")
|
||||
|
||||
avg = 0
|
||||
|
||||
Reference in New Issue
Block a user