|
|
@ -132,7 +132,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch |
|
|
if (memcmp(command, "reboot", 6) == 0) { |
|
|
if (memcmp(command, "reboot", 6) == 0) { |
|
|
_board->reboot(); // doesn't return
|
|
|
_board->reboot(); // doesn't return
|
|
|
} else if (memcmp(command, "advert", 6) == 0) { |
|
|
} else if (memcmp(command, "advert", 6) == 0) { |
|
|
_callbacks->sendSelfAdvertisement(400); |
|
|
_callbacks->sendSelfAdvertisement(1500); // longer delay, give CLI response time to be sent first
|
|
|
strcpy(reply, "OK - Advert sent"); |
|
|
strcpy(reply, "OK - Advert sent"); |
|
|
} else if (memcmp(command, "clock sync", 10) == 0) { |
|
|
} else if (memcmp(command, "clock sync", 10) == 0) { |
|
|
uint32_t curr = getRTCClock()->getCurrentTime(); |
|
|
uint32_t curr = getRTCClock()->getCurrentTime(); |
|
|
@ -280,19 +280,25 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch |
|
|
strcpy(reply, _prefs->disable_fwd ? "OK - repeat is now OFF" : "OK - repeat is now ON"); |
|
|
strcpy(reply, _prefs->disable_fwd ? "OK - repeat is now OFF" : "OK - repeat is now ON"); |
|
|
} else if (memcmp(config, "radio ", 6) == 0) { |
|
|
} else if (memcmp(config, "radio ", 6) == 0) { |
|
|
strcpy(tmp, &config[6]); |
|
|
strcpy(tmp, &config[6]); |
|
|
const char *parts[4]; |
|
|
const char *parts[5]; |
|
|
int num = mesh::Utils::parseTextParts(tmp, parts, 4); |
|
|
int num = mesh::Utils::parseTextParts(tmp, parts, 5); |
|
|
float freq = num > 0 ? atof(parts[0]) : 0.0f; |
|
|
float freq = num > 0 ? atof(parts[0]) : 0.0f; |
|
|
float bw = num > 1 ? atof(parts[1]) : 0.0f; |
|
|
float bw = num > 1 ? atof(parts[1]) : 0.0f; |
|
|
uint8_t sf = num > 2 ? atoi(parts[2]) : 0; |
|
|
uint8_t sf = num > 2 ? atoi(parts[2]) : 0; |
|
|
uint8_t cr = num > 3 ? atoi(parts[3]) : 0; |
|
|
uint8_t cr = num > 3 ? atoi(parts[3]) : 0; |
|
|
|
|
|
int temp_timeout_mins = num > 4 ? atoi(parts[4]) : 0; |
|
|
if (freq >= 300.0f && freq <= 2500.0f && sf >= 7 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7.0f && bw <= 500.0f) { |
|
|
if (freq >= 300.0f && freq <= 2500.0f && sf >= 7 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7.0f && bw <= 500.0f) { |
|
|
_prefs->sf = sf; |
|
|
if (temp_timeout_mins > 0) { |
|
|
_prefs->cr = cr; |
|
|
_callbacks->applyTempRadioParams(freq, bw, sf, cr, temp_timeout_mins); |
|
|
_prefs->freq = freq; |
|
|
sprintf(reply, "OK - temp params for %d mins", temp_timeout_mins); |
|
|
_prefs->bw = bw; |
|
|
} else { |
|
|
_callbacks->savePrefs(); |
|
|
_prefs->sf = sf; |
|
|
strcpy(reply, "OK - reboot to apply"); |
|
|
_prefs->cr = cr; |
|
|
|
|
|
_prefs->freq = freq; |
|
|
|
|
|
_prefs->bw = bw; |
|
|
|
|
|
_callbacks->savePrefs(); |
|
|
|
|
|
strcpy(reply, "OK - reboot to apply"); |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
strcpy(reply, "Error, invalid radio params"); |
|
|
strcpy(reply, "Error, invalid radio params"); |
|
|
} |
|
|
} |
|
|
|