mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Fix channel sync errors
This commit is contained in:
@@ -772,7 +772,21 @@ class ConnectionProvider with ChangeNotifier {
|
|||||||
try {
|
try {
|
||||||
// Use maxChannels from device info if available, otherwise default to 40
|
// Use maxChannels from device info if available, otherwise default to 40
|
||||||
final channelCount = maxChannels ?? _deviceInfo.maxChannels ?? 40;
|
final channelCount = maxChannels ?? _deviceInfo.maxChannels ?? 40;
|
||||||
await _activeService.syncAllChannels(maxChannels: channelCount);
|
debugPrint(
|
||||||
|
'📻 [Provider] Syncing channels with tolerant per-slot reads (1-${channelCount - 1})...',
|
||||||
|
);
|
||||||
|
|
||||||
|
for (int i = 1; i < channelCount; i++) {
|
||||||
|
try {
|
||||||
|
await _activeService.getChannel(i);
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint(
|
||||||
|
'⚠️ [Provider] Channel sync skipped slot $i after read failure: $e',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
debugPrint('✅ [Provider] Channel sync complete');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_error = 'Failed to sync channels: $e';
|
_error = 'Failed to sync channels: $e';
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@@ -996,7 +1010,7 @@ class ConnectionProvider with ChangeNotifier {
|
|||||||
|
|
||||||
// Refresh channel state before choosing a slot so we match meshcore-open's
|
// Refresh channel state before choosing a slot so we match meshcore-open's
|
||||||
// "pick first missing slot from the synced list" behavior.
|
// "pick first missing slot from the synced list" behavior.
|
||||||
await _activeService.syncAllChannels(maxChannels: maxChannels);
|
await syncChannels(maxChannels: maxChannels);
|
||||||
|
|
||||||
// Match meshcore-open behavior:
|
// Match meshcore-open behavior:
|
||||||
// - deterministic hash channels (#name) cannot be duplicated
|
// - deterministic hash channels (#name) cannot be duplicated
|
||||||
|
|||||||
Reference in New Issue
Block a user