[SYS] Fix connection validation on unknown indexes and improve erase method (#2075)

Before this fix, connections with Index 1 and 2 were supposed valid when not present in the configuration, generating attempts to connect with those indexes.
Also improve the erase config by adding an erase when the config file is not present (ESP is connected to WiFi without the config file). This way the ESP will not reconnect to the WiFi AP.

Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
FlorianandFlorian authored and GitHub committed 2024-10-01 11:48:39 -05:00
1 parent 9e5f56580d
commit c234afa9c8
3 files changed
+24 -25

No files matched your search

+4 -7
View File
@@ -257,10 +257,6 @@ const char* OTAserver_cert = "";
# define MQTT_SECURE_SIGNED_CLIENT 0 // If using a signed certificate for the broker and using client certificate/key set this to true or 1
#endif
#ifndef CNT_DEFAULT_INDEX
# define CNT_DEFAULT_INDEX 0 // Default set of connection parameters
#endif
#ifdef PRIVATE_CERTS
# include "certs/private_client_cert.h"
# include "certs/private_client_key.h"
@@ -273,6 +269,10 @@ const char* OTAserver_cert = "";
#include <string>
#ifndef CNT_DEFAULT_INDEX
# define CNT_DEFAULT_INDEX 0 // Default set of connection parameters
#endif
#if !MQTT_BROKER_MODE
struct ss_cnt_parameters {
std::string server_cert;
@@ -288,9 +288,6 @@ struct ss_cnt_parameters {
bool validConnection;
};
// Index 0 is used for connection parameters provided in the build that can be overloaded by WiFi Manager/Onboarding/WebUI,MQTT
# define CNT_DEFAULT_INDEX 0
// Index 1 and more are used for connection parameters provided at runtime by MQTT
# define cnt_parameters_array_size 3
ss_cnt_parameters cnt_parameters_array[cnt_parameters_array_size] = {