Skip to content

Instantly share code, notes, and snippets.

@kroimon

kroimon/box.yaml Secret

Last active June 27, 2023 00:24
Show Gist options
  • Save kroimon/f6692879f9c00702990801ae9dfa433b to your computer and use it in GitHub Desktop.
Save kroimon/f6692879f9c00702990801ae9dfa433b to your computer and use it in GitHub Desktop.
ESPHome configuration to test PR #4793 on ESP32-S3-BOX
esphome:
name: box
friendly_name: Box
on_boot:
priority: 799
then:
# Mirror display (X and Y) - TODO: fix in ili9xxx driver
- lambda: |-
uint8_t madctl = ili9xxx::MADCTL_BGR | ili9xxx::MADCTL_MX | ili9xxx::MADCTL_MY;
id(lcd).send_command(ili9xxx::ILI9XXX_MADCTL, &madctl, 1);
- output.turn_on: ns4150_ctrl
esp32:
board: esp32s3box
framework:
type: arduino
# Compilation with esp-idf currently results in boot-loops. Also, i2s is currently only supported on Arduino.
#type: esp-idf
#version: latest
external_components:
- source: github://pr#4793
components: [ tt21100 ]
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
reboot_timeout: 15min
ap:
password: !secret ap_password
ap_timeout: 10min
ota:
password: !secret ota_password
api:
encryption:
key: !secret api_encryption_key
reboot_timeout: 0s
logger:
# CDC logging is currently not working on the S3
# See https://github.com/espressif/esp-idf/commit/9924d9f27192a5fab5f66230c72249ecc6cad34c
#hardware_uart: USB_CDC
level: VERBOSE
logs:
ledc.output: DEBUG
component: DEBUG
ili9xxx: DEBUG
tt21100: VERBOSE
time:
- platform: sntp
id: time_sntp
output:
- platform: ledc
pin: GPIO45
id: lcd_backlight
- platform: gpio
pin: GPIO46
id: ns4150_ctrl
light:
- platform: monochromatic
output: lcd_backlight
name: "LCD Backlight"
restore_mode: ALWAYS_ON
spi:
clk_pin: GPIO7
mosi_pin: GPIO6
display:
- platform: ili9xxx
model: ili9342
cs_pin: GPIO5
dc_pin: GPIO4
reset_pin: GPIO48
id: lcd
# Width = 320, Height = 240
lambda: |-
it.fill(Color::WHITE);
auto red = Color(255, 0, 0);
auto green = Color(0, 255, 0);
auto blue = Color(0, 0, 255);
it.filled_rectangle(10, 170, 60, 60, red);
it.filled_rectangle(130, 170, 60, 60, green);
it.filled_rectangle(250, 170, 60, 60, blue);
it.strftime(160, 85, id(font_time), Color::BLACK, TextAlign::CENTER, "%H:%M", id(time_sntp).now());
if (id(muted).state) {
it.print(310, 10, id(font_small), red, TextAlign::TOP_RIGHT, "Muted");
}
font:
- file: "gfonts://Roboto@900"
id: font_time
size: 80
glyphs: "0123456789:"
- file: "gfonts://Roboto"
id: font_small
size: 20
i2c:
scl: GPIO18
sda: GPIO8
scan: true
touchscreen:
- platform: tt21100
address: 0x24
interrupt_pin: GPIO3
# Don't use as the reset pin is shared with the display, so the ili9xxx will perform the reset
#reset_pin: GPIO48
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
id: settings
name: "Settings"
- platform: gpio
pin:
number: GPIO1
inverted: true
id: muted
name: "Muted"
- platform: tt21100
name: "Home"
index: 0
- platform: touchscreen
name: "Red"
x_min: 10
x_max: 70
y_min: 170
y_max: 230
- platform: touchscreen
name: "Green"
x_min: 130
x_max: 190
y_min: 170
y_max: 230
- platform: touchscreen
name: "Blue"
x_min: 250
x_max: 310
y_min: 170
y_max: 230
i2s_audio:
i2s_lrclk_pin: GPIO47
i2s_bclk_pin: GPIO17
# Need support for MCLK pin, see https://github.com/esphome/feature-requests/issues/1786
#i2c_mclk_pin: GPIO2
#es8311:
# address: 0x18
#media_player:
# - platform: i2s_audio
# name: Media Player
# dac_type: external
# i2s_dout_pin: GPIO15
# mode: mono
#es7210:
# address: 0x40
#microphone:
# - platform: i2s_audio
# id: external_mic
# adc_type: external
# pdm: false
# i2s_din_pin: GPIO16
# i2c device at address 0x18 - ES8311 Audio Codec
# i2c device at address 0x24 - TT21100 Touchscreen
# i2c device at address 0x40 - ES7210 Mic ADC
# i2c device at address 0x68 - ICM-42607-P IMU
@gsgxnet
Copy link

gsgxnet commented Jun 25, 2023

Found a solution. Use the latest Arduino framework.

esp32:
  board: esp32s3box
  framework:
    type: arduino
    #version: recommended  # default
    version: latest

That will give you when compiling the following warning:

INFO Reading configuration /config/esphome/box32s3xc.yaml...
WARNING The selected Arduino framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.

Which has some truth in it, I have to exclude i2saudio. Because the compiler fails on that:

src/esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp: In member function 'void esphome::i2s_audio::I2SAudioMicrophone::read_()':
src/esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp:119:43: error: no matching function for call to 'esphome::CallbackManager<void(const std::vector<short int, std::allocator<short int> >&)>::call(std::vector<unsigned char>&)'
   this->data_callbacks_.call(this->buffer_);
                                           ^
In file included from src/esphome/components/i2s_audio/microphone/../i2s_audio.h:7,
                 from src/esphome/components/i2s_audio/microphone/i2s_audio_microphone.h:5,
                 from src/esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp:1:
src/esphome/core/helpers.h:474:8: note: candidate: 'void esphome::CallbackManager<void(Ts ...)>::call(Ts ...) [with Ts = {const std::vector<short int, std::allocator<short int> >&}]'
   void call(Ts... args) {
        ^~~~
src/esphome/core/helpers.h:474:8: note:   no known conversion for argument 1 from 'std::vector<unsigned char>' to 'const std::vector<short int>&'
*** [/data/box32s3xc/.pioenvs/box32s3xc/src/esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp.o] Error 1

Now it works as expected after a reset. No loop.

@degner
Copy link

degner commented Jun 26, 2023

Great work @gsgxnet , I will try this and report back

@degner
Copy link

degner commented Jun 26, 2023

hi @gsgxnet i can confirm that worked for me as well. would be great to get these findings reported with hope of fix being made (including i2saudio) - any chance you have done that?

@gsgxnet
Copy link

gsgxnet commented Jun 26, 2023

hi @gsgxnet i can confirm that worked for me as well. would be great to get these findings reported with hope of fix being made (including i2saudio) - any chance you have done that?

Would do so if I had a clue where to do it.

@rpatel3001
Copy link

We are tracking the status of the S3-BOX at esphome/feature-requests#2239

There is an updated config at https://gist.github.com/rpatel3001/ffd160577b96585fda144b786d789f46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment