cleaned up

This commit is contained in:
2021-01-07 14:53:50 +01:00
parent 1abe7b1773
commit d737de33dc
2 changed files with 6 additions and 7 deletions

View File

@@ -55,7 +55,6 @@ class LedMatrix:
return math.floor(n * multiplier) / multiplier return math.floor(n * multiplier) / multiplier
def xy_to_phys(self, x, y): def xy_to_phys(self, x, y):
""" """
Map x,y to physical LED address after accounting for display rotation Map x,y to physical LED address after accounting for display rotation
@@ -74,16 +73,16 @@ class LedMatrix:
x = y x = y
y = self.columns-1-tmp y = self.columns-1-tmp
# The LEDs are laid out in a long string going from north to south, # The LEDs are laid out in a long string going from north to south,
# one step to the east, and then south to north, before the cycle # one step to the east, and then south to north, before thxy e cycle
# starts over. # starts over.
stride = self.stride stride = self.stride
phys_addr = ((x-1)%self.panelcolumn) + ((y-1)*self.panelcolumn) + (self.round_down((x-1)/self.panelcolumn) * self.panelcolumn * self.panelcolumn) phys_addr = ((x)%self.panelcolumn) + ((y)*self.panelcolumn) + (self.round_down((x)/self.panelcolumn) * self.panelcolumn * self.panelcolumn)
#MOD(x-1;panelCol) + ((y-1)*panelCol) + (FLOOR.MATH((x-1)/panelCol;1)*panelCol*panelRow)
# if x & 1: # if x & 1:
# phys_addr += stride - 1 - y # phys_addr += stride - 1 - y
# else: # else:
# phys_addr += y # phys_addr += y
# return phys_addr return phys_addr
def get_pixel(self, x, y): def get_pixel(self, x, y):
""" """

View File

@@ -29,8 +29,8 @@ class WeatherScene:
self.icon = None self.icon = None
self.debug = False self.debug = False
self.intensity = 16 self.intensity = 16
self.lat = 59.3293 self.lat = 51.666664
self.lon = 18.0686 self.lon = 5.3666652
self.api_url = 'https://opendata-download-metfcst.smhi.se' self.api_url = 'https://opendata-download-metfcst.smhi.se'
self.headers = { self.headers = {
'User-Agent':'weatherscene.py/1.0 (+https://github.com/noahwilliamsson/lamatrix)', 'User-Agent':'weatherscene.py/1.0 (+https://github.com/noahwilliamsson/lamatrix)',