From 443aa42e7b10db6ab093d3cb6a2336e9a61268ea Mon Sep 17 00:00:00 2001 From: pelgraine <140762863+pelgraine@users.noreply.github.com> Date: Thu, 2 Jul 2026 06:17:56 +1000 Subject: [PATCH] What you now have on the CLI: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get dutycycle → reports the current duty as a percentage (e.g. > 50%) set dutycycle <10-100> → sets it, saves to prefs, persists on reboot; anything below 10 or above 100 returns ERR - duty cycle must be 10-100 set af is untouched, for anyone who prefers the raw factor --- src/helpers/CommonCLI.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/helpers/CommonCLI.cpp b/src/helpers/CommonCLI.cpp index a4456dee..56b0e080 100644 --- a/src/helpers/CommonCLI.cpp +++ b/src/helpers/CommonCLI.cpp @@ -280,6 +280,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch const char* config = &command[4]; if (memcmp(config, "af", 2) == 0) { sprintf(reply, "> %s", StrHelper::ftoa(_prefs->airtime_factor)); + } else if (memcmp(config, "dutycycle", 9) == 0) { + int pct = (int)(100.0f / (_prefs->airtime_factor + 1.0f) + 0.5f); + sprintf(reply, "> %d%%", pct); } else if (memcmp(config, "int.thresh", 10) == 0) { sprintf(reply, "> %d", (uint32_t) _prefs->interference_threshold); } else if (memcmp(config, "agc.reset.interval", 18) == 0) { @@ -412,6 +415,15 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch _prefs->airtime_factor = atof(&config[3]); savePrefs(); strcpy(reply, "OK"); + } else if (memcmp(config, "dutycycle ", 10) == 0) { + int pct = atoi(&config[10]); + if (pct < 10 || pct > 100) { + strcpy(reply, "ERR - duty cycle must be 10-100"); + } else { + _prefs->airtime_factor = (100.0f / (float)pct) - 1.0f; + savePrefs(); + sprintf(reply, "OK - duty cycle %d%%", pct); + } } else if (memcmp(config, "int.thresh ", 11) == 0) { _prefs->interference_threshold = atoi(&config[11]); savePrefs();