some optimizations regarding LED color

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-09-20 20:21:42 +02:00
parent 2f03713a4e
commit 273f9491f8
26 changed files with 357 additions and 91 deletions

View File

@@ -0,0 +1,29 @@
#pragma once
#include "common/Menu.h"
namespace ColorSettingsMenuOptions
{
constexpr auto RED = "red_";
constexpr auto GREEN = "green_";
constexpr auto BLUE = "blue_";
} // namespace ColorSettingsMenuOptions
class ColorSettingsMenu : public Menu
{
public:
/**
* @brief Constructs a ColorSettingsMenu with the specified options
* @param options Pointer to menu configuration options structure
* @details Initializes the menu with color settings options
*/
explicit ColorSettingsMenu(menu_options_t *options, std::string prefix);
void onButtonPressed(const MenuItem &menuItem, const ButtonType button) override;
void onExit() override;
private:
std::string m_suffix;
menu_options_t *m_options;
};

View File

@@ -159,7 +159,7 @@ class Menu : public Widget
* @note New items are created as selection items with auto-generated names
* in the format "Section X" where X is the item number
*/
void setItemSize(size_t size);
void setItemSize(size_t size, int8_t startIndex = 0);
/**
* @brief Toggles the boolean state of a toggle menu item

View File

@@ -63,7 +63,7 @@ class Widget
* @note This method is typically called by the UI management system during
* screen transitions or focus changes.
*/
virtual void enter();
virtual void onEnter();
/**
* @brief Called when the widget is temporarily paused or loses focus
@@ -76,7 +76,7 @@ class Widget
* only if pause behavior is needed.
* @note The widget should be prepared to resume from this state when resume() is called.
*/
virtual void pause();
virtual void onPause();
/**
* @brief Called when the widget resumes from a paused state
@@ -89,7 +89,7 @@ class Widget
* only if resume behavior is needed.
* @note This method should restore the widget to the state it was in before pause() was called.
*/
virtual void resume();
virtual void onResume();
/**
* @brief Called when the widget is being destroyed or exits the system
@@ -99,11 +99,11 @@ class Widget
* save final state, or release resources that are not automatically freed.
*
* @note The base implementation is empty, allowing derived classes to override
* only if exit behavior is needed.
* only if onExit behavior is needed.
* @note This method is called before the widget's destructor and provides
* an opportunity for controlled shutdown of widget-specific resources.
*/
virtual void exit();
virtual void onExit();
/**
* @brief Updates the widget's internal state based on elapsed time