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.
This commit is contained in:
16
src/main.zig
16
src/main.zig
@@ -185,9 +185,21 @@ pub const RotInt = struct {
|
|||||||
.el = self.requested_posture.el,
|
.el = self.requested_posture.el,
|
||||||
};
|
};
|
||||||
mangled.el = if (mangled.el > 90)
|
mangled.el = if (mangled.el > 90)
|
||||||
@min(mangled.el, 180 - self.conf.elevation_mask) - self.offsets.el
|
@max(
|
||||||
|
@min(
|
||||||
|
@min(mangled.el, 180 - self.conf.elevation_mask) - self.offsets.el,
|
||||||
|
180 - self.conf.elevation_mask,
|
||||||
|
),
|
||||||
|
90,
|
||||||
|
)
|
||||||
else
|
else
|
||||||
@max(mangled.el, self.conf.elevation_mask) + self.offsets.el;
|
@min(
|
||||||
|
@max(
|
||||||
|
@max(mangled.el, self.conf.elevation_mask) + self.offsets.el,
|
||||||
|
self.conf.elevation_mask,
|
||||||
|
),
|
||||||
|
90,
|
||||||
|
);
|
||||||
|
|
||||||
self.sendRotatorCommand(.{ .set_position = mangled });
|
self.sendRotatorCommand(.{ .set_position = mangled });
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user