Macros LOG and LOGln now will, if debugging is enabled, log to an mqtt topic as well as Serial.

This commit is contained in:
2019-05-31 23:57:46 +02:00
parent 3294a35028
commit f9fba8a8f9
4 changed files with 60 additions and 7 deletions

View File

@ -28,6 +28,7 @@
#define MQTT_USER "..."
#define MQTT_PASS "..."
#define MQTT_TOPIC "pitrix/" // MQTT-Topic to listen to. Must not start with a slash, but must end with one."
#define MQTT_TOPIC_LOG "pitrix/log"
#define HOSTNAME "pitrix-%08X"
#define OTA_STARTUP_DELAY 10 // How many seconds to wait at startup. Set to 0 to disable.
@ -39,7 +40,7 @@
#define MONITOR_LOOP_TIME_THRESHOLD 500
#define MONITOR_LOOP_TIME_COUNT_MAX 10
#define REPORT_FREE_HEAP true
#define REPORT_METRICS true
#define EFFECT_CYCLE_TIME 300 // Time in seconds between cycling effects.
@ -48,7 +49,7 @@
#define EFFECT_MATRIX_SPEED_MIN 50
#define EFFECT_MATRIX_SPEED_MAX 135
#define EFFECT_SINGLE_DYNAMIC_LOOP_TIME 200
#define EFFECT_SINGLE_DYNAMIC_LOOP_TIME 50
#define EFFECT_MULTI_DYNAMIC_LOOP_TIME 1400
#define EFFECT_CONFETTI_PIXELS_PER_LOOP 2
@ -57,8 +58,8 @@
#define EFFECT_SNAKE_SLOWDOWN 2
#ifdef DEBUG
#define LOG(x) Serial.print(x);
#define LOGln(x) Serial.println(x);
#define LOG(x) mqtt_log(x); Serial.print(x);
#define LOGln(x) mqtt_log_ln(x); Serial.println(x);
#else
#define LOG(x) do {} while(0);
#define LOGln(x) do {} while(0);

View File

@ -2,7 +2,7 @@
#define my_mqtt_H
#include <PubSubClient.h>
//extern PubSubClient mqtt_client;
#include <Arduino.h>
void mqtt_callback(char* complete_topic, byte* pl, unsigned int length);
@ -14,4 +14,17 @@ void mqtt_loop();
void mqtt_publish(const char* topic, int number);
void mqtt_log(const char* message);
void mqtt_log(int number);
void mqtt_log(long unsigned int number);
void mqtt_log_ln(const char* message);
void mqtt_log_ln(int number);
void mqtt_log_ln(long unsigned int number);
void mqtt_log_send(const char* message);
extern String mqtt_log_str;
#endif // mqtt_H