mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Fix empty channel slot handling
This commit is contained in:
@@ -848,10 +848,21 @@ class ConnectionProvider with ChangeNotifier {
|
||||
return true;
|
||||
} catch (e) {
|
||||
debugPrint('❌ [Provider] Failed to check slot $channelIdx: $e');
|
||||
if (_isEmptyChannelQueryError(e)) {
|
||||
debugPrint(
|
||||
' ℹ️ Treating slot $channelIdx as empty because the device reported it was not found',
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool _isEmptyChannelQueryError(Object error) {
|
||||
final message = error.toString().toLowerCase();
|
||||
return message.contains('not found');
|
||||
}
|
||||
|
||||
Future<int?> findNextEmptyChannelSlot() async {
|
||||
if (!_activeService.isConnected) {
|
||||
throw Exception('Not connected to device');
|
||||
|
||||
Reference in New Issue
Block a user