Files
led-controller/bridge/main/radio_proto.h
T
jimmyandClaude Opus 5.5 4ab0c7c6d7 P4-Nano: controller port with the C6 as ESP-NOW radio, and the simulator
The controller now builds for the Waveshare ESP32-P4-Nano only (plus the linux
sim and the desktop); the S3 stays for the USB/network bridge in bridge/.

- radio-c6/: C6 firmware, esp-hosted plus ESP-NOW over peer data. The P4 loads
  it from the slave_fw partition when the C6 runs another version (c6_update.c)
- bridge_hosted.c: the C6 as the always-on "c6" bridge, and the P4 as a network
  bridge on UDP 8766 for the desktop
- Ethernet on the P4's EMAC, ES8311 mic; default address 192.168.50.20. The
  W5500, INMP441 and direct ESP-NOW code is gone
- The simulated rig at /sim/ is built into the board image, with an always-on
  "browser" bridge. Its frames go through a queue so a slow page cannot hold up
  the radio, and frames for simulated bars are not sent over the C6. Receiver
  buffers are on the heap; a bar's flash file is only written when it changes
- HTTP server: more handlers, sockets and stack for the rig
- docs/P4_NANO.md, README and Makefile updated; graphify output

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 21:45:25 +13:00

31 lines
1.6 KiB
C

/*
* The ESP32-P4-Nano's built-in radio: the P4 controller (main/bridge_hosted.c) and the ESP32-C6 next to it
* (radio-c6/) talk over esp-hosted's peer-data channel (SDIO), one message = msg_id + bytes.
*
* RADIO_MSG_TX P4 -> C6 a batch of frames to send on ESP-NOW
* RADIO_MSG_RX C6 -> P4 a batch of frames heard on ESP-NOW
* RADIO_MSG_CTL P4 -> C6 one bridge_proto message without SLIP or CRC: [type][body]
* (BRIDGE_MSG_HELLO, BRIDGE_MSG_SET_CHANNEL); both are answered with INFO
* RADIO_MSG_INFO C6 -> P4 the bridge_proto INFO body (BRIDGE_INFO_LEN bytes)
* RADIO_MSG_VERSION C6 -> P4 radio-c6's version (RADIO_CTL_VERSION asks for it)
*
* A batch is entries of mac(6) + len(1) + data(len), back to back: dst_mac going down, src_mac coming up.
* Each RPC costs a round trip over SDIO, so both sides pack every frame that is waiting into one message.
*/
#pragma once
#include <stdint.h>
#define RADIO_MSG_TX 0x52430001u
#define RADIO_MSG_RX 0x52430002u
#define RADIO_MSG_CTL 0x52430003u
#define RADIO_MSG_INFO 0x52430004u
#define RADIO_MSG_VERSION 0x52430005u // C6 -> P4: radio-c6's app version string, the answer to RADIO_CTL_VERSION
// RADIO_MSG_CTL types of its own, next to the bridge_proto ones
#define RADIO_CTL_VERSION 0x50 // ask for RADIO_MSG_VERSION. esp-hosted's own app description does not carry the
// C6 app's version (it reports esp-hosted's), so the P4 asks this way.
#define RADIO_BATCH_MAX 1536 // bytes per batch message
#define RADIO_ENTRY_HDR 7 // mac + len