From 0c9e8b977bcb24cfdb7eb7ae87e4dcaa1d49fa09 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Fri, 28 Feb 2020 17:16:39 +0100 Subject: [PATCH] Bme fixes --- WifiControlSensor/BME680.h | 2 +- WifiControlSensor/MQTT.h | 2 +- WifiControlSensor/MQTT.ino | 2 +- WifiControlSensor/WebServer.ino | 2 +- WifiControlSensor/WifiControlSensor.ino | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/WifiControlSensor/BME680.h b/WifiControlSensor/BME680.h index 155c71f..9d1451f 100644 --- a/WifiControlSensor/BME680.h +++ b/WifiControlSensor/BME680.h @@ -22,7 +22,7 @@ int BME680Setup(); bool BME680IsConnected(); #else //CONFIG_ENABLE_BMP80 -int BME680GetMeasure(float &, float &, float&, float &, float &); +int BME680GetMeasure(float &, float &, float&, float &, float &){return -1;}; int BME680Setup(){SKETCH_DEBUG_PRINTLN("BME680 is disabled at build time"); return -1;}; bool BME680IsConnected(){return false;}; #endif diff --git a/WifiControlSensor/MQTT.h b/WifiControlSensor/MQTT.h index 9935637..6212d9f 100644 --- a/WifiControlSensor/MQTT.h +++ b/WifiControlSensor/MQTT.h @@ -23,7 +23,7 @@ typedef struct {uint8_t updated; int value;} gpioInfo; struct mqttInfo { float value; - char *topic; + const char *topic; uint8_t retain; uint8_t qos; }; diff --git a/WifiControlSensor/MQTT.ino b/WifiControlSensor/MQTT.ino index 32774e4..4ba3f91 100644 --- a/WifiControlSensor/MQTT.ino +++ b/WifiControlSensor/MQTT.ino @@ -87,7 +87,7 @@ int MqttBatchPublish(std::vector tab, ...) { va_start (args, tab); vsnprintf(buf, sizeof(buf), (const char *)info.topic, args); va_end(args); - SKETCH_DEBUG_PRINTFLN("publishing %f for %s\n", info.value, buf); + SKETCH_DEBUG_PRINTF("publishing %f for %s\n", info.value, buf); Adafruit_MQTT_Publish client(mqtt, buf, info.qos, info.retain); if (!client.publish(info.value)) SKETCH_DEBUG_PRINTLN("Fail :("); diff --git a/WifiControlSensor/WebServer.ino b/WifiControlSensor/WebServer.ino index 03b5ac6..6c55e6d 100644 --- a/WifiControlSensor/WebServer.ino +++ b/WifiControlSensor/WebServer.ino @@ -190,7 +190,7 @@ void WebHandleSave() { strdup(server.arg("host").c_str()), strdup(server.arg("mqttServer").c_str()), strdup(server.arg("mqttUser").c_str()), strdup(server.arg("mqttPasswd").c_str()), server.arg("mqttPort").toInt(), server.arg("ip_config").toInt(), static_cast(ip), static_cast(gw), - static_cast(mask), static_cast(dns), static_cast(dns2), server.arg("channel").toInt(), strdup(server.arg("bssid").c_str()) + static_cast(mask), static_cast(dns), static_cast(dns2), static_cast(server.arg("channel").toInt()), strdup(server.arg("bssid").c_str()) }; if (EepromSaveConfig(newConf) < 0) { WebSendError("Cannot Save Credentials (Too long ?Contains \";\"?)\r\n"); diff --git a/WifiControlSensor/WifiControlSensor.ino b/WifiControlSensor/WifiControlSensor.ino index 8e58a5b..3aeedd4 100644 --- a/WifiControlSensor/WifiControlSensor.ino +++ b/WifiControlSensor/WifiControlSensor.ino @@ -43,6 +43,7 @@ #include "debug_sketch.h" #include "BMP180.h" +#include "BME680.h" #include "sensor_DHT.h" #include "dry_sensor.h" #include "MQTT.h"