Compass: a fix while standing still (no heading) is subdued, not the no-receiver alarm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
@@ -16,6 +16,9 @@ class GpsCompass extends StatelessWidget {
|
||||
bool get _hasSignal => heading != null;
|
||||
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 {
|
||||
if (!_hasSignal) return 'N/A';
|
||||
return '${(heading! % 360).round()}';
|
||||
@@ -50,8 +53,13 @@ class GpsCompass extends StatelessWidget {
|
||||
final theme = AppTheme.of(context);
|
||||
|
||||
// No signal = subdued color, valid = foreground
|
||||
// Heading: foreground; acquiring: caution; no receiver at all: alarm.
|
||||
final iconColour = _hasSignal ? theme.foreground : (_isAcquiring ? theme.caution : theme.alarm);
|
||||
// Heading: foreground; standing still with a fix: subdued; acquiring: caution;
|
||||
// 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
|
||||
final angle = _hasSignal ? (heading! * math.pi / 180.0) : 0.0;
|
||||
@@ -80,7 +88,7 @@ class GpsCompass extends StatelessWidget {
|
||||
child: Text(
|
||||
_hasSignal
|
||||
? "$_displayHeading $_compassDirection"
|
||||
: (_isAcquiring ? "ACQ" : "N/A"),
|
||||
: (_isStill ? "—" : (_isAcquiring ? "ACQ" : "N/A")),
|
||||
style: TextStyle(
|
||||
fontSize: 80,
|
||||
color: theme.subdued, // less emphasis on text, let the icon have semantic colour
|
||||
|
||||
Reference in New Issue
Block a user