From e0a35644a81c9a87a1fff81499762bcc58206e2f Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 25 Jan 2021 15:57:26 +0100 Subject: [PATCH] fix standalone compiling --- lib/framework/MqttSettingsService.h | 8 ++++---- lib_standalone/ESP8266React.h | 17 ++++++++++------- src/mqtt.h | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/framework/MqttSettingsService.h b/lib/framework/MqttSettingsService.h index f6c871a8a..a22f0cbec 100644 --- a/lib/framework/MqttSettingsService.h +++ b/lib/framework/MqttSettingsService.h @@ -8,10 +8,6 @@ #include #include -#include "../../src/system.h" -#include "../../src/mqtt.h" -#include "../../src/dallassensor.h" - #define MQTT_RECONNECTION_DELAY 1000 #define MQTT_SETTINGS_FILE "/config/mqttSettings.json" @@ -71,6 +67,10 @@ static String generateClientId() { #define EMSESP_DEFAULT_HA_ENABLED false #define EMSESP_DEFAULT_PUBLISH_TIME 10 +#include "../../src/system.h" +#include "../../src/mqtt.h" +#include "../../src/dallassensor.h" + class MqttSettings { public: // host and port - if enabled diff --git a/lib_standalone/ESP8266React.h b/lib_standalone/ESP8266React.h index b0f1599df..31bc4c91d 100644 --- a/lib_standalone/ESP8266React.h +++ b/lib_standalone/ESP8266React.h @@ -27,13 +27,14 @@ class DummySettings { bool api_enabled = true; // MQTT - uint16_t publish_time = 10; // seconds - uint8_t mqtt_qos = 0; - bool mqtt_retain = false; - bool enabled = true; - uint8_t dallas_format = 1; - uint8_t ha_climate_format = 1; - bool ha_enabled = true; + uint16_t publish_time = 10; // seconds + uint8_t mqtt_qos = 0; + bool mqtt_retain = false; + bool enabled = true; + uint8_t dallas_format = 1; + uint8_t ha_climate_format = 1; + bool ha_enabled = true; + std::string base = "ems-esp"; String hostname = "ems-esp"; String jwtSecret = "ems-esp"; @@ -54,6 +55,8 @@ class DummySettings { uint16_t publish_time_sensor = 10; uint8_t bool_format = 1; // on off +#define FACTORY_MQTT_MAX_TOPIC_LENGTH 128 + static void read(DummySettings & settings, JsonObject & root){}; static void read(DummySettings & settings){}; diff --git a/src/mqtt.h b/src/mqtt.h index 69391ef8d..c760a767d 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -88,7 +88,7 @@ class Mqtt { enum Dallas_Format : uint8_t { SENSORID = 1, NUMBER }; enum HA_Climate_Format : uint8_t { CURRENT = 1, SETPOINT, ZERO }; - static constexpr uint8_t MQTT_TOPIC_MAX_SIZE = FACTORY_MQTT_MAX_TOPIC_LENGTH; // note this should really match the user setting in mqttSettings.maxTopicLength + static constexpr uint8_t MQTT_TOPIC_MAX_SIZE = 128; // note this should really match the user setting in mqttSettings.maxTopicLength static void on_connect();