mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-11-14 08:53:49 +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')
|
y_coord = data.get('y')
|
||||||
|
|
||||||
matrix.text(x_coord, y_coord, text)
|
matrix.text(x_coord, y_coord, text)
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
response['success'] = False
|
response['success'] = False
|
||||||
|
|
||||||
return jsonify(response)
|
return jsonify(response)
|
||||||
@ -33,7 +34,8 @@ def update_matrix():
|
|||||||
try:
|
try:
|
||||||
global matrix
|
global matrix
|
||||||
matrix.update()
|
matrix.update()
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
response['success'] = False
|
response['success'] = False
|
||||||
|
|
||||||
return jsonify(response)
|
return jsonify(response)
|
||||||
@ -54,9 +56,12 @@ class Matrix(SampleBase):
|
|||||||
while True:
|
while True:
|
||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
self.canvas.Clear()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self.canvas = self.matrix.SwapOnVSync(self.canvas)
|
self.canvas = self.matrix.SwapOnVSync(self.canvas)
|
||||||
self.canvas.Clear()
|
self.clear()
|
||||||
|
|
||||||
def text(self, x, y, t):
|
def text(self, x, y, t):
|
||||||
graphics.DrawText(self.canvas, self.font, x*9, (y+1)*18, self.color, t)
|
graphics.DrawText(self.canvas, self.font, x*9, (y+1)*18, self.color, t)
|
||||||
|
Loading…
Reference in New Issue
Block a user