From 52f527ff8fcf545994b565400da633bc4161aafc Mon Sep 17 00:00:00 2001 From: Elmwood Electronics Date: Mon, 22 Jul 2019 16:32:37 -0400 Subject: [PATCH 1/2] Update code.py Noticed that midnight was not handled properly for cases like "Five to Midnight" or "Twenty after Midnight". Was seeing noon instead of midnight. --- CircuitPython_Simple_Wordclock/code.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CircuitPython_Simple_Wordclock/code.py b/CircuitPython_Simple_Wordclock/code.py index 8c568c892..cadb5add5 100644 --- a/CircuitPython_Simple_Wordclock/code.py +++ b/CircuitPython_Simple_Wordclock/code.py @@ -89,6 +89,9 @@ def writetime(the_hr, the_min): the_hr = the_hr + 1 # for the TO case value = value | TO # set hour + if the_hr == 24: # special case for Midnight + value = value | MIDIGHT + return value if the_hr > 12: the_hr = the_hr - 12 # Convert 24 hour format to 12 hour if the_hr == 1: @@ -113,8 +116,6 @@ def writetime(the_hr, the_min): value = value | TEN if the_hr == 11: value = value | ELEVEN - if the_hr == 0: - value = value | MIDNIGHT if the_hr == 12: value = value | NOON return value From 725dc66b322c6d31d7015c0be9dc342e57fece27 Mon Sep 17 00:00:00 2001 From: Elmwood Electronics Date: Sat, 27 Jul 2019 14:56:10 -0400 Subject: [PATCH 2/2] Clock was showing noon instead of midnight Added a special case so clock shows "xxx TO MIDNIGHT" or "xxx PAST MIDNIGHT" instead of "xxx TO NOON" or "xxx PAST MIDNIGHT". Midnight was only working properly if the display time was exactly midnight. --- CircuitPython_Simple_Wordclock/code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CircuitPython_Simple_Wordclock/code.py b/CircuitPython_Simple_Wordclock/code.py index cadb5add5..cf0dd4b1a 100644 --- a/CircuitPython_Simple_Wordclock/code.py +++ b/CircuitPython_Simple_Wordclock/code.py @@ -90,7 +90,7 @@ def writetime(the_hr, the_min): value = value | TO # set hour if the_hr == 24: # special case for Midnight - value = value | MIDIGHT + value = value | MIDNIGHT return value if the_hr > 12: the_hr = the_hr - 12 # Convert 24 hour format to 12 hour