Skip to content

Commit 670fa08

Browse files
committed
Fix issue when WiFi RSSI shows 100%, when connection is lost. Now it will show -1
1 parent 82c7f67 commit 670fa08

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

marquee/marquee.ino

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,13 @@ String getPressureSymbol()
13911391
// converts the dBm to a range between 0 and 100%
13921392
int8_t getWifiQuality() {
13931393
int32_t dbm = WiFi.RSSI();
1394-
if (dbm <= -100) {
1394+
// found out that RSSI returns 31 when wifi connection is lost
1395+
// we return -1 in that case
1396+
if (dbm > 0)
1397+
{
1398+
return -1; // wifi error
1399+
}
1400+
else if (dbm <= -100) {
13951401
return 0;
13961402
} else if (dbm >= -50) {
13971403
return 100;
@@ -1548,7 +1554,7 @@ void readConfiguration() {
15481554
line.trim();
15491555
//print each line read
15501556
if (1) {
1551-
int idx = line.indexOf("Key");
1557+
idx = line.indexOf("Key");
15521558
if (idx < 0) idx = line.indexOf("KEY");
15531559
if (idx < 0) idx = line.indexOf("Pass");
15541560
if (idx > 0) idx = line.indexOf("=");

0 commit comments

Comments
 (0)