Plan P5: a value bubble on the pitch slider while dragging, press-and-drag on the video as a speed joystick (re-sent at 10 Hz, zero on release), and a gimbal settings sheet: mode, 30° extension, yaw follow, recenter / face down / yaw recenter, roll fine-tune, auto calibration and advanced speed/smoothness rows gated by the gimbal's capability ranges. GimbalBridge reports mode, trim, calibration and stop/overload state in the gimbal telemetry group, and getter-only settings in a new gimbalSettings slow group. The reported-plus-pending overlay moves out of CameraState into a SettingsOverlay mixin shared by camera and gimbal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.0 KiB
Dart
31 lines
1.0 KiB
Dart
import 'dart:async';
|
|
|
|
import '../../../fly/state/settings_overlay.dart';
|
|
|
|
/// How long a written camera setting may stay unconfirmed before the HUD
|
|
/// shows the camera's own value again.
|
|
const Duration cameraSettle = Duration(seconds: 3);
|
|
|
|
/// Writes one camera (or gimbal) setting the way every camera-menu row does
|
|
/// (plan P4): show [pending] at once, send, roll back with [onError] if the
|
|
/// component refuses, and drop the pending value after [cameraSettle] in any
|
|
/// case — by then it has reported the new value (which replaces it) or ignored
|
|
/// the write (and the row snaps back to what it really is).
|
|
Future<void> writeCameraSetting(
|
|
SettingsOverlay camera, {
|
|
required String label,
|
|
required Map<String, Object?> pending,
|
|
required Future<void> Function() send,
|
|
required void Function(String label, Object error) onError,
|
|
}) async {
|
|
camera.setPending(pending);
|
|
try {
|
|
await send();
|
|
} catch (e) {
|
|
camera.dropPending(pending.keys);
|
|
onError(label, e);
|
|
return;
|
|
}
|
|
Timer(cameraSettle, () => camera.dropPending(pending.keys));
|
|
}
|