Show degree character in temperature

This commit is contained in:
Mike Cifelli 2022-12-27 19:49:15 -05:00
parent 11f3ed7679
commit bbc7e505ae
3 changed files with 24 additions and 5 deletions

View File

@ -56,7 +56,7 @@ class CharacterDisplay:
self.unicorn.show()
def displayTimeDots(self, x, y, color,):
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)
@ -64,6 +64,19 @@ class CharacterDisplay:
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)

View File

@ -11,7 +11,7 @@ class TimeDisplay:
self.currentHour = [-1, -1]
self.currentMinute = [-1, -1]
self.currentColor = colors.BLACK
self.color = colors.RED
self.color = colors.PINK
self.hourStartColumn = -1
self.timeDotsColumn = 7
self.minuteStartColumn = 9

View File

@ -5,11 +5,11 @@ class WeatherDisplay:
def __init__(self, characterDisplay, topRow):
self.characterDisplay = characterDisplay
self.topRow = topRow
self.twoDigitStartColumn = 9
self.oneDigitStartColumn = 13
self.twoDigitStartColumn = 6
self.oneDigitStartColumn = 10
self.digitWidth = 4
self.currentTemperature = ''
self.color = colors.PINK
self.color = colors.BLUE
self.weatherFile = 'weather.txt'
def showWeather(self):
@ -52,6 +52,12 @@ class WeatherDisplay:
)
start = start + self.digitWidth
self.characterDisplay.displayDegree(
x=start,
y=self.topRow,
color=self.color
)
def getStartColumn(self, temperature):
return self.oneDigitStartColumn if (self.isOneDigit(temperature)) else self.twoDigitStartColumn