Skip to content

Commit

Permalink
fix wifi manager portal missing parameters on esp8266 (#1132)
Browse files Browse the repository at this point in the history
* fix wifi manager portal missing parameters on esp8266

on esp8266 with ZgatewayBT
Reducing the scope of the parameters on wifi manager for esp8266 to enable to enter properly the configuration
  • Loading branch information
1technophile authored Jan 16, 2022
1 parent 9a4db88 commit 76b2f0a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,9 @@ void setup_wifimanager(bool reset_settings) {
WiFiManagerParameter custom_mqtt_pass("pass", "mqtt pass", mqtt_pass, parameters_size * 2);
WiFiManagerParameter custom_mqtt_topic("topic", "mqtt base topic", mqtt_topic, mqtt_topic_max_size);
WiFiManagerParameter custom_mqtt_secure("secure", "mqtt secure", "1", 1, mqtt_secure ? "type=\"checkbox\" checked" : "type=\"checkbox\"");
# ifdef ESP32 // not enough memory on ESP8266
WiFiManagerParameter custom_mqtt_cert("cert", "mqtt broker cert", mqtt_cert.c_str(), 2048);
# endif
WiFiManagerParameter custom_gateway_name("name", "gateway name", gateway_name, parameters_size * 2);
# endif
//WiFiManager
Expand Down Expand Up @@ -1169,7 +1171,9 @@ void setup_wifimanager(bool reset_settings) {
wifiManager.addParameter(&custom_mqtt_user);
wifiManager.addParameter(&custom_mqtt_pass);
wifiManager.addParameter(&custom_mqtt_secure);
# ifdef ESP32 // not enough memory on ESP8266
wifiManager.addParameter(&custom_mqtt_cert);
# endif
wifiManager.addParameter(&custom_gateway_name);
wifiManager.addParameter(&custom_mqtt_topic);
# endif
Expand Down Expand Up @@ -1227,6 +1231,7 @@ void setup_wifimanager(bool reset_settings) {
strcpy(gateway_name, custom_gateway_name.getValue());
mqtt_secure = *custom_mqtt_secure.getValue();

# ifdef ESP32 // not enough memory on ESP8266
int cert_len = strlen(custom_mqtt_cert.getValue());
if (cert_len) {
char* cert_in = (char*)custom_mqtt_cert.getValue();
Expand All @@ -1244,6 +1249,7 @@ void setup_wifimanager(bool reset_settings) {

mqtt_cert = cert_begin;
}
# endif
# endif
//save the custom parameters to FS
saveMqttConfig();
Expand Down

0 comments on commit 76b2f0a

Please sign in to comment.