diff --git a/include/user_config_override-template.h b/include/user_config_override-template.h index 31d9b2c9..4d0d8806 100644 --- a/include/user_config_override-template.h +++ b/include/user_config_override-template.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ /*************************************************** diff --git a/src/dev/device.cpp b/src/dev/device.cpp index 7bee8627..dd5b7531 100644 --- a/src/dev/device.cpp +++ b/src/dev/device.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "device.h" diff --git a/src/dev/device.h b/src/dev/device.h index 13989e04..cafcec5d 100644 --- a/src/dev/device.h +++ b/src/dev/device.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DEVICE_H diff --git a/src/dev/esp32/esp32.cpp b/src/dev/esp32/esp32.cpp index bde329ea..e3f55935 100644 --- a/src/dev/esp32/esp32.cpp +++ b/src/dev/esp32/esp32.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if defined(ESP32) diff --git a/src/dev/esp32/esp32.h b/src/dev/esp32/esp32.h index 5cdb4f90..8c445521 100644 --- a/src/dev/esp32/esp32.h +++ b/src/dev/esp32/esp32.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DEVICE_ESP32_H diff --git a/src/dev/esp32/lanbonl8.cpp b/src/dev/esp32/lanbonl8.cpp index 39b7a182..f2f50ad9 100644 --- a/src/dev/esp32/lanbonl8.cpp +++ b/src/dev/esp32/lanbonl8.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "lanbonl8.h" diff --git a/src/dev/esp32/lanbonl8.h b/src/dev/esp32/lanbonl8.h index 3ec1fa93..f32e1fa4 100644 --- a/src/dev/esp32/lanbonl8.h +++ b/src/dev/esp32/lanbonl8.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DEVICE_LANBONL8_H diff --git a/src/dev/esp32/m5stackcore2.cpp b/src/dev/esp32/m5stackcore2.cpp index f4da47ab..11785afe 100644 --- a/src/dev/esp32/m5stackcore2.cpp +++ b/src/dev/esp32/m5stackcore2.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "m5stackcore2.h" diff --git a/src/dev/esp32/m5stackcore2.h b/src/dev/esp32/m5stackcore2.h index b41f4a6e..7bc48dd3 100644 --- a/src/dev/esp32/m5stackcore2.h +++ b/src/dev/esp32/m5stackcore2.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DEVICE_M5STACKCORE2_H diff --git a/src/dev/esp8266/esp8266.cpp b/src/dev/esp8266/esp8266.cpp index e21ca697..1bceb5f7 100644 --- a/src/dev/esp8266/esp8266.cpp +++ b/src/dev/esp8266/esp8266.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if defined(ESP8266) diff --git a/src/dev/esp8266/esp8266.h b/src/dev/esp8266/esp8266.h index 05a02e1a..39af24c6 100644 --- a/src/dev/esp8266/esp8266.h +++ b/src/dev/esp8266/esp8266.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DEVICE_ESP8266_H diff --git a/src/dev/win32/hasp_win32.cpp b/src/dev/win32/hasp_win32.cpp index dd2c8906..6dc27817 100644 --- a/src/dev/win32/hasp_win32.cpp +++ b/src/dev/win32/hasp_win32.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if defined(WINDOWS) diff --git a/src/dev/win32/hasp_win32.h b/src/dev/win32/hasp_win32.h index ae7015a0..2eb3614a 100644 --- a/src/dev/win32/hasp_win32.h +++ b/src/dev/win32/hasp_win32.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DEVICE_WINDOWS_H diff --git a/src/drv/hasp_drv_display.cpp b/src/drv/hasp_drv_display.cpp index e9c18840..c0b569ed 100644 --- a/src/drv/hasp_drv_display.cpp +++ b/src/drv/hasp_drv_display.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_drv_display.h" diff --git a/src/drv/hasp_drv_display.h b/src/drv/hasp_drv_display.h index 75a26c63..78bdf4c2 100644 --- a/src/drv/hasp_drv_display.h +++ b/src/drv/hasp_drv_display.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DRV_DISPLAY_H @@ -8,12 +8,12 @@ // Select Display Driver #if defined(USE_FSMC) - #include "fsmc_ili9341.h" +#include "fsmc_ili9341.h" #else - #include "tft_espi_drv.h" +#include "tft_espi_drv.h" #endif -void drv_display_init(lv_disp_drv_t * disp_drv, uint8_t rotation, bool invert_display); -void drv_display_flush_cb(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p); +void drv_display_init(lv_disp_drv_t* disp_drv, uint8_t rotation, bool invert_display); +void drv_display_flush_cb(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p); #endif \ No newline at end of file diff --git a/src/drv/hasp_drv_touch.cpp b/src/drv/hasp_drv_touch.cpp index f2ed5b33..a7a872e9 100644 --- a/src/drv/hasp_drv_touch.cpp +++ b/src/drv/hasp_drv_touch.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_drv_touch.h" diff --git a/src/drv/hasp_drv_touch.h b/src/drv/hasp_drv_touch.h index 6273ef71..f1b83f10 100644 --- a/src/drv/hasp_drv_touch.h +++ b/src/drv/hasp_drv_touch.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DRV_TOUCH_H @@ -7,11 +7,11 @@ #include "lvgl.h" #ifndef TOUCH_DRIVER - #define TOUCH_DRIVER -1 // No Touch +#define TOUCH_DRIVER -1 // No Touch #endif void drv_touch_init(uint8_t rotation); -bool drv_touch_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data); +bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data); void drv_touch_loop(); #endif \ No newline at end of file diff --git a/src/drv/tft_driver.h b/src/drv/tft_driver.h index a44dfba4..a5193456 100644 --- a/src/drv/tft_driver.h +++ b/src/drv/tft_driver.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_BASE_TFT_DRIVER_H diff --git a/src/drv/tft_driver_sdl2.h b/src/drv/tft_driver_sdl2.h index 0419427a..f8d81554 100644 --- a/src/drv/tft_driver_sdl2.h +++ b/src/drv/tft_driver_sdl2.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_SDL2_DRIVER_H diff --git a/src/drv/tft_driver_tftesp.cpp b/src/drv/tft_driver_tftesp.cpp index 2928d035..4a4a74bc 100644 --- a/src/drv/tft_driver_tftesp.cpp +++ b/src/drv/tft_driver_tftesp.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifdef ARDUINO diff --git a/src/drv/tft_driver_tftespi.h b/src/drv/tft_driver_tftespi.h index 83ae4097..4cb29f70 100644 --- a/src/drv/tft_driver_tftespi.h +++ b/src/drv/tft_driver_tftespi.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_TFTESPI_DRIVER_H diff --git a/src/drv/tft_espi_drv.cpp b/src/drv/tft_espi_drv.cpp index 3ce1fce7..d005a380 100644 --- a/src/drv/tft_espi_drv.cpp +++ b/src/drv/tft_espi_drv.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ /********************* diff --git a/src/drv/tft_espi_drv.h b/src/drv/tft_espi_drv.h index c02607df..9f55e73f 100644 --- a/src/drv/tft_espi_drv.h +++ b/src/drv/tft_espi_drv.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef TFT_ESPI_DRV_H diff --git a/src/drv/touch/hasp_drv_ft5206.h b/src/drv/touch/hasp_drv_ft5206.h index 9f1d9786..1922d7cb 100644 --- a/src/drv/touch/hasp_drv_ft5206.h +++ b/src/drv/touch/hasp_drv_ft5206.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DRV_FT5206_H @@ -10,7 +10,7 @@ #include "hasp_debug.h" // for TAG_DRVR -bool FT5206_getXY(int16_t * touchX, int16_t * touchY, bool debug); +bool FT5206_getXY(int16_t* touchX, int16_t* touchY, bool debug); void FT5206_init(); #endif diff --git a/src/drv/touch/hasp_drv_ft6336u.h b/src/drv/touch/hasp_drv_ft6336u.h index 652ca87b..a52100e1 100644 --- a/src/drv/touch/hasp_drv_ft6336u.h +++ b/src/drv/touch/hasp_drv_ft6336u.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DRV_FT6336U_H @@ -8,7 +8,7 @@ #include "hasp_debug.h" // for TAG_DRVR -bool FT6336U_getXY(int16_t * touchX, int16_t * touchY, bool debug); +bool FT6336U_getXY(int16_t* touchX, int16_t* touchY, bool debug); void FT6336U_init(); #endif diff --git a/src/drv/touch/hasp_drv_gt911.h b/src/drv/touch/hasp_drv_gt911.h index 761ae081..727a84e7 100644 --- a/src/drv/touch/hasp_drv_gt911.h +++ b/src/drv/touch/hasp_drv_gt911.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DRV_911_H @@ -8,7 +8,7 @@ #include "hasp_debug.h" // for TAG_DRVR -bool GT911_getXY(int16_t * touchX, int16_t * touchY, bool debug); +bool GT911_getXY(int16_t* touchX, int16_t* touchY, bool debug); void GT911_init(); void GT911_loop(); diff --git a/src/drv/touch/hasp_drv_xpt2046.h b/src/drv/touch/hasp_drv_xpt2046.h index 188d31f7..e4217fa9 100644 --- a/src/drv/touch/hasp_drv_xpt2046.h +++ b/src/drv/touch/hasp_drv_xpt2046.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DRV_XPT2046B_H @@ -6,18 +6,18 @@ #if TOUCH_DRIVER == 0x2046B - #include "XPT2046_Touchscreen.h" +#include "XPT2046_Touchscreen.h" - #define XPT2046_HOR_RES TFT_WIDTH - #define XPT2046_VER_RES TFT_HEIGHT - #define XPT2046_X_MIN 200 - #define XPT2046_Y_MIN 200 - #define XPT2046_X_MAX 3800 - #define XPT2046_Y_MAX 3800 - #define XPT2046_AVG 4 - #define XPT2046_INV 0 +#define XPT2046_HOR_RES TFT_WIDTH +#define XPT2046_VER_RES TFT_HEIGHT +#define XPT2046_X_MIN 200 +#define XPT2046_Y_MIN 200 +#define XPT2046_X_MAX 3800 +#define XPT2046_Y_MAX 3800 +#define XPT2046_AVG 4 +#define XPT2046_INV 0 -bool XPT2046_getXY(int16_t * touchX, int16_t * touchY, bool debug); +bool XPT2046_getXY(int16_t* touchX, int16_t* touchY, bool debug); void XPT2046_init(); #endif diff --git a/src/hal/hasp_hal.cpp b/src/hal/hasp_hal.cpp index f2bea6a0..316f6ddf 100644 --- a/src/hal/hasp_hal.cpp +++ b/src/hal/hasp_hal.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_hal.h" @@ -26,7 +26,7 @@ String esp32ResetReason(uint8_t cpuid) } RESET_REASON reason = rtc_get_reset_reason(cpuid); - String resetReason((char *)0); + String resetReason((char*)0); resetReason.reserve(128); resetReason += F("CPU"); @@ -102,7 +102,7 @@ void halRestartMcu(void) String halGetResetInfo() { #if defined(ARDUINO_ARCH_ESP32) - String resetReason((char *)0); + String resetReason((char*)0); resetReason.reserve(128); resetReason += String(esp32ResetReason(0)); @@ -129,7 +129,7 @@ String halGetCoreVersion() String halGetChipModel() { - String model((char *)0); + String model((char*)0); model.reserve(128); #if defined(STM32F4xx) @@ -181,7 +181,7 @@ int freeHighMemory() { char top; #ifdef __arm__ - return &top - reinterpret_cast(sbrk(0)); + return &top - reinterpret_cast(sbrk(0)); #elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151) return &top - __brkval; #else // __arm__ @@ -254,12 +254,12 @@ uint8_t halGetHeapFragmentation() #endif } -String halGetMacAddress(int start, const char * seperator) +String halGetMacAddress(int start, const char* seperator) { byte mac[6]; #if defined(STM32F4xx) - uint8_t * mac_p = nullptr; + uint8_t* mac_p = nullptr; #if HASP_USE_ETHERNET > 0 #if USE_BUILTIN_ETHERNET > 0 mac_p = Ethernet.MACAddress(); @@ -272,7 +272,7 @@ String halGetMacAddress(int start, const char * seperator) WiFi.macAddress(mac); #endif - String cMac((char *)0); + String cMac((char*)0); cMac.reserve(32); for(int i = start; i < 6; ++i) { diff --git a/src/hal/hasp_hal.h b/src/hal/hasp_hal.h index 0ccd03df..3a8d5860 100644 --- a/src/hal/hasp_hal.h +++ b/src/hal/hasp_hal.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_HAL_H @@ -13,7 +13,7 @@ String halGetResetInfo(void); // size_t halGetFreeHeap(void); String halGetCoreVersion(void); String halGetChipModel(); -String halGetMacAddress(int start, const char * seperator); +String halGetMacAddress(int start, const char* seperator); // uint16_t halGetCpuFreqMHz(void); String halDisplayDriverName(void); String halGpioName(uint8_t gpio); diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index 3437ff04..cb9f21d8 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifdef ARDUINO diff --git a/src/hasp/hasp.h b/src/hasp/hasp.h index d7bc4eaa..986eefc8 100644 --- a/src/hasp/hasp.h +++ b/src/hasp/hasp.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_H diff --git a/src/hasp/hasp_attribute.cpp b/src/hasp/hasp_attribute.cpp index a5f6bab7..b2313255 100644 --- a/src/hasp/hasp_attribute.cpp +++ b/src/hasp/hasp_attribute.cpp @@ -1,13 +1,13 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifdef ARDUINO - #include "ArduinoLog.h" +#include "ArduinoLog.h" #endif #include "lvgl.h" #if LVGL_VERSION_MAJOR != 7 - #include "../lv_components.h" +#include "../lv_components.h" #endif #include "hasp.h" @@ -18,8 +18,8 @@ #include "hasp_parser.h" LV_FONT_DECLARE(unscii_8_icon); -extern lv_font_t * haspFonts[8]; -extern const char ** btnmatrix_default_map; // memory pointer to lvgl default btnmatrix map +extern lv_font_t* haspFonts[8]; +extern const char** btnmatrix_default_map; // memory pointer to lvgl default btnmatrix map #if 0 static bool attribute_lookup_lv_property(uint16_t hash, uint8_t * prop) @@ -111,20 +111,20 @@ static bool attribute_lookup_lv_property(uint16_t hash, uint8_t * prop) {ATTR_TRANSITION_PATH, LV_STYLE_TRANSITION_PATH & LV_STYLE_PROP_ALL}, {ATTR_VALUE_STR, LV_STYLE_VALUE_STR & LV_STYLE_PROP_ALL}, - #if LV_USE_SHADOW +#if LV_USE_SHADOW {ATTR_SHADOW_WIDTH, LV_STYLE_SHADOW_WIDTH & LV_STYLE_PROP_ALL}, {ATTR_SHADOW_OFS_X, LV_STYLE_SHADOW_OFS_X & LV_STYLE_PROP_ALL}, {ATTR_SHADOW_OFS_Y, LV_STYLE_SHADOW_OFS_Y & LV_STYLE_PROP_ALL}, {ATTR_SHADOW_SPREAD, LV_STYLE_SHADOW_SPREAD & LV_STYLE_PROP_ALL}, {ATTR_SHADOW_COLOR, LV_STYLE_SHADOW_COLOR & LV_STYLE_PROP_ALL}, {ATTR_SHADOW_OPA, LV_STYLE_SHADOW_OPA & LV_STYLE_PROP_ALL}, - #endif +#endif - #if LV_USE_BLEND_MODES && LV_USE_SHADOW +#if LV_USE_BLEND_MODES && LV_USE_SHADOW {ATTR_SHADOW_BLEND_MODE, LV_STYLE_SHADOW_BLEND_MODE & LV_STYLE_PROP_ALL}, - #endif +#endif - #if LV_USE_BLEND_MODES +#if LV_USE_BLEND_MODES {ATTR_BG_BLEND_MODE, LV_STYLE_BG_BLEND_MODE & LV_STYLE_PROP_ALL}, {ATTR_PATTERN_BLEND_MODE, LV_STYLE_PATTERN_BLEND_MODE & LV_STYLE_PROP_ALL}, {ATTR_IMAGE_BLEND_MODE, LV_STYLE_IMAGE_BLEND_MODE & LV_STYLE_PROP_ALL}, @@ -133,7 +133,7 @@ static bool attribute_lookup_lv_property(uint16_t hash, uint8_t * prop) {ATTR_OUTLINE_BLEND_MODE, LV_STYLE_OUTLINE_BLEND_MODE & LV_STYLE_PROP_ALL}, {ATTR_VALUE_BLEND_MODE, LV_STYLE_VALUE_BLEND_MODE & LV_STYLE_PROP_ALL}, {ATTR_TEXT_BLEND_MODE, LV_STYLE_TEXT_BLEND_MODE & LV_STYLE_PROP_ALL}, - #endif +#endif }; for(uint32_t i = 0; i < sizeof(props) / sizeof(props[0]); i++) { @@ -185,9 +185,9 @@ static bool attribute_update_lv_property(lv_obj_t * obj, const char * attr_p, ui #endif // OK - this function is missing in lvgl -static uint8_t my_roller_get_visible_row_count(lv_obj_t * roller) +static uint8_t my_roller_get_visible_row_count(lv_obj_t* roller) { - const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG); + const lv_font_t* font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG); lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG); lv_coord_t h = lv_obj_get_height(roller); @@ -198,32 +198,32 @@ static uint8_t my_roller_get_visible_row_count(lv_obj_t * roller) } // OK - this function is missing in lvgl -static inline int16_t my_arc_get_rotation(lv_obj_t * arc) +static inline int16_t my_arc_get_rotation(lv_obj_t* arc) { - lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc); + lv_arc_ext_t* ext = (lv_arc_ext_t*)lv_obj_get_ext_attr(arc); return ext->rotation_angle; } // OK - this function is missing in lvgl -static inline int16_t my_chart_get_min_value(lv_obj_t * chart) +static inline int16_t my_chart_get_min_value(lv_obj_t* chart) { - lv_chart_ext_t * ext = (lv_chart_ext_t *)lv_obj_get_ext_attr(chart); + lv_chart_ext_t* ext = (lv_chart_ext_t*)lv_obj_get_ext_attr(chart); return ext->ymin[LV_CHART_AXIS_PRIMARY_Y]; } // OK - this function is missing in lvgl -static inline int16_t my_chart_get_max_value(lv_obj_t * chart) +static inline int16_t my_chart_get_max_value(lv_obj_t* chart) { - lv_chart_ext_t * ext = (lv_chart_ext_t *)lv_obj_get_ext_attr(chart); + lv_chart_ext_t* ext = (lv_chart_ext_t*)lv_obj_get_ext_attr(chart); return ext->ymax[LV_CHART_AXIS_PRIMARY_Y]; } -lv_chart_series_t * my_chart_get_series(lv_obj_t * chart, uint8_t ser_num) +lv_chart_series_t* my_chart_get_series(lv_obj_t* chart, uint8_t ser_num) { - lv_chart_ext_t * ext = (lv_chart_ext_t *)lv_obj_get_ext_attr(chart); - lv_chart_series_t * ser = (lv_chart_series_t *)_lv_ll_get_tail(&ext->series_ll); + lv_chart_ext_t* ext = (lv_chart_ext_t*)lv_obj_get_ext_attr(chart); + lv_chart_series_t* ser = (lv_chart_series_t*)_lv_ll_get_tail(&ext->series_ll); while(ser_num > 0 && ser) { - ser = (lv_chart_series_t *)_lv_ll_get_prev(&ext->series_ll, ser); + ser = (lv_chart_series_t*)_lv_ll_get_prev(&ext->series_ll, ser); ser_num--; } return ser; @@ -234,11 +234,11 @@ lv_chart_series_t * my_chart_get_series(lv_obj_t * chart, uint8_t ser_num) * @param obj pointer to a object * @param text '\0' terminated character string. NULL to refresh with the current text. */ -void my_obj_set_value_str_txt(lv_obj_t * obj, uint8_t part, lv_state_t state, const char * text) +void my_obj_set_value_str_txt(lv_obj_t* obj, uint8_t part, lv_state_t state, const char* text) { // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); - const void * value_str_p = lv_obj_get_style_value_str(obj, part); + const void* value_str_p = lv_obj_get_style_value_str(obj, part); lv_obj_invalidate(obj); if(text == NULL || text[0] == 0) { @@ -257,13 +257,13 @@ void my_obj_set_value_str_txt(lv_obj_t * obj, uint8_t part, lv_state_t state, co /*Allocate space for the new text*/ // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); - value_str_p = (char *)lv_mem_alloc(len); + value_str_p = (char*)lv_mem_alloc(len); LV_ASSERT_MEM(value_str_p); if(value_str_p == NULL) return; // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); - strncpy((char *)value_str_p, text, len); - lv_obj_set_style_local_value_str(obj, part, state, (char *)value_str_p); + strncpy((char*)value_str_p, text, len); + lv_obj_set_style_local_value_str(obj, part, state, (char*)value_str_p); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); return; } @@ -294,17 +294,17 @@ void my_obj_set_value_str_txt(lv_obj_t * obj, uint8_t part, lv_state_t state, co /*Allocate space for the new text*/ value_str_p = lv_mem_alloc(len); LV_ASSERT_MEM(value_str_p); - if(value_str_p != NULL) strcpy((char *)value_str_p, text); - lv_obj_set_style_local_value_str(obj, part, state, (char *)value_str_p); + if(value_str_p != NULL) strcpy((char*)value_str_p, text); + lv_obj_set_style_local_value_str(obj, part, state, (char*)value_str_p); } // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); } -void my_btnmatrix_map_clear(lv_obj_t * obj) +void my_btnmatrix_map_clear(lv_obj_t* obj) { - lv_btnmatrix_ext_t * ext = (lv_btnmatrix_ext_t *)lv_obj_get_ext_attr(obj); - const char ** map_p_tmp = ext->map_p; // store current pointer + lv_btnmatrix_ext_t* ext = (lv_btnmatrix_ext_t*)lv_obj_get_ext_attr(obj); + const char** map_p_tmp = ext->map_p; // store current pointer LOG_VERBOSE(TAG_ATTR, "%s %d %x btn_cnt: %d", __FILE__, __LINE__, map_p_tmp, ext->btn_cnt); @@ -326,9 +326,9 @@ void my_btnmatrix_map_clear(lv_obj_t * obj) } } -static void my_btnmatrix_map_create(lv_obj_t * obj, const char * payload) +static void my_btnmatrix_map_create(lv_obj_t* obj, const char* payload) { - const char ** map_p = lv_btnmatrix_get_map_array(obj); + const char** map_p = lv_btnmatrix_get_map_array(obj); // Create new map // Reserve memory for JsonDocument @@ -343,8 +343,8 @@ static void my_btnmatrix_map_create(lv_obj_t * obj, const char * payload) JsonArray arr = map_doc.as(); // Parse payload - size_t tot_len = sizeof(char *) * (arr.size() + 1); - const char ** map_data_str = (const char **)lv_mem_alloc(tot_len); + size_t tot_len = sizeof(char*) * (arr.size() + 1); + const char** map_data_str = (const char**)lv_mem_alloc(tot_len); if(map_data_str == NULL) { LOG_ERROR(TAG_ATTR, F("Out of memory while creating button map")); return; @@ -355,12 +355,12 @@ static void my_btnmatrix_map_create(lv_obj_t * obj, const char * payload) tot_len = 0; for(JsonVariant btn : arr) { // tot_len += btn.as().length() + 1; - tot_len += strlen(btn.as()) + 1; + tot_len += strlen(btn.as()) + 1; } tot_len++; // trailing '\0' LOG_VERBOSE(TAG_ATTR, F("Array Size = %d, Map Length = %d"), arr.size(), tot_len); - char * buffer_addr = (char *)lv_mem_alloc(tot_len); + char* buffer_addr = (char*)lv_mem_alloc(tot_len); if(buffer_addr == NULL) { lv_mem_free(map_data_str); LOG_ERROR(TAG_ATTR, F("Out of memory while creating button map")); @@ -378,12 +378,12 @@ static void my_btnmatrix_map_create(lv_obj_t * obj, const char * payload) LOG_VERBOSE(TAG_ATTR, F("%s %d lbl addr: %x"), __FILE__, __LINE__, buffer_addr); for(JsonVariant btn : arr) { // size_t len = btn.as().length() + 1; - size_t len = strlen(btn.as()) + 1; - LOG_VERBOSE(TAG_ATTR, F(D_BULLET "Adding button: %s (%d bytes) %x"), btn.as(), len, + size_t len = strlen(btn.as()) + 1; + LOG_VERBOSE(TAG_ATTR, F(D_BULLET "Adding button: %s (%d bytes) %x"), btn.as(), len, buffer_addr + pos); // LOG_VERBOSE(TAG_ATTR, F(D_BULLET "Adding button: %s (%d bytes) %x"), btn.as().c_str(), len, // buffer_addr + pos); - memccpy(buffer_addr + pos, btn.as(), 0, len); // Copy the label text into the buffer + memccpy(buffer_addr + pos, btn.as(), 0, len); // Copy the label text into the buffer // memccpy(buffer_addr + pos, btn.as().c_str(), 0, len); // Copy the label text into the buffer map_data_str[index++] = buffer_addr + pos; // save pointer to the label in the array pos += len; @@ -395,17 +395,17 @@ static void my_btnmatrix_map_create(lv_obj_t * obj, const char * payload) LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); } -void line_clear_points(lv_obj_t * obj) +void line_clear_points(lv_obj_t* obj) { - lv_line_ext_t * ext = (lv_line_ext_t *)lv_obj_get_ext_attr(obj); + lv_line_ext_t* ext = (lv_line_ext_t*)lv_obj_get_ext_attr(obj); if(ext->point_array && (ext->point_num > 0)) { - const lv_point_t * ptr = ext->point_array; + const lv_point_t* ptr = ext->point_array; lv_line_set_points(obj, NULL, 0); lv_mem_free(ptr); } } -static void line_set_points(lv_obj_t * obj, const char * payload) +static void line_set_points(lv_obj_t* obj, const char* payload) { line_clear_points(obj); // delete pointmap @@ -422,8 +422,8 @@ static void line_set_points(lv_obj_t * obj, const char * payload) JsonArray arr = doc.as(); // Parse payload - size_t tot_len = sizeof(lv_point_t *) * (arr.size()); - lv_point_t * point_arr = (lv_point_t *)lv_mem_alloc(tot_len); + size_t tot_len = sizeof(lv_point_t*) * (arr.size()); + lv_point_t* point_arr = (lv_point_t*)lv_mem_alloc(tot_len); if(point_arr == NULL) { LOG_ERROR(TAG_ATTR, F("Out of memory while creating line points")); return; @@ -454,7 +454,7 @@ static inline lv_color_t haspLogColor(lv_color_t color) return color; } -static lv_font_t * haspPayloadToFont(const char * payload) +static lv_font_t* haspPayloadToFont(const char* payload) { uint8_t var = atoi(payload); @@ -470,25 +470,25 @@ static lv_font_t * haspPayloadToFont(const char * payload) #ifndef ARDUINO_ARCH_ESP8266 - #ifdef LV_FONT_CUSTOM_12 +#ifdef LV_FONT_CUSTOM_12 case 12: return LV_THEME_DEFAULT_FONT_SMALL; - #endif +#endif - #ifdef LV_FONT_CUSTOM_16 +#ifdef LV_FONT_CUSTOM_16 case 16: return LV_THEME_DEFAULT_FONT_NORMAL; - #endif +#endif - #ifdef LV_FONT_CUSTOM_22 +#ifdef LV_FONT_CUSTOM_22 case 22: return LV_THEME_DEFAULT_FONT_SUBTITLE; - #endif +#endif - #ifdef LV_FONT_CUSTOM_28 +#ifdef LV_FONT_CUSTOM_28 case 28: return LV_THEME_DEFAULT_FONT_TITLE; - #endif +#endif #endif @@ -497,27 +497,27 @@ static lv_font_t * haspPayloadToFont(const char * payload) } } -static void gauge_format_10(lv_obj_t * gauge, char * buf, int bufsize, int32_t value) +static void gauge_format_10(lv_obj_t* gauge, char* buf, int bufsize, int32_t value) { snprintf(buf, bufsize, PSTR("%d"), value / 10); } -static void gauge_format_100(lv_obj_t * gauge, char * buf, int bufsize, int32_t value) +static void gauge_format_100(lv_obj_t* gauge, char* buf, int bufsize, int32_t value) { snprintf(buf, bufsize, PSTR("%d"), value / 100); } -static void gauge_format_1k(lv_obj_t * gauge, char * buf, int bufsize, int32_t value) +static void gauge_format_1k(lv_obj_t* gauge, char* buf, int bufsize, int32_t value) { snprintf(buf, bufsize, PSTR("%d"), value / 1000); } -static void gauge_format_10k(lv_obj_t * gauge, char * buf, int bufsize, int32_t value) +static void gauge_format_10k(lv_obj_t* gauge, char* buf, int bufsize, int32_t value) { snprintf(buf, bufsize, PSTR("%d"), value / 10000); } -static void hasp_process_label_long_mode(lv_obj_t * obj, const char * payload, bool update) +static void hasp_process_label_long_mode(lv_obj_t* obj, const char* payload, bool update) { if(update) { lv_label_long_mode_t mode = LV_LABEL_LONG_EXPAND; @@ -545,10 +545,10 @@ static void hasp_process_label_long_mode(lv_obj_t * obj, const char * payload, b } // OK -lv_obj_t * FindButtonLabel(lv_obj_t * btn) +lv_obj_t* FindButtonLabel(lv_obj_t* btn) { if(btn) { - lv_obj_t * label = lv_obj_get_child_back(btn, NULL); + lv_obj_t* label = lv_obj_get_child_back(btn, NULL); #if 1 if(label) { if(check_obj_type(label, LV_HASP_LABEL)) { @@ -558,7 +558,7 @@ lv_obj_t * FindButtonLabel(lv_obj_t * btn) if(label) { lv_obj_type_t list; lv_obj_get_type(label, &list); - const char * objtype = list.type[0]; + const char* objtype = list.type[0]; if(check_obj_type(objtype, LV_HASP_LABEL)) { return label; @@ -575,23 +575,23 @@ lv_obj_t * FindButtonLabel(lv_obj_t * btn) } // OK -static inline void haspSetLabelText(lv_obj_t * obj, const char * value) +static inline void haspSetLabelText(lv_obj_t* obj, const char* value) { - lv_obj_t * label = FindButtonLabel(obj); + lv_obj_t* label = FindButtonLabel(obj); if(label) { lv_label_set_text(label, value); } } // OK -static bool haspGetLabelText(lv_obj_t * obj, char ** text) +static bool haspGetLabelText(lv_obj_t* obj, char** text) { if(!obj) { LOG_WARNING(TAG_ATTR, F("Button not defined")); return false; } - lv_obj_t * label = lv_obj_get_child_back(obj, NULL); + lv_obj_t* label = lv_obj_get_child_back(obj, NULL); if(label) { #if 1 if(check_obj_type(label, LV_HASP_LABEL)) { @@ -615,8 +615,8 @@ static bool haspGetLabelText(lv_obj_t * obj, char ** text) return false; } -static void hasp_attribute_get_part_state(lv_obj_t * obj, const char * attr_in, char * attr_out, uint8_t & part, - uint8_t & state) +static void hasp_attribute_get_part_state(lv_obj_t* obj, const char* attr_in, char* attr_out, uint8_t& part, + uint8_t& state) { int len = strlen(attr_in); if(len <= 0 || len >= 32) { @@ -668,7 +668,7 @@ static void hasp_attribute_get_part_state(lv_obj_t * obj, const char * attr_in, (LV_SLIDER_PART_BG != LV_SWITCH_PART_BG) || (LV_SLIDER_PART_INDIC != LV_ARC_PART_INDIC) || \ (LV_SLIDER_PART_KNOB != LV_ARC_PART_KNOB) || (LV_SLIDER_PART_BG != LV_ARC_PART_BG) || \ (LV_SLIDER_PART_INDIC != LV_BAR_PART_INDIC) || (LV_SLIDER_PART_BG != LV_BAR_PART_BG) - #error "LV_SLIDER, LV_BAR, LV_ARC, LV_SWITCH parts should match!" +#error "LV_SLIDER, LV_BAR, LV_ARC, LV_SWITCH parts should match!" #endif if(check_obj_type(obj, LV_HASP_SLIDER) || check_obj_type(obj, LV_HASP_SWITCH) || check_obj_type(obj, LV_HASP_ARC) || @@ -719,7 +719,7 @@ static void hasp_attribute_get_part_state(lv_obj_t * obj, const char * attr_in, * @param update bool: change/set the value if true, dispatch/get value if false * @note setting a value won't return anything, getting will dispatch the value */ -static void hasp_local_style_attr(lv_obj_t * obj, const char * attr_p, uint16_t attr_hash, const char * payload, +static void hasp_local_style_attr(lv_obj_t* obj, const char* attr_p, uint16_t attr_hash, const char* payload, bool update) { char attr[32]; @@ -857,7 +857,7 @@ static void hasp_local_style_attr(lv_obj_t * obj, const char * attr_p, uint16_t return; } case ATTR_TEXT_FONT: { - lv_font_t * font = haspPayloadToFont(payload); + lv_font_t* font = haspPayloadToFont(payload); if(font) { uint8_t count = 3; if(check_obj_type(obj, LV_HASP_ROLLER)) count = my_roller_get_visible_row_count(obj); @@ -1015,7 +1015,7 @@ static void hasp_local_style_attr(lv_obj_t * obj, const char * attr_p, uint16_t return; } case ATTR_VALUE_FONT: { - lv_font_t * font = haspPayloadToFont(payload); + lv_font_t* font = haspPayloadToFont(payload); if(font) { return lv_obj_set_style_local_value_font(obj, part, state, font); } else { @@ -1058,14 +1058,14 @@ static void hasp_local_style_attr(lv_obj_t * obj, const char * attr_p, uint16_t LOG_WARNING(TAG_ATTR, F(D_ATTRIBUTE_UNKNOWN " (%d)"), attr_p, attr_hash); } -static void hasp_process_arc_attribute(lv_obj_t * obj, const char * attr_p, uint16_t attr_hash, const char * payload, +static void hasp_process_arc_attribute(lv_obj_t* obj, const char* attr_p, uint16_t attr_hash, const char* payload, bool update) { // We already know it's a arc object int16_t intval = atoi(payload); uint16_t val = atoi(payload); - char * attr = (char *)attr_p; + char* attr = (char*)attr_p; if(*attr == '.') attr++; // strip leading '.' switch(attr_hash) { @@ -1102,7 +1102,7 @@ static void hasp_process_arc_attribute(lv_obj_t * obj, const char * attr_p, uint LOG_WARNING(TAG_ATTR, F(D_ATTRIBUTE_UNKNOWN), attr_p); } -static void hasp_process_lmeter_attribute(lv_obj_t * obj, const char * attr_p, uint16_t attr_hash, const char * payload, +static void hasp_process_lmeter_attribute(lv_obj_t* obj, const char* attr_p, uint16_t attr_hash, const char* payload, bool update) { // We already know it's a linemeter object @@ -1112,7 +1112,7 @@ static void hasp_process_lmeter_attribute(lv_obj_t * obj, const char * attr_p, u uint16_t line_count = lv_linemeter_get_line_count(obj); uint16_t angle = lv_linemeter_get_scale_angle(obj); - char * attr = (char *)attr_p; + char* attr = (char*)attr_p; if(*attr == '.') attr++; // strip leading '.' switch(attr_hash) { @@ -1134,7 +1134,7 @@ static void hasp_process_lmeter_attribute(lv_obj_t * obj, const char * attr_p, u LOG_WARNING(TAG_ATTR, F(D_ATTRIBUTE_UNKNOWN), attr_p); } -static void hasp_process_gauge_attribute(lv_obj_t * obj, const char * attr_p, uint16_t attr_hash, const char * payload, +static void hasp_process_gauge_attribute(lv_obj_t* obj, const char* attr_p, uint16_t attr_hash, const char* payload, bool update) { // We already know it's a gauge object @@ -1145,7 +1145,7 @@ static void hasp_process_gauge_attribute(lv_obj_t * obj, const char * attr_p, ui uint16_t line_count = lv_gauge_get_line_count(obj); uint16_t angle = lv_gauge_get_scale_angle(obj); - char * attr = (char *)attr_p; + char* attr = (char*)attr_p; if(*attr == '.') attr++; // strip leading '.' switch(attr_hash) { @@ -1193,7 +1193,7 @@ static void hasp_process_gauge_attribute(lv_obj_t * obj, const char * attr_p, ui // ##################### Common Attributes ######################################################## -static void hasp_process_obj_attribute_txt(lv_obj_t * obj, const char * attr, const char * payload, bool update) +static void hasp_process_obj_attribute_txt(lv_obj_t* obj, const char* attr, const char* payload, bool update) { /* Attributes depending on objecttype */ // lv_obj_type_t list; @@ -1204,7 +1204,7 @@ static void hasp_process_obj_attribute_txt(lv_obj_t * obj, const char * attr, co if(update) { haspSetLabelText(obj, payload); } else { - char * text = NULL; + char* text = NULL; if(haspGetLabelText(obj, &text) && text) hasp_out_str(obj, attr, text); } return; @@ -1235,7 +1235,7 @@ static void hasp_process_obj_attribute_txt(lv_obj_t * obj, const char * attr, co LOG_WARNING(TAG_ATTR, F(D_ATTRIBUTE_UNKNOWN), attr); } -bool hasp_process_obj_attribute_val(lv_obj_t * obj, const char * attr, const char * payload, bool update) +bool hasp_process_obj_attribute_val(lv_obj_t* obj, const char* attr, const char* payload, bool update) { int16_t intval = atoi(payload); @@ -1283,7 +1283,7 @@ bool hasp_process_obj_attribute_val(lv_obj_t * obj, const char * attr, const cha return true; } -static void hasp_process_obj_attribute_range(lv_obj_t * obj, const char * attr, const char * payload, bool update, +static void hasp_process_obj_attribute_range(lv_obj_t* obj, const char* attr, const char* payload, bool update, bool set_min, bool set_max) { int16_t val = atoi(payload); @@ -1355,7 +1355,7 @@ static void hasp_process_obj_attribute_range(lv_obj_t * obj, const char * attr, * @param update bool: change/set the value if true, dispatch/get value if false * @note setting a value won't return anything, getting will dispatch the value */ -void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char * payload, bool update) +void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* payload, bool update) { // unsigned long start = millis(); if(!obj) { @@ -1364,7 +1364,7 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char } int16_t val = atoi(payload); - char * attr = (char *)attr_p; + char* attr = (char*)attr_p; if(*attr == '.') attr++; // strip leading '.' uint16_t attr_hash = Utilities::get_sdbm(attr); @@ -1471,7 +1471,8 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char break; // attribute_found case ATTR_ENABLED: - update ? lv_obj_set_click(obj, Utilities::is_true(payload)) : hasp_out_int(obj, attr, lv_obj_get_click(obj)); + update ? lv_obj_set_click(obj, Utilities::is_true(payload)) + : hasp_out_int(obj, attr, lv_obj_get_click(obj)); break; // attribute_found case ATTR_SRC: @@ -1483,7 +1484,7 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char case LV_IMG_SRC_FILE: return hasp_out_str(obj, attr, lv_img_get_file_name(obj)); case LV_IMG_SRC_SYMBOL: - return hasp_out_str(obj, attr, (char *)lv_img_get_src(obj)); + return hasp_out_str(obj, attr, (char*)lv_img_get_src(obj)); default: return; } @@ -1521,7 +1522,7 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char case ATTR_ALIGN: if(check_obj_type(obj, LV_HASP_BUTTON)) { - lv_obj_t * label = FindButtonLabel(obj); + lv_obj_t* label = FindButtonLabel(obj); if(label == NULL) goto attribute_not_found; else @@ -1540,7 +1541,7 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char case ATTR_MODE: if(check_obj_type(obj, LV_HASP_BUTTON)) { - lv_obj_t * label = FindButtonLabel(obj); + lv_obj_t* label = FindButtonLabel(obj); if(label) { hasp_process_label_long_mode(label, payload, update); lv_obj_set_width(label, lv_obj_get_width(obj)); @@ -1575,7 +1576,7 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char } } else if(check_obj_type(obj, LV_HASP_ROLLER)) { if(update) { - lv_roller_ext_t * ext = (lv_roller_ext_t *)lv_obj_get_ext_attr(obj); + lv_roller_ext_t* ext = (lv_roller_ext_t*)lv_obj_get_ext_attr(obj); lv_roller_set_options(obj, payload, ext->mode); } else { hasp_out_str(obj, attr, lv_roller_get_options(obj)); diff --git a/src/hasp/hasp_attribute.h b/src/hasp/hasp_attribute.h index 7273cd21..ff8ccf50 100644 --- a/src/hasp/hasp_attribute.h +++ b/src/hasp/hasp_attribute.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_ATTR_SET_H @@ -6,7 +6,7 @@ #include "lvgl.h" #if LVGL_VERSION_MAJOR != 7 - #include "../lv_components.h" +#include "../lv_components.h" #endif #include "hasp_conf.h" @@ -18,14 +18,14 @@ extern "C" { #endif // test -lv_chart_series_t * my_chart_get_series(lv_obj_t * chart, uint8_t ser_num); -void my_obj_set_value_str_txt(lv_obj_t * obj, uint8_t part, lv_state_t state, const char * text); +lv_chart_series_t* my_chart_get_series(lv_obj_t* chart, uint8_t ser_num); +void my_obj_set_value_str_txt(lv_obj_t* obj, uint8_t part, lv_state_t state, const char* text); -void my_btnmatrix_map_clear(lv_obj_t * obj); -void line_clear_points(lv_obj_t * obj); +void my_btnmatrix_map_clear(lv_obj_t* obj); +void line_clear_points(lv_obj_t* obj); -void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char * payload, bool update); -bool hasp_process_obj_attribute_val(lv_obj_t * obj, const char * attr, const char * payload, bool update); +void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* payload, bool update); +bool hasp_process_obj_attribute_val(lv_obj_t* obj, const char* attr, const char* payload, bool update); #ifdef __cplusplus } /* extern "C" */ @@ -37,8 +37,8 @@ bool hasp_process_obj_attribute_val(lv_obj_t * obj, const char * attr, const cha #define hasp_out_color hasp_send_obj_attribute_color #define _HASP_ATTRIBUTE(prop_name, func_name, value_type) \ - static inline void attribute_##func_name(lv_obj_t * obj, uint8_t part, lv_state_t state, bool update, \ - const char * attr, value_type val) \ + static inline void attribute_##func_name(lv_obj_t* obj, uint8_t part, lv_state_t state, bool update, \ + const char* attr, value_type val) \ { \ if(update) { \ return lv_obj_set_style_local_##func_name(obj, part, state, (value_type)val); \ diff --git a/src/hasp/hasp_dispatch.cpp b/src/hasp/hasp_dispatch.cpp index 9484ff4b..4e6a360a 100644 --- a/src/hasp/hasp_dispatch.cpp +++ b/src/hasp/hasp_dispatch.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include diff --git a/src/hasp/hasp_dispatch.h b/src/hasp/hasp_dispatch.h index 254c1d0d..39f8cacc 100644 --- a/src/hasp/hasp_dispatch.h +++ b/src/hasp/hasp_dispatch.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DISPATCH_H diff --git a/src/hasp/hasp_object.cpp b/src/hasp/hasp_object.cpp index 68312705..6fa91a78 100644 --- a/src/hasp/hasp_object.cpp +++ b/src/hasp/hasp_object.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ /* ******************************************************************************************** diff --git a/src/hasp/hasp_object.h b/src/hasp/hasp_object.h index 012e4782..e280883a 100644 --- a/src/hasp/hasp_object.h +++ b/src/hasp/hasp_object.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_OBJECT_H @@ -60,27 +60,27 @@ enum lv_hasp_obj_type_t { LV_HASP_MASK = 63, // placeholder }; -void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id); +void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id); -lv_obj_t * hasp_find_obj_from_parent_id(lv_obj_t * parent, uint8_t objid); +lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid); // lv_obj_t * hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid); -bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, uint8_t * objid); +bool hasp_find_id_from_obj(lv_obj_t* obj, uint8_t* pageid, uint8_t* objid); // bool check_obj_type_str(const char * lvobjtype, lv_hasp_obj_type_t haspobjtype); -bool check_obj_type(lv_obj_t * obj, lv_hasp_obj_type_t haspobjtype); -void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level); -void hasp_object_delete(lv_obj_t * obj); +bool check_obj_type(lv_obj_t* obj, lv_hasp_obj_type_t haspobjtype); +void hasp_object_tree(lv_obj_t* parent, uint8_t pageid, uint16_t level); +void hasp_object_delete(lv_obj_t* obj); -void hasp_send_obj_attribute_str(lv_obj_t * obj, const char * attribute, const char * data); -void hasp_send_obj_attribute_int(lv_obj_t * obj, const char * attribute, int32_t val); -void hasp_send_obj_attribute_color(lv_obj_t * obj, const char * attribute, lv_color_t color); -void hasp_process_attribute(uint8_t pageid, uint8_t objid, const char * attr, const char * payload); +void hasp_send_obj_attribute_str(lv_obj_t* obj, const char* attribute, const char* data); +void hasp_send_obj_attribute_int(lv_obj_t* obj, const char* attribute, int32_t val); +void hasp_send_obj_attribute_color(lv_obj_t* obj, const char* attribute, lv_color_t color); +void hasp_process_attribute(uint8_t pageid, uint8_t objid, const char* attr, const char* payload); -void object_set_group_state(uint8_t groupid, uint8_t eventid, lv_obj_t * src_obj); +void object_set_group_state(uint8_t groupid, uint8_t eventid, lv_obj_t* src_obj); -void generic_event_handler(lv_obj_t * obj, lv_event_t event); -void toggle_event_handler(lv_obj_t * obj, lv_event_t event); -void slider_event_handler(lv_obj_t * obj, lv_event_t event); -void wakeup_event_handler(lv_obj_t * obj, lv_event_t event); +void generic_event_handler(lv_obj_t* obj, lv_event_t event); +void toggle_event_handler(lv_obj_t* obj, lv_event_t event); +void slider_event_handler(lv_obj_t* obj, lv_event_t event); +void wakeup_event_handler(lv_obj_t* obj, lv_event_t event); #define HASP_OBJ_BAR 1971 #define HASP_OBJ_BTN 3164 diff --git a/src/hasp/hasp_parser.cpp b/src/hasp/hasp_parser.cpp index af46a4ec..6742b1f7 100644 --- a/src/hasp/hasp_parser.cpp +++ b/src/hasp/hasp_parser.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include @@ -13,13 +13,13 @@ #include "hasp_parser.h" #include "hasp_utilities.h" -bool Parser::haspPayloadToColor(const char * payload, lv_color32_t & color) +bool Parser::haspPayloadToColor(const char* payload, lv_color32_t& color) { /* HEX format #rrggbb or #rgb */ if(*payload == '#') { if(strlen(payload) >= 8) return false; - char * pEnd; + char* pEnd; long color_int = strtol(payload + 1, &pEnd, HEX); if(pEnd - payload == 7) { // #rrbbgg diff --git a/src/hasp/hasp_parser.h b/src/hasp/hasp_parser.h index 2ffc058c..d0697a17 100644 --- a/src/hasp/hasp_parser.h +++ b/src/hasp/hasp_parser.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_PARSER_H @@ -10,7 +10,7 @@ class Parser { public: - static bool haspPayloadToColor(const char * payload, lv_color32_t & color); + static bool haspPayloadToColor(const char* payload, lv_color32_t& color); }; /* Named COLOR attributes */ diff --git a/src/hasp/hasp_utilities.h b/src/hasp/hasp_utilities.h index e44a86ca..d8793f93 100644 --- a/src/hasp/hasp_utilities.h +++ b/src/hasp/hasp_utilities.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_UTILITIES_H diff --git a/src/hasp_config.cpp b/src/hasp_config.cpp index 540d995f..b92b9e13 100644 --- a/src/hasp_config.cpp +++ b/src/hasp_config.cpp @@ -1,29 +1,29 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if HASP_USE_CONFIG > 0 - #include "ArduinoJson.h" - #include "StreamUtils.h" // For EEPromStream +#include "ArduinoJson.h" +#include "StreamUtils.h" // For EEPromStream - #include "hasp_conf.h" +#include "hasp_conf.h" - #include "hasp_config.h" - #include "hasp_debug.h" - #include "hasp_gui.h" +#include "hasp_config.h" +#include "hasp_debug.h" +#include "hasp_gui.h" - //#include "hasp_ota.h" included in conf - //#include "hasp_filesystem.h" included in conf - //#include "hasp_telnet.h" included in conf - //#include "hasp_gpio.h" included in conf +//#include "hasp_ota.h" included in conf +//#include "hasp_filesystem.h" included in conf +//#include "hasp_telnet.h" included in conf +//#include "hasp_gpio.h" included in conf - //#include "hasp_eeprom.h" - #include "hasp/hasp.h" - #include "hasp/hasp_dispatch.h" +//#include "hasp_eeprom.h" +#include "hasp/hasp.h" +#include "hasp/hasp_dispatch.h" - #if HASP_USE_EEPROM > 0 - #include "EEPROM.h" - #endif +#if HASP_USE_EEPROM > 0 +#include "EEPROM.h" +#endif extern uint16_t dispatchTelePeriod; extern uint32_t dispatchLastMillis; @@ -31,7 +31,7 @@ extern uint32_t dispatchLastMillis; extern gui_conf_t gui_settings; extern dispatch_conf_t dispatch_settings; -void confDebugSet(const __FlashStringHelper * fstr_name) +void confDebugSet(const __FlashStringHelper* fstr_name) { /*char buffer[128]; snprintf_P(buffer, sizeof(buffer), PSTR(" * %s set"), name); @@ -39,7 +39,7 @@ void confDebugSet(const __FlashStringHelper * fstr_name) LOG_VERBOSE(TAG_CONF, F(D_BULLET "%S set"), fstr_name); } -bool configSet(int8_t & value, const JsonVariant & setting, const __FlashStringHelper * fstr_name) +bool configSet(int8_t& value, const JsonVariant& setting, const __FlashStringHelper* fstr_name) { if(!setting.isNull()) { int8_t val = setting.as(); @@ -51,7 +51,7 @@ bool configSet(int8_t & value, const JsonVariant & setting, const __FlashStringH } return false; } -bool configSet(uint8_t & value, const JsonVariant & setting, const __FlashStringHelper * fstr_name) +bool configSet(uint8_t& value, const JsonVariant& setting, const __FlashStringHelper* fstr_name) { if(!setting.isNull()) { uint8_t val = setting.as(); @@ -63,7 +63,7 @@ bool configSet(uint8_t & value, const JsonVariant & setting, const __FlashString } return false; } -bool configSet(uint16_t & value, const JsonVariant & setting, const __FlashStringHelper * fstr_name) +bool configSet(uint16_t& value, const JsonVariant& setting, const __FlashStringHelper* fstr_name) { if(!setting.isNull()) { uint16_t val = setting.as(); @@ -76,31 +76,31 @@ bool configSet(uint16_t & value, const JsonVariant & setting, const __FlashStrin return false; } -void configStartDebug(bool setupdebug, String & configFile) +void configStartDebug(bool setupdebug, String& configFile) { if(setupdebug) { debugStart(); // Debug started, now we can use it; HASP header sent - #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 +#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 LOG_INFO(TAG_CONF, F("SPI flash FS mounted")); filesystemInfo(); filesystemList(); - #endif +#endif } - #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 +#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 LOG_TRACE(TAG_CONF, F(D_FILE_LOADING), configFile.c_str()); - #else +#else LOG_TRACE(TAG_CONF, F(D_FILE_LOADING), "EEPROM"); - #endif +#endif } -void configRead(JsonDocument & settings, bool setupdebug = false) +void configRead(JsonDocument& settings, bool setupdebug = false) { - String configFile((char *)0); + String configFile((char*)0); configFile.reserve(32); configFile = String(FPSTR(FP_HASP_CONFIG_FILE)); DeserializationError error; - #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 +#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 File file = HASP_FS.open(configFile, "r"); if(file) { @@ -123,8 +123,8 @@ void configRead(JsonDocument & settings, bool setupdebug = false) // show settings in log String output; serializeJson(settings, output); - String passmask = F(D_PASSWORD_MASK); - const __FlashStringHelper * pass = F("pass"); + String passmask = F(D_PASSWORD_MASK); + const __FlashStringHelper* pass = F("pass"); output.replace(settings[FPSTR(FP_HTTP)][pass].as(), passmask); output.replace(settings[FPSTR(FP_MQTT)][pass].as(), passmask); output.replace(settings[FPSTR(FP_WIFI)][pass].as(), passmask); @@ -135,14 +135,14 @@ void configRead(JsonDocument & settings, bool setupdebug = false) return; } } - #else +#else - #if HASP_USE_EEPROM > 0 +#if HASP_USE_EEPROM > 0 EepromStream eepromStream(0, 1024); error = deserializeJson(settings, eepromStream); - #endif +#endif - #endif +#endif // File does not exist or error reading file if(setupdebug) { @@ -150,9 +150,9 @@ void configRead(JsonDocument & settings, bool setupdebug = false) } configStartDebug(setupdebug, configFile); - #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 +#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 LOG_ERROR(TAG_CONF, F(D_FILE_LOAD_FAILED), configFile.c_str()); - #endif +#endif } /* void configBackupToEeprom() @@ -186,11 +186,11 @@ void configBackupToEeprom() */ void configWrite() { - String configFile((char *)0); + String configFile((char*)0); configFile.reserve(32); configFile = String(FPSTR(FP_HASP_CONFIG_FILE)); - String settingsChanged((char *)0); + String settingsChanged((char*)0); settingsChanged.reserve(128); settingsChanged = F(D_CONFIG_CHANGED); @@ -210,9 +210,9 @@ void configWrite() bool writefile = false; bool changed = false; - const __FlashStringHelper * module; + const __FlashStringHelper* module; - #if HASP_USE_WIFI > 0 +#if HASP_USE_WIFI > 0 module = FPSTR(FP_WIFI); if(settings[module].as().isNull()) settings.createNestedObject(module); changed = wifiGetConfig(settings[module]); @@ -221,9 +221,9 @@ void configWrite() configOutput(settings[module], TAG_WIFI); writefile = true; } - #endif +#endif - #if HASP_USE_MQTT > 0 +#if HASP_USE_MQTT > 0 module = FPSTR(FP_MQTT); if(settings[module].as().isNull()) settings.createNestedObject(module); changed = mqttGetConfig(settings[module]); @@ -232,9 +232,9 @@ void configWrite() configOutput(settings[module], TAG_MQTT); writefile = true; } - #endif +#endif - #if HASP_USE_TELNET > 0 +#if HASP_USE_TELNET > 0 module = F("telnet"); if(settings[module].as().isNull()) settings.createNestedObject(module); changed = telnetGetConfig(settings[module]); @@ -243,9 +243,9 @@ void configWrite() configOutput(settings[module], TAG_TELN); writefile = true; } - #endif +#endif - #if HASP_USE_MDNS > 0 +#if HASP_USE_MDNS > 0 module = FPSTR(FP_MDNS); if(settings[module].as().isNull()) settings.createNestedObject(module); changed = mdnsGetConfig(settings[module]); @@ -254,9 +254,9 @@ void configWrite() configOutput(settings[module], TAG_MDNS); writefile = true; } - #endif +#endif - #if HASP_USE_HTTP > 0 +#if HASP_USE_HTTP > 0 if(settings[FPSTR(FP_HTTP)].as().isNull()) settings.createNestedObject(F("http")); changed = httpGetConfig(settings[FPSTR(FP_HTTP)]); if(changed) { @@ -264,9 +264,9 @@ void configWrite() configOutput(settings[FPSTR(FP_HTTP)], TAG_HTTP); writefile = true; } - #endif +#endif - #if HASP_USE_GPIO > 0 +#if HASP_USE_GPIO > 0 module = FPSTR(FP_GPIO); if(settings[module].as().isNull()) settings.createNestedObject(module); changed = gpioGetConfig(settings[module]); @@ -275,7 +275,7 @@ void configWrite() configOutput(settings[module], TAG_GPIO); writefile = true; } - #endif +#endif module = FPSTR(FP_DEBUG); if(settings[module].as().isNull()) settings.createNestedObject(module); @@ -305,7 +305,7 @@ void configWrite() // changed |= otaGetConfig(settings[F("ota")].as()); if(writefile) { - #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 +#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 File file = HASP_FS.open(configFile, "w"); if(file) { LOG_TRACE(TAG_CONF, F(D_FILE_SAVING), configFile.c_str()); @@ -320,7 +320,7 @@ void configWrite() } else { LOG_ERROR(TAG_CONF, F(D_FILE_SAVE_FAILED), configFile.c_str()); } - #endif +#endif // Method 1 // LOG_INFO(TAG_CONF,F("Writing to EEPROM")); @@ -330,7 +330,7 @@ void configWrite() // bufferedWifiClient.flush(); // <- OPTIONAL // eepromStream.flush(); // (for ESP) - #if defined(STM32F4xx) +#if defined(STM32F4xx) // Method 2 LOG_INFO(TAG_CONF, F(F_FILE_SAVING), "EEPROM"); char buffer[1024 + 128]; @@ -344,7 +344,7 @@ void configWrite() } else { LOG_ERROR(TAG_CONF, F(D_FILE_WRITE_FAILED), "EEPROM"); } - #endif +#endif } else { LOG_INFO(TAG_CONF, F(D_CONFIG_NOT_CHANGED)); @@ -361,19 +361,19 @@ void configSetup() Serial.println(__LINE__); if(i == 0) { - #if HASP_USE_SPIFFS > 0 +#if HASP_USE_SPIFFS > 0 EepromStream eepromStream(0, 2048); DeserializationError err = deserializeJson(settings, eepromStream); - #else +#else continue; - #endif +#endif } else { - #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 +#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 if(!filesystemSetup()) { LOG_ERROR(TAG_CONF, F("FILE: SPI flash init failed. Unable to mount FS: Using default settings...")); return; } - #endif +#endif configRead(settings, true); } @@ -386,35 +386,35 @@ void configSetup() haspSetConfig(settings[FPSTR(FP_HASP)]); // otaGetConfig(settings[F("ota")]); - #if HASP_USE_WIFI > 0 +#if HASP_USE_WIFI > 0 LOG_INFO(TAG_WIFI, F("Loading WiFi settings")); wifiSetConfig(settings[FPSTR(FP_WIFI)]); - #endif +#endif - #if HASP_USE_MQTT > 0 +#if HASP_USE_MQTT > 0 LOG_INFO(TAG_MQTT, F("Loading MQTT settings")); mqttSetConfig(settings[FPSTR(FP_MQTT)]); - #endif +#endif - #if HASP_USE_TELNET > 0 +#if HASP_USE_TELNET > 0 LOG_INFO(TAG_TELN, F("Loading Telnet settings")); telnetSetConfig(settings[F("telnet")]); - #endif +#endif - #if HASP_USE_MDNS > 0 +#if HASP_USE_MDNS > 0 LOG_INFO(TAG_MDNS, F("Loading MDNS settings")); mdnsSetConfig(settings[FPSTR(FP_MDNS)]); - #endif +#endif - #if HASP_USE_HTTP > 0 +#if HASP_USE_HTTP > 0 LOG_INFO(TAG_HTTP, F("Loading HTTP settings")); httpSetConfig(settings[FPSTR(FP_HTTP)]); - #endif +#endif - #if HASP_USE_GPIO > 0 +#if HASP_USE_GPIO > 0 LOG_INFO(TAG_GPIO, F("Loading GPIO settings")); gpioSetConfig(settings[FPSTR(FP_GPIO)]); - #endif +#endif LOG_INFO(TAG_CONF, F(D_CONFIG_LOADED)); } @@ -424,17 +424,17 @@ void configSetup() void configLoop(void) {} -void configOutput(const JsonObject & settings, uint8_t tag) +void configOutput(const JsonObject& settings, uint8_t tag) { - String output((char *)0); + String output((char*)0); output.reserve(128); serializeJson(settings, output); - String passmask((char *)0); + String passmask((char*)0); passmask.reserve(128); passmask = F("\"pass\":\"" D_PASSWORD_MASK "\""); - String password((char *)0); + String password((char*)0); password.reserve(128); String pass = F("pass"); @@ -471,7 +471,7 @@ void configOutput(const JsonObject & settings, uint8_t tag) bool configClearEeprom() { - #if defined(STM32F4xx) +#if defined(STM32F4xx) LOG_TRACE(TAG_CONF, F("Clearing EEPROM")); char buffer[1024 + 128]; memset(buffer, 1, sizeof(buffer)); @@ -486,11 +486,11 @@ bool configClearEeprom() LOG_ERROR(TAG_CONF, F("Failed to clear to EEPROM")); return false; } - #elif HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 +#elif HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 return HASP_FS.format(); - #else +#else return false; - #endif +#endif } #endif // HAS_USE_CONFIG \ No newline at end of file diff --git a/src/hasp_config.h b/src/hasp_config.h index 76cd5448..77eb6e01 100644 --- a/src/hasp_config.h +++ b/src/hasp_config.h @@ -1,14 +1,14 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if HASP_USE_CONFIG > 0 - #ifndef HASP_CONFIG_H - #define HASP_CONFIG_H +#ifndef HASP_CONFIG_H +#define HASP_CONFIG_H - #include "hasp_conf.h" - #include "ArduinoJson.h" - #include "hasp_debug.h" // for TAG_CONF +#include "hasp_conf.h" +#include "ArduinoJson.h" +#include "hasp_debug.h" // for TAG_CONF /* ===== Default Event Processors ===== */ void configSetup(void); @@ -19,17 +19,17 @@ void configStop(void); /* ===== Special Event Processors ===== */ void configWrite(void); -void configOutput(const JsonObject & settings, uint8_t tag = TAG_CONF); +void configOutput(const JsonObject& settings, uint8_t tag = TAG_CONF); bool configClearEeprom(void); /* ===== Getter and Setter Functions ===== */ -bool configSet(int8_t & value, const JsonVariant & setting, const __FlashStringHelper * fstr_name); -bool configSet(uint8_t & value, const JsonVariant & setting, const __FlashStringHelper * fstr_name); -bool configSet(uint16_t & value, const JsonVariant & setting, const __FlashStringHelper * fstr_name); +bool configSet(int8_t& value, const JsonVariant& setting, const __FlashStringHelper* fstr_name); +bool configSet(uint8_t& value, const JsonVariant& setting, const __FlashStringHelper* fstr_name); +bool configSet(uint16_t& value, const JsonVariant& setting, const __FlashStringHelper* fstr_name); /* ===== Read/Write Configuration ===== */ -void configSetConfig(JsonObject & settings); -void configGetConfig(JsonDocument & settings); +void configSetConfig(JsonObject& settings); +void configGetConfig(JsonDocument& settings); /* json keys used in the configfile */ const char FP_CONFIG_STARTPAGE[] PROGMEM = "startpage"; @@ -71,6 +71,6 @@ const char FP_HASP[] PROGMEM = "hasp"; const char FP_GUI[] PROGMEM = "gui"; const char FP_DEBUG[] PROGMEM = "debug"; - #endif +#endif #endif // HASP_USE_CONFIG \ No newline at end of file diff --git a/src/hasp_debug.h b/src/hasp_debug.h index 22bd138f..97bff5a0 100644 --- a/src/hasp_debug.h +++ b/src/hasp_debug.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_DEBUG_H diff --git a/src/hasp_eeprom.cpp b/src/hasp_eeprom.cpp index 80a1a27d..fdb02824 100644 --- a/src/hasp_eeprom.cpp +++ b/src/hasp_eeprom.cpp @@ -1,20 +1,20 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" // load first #if HASP_USE_EEPROM > 0 - #ifdef ARDUINO - #include "Arduino.h" - #endif +#ifdef ARDUINO +#include "Arduino.h" +#endif - #include "EEPROM.h" +#include "EEPROM.h" void eepromSetup() { - #if defined(STM32Fxx) +#if defined(STM32Fxx) eeprom_buffer_fill(); char buffer[] = "{\"objid\":10,\"id\":1,\"page\":0,\"x\":10,\"y\":45,\"w\":220,\"h\":55,\"toggle\":\"TRUE\"," "\"txt\":\"Toggle Me\"}"; @@ -22,8 +22,8 @@ void eepromSetup() uint16_t i; for(i = 0; i < size; i++) eeprom_buffered_write_byte(i + 4096, buffer[i]); eeprom_buffered_write_byte(i + 4096, 0); - // eeprom_buffer_flush(); - #endif + // eeprom_buffer_flush(); +#endif // ESP8266 // Don't start at boot, only at write // EEPROM.begin(1024); diff --git a/src/hasp_eeprom.h b/src/hasp_eeprom.h index c2d83d22..db8d40bd 100644 --- a/src/hasp_eeprom.h +++ b/src/hasp_eeprom.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_EEPROM_H @@ -8,7 +8,7 @@ void eepromSetup(void); void eepromLoop(void); -void eepromWrite(uint16_t addr, std::string & data); +void eepromWrite(uint16_t addr, std::string& data); std::string eepromRead(uint16_t addr); #endif \ No newline at end of file diff --git a/src/hasp_filesystem.cpp b/src/hasp_filesystem.cpp index c8d915f8..6a014e7d 100644 --- a/src/hasp_filesystem.cpp +++ b/src/hasp_filesystem.cpp @@ -1,20 +1,20 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" // include first #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 - #include - #include "ArduinoJson.h" - #include "ArduinoLog.h" +#include +#include "ArduinoJson.h" +#include "ArduinoLog.h" - #include "hasp_debug.h" - #include "hasp_filesystem.h" +#include "hasp_debug.h" +#include "hasp_filesystem.h" void filesystemInfo() { // Get all information of your SPIFFS - #if 0 +#if 0 FSInfo fs_info; SPIFFS.info(fs_info); @@ -64,38 +64,38 @@ void filesystemInfo() Serial.print("Max path lenght: "); // Serial.println(SPIFFS.maxPathLength()); - #endif +#endif } void filesystemList() { - #if HASP_USE_SPIFFS > 0 - #if defined(ARDUINO_ARCH_ESP8266) +#if HASP_USE_SPIFFS > 0 +#if defined(ARDUINO_ARCH_ESP8266) if(!SPIFFS.begin()) { - #else +#else if(!SPIFFS.begin(true)) { - #endif +#endif LOG_ERROR(TAG_FILE, F("Flash file system not mouted.")); } else { LOG_VERBOSE(TAG_FILE, F("Listing files on the internal flash:")); - #if defined(ARDUINO_ARCH_ESP32) +#if defined(ARDUINO_ARCH_ESP32) File root = SPIFFS.open("/"); File file = root.openNextFile(); while(file) { LOG_VERBOSE(TAG_FILE, F(" * %s (%u bytes)"), file.name(), (uint32_t)file.size()); file = root.openNextFile(); } - #endif - #if defined(ARDUINO_ARCH_ESP8266) +#endif +#if defined(ARDUINO_ARCH_ESP8266) Dir dir = SPIFFS.openDir("/"); while(dir.next()) { LOG_VERBOSE(TAG_FILE, F(" * %s (%u bytes)"), dir.fileName().c_str(), (uint32_t)dir.fileSize()); } - #endif +#endif } - #endif +#endif } bool filesystemSetup(void) @@ -106,19 +106,19 @@ bool filesystemSetup(void) // Logging is defered until debugging has started // FS success or failure is printed at that time ! - #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 - #if defined(ARDUINO_ARCH_ESP8266) +#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 +#if defined(ARDUINO_ARCH_ESP8266) if(!HASP_FS.begin()) { - #else +#else if(!HASP_FS.begin(true)) { - #endif +#endif // LOG_ERROR(TAG_FILE, F("SPI flash init failed. Unable to mount FS.")); return false; } else { // LOG_INFO(TAG_FILE, F("SPI Flash FS mounted")); return true; } - #endif +#endif return false; } diff --git a/src/hasp_filesystem.h b/src/hasp_filesystem.h index ed3b773b..bda556ed 100644 --- a/src/hasp_filesystem.h +++ b/src/hasp_filesystem.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_FILESYSTEM_H @@ -12,22 +12,22 @@ void filesystemList(); void filesystemInfo(); #if defined(ARDUINO_ARCH_ESP32) - #if HASP_USE_SPIFFS > 0 - #include "SPIFFS.h" - #define HASP_FS SPIFFS - #elif HASP_USE_LITTLEFS > 0 - #include "LITTLEFS.h" - #define HASP_FS LITTLEFS - #endif +#if HASP_USE_SPIFFS > 0 +#include "SPIFFS.h" +#define HASP_FS SPIFFS +#elif HASP_USE_LITTLEFS > 0 +#include "LITTLEFS.h" +#define HASP_FS LITTLEFS +#endif #elif defined(ARDUINO_ARCH_ESP8266) - // included by default - #include - #define HASP_FS LittleFS +// included by default +#include +#define HASP_FS LittleFS #endif // ARDUINO_ARCH #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) - #include - #include +#include +#include #endif // ARDUINO_ARCH #endif // HASP_FILESYSTEM_H \ No newline at end of file diff --git a/src/hasp_gui.cpp b/src/hasp_gui.cpp index 7063d104..de4e2ece 100644 --- a/src/hasp_gui.cpp +++ b/src/hasp_gui.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" diff --git a/src/hasp_gui.h b/src/hasp_gui.h index 46722dae..3e33d068 100644 --- a/src/hasp_gui.h +++ b/src/hasp_gui.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_GUI_H diff --git a/src/hasp_oobe.cpp b/src/hasp_oobe.cpp index b3748dea..74481ba0 100644 --- a/src/hasp_oobe.cpp +++ b/src/hasp_oobe.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if HASP_USE_CONFIG > 0 diff --git a/src/hasp_oobe.h b/src/hasp_oobe.h index 8e3e7f4b..a2ed71d4 100644 --- a/src/hasp_oobe.h +++ b/src/hasp_oobe.h @@ -1,10 +1,10 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if HASP_USE_CONFIG > 0 void oobeSetAutoCalibrate(bool cal); bool oobeSetup(); -void oobeFakeSetup(const char *, const char *); // for testing purposes only +void oobeFakeSetup(const char*, const char*); // for testing purposes only #endif // HASP_USE_CONFIG diff --git a/src/log/hasp_debug.cpp b/src/log/hasp_debug.cpp index c36ba4f5..d58726bc 100644 --- a/src/log/hasp_debug.cpp +++ b/src/log/hasp_debug.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ /* =========================================================================== diff --git a/src/main_arduino copy.cpp b/src/main_arduino copy.cpp index 6d14b297..9f93e141 100644 --- a/src/main_arduino copy.cpp +++ b/src/main_arduino copy.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if 0 && ARDUINO diff --git a/src/main_arduino.cpp b/src/main_arduino.cpp index 41920295..3b014ace 100644 --- a/src/main_arduino.cpp +++ b/src/main_arduino.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef WINDOWS diff --git a/src/main_windows.cpp b/src/main_windows.cpp index 8e409690..8ccf9171 100644 --- a/src/main_windows.cpp +++ b/src/main_windows.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifdef WINDOWS diff --git a/src/mqtt/hasp_mqtt.h b/src/mqtt/hasp_mqtt.h index b10d9e4d..8e47773c 100644 --- a/src/mqtt/hasp_mqtt.h +++ b/src/mqtt/hasp_mqtt.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_MQTT_H diff --git a/src/mqtt/hasp_mqtt_ha.cpp b/src/mqtt/hasp_mqtt_ha.cpp index ddb4ae6c..3eeebcbb 100644 --- a/src/mqtt/hasp_mqtt_ha.cpp +++ b/src/mqtt/hasp_mqtt_ha.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "ArduinoJson.h" diff --git a/src/mqtt/hasp_mqtt_ha.h b/src/mqtt/hasp_mqtt_ha.h index 5580f79e..9d84db6f 100644 --- a/src/mqtt/hasp_mqtt_ha.h +++ b/src/mqtt/hasp_mqtt_ha.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_MQTT_HA_H diff --git a/src/mqtt/hasp_mqtt_paho_async.cpp b/src/mqtt/hasp_mqtt_paho_async.cpp index b0930d33..d8b94f2b 100644 --- a/src/mqtt/hasp_mqtt_paho_async.cpp +++ b/src/mqtt/hasp_mqtt_paho_async.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ /* Multi threaded asynchronous paho client */ diff --git a/src/mqtt/hasp_mqtt_paho_single.cpp b/src/mqtt/hasp_mqtt_paho_single.cpp index d355d641..bcdbdcb0 100644 --- a/src/mqtt/hasp_mqtt_paho_single.cpp +++ b/src/mqtt/hasp_mqtt_paho_single.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ /* Single threaded synchronous paho client */ diff --git a/src/mqtt/hasp_mqtt_pubsubclient.cpp b/src/mqtt/hasp_mqtt_pubsubclient.cpp index f77db9ac..73afab25 100644 --- a/src/mqtt/hasp_mqtt_pubsubclient.cpp +++ b/src/mqtt/hasp_mqtt_pubsubclient.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" diff --git a/src/sys/gpio/hasp_gpio.cpp b/src/sys/gpio/hasp_gpio.cpp index 91f519cd..f2963f1c 100644 --- a/src/sys/gpio/hasp_gpio.cpp +++ b/src/sys/gpio/hasp_gpio.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "AceButton.h" @@ -12,13 +12,13 @@ #include "hasp/hasp.h" #ifdef ARDUINO_ARCH_ESP8266 - #define INPUT_PULLDOWN INPUT +#define INPUT_PULLDOWN INPUT #endif uint8_t gpioUsedInputCount = 0; using namespace ace_button; -static AceButton * button[HASP_NUM_INPUTS]; +static AceButton* button[HASP_NUM_INPUTS]; // An array of button pins, led pins, and the led states. Cannot be const // because ledState is mutable. @@ -49,7 +49,7 @@ class TouchConfig : public ButtonConfig { TouchConfig touchConfig(); #endif -static void gpio_event_handler(AceButton * button, uint8_t eventType, uint8_t buttonState) +static void gpio_event_handler(AceButton* button, uint8_t eventType, uint8_t buttonState) { uint8_t btnid = button->getId(); uint8_t eventid; @@ -95,7 +95,7 @@ static void gpio_event_handler(AceButton * button, uint8_t eventType, uint8_t bu void aceButtonSetup(void) { - ButtonConfig * buttonConfig = ButtonConfig::getSystemButtonConfig(); + ButtonConfig* buttonConfig = ButtonConfig::getSystemButtonConfig(); buttonConfig->setEventHandler(gpio_event_handler); // Features @@ -128,14 +128,14 @@ void gpioAddButton(uint8_t pin, uint8_t input_mode, uint8_t default_state, uint8 if(!button[i]) { LOG_TRACE(TAG_GPIO, F("Creating Button%d on pin %d (index %d) mode %d default %d"), i, pin, index, - input_mode, default_state); + input_mode, default_state); button[i] = new AceButton(pin, default_state, index); if(button[i]) { // pinMode(pin, input_mode); - ButtonConfig * buttonConfig = button[i]->getButtonConfig(); + ButtonConfig* buttonConfig = button[i]->getButtonConfig(); buttonConfig->setEventHandler(gpio_event_handler); buttonConfig->setFeature(ButtonConfig::kFeatureClick); buttonConfig->clearFeature(ButtonConfig::kFeatureDoubleClick); @@ -146,7 +146,7 @@ void gpioAddButton(uint8_t pin, uint8_t input_mode, uint8_t default_state, uint8 buttonConfig->setFeature(ButtonConfig::kFeatureSuppressAfterClick); LOG_INFO(TAG_GPIO, F("Button%d created on pin %d (index %d) mode %d default %d"), i, pin, index, - input_mode, default_state); + input_mode, default_state); gpioUsedInputCount = i + 1; return; } @@ -163,19 +163,19 @@ void gpioAddSwitch(uint8_t pin, uint8_t input_mode, uint8_t default_state, uint8 if(!button[i]) { LOG_TRACE(TAG_GPIO, F("Creating Switch%d on pin %d (index %d) mode %d default %d"), i, pin, index, - input_mode, default_state); + input_mode, default_state); button[i] = new AceButton(pin, default_state, index); if(button[i]) { // pinMode(pin, input_mode); - ButtonConfig * buttonConfig = button[i]->getButtonConfig(); + ButtonConfig* buttonConfig = button[i]->getButtonConfig(); buttonConfig->setEventHandler(gpio_event_handler); buttonConfig->setFeature(ButtonConfig::kFeatureSuppressAll); LOG_INFO(TAG_GPIO, F("Button%d switch on pin %d (index %d) mode %d default %d"), i, pin, index, - input_mode, default_state); + input_mode, default_state); gpioUsedInputCount = i + 1; return; } @@ -196,7 +196,7 @@ void gpioAddTouchButton(uint8_t pin, uint8_t input_mode, uint8_t default_state, if(button[i]) { pinMode(pin, input_mode); - ButtonConfig * buttonConfig = button[i]->getButtonConfig(); + ButtonConfig* buttonConfig = button[i]->getButtonConfig(); buttonConfig->setEventHandler(gpio_event_handler); buttonConfig->setFeature(ButtonConfig::kFeatureClick); buttonConfig->clearFeature(ButtonConfig::kFeatureDoubleClick); @@ -206,7 +206,7 @@ void gpioAddTouchButton(uint8_t pin, uint8_t input_mode, uint8_t default_state, ButtonConfig::kFeatureSuppressClickBeforeDoubleClick); // Causes annoying pauses LOG_INFO(TAG_GPIO, F("Button%d created on pin %d (index %d) mode %d default %d"), i, pin, index, - input_mode, default_state); + input_mode, default_state); gpioUsedInputCount = i + 1; return; } @@ -472,9 +472,9 @@ bool gpioIsSystemPin(uint8_t gpio) #ifdef ARDUINO_ARCH_ESP8266 if((gpio >= 6) && (gpio <= 11)) return true; // integrated SPI flash - #ifndef TFT_SPI_OVERLAP +#ifndef TFT_SPI_OVERLAP if((gpio >= 12) && (gpio <= 14)) return true; // HSPI - #endif +#endif #endif return false; @@ -505,7 +505,7 @@ bool gpioSavePinConfig(uint8_t config_num, uint8_t pin, uint8_t type, uint8_t gr gpioConfig[config_num].group = group; gpioConfig[config_num].gpio_function = pinfunc; LOG_TRACE(TAG_GPIO, F("Saving Pin config #%d pin %d - type %d - group %d - func %d"), config_num, pin, type, - group, pinfunc); + group, pinfunc); return true; } @@ -535,7 +535,7 @@ hasp_gpio_config_t gpioGetPinConfig(uint8_t num) //////////////////////////////////////////////////////////////////////////////////////////////////// #if HASP_USE_CONFIG > 0 -bool gpioGetConfig(const JsonObject & settings) +bool gpioGetConfig(const JsonObject& settings) { bool changed = false; @@ -579,7 +579,7 @@ bool gpioGetConfig(const JsonObject & settings) * * @param[in] settings JsonObject with the config settings. **/ -bool gpioSetConfig(const JsonObject & settings) +bool gpioSetConfig(const JsonObject& settings) { configOutput(settings); bool changed = false; diff --git a/src/sys/gpio/hasp_gpio.h b/src/sys/gpio/hasp_gpio.h index 1ff8507c..1419e1b5 100644 --- a/src/sys/gpio/hasp_gpio.h +++ b/src/sys/gpio/hasp_gpio.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_GPIO_H @@ -36,8 +36,8 @@ int8_t gpioGetFreeConfigId(); hasp_gpio_config_t gpioGetPinConfig(uint8_t num); #if HASP_USE_CONFIG > 0 -bool gpioGetConfig(const JsonObject & settings); -bool gpioSetConfig(const JsonObject & settings); +bool gpioGetConfig(const JsonObject& settings); +bool gpioSetConfig(const JsonObject& settings); #endif #define HASP_GPIO_FREE 0x00 diff --git a/src/sys/net/hasp_ethernet_esp32.cpp b/src/sys/net/hasp_ethernet_esp32.cpp index 270c44ba..6b78e836 100644 --- a/src/sys/net/hasp_ethernet_esp32.cpp +++ b/src/sys/net/hasp_ethernet_esp32.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" diff --git a/src/sys/net/hasp_ethernet_esp32.h b/src/sys/net/hasp_ethernet_esp32.h index 5e824a34..3eb24e4e 100644 --- a/src/sys/net/hasp_ethernet_esp32.h +++ b/src/sys/net/hasp_ethernet_esp32.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_ETHERNET_ESP32_H @@ -10,6 +10,6 @@ void ethernetSetup(); void ethernetLoop(void); bool ethernetEvery5Seconds(); -void ethernet_get_statusupdate(char * buffer, size_t len); +void ethernet_get_statusupdate(char* buffer, size_t len); #endif \ No newline at end of file diff --git a/src/sys/net/hasp_ethernet_stm32.cpp b/src/sys/net/hasp_ethernet_stm32.cpp index 32bdebe7..8741a89c 100644 --- a/src/sys/net/hasp_ethernet_stm32.cpp +++ b/src/sys/net/hasp_ethernet_stm32.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" @@ -13,9 +13,9 @@ IPAddress ip; void ethernetSetup() { - #if USE_BUILTIN_ETHERNET > 0 +#if USE_BUILTIN_ETHERNET > 0 // start Ethernet and UDP - LOG_TRACE(TAG_ETH, F("LAN8720 "D_SERVICE_STARTING)); + LOG_TRACE(TAG_ETH, F("LAN8720 " D_SERVICE_STARTING)); if(Ethernet.begin() == 0) { LOG_TRACE(TAG_ETH, F("Failed to configure Ethernet using DHCP")); eth_connected = false; @@ -27,7 +27,7 @@ void ethernetSetup() LOG_TRACE(TAG_ETH, F("MAC Address %s"), halGetMacAddress(0, ":")); - #else +#else byte mac[6]; uint32_t baseUID = (uint32_t)UID_BASE; mac[0] = 0x00; @@ -44,14 +44,14 @@ void ethernetSetup() Ethernet.setCsPin(W5500_CS); Ethernet.setRstPin(W5500_RST); Ethernet.setHostname(ethHostname); - LOG_TRACE(TAG_ETH, F("W5500 "D_SERVICE_STARTING)); + LOG_TRACE(TAG_ETH, F("W5500 " D_SERVICE_STARTING)); if(Ethernet.begin(mac) == 0) { LOG_TRACE(TAG_ETH, F("Failed to configure Ethernet using DHCP")); } else { ip = Ethernet.localIP(); LOG_TRACE(TAG_ETH, F("DHCP Success got IP %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]); } - #endif +#endif } void ethernetLoop(void) @@ -88,22 +88,22 @@ void ethernetLoop(void) bool ethernetEvery5Seconds() { bool state; - #if USE_BUILTIN_ETHERNET > 0 +#if USE_BUILTIN_ETHERNET > 0 state = Ethernet.linkStatus() == LinkON; - #else +#else state = Ethernet.link() == 1; - #endif +#endif LOG_WARNING(TAG_ETH, state ? F(D_NETWORK_ONLINE) : F(D_NETWORK_OFFLINE)); return state; } -void ethernet_get_statusupdate(char * buffer, size_t len) +void ethernet_get_statusupdate(char* buffer, size_t len) { - #if USE_BUILTIN_ETHERNET > 0 +#if USE_BUILTIN_ETHERNET > 0 bool state = Ethernet.linkStatus() == LinkON; - #else +#else bool state = Ethernet.link() == 1; - #endif +#endif IPAddress ip = Ethernet.localIP(); snprintf_P(buffer, len, PSTR("\"eth\":\"%s\",\"link\":%d,\"ip\":\"%d.%d.%d.%d\","), state ? F("ON") : F("OFF"), 10, diff --git a/src/sys/net/hasp_ethernet_stm32.h b/src/sys/net/hasp_ethernet_stm32.h index 04ddec72..ed3a76c1 100644 --- a/src/sys/net/hasp_ethernet_stm32.h +++ b/src/sys/net/hasp_ethernet_stm32.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_ETHERNET_STM32_H @@ -10,6 +10,6 @@ void ethernetSetup(); void ethernetLoop(void); bool ethernetEvery5Seconds(); -void ethernet_get_statusupdate(char * buffer, size_t len); +void ethernet_get_statusupdate(char* buffer, size_t len); #endif \ No newline at end of file diff --git a/src/sys/net/hasp_network.cpp b/src/sys/net/hasp_network.cpp index 467b6330..2545d5f8 100644 --- a/src/sys/net/hasp_network.cpp +++ b/src/sys/net/hasp_network.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include diff --git a/src/sys/net/hasp_network.h b/src/sys/net/hasp_network.h index facd76e7..094d96ad 100644 --- a/src/sys/net/hasp_network.h +++ b/src/sys/net/hasp_network.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_NETWORK_H @@ -15,7 +15,7 @@ void networkStop(void); /* ===== Special Event Processors ===== */ /* ===== Getter and Setter Functions ===== */ -void network_get_statusupdate(char * buffer, size_t len); +void network_get_statusupdate(char* buffer, size_t len); /* ===== Read/Write Configuration ===== */ diff --git a/src/sys/net/hasp_wifi.cpp b/src/sys/net/hasp_wifi.cpp index 0e6c40e5..c2fa9170 100644 --- a/src/sys/net/hasp_wifi.cpp +++ b/src/sys/net/hasp_wifi.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include diff --git a/src/sys/net/hasp_wifi.h b/src/sys/net/hasp_wifi.h index 5364150f..9854d449 100644 --- a/src/sys/net/hasp_wifi.h +++ b/src/sys/net/hasp_wifi.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_WIFI_H @@ -8,16 +8,16 @@ void wifiSetup(); bool wifiShowAP(); -bool wifiShowAP(char * ssid, char * pass); +bool wifiShowAP(char* ssid, char* pass); bool wifiEvery5Seconds(void); void wifiStop(void); -bool wifiValidateSsid(const char * ssid, const char * pass); -void wifi_get_statusupdate(char * buffer, size_t len); +bool wifiValidateSsid(const char* ssid, const char* pass); +void wifi_get_statusupdate(char* buffer, size_t len); #if HASP_USE_CONFIG > 0 -bool wifiGetConfig(const JsonObject & settings); -bool wifiSetConfig(const JsonObject & settings); +bool wifiGetConfig(const JsonObject& settings); +bool wifiSetConfig(const JsonObject& settings); #endif #endif \ No newline at end of file diff --git a/src/sys/svc/hasp_http.cpp b/src/sys/svc/hasp_http.cpp index 95232d91..dd7b0637 100644 --- a/src/sys/svc/hasp_http.cpp +++ b/src/sys/svc/hasp_http.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ //#include "webServer.h" diff --git a/src/sys/svc/hasp_http.h b/src/sys/svc/hasp_http.h index 34e2bd1d..51313c6d 100644 --- a/src/sys/svc/hasp_http.h +++ b/src/sys/svc/hasp_http.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_HTTP_H @@ -22,11 +22,11 @@ void httpEvery5Seconds(void); void httpStart(void); void httpStop(void); -size_t httpClientWrite(const uint8_t * buf, size_t size); // Screenshot Write Data +size_t httpClientWrite(const uint8_t* buf, size_t size); // Screenshot Write Data #if HASP_USE_CONFIG > 0 -bool httpGetConfig(const JsonObject & settings); -bool httpSetConfig(const JsonObject & settings); +bool httpGetConfig(const JsonObject& settings); +bool httpSetConfig(const JsonObject& settings); #endif // HASP_USE_CONFIG #endif \ No newline at end of file diff --git a/src/sys/svc/hasp_mdns.cpp b/src/sys/svc/hasp_mdns.cpp index 1c6c127e..822c7970 100644 --- a/src/sys/svc/hasp_mdns.cpp +++ b/src/sys/svc/hasp_mdns.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" diff --git a/src/sys/svc/hasp_mdns.h b/src/sys/svc/hasp_mdns.h index 9886b823..2700595b 100644 --- a/src/sys/svc/hasp_mdns.h +++ b/src/sys/svc/hasp_mdns.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_MDNS_H @@ -8,7 +8,7 @@ struct hasp_mdns_config_t { - uint8_t enable = true; + uint8_t enable = true; }; /* ===== Default Event Processors ===== */ @@ -19,8 +19,8 @@ void mdnsStop(void); /* ===== Read/Write Configuration ===== */ #if HASP_USE_CONFIG > 0 -bool mdnsGetConfig(const JsonObject & settings); -bool mdnsSetConfig(const JsonObject & settings); +bool mdnsGetConfig(const JsonObject& settings); +bool mdnsSetConfig(const JsonObject& settings); #endif #endif \ No newline at end of file diff --git a/src/sys/svc/hasp_ota.cpp b/src/sys/svc/hasp_ota.cpp index ba643b60..9e82b11e 100644 --- a/src/sys/svc/hasp_ota.cpp +++ b/src/sys/svc/hasp_ota.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) diff --git a/src/sys/svc/hasp_ota.h b/src/sys/svc/hasp_ota.h index 9d023c1f..215cd73a 100644 --- a/src/sys/svc/hasp_ota.h +++ b/src/sys/svc/hasp_ota.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) @@ -14,7 +14,7 @@ void otaLoop(void); void otaEverySecond(void); /* ===== Special Event Processors ===== */ -void otaHttpUpdate(const char * espOtaUrl); +void otaHttpUpdate(const char* espOtaUrl); #endif #endif \ No newline at end of file diff --git a/src/sys/svc/hasp_slave.cpp b/src/sys/svc/hasp_slave.cpp index 840269b2..a3739845 100644 --- a/src/sys/svc/hasp_slave.cpp +++ b/src/sys/svc/hasp_slave.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" @@ -25,7 +25,7 @@ unsigned long updatLedPeriod = 1000; // timer in msec for tele mqtt send bool ledstate = false; -void slave_send_state(const __FlashStringHelper * subtopic, const char * payload) +void slave_send_state(const __FlashStringHelper* subtopic, const char* payload) { // page = 0 // p[0].b[0].attr = abc @@ -37,32 +37,32 @@ void slave_send_state(const __FlashStringHelper * subtopic, const char * payload char cBuffer[strlen(payload) + 64]; memset(cBuffer, 0, sizeof(cBuffer)); snprintf_P(cBuffer, sizeof(cBuffer), PSTR("publish %sstate/%s %s"), slaveNodeTopic, subtopic, payload); - slave.ExecuteCommand((char *)cBuffer); + slave.ExecuteCommand((char*)cBuffer); // Log after char buffers are cleared LOG_TRACE(TAG_TASM, F("TAS PUB: %sstate/%S = %s"), slaveNodeTopic, subtopic, payload); } -void slave_send_obj_attribute_str(uint8_t pageid, uint8_t btnid, const char * attribute, const char * data) +void slave_send_obj_attribute_str(uint8_t pageid, uint8_t btnid, const char* attribute, const char* data) { char cBuffer[192]; memset(cBuffer, 0, sizeof(cBuffer)); snprintf_P(cBuffer, sizeof(cBuffer), PSTR("publish %sstate/json {\"p[%u].b[%u].%s\":\"%s\"}"), slaveNodeTopic, pageid, btnid, attribute, data); - slave.ExecuteCommand((char *)cBuffer); + slave.ExecuteCommand((char*)cBuffer); // Log after char buffers are cleared LOG_TRACE(TAG_TASM, F("TAS PUB: %sstate/json = {\"p[%u].b[%u].%s\":\"%s\"}"), slaveNodeTopic, pageid, btnid, attribute, data); } -void slave_send_input(uint8_t id, const char * payload) +void slave_send_input(uint8_t id, const char* payload) { // LOG_VERBOSE(TAG_TASM,F("MQTT TST: %sstate/input%u = %s"), mqttNodeTopic, id, payload); // to be removed char cBuffer[strlen(payload) + 64]; memset(cBuffer, 0, sizeof(cBuffer)); snprintf_P(cBuffer, sizeof(cBuffer), PSTR("publish %sstate/input%u %s"), slaveNodeTopic, id, payload); - slave.ExecuteCommand((char *)cBuffer); + slave.ExecuteCommand((char*)cBuffer); // Log after char buffers are cleared LOG_TRACE(TAG_TASM, F("TAS PUB: %sstate/input%u = %s"), slaveNodeTopic, id, payload); @@ -85,12 +85,12 @@ void TASMO_TELE_JSON() halDisplayDriverName().c_str(), (TFT_WIDTH), (TFT_HEIGHT)); strcat(data, buffer); } - slave.sendJSON((char *)data); + slave.sendJSON((char*)data); // slave_send_state(F("statusupdate"), data); // debugLastMillis = millis(); } -void TASMO_DATA_RECEIVE(char * data) +void TASMO_DATA_RECEIVE(char* data) { LOG_INFO(TAG_TASM, F("Slave IN [%s]"), data); diff --git a/src/sys/svc/hasp_slave.h b/src/sys/svc/hasp_slave.h index 9271732a..0fe530c7 100644 --- a/src/sys/svc/hasp_slave.h +++ b/src/sys/svc/hasp_slave.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_TASMOTACLIENT_H @@ -9,10 +9,10 @@ #define HASP_TASMOTACLIENT_SPEED 57600 void TASMO_EVERY_SECOND(void); -void TASMO_DATA_RECEIVE(char * data); -void slave_send_state(const __FlashStringHelper * subtopic, const char * payload); -void slave_send_obj_attribute_str(uint8_t pageid, uint8_t btnid, const char * attribute, const char * data); -void slave_send_input(uint8_t id, const char * payload); +void TASMO_DATA_RECEIVE(char* data); +void slave_send_state(const __FlashStringHelper* subtopic, const char* payload); +void slave_send_obj_attribute_str(uint8_t pageid, uint8_t btnid, const char* attribute, const char* data); +void slave_send_input(uint8_t id, const char* payload); void slave_send_statusupdate(); void slaveSetup(); diff --git a/src/sys/svc/hasp_telnet.cpp b/src/sys/svc/hasp_telnet.cpp index 50697059..e760b7cf 100644 --- a/src/sys/svc/hasp_telnet.cpp +++ b/src/sys/svc/hasp_telnet.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #include "hasp_conf.h" diff --git a/src/sys/svc/hasp_telnet.h b/src/sys/svc/hasp_telnet.h index 98a958ee..314e678b 100644 --- a/src/sys/svc/hasp_telnet.h +++ b/src/sys/svc/hasp_telnet.h @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2020 Francis Van Roie +/* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ #ifndef HASP_TELNET_H @@ -23,8 +23,8 @@ void telnetStop(void); /* ===== Read/Write Configuration ===== */ #if HASP_USE_CONFIG > 0 -bool telnetSetConfig(const JsonObject & settings); -bool telnetGetConfig(const JsonObject & settings); +bool telnetSetConfig(const JsonObject& settings); +bool telnetGetConfig(const JsonObject& settings); #endif #define TELNET_UNAUTHENTICATED 0