#include #include "peripherals/uart_serial.h" #include "peripherals/usb_serial.h" #include "peripherals/wireless_comms.h" /// /// So i lost all the code from the previous version of this due to messing with git. /// I only have a binary file to flash onto the esp for that /// so this is my attempt at reimplementation asap /// /// Nicholas - 23/08/2026 @ 21:36 /// const char *test = "amai zeg\n"; #define NODE_NUMBER 1 #define TOTAL_NUMBER_OF_NODES 4 // testing if the release packaging works 2 2 uint8_t node_mac[ESP_NOW_ETH_ALEN] = {0xDE, 0xD5, 0xEC, 0x00, 0x00, 0x02}; uint8_t peer_mac[ESP_NOW_ETH_ALEN] = {0xDE, 0xD5, 0xEC, 0x00, 0x00, 0x01}; uint8_t peer_list[TOTAL_NUMBER_OF_NODES][ESP_NOW_ETH_ALEN]; typedef struct communications { uart_serial uart; wireless_comms *wireless; } communications; void main_task(void *pvParameter) { auto comms = reinterpret_cast(pvParameter); uart_serial uart = comms->uart; char data; while (true) { if (usb_serial::read_byte(&data)) { wireless_comms::send_byte(data); uart.write_byte(&data); } if (uart.read_byte(&data)) { ESP_LOGI("uart", "received data"); wireless_comms::send_byte(data); usb_serial::write_byte(&data); } } } extern "C" void app_main(void) { esp_log_level_set("*", ESP_LOG_NONE); usb_serial::init(); uart_serial uart(UART_NUM_0, GPIO_NUM_18, GPIO_NUM_19, 9600); wireless_comms wireless; //usb_serial::write(test,strlen(test)); communications comms = {.uart = uart, .wireless = &wireless}; /* uint8_t peer_gen[ESP_NOW_ETH_ALEN] = {0xDE, 0xD5, 0xEC, 0x00, 0x00, 0x00}; for(int i=2;i