Log mission name on send, log mission/drone-profile changes, auto-send on mission switch
Include the mission name in the "Mission sent"/"Mission upload failed" System Messages (was just the waypoint count before). Add MissionMeta.switchSeq, bumped only by an actual mission switch (startNew/startNewFromPlace/loadMission) - not by the id a brand-new mission gets from its first autosave, and not by restoreLastSession() on app start. FlyScreen compares it to detect a genuine switch and reacts two ways: logs "Mission changed to ..." and automatically re-uploads the new route to the flight controller, reusing the same send path as the manual send button (same _sending guard, same success/failure snackbar and log entry). Mission-change and drone-profile-change logging intentionally live in FlyScreen's ref.listen callbacks, not in mission_meta_provider.dart / active_drone_profile_provider.dart themselves - those providers have no notion of the app mode (Plan vs Fly, tracked separately by AppModeCubit), and logging there would record a change regardless of mode. Since FlyScreen only exists while Fly mode is active, scoping the listeners there means switching missions or drone profiles from Plan mode produces no System Messages entries, and only a mission switch (not a drone profile switch) triggers the automatic re-upload, matching what was asked for. Also splits systemMessageLogProvider (the plain message list + log(), no telemetry dependency) from the new systemMessageAutoLogProvider (the Connected/lost/battery/failsafe/connection-type auto-detection, which does watch telemetryProvider) - discovered while wiring the mission-change logging that logging a plain message from Plan-mode code was forcing the entire telemetry/transport stack to spin up as a side effect, which broke an unrelated Plan-mode test (UdpTransport threw on a double-disconnect during teardown). Keeping the two concerns apart means calling log() for a one-off message never has that side effect. Verified end to end on the Pixel_10a emulator: switching to an empty mission while in Fly mode correctly showed "No waypoints to send" and logged "Mission changed to ..." automatically, without touching the send button. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
b09d00ab9f
commit
b68c16d8e6
@@ -64,7 +64,7 @@ void main() {
|
||||
.overrideWith((ref) async => _settings(ConnectionType.mock)),
|
||||
]);
|
||||
addTearDown(container.dispose);
|
||||
container.listen(systemMessageLogProvider, (previous, next) {});
|
||||
container.listen(systemMessageAutoLogProvider, (previous, next) {});
|
||||
|
||||
controller.add(_frame());
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
@@ -90,7 +90,7 @@ void main() {
|
||||
]);
|
||||
addTearDown(container.dispose);
|
||||
|
||||
container.listen(systemMessageLogProvider, (previous, next) {});
|
||||
container.listen(systemMessageAutoLogProvider, (previous, next) {});
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
|
||||
expect(container.read(systemMessageLogProvider), isEmpty);
|
||||
@@ -105,7 +105,7 @@ void main() {
|
||||
]);
|
||||
addTearDown(container.dispose);
|
||||
|
||||
container.listen(systemMessageLogProvider, (previous, next) {});
|
||||
container.listen(systemMessageAutoLogProvider, (previous, next) {});
|
||||
await container.read(connectionSettingsProvider.future);
|
||||
expect(container.read(systemMessageLogProvider), isEmpty);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user