diff --git a/docs/cli_commands.md b/docs/cli_commands.md index 0e170a77..f248e4f3 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -425,16 +425,31 @@ This document provides an overview of CLI commands that can be sent to MeshCore - `set dutycycle ` **Parameters:** -- `value`: Duty cycle percentage (10-100) +- `value`: Duty cycle percentage (1-100) **Default:** `50%` (equivalent to airtime factor 1.0) **Examples:** - `set dutycycle 100` — no duty cycle limit - `set dutycycle 50` — 50% duty cycle (default) -- `set dutycycle 10` — 10% duty cycle (strictest EU requirement) +- `set dutycycle 10` — 10% duty cycle +- `set dutycycle 1` — 1% duty cycle (strictest EU requirement) -> **Deprecated:** `get af` / `set af` still work but are deprecated in favour of `dutycycle`. +> **Note:** Added in firmware v1.15.0 + +--- + +#### View or change the airtime factor (duty cycle limit) +> **Deprecated** as of firmware v1.15.0. Use [`get/set dutycycle`](#view-or-change-the-duty-cycle-limit) instead. + +**Usage:** +- `get af` +- `set af ` + +**Parameters:** +- `value`: Airtime factor (0-9) + +**Default:** `1.0` --- diff --git a/docs/terminal_chat_cli.md b/docs/terminal_chat_cli.md index b1a3af2a..c889da96 100644 --- a/docs/terminal_chat_cli.md +++ b/docs/terminal_chat_cli.md @@ -30,9 +30,12 @@ Sets your advertisement map longitude. (decimal degrees) ``` set dutycycle {percent} ``` -Sets the transmit duty cycle limit (10-100%). Example: `set dutycycle 10` for 10%. +Sets the transmit duty cycle limit (1-100%). Example: `set dutycycle 10` for 10%. -> **Deprecated:** `set af` still works but is deprecated in favour of `set dutycycle`. +``` +set af {air-time-factor} +``` +Sets the transmit air-time-factor. Deprecated — use `set dutycycle` instead. ``` diff --git a/src/helpers/CommonCLI.cpp b/src/helpers/CommonCLI.cpp index b3eff17f..cf6d4712 100644 --- a/src/helpers/CommonCLI.cpp +++ b/src/helpers/CommonCLI.cpp @@ -289,7 +289,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch int dc_frac = (int)((dc - dc_int) * 10.0f + 0.5f); sprintf(reply, "> %d.%d%%", dc_int, dc_frac); } else if (memcmp(config, "af", 2) == 0) { - sprintf(reply, "> %s (deprecated, use 'get dutycycle')", StrHelper::ftoa(_prefs->airtime_factor)); + sprintf(reply, "> %s", StrHelper::ftoa(_prefs->airtime_factor)); } 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) { @@ -443,8 +443,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch const char* config = &command[4]; if (memcmp(config, "dutycycle ", 10) == 0) { float dc = atof(&config[10]); - if (dc < 10 || dc > 100) { - strcpy(reply, "ERROR: dutycycle must be 10-100"); + if (dc < 1 || dc > 100) { + strcpy(reply, "ERROR: dutycycle must be 1-100"); } else { _prefs->airtime_factor = (100.0f / dc) - 1.0f; savePrefs(); @@ -456,10 +456,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch } else if (memcmp(config, "af ", 3) == 0) { _prefs->airtime_factor = atof(&config[3]); savePrefs(); - float actual = 100.0f / (_prefs->airtime_factor + 1.0f); - int a_int = (int)actual; - int a_frac = (int)((actual - a_int) * 10.0f + 0.5f); - sprintf(reply, "OK - %d.%d%% (deprecated, use 'set dutycycle')", a_int, a_frac); + strcpy(reply, "OK"); } else if (memcmp(config, "int.thresh ", 11) == 0) { _prefs->interference_threshold = atoi(&config[11]); savePrefs();