From a545193204008eac4b16f413fcab416d132cf161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils-Lucas=20Scho=CC=88nfeld?= Date: Fri, 8 May 2026 14:51:48 +0200 Subject: [PATCH] add build flag support for airtime limit Unfortunately, I did not find a way to set airtime limits at runtime with rnodeconf, when in TNC mode. I added the option to add build flags to set airtime limits at compile-time. Airtime limits are essential for respecting duty cycles on most EU frequency bands. --- Config.h | 10 ++++++++-- platformio.ini | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Config.h b/Config.h index dec00639..f57881db 100644 --- a/Config.h +++ b/Config.h @@ -193,8 +193,14 @@ float longterm_airtime = 0.0; #define current_airtime_bin(void) (millis()%AIRTIME_LONGTERM_MS)/AIRTIME_BINLEN_MS #endif - float st_airtime_limit = 0.0; - float lt_airtime_limit = 0.0; + #ifndef ST_AIRTIME_LIMIT + #define ST_AIRTIME_LIMIT 0.0 + #endif + #ifndef LT_AIRTIME_LIMIT + #define LT_AIRTIME_LIMIT 0.0 + #endif + float st_airtime_limit = ST_AIRTIME_LIMIT; + float lt_airtime_limit = LT_AIRTIME_LIMIT; bool airtime_lock = false; bool stat_signal_detected = false; diff --git a/platformio.ini b/platformio.ini index 076d50f4..de760f5c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -46,6 +46,9 @@ build_flags = ; ??? NO ;-DLOG_LOCAL_LEVEL=5 ;-DCONFIG_LOG_DEFAULT_LEVEL=5 + ; Optional airtime limit defaults. Values are fractions: 0.05 = 5%. + ;-DST_AIRTIME_LIMIT=0.05 + ;-DLT_AIRTIME_LIMIT=0.01 lib_deps = ArduinoJson@^7.4.2 MsgPack@^0.4.2