File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
examples/led-matrix-painter/python Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -304,11 +304,13 @@ def play_animation(payload: dict):
304304 animation_bytes = bytearray ()
305305 for frame in frames :
306306 hex_values = frame .to_animation_hex ()
307- # Convert hex strings to uint32_t integers, then to bytes
308- for hex_str in hex_values :
309- value = int (hex_str , 16 )
310- # Pack as 4 bytes, little-endian
307+ # First 4 are hex pixel data
308+ for i in range (4 ):
309+ value = int (hex_values [i ], 16 )
311310 animation_bytes .extend (value .to_bytes (4 , byteorder = 'little' ))
311+ # 5th is duration in ms
312+ duration = int (hex_values [4 ])
313+ animation_bytes .extend (duration .to_bytes (4 , byteorder = 'little' ))
312314
313315 logger .debug (f"Animation data prepared: { len (animation_bytes )} bytes ({ len (animation_bytes )// 20 } frames)" )
314316
You can’t perform that action at this time.
0 commit comments