drone status pill in footer for fly mode implemented. footer layout and sizes homogenized

This commit is contained in:
Constantin Leue
2026-08-04 15:47:53 +02:00
parent f2f2953642
commit 1a17fe5b36
12 changed files with 585 additions and 28 deletions
@@ -33,6 +33,7 @@ Timer _startFakeFlightController(
d.setInt32(6, 134050000, Endian.little); // lon 13.405
d.setUint16(12, 500, Endian.little); // 5.00 m/s
d.setUint16(14, 2700, Endian.little); // 270.0 deg
d.setUint16(16, 150, Endian.little); // HDOP 1.50
payload = d.buffer.asUint8List();
case MspCommands.altitude:
final d = ByteData(10);
@@ -52,6 +53,7 @@ Timer _startFakeFlightController(
case MspCommands.inavLinkStats:
final d = ByteData(3);
d.setUint8(1, 88); // Linkqualitaet %
d.setInt8(2, 6); // SNR 6 dB
payload = d.buffer.asUint8List();
default:
payload = Uint8List(0);
@@ -88,6 +90,9 @@ void main() {
expect(frame.headingDeg, closeTo(270.0, 1e-6));
expect(frame.batteryPercent, 77);
expect(frame.linkQuality, 88);
expect(frame.snrDb, 6);
expect(frame.hdop, closeTo(1.5, 1e-9));
expect(frame.navMode, 3);
expect(frame.flightMode, 'Waypoint mission (en route to WP)');
// Fake-FC meldet activeWpNumber=3 (1-basiert) - als 0-basierter Index
// in die App-eigene Wegpunktliste entspricht das Index 2.
@@ -6,10 +6,10 @@ import 'package:dmc_app/transport/msp/msp_telemetry_codec.dart';
void main() {
group('parseMspRawGps', () {
test('parst fixType, numSat, lat/lon (1e-7 deg) und Speed (cm/s)', () {
test('parst fixType, numSat, lat/lon (1e-7 deg), Speed (cm/s) und HDOP', () {
// fixType=2, numSat=9, lat=52.5200000 deg, lon=13.4050000 deg,
// alt=100m (ungenutzt), groundSpeed=1234 cm/s, groundCourse=900 (0.1deg,
// ungenutzt), hdop=120 (ungenutzt).
// ungenutzt), hdop=120 (/100 = 1.2).
final data = ByteData(18);
data.setUint8(0, 2);
data.setUint8(1, 9);
@@ -29,6 +29,7 @@ void main() {
expect(reading.lon, closeTo(13.405, 1e-9));
expect(reading.speedMs, closeTo(12.34, 1e-9));
expect(reading.headingDeg, closeTo(90.0, 1e-9));
expect(reading.hdop, closeTo(1.2, 1e-9));
});
test('fixType 0 bedeutet kein Fix', () {
@@ -142,4 +143,20 @@ void main() {
expect(parseMspLinkQuality(payload), 87);
});
});
group('parseMspLinkStatsSnr', () {
test('liest positives SNR an Offset 2', () {
final payload = Uint8List(3);
payload[2] = 12;
expect(parseMspLinkStatsSnr(payload), 12);
});
test('liest negatives SNR (vorzeichenbehaftetes Byte) an Offset 2', () {
// -5 dB als uint8 geschrieben (fc_msp.c: (uint8_t)rxLinkStatistics.
// uplinkSNR) entspricht 251 (256-5).
final payload = Uint8List(3);
payload[2] = 251;
expect(parseMspLinkStatsSnr(payload), -5);
});
});
}