Optimistically update currentCustomVars in setCustomVar

Reflect the set value immediately so UI bound to currentCustomVars
(e.g. the GPS toggle in settings) updates on tap rather than waiting
for a later device-info refresh.
This commit is contained in:
zjs81
2026-05-08 13:37:51 -07:00
parent 4a72fbd1ad
commit 74840d3baf
+7
View File
@@ -3295,6 +3295,13 @@ class MeshCoreConnector extends ChangeNotifier {
Future<void> setCustomVar(String value) async {
if (!isConnected) return;
await sendFrame(buildSetCustomVarFrame(value));
final sep = value.indexOf(':');
if (sep > 0) {
final key = value.substring(0, sep);
final val = value.substring(sep + 1);
(_currentCustomVars ??= <String, String>{})[key] = val;
notifyListeners();
}
if (value == 'gps:1') {
_startGpsLocationPolling();
} else if (value == 'gps:0') {