Skip to content

Commit fce9bf3

Browse files
ble-devble-dev
andauthored
Add config flags to display or not battery level and WiFi signal strenth texts (#201)
Co-authored-by: ble-dev <a2zugmhz4@mozmail.com>
1 parent bd7b389 commit fce9bf3

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

platformio/include/config.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@
252252
// STATUS BAR EXTRAS
253253
// Extra information that can be displayed on the status bar. Set to 1 to
254254
// enable.
255-
#define STATUS_BAR_EXTRAS_BAT_VOLTAGE 0
256-
#define STATUS_BAR_EXTRAS_WIFI_RSSI 0
255+
#define STATUS_BAR_EXTRAS_BAT_PERCENTAGE 1
256+
#define STATUS_BAR_EXTRAS_BAT_VOLTAGE 0
257+
#define STATUS_BAR_EXTRAS_WIFI_STRENGTH 1
258+
#define STATUS_BAR_EXTRAS_WIFI_RSSI 0
257259

258260
// BATTERY MONITORING
259261
// You may choose to power your weather display with or without a battery.

platformio/src/renderer.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,28 +1281,40 @@ void drawStatusBar(const String &statusStr, const String &refreshTimeStr,
12811281
dataColor = ACCENT_COLOR;
12821282
}
12831283
#endif
1284-
dataStr = String(batPercent) + "%";
1284+
#if STATUS_BAR_EXTRAS_BAT_PERCENTAGE || STATUS_BAR_EXTRAS_BAT_VOLTAGE
1285+
dataStr = "";
1286+
#if STATUS_BAR_EXTRAS_BAT_PERCENTAGE
1287+
dataStr += String(batPercent) + "%";
1288+
#endif
12851289
#if STATUS_BAR_EXTRAS_BAT_VOLTAGE
12861290
dataStr += " (" + String( std::round(batVoltage / 10.f) / 100.f, 2 ) + "v)";
12871291
#endif
12881292
drawString(pos, DISP_HEIGHT - 1 - 2, dataStr, RIGHT, dataColor);
1289-
pos -= getStringWidth(dataStr) + 25;
1293+
pos -= getStringWidth(dataStr) + 1;
1294+
#endif
1295+
pos -= 24;
12901296
display.drawInvertedBitmap(pos, DISP_HEIGHT - 1 - 17,
12911297
getBatBitmap24(batPercent), 24, 24, dataColor);
12921298
pos -= sp + 9;
12931299
#endif
12941300

12951301
// WiFi
1296-
dataStr = String(getWiFidesc(rssi));
12971302
dataColor = rssi >= -70 ? GxEPD_BLACK : ACCENT_COLOR;
1303+
#if STATUS_BAR_EXTRAS_WIFI_STRENGTH || STATUS_BAR_EXTRAS_WIFI_RSSI
1304+
dataStr = "";
1305+
#if STATUS_BAR_EXTRAS_WIFI_STRENGTH
1306+
dataStr += String(getWiFidesc(rssi));
1307+
#endif
12981308
#if STATUS_BAR_EXTRAS_WIFI_RSSI
12991309
if (rssi != 0)
13001310
{
13011311
dataStr += " (" + String(rssi) + "dBm)";
13021312
}
13031313
#endif
13041314
drawString(pos, DISP_HEIGHT - 1 - 2, dataStr, RIGHT, dataColor);
1305-
pos -= getStringWidth(dataStr) + 19;
1315+
pos -= getStringWidth(dataStr) + 1;
1316+
#endif
1317+
pos -= 18;
13061318
display.drawInvertedBitmap(pos, DISP_HEIGHT - 1 - 13, getWiFiBitmap16(rssi),
13071319
16, 16, dataColor);
13081320
pos -= sp + 8;

0 commit comments

Comments
 (0)