Smanar / CYD-Domoticz-Remote

WIP project to control your home-automation using Domoticz and a CYD (Cheap touchscreen).
9 stars 2 forks source link

Support for ESP32-4848S040 #4

Closed franki29 closed 7 months ago

franki29 commented 7 months ago

Hi, I just bought a ESP32-4848S040

https://github.com/Mboukhal/4.0inch_ESP32-4848S040

https://github.com/arendst/Tasmota/discussions/20527

Do you think you can make it work for your Software?

Br. Frank

franki29 commented 7 months ago

Starting application Config version: 0 Clearing Global Config

With no debug on

franki29 commented 7 months ago

So it is stopping after clearing config

Smanar commented 7 months ago

So there is no more crash, but not working ? Or it freeze now ?

After "Clearing Global Config" it set the display, so the touchpad and the display.

Or you mean with all debug disabled ?

Smanar commented 7 months ago

Ok so this time was my fault. Have re write the touch code for all device, It will still crashing I think, but this time we will have logs.

Can you tell me how it s with debug disabled ? all are enabled by defaut, so no crash at first try.

franki29 commented 7 months ago

Starting application Config version: 3 Init 911 driver

44444444444

Driver GT911 started: (480x480) 888888888 Check ACK on addr request on 0x 5D : SUCCESS 9999999999 Starting calibration Calibration coef: inf , inf Calibration offset: nan , nan Display buffer size: 24576 bytes Screen init done WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected

franki29 commented 7 months ago

So when I try to select the network, nothing is happening

Smanar commented 7 months ago

Ok so it mean all was my fault, sorry, was not a problem with your device (at least for the touchpad). Now we have all logs, and the lib is running without crash. So I think this lib can work now, I have updated the code again

Starting calibration
Calibration coef: inf , inf
Calibration offset: nan , nan

If all is fine you will have value now here, else I m wrong again on my side. And thx for your patience.

franki29 commented 7 months ago

Now calibartion is not shown.

Build:Mar 27 2021 rst:0x1 (POWERON),boot:0x18 (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3808,len:0x128 load:0x403c9700,len:0xb90 load:0x403cc700,len:0x28cc entry 0x403c98b8 Starting application Config version: 3 Init 911 driver

Driver GT911 started: (480x480) Check ACK on addr request on 0x 5D : SUCCESS Display buffer size: 24576 bytes Screen init done WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected WiFi Status: Disconnected

Smanar commented 7 months ago

Yes it's normal, it's because you had bad value but the calibration was finished on your previous test, so the device don't ask for it again.

On Platformio.ini file.

-DFORCECALIBRATE=true # Reset the calibration at every restart, used to reset it after a config change.

If you want I can make a special branch in "franki" with code specific to your device, insteod of using the "test" branch, but for me we are realy close the end.

franki29 commented 7 months ago

OK I tried but still I can not select a network. After calibration of the screen, touch is not working anymore

franki29 commented 7 months ago

: SUCCESS Starting calibration Calibration coef: 0.9 , 0.9 Calibration offset: 13.5 , 6.8 Display buffer size: 24576 bytes Screen init done WiFi Status: Disconnected WiFi Status: Disconnected

Smanar commented 7 months ago

Value don't look so bad. There is an hidden tool in the code in the screen driver.cpp file


#if 0
//Tool to test the touchpad, need to be disabled, only for debug purpose
while (true)
{
    p = touchscreen.getPoint();
    p.x = round((p.x * global_config.screenCalXMult) + global_config.screenCalXOffset);
    p.y = round((p.y * global_config.screenCalYMult) + global_config.screenCalYOffset);

    tft.drawFastHLine(p.x,p.y,2,TFT_RED);
}
#endif

Just replace #if 0 by #if 1 It will block the code, but just after the calibration, you will be able to "color a pixel" with pressing the display, usefull to see if the screen is not reversed, or a bad scale.

Edit: Wait a little, have found a problem.

Smanar commented 7 months ago

Have upodated the code again, you can let -DFORCECALIBRATE=false

for me your last try was fine.

franki29 commented 7 months ago

Bingo, now it is working:-) Thank you very much

Smanar commented 7 months ago

Ha finally ^^. I let you make tries, according your resolution, I think thoses one need to be adpated

    -DTOTAL_ICONX=3 # How many icon widht
    -DTOTAL_ICONY=3 # How many icon Heigh
    -DDEVICE_SIZE=1 # Device display size

And I think soon, you will want to use the relay.

franki29 commented 7 months ago

Hi, no I do not want to use the relay as the size of the device does not fit in European wall plugs and it does not have CE

franki29 commented 7 months ago

But you can use the device separate from the relays part. Only for the power I have to think what solution I will go with. I do not want to use the USB for Power, so I want to use a mini Power Supply that fit into the wall whole.

Smanar commented 7 months ago

Ha yes, this one don't need power module. I live in France and we can found square box or round but bigger https://www.elecproshop.com/12687-boite-de-derivation-cloisons-seches-ronde-diam-85.html?srsltid=AfmBOoqDipySMQ4TyZtUUFsx-kz9igAN74-KVhat4SJe0qQvd7a6TCfkQQA