Skip to content

Commit 321c4f2

Browse files
Update bmp2led.py
1 parent 619cf2c commit 321c4f2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

CLUE_Light_Painter/bmp2led.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ def process(self, input_filename, output_filename, rows,
261261
# integer 'a' and 'b' row indices, floating 'a' and
262262
# 'b' weights (0.0 to 1.0) for interpolation.
263263
row_b_weight, row_a_index = math.modf(position)
264-
row_a_index = int(row_a_index)
264+
row_a_index = min(int(row_a_index),
265+
self.bmp_specs.height - 1)
265266
row_b_index = (row_a_index + 1) % self.bmp_specs.height
266267
row_a_weight = 1.0 - row_b_weight
267268

0 commit comments

Comments
 (0)