Fix Weave() for horizontally mirrored display (NeoPixel 0 at top-right)

This commit is contained in:
2025-10-26 18:08:26 +00:00
parent 1a4a1ec9e5
commit dc4eebfa84

View File

@@ -167,10 +167,13 @@ class Display(object):
return(int(Number/self.Columns)) return(int(Number/self.Columns))
def Weave(self,Pos): 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) Row=self.Num2Row(Pos)
if Row%2 == 1: Col=self.Num2Column(Pos)
NewPos=(Row+1)*self.Columns-self.Num2Column(Pos)-1 if Row%2 == 0: # Even rows go right-to-left (mirrored from original)
else: NewPos=Row*self.Columns+(self.Columns-1-Col)
else: # Odd rows go left-to-right
NewPos=Pos NewPos=Pos
return NewPos return NewPos