44from serial .tools .list_ports import comports
55
66from library .lcd_comm import *
7+ from library .log import logger
78
89
910class Command (IntEnum ):
@@ -23,7 +24,6 @@ def __init__(self):
2324
2425 def __del__ (self ):
2526 try :
26- print ("close serial" )
2727 self .lcd_serial .close ()
2828 except :
2929 pass
@@ -60,7 +60,7 @@ def WriteData(self, byteBuffer: bytearray):
6060 self .lcd_serial .write (bytes (byteBuffer ))
6161 except serial .serialutil .SerialTimeoutException :
6262 # We timed-out trying to write to our device, slow things down.
63- print ("(Write data) Too fast! Slow down!" )
63+ logger . warn ("(Write data) Too fast! Slow down!" )
6464
6565 def SendLine (self , line : bytes ):
6666 config .update_queue .put ((self .WriteLine , [line ]))
@@ -70,14 +70,14 @@ def WriteLine(self, line: bytes):
7070 self .lcd_serial .write (line )
7171 except serial .serialutil .SerialTimeoutException :
7272 # We timed-out trying to write to our device, slow things down.
73- print ("(Write line) Too fast! Slow down!" )
73+ logger . warn ("(Write line) Too fast! Slow down!" )
7474
7575 def InitializeComm (self ):
7676 # HW revision A does not need init commands
7777 pass
7878
7979 def Reset (self ):
80- print ("Display reset..." )
80+ logger . info ("Display reset..." )
8181 # Reset command bypasses queue because it is run when queue threads are not yet started
8282 self .SendCommand (Command .RESET , 0 , 0 , 0 , 0 , bypass_queue = True )
8383 # Wait for display reset then reconnect
@@ -106,7 +106,7 @@ def SetBrightness(self, level: int = CONFIG_DATA["display"]["BRIGHTNESS"]):
106106 self .SendCommand (Command .SET_BRIGHTNESS , level_absolute , 0 , 0 , 0 )
107107
108108 def SetBackplateLedColor (self , led_color : tuple [int , int , int ] = THEME_DATA ['display' ]["DISPLAY_RGB_LED" ]):
109- print ("HW revision A does not support backplate LED color setting" )
109+ logger . info ("HW revision A does not support backplate LED color setting" )
110110 pass
111111
112112 def SetOrientation (self , orientation : Orientation = get_theme_orientation ()):
0 commit comments