Bridge: enhance CLI configuration options

This commit is contained in:
João Brázio 2025-10-03 00:20:09 +01:00
parent aa946bbe36
commit 8edcb46a28
No known key found for this signature in database
GPG key ID: 56A1490716A324DD
11 changed files with 162 additions and 118 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include "helpers/AbstractBridge.h"
#include "helpers/CommonCLI.h"
#include "helpers/SimpleMeshTables.h"
#include <RTClib.h>
@ -48,34 +49,31 @@ public:
static constexpr uint16_t BRIDGE_LENGTH_SIZE = sizeof(uint16_t);
static constexpr uint16_t BRIDGE_CHECKSUM_SIZE = sizeof(uint16_t);
/**
* @brief Default delay in milliseconds for scheduling inbound packet processing
*
* It provides a buffer to prevent immediate processing conflicts in the mesh network.
* Used in handleReceivedPacket() as: millis() + BRIDGE_DELAY
*/
static constexpr uint16_t BRIDGE_DELAY = 500; // TODO: maybe too high ?
protected:
/** Tracks bridge state */
bool _initialized = false;
/** Packet manager for allocating and queuing mesh packets */
mesh::PacketManager *_mgr;
/** RTC clock for timestamping debug messages */
mesh::RTCClock *_rtc;
/** Node preferences for configuration settings */
NodePrefs *_prefs;
/** Tracks seen packets to prevent loops in broadcast communications */
SimpleMeshTables _seen_packets;
/**
* @brief Constructs a BridgeBase instance
*
* @param prefs Node preferences for configuration settings
* @param mgr PacketManager for allocating and queuing packets
* @param rtc RTCClock for timestamping debug messages
*/
BridgeBase(mesh::PacketManager *mgr, mesh::RTCClock *rtc) : _mgr(mgr), _rtc(rtc) {}
BridgeBase(NodePrefs *prefs, mesh::PacketManager *mgr, mesh::RTCClock *rtc)
: _prefs(prefs), _mgr(mgr), _rtc(rtc) {}
/**
* @brief Gets formatted date/time string for logging