diff --git a/LICENSE b/LICENSE index 39ed97df..71b929c8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,8 @@ MIT License -Copyright (c) 2020 Francis Van Roie francis@netwize.be -Copyright (c) 2019 Allen Derusha allen@derusha.org +Copyright (c) 2020 Francis Van Roie + +Based upon HASwitchPlate - Copyright (c) 2019 Allen Derusha allen@derusha.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/platformio_override-template.ini b/platformio_override-template.ini index 5c423482..f052d3a4 100644 --- a/platformio_override-template.ini +++ b/platformio_override-template.ini @@ -1,3 +1,6 @@ +; MIT License - Copyright (c) 2020 Francis Van Roie +; For full license information read the LICENSE file in the project folder +; ; Copy this file and rename it to platformio_override.ini ; ONLY edit platformio_override.ini to make local changes to the parameters ; diff --git a/src/hasp.cpp b/src/hasp.cpp index 2f779d1f..eeac56c7 100644 --- a/src/hasp.cpp +++ b/src/hasp.cpp @@ -1,6 +1,6 @@ -/********************* - * INCLUDES - *********************/ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "hasp_conf.h" #include #include "ArduinoLog.h" @@ -518,6 +518,9 @@ void haspSetPage(uint8_t pageid) Log.notice(TAG_HASP, F("Changing page to %u"), pageid); current_page = pageid; lv_scr_load(page); + + hasp_object_tree(page, pageid, 0); + //} } } diff --git a/src/hasp.h b/src/hasp.h index f3664535..603271a7 100644 --- a/src/hasp.h +++ b/src/hasp.h @@ -1,7 +1,5 @@ -/** - * @file hasp.h - * - */ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ #ifndef HASP_H #define HASP_H diff --git a/src/hasp_attribute.cpp b/src/hasp_attribute.cpp index 43c07c8a..a39650ec 100644 --- a/src/hasp_attribute.cpp +++ b/src/hasp_attribute.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "ArduinoJson.h" #include "ArduinoLog.h" diff --git a/src/hasp_attribute.h b/src/hasp_attribute.h index bce499b6..76275091 100644 --- a/src/hasp_attribute.h +++ b/src/hasp_attribute.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_ATTR_SET_H #define HASP_ATTR_SET_H diff --git a/src/hasp_config.cpp b/src/hasp_config.cpp index d5f915e3..7634f7d4 100644 --- a/src/hasp_config.cpp +++ b/src/hasp_config.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "Arduino.h" #include "ArduinoLog.h" #include "ArduinoJson.h" diff --git a/src/hasp_config.h b/src/hasp_config.h index 9924cc34..55c86d10 100644 --- a/src/hasp_config.h +++ b/src/hasp_config.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_CONFIG_H #define HASP_CONFIG_H diff --git a/src/hasp_debug.cpp b/src/hasp_debug.cpp index 8a52bd17..0bae2415 100644 --- a/src/hasp_debug.cpp +++ b/src/hasp_debug.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "ArduinoJson.h" #include "ArduinoLog.h" #include "lvgl.h" diff --git a/src/hasp_debug.h b/src/hasp_debug.h index ff2d473d..ae9d27cd 100644 --- a/src/hasp_debug.h +++ b/src/hasp_debug.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_DEBUG_H #define HASP_DEBUG_H diff --git a/src/hasp_dispatch.cpp b/src/hasp_dispatch.cpp index 386bf3d8..1877dd4a 100644 --- a/src/hasp_dispatch.cpp +++ b/src/hasp_dispatch.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "ArduinoJson.h" #include "ArduinoLog.h" #include "StringStream.h" diff --git a/src/hasp_dispatch.h b/src/hasp_dispatch.h index 4d355841..cbc6907b 100644 --- a/src/hasp_dispatch.h +++ b/src/hasp_dispatch.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_DISPATCH_H #define HASP_DISPATCH_H diff --git a/src/hasp_eeprom.cpp b/src/hasp_eeprom.cpp index d53963fe..7faa5527 100644 --- a/src/hasp_eeprom.cpp +++ b/src/hasp_eeprom.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include #include "EEPROM.h" diff --git a/src/hasp_eeprom.h b/src/hasp_eeprom.h index 74117671..c2d83d22 100644 --- a/src/hasp_eeprom.h +++ b/src/hasp_eeprom.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_EEPROM_H #define HASP_EEPROM_H diff --git a/src/hasp_ethernet.cpp b/src/hasp_ethernet.cpp index 548f5271..407e7a1b 100644 --- a/src/hasp_ethernet.cpp +++ b/src/hasp_ethernet.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include #include "ArduinoJson.h" #include "ArduinoLog.h" diff --git a/src/hasp_ethernet.h b/src/hasp_ethernet.h index 177f0908..a35bf4dc 100644 --- a/src/hasp_ethernet.h +++ b/src/hasp_ethernet.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_ETHERNET_H #define HASP_ETHERNET_H diff --git a/src/hasp_ethernet_esp32.cpp b/src/hasp_ethernet_esp32.cpp index 0f290561..033f9c82 100644 --- a/src/hasp_ethernet_esp32.cpp +++ b/src/hasp_ethernet_esp32.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include #include "ArduinoJson.h" #include "ArduinoLog.h" diff --git a/src/hasp_ethernet_esp32.h b/src/hasp_ethernet_esp32.h index becd6a60..352a67b1 100644 --- a/src/hasp_ethernet_esp32.h +++ b/src/hasp_ethernet_esp32.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_ETHERNET_ESP32_H #define HASP_ETHERNET_ESP32_H diff --git a/src/hasp_gpio.cpp b/src/hasp_gpio.cpp index 4163549f..4a11feb8 100644 --- a/src/hasp_gpio.cpp +++ b/src/hasp_gpio.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "Arduino.h" #include "ArduinoLog.h" diff --git a/src/hasp_gpio.h b/src/hasp_gpio.h index 6f529bb5..0362d82b 100644 --- a/src/hasp_gpio.h +++ b/src/hasp_gpio.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_GPIO_H #define HASP_GPIO_H diff --git a/src/hasp_gui.cpp b/src/hasp_gui.cpp index 2bf8a781..3650b471 100644 --- a/src/hasp_gui.cpp +++ b/src/hasp_gui.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "Ticker.h" #include "ArduinoLog.h" diff --git a/src/hasp_gui.h b/src/hasp_gui.h index e476862a..deea91e6 100644 --- a/src/hasp_gui.h +++ b/src/hasp_gui.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_GUI_H #define HASP_GUI_H diff --git a/src/hasp_http.cpp b/src/hasp_http.cpp index 9e505c49..ca9e3297 100644 --- a/src/hasp_http.cpp +++ b/src/hasp_http.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + //#include "webServer.h" #include "Arduino.h" #include "ArduinoJson.h" diff --git a/src/hasp_http.h b/src/hasp_http.h index 3caf1b7f..82d78fcc 100644 --- a/src/hasp_http.h +++ b/src/hasp_http.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_HTTP_H #define HASP_HTTP_H diff --git a/src/hasp_mdns.cpp b/src/hasp_mdns.cpp index 9f9c3d2e..f4977941 100644 --- a/src/hasp_mdns.cpp +++ b/src/hasp_mdns.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "ArduinoJson.h" #include "ArduinoLog.h" diff --git a/src/hasp_mdns.h b/src/hasp_mdns.h index 88d9414a..ad56e12b 100644 --- a/src/hasp_mdns.h +++ b/src/hasp_mdns.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_MDNS_H #define HASP_MDNS_H diff --git a/src/hasp_object.cpp b/src/hasp_object.cpp index a9ff430c..196dec89 100644 --- a/src/hasp_object.cpp +++ b/src/hasp_object.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + /* ******************************************************************************************** * * HASP Object Handlers @@ -156,6 +159,37 @@ bool check_obj_type(lv_obj_t * obj, lv_hasp_obj_type_t haspobjtype) return check_obj_type(objtype, haspobjtype); } +void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level) +{ + if(parent == nullptr) return; + + /* Output parent info */ + lv_obj_type_t list; + lv_obj_get_type(parent, &list); + const char * objtype = list.type[0]; + Log.verbose(TAG_HASP, F("[%d] p[%d].b[%d] %s"), level, pageid, parent->user_data, objtype); + + lv_obj_t * child; + child = lv_obj_get_child(parent, NULL); + while(child) { + /* child found, process it */ + if(child->user_data) hasp_object_tree(child, pageid, level + 1); + + /* try next sibling */ + child = lv_obj_get_child(parent, child); + } + + /* check tabs */ + if(check_obj_type(parent, LV_HASP_TABVIEW)) { + uint16_t tabcount = lv_tabview_get_tab_count(parent); + for(uint16_t i = 0; i < tabcount; i++) { + lv_obj_t * tab = lv_tabview_get_tab(child, i); + Log.verbose(TAG_HASP, "Found tab %i", i); + if(tab->user_data) hasp_object_tree(tab, pageid, level + 1); + } + } +} + // ##################### Value Dispatchers ######################################################## void hasp_send_obj_attribute_str(lv_obj_t * obj, const char * attribute, const char * data) diff --git a/src/hasp_object.h b/src/hasp_object.h index 909cd104..c6cfdf04 100644 --- a/src/hasp_object.h +++ b/src/hasp_object.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_OBJECT_H #define HASP_OBJECT_H @@ -52,6 +55,7 @@ lv_obj_t * hasp_find_obj_from_id(uint8_t pageid, uint8_t objid); bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, lv_obj_user_data_t * objid); bool check_obj_type(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_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); diff --git a/src/hasp_oobe.cpp b/src/hasp_oobe.cpp index e72615cd..115165b1 100644 --- a/src/hasp_oobe.cpp +++ b/src/hasp_oobe.cpp @@ -1,6 +1,6 @@ -/********************* - * INCLUDES - *********************/ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "hasp_conf.h" #include #include "ArduinoJson.h" diff --git a/src/hasp_oobe.h b/src/hasp_oobe.h index 9a8b3a9b..26d4b540 100644 --- a/src/hasp_oobe.h +++ b/src/hasp_oobe.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + void oobeSetAutoCalibrate(bool cal); bool oobeSetup(); void oobeFakeSetup(const char *); \ No newline at end of file diff --git a/src/hasp_ota.cpp b/src/hasp_ota.cpp index 1fb19942..42a763b4 100644 --- a/src/hasp_ota.cpp +++ b/src/hasp_ota.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) #include #include diff --git a/src/hasp_ota.h b/src/hasp_ota.h index e30d1a36..06229d3c 100644 --- a/src/hasp_ota.h +++ b/src/hasp_ota.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) #ifndef HASP_OTA_H diff --git a/src/hasp_slave.cpp b/src/hasp_slave.cpp index c13ec6bd..2feefc6a 100644 --- a/src/hasp_slave.cpp +++ b/src/hasp_slave.cpp @@ -1,6 +1,6 @@ -/********************* - * INCLUDES - *********************/ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #if HASP_USE_TASMOTA_SLAVE>0 #include "hasp_slave.h" diff --git a/src/hasp_slave.h b/src/hasp_slave.h index 772a471c..a0194a98 100644 --- a/src/hasp_slave.h +++ b/src/hasp_slave.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_SLAVE_H #define HASP_SLAVE_H diff --git a/src/hasp_telnet.cpp b/src/hasp_telnet.cpp index 1a454a5e..77b211a0 100644 --- a/src/hasp_telnet.cpp +++ b/src/hasp_telnet.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "hasp_conf.h" #if HASP_USE_TELNET > 0 diff --git a/src/hasp_telnet.h b/src/hasp_telnet.h index 7bf4fecc..835e573d 100644 --- a/src/hasp_telnet.h +++ b/src/hasp_telnet.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "hasp_conf.h" #ifndef HASP_TELNET_H diff --git a/src/hasp_tft.cpp b/src/hasp_tft.cpp index 88b404ee..aea8f5be 100644 --- a/src/hasp_tft.cpp +++ b/src/hasp_tft.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "ArduinoJson.h" #include "ArduinoLog.h" diff --git a/src/hasp_tft.h b/src/hasp_tft.h index ff31faa0..8ab5179e 100644 --- a/src/hasp_tft.h +++ b/src/hasp_tft.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_TFT_H #define HASP_TFT_H diff --git a/src/hasp_wifi.cpp b/src/hasp_wifi.cpp index fd67aed3..bde0c1e4 100644 --- a/src/hasp_wifi.cpp +++ b/src/hasp_wifi.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include #include "ArduinoJson.h" #include "ArduinoLog.h" diff --git a/src/hasp_wifi.h b/src/hasp_wifi.h index ea7b397c..a6f39386 100644 --- a/src/hasp_wifi.h +++ b/src/hasp_wifi.h @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #ifndef HASP_WIFI_H #define HASP_WIFI_H diff --git a/src/main.cpp b/src/main.cpp index 9185a1d0..4eabd644 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include "hasp_conf.h" // load first #include @@ -35,7 +38,7 @@ void setup() * Read & Apply User Configuration ***************************/ configSetup(); - + dispatchSetup(); /**************************** diff --git a/src/user_config_override-template.h b/src/user_config_override-template.h index 8a6b1b95..0a630cb2 100644 --- a/src/user_config_override-template.h +++ b/src/user_config_override-template.h @@ -1,9 +1,14 @@ +/* MIT License - Copyright (c) 2020 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + +/*************************************************** // This file contains the default settings that are // burned into the compiled firmware. // // These default settings can be changed at runtime // // To use: Save a copy as user_config_override.h +***************************************************/ #define SERIAL_SPEED 115200