mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
feat(ui-new): a bolt beside the battery while USB power is connected
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
643dc09615
commit
6e13ad59ae
@@ -766,7 +766,7 @@ class HomeScreen : public UIScreen {
|
|||||||
// icon won't fit above the reserved area, every lower-priority icon after
|
// icon won't fit above the reserved area, every lower-priority icon after
|
||||||
// it is dropped too (the list is ordered high→low).
|
// it is dropped too (the list is ordered high→low).
|
||||||
//
|
//
|
||||||
// Priority: BT > GPS fix > alarm > mute > auto-advert > trail > live-share >
|
// Priority: power > BT > GPS fix > alarm > mute > auto-advert > trail > live-share >
|
||||||
// repeater. Battery (drawn above) is always rightmost. The background modes
|
// repeater. Battery (drawn above) is always rightmost. The background modes
|
||||||
// (advert / trail / live-share / repeater) stay outside any BT gate — they
|
// (advert / trail / live-share / repeater) stay outside any BT gate — they
|
||||||
// keep running with Bluetooth off, so their cue must not vanish with it.
|
// keep running with Bluetooth off, so their cue must not vanish with it.
|
||||||
@@ -782,6 +782,7 @@ class HomeScreen : public UIScreen {
|
|||||||
const bool gps_fix = gps_on && loc->isValid();
|
const bool gps_fix = gps_on && loc->isValid();
|
||||||
struct Sicon { bool active; const MiniIcon* icon; };
|
struct Sicon { bool active; const MiniIcon* icon; };
|
||||||
const Sicon icons[] = {
|
const Sicon icons[] = {
|
||||||
|
{ board.isExternalPowered(), &ICON_CHARGE }, // USB power: next to the battery
|
||||||
{ _task->isSerialEnabled() && _task->isBLEConnected(), &ICON_BLUETOOTH },
|
{ _task->isSerialEnabled() && _task->isBLEConnected(), &ICON_BLUETOOTH },
|
||||||
{ gps_on, gps_fix ? &ICON_GPS : &ICON_GPS_SEARCH },
|
{ gps_on, gps_fix ? &ICON_GPS : &ICON_GPS_SEARCH },
|
||||||
{ _node_prefs && _node_prefs->alarm_on, &ICON_ALARM },
|
{ _node_prefs && _node_prefs->alarm_on, &ICON_ALARM },
|
||||||
|
|||||||
@@ -488,6 +488,16 @@ MINI_ICON(ICON_ALARM, 9, // bell — an alarm is armed
|
|||||||
packRow("#########"),
|
packRow("#########"),
|
||||||
packRow("........."),
|
packRow("........."),
|
||||||
packRow("...###..."));
|
packRow("...###..."));
|
||||||
|
MINI_ICON(ICON_CHARGE, 9, // lightning bolt -- on external power
|
||||||
|
packRow("......##."),
|
||||||
|
packRow(".....##.."),
|
||||||
|
packRow("....##..."),
|
||||||
|
packRow("...#####."),
|
||||||
|
packRow(".#####..."),
|
||||||
|
packRow("...##...."),
|
||||||
|
packRow("..##....."),
|
||||||
|
packRow(".##......"),
|
||||||
|
packRow(".#......."));
|
||||||
MINI_ICON(ICON_TRAIL, 7, // map pin (GPS trail logging)
|
MINI_ICON(ICON_TRAIL, 7, // map pin (GPS trail logging)
|
||||||
packRow("..###.."),
|
packRow("..###.."),
|
||||||
packRow(".#####."),
|
packRow(".#####."),
|
||||||
@@ -572,6 +582,14 @@ MINI_ICON(ICON_ALARM, 7, // bell — an alarm is armed
|
|||||||
packRow(".#####."),
|
packRow(".#####."),
|
||||||
packRow("#######"),
|
packRow("#######"),
|
||||||
packRow("...#..."));
|
packRow("...#..."));
|
||||||
|
MINI_ICON(ICON_CHARGE, 7, // lightning bolt -- on external power
|
||||||
|
packRow("....##."),
|
||||||
|
packRow("...##.."),
|
||||||
|
packRow("..##..."),
|
||||||
|
packRow(".#####."),
|
||||||
|
packRow("...##.."),
|
||||||
|
packRow("..##..."),
|
||||||
|
packRow("..#...."));
|
||||||
MINI_ICON(ICON_TRAIL, 7, // map pin (GPS trail logging)
|
MINI_ICON(ICON_TRAIL, 7, // map pin (GPS trail logging)
|
||||||
packRow("..###.."),
|
packRow("..###.."),
|
||||||
packRow(".#####."),
|
packRow(".#####."),
|
||||||
@@ -644,6 +662,13 @@ MINI_ICON(ICON_ALARM, 5, // bell — an alarm is armed
|
|||||||
packRow(".###."),
|
packRow(".###."),
|
||||||
packRow("#####"),
|
packRow("#####"),
|
||||||
packRow("..#.."));
|
packRow("..#.."));
|
||||||
|
MINI_ICON(ICON_CHARGE, 5, // lightning bolt -- on external power
|
||||||
|
packRow("...#."),
|
||||||
|
packRow("..##."),
|
||||||
|
packRow(".####"),
|
||||||
|
packRow("..##."),
|
||||||
|
packRow(".##.."),
|
||||||
|
packRow(".#..."));
|
||||||
|
|
||||||
MINI_ICON(ICON_TRAIL, 6, // map pin / location marker (GPS trail logging)
|
MINI_ICON(ICON_TRAIL, 6, // map pin / location marker (GPS trail logging)
|
||||||
packRow(".####."),
|
packRow(".####."),
|
||||||
|
|||||||
@@ -16,9 +16,14 @@ class SimMainBoard : public mesh::MainBoard {
|
|||||||
// plumbed through, same reasoning as SimLocationProvider.h's singleton.
|
// plumbed through, same reasoning as SimLocationProvider.h's singleton.
|
||||||
static uint16_t& battMilliVoltsRef() { static uint16_t mv = 4000; return mv; }
|
static uint16_t& battMilliVoltsRef() { static uint16_t mv = 4000; return mv; }
|
||||||
|
|
||||||
|
static bool& externalPowerRef() { static bool on = false; return on; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void begin() { }
|
void begin() { }
|
||||||
|
|
||||||
|
bool isExternalPowered() override { return externalPowerRef(); }
|
||||||
|
static void setExternalPower(bool on) { externalPowerRef() = on; }
|
||||||
|
|
||||||
uint16_t getBattMilliVolts() override { return battMilliVoltsRef(); }
|
uint16_t getBattMilliVolts() override { return battMilliVoltsRef(); }
|
||||||
static void setBattMilliVolts(uint16_t mv) { battMilliVoltsRef() = mv; }
|
static void setBattMilliVolts(uint16_t mv) { battMilliVoltsRef() = mv; }
|
||||||
const char* getManufacturerName() const override { return "MeshCore Sim (native)"; }
|
const char* getManufacturerName() const override { return "MeshCore Sim (native)"; }
|
||||||
@@ -43,4 +48,7 @@ public:
|
|||||||
extern "C" inline EMSCRIPTEN_KEEPALIVE void sim_battery_set_mv(int mv) {
|
extern "C" inline EMSCRIPTEN_KEEPALIVE void sim_battery_set_mv(int mv) {
|
||||||
SimMainBoard::setBattMilliVolts((uint16_t)mv);
|
SimMainBoard::setBattMilliVolts((uint16_t)mv);
|
||||||
}
|
}
|
||||||
|
extern "C" inline EMSCRIPTEN_KEEPALIVE void sim_external_power_set(int on) {
|
||||||
|
SimMainBoard::setExternalPower(on != 0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user