diff --git a/app.go b/app.go index 2d15511..0d9a02c 100644 --- a/app.go +++ b/app.go @@ -63,6 +63,7 @@ import ( "hamlog/internal/relaydev" "hamlog/internal/rigctld" "hamlog/internal/rotator/dcu1" + "hamlog/internal/rotator/easycomm" "hamlog/internal/rotator/gs232" "hamlog/internal/rotator/pst" "hamlog/internal/rotator/spid" @@ -16955,11 +16956,13 @@ const keyRotatorsList = "rotators.json" // contributes TWO logical rotors — Name/Motorized for the first, Name2/Motorized2 // for the second. type RotatorDevice struct { - ID string `json:"id"` - Name string `json:"name"` - Type string `json:"type"` // "pst" (PstRotator UDP) | "rotgenius" (4O3A native TCP) | "arco" (GS-232A) + ID string `json:"id"` + Name string `json:"name"` + // Type is the backend. See rotatorTypes for the list and what each one can + // do; normRotorType clamps anything unknown to "pst". + Type string `json:"type"` Host string `json:"host"` // default 127.0.0.1 - Port int `json:"port"` // default 12000 (pst) / 9006 (rotgenius) / 4001 (arco) + Port int `json:"port"` // per-backend default, see rotatorDefaultPort HasElevation bool `json:"has_elevation"` // include EL in GoTo packets (PstRotator) RotatorNum int `json:"rotator_num"` // Rotator Genius internal index (1/2) when not Dual Dual bool `json:"dual"` // Rotator Genius: drive both ports → two logical rotors @@ -16973,36 +16976,125 @@ type RotatorDevice struct { // azimuth + elevation) or "rot1prog" (the older azimuth-only controller). // They differ in reply length and baud rate, so guessing is not an option. SpidModel string `json:"spid_model,omitempty"` + // MaxAz is the azimuth range of the mast: 360 or 450. It matters only when + // OpsLog drives the controller itself — an overlap rotator reached at 350° + // through 10° unwinds the cable, and the choice between going the short way + // and the long way is ours to make. Through PstRotator it is deliberately + // ignored: PstRotator knows which controller is on the other end and does + // its own overlap, and two programs each deciding to go the long way round + // is how an antenna unwinds in the middle of a satellite pass. + MaxAz int `json:"max_az,omitempty"` +} + +// rotatorTypes is the one place that says what each backend is and what it can +// do. The settings panel renders its dropdown from this — labels, the "Az + El" +// badge, which transports to offer — instead of keeping a second, drifting copy +// of the same knowledge in TypeScript. +// +// Elevation here means the backend has an elevation AXIS, which is what the +// satellite tracker needs. It is not the same question as whether a given +// station's mast has an elevation motor: a PstRotator setup answers "it +// depends", which is why pst carries the per-device HasElevation switch and is +// the only type whose capability is decided by rotorHasElevation rather than by +// this table. +var rotatorTypes = []RotatorTypeInfo{ + {ID: "pst", Label: "PstRotator (UDP)", Elevation: false, Optional: true, Network: true, DefaultPort: 12000}, + {ID: "rotgenius", Label: "Rotator Genius (4O3A, native)", Network: true, DefaultPort: 9006}, + {ID: "arco", Label: "GS-232 azimuth controller (microHAM ARCO, ERC)", Network: true, Serial: true, DefaultPort: 4001, DefaultBaud: 9600}, + {ID: "erc", Label: "ERC-M by DF9GR (Yaesu G-5500 az/el)", Elevation: true, Network: true, Serial: true, DefaultPort: 4001, DefaultBaud: 19200}, + {ID: "dcu1", Label: "Hy-Gain DCU-1 (RotorCard DXA, Rotor-EZ, Green Heron)", Network: true, Serial: true, DefaultPort: 4001, DefaultBaud: 4800}, + {ID: "spid", Label: "SPID / AlfaSpid (RAS, BIG-RAS, MD-01, MD-02)", Elevation: true, Serial: true, DefaultBaud: 600}, + {ID: "easycomm", Label: "EasyComm II (SatPC32, Gpredict, K3NG…)", Elevation: true, Network: true, Serial: true, DefaultPort: 4533, DefaultBaud: 9600}, +} + +// RotatorTypeInfo describes one rotator backend to the settings panel. +type RotatorTypeInfo struct { + ID string `json:"id"` + Label string `json:"label"` + // Elevation: this backend drives an elevation axis, so a satellite pass can + // be followed with it. + Elevation bool `json:"elevation"` + // Optional: the elevation axis depends on the station rather than on the + // backend, and the operator says so per device (PstRotator). + Optional bool `json:"elevation_optional"` + Serial bool `json:"serial"` + Network bool `json:"network"` + DefaultPort int `json:"default_port"` + DefaultBaud int `json:"default_baud"` +} + +// GetRotatorTypes lists the rotator backends for the settings panel. +func (a *App) GetRotatorTypes() []RotatorTypeInfo { + out := make([]RotatorTypeInfo, len(rotatorTypes)) + copy(out, rotatorTypes) + return out +} + +// rotorTypeInfo looks a backend up, falling back to PstRotator like +// normRotorType does. +func rotorTypeInfo(typ string) RotatorTypeInfo { + typ = normRotorType(typ) + for _, t := range rotatorTypes { + if t.ID == typ { + return t + } + } + return rotatorTypes[0] +} + +// rotorHasElevation reports whether this configured rotor can be pointed in +// elevation — the question the satellite tracker asks before offering a rotor. +func rotorHasElevation(d RotatorDevice) bool { + t := rotorTypeInfo(d.Type) + if t.Optional { + // PstRotator: the elevation is the station's, not the protocol's. + return d.HasElevation + } + if t.ID == "spid" { + // Rot1Prog is the azimuth-only controller. Offering it for a satellite + // pass would mean sending elevation commands into a reply format that + // has no room for them. + return d.SpidModel != "rot1prog" + } + return t.Elevation } // logicalRotor is one addressable rotor. Flattening the device list expands a // Dual Rotator Genius into two. type logicalRotor struct { + // Key addresses this rotor from elsewhere in the app — the satellite + // tracker stores one. It is the device id, with "#2" for the second port of + // a Dual Rotator Genius, and NOT the list index: an operator who deletes the + // first rotor must not silently have the satellite follow a different mast. + Key string Name string Motorized bool + HasEl bool Link rotorLink } // normRotorType clamps a rotor type to a known backend. func normRotorType(t string) string { - if t == "rotgenius" || t == "arco" || t == "dcu1" || t == "spid" { - return t + for _, k := range rotatorTypes { + if k.ID == t { + return t + } } return "pst" } // rotatorDefaultPort is each backend's default network port. +// +// Two of them are placeholders rather than standards, and the difference +// matters when a link fails: 4001 for a GS-232 or DCU-1 controller is whatever +// the operator typed into its own LAN menu (or into the serial-over-IP bridge), +// so a refused connection there means "that is not the number you set", not +// "the controller is off". func rotatorDefaultPort(typ string) int { - switch typ { - case "rotgenius": - return 9006 // 4O3A native default - case "arco": - return 4001 // placeholder — the real number is set in ARCO's LAN menu - case "dcu1": - return 4001 // only used with a serial-over-IP bridge; DCU-1 has no standard - default: - return 12000 // PstRotator UDP + if p := rotorTypeInfo(typ).DefaultPort; p > 0 { + return p } + return 12000 // PstRotator UDP } // deviceLink builds the connection params for a device's rotor. sub selects the @@ -17010,8 +17102,11 @@ func rotatorDefaultPort(typ string) int { func deviceLink(d RotatorDevice, sub int) rotorLink { l := rotorLink{ Type: normRotorType(d.Type), Host: d.Host, Port: d.Port, - Transport: d.Transport, ComPort: d.ComPort, Baud: d.Baud, HasElevation: d.HasElevation, - SpidModel: d.SpidModel, + Transport: d.Transport, ComPort: d.ComPort, Baud: d.Baud, HasElevation: rotorHasElevation(d), + SpidModel: d.SpidModel, MaxAz: d.MaxAz, + } + if l.MaxAz != 450 { + l.MaxAz = 360 } if l.Host == "" { l.Host = "127.0.0.1" @@ -17050,18 +17145,39 @@ func deviceLink(d RotatorDevice, sub int) rotorLink { func flattenRotors(devs []RotatorDevice) []logicalRotor { var out []logicalRotor for _, d := range devs { + el := rotorHasElevation(d) if normRotorType(d.Type) == "rotgenius" && d.Dual { out = append(out, - logicalRotor{Name: d.Name, Motorized: d.Motorized, Link: deviceLink(d, 1)}, - logicalRotor{Name: d.Name2, Motorized: d.Motorized2, Link: deviceLink(d, 2)}, + logicalRotor{Key: d.ID, Name: d.Name, Motorized: d.Motorized, HasEl: el, Link: deviceLink(d, 1)}, + logicalRotor{Key: d.ID + "#2", Name: d.Name2, Motorized: d.Motorized2, HasEl: el, Link: deviceLink(d, 2)}, ) continue } - out = append(out, logicalRotor{Name: d.Name, Motorized: d.Motorized, Link: deviceLink(d, 1)}) + out = append(out, logicalRotor{Key: d.ID, Name: d.Name, Motorized: d.Motorized, HasEl: el, Link: deviceLink(d, 1)}) } return out } +// rotorByKey finds a logical rotor by the key flattenRotors gave it. Used by +// anything that stores a choice of rotor rather than driving the active one — +// the satellite tracker, so far. +func (a *App) rotorByKey(key string) (logicalRotor, bool) { + key = strings.TrimSpace(key) + if key == "" { + return logicalRotor{}, false + } + devs, err := a.GetRotators() + if err != nil { + return logicalRotor{}, false + } + for _, r := range flattenRotors(devs) { + if r.Key == key { + return r, true + } + } + return logicalRotor{}, false +} + // GetRotators returns the configured rotor list, migrating the legacy single- // rotor flat settings into the list on first read (persisted on next save). func (a *App) GetRotators() ([]RotatorDevice, error) { @@ -17140,7 +17256,16 @@ func (a *App) SaveRotators(list []RotatorDevice) error { d.Transport = "tcp" } if d.Baud <= 0 { - d.Baud = 9600 + // Per backend, not a blanket 9600: a SPID at 9600 is silent (it runs + // at 600 or 1200), and an ERC-M ships at 19200. A wrong baud rate + // reads exactly like a dead controller. + d.Baud = rotorTypeInfo(d.Type).DefaultBaud + if d.Baud <= 0 { + d.Baud = 9600 + } + } + if d.MaxAz != 450 { + d.MaxAz = 360 } } b, err := json.Marshal(list) @@ -17162,6 +17287,7 @@ type rotorLink struct { Baud int HasElevation bool SpidModel string // SPID: "rot2prog" (default) | "rot1prog" + MaxAz int // 360 or 450, for the backends OpsLog drives directly } // activeRotorIndex returns the compass-selected rotor index, clamped to the @@ -17199,6 +17325,34 @@ func arcoClient(l rotorLink) *gs232.Client { return gs232.New(l.Host, l.Port) } +// ercClient builds the GS-232 client for an ERC-M (Easy Rotor Control, DF9GR). +// +// Same wire protocol as the ARCO above, and a separate rotor type all the same: +// the ERC-M drives BOTH axes of a Yaesu G-5500, and "does this rotor have an +// elevation motor" is the question the satellite tracker asks. Folding it into +// "arco" would have made every ARCO owner appear in the satellite rotor list +// with an elevation axis they do not have. +func ercClient(l rotorLink) *gs232.Client { + if l.Transport == "serial" { + return gs232.NewSerial(l.ComPort, l.Baud) + } + return gs232.New(l.Host, l.Port) +} + +// easycommClient builds the EasyComm II client for a rotor. +// +// EasyComm is what SatPC32, Gpredict and K3NG's firmware speak, so it is the +// common tongue of home-built az/el controllers. It lives in the rotator list +// like every other backend now: it used to be configured inside the satellite +// settings, which meant an operator with one mast described it twice and could +// describe it differently the second time. +func easycommClient(l rotorLink) *easycomm.Client { + if l.Transport == "serial" { + return easycomm.NewSerial(l.ComPort, l.Baud, l.MaxAz) + } + return easycomm.New(l.Host, l.Port, l.MaxAz) +} + // dcu1Client builds the Hy-Gain DCU-1 client for a rotor's transport: the // controller's COM port (the usual case — RotorCard DXA, Green Heron, Rotor-EZ) // or a serial-over-IP bridge on TCP. @@ -17231,6 +17385,11 @@ type RotatorHeading struct { OK bool `json:"ok"` Azimuth int `json:"azimuth"` Raw string `json:"raw"` + // Elevation is only meaningful when HasElevation is set. The two travel + // together so an az-only rotor cannot be drawn pointing at the horizon, + // which is a real elevation and not the absence of one. + Elevation int `json:"elevation"` + HasElevation bool `json:"has_elevation"` // The compass renders a rotor selector from these — one entry per logical // rotor — without an extra roundtrip. Rotors []string `json:"rotors"` // names of every logical rotor (may be empty strings) @@ -17291,8 +17450,35 @@ func (a *App) GetRotatorHeading() RotatorHeading { base.Azimuth = az base.Raw = raw return base + case "erc": + az, el, raw, herr := ercClient(link).Position() + if herr != nil { + base.Raw = herr.Error() + return base + } + base.OK = true + base.Azimuth, base.Elevation, base.HasElevation = az, el, true + base.Raw = raw + return base + case "easycomm": + az, el, live, herr := easycommClient(link).Heading() + if herr != nil { + base.Raw = herr.Error() + return base + } + base.OK = true + base.Azimuth, base.Elevation, base.HasElevation = int(math.Round(az)), int(math.Round(el)), true + if live { + base.Raw = fmt.Sprintf("AZ %.0f° EL %.0f°", az, el) + } else { + // The controller answered nothing and this is the last COMMANDED + // position. Say so: a stuck rotator must not be able to hide behind + // an order it never carried out. + base.Raw = fmt.Sprintf("AZ %.0f° EL %.0f° (commanded)", az, el) + } + return base case "spid": - az, _, herr := spidClient(link).Heading() + az, el, herr := spidClient(link).Heading() if herr != nil { base.Raw = herr.Error() return base @@ -17300,6 +17486,10 @@ func (a *App) GetRotatorHeading() RotatorHeading { base.OK = true base.Azimuth = az base.Raw = fmt.Sprintf("%d°", az) + if link.HasElevation { + base.Elevation, base.HasElevation = el, true + base.Raw = fmt.Sprintf("AZ %d° EL %d°", az, el) + } return base case "dcu1": az, raw, herr := dcu1Client(link).Heading() @@ -17351,6 +17541,23 @@ func (a *App) RotatorGoToPath(az int, el int, path string) error { return rotgenius.New(link.Host, link.Port).GoTo(link.Num, az) case "arco": return arcoClient(link).GoTo(az) + case "erc": + // An elevation of -1 is the callers' "no opinion" (a spot click, a + // compass drag). Leaving the elevation where it is beats swinging the + // dish to the horizon because somebody clicked a DX spot. + if el < 0 { + return ercClient(link).GoTo(az) + } + return ercClient(link).GoToAzEl(az, el) + case "easycomm": + if el < 0 { + if _, cur, _, err := easycommClient(link).Heading(); err == nil { + el = int(math.Round(cur)) + } else { + el = 0 + } + } + return easycommClient(link).Point(float64(az), float64(el)) case "spid": return spidClient(link).GoTo(az, el) case "dcu1": @@ -17372,6 +17579,10 @@ func (a *App) RotatorStop() error { return rotgenius.New(link.Host, link.Port).Stop() case "arco": return arcoClient(link).Stop() + case "erc": + return ercClient(link).Stop() + case "easycomm": + return easycommClient(link).Stop() case "spid": return spidClient(link).Stop() case "dcu1": @@ -17501,8 +17712,12 @@ func (a *App) RotatorPark() error { switch link.Type { case "rotgenius": return fmt.Errorf("park is a PstRotator feature; not available on the Rotator Genius") - case "arco": - return fmt.Errorf("park is a PstRotator feature; not available over the ARCO GS-232 link") + case "arco", "erc": + return fmt.Errorf("park is a PstRotator feature; not available over a GS-232 link") + case "easycomm": + // EasyComm has no park command either, but it does take an absolute + // position — and the satellite tracker's own park does exactly this. + return easycommClient(link).Point(0, 0) case "spid": return fmt.Errorf("park is a PstRotator feature; a SPID controller has no park command") case "dcu1": @@ -17545,6 +17760,21 @@ func testRotorLink(l rotorLink) error { // GS-232 — without moving the antenna. _, _, err := arcoClient(l).Heading() return err + case "erc": + if l.Transport == "serial" && strings.TrimSpace(l.ComPort) == "" { + return fmt.Errorf("select the ERC-M's COM port first") + } + // Both axes, because reading only the azimuth would pass on a controller + // wired for azimuth alone — and the whole reason for choosing ERC-M over + // the plain GS-232 entry is that it has an elevation motor. + _, _, _, err := ercClient(l).Position() + return err + case "easycomm": + if l.Transport == "serial" && strings.TrimSpace(l.ComPort) == "" { + return fmt.Errorf("select the controller's COM port first") + } + _, _, _, err := easycommClient(l).Heading() + return err case "spid": if strings.TrimSpace(l.ComPort) == "" { return fmt.Errorf("select the SPID controller's COM port first") diff --git a/app_sat.go b/app_sat.go index fc49285..0af5d60 100644 --- a/app_sat.go +++ b/app_sat.go @@ -34,15 +34,20 @@ const ( keySatGrid = "sat.grid" // locator override ("" = the station's own) keySatAltM = "sat.alt_m" // antenna height above sea level, metres - // 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. + // The az/el rotator. 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. + // WHICH rotor, out of the ones configured in Settings ▸ Rotator — the key + // flattenRotors gives it. How to reach it is that list's business, not + // this page's: describing one mast in two places is how a station ends up + // working on HF and not on a pass. + keySatRotID = "sat.rot_id" + keySatRotMinEl = "sat.rot_min_el" // don't drive the rotator below this elevation + keySatRotStep = "sat.rot_step" // degrees of change worth a command + keySatRotPark = "sat.rot_park" // park at az 0 / el 0 when tracking stops + + // The satellite page used to configure its own EasyComm or PstRotator link. + // These keys are read once by migrateSatRotator, which turns what they hold + // into a real entry in the rotator list, and are never written again. keySatRotType = "sat.rot_type" // "easycomm" | "pstrotator" keySatRotPstPort = "sat.rot_pst_port" // PstRotator's UDP command port keySatRotTransport = "sat.rot_transport" // "serial" | "tcp" @@ -51,9 +56,6 @@ const ( keySatRotCOM = "sat.rot_com" keySatRotBaud = "sat.rot_baud" keySatRotMaxAz = "sat.rot_max_az" // 360 or 450 - keySatRotMinEl = "sat.rot_min_el" // don't drive the rotator below this elevation - keySatRotStep = "sat.rot_step" // degrees of change worth a command - keySatRotPark = "sat.rot_park" // park at az 0 / el 0 when tracking stops ) // customTLEName holds elements the operator pasted in by hand. @@ -74,18 +76,21 @@ type SatSettings struct { AltM int `json:"alt_m"` // 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"` - RotCOM string `json:"rot_com"` - RotBaud int `json:"rot_baud"` - RotMaxAz int `json:"rot_max_az"` - RotMinEl int `json:"rot_min_el"` - RotStep int `json:"rot_step"` - RotPark bool `json:"rot_park"` + // + // RotID names one of the rotors configured in Settings ▸ Rotator — the + // key flattenRotors gives it. Everything about HOW to reach that rotator + // (backend, host, COM port, baud, 360/450) belongs to the rotator list and + // is deliberately not repeated here. + // + // What IS here is the tracking policy, which is the satellite page's own + // business and means nothing to a rotor turned by hand: below which + // elevation not to bother, how far the antenna must be off before a command + // is worth sending, and whether to park at the end. + RotOn bool `json:"rot_on"` + RotID string `json:"rot_id"` + RotMinEl int `json:"rot_min_el"` + RotStep int `json:"rot_step"` + RotPark bool `json:"rot_park"` } // SatTransponder is one path through a satellite, as the UI needs it. @@ -189,6 +194,11 @@ type SatPassInfo struct { // PC with no internet as much as on one with. The fetch is the slow, optional // half and never blocks a launch. func (a *App) startSatellites() { + // Before anything else reads the rotator choice: an operator upgrading from + // the version where the satellite page held its own rotator link must find + // that mast already in the list and already selected. + a.migrateSatRotator() + dir := a.dataDir birds, err := sat.LoadBirds(dir) if err != nil { @@ -239,47 +249,23 @@ func (a *App) satParts() (*sat.Store, *sat.Birds, *sat.Fetcher) { // ── Settings ──────────────────────────────────────────────────────────────── func (a *App) satSettings() SatSettings { - // The rotator defaults are the common case, not a blank form: EasyComm over - // a serial port at 9600, a 360° machine, and a five-degree step — which on a - // beam with any gain at all is well inside the beamwidth and keeps a pass - // from being a command a second. + // A five-degree step, which on a beam with any gain at all is well inside + // the beamwidth and keeps a pass 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, + RotMinEl: 0, RotStep: 5, } if a.settings == nil { return out } m, err := a.settings.GetMany(a.ctx, keySatFavorites, keySatMinEl, keySatWindowH, keySatAutoTLE, keySatGrid, keySatAltM, - keySatRotOn, keySatRotType, keySatRotPstPort, keySatRotTransport, keySatRotHost, keySatRotPort, keySatRotCOM, - keySatRotBaud, keySatRotMaxAz, keySatRotMinEl, keySatRotStep, keySatRotPark) + keySatRotOn, keySatRotID, 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 - } - out.RotHost = strings.TrimSpace(m[keySatRotHost]) - if v, err := strconv.Atoi(m[keySatRotPort]); err == nil && v > 0 && v <= 65535 { - out.RotPort = v - } - out.RotCOM = strings.TrimSpace(m[keySatRotCOM]) - if v, err := strconv.Atoi(m[keySatRotBaud]); err == nil && v >= 1200 && v <= 115200 { - out.RotBaud = v - } - if v, err := strconv.Atoi(m[keySatRotMaxAz]); err == nil && v == 450 { - out.RotMaxAz = 450 - } + out.RotID = strings.TrimSpace(m[keySatRotID]) if v, err := strconv.Atoi(m[keySatRotMinEl]); err == nil && v >= -10 && v <= 30 { out.RotMinEl = v } @@ -337,46 +323,21 @@ 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" - } - if s.RotMaxAz != 450 { - s.RotMaxAz = 360 - } if s.RotStep < 1 || s.RotStep > 30 { s.RotStep = 5 } - if s.RotPort <= 0 || s.RotPort > 65535 { - s.RotPort = 4533 - } - if s.RotBaud < 1200 || s.RotBaud > 115200 { - s.RotBaud = 9600 - } for k, v := range map[string]string{ - keySatFavorites: strings.Join(favs, ","), - keySatMinEl: strconv.Itoa(s.MinEl), - keySatWindowH: strconv.Itoa(s.WindowH), - keySatAutoTLE: boolStr(s.AutoTLE), - 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), - keySatRotCOM: strings.TrimSpace(s.RotCOM), - keySatRotBaud: strconv.Itoa(s.RotBaud), - keySatRotMaxAz: strconv.Itoa(s.RotMaxAz), - keySatRotMinEl: strconv.Itoa(s.RotMinEl), - keySatRotStep: strconv.Itoa(s.RotStep), - keySatRotPark: boolStr(s.RotPark), + keySatFavorites: strings.Join(favs, ","), + keySatMinEl: strconv.Itoa(s.MinEl), + keySatWindowH: strconv.Itoa(s.WindowH), + keySatAutoTLE: boolStr(s.AutoTLE), + keySatGrid: strings.ToUpper(strings.TrimSpace(s.Grid)), + keySatAltM: strconv.Itoa(s.AltM), + keySatRotOn: boolStr(s.RotOn), + keySatRotID: strings.TrimSpace(s.RotID), + keySatRotMinEl: strconv.Itoa(s.RotMinEl), + keySatRotStep: strconv.Itoa(s.RotStep), + keySatRotPark: boolStr(s.RotPark), } { if err := a.settings.Set(a.ctx, k, v); err != nil { return err @@ -978,3 +939,80 @@ func (a *App) GetSatelliteTuning(name string, transponder int, downHz int64) (Sa out.Visible = p.Visible() return out, nil } + +// migrateSatRotator moves a pre-list satellite rotator into Settings ▸ Rotator. +// +// Until now the satellite page configured its own EasyComm or PstRotator link, +// separately from the rotator list every other backend lived in. An operator who +// had set one up must not open OpsLog to an empty dropdown and a mast that no +// longer turns — so the old keys are read once, turned into a real rotor in the +// list, and the satellite page is pointed at it. +// +// Runs once. The legacy keys are cleared afterwards so a second run cannot add +// the same mast a second time, and so the next reader of this file is not left +// wondering which of the two copies is live. +func (a *App) migrateSatRotator() { + if a.settings == nil { + return + } + m, err := a.settings.GetMany(a.ctx, + keySatRotID, keySatRotType, keySatRotTransport, keySatRotHost, keySatRotPort, + keySatRotCOM, keySatRotBaud, keySatRotPstPort, keySatRotMaxAz) + if err != nil { + return + } + if strings.TrimSpace(m[keySatRotID]) != "" { + return // already migrated, or configured since + } + legacy := strings.TrimSpace(m[keySatRotType]) + if legacy == "" { + return // the satellite rotator was never configured + } + + atoi := func(s string) int { n, _ := strconv.Atoi(s); return n } + dev := RotatorDevice{ + ID: fmt.Sprintf("rotor-sat-%d", time.Now().Unix()), + Name: "Satellite", + MaxAz: atoi(m[keySatRotMaxAz]), + // A satellite rotor carries a fixed antenna, not a motorized Ultrabeam + // or SteppIR: showing it pattern paths would be showing it something it + // cannot do. + Motorized: false, + } + switch legacy { + case satRotPst: + dev.Type = "pst" + dev.Host = strings.TrimSpace(m[keySatRotHost]) + dev.Port = atoi(m[keySatRotPstPort]) + // It was in the satellite settings, so it has elevation by construction. + dev.HasElevation = true + default: + dev.Type = "easycomm" + dev.Transport = strings.TrimSpace(m[keySatRotTransport]) + dev.Host = strings.TrimSpace(m[keySatRotHost]) + dev.Port = atoi(m[keySatRotPort]) + dev.ComPort = strings.TrimSpace(m[keySatRotCOM]) + dev.Baud = atoi(m[keySatRotBaud]) + } + + list, err := a.GetRotators() + if err != nil { + applog.Printf("satellite: cannot read the rotator list to migrate the satellite rotator: %v", err) + return + } + list = append(list, dev) + if err := a.SaveRotators(list); err != nil { + applog.Printf("satellite: cannot save the migrated satellite rotator: %v", err) + return + } + if err := a.settings.Set(a.ctx, keySatRotID, dev.ID); err != nil { + applog.Printf("satellite: migrated the rotator but could not select it: %v", err) + return + } + // Clear the old keys so this cannot run twice. + for _, k := range []string{keySatRotType, keySatRotTransport, keySatRotHost, keySatRotPort, + keySatRotCOM, keySatRotBaud, keySatRotPstPort, keySatRotMaxAz} { + _ = a.settings.Set(a.ctx, k, "") + } + applog.Printf("satellite: the %s rotator configured on the satellite page is now %q in Settings ▸ Rotator", legacy, dev.Name) +} diff --git a/app_sat_rotator.go b/app_sat_rotator.go index 88c8e26..4f5b175 100644 --- a/app_sat_rotator.go +++ b/app_sat_rotator.go @@ -1,16 +1,18 @@ package main -// The two ways a satellite station points its antenna. +// How a satellite station points its antenna. // -// Some operators drive their az/el rotator directly — EasyComm II, what -// SatPC32 and Gpredict speak. Others already run PstRotator, which sits between -// them and a dozen different controllers and handles az AND el; for those, -// OpsLog talking to the controller itself would be a second program fighting -// PstRotator over the same cable. +// It does NOT configure a rotator. Every rotator interface OpsLog knows lives in +// Settings ▸ Rotator, once, and the satellite page only CHOOSES one of them. +// The two used to be separate: EasyComm and PstRotator were described inside the +// satellite settings while five other backends were described in the rotator +// list, so an operator with one mast described it twice — and could describe it +// differently the second time, which is a station that works on HF and not on a +// pass, for no reason anyone can see. // -// So both, behind one small interface, chosen in Settings. Neither is more -// "correct" than the other: the right one is whichever the station already has -// working. +// What remains here is the adapter: turning whichever backend the operator +// picked into the three things a pass needs — point it, ask where it is, let go +// of it at the end. import ( "fmt" @@ -18,8 +20,9 @@ import ( "strings" "sync" - "hamlog/internal/rotator/easycomm" + "hamlog/internal/rotator/gs232" "hamlog/internal/rotator/pst" + "hamlog/internal/rotator/spid" ) // satRotator is what the tracker needs of an antenna: point it, ask where it @@ -33,41 +36,165 @@ type satRotator interface { Close() } -// The rotator kinds, as stored. +// The legacy satellite-only rotator kinds. They are no longer stored; they +// survive only so migrateSatRotator can read what an operator configured before +// the rotator list existed. const ( satRotEasycomm = "easycomm" satRotPst = "pstrotator" ) -// newSatRotator builds the configured controller. -func newSatRotator(s SatSettings) (satRotator, error) { - switch s.RotType { - case satRotPst: - if strings.TrimSpace(s.RotHost) == "" && s.RotPort <= 0 { - return nil, fmt.Errorf("no address for PstRotator") - } - return &pstSatRotator{c: pst.New(s.RotHost, s.RotPstPort), maxAz: s.RotMaxAz}, nil - default: - if s.RotTransport == "tcp" { - if strings.TrimSpace(s.RotHost) == "" { - return nil, fmt.Errorf("no address for the rotator") - } - return easycomm.New(s.RotHost, s.RotPort, s.RotMaxAz), nil - } - if strings.TrimSpace(s.RotCOM) == "" { - return nil, fmt.Errorf("no COM port for the rotator") - } - return easycomm.NewSerial(s.RotCOM, s.RotBaud, s.RotMaxAz), nil +// newSatRotator builds a controller for the rotor the satellite page selected. +func (a *App) newSatRotator(s SatSettings) (satRotator, error) { + if strings.TrimSpace(s.RotID) == "" { + return nil, fmt.Errorf("no rotator chosen for satellite tracking — pick one in Settings ▸ Satellite") } + lr, ok := a.rotorByKey(s.RotID) + if !ok { + // The rotor was deleted from the list after being chosen here. Say that, + // rather than failing to connect to an address nobody can see any more. + return nil, fmt.Errorf("the rotator chosen for satellite tracking no longer exists in Settings ▸ Rotator") + } + if !lr.HasEl { + name := strings.TrimSpace(lr.Name) + if name == "" { + name = "this rotator" + } + return nil, fmt.Errorf("%s has no elevation axis — a satellite pass needs one", name) + } + l := lr.Link + switch l.Type { + case "pst": + return &pstSatRotator{c: pst.New(l.Host, l.Port), maxAz: l.MaxAz}, nil + case "easycomm": + return easycommClient(l), nil + case "erc": + return &gs232SatRotator{c: ercClient(l), maxAz: l.MaxAz}, nil + case "spid": + return &spidSatRotator{c: spidClient(l)}, nil + default: + return nil, fmt.Errorf("the %s backend cannot be pointed in elevation", l.Type) + } +} + +// SatelliteRotorChoice is one entry in the satellite page's rotator dropdown. +type SatelliteRotorChoice struct { + Key string `json:"key"` + // Name is the operator's label; Type is the backend's, for the rotors left + // unnamed (a list of three blank rows is a list of one rotor as far as + // anybody can tell). + Name string `json:"name"` + Type string `json:"type"` + HasEl bool `json:"has_el"` +} + +// ListSatelliteRotors returns every configured rotor, elevation-capable or not. +// +// Not filtered to the az/el ones, deliberately. An operator who owns exactly one +// rotator and does not see it in this list concludes OpsLog cannot find it; shown +// with "azimuth only" beside it, they learn the actual thing — that the tracker +// needs an elevation axis and this mast has none. +func (a *App) ListSatelliteRotors() ([]SatelliteRotorChoice, error) { + devs, err := a.GetRotators() + if err != nil { + return nil, err + } + out := []SatelliteRotorChoice{} + for _, r := range flattenRotors(devs) { + out = append(out, SatelliteRotorChoice{ + Key: r.Key, Name: r.Name, Type: rotorTypeInfo(r.Link.Type).Label, HasEl: r.HasEl, + }) + } + return out, nil +} + +// gs232SatRotator points an ERC-M (or any GS-232 az/el controller) through the +// W command. +// +// The 450° overlap is handled HERE and not in the package, the same way the +// EasyComm client does it: a controller reports 0-450 and takes 0-450, but the +// tracker works in true bearings, and which of the two ways round to reach 010° +// depends on where the mast currently is. +type gs232SatRotator struct { + c *gs232.Client + maxAz int +} + +func (g *gs232SatRotator) Point(az, el float64) error { + return g.c.GoToAzEl(int(math.Round(satWrapAz(az, g.maxAz))), int(math.Round(clampEl(el)))) +} + +func (g *gs232SatRotator) Heading() (float64, float64, bool, error) { + az, el, _, err := g.c.Position() + if err != nil { + return 0, 0, false, err + } + return float64(az), float64(el), true, nil +} + +// Close: nothing to release. The serial port is held by the gs232 package, which +// keeps it open across the whole session on purpose — an Arduino-based +// controller reboots every time its port is opened. +func (g *gs232SatRotator) Close() {} + +// spidSatRotator points a SPID Rot2Prog. Its protocol is absolute and binary, +// with no overlap notion to manage: the controller is told a bearing and a +// resolution and works out its own path. +type spidSatRotator struct{ c *spid.Client } + +func (s *spidSatRotator) Point(az, el float64) error { + a := math.Mod(az, 360) + if a < 0 { + a += 360 + } + return s.c.GoTo(int(math.Round(a)), int(math.Round(clampEl(el)))) +} + +func (s *spidSatRotator) Heading() (float64, float64, bool, error) { + az, el, err := s.c.Heading() + if err != nil { + return 0, 0, false, err + } + return float64(az), float64(el), true, nil +} + +func (s *spidSatRotator) Close() {} + +// satWrapAz maps a true bearing onto what the controller accepts. On a 450° +// mast the far end of the overlap is reachable two ways and the higher number is +// chosen for the last 90°, which is what keeps a pass crossing north from +// unwinding the cable in the middle of it. +func satWrapAz(az float64, maxAz int) float64 { + a := math.Mod(az, 360) + if a < 0 { + a += 360 + } + if maxAz == 450 && a < 90 { + return a + 360 + } + return a +} + +// clampEl keeps the elevation inside what a mast will accept. 180 and not 90: a +// G-5500 goes past the zenith and keeps counting, which is how an overhead pass +// is followed without swinging the azimuth 180° through the middle of it. +func clampEl(el float64) float64 { + if el < 0 { + return 0 + } + if el > 180 { + return 180 + } + return el } // pstSatRotator points the antenna through PstRotator. // // PstRotator takes whole degrees and does its own overlap handling for a 450° // rotator — it knows which controller is on the other end, and OpsLog does not. -// So the azimuth is sent plainly, and the 450° logic that EasyComm needs is -// deliberately NOT applied here: two programs each deciding to go the long way -// round is how an antenna ends up unwinding in the middle of a pass. +// So the azimuth is sent plainly, and the 450° logic that the direct backends +// need is deliberately NOT applied here: two programs each deciding to go the +// long way round is how an antenna ends up unwinding in the middle of a pass. type pstSatRotator struct { c *pst.Client maxAz int @@ -87,12 +214,7 @@ func (p *pstSatRotator) Point(az, el float64) error { if a < 0 { a += 360 } - if el < 0 { - el = 0 - } - if el > 180 { - el = 180 - } + el = clampEl(el) if err := p.c.GoTo(int(math.Round(a)), true, int(math.Round(el))); err != nil { return err } diff --git a/app_sat_track.go b/app_sat_track.go index 2cd2a3b..1e641e7 100644 --- a/app_sat_track.go +++ b/app_sat_track.go @@ -131,7 +131,7 @@ func (a *App) StartSatelliteTracking(name string, transponder int) error { // left alone, so it gets one command rather than a loop. set := a.satSettings() if set.RotOn { - r, rerr := newSatRotator(set) + r, rerr := a.newSatRotator(set) if rerr != nil { applog.Printf("sat: no rotator: %v", rerr) t.status.Error = rerr.Error() @@ -193,7 +193,7 @@ func (a *App) TestSatelliteRotator() (string, error) { if !set.RotOn { return "", fmt.Errorf("the satellite rotator is switched off") } - c, err := newSatRotator(set) + c, err := a.newSatRotator(set) if err != nil { return "", err } diff --git a/changelog.json b/changelog.json index fb6d788..854fb2b 100644 --- a/changelog.json +++ b/changelog.json @@ -1,4 +1,20 @@ [ + { + "version": "0.27.20", + "date": "", + "en": [ + "Every rotator interface now lives in Settings ▸ Rotator, and the satellite page only picks one of them. EasyComm and PstRotator used to be described inside the satellite settings while the other backends were described in the rotator list, so one mast was configured twice. What you already set up is moved into the list for you and selected.", + "Each rotator interface says whether it drives azimuth alone or azimuth and elevation, beside the interface itself. The satellite rotator list shows the azimuth-only ones greyed out rather than hiding them, so a rotor that cannot follow a pass says why.", + "New rotator interface: ERC-M by DF9GR, the azimuth/elevation controller for a Yaesu G-5500. Over its USB COM port or the network, with its emulation set to GS-232. Untested on hardware — reports welcome.", + "EasyComm II is now an ordinary rotator interface, so it can turn the antenna from the compass and from a spot click, not only during a satellite pass." + ], + "fr": [ + "Toutes les interfaces de rotor sont désormais dans Réglages ▸ Rotator, et la page satellite ne fait qu’en choisir une. EasyComm et PstRotator se configuraient dans les réglages satellite pendant que les autres se configuraient dans la liste des rotors : un même pylône était décrit deux fois. Ce que vous aviez réglé est déplacé dans la liste et sélectionné automatiquement.", + "Chaque interface de rotor indique si elle pilote l’azimut seul ou l’azimut et l’élévation, juste à côté de l’interface. La liste des rotors de la page satellite affiche les azimut-seul en grisé plutôt que de les cacher : un rotor qui ne peut pas suivre un passage dit pourquoi.", + "Nouvelle interface de rotor : ERC-M de DF9GR, le contrôleur azimut/élévation pour un Yaesu G-5500. Via son port COM USB ou le réseau, avec son émulation réglée sur GS-232. Non testé sur matériel — vos retours sont les bienvenus.", + "EasyComm II devient une interface de rotor comme les autres : elle peut tourner l’antenne depuis le compas et depuis un clic sur un spot, plus seulement pendant un passage satellite." + ] + }, { "version": "0.27.19", "date": "", diff --git a/frontend/src/components/SettingsModal.tsx b/frontend/src/components/SettingsModal.tsx index a85ceaf..71017a8 100644 --- a/frontend/src/components/SettingsModal.tsx +++ b/frontend/src/components/SettingsModal.tsx @@ -13,13 +13,13 @@ import { GetChaseSettings, SaveChaseSettings, GetAudioMonitorPref, ListProfiles, GetActiveProfile, SaveProfile, DeleteProfile, ActivateProfile, DuplicateProfile, - GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop, + GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop, GetRotatorTypes, GetRotorPresets, SaveRotorPresets, ResetRotorPresets, GetUltrabeamSettings, SaveUltrabeamSettings, TestUltrabeam, CompactDatabase, CheckHamlogKey, CompareRDASources, ApplyRDAChoices, GetAntGeniusSettings, SaveAntGeniusSettings, GetTunerGeniusSettings, SaveTunerGeniusSettings, GetPSUSettings, SavePSUSettings, - GetSatSettings, SaveSatSettings, TestSatelliteRotator, + GetSatSettings, SaveSatSettings, TestSatelliteRotator, ListSatelliteRotors, GetSatelliteTLEInfo, RefreshSatelliteTLE, AddSatelliteElements, GetSatelliteBirds, GetAmplifiers, SaveAmplifiers, GetAmpStatuses, AmpOperate, GetWinkeyerSettings, SaveWinkeyerSettings, ListSerialPorts, @@ -1896,6 +1896,15 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged // While true, the next key press is captured as the PTT hotkey. const [capturingPtt, setCapturingPtt] = useState(false); const [rotors, setRotors] = useState([]); + // What each rotator backend is and what it can do, straight from Go. The + // panel used to hold its own copy of the list — labels, default ports, which + // ones offer a COM port — and a second copy of that knowledge is a copy that + // drifts. It also carries the answer the satellite page needs: which + // interfaces drive an elevation axis. + const [rotTypes, setRotTypes] = useState([]); + // The rotors the satellite page may choose between. Read from the same list, + // so a mast is described once. + const [satRotors, setSatRotors] = useState([]); const [rotorPresets, setRotorPresets] = useState<{ label: string; azimuth: number }[]>([]); // Whether the presets have actually been READ back yet. // @@ -1922,7 +1931,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged // Satellites: the observer and the az/el rotator. The rest of the satellite // settings (favourites, the pass window) are set in the tab itself, where // they are used. - const [satCfg, setSatCfg] = useState({ min_el: 10, window_h: 24, auto_tle: true, grid: '', alt_m: 0, rot_on: false, rot_type: 'easycomm', rot_pst_port: 12000, rot_transport: 'serial', rot_host: '', rot_port: 4533, rot_com: '', rot_baud: 9600, rot_max_az: 360, rot_min_el: 0, rot_step: 5, rot_park: false }); + const [satCfg, setSatCfg] = useState({ min_el: 10, window_h: 24, auto_tle: true, grid: '', alt_m: 0, rot_on: false, rot_id: '', rot_min_el: 0, rot_step: 5, rot_park: false }); const [satTest, setSatTest] = useState(''); // Amplifier list — operators can run SEVERAL amps (even two SPEs combined), @@ -2517,6 +2526,8 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged await reloadClusterServers(); setCatCfg(c); setRotors((r ?? []) as any); + try { setRotTypes(((await GetRotatorTypes()) ?? []) as any[]); } catch {} + try { setSatRotors(((await ListSatelliteRotors()) ?? []) as any[]); } catch {} // Loaded HERE, in the loader that runs on mount — not only in the // event-driven one below. Missing from this one, the state stayed empty // on a normal open and Save then wrote an empty list over the operator's @@ -2579,6 +2590,8 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged try { setLookup(await GetLookupSettings() as any); } catch {} try { setCatCfg(await GetCATSettings() as any); } catch {} try { setRotors(((await GetRotators()) ?? []) as any); } catch {} + try { setRotTypes(((await GetRotatorTypes()) ?? []) as any[]); } catch {} + try { setSatRotors(((await ListSatelliteRotors()) ?? []) as any[]); } catch {} try { setRotorPresets((((await GetRotorPresets()) ?? []) as any)); setRotorPresetsLoaded(true); } catch {} try { setUltrabeam(await GetUltrabeamSettings() as any); } catch {} try { setAntgenius(await GetAntGeniusSettings() as any); } catch {} @@ -2780,6 +2793,10 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged await SaveLookupSettings(lookup as any); await SaveCATSettings(catCfg as any); await SaveRotators(rotors as any); + // The satellite page picks from this list. Re-read it after a save so a + // rotor added on the Rotator panel can be chosen straight away, without + // closing the window first. + try { setSatRotors(((await ListSatelliteRotors()) ?? []) as any[]); } catch {} // Only once they have been read back — see rotorPresetsLoaded. if (rotorPresetsLoaded) await SaveRotorPresets(rotorPresets as any); await SaveUltrabeamSettings(ultrabeam as any); @@ -4673,113 +4690,40 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged {!!satCfg.rot_on && ( <> - {/* Who drives the mast. Not a detail: a station already running - PstRotator must NOT have OpsLog on the same cable as well. */} -
- {/* Two columns wide: "OpsLog (EasyComm II)" does not fit in a - third of the row, and a truncated choice is a choice an - operator cannot read. */} -
- - set('rot_id', v === '_' ? '' : v)}> + - {t('satset.rotEasycomm')} - {t('satset.rotPst')} + {satRotors.length === 0 && {t('satset.rotNoneConfigured')}} + {/* The azimuth-only rotors are LISTED, and disabled. An + operator who owns one rotator and does not see it + concludes OpsLog cannot find it; shown greyed with + "azimuth only" beside it, they learn the real thing. */} + {satRotors.map((r: any) => ( + + {(r.name || r.type) + (r.has_el ? '' : ` — ${t('satset.rotAzOnly')}`)} + + ))} +
- {satCfg.rot_type === 'pstrotator' && ( - <> -
- - set('rot_host', e.target.value)} /> -
-
- - set('rot_pst_port', num(e.target.value))} /> -
- - )} -
- {satCfg.rot_type === 'pstrotator' && ( -

{t('satset.rotPstHint')}

- )} -
-
- - -
- {satCfg.rot_transport === 'tcp' ? ( - <> -
- - set('rot_host', e.target.value)} /> -
-
- - set('rot_port', num(e.target.value))} /> -
- - ) : ( - <> -
- -
- - -
-
-
- - -
- +

{t('satset.rotPickHint')}

+ {satRotors.length > 0 && !satRotors.some((r: any) => r.has_el) && ( +

{t('satset.rotNoElAtAll')}

)}
- {/* The rotator's range is ours to know only when we drive the - controller. PstRotator knows which machine is on the other - end and does its own overlap; two programs each deciding to - go the long way round is how an antenna unwinds mid-pass. */} - {satCfg.rot_type !== 'pstrotator' && ( -
- - -
- )}
setRotors((l) => [...l, { id: '', name: '', type: 'pst', host: '127.0.0.1', port: 12000, has_elevation: false, rotator_num: 1, dual: false, motorized: true, name2: '', motorized2: false, - transport: 'tcp', com_port: '', baud: 9600, + transport: 'tcp', com_port: '', baud: 9600, max_az: 360, } as any]); const removeRotor = (i: number) => setRotors((l) => l.filter((_, j) => j !== i)); const anyPst = rotors.some((d) => ((d as any).type ?? 'pst') === 'pst'); @@ -5153,18 +5097,45 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged const dev = d as any; const isRG = dev.type === 'rotgenius'; const isARCO = dev.type === 'arco'; + const isERC = dev.type === 'erc'; const isDCU1 = dev.type === 'dcu1'; // A SPID has a COM port and nothing else — no network transport to // offer, which is the whole point of driving it without PstRotator. const isSPID = dev.type === 'spid'; - const isSerialCap = isARCO || isDCU1 || isSPID; // COM-port or serial-over-IP controllers + const isEasycomm = dev.type === 'easycomm'; + const isSerialCap = isARCO || isERC || isDCU1 || isSPID || isEasycomm; // COM-port or serial-over-IP controllers const transport = dev.transport ?? 'tcp'; + // What this backend can do, from Go. The panel asks rather than + // deciding: the same table answers the satellite page's question + // about which rotors have an elevation axis, and two tables would + // eventually disagree about one rotor. + const info = rotTypes.find((k) => k.id === (dev.type ?? 'pst')); + // PstRotator is the only backend where the elevation belongs to the + // station rather than to the protocol — it forwards EL happily to a + // mast that has no elevation motor, so only the operator knows. + const elOptional = !!info?.elevation_optional; + const hasEl = elOptional ? !!dev.has_elevation + : (isSPID ? (dev.spid_model || 'rot2prog') !== 'rot1prog' : !!info?.elevation); + // The mast's range is ours to know only when OpsLog drives the + // controller. PstRotator knows which machine is on the other end and + // does its own overlap; two programs each deciding to go the long + // way round is how an antenna unwinds mid-pass. + const ownsOverlap = isERC || isEasycomm; return (
patch(i, { name: e.target.value })} /> + {/* Which axes this interface drives, beside the interface + itself. Without it the only way to find out is to pick a + rotor on the satellite page and be told no. */} + + {hasEl ? t('rot.capAzEl') : t('rot.capAz')} +