Files
PilotVault/Fly App/lib/fly/screen_awake.dart
T
tajniak81andClaude Opus 5.5 8f259339fc Keep the screen on in flight, time out silent vision starts, gate Tripod on the ground
From the Mavic Pro simulator run on 2026-10-22:
- The tablet's 2-minute sleep blanked the flight screen mid-flight. The
  flight screen now sets FLAG_KEEP_SCREEN_ON while it is open.
- TapFly's GO got no answer from the aircraft and no error, so the button
  looked dead. ActiveTrack/TapFly starts now give up after 15 s with "the
  aircraft did not answer".
- Tripod works in the air but the flight controller ignores it on the
  ground, so the gate asks to take off first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 10:38:07 +02:00

15 lines
525 B
Dart

import 'package:flutter/services.dart';
/// Keeps the tablet's screen on while the flight screen is open: Android's
/// sleep timeout (2 min on the dev tablet) otherwise blanks the HUD mid-flight.
abstract final class ScreenAwake {
static const MethodChannel _channel = MethodChannel('pilotvault/screen');
/// Best-effort: a missing host (widget tests) just leaves the screen alone.
static Future<void> keepOn(bool on) async {
try {
await _channel.invokeMethod<void>('keepOn', on);
} catch (_) {}
}
}