HASwitchPlate / openHASP

HomeAutomation Switchplate based on lvgl for ESP32
https://www.openhasp.com
MIT License
694 stars 177 forks source link

Support for backlight on Makerfab ESPTFT35(CA) #335

Closed mmccool closed 2 years ago

mmccool commented 2 years ago

Is your feature request related to a problem? Please describe. Currently openHASP can't control the backlight on the Makerfabs ESPTFT35(CA) board. It's true that the standard board as-shipped is always-on, BUT backlight control can (theoretically) be enabled by soldering two pads together (marked R31 on the board). Technically a 0 Ohm resistor should be used, but a blob of solder or a small wire would (probably) also do the trick. This connects GPIO1 to the backlight control on the display, which means you cannot use TX in the UART (uses the same pin) and therefore disables serial debugging, but no big deal. See https://github.com/Makerfabs/Project_Touch-Screen-Camera/issues/8

Describe the solution you'd like A flag or some build-time configuration option (disabled by default) to allow backlight control using PWM on GPIO1.

Describe alternatives you've considered Well, I could go in and try to hack the code myself, and then try to upstream it to benefit others, but I'm lazy. If someone points me in the right direction though I can test a solution. I happen to have two boards so I will modify one and leave the other one alone for test purposes. I already have openHASP running on the board and integrated with Home Assistant.

Additional context This page should also be updated to note that backlight control can be added with a little soldering and configuring, assuming it can be made to work: https://openhasp.haswitchplate.com/0.6.2/devices/makerfabs-tft-touch/

fvanroie commented 2 years ago

I discovered that resistor in the schematics but didn't find it very useful at the time. While technically it can be done, I haven't tested this as I'm not that precise with a soldering iron.

It's not just the debug output as flashing of the ESP32 over UART could be affected too. I'm not sure if that will still work after the resistor is soldered on. Granted that you can upload firmware via OTA but it makes recovery a lot harder. Have you tested flashing the ESP32 with the blob on?

Before delving into the code, I would suggest:

I haven't tried the blob, but that could work. The Web UI won't reflect the selected backlight pin, but that's window dressing which we can address if it works.

mmccool commented 2 years ago

Hmm. Good point about flashing. Let me set up OTA first then (BTW the instructions on how to configure that could be better; I guess it's automatic but there are some OTA options in the configuration include file that I don't know what to do with... if anything). True, I could just set up the PIN as a GPIO without changing the firmware, so let me try as you suggest first to test. Soldering in that resistor is likely to be a bit of a pain but seems doable. Really wish they had provided a jumper, but oh, well. I will have to think if there is some way to solder in something easily switchable...

(Edit: I just realized you created the original issue in the Makerfab repo on this :))

fvanroie commented 2 years ago

Did you have a chance to test UART with the backlight blob on?