You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In IPStack.h it tries to include SPI.h (as this is required by normal Arduinos). However, if the user is using the ESP8266 Arduino core (https://github.com/esp8266/Arduino) and does not need to include SPI.h then a compile error will be thrown:
In file included from PahoESP8266.ino:6:0:
/Users/jamessutton/Documents/Arduino/libraries/MQTTClient/IPStack.h:22:19: fatal error: SPI.h: No such file or directory
#include <SPI.h>
^
compilation terminated.
Error compiling.
Because the ESP8266 does not require SPI for it's networking functions, a user is unlikely to want to include the SPI library just to get their sketch to compile.
I modified my local copy of IPStack.h to only attempt to include SPI.h if WiFi_h has not been defined. This is because, the ESP8266WiFi Library has defined it so should be a good indicator as to whether the client is being compiled for the ESP8266.
#ifndef WiFi_h
#include <SPI.h>
#endif
I've tested this and it seems to work fine on my own machine / ESP8266, but I wouldn't say I'm confident enough with C to want to make the commit / Pull request myself in case this is a terrible idea, so thought it best to open as an issue.
In IPStack.h it tries to include SPI.h (as this is required by normal Arduinos). However, if the user is using the ESP8266 Arduino core (https://github.com/esp8266/Arduino) and does not need to include SPI.h then a compile error will be thrown:
Because the ESP8266 does not require SPI for it's networking functions, a user is unlikely to want to include the SPI library just to get their sketch to compile.
I modified my local copy of IPStack.h to only attempt to include SPI.h if WiFi_h has not been defined. This is because, the ESP8266WiFi Library has defined it so should be a good indicator as to whether the client is being compiled for the ESP8266.
I've tested this and it seems to work fine on my own machine / ESP8266, but I wouldn't say I'm confident enough with C to want to make the commit / Pull request myself in case this is a terrible idea, so thought it best to open as an issue.
Other than that, the library works great on the ESP8266, I've modified the Example sketch to work with it here: https://gist.github.com/jpwsutton/d364f46a54575f359fbe#file-paho_arduino_esp8266-ino
The text was updated successfully, but these errors were encountered: