summaryrefslogtreecommitdiff
path: root/src/system_fsm/system_fsm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/system_fsm/system_fsm.cpp')
-rw-r--r--src/system_fsm/system_fsm.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/system_fsm/system_fsm.cpp b/src/system_fsm/system_fsm.cpp
index 24f65a4f..78c4c53e 100644
--- a/src/system_fsm/system_fsm.cpp
+++ b/src/system_fsm/system_fsm.cpp
@@ -95,6 +95,16 @@ void SystemState::react(const internal::SamdInterrupt&) {
}
}
+void SystemState::react(const internal::BatteryTimerFired&) {
+ ESP_LOGI(kTag, "checking battery");
+ if (sBattery->UpdatePercent()) {
+ ESP_LOGI(kTag, "battery now at %u%%", sBattery->Percent());
+ BatteryPercentChanged ev{};
+ events::Ui().Dispatch(ev);
+ events::System().Dispatch(ev);
+ }
+}
+
} // namespace system_fsm
FSM_INITIAL_STATE(system_fsm::SystemState, system_fsm::states::Booting)