Few little fix

This commit is contained in:
Mathieu Maret 2016-11-20 00:23:16 +01:00
parent 3691745aec
commit 207c104c07
2 changed files with 8 additions and 12 deletions

View File

@ -128,7 +128,7 @@ int MqttConnect() {
} }
template<typename T> int MqttPublish(Adafruit_MQTT_Publish *publisher, T value){ template<typename T> int MqttPublish(Adafruit_MQTT_Publish *publisher, T value){
if(MqttConnect() == 0){ if (MqttConnect() == 0) {
publisher->publish(value); publisher->publish(value);
return 0; return 0;
} }

View File

@ -100,7 +100,7 @@ void WifiSetup(productConfig conf) {
WiFi.softAP(conf.ssid); WiFi.softAP(conf.ssid);
myIP = WiFi.softAPIP(); myIP = WiFi.softAPIP();
} else { } else {
SKETCH_DEBUG_PRINTLN("Disable previous AP mode "); //Disable previous AP mode
WiFi.softAPdisconnect(true); WiFi.softAPdisconnect(true);
SKETCH_DEBUG_PRINTLN("Connecting to Wifi..."); SKETCH_DEBUG_PRINTLN("Connecting to Wifi...");
if(conf.ip_mode == 1){ if(conf.ip_mode == 1){
@ -112,17 +112,14 @@ void WifiSetup(productConfig conf) {
delay(500); delay(500);
SKETCH_DEBUG_PRINT("."); SKETCH_DEBUG_PRINT(".");
} }
SKETCH_DEBUG_PRINTLN(""); SKETCH_DEBUG_PRINTF("\nWiFi connected\n");
SKETCH_DEBUG_PRINTLN("WiFi connected");
#ifdef CONFIG_ENABLE_MDNS #ifdef CONFIG_ENABLE_MDNS
if (!MDNS.begin(conf.host)) { if (!MDNS.begin(conf.host)) {
SKETCH_DEBUG_PRINTLN("Error setting up MDNS responder!"); SKETCH_DEBUG_PRINTLN("Error setting up MDNS responder!");
while (1) { } else {
delay(1000); SKETCH_DEBUG_PRINTLN("mDNS responder started");
}
} }
SKETCH_DEBUG_PRINTLN("mDNS responder started");
#endif #endif
myIP = WiFi.localIP(); myIP = WiFi.localIP();
} }
@ -130,6 +127,7 @@ void WifiSetup(productConfig conf) {
SKETCH_DEBUG_PRINT("My IP address: "); SKETCH_DEBUG_PRINT("My IP address: ");
SKETCH_DEBUG_PRINTLN(myIP); SKETCH_DEBUG_PRINTLN(myIP);
} }
void OTASetup() { void OTASetup() {
#ifndef CONFIF_DISABLE_OTA #ifndef CONFIF_DISABLE_OTA
// Port defaults to 8266 // Port defaults to 8266
@ -174,7 +172,7 @@ void OTASetup() {
}); });
ArduinoOTA.begin(); ArduinoOTA.begin();
SKETCH_DEBUG_PRINTLN("Ready"); SKETCH_DEBUG_PRINTLN("Ready");
SKETCH_DEBUG_PRINT("IP address: "); SKETCH_DEBUG_PRINTF("IP address: ");
SKETCH_DEBUG_PRINTLN(WiFi.localIP()); SKETCH_DEBUG_PRINTLN(WiFi.localIP());
SKETCH_DEBUG_PRINTF("Free Space: %d\n", ESP.getFreeSketchSpace()); SKETCH_DEBUG_PRINTF("Free Space: %d\n", ESP.getFreeSketchSpace());
#endif #endif
@ -214,9 +212,7 @@ void setup() {
SKETCH_DEBUG_PRINTLN("No configuration saved"); SKETCH_DEBUG_PRINTLN("No configuration saved");
} }
SKETCH_DEBUG_PRINT("Force Setup Mode ? :"); SKETCH_DEBUG_PRINTF("Force Setup Mode ? : %s\n",txStatus ? "No" : "Yes");
SKETCH_DEBUG_PRINT(txStatus ? "No" : "Yes");
SKETCH_DEBUG_PRINTLN();
if(txStatus == 0){ if(txStatus == 0){
mode = BOOTMODE_SETUP; mode = BOOTMODE_SETUP;
} }