diff --git a/include/hasp_conf.h b/include/hasp_conf.h
index 4c5a6fcf..605e715c 100644
--- a/include/hasp_conf.h
+++ b/include/hasp_conf.h
@@ -4,18 +4,18 @@
#define HASP_USE_APP 1
/* Network Services */
-#define HASP_HAS_NETWORK (ARDUINO_ARCH_ESP32 > 0 || ARDUINO_ARCH_ESP8266 > 0)
-
-#ifndef HASP_USE_OTA
-#define HASP_USE_OTA (HASP_HAS_NETWORK)
+#ifndef HASP_USE_ETHERNET
+#define HASP_USE_ETHERNET 0
#endif
#ifndef HASP_USE_WIFI
-#define HASP_USE_WIFI (HASP_HAS_NETWORK)
+#define HASP_USE_WIFI (ARDUINO_ARCH_ESP32 > 0 || ARDUINO_ARCH_ESP8266 > 0 || HASP_USE_WIFI > 0)
#endif
-#ifndef HASP_USE_ETHERNET
-#define HASP_USE_ETHERNET 0
+#define HASP_HAS_NETWORK (ARDUINO_ARCH_ESP32 > 0 || ARDUINO_ARCH_ESP8266 > 0 || HASP_USE_ETHERNET > 0 || HASP_USE_WIFI > 0)
+
+#ifndef HASP_USE_OTA
+#define HASP_USE_OTA (HASP_HAS_NETWORK)
#endif
#ifndef HASP_USE_MQTT
@@ -124,7 +124,7 @@
#endif
#if HASP_USE_WIFI > 0
-#include "hasp_wifi.h"
+#include "net/hasp_wifi.h"
#if defined(STM32F4xx)
#include "WiFiSpi.h"
@@ -144,7 +144,7 @@ static WiFiSpiClass WiFi;
#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_CLKMODE ETH_CLOCK_GPIO17_OUT
-#include "hasp_ethernet_esp32.h"
+#include "net/hasp_ethernet_esp32.h"
#warning Using ESP32 Ethernet LAN8720
#else
@@ -160,12 +160,12 @@ static WiFiSpiClass WiFi;
#include "Ethernet.h"
#warning Use W5x00 Ethernet shield
#endif
-#include "hasp_ethernet_stm32.h"
+#include "net/hasp_ethernet_stm32.h"
#endif
#endif
#if HASP_USE_MQTT > 0
-#include "hasp_mqtt.h"
+#include "svc/hasp_mqtt.h"
#endif
#if HASP_USE_GPIO > 0
@@ -173,23 +173,19 @@ static WiFiSpiClass WiFi;
#endif
#if HASP_USE_HTTP > 0
-#include "hasp_http.h"
+#include "svc/hasp_http.h"
#endif
#if HASP_USE_TELNET > 0
-#include "hasp_telnet.h"
+#include "svc/hasp_telnet.h"
#endif
#if HASP_USE_MDNS > 0
-#include "hasp_mdns.h"
-#endif
-
-#if HASP_USE_BUTTON > 0
-#include "hasp_button.h"
+#include "svc/hasp_mdns.h"
#endif
#if HASP_USE_OTA > 0
-#include "hasp_ota.h"
+#include "svc/hasp_ota.h"
#ifndef HASP_OTA_PORT
#if defined(ARDUINO_ARCH_ESP32)
#define HASP_OTA_PORT 3232
@@ -200,7 +196,7 @@ static WiFiSpiClass WiFi;
#endif
#if HASP_USE_TASMOTA_SLAVE > 0
-#include "hasp_slave.h"
+#include "svc/hasp_slave.h"
#endif
#ifndef FPSTR
diff --git a/lib/lv_drv_tft_espi/tft_espi_drv.cpp b/lib/lv_drv_tft_espi/tft_espi_drv.cpp
index fa33081a..bab85a9b 100644
--- a/lib/lv_drv_tft_espi/tft_espi_drv.cpp
+++ b/lib/lv_drv_tft_espi/tft_espi_drv.cpp
@@ -109,7 +109,7 @@ void tft_espi_calibrate(uint16_t * calData)
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
- tft.println(PSTR("Touch corners as indicated"));
+ // tft.println(PSTR("Touch corners as indicated"));
tft.setTextFont(1);
delay(500);
diff --git a/src/drv/hasp_drv_911.cpp b/src/drv/hasp_drv_911.cpp
new file mode 100644
index 00000000..6151da3c
--- /dev/null
+++ b/src/drv/hasp_drv_911.cpp
@@ -0,0 +1,108 @@
+#if TOUCH_DRIVER == 911
+
+ #include
+ #include "Goodix.h"
+ #include "ArduinoLog.h"
+
+ #include "hasp_drv_911.h"
+
+ #define INT_PIN (TOUCH_IRQ)
+ #define RST_PIN (TOUCH_RST) // -1 if pin is connected to VCC else set pin number
+
+static Goodix touch = Goodix();
+static int8_t GT911_num_touches;
+static GTPoint * GT911_points;
+
+// Store touch points into global variable
+void IRAM_ATTR GT911_setXY(int8_t contacts, GTPoint * points)
+{
+ GT911_num_touches = contacts;
+ GT911_points = points;
+
+ Log.verbose(TAG_GUI, "Contacts: %d", contacts);
+ for(int i = 0; i < contacts; i++) {
+ Log.verbose(TAG_GUI, "C%d: #%d %d,%d s:%d", i, points[i].trackId, points[i].x, points[i].y, points[i].area);
+ yield();
+ }
+}
+
+// Read touch points from global variable
+bool IRAM_ATTR GT911_getXY(uint16_t * touchX, uint16_t * touchY, bool debug)
+{
+ static GTPoint points[5];
+ int16_t contacts = touch.readInput((uint8_t *)&points);
+ if(contacts <= 0) return false;
+
+ if(debug) {
+ Serial.print(contacts);
+ Serial.print(" : ");
+ Serial.print(points[0].x);
+ Serial.print(" x ");
+ Serial.println(points[0].y);
+ }
+
+ *touchX = points[0].x;
+ *touchY = points[0].y;
+ return true;
+
+ // ALTERNATE REGISTER READ METHOD
+ // static uint8_t touchBuffer[6];
+
+ // uint16_t first = 0x814E; // 8150
+ // uint16_t last = 0x8153;
+ // uint16_t len = first - last + 1;
+ // uint8_t res = touch.read(first, touchBuffer, len);
+
+ // if(res != GOODIX_OK || touchBuffer[0] - 128 == 0) return false;
+
+ // *touchX = touchBuffer[2] + touchBuffer[3] * 256;
+ // *touchY = touchBuffer[4] + touchBuffer[5] * 256;
+
+ // if (debug) {
+ // Serial.print(touchBuffer[0] - 128);
+ // Serial.print(" : ");
+ // Serial.print(*touchX);
+ // Serial.print(" x ");
+ // Serial.println(*touchY);
+ // }
+ // return true;
+}
+
+static void touchStart()
+{
+ if(touch.begin(INT_PIN, RST_PIN) != true) {
+ Serial.println("! Module reset failed");
+ } else {
+ Serial.println("Module reset OK");
+ }
+
+ Serial.print("Check ACK on addr request on 0x");
+ Serial.print(touch.i2cAddr, HEX);
+
+ Wire.beginTransmission(touch.i2cAddr);
+ int error = Wire.endTransmission();
+ if(error == 0) {
+ Serial.println(": SUCCESS");
+ } else {
+ Serial.print(": ERROR #");
+ Serial.println(error);
+ }
+}
+
+void GT911_init()
+{
+ // Wire.setClock(400000);
+ // Wire.begin();
+ Wire.begin(TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_FREQUENCY);
+ delay(300);
+
+ touch.setHandler(GT911_setXY);
+ touchStart();
+ Log.trace(TAG_DRVR, F("Goodix GT911x touch driver started"));
+}
+
+void IRAM_ATTR GT911_loop()
+{
+ touch.loop();
+}
+#endif
\ No newline at end of file
diff --git a/src/drv/hasp_drv_911.h b/src/drv/hasp_drv_911.h
new file mode 100644
index 00000000..fd63b9eb
--- /dev/null
+++ b/src/drv/hasp_drv_911.h
@@ -0,0 +1,16 @@
+/* MIT License - Copyright (c) 2020 Francis Van Roie
+ For full license information read the LICENSE file in the project folder */
+
+#if TOUCH_DRIVER == 911
+
+ #include "hasp_debug.h" // for TAG_DRVR
+
+ #ifndef HASP_DRV_911_H
+ #define HASP_DRV_911_H
+
+bool IRAM_ATTR GT911_getXY(uint16_t * touchX, uint16_t * touchY, bool debug);
+void GT911_init();
+void IRAM_ATTR GT911_loop();
+
+ #endif
+#endif
\ No newline at end of file
diff --git a/src/drv/hasp_drv_display.cpp b/src/drv/hasp_drv_display.cpp
new file mode 100644
index 00000000..d1efa9e6
--- /dev/null
+++ b/src/drv/hasp_drv_display.cpp
@@ -0,0 +1,12 @@
+#include "hasp_drv_display.h"
+
+void drv_display_init(uint8_t rotation)
+{
+ /* TFT init */
+#if defined(USE_FSMC)
+ fsmc_ili9341_init(rotation);
+ // xpt2046_init(rotation);
+#else
+ tft_espi_init(rotation);
+#endif
+}
diff --git a/src/drv/hasp_drv_display.h b/src/drv/hasp_drv_display.h
new file mode 100644
index 00000000..27951e5e
--- /dev/null
+++ b/src/drv/hasp_drv_display.h
@@ -0,0 +1,16 @@
+/* MIT License - Copyright (c) 2020 Francis Van Roie
+ For full license information read the LICENSE file in the project folder */
+
+#ifndef HASP_DRV_DISPLAY_H
+#define HASP_DRV_DISPLAY_H
+
+// Select Display Driver
+#if defined(USE_FSMC)
+ #include "fsmc_ili9341.h"
+#else
+ #include "tft_espi_drv.h"
+#endif
+
+ void drv_display_init(uint8_t rotation);
+
+#endif
\ No newline at end of file
diff --git a/src/drv/hasp_drv_ft6336u.cpp b/src/drv/hasp_drv_ft6336u.cpp
new file mode 100644
index 00000000..14d94662
--- /dev/null
+++ b/src/drv/hasp_drv_ft6336u.cpp
@@ -0,0 +1,39 @@
+#if TOUCH_DRIVER == 6336
+
+ #include
+ #include "FT6336U.h"
+ #include "ArduinoLog.h"
+
+ #include "hasp_drv_ft6336u.h"
+
+ #define RST_PIN (TOUCH_RST) // -1 if pin is connected to VCC else set pin number
+
+static FT6336U ft6336u(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_IRQ);
+
+// Read touch points
+bool IRAM_ATTR FT6336U_getXY(uint16_t * touchX, uint16_t * touchY, bool debug)
+{
+ FT6336U_TouchPointType tp = ft6336u.scan();
+
+ if(debug) {
+ char tempString[128];
+ sprintf(tempString, "FT6336U TD Count %d / TD1 (%d, %4d, %4d) / TD2 (%d, %4d, %4d)\r", tp.touch_count,
+ tp.tp[0].status, tp.tp[0].x, tp.tp[0].y, tp.tp[1].status, tp.tp[1].x, tp.tp[1].y);
+ Serial.print(tempString);
+ }
+
+ if(tp.touch_count != 1) return false;
+
+ int i = tp.tp[0].status == TouchStatusEnum::touch ? 0 : 1;
+
+ *touchX = tp.tp[i].x;
+ *touchY = tp.tp[i].y;
+ return true;
+}
+
+void FT6336U_init()
+{
+ ft6336u.begin();
+ Log.trace(TAG_DRVR, F("FT6336U touch driver started"));
+}
+#endif
\ No newline at end of file
diff --git a/src/drv/hasp_drv_ft6336u.h b/src/drv/hasp_drv_ft6336u.h
new file mode 100644
index 00000000..896daec0
--- /dev/null
+++ b/src/drv/hasp_drv_ft6336u.h
@@ -0,0 +1,15 @@
+/* MIT License - Copyright (c) 2020 Francis Van Roie
+ For full license information read the LICENSE file in the project folder */
+
+#if TOUCH_DRIVER == 6336
+
+ #include "hasp_debug.h" // for TAG_DRVR
+
+ #ifndef HASP_DRV_FT6336U_H
+ #define HASP_DRV_FT6336U_H
+
+bool IRAM_ATTR FT6336U_getXY(uint16_t * touchX, uint16_t * touchY, bool debug);
+void FT6336U_init();
+
+ #endif
+#endif
\ No newline at end of file
diff --git a/src/drv/hasp_drv_touch.cpp b/src/drv/hasp_drv_touch.cpp
new file mode 100644
index 00000000..46dc942e
--- /dev/null
+++ b/src/drv/hasp_drv_touch.cpp
@@ -0,0 +1,100 @@
+#include "hasp_drv_touch.h"
+#include "lvgl.h"
+
+#if TOUCH_DRIVER == 2046
+ #if defined(USE_FSMC)
+ #else
+ #include "tft_espi_drv.h"
+ #endif
+
+#elif TOUCH_DRIVER == 2046
+ #include "indev/XPT2046.h"
+#elif TOUCH_DRIVER == 911
+ #include "hasp_drv_911.h"
+#elif TOUCH_DRIVER == 0xADC
+ #include "hasp_drv_ft6336u.h"
+#elif TOUCH_DRIVER == 6336
+ #include "hasp_drv_ft6336u.h"
+#else
+//#include "tp_i2c.h"
+//#include "ft6x36.h"
+#endif
+
+#include "../hasp/hasp_sleep.h"
+extern uint8_t sleep_state;
+
+void drv_touch_init(uint8_t rotation)
+{
+#if TOUCH_DRIVER == 2046 // XPT2046 Resistive touch panel driver
+ #if defined(USE_FSMC)
+ xpt2046_init(rotation);
+ #else
+ // The display driver takes care of all initializations
+ // tft_espi_init(rotation);
+ #endif
+
+#elif TOUCH_DRIVER == 911
+ GT911_init();
+
+#elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
+ // Touch_init();
+
+#elif TOUCH_DRIVER == 6336
+ FT6336U_init();
+
+#else
+ // xpt2046_alt_drv_read(indev_driver, data);
+ // xpt2046_read(indev_driver, data);
+ // if(data->state && guiSleeping != HASP_SLEEP_OFF) guiCheckSleep();
+#endif
+}
+
+static inline bool drv_touchpad_getXY(uint16_t * touchX, uint16_t * touchY)
+{
+#if TOUCH_DRIVER == 2046 // XPT2046 Resistive touch panel driver
+ return tft_espi_get_touch(touchX, touchY, 300);
+
+#elif TOUCH_DRIVER == 911
+ return GT911_getXY(touchX, touchY, true);
+
+#elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
+ return Touch_getXY(touchX, touchY, false);
+
+#elif TOUCH_DRIVER == 6336
+ return FT6336U_getXY(touchX, touchY, true);
+
+#else
+ // xpt2046_alt_drv_read(indev_driver, data);
+ // xpt2046_read(indev_driver, data);
+ // if(data->state && guiSleeping != HASP_SLEEP_OFF) guiCheckSleep();
+ return false;
+#endif
+}
+
+bool drv_touch_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
+{
+#ifdef TOUCH_CS
+ uint16_t touchX, touchY;
+ bool touched = drv_touchpad_getXY(&touchX, &touchY);
+ if(touched && sleep_state != HASP_SLEEP_OFF) sleep_check_state(); // update Idle
+
+ // Ignore first press?
+
+ /*Save the state and save the pressed coordinate for cursor position */
+ data->state = touched ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
+ if(touched) {
+ data->point.x = touchX;
+ data->point.y = touchY;
+ }
+#endif
+
+ /*Return `false` because we are not buffering and no more data to read*/
+ return false;
+}
+
+void IRAM_ATTR drv_touch_loop()
+{
+#if TOUCH_DRIVER == 911
+ GT911_loop();
+#endif
+}
\ No newline at end of file
diff --git a/src/drv/hasp_drv_touch.h b/src/drv/hasp_drv_touch.h
new file mode 100644
index 00000000..6273ef71
--- /dev/null
+++ b/src/drv/hasp_drv_touch.h
@@ -0,0 +1,17 @@
+/* MIT License - Copyright (c) 2020 Francis Van Roie
+ For full license information read the LICENSE file in the project folder */
+
+#ifndef HASP_DRV_TOUCH_H
+#define HASP_DRV_TOUCH_H
+
+#include "lvgl.h"
+
+#ifndef TOUCH_DRIVER
+ #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);
+void drv_touch_loop();
+
+#endif
\ No newline at end of file
diff --git a/src/hasp.cpp b/src/hasp/hasp.cpp
similarity index 99%
rename from src/hasp.cpp
rename to src/hasp/hasp.cpp
index a7f37861..850f99b5 100644
--- a/src/hasp.cpp
+++ b/src/hasp/hasp.cpp
@@ -16,7 +16,6 @@
#include "hasp_object.h"
#include "hasp_dispatch.h"
//#include "hasp_filesystem.h" included in hasp_conf.h
-#include "hasp_wifi.h"
#include "hasp_gui.h"
#include "hasp_attribute.h"
diff --git a/src/hasp.h b/src/hasp/hasp.h
similarity index 98%
rename from src/hasp.h
rename to src/hasp/hasp.h
index 53a330e1..4b08c4de 100644
--- a/src/hasp.h
+++ b/src/hasp/hasp.h
@@ -7,7 +7,8 @@
#include
#include "lvgl.h"
#include "hasp_conf.h"
-#include "hasp_debug.h"
+
+#include "../hasp_debug.h"
#ifdef __cplusplus
extern "C" {
diff --git a/src/hasp_attribute.cpp b/src/hasp/hasp_attribute.cpp
similarity index 100%
rename from src/hasp_attribute.cpp
rename to src/hasp/hasp_attribute.cpp
diff --git a/src/hasp_attribute.h b/src/hasp/hasp_attribute.h
similarity index 100%
rename from src/hasp_attribute.h
rename to src/hasp/hasp_attribute.h
diff --git a/src/hasp_dispatch.cpp b/src/hasp/hasp_dispatch.cpp
similarity index 99%
rename from src/hasp_dispatch.cpp
rename to src/hasp/hasp_dispatch.cpp
index 312245f6..929deebc 100644
--- a/src/hasp_dispatch.cpp
+++ b/src/hasp/hasp_dispatch.cpp
@@ -7,15 +7,19 @@
#include "hasp_conf.h"
#include "hasp_dispatch.h"
-#include "hasp_network.h" // for network_get_status()
-#include "hasp_debug.h"
#include "hasp_object.h"
+#include "hasp_sleep.h"
+#include "hasp.h"
+
+#include "hasp_debug.h"
#include "hasp_gui.h"
#include "hasp_oobe.h"
-#include "hasp_mqtt.h"
#include "hasp_gpio.h"
#include "hasp_hal.h"
-#include "hasp.h"
+
+#include "svc/hasp_ota.h"
+#include "svc/hasp_mqtt.h"
+#include "net/hasp_network.h" // for network_get_status()
#if HASP_USE_CONFIG > 0
#include "hasp_config.h"
@@ -472,9 +476,11 @@ void dispatch_parse_json(const char *, const char * payload)
} else if(json.is()) { // handle json as an array of commands
JsonArray arr = json.as();
+ guiStop();
for(JsonVariant command : arr) {
dispatch_text_line(command.as().c_str());
}
+ guiStart();
} else if(json.is()) { // handle json as a jsonl
uint8_t savedPage = haspGetPage();
hasp_new_object(json.as(), savedPage);
@@ -500,11 +506,13 @@ void dispatch_parse_jsonl(Stream & stream)
DynamicJsonDocument jsonl(4 * 128u); // max ~256 characters per line
DeserializationError err = deserializeJson(jsonl, stream);
+ guiStop();
while(err == DeserializationError::Ok) {
hasp_new_object(jsonl.as(), savedPage);
err = deserializeJson(jsonl, stream);
line++;
}
+ guiStart();
/* For debugging pourposes */
if(err == DeserializationError::EmptyInput) {
@@ -685,7 +693,7 @@ void dispatch_calibrate(const char *, const char *)
void dispatch_wakeup(const char *, const char *)
{
- guiWakeUp();
+ sleep_wakeup();
}
void dispatch_reboot(const char *, const char *)
diff --git a/src/hasp_dispatch.h b/src/hasp/hasp_dispatch.h
similarity index 100%
rename from src/hasp_dispatch.h
rename to src/hasp/hasp_dispatch.h
diff --git a/src/hasp_object.cpp b/src/hasp/hasp_object.cpp
similarity index 98%
rename from src/hasp_object.cpp
rename to src/hasp/hasp_object.cpp
index 24ef3e1d..9d16def8 100644
--- a/src/hasp_object.cpp
+++ b/src/hasp/hasp_object.cpp
@@ -21,10 +21,10 @@
#endif
#include "hasp.h"
-#include "hasp_gui.h"
#include "hasp_object.h"
#include "hasp_dispatch.h"
#include "hasp_attribute.h"
+#include "hasp_sleep.h"
// ##################### Object Finders ########################################################
@@ -311,7 +311,7 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
return;
}
- guiCheckSleep(); // wakeup?
+ sleep_check_state(); // wakeup?
dispatch_object_event(obj, eventid); // send object event
}
@@ -323,7 +323,7 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
void wakeup_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(obj == lv_disp_get_layer_sys(NULL)) {
- guiCheckSleep(); // wakeup?
+ sleep_check_state(); // wakeup?
lv_obj_set_click(obj, false); // disable fist click
}
}
@@ -336,7 +336,7 @@ void wakeup_event_handler(lv_obj_t * obj, lv_event_t event)
static void btnmap_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
- guiCheckSleep(); // wakeup?
+ sleep_check_state(); // wakeup?
hasp_send_obj_attribute_val(obj, lv_btnmatrix_get_active_btn(obj));
}
}
@@ -349,7 +349,7 @@ static void btnmap_event_handler(lv_obj_t * obj, lv_event_t event)
static void table_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
- guiCheckSleep(); // wakeup?
+ sleep_check_state(); // wakeup?
uint16_t row;
uint16_t col;
@@ -365,7 +365,7 @@ static void table_event_handler(lv_obj_t * obj, lv_event_t event)
void IRAM_ATTR toggle_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
- guiCheckSleep(); // wakeup?
+ sleep_check_state(); // wakeup?
hasp_send_obj_attribute_val(obj, lv_checkbox_is_checked(obj));
}
}
@@ -378,7 +378,7 @@ void IRAM_ATTR toggle_event_handler(lv_obj_t * obj, lv_event_t event)
static void switch_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
- guiCheckSleep(); // wakeup?
+ sleep_check_state(); // wakeup?
hasp_send_obj_attribute_val(obj, lv_switch_get_state(obj));
}
}
diff --git a/src/hasp_object.h b/src/hasp/hasp_object.h
similarity index 100%
rename from src/hasp_object.h
rename to src/hasp/hasp_object.h
diff --git a/src/lv_theme_hasp.cpp b/src/hasp/lv_theme_hasp.cpp
similarity index 100%
rename from src/lv_theme_hasp.cpp
rename to src/hasp/lv_theme_hasp.cpp
diff --git a/src/lv_theme_hasp.h b/src/hasp/lv_theme_hasp.h
similarity index 100%
rename from src/lv_theme_hasp.h
rename to src/hasp/lv_theme_hasp.h
diff --git a/src/hasp_config.cpp b/src/hasp_config.cpp
index 65f34bc0..eb9b2fb1 100644
--- a/src/hasp_config.cpp
+++ b/src/hasp_config.cpp
@@ -18,7 +18,7 @@
//#include "hasp_gpio.h" included in conf
//#include "hasp_eeprom.h"
-#include "hasp.h"
+#include "hasp/hasp.h"
#if HASP_USE_EEPROM > 0
#include "EEPROM.h"
diff --git a/src/hasp_debug.cpp b/src/hasp_debug.cpp
index 89f1cc08..14e45f10 100644
--- a/src/hasp_debug.cpp
+++ b/src/hasp_debug.cpp
@@ -27,12 +27,14 @@
#include
#endif
-#include "hasp.h"
-#include "hasp_hal.h"
#include "hasp_conf.h"
+
+#include "hasp_hal.h"
#include "hasp_debug.h"
#include "hasp_config.h"
-#include "hasp_dispatch.h"
+
+#include "hasp/hasp_dispatch.h"
+#include "hasp/hasp.h"
#ifdef USE_CONFIG_OVERRIDE
#include "user_config_override.h"
@@ -426,6 +428,10 @@ static void debugPrintTag(uint8_t tag, Print * _logOutput)
_logOutput->print(F("HASP"));
break;
+ case TAG_DRVR:
+ _logOutput->print(F("DRVR"));
+ break;
+
case TAG_ATTR:
_logOutput->print(F("ATTR"));
break;
diff --git a/src/hasp_debug.h b/src/hasp_debug.h
index 06fd4851..64e5fa16 100644
--- a/src/hasp_debug.h
+++ b/src/hasp_debug.h
@@ -40,6 +40,7 @@ enum {
TAG_MSGR = 3,
TAG_OOBE = 4,
TAG_HAL = 5,
+ TAG_DRVR = 6,
TAG_DEBG = 10,
TAG_TELN = 11,
diff --git a/src/hasp_gpio.cpp b/src/hasp_gpio.cpp
index 583ba853..66aeb956 100644
--- a/src/hasp_gpio.cpp
+++ b/src/hasp_gpio.cpp
@@ -7,8 +7,9 @@
#include "hasp_conf.h"
#include "hasp_gpio.h"
#include "hasp_config.h"
-#include "hasp_dispatch.h"
-#include "hasp.h"
+
+#include "hasp/hasp_dispatch.h"
+#include "hasp/hasp.h"
uint8_t gpioUsedInputCount = 0;
diff --git a/src/hasp_oobe.cpp b/src/hasp_oobe.cpp
index 6c70e349..5468d05a 100644
--- a/src/hasp_oobe.cpp
+++ b/src/hasp_oobe.cpp
@@ -10,11 +10,12 @@
#include "../lv_components.h"
#endif
-#include "hasp_object.h"
#include "hasp_gui.h"
-#include "hasp_wifi.h"
#include "hasp_config.h"
-#include "hasp_dispatch.h"
+
+#include "net/hasp_wifi.h"
+#include "hasp/hasp_dispatch.h"
+#include "hasp/hasp_object.h"
static bool oobeAutoCalibrate = true;
diff --git a/src/main.cpp b/src/main.cpp
index 6cf9ff5d..8ad578b9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -8,9 +8,12 @@
#include "hasp_config.h"
#include "hasp_gui.h"
#include "hasp_oobe.h"
-#include "hasp_dispatch.h"
-#include "hasp_network.h"
-#include "hasp.h"
+
+#include "hasp/hasp_dispatch.h"
+#include "hasp/hasp_sleep.h"
+#include "hasp/hasp.h"
+
+#include "net/hasp_network.h"
bool isConnected;
uint8_t mainLoopCounter = 0;
@@ -153,7 +156,7 @@ void loop()
/* Timer Loop */
if(millis() - mainLastLoopTime >= 1000) {
/* Runs Every Second */
- guiEverySecond(); // sleep timer
+ sleepEverySecond();
debugEverySecond(); // statusupdate
#if HASP_USE_OTA > 0
otaEverySecond(); // progressbar
diff --git a/src/hasp_ethernet_esp32.cpp b/src/net/hasp_ethernet_esp32.cpp
similarity index 100%
rename from src/hasp_ethernet_esp32.cpp
rename to src/net/hasp_ethernet_esp32.cpp
diff --git a/src/hasp_ethernet_esp32.h b/src/net/hasp_ethernet_esp32.h
similarity index 100%
rename from src/hasp_ethernet_esp32.h
rename to src/net/hasp_ethernet_esp32.h
diff --git a/src/hasp_ethernet_stm32.cpp b/src/net/hasp_ethernet_stm32.cpp
similarity index 100%
rename from src/hasp_ethernet_stm32.cpp
rename to src/net/hasp_ethernet_stm32.cpp
diff --git a/src/hasp_ethernet_stm32.h b/src/net/hasp_ethernet_stm32.h
similarity index 100%
rename from src/hasp_ethernet_stm32.h
rename to src/net/hasp_ethernet_stm32.h
diff --git a/src/hasp_network.cpp b/src/net/hasp_network.cpp
similarity index 96%
rename from src/hasp_network.cpp
rename to src/net/hasp_network.cpp
index 51f20f80..c24c7b2e 100644
--- a/src/hasp_network.cpp
+++ b/src/net/hasp_network.cpp
@@ -7,8 +7,9 @@
#include "hasp_conf.h"
#include "hasp_hal.h"
#include "hasp_debug.h"
-#include "hasp_mdns.h"
-#include "hasp.h"
+
+#include "../hasp/hasp.h"
+#include "../svc/hasp_mdns.h"
#if HASP_USE_ETHERNET > 0 || HASP_USE_WIFI > 0
diff --git a/src/hasp_network.h b/src/net/hasp_network.h
similarity index 100%
rename from src/hasp_network.h
rename to src/net/hasp_network.h
diff --git a/src/hasp_wifi.cpp b/src/net/hasp_wifi.cpp
similarity index 99%
rename from src/hasp_wifi.cpp
rename to src/net/hasp_wifi.cpp
index e0f2d2d7..818f47a9 100644
--- a/src/hasp_wifi.cpp
+++ b/src/net/hasp_wifi.cpp
@@ -11,10 +11,11 @@
#include "hasp_debug.h"
#include "hasp_config.h"
-#include "hasp_dispatch.h"
#include "hasp_network.h"
#include "hasp_gui.h"
-#include "hasp.h"
+
+#include "hasp/hasp_dispatch.h"
+#include "hasp/hasp.h"
#if defined(ARDUINO_ARCH_ESP32)
#include
diff --git a/src/hasp_wifi.h b/src/net/hasp_wifi.h
similarity index 100%
rename from src/hasp_wifi.h
rename to src/net/hasp_wifi.h
diff --git a/src/hasp_http.cpp b/src/svc/hasp_http.cpp
similarity index 99%
rename from src/hasp_http.cpp
rename to src/svc/hasp_http.cpp
index 637f1308..4559ad59 100644
--- a/src/hasp_http.cpp
+++ b/src/svc/hasp_http.cpp
@@ -17,8 +17,9 @@
#include "hasp_hal.h"
#include "hasp_debug.h"
#include "hasp_config.h"
-#include "hasp_dispatch.h"
-#include "hasp.h"
+
+#include "hasp/hasp_dispatch.h"
+#include "hasp/hasp.h"
#if HASP_USE_HTTP > 0
@@ -1620,9 +1621,9 @@ void webHandleFirmware()
"name='filename' accept='.bin'>");
httpMessage += F("
");
- httpMessage += F("");
+ // httpMessage += F("");
httpMessage += FPSTR(MAIN_MENU_BUTTON);
diff --git a/src/hasp_http.h b/src/svc/hasp_http.h
similarity index 100%
rename from src/hasp_http.h
rename to src/svc/hasp_http.h
diff --git a/src/hasp_mdns.cpp b/src/svc/hasp_mdns.cpp
similarity index 100%
rename from src/hasp_mdns.cpp
rename to src/svc/hasp_mdns.cpp
diff --git a/src/hasp_mdns.h b/src/svc/hasp_mdns.h
similarity index 100%
rename from src/hasp_mdns.h
rename to src/svc/hasp_mdns.h
diff --git a/src/hasp_mqtt.cpp b/src/svc/hasp_mqtt.cpp
similarity index 99%
rename from src/hasp_mqtt.cpp
rename to src/svc/hasp_mqtt.cpp
index e6c93ed4..b0f37da0 100644
--- a/src/hasp_mqtt.cpp
+++ b/src/svc/hasp_mqtt.cpp
@@ -35,8 +35,9 @@ EthernetClient mqttNetworkClient;
#include "hasp_hal.h"
#include "hasp_debug.h"
#include "hasp_config.h"
-#include "hasp_dispatch.h"
-#include "hasp.h"
+
+#include "../hasp/hasp_dispatch.h"
+#include "../hasp/hasp.h"
#ifdef USE_CONFIG_OVERRIDE
#include "user_config_override.h"
diff --git a/src/hasp_mqtt.h b/src/svc/hasp_mqtt.h
similarity index 100%
rename from src/hasp_mqtt.h
rename to src/svc/hasp_mqtt.h
diff --git a/src/hasp_ota.cpp b/src/svc/hasp_ota.cpp
similarity index 98%
rename from src/hasp_ota.cpp
rename to src/svc/hasp_ota.cpp
index 4109c02c..52032ec6 100644
--- a/src/hasp_ota.cpp
+++ b/src/svc/hasp_ota.cpp
@@ -6,9 +6,10 @@
#include "hasp_conf.h"
#include "hasp_debug.h"
-#include "hasp_dispatch.h"
#include "hasp_ota.h"
-#include "hasp.h"
+
+#include "../hasp/hasp_dispatch.h"
+#include "../hasp/hasp.h"
#if defined(ARDUINO_ARCH_ESP8266)
#include
diff --git a/src/hasp_ota.h b/src/svc/hasp_ota.h
similarity index 100%
rename from src/hasp_ota.h
rename to src/svc/hasp_ota.h
diff --git a/src/hasp_slave.cpp b/src/svc/hasp_slave.cpp
similarity index 100%
rename from src/hasp_slave.cpp
rename to src/svc/hasp_slave.cpp
diff --git a/src/hasp_slave.h b/src/svc/hasp_slave.h
similarity index 100%
rename from src/hasp_slave.h
rename to src/svc/hasp_slave.h
diff --git a/src/hasp_telnet.cpp b/src/svc/hasp_telnet.cpp
similarity index 99%
rename from src/hasp_telnet.cpp
rename to src/svc/hasp_telnet.cpp
index 462a78a0..6d821950 100644
--- a/src/hasp_telnet.cpp
+++ b/src/svc/hasp_telnet.cpp
@@ -9,9 +9,10 @@
#include "hasp_debug.h"
#include "hasp_config.h"
-#include "hasp_dispatch.h"
#include "hasp_telnet.h"
+#include "../hasp/hasp_dispatch.h"
+
#if defined(ARDUINO_ARCH_ESP32)
#include
WiFiClient telnetClient;
diff --git a/src/hasp_telnet.h b/src/svc/hasp_telnet.h
similarity index 100%
rename from src/hasp_telnet.h
rename to src/svc/hasp_telnet.h