Don't allow exception to stop updaters

This commit is contained in:
Mike Cifelli 2022-12-28 18:37:32 -05:00
parent bbc7e505ae
commit 460be567c9
3 changed files with 7 additions and 30 deletions

View File

@ -57,37 +57,20 @@ class CharacterDisplay:
self.unicorn.show()
def displayTimeDots(self, x, y, color):
self.setPixel(x, y, colors.BLACK)
self.setPixel(x, y-1, color)
self.setPixel(x, y-2, colors.BLACK)
self.setPixel(x, y-3, color)
self.setPixel(x, y-4, colors.BLACK)
self.unicorn.show()
def displayDegree(self, x, y, color):
self.setPixel(x, y, color)
self.setPixel(x, y-1, color)
self.setPixel(x, y-2, colors.BLACK)
self.setPixel(x, y-3, colors.BLACK)
self.setPixel(x, y-4, colors.BLACK)
self.setPixel(x+1, y, color)
self.setPixel(x+1, y-1, color)
self.setPixel(x+1, y-2, colors.BLACK)
self.setPixel(x+1, y-3, colors.BLACK)
self.setPixel(x+1, y-4, colors.BLACK)
self.unicorn.show()
def displayNegative(self, x, y, color):
self.setPixel(x, y, colors.BLACK)
self.setPixel(x, y-1, colors.BLACK)
self.setPixel(x+1, y, colors.BLACK)
self.setPixel(x+1, y-1, colors.BLACK)
self.setPixel(x, y-2, color)
self.setPixel(x+1, y-2, color)
self.setPixel(x, y-3, colors.BLACK)
self.setPixel(x, y-4, colors.BLACK)
self.setPixel(x+1, y-3, colors.BLACK)
self.setPixel(x+1, y-4, colors.BLACK)
self.unicorn.show()
def displaySquare(self, x, y, outlineColor, fillColor):
@ -100,10 +83,10 @@ class CharacterDisplay:
self.rightSide(x+1, y-2, outlineColor)
self.rightSide(x+1, y-3, outlineColor)
self.leftSide(x+1, y-1, fillColor)
self.leftSide(x+1, y-2, fillColor)
self.leftSide(x+2, y-1, fillColor)
self.leftSide(x+2, y-2, fillColor)
self.setPixel(x+1, y-1, fillColor)
self.setPixel(x+1, y-2, fillColor)
self.setPixel(x+2, y-1, fillColor)
self.setPixel(x+2, y-2, fillColor)
self.unicorn.show()
def displayZero(self, x, y, color):

View File

@ -18,12 +18,9 @@ class GarageUpdater:
try:
state = self.getGarageState()
self.persistGarageState(state)
except requests.exceptions.ConnectionError as e:
except Exception as e:
print(e, flush=True)
self.persistGarageState('{"error": "connection"}')
except requests.exceptions.Timeout as e:
print(e, flush=True)
self.persistGarageState('{"error": "timeout"}')
self.persistGarageState('{"error": "exception"}')
def clearGarageState(self):
self.persistGarageState('{"error": "halted"}')

View File

@ -25,10 +25,7 @@ class WeatherUpdater:
try:
temperature = round(self.getTemperature())
self.persistTemperature(temperature)
except requests.exceptions.ConnectionError as e:
print(e, flush=True)
self.persistTemperature('error')
except requests.exceptions.Timeout as e:
except Exception as e:
print(e, flush=True)
self.persistTemperature('error')