mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 10:16:11 +00:00
fix(ui): force immediate refresh when BLE disconnects
UITask.onBLEDisconnected() sets _next_refresh=0 so the BLE icon updates instantly instead of waiting for the next polling cycle. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a1fc67ed96
commit
ec4b7d625f
@@ -34,8 +34,13 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setHasConnection(bool connected) { _connected = connected; }
|
void setHasConnection(bool connected) {
|
||||||
|
bool prev = _connected;
|
||||||
|
_connected = connected;
|
||||||
|
if (prev && !connected) onBLEDisconnected();
|
||||||
|
}
|
||||||
bool hasConnection() const { return _connected; }
|
bool hasConnection() const { return _connected; }
|
||||||
|
virtual void onBLEDisconnected() {}
|
||||||
// True only when a BLE central is actually bonded/connected. On a dual
|
// True only when a BLE central is actually bonded/connected. On a dual
|
||||||
// (BLE+USB) interface hasConnection() is always true (USB counts), so use
|
// (BLE+USB) interface hasConnection() is always true (USB counts), so use
|
||||||
// this for BLE-specific UI like the pairing-PIN prompt.
|
// this for BLE-specific UI like the pairing-PIN prompt.
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ public:
|
|||||||
curr = NULL;
|
curr = NULL;
|
||||||
}
|
}
|
||||||
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs);
|
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs);
|
||||||
|
void onBLEDisconnected() override { _next_refresh = 0; }
|
||||||
|
|
||||||
NodePrefs* getNodePrefs() const { return _node_prefs; }
|
NodePrefs* getNodePrefs() const { return _node_prefs; }
|
||||||
uint16_t getBattMilliVolts() const { return _batt_mv > 0 ? _batt_mv : AbstractUITask::getBattMilliVolts(); }
|
uint16_t getBattMilliVolts() const { return _batt_mv > 0 ? _batt_mv : AbstractUITask::getBattMilliVolts(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user