feat(rotator): drive a Rotator Genius through the overlap

An operator with a 450° mast watched the Genius stop at 359 and had to press
"clockwise" by hand to get through north. Half of that was ours: GoTo clamped
every target to 360 before sending it, although the wire command carries three
digits and always could have said 370.

So the clamp goes to 450, the rotator-range setting is offered for the Rotator
Genius like the other backends it applies to, and when a bearing can be reached
two ways the nearer one is taken — 010° sent as 370° when the antenna is already
at 350°, which is the entire point of having an overlap.

THE GENIUS DECIDES WHAT IS REACHABLE. It reports the limits it is configured
with, and they are the truth about what is bolted to the tower. This particular
station's box says "5 to 4" — the factory 360° range — and would refuse 370,
turning a working command into a rejected one. So the overlap is used only when
the Genius itself says it has one, and when OpsLog is set to 450 while the Genius
is not, the log says so once a minute and names the dialog to change: the setting
lives in the Genius's own Rotator Configuration, and nothing here can reach past
its limits.

The |h reply always carried those limits and they were being skipped over.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
2026-09-09 23:46:04 +02:00
co-authored by Claude Opus 5
parent b8491f3038
commit 3dad00f8ad
4 changed files with 112 additions and 10 deletions
+27 -6
View File
@@ -33,10 +33,16 @@ const (
// Status is one rotator's live state parsed from a |h reply.
type Status struct {
Azimuth int // current heading in degrees (0..360)
Azimuth int // current heading in degrees (0..450 on an overlap rotator)
Connected bool // false when the sensor reports 999 (not connected)
Moving int // 0 not moving, 1 CW, 2 CCW
Target int // target azimuth when moving (else -1)
// The soft limits the Genius itself is configured with, as it reports them.
// Read rather than assumed: an operator with a 450° mast has told the
// Genius so, and that is the authority on how far it will go — OpsLog
// asking for 400° on a box configured for 360 is a command it will refuse.
LimitCW int
LimitCCW int
}
// Client is a stateless connector: each call opens a short-lived TCP connection,
@@ -128,15 +134,30 @@ func (c *Client) Read(rotator int) (Status, error) {
cur := atoiField(string(p[base : base+3]))
moving := atoiField(string(p[base+10 : base+11]))
target := atoiField(string(p[base+15 : base+18]))
st := Status{Azimuth: cur, Moving: moving, Connected: cur != 999, Target: -1}
st := Status{
Azimuth: cur, Moving: moving, Connected: cur != 999, Target: -1,
LimitCW: atoiField(string(p[base+3 : base+6])),
LimitCCW: atoiField(string(p[base+6 : base+9])),
}
if target != 999 {
st.Target = target
}
return st, nil
}
// GoTo moves the rotator to az (0..360). The reply's status byte is 'K' on
// accept, 'F' on reject.
// GoTo moves the rotator to az. The reply's status byte is 'K' on accept, 'F'
// on reject.
//
// The ceiling is 450 and not 360, which is the whole point: a rotator with an
// overlap can be asked for 010° as either 10 or 370, and only the second reaches
// it without unwinding the cable back through north. The command carries three
// digits, so the range was never the protocol's — it was ours, and it left an
// operator with a 450° mast clicking "clockwise" by hand every time a bearing
// crossed north.
//
// A Genius configured for a 360° rotator refuses a target beyond its own limit,
// which is the correct place for that decision: it knows what is bolted to the
// tower, and OpsLog does not.
func (c *Client) GoTo(rotator, az int) error {
if rotator != 1 && rotator != 2 {
rotator = 1
@@ -144,8 +165,8 @@ func (c *Client) GoTo(rotator, az int) error {
if az < 0 {
az = 0
}
if az > 360 {
az = 360
if az > 450 {
az = 450
}
reply, err := c.exchange(fmt.Sprintf("|A%d%03d", rotator, az), 8)
if err != nil {