mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
RPC calls
This commit is contained in:
@@ -19,11 +19,12 @@
|
||||
[[noreturn]] void LoopManager::control_loop() const {
|
||||
uint8_t buffer[512];
|
||||
while (true) {
|
||||
m_messaging_interface->recv(reinterpret_cast<char *>(buffer), 512, PC_ADDR,
|
||||
ACTUATOR_CMD_TAG);
|
||||
m_actuator->actuate(buffer);
|
||||
send_sensor_reading(false);
|
||||
}
|
||||
if (m_messaging_interface->recv(buffer, 512,
|
||||
ACTUATOR_CMD_TAG)) {
|
||||
m_actuator->actuate(buffer);
|
||||
send_sensor_reading(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[[noreturn]] void LoopManager::sensor_loop(char *args) {
|
||||
@@ -53,7 +54,7 @@
|
||||
that->m_config_manager.get_module_id(), that->m_config_manager.get_module_type(),
|
||||
module_ids, casted_orientations, that->m_messaging_interface->get_connection_type(),
|
||||
that->m_messaging_interface->get_leader());
|
||||
that->m_messaging_interface->send(static_cast<char *>(data), size, PC_ADDR,
|
||||
that->m_messaging_interface->send((uint8_t *)data, size, PC_ADDR,
|
||||
TOPOLOGY_CMD_TAG, false);
|
||||
vTaskDelay(METADATA_PERIOD_MS / portTICK_PERIOD_MS);
|
||||
}
|
||||
@@ -61,10 +62,10 @@
|
||||
|
||||
[[noreturn]] void LoopManager::metadata_rx_loop(char *args) {
|
||||
const auto that = reinterpret_cast<LoopManager *>(args);
|
||||
const auto buffer = std::make_unique<std::vector<char>>();
|
||||
const auto buffer = std::make_unique<std::vector<uint8_t>>();
|
||||
buffer->resize(512);
|
||||
while (true) {
|
||||
that->m_messaging_interface->recv(buffer->data(), 512, PC_ADDR, METADATA_RX_TAG);
|
||||
that->m_messaging_interface->recv(buffer->data(), 512, METADATA_RX_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +75,6 @@ void LoopManager::send_sensor_reading(bool durable) const {
|
||||
if (m_actuator) {
|
||||
auto data = m_actuator->get_sensor_data();
|
||||
const auto [ptr, size] = smb.build_sensor_message(data);
|
||||
m_messaging_interface->send(reinterpret_cast<char *>(ptr), size, PC_ADDR, SENSOR_TAG, durable);
|
||||
m_messaging_interface->send((uint8_t *)ptr, size, PC_ADDR, SENSOR_TAG, durable);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user