SSID_RSSI_BSS_OLED
SSID_RSSI_BSS_OLED copied to clipboard
RSSI values not caught by if statement
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;
}
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;