Display control code

This commit is contained in:
2026-02-07 01:38:05 -05:00
parent 2e9004ee34
commit 52ff24e649
21 changed files with 797 additions and 86 deletions

View File

@@ -0,0 +1,33 @@
//
// Created by Johnathon Slightham on 2025-07-15.
//
#include "control/OledActuator.h"
#include "TextControlMessageBuilder.h"
#include "SensorMessageBuilder.h"
#include "constants/module.h"
#include "driver/ledc.h"
#include "flatbuffers_generated/SensorMessage_generated.h"
#include "util/number_utils.h"
#include "esp_log.h"
void OledActuator::actuate(uint8_t *cmd) {
// todo: Do we want to verify flatbuffers here?
// Will introduce latency, and means that we need to also send the size to the actuate function.
const auto *text_control_message = Flatbuffers::TextControlMessageBuilder::parse_text_control_message(cmd);
const auto new_str = text_control_message->message()->str();
if (m_display_str != new_str) {
m_display_str = new_str;
m_oled->clear_display();
if (m_display_str != "") {
m_oled->display_text(m_display_str);
}
}
}
std::vector<Flatbuffers::sensor_value> OledActuator::get_sensor_data() {
return {Flatbuffers::target_text{m_display_str}};
}