diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index bd8a7fa..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/src/blflow/mqttmanager.h b/src/blflow/mqttmanager.h index 98828e9..2925ca7 100644 --- a/src/blflow/mqttmanager.h +++ b/src/blflow/mqttmanager.h @@ -43,6 +43,10 @@ void ParseMQTTState(int code){ break; case 0: // MQTT_CONNECTED Serial.println(F("MQTT CONNECTED")); + if (printerVariables.errorcode == "no mqtt"){ + //if this routine set the error code, clear it + printerVariables.errorcode = ""; + } break; case 1: // MQTT_CONNECT_BAD_PROTOCOL Serial.println(F("MQTT BAD PROTOCOL")); @@ -80,6 +84,10 @@ void connectMqtt(){ mqttClient.subscribe(report_topic.c_str()); printerVariables.online = true; printerVariables.disconnectMQTTms = 0; + if (printerVariables.errorcode == "no mqtt"){ + //if this routine set the error code, clear it + printerVariables.errorcode = ""; + } //Serial.println(F("Updating LEDs from MQTT connect")); }else{ Serial.println(F("Failed to connect with error code: ")); diff --git a/src/main.cpp b/src/main.cpp index 25e1a34..ee1b270 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,13 +37,22 @@ void setup(){ Serial.println(F("SSID or password is missing. Please configure both by going to: https://dutchdevelop.com/smartflow-configuration-setup/")); return; } + else if (printerVariables.errorcode == "no config"){ + //if this routine set the error code, clear it + printerVariables.errorcode = ""; + } + scanNetwork(); //Sets the MAC address for following connection attempt if(!connectToWifi()){ printerVariables.errorcode = "no wifi"; return; } - + else if (printerVariables.errorcode == "no wifi"){ + //if this routine set the error code, clear it + printerVariables.errorcode = ""; + } + setupWebserver(); delay(500); start_ssdp();