From 955a8ce303a9f8fd6a34009934e3d7aaeff3ec17 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 1 Aug 2023 12:13:48 +1000 Subject: Basic nvs init + bluetooth in the build --- src/system_fsm/booting.cpp | 4 +++- src/system_fsm/include/system_fsm.hpp | 2 ++ src/system_fsm/system_fsm.cpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/system_fsm') diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp index 4686748e..3d6c6a46 100644 --- a/src/system_fsm/booting.cpp +++ b/src/system_fsm/booting.cpp @@ -13,6 +13,7 @@ #include "event_queue.hpp" #include "gpios.hpp" #include "lvgl/lvgl.h" +#include "nvs.hpp" #include "relative_wheel.hpp" #include "spi.hpp" #include "system_events.hpp" @@ -50,9 +51,10 @@ auto Booting::entry() -> void { ESP_LOGI(kTag, "installing remaining drivers"); sSamd.reset(drivers::Samd::Create()); sBattery.reset(drivers::Battery::Create()); + sNvs.reset(drivers::NvsStorage::Open()); sTagParser.reset(new database::TagParserImpl()); - if (!sSamd || !sBattery) { + if (!sSamd || !sBattery || !sNvs) { events::System().Dispatch(FatalError{}); events::Ui().Dispatch(FatalError{}); return; diff --git a/src/system_fsm/include/system_fsm.hpp b/src/system_fsm/include/system_fsm.hpp index 6f0eb563..dc188780 100644 --- a/src/system_fsm/include/system_fsm.hpp +++ b/src/system_fsm/include/system_fsm.hpp @@ -16,6 +16,7 @@ #include "relative_wheel.hpp" #include "samd.hpp" #include "storage.hpp" +#include "nvs.hpp" #include "tag_parser.hpp" #include "tinyfsm.hpp" #include "touchwheel.hpp" @@ -54,6 +55,7 @@ class SystemState : public tinyfsm::Fsm { protected: static std::shared_ptr sGpios; static std::shared_ptr sSamd; + static std::shared_ptr sNvs; static std::shared_ptr sTouch; static std::shared_ptr sRelativeTouch; diff --git a/src/system_fsm/system_fsm.cpp b/src/system_fsm/system_fsm.cpp index 5f85d43c..527a8770 100644 --- a/src/system_fsm/system_fsm.cpp +++ b/src/system_fsm/system_fsm.cpp @@ -17,6 +17,7 @@ namespace system_fsm { std::shared_ptr SystemState::sGpios; std::shared_ptr SystemState::sSamd; +std::shared_ptr SystemState::sNvs; std::shared_ptr SystemState::sTouch; std::shared_ptr SystemState::sRelativeTouch; -- cgit v1.2.3