software:firmware
MakAir Firmware
|
Manage alarm features. More...
#include <alarm_controller.h>
Public Member Functions | |
AlarmController () | |
Default constructor. More... | |
void | snooze () |
Snooze alarm for 2 minutes. More... | |
void | unsnooze () |
Unsnooze alarms. More... | |
bool | isSnoozed () const |
Check if alarms are currently snoozed. More... | |
void | detectedAlarm (uint8_t p_alarmCode, uint32_t p_cycleNumber, uint32_t p_expected, uint32_t p_measured) |
Mark a specific alarm as detected. More... | |
void | notDetectedAlarm (uint8_t p_alarmCode) |
Reset detection of a specific alarm. More... | |
void | runAlarmEffects (uint32_t p_tick) |
Run effects (buzzer, LCD message, LED) according to the currently triggered alarms. More... | |
void | updateCoreData (uint32_t p_tick, uint16_t p_pressure, CyclePhases p_phase, uint32_t p_cycle_number) |
Update internal state of alarm controller with data from pressure controller. More... | |
uint8_t * | triggeredAlarms () |
Get the alarms triggered during this cycle. More... | |
void | updateEnabledAlarms (Alarms enabledAlarms) |
Update the list of enabled alarms (alarms not provided here will have no effects) More... | |
Private Attributes | |
AlarmPriority | m_highestPriority |
Highest priority of the currently triggered alarms. More... | |
uint32_t | m_snoozeTime |
Time when snoozed was triggered. More... | |
Alarm | m_alarms [ALARMS_SIZE] |
Collections of available alarms. More... | |
bool | m_snoozedAlarms [ALARMS_SIZE] |
Collections of snoozed alarms. More... | |
uint8_t | m_triggeredAlarms [ALARMS_SIZE] |
Alarms currently triggered. More... | |
uint16_t | m_tick |
Current pressure. More... | |
uint16_t | m_pressure |
Current pressure. More... | |
CyclePhases | m_phase |
Current phase. More... | |
uint32_t | m_cycle_number |
Current cycle number. More... | |
bool | m_unsnooze |
Is unsnoozed right now. More... | |
Manage alarm features.
Definition at line 52 of file alarm_controller.h.
AlarmController::AlarmController | ( | ) |
Default constructor.
Definition at line 27 of file alarm_controller.cpp.
void AlarmController::detectedAlarm | ( | uint8_t | p_alarmCode, |
uint32_t | p_cycleNumber, | ||
uint32_t | p_expected, | ||
uint32_t | p_measured | ||
) |
Mark a specific alarm as detected.
p_alarmCode | The code of the alarm |
p_cycleNumber | The cycle number since the device startup |
p_expected | The expected value |
p_measured | The measured value that was different from the expected value thus triggering the alarm |
Definition at line 207 of file alarm_controller.cpp.
|
inline |
void AlarmController::notDetectedAlarm | ( | uint8_t | p_alarmCode | ) |
Reset detection of a specific alarm.
p_alarmCode | The code of the alarm |
Definition at line 241 of file alarm_controller.cpp.
void AlarmController::runAlarmEffects | ( | uint32_t | p_tick | ) |
Run effects (buzzer, LCD message, LED) according to the currently triggered alarms.
p_tick | Centile in the respiratory cycle |
Definition at line 268 of file alarm_controller.cpp.
void AlarmController::snooze | ( | ) |
Snooze alarm for 2 minutes.
There is no more buzzer during the alarm
Definition at line 188 of file alarm_controller.cpp.
|
inline |
void AlarmController::unsnooze | ( | ) |
void AlarmController::updateCoreData | ( | uint32_t | p_tick, |
uint16_t | p_pressure, | ||
CyclePhases | p_phase, | ||
uint32_t | p_cycle_number | ||
) |
Update internal state of alarm controller with data from pressure controller.
Definition at line 361 of file alarm_controller.cpp.
void AlarmController::updateEnabledAlarms | ( | Alarms | enabledAlarms | ) |
Update the list of enabled alarms (alarms not provided here will have no effects)
enabledAlarms | The new list of enabled alarms |
Definition at line 371 of file alarm_controller.cpp.
|
private |
Collections of available alarms.
Definition at line 123 of file alarm_controller.h.
|
private |
Current cycle number.
Definition at line 141 of file alarm_controller.h.
|
private |
Highest priority of the currently triggered alarms.
Definition at line 117 of file alarm_controller.h.
|
private |
Current phase.
Definition at line 138 of file alarm_controller.h.
|
private |
Current pressure.
Definition at line 135 of file alarm_controller.h.
|
private |
Collections of snoozed alarms.
Definition at line 126 of file alarm_controller.h.
|
private |
Time when snoozed was triggered.
Definition at line 120 of file alarm_controller.h.
|
private |
Current pressure.
Definition at line 132 of file alarm_controller.h.
|
private |
Alarms currently triggered.
Definition at line 129 of file alarm_controller.h.
|
private |
Is unsnoozed right now.
Definition at line 144 of file alarm_controller.h.