[SYS] Fix default connection (#1966)

This commit is contained in:
Florian authored and GitHub committed 2024-06-12 12:17:12 -05:00
1 parent 676a62fecb
commit 0a1ee69a72
3 files changed
+8 -2

No files matched your search

+1 -1
View File
@@ -284,7 +284,7 @@ struct ss_cnt_parameters {
#define cnt_parameters_array_size 3
ss_cnt_parameters cnt_parameters_array[cnt_parameters_array_size] = {
{ss_server_cert, ss_client_cert, ss_client_key, OTAserver_cert, MQTT_SERVER, MQTT_PORT, MQTT_USER, MQTT_PASS, MQTT_SECURE_DEFAULT, MQTT_CERT_VALIDATE_DEFAULT, true},
{ss_server_cert, ss_client_cert, ss_client_key, OTAserver_cert, MQTT_SERVER, MQTT_PORT, MQTT_USER, MQTT_PASS, MQTT_SECURE_DEFAULT, MQTT_CERT_VALIDATE_DEFAULT, false},
{"", "", "", "", MQTT_SERVER, MQTT_PORT, MQTT_USER, MQTT_PASS, MQTT_SECURE_DEFAULT, MQTT_CERT_VALIDATE_DEFAULT, false},
{"", "", "", "", MQTT_SERVER, MQTT_PORT, MQTT_USER, MQTT_PASS, MQTT_SECURE_DEFAULT, MQTT_CERT_VALIDATE_DEFAULT, false}};
+3
View File
@@ -179,6 +179,9 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para
cnt_index = CNT_DEFAULT_INDEX;
}
// We suppose the connection is valid (could be tested before)
cnt_parameters_array[cnt_index].validConnection = true;
saveConfig();
}
break;
+4 -1
View File
@@ -1872,6 +1872,9 @@ bool loadConfigFromFlash() {
strcat(key, index_suffix);
if (json.containsKey(key)) {
cnt_parameters_array[i].validConnection = json[key].as<bool>();
} else {
// For backward compatibility, if valid_cnt is not found, we assume the connection is valid
cnt_parameters_array[i].validConnection = true;
}
}
if (json.containsKey("cnt_index")) {
@@ -2087,9 +2090,9 @@ void setupwifi(bool reset_settings) {
cnt_parameters_array[cnt_index].client_cert = processCert(custom_client_cert.getValue());
cnt_parameters_array[cnt_index].client_key = processCert(custom_client_key.getValue());
# endif
# endif
// We suppose the connection is valid (could be tested before)
cnt_parameters_array[cnt_index].validConnection = true;
# endif
//save the custom parameters to FS
saveConfig();