mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-11-12 16:03:50 +00:00
error handling and clear method
This commit is contained in:
parent
f953ac8c62
commit
a7ae976d67
11
API/main.py
11
API/main.py
@ -21,7 +21,8 @@ def display_text():
|
||||
y_coord = data.get('y')
|
||||
|
||||
matrix.text(x_coord, y_coord, text)
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
response['success'] = False
|
||||
|
||||
return jsonify(response)
|
||||
@ -33,7 +34,8 @@ def update_matrix():
|
||||
try:
|
||||
global matrix
|
||||
matrix.update()
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
response['success'] = False
|
||||
|
||||
return jsonify(response)
|
||||
@ -54,9 +56,12 @@ class Matrix(SampleBase):
|
||||
while True:
|
||||
time.sleep(.05)
|
||||
|
||||
def clear(self):
|
||||
self.canvas.Clear()
|
||||
|
||||
def update(self):
|
||||
self.canvas = self.matrix.SwapOnVSync(self.canvas)
|
||||
self.canvas.Clear()
|
||||
self.clear()
|
||||
|
||||
def text(self, x, y, t):
|
||||
graphics.DrawText(self.canvas, self.font, x*9, (y+1)*18, self.color, t)
|
||||
|
Loading…
Reference in New Issue
Block a user