Skip to content

Commit 1f48d2b

Browse files
committed
Address comments
1 parent 3c0d186 commit 1f48d2b

3 files changed

Lines changed: 27 additions & 12 deletions

File tree

docs/cli_commands.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,31 @@ This document provides an overview of CLI commands that can be sent to MeshCore
425425
- `set dutycycle <value>`
426426

427427
**Parameters:**
428-
- `value`: Duty cycle percentage (10-100)
428+
- `value`: Duty cycle percentage (1-100)
429429

430430
**Default:** `50%` (equivalent to airtime factor 1.0)
431431

432432
**Examples:**
433433
- `set dutycycle 100` — no duty cycle limit
434434
- `set dutycycle 50` — 50% duty cycle (default)
435-
- `set dutycycle 10` — 10% duty cycle (strictest EU requirement)
435+
- `set dutycycle 10` — 10% duty cycle
436+
- `set dutycycle 1` — 1% duty cycle (strictest EU requirement)
436437

437-
> **Deprecated:** `get af` / `set af` still work but are deprecated in favour of `dutycycle`.
438+
> **Note:** Added in firmware v1.15.0
439+
440+
---
441+
442+
#### View or change the airtime factor (duty cycle limit)
443+
> **Deprecated** as of firmware v1.15.0. Use [`get/set dutycycle`](#view-or-change-the-duty-cycle-limit) instead.
444+
445+
**Usage:**
446+
- `get af`
447+
- `set af <value>`
448+
449+
**Parameters:**
450+
- `value`: Airtime factor (0-9)
451+
452+
**Default:** `1.0`
438453

439454
---
440455

docs/terminal_chat_cli.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ Sets your advertisement map longitude. (decimal degrees)
3030
```
3131
set dutycycle {percent}
3232
```
33-
Sets the transmit duty cycle limit (10-100%). Example: `set dutycycle 10` for 10%.
33+
Sets the transmit duty cycle limit (1-100%). Example: `set dutycycle 10` for 10%.
3434

35-
> **Deprecated:** `set af` still works but is deprecated in favour of `set dutycycle`.
35+
```
36+
set af {air-time-factor}
37+
```
38+
Sets the transmit air-time-factor. Deprecated — use `set dutycycle` instead.
3639

3740

3841
```

src/helpers/CommonCLI.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
289289
int dc_frac = (int)((dc - dc_int) * 10.0f + 0.5f);
290290
sprintf(reply, "> %d.%d%%", dc_int, dc_frac);
291291
} else if (memcmp(config, "af", 2) == 0) {
292-
sprintf(reply, "> %s (deprecated, use 'get dutycycle')", StrHelper::ftoa(_prefs->airtime_factor));
292+
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->airtime_factor));
293293
} else if (memcmp(config, "int.thresh", 10) == 0) {
294294
sprintf(reply, "> %d", (uint32_t) _prefs->interference_threshold);
295295
} else if (memcmp(config, "agc.reset.interval", 18) == 0) {
@@ -443,8 +443,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
443443
const char* config = &command[4];
444444
if (memcmp(config, "dutycycle ", 10) == 0) {
445445
float dc = atof(&config[10]);
446-
if (dc < 10 || dc > 100) {
447-
strcpy(reply, "ERROR: dutycycle must be 10-100");
446+
if (dc < 1 || dc > 100) {
447+
strcpy(reply, "ERROR: dutycycle must be 1-100");
448448
} else {
449449
_prefs->airtime_factor = (100.0f / dc) - 1.0f;
450450
savePrefs();
@@ -456,10 +456,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
456456
} else if (memcmp(config, "af ", 3) == 0) {
457457
_prefs->airtime_factor = atof(&config[3]);
458458
savePrefs();
459-
float actual = 100.0f / (_prefs->airtime_factor + 1.0f);
460-
int a_int = (int)actual;
461-
int a_frac = (int)((actual - a_int) * 10.0f + 0.5f);
462-
sprintf(reply, "OK - %d.%d%% (deprecated, use 'set dutycycle')", a_int, a_frac);
459+
strcpy(reply, "OK");
463460
} else if (memcmp(config, "int.thresh ", 11) == 0) {
464461
_prefs->interference_threshold = atoi(&config[11]);
465462
savePrefs();

0 commit comments

Comments
 (0)