feat: add bounded display_diag journal diagnostics for the OSD (#3)

This commit is contained in:
2026-11-24 15:24:39 +01:00
parent 5d067ee82d
commit 903c5c69b6
8 changed files with 779 additions and 28 deletions
+16
View File
@@ -41,6 +41,11 @@ func NewOSDTemplate(video *VideoPresence, source SnapshotSource) OSDTemplate {
func (t OSDTemplate) Draw(canvas Canvas) {
canvas.Clear()
snapshot, state := t.source.Latest()
// Report the snapshot state into the layer's diagnostic stream when
// the canvas supports it; transitions are deduplicated there.
if reporter, ok := canvas.(interface{ SetDiagSnapshot(string) }); ok {
reporter.SetDiagSnapshot(snapshotStateName(state))
}
t.draw(canvas, snapshot, state)
canvas.Flush()
}
@@ -77,6 +82,17 @@ func armLine(snapshot osd.Snapshot) string {
return "ARM OFF"
}
// snapshotStateName names a snapshot state in diagnostics.
func snapshotStateName(state osd.SnapshotState) string {
switch state {
case osd.SnapshotFresh:
return "fresh"
case osd.SnapshotStale:
return "stale"
}
return "none"
}
func videoState(active bool) string {
if active {
return "ON"