mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-14 07:21:30 +10:00
Full T-echo card support + Compact UI (#11342)
* T-echo card * Update NRF52I2SOutput.cpp * Update NRF52I2SOutput.h * cleanup * Update buzz.cpp * use consistent runtime compact-panel check instead of mixing with compile-time macro * Update NodeDB.cpp * Update ExternalNotificationModule.cpp * switched to Throttle::isWithinTimespanMs * Update SharedUIDisplay.h * trunk fix * last cleanup * ClockRenderer.cpp for OLED_COMPACT_UI and setup Unit C6L for new UI. * Fixed regressions in standard OLED and TFT --------- Co-authored-by: Jason P <applewiz@mac.com>
This commit is contained in:
@@ -161,13 +161,15 @@ void drawLoRaFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x,
|
||||
int nameX = (SCREEN_WIDTH - textWidth);
|
||||
display->drawString(nameX, getTextPositions(display)[line++], shortnameble);
|
||||
|
||||
// === Second Row: Role ===
|
||||
auto role = DisplayFormatters::getDeviceRole(config.device.role);
|
||||
char device_role[25];
|
||||
snprintf(device_role, sizeof(device_role), "Role: %s", role);
|
||||
textWidth = display->getStringWidth(device_role);
|
||||
nameX = (SCREEN_WIDTH - textWidth) / 2;
|
||||
display->drawString(nameX, getTextPositions(display)[line++], device_role);
|
||||
if (!graphics::isCompactPanel(display)) {
|
||||
// === Second Row: Role ===
|
||||
auto role = DisplayFormatters::getDeviceRole(config.device.role);
|
||||
char device_role[25];
|
||||
snprintf(device_role, sizeof(device_role), "Role: %s", role);
|
||||
textWidth = display->getStringWidth(device_role);
|
||||
nameX = (SCREEN_WIDTH - textWidth) / 2;
|
||||
display->drawString(nameX, getTextPositions(display)[line++], device_role);
|
||||
}
|
||||
|
||||
// === Third Row: Radio Preset ===
|
||||
// For custom modem settings show the actual parameters; for presets use the preset name.
|
||||
@@ -423,10 +425,14 @@ void drawSystemScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
// System Uptime
|
||||
if (line < 2) {
|
||||
if (graphics::isCompactPanel(display)) {
|
||||
line += 1;
|
||||
} else {
|
||||
if (line < 2) {
|
||||
line += 1;
|
||||
}
|
||||
line += 1;
|
||||
}
|
||||
line += 1;
|
||||
|
||||
char appversionstr[35];
|
||||
char appversionstr_formatted[40];
|
||||
@@ -461,7 +467,8 @@ void drawSystemScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x
|
||||
|
||||
display->drawString(nameX, getTextPositions(display)[line++], appversionstr);
|
||||
|
||||
if (SCREEN_HEIGHT > 64 || (SCREEN_HEIGHT <= 64 && line <= 5)) { // Only show uptime if the screen can show it
|
||||
if (!graphics::isCompactPanel(display) &&
|
||||
(SCREEN_HEIGHT > 64 || (SCREEN_HEIGHT <= 64 && line <= 5))) { // Only show uptime if the screen can show it
|
||||
char uptimeStr[32] = "";
|
||||
getUptimeStr(millis(), "Up: ", uptimeStr, sizeof(uptimeStr));
|
||||
textWidth = display->getStringWidth(uptimeStr);
|
||||
@@ -471,6 +478,23 @@ void drawSystemScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x
|
||||
|
||||
if (SCREEN_HEIGHT > 64 || (SCREEN_HEIGHT <= 64 && line <= 5)) { // Only show API state if the screen can show it
|
||||
char api_state[32] = "";
|
||||
#if defined(OLED_COMPACT_UI)
|
||||
const char *connection = "None";
|
||||
if (service->api_state == service->STATE_BLE) {
|
||||
connection = "BLE";
|
||||
} else if (service->api_state == service->STATE_WIFI) {
|
||||
connection = "WiFi";
|
||||
} else if (service->api_state == service->STATE_SERIAL) {
|
||||
connection = "USB";
|
||||
} else if (service->api_state == service->STATE_PACKET) {
|
||||
connection = "Local";
|
||||
} else if (service->api_state == service->STATE_HTTP) {
|
||||
connection = "HTTP";
|
||||
} else if (service->api_state == service->STATE_ETH) {
|
||||
connection = "Eth";
|
||||
}
|
||||
snprintf(api_state, sizeof(api_state), "App: %s", connection);
|
||||
#else
|
||||
const char *clientWord = nullptr;
|
||||
|
||||
// Determine if narrow or wide screen
|
||||
@@ -494,6 +518,7 @@ void drawSystemScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x
|
||||
} else if (service->api_state == service->STATE_ETH) {
|
||||
snprintf(api_state, sizeof(api_state), "%s Connected (Ethernet)", clientWord);
|
||||
}
|
||||
#endif
|
||||
if (api_state[0] != '\0') {
|
||||
display->drawString((SCREEN_WIDTH - display->getStringWidth(api_state)) / 2, getTextPositions(display)[line++],
|
||||
api_state);
|
||||
|
||||
Reference in New Issue
Block a user