diff --git a/src/Config.zig b/src/Config.zig index 64867a6..47e9dde 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -65,6 +65,9 @@ controller: ControllerConfig = .{ .parking_posture = .{ .azimuth = 180, .elevation = 90 }, .angle_tolerance = .{ .azimuth = 1, .elevation = 1 }, .angle_offset = .{ .azimuth = 0, .elevation = 0 }, + // this is a symmetric mask, so the minimum usable elevation is elevation_mask deg + // and the maximum usable elevation is 180 - elevation_mask deg + .elevation_mask = 0.0, }, pub const VoltAngle = struct { voltage: f64, angle: f64 }; @@ -115,6 +118,7 @@ const ControllerConfig = struct { parking_posture: AzEl, angle_tolerance: AzEl, angle_offset: AzEl, + elevation_mask: f64, const OutPair = struct { increase: lj.DigitalOutputChannel, diff --git a/src/LabjackYaesu.zig b/src/LabjackYaesu.zig index 34f5ab7..b46dab3 100644 --- a/src/LabjackYaesu.zig +++ b/src/LabjackYaesu.zig @@ -40,7 +40,13 @@ pub fn setTarget(self: LabjackYaesu, target: AzEl) void { defer self.lock.unlock(); const controller = @constCast(self.controller); - controller.target = target; + controller.target = .{ + .azimuth = target.azimuth, + .elevation = @min( + @max(target.elevation, config.controller.elevation_mask), + 180.0 - config.controller.elevation_mask, + ), + }; controller.requested_state = .running; }