From 1087134c6590582da01bae8ed84daf59eb3b5d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Fri, 19 Jan 2018 22:59:32 +0100 Subject: [PATCH] Allow overriding several build settings --- code/espurna/config/all.h | 25 ++++++++++++------------- code/espurna/config/general.h | 14 ++++++++++++++ code/espurna/config/hardware.h | 11 +++++++---- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/code/espurna/config/all.h b/code/espurna/config/all.h index bec91d47..b5fc84d6 100644 --- a/code/espurna/config/all.h +++ b/code/espurna/config/all.h @@ -1,15 +1,3 @@ -#include "version.h" -#include "arduino.h" -#include "hardware.h" -#include "defaults.h" -#include "general.h" -#include "prototypes.h" -#include "sensors.h" - -#ifdef USE_CORE_VERSION_H -#include "core_version.h" -#endif - /* If you want to modify the stock configuration but you don't want to touch the repo files you can either define USE_CUSTOM_H or remove the @@ -20,7 +8,18 @@ (Define USE_CUSTOM_H on commandline for platformio: export PLATFORMIO_BUILD_FLAGS="'-DUSE_CUSTOM_H'" ) */ - #ifdef USE_CUSTOM_H #include "custom.h" #endif + +#include "version.h" +#include "arduino.h" +#include "hardware.h" +#include "defaults.h" +#include "general.h" +#include "prototypes.h" +#include "sensors.h" + +#ifdef USE_CORE_VERSION_H +#include "core_version.h" +#endif diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 1fec3c48..83f37b18 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -496,11 +496,21 @@ PROGMEM const char* const custom_reset_string[] = { #define MQTT_QUEUE_MAX_SIZE 10 // Size of the MQTT queue when MQTT_USE_JSON is enabled // These are the properties that will be sent when useJson is true +#ifndef MQTT_ENQUEUE_IP #define MQTT_ENQUEUE_IP 1 +#endif +#ifndef MQTT_ENQUEUE_MAC #define MQTT_ENQUEUE_MAC 1 +#endif +#ifndef MQTT_ENQUEUE_HOSTNAME #define MQTT_ENQUEUE_HOSTNAME 1 +#endif +#ifndef MQTT_ENQUEUE_DATETIME #define MQTT_ENQUEUE_DATETIME 1 +#endif +#ifndef MQTT_ENQUEUE_MESSAGE_ID #define MQTT_ENQUEUE_MESSAGE_ID 1 +#endif // These particles will be concatenated to the MQTT_TOPIC base to form the actual topic #define MQTT_TOPIC_JSON "data" @@ -553,8 +563,12 @@ PROGMEM const char* const custom_reset_string[] = { // Custom get and set postfixes // Use something like "/status" or "/set", with leading slash // Since 1.9.0 the default value is "" for getter and "/set" for setter +#ifndef MQTT_GETTER #define MQTT_GETTER "" +#endif +#ifndef MQTT_SETTER #define MQTT_SETTER "/set" +#endif // ----------------------------------------------------------------------------- // SETTINGS diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 5053c775..edbefa8c 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1393,9 +1393,12 @@ #define RELAY8_TYPE RELAY_TYPE_NORMAL // ----------------------------------------------------------------------------- -// Unknown hardware -// ----------------------------------------------------------------------------- -#else - #error "UNSUPPORTED HARDWARE!" +#endif + +// ----------------------------------------------------------------------------- +// Check definitions +// ----------------------------------------------------------------------------- +#if not defined(MANUFACTURER) || not defined(DEVICE) + #error "UNSUPPORTED HARDWARE!!" #endif