Skip to content
21 changes: 17 additions & 4 deletions src/mesh/mesh-pb-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,29 @@ static inline int get_max_num_nodes()
#define MAX_NUM_CHANNELS (member_size(meshtastic_ChannelFile, channels) / member_size(meshtastic_ChannelFile, channels[0]))

// Traffic Management module configuration
// Enable per-variant by defining HAS_TRAFFIC_MANAGEMENT=1 in variant.h
// Enabled by default on ESP32 and nRF52 targets. Variants can still override
// either macro in variant.h for custom sizing or opt-out builds.
#ifndef HAS_TRAFFIC_MANAGEMENT
#if defined(ARCH_ESP32) || defined(ARCH_NRF52)
#define HAS_TRAFFIC_MANAGEMENT 1
#else
#define HAS_TRAFFIC_MANAGEMENT 0
#endif
#endif

// Cache size for traffic management (number of nodes to track)
// Can be overridden per-variant based on available memory
// Default sizing is conservative on nRF52 and all ESP32-family targets
// without PSRAM. Variants can still override this upward on boards that have
// enough headroom even without BOARD_HAS_PSRAM.
#ifndef TRAFFIC_MANAGEMENT_CACHE_SIZE
#if HAS_TRAFFIC_MANAGEMENT
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 1000
#if !HAS_TRAFFIC_MANAGEMENT
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 0
#elif defined(ARCH_NRF52)
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 1024
#elif defined(ARCH_ESP32) && defined(BOARD_HAS_PSRAM)
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 2048
#elif defined(ARCH_ESP32)
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 1024
#else
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 0
#endif
Expand Down
8 changes: 0 additions & 8 deletions variants/esp32s3/heltec_v4/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

// Enable Traffic Management Module for Heltec V4
#ifndef HAS_TRAFFIC_MANAGEMENT
#define HAS_TRAFFIC_MANAGEMENT 1
#endif
#ifndef TRAFFIC_MANAGEMENT_CACHE_SIZE
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 2048
#endif

// ---- GC1109 RF FRONT END CONFIGURATION ----
// The Heltec V4.2 uses a GC1109 FEM chip with integrated PA and LNA
// RF path: SX1262 -> Pi attenuator -> GC1109 PA -> Antenna
Expand Down
8 changes: 0 additions & 8 deletions variants/esp32s3/station-g2/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ Board Information: https://wiki.uniteng.com/en/meshtastic/station-g2
#define SX126X_MAX_POWER 19
#endif

// Enable Traffic Management Module for Station G2
#ifndef HAS_TRAFFIC_MANAGEMENT
#define HAS_TRAFFIC_MANAGEMENT 1
#endif
#ifndef TRAFFIC_MANAGEMENT_CACHE_SIZE
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 2048
#endif

/*
#define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_CHANNEL ADC_CHANNEL_3
Expand Down
9 changes: 0 additions & 9 deletions variants/nrf52840/tracker-t1000-e/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,6 @@ extern "C" {

#define HAS_SCREEN 0

// Enable Traffic Management Module for testing on T1000-E
// NRF52840 has 256KB RAM - 1024 entries uses ~10KB
#ifndef HAS_TRAFFIC_MANAGEMENT
#define HAS_TRAFFIC_MANAGEMENT 1
#endif
#ifndef TRAFFIC_MANAGEMENT_CACHE_SIZE
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 1024
#endif

#ifdef __cplusplus
}
#endif
Expand Down
Loading