File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -48,15 +48,17 @@ class NTP:
48
48
This module does not handle daylight savings or local time.
49
49
50
50
:param adafruit_esp32spi esp: ESP32SPI object.
51
+ :param bool debug: Set to True to output set_time() failures to console
51
52
"""
52
53
53
- def __init__ (self , esp ):
54
+ def __init__ (self , esp , debug = False ):
54
55
# Verify ESP32SPI module
55
56
if "ESP_SPIcontrol" in str (type (esp )):
56
57
self ._esp = esp
57
58
else :
58
59
raise TypeError ("Provided object is not an ESP_SPIcontrol object." )
59
60
self .valid_time = False
61
+ self .debug = debug
60
62
61
63
def set_time (self , tz_offset = 0 ):
62
64
"""Fetches and sets the microcontroller's current time
@@ -73,5 +75,6 @@ def set_time(self, tz_offset=0):
73
75
rtc .RTC ().datetime = now
74
76
self .valid_time = True
75
77
except ValueError as error :
76
- print (str (error ))
78
+ if self .debug :
79
+ print (str (error ))
77
80
return
You can’t perform that action at this time.
0 commit comments