TheThingsNetwork / arduino-device-lib

Arduino Library for TTN Devices
MIT License
208 stars 96 forks source link

ESP32 doesn't compile #241

Closed jstrobel closed 6 years ago

jstrobel commented 6 years ago

I am not sure if this is an error or there is a missconfiguration at my side.

I wanted to compile the Code for an Heltec-ESP32-Module and got the error: /Arduino/libraries/TheThingsNetwork/src/TheThingsNetwork.h:9:26: fatal error: avr/pgmspace.h: No such file or directory

After changing in TheThingsNetwork.h from: #include <avr/pgmspace.h> to #include <pgmspace.h> it compiles.

johanstokking commented 6 years ago

@jstrobel thanks for reporting. Did you install a library to get pgmspace.h on non-AVR architectures? Afaik, but I'm not an Arduino expert, the avr/* stuff is available with AVR architecture (which the ESP32 is not), so that file is not available indeed.

Can you try this in the header file?

#ifdef ARDUINO_ARCH_AVR
#include <avr/pgmspace.h>
#else
#include <pgmspace.h>
#endif

And if that works, can you file a PR?

jstrobel commented 6 years ago

@johanstokking If you have a look here: https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/pgmspace.h the pgmspace.h is available with the esp32. will try you patch and if it works i will do a PR. Thank you.

johanstokking commented 6 years ago

I see, then it should be good, looking forward to the PR.

jstrobel commented 6 years ago

Works for me. I did a PR.