feat(#144): gate 0xC1 (CMD_OFFBAND_GPS) to Offband-capable firmware
The fork-only 0xC1 GPS command was sent to any connected radio — both the 60s self-location poll (on gps=1) and the Settings GPS status query. Stock / non-Offband MeshCore firmware can't answer it, so gate both behind a capability check. - firmwareSupportsOffbandGps(offbandCaps): presence of the Offband-fork offband_caps byte (device-info v14+), which stock MeshCore never emits. - requestOffbandGps() hard-returns when unsupported — 0xC1 never goes out. - _reconcileGpsPolling() centralizes the poll decision (support AND gps=1) across all three triggers + the device-info reply, so frame order is moot. - Settings hides the GPS status section on unsupported firmware. Interim presence-gate; a dedicated OFFBAND_CAP_GPS bit can follow once firmware defines one. Unit-tested (3 new); Gemini review: ship. Bumps build number to +43 (test build b43). Closes #144 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>pull/147/head
parent
7f2548ca95
commit
87e8e62e6b
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:meshcore_open/connector/meshcore_protocol.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
group('firmwareSupportsOffbandGps', () {
|
||||||
|
test('null caps (stock/pre-v14 MeshCore omits the byte) → unsupported', () {
|
||||||
|
expect(firmwareSupportsOffbandGps(null), isFalse);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('caps byte present with no bits set → supported', () {
|
||||||
|
// An Offband v14+ radio that simply isn't a wifi observer still emits the
|
||||||
|
// offband_caps byte (value 0), so it speaks the 0xC1 fork extension.
|
||||||
|
expect(firmwareSupportsOffbandGps(0x00), isTrue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('caps byte present with bits set → supported', () {
|
||||||
|
expect(firmwareSupportsOffbandGps(0x01), isTrue);
|
||||||
|
expect(firmwareSupportsOffbandGps(0xFF), isTrue);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in new issue