From 9c4c374db893abfb9d9339811d0b3df6b1011ba9 Mon Sep 17 00:00:00 2001 From: pelgraine <140762863+pelgraine@users.noreply.github.com> Date: Sat, 2 May 2026 10:07:49 +1000 Subject: [PATCH] added has meck fonts build flag to draft max platformio; new fast scroll implementation update with next page scroll function with shift+w/s; updated home page hint text to make it clearer you can press enter to toggle on/off/send adverts etc --- examples/companion_radio/main.cpp | 34 +++++++++++++++++++ .../companion_radio/ui-new/Contactsscreen.h | 18 ++++++++-- .../companion_radio/ui-new/Discoveryscreen.h | 18 ++++++++-- .../companion_radio/ui-new/Lastheardscreen.h | 18 ++++++++-- examples/companion_radio/ui-new/Notesscreen.h | 18 ++++++++-- .../companion_radio/ui-new/Settingsscreen.h | 24 +++++++++++-- .../companion_radio/ui-new/Textreaderscreen.h | 18 ++++++++-- examples/companion_radio/ui-new/UITask.cpp | 9 +++-- .../lilygo_tdeck_pro_max_WIP/platformio.ini | 1 + 9 files changed, 142 insertions(+), 16 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index c94fa50e..9a073c15 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -4567,6 +4567,23 @@ void handleKeyboardInput() { ui_task.gotoNotesScreen(); break; + case 'S': + // Shift+S: page scroll down on list screens + if (ui_task.isOnChannelScreen() || ui_task.isOnContactsScreen() || ui_task.isOnRepeaterAdmin() + || ui_task.isOnDiscoveryScreen() || ui_task.isOnLastHeardScreen() + || ui_task.isOnPathEditor() || ui_task.isOnChannelPickerScreen() +#ifdef MECK_WEB_READER + || ui_task.isOnWebReader() +#endif + || ui_task.isOnMapScreen() +#ifdef MECK_AUDIO_VARIANT + || ui_task.isOnAlarmScreen() +#endif + ) { + ui_task.injectKey('S'); + } + break; + case 's': // Open settings (from home), or navigate down on channel/contacts/admin/web/map/discovery/lastheard if (ui_task.isOnChannelScreen() || ui_task.isOnContactsScreen() || ui_task.isOnRepeaterAdmin() @@ -4587,6 +4604,23 @@ void handleKeyboardInput() { } break; + case 'W': + // Shift+W: page scroll up on list screens + if (ui_task.isOnChannelScreen() || ui_task.isOnContactsScreen() || ui_task.isOnRepeaterAdmin() + || ui_task.isOnDiscoveryScreen() || ui_task.isOnLastHeardScreen() + || ui_task.isOnPathEditor() || ui_task.isOnChannelPickerScreen() +#ifdef MECK_WEB_READER + || ui_task.isOnWebReader() +#endif + || ui_task.isOnMapScreen() +#ifdef MECK_AUDIO_VARIANT + || ui_task.isOnAlarmScreen() +#endif + ) { + ui_task.injectKey('W'); + } + break; + case 'w': // Navigate up/previous (scroll on channel screen) if (ui_task.isOnChannelScreen() || ui_task.isOnContactsScreen() || ui_task.isOnRepeaterAdmin() diff --git a/examples/companion_radio/ui-new/Contactsscreen.h b/examples/companion_radio/ui-new/Contactsscreen.h index 34b7c9b9..834faafb 100644 --- a/examples/companion_radio/ui-new/Contactsscreen.h +++ b/examples/companion_radio/ui-new/Contactsscreen.h @@ -495,16 +495,30 @@ public: } bool handleInput(char c) override { + // Shift+W: page up + if (c == 'W') { + int pageSize = (128 - 14 - 14) / the_mesh.getNodePrefs()->smallLineH(); + if (pageSize < 3) pageSize = 3; + _scrollPos = max(0, _scrollPos - pageSize); + return true; + } // W - scroll up (previous contact) - if (c == 'w' || c == 'W' || c == 0xF2) { + if (c == 'w' || c == 0xF2) { if (_scrollPos > 0) { _scrollPos--; return true; } } + // Shift+S: page down + if (c == 'S') { + int pageSize = (128 - 14 - 14) / the_mesh.getNodePrefs()->smallLineH(); + if (pageSize < 3) pageSize = 3; + _scrollPos = min(_filteredCount - 1, _scrollPos + pageSize); + return true; + } // S - scroll down (next contact) - if (c == 's' || c == 'S' || c == 0xF1) { + if (c == 's' || c == 0xF1) { if (_scrollPos < _filteredCount - 1) { _scrollPos++; return true; diff --git a/examples/companion_radio/ui-new/Discoveryscreen.h b/examples/companion_radio/ui-new/Discoveryscreen.h index b7c37e77..9a5a9318 100644 --- a/examples/companion_radio/ui-new/Discoveryscreen.h +++ b/examples/companion_radio/ui-new/Discoveryscreen.h @@ -217,16 +217,30 @@ public: bool handleInput(char c) override { int count = the_mesh.getDiscoveredCount(); + // Shift+W: page up + if (c == 'W') { + int pageSize = (128 - 14 - 14) / the_mesh.getNodePrefs()->smallLineH(); + if (pageSize < 3) pageSize = 3; + _scrollPos = max(0, _scrollPos - pageSize); + return true; + } // W - scroll up - if (c == 'w' || c == 'W' || c == 0xF2) { + if (c == 'w' || c == 0xF2) { if (_scrollPos > 0) { _scrollPos--; return true; } } + // Shift+S: page down + if (c == 'S') { + int pageSize = (128 - 14 - 14) / the_mesh.getNodePrefs()->smallLineH(); + if (pageSize < 3) pageSize = 3; + _scrollPos = min(count - 1, _scrollPos + pageSize); + return true; + } // S - scroll down - if (c == 's' || c == 'S' || c == 0xF1) { + if (c == 's' || c == 0xF1) { if (_scrollPos < count - 1) { _scrollPos++; return true; diff --git a/examples/companion_radio/ui-new/Lastheardscreen.h b/examples/companion_radio/ui-new/Lastheardscreen.h index bf95e2e8..3c2f27e7 100644 --- a/examples/companion_radio/ui-new/Lastheardscreen.h +++ b/examples/companion_radio/ui-new/Lastheardscreen.h @@ -223,14 +223,28 @@ public: } bool handleInput(char c) override { + // Shift+W: page up + if (c == 'W') { + int pageSize = (128 - 14 - 14) / the_mesh.getNodePrefs()->smallLineH(); + if (pageSize < 3) pageSize = 3; + _scrollPos = max(0, _scrollPos - pageSize); + return true; + } // Scroll up - if (c == 'w' || c == 'W' || c == 0xF2) { + if (c == 'w' || c == 0xF2) { if (_scrollPos > 0) { _scrollPos--; return true; } return false; } + // Shift+S: page down + if (c == 'S') { + int pageSize = (128 - 14 - 14) / the_mesh.getNodePrefs()->smallLineH(); + if (pageSize < 3) pageSize = 3; + _scrollPos = min(_count - 1, _scrollPos + pageSize); + return true; + } // Scroll down - if (c == 's' || c == 'S' || c == 0xF1) { + if (c == 's' || c == 0xF1) { if (_scrollPos < _count - 1) { _scrollPos++; return true; } return false; } diff --git a/examples/companion_radio/ui-new/Notesscreen.h b/examples/companion_radio/ui-new/Notesscreen.h index 74f1ceb1..4ef4d782 100644 --- a/examples/companion_radio/ui-new/Notesscreen.h +++ b/examples/companion_radio/ui-new/Notesscreen.h @@ -909,12 +909,26 @@ private: bool handleFileListInput(char c) { int totalItems = 1 + (int)_fileList.size(); - if (c == 'w' || c == 'W' || c == 0xF2) { + // Shift+W: page up + if (c == 'W') { + int pageSize = (128 - 14 - 14) / _prefs->smallLineH(); + if (pageSize < 3) pageSize = 3; + _selectedFile = max(0, _selectedFile - pageSize); + return true; + } + if (c == 'w' || c == 0xF2) { if (_selectedFile > 0) { _selectedFile--; return true; } return false; } - if (c == 's' || c == 'S' || c == 0xF1) { + // Shift+S: page down + if (c == 'S') { + int pageSize = (128 - 14 - 14) / _prefs->smallLineH(); + if (pageSize < 3) pageSize = 3; + _selectedFile = min(totalItems - 1, _selectedFile + pageSize); + return true; + } + if (c == 's' || c == 0xF1) { if (_selectedFile < totalItems - 1) { _selectedFile++; return true; } return false; } diff --git a/examples/companion_radio/ui-new/Settingsscreen.h b/examples/companion_radio/ui-new/Settingsscreen.h index b323d49e..38b0d62f 100644 --- a/examples/companion_radio/ui-new/Settingsscreen.h +++ b/examples/companion_radio/ui-new/Settingsscreen.h @@ -2996,8 +2996,17 @@ public: // --- Normal browsing mode --- - // W/S: navigate - if (c == 'w' || c == 'W') { + // W/S: navigate, Shift+W/S: page scroll + if (c == 'W') { + // Shift+W: page up + int pageSize = (128 - 14 - 14) / _prefs->smallLineH(); + if (pageSize < 3) pageSize = 3; + _cursor = max(0, _cursor - pageSize); + skipNonSelectable(-1); + Serial.printf("Settings: page up cursor=%d/%d\n", _cursor, _numRows); + return true; + } + if (c == 'w') { if (_cursor > 0) { _cursor--; skipNonSelectable(-1); @@ -3005,7 +3014,16 @@ public: Serial.printf("Settings: cursor=%d/%d row=%d\n", _cursor, _numRows, _rows[_cursor].type); return true; } - if (c == 's' || c == 'S') { + if (c == 'S') { + // Shift+S: page down + int pageSize = (128 - 14 - 14) / _prefs->smallLineH(); + if (pageSize < 3) pageSize = 3; + _cursor = min(_numRows - 1, _cursor + pageSize); + skipNonSelectable(1); + Serial.printf("Settings: page down cursor=%d/%d\n", _cursor, _numRows); + return true; + } + if (c == 's') { if (_cursor < _numRows - 1) { _cursor++; skipNonSelectable(1); diff --git a/examples/companion_radio/ui-new/Textreaderscreen.h b/examples/companion_radio/ui-new/Textreaderscreen.h index 665b9077..b7b5114d 100644 --- a/examples/companion_radio/ui-new/Textreaderscreen.h +++ b/examples/companion_radio/ui-new/Textreaderscreen.h @@ -1811,8 +1811,15 @@ public: bool handleFileListInput(char c) { int total = totalListItems(); + // Shift+W: page up + if (c == 'W') { + int pageSize = (128 - 14 - 14) / _prefs->smallLineH(); + if (pageSize < 3) pageSize = 3; + _selectedFile = max(0, _selectedFile - pageSize); + return true; + } // W - scroll up - if (c == 'w' || c == 'W' || c == 0xF2) { + if (c == 'w' || c == 0xF2) { if (_selectedFile > 0) { _selectedFile--; return true; @@ -1820,8 +1827,15 @@ public: return false; } + // Shift+S: page down + if (c == 'S') { + int pageSize = (128 - 14 - 14) / _prefs->smallLineH(); + if (pageSize < 3) pageSize = 3; + _selectedFile = min(total - 1, _selectedFile + pageSize); + return true; + } // S - scroll down - if (c == 's' || c == 'S' || c == 0xF1) { + if (c == 's' || c == 0xF1) { if (_selectedFile < total - 1) { _selectedFile++; return true; diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 853c8ca9..8ca80cf6 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -716,7 +716,8 @@ public: #if defined(LilyGo_T5S3_EPaper_Pro) display.drawTextCentered(display.width() / 2, 80, "toggle: " PRESS_LABEL); #else - display.drawTextCentered(display.width() / 2, 72, "toggle: " PRESS_LABEL); + display.drawTextCentered(display.width() / 2, 68, "toggle: " PRESS_LABEL); + display.drawTextCentered(display.width() / 2, 78, "or press Enter key"); #endif #endif #ifdef MECK_WIFI_COMPANION @@ -768,7 +769,8 @@ public: #if defined(LilyGo_T5S3_EPaper_Pro) display.drawTextCentered(display.width() / 2, 64, "advert: " PRESS_LABEL); #else - display.drawTextCentered(display.width() / 2, 64 - 11, "advert: " PRESS_LABEL); + display.drawTextCentered(display.width() / 2, 57, "advert: " PRESS_LABEL); + display.drawTextCentered(display.width() / 2, 67, "or press Enter key"); #endif #if ENV_INCLUDE_GPS == 1 } else if (_page == HomePage::GPS) { @@ -1010,7 +1012,8 @@ public: #if defined(LilyGo_T5S3_EPaper_Pro) display.drawTextCentered(display.width() / 2, 64, "hibernate:" PRESS_LABEL); #else - display.drawTextCentered(display.width() / 2, 64 - 11, "hibernate:" PRESS_LABEL); + display.drawTextCentered(display.width() / 2, 57, "hibernate: " PRESS_LABEL); + display.drawTextCentered(display.width() / 2, 67, "or press Enter key"); #endif } } diff --git a/variants/lilygo_tdeck_pro_max_WIP/platformio.ini b/variants/lilygo_tdeck_pro_max_WIP/platformio.ini index 5b5889f6..ff9fe026 100644 --- a/variants/lilygo_tdeck_pro_max_WIP/platformio.ini +++ b/variants/lilygo_tdeck_pro_max_WIP/platformio.ini @@ -132,6 +132,7 @@ build_flags = -D CST328_PIN_INT=12 -D CST328_PIN_RST=-1 -D ARDUINO_LOOP_STACK_SIZE=32768 + -D HAS_MECK_FONTS build_src_filter = ${esp32_base.build_src_filter} ; Include TDeckBoard.cpp from V1.1 (parent class with BQ27220 code) +<../variants/LilyGo_TDeck_Pro/TDeckBoard.cpp>