Change HASP_USE_CUSTOM > 0 to defined(HASP_USE_CUSTOM)

This commit is contained in:
fvanroie 2021-10-08 18:59:41 +02:00
parent dffea46d07
commit 45a451c830
9 changed files with 21 additions and 21 deletions

View File

@ -145,9 +145,9 @@
#define HASP_NUM_GPIO_CONFIG 8
#endif
#ifndef HASP_USE_CUSTOM
#define HASP_USE_CUSTOM 0
#endif
// #ifndef HASP_USE_CUSTOM
// #define HASP_USE_CUSTOM 0
// #endif
// #ifndef HASP_NUM_OUTPUTS
// #define HASP_NUM_OUTPUTS 3

View File

@ -3,7 +3,7 @@
#include "hasplib.h"
#if HASP_USE_CUSTOM > 0 && false // <-- set this to true in your code
#if defined(HASP_USE_CUSTOM) && false // <-- set this to true in your code
#include "custom/my_custom.h"

View File

@ -3,7 +3,7 @@
#include "hasplib.h"
#if HASP_USE_CUSTOM > 0 && false // <-- set this to true in your code
#if defined(HASP_USE_CUSTOM) && false // <-- set this to true in your code
#include "custom/my_custom.h"

View File

@ -5,7 +5,7 @@
#define HASP_CUSTOM_H
#include "hasplib.h"
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
/* This function is called at boot */
void custom_setup();

View File

@ -40,7 +40,7 @@
#include "hasp_config.h"
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
#include "custom/my_custom.h"
#endif
@ -340,7 +340,7 @@ void dispatch_topic_payload(const char* topic, const char* payload, bool update,
}
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
if(topic == strstr_P(topic, PSTR(MQTT_TOPIC_CUSTOM "/"))) { // startsWith custom
topic += 7u;
custom_topic_payload(topic, (char*)payload, source);
@ -1001,7 +1001,7 @@ void dispatch_send_sensordata(const char*, const char*, uint8_t source)
haspDevice.get_sensors(doc);
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_get_sensors(doc);
#endif

View File

@ -20,7 +20,7 @@
#include "hasp_gui.h"
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
#include "custom/my_custom.h"
#endif
@ -110,7 +110,7 @@ void setup()
slaveSetup();
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_setup();
#endif
@ -145,7 +145,7 @@ IRAM_ATTR void loop()
consoleLoop();
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_loop();
#endif
@ -164,7 +164,7 @@ IRAM_ATTR void loop()
telnetEverySecond();
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_every_second();
#endif
// debugEverySecond();
@ -185,7 +185,7 @@ IRAM_ATTR void loop()
// gpioEvery5Seconds();
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_every_5seconds();
#endif
break;

View File

@ -36,7 +36,7 @@
#include "dev/device.h"
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
#include "custom/my_custom.h"
#endif
@ -142,7 +142,7 @@ void setup()
gpioSetup();
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_setup();
#endif
@ -164,7 +164,7 @@ void loop()
gpioLoop();
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_loop();
#endif
@ -178,7 +178,7 @@ void loop()
otaEverySecond(); // progressbar
#endif
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_every_second();
#endif
@ -188,7 +188,7 @@ void loop()
haspDevice.loop_5s();
gpioEvery5Seconds();
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
custom_every_5seconds();
#endif
}

View File

@ -264,7 +264,7 @@ static void onConnect(void* context)
topic = mqttNodeTopic + "config/#";
mqtt_subscribe(mqtt_client, topic.c_str());
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#";
mqtt_subscribe(mqtt_client, topic.c_str());

View File

@ -300,7 +300,7 @@ void mqttStart()
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CONFIG "/#"), mqttNodeTopic);
mqttSubscribeTo(topic);
#if HASP_USE_CUSTOM > 0
#if defined(HASP_USE_CUSTOM)
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttGroupTopic);
mqttSubscribeTo(topic);
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttNodeTopic);