|
HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
|
Singleton that drives the on-board WS2812 status LED. More...
#include <LedManager.h>
Public Member Functions | |
| LedManager (const LedManager &)=delete | |
| LedManager & | operator= (const LedManager &)=delete |
| LedManager (LedManager &&)=delete | |
| LedManager & | operator= (LedManager &&)=delete |
| bool | EnsureInitialized () noexcept |
| Initialise the WS2812 LED strip (idempotent). | |
| bool | Shutdown () noexcept |
| Turn off the LED and release driver resources. | |
| bool | Deinitialize () noexcept |
| Alias for Shutdown(). | |
| bool | IsInitialized () const noexcept |
| Check whether the LED driver is initialised. | |
| LedError | GetSystemDiagnostics (LedSystemDiagnostics &diagnostics) const noexcept |
| Populate a diagnostics snapshot. | |
| LedError | GetLastError () const noexcept |
| Get the most recent error code from any LED operation. | |
| flux::hal::ManagerError | GetManagerError () const noexcept |
Lifecycle / bind error of the last EnsureInitialized() (shared catalog). | |
| LedError | SetColor (const LedColor &color, uint32_t led_index=0) noexcept |
| Set LED colour from an LedColor struct. | |
| LedError | SetColor (uint32_t rgb, uint32_t led_index=0) noexcept |
| Set LED colour from a packed 0xRRGGBB integer. | |
| LedError | TurnOff () noexcept |
| Turn the LED off (set colour to black). | |
| LedError | GetCurrentColor (LedColor &color) const noexcept |
| Read the currently displayed colour. | |
| LedError | SetBrightnessPercent (uint8_t brightness_percent) noexcept |
| Set brightness as a percentage of max. | |
| LedError | SetBrightnessRaw (uint8_t brightness_raw) noexcept |
| Set brightness as a raw 0–255 value. | |
| LedError | SetBrightness (uint8_t brightness) noexcept |
| Alias for SetBrightnessRaw(). | |
| LedError | SetMaxBrightness (uint8_t max_brightness) noexcept |
| Set the upper ceiling for brightness. | |
| LedError | GetCurrentBrightnessPercent (uint8_t &brightness_percent) const noexcept |
| Read current brightness as a percentage of max. | |
| LedError | GetCurrentBrightnessRaw (uint8_t &brightness_raw) const noexcept |
| Read current brightness as a raw 0–255 value. | |
| LedError | StartAnimation (LedAnimation animation, const LedColor &color=LedColors::WHITE) noexcept |
| Start a named animation with an optional base colour. | |
| LedError | StopAnimation () noexcept |
| Stop the current animation and turn the LED off. | |
| bool | IsAnimationActive () const noexcept |
| Check whether an animation is currently running. | |
| LedError | UpdateAnimation () noexcept |
| Advance the animation by one tick. Call periodically (~50 ms). | |
| LedError | SetStatus (LedAnimation animation) noexcept |
| Set a status animation by enum (generic variant). | |
| LedError | IndicateBoot () noexcept |
| Show the boot indicator (blue blink). | |
| LedError | IndicateReady () noexcept |
| Show the ready indicator (solid green). | |
| LedError | IndicateWarning () noexcept |
| Show the warning indicator (yellow blink). | |
| LedError | IndicateError () noexcept |
| Show the error indicator (red fast-blink). | |
| LedError | IndicateCalibration () noexcept |
| Show the calibration indicator (cyan breathe). | |
| void | DumpStatistics () const noexcept |
| Log current LED state and statistics to the console. | |
| hf_pin_num_t | GetCurrentGpioPin () const noexcept |
| GPIO pin the LED strip is attached to. | |
| uint32_t | GetLedCount () const noexcept |
| Number of LEDs in the strip (always 1 on Flux V1). | |
Static Public Member Functions | |
| static LedManager & | GetInstance () noexcept |
| Access the singleton instance (Meyers singleton, thread-safe). | |
| static uint32_t | ColorWheel (uint8_t position) noexcept |
| Map a 0–255 wheel position to a rainbow RGB colour. | |
Private Member Functions | |
| LedManager () noexcept=default | |
| ~LedManager ()=default | |
| bool | Initialize () noexcept |
| LedError | UpdateAnimationStep () noexcept |
| void | UpdateStatistics (bool success) noexcept |
| void | UpdateLastError (LedError error_code) noexcept |
| uint64_t | GetSystemUptimeMs () const noexcept |
| uint8_t | PercentToRaw (uint8_t percent) const noexcept |
| uint8_t | RawToPercent (uint8_t raw) const noexcept |
Static Private Member Functions | |
| static hf_pin_num_t | GetLedGpioPin () noexcept |
Private Attributes | |
| std::atomic< bool > | is_initialized_ {false} |
| RtosMutex | mutex_ |
| bool | strip_ready_ {false} |
| The binding's strip was started by Initialize() | |
| LedAnimation | current_animation_ {LedAnimation::OFF} |
| LedColor | current_color_ {LedColors::BLACK} |
| uint8_t | current_brightness_ {255} |
| uint8_t | max_brightness_ {DEFAULT_MAX_BRIGHTNESS} |
| uint16_t | animation_step_ {0} |
| int8_t | animation_direction_ {1} |
| uint64_t | last_animation_update_ {0} |
| std::atomic< uint32_t > | total_operations_ {0} |
| std::atomic< uint32_t > | successful_operations_ {0} |
| std::atomic< uint32_t > | failed_operations_ {0} |
| std::atomic< uint32_t > | animation_cycles_ {0} |
| std::atomic< LedError > | last_error_ {LedError::SUCCESS} |
| std::atomic< flux::hal::ManagerError > | manager_error_ {flux::hal::ManagerError::NotInitialized} |
| uint64_t | system_start_time_ {0} |
| hf_pin_num_t | current_led_gpio_ {kFallbackLedPin} |
Static Private Attributes | |
| static constexpr hf_pin_num_t | kFallbackLedPin = 3 |
| Board default if the pin map lacks the LED. | |
| static constexpr uint32_t | kNumLeds = 1 |
| static constexpr uint8_t | DEFAULT_MAX_BRIGHTNESS = 255 |
| static constexpr uint32_t | ANIMATION_UPDATE_INTERVAL = 50 |
| static constexpr uint32_t | BREATH_SPEED = 5 |
| static constexpr uint32_t | BLINK_SPEED = 500 |
Singleton that drives the on-board WS2812 status LED.
Controls a single WS2812 NeoPixel LED on GPIO3. Provides:
|
delete |
|
delete |
|
privatedefaultnoexcept |
|
privatedefault |
|
staticnoexcept |
Map a 0–255 wheel position to a rainbow RGB colour.
| position | Wheel position [0–255]. |
|
inlinenoexcept |
Alias for Shutdown().
|
noexcept |
Log current LED state and statistics to the console.
|
noexcept |
Initialise the WS2812 LED strip (idempotent).
|
inlinenoexcept |
Read current brightness as a percentage of max.
| [out] | brightness_percent | Filled with value in [0, 100]. |
|
inlinenoexcept |
Read current brightness as a raw 0–255 value.
| [out] | brightness_raw | Filled with raw brightness. |
Read the currently displayed colour.
| [out] | color | Filled with current RGB value. |
|
inlinenoexcept |
GPIO pin the LED strip is attached to.
|
staticnoexcept |
Access the singleton instance (Meyers singleton, thread-safe).
|
inlinenoexcept |
Get the most recent error code from any LED operation.
|
inlinenoexcept |
Number of LEDs in the strip (always 1 on Flux V1).
|
inlinestaticprivatenoexcept |
|
inlinenoexcept |
Lifecycle / bind error of the last EnsureInitialized() (shared catalog).
ManagerError::None when initialised; otherwise why bring-up failed.
|
noexcept |
Populate a diagnostics snapshot.
| [out] | diagnostics | Struct filled with current counters and state. |
|
privatenoexcept |
|
inlinenoexcept |
Show the boot indicator (blue blink).
|
inlinenoexcept |
Show the calibration indicator (cyan breathe).
|
inlinenoexcept |
Show the error indicator (red fast-blink).
|
inlinenoexcept |
Show the ready indicator (solid green).
|
inlinenoexcept |
Show the warning indicator (yellow blink).
|
privatenoexcept |
|
inlinenoexcept |
Check whether an animation is currently running.
|
inlinenoexcept |
Check whether the LED driver is initialised.
|
delete |
|
delete |
|
inlineprivatenoexcept |
|
inlineprivatenoexcept |
|
inlinenoexcept |
|
noexcept |
Set brightness as a percentage of max.
| brightness_percent | Value in [0, 100]. |
|
noexcept |
Set brightness as a raw 0–255 value.
| brightness_raw | Raw brightness [0, max_brightness]. |
Set LED colour from an LedColor struct.
| color | RGB colour to display. |
| led_index | LED index (always 0 for single-LED boards). |
|
noexcept |
Set LED colour from a packed 0xRRGGBB integer.
| rgb | 24-bit packed colour. |
| led_index | LED index (always 0 for single-LED boards). |
|
noexcept |
Set the upper ceiling for brightness.
| max_brightness | Maximum raw brightness [0–255]. |
|
inlinenoexcept |
Set a status animation by enum (generic variant).
| animation | The status animation to start. |
|
noexcept |
Turn off the LED and release driver resources.
|
noexcept |
Start a named animation with an optional base colour.
| animation | Animation type to run. |
| color | Base colour for the animation (default: white). |
|
noexcept |
Stop the current animation and turn the LED off.
|
noexcept |
Turn the LED off (set colour to black).
|
noexcept |
Advance the animation by one tick. Call periodically (~50 ms).
|
privatenoexcept |
|
privatenoexcept |
|
privatenoexcept |
|
private |
|
private |
|
private |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
private |
|
private |
|
private |
|
private |
|
staticconstexprprivate |
|
private |
|
private |
|
staticconstexprprivate |
Board default if the pin map lacks the LED.
|
staticconstexprprivate |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
The binding's strip was started by Initialize()
|
private |
|
private |
|
private |