Browse Source

Few little fix

gpiosensors
Mathieu Maret 5 years ago
parent
commit
207c104c07
  1. 2
      WifiControlSensor/MQTT.ino
  2. 18
      WifiControlSensor/WifiControlSensor.ino

2
WifiControlSensor/MQTT.ino

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

18
WifiControlSensor/WifiControlSensor.ino

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

Loading…
Cancel
Save