Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated macro #5

Merged
merged 1 commit into from
Jan 12, 2025
Merged

Replace deprecated macro #5

merged 1 commit into from
Jan 12, 2025

Conversation

pcmihnea
Copy link
Contributor

@ggaljoen
Copy link
Contributor

ggaljoen commented Dec 27, 2024

For the "real/original ESP32" this seems to work with the old 'TICK' BUT for others like EPS32 S2 this should be changed.

@pcmihnea
Copy link
Contributor Author

For the "real/original ESP32" this seems to work with the old 'TICK' BUT for others like EPS32 S2 this should be changed.

That might explain why no one was made aware of this issue which is present starting with esphome 2024.12 and upwards.
My target board is indeed an 8MB ESP32-S3 @240MHz. The current 'recommended' espd-idf framework is 3.50105.0 (5.1.5).
Would it then be wise to use the newer macro, maybe inside ifdef's for the esp variants and/or framework versions?

@aquaticus
Copy link
Owner

What compiler emits for old macro? An error or just a warning?

@pcmihnea
Copy link
Contributor Author

Here's the relevant log output:

INFO ESPHome 2024.12.2
INFO Reading configuration /config/esphome/esphome-web-0d7f88.yaml...
INFO Detected timezone 'Europe/Bucharest'
INFO Generating C++ source...
INFO Updating https://github.com/espressif/[email protected]
INFO Compiling app...
Processing esphome-web-0d7f88 (board: esp32-s3-devkitc-1; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32.git#51.03.07)
--------------------------------------------------------------------------------
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
 - framework-espidf @ 3.50105.0 (5.1.5) 
 - tool-cmake @ 3.21.3 
 - tool-esptoolpy @ 4.8.1 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.10.2 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-riscv32-esp @ 12.2.0+20230208 
 - toolchain-xtensa-esp32s3 @ 12.2.0+20230208
Reading CMake configuration...
Dependency Graph
|-- noise-c @ 0.1.6
Compiling .pioenvs/esphome-web-0d7f88/src/esphome/components/iec62056/iec62056.cpp.o
Compiling .pioenvs/esphome-web-0d7f88/src/esphome/components/iec62056/iec62056switch.cpp.o
Compiling .pioenvs/esphome-web-0d7f88/src/main.cpp.o
In file included from src/esphome/components/esp32_rmt_led_strip/led_strip.h:12,
                 from src/esphome.h:22,
                 from src/main.cpp:3:
/data/cache/platformio/packages/framework-espidf/components/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
   18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
      |  ^~~~~~~
In file included from src/esphome/components/iec62056/iec62056.h:13,
                 from src/esphome/components/iec62056/iec62056.cpp:4:
src/esphome/components/iec62056/iec62056uart.h: In member function 'bool esphome::iec62056::IEC62056UART::read_array_quick_(uint8_t*, size_t)':
src/esphome/components/iec62056/iec62056uart.h:173:68: error: 'portTICK_RATE_MS' was not declared in this scope; did you mean 'portTICK_PERIOD_MS'?
  173 |       uart_read_bytes(this->iuart_num_, data, length_to_read, 20 / portTICK_RATE_MS);
      |                                                                    ^~~~~~~~~~~~~~~~
      |                                                                    portTICK_PERIOD_MS
In file included from src/esphome/components/iec62056/iec62056.h:13,
                 from src/esphome/components/iec62056/iec62056switch.h:4,
                 from src/esphome/components/iec62056/iec62056switch.cpp:1:
src/esphome/components/iec62056/iec62056uart.h: In member function 'bool esphome::iec62056::IEC62056UART::read_array_quick_(uint8_t*, size_t)':
src/esphome/components/iec62056/iec62056uart.h:173:68: error: 'portTICK_RATE_MS' was not declared in this scope; did you mean 'portTICK_PERIOD_MS'?
  173 |       uart_read_bytes(this->iuart_num_, data, length_to_read, 20 / portTICK_RATE_MS);
      |                                                                    ^~~~~~~~~~~~~~~~
      |                                                                    portTICK_PERIOD_MS
In file included from src/esphome/components/iec62056/iec62056.h:13,
                 from src/esphome.h:27:
src/esphome/components/iec62056/iec62056uart.h: In member function 'bool esphome::iec62056::IEC62056UART::read_array_quick_(uint8_t*, size_t)':
src/esphome/components/iec62056/iec62056uart.h:173:68: error: 'portTICK_RATE_MS' was not declared in this scope; did you mean 'portTICK_PERIOD_MS'?
  173 |       uart_read_bytes(this->iuart_num_, data, length_to_read, 20 / portTICK_RATE_MS);
      |                                                                    ^~~~~~~~~~~~~~~~
      |                                                                    portTICK_PERIOD_MS
*** [.pioenvs/esphome-web-0d7f88/src/esphome/components/iec62056/iec62056switch.cpp.o] Error 1
*** [.pioenvs/esphome-web-0d7f88/src/esphome/components/iec62056/iec62056.cpp.o] Error 1
*** [.pioenvs/esphome-web-0d7f88/src/main.cpp.o] Error 1
========================== [FAILED] Took 8.37 seconds ==========================

The energy meter configuration I'm using is:

external_components:
  - source: github://aquaticus/esphome-iec62056

substitutions:
  PIN_RX: GPIO17
  PIN_TX: GPIO18

esphome:
  name: esphome-web-0d7f88
  friendly_name: ESP_0d7f88
  platformio_options:
    board_build.flash_mode: dio

esp32:
  board: esp32-s3-devkitc-1
  flash_size: 8MB
  framework:
    type: esp-idf

logger:
  baud_rate: 0
  level: WARN

uart:
  id: id_uart
  rx_pin: ${PIN_RX}
  tx_pin: ${PIN_TX}
  baud_rate: 300
  data_bits: 7
  parity: EVEN
  stop_bits: 1

iec62056:
  uart_id: id_uart
  update_interval: 30s
  baud_rate_max: 9600

sensor:
  - platform: iec62056
    obis: 15.8.0
    name: "ESP_METER_ENERGY"
    unit_of_measurement: kWh
    accuracy_decimals: 3
    device_class: energy
    state_class: total_increasing
  - platform: iec62056
    obis: 96.7.0
    name: "ESP_METER_POWER_FAILURES"
    unit_of_measurement: counts
    accuracy_decimals: 0
    state_class: total_increasing

Where it just a warning, I would've brush it off, but unfortunately it aborts the build...

@ggaljoen
Copy link
Contributor

Same error and aborted build with this device:

esp32:
  variant: esp32s2
  board: lolin_s2_mini

@alexhumphrey
Copy link

Same error and compile fail on
esp32: board: esp32dev framework: type: esp-idf

@aquaticus aquaticus merged commit 70e9cfc into aquaticus:main Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants