From b3f228e207585d443ae9039a46bc4b00139ad7c5 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 2 Jun 2019 13:39:10 +0200 Subject: [PATCH] [RTTY] Moved ITA2 code table to flash --- src/protocols/RTTY.cpp | 4 ++-- src/protocols/RTTY.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/protocols/RTTY.cpp b/src/protocols/RTTY.cpp index 9427c87a..0cc22dc7 100644 --- a/src/protocols/RTTY.cpp +++ b/src/protocols/RTTY.cpp @@ -84,11 +84,11 @@ uint16_t ITA2String::getBits(char c) { // search ITA2 table uint16_t code = 0x0000; for(uint8_t i = 0; i < ITA2_LENGTH; i++) { - if(ITA2Table[i][0] == c) { + if(pgm_read_byte(ITA2Table[i][0]) == c) { // character is in letter shift code = (ITA2_LTRS << 5) | i; break; - } else if(ITA2Table[i][1] == c) { + } else if(pgm_read_byte(ITA2Table[i][1]) == c) { // character is in figures shift code = (ITA2_FIGS << 5) | i; break; diff --git a/src/protocols/RTTY.h b/src/protocols/RTTY.h index 6a62cfb0..6a4e9332 100644 --- a/src/protocols/RTTY.h +++ b/src/protocols/RTTY.h @@ -11,10 +11,10 @@ // ITA2 character table: - position in array corresponds to 5-bit ITA2 code // - characters to the left are in letters shift, characters to the right in figures shift // - characters marked 0x7F do not have ASCII equivalent -static const char ITA2Table[ITA2_LENGTH][2] = {{'\0', '\0'}, {'E', '3'}, {'\n', '\n'}, {'A', '-'}, {' ', ' '}, {'S', '\''}, {'I', '8'}, {'U', '7'}, - {'\r', '\r'}, {'D', 0x05}, {'R', '4'}, {'J', '\a'}, {'N', ','}, {'F', '!'}, {'C', ':'}, {'K', '('}, - {'T', '5'}, {'Z', '+'}, {'L', ')'}, {'W', '2'}, {'H', 0x7F}, {'Y', '6'}, {'P', '0'}, {'Q', '1'}, - {'O', '9'}, {'B', '?'}, {'G', '&'}, {0x7F, 0x7F}, {'M', '.'}, {'X', '/'}, {'V', ';'}, {0x7F, 0x7F}}; +static const char ITA2Table[ITA2_LENGTH][2] PROGMEM = {{'\0', '\0'}, {'E', '3'}, {'\n', '\n'}, {'A', '-'}, {' ', ' '}, {'S', '\''}, {'I', '8'}, {'U', '7'}, + {'\r', '\r'}, {'D', 0x05}, {'R', '4'}, {'J', '\a'}, {'N', ','}, {'F', '!'}, {'C', ':'}, {'K', '('}, + {'T', '5'}, {'Z', '+'}, {'L', ')'}, {'W', '2'}, {'H', 0x7F}, {'Y', '6'}, {'P', '0'}, {'Q', '1'}, + {'O', '9'}, {'B', '?'}, {'G', '&'}, {0x7F, 0x7F}, {'M', '.'}, {'X', '/'}, {'V', ';'}, {0x7F, 0x7F}}; /*! \class ITA2String