Skip to content

Commit

Permalink
Fix letter/word break timing
Browse files Browse the repository at this point in the history
  • Loading branch information
ed7coyne committed May 23, 2016
1 parent 42809b7 commit 5b7bedc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/FirebaseMorse_ESP8266/FirebaseMorse_ESP8266.ino
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ void loop() {
// Wait while button is up.
int upStarted = millis();
while (digitalRead(morseButtonPin) == HIGH) {
if (millis() - upStarted > longMillis) {
if (millis() - upStarted > shortMillis*7) {
updateDisplay(currentMessage, 'w', currentLetter);
} else if (millis() - upStarted > shortMillis*3) {
} else if (millis() - upStarted > longMillis) {
updateDisplay(currentMessage, 'l', currentLetter);
} else {
updateDisplay(currentMessage, ' ', currentLetter);
}
delay(1);
}
int upTime = millis() - upStarted;
if (upTime > shortMillis*3) {
if (upTime > longMillis) {
// A letter break is 3 * the length of a short (.).
if (currentLetter > morseToCharSize || morseToChar[currentLetter] == '\0') {
Serial.println("Invalid morse char, ignoring");
Expand Down

0 comments on commit 5b7bedc

Please sign in to comment.