mirror of
https://github.com/adrigongv23/G26---Telemetry-Software.git
synced 2026-08-25 19:43:16 +02:00
Radio subida
This commit is contained in:
parent
5f81e54793
commit
f0db3a8aeb
147 changed files with 11343 additions and 0 deletions
50
Radio/Radio_receptor/Radio_receptor.ino
Normal file
50
Radio/Radio_receptor/Radio_receptor.ino
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#include <Arduino.h>
|
||||
#include "espnow.hpp"
|
||||
|
||||
void setup()
|
||||
{
|
||||
// UART USB con el PC.
|
||||
// IMPORTANTE: tiene que coincidir con el baudrate del programa de Windows.
|
||||
// Buffer grande para que no se pierdan bytes cuando el PC envia audio por UART.
|
||||
Serial.setRxBufferSize(4096);
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
|
||||
#if DEBUG_SERIAL
|
||||
Serial.println();
|
||||
Serial.println("================================");
|
||||
Serial.println(" Puente UART <-> ESP-NOW LR");
|
||||
Serial.println("================================");
|
||||
#endif
|
||||
|
||||
if (!init_espnow_puente_bidir()) {
|
||||
#if DEBUG_SERIAL
|
||||
Serial.println("FALLO: no se pudo iniciar ESP-NOW bidireccional");
|
||||
#endif
|
||||
while (true) {
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG_SERIAL
|
||||
Serial.println("Puente listo: PC <-> UART <-> ESP-NOW LR");
|
||||
#endif
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
static bool pilot_first = true;
|
||||
|
||||
// Cada funcion procesa un numero limitado de paquetes. Ademas se alterna
|
||||
// el orden para que ninguno de los dos sentidos monopolice el loop.
|
||||
if (pilot_first) {
|
||||
procesar_espnow_y_enviar_pc();
|
||||
procesar_uart_y_enviar_espnow();
|
||||
} else {
|
||||
procesar_uart_y_enviar_espnow();
|
||||
procesar_espnow_y_enviar_pc();
|
||||
}
|
||||
|
||||
pilot_first = !pilot_first;
|
||||
delay(0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue