fix(settings): preserve preset across off-grid repeat

This commit is contained in:
just-stuff-tm
2026-03-11 11:18:35 -04:00
committed by Enot (ded) Skelly
parent 82e04e8090
commit c7b7deb0f6
2 changed files with 374 additions and 33 deletions
+24
View File
@@ -104,6 +104,22 @@ class RepeaterBatterySnapshot {
});
}
class MeshCoreRadioStateSnapshot {
final int freqHz;
final int bwHz;
final int sf;
final int cr;
final int txPowerDbm;
const MeshCoreRadioStateSnapshot({
required this.freqHz,
required this.bwHz,
required this.sf,
required this.cr,
required this.txPowerDbm,
});
}
class MeshCoreConnector extends ChangeNotifier {
// Message windowing to limit memory usage
static const int _messageWindowSize = 200;
@@ -169,6 +185,7 @@ class MeshCoreConnector extends ChangeNotifier {
int? _currentSf;
int? _currentCr;
bool? _clientRepeat;
MeshCoreRadioStateSnapshot? _rememberedNonRepeatRadioState;
int? _firmwareVerCode;
int _pathHashByteWidth = 1;
CompanionRadioStats? _latestRadioStats;
@@ -369,6 +386,8 @@ class MeshCoreConnector extends ChangeNotifier {
int? get currentBwHz => _currentBwHz;
int? get currentSf => _currentSf;
int? get currentCr => _currentCr;
MeshCoreRadioStateSnapshot? get rememberedNonRepeatRadioState =>
_rememberedNonRepeatRadioState;
bool? get autoAddUsers => _autoAddUsers;
bool? get autoAddRepeaters => _autoAddRepeaters;
bool? get autoAddRoomServers => _autoAddRoomServers;
@@ -380,6 +399,10 @@ class MeshCoreConnector extends ChangeNotifier {
int get advertLocationPolicy => _advertLocPolicy;
int get multiAcks => _multiAcks;
bool? get clientRepeat => _clientRepeat;
void rememberNonRepeatRadioState(MeshCoreRadioStateSnapshot snapshot) {
_rememberedNonRepeatRadioState = snapshot;
}
int? get firmwareVerCode => _firmwareVerCode;
Map<String, String>? get currentCustomVars => _currentCustomVars;
int? get batteryMillivolts => _batteryMillivolts;
@@ -2278,6 +2301,7 @@ class MeshCoreConnector extends ChangeNotifier {
_selfLatitude = null;
_selfLongitude = null;
_clientRepeat = null;
_rememberedNonRepeatRadioState = null;
_firmwareVerCode = null;
_batteryMillivolts = null;
_repeaterBatterySnapshots.clear();