diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index b3c3753..291128c 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -2564,6 +2564,21 @@ void handleKeyboardInput() { // Still read the key above to clear the TCA8418 buffer. if (ui_task.isLocked()) return; + // Alt+B backlight toggle (T-Deck Pro MAX — working front-light on IO41) + // Cycles: off → low → medium → full → off + // Works from any screen; processed before anything else so it never + // leaks into compose buffers or screen handlers. + #ifdef LilyGo_TDeck_Pro_Max + if (key == KB_KEY_BACKLIGHT) { + static uint8_t blLevel = 0; // 0=off, 1=low, 2=med, 3=full + blLevel = (blLevel + 1) & 3; + const uint8_t levels[] = {0, 64, 160, 255}; + board.backlightSetBrightness(levels[blLevel]); + Serial.printf("Backlight: level %d (%d/255)\n", blLevel, levels[blLevel]); + return; + } + #endif + // Dismiss boot navigation hint on any keypress if (ui_task.isHintActive()) { ui_task.dismissBootHint(); diff --git a/variants/lilygo_tdeck_pro_max/Tca8418keyboard.h b/variants/lilygo_tdeck_pro_max/Tca8418keyboard.h index fb0cfef..4e5635a 100644 --- a/variants/lilygo_tdeck_pro_max/Tca8418keyboard.h +++ b/variants/lilygo_tdeck_pro_max/Tca8418keyboard.h @@ -22,6 +22,7 @@ #define KB_KEY_ENTER '\r' #define KB_KEY_SPACE ' ' #define KB_KEY_EMOJI 0x01 // Non-printable code for $ key (emoji picker) +#define KB_KEY_BACKLIGHT 0x02 // Non-printable code for Alt+B (backlight toggle, MAX only) class TCA8418Keyboard { private: @@ -290,6 +291,13 @@ public: // Get the character char c = 0; + // Alt+B -> backlight toggle (T-Deck Pro MAX only — working front-light on IO41) + if (_altActive && keyCode == 25) { // keyCode 25 = B + _altActive = false; + Serial.println("KB: Alt+B -> backlight toggle"); + return KB_KEY_BACKLIGHT; + } + if (_altActive) { c = getAltChar(keyCode); _altActive = false; // Reset sticky alt