Skip to content

Commit

Permalink
avoid ZeroDivisionError with ssd1327
Browse files Browse the repository at this point in the history
rows_per_buffer is 104/106, which rounds/truncates to zero, causing ZeroDivisionError on line 371 (subrectangles=...).
  • Loading branch information
douglaspkelly authored Aug 17, 2024
1 parent 06038e9 commit 229340e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions busdisplay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ def _refresh_area(self, area) -> bool:
pixels_per_byte = 8 // self._core.colorspace.depth
if rows_per_buffer % pixels_per_byte != 0:
rows_per_buffer -= rows_per_buffer % pixels_per_byte
if rows_per_buffer == 0:
rows_per_buffer = 1
subrectangles = clipped.height() // rows_per_buffer
if clipped.height() % rows_per_buffer != 0:
subrectangles += 1
Expand Down

0 comments on commit 229340e

Please sign in to comment.