4
4
from serial .tools .list_ports import comports
5
5
6
6
from library .lcd_comm import *
7
+ from library .log import logger
7
8
8
9
9
10
class Command (IntEnum ):
@@ -23,7 +24,6 @@ def __init__(self):
23
24
24
25
def __del__ (self ):
25
26
try :
26
- print ("close serial" )
27
27
self .lcd_serial .close ()
28
28
except :
29
29
pass
@@ -60,7 +60,7 @@ def WriteData(self, byteBuffer: bytearray):
60
60
self .lcd_serial .write (bytes (byteBuffer ))
61
61
except serial .serialutil .SerialTimeoutException :
62
62
# 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!" )
64
64
65
65
def SendLine (self , line : bytes ):
66
66
config .update_queue .put ((self .WriteLine , [line ]))
@@ -70,14 +70,14 @@ def WriteLine(self, line: bytes):
70
70
self .lcd_serial .write (line )
71
71
except serial .serialutil .SerialTimeoutException :
72
72
# 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!" )
74
74
75
75
def InitializeComm (self ):
76
76
# HW revision A does not need init commands
77
77
pass
78
78
79
79
def Reset (self ):
80
- print ("Display reset..." )
80
+ logger . info ("Display reset..." )
81
81
# Reset command bypasses queue because it is run when queue threads are not yet started
82
82
self .SendCommand (Command .RESET , 0 , 0 , 0 , 0 , bypass_queue = True )
83
83
# Wait for display reset then reconnect
@@ -106,7 +106,7 @@ def SetBrightness(self, level: int = CONFIG_DATA["display"]["BRIGHTNESS"]):
106
106
self .SendCommand (Command .SET_BRIGHTNESS , level_absolute , 0 , 0 , 0 )
107
107
108
108
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" )
110
110
pass
111
111
112
112
def SetOrientation (self , orientation : Orientation = get_theme_orientation ()):
0 commit comments