This commit is contained in:
2025-07-14 00:09:35 -04:00
parent f94f3bbc8b
commit 219467fc1a
3 changed files with 8 additions and 5 deletions

View File

@@ -105,7 +105,10 @@ void CommunicationRouter::route(uint8_t* buffer, const size_t length) const {
} else if (mpi_message->destination() == PC_ADDR && this->m_leader == m_module_id) { } else if (mpi_message->destination() == PC_ADDR && this->m_leader == m_module_id) {
std::cout << "Routing to wifi [dest:" << static_cast<int>(mpi_message->destination()) << ", length: " << length << "]" << std::endl; std::cout << "Routing to wifi [dest:" << static_cast<int>(mpi_message->destination()) << ", length: " << length << "]" << std::endl;
this->m_tcp_server->send_msg(reinterpret_cast<char *>(buffer), 512); this->m_tcp_server->send_msg(reinterpret_cast<char *>(buffer), 512);
} else { } else if (mpi_message->destination() == PC_ADDR) {
std::cout << "Routing to wireline for wifi [dest:" << static_cast<int>(mpi_message->destination()) << ", length: " << length << "]" << std::endl;
this->m_data_link_manager->send(this->m_leader, buffer, length, FrameType::MOTOR_TYPE, 0);
}else {
std::cout << "Routing to wireline [dest:" << static_cast<int>(mpi_message->destination()) << ", length: " << length << "]" << std::endl; std::cout << "Routing to wireline [dest:" << static_cast<int>(mpi_message->destination()) << ", length: " << length << "]" << std::endl;
this->m_data_link_manager->send(mpi_message->destination(), buffer, length, FrameType::MOTOR_TYPE, 0); this->m_data_link_manager->send(mpi_message->destination(), buffer, length, FrameType::MOTOR_TYPE, 0);
} }

View File

@@ -40,13 +40,13 @@ public:
m_last_leader_updated(std::chrono::system_clock::now()){ m_last_leader_updated(std::chrono::system_clock::now()){
update_leader(); update_leader();
xTaskCreate(router_thread, "communication_router", 3072, this, 3, &this->m_router_thread); xTaskCreate(router_thread, "communication_router", 4096, this, 3, &this->m_router_thread);
const auto num_channels = MODULE_TO_NUM_CHANNELS_MAP[ConfigManager::get_module_type()]; const auto num_channels = MODULE_TO_NUM_CHANNELS_MAP[ConfigManager::get_module_type()];
this->m_link_layer_threads.resize(num_channels); this->m_link_layer_threads.resize(num_channels);
for (uint8_t i = 0; i < num_channels; i++) { for (uint8_t i = 0; i < num_channels; i++) {
auto *params = new link_layer_thread_params(this, i); auto *params = new link_layer_thread_params(this, i);
xTaskCreate(link_layer_thread, "communication_router_rmt", 3072, params, 3, &this->m_link_layer_threads[i]); xTaskCreate(link_layer_thread, "communication_router_rmt", 4096, params, 3, &this->m_link_layer_threads[i]);
} }
} }

View File

@@ -16,9 +16,9 @@
char buffer[512]; char buffer[512];
while (true) { while (true) {
messaging_interface->recv(buffer, 512, 0, 1); messaging_interface->recv(buffer, 512, 0, 1);
std::cout << buffer << std::endl; //std::cout << buffer << std::endl;
std::string s = std::format("Hello from number {} board!", ConfigManager::get_module_id()); std::string s = std::format("num {} bo", ConfigManager::get_module_id());
messaging_interface->send(s.data(), s.size(), 0, 2, true); messaging_interface->send(s.data(), s.size(), 0, 2, true);
ESP_LOGI("MEM", "Free internal RAM: %d", heap_caps_get_free_size(MALLOC_CAP_8BIT)); ESP_LOGI("MEM", "Free internal RAM: %d", heap_caps_get_free_size(MALLOC_CAP_8BIT));