Skip to content

Commit

Permalink
Fixing multi-scooter corner case
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonard Wohlfarth committed Nov 8, 2024
1 parent 9d96f8c commit 85b8e4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ class _HomeScreenState extends State<HomeScreen> {
width:
MediaQuery.of(context).size.width / 6,
child: LinearProgressIndicator(
backgroundColor: Colors.black26,
minHeight: 8,
borderRadius: BorderRadius.circular(8),
value: _primarySOC! / 100.0,
Expand Down
7 changes: 6 additions & 1 deletion lib/scooter_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,12 @@ class ScooterService {
List<BluetoothDevice> foundScooterCache = [];
List<String> savedScooterIds =
await getSavedScooterIds(onlyAutoConnect: true);
if (savedScooterIds.isNotEmpty && preferSavedScooters) {
if (savedScooterIds.isEmpty && savedScooters.isNotEmpty) {
log.info(
"We have ${savedScooters.length} saved scooters, but getSavedScooterIds returned an empty list. Probably no auto-connect enabled scooters, so we're not even scanning.");
return;
}
if (savedScooters.isNotEmpty && preferSavedScooters) {
flutterBluePlus.startScan(
withRemoteIds: savedScooterIds, // look for OUR scooter
timeout: const Duration(seconds: 30),
Expand Down

0 comments on commit 85b8e4b

Please sign in to comment.