28 lines
1.0 KiB
Go
28 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"git.piksar.eu/piotr/groundstation/internal/config"
|
|
"git.piksar.eu/piotr/groundstation/internal/osd"
|
|
"git.piksar.eu/piotr/groundstation/internal/protocol"
|
|
)
|
|
|
|
// newSnapshot builds the immutable flight OSD snapshot from the latest
|
|
// valid RC frame: the final RC channels, the arm state derived from the
|
|
// configured arm channel, the requested CH6 WFB power (the same channel
|
|
// comparison that drives the video launcher) and the supervisor's
|
|
// decoded-video presence (its video launcher ownership). Building it is
|
|
// pure computation: publication never blocks the UART loop.
|
|
func newSnapshot(frame protocol.RCFrame, cfg config.Config, video *videoController) osd.Snapshot {
|
|
snapshot := osd.Snapshot{
|
|
Sequence: frame.Sequence,
|
|
TimestampMS: frame.Timestamp,
|
|
Channels: frame.Channels,
|
|
Armed: frame.Channels[cfg.OSD.ArmIndex] > cfg.OSD.ArmedThreshold,
|
|
Power: frame.Channels[cfg.Video.AuxIndex] > cfg.Video.Threshold,
|
|
}
|
|
if video != nil {
|
|
snapshot.Video = video.Running()
|
|
}
|
|
return snapshot
|
|
}
|