Compare commits

...

4 Commits

Author SHA1 Message Date
Jonas Bark
b875489ad3 more logging 2025-04-02 18:29:41 +02:00
Jonas Bark
ece3f3822f increase connection timeout, logging 2025-04-02 13:34:40 +02:00
Jonas Bark
0780cdc80b increase connection timeout, logging 2025-04-02 13:30:25 +02:00
Jonas Bark
1c0e027abb Android: make sure the touch reassignment page is fullscreen 2025-04-02 12:20:56 +02:00
6 changed files with 44 additions and 18 deletions

View File

@@ -1,3 +1,9 @@
### 1.1.9 (2025-04-03)
- Add more troubleshooting during connection
### 1.1.8 (2025-04-02)
- Android: make sure the touch reassignment page is fullscreen
### 1.1.7 (2025-04-01)
- Zwift Ride: fix connection issues by connecting only to the left controller
- Windows: connect sequentially to fix (finally?) fix connection issues

View File

@@ -33,6 +33,9 @@ Get the latest version here: https://github.com/jonasbark/swiftcontrol/releases
- Windows (make sure you have installed the "[Microsoft Visual C++ Runtime libraries](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170)")
- [Web](https://jonasbark.github.io/swiftcontrol/) (you won't be able to do much)
## Troubleshooting
Your Zwift device is found but connection does not work properly? You may need to update the firmware in Zwift Companion app.
## How does it work?
The app connects to your Zwift device automatically.

View File

@@ -34,8 +34,10 @@ class Connection {
UniversalBle.onScanResult = (result) {
if (_lastScanResult.none((e) => e.deviceId == result.deviceId)) {
_lastScanResult.add(result);
_actionStreams.add(LogNotification('Found new device: ${result.name}'));
final scanResult = BaseDevice.fromScanResult(result);
_actionStreams.add(
LogNotification('Found new device: ${result.name ?? scanResult?.runtimeType ?? result.deviceId}'),
);
if (scanResult != null) {
_addDevices([scanResult]);
}
@@ -143,6 +145,7 @@ class Connection {
print(e);
print("backtrace: $backtrace");
}
rethrow;
}
}

View File

@@ -78,7 +78,7 @@ abstract class BaseDevice {
Stream<BaseNotification> get actionStream => actionStreamInternal.stream;
Future<void> connect() async {
await UniversalBle.connect(device.deviceId, connectionTimeout: const Duration(seconds: 3));
await UniversalBle.connect(device.deviceId);
if (!kIsWeb && Platform.isAndroid) {
//await UniversalBle.requestMtu(device.deviceId, 256);
@@ -92,7 +92,9 @@ abstract class BaseDevice {
final customService = services.firstOrNullWhere((service) => service.uuid == customServiceId);
if (customService == null) {
throw Exception('Custom service $customServiceId not found for device $this ${device.name ?? device.rawName}');
throw Exception(
'Custom service $customServiceId not found for device $this ${device.name ?? device.rawName}.\nYou may need to update the firmware in Zwift Companion app.\nWe found: ${services.joinToString(transform: (s) => s.uuid)}',
);
}
final asyncCharacteristic = customService.characteristics.firstOrNullWhere(

View File

@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import 'package:swift_control/main.dart';
@@ -35,10 +36,18 @@ class _TouchAreaSetupPageState extends State<TouchAreaSetupPage> {
Navigator.of(context).pop();
}
@override
void dispose() {
super.dispose();
// Exit full screen
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values);
}
@override
void initState() {
super.initState();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky, overlays: []);
WidgetsBinding.instance.addPostFrameCallback((_) {
final devicePixelRatio = MediaQuery.devicePixelRatioOf(context);
@@ -90,35 +99,38 @@ class _TouchAreaSetupPageState extends State<TouchAreaSetupPage> {
Positioned.fill(child: Opacity(opacity: 0.5, child: Image.file(_backgroundImage!, fit: BoxFit.cover)))
else
Center(
child: Column(
mainAxisSize: MainAxisSize.min,
spacing: 8,
children: [
Text('''1. Create an in-game screenshot of your app (e.g. within MyWhoosh)
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
spacing: 8,
children: [
Text('''1. Create an in-game screenshot of your app (e.g. within MyWhoosh)
2. Load the screenshot with the button below
3. Make sure the app is in the correct orientation (portrait or landscape)
4. Drag the touch areas to the correct position where the gear up / down buttons are located
5. Save and close this screen'''),
ElevatedButton(
onPressed: () {
_pickScreenshot();
},
child: Text('Load in-game screenshot for placement'),
),
],
ElevatedButton(
onPressed: () {
_pickScreenshot();
},
child: Text('Load in-game screenshot for placement'),
),
],
),
),
),
// Touch Areas
_buildDraggableArea(
position: _gearUpPos,
onPositionChanged: (newPos) => _gearUpPos = newPos,
color: Colors.green,
color: Colors.red,
label: "Gear ↑",
),
_buildDraggableArea(
position: _gearDownPos,
onPositionChanged: (newPos) => _gearDownPos = newPos,
color: Colors.red,
color: Colors.green,
label: "Gear ↓",
),
Positioned(

View File

@@ -1,7 +1,7 @@
name: swift_control
description: "SwiftControl - Control your virtual riding"
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.1.7+0
version: 1.1.9+0
environment:
sdk: ^3.7.0