Added xaositek screens

This commit is contained in:
HarukiToreda 2025-03-29 23:46:54 -04:00
parent 0480ddd266
commit 2fc6781322

View File

@ -2120,7 +2120,107 @@ static void drawDefaultScreen(OLEDDisplay *display, OLEDDisplayUiState *state, i
int uptimeY = y + (FONT_HEIGHT_SMALL + 1) * 3;
display->drawString(uptimeX, uptimeY, uptimeFullStr);
}
// ****************************
// * BatteryDeviceLoRa Screen *
// ****************************
static void drawBatteryDeviceLoRa(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{
display->clear();
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(FONT_SMALL);
// === Header ===
drawCommonHeader(display, x, y);
// === Second Row: MAC ID and Region ===
bool origBold = config.display.heading_bold;
config.display.heading_bold = false;
int secondRowY = y + FONT_HEIGHT_SMALL + 1;
// Get our hardware ID
uint8_t dmac[6];
getMacAddr(dmac);
snprintf(ourId, sizeof(ourId), "%02x%02x", dmac[4], dmac[5]);
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS) || ARCH_PORTDUINO) && \
!defined(DISPLAY_FORCE_SMALL_FONTS)
display->drawFastImage(x, y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgInfoL1);
display->drawFastImage(x, y + 11 + FONT_HEIGHT_SMALL, 12, 8, imgInfoL2);
#else
display->drawFastImage(x, y + 2 + FONT_HEIGHT_SMALL, 8, 8, imgInfo);
#endif
display->drawString(x + 14, secondRowY, ourId);
const char *region = myRegion ? myRegion->name : NULL;
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(region), secondRowY, region);
config.display.heading_bold = origBold;
// === Third Row: Channel and Channel Utilization ===
int thirdRowY = y + (FONT_HEIGHT_SMALL * 2) + 1;
char channelStr[20];
{
snprintf(channelStr, sizeof(channelStr), "#%s", channels.getName(channels.getPrimaryIndex()));
}
display->drawString(x, thirdRowY, channelStr);
// Display Channel Utilization
char chUtil[13];
snprintf(chUtil, sizeof(chUtil), "ChUtil %2.0f%%", airTime->channelUtilizationPercent());
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), thirdRowY, chUtil);
// === Fourth Row: Uptime ===
uint32_t uptime = millis() / 1000;
char uptimeStr[6];
uint32_t minutes = uptime / 60, hours = minutes / 60, days = hours / 24;
if (days > 365) {
snprintf(uptimeStr, sizeof(uptimeStr), "?");
} else {
snprintf(uptimeStr, sizeof(uptimeStr), "%d%c",
days ? days
: hours ? hours
: minutes ? minutes
: (int)uptime,
days ? 'd'
: hours ? 'h'
: minutes ? 'm'
: 's');
}
char uptimeFullStr[16];
snprintf(uptimeFullStr, sizeof(uptimeFullStr), "Uptime: %s", uptimeStr);
int uptimeX = (SCREEN_WIDTH - display->getStringWidth(uptimeFullStr)) / 2;
int uptimeY = y + (FONT_HEIGHT_SMALL + 1) * 3;
display->drawString(uptimeX, uptimeY, uptimeFullStr);
}
// ****************************
// * Activity Screen *
// ****************************
static void drawActivity(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{
display->clear();
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(FONT_SMALL);
// === Header ===
drawCommonHeader(display, x, y);
// === Second Row: Draw any log messages ===
bool origBold = config.display.heading_bold;
config.display.heading_bold = false;
int secondRowY = y + FONT_HEIGHT_SMALL + 1;
display->drawLogBuffer(x, secondRowY);
}
// ****************************
// * Activity Screen *
// ****************************
static void drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) {
display->clear();
display->setTextAlignment(TEXT_ALIGN_LEFT);
@ -2838,7 +2938,9 @@ void Screen::setFrames(FrameFocus focus)
normalFrames[numframes++] = drawDistanceScreen;
normalFrames[numframes++] = drawNodeListWithCompasses;
normalFrames[numframes++] = drawHopSignalScreen;
normalFrames[numframes++] = drawBatteryDeviceLoRa;
normalFrames[numframes++] = drawCompassAndLocationScreen;
normalFrames[numframes++] = drawActivity;
// then all the nodes
// We only show a few nodes in our scrolling list - because meshes with many nodes would have too many screens