Compass: a fix while standing still (no heading) is subdued, not the no-receiver alarm
/ crosscheck (push) Successful in 1s
CI / Analyze & Test (push) Successful in 20s
CI / Debug APK (push) Successful in 41s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
2026-10-15 20:20:09 +09:00
parent f03a0ad464
commit 85f553b034
+11 -3
View File
@@ -16,6 +16,9 @@ class GpsCompass extends StatelessWidget {
bool get _hasSignal => heading != null; bool get _hasSignal => heading != null;
bool get _isAcquiring => gpsState == 'acquiring'; bool get _isAcquiring => gpsState == 'acquiring';
/// A fix but no heading: standing still, where GNSS cannot tell direction. Not a fault.
bool get _isStill => gpsState == 'fix' && !_hasSignal;
String get _displayHeading { String get _displayHeading {
if (!_hasSignal) return 'N/A'; if (!_hasSignal) return 'N/A';
return '${(heading! % 360).round()}'; return '${(heading! % 360).round()}';
@@ -50,8 +53,13 @@ class GpsCompass extends StatelessWidget {
final theme = AppTheme.of(context); final theme = AppTheme.of(context);
// No signal = subdued color, valid = foreground // No signal = subdued color, valid = foreground
// Heading: foreground; acquiring: caution; no receiver at all: alarm. // Heading: foreground; standing still with a fix: subdued; acquiring: caution;
final iconColour = _hasSignal ? theme.foreground : (_isAcquiring ? theme.caution : theme.alarm); // no receiver at all: alarm.
final iconColour = _hasSignal
? theme.foreground
: (_isStill
? theme.subdued
: (_isAcquiring ? theme.caution : theme.alarm));
// Convert to radians, 0 = no rotation when no signal // Convert to radians, 0 = no rotation when no signal
final angle = _hasSignal ? (heading! * math.pi / 180.0) : 0.0; final angle = _hasSignal ? (heading! * math.pi / 180.0) : 0.0;
@@ -80,7 +88,7 @@ class GpsCompass extends StatelessWidget {
child: Text( child: Text(
_hasSignal _hasSignal
? "$_displayHeading $_compassDirection" ? "$_displayHeading $_compassDirection"
: (_isAcquiring ? "ACQ" : "N/A"), : (_isStill ? "—" : (_isAcquiring ? "ACQ" : "N/A")),
style: TextStyle( style: TextStyle(
fontSize: 80, fontSize: 80,
color: theme.subdued, // less emphasis on text, let the icon have semantic colour color: theme.subdued, // less emphasis on text, let the icon have semantic colour