pimoroni / enviro

MIT License
105 stars 84 forks source link

Fixed crash on cold RTC boot #130

Open thinkier opened 1 year ago

thinkier commented 1 year ago

Added checks before writing external RTC time to Pico's time to prevent error-crash when the enviro board is booted from a cold RTC.

ZodiusInfuser commented 1 year ago

Hi. Do you have more details of the crash you experienced? From a cold boot the RTC does have a time (though out by 2 years), so shouldn't cause a crash when being applied to the Pico's RTC.

thinkier commented 1 year ago

When I unboxed my enviro urban, the dRTC kept trying to set the time on the Pico's RTC to something in 2001 and immediately crashes. This fix attempts to fetch NTP time if the dRTC is ridiculously off (as defined by an existing function; where the dRTC reports the year to be 2020)