Resync drain after framing error

This commit is contained in:
iceman1001 committed 2026-08-31 19:45:23 +02:00
1 parent 179de04301
commit 7556dd8fc0
1 file changed
+17 -1
+17 -1
View File
@@ -659,7 +659,23 @@ __attribute__((force_align_arg_pointer))
}
is_receiving_raw_last = is_receiving_raw;
// TODO if error, shall we resync ?
// Resync after a framing error.
if (error && (is_receiving_raw == false)) {
uint8_t discard[256];
uint32_t discarded = 0;
for (uint8_t round = 0; round < 32; round++) {
uint32_t drained = 0;
if (uart_receive(sp, discard, sizeof(discard), &drained) != PM3_SUCCESS) {
break;
}
if (drained == 0) {
break;
}
discarded += drained;
}
PrintAndLogEx(WARNING, "Resynchronising, dropped %u byte(s)", discarded);
}
pthread_mutex_lock(&txBufferMutex);