WiFi.RSSI() and 0.8.0

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
1 Like