часы на первом экране: включены на T096 и V4, раскладка перекомпонована под 128x64
This commit is contained in:
1 parent
bf1e2b852a
commit
c4e362e0ac
3 files changed
+74
-39
No files matched your search
@@ -543,52 +543,85 @@ public:
|
||||
|
||||
if (_page == HomePage::FIRST) {
|
||||
display.setColor(UIColor::primary_txt);
|
||||
#ifdef ENABLE_WIFI_INTERFACE
|
||||
// smaller unread message ui for wifi variants
|
||||
display.setTextSize(1);
|
||||
sprintf(tmp, "Unread Msg: %d", _task->getMsgCount());
|
||||
display.drawTextCentered(display.width() / 2, 22, tmp);
|
||||
#else
|
||||
// larger unread message ui for non wifi variants
|
||||
display.setTextSize(2);
|
||||
sprintf(tmp, "MSG: %d", _task->getMsgCount());
|
||||
display.drawTextCentered(display.width() / 2, 22, tmp);
|
||||
#endif
|
||||
|
||||
// На узких экранах (128x64 — OLED и T096) раскладка оригинала не помещается:
|
||||
// там счётчик и признак связи идут одной мелкой строкой, под ней часы и дата.
|
||||
const bool compact = display.height() < 100;
|
||||
|
||||
if (compact) {
|
||||
display.setTextSize(1);
|
||||
sprintf(tmp, "MSG: %d", _task->getMsgCount());
|
||||
display.setCursor(0, 19);
|
||||
display.print(tmp);
|
||||
if (_task->hasConnection()) {
|
||||
display.setColor(UIColor::warning_txt);
|
||||
display.drawTextRightAlign(display.width() - 1, 19, "<Linked>");
|
||||
display.setColor(UIColor::primary_txt);
|
||||
} else if (the_mesh.getBLEPin() != 0) { // BT pin
|
||||
display.setColor(UIColor::warning_txt);
|
||||
sprintf(tmp, "Pin:%d", the_mesh.getBLEPin());
|
||||
display.drawTextRightAlign(display.width() - 1, 19, tmp);
|
||||
display.setColor(UIColor::primary_txt);
|
||||
}
|
||||
} else {
|
||||
#ifdef ENABLE_WIFI_INTERFACE
|
||||
// smaller unread message ui for wifi variants
|
||||
display.setTextSize(1);
|
||||
sprintf(tmp, "Unread Msg: %d", _task->getMsgCount());
|
||||
display.drawTextCentered(display.width() / 2, 22, tmp);
|
||||
#else
|
||||
// larger unread message ui for non wifi variants
|
||||
display.setTextSize(2);
|
||||
sprintf(tmp, "MSG: %d", _task->getMsgCount());
|
||||
display.drawTextCentered(display.width() / 2, 22, tmp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef UI_SHOW_CLOCK
|
||||
display.setTextSize(3);
|
||||
uint32_t now = _rtc->getCurrentTime();
|
||||
now += (int32_t)_node_prefs->tz_offset * 3600;
|
||||
DateTime dt (now);
|
||||
sprintf(tmp, "%02d:%02d", dt.hour(), dt.minute());
|
||||
display.drawTextCentered(display.width() / 2, 60, tmp);
|
||||
display.setTextSize(1);
|
||||
sprintf(tmp, "%02d/%02d/%d", dt.day(), dt.month(), dt.year());
|
||||
display.drawTextCentered(display.width() / 2, 80, tmp);
|
||||
{
|
||||
uint32_t now = _rtc->getCurrentTime();
|
||||
now += (int32_t)_node_prefs->tz_offset * 3600;
|
||||
DateTime dt (now);
|
||||
display.setTextSize(compact ? 2 : 3);
|
||||
sprintf(tmp, "%02d:%02d", dt.hour(), dt.minute());
|
||||
display.drawTextCentered(display.width() / 2, compact ? 30 : 60, tmp);
|
||||
display.setTextSize(1);
|
||||
display.setColor(UIColor::secondary_txt);
|
||||
sprintf(tmp, "%02d/%02d/%d", dt.day(), dt.month(), dt.year());
|
||||
display.drawTextCentered(display.width() / 2, compact ? 46 : 80, tmp);
|
||||
display.setColor(UIColor::primary_txt);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_WIFI_INTERFACE
|
||||
IPAddress ip = WiFi.localIP();
|
||||
snprintf(tmp, sizeof(tmp), "IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||
display.setTextSize(1);
|
||||
display.drawTextCentered(display.width() / 2, 32, tmp);
|
||||
display.setColor(UIColor::secondary_txt);
|
||||
display.drawTextCentered(display.width() / 2, compact ? 55 : 32, tmp);
|
||||
display.setColor(UIColor::primary_txt);
|
||||
#endif
|
||||
if (_task->hasConnection()) {
|
||||
display.setColor(UIColor::warning_txt);
|
||||
display.setTextSize(1);
|
||||
#ifdef UI_SHOW_CLOCK
|
||||
display.drawTextCentered(display.width() / 2, 110, "< Connected >");
|
||||
#else
|
||||
display.drawTextCentered(display.width() / 2, 43, "< Connected >");
|
||||
#endif
|
||||
} else if (the_mesh.getBLEPin() != 0) { // BT pin
|
||||
display.setColor(UIColor::warning_txt);
|
||||
sprintf(tmp, "Pin:%d", the_mesh.getBLEPin());
|
||||
#ifdef UI_SHOW_CLOCK
|
||||
display.setTextSize(1);
|
||||
display.drawTextCentered(display.width() / 2, 110, tmp);
|
||||
#else
|
||||
display.setTextSize(2);
|
||||
display.drawTextCentered(display.width() / 2, 43, tmp);
|
||||
#endif
|
||||
|
||||
if (!compact) {
|
||||
if (_task->hasConnection()) {
|
||||
display.setColor(UIColor::warning_txt);
|
||||
display.setTextSize(1);
|
||||
#ifdef UI_SHOW_CLOCK
|
||||
display.drawTextCentered(display.width() / 2, 110, "< Connected >");
|
||||
#else
|
||||
display.drawTextCentered(display.width() / 2, 43, "< Connected >");
|
||||
#endif
|
||||
} else if (the_mesh.getBLEPin() != 0) { // BT pin
|
||||
display.setColor(UIColor::warning_txt);
|
||||
sprintf(tmp, "Pin:%d", the_mesh.getBLEPin());
|
||||
#ifdef UI_SHOW_CLOCK
|
||||
display.setTextSize(1);
|
||||
display.drawTextCentered(display.width() / 2, 110, tmp);
|
||||
#else
|
||||
display.setTextSize(2);
|
||||
display.drawTextCentered(display.width() / 2, 43, tmp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else if (_page == HomePage::RECENT) {
|
||||
the_mesh.getRecentlyHeard(recent, UI_RECENT_LIST_SIZE);
|
||||
|
||||
Reference in new issue
Block a user