lf t55xx chk m - tweaking the algo

This commit is contained in:
iceman1001 2020-08-21 17:46:29 +02:00
parent 4a09a1e17f
commit dc6e4ea4ea

View file

@ -2074,7 +2074,7 @@ void T55xx_ChkPwds(uint8_t flags) {
b1 = 0;
T55xxReadBlock(0, 0, true, 0, 0, downlink_mode);
for (uint16_t j = 0; j < CHK_SAMPLES_SIGNAL; ++j) {
b1 += buf[j];
b1 += (buf[j] * buf[j]);
}
b1 *= b1;
b1 >>= 8;
@ -2082,6 +2082,9 @@ void T55xx_ChkPwds(uint8_t flags) {
}
baseline_faulty >>= 5;
if (DBGLEVEL >= DBG_DEBUG)
Dbprintf("Baseline " _YELLOW_("%llu"), baseline_faulty);
uint8_t *pwds = BigBuf_get_EM_addr();
uint16_t pwd_count = 0;
@ -2133,7 +2136,7 @@ void T55xx_ChkPwds(uint8_t flags) {
uint64_t sum = 0;
for (uint16_t j = 0; j < CHK_SAMPLES_SIGNAL; ++j) {
sum += buf[j];
sum += (buf[j] * buf[j]);
}
sum *= sum;
sum >>= 8;
@ -2141,6 +2144,9 @@ void T55xx_ChkPwds(uint8_t flags) {
int64_t tmp_dist = (baseline_faulty - sum);
curr = ABS(tmp_dist);
if (DBGLEVEL >= DBG_DEBUG)
Dbprintf("%08x has distance " _YELLOW_("%llu"), pwd, curr);
if (curr > prev) {
idx = i;
prev = curr;