2025-05-30 14:20:31 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "graphics/Screen.h"
|
|
|
|
|
#include "graphics/emotes.h"
|
|
|
|
|
#include <OLEDDisplay.h>
|
|
|
|
|
#include <OLEDDisplayUi.h>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
// Forward declarations for status types
|
|
|
|
|
namespace meshtastic
|
|
|
|
|
{
|
|
|
|
|
class PowerStatus;
|
|
|
|
|
class NodeStatus;
|
|
|
|
|
class GPSStatus;
|
|
|
|
|
} // namespace meshtastic
|
|
|
|
|
|
|
|
|
|
namespace graphics
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// Forward declarations
|
|
|
|
|
class Screen;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief UI utility drawing functions
|
|
|
|
|
*
|
|
|
|
|
* Contains utility functions for drawing common UI elements, overlays,
|
|
|
|
|
* battery indicators, and other shared graphical components.
|
|
|
|
|
*/
|
|
|
|
|
namespace UIRenderer
|
|
|
|
|
{
|
|
|
|
|
// Common UI elements
|
|
|
|
|
void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y);
|
|
|
|
|
void drawBattery(OLEDDisplay *display, int16_t x, int16_t y, uint8_t *imgBuffer, const meshtastic::PowerStatus *powerStatus);
|
|
|
|
|
void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, const meshtastic::NodeStatus *nodeStatus, int node_offset = 0,
|
|
|
|
|
bool show_total = true, String additional_words = "");
|
|
|
|
|
|
|
|
|
|
// GPS status functions
|
|
|
|
|
void drawGPS(OLEDDisplay *display, int16_t x, int16_t y, const meshtastic::GPSStatus *gpsStatus);
|
|
|
|
|
void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const meshtastic::GPSStatus *gpsStatus);
|
|
|
|
|
void drawGPSAltitude(OLEDDisplay *display, int16_t x, int16_t y, const meshtastic::GPSStatus *gpsStatus);
|
|
|
|
|
void drawGPSpowerstat(OLEDDisplay *display, int16_t x, int16_t y, const meshtastic::GPSStatus *gpsStatus);
|
|
|
|
|
|
|
|
|
|
// Layout and utility functions
|
|
|
|
|
void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char **fields);
|
|
|
|
|
void drawColumnSeparator(OLEDDisplay *display, int16_t x, int16_t startY, int16_t endY);
|
|
|
|
|
void drawScrollbar(OLEDDisplay *display, int visibleItems, int totalItems, int scrollIndex, int x, int startY);
|
|
|
|
|
|
|
|
|
|
// Overlay and special screens
|
|
|
|
|
void drawFrameText(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *text);
|
|
|
|
|
|
2025-05-31 10:52:17 -05:00
|
|
|
// Function overlay for showing mute/buzzer modifiers etc.
|
|
|
|
|
void drawFunctionOverlay(OLEDDisplay *display, OLEDDisplayUiState *state);
|
|
|
|
|
|
2025-05-31 09:09:43 -05:00
|
|
|
// Navigation bar overlay
|
|
|
|
|
void drawNavigationBar(OLEDDisplay *display, OLEDDisplayUiState *state);
|
|
|
|
|
|
2025-05-31 06:39:14 -05:00
|
|
|
void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
|
|
|
|
|
|
|
|
void drawDeviceFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
|
|
|
|
2025-05-31 07:35:38 -05:00
|
|
|
// Icon and screen drawing functions
|
|
|
|
|
void drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
|
|
|
|
|
|
|
|
// Compass and location screen
|
|
|
|
|
void drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
|
|
|
|
|
|
|
|
// OEM screens
|
|
|
|
|
#ifdef USERPREFS_OEM_TEXT
|
|
|
|
|
void drawOEMIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
|
|
|
void drawOEMBootScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-05-31 08:45:02 -05:00
|
|
|
#ifdef USE_EINK
|
|
|
|
|
/// Used on eink displays while in deep sleep
|
2025-05-31 08:50:42 -05:00
|
|
|
void drawDeepSleepFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
2025-05-31 08:45:02 -05:00
|
|
|
|
|
|
|
|
/// Used on eink displays when screen updates are paused
|
2025-05-31 08:50:42 -05:00
|
|
|
void drawScreensaverOverlay(OLEDDisplay *display, OLEDDisplayUiState *state);
|
2025-05-31 08:45:02 -05:00
|
|
|
#endif
|
|
|
|
|
|
2025-05-30 14:20:31 -05:00
|
|
|
// Time and date utilities
|
|
|
|
|
void getTimeAgoStr(uint32_t agoSecs, char *timeStr, uint8_t maxLength);
|
|
|
|
|
std::string drawTimeDelta(uint32_t days, uint32_t hours, uint32_t minutes, uint32_t seconds);
|
2025-05-30 20:50:24 -05:00
|
|
|
int formatDateTime(char *buffer, size_t bufferSize, uint32_t rtc_sec, OLEDDisplay *display, bool showTime);
|
2025-05-30 14:20:31 -05:00
|
|
|
|
|
|
|
|
// Message filtering
|
|
|
|
|
bool shouldDrawMessage(const meshtastic_MeshPacket *packet);
|
2025-05-31 06:39:14 -05:00
|
|
|
// Check if the display can render a string (detect special chars; emoji)
|
|
|
|
|
bool haveGlyphs(const char *str);
|
2025-05-30 14:20:31 -05:00
|
|
|
} // namespace UIRenderer
|
|
|
|
|
|
|
|
|
|
} // namespace graphics
|