feat(sat): PstRotator can point the antenna too
It handles azimuth and elevation, and a great many stations already run it in front of a controller OpsLog has never heard of. For those, OpsLog talking to the controller itself would be a second program fighting PstRotator over the same cable — so it hands over the bearing instead, and lets PstRotator turn the mast. Both kinds sit behind one small interface, chosen in Settings. Neither is more correct than the other: the right one is whichever the station already has working. The 450° overlap is deliberately NOT applied on the PstRotator path. PstRotator knows which machine is on the other end and does its own; two programs each deciding to go the long way round is exactly how an antenna unwinds in the middle of a pass. Position queries are asked at most every three seconds rather than on every tick. A PstRotator query binds a socket and waits up to a second and a half, and many setups answer nothing at all — so one silence is enough and it stops asking, reporting the commanded position instead and saying that is what it is.
This commit is contained in:
+26
-2
@@ -37,7 +37,14 @@ const (
|
||||
// The az/el rotator. Its own settings rather than the HF rotator's: a
|
||||
// satellite station's elevation rotator is a different machine on a
|
||||
// different port, and an operator who has both must not have to choose.
|
||||
keySatRotOn = "sat.rot_enabled"
|
||||
keySatRotOn = "sat.rot_enabled"
|
||||
// Which program drives the mast: OpsLog itself over EasyComm, or PstRotator,
|
||||
// which many stations already run in front of their controller. Its own port
|
||||
// key because it is a different program on a different port from an EasyComm
|
||||
// controller, and an operator who tries both must not lose the first setting
|
||||
// to the second.
|
||||
keySatRotType = "sat.rot_type" // "easycomm" | "pstrotator"
|
||||
keySatRotPstPort = "sat.rot_pst_port" // PstRotator's UDP command port
|
||||
keySatRotTransport = "sat.rot_transport" // "serial" | "tcp"
|
||||
keySatRotHost = "sat.rot_host"
|
||||
keySatRotPort = "sat.rot_port"
|
||||
@@ -68,6 +75,8 @@ type SatSettings struct {
|
||||
|
||||
// The az/el rotator.
|
||||
RotOn bool `json:"rot_on"`
|
||||
RotType string `json:"rot_type"`
|
||||
RotPstPort int `json:"rot_pst_port"`
|
||||
RotTransport string `json:"rot_transport"`
|
||||
RotHost string `json:"rot_host"`
|
||||
RotPort int `json:"rot_port"`
|
||||
@@ -236,6 +245,7 @@ func (a *App) satSettings() SatSettings {
|
||||
// from being a command a second.
|
||||
out := SatSettings{
|
||||
MinEl: 10, WindowH: 24, AutoTLE: true,
|
||||
RotType: satRotEasycomm, RotPstPort: 12000,
|
||||
RotTransport: "serial", RotPort: 4533, RotBaud: 9600,
|
||||
RotMaxAz: 360, RotMinEl: 0, RotStep: 5,
|
||||
}
|
||||
@@ -244,12 +254,18 @@ func (a *App) satSettings() SatSettings {
|
||||
}
|
||||
m, err := a.settings.GetMany(a.ctx,
|
||||
keySatFavorites, keySatMinEl, keySatWindowH, keySatAutoTLE, keySatGrid, keySatAltM,
|
||||
keySatRotOn, keySatRotTransport, keySatRotHost, keySatRotPort, keySatRotCOM,
|
||||
keySatRotOn, keySatRotType, keySatRotPstPort, keySatRotTransport, keySatRotHost, keySatRotPort, keySatRotCOM,
|
||||
keySatRotBaud, keySatRotMaxAz, keySatRotMinEl, keySatRotStep, keySatRotPark)
|
||||
if err != nil {
|
||||
return out
|
||||
}
|
||||
out.RotOn = m[keySatRotOn] == "1"
|
||||
if ty := m[keySatRotType]; ty == satRotPst || ty == satRotEasycomm {
|
||||
out.RotType = ty
|
||||
}
|
||||
if v, err := strconv.Atoi(m[keySatRotPstPort]); err == nil && v > 0 && v <= 65535 {
|
||||
out.RotPstPort = v
|
||||
}
|
||||
if tr := m[keySatRotTransport]; tr == "tcp" || tr == "serial" {
|
||||
out.RotTransport = tr
|
||||
}
|
||||
@@ -321,6 +337,12 @@ func (a *App) SaveSatSettings(s SatSettings) error {
|
||||
seen[strings.ToUpper(n)] = true
|
||||
favs = append(favs, n)
|
||||
}
|
||||
if s.RotType != satRotPst {
|
||||
s.RotType = satRotEasycomm
|
||||
}
|
||||
if s.RotPstPort <= 0 || s.RotPstPort > 65535 {
|
||||
s.RotPstPort = 12000
|
||||
}
|
||||
if s.RotTransport != "tcp" {
|
||||
s.RotTransport = "serial"
|
||||
}
|
||||
@@ -344,6 +366,8 @@ func (a *App) SaveSatSettings(s SatSettings) error {
|
||||
keySatGrid: strings.ToUpper(strings.TrimSpace(s.Grid)),
|
||||
keySatAltM: strconv.Itoa(s.AltM),
|
||||
keySatRotOn: boolStr(s.RotOn),
|
||||
keySatRotType: s.RotType,
|
||||
keySatRotPstPort: strconv.Itoa(s.RotPstPort),
|
||||
keySatRotTransport: s.RotTransport,
|
||||
keySatRotHost: strings.TrimSpace(s.RotHost),
|
||||
keySatRotPort: strconv.Itoa(s.RotPort),
|
||||
|
||||
Reference in New Issue
Block a user