Rihan9 / LD2412

MIT License
8 stars 2 forks source link

unable to install to ESP32S3 #8

Open Hrupek opened 1 day ago

Hrupek commented 1 day ago

hi I have below config:

substitutions:
  name: esp32s3-salon
  friendly_name: ESP32S3-Salon

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  platformio_options:
    board_build.flash_mode: dio
  project:
    name: esphome.web
    version: dev

external_components:
  - source:
      type: git
      url: https://github.com/Rihan9/LD2412
      ref: main
    components: [LD2412]

esp32:
  variant: esp32s3
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

logger:
  level: VERBOSE
  baud_rate: 0

# Enable Home Assistant API
api:

ota:
  - platform: esphome

wifi:
  networks:
  - ssid: "Home"
    password: "xxxxxxx"
  - ssid: "HA"
    password: "xxxxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ESP32-S3 Salon"
    password: "xxxxxxxx"

captive_portal:

uart:
  tx_pin: GPIO17
  rx_pin: GPIO16
  baud_rate: 115200
  parity: NONE
  stop_bits: 1
  id: uart_bus

LD2412:
  id: ld2412
  throttle: 3s

binary_sensor:
  - platform: LD2412
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target

sensor:
  - platform: LD2412
    moving_distance:
      name : Moving Distance
    still_distance:
      name: Still Distance
    moving_energy:
      name: Move Energy
    still_energy:
      name: Still Energy
    detection_distance:
      name: Detection Distance
    light:
      name: light
    g0:
      move_energy:
        name: g00 move energy
      still_energy:
        name: g00 still energy
    g1:
      move_energy:
        name: g01 move energy
      still_energy:
        name: g01 still energy
    g2:
      move_energy:
        name: g02 move energy
      still_energy:
        name: g02 still energy
    g3:
      move_energy:
        name: g03 move energy
      still_energy:
        name: g03 still energy
    g4:
      move_energy:
        name: g04 move energy
      still_energy:
        name: g04 still energy
    g5:
      move_energy:
        name: g05 move energy
      still_energy:
        name: g05 still energy
    g6:
      move_energy:
        name: g06 move energy
      still_energy:
        name: g06 still energy
    g7:
      move_energy:
        name: g07 move energy
      still_energy:
        name: g07 still energy
    g8:
      move_energy:
        name: g08 move energy
      still_energy:
        name: g08 still energy
    g9:
      move_energy:
        name: g09 move energy
      still_energy:
        name: g09 still energy
    g10:
      move_energy:
        name: g10 move energy
      still_energy:
        name: g10 still energy
    g11:
      move_energy:
        name: g11 move energy
      still_energy:
        name: g11 still energy
    g12:
      move_energy:
        name: g12 move energy
      still_energy:
        name: g12 still energy
    g13:
      move_energy:
        name: g13 move energy
      still_energy:
        name: g13 still energy

number:
  - platform: LD2412
    timeout:
      name: "presence holding"
    min_distance_gate:
      name: "min distance gate"
    max_distance_gate:
      name: "max distance gate"
    g0:
      move_threshold:
        name: g00 move threshold
      still_threshold:
        name: g00 still threshold
    g1:
      move_threshold:
        name: g01 move threshold
      still_threshold:
        name: g01 still threshold
    g2:
      move_threshold:
        name: g02 move threshold
      still_threshold:
        name: g02 still threshold
    g3:
      move_threshold:
        name: g03 move threshold
      still_threshold:
        name: g03 still threshold
    g4:
      move_threshold:
        name: g04 move threshold
      still_threshold:
        name: g04 still threshold
    g5:
      move_threshold:
        name: g05 move threshold
      still_threshold:
        name: g05 still threshold
    g6:
      move_threshold:
        name: g06 move threshold
      still_threshold:
        name: g06 still threshold
    g7:
      move_threshold:
        name: g07 move threshold
      still_threshold:
        name: g07 still threshold
    g8:
      move_threshold:
        name: g08 move threshold
      still_threshold:
        name: g08 still threshold
    g9:
      move_threshold:
        name: g09 move threshold
      still_threshold:
        name: g09 still threshold
    g10:
      move_threshold:
        name: g10 move threshold
      still_threshold:
        name: g10 still threshold
    g11:
      move_threshold:
        name: g11 move threshold
      still_threshold:
        name: g11 still threshold
    g12:
      move_threshold:
        name: g12 move threshold
      still_threshold:
        name: g12 still threshold
    g13:
      move_threshold:
        name: g13 move threshold
      still_threshold:
        name: g13 still threshold

select:
  - platform: LD2412
    out_pin_level:
      name: 'Hardware output pin level'
    distance_resolution:
      name: 'Distance resolution'
    baud_rate:
      name: "baud rate"
      on_value:
        - delay: 3s
        - lambda: |-
            id(uart_bus).flush();
            uint32_t new_baud_rate = stoi(x);
            ESP_LOGD("change_baud_rate", "Changing baud rate from %i to %i",id(uart_bus).get_baud_rate(), new_baud_rate);
            if (id(uart_bus).get_baud_rate() != new_baud_rate) {
            id(uart_bus).set_baud_rate(new_baud_rate);
            id(uart_bus).load_settings();
            }
    mode:
      name: "Mode"
button:
  - platform: LD2412
    factory_reset:
      name: "factory reset"
    restart:
      name: "restart"
    query_params:
      name: query params

text_sensor:
  - platform: LD2412
    version:
      name: "firmware version"
    mac_address:
      name: "mac address"
switch:
  - platform: LD2412
    bluetooth:
      name: "Bluetooth"

while trying to install it to my board i get this error:

INFO ESPHome 2024.10.0
INFO Reading configuration /config/esphome/esphome-web-d04dc0.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esp32s3-salon (board: esp32-s3-devkitc-1; framework: espidf; platform: platformio/espressif32@5.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
 - framework-espidf @ 3.40408.0 (4.4.8) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
Reading CMake configuration...
Generating assembly for certificate bundle...
No dependencies
Compiling .pioenvs/esp32s3-salon/src/esphome/components/LD2412/LD2412.o
Compiling .pioenvs/esp32s3-salon/src/esphome/components/LD2412/button/query_button.o
Compiling .pioenvs/esp32s3-salon/src/esphome/components/LD2412/button/reset_button.o
src/esphome/components/LD2412/LD2412.cpp: In member function 'void esphome::LD2412::LD2412Component::set_mode(const string&)':
src/esphome/components/LD2412/LD2412.cpp:655:22: error: 'cmd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   this->send_command_(cmd, nullptr, 0);
   ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
*** [.pioenvs/esp32s3-salon/src/esphome/components/LD2412/LD2412.o] Error 1
========================= [FAILED] Took 11.32 seconds =========================
Rihan9 commented 1 day ago

Hi, please use the markdown for "multiline code" to report your configuration and your log. Is unreadable like this

https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

Hrupek commented 1 day ago

sorry for the formating, now should be better

Rihan9 commented 18 hours ago

Hi, thanks for the reformatting. A change has been pushed to the Dev branch. Unfortunately, I don't have and ESP32S3 so I can't check myself, can you give it a try please?