|
|
|
|
@@ -329,11 +329,8 @@ static void drawFrameFirmware(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|
|
|
|
display->drawString(64 + x, y, "Updating");
|
|
|
|
|
|
|
|
|
|
display->setFont(FONT_SMALL);
|
|
|
|
|
if ((millis() / 1000) % 2) {
|
|
|
|
|
display->drawString(64 + x, FONT_HEIGHT_SMALL + y + 2, "Please wait . . .");
|
|
|
|
|
} else {
|
|
|
|
|
display->drawString(64 + x, FONT_HEIGHT_SMALL + y + 2, "Please wait . . ");
|
|
|
|
|
}
|
|
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
|
|
|
display->drawStringMaxWidth(0 + x, 2 + y + FONT_HEIGHT_SMALL *2, x + display->getWidth(), "Please be patient and do not power off.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Draw the last text message we received
|
|
|
|
|
@@ -364,6 +361,9 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|
|
|
|
{
|
|
|
|
|
displayedNodeNum = 0; // Not currently showing a node pane
|
|
|
|
|
|
|
|
|
|
// the max length of this buffer is much longer than we can possibly print
|
|
|
|
|
static char tempBuf[237];
|
|
|
|
|
|
|
|
|
|
MeshPacket &mp = devicestate.rx_text_message;
|
|
|
|
|
NodeInfo *node = nodeDB.getNode(getFrom(&mp));
|
|
|
|
|
// DEBUG_MSG("drawing text message from 0x%x: %s\n", mp.from,
|
|
|
|
|
@@ -373,16 +373,14 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|
|
|
|
// with the third parameter you can define the width after which words will
|
|
|
|
|
// be wrapped. Currently only spaces and "-" are allowed for wrapping
|
|
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
|
|
|
display->setFont(FONT_MEDIUM);
|
|
|
|
|
String sender = (node && node->has_user) ? node->user.short_name : "???";
|
|
|
|
|
display->drawString(0 + x, 0 + y, sender);
|
|
|
|
|
display->setFont(FONT_SMALL);
|
|
|
|
|
|
|
|
|
|
// the max length of this buffer is much longer than we can possibly print
|
|
|
|
|
static char tempBuf[96];
|
|
|
|
|
snprintf(tempBuf, sizeof(tempBuf), " %s", mp.decoded.payload.bytes);
|
|
|
|
|
|
|
|
|
|
display->drawStringMaxWidth(4 + x, 10 + y, SCREEN_WIDTH - (6 + x), tempBuf);
|
|
|
|
|
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
|
|
|
|
display->setColor(BLACK);
|
|
|
|
|
display->drawStringf(0 + x, 0 + y, tempBuf, "From: %s", (node && node->has_user) ? node->user.short_name : "???");
|
|
|
|
|
display->drawStringf(1 + x, 0 + y, tempBuf, "From: %s", (node && node->has_user) ? node->user.short_name : "???");
|
|
|
|
|
display->setColor(WHITE);
|
|
|
|
|
snprintf(tempBuf, sizeof(tempBuf), "%s", mp.decoded.payload.bytes);
|
|
|
|
|
display->drawStringMaxWidth(0 + x, 0 + y + FONT_HEIGHT_SMALL, x + display->getWidth(), tempBuf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Draw a series of fields in a column, wrapping to multiple colums if needed
|
|
|
|
|
@@ -395,6 +393,10 @@ static void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char *
|
|
|
|
|
int xo = x, yo = y;
|
|
|
|
|
while (*f) {
|
|
|
|
|
display->drawString(xo, yo, *f);
|
|
|
|
|
if (display->getColor() == BLACK)
|
|
|
|
|
display->drawString(xo + 1, yo, *f);
|
|
|
|
|
|
|
|
|
|
display->setColor(WHITE);
|
|
|
|
|
yo += FONT_HEIGHT_SMALL;
|
|
|
|
|
if (yo > SCREEN_HEIGHT - FONT_HEIGHT_SMALL) {
|
|
|
|
|
xo += SCREEN_WIDTH / 2;
|
|
|
|
|
@@ -465,6 +467,7 @@ static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, NodeStatus *no
|
|
|
|
|
sprintf(usersString, "%d/%d", nodeStatus->getNumOnline(), nodeStatus->getNumTotal());
|
|
|
|
|
display->drawFastImage(x, y, 8, 8, imgUser);
|
|
|
|
|
display->drawString(x + 10, y - 2, usersString);
|
|
|
|
|
display->drawString(x + 11, y - 2, usersString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw GPS status summary
|
|
|
|
|
@@ -473,15 +476,18 @@ static void drawGPS(OLEDDisplay *display, int16_t x, int16_t y, const GPSStatus
|
|
|
|
|
if (config.position.fixed_position) {
|
|
|
|
|
// GPS coordinates are currently fixed
|
|
|
|
|
display->drawString(x - 1, y - 2, "Fixed GPS");
|
|
|
|
|
display->drawString(x, y - 2, "Fixed GPS");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!gps->getIsConnected()) {
|
|
|
|
|
display->drawString(x, y - 2, "No GPS");
|
|
|
|
|
display->drawString(x + 1, y - 2, "No GPS");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
display->drawFastImage(x, y, 6, 8, gps->getHasLock() ? imgPositionSolid : imgPositionEmpty);
|
|
|
|
|
if (!gps->getHasLock()) {
|
|
|
|
|
display->drawString(x + 8, y - 2, "No sats");
|
|
|
|
|
display->drawString(x + 9, y - 2, "No sats");
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
char satsString[3];
|
|
|
|
|
@@ -685,16 +691,16 @@ static uint16_t getCompassDiam(OLEDDisplay *display)
|
|
|
|
|
{
|
|
|
|
|
uint16_t diam = 0;
|
|
|
|
|
// get the smaller of the 2 dimensions and subtract 20
|
|
|
|
|
if(display->getWidth() > display->getHeight()) {
|
|
|
|
|
diam = display->getHeight();
|
|
|
|
|
if(display->getWidth() > (display->getHeight() - FONT_HEIGHT_SMALL)) {
|
|
|
|
|
diam = display->getHeight() - FONT_HEIGHT_SMALL;
|
|
|
|
|
// if 2/3 of the other size would be smaller, use that
|
|
|
|
|
if (diam > (display->getWidth() * 2 / 3)) {
|
|
|
|
|
diam = display->getWidth() * 2 / 3;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
diam = display->getWidth();
|
|
|
|
|
if (diam > (display->getHeight() * 2 / 3)) {
|
|
|
|
|
diam = display->getHeight() * 2 / 3;
|
|
|
|
|
if (diam > ((display->getHeight() - FONT_HEIGHT_SMALL) * 2 / 3)) {
|
|
|
|
|
diam = (display->getHeight() - FONT_HEIGHT_SMALL) * 2 / 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -774,6 +780,8 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|
|
|
|
// The coordinates define the left starting point of the text
|
|
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
|
|
|
|
|
|
|
|
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
|
|
|
|
|
|
|
|
|
const char *username = node->has_user ? node->user.long_name : "Unknown Name";
|
|
|
|
|
|
|
|
|
|
static char signalStr[20];
|
|
|
|
|
@@ -804,7 +812,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|
|
|
|
const char *fields[] = {username, distStr, signalStr, lastStr, NULL};
|
|
|
|
|
|
|
|
|
|
// coordinates for the center of the compass/circle
|
|
|
|
|
int16_t compassX = x + SCREEN_WIDTH - getCompassDiam(display) / 2 - 5, compassY = y + SCREEN_HEIGHT / 2;
|
|
|
|
|
int16_t compassX = x + SCREEN_WIDTH - getCompassDiam(display) / 2 - 5, compassY = y + FONT_HEIGHT_SMALL + (SCREEN_HEIGHT - FONT_HEIGHT_SMALL) / 2;
|
|
|
|
|
bool hasNodeHeading = false;
|
|
|
|
|
|
|
|
|
|
if (ourNode && hasPosition(ourNode)) {
|
|
|
|
|
@@ -847,6 +855,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|
|
|
|
display->drawString(compassX - FONT_HEIGHT_SMALL / 4, compassY - FONT_HEIGHT_SMALL / 2, "?");
|
|
|
|
|
display->drawCircle(compassX, compassY, getCompassDiam(display) / 2);
|
|
|
|
|
|
|
|
|
|
display->setColor(BLACK);
|
|
|
|
|
// Must be after distStr is populated
|
|
|
|
|
drawColumns(display, x, y, fields);
|
|
|
|
|
}
|
|
|
|
|
@@ -1373,6 +1382,9 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|
|
|
|
// The coordinates define the left starting point of the text
|
|
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
|
|
|
|
|
|
|
|
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
|
|
|
|
display->setColor(BLACK);
|
|
|
|
|
|
|
|
|
|
char channelStr[20];
|
|
|
|
|
{
|
|
|
|
|
concurrency::LockGuard guard(&lock);
|
|
|
|
|
@@ -1382,22 +1394,24 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|
|
|
|
|
|
|
|
|
// Display power status
|
|
|
|
|
if (powerStatus->getHasBattery())
|
|
|
|
|
drawBattery(display, x, y + 2, imgBattery, powerStatus);
|
|
|
|
|
drawBattery(display, x + 1, y + 3, imgBattery, powerStatus);
|
|
|
|
|
else if (powerStatus->knowsUSB())
|
|
|
|
|
display->drawFastImage(x, y + 2, 16, 8, powerStatus->getHasUSB() ? imgUSB : imgPower);
|
|
|
|
|
display->drawFastImage(x + 1, y + 3, 16, 8, powerStatus->getHasUSB() ? imgUSB : imgPower);
|
|
|
|
|
// Display nodes status
|
|
|
|
|
drawNodes(display, x + (SCREEN_WIDTH * 0.25), y + 2, nodeStatus);
|
|
|
|
|
drawNodes(display, x + (SCREEN_WIDTH * 0.25), y + 3, nodeStatus);
|
|
|
|
|
// Display GPS status
|
|
|
|
|
if (!config.position.gps_enabled){
|
|
|
|
|
int16_t yPos = y + 2;
|
|
|
|
|
#ifdef GPS_POWER_TOGGLE
|
|
|
|
|
int16_t yPos = y + 2;
|
|
|
|
|
#ifdef GPS_POWER_TOGGLE
|
|
|
|
|
yPos = (y + 10 + FONT_HEIGHT_SMALL);
|
|
|
|
|
#endif
|
|
|
|
|
drawGPSpowerstat(display, x, yPos, gpsStatus);
|
|
|
|
|
#endif
|
|
|
|
|
drawGPSpowerstat(display, x, yPos, gpsStatus);
|
|
|
|
|
} else {
|
|
|
|
|
drawGPS(display, x + (SCREEN_WIDTH * 0.63), y + 2, gpsStatus);
|
|
|
|
|
drawGPS(display, x + (SCREEN_WIDTH * 0.63), y + 2, gpsStatus);
|
|
|
|
|
drawGPS(display, x + (SCREEN_WIDTH * 0.63), y + 3, gpsStatus);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
display->setColor(WHITE);
|
|
|
|
|
// Draw the channel name
|
|
|
|
|
display->drawString(x, y + FONT_HEIGHT_SMALL, channelStr);
|
|
|
|
|
// Draw our hardware ID to assist with bluetooth pairing
|
|
|
|
|
@@ -1428,15 +1442,24 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|
|
|
|
// The coordinates define the left starting point of the text
|
|
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
|
|
|
|
|
|
|
|
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
|
|
|
|
display->setColor(BLACK);
|
|
|
|
|
|
|
|
|
|
if (WiFi.status() != WL_CONNECTED) {
|
|
|
|
|
display->drawString(x, y, String("WiFi: Not Connected"));
|
|
|
|
|
display->drawString(x + 1, y, String("WiFi: Not Connected"));
|
|
|
|
|
} else {
|
|
|
|
|
display->drawString(x, y, String("WiFi: Connected"));
|
|
|
|
|
display->drawString(x + 1, y, String("WiFi: Connected"));
|
|
|
|
|
|
|
|
|
|
display->drawString(x + SCREEN_WIDTH - display->getStringWidth("RSSI " + String(WiFi.RSSI())), y,
|
|
|
|
|
"RSSI " + String(WiFi.RSSI()));
|
|
|
|
|
display->drawString(x + SCREEN_WIDTH - display->getStringWidth("RSSI " + String(WiFi.RSSI())) - 1, y,
|
|
|
|
|
"RSSI " + String(WiFi.RSSI()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
display->setColor(WHITE);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
- WL_CONNECTED: assigned when connected to a WiFi network;
|
|
|
|
|
- WL_NO_SSID_AVAIL: assigned when no SSID are available;
|
|
|
|
|
@@ -1545,6 +1568,9 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|
|
|
|
// The coordinates define the left starting point of the text
|
|
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
|
|
|
|
|
|
|
|
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
|
|
|
|
display->setColor(BLACK);
|
|
|
|
|
|
|
|
|
|
char batStr[20];
|
|
|
|
|
if (powerStatus->getHasBattery()) {
|
|
|
|
|
int batV = powerStatus->getBatteryVoltageMv() / 1000;
|
|
|
|
|
@@ -1555,9 +1581,11 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|
|
|
|
|
|
|
|
|
// Line 1
|
|
|
|
|
display->drawString(x, y, batStr);
|
|
|
|
|
display->drawString(x + 1, y, batStr);
|
|
|
|
|
} else {
|
|
|
|
|
// Line 1
|
|
|
|
|
display->drawString(x, y, String("USB"));
|
|
|
|
|
display->drawString(x + 1, y, String("USB"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto mode = "";
|
|
|
|
|
@@ -1590,6 +1618,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode), y, mode);
|
|
|
|
|
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode) - 1, y, mode);
|
|
|
|
|
|
|
|
|
|
// Line 2
|
|
|
|
|
uint32_t currentMillis = millis();
|
|
|
|
|
@@ -1602,6 +1631,8 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|
|
|
|
// minutes %= 60;
|
|
|
|
|
// hours %= 24;
|
|
|
|
|
|
|
|
|
|
display->setColor(WHITE);
|
|
|
|
|
|
|
|
|
|
// Show uptime as days, hours, minutes OR seconds
|
|
|
|
|
String uptime;
|
|
|
|
|
if (days >= 2)
|
|
|
|
|
|