Unmarshal AMI info

This commit is contained in:
Jasper Blanckenburg 2022-05-28 02:18:57 +02:00
parent 0cd0ce6f3e
commit 938978f5d4
2 changed files with 9 additions and 0 deletions

View File

@ -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<int> i2c_dev_file;

View File

@ -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<Mission>(data[1]);
spdlog::info("Mission after poll: {}", mission);
}
void AppState::unmarshal_ami(uint8_t* data) {
mission = static_cast<Mission>(data[1]);
spdlog::info("Mission after poll: {}", mission);
}