fix: 节点列表禁用自动切换,改为上下键控制

- 禁用 autoCycleEnabled,停止自动切换模式
- 添加 switchToNextMode/switchToPrevMode/getCurrentMode 函数
- 在 Screen.cpp 中添加 UP/DOWN 按键处理来切换模式
This commit is contained in:
2026-03-30 20:10:14 +08:00
parent 4fad0c7d6e
commit 767527b4f9
3 changed files with 41 additions and 2 deletions
@@ -1596,6 +1596,20 @@ int Screen::handleInputEvent(const InputEvent *event)
showPrevFrame();
} else if (event->inputEvent == INPUT_BROKER_RIGHT || event->inputEvent == INPUT_BROKER_USER_PRESS) {
showNextFrame();
} else if (event->inputEvent == INPUT_BROKER_UP) {
// 在节点列表界面,UP 切换到上一个模式
if (this->ui->getUiState()->currentFrame == framesetInfo.positions.nodelist) {
graphics::NodeListRenderer::switchToPrevMode();
setFastFramerate();
ui->update();
}
} else if (event->inputEvent == INPUT_BROKER_DOWN) {
// 在节点列表界面,DOWN 切换到下一个模式
if (this->ui->getUiState()->currentFrame == framesetInfo.positions.nodelist) {
graphics::NodeListRenderer::switchToNextMode();
setFastFramerate();
ui->update();
}
} else if (event->inputEvent == INPUT_BROKER_SELECT) {
if (this->ui->getUiState()->currentFrame == framesetInfo.positions.home) {
menuHandler::homeBaseMenu();
@@ -48,6 +48,26 @@ void drawScaledXBitmap16x16(int x, int y, int width, int height, const uint8_t *
// Static variables for dynamic cycling
static NodeListMode currentMode = MODE_LAST_HEARD;
static int scrollIndex = 0;
static bool autoCycleEnabled = false; // 禁用自动切换,改为手动按键控制
// =============================
// Mode Control Functions (manual UP/DOWN control)
// =============================
NodeListMode getCurrentMode()
{
return currentMode;
}
void switchToNextMode()
{
currentMode = static_cast<NodeListMode>((currentMode + 1) % MODE_COUNT);
}
void switchToPrevMode()
{
currentMode = static_cast<NodeListMode>((currentMode + MODE_COUNT - 1) % MODE_COUNT);
}
// =============================
// Utility Functions
@@ -534,8 +554,8 @@ void drawDynamicNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
modeStartTime = now;
}
// Time to switch to next mode?
if (now - modeStartTime >= getModeCycleIntervalMs()) {
// Time to switch to next mode? (only if auto-cycle is enabled)
if (autoCycleEnabled && now - modeStartTime >= getModeCycleIntervalMs()) {
currentMode = static_cast<NodeListMode>((currentMode + 1) % MODE_COUNT);
modeStartTime = now;
}
@@ -54,6 +54,11 @@ const char *getCurrentModeTitle(int screenWidth);
const char *getSafeNodeName(meshtastic_NodeInfoLite *node);
void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char **fields);
// Mode control functions (for manual UP/DOWN control)
void switchToNextMode();
void switchToPrevMode();
NodeListMode getCurrentMode();
// Bitmap drawing function
void drawScaledXBitmap16x16(int x, int y, int width, int height, const uint8_t *bitmapXBM, OLEDDisplay *display);