From 061a65a7f0409c381a8e7eb7e587952ff75c9cca Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Fri, 12 Jun 2026 21:07:37 +0200 Subject: [PATCH] cli commands fix --- zephcore/Repeater_CLI_commands.md | 4 ++-- zephcore/helpers/CommonCLI.cpp | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/zephcore/Repeater_CLI_commands.md b/zephcore/Repeater_CLI_commands.md index 0dbe7c2..44a4843 100644 --- a/zephcore/Repeater_CLI_commands.md +++ b/zephcore/Repeater_CLI_commands.md @@ -242,8 +242,8 @@ Changes are persisted immediately unless noted. Some require a reboot. | `set multi.acks <0\|1>` | | Enable extra ACK transmits | | `set path.hash.mode ` | 0, 1, or 2 | Path hashing algorithm | | `set loop.detect ` | `off`, `minimal`, `moderate`, `strict` | Loop detection sensitivity | -| `set radio.rxgain <0\|1>` | | RX gain boost *(reboot required)* | -| `set rxduty <0\|1>` | | RX duty cycle mode *(reboot required)* | +| `set radio.rxgain <0\|1\|on\|off>` | | RX gain boost *(reboot required)* | +| `set rxduty <0\|1\|on\|off>` | | RX duty cycle mode *(reboot required)* | | `set adc.multiplier ` | (0 = use board default) | Battery voltage ADC calibration multiplier | | `set prv.key ` | 64-char hex (32-byte key) | Replace private key; derive new identity *(reboot to apply)* | diff --git a/zephcore/helpers/CommonCLI.cpp b/zephcore/helpers/CommonCLI.cpp index d726cd1..822b912 100644 --- a/zephcore/helpers/CommonCLI.cpp +++ b/zephcore/helpers/CommonCLI.cpp @@ -884,22 +884,30 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch strcpy(reply, "Error: unsupported by this board"); } } else if (memcmp(config, "radio.rxgain ", 13) == 0) { - int val = atoi(&config[13]); + const char* arg = &config[13]; + int val = -1; + if (memcmp(arg, "on", 2) == 0) val = 1; + else if (memcmp(arg, "off", 3) == 0) val = 0; + else if (arg[0] == '0' || arg[0] == '1') val = atoi(arg); if (val == 0 || val == 1) { _prefs->rx_boost = (uint8_t)val; savePrefs(); snprintf(reply, CLI_REPLY_SIZE, "OK - radio.rxgain=%d (reboot to apply)", _prefs->rx_boost); } else { - strcpy(reply, "Error: must be 0 or 1"); + strcpy(reply, "Error: must be 0, 1, on, or off"); } } else if (memcmp(config, "rxduty ", 7) == 0) { - int val = atoi(&config[7]); + const char* arg = &config[7]; + int val = -1; + if (memcmp(arg, "on", 2) == 0) val = 1; + else if (memcmp(arg, "off", 3) == 0) val = 0; + else if (arg[0] == '0' || arg[0] == '1') val = atoi(arg); if (val == 0 || val == 1) { _prefs->rx_duty_cycle = (uint8_t)val; savePrefs(); snprintf(reply, CLI_REPLY_SIZE, "OK - rxduty=%d (reboot to apply)", _prefs->rx_duty_cycle); } else { - strcpy(reply, "Error: must be 0 or 1"); + strcpy(reply, "Error: must be 0, 1, on, or off"); } } else { snprintf(reply, CLI_REPLY_SIZE, "unknown config: %s", config);