thorrak / tiltbridge

Tilt Hydrometer to WiFi Bridge
http://www.tiltbridge.com/
Other
61 stars 27 forks source link

Reset TFT Display on Orientation Change #95

Closed lbussy closed 3 years ago

lbussy commented 3 years ago

Need to figure out a way to reset the TFT display upon a change in the orientation. I raised a question in the TFT Lib discussion area.

lbussy commented 3 years ago

Solved:

The library class for the TFT has no destructor and thus can not be "ended". The rationale was that if a TFT is connected then the instance can be global as it is unlikely the dislay will only be used once. The memory footprint is quite low compared to the RTOS etc on an ESP32 so I have never seen the need to end the library instance.

You can change the rotation at any time, (example) you do not need to stop and start with a new instance. The display can be re-initialised by calling tft.begin() again as there is a boot lock that only runs part of the initiailisation the second time it is called. This permits the display to be powered down and restarted later.

Need to put this in the reinit reoutine.