[SYS] Fix default connection (#1966)
This commit is contained in:
1 parent
676a62fecb
commit
0a1ee69a72
3 files changed
+8
-2
No files matched your search
+1
-1
@@ -284,7 +284,7 @@ struct ss_cnt_parameters {
|
|||||||
#define cnt_parameters_array_size 3
|
#define cnt_parameters_array_size 3
|
||||||
|
|
||||||
ss_cnt_parameters cnt_parameters_array[cnt_parameters_array_size] = {
|
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},
|
||||||
{"", "", "", "", 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}};
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,9 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para
|
|||||||
cnt_index = CNT_DEFAULT_INDEX;
|
cnt_index = CNT_DEFAULT_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We suppose the connection is valid (could be tested before)
|
||||||
|
cnt_parameters_array[cnt_index].validConnection = true;
|
||||||
|
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
+4
-1
@@ -1872,6 +1872,9 @@ bool loadConfigFromFlash() {
|
|||||||
strcat(key, index_suffix);
|
strcat(key, index_suffix);
|
||||||
if (json.containsKey(key)) {
|
if (json.containsKey(key)) {
|
||||||
cnt_parameters_array[i].validConnection = json[key].as<bool>();
|
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")) {
|
if (json.containsKey("cnt_index")) {
|
||||||
@@ -2086,10 +2089,10 @@ void setupwifi(bool reset_settings) {
|
|||||||
# if MQTT_SECURE_SIGNED_CLIENT
|
# if MQTT_SECURE_SIGNED_CLIENT
|
||||||
cnt_parameters_array[cnt_index].client_cert = processCert(custom_client_cert.getValue());
|
cnt_parameters_array[cnt_index].client_cert = processCert(custom_client_cert.getValue());
|
||||||
cnt_parameters_array[cnt_index].client_key = processCert(custom_client_key.getValue());
|
cnt_parameters_array[cnt_index].client_key = processCert(custom_client_key.getValue());
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
// We suppose the connection is valid (could be tested before)
|
// We suppose the connection is valid (could be tested before)
|
||||||
cnt_parameters_array[cnt_index].validConnection = true;
|
cnt_parameters_array[cnt_index].validConnection = true;
|
||||||
# endif
|
|
||||||
|
|
||||||
//save the custom parameters to FS
|
//save the custom parameters to FS
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|||||||
Reference in new issue
Block a user