diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-04-22 09:48:21 +1000 |
|---|---|---|
| committer | ailurux <ailuruxx@gmail.com> | 2024-04-22 09:48:21 +1000 |
| commit | 4eb1a074f7c7dc7e43789400bea5e6357e4546f5 (patch) | |
| tree | a93e29b51e5c902329d28a7b2064e0ffdcee9887 /src/system_fsm/booting.cpp | |
| parent | dfccf56f34484b3e9efcb48b240abdb22c577281 (diff) | |
| parent | 5b99267cb9f0344e519956096867aea5468ecf9f (diff) | |
| download | tangara-fw-4eb1a074f7c7dc7e43789400bea5e6357e4546f5.tar.gz | |
Merge branch 'main' of codeberg.org:cool-tech-zone/tangara-fw
Diffstat (limited to 'src/system_fsm/booting.cpp')
| -rw-r--r-- | src/system_fsm/booting.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp index bd394428..a89f35d9 100644 --- a/src/system_fsm/booting.cpp +++ b/src/system_fsm/booting.cpp @@ -62,6 +62,10 @@ auto Booting::entry() -> void { sServices->nvs( std::unique_ptr<drivers::NvsStorage>(drivers::NvsStorage::OpenSync())); + // HACK: tell the unit that it has an ERM motor (we will likely default to + // LRAs in future, but all the current units in the field use ERMs.) + sServices->nvs().HapticMotorIsErm(true); + // HACK: fix up the switch polarity on newer dev units // sServices->nvs().LockPolarity(false); @@ -85,7 +89,11 @@ auto Booting::entry() -> void { sServices->samd(std::unique_ptr<drivers::Samd>(drivers::Samd::Create())); sServices->touchwheel( std::unique_ptr<drivers::TouchWheel>{drivers::TouchWheel::Create()}); - sServices->haptics(std::make_unique<drivers::Haptics>()); + sServices->haptics(std::make_unique<drivers::Haptics>( + sServices->nvs().HapticMotorIsErm() + ? std::variant<drivers::ErmMotor, drivers::LraMotor>( + drivers::ErmMotor()) + : drivers::LraMotor())); auto adc = drivers::AdcBattery::Create(); sServices->battery(std::make_unique<battery::Battery>( |
