mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-10 23:47:12 +00:00
Memory bar fix
This commit is contained in:
parent
df631d480b
commit
33093e28fa
@ -2860,9 +2860,10 @@ static void drawMemoryScreen(OLEDDisplay *display, OLEDDisplayUiState *state, in
|
|||||||
|
|
||||||
char combinedStr[24];
|
char combinedStr[24];
|
||||||
if (SCREEN_WIDTH > 128) {
|
if (SCREEN_WIDTH > 128) {
|
||||||
snprintf(combinedStr, sizeof(combinedStr), "%3d%% %lu/%luKB", percent, used / 1024, total / 1024);
|
snprintf(combinedStr, sizeof(combinedStr), "%s%3d%% %lu/%luKB", (percent > 80) ? "! " : "", percent, used / 1024,
|
||||||
|
total / 1024);
|
||||||
} else {
|
} else {
|
||||||
snprintf(combinedStr, sizeof(combinedStr), "%3d%%", percent);
|
snprintf(combinedStr, sizeof(combinedStr), "%s%3d%%", (percent > 80) ? "! " : "", percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
int textWidth = display->getStringWidth(combinedStr);
|
int textWidth = display->getStringWidth(combinedStr);
|
||||||
@ -2881,8 +2882,6 @@ static void drawMemoryScreen(OLEDDisplay *display, OLEDDisplayUiState *state, in
|
|||||||
display->setColor(WHITE);
|
display->setColor(WHITE);
|
||||||
display->drawRect(barX, barY, adjustedBarWidth, barHeight);
|
display->drawRect(barX, barY, adjustedBarWidth, barHeight);
|
||||||
|
|
||||||
if (percent >= 80)
|
|
||||||
display->setColor(BLACK);
|
|
||||||
display->fillRect(barX, barY, fillWidth, barHeight);
|
display->fillRect(barX, barY, fillWidth, barHeight);
|
||||||
display->setColor(WHITE);
|
display->setColor(WHITE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user