|
@@ -139,20 +139,26 @@ if options.daemon is True:
|
|
|
|
|
|
"""Initialize the display object"""
|
|
|
display = SevenSegment(config.hw_address)
|
|
|
+logger.debug("opened hardware address")
|
|
|
|
|
|
"""Set the brightness according to the configuration"""
|
|
|
if datetime.datetime.now().time() > config.set_brightness_high and \
|
|
|
datetime.datetime.now().time() < config.set_brightness_low:
|
|
|
+ logger.debug("setting display brightness high")
|
|
|
display.setBrightness(config.brightness_high)
|
|
|
else:
|
|
|
+ logger.debug("setting display brightness low")
|
|
|
display.setBrightness(config.brightness_low)
|
|
|
+
|
|
|
"""Define the main loop"""
|
|
|
def main():
|
|
|
while True:
|
|
|
date_now = datetime.datetime.now()
|
|
|
+ logger.debug("got datetime: " + date_now)
|
|
|
minute = date_now.minute
|
|
|
hour = date_now.hour
|
|
|
if config.blink_colon is True:
|
|
|
+ logger.debug("blinking middle colon")
|
|
|
display.setColon(date_now.second %2)
|
|
|
else:
|
|
|
display.setColon(True)
|
|
@@ -162,9 +168,11 @@ def main():
|
|
|
"""
|
|
|
if config.set_brightness_low.hour == hour:
|
|
|
if config.set_brightness_low.minute == minute:
|
|
|
+ logger.debug("setting display brightness low")
|
|
|
display.setBrightness(config.brightness_low)
|
|
|
if config.set_brightness_high.hour == hour:
|
|
|
if config.set_brightness_high.minute == minute:
|
|
|
+ logger.debug("setting display brightness high")
|
|
|
display.setBrightness(config.brightness_high)
|
|
|
try:
|
|
|
position2 = str(hour)[1]
|
|
@@ -181,6 +189,7 @@ def main():
|
|
|
position3 = "0"
|
|
|
else:
|
|
|
position3 = str(minute)[0]
|
|
|
+ logger.debug("writing time to display")
|
|
|
display.writeDigit(0, int(position1))
|
|
|
display.writeDigit(1, int(position2))
|
|
|
display.writeDigit(3, int(position3))
|