paulvha / sps30

Sensirion SPS30 driver for ESP32, SODAQ, MEGA2560, UNO,UNO-R4 ESP8266, Particle-photon on UART OR I2C coummunication
GNU General Public License v3.0
66 stars 27 forks source link

ERR_OK and ERR_TIMEOUT overwrite framework definitions #28

Closed oseiler2 closed 2 years ago

oseiler2 commented 2 years ago

I'm trying to use this lib with the Arduino framework on ESP32 in PlatformIO and get compile errors when also using the framework's lwip implementation (basically anything using sockets if I'm not mistaken) because sps30.h redefines ERR_OK and ERR_TIMEOUT that are already defined in lwip/err.h. I'm not sure if there's an easy way to avoid this and appreciate any help.

buildlog.txt Sample project showing the error esp-lwip

oseiler2 commented 2 years ago

Core error:


 #define ERR_OK          0x00
                         ^~~~
C:/Users/xxxxx/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/lwip/lwip/src/include/lwip/err.h:55:3: note: in expansion of macro 'ERR_OK'
   ERR_OK         = 0,
   ^~~~~~
.pio/libdeps/usb/sps30/src/sps30.h:350:25: error: expected '}' before numeric constant
 #define ERR_OK          0x00
                         ^~~~
C:/Users/xxxxx/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/lwip/lwip/src/include/lwip/err.h:55:3: note: in expansion of macro 'ERR_OK'
   ERR_OK         = 0,
   ^~~~~~
In file included from C:/Users/xxxxx/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/lwip/lwip/src/include/lwip/pbuf.h:42,
                 from .pio/libdeps/usb/AsyncTCP/src/AsyncTCP.h:30,
                 from src/main.cpp:4:
C:/Users/xxxxx/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/lwip/lwip/src/include/lwip/err.h:53:14: note: to match this '{'
 typedef enum {
              ^
In file included from src/main.cpp:2:
.pio/libdeps/usb/sps30/src/sps30.h:350:25: error: expected unqualified-id before numeric constant
 #define ERR_OK          0x00
                         ^~~~
C:/Users/xxxxx/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/lwip/lwip/src/include/lwip/err.h:55:3: note: in expansion of macro 'ERR_OK'
   ERR_OK         = 0,
   ^~~~~~
In file included from C:/Users/xxxxx/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/lwip/lwip/src/include/lwip/pbuf.h:42,
                 from .pio/libdeps/usb/AsyncTCP/src/AsyncTCP.h:30,
                 from src/main.cpp:4:
C:/Users/xxxxx/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/lwip/lwip/src/include/lwip/err.h:89:3: error: 'err_enum_t' does not name a type; did you mean 'error_t'?
 } err_enum_t;
   ^~~~~~~~~~
   error_t
In file included from src/main.cpp:4:
.pio/libdeps/usb/AsyncTCP/src/AsyncTCP.h:31:1: error: expected declaration before '}' token
 }```
paulvha commented 2 years ago

it is a matter of definition. I have updated the SPS30 library and added "SPS30_" before each error code. Download the 1.4.14 version and it should work now.

regards, Paul

oseiler2 commented 2 years ago

Awesome, thanks for the quick fix!

oseiler2 commented 2 years ago

Quick follow-up: do you happen to know how to update the version for PlatformIO (still on 1.4.12), so that it can be pulled automatically? https://registry.platformio.org/libraries/paulvha/sps30/versions

paulvha commented 2 years ago

some time ago I was contacted by CanAirIO community with some questions. Apparently, they control the content on the link you provided. Try to contact them on https://canair.io/ regards, Paul

oseiler2 commented 2 years ago

Thanks, it's been updated now.