gps: debug stub mode with satellites field and signal loss simulation

- _GPS_DEBUG flag for development without hardware
- stub mode: realistic mock data with occasional signal loss
- satellites field in backend and UI data models
- periodic status logging

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mikkeli Matlock
2026-02-08 03:04:44 +09:00
parent 9173c3b93a
commit 896ba322c0
3 changed files with 147 additions and 20 deletions

View File

@@ -108,8 +108,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
setState(() {
_gpsSpeed = data.speed;
_gpsTrack = data.track;
// Derive satellites from mode (placeholder logic)
_gpsSatellites = data.mode == 3 ? 8 : (data.mode == 2 ? 4 : 0);
_gpsSatellites = data.satellites;
});
});
@@ -144,7 +143,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
if (cachedGps != null) {
_gpsSpeed = cachedGps.speed;
_gpsTrack = cachedGps.track;
_gpsSatellites = cachedGps.mode == 3 ? 8 : (cachedGps.mode == 2 ? 4 : 0);
_gpsSatellites = cachedGps.satellites;
}
_wsState = WebSocketService.instance.connectionState;

View File

@@ -39,8 +39,9 @@ class GpsData {
final double? alt;
final double? track;
final int? mode; // 0=no fix, 2=2D, 3=3D
final int? satellites;
GpsData({this.lat, this.lon, this.speed, this.alt, this.track, this.mode});
GpsData({this.lat, this.lon, this.speed, this.alt, this.track, this.mode, this.satellites});
factory GpsData.fromJson(Map<String, dynamic> json) {
return GpsData(
@@ -50,6 +51,7 @@ class GpsData {
alt: (json['alt'] as num?)?.toDouble(),
track: (json['track'] as num?)?.toDouble(),
mode: (json['mode'] as num?)?.toInt(),
satellites: (json['satellites'] as num?)?.toInt(),
);
}
}