Move page constructors to TFT

To reduce comms between ESPHome and Nextion, which could help with some sync issues found with 921600 bps.
This commit is contained in:
Edward Firmo
2023-12-17 12:44:12 +01:00
parent bd99afa14b
commit a2dc5913fa
130 changed files with 665 additions and 701 deletions

View File

@@ -7,3 +7,13 @@ Change to `display_mode=3`
1. Change left_bt_pic (x,y,w,h) from ( 47,307,120,3) to (467,173,3,120)
2. Change right_bt_pic(x,y,w,h) from (288,307,120,3) to (467, 27,3,120)
3. Rotate pictures 30 & 31 by 90degrees - You will find the rotated pics under pics folder where this instruction file is.
# Creating `nspanel_CJK_xxx.HMI` from `nspanel_xxx.HMI`:
## Program.s:
Change to `charset=2`
## Fonts:
1. Replace `ubuntuXX` fonts by the ones available under this folder
* Note that not all fonts are available.
* Note that CJK font names might not match it's size. This should be ignored.

View File

@@ -0,0 +1,24 @@
# ESPHome
When a new page is opened, a script name `page_changed` (whith a parameter `page` containing a string with the page name) is called and that one will call a page specific script named `page_<page_name>`. In addition, pages with multiple pages (entitypageXX, buttonpageXX and weatherXX) will also call a generic page named `page_entitypage`, `page_buttonpage` or `page_weather` with a parameter `page_number` containing the number of the page called.
If you want to execute expecific code when a page is opened, you can extend the functionality of that specific page:
```yaml
script:
- id: !extend page_changed
then:
# Code to run when any page is opened
- lambda: |-
static const char *const TAG = "script.page_changed (custom)";
ESP_LOGD(TAG, "Custom code for page changed");
ESP_LOGD(TAG, "This is the new page: %s", page.c_str());
- id: !extend page_buttonpage
then:
# Code to run when any buttonpage is openend
- id: !extend page_buttonpage02
then:
# Code to run when buttonpage02 is opened
```