-->
Page 3 of 3

Re: Wifi.RSSI(i) invalid argument with EclipseArduino IDE V3

PostPosted: Wed May 25, 2016 6:53 pm
by Mingy
I was somehow able to get rid of the strdup() issue but I honestly don't know how. I did figure out how to modify the compiler settings but the problem persisted, then magically disappeared.

I am at a complete loss to figure out what is wrong with WiFi.RSSI.
When I do this
int r = WiFi.RSSI(i); //I get an error
int p = WiFi.RSSI(); //I do not get an error

This seems that somehow the code in ESP8266 WiFiScan is not getting compiled correctly, even though int n = WiFi.scanNetworks(); generates no error.

I tried inserting a #pragma statement to see if the compiler was getting the to the declaration

int32_t ESP8266WiFiScanClass::RSSI(uint8_t i) {
struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i));
if(!it) {
return 0;
}
return it->rssi;
}

but somehow #pragmas are suppressed (i can't figure out where).


Can I ask what IDE you are using that works? Arduino works OK for me, but I am working on a project which I figure is going to be very big so it is too primitive.

I tried using PlatformIO but got nowhere (couldn't compile a thing) and, in any event, I am using Eclipse for other things.

Thanks again

Wifi.RSSI(i) invalid argument with EclipseArduino IDE V3

PostPosted: Wed May 25, 2016 7:55 pm
by Mingy
I found a sort of workaround but I don't like it.

In
ESP8266WiFi.h
ESP8266WiFiScan.cpp and
ESP8266WiFiScan.h

I changed references from

using ESP8266WiFiScanClass::RSSI;
to
using ESP8266WiFiScanClass::ScanRSSI;

Re: Wifi.RSSI(i) invalid argument with EclipseArduino IDE V3

PostPosted: Wed Sep 21, 2016 1:17 am
by bluevoid
I had the same problem using platformIO and eclipse.
Solved it using a cast like this: ((ESP8266WiFiScanClass)WiFi).RSSI(i);

Re: Wifi.RSSI(i) invalid argument with EclipseArduino IDE V3

PostPosted: Thu Jan 19, 2017 10:31 am
by Wolle
In eclipse You can see that:
WiFi1.jpg

There is only one entry by methods with the same name. Cause is the keyword "using" in the file "ESP8266WiFi.h"
- using ESP8266WiFiScanClass::SSID;
- using ESP8266WiFiSTAClass::SSID;
The second one hides the first one if the name of the members are equal.
You can fix that as follow:
Code: Select all   
String  SSID(uint8_t networkItem)    {return ESP8266WiFiScanClass::SSID(networkItem);}
int32_t RSSI(uint8_t networkItem)    {return ESP8266WiFiScanClass::RSSI(networkItem);}
uint8_t *BSSID(uint8_t networkItem)  {return ESP8266WiFiScanClass::BSSID(networkItem);}
String  BSSIDstr(uint8_t networkItem){return ESP8266WiFiScanClass::BSSIDstr(networkItem);}
int32_t channel(uint8_t networkItem) {return ESP8266WiFiScanClass::channel(networkItem);}

String  SSID(void)                   {return ESP8266WiFiSTAClass::SSID();}
int32_t RSSI(void)                   {return ESP8266WiFiSTAClass::RSSI();}
uint8_t *BSSID(void)                 {return ESP8266WiFiSTAClass::BSSID();}
String  BSSIDstr(void)               {return ESP8266WiFiSTAClass::BSSIDstr();}
int32_t channel(void)                {return ESP8266WiFiGenericClass::channel();}

using ESP8266WiFiScanClass::encryptionType;
using ESP8266WiFiScanClass::isHidden;


Then all members are visible
WiFi2.jpg


Wolle