Pulizia: rimosso codice morto RC/SBUS/PWM e uplink ESP-NOW inutilizzato

terseCRSF vendorizzata: rimosse initialise/sbus_initialise/readCrsfFrame/
decodeRC/printPWM/prepSBUS/bytesToPWM/pwmToBytes/sendSBUS e i membri/buffer
SBUS-PWM (sb_bytes, pwm_val, crsf_port, sbus_port, RC_BUILD/SBUS machinery).
Usiamo solo decodeTelemetry: mantenuti i decoder + helper (bytes2*, wrap360,
crc8_dvb_s2[_sbuf_accum] usata dalla patch CRC, printByte/printBytes). ~283
righe in meno, nessun riferimento pendente (verificato con grep su 01/02/03).

EspNowCrsf: rimosso sendRaw() e il peer broadcast in begin() (uplink
sperimentale morto, il backpack e' downlink-only). Ora RX-only pulito.

main.cpp: commento "MAVLink v1" -> "v2" (la lib emette v2).

DA VERIFICARE A BANCO con un build (qui non compilabile).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Francesco Zanin
2026-06-24 16:55:41 +02:00
parent f8bd99b89d
commit 5d6f646a5e
5 changed files with 4 additions and 334 deletions

View File

@@ -56,13 +56,6 @@ void begin(const uint8_t uid[6]) {
if (esp_now_init() != ESP_OK) return;
esp_now_register_recv_cb(onRecv);
// Peer broadcast per l'invio sperimentale (uplink)
esp_now_peer_info_t peer = {};
memset(peer.peer_addr, 0xFF, 6); // broadcast
peer.channel = 1;
peer.encrypt = false;
esp_now_add_peer(&peer);
}
bool poll(uint8_t* out, uint16_t* outLen, uint16_t maxLen) {
@@ -83,11 +76,6 @@ bool poll(uint8_t* out, uint16_t* outLen, uint16_t maxLen) {
uint32_t framesReceived() { return s_received; }
uint32_t framesDropped() { return s_dropped; }
bool sendRaw(const uint8_t* data, uint16_t len) {
static const uint8_t bcast[6] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
return esp_now_send(bcast, data, len) == ESP_OK;
}
#ifdef UNIT_TEST
void test_injectRaw(const uint8_t* data, uint16_t len) { onRecv(nullptr, data, len); }

View File

@@ -1,11 +1,9 @@
// ============================================================
// EspNowCrsf - ricezione (e invio sperimentale) di frame CRSF
// trasportati su ESP-NOW dal TX Backpack ExpressLRS.
// EspNowCrsf - ricezione di frame CRSF trasportati su ESP-NOW
// dal TX Backpack ExpressLRS.
//
// - begin(uid): imposta WiFi STA, MAC=UID, canale 1, ESP-NOW.
// - poll(): estrae il prossimo frame CRSF grezzo ricevuto.
// - sendRaw(): invio ESP-NOW (uplink) -- vedi nota uplink in
// mode_msp.cpp: NON raggiunge l'FC con ELRS stock.
//
// Il frame CRSF restituito inizia al sync byte (0xC8/0xEA):
// [0]=sync [1]=len [2]=type [3..]=payload [..]=crc
@@ -26,10 +24,6 @@ bool poll(uint8_t* out, uint16_t* outLen, uint16_t maxLen);
uint32_t framesReceived();
uint32_t framesDropped();
// Invio ESP-NOW grezzo verso il peer (broadcast). Sperimentale.
// Ritorna true se esp_now_send ha accettato il pacchetto.
bool sendRaw(const uint8_t* data, uint16_t len);
#ifdef UNIT_TEST
// Hook di test (definita solo in build di test, PlatformIO imposta
// UNIT_TEST automaticamente per `pio test`: zero impatto sul firmware