From 1673016c5f928372d7d0dca41ce69b20815ff2a0 Mon Sep 17 00:00:00 2001 From: Robin Clark Date: Sun, 17 Jul 2022 18:31:56 +0100 Subject: [PATCH] put spaces in between words --- main.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 069a81e..f85eb39 100644 --- a/main.py +++ b/main.py @@ -222,20 +222,30 @@ def decode_morse(): return("?") +last_was_space = 0 +last_sp = 0 def process_morse(): - global last_tt, morse + global last_tt, morse, last_was_space, last_sp tt = time.ticks_ms() - if (tt - last_tt) > 600: + if (tt - last_tt) > rate*6: # morse chacter complete if (len(morse) > 0): - print(morse) + #print(morse) printm(decode_morse()) morse = [] + last_was_space = 0 + last_sp = tt #oled.clear() #oled.displayText(rtc.readDateString(), 1, 25) #oled.displayText(rtc.readTimeString(), 2, 33) #oled.displayText(str(mcount), 4, 33) - oled.show() + #oled.show() + if (tt - last_sp) > rate*15 : # and last_not_space == 0: + if last_was_space == 0: + printm(" "); + last_was_space = 1 # dont keep repeating inter word spaces + +