Fix compiling errors when HASP_USE_CUSTOM set to zero

This commit is contained in:
marsman7 2024-12-03 21:37:06 +01:00
parent 9a3e9c03b8
commit 932805d3bd
12 changed files with 17 additions and 17 deletions

View File

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

View File

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

View File

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

View File

@ -452,7 +452,7 @@ void dispatch_topic_payload(const char* topic, const char* payload, bool update,
} }
#endif #endif
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
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);
@ -1295,7 +1295,7 @@ void dispatch_send_sensordata(const char*, const char*, uint8_t source)
haspDevice.get_sensors(doc); haspDevice.get_sensors(doc);
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_get_sensors(doc); custom_get_sensors(doc);
#endif #endif

View File

@ -32,7 +32,7 @@ void task_every_second_cb(lv_task_t* task)
telnetEverySecond(); telnetEverySecond();
#endif #endif
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_every_second(); custom_every_second();
#endif #endif
// debugEverySecond(); // debugEverySecond();
@ -53,7 +53,7 @@ void task_every_second_cb(lv_task_t* task)
break; break;
case 3: case 3:
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_every_5seconds(); custom_every_5seconds();
#endif #endif
break; break;

View File

@ -70,6 +70,6 @@
#endif #endif
#endif #endif
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
#include "custom/my_custom.h" #include "custom/my_custom.h"
#endif #endif

View File

@ -136,7 +136,7 @@ void setup()
slaveSetup(); slaveSetup();
#endif #endif
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_setup(); custom_setup();
#endif #endif
@ -195,7 +195,7 @@ IRAM_ATTR void loop()
consoleLoop(); consoleLoop();
#endif #endif
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_loop(); custom_loop();
#endif #endif
@ -222,7 +222,7 @@ IRAM_ATTR void loop()
telnetEverySecond(); telnetEverySecond();
#endif #endif
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_every_second(); custom_every_second();
#endif #endif
// debugEverySecond(); // debugEverySecond();
@ -243,7 +243,7 @@ IRAM_ATTR void loop()
// gpioEvery5Seconds(); // gpioEvery5Seconds();
#endif #endif
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_every_5seconds(); custom_every_5seconds();
#endif #endif
break; break;

View File

@ -371,7 +371,7 @@ void onMqttConnect(esp_mqtt_client_handle_t client)
// mqttSubscribeTo(mqttGroupTopic + subtopic); // mqttSubscribeTo(mqttGroupTopic + subtopic);
// mqttSubscribeTo(mqttNodeTopic + subtopic); // mqttSubscribeTo(mqttNodeTopic + subtopic);
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
String subtopic = F(MQTT_TOPIC_CUSTOM "/#"); String subtopic = F(MQTT_TOPIC_CUSTOM "/#");
mqttSubscribeTo(mqttGroupCommandTopic + subtopic); mqttSubscribeTo(mqttGroupCommandTopic + subtopic);
mqttSubscribeTo(mqttNodeCommandTopic + subtopic); mqttSubscribeTo(mqttNodeCommandTopic + subtopic);

View File

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

View File

@ -269,7 +269,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 defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#"; topic = mqttGroupTopic + MQTT_TOPIC_CUSTOM "/#";
mqtt_subscribe(mqtt_client, topic.c_str()); mqtt_subscribe(mqtt_client, topic.c_str());

View File

@ -311,7 +311,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 defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
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);

View File

@ -776,7 +776,7 @@ bool gpioIsSystemPin(uint8_t gpio)
return true; return true;
} }
#if defined(HASP_USE_CUSTOM) #if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
if(custom_pin_in_use(gpio)) { if(custom_pin_in_use(gpio)) {
LOG_DEBUG(TAG_GPIO, F(D_BULLET D_GPIO_PIN " %d => Custom"), gpio); LOG_DEBUG(TAG_GPIO, F(D_BULLET D_GPIO_PIN " %d => Custom"), gpio);
return true; return true;