mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 10:16:11 +00:00
feat: polish status bar and home screen layout
- Move "A" (auto-advert) indicator left of BT "B" in status bar - Ellipsize node name to fit available width instead of overflowing - Shrink A and B background rectangles by 1px right, 2px bottom - Change A blink to 2s on / 2s off at 1000ms refresh rate - Auto-advert sends GPS position directly via createSelfAdvert/sendZeroHop - Align Settings and Tools home page titles to y=22, same as Messages Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
b36c970a2d
commit
9426c86e79
@@ -2206,7 +2206,10 @@ void MyMesh::loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_prefs.advert_auto_interval_sec > 0 && millisHasNowPassed(_next_auto_advert_ms)) {
|
if (_prefs.advert_auto_interval_sec > 0 && millisHasNowPassed(_next_auto_advert_ms)) {
|
||||||
advert();
|
mesh::Packet* pkt = (sensors.node_lat != 0 || sensors.node_lon != 0)
|
||||||
|
? createSelfAdvert(_prefs.node_name, sensors.node_lat, sensors.node_lon)
|
||||||
|
: createSelfAdvert(_prefs.node_name);
|
||||||
|
if (pkt) sendZeroHop(pkt);
|
||||||
_next_auto_advert_ms = futureMillis(_prefs.advert_auto_interval_sec * 1000UL);
|
_next_auto_advert_ms = futureMillis(_prefs.advert_auto_interval_sec * 1000UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1658,7 +1658,7 @@ class HomeScreen : public UIScreen {
|
|||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderBatteryIndicator(DisplayDriver& display, uint16_t batteryMilliVolts) {
|
int renderBatteryIndicator(DisplayDriver& display, uint16_t batteryMilliVolts) {
|
||||||
#ifndef BATT_MIN_MILLIVOLTS
|
#ifndef BATT_MIN_MILLIVOLTS
|
||||||
#define BATT_MIN_MILLIVOLTS 3200
|
#define BATT_MIN_MILLIVOLTS 3200
|
||||||
#endif
|
#endif
|
||||||
@@ -1729,6 +1729,7 @@ class HomeScreen : public UIScreen {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// BT connection indicator (left of muted/battery icons)
|
// BT connection indicator (left of muted/battery icons)
|
||||||
|
int leftmostX = battLeftX;
|
||||||
if (_task->isSerialEnabled()) {
|
if (_task->isSerialEnabled()) {
|
||||||
#ifdef PIN_BUZZER
|
#ifdef PIN_BUZZER
|
||||||
int btX = battLeftX - 18;
|
int btX = battLeftX - 18;
|
||||||
@@ -1737,7 +1738,7 @@ class HomeScreen : public UIScreen {
|
|||||||
#endif
|
#endif
|
||||||
if (_task->hasConnection()) {
|
if (_task->hasConnection()) {
|
||||||
display.setColor(DisplayDriver::LIGHT);
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
display.fillRect(btX - 1, 0, 8, 9);
|
display.fillRect(btX - 1, 0, 7, 7);
|
||||||
display.setColor(DisplayDriver::DARK);
|
display.setColor(DisplayDriver::DARK);
|
||||||
display.setCursor(btX, 0);
|
display.setCursor(btX, 0);
|
||||||
display.print("B");
|
display.print("B");
|
||||||
@@ -1747,7 +1748,23 @@ class HomeScreen : public UIScreen {
|
|||||||
display.setCursor(btX, 0);
|
display.setCursor(btX, 0);
|
||||||
display.print("b");
|
display.print("b");
|
||||||
}
|
}
|
||||||
|
leftmostX = btX - 1;
|
||||||
|
|
||||||
|
// "A" indicator — left of BT, blinks 50% duty at 1s period
|
||||||
|
if (_node_prefs && _node_prefs->advert_auto_interval_sec > 0) {
|
||||||
|
int aX = leftmostX - 8;
|
||||||
|
if ((millis() % 4000) < 2000) {
|
||||||
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
|
display.fillRect(aX - 1, 0, 7, 7);
|
||||||
|
display.setColor(DisplayDriver::DARK);
|
||||||
|
display.setCursor(aX, 0);
|
||||||
|
display.print("A");
|
||||||
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
|
}
|
||||||
|
leftmostX = aX - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return leftmostX;
|
||||||
}
|
}
|
||||||
|
|
||||||
CayenneLPP sensors_lpp;
|
CayenneLPP sensors_lpp;
|
||||||
@@ -1796,19 +1813,9 @@ public:
|
|||||||
display.setColor(DisplayDriver::LIGHT);
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
char filtered_name[sizeof(_node_prefs->node_name)];
|
char filtered_name[sizeof(_node_prefs->node_name)];
|
||||||
display.translateUTF8ToBlocks(filtered_name, _node_prefs->node_name, sizeof(filtered_name));
|
display.translateUTF8ToBlocks(filtered_name, _node_prefs->node_name, sizeof(filtered_name));
|
||||||
display.setCursor(0, 0);
|
int rightEdge = renderBatteryIndicator(display, _task->getBattMilliVolts());
|
||||||
display.print(filtered_name);
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
if (_node_prefs->advert_auto_interval_sec > 0 && (millis() % 1000) < 500) {
|
display.drawTextEllipsized(0, 0, rightEdge - 2, filtered_name);
|
||||||
int spaceW = display.getTextWidth(" ");
|
|
||||||
int aW = display.getTextWidth("A");
|
|
||||||
int ax = display.getTextWidth(filtered_name) + spaceW;
|
|
||||||
display.fillRect(ax - 1, 0, aW + 2, 8);
|
|
||||||
display.setColor(DisplayDriver::DARK);
|
|
||||||
display.setCursor(ax, 0);
|
|
||||||
display.print("A");
|
|
||||||
display.setColor(DisplayDriver::LIGHT);
|
|
||||||
}
|
|
||||||
renderBatteryIndicator(display, _task->getBattMilliVolts());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure current page is visible (e.g. after settings change)
|
// ensure current page is visible (e.g. after settings change)
|
||||||
@@ -2115,13 +2122,13 @@ public:
|
|||||||
} else if (_page == HomePage::SETTINGS) {
|
} else if (_page == HomePage::SETTINGS) {
|
||||||
display.setColor(DisplayDriver::LIGHT);
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
display.setTextSize(1);
|
display.setTextSize(1);
|
||||||
display.drawTextCentered(display.width() / 2, 30, "Settings");
|
display.drawTextCentered(display.width() / 2, 22, "Settings");
|
||||||
display.drawTextCentered(display.width() / 2, 46, PRESS_LABEL " to open");
|
display.drawTextCentered(display.width() / 2, 50, PRESS_LABEL " to open");
|
||||||
} else if (_page == HomePage::TOOLS) {
|
} else if (_page == HomePage::TOOLS) {
|
||||||
display.setColor(DisplayDriver::LIGHT);
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
display.setTextSize(1);
|
display.setTextSize(1);
|
||||||
display.drawTextCentered(display.width() / 2, 30, "Tools");
|
display.drawTextCentered(display.width() / 2, 22, "Tools");
|
||||||
display.drawTextCentered(display.width() / 2, 46, PRESS_LABEL " to open");
|
display.drawTextCentered(display.width() / 2, 50, PRESS_LABEL " to open");
|
||||||
} else if (_page == HomePage::QUICK_MSG) {
|
} else if (_page == HomePage::QUICK_MSG) {
|
||||||
display.setColor(DisplayDriver::LIGHT);
|
display.setColor(DisplayDriver::LIGHT);
|
||||||
display.setTextSize(1);
|
display.setTextSize(1);
|
||||||
@@ -2146,9 +2153,9 @@ public:
|
|||||||
bool auto_adv = _node_prefs && _node_prefs->advert_auto_interval_sec > 0;
|
bool auto_adv = _node_prefs && _node_prefs->advert_auto_interval_sec > 0;
|
||||||
if (_page == HomePage::CLOCK) {
|
if (_page == HomePage::CLOCK) {
|
||||||
bool show_sec = !_node_prefs || !_node_prefs->clock_hide_seconds;
|
bool show_sec = !_node_prefs || !_node_prefs->clock_hide_seconds;
|
||||||
return auto_adv ? 300 : (show_sec ? 1000 : 60000);
|
return auto_adv ? 1000 : (show_sec ? 1000 : 60000);
|
||||||
}
|
}
|
||||||
return auto_adv ? 300 : 5000;
|
return auto_adv ? 1000 : 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool handleInput(char c) override {
|
bool handleInput(char c) override {
|
||||||
|
|||||||
Reference in New Issue
Block a user