Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

PlatformIO woes with AdafruitIO
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

PlatformIO woes with AdafruitIO

by electricphred on Mon Jul 13, 2020 1:09 pm

Hello:

Am having a terrible time trying to get AdafruitIO going under PlatformIO. Problems see to stem for wrong libraries and irrelevant libraries automagically downloaded as part of the AdafruitIO packagage? Have had to disable both the Sleepy Dog Library and WiFi101 which both throw errors. Have read on these forums that WiFi101 isn't even compatible with my ESP32 (Thing Plus).

could use help on my latest multiple errors stemming from WiFiclient which are preventing a compile:

WiFiClientSocketHandle()
{
close(sockfd);
}
Where identifier 'close' is undefined. WiFiclient seems to depend on WiFi and I'm not certain that I've got an ESP32 variant.

here's another thread on these excessive library installs: viewtopic.php?f=56&t=167263
and this one on Sleepy Dog: viewtopic.php?f=56&t=167271

electricphred
 
Posts: 15
Joined: Wed Jul 01, 2020 10:40 am

Re: PlatformIO woes with AdafruitIO

by electricphred on Mon Jul 13, 2020 8:50 pm

OK my builds of the AdafruitIO examples now seems busted under Arduino IDE where I had it working last week. Don't know/think this is related to the update of that library to 3.7 which i have done.

In the Arduino IDE my compile craps out after:
Using library WiFi at version 1.0 in folder: /Users/xxx/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi

under the more verbose compiler logs in PlatformIO I am also having trouble with a dependency of that library where 'close' is not defined in WebSocket handling

electricphred
 
Posts: 15
Joined: Wed Jul 01, 2020 10:40 am

Re: PlatformIO woes with AdafruitIO

by brubell on Wed Jul 15, 2020 11:57 am

Which board support package version do you have installed for the ESP32? Which ESP32 board are you using (vendor)?

brubell
 
Posts: 1079
Joined: Fri Jul 17, 2015 10:33 pm

Re: PlatformIO woes with AdafruitIO

by electricphred on Wed Jul 15, 2020 3:00 pm

I’ve been using platform “espressif32” and have variously used an Adafruit Feather Huzzah32 and a SparkFun ThingPlus Wroom32. Thanks.

electricphred
 
Posts: 15
Joined: Wed Jul 01, 2020 10:40 am

Re: PlatformIO woes with AdafruitIO

by electricphred on Thu Jul 16, 2020 2:46 pm

Tried uninstalling and reinstalling Arduino 1.8.13 and fresh libraries. How can I solve my WiFi.h problems preventing a compile of the Adafruit IO examples which I had running before?

Here's the output:
Multiple libraries were found for "WiFi.h"
Used: /Users/xxx/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
Not used: /private/var/folders/9l/bmv1h9bx6mlb8lv_1x500nm00000gn/T/AppTranslocation/C70B2388-92FF-4EF0-A35B-B9E8CF2A4D0E/d/Arduino 7.app/Contents/Java/libraries/WiFi
Using library ESP32 at version 1.0 in folder: /Users/xxx/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/ESP32
Using library Adafruit_IO_Arduino-master at version 3.7.0 in folder: /Users/ccc/Documents/Arduino/libraries/Adafruit_IO_Arduino-master
Using library Adafruit_MQTT_Library at version 1.3.0 in folder: /Users/xxx/Documents/Arduino/libraries/Adafruit_MQTT_Library
Using library ArduinoHttpClient at version 0.4.0 in folder: /Users/fredwhitridge/Documents/Arduino/libraries/ArduinoHttpClient
Using library WiFiClientSecure at version 1.0 in folder: /Users/xxx/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFiClientSecure
Using library WiFi at version 1.0 in folder: /Users/xxx/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
exit status 1
'WiFiClientSecure' does not name a type

I seem to be stuck in a similar place under PlatformIO where the problem seems to be around closing a socket, don't have that error at hand.

electricphred
 
Posts: 15
Joined: Wed Jul 01, 2020 10:40 am

Re: PlatformIO woes with AdafruitIO

by electricphred on Thu Jul 16, 2020 6:03 pm

Compile problem solved. Deleted Arduino IDE. Flushed libraries.
Exited IDE, Fired it up with the last known Adafruit IO working software and it least compiles.

Now to track down "Connection Failed!" a Scanner shows my Thing Plus Wroom32 has and IP address so more sleuthing...

electricphred
 
Posts: 15
Joined: Wed Jul 01, 2020 10:40 am

Re: PlatformIO woes with AdafruitIO

by cbitter78 on Wed Sep 09, 2020 9:05 am

I ran into this problem and found the root cause. I was able to fix it.

This is caused because the SDK is trying to map a type to a interface. It tries to find the right wifi code for your board. To do this its looking for compile flags that comes from your boards.txt. This is why people have fixed this in the past by picking the correct board, or reinstalling (when you reinstall a new boards.txt file is installed per board type). You can see the code here: https://github.com/adafruit/Adafruit_IO_Arduino/blob/master/src/AdafruitIO_WiFi.h#L18.

Based on a deff existing it includes the correct file in ./wifi that implements the methods in AdafruitIO_WiFi.h. If it fails then AdafruitIO_WiFi.h has no type! It's just a header with no code to carry out its job. (by the way kodos to the adafruit team this is some sweet code!)

However with the Feather M0 none of this works. I could have gone and added stuff to my boards.txt or included a build variable. The goal for the M0 is to have the type be defined as wifi/AdafruitIO_WINC1500.h. Todo this I just added
Code: Select all | TOGGLE FULL SIZE
#define USE_WINC1500
to the config.h in any of the examples. This triggered the if statement here: https://github.com/adafruit/Adafruit_IO_Arduino/blob/master/src/AdafruitIO_WiFi.h#L29

How did I know what type to use? I read through them all, wifi/AdafruitIO_WINC1500.h is the only one that runs wifi.setpins correctly so I knew it was the one I needed.

One line in the config.h and I am good to go! If I remove the line it brakes.

Knowing what's going on here is key, It just can't find the right wifi type based on what it knows. Given that you may fix it in different ways. Because my board was correct and I had the newest boards.txt file for my M0 I went with a define. There are many ways to fix this. Think about it, try the easy things first. Then use a #define if you must.

Cheers!

cbitter78
 
Posts: 1
Joined: Wed Aug 05, 2020 9:02 pm

Please be positive and constructive with your questions and comments.