diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index 50008358..2adc0dad 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -1,10 +1,12 @@ /* MIT License - Copyright (c) 2020 Francis Van Roie For full license information read the LICENSE file in the project folder */ -#include "hasp_conf.h" +#ifdef ARDUINO + #include "ArduinoLog.h" +#endif #include "ArduinoJson.h" -#include "ArduinoLog.h" +#include "hasp_conf.h" #if HASP_USE_EEPROM > 0 #include "StreamUtils.h" // For EEPromStream @@ -15,10 +17,13 @@ #include "hasp_conf.h" #if HASP_USE_DEBUG > 0 + #include "../hasp_debug.h" +#endif + +#if HASP_USE_CONFIG > 0 #include "lv_fs_if.h" - #include "hasp_debug.h" - #include "hasp_config.h" #include "hasp_gui.h" + #include "hasp_config.h" //#include "hasp_filesystem.h" included in hasp_conf.h #endif @@ -29,7 +34,9 @@ #include "hasp.h" #include "lv_theme_hasp.h" -#include "EEPROM.h" +#if HASP_USE_EEPROM > 0 + #include "EEPROM.h" +#endif //#if LV_USE_HASP @@ -129,7 +136,7 @@ bool hasp_update_sleep_state() void hasp_enable_wakeup_touch() { - LOG_VERBOSE(TAG_HASP,F("Wakeup touch enabled")); + LOG_VERBOSE(TAG_HASP, F("Wakeup touch enabled")); lv_obj_set_click(lv_disp_get_layer_sys(NULL), true); // enable first touch lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), wakeup_event_handler); } @@ -289,11 +296,13 @@ void haspProgressMsg(const char * msg) } */ } +#ifdef ARDUINO // Sets the value string of the global progress bar -void haspProgressMsg(const __FlashStringHelper * msg) +void haspProgressMsg(const __FlashStringHelper *msg) { haspProgressMsg(String(msg).c_str()); } +#endif /*Add a custom apply callback*/ static void custom_font_apply_cb(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) diff --git a/src/hasp/hasp.h b/src/hasp/hasp.h index edc5512b..0b0b260f 100644 --- a/src/hasp/hasp.h +++ b/src/hasp/hasp.h @@ -4,16 +4,22 @@ #ifndef HASP_H #define HASP_H -#define NORMALIZE(a, b, c) map(a, b, c, 0, 0xFFFFU) +#ifdef ARDUINO +#include "Arduino.h" +#endif -#include #include "lvgl.h" #include "hasp_conf.h" +#include "hasp_conf.h" +#include "hasp_utilities.h" + #if HASP_USE_DEBUG > 0 #include "../hasp_debug.h" #endif +#define NORMALIZE(a, b, c) map(a, b, c, 0, 0xFFFFU) + #ifdef __cplusplus extern "C" { #endif @@ -87,6 +93,8 @@ void hasp_enable_wakeup_touch(); #endif void haspProgressMsg(const char * msg); +#ifdef ARDUINO void haspProgressMsg(const __FlashStringHelper * msg); +#endif #endif /*HASP_H*/