Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions src/blflow/mqttmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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: "));
Expand Down
11 changes: 10 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down