Very fast on pulse followed by longer off pulses. Make a stroboscopic effect.
More...
#include <brightness_modes.hpp>
|
|
static void | on_enter_mode (auto &ctx) |
| |
|
static void | custom_ramp_update (auto &ctx, uint8_t rampValue) |
| | User ramp controls the strob frequency.
|
| |
| static void | loop (auto &ctx) |
| |
| static void | on_exit_mode (auto &ctx) |
| | Custom callback when mode goes outside of focus (optional)
|
| |
| static void | sunset_update (auto &ctx, float progress) |
| | Custom callback when sunset mode is updated (optional)
|
| |
| static void | brightness_update (auto &ctx, brightness_t brightness) |
| | Custom callback when brightness changes (optional)
|
| |
| static bool | custom_click (auto &ctx, uint8_t nbClick) |
| | Custom "usermode" button UI for "click" action (optional)
|
| |
| static bool | custom_hold (auto &ctx, uint8_t nbClickAndHold, bool isEndOfHoldEvent, uint32_t holdDuration) |
| | Custom "usermode" button UI for "click+hold" action (optional)
|
| |
| static void | power_on_sequence (auto &ctx) |
| | Custom callback when the system powers on (optional)
|
| |
| static void | power_off_sequence (auto &ctx) |
| | Custom callback when the system powers off (optional)
|
| |
| static void | read_parameters (auto &ctx) |
| | Custom callback to read parameters from filesystem (optional)
|
| |
| static void | write_parameters (auto &ctx) |
| | Custom callback to write parameters to filesystem (optional)
|
| |
| static void | user_thread (auto &ctx) |
| | Custom secondary loop, executed in another thread (optional)
|
| |
|
|
static constexpr bool | hasCustomRamp = true |
| | regulate stroboscopic speed
|
| |
|
static constexpr uint32_t | stroboMaxFreq = 1000 * (1 / 30.0f) |
| | maximum allowed stroboscopic frequency in Hertz
|
| |
|
static constexpr uint32_t | stroboMinFreq = 1000 * (1 / 7.0f) |
| | minimum allowed stroboscopic frequency in hertz
|
| |
|
static constexpr bool | isGroupManager = false |
| |
|
static constexpr bool | hasSunsetAnimation = false |
| | Toggles the use of custom BasicMode::sunset_update() callback.
|
| |
|
static constexpr bool | hasBrightCallback = false |
| | Toggles the use of custom BasicMode::brightness_update() callback.
|
| |
|
static constexpr bool | hasButtonCustomUI = false |
| | Toggles "usermode" button UI custom_click() and custom_hold()
|
| |
| static constexpr bool | hasSystemCallbacks = false |
| | Toggles advanced system callbacks, see list here .
|
| |
| static constexpr bool | requireUserThread = false |
| | Toggles the use of custom BasicMode::user_thread() callback.
|
| |
| static constexpr uint32_t | storeId = 0 |
| | Store identifier for persistent storage (optional)
|
| |
Very fast on pulse followed by longer off pulses. Make a stroboscopic effect.
◆ brightness_update()
| static void lampda::modes::BasicMode::brightness_update |
( |
auto & |
ctx, |
|
|
brightness_t |
brightness |
|
) |
| |
|
inlinestaticinherited |
Custom callback when brightness changes (optional)
Callback active only if BasicMode::hasBrightCallback is True
- Parameters
-
| [in] | ctx | The current context |
| [in] | brightness | The brightness value set by the system |
◆ custom_click()
| static bool lampda::modes::BasicMode::custom_click |
( |
auto & |
ctx, |
|
|
uint8_t |
nbClick |
|
) |
| |
|
inlinestaticinherited |
Custom "usermode" button UI for "click" action (optional)
Callback active only if BasicMode::hasButtonCustomUI is True
- Parameters
-
| [in] | ctx | The current context |
| [in] | nbClick | The number of clicks made by the user |
- Returns
- Returns True if default UI action should be prevented
◆ custom_hold()
| static bool lampda::modes::BasicMode::custom_hold |
( |
auto & |
ctx, |
|
|
uint8_t |
nbClickAndHold, |
|
|
bool |
isEndOfHoldEvent, |
|
|
uint32_t |
holdDuration |
|
) |
| |
|
inlinestaticinherited |
Custom "usermode" button UI for "click+hold" action (optional)
Callback active only if BasicMode::hasButtonCustomUI is True
- Parameters
-
| [in] | ctx | The current context |
| [in] | nbClickAndHold | The number of clicks made by the user |
| [in] | isEndOfHoldEvent | True if the user just released the button |
| [in] | holdDuration | The duration of the on-going hold event |
- Returns
- Returns True if default action must be prevented
◆ loop()
| static void lampda::modes::brightness::StroboscopeMode::loop |
( |
auto & |
ctx | ) |
|
|
inlinestatic |
max time of the on pulse, in milliseconds
◆ on_exit_mode()
| static void lampda::modes::BasicMode::on_exit_mode |
( |
auto & |
ctx | ) |
|
|
inlinestaticinherited |
Custom callback when mode goes outside of focus (optional)
- Parameters
-
| [in] | ctx | The current context |
◆ power_off_sequence()
| static void lampda::modes::BasicMode::power_off_sequence |
( |
auto & |
ctx | ) |
|
|
inlinestaticinherited |
Custom callback when the system powers off (optional)
Callback active only if BasicMode::hasSystemCallbacks is True
- Parameters
-
| [in] | ctx | The current context |
◆ power_on_sequence()
| static void lampda::modes::BasicMode::power_on_sequence |
( |
auto & |
ctx | ) |
|
|
inlinestaticinherited |
Custom callback when the system powers on (optional)
Callback active only if BasicMode::hasSystemCallbacks is True
- Parameters
-
| [in] | ctx | The current context |
◆ read_parameters()
| static void lampda::modes::BasicMode::read_parameters |
( |
auto & |
ctx | ) |
|
|
inlinestaticinherited |
Custom callback to read parameters from filesystem (optional)
Callback active only if BasicMode::hasSystemCallbacks is True
- Parameters
-
| [in] | ctx | The current context |
◆ sunset_update()
| static void lampda::modes::BasicMode::sunset_update |
( |
auto & |
ctx, |
|
|
float |
progress |
|
) |
| |
|
inlinestaticinherited |
Custom callback when sunset mode is updated (optional)
Callback active only if BasicMode::hasSunsetAnimation is True
- Parameters
-
| [in] | ctx | The current context |
| [in] | progress | Between 0 and 1, progress of the sunset. At 1, the system turns off |
◆ user_thread()
| static void lampda::modes::BasicMode::user_thread |
( |
auto & |
ctx | ) |
|
|
inlinestaticinherited |
Custom secondary loop, executed in another thread (optional)
Called only if BasicMode::requireUserThread is True
- Parameters
-
| [in] | ctx | The current context |
◆ write_parameters()
| static void lampda::modes::BasicMode::write_parameters |
( |
auto & |
ctx | ) |
|
|
inlinestaticinherited |
Custom callback to write parameters to filesystem (optional)
Callback active only if BasicMode::hasSystemCallbacks is True
- Parameters
-
| [in] | ctx | The current context |
◆ hasSystemCallbacks
| constexpr bool lampda::modes::BasicMode::hasSystemCallbacks = false |
|
staticconstexprinherited |
Toggles advanced system callbacks, see list here .
Required to use any of the following:
◆ requireUserThread
| constexpr bool lampda::modes::BasicMode::requireUserThread = false |
|
staticconstexprinherited |
◆ storeId
| constexpr uint32_t lampda::modes::BasicMode::storeId = 0 |
|
staticconstexprinherited |
Store identifier for persistent storage (optional)
By default, all modes are reset upon a shutdown, providing no persistence of their state across several on/off cycles. To expose to the user a way to configure your mode in a persistent fashion, you can use:
static void loop(
auto& ctx) {
uint8_t rampValue = ctx.get_active_custom_ramp();
}
static constexpr bool hasCustomRamp
regulate stroboscopic speed
Definition: brightness_modes.hpp:155
static void loop(auto &ctx)
Definition: brightness_modes.hpp:184
This value is configurable through user interaction with the button. If you need a persistent value, private to your mode, you can use:
static void loop(
auto& ctx) {
uint8_t indexValue = ctx.get_active_custom_index();
indexValue += 1;
ctx.set_active_custom_index(indexValue);
}
These are the two always-available persistent state that a mode can configure by default. However, for more advanced modes (like games, with a list of high-scores, for example) more flexibility can be required.
If you need such extended storage, see ContextTy::KeyProxy for usage.
If you don't need these capabilities, just ignore this identifier :)
The documentation for this struct was generated from the following file: