Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LVGL calibrate touch screen #14459

Merged
merged 1 commit into from
Jan 15, 2022

Conversation

s-hadinger
Copy link
Collaborator

@s-hadinger s-hadinger commented Jan 15, 2022

Description:

Tasmota Application useful for Touch Screen calibration (resistive touchscreens only). This application guides you through simple steps and generates automatically the required settings in display.ini (the ':M' line).

Download here

  1. First download DisplayCalibrate.tapp application and upload it in the file system, and restart.

  2. Make sure you are in orientation DisplayRotate 0

  3. In the console, type the command DisplayCalibrate

You will see the following screens. Click on all 4 crosses near corners.

ts_0

ts_1_0

ts_1_1

ts_1_2

ts_1_3

Note: measures are taken every 50 ms and are averaged, and requires at least 3 measures (150ms).

If everything went well, you will see the following screen. After reboot, your touchscreen is ready and calibrate.

ts_ok

If the geometry is wrong, you will see the following screen and no change is done to display.ini

ts_nok

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The code change is tested and works with Tasmota core ESP32 V.2.0.2
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@s-hadinger s-hadinger merged commit c5e4d2b into arendst:development Jan 15, 2022
@Jason2866
Copy link
Collaborator

COOL

@michael-bartmann
Copy link

Yes, cool. The first app I ran on tasmota. Still it fails for me (AZ-Touch MOD). After running through all 4 screens and pressing the cross, the device reboots with flickering of a white screen screen and display.ini is not modified. When setting log level to 4, I still see some events like:
20:54:56.561 TS : touched x=24 y=19 (raw x=3680 y=528).

@s-hadinger
Copy link
Collaborator Author

Please provide full logs of the calibration process

@s-hadinger
Copy link
Collaborator Author

And please provide also your display.ini file

@michael-bartmann
Copy link

michael-bartmann commented Jan 27, 2022

00:00:00.003 HDW: ESP32-D0WDQ6 
00:00:00.003 HDW: FoundPSRAM=0 CanUsePSRAM=0
00:00:00.021 UFS: FlashFS mounted with 280 kB free
00:00:00.046 CFG: Loaded from File, Count 64
00:00:00.056 QPC: Count 1
00:00:00.059 SPI: Hardware using GPIO18(CLK), GPIO23(MOSI) and GPIO19(MISO)
00:00:00.061 ROT: Mode 1
00:00:00.063 BRY: GC from 1439 to 1439 bytes, objects freed 0/1 (in 0 ms)
00:00:00.071 BRY: GC from 3873 to 3241 bytes, objects freed 5/23 (in 1 ms)
00:00:00.156 CFG: No '*.autoconf' file found
00:00:00.161 BRY: GC from 5507 to 4721 bytes, objects freed 5/41 (in 1 ms)
00:00:00.162 BRY: Berry initialized, RAM used=4721 bytes
00:00:00.172 BRY: No 'preinit.be'
00:00:00.190 DSP: File descriptor used
00:00:00.192 TS: XPT2046
00:00:01.358 SRC: Display
00:00:01.363 RSL: RESULT = {"POWER":"ON"}
00:00:01.364 RSL: POWER = ON
00:00:01.366 DSP: Configured display 'ILI9341'
00:00:01.972 SRC: Restart
00:00:01.977 Project tasmota - AZ-Touch-Mod Version 2022.01.3(lvgl)-2_0_2_1(2022-01-27T15:54:45)
00:00:02.042 TAP: Loaded Tasmota App 'DisplayCalibrate.tapp'
00:00:02.164 BRY: No 'autoexec.be'
00:00:02.422 WIF: Checking connection...
00:00:02.423 WIF: Attempting connection...
00:00:02.881 WIF: Connecting to xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
00:00:02.719 WIF: Checking connection...
00:00:02.720 WIF: Attempting connection...
00:00:04.365 WIF: Checking connection...
00:00:04.366 WIF: Attempting connection...
00:00:04.365 WIF: Checking connection...
00:00:04.366 WIF: Attempting connection...
00:00:06.719 WIF: Checking connection...
00:00:06.720 WIF: Connected
00:00:06.928 HTP: Web server active on aztouch with IP address xxxxxxxxxxxxxxxxxxxxxxxxxx
00:00:07.221 NTP: Synch time...
00:00:07.280 RTC: UTC 2022-01-27T21:42:27, DST 2022-03-27T02:00:00, STD 2022-10-30T03:00:00
22:42:27.000 NTP: Synched
22:42:27.657 MQT: Attempting connection...
22:42:28.434 MQT: TLS connected in 493 ms, stack low mark 2052
22:42:28.435 MQT: MFLN not supported by TLS server
22:42:28.436 MQT: Server fingerprint: 42 53 5A 47 C3 0D FE C3 D3 F2 AA DC D9 C4 1B 1B B1 A9 3F 8D
22:42:28.436 MQT: Connected
22:42:28.443 MQT: tele/aztouch/LWT = Online (retained)
22:42:28.446 MQT: cmnd/aztouch/POWER = 
22:42:28.448 MQT: Subscribe to cmnd/aztouch/#
22:42:28.451 MQT: Subscribe to cmnd/tasmotas/#
22:42:28.457 MQT: Subscribe to cmnd/aztouch_fb/#
22:42:28.464 MQT: tele/aztouch/INFO1 = {"Info1":{"Module":"AZ-Touch MOD","Version":"2022.01.3(lvgl)","FallbackTopic":"cmnd/aztouch_fb/","GroupTopic":"cmnd/tasmotas/"}}
22:42:28.481 MQT: tele/aztouch/INFO2 = {"Info2":{"WebServerMode":"Admin","Hostname":"aztouch","IPAddress":"xxxxxxxx"}}
22:42:28.488 MQT: tele/aztouch/INFO3 = {"Info3":{"RestartReason":"Software reset CPU"}}
22:42:28.504 MQT: stat/aztouch/RESULT = {"POWER":"ON"}
22:42:28.511 MQT: stat/aztouch/POWER = ON
22:42:28.517 TFS: File 'autoexec.bat' not found
22:42:29.186 QPC: Reset
22:42:31.179 APP: Boot Count 25
22:42:31.890 CFG: Saved, Count 65, Bytes 4096
22:42:32.202 BRY: GC from 8188 to 5236 bytes, objects freed 34/59 (in 1 ms)
22:42:32.213 MQT: tele/aztouch/STATE = {"Time":"2022-01-27T22:42:32","Uptime":"0T00:00:11","UptimeSec":11,"Heap":152,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":34,"MqttCount":1,"Berry":{"HeapUsed":5,"Objects":59},"POWER":"ON","Wifi":{"AP":1,"SSId":"xxxxxxxx","BSSId":"xxxxxxxxxx","Channel":1,"Mode":"11n","RSSI":64,"Signal":-68,"LinkCount":1,"Downtime":"0T00:00:05"}}
22:42:32.258 MQT: tele/aztouch/SENSOR = {"Time":"2022-01-27T22:42:32","ESP32":{"Temperature":48.9},"TempUnit":"C"}
22:42:33.370 HTP: Main Menu
22:42:47.869 WIF: Checking connection...
22:42:49.072 HTP: Consoles
22:42:51.117 HTP: Console
22:42:59.176 CMD: DisplayRotate 0
22:42:59.178 SRC: WebConsole from 192.168.1.162
22:42:59.179 CMD: Grp 0, Cmnd 'DISPLAYROTATE', Idx 1, Len 1, Data '0'
22:42:59.188 MQT: stat/aztouch/RESULT = {"DisplayRotate":0}
22:43:02.426 CMD: displaycalibrate
22:43:02.428 SRC: WebConsole from 192.168.1.162
22:43:02.429 CMD: Grp 0, Cmnd 'DISPLAYCALIBRATE', Idx 1, Len 0, Data ''
22:43:02.669 BRY: GC from 10480 to 9201 bytes, objects freed 9/124 (in 1 ms)
22:43:02.712 BRY: GC from 18553 to 17009 bytes, objects freed 28/226 (in 2 ms)
22:43:02.742 MQT: stat/aztouch/RESULT = {"DisplayCalibrate":"Done"}
22:43:02.837 LVG: LVGL initialized
22:43:02.839 SRC: Berry
22:43:02.841 CMD: Grp 0, Cmnd 'DISPLAYROTATE', Idx 1, Len 0, Data ''
22:43:02.850 MQT: stat/aztouch/RESULT = {"DisplayRotate":0}
22:43:02.906 LVG: Refreshed 12800 pixels in 6 ms (2133 pix/ms)
22:43:02.915 LVG: Refreshed 12800 pixels in 6 ms (2133 pix/ms)
22:43:02.927 LVG: Refreshed 12800 pixels in 6 ms (2133 pix/ms)
22:43:02.936 LVG: Refreshed 12800 pixels in 6 ms (2133 pix/ms)
22:43:02.945 LVG: Refreshed 12800 pixels in 6 ms (2133 pix/ms)
22:43:02.953 LVG: Refreshed 12800 pixels in 7 ms (1828 pix/ms)
22:43:04.953 LVG: Refreshed 12740 pixels in 6 ms (2123 pix/ms)
22:43:05.666 BRY: GC from 27281 to 16878 bytes, objects freed 101/257 (in 5 ms)
22:43:06.692 TS : touched x=26 y=221 (raw x=3662 y=3547)
22:43:06.792 TS : touched x=24 y=223 (raw x=3679 y=3573)
22:43:06.892 TS : touched x=25 y=224 (raw x=3674 y=3583)
22:43:06.993 TS : touched x=23 y=224 (raw x=3687 y=3582)
22:43:07.092 TS : touched x=23 y=222 (raw x=3692 y=3559)
22:43:07.299 LVG: Refreshed 12740 pixels in 6 ms (2123 pix/ms)
22:43:07.315 LVG: Refreshed 12441 pixels in 6 ms (2073 pix/ms)
22:43:08.077 WIF: Checking connection...
22:43:08.372 BRY: GC from 27119 to 16777 bytes, objects freed 232/255 (in 11 ms)
22:43:08.390 TS : touched x=306 y=219 (raw x=557 y=3512)
22:43:08.490 TS : touched x=306 y=219 (raw x=554 y=3519)
22:43:08.590 TS : touched x=306 y=220 (raw x=555 y=3532)
22:43:08.691 TS : touched x=306 y=220 (raw x=553 y=3523)
22:43:08.790 TS : touched x=306 y=220 (raw x=560 y=3532)
22:43:08.990 LVG: Refreshed 12441 pixels in 7 ms (1777 pix/ms)
22:43:09.004 LVG: Refreshed 12740 pixels in 6 ms (2123 pix/ms)
22:43:10.095 TS : touched x=24 y=20 (raw x=3680 y=538)

@michael-bartmann
Copy link

:H,ILI9341,320,240,16,SPI,1,*,*,*,*,*,*,*,40
:S,2,1,1,0,40,20
:I
EF,3,03,80,02
CF,3,00,C1,30
ED,4,64,03,12,81
E8,3,85,00,78
CB,5,39,2C,00,34,02
F7,1,20
EA,2,00,00
C0,1,23
C1,1,10
C5,2,3e,28
C7,1,86
36,1,48
37,1,00
3A,1,55
B1,2,00,18
B6,3,08,82,27
F2,1,00
26,1,01
E0,0F,0F,31,2B,0C,0E,08,4E,F1,37,07,10,03,0E,09,00
E1,0F,00,0E,14,03,11,07,31,C1,48,08,0F,0C,31,36,0F
11,80
29,80
:o,28
:O,29
:A,2A,2B,2C
:R,36
:0,28,00,00,00
:1,88,00,00,01
:2,E8,00,00,02
:3,48,00,00,03
:i,20,21
:TS,*
:M,3946,401,241,3828
#

@michael-bartmann
Copy link

michael-bartmann commented Jan 27, 2022

22:43:08.691 TS : touched x=306 y=220 (raw x=553 y=3523)
22:43:08.790 TS : touched x=306 y=220 (raw x=560 y=3532)
22:43:08.990 LVG: Refreshed 12441 pixels in 7 ms (1777 pix/ms)
22:43:09.004 LVG: Refreshed 12740 pixels in 6 ms (2123 pix/ms)
22:43:10.095 TS : touched x=24 y=20 (raw x=3680 y=538)

I am not sure if this is really the end of what could be logged; maybe some trailing lines have been lost due to reboot and lack of sync with the web console. Unfortunately it is not trivial to use serial log on that device, because there is a power conflict with the USB connector when the device is running with its own supply.

@s-hadinger
Copy link
Collaborator Author

s-hadinger commented Jan 27, 2022

Ah too bad. The interesting part was lost just before reboot. The :M line should have been updated by the calibration process.

I may have an idea why it failed. I need to do more tests tomorrow

@michael-bartmann
Copy link

michael-bartmann commented Jan 27, 2022

There is one circumstance to mention. In the few demo applications I have run so far, including the berry demo, the screen and colors locked "clean". But the white background of the calibration screen has some disturbance (dim black lines/patterns flickering a bit). I assume this is not related to the issue with calibration app, but you never know...

@s-hadinger
Copy link
Collaborator Author

I did some more tests and I can't reproduce.

I can't explain the flickering either, DisplayCalibrate does nothing fancy except setting a white background

@michael-bartmann
Copy link

I've not found docs about tapps yet. Are these just Berry scripts with their name mapped to a tasmota command? If so, maybe I could execute the calibration step by step over berry console to isolate where my device misbehaves.

@s-hadinger s-hadinger deleted the display_calibrate branch January 6, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants