meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
3.3k stars 800 forks source link

[Bug]: TFT Screens don't honor the flip screen display config value #3101

Closed garthvh closed 7 months ago

garthvh commented 8 months ago

Category

Hardware Compatibility

Hardware

T-Watch

Firmware Version

2.2.18

Description

I need to flip my twatch screen and the flip screen vertically config option is not doing anything.

Relevant log output

No response

mverch67 commented 7 months ago

The issue appears in 2.2.17 where the following changes were made in Screen.h: image

While it looks nice and clean to use the baseclass pointer it unfortunately does not work anymore, because the OLEDDisplay baseclass is poorly designed as it does not use virtual function declarations (especially in this case flipScreenVertically()). That means now OLEDDisplay::flipScreenVertically() is called instead of TFTDisplay::flipScreenVertically().

There are three possible solutions to fix this: (1) revert this change (but use pointers as required now in this commit) (2) Change the library OLEDDisplay to use virtual function declarations (e.g. fork into meshtastic repository) (3) Use this ugly "hack" in Screen.cpp#1055 (and maybe at other yet undetected broken places)

#if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014)
    static_cast<TFTDisplay *>(dispdev)->flipScreenVertically();
#endif

@jp-bennett