From 938978f5d4449ba45db2a3751052472608b28f56 Mon Sep 17 00:00:00 2001 From: Jasper Date: Sat, 28 May 2022 02:18:57 +0200 Subject: [PATCH] Unmarshal AMI info --- include/AppState.h | 1 + src/AppState.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/AppState.h b/include/AppState.h index fea7e40..9bbb8ac 100644 --- a/include/AppState.h +++ b/include/AppState.h @@ -35,6 +35,7 @@ public: private: void unmarshal_mission_select(uint8_t* data); + void unmarshal_ami(uint8_t* data); // This is optional so that we can still run the code on a PC without I2C std::optional i2c_dev_file; diff --git a/src/AppState.cpp b/src/AppState.cpp index 8002b0d..ab8a611 100644 --- a/src/AppState.cpp +++ b/src/AppState.cpp @@ -92,6 +92,9 @@ void AppState::poll() { case AppView::MISSION_SELECT: unmarshal_mission_select(data); break; + case AppView::AMI: + unmarshal_ami(data); + break; default: throw std::runtime_error(fmt::format("Unknown view: {}", view)); } @@ -104,4 +107,9 @@ Mission AppState::get_mission() const { return mission; } void AppState::unmarshal_mission_select(uint8_t* data) { mission = static_cast(data[1]); spdlog::info("Mission after poll: {}", mission); +} + +void AppState::unmarshal_ami(uint8_t* data) { + mission = static_cast(data[1]); + spdlog::info("Mission after poll: {}", mission); } \ No newline at end of file