From a2ab8cfc2ca5f45a739ef95feddc77d4ee77236a Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Mon, 12 Jul 2021 02:31:43 +0200 Subject: [PATCH] Add HASP_USE_CUSTOM --- src/hasp_debug.cpp | 4 ++++ src/hasp_debug.h | 4 +++- src/main_arduino.cpp | 21 ++++++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/hasp_debug.cpp b/src/hasp_debug.cpp index 699a02fc..dd51f515 100644 --- a/src/hasp_debug.cpp +++ b/src/hasp_debug.cpp @@ -313,6 +313,10 @@ void debug_get_tag(uint8_t tag, char* buffer) memcpy_P(buffer, PSTR("FONT"), 5); break; + case TAG_CUSTOM: + memcpy_P(buffer, PSTR("CUST"), 5); + break; + default: memcpy_P(buffer, PSTR("----"), 5); break; diff --git a/src/hasp_debug.h b/src/hasp_debug.h index 13a445ef..275ec663 100644 --- a/src/hasp_debug.h +++ b/src/hasp_debug.h @@ -191,7 +191,9 @@ enum { TAG_LVGL = 90, TAG_LVFS = 91, - TAG_FONT = 92 + TAG_FONT = 92, + + TAG_CUSTOM = 99 }; //#define TERM_COLOR_Black "\u001b[30m" diff --git a/src/main_arduino.cpp b/src/main_arduino.cpp index 567bf9c0..20576d43 100644 --- a/src/main_arduino.cpp +++ b/src/main_arduino.cpp @@ -20,6 +20,10 @@ #include "hasp_gui.h" #endif +#if HASP_USE_CUSTOM > 0 +#include "custom/my_custom.h" +#endif + bool isConnected; uint8_t mainLoopCounter = 0; unsigned long mainLastLoopTime = 0; @@ -106,6 +110,10 @@ void setup() slaveSetup(); #endif +#if HASP_USE_CUSTOM > 0 + custom_setup(); +#endif + mainLastLoopTime = -1000; // reset loop counter delay(20); // guiStart(); @@ -137,6 +145,10 @@ IRAM_ATTR void loop() consoleLoop(); #endif +#if HASP_USE_CUSTOM > 0 + custom_loop(); +#endif + #ifdef HASP_USE_STAT_COUNTER statLoopCounter++; // measures the average looptime #endif @@ -152,6 +164,9 @@ IRAM_ATTR void loop() telnetEverySecond(); #endif +#if HASP_USE_CUSTOM > 0 + custom_every_second(); +#endif // debugEverySecond(); switch(++mainLoopCounter) { @@ -161,7 +176,7 @@ IRAM_ATTR void loop() case 2: #if HASP_USE_HTTP_ASYNC > 0 - httpEvery5Seconds(); + httpEvery5Seconds(); #endif break; @@ -169,6 +184,10 @@ IRAM_ATTR void loop() #if HASP_USE_GPIO > 0 // gpioEvery5Seconds(); #endif + +#if HASP_USE_CUSTOM > 0 + custom_every_5seconds(); +#endif break; case 4: