Hi, I am working to make the Button+ in ESPHome. The Button+ knows multiple configurations with in the max 7 displays, 6 of them are the same type.
My problem is that is if I define 6 displays, I run in to ram problems the device does not have PSRAM so this is not an option… So I discussed this problem with the owner and he suggested to update the displays 1 by 1 by cycling through the CS pins. Like this:
- id: cs_pin_bar_left
platform: gpio
pin:
mcp23xxx: base_J3
number: 5
mode:
output: true
inverted: true
- id: cs_pin_bar_right
platform: gpio
pin:
mcp23xxx: base_J3
number: 1
mode:
output: true
inverted: false
display:
- id: bar_display
platform: ili9xxx
model: ST7735
color_order: bgr
update_interval: never
dc_pin:
number: GPIO37
allow_other_uses: true
invert_colors: false
show_test_card: false
dimensions:
height: 160
width: 80
offset_width: 24
script:
- id: update_bar1_right
then:
- lambda: |-
id(cs_pin_bar_left).turn_on();
id(cs_pin_bar_right).turn_off();
id(bar_display).fill(id(orange));
id(bar_display).update();
delay(10);
id(cs_pin_bar_right).turn_on();
For some reason if I execute the update_bar1_script
the display stays black. I asumed the we have a timing issue, so I am trying to use the set_cs_pin()
method form the ili9xxx display component
something like this below:
I am not an C++ expert, but by searching the web, this is where I landed ;). It is giving me a hard time…
- id: update_bar_left
then:
- lambda: |-
auto pin = esphome::mcp23xxx_base::MCP23XXXGPIOPin();
pin.set_parent(base_J3);
pin.pin_mode(esphome::gpio::Flags::FLAG_OUTPUT);
pin.setup();
esphome::GPIOPin* newpin = pin;
id(bar_display).set_cs_pin(newpin);
id(bar_display).fill(id(orange));
id(bar_display).update();
But I have the feeling that the GPIOPin class seems not to be meant to be used on this level…
Any suggestions?
Thanks in advanced