aboutsummaryrefslogtreecommitdiff
path: root/center_fw/src/main.c
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-10-02 01:42:34 +0200
committerjaseg <git@jaseg.de>2023-10-02 01:42:34 +0200
commit72cffd586a7d2cd20bd8256a920b2caac8c7db85 (patch)
tree98b1fd20f918030a03d7a84bc713208d8dc0ba3b /center_fw/src/main.c
parentc8623eb4c6c1464ffd49e83126e66d71ba5bf862 (diff)
download8seg-72cffd586a7d2cd20bd8256a920b2caac8c7db85.tar.gz
8seg-72cffd586a7d2cd20bd8256a920b2caac8c7db85.tar.bz2
8seg-72cffd586a7d2cd20bd8256a920b2caac8c7db85.zip
Fix the nasty 8b/10b bug
Diffstat (limited to 'center_fw/src/main.c')
-rw-r--r--center_fw/src/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/center_fw/src/main.c b/center_fw/src/main.c
index 59bd7a1..a4f7d9e 100644
--- a/center_fw/src/main.c
+++ b/center_fw/src/main.c
@@ -195,7 +195,9 @@ size_t adc_dump_pos = 0;
uint8_t bit_dump[4096];
size_t bit_dump_pos = 0;
+bool armed = false;
void gdb_dump(void) {
+ armed = false;
}
void ADC1_IRQHandler(void) {
@@ -237,10 +239,15 @@ void ADC1_IRQHandler(void) {
bit_dump_pos++;
if (bit_dump_pos == COUNT_OF(bit_dump)) {
bit_dump_pos = 0;
- gdb_dump();
+ armed = true;
}
int rc = xfr_8b10b_feed_bit((struct state_8b10b_dec *)&st_8b10b_dec, bit);
+ if (rc == 0xfb) {
+ if (armed)
+ gdb_dump();
+ }
+
if (rc > -K_CODES_LAST) {
sym_dump[sym_dump_pos++] = rc;
if (sym_dump_pos == COUNT_OF(sym_dump)) {
@@ -279,7 +286,7 @@ void ADC1_IRQHandler(void) {
}
}
}
- } else {
+ } else if (rc == -DECODING_ERROR) {
errors.decoding_errors++;
}
}