diff --git a/host/fipy/lib/rtc_time.py b/host/fipy/lib/rtc_time.py index c957d2fc769e405cc7c06e037547ccadc1809341..d57b3944d0e00847266b988349464009d3e0a971 100644 --- a/host/fipy/lib/rtc_time.py +++ b/host/fipy/lib/rtc_time.py @@ -3,14 +3,19 @@ from machine import RTC class RTCTime: - def __init__( - self, - main_ntp_server: str = "pool.ntp.org", - backup_ntp_server: str = "time.nist.gov", - update_interval_seconds: int = 3600, - ): + # def __init__( + # self, + # main_ntp_server: str = "pool.ntp.org", + # backup_ntp_server: str = "time.nist.gov", + # update_interval_seconds: int = 3600, + # ): + # self.rtc = RTC() + # self._setup_ntp(main_ntp_server, backup_ntp_server, update_interval_seconds) + + + def __init__(self, datetime): self.rtc = RTC() - self._setup_ntp(main_ntp_server, backup_ntp_server, update_interval_seconds) + self.rtc.init(datetime) def _setup_ntp( self, main_ntp_server: str, backup_ntp_server: str, update_interval_seconds: int @@ -21,6 +26,8 @@ class RTCTime: print(self.rtc.synced()) sleep(1) + + def get_time(self): return self.rtc.now() diff --git a/host/fipy/main.py b/host/fipy/main.py index 4f51b3de80d3a5452eca45df6d08ca3898394c4c..9e65d65ab025701fe5dd71b5f2f25b2a839d741b 100644 --- a/host/fipy/main.py +++ b/host/fipy/main.py @@ -43,7 +43,7 @@ data.send( ) # data.disconnect() -rtc_time = RTCTime() +rtc_time = RTCTime((2014, 5, 1, 4, 13, 0, 0, 0)) # w = WLAN() # ESPNOW.init()