mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-29 09:11:17 +01:00
The probe was only reachable via a device-page toggle, but TX pods drop so fast the user can never open the page — the one field tester couldn't enable it. Arm the probe automatically on the first 0x10 status frame (the moment that proves a pod needs the reply), default on; the toggle becomes an opt-out. Move probe creation out of handleServices into a lazy arm on that frame. When the experiment is off, count a connect that dies within quickDropThreshold (5s) as a failure via the same backoff, so the endless connect/connected/disconnected loop gives up after 3 and shows the guidance instead of spamming forever. While the experiment is on the device opts out (keepsReconnectingWhileDropping) so the loop keeps cycling for the probe. Extract _engageBackoff shared by both paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
47 lines
1.7 KiB
Dart
47 lines
1.7 KiB
Dart
import 'package:bike_control/utils/core.dart';
|
|
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
|
|
|
/// Opt-in switch for the WHEELTOP keepalive experiment (see WheeltopProbe).
|
|
///
|
|
/// English-only on purpose: a temporary beta diagnostic driven through
|
|
/// support, expected to disappear once the TX status-frame reply is known.
|
|
class WheeltopProbeToggle extends StatefulWidget {
|
|
const WheeltopProbeToggle({super.key});
|
|
|
|
@override
|
|
State<WheeltopProbeToggle> createState() => _WheeltopProbeToggleState();
|
|
}
|
|
|
|
class _WheeltopProbeToggleState extends State<WheeltopProbeToggle> {
|
|
late bool _enabled = core.settings.getWheeltopProbeEnabled();
|
|
|
|
void _onChanged(bool value) {
|
|
setState(() => _enabled = value);
|
|
core.settings.setWheeltopProbeEnabled(value);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
spacing: 4,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: const Text('Keepalive experiment (beta)').small.semiBold),
|
|
Switch(value: _enabled, onChanged: _onChanged),
|
|
],
|
|
),
|
|
const Text(
|
|
'TX shifters drop the connection a few seconds after connecting because the app '
|
|
'does not yet know how to answer their status frames. This experiment (on by '
|
|
'default) automatically tries one candidate answer per reconnect and records the '
|
|
'outcome in the log — sharing that log with support helps find the answer that '
|
|
'keeps the shifter connected. Turn it off to stop the reconnect attempts instead.',
|
|
).xSmall,
|
|
],
|
|
);
|
|
}
|
|
}
|