Skip to content
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

BUG: time incoherent in Badger2040 clock.py #449

Closed
Martin-HiPi opened this issue Jul 17, 2022 · 7 comments
Closed

BUG: time incoherent in Badger2040 clock.py #449

Martin-HiPi opened this issue Jul 17, 2022 · 7 comments
Assignees
Labels
[- badger2040 -] https://shop.pimoroni.com/products/badger-2040 documentation Improvements or additions to documentation enhancement New feature or request

Comments

@Martin-HiPi
Copy link

Martin-HiPi commented Jul 17, 2022

I've edited the font used by the clock.py example to "sans" and saved it back to the root of the Badger2040. It starts correctly, but it resets to the default time on every start, even if previously set. If I manually start the modified clock.py from Thonny, the time is correctly shown, confirming that the time was correctly set previously.

EDIT: I've deleted the clock.py from the Badger and the behaviour persists.

Badger 2040 using pimoroni-badger2040-v1.19.2-micropython.uf2
clock.py = b78b292

Bonus question: Can the seconds be made to reset to "00" if selected? This would allow for accurate time setting :-)

@Martin-HiPi Martin-HiPi changed the title REQ: time incoherent in edited Badger2040 clock.py REQ: time incoherent in Badger2040 clock.py Jul 17, 2022
@Martin-HiPi Martin-HiPi changed the title REQ: time incoherent in Badger2040 clock.py BUG: time incoherent in Badger2040 clock.py Jul 17, 2022
@alphanumeric007
Copy link

I'm not sure if your aware, but the RTC on the RP2040 doesn't have any onboard battery backup. On a stock Pi Pico it doesn't anyway. If you remove power it will reset to its default start time.
I'm thinking turning the Badger off, kills the power, and resets the time to default.
And when its being run from Thonny, its getting the time from the host PC.

I was having a similar experience when the battery died in my RV3028 RTC breakout. It's what i'm using on a Pi Pico setup that I wanted accurate date time on.

@Gadgetoid
Copy link
Member

Indeed there is no RTC battery backup, so this cannot be fixed in software

Making seconds reset to zero is doable, though, for what little help that is.

@Martin-HiPi
Copy link
Author

I will clarify: I mean that setting the time in the clock app, pressing "B" to clear the cursor, pressing "A"+"C" to return to the launcher, and launching the clock app again, the time isn't restored in the app. It starts again from 12:00:00

A 18650 LiPo, fully charged, is attached at all times.

Since launching the clock app from Thonny shows the correct time, I know the RTC is set and time is running. Pressing "Reset" on the Badger2040 and launching the clock from the launcher fails to show the time from the RTC. At this point, the Badger2040 is still attached to the Pi.

Once set, time is always wrong when restarted from the launcher, but good when started from Thonny. The clock app, when launched from any place, is expected to retrieve the time from the RTC and display it, but depending on where it's launched from, doesn't and this is the incoherence.

I am well aware of the RP2040 dependence on a power source to maintain the RTC, thus the attached LiPo.

Martin Boissonneault,
Technical department head
PiShop.ca|.us

@Gadgetoid
Copy link
Member

The catch is that Badger 2040 doesn't rely on the not-great sleep states of the Pico, but rather cuts the power entirely. Connected battery or not, it'll lose the time since it's truly off. The buttons actually trigger the power being turned back on, in addition to being readable by the RP2040. Rather ingenious save this one unfortunate side-effect.

Thonny quietly sets the clock in the background from the host PC.

@Martin-HiPi
Copy link
Author

I suggest this caveat be mentioned in the clock.py source then :-)

Thanks,
Martin

@Gadgetoid
Copy link
Member

Agreed!

@Gadgetoid Gadgetoid self-assigned this Jul 18, 2022
@Gadgetoid Gadgetoid added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 18, 2022
@ZodiusInfuser ZodiusInfuser added the [- badger2040 -] https://shop.pimoroni.com/products/badger-2040 label Jan 20, 2023
@Gadgetoid
Copy link
Member

Badger 2040 and Badger 2040 W now live here: https://github.com/pimoroni/badger2040/

Closing this issue to keep Badger 2040 to its new home. Have made a note to look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[- badger2040 -] https://shop.pimoroni.com/products/badger-2040 documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants