@@ -297,7 +297,7 @@ Questo meccanismo e' usato sia da `healthCheck()` che da `alert test`.
297297- Creata ` CmdCtx ` struct per output unificato (serial/buffer)
298298- ` dispatchSharedCommand() ` contiene ~ 40 comandi condivisi (prima duplicati)
299299- ` processCommand() ` e ` processRemoteCommand() ` diventati thin wrapper
300- - Comandi serial-only: help, newid, nodetype, passwd , tempradio, test, contacts, msg
300+ - Comandi serial-only: help, newid, nodetype, password , tempradio, test, contacts, msg
301301- Comandi remote-only: set password, set guest, report (paginato)
302302
303303** Risparmio merge CLI** : -3,164 B Flash
@@ -486,6 +486,57 @@ Floor 5dBm, ceiling MC_TX_POWER.
486486
487487---
488488
489+ ## Fase 4: Region System (MeshCore 1.10.0+) (COMPLETATA)
490+
491+ ### Implementazione
492+ Deny-based flood filtering allineato al protocollo MeshCore. Vedi ` docs/REGION_SCOPE_DESIGN.md ` per i dettagli.
493+
494+ ** Fase 4.1: Transport Code in Packet.h**
495+ - ` uint16_t transport_codes[2] ` aggiunto a MCPacket
496+ - ` serialize() ` /` deserialize() ` aggiornati per wire format con transport codes
497+ - ` hasTransportCodes() ` helper
498+ - Costo: +48 B Flash, +16 B RAM
499+
500+ ** Fase 4.2: RegionMap Data Structure**
501+ - ` src/mesh/RegionMap.h ` : RegionEntry/RegionMap classes
502+ - SHA256 key derivation, HMAC-SHA256 transport code verification
503+ - 4 region slots + wildcard entry
504+ - Costo: +272 B Flash, +168 B RAM
505+
506+ ** Fase 4.3: Forwarding Integration**
507+ - Region filter in ` shouldForward() ` di main.cpp
508+ - TRANSPORT_FLOOD: check ` regionMap.findMatch() ` contro transport codes
509+ - Legacy FLOOD: check wildcard ` REGION_DENY_FLOOD ` flag
510+ - Default: forward everything (nessuna regione configurata = nessun filtro)
511+
512+ ** Fase 4.4: CLI Commands + Flash Optimization**
513+ - ` region ` — lista wildcard e entry con stato flood (A=allow, D=deny)
514+ - ` region put/remove/allowf/denyf <name> ` — gestione regioni (admin only)
515+ - Per liberare spazio Flash: wrapped ` Serial.printf ` in mesh/ headers con ` #ifndef SILENT ` ,
516+ compresso help text, rimossi alias CLI duplicati (~ 12 comandi)
517+ - Costo CLI: +744 B Flash (netto dopo ottimizzazioni: ~ 1,088 B liberati)
518+
519+ ** Alias rimossi (v0.8.0):**
520+ - ` passwd ` → usare ` password `
521+ - ` erase ` → usare ` reset `
522+ - ` stats-radio ` → usare ` radiostats `
523+ - ` stats-packets ` → usare ` packetstats `
524+ - ` set repeat ` /` get repeat ` (getter) → usare ` repeat `
525+ - ` set advert.interval ` /` get advert.interval ` (getter) → usare ` advert interval `
526+ - ` get radio ` → usare ` radio `
527+ - ` set tx ` /` get tx ` (getter) → usare ` txpower `
528+ - ` txpower auto on/off ` → usare ` set tx auto on/off `
529+ - ` set name ` (getter) → usare ` get name ` o ` name `
530+ - ` set guest.password ` (serial) → usare ` password guest `
531+
532+ ** Password syntax cambiata:**
533+ - Serial: ` password admin <pw> ` / ` password guest <pw> `
534+ - Remote: ` password <pw> ` / ` set guest.password <pw> ` (invariato)
535+
536+ ### Ordine completato: Fase 0 -> 1 -> 2 -> 2.5 -> 3 -> 3.1 -> 3.2 -> 3.3 -> 3.4 -> 4
537+
538+ ---
539+
489540## Riepilogo risorse finali
490541
491542| Fase | Flash | RAM | EEPROM | Note |
@@ -497,13 +548,14 @@ Floor 5dBm, ceiling MC_TX_POWER.
497548| Fase 2.5 (Ottimiz) | -12,916 B | -368 B | 0 | Merge CLI, no float |
498549| Fase 3 (Mailbox) | +1,752 B | +512 B | 172 B | 2 EEPROM + 4 RAM slots |
499550| Fase 3.1 (Fix+Dedup) | +136 B | 0 | 0 | Session expiry, dedup, CLI fix |
500- | Fase 3.2 (DIRECT+Health) | ~ +200 B | 0 | 0 | DIRECT routing, health dashboard, loop prevention |
501- | Fase 3.3 (SNR Delay) | ~ +50 B | 0 | 0 | Lookup table 22B, nuove funzioni , RSSI threshold |
551+ | Fase 3.2 (DIRECT+Health) | ~ +200 B | 0 | 0 | DIRECT routing, health dashboard |
552+ | Fase 3.3 (SNR Delay) | ~ +50 B | 0 | 0 | Lookup table, RSSI threshold |
502553| Fase 3.4 (QH+CB+ATX) | ~ +1,200 B | +57 B | 0 | Quiet Hours, Circuit Breaker, Adaptive TX |
503- | ** Totale** | ** ~ -7,882 B** | ** -255 B** | ** +172 B** | |
504- | ** Finale (stimato)** | ** ~ 120,798 B (92.1%)** | ** 7,905 B (48.3%)** | ** 512/512** | |
554+ | Fase 4 (Regions) | ~ +1,064 B | +184 B | 0 | RegionMap, transport codes, CLI (-1,088 B ottimiz.) |
555+ | ** Totale** | ** ~ -6,818 B** | ** -71 B** | ** +172 B** | |
556+ | ** Finale (misurato)** | ** ~ 130,144 B (99.3%)** | ** ~ 8,696 B (53.1%)** | ** 512/512** | |
505557
506- ** Margine residuo** : ~ 10,274 B Flash liberi, 8,479 B RAM liberi
558+ ** Margine residuo** : ~ 928 B Flash liberi, ~ 7,688 B RAM liberi
507559
508560---
509561
@@ -514,4 +566,5 @@ Floor 5dBm, ceiling MC_TX_POWER.
514566- ** Mailbox** : messaggio consegnato entro 30s dal ritorno del nodo destinatario
515567- ** Stabilita'** : zero regressioni sui 66 test firmware esistenti
516568- ** SNR Adaptive Delay** : DIRECT delay < FLOOD delay; SNR migliore = ritrasmissione piu' veloce; pacchetti sotto -120 dBm scartati
517- - ** Flash** : margine residuo ~ 11.4 KB dopo tutte le feature (era 2.3 KB pre-ottimizzazione)
569+ - ** Region Filtering** : deny-based flood filtering compatibile con MeshCore 1.10.0+
570+ - ** Flash** : margine residuo ~ 928 B dopo tutte le feature
0 commit comments