MQTT can now be disabled via MQTT_ENABLE
This commit is contained in:
parent
158847d4c4
commit
f7fc459095
@ -1,5 +1,7 @@
|
||||
#ifndef my_mqtt_H
|
||||
#define my_mqtt_H
|
||||
#pragma once
|
||||
#include "config.h"
|
||||
|
||||
#ifdef MQTT_ENABLE
|
||||
|
||||
#include <PubSubClient.h>
|
||||
#include <Arduino.h>
|
||||
@ -27,4 +29,4 @@ void mqtt_log_send(const char* message);
|
||||
|
||||
extern String mqtt_log_str;
|
||||
|
||||
#endif // mqtt_H
|
||||
#endif // MQTT_ENABLE
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "my_mqtt.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef MQTT_ENABLE
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <PubSubClient.h>
|
||||
#include "EffectEntry.h"
|
||||
@ -118,3 +121,5 @@ void mqtt_log_send(const char* message) {
|
||||
mqtt_client.publish(MQTT_TOPIC_LOG, message);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MQTT_ENABLE
|
||||
|
@ -29,7 +29,9 @@ void setup() {
|
||||
ota_setup();
|
||||
fastled_setup();
|
||||
ntpClient.begin();
|
||||
#ifdef MQTT_ENABLE
|
||||
mqtt_setup();
|
||||
#endif
|
||||
LOGln("Core * Setup complete");
|
||||
|
||||
current_effect->start();
|
||||
@ -53,7 +55,9 @@ void loop() {
|
||||
}
|
||||
|
||||
ntpClient.update();
|
||||
#ifdef MQTT_ENABLE
|
||||
mqtt_loop();
|
||||
#endif
|
||||
|
||||
EVERY_N_MILLISECONDS(100) {
|
||||
baseHue++;
|
||||
@ -70,12 +74,12 @@ void loop() {
|
||||
FastLED.show();
|
||||
}
|
||||
|
||||
#if defined(MQTT_ENABLE) && defined(MQTT_REPORT_METRICS)
|
||||
EVERY_N_SECONDS(15) {
|
||||
if (REPORT_METRICS) {
|
||||
mqtt_publish("free_heap", ESP.getFreeHeap());
|
||||
mqtt_publish("uptime", millis()/1000);
|
||||
}
|
||||
}
|
||||
#endif // MQTT_REPORT_METRICS
|
||||
|
||||
|
||||
if (MONITOR_LOOP_TIMES && millis()-loop_started_at>=MONITOR_LOOP_TIME_THRESHOLD) {
|
||||
|
Loading…
Reference in New Issue
Block a user