Skip to content

Commit

Permalink
Merge pull request #829 from marsman7/fix-compiling_error_with_hasp_u…
Browse files Browse the repository at this point in the history
…se_custom_0

Fix compiling errors when HASP_USE_CUSTOM set to zero
  • Loading branch information
fvanroie authored Dec 4, 2024
2 parents 9a3e9c0 + 932805d commit d8ee62b
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/custom/my_custom_fan_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#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"

Expand Down
2 changes: 1 addition & 1 deletion src/custom/my_custom_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#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"

Expand Down
2 changes: 1 addition & 1 deletion src/custom/my_custom_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define HASP_CUSTOM_H

#include "hasplib.h"
#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0

/* This function is called at boot */
void custom_setup();
Expand Down
4 changes: 2 additions & 2 deletions src/hasp/hasp_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void dispatch_topic_payload(const char* topic, const char* payload, bool update,
}
#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
topic += 7u;
custom_topic_payload(topic, (char*)payload, source);
Expand Down Expand Up @@ -1295,7 +1295,7 @@ void dispatch_send_sensordata(const char*, const char*, uint8_t source)

haspDevice.get_sensors(doc);

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_get_sensors(doc);
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/hasp/hasp_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void task_every_second_cb(lv_task_t* task)
telnetEverySecond();
#endif

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_every_second();
#endif
// debugEverySecond();
Expand All @@ -53,7 +53,7 @@ void task_every_second_cb(lv_task_t* task)
break;

case 3:
#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_every_5seconds();
#endif
break;
Expand Down
2 changes: 1 addition & 1 deletion src/hasplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@
#endif
#endif

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
#include "custom/my_custom.h"
#endif
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void setup()
slaveSetup();
#endif

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_setup();
#endif

Expand Down Expand Up @@ -195,7 +195,7 @@ IRAM_ATTR void loop()
consoleLoop();
#endif

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_loop();
#endif

Expand All @@ -222,7 +222,7 @@ IRAM_ATTR void loop()
telnetEverySecond();
#endif

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_every_second();
#endif
// debugEverySecond();
Expand All @@ -243,7 +243,7 @@ IRAM_ATTR void loop()
// gpioEvery5Seconds();
#endif

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
custom_every_5seconds();
#endif
break;
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/hasp_mqtt_esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void onMqttConnect(esp_mqtt_client_handle_t client)
// mqttSubscribeTo(mqttGroupTopic + subtopic);
// mqttSubscribeTo(mqttNodeTopic + subtopic);

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
String subtopic = F(MQTT_TOPIC_CUSTOM "/#");
mqttSubscribeTo(mqttGroupCommandTopic + subtopic);
mqttSubscribeTo(mqttNodeCommandTopic + subtopic);
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/hasp_mqtt_paho_async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static void onConnect(void* context, MQTTAsync_successData* response)
topic = mqttNodeTopic + "config/#";
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 "/#";
mqtt_subscribe(mqtt_client, topic.c_str());

Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/hasp_mqtt_paho_single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static void onConnect(void* context)
topic = mqttNodeTopic + "config/#";
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 "/#";
mqtt_subscribe(mqtt_client, topic.c_str());

Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/hasp_mqtt_pubsubclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void mqttStart()
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CONFIG "/#"), mqttNodeTopic);
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);
mqttSubscribeTo(topic);
snprintf_P(topic, sizeof(topic), PSTR("%s" MQTT_TOPIC_CUSTOM "/#"), mqttNodeTopic);
Expand Down
2 changes: 1 addition & 1 deletion src/sys/gpio/hasp_gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ bool gpioIsSystemPin(uint8_t gpio)
return true;
}

#if defined(HASP_USE_CUSTOM)
#if defined(HASP_USE_CUSTOM) && HASP_USE_CUSTOM > 0
if(custom_pin_in_use(gpio)) {
LOG_DEBUG(TAG_GPIO, F(D_BULLET D_GPIO_PIN " %d => Custom"), gpio);
return true;
Expand Down

0 comments on commit d8ee62b

Please sign in to comment.