mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 21:26:43 +00:00
Change HASP_USE_CUSTOM > 0 to defined(HASP_USE_CUSTOM)
This commit is contained in:
parent
dffea46d07
commit
45a451c830
@ -145,9 +145,9 @@
|
|||||||
#define HASP_NUM_GPIO_CONFIG 8
|
#define HASP_NUM_GPIO_CONFIG 8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HASP_USE_CUSTOM
|
// #ifndef HASP_USE_CUSTOM
|
||||||
#define HASP_USE_CUSTOM 0
|
// #define HASP_USE_CUSTOM 0
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
// #ifndef HASP_NUM_OUTPUTS
|
// #ifndef HASP_NUM_OUTPUTS
|
||||||
// #define HASP_NUM_OUTPUTS 3
|
// #define HASP_NUM_OUTPUTS 3
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "hasplib.h"
|
#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"
|
#include "custom/my_custom.h"
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "hasplib.h"
|
#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"
|
#include "custom/my_custom.h"
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#define HASP_CUSTOM_H
|
#define HASP_CUSTOM_H
|
||||||
|
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
|
|
||||||
/* This function is called at boot */
|
/* This function is called at boot */
|
||||||
void custom_setup();
|
void custom_setup();
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "hasp_config.h"
|
#include "hasp_config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
#include "custom/my_custom.h"
|
#include "custom/my_custom.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ void dispatch_topic_payload(const char* topic, const char* payload, bool update,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
if(topic == strstr_P(topic, PSTR(MQTT_TOPIC_CUSTOM "/"))) { // startsWith custom
|
if(topic == strstr_P(topic, PSTR(MQTT_TOPIC_CUSTOM "/"))) { // startsWith custom
|
||||||
topic += 7u;
|
topic += 7u;
|
||||||
custom_topic_payload(topic, (char*)payload, source);
|
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);
|
haspDevice.get_sensors(doc);
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_get_sensors(doc);
|
custom_get_sensors(doc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "hasp_gui.h"
|
#include "hasp_gui.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
#include "custom/my_custom.h"
|
#include "custom/my_custom.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ void setup()
|
|||||||
slaveSetup();
|
slaveSetup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_setup();
|
custom_setup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ IRAM_ATTR void loop()
|
|||||||
consoleLoop();
|
consoleLoop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_loop();
|
custom_loop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ IRAM_ATTR void loop()
|
|||||||
telnetEverySecond();
|
telnetEverySecond();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_every_second();
|
custom_every_second();
|
||||||
#endif
|
#endif
|
||||||
// debugEverySecond();
|
// debugEverySecond();
|
||||||
@ -185,7 +185,7 @@ IRAM_ATTR void loop()
|
|||||||
// gpioEvery5Seconds();
|
// gpioEvery5Seconds();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_every_5seconds();
|
custom_every_5seconds();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "dev/device.h"
|
#include "dev/device.h"
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
#include "custom/my_custom.h"
|
#include "custom/my_custom.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ void setup()
|
|||||||
gpioSetup();
|
gpioSetup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_setup();
|
custom_setup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ void loop()
|
|||||||
gpioLoop();
|
gpioLoop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_loop();
|
custom_loop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ void loop()
|
|||||||
otaEverySecond(); // progressbar
|
otaEverySecond(); // progressbar
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_every_second();
|
custom_every_second();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ void loop()
|
|||||||
haspDevice.loop_5s();
|
haspDevice.loop_5s();
|
||||||
gpioEvery5Seconds();
|
gpioEvery5Seconds();
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
custom_every_5seconds();
|
custom_every_5seconds();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ static void onConnect(void* context)
|
|||||||
topic = mqttNodeTopic + "config/#";
|
topic = mqttNodeTopic + "config/#";
|
||||||
mqtt_subscribe(mqtt_client, topic.c_str());
|
mqtt_subscribe(mqtt_client, topic.c_str());
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#";
|
topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#";
|
||||||
mqtt_subscribe(mqtt_client, topic.c_str());
|
mqtt_subscribe(mqtt_client, topic.c_str());
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ void mqttStart()
|
|||||||
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CONFIG "/#"), mqttNodeTopic);
|
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CONFIG "/#"), mqttNodeTopic);
|
||||||
mqttSubscribeTo(topic);
|
mqttSubscribeTo(topic);
|
||||||
|
|
||||||
#if HASP_USE_CUSTOM > 0
|
#if defined(HASP_USE_CUSTOM)
|
||||||
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttGroupTopic);
|
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttGroupTopic);
|
||||||
mqttSubscribeTo(topic);
|
mqttSubscribeTo(topic);
|
||||||
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttNodeTopic);
|
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttNodeTopic);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user