mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
//
|
|
// 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}};
|
|
}
|