feat: publish adaptive-link OSD contract and keep overlay above video (#3)

This commit is contained in:
2026-10-18 08:02:18 +02:00
parent f0d5052ccb
commit 79ea5d62b7
14 changed files with 616 additions and 81 deletions
+5
View File
@@ -26,6 +26,11 @@ type OSDConfig struct {
// channels: armed while that channel stays above the threshold.
ArmIndex int `yaml:"arm_index"`
ArmedThreshold int16 `yaml:"armed_threshold"`
// VtxTableGen and VtxTableHash are the operator-selected VTX power
// table identifiers. Zero means no table is selected yet; a static
// selection is operator intent and never applied VTX state.
VtxTableGen uint32 `yaml:"vtx_table_gen"`
VtxTableHash uint64 `yaml:"vtx_table_hash"`
}
type Config struct {
+14 -1
View File
@@ -67,7 +67,7 @@ func TestDefaultConfigPublishesOSDSnapshotsFromAUX1(t *testing.T) {
func TestLoadOverridesOSDSettings(t *testing.T) {
path := filepath.Join(t.TempDir(), "config.yml")
body := "osd:\n state_path: /tmp/osd-state.bin\n arm_index: 6\n armed_threshold: 256\n"
body := "osd:\n state_path: /tmp/osd-state.bin\n arm_index: 6\n armed_threshold: 256\n vtx_table_gen: 3\n vtx_table_hash: 9\n"
if err := os.WriteFile(path, []byte(body), 0644); err != nil {
t.Fatal(err)
}
@@ -83,6 +83,19 @@ func TestLoadOverridesOSDSettings(t *testing.T) {
if cfg.OSD.ArmIndex != 6 || cfg.OSD.ArmedThreshold != 256 {
t.Fatalf("arm config=%+v want the overrides", cfg.OSD)
}
if cfg.OSD.VtxTableGen != 3 || cfg.OSD.VtxTableHash != 9 {
t.Fatalf("table config=%+v want the selected table", cfg.OSD)
}
}
func TestDefaultConfigSelectsNoVtxTable(t *testing.T) {
// No table exists yet: the operator selection defaults to none, so the
// OSD shows an explicit pending table instead of static configuration
// dressed up as applied VTX state.
cfg := Default()
if cfg.OSD.VtxTableGen != 0 || cfg.OSD.VtxTableHash != 0 {
t.Fatalf("table config=%+v must default to no selection", cfg.OSD)
}
}
func TestLoadRejectsArmAndVideoIndexesOutsideTheChannelRange(t *testing.T) {