This commit is contained in:
pelgraine
2026-03-26 17:05:58 +11:00
parent adbceea176
commit 85fff12052
2 changed files with 23 additions and 0 deletions

View File

@@ -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();

View File

@@ -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