Commit Graph

81 Commits

Author SHA1 Message Date
agessaman 1d52161332 Merge branch 'restore/upstream-duty-cycle' into restore/fem-rxgain 2026-07-09 17:54:45 -07:00
agessaman 1c9c6292e5 fix(mqtt): shed retransmissions, not capture, when duty cycle starves the pool
Load-testing the restored token bucket at 'set dutycycle 1' showed MQTT
capture dropping to exactly the TX rate. Queued retransmissions hold static-
pool packets with no expiry, so throttling parks the whole pool in the send
queue; Dispatcher::checkRecv() then discards received packets before logRx()
ever feeds the bridge — each completed TX frees exactly one packet for
exactly one more RX.

Observer builds now use RxReservePacketManager (fork-owned header): once the
free pool drops below a quarter of the pool, outbound packets are refused and
freed, so RX allocation and MQTT capture continue at full rate while the node
sheds repeat load it has no TX budget for anyway. Non-observer builds keep
upstream pool behavior via the same factory; StaticPoolPacketManager stays
byte-identical to upstream.
2026-07-09 17:54:38 -07:00
agessaman e905451dce feat(radio): drive LoRa FEM RX gain from radio_fem_rxgain (heltec_v4)
Completes the FEM RX-gain restoration begun in the CAD/prefs change, which
persisted radio_fem_rxgain but didn't yet drive the hardware. Also dropped
by the 22eb9b87 revert; restored to match upstream.

- MainBoard: setLoRaFemLnaEnabled()/canControlLoRaFemLna()/isLoRaFemLnaEnabled()
  virtuals (default: can't control — non-FEM boards report unsupported)
- heltec_v4: board overrides driving loRaFEMControl; LoRaFEMControl gains the
  isLNAEnabled() getter (it already tracked lna_enabled and drove the FEM)
- CLI: `set radio.fem.rxgain on/off` / `get radio.fem.rxgain` (guarded by
  canControlLoRaFemLna, so it reports "unsupported" on non-FEM boards)
- app startup applies the persisted pref: board.setLoRaFemLnaEnabled(
  _prefs.radio_fem_rxgain), beside setRxBoostedGainMode

Default is ON (upstream), so on FEM boards the LNA is enabled after upgrade —
a real reception behavior change to confirm on hardware. The other FEM
variants (heltec_t096/tower_v2/tracker_v2) need the same small board-override
addition; until then `radio.fem.rxgain` reports unsupported there (no
regression — status quo).

Builds: heltec_v4 repeater-observer + room-observer (FEM board), Heltec_v3
repeater (non-FEM, base virtuals no-op). NEEDS on-device validation on a
Heltec V4.
2026-07-09 11:20:07 -07:00
agessaman df90673d18 feat(radio): restore CAD support + radio_fem_rxgain persistence (upstream parity)
Continues restoring features dropped by the 22eb9b87 revert. Both were
upstream-tested code, not intentional fork removals.

CAD (hardware Channel Activity Detection / listen-before-talk before TX),
fully restored and functional:
- NodePrefs.cad_enabled + `set cad on/off` / `get cad` CLI (default off)
- RadioLibWrapper: _cad_enabled + setCADEnabled() + the scanChannel()/CAD
  branch in isChannelActive() (Phase 1 already restored the Dispatcher hook)
- getCADEnabled() overrides in the repeater/room/sensor apps (return the
  pref) and companion (always on, matching upstream)

radio_fem_rxgain: the NodePrefs field + /com_prefs persistence are restored
here at upstream's exact offsets (293 fem, 294 cad), which makes /com_prefs
byte-identical to upstream through the tail. The field is persisted and
defaults on (upstream default), but the per-board LNA *driving* + the
`radio.fem.rxgain` CLI are deferred to the FEM-hardware change (they depend
on board methods and want per-board bench testing).

The new-format /com_prefs tail grows from 3 to 5 bytes; the old-format
detection threshold and the host migration harness are updated accordingly
(all scenarios pass, incl. the non-MQTT-build variant).

Builds: Heltec_v3 repeater, repeater-observer, room-observer. (sensor /
plain-room / companion fail only on the pre-existing Timezone.h include
issue, unrelated to these changes.)
2026-07-09 11:12:57 -07:00
agessaman 2eb41baeda refactor(mqtt): migrate observer settings to MQTTPrefs structure
Refactored the handling of observer-related settings by moving them from
NodePrefs to a new MQTTPrefs structure. This change centralizes MQTT,
WiFi, timezone, SNMP, and alert configurations, improving code organization
and maintainability. The new structure allows for better separation of
concerns and prepares the codebase for future enhancements.
2026-06-26 08:59:48 -07:00
agessaman 985fda1382 Add AlertReporter integration to MyMesh 2026-06-17 20:02:39 -07:00
agessaman dcc8f826db Merge upstream/dev into mqtt-bridge-implementation-flex
Pick up 97 commits from upstream/dev, resolving conflicts in
CommonCLI prefs layout, board definitions, docs, and T-Beam Supreme
platformio config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 09:29:16 -07:00
Scott Powell 8fc2da5c98 * default now 8, per the will of the peoples. 2026-06-06 21:00:58 +10:00
Scott Powell 5f6821bb66 * new CLI config: flood.max.advert (default 16) 2026-06-06 13:09:24 +10:00
Sefinek cc05ae555a docs: fix typos, grammar, and formatting in FAQ and code comments 2026-06-02 22:12:18 +02:00
Scott Powell f66c1d0258 * simplified the new flood.max.unscoped pref 2026-06-02 14:15:33 +10:00
Chris Barker a33f3011a5 Feat: Adds flood.max.unscoped setting
Before this commit, there was no way to set a different max hop count
for unscoped messages.

Now with this change, by defaul it tracks the flood.max setting, until
a user provides a flood.max.unscoped value, which tax precidence for
packets if ROUTE_TYPE_FLOOD is true.
2026-06-01 21:30:17 +01:00
Adam Gessaman d669d4dbd4 Add new MQTT presets for Mesh Core CA and update compile-time defaults
- Introduced two new MQTT presets: `meshcore-ca-1` and `meshcore-ca-2`.
- Updated documentation to reflect compile-time configuration options for MQTT defaults, including slot presets, IATA, and timezone settings.
- Removed legacy default MQTT settings from the code, now relying on the new configuration approach.
2026-05-24 12:50:55 -07:00
Adam Gessaman 5a99492c1a Merge upstream/dev into mqtt-bridge-implementation-flex
Pick up meshcore-dev changes since last upstream merge.
2026-05-23 13:12:39 -07:00
Rastislav Vysoky 01500e55d8 Change room server flood advert interval to 47 hours 2026-05-21 14:53:49 +02:00
agessaman a866884059 Refactor alert PSK handling to exclusively use hex format
Updated the alert PSK implementation to remove base64 support, now requiring a 32-character hex format for private channel secrets. Adjusted related CLI commands, error messages, and internal handling to ensure consistency with the new format. This change enhances clarity and aligns with the mobile app's "Share Channel" output. Relevant updates made across multiple files, including documentation and preference handling.
2026-05-12 21:18:58 -07:00
agessaman 16dc49fa10 Enhance fault alert system with region-based scoping and banned channels
Updated the fault alert functionality to include an optional region name for scoping alert floods, allowing operators to override the default scope. Introduced a list of banned channels (e.g., Public PSK, `#test`, `#bot`) to prevent spamming community channels with alerts. The implementation ensures that alerts are only sent to private PSKs or non-banned hashtags. Relevant changes were made across multiple files, including updates to the CLI for setting and retrieving the new `alert.region` preference.
2026-05-11 13:45:01 -07:00
agessaman 80355f32ab Add fault alert functionality for WiFi and MQTT disconnections
Implemented a new fault alert system that broadcasts notifications over LoRa when WiFi or MQTT connections are down for a specified duration. The alerts are configurable via CLI commands, allowing operators to set private PSKs or hashtags for alert channels. Default settings for alert thresholds and intervals are established, and the system ensures that alerts do not spam the public channel. Updated relevant files to integrate this feature into the MyMesh implementations and CLI handling.
2026-05-10 19:19:17 -07:00
agessaman ff031f48bb Refactor MQTT origin handling to use effective origin logic
Updated MyMesh implementations in simple_repeater and simple_room_server to set mqtt_origin to an empty string, allowing the effective origin to follow node_name during publishing. Introduced new functions in MQTTBridge to manage effective origin retrieval and refresh from preferences, ensuring consistent behavior across MQTT operations. This change simplifies the origin management and enhances clarity in the codebase.
2026-05-09 17:06:00 -07:00
agessaman b37db66830 Merge upstream/dev into mqtt-bridge-implementation-flex
Merge meshcore-dev changes (kiss_modem targets, preamble SF tuning, CI).
Resolve conflicts: combine RadioLib preamble/watchdog fields; keep kiss_modem and MQTT envs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-09 16:37:11 -07:00
Scott Powell 0a8a0a4904 * Refactor: removed duplicated radio_rng_seed(), radio_set_params(), radio_set_tx_power() 2026-05-01 14:47:07 +10:00
agessaman bfcf017625 refactor(mqtt): update default TX packet settings and documentation
Changed the default setting for TX packets from disabled to 'advert' across multiple files, including documentation and example implementations. This aligns the behavior of the MQTT bridge with the new default preferences, ensuring that only the node's own advert packets are uplinked by default. Updated relevant comments and documentation to reflect these changes.
2026-04-25 09:32:23 -07:00
agessaman d6712c69c8 Merge mqtt-bridge-implementation into mqtt-bridge-implementation-flex
Integrate upstream/dev changes from merge 563d9a7 while preserving flex
MQTT memory and CLI behavior (slot commands, snmp, mqtt.rx/advert TX,
bridge.source sync, prefs layout, cert ignore rules).

Made-with: Cursor
2026-04-21 21:38:18 -07:00
agessaman 563d9a7d39 Merge upstream/dev into mqtt-bridge-implementation
Resolve conflicts: devcontainer Node feature; UITask USER_BTN + MQTT WiFi;
room server ctor with RegionMap + MQTTBridge; CommonCLI prefs layout
(rx_boosted_gain after owner_info), refactor get/set into handlers with
MQTT CLI branches and getBoard preserved.

Made-with: Cursor
2026-04-19 10:08:27 -07:00
Scott Powell 77d02e844f * bug fix 2026-04-17 14:38:03 +10:00
Scott Powell df1e12de3e * Repeater, room server: rule change for sendFloodReply() 2026-04-16 13:22:39 +10:00
Scott Powell 4131a455a2 * repeater: refactored 'region' CLI commands -> CommonCLI
* room server: added RegionMap, and new CommonCLI wiring, default_scope handling
* sensor: only minimal RegionMap wiring. Still needs work to handle default-scope
2026-04-15 13:32:49 +10:00
agessaman 47b632aaa9 Refactor MQTT bridge handling in MyMesh to support RX and TX packet logging based on MQTT settings. Introduce mqtt_rx_enabled preference for default RX packet handling and update related logic in CommonCLI and MQTTBridge for improved configuration management. Enhance MQTTMessageBuilder to conditionally include SNR and RSSI for RX packets only. 2026-04-04 16:01:35 -07:00
agessaman 4a60f16683 Refactor logging and error handling in MyMesh and MQTTBridge. Implement checks for Serial availability before printing logs to prevent potential blocking. Update MQTTBridge to include circuit breaker logic for managing reconnect attempts and enhance slot management with new state tracking. Expand MQTTPresetDef to include a new preset with configurable token lifetime and retain options. 2026-03-23 20:21:47 -07:00
agessaman c67fb12b44 Refactor MQTT bridge implementation to use dynamic allocation for the MQTTBridge instance, preventing static initialization crashes on ESP32. Update related methods to check for bridge existence before invoking operations. Enhance documentation to clarify memory limits for active connection slots based on PSRAM availability. 2026-03-21 12:21:34 -07:00
agessaman b43e9618db Refactor MQTT bridge implementation to support up to 3 configurable connection slots with built-in presets for LetsMesh Analyzer (US/EU) and MeshMapper. Update CLI commands for slot management and enhance configuration migration from legacy settings. Adjust related documentation and code structure for improved clarity and functionality. 2026-03-20 22:41:41 -07:00
agessaman abe6e046fe Merge branch 'upstream/dev' into mqtt-bridge-implementation
Reverted prior dev merge, then merged current meshcore-dev dev. Resolved
CommonCLI by restoring MQTT prefs flow with upstream com_prefs layout
(rx_boosted_gain at offset 79), rxgain CLI, poweroff/shutdown, and FEM
variant files from upstream.

Made-with: Cursor
2026-03-20 15:55:39 -07:00
agessaman 22eb9b87a3 Revert "Merge remote-tracking branch 'origin/dev' into mqtt-bridge-implementation"
This reverts commit 2b63765522, reversing
changes made to 304719e8e0.
2026-03-20 15:54:14 -07:00
agessaman 2b63765522 Merge remote-tracking branch 'origin/dev' into mqtt-bridge-implementation 2026-03-20 06:06:06 -07:00
Orum b4b66521b6 Add MCU temperature to telemetry responses from room servers. 2026-03-16 17:34:16 -05:00
Scott Powell fcfdc5fc5b * Repeater and Room Server: flood advert timer now uses the path_hash_mode pref 2026-03-16 13:56:19 +11:00
ripplebiz cf0cc851d4 Merge pull request #1297 from ViezeVingertjes/feature/duty-cycle-token-bucket
Implement token bucket duty cycle enforcement
2026-03-08 23:54:32 +11:00
agessaman 304719e8e0 Remove default enabling of MQTT analyzer servers in MyMesh::begin for both simple_repeater and simple_room_server examples. 2026-03-07 10:51:04 -08:00
Daniel Novak c7568a8db0 Replace 0xFFFFFFFF sentinel with explicit getOutboundTotal()
Instead of overloading getOutboundCount() with a magic sentinel value,
add a dedicated getOutboundTotal() method to the PacketManager interface
that returns the total queue size without time filtering.

This eliminates the fragile convention that caused the regression and
makes the two operations — time-filtered count vs total count —
explicitly separate in the API.
2026-02-28 17:19:04 +01:00
agessaman 51e9907fa6 Merge upstream/dev into mqtt-bridge-implementation
Resolve conflicts in CommonCLI: keep upstream path_hash_mode and
sanitization (adc_multiplier, path_hash_mode constrain), retain
MQTT/NodePrefs layout and MQTT fields.

Made-with: Cursor
2026-02-25 19:41:42 -08:00
Scott Powell 9d5c4865c3 * room server fix 2026-02-24 01:08:11 +11:00
Scott Powell e52d57c065 * companion: new pref: path_hash_mode (0..2)
* companion: new field in CMD_SET_OTHER_PARAMS, path_hash_mode
* companion: CMD_SEND_SELF_ADVERT, cmd_frame[1] now holds the path hash size (0 = zero hop, 1..3 = flood path hash size)
2026-02-23 18:26:56 +11:00
Scott Powell a66773bac0 * CommonCLI: added "get/set path.hash.mode " 2026-02-23 14:25:19 +11:00
Scott Powell 3e76161e9c * refactor of Contact/Client out_path_len (stored in files), from signed to unsigned byte (+2 squashed commits)
Squashed commits:
[f326e25] * misc
[fa5152e] * new 'path mode' parsing in Dispatcher
2026-02-21 19:35:51 +11:00
Adam Gessaman 8b841d9cfd Merge remote-tracking branch 'origin/dev' into mqtt-bridge-implementation 2026-02-09 09:50:44 -08:00
Wessel Nieboer d0720c63c2 Allow negative tx power
Like SX1262 allows -9 dBm lowest, some allow lower but that probably
isn't useful
2026-02-06 02:24:51 +01:00
agessaman 2a84e58b3a Merge upstream/dev into mqtt-bridge-responsiveness-changes
Resolved conflicts in:
- examples/simple_repeater/MyMesh.cpp: kept analyzer/MQTT origin code, updated acl.load() signature
- examples/simple_room_server/MyMesh.cpp: kept MQTT bridge init, added acl parameter to _cli constructor
- src/helpers/CommonCLI.cpp: merged MQTT get commands with ADC/power management commands
2026-01-26 19:30:45 -08:00
liamcottle ed589f9620 boot adverts are now zero hop instead of flood 2026-01-26 22:20:36 +13:00
ripplebiz 153bcdc6a3 Merge pull request #1457 from oltaco/remote-set-prvkey
Allow set prv.key over LoRa, clear ACL and validate key
2026-01-25 14:46:41 +11:00
taco 96ef5e5efe allow set prv.key from remote, validate new prv.key 2026-01-25 01:32:48 +11:00