ESP32Encoder icon indicating copy to clipboard operation
ESP32Encoder copied to clipboard

fix compiling with ESP-IDF 5.x,

Open tueddy opened this issue 1 year ago • 3 comments

see https://github.com/madhephaestus/ESP32Encoder/issues/101

tueddy avatar Mar 01 '24 22:03 tueddy

can you add the compiler gaurds so this is only added these imports on the older cores? Or have you tested this works in 1.04 and 2.x.x before we merge this?

madhephaestus avatar Mar 02 '24 19:03 madhephaestus

I've tested with Arduino 2.0.14 & 3.0 but not with Arduino 1. For safety i've added a compiler define..

tueddy avatar Mar 02 '24 20:03 tueddy

An alternative condition would be

#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) )

but i'm happy with #if ESP_IDF_VERSION_MAJOR == 5

tueddy avatar Mar 02 '24 20:03 tueddy

I would prefer the #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) to be backwards compatible and future looking as the major number is increased over time.

madhephaestus avatar Mar 04 '24 15:03 madhephaestus

this is released as of 0.11.2

madhephaestus avatar Mar 05 '24 14:03 madhephaestus

Sorry for the inconvenience: With changed directive it does not compile with Arduino 3 / ESP-IDF 5.

We need additionally #include <Arduino.h>

or change the compiler condition to #if ESP_IDF_VERSION_MAJOR >= 5

@madhephaestus What solution do you prefer?

tueddy avatar Mar 11 '24 20:03 tueddy