Compare commits

..

1 Commits

Author SHA1 Message Date
86a5fa20a4 main: treat elevation offset as offset from horizon
Rather than having somewhat confusing flipped logic when the rotator is
operating in the 180-90 degree elevation regime, this internally
performs sign flipping. This means that a 3 degree elevation offset
means "point an additional 3 degrees up from the horizon" regardless
of whether the rotator is operating in the 0-90 or 180-90 elevation
ranges.
2024-08-22 11:55:12 -07:00

View File

@@ -182,24 +182,12 @@ pub const RotInt = struct {
if (self.pollcount == 0) {
var mangled: AzEl = .{
.az = self.requested_posture.az + self.offsets.az,
.el = self.requested_posture.el,
.el = self.requested_posture.el + if (self.requested_posture.el > 90) -self.offsets.el else self.offsets.el,
};
mangled.el = if (mangled.el > 90)
@max(
@min(
@min(mangled.el, 180 - self.conf.elevation_mask) - self.offsets.el,
180 - self.conf.elevation_mask,
),
90,
)
@min(mangled.el, 180 - self.conf.elevation_mask)
else
@min(
@max(
@max(mangled.el, self.conf.elevation_mask) + self.offsets.el,
self.conf.elevation_mask,
),
90,
);
@max(mangled.el, self.conf.elevation_mask);
self.sendRotatorCommand(.{ .set_position = mangled });
} else {