[Morse] Fixed bug in decoder logic
This commit is contained in:
parent
655dfaae45
commit
4a637b44f1
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||||
|
if(state == RADIOLIB_MORSE_WORD_COMPLETE) {
|
||||||
// inter-word space, interpret that as a new line
|
// inter-word space, interpret that as a new line
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue