|
|
|
@ -53,23 +53,24 @@ public: |
|
|
|
|
|
|
|
int render(DisplayDriver& display) override { |
|
|
|
// meshcore logo
|
|
|
|
display.setColor(DisplayDriver::BLUE); |
|
|
|
display.setColor(UIColor::corp_blue); |
|
|
|
int logoWidth = 128; |
|
|
|
display.drawXbm((display.width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13); |
|
|
|
|
|
|
|
// meshcore website
|
|
|
|
const char* website = "https://meshcore.io"; |
|
|
|
display.setColor(DisplayDriver::LIGHT); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
display.setTextSize(1); |
|
|
|
uint16_t websiteWidth = display.getTextWidth(website); |
|
|
|
display.setCursor((display.width() - websiteWidth) / 2, 22); |
|
|
|
display.print(website); |
|
|
|
|
|
|
|
// version info
|
|
|
|
display.setColor(DisplayDriver::LIGHT); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
display.setTextSize(1); |
|
|
|
display.drawTextCentered(display.width()/2, 35, _version_info); |
|
|
|
|
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.setTextSize(1); |
|
|
|
display.drawTextCentered(display.width()/2, 48, FIRMWARE_BUILD_DATE); |
|
|
|
|
|
|
|
@ -128,7 +129,7 @@ class HomeScreen : public UIScreen { |
|
|
|
int iconHeight = 10; |
|
|
|
int iconX = display.width() - iconWidth - 5; // Position the icon near the top-right corner
|
|
|
|
int iconY = 0; |
|
|
|
display.setColor(DisplayDriver::GREEN); |
|
|
|
display.setColor(UIColor::title_txt); |
|
|
|
|
|
|
|
// battery outline
|
|
|
|
display.drawRect(iconX, iconY, iconWidth, iconHeight); |
|
|
|
@ -143,7 +144,7 @@ class HomeScreen : public UIScreen { |
|
|
|
// show muted icon if buzzer is muted
|
|
|
|
#ifdef PIN_BUZZER |
|
|
|
if (_task->isBuzzerQuiet()) { |
|
|
|
display.setColor(DisplayDriver::RED); |
|
|
|
display.setColor(UIColor::warning_txt); |
|
|
|
display.drawXbm(iconX - 9, iconY + 1, muted_icon, 8, 8); |
|
|
|
} |
|
|
|
#endif |
|
|
|
@ -188,34 +189,37 @@ public: |
|
|
|
} |
|
|
|
|
|
|
|
int render(DisplayDriver& display) override { |
|
|
|
display.setColor(UIColor::title_bkg); |
|
|
|
display.fillRect(0, 0, display.width(), 12); |
|
|
|
char tmp[80]; |
|
|
|
// node name
|
|
|
|
display.setTextSize(1); |
|
|
|
display.setColor(DisplayDriver::GREEN); |
|
|
|
display.setColor(UIColor::title_txt); |
|
|
|
char filtered_name[sizeof(_node_prefs->node_name)]; |
|
|
|
display.translateUTF8ToBlocks(filtered_name, _node_prefs->node_name, sizeof(filtered_name)); |
|
|
|
display.setCursor(0, 0); |
|
|
|
display.setCursor(0, 2); |
|
|
|
display.print(filtered_name); |
|
|
|
|
|
|
|
// battery voltage
|
|
|
|
renderBatteryIndicator(display, _task->getBattMilliVolts()); |
|
|
|
|
|
|
|
// curr page indicator
|
|
|
|
display.setColor(UIColor::title_bkg); |
|
|
|
int y = 14; |
|
|
|
int x = display.width() / 2 - 5 * (HomePage::Count-1); |
|
|
|
for (uint8_t i = 0; i < HomePage::Count; i++, x += 10) { |
|
|
|
if (i == _page) { |
|
|
|
display.fillRect(x-1, y-1, 3, 3); |
|
|
|
display.fillRect(x-1, y-1, 4, 4); |
|
|
|
} else { |
|
|
|
display.fillRect(x, y, 1, 1); |
|
|
|
display.fillRect(x, y, 2, 2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (_page == HomePage::FIRST) { |
|
|
|
display.setColor(DisplayDriver::YELLOW); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
display.setTextSize(2); |
|
|
|
sprintf(tmp, "MSG: %d", _task->getMsgCount()); |
|
|
|
display.drawTextCentered(display.width() / 2, 20, tmp); |
|
|
|
display.drawTextCentered(display.width() / 2, 22, tmp); |
|
|
|
|
|
|
|
#ifdef WIFI_SSID |
|
|
|
IPAddress ip = WiFi.localIP(); |
|
|
|
@ -224,19 +228,19 @@ public: |
|
|
|
display.drawTextCentered(display.width() / 2, 54, tmp); |
|
|
|
#endif |
|
|
|
if (_task->hasConnection()) { |
|
|
|
display.setColor(DisplayDriver::GREEN); |
|
|
|
display.setColor(UIColor::warning_txt); |
|
|
|
display.setTextSize(1); |
|
|
|
display.drawTextCentered(display.width() / 2, 43, "< Connected >"); |
|
|
|
|
|
|
|
} else if (the_mesh.getBLEPin() != 0) { // BT pin
|
|
|
|
display.setColor(DisplayDriver::RED); |
|
|
|
display.setColor(UIColor::warning_txt); |
|
|
|
display.setTextSize(2); |
|
|
|
sprintf(tmp, "Pin:%d", the_mesh.getBLEPin()); |
|
|
|
display.drawTextCentered(display.width() / 2, 43, tmp); |
|
|
|
} |
|
|
|
} else if (_page == HomePage::RECENT) { |
|
|
|
the_mesh.getRecentlyHeard(recent, UI_RECENT_LIST_SIZE); |
|
|
|
display.setColor(DisplayDriver::GREEN); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
int y = 20; |
|
|
|
for (int i = 0; i < UI_RECENT_LIST_SIZE; i++, y += 11) { |
|
|
|
auto a = &recent[i]; |
|
|
|
@ -260,7 +264,7 @@ public: |
|
|
|
display.print(tmp); |
|
|
|
} |
|
|
|
} else if (_page == HomePage::RADIO) { |
|
|
|
display.setColor(DisplayDriver::YELLOW); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
display.setTextSize(1); |
|
|
|
// freq / sf
|
|
|
|
display.setCursor(0, 20); |
|
|
|
@ -279,15 +283,17 @@ public: |
|
|
|
sprintf(tmp, "Noise floor: %d", radio_driver.getNoiseFloor()); |
|
|
|
display.print(tmp); |
|
|
|
} else if (_page == HomePage::BLUETOOTH) { |
|
|
|
display.setColor(DisplayDriver::GREEN); |
|
|
|
display.setColor(UIColor::corp_blue); |
|
|
|
display.drawXbm((display.width() - 32) / 2, 18, |
|
|
|
_task->isSerialEnabled() ? bluetooth_on : bluetooth_off, |
|
|
|
32, 32); |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.setTextSize(1); |
|
|
|
display.drawTextCentered(display.width() / 2, 64 - 11, "toggle: " PRESS_LABEL); |
|
|
|
} else if (_page == HomePage::ADVERT) { |
|
|
|
display.setColor(DisplayDriver::GREEN); |
|
|
|
display.setColor(UIColor::corp_blue); |
|
|
|
display.drawXbm((display.width() - 32) / 2, 18, advert_icon, 32, 32); |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.drawTextCentered(display.width() / 2, 64 - 11, "advert: " PRESS_LABEL); |
|
|
|
#if ENV_INCLUDE_GPS == 1 |
|
|
|
} else if (_page == HomePage::GPS) { |
|
|
|
@ -305,24 +311,33 @@ public: |
|
|
|
#else |
|
|
|
strcpy(buf, gps_state ? "gps on" : "gps off"); |
|
|
|
#endif |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
display.drawTextLeftAlign(0, y, buf); |
|
|
|
if (nmea == NULL) { |
|
|
|
y = y + 12; |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.drawTextLeftAlign(0, y, "Can't access GPS"); |
|
|
|
} else { |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
strcpy(buf, nmea->isValid()?"fix":"no fix"); |
|
|
|
display.drawTextRightAlign(display.width()-1, y, buf); |
|
|
|
y = y + 12; |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.drawTextLeftAlign(0, y, "sat"); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
sprintf(buf, "%d", nmea->satellitesCount()); |
|
|
|
display.drawTextRightAlign(display.width()-1, y, buf); |
|
|
|
y = y + 12; |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.drawTextLeftAlign(0, y, "pos"); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
sprintf(buf, "%.4f %.4f", |
|
|
|
nmea->getLatitude()/1000000., nmea->getLongitude()/1000000.); |
|
|
|
display.drawTextRightAlign(display.width()-1, y, buf); |
|
|
|
y = y + 12; |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.drawTextLeftAlign(0, y, "alt"); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
sprintf(buf, "%.2f", nmea->getAltitude()/1000.); |
|
|
|
display.drawTextRightAlign(display.width()-1, y, buf); |
|
|
|
y = y + 12; |
|
|
|
@ -390,7 +405,9 @@ public: |
|
|
|
strcpy(name, "unk"); sprintf(buf, ""); |
|
|
|
} |
|
|
|
display.setCursor(0, y); |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.print(name); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
display.setCursor( |
|
|
|
display.width()-display.getTextWidth(buf)-1, y |
|
|
|
); |
|
|
|
@ -401,11 +418,13 @@ public: |
|
|
|
else sensors_scroll_offset = 0; |
|
|
|
#endif |
|
|
|
} else if (_page == HomePage::SHUTDOWN) { |
|
|
|
display.setColor(DisplayDriver::GREEN); |
|
|
|
display.setColor(UIColor::corp_blue); |
|
|
|
display.setTextSize(1); |
|
|
|
if (_shutdown_init) { |
|
|
|
display.setColor(UIColor::warning_txt); |
|
|
|
display.drawTextCentered(display.width() / 2, 34, "hibernating..."); |
|
|
|
} else { |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
display.drawXbm((display.width() - 32) / 2, 18, power_icon, 32, 32); |
|
|
|
display.drawTextCentered(display.width() / 2, 64 - 11, "hibernate:" PRESS_LABEL); |
|
|
|
} |
|
|
|
@ -498,7 +517,7 @@ public: |
|
|
|
char tmp[16]; |
|
|
|
display.setCursor(0, 0); |
|
|
|
display.setTextSize(1); |
|
|
|
display.setColor(DisplayDriver::GREEN); |
|
|
|
display.setColor(UIColor::corp_blue); |
|
|
|
sprintf(tmp, "Unread: %d", num_unread); |
|
|
|
display.print(tmp); |
|
|
|
|
|
|
|
@ -518,13 +537,13 @@ public: |
|
|
|
display.drawRect(0, 11, display.width(), 1); // horiz line
|
|
|
|
|
|
|
|
display.setCursor(0, 14); |
|
|
|
display.setColor(DisplayDriver::YELLOW); |
|
|
|
display.setColor(UIColor::secondary_txt); |
|
|
|
char filtered_origin[sizeof(p->origin)]; |
|
|
|
display.translateUTF8ToBlocks(filtered_origin, p->origin, sizeof(filtered_origin)); |
|
|
|
display.print(filtered_origin); |
|
|
|
|
|
|
|
display.setCursor(0, 25); |
|
|
|
display.setColor(DisplayDriver::LIGHT); |
|
|
|
display.setColor(UIColor::primary_txt); |
|
|
|
char filtered_msg[sizeof(p->msg)]; |
|
|
|
display.translateUTF8ToBlocks(filtered_msg, p->msg, sizeof(filtered_msg)); |
|
|
|
display.printWordWrap(filtered_msg, display.width()); |
|
|
|
@ -806,9 +825,9 @@ void UITask::loop() { |
|
|
|
_display->setTextSize(1); |
|
|
|
int y = _display->height() / 3; |
|
|
|
int p = _display->height() / 32; |
|
|
|
_display->setColor(DisplayDriver::DARK); |
|
|
|
_display->setColor(UIColor::popup_bkg); |
|
|
|
_display->fillRect(p, y, _display->width() - p*2, y); |
|
|
|
_display->setColor(DisplayDriver::LIGHT); // draw box border
|
|
|
|
_display->setColor(UIColor::popup_txt); // draw box border
|
|
|
|
_display->drawRect(p, y, _display->width() - p*2, y); |
|
|
|
_display->drawTextCentered(_display->width() / 2, y + p*3, _alert); |
|
|
|
_next_refresh = _alert_expiry; // will need refresh when alert is dismissed
|
|
|
|
@ -845,7 +864,7 @@ void UITask::loop() { |
|
|
|
if (_display != NULL) { |
|
|
|
_display->startFrame(); |
|
|
|
_display->setTextSize(2); |
|
|
|
_display->setColor(DisplayDriver::RED); |
|
|
|
_display->setColor(UIColor::warning_txt); |
|
|
|
_display->drawTextCentered(_display->width() / 2, 20, "Low Battery."); |
|
|
|
_display->drawTextCentered(_display->width() / 2, 40, "Shutting Down!"); |
|
|
|
_display->endFrame(); |
|
|
|
|