diff --git a/code/firmware-2.7.15.567b8ea/src/graphics/Screen.cpp b/code/firmware-2.7.15.567b8ea/src/graphics/Screen.cpp index 86599d5..41acba6 100644 --- a/code/firmware-2.7.15.567b8ea/src/graphics/Screen.cpp +++ b/code/firmware-2.7.15.567b8ea/src/graphics/Screen.cpp @@ -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(); diff --git a/code/firmware-2.7.15.567b8ea/src/graphics/draw/NodeListRenderer.cpp b/code/firmware-2.7.15.567b8ea/src/graphics/draw/NodeListRenderer.cpp index 1a36a61..739716a 100644 --- a/code/firmware-2.7.15.567b8ea/src/graphics/draw/NodeListRenderer.cpp +++ b/code/firmware-2.7.15.567b8ea/src/graphics/draw/NodeListRenderer.cpp @@ -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((currentMode + 1) % MODE_COUNT); +} + +void switchToPrevMode() +{ + currentMode = static_cast((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((currentMode + 1) % MODE_COUNT); modeStartTime = now; } diff --git a/code/firmware-2.7.15.567b8ea/src/graphics/draw/NodeListRenderer.h b/code/firmware-2.7.15.567b8ea/src/graphics/draw/NodeListRenderer.h index ea8df8b..b26d651 100644 --- a/code/firmware-2.7.15.567b8ea/src/graphics/draw/NodeListRenderer.h +++ b/code/firmware-2.7.15.567b8ea/src/graphics/draw/NodeListRenderer.h @@ -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);