SSID_RSSI_BSS_OLED icon indicating copy to clipboard operation
SSID_RSSI_BSS_OLED copied to clipboard

RSSI values not caught by if statement

Open JonSilver opened this issue 6 years ago • 1 comments

Just stumbled upon your code and thought I'd point out that your if statement for rssi values allows the values at the top ends of your ranges to drop through to the end, resulting in no bars.

To resolve this:

    if (RSSI >= -55) { 
      bars = 5;
    } else if (RSSI < -55 & RSSI >= -65) {
      bars = 4;
    } else if (RSSI < -65 & RSSI >= -70) {
      bars = 3;
    } else if (RSSI < -70 & RSSI >= -78) {
      bars = 2;
    } else if (RSSI < -78 & RSSI >= -82) {
      bars = 1;
    } else {
      bars = 0;
    }

JonSilver avatar Aug 21 '18 14:08 JonSilver

The if statement may be even simpler. Like this:

bars = 0;
 if (RSSI >= -82) bars = 1;
 if (RSSI >= -78) bars = 2;
 if (RSSI >= -70) bars = 3;
 if (RSSI >= -65) bars = 4;
 if (RSSI >= -55) bars = 5;

qurek1 avatar Aug 31 '20 18:08 qurek1