Rework isHighResolution to be an enum called ScreenResolution

This commit is contained in:
Jason P
2025-12-16 17:27:08 -06:00
parent 22ee679ea5
commit a0b4e8270e
14 changed files with 127 additions and 108 deletions

View File

@@ -268,7 +268,7 @@ int CannedMessageModule::splitConfiguredMessages()
}
void CannedMessageModule::drawHeader(OLEDDisplay *display, int16_t x, int16_t y, char *buffer)
{
if (graphics::isHighResolution) {
if (graphics::currentResolution == graphics::ScreenResolution::High) {
if (this->dest == NODENUM_BROADCAST) {
display->drawStringf(x, y, buffer, "To: #%s", channels.getName(this->channel));
} else {
@@ -1695,8 +1695,9 @@ void CannedMessageModule::drawDestinationSelectionScreen(OLEDDisplay *display, O
strncpy(entryText, node->user.long_name, sizeof(entryText) - 1);
entryText[sizeof(entryText) - 1] = '\0';
}
int availWidth =
display->getWidth() - (graphics::isHighResolution ? 40 : 20) - ((node && node->is_favorite) ? 10 : 0);
int availWidth = display->getWidth() -
((graphics::currentResolution == graphics::ScreenResolution::High) ? 40 : 20) -
((node && node->is_favorite) ? 10 : 0);
if (availWidth < 0)
availWidth = 0;
@@ -2307,7 +2308,8 @@ ProcessMessage CannedMessageModule::handleReceived(const meshtastic_MeshPacket &
strncpy(nodeName, src, sizeof(nodeName) - 1);
nodeName[sizeof(nodeName) - 1] = '\0';
int availWidth = display->getWidth() - (graphics::isHighResolution ? 60 : 30);
int availWidth =
display->getWidth() - ((graphics::currentResolution == graphics::ScreenResolution::High) ? 60 : 30);
if (availWidth < 0)
availWidth = 0;

View File

@@ -378,7 +378,7 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt
int line = 1;
// === Set Title
const char *titleStr = (graphics::isHighResolution) ? "Environment" : "Env.";
const char *titleStr = (graphics::currentResolution == graphics::ScreenResolution::High) ? "Environment" : "Env.";
// === Header ===
graphics::drawCommonHeader(display, x, y, titleStr);

View File

@@ -117,7 +117,7 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s
int line = 1;
// === Set Title
const char *titleStr = (graphics::isHighResolution) ? "Power Telem." : "Power";
const char *titleStr = (graphics::currentResolution == graphics::ScreenResolution::High) ? "Power Telem." : "Power";
// === Header ===
graphics::drawCommonHeader(display, x, y, titleStr);