Keep action rows when their key cannot be read

e3917e6 hid any row whose key failed its seeding read, which also hid
"Link remote controller": an action key has no value to read. Unreadable is
now tracked apart from supported, and only rows that show a value hide on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-10-22 15:16:04 +02:00
1 parent 128220dcb7
commit 415c6184b1
3 files changed
+33 -8

No files matched your search

+14 -2
View File
@@ -151,12 +151,24 @@ void main() {
final TelemetryReducer r = TelemetryReducer(m);
m.keys.setSupported(SettingsKeys.gimbalDialSpeed, true);
r.apply(<String, dynamic>{'type': 'key', 'id': SettingsKeys.gimbalDialSpeed.id, 'unreadable': true});
expect(m.keys.supported(SettingsKeys.gimbalDialSpeed), isFalse);
expect(m.keys.unreadable(SettingsKeys.gimbalDialSpeed), isTrue);
final SettingsContext c = SettingsContext(profile: m.profile, keys: m.keys, aircraft: m.aircraft);
final SettingSpec dial = spec<SettingSpec>(SettingsTabs.rc, 'gimbalDialSpeed');
expect(dial.visible(c), isFalse);
r.apply(<String, dynamic>{'type': 'key', 'id': SettingsKeys.gimbalDialSpeed.id, 'value': 40});
expect(m.keys.supported(SettingsKeys.gimbalDialSpeed), isNot(isFalse));
expect(dial.visible(c), isTrue);
expect(m.keys.value(SettingsKeys.gimbalDialSpeed), 40);
});
test('an action row stays when its key cannot be read (it never reads it)', () {
final FlightModel m = connectedModel(phantom4);
m.keys.setSupported(SettingsKeys.startPairing, true);
TelemetryReducer(m).apply(<String, dynamic>{'type': 'key', 'id': SettingsKeys.startPairing.id, 'unreadable': true});
final SettingsContext c = SettingsContext(profile: m.profile, keys: m.keys, aircraft: m.aircraft);
final SettingSpec link = spec<SettingSpec>(SettingsTabs.rc, 'startPairing');
expect(link.visible(c), isTrue);
});
test('subscriptions listen only to supported keys and cancel on dispose', () async {
final FakeDjiService dji = FakeDjiService()..unsupportedKeys.add('ESC_BEEPING_ENABLED');
final KeyState s = KeyState();