From 285952ea1dc6ac40d67820844033d6115ab7e404 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 12 Feb 2016 20:04:27 +0100 Subject: FECModem: set byte to 0 (frownie symbol) if it contained an uncorrectable error --- src/fecmodem.cc | 14 ++++++++------ src/font.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/fecmodem.cc b/src/fecmodem.cc index 5323135..bd0d58c 100644 --- a/src/fecmodem.cc +++ b/src/fecmodem.cc @@ -17,14 +17,16 @@ uint8_t FECModem::correct128(uint8_t *byte, uint8_t err) uint8_t result = pgm_read_byte(&hammingParityCheck[err & 0x0f]); if (result != NO_ERROR) { - if (result == UNCORRECTABLE || byte == NULL) { + if (byte == NULL) return 3; - } else { - if (result != ERROR_IN_PARITY) { - *byte ^= result; - } - return 1; + if (result == UNCORRECTABLE) { + *byte = 0; + return 3; + } + if (result != ERROR_IN_PARITY) { + *byte ^= result; } + return 1; } return 0; } diff --git a/src/font.h b/src/font.h index a705d57..b0015b3 100644 --- a/src/font.h +++ b/src/font.h @@ -133,7 +133,7 @@ const unsigned char PROGMEM chr_125[] = {0x03,0x41,0x36,0x08}; // } const unsigned char PROGMEM chr_126[] = {0x05,0x08,0x10,0x08,0x04,0x08}; // ~ const glyph_t font[] PROGMEM = { - chr_001, + chr_002, // special character for uncorrectable byte errors chr_001, chr_002, chr_003, -- cgit v1.2.3