FLEX RX: comprehensive decoder rewrite (#3131)

Baseband (proc_flex.cpp):
- Fix numeric vector field width (3-bit n+1 for types 3,4,7)
- Fix capcode range classification for long address components
- Add long address decode (Set 1-2, 1-3/1-4, 2-3)
- Add vector checksum validation (4-bit nibble sum)
- Add tone-only boundary detection via vector pre-scan
- Add idle phase detection (skip all-zeros/all-ones before BCH)
- Skip spurious TON for capcode 1 (BCH-corrected idle artifact)
- Add BIW parsing: SSID1/SSID2, DATE, TIME, TZ, SYSMSG, CHAN
- Add alpha fragment flags: frag, more_frag, seq, new, maildrop, sig
- Add secure message enc= field (alpha/binary/separate)
- Add numbered numeric flags: seq, new, fmt
- Add HEX/Binary header decode: block_bits, new, maildrop, rtl
- Add short instruction decode: temp group slot/target, sys events
- Add short message (SMSG) decode: tone/numeric/source/numbered
- Add group/temp-group/priority flags per address
- Add S2 C-pattern detection with ±1 symbol boundary correction
- Extract FIW roaming, repeat, traffic fields
- Replace snprintf with lightweight str_* helpers (no heap/_sbrk)
- Mark uncorrectable BCH words as ? instead of aborting phase
- ETX/NUL handling: trim trailing padding, show mid-message as ?

App (ui_flex_rx.cpp):
- Add status bar: cycle/frame, bitrate, polarity, time, timezone
- Add network info bar: LID, CZ, CC, roaming flag
- Pipe-delimited serial output for all message types
- BIW events to serial and status bar (not console)
- Human-readable console: +GRP for temp group, G/TG/P flags
- USB serial via UsbSerialAsyncmsg

Packet (flex_defs.hpp):
- uint64_t capcode (long address support)
- 256-byte message buffer
- Fragment flags, BIW raw values, address type, group/priority

Known limitation: phase label unreliable on multi-phase modes
(3200/2FSK, 6400/4FSK). Data always decodes correctly.
This commit is contained in:
VasylSamoilov
2026-04-10 09:37:38 +03:00
committed by GitHub
parent dd006b4830
commit cf44076a34
5 changed files with 1035 additions and 81 deletions
+18 -3
View File
@@ -26,10 +26,17 @@ class FlexAppView : public View {
NavigationView& nav_;
// Saved settings
rf::Frequency frequency_value{931740000}; // Default FLEX frequency
rf::Frequency frequency_value{931740000};
RxRadioState radio_state_{};
// Status bar state (updated from BIW packets)
char status_time_[12]{}; // "HH:MM:SS"
char status_tz_[12]{}; // "UTC+N"
uint16_t status_lid_{0};
uint16_t status_cz_{0};
uint16_t status_cc_{0};
// Message storage for console redraw
static constexpr size_t MAX_MESSAGES = 20;
std::vector<std::string> messages{};
@@ -54,9 +61,17 @@ class FlexAppView : public View {
RSSI rssi{
{UI_POS_X(21), 0, UI_POS_WIDTH(9), 4}};
// Message display area (below controls, account for status bar)
// Status rows (rows 1-2)
Text text_status1{
{0, 1 * 16, screen_width, 16},
""};
Text text_status2{
{0, 2 * 16, screen_width, 16},
""};
// Message display area (below status rows)
Console console{
{0, 1 * 16, screen_width, screen_height - 2 * 16}};
{0, 3 * 16, screen_width, screen_height - 4 * 16}};
// Persistent settings manager
app_settings::SettingsManager settings_{