17#include "src/modes/include/default_config.hpp"
25template<
typename NewLocalMode>
static auto context_as(
auto& ctx) {
return ctx.template context_as<NewLocalMode>(); }
28template<
typename LocalBasicMode,
typename ModeManager>
struct ContextTy
43 static constexpr bool isMode = is_mode<LocalModeTy>;
46 static constexpr bool isModeManager = std::is_same_v<LocalModeTy, ModeManagerTy>;
47 static constexpr bool isGroupManager =
false;
50 static constexpr bool hasSunsetAnimation = LocalModeTy::hasSunsetAnimation;
51 static constexpr bool hasSunriseAnimation = LocalModeTy::hasSunriseAnimation;
52 static constexpr bool usesSunsetGravityDissolveMode = LocalModeTy::usesSunsetGravityDissolveMode;
53 static constexpr bool usesSunriseGravityAppearMode = LocalModeTy::usesSunriseGravityAppearMode;
54 static constexpr bool hasBrightCallback = LocalModeTy::hasBrightCallback;
55 static constexpr bool hasSystemCallbacks = LocalModeTy::hasSystemCallbacks;
56 static constexpr bool requireUserThread = LocalModeTy::requireUserThread;
57 static constexpr bool hasCustomRamp = LocalModeTy::hasCustomRamp;
58 static constexpr bool hasButtonCustomUI = LocalModeTy::hasButtonCustomUI;
61 static constexpr auto everySunsetCallback = LocalModeTy::everySunsetCallback;
62 static constexpr auto everySunriseCallback = LocalModeTy::everySunriseCallback;
63 static constexpr auto everyBrightCallback = LocalModeTy::everyBrightCallback;
64 static constexpr auto everySystemCallbacks = LocalModeTy::everySystemCallbacks;
65 static constexpr auto everyRequireUserThread = LocalModeTy::everyRequireUserThread;
66 static constexpr auto everyCustomRamp = LocalModeTy::everyCustomRamp;
67 static constexpr auto everyButtonCustomUI = LocalModeTy::everyButtonCustomUI;
74 template<
typename NewLocalMode>
auto LMBD_INLINE
context_as()
83 modeManager {modeManager}
88 ContextTy(
const ContextTy&) =
delete;
89 ContextTy& operator=(
const ContextTy&) =
delete;
96 auto LMBD_INLINE next_group()
98 if constexpr (LocalModeTy::isGroupManager)
100 LocalModeTy::next_group(*
this);
104 auto manager = modeManager.get_context();
105 return manager.next_group();
110 auto LMBD_INLINE next_mode()
112 if constexpr (LocalModeTy::isModeManager)
114 LocalModeTy::next_mode(*
this);
118 auto manager = modeManager.get_context();
123 void LMBD_INLINE jump_to_new_active_index(
const auto& newActiveIndex,
124 const bool ignoreRampAndIndex =
false,
125 const bool quitFavoriteGroup =
false)
127 if constexpr (LocalModeTy::isGroupManager)
129 LocalModeTy::jump_to_new_active_index(*
this, newActiveIndex, ignoreRampAndIndex, quitFavoriteGroup);
133 auto manager = modeManager.get_context();
134 manager.jump_to_new_active_index(newActiveIndex, ignoreRampAndIndex, quitFavoriteGroup);
139 bool LMBD_INLINE jump_to_favorite(uint8_t which_one,
bool shouldSaveLastActiveIndex)
141 if constexpr (LocalModeTy::isModeManager)
143 return LocalModeTy::jump_to_favorite(*
this, which_one, shouldSaveLastActiveIndex);
147 auto manager = modeManager.get_context();
148 return manager.jump_to_favorite(which_one, shouldSaveLastActiveIndex);
153 bool LMBD_INLINE exit_favorite_group(
auto nextActiveIndex)
155 if constexpr (LocalModeTy::isModeManager)
157 return LocalModeTy::exit_favorite_group(*
this, nextActiveIndex);
161 auto manager = modeManager.get_context();
162 return manager.exit_favorite_group(nextActiveIndex);
167 auto LMBD_INLINE set_favorite_at(uint8_t which_one,
auto activeIndex)
169 if constexpr (LocalModeTy::isModeManager)
171 return LocalModeTy::set_favorite_at(*
this, which_one, activeIndex);
175 auto manager = modeManager.get_context();
176 return manager.set_favorite_at(which_one, activeIndex);
181 auto LMBD_INLINE delete_favorite_now()
183 if constexpr (LocalModeTy::isModeManager)
185 return LocalModeTy::delete_favorite_now(*
this);
189 auto manager = modeManager.get_context();
190 return manager.delete_favorite_now();
195 auto LMBD_INLINE handle_scroll_modes(
const uint32_t holdDuration)
197 if constexpr (LocalModeTy::isModeManager)
199 return LocalModeTy::handle_scroll_modes(*
this, holdDuration);
203 auto manager = modeManager.get_context();
204 return manager.handle_scroll_modes(holdDuration);
209 auto LMBD_INLINE enter_hidden_group(
const uint8_t hiddenGroupIndex)
211 if constexpr (LocalModeTy::isModeManager)
213 return LocalModeTy::enter_hidden_group(*
this, hiddenGroupIndex);
217 auto manager = modeManager.get_context();
218 return manager.enter_hidden_group(hiddenGroupIndex);
223 auto LMBD_INLINE overlay_animate_ramp(
float holdDuration,
226 const uint32_t timeout = 0)
228 if constexpr (LocalModeTy::isModeManager)
230 return modeManager.overlay_animate_ramp(*
this, holdDuration, stepSize, palette, timeout);
234 auto manager = modeManager.get_context();
235 return manager.overlay_animate_ramp(holdDuration, stepSize, palette, timeout);
240 auto LMBD_INLINE overlay_animate_ramp(uint8_t progress,
const colors::PaletteTy& palette,
const uint32_t timeout = 0)
242 if constexpr (LocalModeTy::isModeManager)
244 return modeManager.overlay_animate_ramp(*
this, progress, palette, timeout);
248 auto manager = modeManager.get_context();
249 return manager.overlay_animate_ramp(progress, palette, timeout);
254 auto LMBD_INLINE get_groups_count() {
return modeManager.nbGroupsTotal; }
256 auto LMBD_INLINE get_accessible_groups_count() {
return modeManager.nbAccessibleGroups; }
258 auto LMBD_INLINE get_hidden_groups_count() {
return modeManager.hiddenGroupCount; }
261 auto LMBD_INLINE get_modes_count()
263 if constexpr (LocalModeTy::isModeManager)
265 return modeManager.get_modes_count(*
this);
269 auto manager = modeManager.get_context();
270 return manager.get_modes_count();
281 uint8_t groupIndex = modeManager.activeIndex.groupIndex;
282 return (groupIndex + 1) > maxValueWrap ? 0 : groupIndex;
288 if (value + 1 > maxValueWrap)
301 uint8_t modeIndex = modeManager.activeIndex.modeIndex;
302 return (modeIndex + 1) > maxValueWrap ? 0 : modeIndex;
308 if (value + 1 > maxValueWrap)
311 auto manager = modeManager.get_context();
314 modeManager.quit_mode(manager);
317 if (modeManager.activeIndex.modeIndex == value)
327 modeManager.activeIndex.modeIndex = value;
329 modeManager.enter_mode(manager);
344 modeManager.sunsetHandler.update_suntimer_drop_animation(*
this, progress);
352 modeManager.sunriseHandler.update_suntimer_drop_animation(*
this, progress);
361 modeManager.activeIndex.rampIndex = value;
371 modeManager.activeIndex.customIndex = value;
380 template<
typename Mode> StateTyOf<Mode>&
get_state_of_mode() {
return modeManager.template getStateOf<Mode>(); }
385 return details::GroupIdFrom<Mode, typename ModeManagerTy::AllGroupsTy>;
391 return details::ModeIdFrom<Mode, typename ModeManagerTy::AllGroupsTy, get_group_id_of_mode<Mode>()>;
395 static constexpr int groupId = get_group_id_of_mode<LocalModeTy>();
398 static constexpr int modeId = get_mode_id<LocalModeTy>();
401 static constexpr auto prefix =
402 (isModeManager ? store::PrefixValues::managerKeys :
403 (isMode ? store::PrefixValues::generalKeys : store::PrefixValues::privateKeys));
406 using StoreEnum = StoreEnumOf<LocalModeTy>;
409 using LocalStore = store::KeyStore<StoreEnum, groupId, modeId, prefix>;
412 static constexpr bool hasStore = not std::is_same_v<StoreEnum, NoStoreHere>;
453 template<StoreEnum _key,
typename T>
struct KeyProxy
455 static_assert(std::is_same_v<T, std::conditional_t<hasStore, T, NoStoreId>>,
456 "KeyProxy can not be used when no storeId has been defined!");
459 static constexpr StoreEnum
key = _key;
468 LocalStore::template setValue<key, T>(value);
472 inline bool LMBD_INLINE
getValue() {
return LocalStore::template getValue<key, T>(
local); }
475 inline void LMBD_INLINE
getValue(T defVal) { LocalStore::template getValue<key, T>(
local, defVal); }
478 inline bool LMBD_INLINE
hasValue() {
return LocalStore::template hasValue<key, T>(); }
485 inline void LMBD_INLINE forceSave() { LocalStore::template setValue<key, T>(
local); }
503 template<StoreEnum key,
typename T = u
int32_t>
517 template<StoreEnum key,
typename T = u
int32_t>
static bool LMBD_INLINE
storageLoadOnly(LMBD_USED T& local)
519 return LocalStore::template getValue<key, T>(local);
523 template<StoreEnum key,
typename T = u
int32_t>
526 LocalStore::template getValue<key, T>(local, defaultValue);
530 template<StoreEnum key,
typename T = u
int32_t>
static void LMBD_INLINE
storageSaveOnly(LMBD_USED T& local)
532 return LocalStore::template setValue<key, T>(local);
545 auto ctx = modeManager.get_context();
549 ctx.state.rampHandler.rampSaturates = value;
552 ctx.state.clearStripOnModeChange = value;
555 ctx.state.rampHandler.animEffect = value;
558 assert(
false &&
"unsupported config key for booleans!");
569 auto ctx = modeManager.get_context();
573 ctx.state.rampHandler.stepSpeed = value;
576 ctx.state.rampHandler.animChoice = value;
579 assert(
false &&
"unsupported config key for u32!");
592 void blip(
const uint32_t duration)
594 auto ctx = modeManager.get_context();
596 ctx.state.skipNextFrameEffect = ceil(duration /
static_cast<float>(ctx.lamp.frameDurationMs));
598 ctx.lamp.blip(duration);
604 auto ctx = modeManager.get_context();
606 ctx.state.skipNextFrameEffect = 0;
607 ctx.lamp.cancel_blip();
613 auto ctx = modeManager.get_context();
614 return ctx.lamp.is_bliping();
624 if constexpr (LocalModeTy::isModeManager)
626 LocalModeTy::enter_group(*
this, value);
630 auto& manager = modeManager.get_context();
631 return manager.enter_group(value);
638 if constexpr (LocalModeTy::isModeManager)
640 LocalModeTy::quit_group(*
this);
644 auto& manager = modeManager.get_context();
645 return manager.quit_group();
652 if constexpr (LocalModeTy::isModeManager)
654 LocalModeTy::enter_mode(*
this);
658 auto& manager = modeManager.get_context();
659 return manager.enter_mode();
666 if constexpr (LocalModeTy::isModeManager)
668 LocalModeTy::quit_mode(*
this);
672 auto& manager = modeManager.get_context();
673 return manager.quit_mode();
684 LocalModeTy::loop(*
this);
687 if constexpr (isMode)
689 auto manager = modeManager.get_context();
692 if constexpr (LocalModeTy::hasSunsetAnimation && LocalModeTy::usesSunsetGravityDissolveMode)
694 manager.sunset_timer_animation_internal_loop();
698 if constexpr (LocalModeTy::hasSunriseAnimation && LocalModeTy::usesSunriseGravityAppearMode)
700 manager.sunrise_timer_animation_internal_loop();
710 LocalStore::template migrateStoreIfNeeded<LocalModeTy::storeId>();
714 if constexpr (isMode)
716 auto manager = modeManager.get_context();
719 if constexpr (LocalModeTy::hasSunsetAnimation && LocalModeTy::usesSunsetGravityDissolveMode)
721 manager.sunset_timer_internal_reset();
725 if constexpr (LocalModeTy::hasSunriseAnimation && LocalModeTy::usesSunriseGravityAppearMode)
727 manager.sunrise_timer_internal_reset();
731 LocalModeTy::on_enter_mode(*
this);
738 LocalModeTy::on_exit_mode(*
this);
744 if constexpr (LocalModeTy::hasSunsetAnimation)
746 if constexpr (isMode)
749 if constexpr (LocalModeTy::usesSunsetGravityDissolveMode)
750 modeManager.get_context().update_sunset_drop_animation(progress);
753 LocalModeTy::sunset_update(*
this, progress);
760 if constexpr (LocalModeTy::hasSunriseAnimation)
762 if constexpr (isMode)
765 if constexpr (LocalModeTy::usesSunriseGravityAppearMode)
766 modeManager.get_context().update_sunrise_drop_animation(progress);
769 LocalModeTy::sunrise_update(*
this, progress);
778 LocalModeTy::sunrise_timer_animation_internal_loop(*
this);
794 if constexpr (LocalModeTy::hasBrightCallback)
796 LocalModeTy::brightness_update(*
this, brightness);
803 if constexpr (LocalModeTy::isGroupManager)
805 LocalModeTy::custom_ramp_update(*
this, rampValue, timeout);
807 else if constexpr (LocalModeTy::hasCustomRamp)
809 LocalModeTy::custom_ramp_update(*
this, rampValue);
816 if constexpr (LocalModeTy::hasButtonCustomUI)
818 return LocalModeTy::custom_click(*
this, nbClick);
826 LMBD_USED
bool isEndOfHoldEvent,
827 LMBD_USED uint32_t holdDuration)
829 if constexpr (LocalModeTy::hasButtonCustomUI)
831 return LocalModeTy::custom_hold(*
this, nbClickAndHold, isEndOfHoldEvent, holdDuration);
837 void display_favorite_number_ramp(
const uint8_t favoriteIndex,
838 const uint8_t maxFavoriteIndex,
839 const bool display =
false,
840 const uint32_t timeout = 0)
842 if constexpr (LocalModeTy::isModeManager)
844 modeManager.template display_favorite_number_ramp(*
this, favoriteIndex, maxFavoriteIndex, display, timeout);
848 auto& manager = modeManager.get_context();
849 manager.display_favorite_number_ramp(favoriteIndex, maxFavoriteIndex, display, timeout);
853 template<
bool displayFavoriteNumber = true>
854 auto set_current_mode_as_favorite(uint8_t favoriteIndex, uint32_t displayTimeout_s = 0)
856 if constexpr (LocalModeTy::isModeManager)
858 modeManager.template set_current_mode_as_favorite<displayFavoriteNumber>(*
this, favoriteIndex, displayTimeout_s);
862 auto&
manager = modeManager.get_context();
863 manager.template set_current_mode_as_favorite<displayFavoriteNumber>(favoriteIndex, displayTimeout_s);
867 auto get_number_of_allowed_favorites()
869 if constexpr (LocalModeTy::isModeManager)
871 return modeManager.template get_number_of_allowed_favorites(*
this);
875 auto&
manager = modeManager.get_context();
876 return manager.get_number_of_allowed_favorites(*
this);
880 bool is_in_favorite_group()
882 if constexpr (LocalModeTy::isGroupManager)
884 return modeManager.template is_in_favorite_group(*
this);
888 auto manager = modeManager.get_context();
889 return manager.is_in_favorite_group();
893 template<
bool displayFavoriteNumber = true>
894 auto LMBD_INLINE animate_favorite_pick(
float holdDuration,
float stepSize,
bool isEndOfHold)
896 if constexpr (LocalModeTy::isModeManager)
898 return modeManager.template animate_favorite_pick<displayFavoriteNumber>(
899 *
this, holdDuration, stepSize, isEndOfHold);
903 auto&
manager = modeManager.get_context();
904 return manager.template animate_favorite_pick<displayFavoriteNumber>(holdDuration, stepSize, isEndOfHold);
908 template<
bool displayFavoriteNumber = true>
909 auto LMBD_INLINE animate_favorite_delete(
float holdDuration,
float stepSize,
bool isEndOfHold)
911 if constexpr (LocalModeTy::isModeManager)
913 return modeManager.template animate_favorite_delete<displayFavoriteNumber>(
914 *
this, holdDuration, stepSize, isEndOfHold);
918 auto&
manager = modeManager.get_context();
919 return manager.template animate_favorite_delete<displayFavoriteNumber>(holdDuration, stepSize, isEndOfHold);
929 if constexpr (LocalModeTy::hasSystemCallbacks)
931 LocalModeTy::power_on_sequence(*
this);
938 if constexpr (LocalModeTy::hasSystemCallbacks)
940 LocalModeTy::power_off_sequence(*
this);
947 if constexpr (LocalModeTy::hasSystemCallbacks)
949 LocalModeTy::write_parameters(*
this);
956 if constexpr (LocalModeTy::hasSystemCallbacks)
958 LocalModeTy::read_parameters(*
this);
968 if constexpr (LocalModeTy::requireUserThread)
970 LocalModeTy::user_thread(*
this);
Filesystem interaction tools.
Define the main led strip interaction object.
AlertManager_t manager
Instanciation of the AlertManager.
Definition: alerts.cpp:30
std::array< uint32_t, 16 > PaletteTy
Palette types.
Definition: palettes.hpp:18
Contains basic interface types to implement custom user modes.
Definition: control_fixed_modes.hpp:14
@ customRampAnimEffect
(bool) Mode uses custom ramp anim. or not?
@ rampSaturates
(bool) Mode saturates on custom ramp, or else wrap?
@ clearStripOnModeChange
(bool) Mode clear strip after reset, or else do nothing?
@ customRampStepSpeedMs
(u32) Mode time step for incrementing custom ramp (ms)
@ customRampAnimChoice
(u32) Which custom ramp anim. to use (rainbow, etc)
static auto context_as(auto &ctx)
Bind provided context to another modes::BasicMode.
Definition: context_type.hpp:25
uint16_t brightness_t
Define the type of the brightness parameters.
Definition: constants.h:151
(store) Binds a local variable of type T to key in storage (with automatic read & save)
Definition: context_type.hpp:454
void LMBD_INLINE getValue(T defVal)
(optional) Read key value, if not found, set local to defVal
Definition: context_type.hpp:475
void LMBD_INLINE setValue(T value)
(optional) Set local to value then write key to store
Definition: context_type.hpp:465
static constexpr StoreEnum key
Enumeration value uniquely identifying where local will be stored.
Definition: context_type.hpp:459
bool LMBD_INLINE getValue()
(optional) Read key from store, return True if local was written
Definition: context_type.hpp:472
T & local
Local variable reference bound to KeyProxy.
Definition: context_type.hpp:462
bool LMBD_INLINE hasValue()
(optional) Return True if key is set in store, False if unknown
Definition: context_type.hpp:478
KeyProxy(T &local)
Use ContextTy::storageFor to construct a KeyProxy bound to local.
Definition: context_type.hpp:492
Local context exposing system features to active BasicMode.
Definition: context_type.hpp:29
static void LMBD_INLINE storageLoadOnly(LMBD_USED T &local, const T defaultValue)
(store) Load key into local if available (single-shot), or load the default value
Definition: context_type.hpp:524
void LMBD_INLINE set_config_bool(bool value)
(setter) Set a configurable boolean to target value
Definition: context_type.hpp:543
void update_sunset_drop_animation(float progress)
Update the sunset timer drop animation.
Definition: context_type.hpp:342
void LMBD_INLINE power_on_sequence()
Binds to local BasicMode::power_on_sequence()
Definition: context_type.hpp:927
void LMBD_INLINE brightness_update(LMBD_USED brightness_t brightness)
Binds to local BasicMode::brightness_update()
Definition: context_type.hpp:792
void LMBD_INLINE enter_group(const uint8_t value)
Call when entering a group.
Definition: context_type.hpp:622
void LMBD_INLINE sunset_timer_animation_internal_loop()
Run the internal sunset animation loop.
Definition: context_type.hpp:774
void LMBD_INLINE set_config_u32(uint32_t value)
(setter) Set a configurable integer (u32) to target value
Definition: context_type.hpp:567
bool LMBD_INLINE custom_hold(LMBD_USED uint8_t nbClickAndHold, LMBD_USED bool isEndOfHoldEvent, LMBD_USED uint32_t holdDuration)
Binds to local BasicMode::custom_hold()
Definition: context_type.hpp:825
void LMBD_INLINE on_exit_mode()
Binds to local BasicMode::on_exit_mode()
Definition: context_type.hpp:735
void LMBD_INLINE quit_group()
Call when quitting a group.
Definition: context_type.hpp:636
uint8_t LMBD_INLINE get_active_custom_index() const
(getter) Get active custom index (recalled when jumping favorites)
Definition: context_type.hpp:366
static constexpr bool hasStore
(store) True if LocalBasicMode has access to a local key store
Definition: context_type.hpp:412
void LMBD_INLINE sunset_timer_internal_reset()
Signal a end of sunset timer event.
Definition: context_type.hpp:784
friend ModeManager
Friend class.
Definition: context_type.hpp:31
uint8_t LMBD_INLINE set_active_custom_ramp(uint8_t value)
(setter) Set active custom ramp value (overrides user choice)
Definition: context_type.hpp:359
void LMBD_INLINE read_parameters()
Binds to local BasicMode::read_parameters()
Definition: context_type.hpp:954
LocalBasicMode LocalModeTy
Type of a local mode.
Definition: context_type.hpp:38
static void LMBD_INLINE storageSaveOnly(LMBD_USED T &local)
(store) Save local into key storage (single-shot)
Definition: context_type.hpp:530
static constexpr int get_mode_id()
Return the.
Definition: context_type.hpp:389
uint8_t LMBD_INLINE get_active_custom_ramp() const
(getter) Get active custom ramp value (as configured by user)
Definition: context_type.hpp:337
void LMBD_INLINE sunrise_update(LMBD_USED float progress)
Binds to local BasicMode::sunrise_update()
Definition: context_type.hpp:758
void LMBD_INLINE loop()
Binds to local BasicMode::loop()
Definition: context_type.hpp:682
void LMBD_INLINE on_enter_mode()
Binds to local BasicMode::on_enter_mode()
Definition: context_type.hpp:706
uint8_t LMBD_INLINE set_active_mode(uint8_t value, uint8_t maxValueWrap=255)
(setter) Set active mode index (as numbered in local group)
Definition: context_type.hpp:306
void LMBD_INLINE write_parameters()
Binds to local BasicMode::write_parameters()
Definition: context_type.hpp:945
ModeManager ModeManagerTy
Type of the mode manager.
Definition: context_type.hpp:36
bool LMBD_INLINE custom_click(LMBD_USED uint8_t nbClick)
Binds to local BasicMode::custom_click()
Definition: context_type.hpp:814
void cancel_blip() const
Cancel an ongoing blip of the ouput.
Definition: context_type.hpp:602
uint8_t LMBD_INLINE set_active_custom_index(uint8_t value)
(setter) Set active custom index (recalled when jumping favorites)
Definition: context_type.hpp:369
bool is_bliping() const
Return true if the systems is currently bliping the output.
Definition: context_type.hpp:611
void LMBD_INLINE sunrise_timer_animation_internal_loop()
Run the internal sunrise animation loop.
Definition: context_type.hpp:776
void LMBD_INLINE power_off_sequence()
Binds to local BasicMode::power_off_sequence()
Definition: context_type.hpp:936
void LMBD_INLINE quit_mode()
Call when quitting a mode.
Definition: context_type.hpp:664
static auto LMBD_INLINE storageFor(LMBD_USED T &local)
(store) Get storage KeyProxy for key bound to local variable
Definition: context_type.hpp:504
StateTyOf< Mode > & get_state_of_mode()
Return the state of a given mode.
Definition: context_type.hpp:380
void blip(const uint32_t duration)
Turn off the output for a duration.
Definition: context_type.hpp:592
void LMBD_INLINE user_thread()
Binds to local BasicMode::user_thread()
Definition: context_type.hpp:966
uint8_t LMBD_INLINE get_active_mode(uint8_t maxValueWrap=255) const
(getter) Get active mode index (as numbered in local group)
Definition: context_type.hpp:299
StateTyOf< LocalModeTy > StateTy
Type of the State of a local mode.
Definition: context_type.hpp:40
void LMBD_INLINE sunset_update(LMBD_USED float progress)
Binds to local BasicMode::sunset_update()
Definition: context_type.hpp:742
void update_sunrise_drop_animation(float progress)
Update the sunrise timer drop animation.
Definition: context_type.hpp:350
hardware::LampTy & lamp
Interact with the lamp hardware.
Definition: context_type.hpp:978
static bool LMBD_INLINE storageLoadOnly(LMBD_USED T &local)
(store) Load key into local if available (single-shot)
Definition: context_type.hpp:517
void LMBD_INLINE enter_mode()
Call when entering a mode.
Definition: context_type.hpp:650
uint8_t LMBD_INLINE set_active_group(uint8_t value, uint8_t maxValueWrap=255)
(setter) Set active group index
Definition: context_type.hpp:286
auto LMBD_INLINE context_as()
Get the same context, but for another mode, see modes::context_as()
Definition: context_type.hpp:74
uint8_t LMBD_INLINE get_active_group(uint8_t maxValueWrap=255) const
(getter) Get active group index
Definition: context_type.hpp:279
void LMBD_INLINE sunrise_timer_internal_reset()
Signal a end of sunrise timer event.
Definition: context_type.hpp:789
StateTy & state
Interact with the current active mode state.
Definition: context_type.hpp:979
bool LMBD_INLINE should_spawn_thread()
Returns BasicMode::requireUserThread.
Definition: context_type.hpp:963
static constexpr int get_group_id_of_mode()
Return the id of the group containing a target mode, or -1 if it does not exist.
Definition: context_type.hpp:383
auto LMBD_INLINE get_custom_ramp_default_value()
Return the default ramp values for all the modes under this group.
Definition: context_type.hpp:924
void LMBD_INLINE custom_ramp_update(LMBD_USED uint8_t rampValue, uint32_t timeout=0)
Binds to local BasicMode::custom_ramp_update()
Definition: context_type.hpp:801
Main interface between the user and the hardware of the lamp.
Definition: lamp_type.hpp:120
Convertion header to use the text out functions from C code.