WiFi.RSSI() and 0.8.0


#1

Just for curiosities sake I though I would try out compiling my software against 0.8.0rc8, one of the functions in my code reads the RSSI value and prints it on screen and includes it in a publish(). Under 0.8.0 something has changed however, that number becomes gibberish: 536884548 - a more credible number was reported in the Device Vitals box.

Issues here and here seem to persist into 0.8.0


#2

In 0.7.0 and earlier, WiFi.RSSI() returned:

int8_t RSSI();

In 0.8.0, it returns:

WiFiSignal RSSI();

Where WiFiSignal is:

class WiFiSignal : public particle::Signal {
public:
    // In order to be compatible with CellularSignal
    int rssi = 2;
    int qual = 0;

    WiFiSignal() {}
    WiFiSignal(const wlan_connected_info_t& inf);
    virtual ~WiFiSignal() {};

    operator int8_t() const;

    bool fromConnectedInfo(const wlan_connected_info_t& sig);

    virtual hal_net_access_tech_t getAccessTechnology() const;
    virtual float getStrength() const;
    virtual float getStrengthValue() const;
    virtual float getQuality() const;
    virtual float getQualityValue() const;

    // virtual size_t printTo(Print& p) const;

private:
    wlan_connected_info_t inf_ = {0};
};

Since it supports operator int8_t() the theory was that it would still work because you’d get the value. Unfortunately, that doesn’t work for sprintf, as it doesn’t know that you want the rssi field.

It should work if you use:

(int8_t) WiFi.RSSI()

or

WiFi.RSSI().rssi

#3

I see, more consistent with electron that way I guess.

You also reserved the choice Variable name Signal, which was mildly annoying as I was already using it.