Fix Weave() for horizontally mirrored display (NeoPixel 0 at top-right)
This commit is contained in:
@@ -167,10 +167,13 @@ class Display(object):
|
||||
return(int(Number/self.Columns))
|
||||
|
||||
def Weave(self,Pos):
|
||||
"""Convert logical position to physical LED position for horizontally mirrored display.
|
||||
NeoPixel 0 is at top-right, serpentine wiring pattern."""
|
||||
Row=self.Num2Row(Pos)
|
||||
if Row%2 == 1:
|
||||
NewPos=(Row+1)*self.Columns-self.Num2Column(Pos)-1
|
||||
else:
|
||||
Col=self.Num2Column(Pos)
|
||||
if Row%2 == 0: # Even rows go right-to-left (mirrored from original)
|
||||
NewPos=Row*self.Columns+(self.Columns-1-Col)
|
||||
else: # Odd rows go left-to-right
|
||||
NewPos=Pos
|
||||
return NewPos
|
||||
|
||||
|
||||
Reference in New Issue
Block a user