Init new era, with wiki integrated.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* UI State Manager Module
|
||||
*
|
||||
* Handles UI state synchronization:
|
||||
* - Syncs toggle switches with actual service states when screens change
|
||||
* - Handles SquareLine Studio screen lifecycle (destroy/recreate)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
namespace UIStateManager {
|
||||
|
||||
// ============================================================================
|
||||
// PUBLIC API
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Initialize the UI State Manager
|
||||
*
|
||||
* This function:
|
||||
* - Initializes internal state tracking variables
|
||||
*/
|
||||
void init();
|
||||
|
||||
/**
|
||||
* @brief Apply saved states to UI switches
|
||||
*
|
||||
* This function is called continuously in loop() to sync UI toggle switches
|
||||
* with the actual running state of services when the Settings screen loads.
|
||||
* It handles the SquareLine Studio screen lifecycle where screens get
|
||||
* destroyed/recreated when swiping between screens.
|
||||
*
|
||||
* @note This function is thread-safe and uses LVGL locks internally
|
||||
*/
|
||||
void applySavedStatesToUI();
|
||||
|
||||
/**
|
||||
* @brief Enable or disable debug mode (LVGL performance and memory monitors)
|
||||
* @param enabled True to enable debug monitors, false to disable
|
||||
*/
|
||||
void setDebugEnabled(bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Get current debug mode state
|
||||
* @return True if debug mode is enabled, false otherwise
|
||||
*/
|
||||
bool isDebugEnabled();
|
||||
|
||||
// ============================================================================
|
||||
// EVENT HANDLERS (Called from SquareLine Studio UI)
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Debug toggle event handler
|
||||
* @param e LVGL event object
|
||||
* @note This function is registered in SquareLine Studio UI
|
||||
*/
|
||||
void onDebugToggle(lv_event_t *e);
|
||||
|
||||
} // namespace UIStateManager
|
||||
Reference in New Issue
Block a user