mirror of
https://github.com/pelgraine/Meck.git
synced 2026-06-24 20:01:13 +02:00
t5s3 settings screen fix for add channels; t5s3 home screen new message screen refresh fix
This commit is contained in:
@@ -832,11 +832,22 @@ MyMesh the_mesh(radio_driver, fast_rng, rtc_clock, tables, store
|
||||
}
|
||||
}
|
||||
|
||||
// Settings screen: long press on a deletable channel → trigger delete
|
||||
// Settings screen: context-dependent long press
|
||||
if (ui_task.isOnSettingsScreen()) {
|
||||
SettingsScreen* ss = (SettingsScreen*)ui_task.getSettingsScreen();
|
||||
if (ss && ss->isCursorOnDeletableChannel()) {
|
||||
return 'x'; // Triggers existing X key → EDIT_CONFIRM delete flow
|
||||
if (ss) {
|
||||
if (ss->isEditingText()) {
|
||||
// Open VKB pre-populated with current edit buffer
|
||||
ui_task.showVirtualKeyboard(VKB_SETTINGS_TEXT, ss->getEditLabel(),
|
||||
ss->getEditBuf(), SETTINGS_TEXT_BUF - 1);
|
||||
return 0;
|
||||
}
|
||||
if (ss->isEditingNumOrPicker()) {
|
||||
return 0; // Consume — don't confirm prematurely
|
||||
}
|
||||
if (ss->isCursorOnDeletableChannel()) {
|
||||
return 'x'; // Triggers existing X key → EDIT_CONFIRM delete flow
|
||||
}
|
||||
}
|
||||
return KEY_ENTER; // All other settings rows: toggle/edit as normal
|
||||
}
|
||||
|
||||
@@ -484,6 +484,35 @@ public:
|
||||
&& _editMode == EDIT_NONE;
|
||||
}
|
||||
|
||||
// T5S3 VKB integration for text editing (channel name, device name, freq, APN)
|
||||
bool isEditingText() const { return _editMode == EDIT_TEXT; }
|
||||
bool isEditingNumOrPicker() const { return _editMode == EDIT_NUMBER || _editMode == EDIT_PICKER; }
|
||||
const char* getEditBuf() const { return _editBuf; }
|
||||
|
||||
// Get a suitable VKB label for the current text edit field
|
||||
const char* getEditLabel() const {
|
||||
if (_cursor < 0 || _cursor >= _numRows) return "Edit";
|
||||
switch (_rows[_cursor].type) {
|
||||
case ROW_NAME: return "Device Name";
|
||||
case ROW_ADD_CHANNEL: return "Add Channel";
|
||||
case ROW_FREQ: return "Frequency";
|
||||
#ifdef HAS_4G_MODEM
|
||||
case ROW_APN: return "Edit APN";
|
||||
#endif
|
||||
default: return "Edit";
|
||||
}
|
||||
}
|
||||
|
||||
// Fill edit buffer with VKB result and confirm via Enter
|
||||
void submitEditText(const char* text) {
|
||||
int len = strlen(text);
|
||||
if (len >= SETTINGS_TEXT_BUF) len = SETTINGS_TEXT_BUF - 1;
|
||||
memcpy(_editBuf, text, len);
|
||||
_editBuf[len] = '\0';
|
||||
_editPos = len;
|
||||
handleKeyInput('\r'); // trigger existing confirm logic
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// WiFi scan helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -842,7 +842,11 @@ public:
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if defined(LilyGo_T5S3_EPaper_Pro)
|
||||
return _editing_utc ? 700 : 2000; // Faster refresh for touch-only (no key to force update)
|
||||
#else
|
||||
return _editing_utc ? 700 : 5000; // match e-ink refresh cycle while editing UTC
|
||||
#endif
|
||||
}
|
||||
|
||||
bool handleInput(char c) override {
|
||||
@@ -1274,9 +1278,16 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i
|
||||
#endif
|
||||
|
||||
if (_display != NULL) {
|
||||
#if defined(LilyGo_T5S3_EPaper_Pro)
|
||||
// E-ink: always wake — no backlight cost, and stale image shows wrong MSG count
|
||||
if (!_display->isOn()) {
|
||||
_display->turnOn();
|
||||
}
|
||||
#else
|
||||
if (!_display->isOn() && !hasConnection()) {
|
||||
_display->turnOn();
|
||||
}
|
||||
#endif
|
||||
if (_display->isOn()) {
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer
|
||||
_next_refresh = 100; // trigger refresh
|
||||
@@ -1828,6 +1839,14 @@ void UITask::onVKBSubmit() {
|
||||
if (_screenBeforeVKB) setCurrScreen(_screenBeforeVKB);
|
||||
break;
|
||||
}
|
||||
case VKB_SETTINGS_TEXT: {
|
||||
SettingsScreen* ss = (SettingsScreen*)settings_screen;
|
||||
if (ss) {
|
||||
ss->submitEditText(text); // Fills buffer + triggers Enter confirm
|
||||
}
|
||||
if (_screenBeforeVKB) setCurrScreen(_screenBeforeVKB);
|
||||
break;
|
||||
}
|
||||
case VKB_NOTES: {
|
||||
NotesScreen* notes = (NotesScreen*)getNotesScreen();
|
||||
if (notes && strlen(text) > 0) {
|
||||
|
||||
@@ -29,6 +29,7 @@ enum VKBPurpose {
|
||||
VKB_ADMIN_CLI, // Repeater admin CLI command
|
||||
VKB_NOTES, // Insert text into notes
|
||||
VKB_SETTINGS_NAME, // Edit node name
|
||||
VKB_SETTINGS_TEXT, // Generic settings text edit (channel name, freq, APN)
|
||||
VKB_WIFI_PASSWORD, // WiFi password entry (settings screen)
|
||||
#ifdef MECK_WEB_READER
|
||||
VKB_WEB_URL, // Web reader URL entry
|
||||
|
||||
Reference in New Issue
Block a user