[Morse] Fixed bug in decoder logic

This commit is contained in:
jgromes 2022-08-07 10:21:07 +02:00
parent 655dfaae45
commit 4a637b44f1

View file

@ -95,8 +95,8 @@ void loop() {
// try to read a new symbol // try to read a new symbol
int state = morse.read(&symbol, &len); int state = morse.read(&symbol, &len);
// check if we have a complete character // check if we have something to decode
if(state == RADIOLIB_MORSE_CHAR_COMPLETE) { if(state != RADIOLIB_MORSE_INTER_SYMBOL) {
// decode and print // decode and print
Serial.print(MorseClient::decode(symbol, len)); Serial.print(MorseClient::decode(symbol, len));
@ -104,9 +104,12 @@ void loop() {
symbol = 0; symbol = 0;
len = 0; len = 0;
} else if(state == RADIOLIB_MORSE_WORD_COMPLETE) { // check if we have a complete word
// inter-word space, interpret that as a new line if(state == RADIOLIB_MORSE_WORD_COMPLETE) {
Serial.println(); // inter-word space, interpret that as a new line
Serial.println();
}
} }
} }