I introduced the connection to the web server, so in the preferences you can set both the FTP connection and the Web Server, which can both be active at the same time, the connection to both starts when you connect Esp to WiFi.
To limit battery consumption (if Esp is not connected to the USB) I have introduced a sleep timer (the time in seconds is set in the preferences).
After considering the various types of sleep that can be used, I decided to use a Light Sleep which simply decreases the frequency of the CPU (80 Mhz against 240 Mhz in normal use) and lowers the brightness of the screen to 0 ( always if you use the touch screen led power supply via the PWM pin and not directly at 3.3 Volts).
In this way Esp32 is reactivated the next time you press the screen, and the WiFi connection remains active.
Below 80 Mhz (it can also be set to 20) the touch screen stops responding. As far as I understand (and tried), the other Deep Sleep modes deactivate the wifi and the touch screen, so they must be reactivated with an external button.
Sleep works like this: as long as there is activity in the screen handler a variable is updated with the current time, when this value is exceeded in the main loop (with the addition of the time set in the preferences) Esp32 goes into sleep.
If you want to disable Sleep mode, just set the variable in the preferences to 0 (or even leave the field blank).
I also introduced another variable to take the screenshot without using the serial (always in the preferences).
In order not to put other conditions in the main loop, the ScreenShot variable is linked to the sleep timer, so if for example you have 30 seconds in the sleep timer and you set the Screenshot variable to ON (capital letters), you have 30 seconds to position yourself on the screen you want to screenshot, and a message appears confirming that the screenshot has been saved to SPIFFS.
The screenshot variable is reset to OFF automatically so that no more screenshots are taken the next time the screen is reactivated … after transferring the image with FTP you can take another screenshot by resetting the variable to ON in the preferences.
I started using the CMDs that can always be set in the preferences and put an example of their use.
For now, a long press in the cell with the inscription CMD 01 displays a text file present on SPIFFS (index.html) in a form Text Area which is relative to the container of the preferences table.
In the text area words can be selected and highlighted.
I haven’t done it yet, but if you put an Eventhandler connected to this text area, perhaps with a Long press, you can call up the keyboard with the selected text, edit it and save the changes to SPIFFS.
see you next time … and I always hope this will help someone
bye
and remember to put the new preferences and the index.html file in the data subdirectory in the .zip file on your SPIFFS
33.zip (227.9 KB)