forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Milestone
Description
Firmware
Adafruit CircuitPython 6.2.0 "adafruit-circuitpython-feather_m4_express-en_GB-6.2.0.uf2"; Feather M4 Express
Code/REPL
import rtc
import time
import supervisor
my_real_time_clock = rtc.RTC() #Uses Internal ADC on AtSAMD51
#To set the time one has to run this script with the following line uncommented.
#With the Lipoly battery connected to the Feather, the internal RTC keeps correct time, even when pressing the reset button
#This should only be needed to run once in the lifetime of the project
#my_real_time_clock.datetime = time.struct_time((2021, 04, 08, 08, 54, 05, 0, -1, -1))
while True:
current_time = my_real_time_clock.datetime
my_datestring = "{:2d}".format(current_time.tm_year) + "/{:02d}".format(current_time.tm_mon) + "/{:02d}".format(current_time.tm_mday)
my_timestring = "{:02d}".format(current_time.tm_hour) + ":{:02d}".format(current_time.tm_min) + ":{:02d}".format(current_time.tm_sec)
if supervisor.runtime.serial_connected:
print ("Time : ", my_datestring, " ", my_timestring, "\n", sep = "")
time.sleep(1)
Behavior
Code runs fine, except that the following now with Circuitpython 6.2.0 has to be set everytime the Feater is reset, whereas with Circuitpython 5.3.1 the RTC kept track of time even when the reset button was pressed
my_real_time_clock.datetime = time.struct_time((2021, 04, 08, 08, 54, 05, 0, -1, -1))
Description
I am using the internal RTC on the AtSAMD51 to keep time in a project I am working on.
Under CircuitPython 5.3.1 the values stored in the internal RTC of the AtSAMD51 was not cleared when pressing the reset button
With CircuitPython 6.2.0 the internal RTC values are cleared when pressing reset
Additional Info
None