Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Namespaces | Functions
behavior.h File Reference

Basic controller behavior, including alerts and user interactions. More...

Go to the source code of this file.

Namespaces

namespace  lampda
 Program scope.
 
namespace  lampda::logic
 Handle the main high level logics.
 
namespace  lampda::logic::behavior
 Main system behavior handle.
 

Functions

bool lampda::logic::behavior::read_parameters ()
 Load the parameters from the filesystem.
 
bool lampda::logic::behavior::is_user_code_running ()
 
void lampda::logic::behavior::set_woke_up_from_vbus (const bool wokeUp)
 call once at program start, before the first main loop runs The system was powered from a vbus powered event, not a user action
 
void lampda::logic::behavior::loop ()
 
std::string lampda::logic::behavior::get_state ()
 
std::string lampda::logic::behavior::get_error_state_message ()
 return the error message associated with the error state
 
bool lampda::logic::behavior::can_system_allowed_to_be_powered ()
 true if system can work at all (charger or output mode)
 
void lampda::logic::behavior::set_power_on ()
 set system state to "output on"
 
void lampda::logic::behavior::set_power_off ()
 set system state to "output off". Can be ignored
 
void lampda::logic::behavior::go_to_external_battery_mode ()
 Try to switch to external battery mode.
 
bool lampda::logic::behavior::is_in_start_logic_state ()
 return true if the system is in start mode
 
bool lampda::logic::behavior::is_in_output_state ()
 return true if the system is in output mode
 
bool lampda::logic::behavior::is_in_charge_state ()
 return true if the system is in charge mode
 
void lampda::logic::behavior::internal::handle_shutdown_state (const bool shouldSaveUserParameters=true, const bool shouldSaveSystemParameters=true)
 DO NOT USE: shutdown the lamp immediatly. only for emmergency/special cases.
 
uint32_t lampda::logic::behavior::internal::get_bluetooth_auto_activation_left ()
 return the remaining bluetooth auto activations
 
void lampda::logic::behavior::sunset::progress_update (const float progress)
 signal to behavior the advance of the sunset timer
 

Detailed Description

Basic controller behavior, including alerts and user interactions.

Function Documentation

◆ handle_shutdown_state()

void lampda::logic::behavior::internal::handle_shutdown_state ( const bool  shouldSaveUserParameters = true,
const bool  shouldSaveSystemParameters = true 
)

DO NOT USE: shutdown the lamp immediatly. only for emmergency/special cases.

Parameters
[in]shouldSaveUserParametersIf False, no user parameters will be written to memory
[in]shouldSaveSystemParametersIf False, no system parameters will be written to memory