main: hook up calibration stubs
I guess I will be finishing this later.
This commit is contained in:
22
src/main.zig
22
src/main.zig
@@ -4,6 +4,7 @@ const builtin = @import("builtin");
|
||||
const Config = @import("./Config.zig");
|
||||
const lj = @import("./labjack.zig");
|
||||
const RotCtl = @import("./RotCtl.zig");
|
||||
const YaesuController = @import("./YaesuController.zig");
|
||||
|
||||
const udev = @import("udev_rules");
|
||||
|
||||
@@ -69,7 +70,26 @@ pub fn main() !u8 {
|
||||
log.err("rotator controller ceased unexpectedly! {s}", .{@errorName(err)});
|
||||
return 1;
|
||||
};
|
||||
} else if (std.mem.eql(u8, args[1], commands.calibrate)) {
|
||||
if (args.len < 3 or args.len > 4) {
|
||||
printHelp(exename, .calibrate);
|
||||
return 1;
|
||||
}
|
||||
|
||||
loadConfigOrDefault(allocator, if (args.len == 4) args[3] else null) catch
|
||||
return 1;
|
||||
defer Config.deinit();
|
||||
|
||||
const routine = std.meta.stringToEnum(YaesuController.CalibrationRoutine, args[2]) orelse {
|
||||
log.err("{s} is not a known calibration routine.", .{args[2]});
|
||||
printHelp(exename, .calibrate);
|
||||
return 1;
|
||||
};
|
||||
|
||||
YaesuController.calibrate(allocator, routine) catch |err| {
|
||||
log.err("Calibration failed: {s}", .{@errorName(err)});
|
||||
return 1;
|
||||
};
|
||||
} else if (std.mem.eql(u8, args[1], commands.help)) {
|
||||
if (args.len != 3) {
|
||||
printHelp(exename, .help);
|
||||
@@ -271,7 +291,7 @@ const command_help = .{
|
||||
\\ Perform a calibration routine and write an updated configuration with its results.
|
||||
\\
|
||||
\\Arguments:
|
||||
\\ routine Must be one of `feedback` or `orientation`. The different calibration routines have
|
||||
\\ routine Must be either `feedback` or `orientation`. The different calibration routines have
|
||||
\\ different requirements. `orientation` calibration is a sun-pointing-based routine and
|
||||
\\ should be performed after `feedback` calibration is complete.
|
||||
\\ config_file [Optional] the path of a config file to load. This file will be updated with the
|
||||
|
Reference in New Issue
Block a user