|
|
|
@ -63,7 +63,8 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) { |
|
|
|
file.read((uint8_t *)&_prefs->multi_acks, sizeof(_prefs->multi_acks)); // 115
|
|
|
|
file.read((uint8_t *)&_prefs->bw, sizeof(_prefs->bw)); // 116
|
|
|
|
file.read((uint8_t *)&_prefs->agc_reset_interval, sizeof(_prefs->agc_reset_interval)); // 120
|
|
|
|
file.read(pad, 3); // 121
|
|
|
|
file.read((uint8_t *)&_prefs->path_hash_mode, sizeof(_prefs->path_hash_mode)); // 121
|
|
|
|
file.read(pad, 2); // 122
|
|
|
|
file.read((uint8_t *)&_prefs->flood_max, sizeof(_prefs->flood_max)); // 124
|
|
|
|
file.read((uint8_t *)&_prefs->flood_advert_interval, sizeof(_prefs->flood_advert_interval)); // 125
|
|
|
|
file.read((uint8_t *)&_prefs->interference_threshold, sizeof(_prefs->interference_threshold)); // 126
|
|
|
|
@ -95,6 +96,7 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) { |
|
|
|
_prefs->tx_power_dbm = constrain(_prefs->tx_power_dbm, -9, 30); |
|
|
|
_prefs->multi_acks = constrain(_prefs->multi_acks, 0, 1); |
|
|
|
_prefs->adc_multiplier = constrain(_prefs->adc_multiplier, 0.0f, 10.0f); |
|
|
|
_prefs->path_hash_mode = constrain(_prefs->path_hash_mode, 0, 2); // NOTE: mode 3 reserved for future
|
|
|
|
|
|
|
|
// sanitise bad bridge pref values
|
|
|
|
_prefs->bridge_enabled = constrain(_prefs->bridge_enabled, 0, 1); |
|
|
|
@ -147,7 +149,8 @@ void CommonCLI::savePrefs(FILESYSTEM* fs) { |
|
|
|
file.write((uint8_t *)&_prefs->multi_acks, sizeof(_prefs->multi_acks)); // 115
|
|
|
|
file.write((uint8_t *)&_prefs->bw, sizeof(_prefs->bw)); // 116
|
|
|
|
file.write((uint8_t *)&_prefs->agc_reset_interval, sizeof(_prefs->agc_reset_interval)); // 120
|
|
|
|
file.write(pad, 3); // 121
|
|
|
|
file.write((uint8_t *)&_prefs->path_hash_mode, sizeof(_prefs->path_hash_mode)); // 121
|
|
|
|
file.write(pad, 2); // 122
|
|
|
|
file.write((uint8_t *)&_prefs->flood_max, sizeof(_prefs->flood_max)); // 124
|
|
|
|
file.write((uint8_t *)&_prefs->flood_advert_interval, sizeof(_prefs->flood_advert_interval)); // 125
|
|
|
|
file.write((uint8_t *)&_prefs->interference_threshold, sizeof(_prefs->interference_threshold)); // 126
|
|
|
|
@ -325,6 +328,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch |
|
|
|
sp++; |
|
|
|
} |
|
|
|
*reply = 0; // set null terminator
|
|
|
|
} else if (memcmp(config, "path.hash.mode", 14) == 0) { |
|
|
|
sprintf(reply, "> %d", (uint32_t)_prefs->path_hash_mode); |
|
|
|
} else if (memcmp(config, "tx", 2) == 0 && (config[2] == 0 || config[2] == ' ')) { |
|
|
|
sprintf(reply, "> %d", (int32_t) _prefs->tx_power_dbm); |
|
|
|
} else if (memcmp(config, "freq", 4) == 0) { |
|
|
|
@ -556,6 +561,16 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch |
|
|
|
*dp = 0; |
|
|
|
savePrefs(); |
|
|
|
strcpy(reply, "OK"); |
|
|
|
} else if (memcmp(config, "path.hash.mode ", 15) == 0) { |
|
|
|
config += 15; |
|
|
|
uint8_t mode = atoi(config); |
|
|
|
if (mode < 3) { |
|
|
|
_prefs->path_hash_mode = mode; |
|
|
|
savePrefs(); |
|
|
|
strcpy(reply, "OK"); |
|
|
|
} else { |
|
|
|
strcpy(reply, "Error, must be 0,1, or 2"); |
|
|
|
} |
|
|
|
} else if (memcmp(config, "tx ", 3) == 0) { |
|
|
|
_prefs->tx_power_dbm = atoi(&config[3]); |
|
|
|
savePrefs(); |
|
|
|
|