Compare commits

...

2 Commits

Author SHA1 Message Date
ddbfb9746d main: respect the elevation mask after applying offsets
This prevents offsets from being able to point below the elevation
mask. The way this is done should probably be reworked, but this whole
thing is such a messy hack anyway that, like, whatever, man.
2024-08-22 13:59:43 -07:00
db55a5081d 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 13:06:27 -07:00

View File

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