dr-mod / pico-solar-system

Digital version of the classic mechanical orrery
GNU General Public License v3.0
277 stars 25 forks source link

Version without RTC? #5

Closed callimero closed 2 years ago

callimero commented 3 years ago

I thought I can hack it to work without RTC.

Maybe use some checks and then use a time/date from the Python file.

BTW: The program runs fine from my pico-display-browser https://github.com/callimero/rp-pico/blob/main/picodisplay/ls.py

but crashes (needs reset) when I start it from Thonny.

callimero commented 3 years ago

Console is not helpfull:

`MicroPython v1.15 on 2021-05-20; Raspberry Pi Pico with RP2040

Type "help()" for more information.

%Run -c $EDITOR_CONTENT (2021, 8, 6, 11, 12, 0, 4, 218) 1628248320 Traceback (most recent call last): File " � `

dr-mod commented 3 years ago

Hi, I haven't used the Thonny IDE, thus won't be able to help out in terms of it. As for Pico Solar System working without RTC, the only time the RTC module is used is during the initialization of the clock to set the internal timer: https://github.com/dr-mod/pico-solar-system/blob/c6322c04a95171c137aee214f2b28a33dc856fc2/main.py#L78

If I understand what you want to acheive correctly and you were to remove the RTC module from the equation and save the current time to flash each second, your clock would be off by the amount of time it's been powered off.

HeatfanJohn commented 3 years ago

If you have saved all of the files (main.py, planets.py, pluto.py) and then comment out the following lines in main.py:

    import ds3231

    ds = ds3231.ds3231()
    set_internal_time(ds.read_time())

main.py should run when you press -D in the Thonny shell to perform a soft reset and the board will execute main.py. You can then press -C to interrupt the running program and return back to the Thonny shell.

image