diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index d0a235e8c..c21c4335d 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -150,8 +150,24 @@ static void drawSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int static void drawPluginFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { - DEBUG_MSG("Drawing Plugin Frame %d\n\n", state->currentFrame); - MeshPlugin &pi = *pluginFrames.at(state->currentFrame); + uint8_t plugin_frame; + // there's a little but in the UI transition code + // where it invokes the function at the correct offset + // in the array of "drawScreen" functions; however, + // the passed-state doesn't quite reflect the "current" + // screen, so we have to detect it. + if (state->frameState == IN_TRANSITION && state->transitionFrameRelationship == INCOMING) { + // if we're transitioning from the end of the frame list back around to the first + // frame, then we want this to be `0` + plugin_frame = state->transitionFrameTarget; + } + else { + // otherwise, just display the plugin frame that's aligned with the current frame + plugin_frame = state->currentFrame; + DEBUG_MSG("Screen is not in transition. Frame: %d\n\n", plugin_frame); + } + DEBUG_MSG("Drawing Plugin Frame %d\n\n", plugin_frame); + MeshPlugin &pi = *pluginFrames.at(plugin_frame); pi.drawFrame(display,state,x,y); } diff --git a/src/plugins/esp32/EnvironmentalMeasurementPlugin.cpp b/src/plugins/esp32/EnvironmentalMeasurementPlugin.cpp index 785fa75a0..4add55f8c 100644 --- a/src/plugins/esp32/EnvironmentalMeasurementPlugin.cpp +++ b/src/plugins/esp32/EnvironmentalMeasurementPlugin.cpp @@ -49,10 +49,10 @@ int32_t EnvironmentalMeasurementPlugin::runOnce() { Uncomment the preferences below if you want to use the plugin without having to configure it from the PythonAPI or WebUI. */ - /*radioConfig.preferences.environmental_measurement_plugin_enabled = 1; + radioConfig.preferences.environmental_measurement_plugin_enabled = 1; radioConfig.preferences.environmental_measurement_plugin_read_error_count_threshold = 5; radioConfig.preferences.environmental_measurement_plugin_update_interval = 30; - radioConfig.preferences.environmental_measurement_plugin_recovery_interval = 600;*/ + radioConfig.preferences.environmental_measurement_plugin_recovery_interval = 600; if (!radioConfig.preferences.environmental_measurement_plugin_enabled){ // If this plugin is not enabled, don't waste any OSThread time on it