Compare commits
2 Commits
0f5c3423b3
...
a920e282e5
Author | SHA1 | Date | |
---|---|---|---|
a920e282e5 | |||
1673016c5f |
22
main.py
22
main.py
@ -17,7 +17,7 @@ zipleds = KitronikZIPLEDs(3)
|
|||||||
# Python u arse hole sec = Integer()
|
# Python u arse hole sec = Integer()
|
||||||
rtc.setDate(16, 7, 2022)
|
rtc.setDate(16, 7, 2022)
|
||||||
rtc.setTime(12, 10, 0)
|
rtc.setTime(12, 10, 0)
|
||||||
rate = 100
|
rate = 60 # 20 wpm
|
||||||
#bme688.setupGasSensor()
|
#bme688.setupGasSensor()
|
||||||
#bme688.calcBaselines()
|
#bme688.calcBaselines()
|
||||||
sec = 0
|
sec = 0
|
||||||
@ -63,7 +63,7 @@ def ButtonB_f_IRQHandler(pin):
|
|||||||
d = tt - last_tt
|
d = tt - last_tt
|
||||||
if pv:
|
if pv:
|
||||||
#print(" duration of inter-m space ", d)
|
#print(" duration of inter-m space ", d)
|
||||||
if d < rate*6:
|
if d < rate*3:
|
||||||
print (" ")
|
print (" ")
|
||||||
else:
|
else:
|
||||||
print (" interval ")
|
print (" interval ")
|
||||||
@ -222,20 +222,30 @@ def decode_morse():
|
|||||||
return("?")
|
return("?")
|
||||||
|
|
||||||
|
|
||||||
|
last_was_space = 0
|
||||||
|
last_sp = 0
|
||||||
def process_morse():
|
def process_morse():
|
||||||
global last_tt, morse
|
global last_tt, morse, last_was_space, last_sp
|
||||||
tt = time.ticks_ms()
|
tt = time.ticks_ms()
|
||||||
if (tt - last_tt) > 600:
|
if (tt - last_tt) > rate*6:
|
||||||
# morse chacter complete
|
# morse chacter complete
|
||||||
if (len(morse) > 0):
|
if (len(morse) > 0):
|
||||||
print(morse)
|
#print(morse)
|
||||||
printm(decode_morse())
|
printm(decode_morse())
|
||||||
morse = []
|
morse = []
|
||||||
|
last_was_space = 0
|
||||||
|
last_sp = last_tt
|
||||||
#oled.clear()
|
#oled.clear()
|
||||||
#oled.displayText(rtc.readDateString(), 1, 25)
|
#oled.displayText(rtc.readDateString(), 1, 25)
|
||||||
#oled.displayText(rtc.readTimeString(), 2, 33)
|
#oled.displayText(rtc.readTimeString(), 2, 33)
|
||||||
#oled.displayText(str(mcount), 4, 33)
|
#oled.displayText(str(mcount), 4, 33)
|
||||||
oled.show()
|
#oled.show()
|
||||||
|
if (tt - last_sp) > rate*22 : # and last_not_space == 0:
|
||||||
|
if last_was_space == 0:
|
||||||
|
printm(" ");
|
||||||
|
last_was_space = 1 # dont keep repeating inter word spaces
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user