gui: add support for qrcode brightness levels
What changed, and why it matters
This commit adds a user-facing feature that lets the device cycle through different brightness/contrast colors when displaying QR codes, to make them easier to scan with different phones or lighting. There is no security-relevant change here.
No security action needed; treat as a normal feature commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch introduces a small color palette (gui_qrcode_colors), a default index that differs by hardware target (ESP32-S3 uses a brighter high-contrast color, others use a dimmer one), and accessor functions gui_get_qrcode_color() and gui_next_qrcode_color(). It only affects QR code rendering appearance and is a pure GUI/usability enhancement.
Changed components
main/gui.cmain/gui.hInspect captured patch +21 / −0
diff --git a/main/gui.c b/main/gui.c
index 004baf2..de167db 100644
--- a/main/gui.c
+++ b/main/gui.c
@@ -80,6 +80,13 @@ static RingbufHandle_t gui_input_queue = NULL;
// and which gui highlight colour is in use
static gui_event_t gui_click_event = GUI_FRONT_CLICK_EVENT;
static color_t gui_highlight_color = 0;
+static const color_t gui_qrcode_colors[5] = { 0xa210, 0x494a, 0xef7b, 0x18c6, 0xffff };
+#ifdef CONFIG_IDF_TARGET_ESP32S3
+// V2 QR codes scan better with a higher contrast background
+static uint8_t gui_qrcode_color_idx = 4;
+#else
+static uint8_t gui_qrcode_color_idx = 1;
+#endif
static bool gui_orientation_flipped = false;
// status bar
@@ -231,6 +238,17 @@ void gui_set_highlight_color(const uint8_t theme)
}
}
+color_t gui_get_qrcode_color(void) { return gui_qrcode_colors[gui_qrcode_color_idx]; }
+
+void gui_next_qrcode_color(void)
+{
+ uint8_t idx = gui_qrcode_color_idx + 1;
+ if (idx >= sizeof(gui_qrcode_colors) / sizeof(gui_qrcode_colors[0])) {
+ idx = 0; // wrap around
+ }
+ gui_qrcode_color_idx = idx;
+}
+
bool gui_get_flipped_orientation(void) { return gui_orientation_flipped; }
bool gui_set_flipped_orientation(const bool flipped_orientation)
diff --git a/main/gui.h b/main/gui.h
index 3e39ee3..359e755 100644
--- a/main/gui.h
+++ b/main/gui.h
@@ -405,6 +405,9 @@ void gui_set_click_event(bool use_wheel_click);
color_t gui_get_highlight_color(void);
void gui_set_highlight_color(uint8_t theme);
+color_t gui_get_qrcode_color(void);
+void gui_next_qrcode_color(void);
+
bool gui_get_flipped_orientation(void);
bool gui_set_flipped_orientation(bool flipped_orientation);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.