-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
display of day of the week is off #17
base: main
Are you sure you want to change the base?
Conversation
Functionally this is identical. only needlessly complicated. and not logically sound, as Sunday is the first day of the week, therefore 0-6 was correct. |
For me, it just shows the wrong day of the week (today on Thursday it shows Tuesday). Maybe we should implement the correct setting for day of the week somewhere in our code? |
@the-it I take it you have set the date correctly? The day of the week is derived from the date (Asking the stupid questions first) |
yes done that correctly. Even get a dump of the date in the console |
I set the day of the week manually when I first set the RTC. and once the DOW is set it is pulled directly from the RTC not calculated. |
I think we should set the DOW in the init routine of the RTC object. If code relies on a correct setting ... we should set it accordingly. |
Is the DOW just an incrementing number in the RTC? i.e. is it down to code to make sure that the DOW is correct in relation to the date? In which case, correcting the DOW from the date in code makes sense. |
I believe you only need to set the DOW when setting the time. and Yes its an incrementing 1:1 integer coming from the RTC |
Hi, I had the same problem. I think the cause is that the weekday number is shifted up and down in several places in the code. On line 79 in ds3231_port.py it saves the weekday to the DS3231 RTC after adding 1. When converting to localtime format (I'm not sure why that is necessary), ds3231_port.py on line 64 subtracts 1 from the weekday. The list 'day_of_week' in display.py (line 184) is in the wrong order, with Sun as 0 and Mon as 1. I'd call that wrong because the clock shows the icons Monday-first, and all datetime functions in Python and MicroPython report the weekday between 0 and 6, where 0 is Monday. So when cleaning that up, my clock shows the right icon for today's date. I did have to reset weekday in the RTC manually, because --if I'm following the code correctly-- the RTC module will only be updated when it is not already set. So if you have a wrong weekday in there, it will only be corrected when the date changes I guess? Or when you take the battery out of the RTC module :-) The easier way is to run a script from Thonny to change the Pico's systems time (and maybe other settings). I will add that script and turn this whole comment into a PR later. |
Just to add some background, I think what may be the source of confusion is that there seems to have been a bug in MicroPython's port for Pico: micropython/micropython#7889 That means that an offset was needed before, in the original software for this clock, but now that can be left out. |
A bug in MicroPython for Pico was fixed, which means this clock doesn't have to offset the day of the week anymore. See discussion in malcolmholmes#17
No description provided.