From 6a5e797e4bbd81409a333e1fe24b59adc6783866 Mon Sep 17 00:00:00 2001 From: lucarin91 Date: Fri, 19 Dec 2025 17:51:20 +0100 Subject: [PATCH 1/3] fix(led-matrix painter): fix c++ code preview generation --- examples/led-matrix-painter/python/app_frame.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/led-matrix-painter/python/app_frame.py b/examples/led-matrix-painter/python/app_frame.py index db66c9b..22362ca 100644 --- a/examples/led-matrix-painter/python/app_frame.py +++ b/examples/led-matrix-painter/python/app_frame.py @@ -146,10 +146,11 @@ def to_c_string(self) -> str: Returns: str: C source fragment containing a const array initializer. """ - c_type = "uint32_t" + c_type = "uint8_t" + snake_name = self.name.lower().replace(" ", "_") scaled_arr = self.rescale_quantized_frame(scale_max=255) - parts = [f"const {c_type} {self.name}[] = {{"] + parts = [f"{c_type} {snake_name}[] = {{"] rows = scaled_arr.tolist() # Emit the array as row-major integer values, preserving row breaks for readability for r_idx, row in enumerate(rows): From 164c5996954ae214d6424ca667965b92751b2928 Mon Sep 17 00:00:00 2001 From: lucarin91 Date: Fri, 19 Dec 2025 18:01:17 +0100 Subject: [PATCH 2/3] fixup! fix(led-matrix painter): fix c++ code preview generation --- examples/led-matrix-painter/python/app_frame.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/led-matrix-painter/python/app_frame.py b/examples/led-matrix-painter/python/app_frame.py index 22362ca..cf49a54 100644 --- a/examples/led-matrix-painter/python/app_frame.py +++ b/examples/led-matrix-painter/python/app_frame.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: MPL-2.0 import json +import re from arduino.app_utils import Frame class AppFrame(Frame): @@ -147,10 +148,10 @@ def to_c_string(self) -> str: str: C source fragment containing a const array initializer. """ c_type = "uint8_t" - snake_name = self.name.lower().replace(" ", "_") + snake_name = re.sub(r'[^a-zA-Z0-9]', '_', self.name.lower()) scaled_arr = self.rescale_quantized_frame(scale_max=255) - parts = [f"{c_type} {snake_name}[] = {{"] + parts = [f"const {c_type} {snake_name} [] = {{"] rows = scaled_arr.tolist() # Emit the array as row-major integer values, preserving row breaks for readability for r_idx, row in enumerate(rows): From 271103baf332a17b09200467fddc7edf139130b4 Mon Sep 17 00:00:00 2001 From: lucarin91 Date: Fri, 19 Dec 2025 18:02:22 +0100 Subject: [PATCH 3/3] fixup! fixup! fix(led-matrix painter): fix c++ code preview generation --- examples/led-matrix-painter/python/app_frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/led-matrix-painter/python/app_frame.py b/examples/led-matrix-painter/python/app_frame.py index cf49a54..b72431b 100644 --- a/examples/led-matrix-painter/python/app_frame.py +++ b/examples/led-matrix-painter/python/app_frame.py @@ -151,7 +151,7 @@ def to_c_string(self) -> str: snake_name = re.sub(r'[^a-zA-Z0-9]', '_', self.name.lower()) scaled_arr = self.rescale_quantized_frame(scale_max=255) - parts = [f"const {c_type} {snake_name} [] = {{"] + parts = [f"{c_type} {snake_name} [] = {{"] rows = scaled_arr.tolist() # Emit the array as row-major integer values, preserving row breaks for readability for r_idx, row in enumerate(rows):