nebulous / infinitesp

ESP32 implementation of Carrier thermostat RS485 "ABCD bus"
MIT License
3 stars 0 forks source link

esp32-box-lite display configuration in esphome/platformio #2

Open nebulous opened 1 year ago

nebulous commented 1 year ago

I'm trying to get my esp32-s3-box-lite's display to work via esphome using the built-in st7789v configuration. I'm hoping that someone more familiar with display configuration in esphome can identify whatever it is I'm missing.

I can confirm that the display works correctly when compiling example apps directly using esp-idf, but ideally I'd like to keep this in the esphome ecosystem to make things simpler for me and anyone else who going to use it.

What follows is my configuration (common just contains wifi ssid/creds common to all of my esphome projects) pin numbers are gleaned from the esp-box bsp files, which corroborate with the published device schematics like so:

image


substitutions:
  name: infinitesp

esphome:
  name: $name

esp32:
  board: esp32s3box
  variant: esp32s3
  framework:
    type: arduino
    version: dev
    platform_version: 5.3.0

<<: !include common.yaml

time:
  - platform: homeassistant
    id: ha_time

sensor:
  - platform: adc
    pin: GPIO1
    name: "front buttons"

i2c:
  scl: GPIO18
  sda: GPIO8
  scan: true

psram:
spi:
  clk_pin: GPIO7
  mosi_pin: GPIO6

display:
  - platform: st7789v
    model: custom
    backlight_pin:
        number: GPIO45
        inverted: true
    cs_pin: GPIO5
    dc_pin: GPIO4
    reset_pin: GPIO48
    width: 320
    height: 240
    offset_height: 0
    offset_width: 0
    lambda: |-
      it.rectangle(0,0,it.get_width(),it.get_height(),id(c_green));
      //it.image(0, 0, id(my_image));

color:
  - id: c_green
    red: 0%
    green: 100%
    blue: 0%

image:
  - file: "image.png"
    id: my_image
    type: RGB24
nebulous commented 1 year ago
INFO Successfully uploaded program.
INFO Starting log output from /dev/cu.usbmodem1401 with baud rate 115200
[16:23:21]load:0x403cc700,len:0x2920
[16:23:21]entry 0x403c98d8
[16:23:21]E (192) esp_core_dump_flash: No core dump partition found!
[16:23:21]E (192) esp_core_dump_flash: No core dump partition found!
[16:23:21][I][logger:258]: Log initialized
[16:23:21][C][ota:469]: There have been 1 suspected unsuccessful boot attempts.
[16:23:21][D][esp32.preferences:113]: Saving 1 preferences to flash...
[16:23:21][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[16:23:21][I][app:029]: Running through setup()...
[16:23:21][I][i2c.arduino:175]: Performing I2C bus recovery
[16:23:21][C][spi:023]: Setting up SPI bus...
[16:23:21][C][adc:044]: Setting up ADC 'front buttons'...
[16:23:21][C][adc:083]: ADC 'front buttons' setup finished!
[16:23:21][C][st7789v:010]: Setting up SPI ST7789V...
[16:23:22][C][wifi:037]: Setting up WiFi...
[16:23:22][C][wifi:038]:   Local MAC: F4:12:FA:D9:90:B0
[16:23:22][D][wifi:386]: Starting scan...
[16:23:22][D][sensor:127]: 'front buttons': Sending state 0.94000 V with 2 decimals of accuracy
[16:23:28][D][wifi:401]: Found networks:
[16:23:28][I][wifi:257]: WiFi Connecting to 'IoTubes'...
[16:23:30][I][wifi:518]: WiFi Connected!
[16:23:30][C][wifi:362]:   Local MAC: F4:12:FA:D9:90:B0
[16:23:30][C][wifi:363]:   SSID: 'IoTubes'
[16:23:30][C][wifi:364]:   IP Address: 192.168.1.91
[16:23:30][C][wifi:366]:   BSSID: FC:EC:DA:BA:6F:1A
[16:23:30][C][wifi:367]:   Hostname: 'infinitesp'
[16:23:30][C][wifi:369]:   Signal strength: -63 dB ▂▄▆█
[16:23:30][C][wifi:373]:   Channel: 1
[16:23:30][C][wifi:374]:   Subnet: 255.255.255.0
[16:23:30][C][wifi:375]:   Gateway: 192.168.1.1
[16:23:30][C][wifi:376]:   DNS1: 192.168.1.3
[16:23:30][C][wifi:377]:   DNS2: 0.0.0.0
[16:23:30][D][wifi:527]: Disabling AP...
[16:23:30][C][web_server:092]: Setting up web server...
[16:23:30][C][ota:093]: Over-The-Air Updates:
[16:23:30][C][ota:094]:   Address: infinitesp.local:3232
[16:23:30][C][api:025]: Setting up Home Assistant API server...
[16:23:30][I][app:062]: setup() finished successfully!
[16:23:30][I][app:102]: ESPHome version 2022.11.5 compiled on Jan  9 2023, 16:23:06
[16:23:30][C][wifi:504]: WiFi:
[16:23:30][C][wifi:362]:   Local MAC: F4:12:FA:D9:90:B0
[16:23:30][C][wifi:363]:   SSID: 'IoTubes'
[16:23:30][C][wifi:364]:   IP Address: 192.168.1.91
[16:23:30][C][wifi:366]:   BSSID: FC:EC:DA:BA:6F:1A
[16:23:30][C][wifi:367]:   Hostname: 'infinitesp'
[16:23:30][C][wifi:369]:   Signal strength: -63 dB ▂▄▆█
[16:23:30][C][wifi:373]:   Channel: 1
[16:23:30][C][wifi:374]:   Subnet: 255.255.255.0
[16:23:30][C][wifi:375]:   Gateway: 192.168.1.1
[16:23:30][C][wifi:376]:   DNS1: 192.168.1.3
[16:23:30][C][wifi:377]:   DNS2: 0.0.0.0
[16:23:30][C][logger:293]: Logger:
[16:23:30][C][logger:294]:   Level: DEBUG
[16:23:30][C][logger:295]:   Log Baud Rate: 115200
[16:23:30][C][logger:296]:   Hardware UART: UART0
[16:23:30][C][i2c.arduino:052]: I2C Bus:
[16:23:30][C][i2c.arduino:053]:   SDA Pin: GPIO8
[16:23:30][C][i2c.arduino:054]:   SCL Pin: GPIO18
[16:23:30][C][i2c.arduino:055]:   Frequency: 50000 Hz
[16:23:30][C][i2c.arduino:058]:   Recovery: bus successfully recovered
[16:23:30][I][i2c.arduino:068]: Results from i2c bus scan:
[16:23:30][I][i2c.arduino:074]: Found i2c device at address 0x08
[16:23:30][I][i2c.arduino:074]: Found i2c device at address 0x10
[16:23:30][C][spi:101]: SPI bus:
[16:23:30][C][spi:102]:   CLK Pin: GPIO7
[16:23:30][C][spi:104]:   MOSI Pin: GPIO6
[16:23:30][C][spi:106]:   Using HW SPI: YES
[16:23:30][C][homeassistant.time:010]: Home Assistant Time:
[16:23:30][C][homeassistant.time:011]:   Timezone: 'EST5EDT,M3.2.0,M11.1.0'
[16:23:30][C][adc:087]: ADC Sensor 'front buttons'
[16:23:30][C][adc:087]:   Device Class: 'voltage'
[16:23:30][C][adc:087]:   State Class: 'measurement'
[16:23:30][C][adc:087]:   Unit of Measurement: 'V'
[16:23:30][C][adc:087]:   Accuracy Decimals: 2
[16:23:30][C][adc:097]:   Pin: GPIO1
[16:23:30][C][adc:103]:  Attenuation: 0db
[16:23:30][C][adc:125]:   Update Interval: 60.0s
[16:23:30][C][psram:020]: PSRAM:
[16:23:30][C][psram:021]:   Available: YES
[16:23:30][C][psram:024]:   Size: 7 MB
[16:23:30][C][restart:022]: Restart Switch 'infinitesp reboot'
[16:23:30][C][restart:022]:   Icon: 'mdi:restart'
[16:23:30][C][st7789v:119]: SPI ST7789V
[16:23:30][C][st7789v:119]:   Rotations: 0 °
[16:23:30][C][st7789v:119]:   Dimensions: 320px x 240px
[16:23:30][C][st7789v:120]:   Model: Custom
[16:23:30][C][st7789v:122]:   Height Offset: 0
[16:23:30][C][st7789v:123]:   Width Offset: 0
[16:23:30][C][st7789v:125]:   8-bit color mode: NO
[16:23:30][C][st7789v:126]:   CS Pin: GPIO5
[16:23:30][C][st7789v:127]:   DC Pin: GPIO4
[16:23:30][C][st7789v:128]:   Reset Pin: GPIO48
[16:23:30][C][st7789v:129]:   B/L Pin: GPIO45
[16:23:30][C][st7789v:130]:   Update Interval: 5.0s
[16:23:30][C][web_server:125]: Web Server:
[16:23:30][C][web_server:126]:   Address: infinitesp.local:80
[16:23:30][C][mdns:103]: mDNS:
[16:23:30][C][mdns:104]:   Hostname: infinitesp
[16:23:30][C][ota:093]: Over-The-Air Updates:
[16:23:30][C][ota:094]:   Address: infinitesp.local:3232
[16:23:30][C][api:138]: API Server:
[16:23:30][C][api:139]:   Address: infinitesp.local:6053
[16:23:30][C][api:143]:   Using noise encryption: NO
nebulous commented 1 year ago

Using the TFT_eSPI Arduino lib I was able to get a platformio project to work with the display. So this does appear to be a limitation in some part of the st7789 esphome pipeline.

nebulous commented 1 year ago

image

nebulous commented 1 year ago

update: made a custom component to use tftespi for now since the built-in esphome st7789 display appears subtly broken for my use case. I'll keep this thread alive in the event someone wants to correct me.