ESP32-S3 4.3inch Capacitive Touch Display from - waveshare

so i was looking into this for backlight control

CH422G - - - - - -
EXIO1 TP_RST
EXIO2 DISP
EXIO3 LCD_RST
EXIO4 SD_CS
EXIO5 USB_SEL(LOW) USB_SEL(HIGH)

so i tried this

  - platform: gpio
    name: CH422G Pin 2
    pin:
      ch422g: ch422g_hub
      number: 2
      mode:
        output: true
      inverted: true

and it indeed turns the backlight off when i turn this switch off on the devices web portal… and only does that while the switch is on… i can still use the touchscreen and control things, but when i turn the switch off to turn the lcd back on it resets the device? im on the right track cos when i do the same thing with pin 1 on the 422g i get error messages about the touchscreen chip not responding and exio1 is listed as tp rst… so is pin 2 supposed to be the backlight control or not? on the wiki they show a code snippet that seems to use an lvgl function? should i be defining the backlight in the display section??? im kinda nooby to all this stuff too

That pin does control the backlight, but also the display enable itself, so it’s not really useful for turning off the backlight. I’d suggest you set it as the enable pin in the display config:

    reset_pin:
      ch422g: io_ex
      number: 3
    enable_pin:
      ch422g: io_ex
      number: 2

and wire a real GPIO to the backlight control - see here for details:

hmm that link doesnt work for me… and i prefer to use forums anyway… discord is a blight on knowledge and is literally the biggest hurdle to internet archiving today… im just astounded that the docs tell us to use the io expander to control the backlight and that makes it reset?.. like i get that you said its also connected to display enable… but i dont see why that should reset the esp

Tough crowd tonight.

sorry i shouldnt have ranted about discord lol… but i mainly just wanted to know is it supposed to reset the esp when the display enable changes?

I have no idea.

If however your real question is “Am I doing something wrong that makes it reset” then the answer AFAIK is no, you are not. That’s just what it appears to do if you mess with the DISP control, so the only solution is “Don’t do that”.

Just tried that, and for me it seems to work pretty well. I don’t need dimming, and disabling the Display might have another advantage, as the Display itself also turns off and no wear leveling is needed. If you turn the Backlight back on the display itself does a reinitialisation and redraw automagically, which is exactly what I want.

You can also get rid of that inversion if you set the restore mode to always on. ( seems that on initial boot it needs a certain state, otherwise changing the backlight only works for one time, then stays on or off.)

ch422g:
  - id: ch422g_hub

switch:
  - platform: gpio
    name: backlight
    pin:
      ch422g: ch422g_hub
      number: 2
      mode:
        output: true
      inverted: False
    restore_mode: ALWAYS_ON

Btw.: it somehow seems that the ch422g integration does not accept an address anymore, but it works fine without.

Correct - it never used the address before anyway.

Does anyone know of a decent case for these by any chance?

If you own a 3D printer

2 Likes