cli commands fix

This commit is contained in:
liquidraver
2026-06-12 21:07:37 +02:00
parent d4a48ae5f3
commit 061a65a7f0
2 changed files with 14 additions and 6 deletions
+2 -2
View File
@@ -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 <mode>` | 0, 1, or 2 | Path hashing algorithm |
| `set loop.detect <mode>` | `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 <mult>` | (0 = use board default) | Battery voltage ADC calibration multiplier |
| `set prv.key <hex>` | 64-char hex (32-byte key) | Replace private key; derive new identity *(reboot to apply)* |
+12 -4
View File
@@ -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);