// Command groundstation-display renders the Ground Station kiosk canvas. It // owns its display lifecycle independently of WFB, the transmitter and the // video launcher: it waits for its target to appear, redraws as needed, and // stops only when it receives SIGINT or SIGTERM. package main import ( "context" "flag" "fmt" "log" "os" "os/signal" "syscall" "git.piksar.eu/piotr/groundstation/internal/display" ) // buildTarget selects the target-specific opener and template. Each target // owns its own backend and layouts; there is no shared global template. func buildTarget(name string) (display.Opener, display.Template, error) { switch name { case "x11": return display.X11Opener{}, display.NewStatusTemplate("Brak polaczenia WFB"), nil default: return nil, nil, fmt.Errorf("unknown display target %q (supported: x11)", name) } } func main() { target := flag.String("target", "x11", "display target: x11 (Viture) today; mipi planned") flag.Parse() opener, template, err := buildTarget(*target) if err != nil { log.Fatal(err) } ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) defer stop() // Temporary X11 unavailability never exits this process; display.Run // keeps retrying internally until the context is cancelled. if err := display.Run(ctx, opener, template, display.Options{}); err != nil { log.Fatalf("display: %v", err) } }