diff --git a/docs/06-faq.md b/docs/06-faq.md
index 45d01801..85c15a14 100644
--- a/docs/06-faq.md
+++ b/docs/06-faq.md
@@ -26,6 +26,6 @@ When the `edit.htm.gz` file is present on Spiffs you will see an additional File
Using that webpage, you can right-click and delete files:

-#### :question: Is there a file browser built-in?
+#### :question: How to delete files from flash?
*See: Is there a file browser built-in?*
\ No newline at end of file
diff --git a/docs/13-objects.md b/docs/13-objects.md
index b92c25ad..5a0a85a9 100644
--- a/docs/13-objects.md
+++ b/docs/13-objects.md
@@ -1,3 +1,7 @@
+There are 2 ways to create an object on the screen:
+- Uploading a pages.jsonl file onto the internal flash
+- Use the `jsonl` command, via MQTT, serial or telnet console
+
## Common Properties
These are the common properties shared among all objects:
@@ -46,6 +50,23 @@ You can still hide the object on select pages if needed. Objects on this page ap
Each object type is an ID that indicates which object type that line represents.
Besides the common properties listed above, each object type can have specific properties.
+### Cheatsheet
+
+| objid | Type |
+|:-----:|:-----------|
+| 10 | [Button](13-objects?id=button) |
+| 11 | [Checkbox](13-objects?id=checkbox) |
+| 12 | [Label](13-objects?id=text-label) |
+| 20 | [Colorpicker](13-objects?id=colorpicker) |
+| 21 | [Spinner](13-objects?id=spinner) |
+| 22 | [Arc](13-objects?id=arc) |
+| 30 | [Slider](13-objects?id=slider) |
+| 31 | [Gauge](13-objects?id=gauge) |
+| 32 | [Progressbar](13-objects?id=progressbar) |
+| 40 | [Switch](13-objects?id=switch) |
+| 41 | [LED](13-objects?id=led-indicator) |
+| 50 | [Dropdown List](13-objects?id=dropdown-list) |
+| 51 | [Roller](13-objects?id=roller) |
### Button
**objid:10**
@@ -239,7 +260,7 @@ When the item is changed both `val` and `txt` of the newly selected item are sen
| txt | string | no | "" | *Read-only* The text of the selected item
| rows | int8 | no | 3 | The number ow rows that are visible
-?> A roller does not use the `h` attribute to set its height, but uses the rows to set the visible number of rows instead.
+!> A roller does not use the `h` attribute to set its height but uses the `rows` attribute instead.
To change the currently selected item, use the `val` attribute.
To change the items in the list, use the `options` attribute.
diff --git a/docs/_sidebar.md b/docs/_sidebar.md
index 053d109f..480084b8 100644
--- a/docs/_sidebar.md
+++ b/docs/_sidebar.md
@@ -39,11 +39,16 @@
- [STM32F4xx](./39-firmware-stm32.md)
- **Hardware**
- - Alternate Dev Boards
-
+
+
- Tested Displays
- - [MHS4001](displays/MHS4001.md)
- - [WaveShare 4.0" RPi LCD (rev C)](displays/Waveshare_40RPi_LCD(C).md)
- - [MRB3511](displays/MRB3511.md)
+ * [MHS4001](displays/MHS4001.md)
+ * [MRB3511](displays/MRB3511.md)
+ * [WaveShare 4.0" RPi LCD (rev C)](displays/Waveshare_40RPi_LCD(C).md)
- [**License**](21-license.md)
\ No newline at end of file
diff --git a/docs/index.md b/docs/index.md
index 19ef47f7..7f6aed42 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,21 +1,25 @@
-# Hasp-lvgl Documentation
+# Hasp-lvgl
## Purpose
-Hasp-lvgl is a microcontroller firmware that can run on ESP and STM32F4 with an off-the-shelve touch display.
+Hasp-lvgl is a microcontroller firmware that runs on ESP and STM32F4 boards using an off-the-shelve touch display.
You can use the hasp-lvgl firmware to create a custom touchscreen user interface.
-It can display information and you can create objects like touch buttons, switches and LEDs on the touchscreen to interact with your home automation system.
-
-The communication is done over the network via MQTT.
+It can display information received over mqtt and you can create on-screen objects to interact with your home automation system,
+like touch buttons, switches, LEDs and more...
This project is a re-implementation of the popular HASwitchPlate sketch created by aderusha. The original HASwitchPlate project uses a Wemos D1 mini and requires a Nextion/TJC HMI display. This rewrite removes the Nextion/TJC requirement by using the Littlev Graphics Library on the MCU to drive a cheap commodity display.
-This version also adds ESP32 and STM32F4 support to take advantage of the additional hardware capabilities.
-
## Requirements
-To run the firmware, you only need a compatible microcontroller and touch display.
+To run the firmware, you only need a compatible [microcontroller](01-hardware?id=recommended-boards) and [touch display](01-hardware?id=recommended-display).
+## Support
+
+For support using hasp-lvgl, please join the Discord channel
+
+
+
\ No newline at end of file
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..e68ee3c2
--- /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.h" // for hasp_sleep_state
+extern uint8_t hasp_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 && hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_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 93%
rename from src/hasp.cpp
rename to src/hasp/hasp.cpp
index a7f37861..0c12e947 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"
@@ -61,6 +60,9 @@ LV_IMG_DECLARE(img_bubble_pattern)
void haspLoadPage(const char * pages);
////////////////////////////////////////////////////////////////////////////////////////////////////
+uint8_t hasp_sleep_state = HASP_SLEEP_OFF; // Used in hasp_drv_touch.cpp
+static uint16_t sleepTimeShort = 60; // 1 second resolution
+static uint16_t sleepTimeLong = 120; // 1 second resolution
uint8_t haspStartDim = 100;
uint8_t haspStartPage = 0;
@@ -90,6 +92,49 @@ lv_font_t * hasp_get_font(uint8_t fontid)
}
}
+/**
+ * WakeUp the display using a command instead of touch
+ */
+void hasp_wakeup()
+{
+ lv_disp_trig_activity(NULL);
+}
+
+/**
+ * Check if sleep state needs to be updated
+ */
+bool IRAM_ATTR hasp_update_sleep_state()
+{
+ uint32_t idle = lv_disp_get_inactive_time(NULL);
+
+ if(idle >= (sleepTimeShort + sleepTimeLong) * 1000U) {
+ if(hasp_sleep_state != HASP_SLEEP_LONG) {
+ dispatch_output_idle_state(HASP_SLEEP_LONG);
+ hasp_sleep_state = HASP_SLEEP_LONG;
+ }
+ } else if(idle >= sleepTimeShort * 1000U) {
+ if(hasp_sleep_state != HASP_SLEEP_SHORT) {
+ dispatch_output_idle_state(HASP_SLEEP_SHORT);
+ hasp_sleep_state = HASP_SLEEP_SHORT;
+ }
+ } else {
+ if(hasp_sleep_state != HASP_SLEEP_OFF) {
+ dispatch_output_idle_state(HASP_SLEEP_OFF);
+ hasp_sleep_state = HASP_SLEEP_OFF;
+ }
+ }
+
+ return (hasp_sleep_state != HASP_SLEEP_OFF);
+}
+
+/**
+ * Checks if we went to sleep, wake up is handled in the event handlers
+ */
+// void haspEverySecond()
+// {
+// hasp_update_sleep_state();
+// }
+
////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Get Page Object by PageID
@@ -235,7 +280,7 @@ static void custom_font_apply_cb(lv_theme_t * th, lv_obj_t * obj, lv_theme_style
/**
* Create a demo application
*/
-void haspSetup()
+void haspSetup(void)
{
guiSetDim(haspStartDim);
diff --git a/src/hasp.h b/src/hasp/hasp.h
similarity index 83%
rename from src/hasp.h
rename to src/hasp/hasp.h
index 53a330e1..9472552a 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" {
@@ -22,6 +23,9 @@ extern "C" {
/*********************
* DEFINES
*********************/
+#define HASP_SLEEP_OFF 0
+#define HASP_SLEEP_SHORT 1
+#define HASP_SLEEP_LONG 2
/**********************
* TYPEDEFS
@@ -34,8 +38,10 @@ extern "C" {
/**
* Create a hasp application
*/
-void haspSetup();
+void haspSetup(void);
void IRAM_ATTR haspLoop(void);
+//void haspEverySecond(void); // See MACROS
+
void haspReconnect(void);
void haspDisconnect(void);
@@ -58,9 +64,13 @@ bool haspSetConfig(const JsonObject & settings);
lv_font_t * hasp_get_font(uint8_t fontid);
+bool IRAM_ATTR hasp_update_sleep_state();
+void hasp_wakeup(void);
+
/**********************
* MACROS
**********************/
+#define haspEverySecond hasp_update_sleep_state
#endif /*HASP_USE_APP*/
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..9c6edfa1 100644
--- a/src/hasp_dispatch.cpp
+++ b/src/hasp/hasp_dispatch.cpp
@@ -7,15 +7,18 @@
#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.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 +475,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 +505,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 +692,7 @@ void dispatch_calibrate(const char *, const char *)
void dispatch_wakeup(const char *, const char *)
{
- guiWakeUp();
+ hasp_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..b55c7d6b 100644
--- a/src/hasp_object.cpp
+++ b/src/hasp/hasp_object.cpp
@@ -21,7 +21,6 @@
#endif
#include "hasp.h"
-#include "hasp_gui.h"
#include "hasp_object.h"
#include "hasp_dispatch.h"
#include "hasp_attribute.h"
@@ -311,7 +310,7 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
return;
}
- guiCheckSleep(); // wakeup?
+ hasp_update_sleep_state(); // wakeup?
dispatch_object_event(obj, eventid); // send object event
}
@@ -323,7 +322,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?
+ hasp_update_sleep_state(); // wakeup?
lv_obj_set_click(obj, false); // disable fist click
}
}
@@ -336,7 +335,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?
+ hasp_update_sleep_state(); // wakeup?
hasp_send_obj_attribute_val(obj, lv_btnmatrix_get_active_btn(obj));
}
}
@@ -349,7 +348,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?
+ hasp_update_sleep_state(); // wakeup?
uint16_t row;
uint16_t col;
@@ -365,7 +364,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?
+ hasp_update_sleep_state(); // wakeup?
hasp_send_obj_attribute_val(obj, lv_checkbox_is_checked(obj));
}
}
@@ -378,7 +377,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?
+ hasp_update_sleep_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 99%
rename from src/hasp_object.h
rename to src/hasp/hasp_object.h
index da06a429..1cdf2d0a 100644
--- a/src/hasp_object.h
+++ b/src/hasp/hasp_object.h
@@ -8,44 +8,41 @@
#include "lvgl.h"
enum lv_hasp_obj_type_t {
- LV_HASP_BTNMATRIX = 1,
- LV_HASP_TABLE = 2,
+ LV_HASP_CONTAINER = 90,
+ LV_HASP_OBJECT = 91,
+ LV_HASP_PAGE = 92,
+
+ LV_HASP_LABEL = 12,
+ LV_HASP_DDLIST = 50,
+ LV_HASP_ROLLER = 51,
LV_HASP_BUTTON = 10,
LV_HASP_CHECKBOX = 11,
- LV_HASP_LABEL = 12,
-
- LV_HASP_CPICKER = 20,
- LV_HASP_PRELOADER = 21,
- LV_HASP_ARC = 22,
+ LV_HASP_SWITCH = 40,
+ LV_HASP_LED = 41,
LV_HASP_SLIDER = 30,
LV_HASP_GAUGE = 31,
LV_HASP_BAR = 32,
LV_HASP_LMETER = 33,
- LV_HASP_SWITCH = 40,
- LV_HASP_LED = 41,
-
- LV_HASP_DDLIST = 50,
- LV_HASP_ROLLER = 51,
+ LV_HASP_ARC = 22,
+ LV_HASP_PRELOADER = 21,
+ LV_HASP_CPICKER = 20,
LV_HASP_IMAGE = 60,
LV_HASP_IMGBTN = 61,
LV_HASP_CANVAS = 62,
+ LV_HASP_BTNMATRIX = 1,
+ LV_HASP_TABLE = 2,
+ LV_HASP_CALENDER = 81,
+ LV_HASP_CHART = 80,
LV_HASP_TILEVIEW = 70,
LV_HASP_TABVIEW = 71,
LV_HASP_TAB = 72,
-
- LV_HASP_CHART = 80,
- LV_HASP_CALENDER = 81,
-
- LV_HASP_CONTAINER = 90,
- LV_HASP_OBJECT = 91,
- LV_HASP_PAGE = 92,
- LV_HASP_MSGBOX = 93,
LV_HASP_WINDOW = 94,
+ LV_HASP_MSGBOX = 93,
};
void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id);
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 2c8501d5..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;
@@ -600,9 +606,6 @@ void debugPrintSuffix(uint8_t tag, int level, Print * _logOutput)
void debugPreSetup(JsonObject settings)
{
- // Link stream to debugOutput
- // debugOutput.reserve(512);
-
Log.begin(LOG_LEVEL_WARNING, true);
Log.setPrefix(debugPrintPrefix); // Uncomment to get timestamps as prefix
Log.setSuffix(debugPrintSuffix); // Uncomment to get newline as suffix
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_gui.cpp b/src/hasp_gui.cpp
index 4166ff8a..48b2a5b2 100644
--- a/src/hasp_gui.cpp
+++ b/src/hasp_gui.cpp
@@ -11,37 +11,24 @@
#include "lv_misc/lv_fs.h"
#include "lv_fs_if.h"
-// Select Display Driver
-#if defined(USE_FSMC)
-#include "fsmc_ili9341.h"
-#else
-#include "tft_espi_drv.h"
-#endif
-
-// Select Touch Driver
-//#include "indev/XPT2046_alt_drv.h"
-#include "indev/XPT2046.h"
-
-//#include "lv_zifont.h"
+// Device Drivers
+#include "drv/hasp_drv_display.h"
+#include "drv/hasp_drv_touch.h"
#include "hasp_debug.h"
#include "hasp_config.h"
-#include "hasp_dispatch.h"
#include "hasp_gui.h"
#include "hasp_oobe.h"
-#include "hasp.h"
-//#include "lv_ex_conf.h"
+#include "hasp/hasp_dispatch.h"
+#include "hasp/hasp.h"
+
//#include "tpcal.h"
#include "Ticker.h"
#if HASP_USE_PNGDECODE > 0
-#include "png_decoder.h"
-#endif
-
-#ifndef TOUCH_DRIVER
-#define TOUCH_DRIVER -1 // No Touch
+ #include "png_decoder.h"
#endif
#define BACKLIGHT_CHANNEL 15 // pwm channel 0-15
@@ -53,10 +40,10 @@ File pFileOut;
#define LVGL_TICK_PERIOD 20
#ifndef TFT_BCKL
-#define TFT_BCKL -1 // No Backlight Control
+ #define TFT_BCKL -1 // No Backlight Control
#endif
#ifndef TFT_ROTATION
-#define TFT_ROTATION 0
+ #define TFT_ROTATION 0
#endif
static void IRAM_ATTR lv_tick_handler(void);
@@ -67,11 +54,9 @@ static int8_t guiDimLevel = -1;
static int8_t guiBacklightPin = TFT_BCKL;
static uint16_t guiSleepTime1 = 60; // 1 second resolution
static uint16_t guiSleepTime2 = 120; // 1 second resolution
-static uint8_t guiSleeping = HASP_SLEEP_OFF;
static uint8_t guiTickPeriod = 20;
static uint8_t guiRotation = TFT_ROTATION;
-// static TFT_eSPI tft; // = TFT_eSPI(); /* TFT instance */
-static uint16_t calData[5] = {0, 65535, 0, 65535, 0};
+static uint16_t calData[5] = {0, 65535, 0, 65535, 0};
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
static Ticker tick; /* timer for interrupt handler */
@@ -79,67 +64,16 @@ static Ticker tick; /* timer for interrupt handler */
static Ticker tick(lv_tick_handler, LVGL_TICK_PERIOD); // guiTickPeriod);
#endif
-/* **************************** SLEEP & WAKEUP ************************************** */
-bool IRAM_ATTR guiCheckSleep()
+/* **************************** FLUSH DATA TO TFT ******************************* */
+
+/* Defines the actual driver callback to use */
+static void gui_flush_cb(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
- uint32_t idle = lv_disp_get_inactive_time(NULL);
-
- if(idle >= (guiSleepTime1 + guiSleepTime2) * 1000U) {
- if(guiSleeping != HASP_SLEEP_LONG) {
- dispatch_output_idle_state(HASP_SLEEP_LONG);
- guiSleeping = HASP_SLEEP_LONG;
- }
- } else if(idle >= guiSleepTime1 * 1000U) {
- if(guiSleeping != HASP_SLEEP_SHORT) {
- dispatch_output_idle_state(HASP_SLEEP_SHORT);
- guiSleeping = HASP_SLEEP_SHORT;
- }
- } else {
- if(guiSleeping != HASP_SLEEP_OFF) {
- dispatch_output_idle_state(HASP_SLEEP_OFF);
- guiSleeping = HASP_SLEEP_OFF;
- }
- }
-
- return (guiSleeping != HASP_SLEEP_OFF);
-}
-
-/**
- * WakeUp the display using a command instead of touch
- */
-void guiWakeUp()
-{
- lv_disp_trig_activity(NULL);
-}
-
-/* **************************** SCREENSHOTS ************************************** */
-
-/* After flusing to the file stream or web client, we also send the buffer to the tft */
-static void IRAM_ATTR printscreen_flush_cb(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
-{
-#if 0
- size_t len = (area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1); /* Number of pixels */
-
- /* Update TFT */
- tft.startWrite(); /* Start new TFT transaction */
- tft.setWindow(area->x1, area->y1, area->x2, area->y2); /* set the working window */
- tft.pushPixels((uint16_t *)color_p, len); /* Write words at once */
- tft.endWrite(); /* terminate TFT transaction */
-
- /* Send Screenshot data */
- // if(guiSnapshot != 0) {
- // gui_take_screenshot(disp, area, color_p);
- //}
-#endif
-
#if defined(USE_FSMC)
fsmc_ili9341_flush(disp, area, color_p);
#else
tft_espi_flush(disp, area, color_p);
#endif
-
- /* Tell lvgl that flushing is done */
- // lv_disp_flush_ready(disp); ===> moved into the drivers
}
/* **************************** GUI TICKER ************************************** */
@@ -205,7 +139,7 @@ static void ICACHE_RAM_ATTR lv_tick_handler(void)
// return true;
// }
-// bool my_touchpad_read_raw(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
+// bool gui_touchpad_read_raw(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
// {
// #ifdef TOUCH_CS
// uint16_t touchX, touchY;
@@ -227,7 +161,7 @@ static void ICACHE_RAM_ATTR lv_tick_handler(void)
// // }
// // }
-// if(guiSleeping > 0) guiCheckSleep(); // update Idle
+// if(sleep_state > 0) hasp_update_sleep_state(); // update Idle
// /*Save the state and save the pressed coordinate*/
// // lv_disp_t * disp = lv_disp_get_default();
@@ -242,8 +176,8 @@ static void ICACHE_RAM_ATTR lv_tick_handler(void)
// return false; /*Return `false` because we are not buffering and no more data to read*/
// }
-#if TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
-#include "Touchscreen.h" // For Uno Shield or ADC based resistive touchscreens
+#if TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
+ #include "Touchscreen.h" // For Uno Shield or ADC based resistive touchscreens
boolean Touch_getXY(uint16_t * x, uint16_t * y, boolean showTouch)
{
@@ -268,8 +202,8 @@ boolean Touch_getXY(uint16_t * x, uint16_t * y, boolean showTouch)
digitalWrite(aYP, HIGH); // because TFT control pins
digitalWrite(aXM, HIGH);
// adjust pressure sensitivity - note works 'backwards'
-#define MINPRESSURE 200
-#define MAXPRESSURE 1000
+ #define MINPRESSURE 200
+ #define MAXPRESSURE 1000
bool pressed = (p.z > MINPRESSURE && p.z < MAXPRESSURE);
if(pressed) {
@@ -297,143 +231,12 @@ boolean Touch_getXY(uint16_t * x, uint16_t * y, boolean showTouch)
}
#endif
-#if TOUCH_DRIVER == 911
-
-#include
-#include "Goodix.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;
-
-void handleTouch(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();
- }
-}
-
-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;
-}
-
-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_setup()
-{
- Wire.setClock(400000);
- Wire.begin();
- delay(300);
-
- touch.setHandler(handleTouch);
- touchStart();
- Log.trace(TAG_GUI, F("Goodix GT911x touch driver started"));
-}
-#endif
-
-bool IRAM_ATTR my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
-{
-#ifdef TOUCH_CS
- uint16_t touchX, touchY;
- bool touched;
-#if TOUCH_DRIVER == 2046 // XPT2046 Resistive touch panel driver
- touched = tft_espi_get_touch(&touchX, &touchY, 300);
-#elif TOUCH_DRIVER == 911
- // return false;
- touched = GT911_getXY(&touchX, &touchY, true);
-#elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
- touched = Touch_getXY(&touchX, &touchY, false);
-#else
- // xpt2046_alt_drv_read(indev_driver, data);
- // xpt2046_read(indev_driver, data);
- // if(data->state && guiSleeping != HASP_SLEEP_OFF) guiCheckSleep();
- return false;
-#endif
-
- if(touched && guiSleeping != HASP_SLEEP_OFF) guiCheckSleep(); // 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; /*Return `false` because we are not buffering and no more data to read*/
-}
-
void guiCalibrate()
{
#if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0
-#ifdef TOUCH_CS
+ #ifdef TOUCH_CS
tft_espi_calibrate(calData);
-#endif
+ #endif
for(int i = 0; i < 5; i++) {
Serial.print(calData[i]);
@@ -447,55 +250,45 @@ void guiCalibrate()
void guiSetup()
{
- /* TFT init */
-#if defined(USE_FSMC)
- fsmc_ili9341_init(guiRotation);
- xpt2046_init(guiRotation);
-#else
- tft_espi_init(guiRotation);
-#endif
-
-#if TOUCH_DRIVER == 911
- GT911_setup();
-#endif
+ // Driver intializations:
+ drv_display_init(guiRotation); // Display
+ drv_touch_init(guiRotation); // Touch
+ lv_init(); // GUI
#if 0
tft.begin();
tft.setSwapBytes(true); /* set endianess */
-#ifdef USE_DMA_TO_TFT
+ #ifdef USE_DMA_TO_TFT
// DMA - should work with STM32F2xx/F4xx/F7xx processors
// NOTE: >>>>>> DMA IS FOR SPI DISPLAYS ONLY <<<<<<
tft.initDMA(); // Initialise the DMA engine (tested with STM32F446 and STM32F767)
-#endif
+ #endif
tft.setRotation(guiRotation); /* 1/3=Landscape or 0/2=Portrait orientation */
-#if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0
+ #if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0
tft_espi_set_touch(calData);
-#endif
+ #endif
#endif
/* Initialize the Virtual Device Buffers */
- size_t guiVDBsize = 0;
- lv_init();
-
#if defined(ARDUINO_ARCH_ESP32)
/* allocate on iram (or psram ?) */
static lv_disp_buf_t disp_buf;
-#ifdef USE_DMA_TO_TFT
+ #ifdef USE_DMA_TO_TFT
static lv_color_t *guiVdbBuffer1, *guiVdbBuffer2 = NULL;
- guiVDBsize = 4 * 1024u; // 16 KBytes * 2
- guiVdbBuffer1 = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_DMA);
+ size_t guiVDBsize = 4 * 1024u; // 16 KBytes * 2
+ guiVdbBuffer1 = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_DMA);
lv_disp_buf_init(&disp_buf, guiVdbBuffer1, NULL, guiVDBsize);
- //guiVdbBuffer2 = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_DMA);
- //lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
-#else
+ // guiVdbBuffer2 = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_DMA);
+ // lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
+ #else
static lv_color_t * guiVdbBuffer1;
- guiVDBsize = 16 * 1024u; // 32 KBytes * 2
- guiVdbBuffer1 = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_8BIT);
+ size_t guiVDBsize = 16 * 1024u; // 32 KBytes * 2
+ guiVdbBuffer1 = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * guiVDBsize, MALLOC_CAP_8BIT);
lv_disp_buf_init(&disp_buf, guiVdbBuffer1, NULL, guiVDBsize);
-#endif
+ #endif
// static lv_color_t * guiVdbBuffer2 = (lv_color_t *)malloc(sizeof(lv_color_t) * guiVDBsize);
// lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
@@ -503,7 +296,7 @@ void guiSetup()
/* allocate on heap */
static lv_disp_buf_t disp_buf;
static lv_color_t guiVdbBuffer1[4 * 512u]; // 4 KBytes
- guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(guiVdbBuffer1[0]);
+ size_t guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(guiVdbBuffer1[0]);
lv_disp_buf_init(&disp_buf, guiVdbBuffer1, NULL, guiVDBsize);
// static lv_disp_buf_t disp_buf;
@@ -515,7 +308,7 @@ void guiSetup()
static lv_disp_buf_t disp_buf;
static lv_color_t guiVdbBuffer1[16 * 512u]; // 16 KBytes
// static lv_color_t guiVdbBuffer2[16 * 512u]; // 16 KBytes
- guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(guiVdbBuffer1[0]);
+ size_t guiVDBsize = sizeof(guiVdbBuffer1) / sizeof(guiVdbBuffer1[0]);
// lv_disp_buf_init(&disp_buf, guiVdbBuffer1, guiVdbBuffer2, guiVDBsize);
lv_disp_buf_init(&disp_buf, guiVdbBuffer1, NULL, guiVDBsize);
#endif
@@ -531,19 +324,15 @@ void guiSetup()
lv_fs_if_init(); // auxilary file system drivers
#endif
- /* Dump TFT Configuration */
- // tftSetup(tft);
#ifdef USE_DMA_TO_TFT
Log.verbose(TAG_GUI, F("DMA : ENABLED"));
#else
Log.verbose(TAG_GUI, F("DMA : DISABLED"));
#endif
- /* Load User Settings */
- // guiSetConfig(settings);
/* Setup Backlight Control Pin */
if(guiBacklightPin >= 0) {
- Log.verbose(TAG_LVGL, F("Backlight: Pin %d"), guiBacklightPin);
+ Log.verbose(TAG_GUI, F("Backlight: Pin %d"), guiBacklightPin);
#if defined(ARDUINO_ARCH_ESP32)
// pinMode(guiBacklightPin, OUTPUT);
@@ -555,11 +344,11 @@ void guiSetup()
pinMode(guiBacklightPin, OUTPUT);
#endif
}
+ Log.verbose(TAG_GUI, F("Rotation : %d"), guiRotation);
Log.verbose(TAG_LVGL, F("Version : %u.%u.%u %s"), LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH,
PSTR(LVGL_VERSION_INFO));
- Log.verbose(TAG_LVGL, F("Rotation : %d"), guiRotation);
#ifdef LV_MEM_SIZE
Log.verbose(TAG_LVGL, F("MEM size : %d"), LV_MEM_SIZE);
#endif
@@ -573,12 +362,15 @@ void guiSetup()
/* Initialize the display driver */
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
-#if defined(USE_FSMC)
- disp_drv.flush_cb = fsmc_ili9341_flush;
-#else
- disp_drv.flush_cb = tft_espi_flush;
-#endif
- disp_drv.buffer = &disp_buf;
+ disp_drv.buffer = &disp_buf;
+ disp_drv.flush_cb = gui_flush_cb; // static void that uses the appropriate driver
+
+ // #if defined(USE_FSMC)
+ // disp_drv.flush_cb = fsmc_ili9341_flush;
+ // #else
+ // disp_drv.flush_cb = tft_espi_flush;
+ // #endif
+
if(guiRotation == 0 || guiRotation == 2 || guiRotation == 4 || guiRotation == 6) {
/* 1/3=Landscape or 0/2=Portrait orientation */
// Normal width & height
@@ -590,7 +382,7 @@ void guiSetup()
disp_drv.ver_res = TFT_WIDTH;
}
lv_disp_drv_register(&disp_drv);
- guiStart();
+ guiStart(); // Ticker
/* Initialize Global progress bar*/
lv_obj_t * bar = lv_bar_create(lv_layer_sys(), NULL);
@@ -608,13 +400,11 @@ void guiSetup()
lv_obj_set_style_local_bg_color(lv_layer_sys(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_obj_set_style_local_bg_opa(lv_layer_sys(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0);
- /*Initialize the touch pad*/
+ /* Initialize the touch pad */
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
- // indev_drv.type = LV_INDEV_TYPE_ENCODER;
- // indev_drv.read_cb = read_encoder;
indev_drv.type = LV_INDEV_TYPE_POINTER;
- indev_drv.read_cb = my_touchpad_read;
+ indev_drv.read_cb = drv_touch_read;
lv_indev_t * mouse_indev = lv_indev_drv_register(&indev_drv);
mouse_indev->driver.type = LV_INDEV_TYPE_POINTER;
@@ -650,16 +440,11 @@ void IRAM_ATTR guiLoop(void)
#if defined(STM32F4xx)
tick.update();
#endif
-
-#if TOUCH_DRIVER == 911
- touch.loop();
-#endif
}
void guiEverySecond(void)
{
- // check if we went to sleep, wake up is handled in the event handlers
- guiCheckSleep();
+ // nothing
}
void guiStart()
@@ -764,9 +549,9 @@ bool guiGetConfig(const JsonObject & settings)
} else {
changed = true;
-#if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0 && defined(TOUCH_CS)
+ #if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0 && defined(TOUCH_CS)
tft_espi_set_touch(calData);
-#endif
+ #endif
}
i++;
}
@@ -779,9 +564,9 @@ bool guiGetConfig(const JsonObject & settings)
}
changed = true;
-#if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0 && defined(TOUCH_CS)
+ #if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0 && defined(TOUCH_CS)
tft_espi_set_touch(calData);
-#endif
+ #endif
}
if(changed) configOutput(settings, TAG_GUI);
@@ -838,9 +623,9 @@ bool guiSetConfig(const JsonObject & settings)
oobeSetAutoCalibrate(true);
}
-#if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0 && defined(TOUCH_CS)
+ #if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0 && defined(TOUCH_CS)
if(status) tft_espi_set_touch(calData);
-#endif
+ #endif
changed |= status;
}
@@ -922,7 +707,7 @@ static void gui_screenshot_to_file(lv_disp_drv_t * disp, const lv_area_t * area,
len *= sizeof(lv_color_t); /* Number of bytes */
size_t res = pFileOut.write((uint8_t *)color_p, len);
if(res != len) gui_flush_not_complete();
- printscreen_flush_cb(disp, area, color_p);
+ gui_flush_cb(disp, area, color_p);
}
/** Take Screenshot.
@@ -976,7 +761,7 @@ static void gui_screenshot_to_http(lv_disp_drv_t * disp, const lv_area_t * area,
len *= sizeof(lv_color_t); /* Number of bytes */
size_t res = httpClientWrite((uint8_t *)color_p, len);
if(res != len) gui_flush_not_complete();
- printscreen_flush_cb(disp, area, color_p);
+ gui_flush_cb(disp, area, color_p);
}
/** Take Screenshot.
diff --git a/src/hasp_gui.h b/src/hasp_gui.h
index 3659beaf..ea2caa94 100644
--- a/src/hasp_gui.h
+++ b/src/hasp_gui.h
@@ -7,10 +7,6 @@
#include "ArduinoJson.h"
#include "lvgl.h"
-#define HASP_SLEEP_OFF 0
-#define HASP_SLEEP_SHORT 1
-#define HASP_SLEEP_LONG 2
-
/* ===== Default Event Processors ===== */
void guiSetup();
void IRAM_ATTR guiLoop(void);
@@ -24,12 +20,10 @@ void guiTakeScreenshot(const char * pFileName); // to file
void guiTakeScreenshot(); // webclient
/* ===== Getter and Setter Functions ===== */
-void guiWakeUp(void);
void guiSetDim(int8_t level);
int8_t guiGetDim(void);
void guiSetBacklight(bool lighton);
bool guiGetBacklight();
-bool IRAM_ATTR guiCheckSleep();
/* ===== Read/Write Configuration ===== */
#if HASP_USE_CONFIG > 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..911247b0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -8,9 +8,11 @@
#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.h"
+
+#include "net/hasp_network.h"
bool isConnected;
uint8_t mainLoopCounter = 0;
@@ -153,7 +155,7 @@ void loop()
/* Timer Loop */
if(millis() - mainLastLoopTime >= 1000) {
/* Runs Every Second */
- guiEverySecond(); // sleep timer
+ haspEverySecond();
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
diff --git a/user_setups/esp32/lanbon_l8.ini b/user_setups/esp32/lanbon_l8.ini
index a064103b..f595e4b9 100644
--- a/user_setups/esp32/lanbon_l8.ini
+++ b/user_setups/esp32/lanbon_l8.ini
@@ -1,8 +1,8 @@
;***************************************************;
-; Lanbon L8 Switch with ILI9341 TFT 2.4" ;
+; Lanbon L8 Switch with ST7789V TFT 2.4" ;
; - Custom ESP32 pcb ;
-; - ili9341 TFT ;
-; - ? touch controller ;
+; - ST7789V TFT ;
+; - FT6336U touch controller ;
;***************************************************;
[env:lanbon_l8]
@@ -22,21 +22,26 @@ build_flags =
;region -- TFT_eSPI build options ------------------------
${lcd.st7789v}
-D TFT_RST=18 ; FCP pin2 RESET
- -D TFT_SCLK=19 ; FCP pin3 SCL
+ -D TFT_SCLK=19 ; FCP pin3 SCL
-D TFT_DC=21 ; FCP pin4 D/C
-D TFT_CS=22 ; FCP pin5 CS
-D TFT_MOSI=23 ; FCP pin6 SDA
-D TFT_MISO=25 ; FCP pin7 SDO
-D TFT_BCKL=5
- ;CONFIG_LVGL_TOUCH_SCL_GPIO=0
- ;CONFIG_LVGL_TOUCH_SDA_GPIO=4
- ;-D TOUCH_CS=22
+ -D TOUCH_DRIVER=6336
+ -D TOUCH_SDA=4
+ -D TOUCH_SCL=0
+ -D TOUCH_IRQ=-1 ; use 34-39 as these are input only pins
+ -D TOUCH_RST=-1 ; not used, connected to 3.3V
+ -D USE_TFT_ESPI=1
;endregion
;region -- Library options -------------------------------
lib_deps =
${env.lib_deps}
${esp32.lib_deps}
+ ;git+https://github.com/lvgl/lvgl_esp32_drivers.git
+ git+https://github.com/aselectroworks/Arduino-FT6336U.git
lib_ignore =
${env.lib_ignore}
diff --git a/user_setups/lcd_config.ini b/user_setups/lcd_config.ini
index 6b0b9a55..3fec8f35 100644
--- a/user_setups/lcd_config.ini
+++ b/user_setups/lcd_config.ini
@@ -47,21 +47,25 @@ mrb3511 =
-D USER_SETUP_LOADED=1
-D TOUCH_DRIVER=911 ; GT911 Capacitive I2C touch panel driver
-D SUPPORT_TRANSACTIONS
+ -D I2C_TOUCH_FREQUENCY=400000
st7789v =
-D ST7789_DRIVER=1
- ;-D CGRAM_OFFSET=1 ; Library will add offsets required, only for 240x240
- -D TFT_SDA_READ ; Read from display, it only provides an SDA pin
+ ;-D CGRAM_OFFSET=1 ; Library will add offsets required
+ -D TFT_SDA_READ ; Read from display, it only provides an SDA pin
-D TFT_WIDTH=240
-D TFT_HEIGHT=320
- -D TFT_ROTATION=2 ; see TFT_ROTATION values
- -D TFT_RGB_ORDER=TFT_RGB ; Colour order Red-Green-Blue
+ -D TFT_ROTATION=2 ; see TFT_ROTATION values
+ -D TFT_INVERSION_ON ; for inverted colors or OFF
+ ; -D TFT_INVERSION_OFF ; for normal colors
+ -D TFT_RGB_ORDER=TFT_RGB ; Colour order Red-Green-Blue
; -D TFT_RGB_ORDER=TFT_BGR ; Colour order Blue-Green-Red
-D SPI_FREQUENCY=80000000
-D SPI_READ_FREQUENCY=6000000
-D USER_SETUP_LOADED=1
- -D TOUCH_DRIVER=6336 ; FT6336U Capacitive I2C touch panel driver
+ -D TOUCH_DRIVER=6336 ; FT6336U Capacitive I2C touch panel driver
-D SUPPORT_TRANSACTIONS
+ -D I2C_TOUCH_FREQUENCY=400000
wireless-tag =
-D ST7796_DRIVER=1
@@ -73,3 +77,4 @@ wireless-tag =
-D USER_SETUP_LOADED=1
-D TOUCH_DRIVER=6336 ; FT6336U Capacitive I2C touch panel driver
-D SUPPORT_TRANSACTIONS
+ -D I2C_TOUCH_FREQUENCY=400000
diff --git a/user_setups/stm32f4xx/STM32F407VET6_black_fsmc.ini b/user_setups/stm32f4xx/STM32F407VET6_black_fsmc.ini
index 5b5ede6e..eb720d23 100644
--- a/user_setups/stm32f4xx/STM32F407VET6_black_fsmc.ini
+++ b/user_setups/stm32f4xx/STM32F407VET6_black_fsmc.ini
@@ -62,6 +62,7 @@ build_flags =
-D HASP_USE_SPIFFS=0
-D HASP_USE_EEPROM=1
-D HASP_USE_GPIO=0
+ -D HASP_USE_OTA=0
-D HASP_USE_ETHERNET=0
;endregion
diff --git a/user_setups/stm32f4xx/stm32f407-black_ili9341.ini b/user_setups/stm32f4xx/stm32f407-black_ili9341.ini
index 1f70ab76..57ed09f7 100644
--- a/user_setups/stm32f4xx/stm32f407-black_ili9341.ini
+++ b/user_setups/stm32f4xx/stm32f407-black_ili9341.ini
@@ -33,6 +33,7 @@ build_flags =
-D HASP_OUTPUT_PIN=PE0 ; User LED D2 on DevEBox board
-D HASP_INPUT_PIN=PD15 ; User Button K1 on DevEBox board
-D HASP_USE_TASMOTA_SLAVE=1
+ -D HASP_USE_OTA=0
-D HASP_USE_ETHERNET=1
;endregion
diff --git a/user_setups/stm32f4xx/stm32f407-black_ili9341_parallel.ini b/user_setups/stm32f4xx/stm32f407-black_ili9341_parallel.ini
index 035289b5..54221de1 100644
--- a/user_setups/stm32f4xx/stm32f407-black_ili9341_parallel.ini
+++ b/user_setups/stm32f4xx/stm32f407-black_ili9341_parallel.ini
@@ -48,6 +48,7 @@ build_flags =
-D HASP_INPUT_PIN=PE4 ; User Button K0 on MCUDev Black board
-D HASP_USE_HTTP=0
-D HASP_USE_MQTT=1
+ -D HASP_USE_OTA=0
;endregion
;region -- Debugging options -----------------------------
diff --git a/user_setups/stm32f4xx/stm32f407-black_ili9341_wifi.ini b/user_setups/stm32f4xx/stm32f407-black_ili9341_wifi.ini
index ea1de859..c855aebb 100644
--- a/user_setups/stm32f4xx/stm32f407-black_ili9341_wifi.ini
+++ b/user_setups/stm32f4xx/stm32f407-black_ili9341_wifi.ini
@@ -45,6 +45,7 @@ build_flags =
-D HASP_USE_EEPROM=1
-D HASP_USE_GPIO=0
-D HASP_USE_TASMOTA_SLAVE=0
+ -D HASP_USE_OTA=0
-D HASP_USE_ETHERNET=0
;endregion
diff --git a/user_setups/stm32f4xx/stm32f407-devebox_ili9341.ini b/user_setups/stm32f4xx/stm32f407-devebox_ili9341.ini
index 96667a6a..2a5e7950 100644
--- a/user_setups/stm32f4xx/stm32f407-devebox_ili9341.ini
+++ b/user_setups/stm32f4xx/stm32f407-devebox_ili9341.ini
@@ -53,6 +53,7 @@ build_flags =
-D HASP_USE_EEPROM=1
-D HASP_USE_GPIO=1
-D HASP_USE_TASMOTA_SLAVE=0
+ -D HASP_USE_OTA=0
-D HASP_OUTPUT_PIN=PA1 ; User LED D2 on DevEBox board
-D HASP_INPUT_PIN=PA0 ; User Button K1 on DevEBox board
;endregion