diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index 30cea93831b..842ee78239a 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -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 diff --git a/variants/esp32s3/heltec_v4/variant.h b/variants/esp32s3/heltec_v4/variant.h index 5a806653e49..9ff04fb6f9d 100644 --- a/variants/esp32s3/heltec_v4/variant.h +++ b/variants/esp32s3/heltec_v4/variant.h @@ -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 diff --git a/variants/esp32s3/station-g2/variant.h b/variants/esp32s3/station-g2/variant.h index 9e844588f3a..83f4704c0e8 100755 --- a/variants/esp32s3/station-g2/variant.h +++ b/variants/esp32s3/station-g2/variant.h @@ -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 diff --git a/variants/nrf52840/tracker-t1000-e/variant.h b/variants/nrf52840/tracker-t1000-e/variant.h index de6916ac74c..b064dbc9f24 100644 --- a/variants/nrf52840/tracker-t1000-e/variant.h +++ b/variants/nrf52840/tracker-t1000-e/variant.h @@ -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