Timer to slowly ramp down the brightness until zero then shutdown.
More...
#include <sun_timers.h>
|
|
void | bump_timer () |
| | signal to the timer that some time may be added. Only add time if the timer is in the fadeout phase
|
| |
|
bool | is_enabled () const |
| |
|
uint32_t | get_remaining_time_s () const |
| | Return the time left before the end of the timer, in seconds. 0 if the timer is not enabled.
|
| |
| bool | cancel () |
| | Cancel the current active timer.
|
| |
|
void | set_deadline (const uint32_t timeshutdown_s) |
| | Start the sun timer with a deadline, or prolonge the current sun timer.
|
| |
|
void | add_time_minutes (const uint8_t time_minutes) |
| | Add some time to the current timer, or start it with a target time in minutes. This time cannot be shorter than BrightnessSunTime_min.
|
| |
|
void | lock_brightness_update (bool shouldLock) |
| | Lock the hability of the sunset timer to control the brightness.
|
| |
|
void | shortcut_to_brightness_phase () |
| | Shortcut the whole timer to the brightness control phase.
|
| |
|
void | sun_process_loop () |
| | sun process task INTERNAL USE ONLY
|
| |
|
|
static constexpr uint32_t | BrightnessSunTime_min |
| |
|
static constexpr uint32_t | BrightnessSunTime_s |
| |
|
static constexpr uint32_t | BrightnessSunTime_ms |
| |
|
static constexpr uint16_t | brightnessDecreasePerLoop |
| |
|
static constexpr uint16_t | brightnessIncreasePerLoop |
| | Brightness increase per loop call during the brightness phase.
|
| |
|
static constexpr uint16_t | minimalSunUpdateCalls |
| | minimum calls to the update sunset function that will be made
|
| |
|
static constexpr uint16_t | minimalSunLoopDuration_ms |
| | Minimum time between sunset loop calls.
|
| |
|
| bool | should_accept_start () const override |
| |
| void | sun_timer_progress_update_callback (const float progress) const override |
| | Wrapper to the custom user code to call for a sun timer update.
|
| |
| void | end_of_timer_handle () override |
| | Called when the timer reaches its target. The brightness scale is left as is by the release: the handle must set it.
|
| |
| void | timer_brightness_progress_update (const float progress) override |
| | Called when the timer progresses through the brightness phase.
|
| |
| bool | release () |
| | Release the timer, without restoring the brightness scale.
|
| |
|
uint32_t | get_loop_timing_ms () const |
| | Compute the timing delay of the loop to stay at the target brightness control frequency.
|
| |
|
float | get_percent_of_advance () const |
| | Return the sun timer progress between 0 to 1.
|
| |
| float | signal_sun_update () const |
| | Signal a sun timer update to consummers.
|
| |
|
|
volatile uint32_t | endTime_s |
| | End of the timer operation, in the lamp time counter. 0 when the timer is not running. Atomic: the timer task and the main loop (inputs, CLI) can both release it.
|
| |
|
bool | isAllowedToControlBrightness |
| | Is the handler allowed to control lamp brightness.
|
| |
Timer to slowly ramp down the brightness until zero then shutdown.
◆ cancel()
Cancel the current active timer.
- Returns
- true if the timer was running. Only one caller can release a running timer, so a timer canceled from another thread never runs its end of timer handle
◆ end_of_timer_handle()
| void lampda::logic::SunsetTimer::end_of_timer_handle |
( |
| ) |
|
|
overrideprotectedvirtual |
Called when the timer reaches its target. The brightness scale is left as is by the release: the handle must set it.
Implements lampda::logic::SunTimerBase< 3 >.
◆ release()
Release the timer, without restoring the brightness scale.
- Returns
- true if the timer was running. See cancel
◆ should_accept_start()
| bool lampda::logic::SunsetTimer::should_accept_start |
( |
| ) |
const |
|
overrideprotectedvirtual |
◆ signal_sun_update()
Signal a sun timer update to consummers.
- Returns
- the progress between 0 and 1
◆ sun_timer_progress_update_callback()
| void lampda::logic::SunsetTimer::sun_timer_progress_update_callback |
( |
const float |
progress | ) |
const |
|
overrideprotectedvirtual |
◆ timer_brightness_progress_update()
| void lampda::logic::SunsetTimer::timer_brightness_progress_update |
( |
const float |
progress | ) |
|
|
overrideprotectedvirtual |
The documentation for this class was generated from the following files:
- src/system/logic/sun_timers.h
- src/system/logic/sun_timers.cpp