New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

Post Reply
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Thx, have updated the code. Always on branch "test".
Now a bad new, I have corrected some value like width/height/color/invert, to make devices supported natively. So it's possible somes devices don't work like before.
Just tell me your device and the issue, and check if the problem is not from the setting, all is disabled by defaut (so no rotation, no color invert)

Have created 2 fonts with special character

Code: Select all

€°µ¥£²³
The code use 3 fonts, 1 small, 1 medium, and a big in bold, for the moment have updated only the big one. But I think on some country you probably need the small one ?
Rik60
Posts: 88
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Hi, tested the latest test version, giving me problems, doesn't connect to wifi/ Domoticz. If i insert the wifi setting its not connecting to Domoticz and after inserting the network ip the dispay resets and can't connect to wifi. So i switch back to testversion parent c0f2375
commit eb36d65, inserted wifi and domoticz ip, display was connecting now but the homescreen was messed up.
Attached Serial Monitor log
Attachments
Test_fail.doc
(19.5 KiB) Downloaded 149 times
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Strange, because my change can have only impact on display, or the touch.
But yes it's exaclty what I m seing on your log, it's on the second try ? on the old version ?
We can see you set the values, the application test an url to see if it's working (with success), restart (this is normal) but after it fail to connect, it seem there is problem with the SSID. So no connection and no Homescreen.

But all settings need to be persisitent, even you try a new code version. You need to set them at every version you test ?

BTW have updated the branch "test" again, have re writted the network setting code, but Honneslty haven't found the problem.
Rik60
Posts: 88
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

I have more information now.
Have downloaded to latest test version. If the software is uploaded to the display it resets, connecting wifi, displaying connecting with Domoticz. In serial monitor i can see it is connecting to Domoticz, see attachment. But the display is not going to display homescreen, it hangs in "Connecting to Domoticz". I can then go back to an ealier test version, the homescreen is what i expect. But if i re-enter the wifi and ip settings in the latest test version it seems that somehow the data is corrupted.
Note: the latest (todays) test version and yesterdays test version have the same problem.

As a test, in a earier working test version i re-entered the wifi and ip settings, no problems.

Until now i didn't have problems with updating, the setting didn't change.

Yesterday's log was the log of the latest test version, first entered the wifi and ip settings, but after "getServerTime" the display resets and can't connect.

Hopefully this helps to find the problem
Attachments
SerialMon_after_upload_No_reset.doc
(16 KiB) Downloaded 114 times
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

So on your side, yo have the EPS32-8048S043C in landscape mode, so 800*600.
So need to use

Code: Select all

TFT_WIDTH = 800
TFT_HEIGHT = 600
All seem fine, and you have the firsts screen, so I don't think it's because of the hardware setting as you have access to the firsts screens ( configuration and "connectiong to domoticz")

And your logs are fines.
The application connect, load devices information, print "Application ready", and you have nothing at screen ?

Nothing special at screen, have you tried to touch the display in "blind" mode ?
it hangs in "Connecting to Domoticz"
So it's the last screen you can see ?

On navigation.cpp around line 53, can you comment this line

Code: Select all

    lv_obj_set_size(panel, TFT_WIDTH, TFT_HEIGHT);
But the previous command clear the screen, so you need to have a blank screen ...
A problem with the theme ?

You can reset the config in file global_config.h, line 6

Code: Select all

#define CONFIG_VERSION 3
If you change the number it will erase and remake the config.
But It mean you will need to re-enter values.
wim57
Posts: 27
Joined: Monday 25 September 2017 12:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by wim57 »

Hi Thorgal,

very nice project!
I tried the 'test' branch and found 2 small bugs:
- Changing the wake timeout seems to only have effect after reboot
- Removing a dft device (setting to 0) keeps showing the widget until reboot.

I also have a feature request:
for my energy counters (P1 smart meter) I'd like to show the CounterToday value instead of the Counter. CounterToday also contains the unit of measurement (kwh, m3). I'll see if I can change the code myself.

Apart from this your project looks very promising, thanks so far,
Wim Donker
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Hello, so new version online, on branch "test"
@Rik60 I have perhpas found your issue, it's because of new font, I forget the "return character", so if you have something to display on 2 lines, the application freeze.

- Corrected the freeze caused by new font.
- Correcting the wake up (happen if you switch from "disable" to any values
- Updating the homepage if a dft device is deleted.

For the counter, it's easy, you can take a look on the Rain sensor, make a search on

Code: Select all

"rain"
, for this device I ignore the "data" field but use instead the "rain" one.
The problem is I do that natively for the rain sensor, because it's more logic to use the daily value than a counter started somes month later.
But for the P1 smart meter, I think the total is more usefull nope ?

We can add a line to "data", but on my sensor I have already 6 values to display ...

But if you want to test on your side, mimic the "rain" code and use instead "CounterToday". The code is on 2 places.

Code: Select all

        //Special device
        char * data;
        if (i.containsKey("CounterToday"))
        {
           data = Cleandata(i["CounterToday"]);
        }
BTW @wim57 what is your hardware ?
Rik60
Posts: 88
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Ok. This helpt me. Display works again with the latest test version.
Question, were/how can i select the font?
In the widget "Weer Beneden Leeuwen" is a part of the text missing, there are 3 variables to display, the third line is partly visible.

thx
Attachments
Screen_fault.jpg
Screen_fault.jpg (242.05 KiB) Viewed 2425 times
wim57
Posts: 27
Joined: Monday 25 September 2017 12:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by wim57 »

Thorgal789 wrote: Thursday 04 April 2024 16:39 BTW @wim57 what is your hardware ?
esp32-2432S028R
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Question, were/how can i select the font?
Here they are loaded

Code: Select all

#if DEVICE_SIZE == 1
#define LV_FONT_MONTSERRAT_10 1
#define LV_FONT_MONTSERRAT_12 1
//#define LV_FONT_MONTSERRAT_14 0
#define LV_FONT_MONTSERRAT_16 0
#else
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 0
//#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 1
#endif
Here selected

Code: Select all

#if DEVICE_SIZE == 1
LV_FONT_DECLARE(Montserrat_Bold_14)
const lv_font_t font1 = Montserrat_Bold_14;
const lv_font_t font3 = lv_font_montserrat_12;
const lv_font_t font2 = lv_font_montserrat_10;
#else
LV_FONT_DECLARE(Montserrat_Bold_18)
const lv_font_t font1 = Montserrat_Bold_18;
const lv_font_t font3 = lv_font_montserrat_16;
const lv_font_t font2 = lv_font_montserrat_14;
#endif
And the 2 customs one are in the "font" folder. Before my last change, you was using the 18 pp but not bold, the new one have same size but bold attribute.

For the missing third line, there is probably something easier

Code: Select all

     /*Create Value*/
     // Does _local_ is working here ?
    lv_obj_t * label = lv_label_create(Button_icon);
    lv_obj_set_style_text_font(label, &font1, 0);
    lv_obj_set_style_text_color(label, color, 0);
    lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_RIGHT, 0);
    lv_obj_set_width(label, Size_w /2);
#if DEVICE_SIZE == 1
    lv_obj_set_height(label, 30);
#else
    lv_obj_set_height(label, 40);
#endif
Can increase the value in

Code: Select all

lv_obj_set_height(label, 40);
but take the minimal possible for your display. For information on small size we have only 2 lines, you have bigger one so can try with 3 lines, but idk how it will be. Else can decrease the size too, but it will impact all others stuff (you can use 2 time the lv_font_montserrat_16 to make tries)
Rik60
Posts: 88
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Thorgal789 wrote: Friday 05 April 2024 15:20
Can increase the value in

Code: Select all

lv_obj_set_height(label, 40);
Thx.
I increased 40 to 55. Thanks works for me.
Rik60
Posts: 88
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Hi,
Found a small bug, if selecting a bonuspage in platformio.ini, the building fails. Problem is a bracket in data_setup.ccp line 75.
Attachments
data_setup.ccp.jpg
data_setup.ccp.jpg (49.26 KiB) Viewed 2354 times
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

I increased 40 to 55. Thanks works for me.
Updated, do you have a capture to compare with your previous post ?
You are using 800*480 with 4*4 widget ?
Found a small bug, if selecting a bonuspage in platformio.ini, the building fails. Problem is a bracket in data_setup.ccp line 75.
Thx, updated too, still on branch "test"
Rik60
Posts: 88
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Thorgal789 wrote: Monday 08 April 2024 18:51
I increased 40 to 55. Thanks works for me.
Updated, do you have a capture to compare with your previous post ?
You are using 800*480 with 4*4 widget ?
Yes, i am using 800x480 with 4x4 widgets
Attachments
Display_4x4.jpg
Display_4x4.jpg (154.46 KiB) Viewed 2312 times
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

I don't see any changes on my side compared to the one here https://www.domoticz.com/forum/viewtopi ... 94#p315894
All devices with DDEVICE_SIZE > 1 have 800*480 so I think it's fine, thx.

Something to improve can be

Code: Select all

     /*Create Value*/
     // Does _local_ is working here ?
    lv_obj_t * label = lv_label_create(Button_icon);
    lv_obj_set_style_text_font(label, &font1, 0);
    lv_obj_set_style_text_color(label, color, 0);
    lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_RIGHT, 0);

#if DEVICE_SIZE == 1
    lv_obj_set_height(label, 30);
    lv_obj_set_width(label, Size_w /2);
#else
    lv_obj_set_height(label, 55);
    lv_obj_set_width(label, 2* Size_w /3);
#endif
You don't need it for the moment but can be usefull if you have more data (for exemple to display "HPA" for the pression)

For small device the text will take 50% of the widget width size
For big device it will take 66% of the widget width size.
Rik60
Posts: 88
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Thorgal789 wrote: Tuesday 09 April 2024 17:41 I don't see any changes on my side compared to the one here https://www.domoticz.com/forum/viewtopi ... 94#p315894
All devices with DDEVICE_SIZE > 1 have 800*480 so I think it's fine, thx.

Something to improve can be

Code: Select all

     /*Create Value*/
     // Does _local_ is working here ?
    lv_obj_t * label = lv_label_create(Button_icon);
    lv_obj_set_style_text_font(label, &font1, 0);
    lv_obj_set_style_text_color(label, color, 0);
    lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_RIGHT, 0);

#if DEVICE_SIZE == 1
    lv_obj_set_height(label, 30);
    lv_obj_set_width(label, Size_w /2);
#else
    lv_obj_set_height(label, 55);
    lv_obj_set_width(label, 2* Size_w /3);
#endif
You don't need it for the moment but can be usefull if you have more data (for exemple to display "HPA" for the pression)

For small device the text will take 50% of the widget width size
For big device it will take 66% of the widget width size.
I have downloaded the latest test version and modified as suggested. Now the hPa is also displayed.
The display i use has 18MB Flash and 8MB PSRAM, but is not found?
Attachments
Display_4x4_ok.jpg
Display_4x4_ok.jpg (200.39 KiB) Viewed 2229 times
Display_settings_info_1.jpg
Display_settings_info_1.jpg (132.46 KiB) Viewed 2229 times
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Thx, I will add it in future build.

For the psram, in "build_flags", add

Code: Select all

	-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue  ; Enable PSRAM in code
This is sure at 99% https://thingpulse.com/esp32-how-to-use-psram/

You can need too some stuff like

Code: Select all

board_build.psram = enable  ; Enable PSRAM
board_build.psram_config = ${platform}_${board} 8MB  ; Set PSRAM size to 8MB
But this was untested yet. You can compare with the "4848S040", but it's not tested.
wim57
Posts: 27
Joined: Monday 25 September 2017 12:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by wim57 »

The latest test branch does not work on my esp32-2432S028R. Even after erasing flash it shows a malformed display.
Thorgal789
Posts: 849
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Strange, its the only device I can test, and it work on my side.
Have just updated the "test" branch to be sure, but there is nothing than can impact it. There is no important change since the last time you have tried it.
What are you calling "after erasing flash"

How is the display ? do you have a capture ? There is somesetting but they can impact only the color, I don't think the "rotation" provoque that too....
wim57
Posts: 27
Joined: Monday 25 September 2017 12:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by wim57 »

I tried with another unit and everything was fine, so maybe I made some mistake the first time.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest