Skip to content

Commit

Permalink
Merge pull request #3 from Zeitungsleser/main
Browse files Browse the repository at this point in the history
fixed post_frame method
  • Loading branch information
KS-HTK authored Dec 6, 2023
2 parents fa055bb + 9eda831 commit 03ff811
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/fluepdot/fluepdot.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,18 @@ def post_frame_raw(self, frame: str) -> Response:


def post_frame(self, frame: List[List[bool]]) -> Response:
data: List[List[str]] = [[" "] * width for _ in range(height)]
for x, l in frame:
for y, b in l:
data: List[List[str]] = [[" "] * self.width for _ in range(self.height)]
for x, l in enumerate(frame):
for y, b in enumerate(l):
if b:
try:
data[x, y] = "X"
data[x][y] = "X"
except IndexError as e:
print(e)
return self._post(frameURL, post=data)
outStr = ""
for line in data:
outStr = outStr + "".join(line) + "\n"
return self._post(frameURL, post=outStr)


def set_pixel(x: int = 0, y: int = 0) -> Response:
Expand Down

0 comments on commit 03ff811

Please sign in to comment.