|
@@ -196,12 +196,17 @@ class CaseLights():
|
196
|
196
|
self.serial = serial.Serial()
|
197
|
197
|
self.serial.port = self.usedPort
|
198
|
198
|
self.serial.baudrate = 115200
|
199
|
|
- self.serial.open()
|
200
|
|
- if self.serial.is_open:
|
201
|
|
- print("connected to: " + self.usedPort)
|
202
|
|
- else:
|
|
199
|
+
|
|
200
|
+ try:
|
|
201
|
+ self.serial.open()
|
|
202
|
+ if self.serial.is_open:
|
|
203
|
+ print("connected to: " + self.usedPort)
|
|
204
|
+ else:
|
|
205
|
+ print("error connecting to: " + self.usedPort)
|
|
206
|
+ return self.serial.is_open
|
|
207
|
+ except serial.serialutil.SerialException:
|
203
|
208
|
print("error connecting to: " + self.usedPort)
|
204
|
|
- return self.serial.is_open
|
|
209
|
+ return False
|
205
|
210
|
|
206
|
211
|
def printRGBStrings(self, rs, gs, bs):
|
207
|
212
|
if self.serial.is_open:
|