From 01072cbc4641857e5a97f1c82f9b62a0215385b4 Mon Sep 17 00:00:00 2001 From: kf Date: Tue, 9 Dec 2025 11:15:07 +0900 Subject: [PATCH 1/7] feat: added Info struct --- src/Config.zig | 359 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 359 insertions(+) diff --git a/src/Config.zig b/src/Config.zig index 770fcab..2d24268 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -328,6 +328,365 @@ test Field { try walkFields(@This(), ""); } +pub const Info = struct { + id: Type = "u16", + __id: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + + station: Type = "u16", + __station: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + + flags: Type = struct { + has_neighbor: struct { + backward: Type = "bool", + __backward: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + forward: type = "bool", + __forward: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + }, + + uses_axis: Type = struct { + axis2: Type = "bool", + axis3: Type = "bool", + }, + __uses_axis: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + + calibration_completed: Type = "bool", + __calibration_completed: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + + rockwell_magnet: Type = "bool", + __rockwell_magnet: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + + flip_sensors: Type = struct { + axis1: Type = "bool", + axis2: Type = "bool", + axis3: Type = "bool", + }, + __flip_sensors: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + + swap_sensor: Type = struct { + axis1: Type = "bool", + axis2: Type = "bool", + axis3: Type = "bool", + }, + __swap_sensor: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + }, + + line: Type = struct { + axis: Type = "u16", + __axis: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + }, + }, + + voltage: Type = struct { + target: Type = "u16", + __target: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "V", + }, + warumup: Type = "u16", + __warumup: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "V", + }, + limit: Type = struct { + lower: Type = "u16", + __lower: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "V", + }, + upper: Type = "u16", + __upper: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "V", + }, + }, + }, + + magnet: Type = struct { + pitch: Type = "f32", + __pitch: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "-", + }, + length: Type = "f32", + __length: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + }, + + carrier: Type = struct { + mass: Type = "u16", + __mass: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + arrival: Type = struct { + threshold: Type = struct { + velocity: Type = "f32", + __velocity: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + position: Type = "f32", + __position: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + }, + }, + }, + + cas: Type = struct { + buffer: Type = "u16", + __buffer: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + acceleration: Type = "f32", + __acceleration: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm/s", + }, + }, + + mechanical_angle_offset: Type = "f32", + + axis: Type = struct { + length: Type = "f32", + __length: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + center: Type = struct { + gain: Type = struct { + current: Type = struct { + p: Type = "f32", + __p: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + i: Type = "f32", + __i: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + denominator: Type = "u32", + __denominator: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + }, + velocity: Type = struct { + p: Type = "f32", + __p: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + i: Type = "f32", + __i: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + denominator: Type = "u32", + __denominator: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + + denominator_pi: Type = "u32", + __denominator_pi: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + }, + position: Type = struct { + p: Type = "f32", + __p: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + denominator: Type = "u32", + __denominator: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + }, + }, + }, + between: Type = struct { + gain: Type = struct { + current: Type = struct { + p: Type = "f32", + __p: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + i: Type = "f32", + __i: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + denominator: Type = "u32", + __denominator: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + }, + velocity: Type = struct { + p: Type = "f32", + __p: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + i: Type = "f32", + __i: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + denominator: Type = "u32", + __denominator: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + + denominator_pi: Type = "u32", + __denominator_pi: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + }, + position: Type = struct { + p: Type = "f32", + __p: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + denominator: Type = "u32", + __denominator: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + }, + }, + }, + }, + + coil: Type = struct { + length: Type = "f32", + __length: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + max_current: Type = "f32", + __max_current: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "A", + }, + continuous_current: Type = "f32", + __continuous_current: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "A", + }, + rs: Type = "f32", + __rs: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + ls: Type = "f32", + __ls: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + center: Type = struct { + kf: Type = "f32", + __kf: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + }, + kdm: Type = "f32", + __kdm: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit = "mm", + }, + }, + + sonsor: Type = struct { + default_magnet_length: Type = "f32", + __default_magnet_length: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + ignore_distance: Type = "f32", + __ignore_distance: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + }, + + zero_position: Type = "f32", + __zero_position: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + + hall_sensors: []const struct { + magnet_length: Type = struct { + backward: Type = "f32", + __backward: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + forward: Type = "f32", + __forward: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + }, + position: Type = struct { + on: Type = struct { + backward: Type = "f32", + __backward: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + forward: Type = "f32", + __forward: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + .unit = "mm", + }, + }, + }, + } = &.{ + .{}, .{}, .{}, .{}, .{}, .{}, + }, + + pub const Type = []const u8; + pub const Meta = struct { + description: ?[]const u8 = null, + unit: ?[]const u8 = null, + }; +}; + /// Driver ID id: u16, From 12f2cf74da5aefca6ad54a57a938b6f45a08aad1 Mon Sep 17 00:00:00 2001 From: kf Date: Tue, 9 Dec 2025 13:16:08 +0900 Subject: [PATCH 2/7] fix: `Config.Info` struct fields init --- src/Config.zig | 120 ++++++++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/Config.zig b/src/Config.zig index 2d24268..2a40234 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -339,22 +339,22 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", }, - flags: Type = struct { + flags: struct { has_neighbor: struct { backward: Type = "bool", __backward: Meta = .{ .description = "Lorem ipsum dolor sit amet.", }, - forward: type = "bool", + forward: Type = "bool", __forward: Meta = .{ .description = "Lorem ipsum dolor sit amet.", }, - }, + } = .{}, - uses_axis: Type = struct { + uses_axis: struct { axis2: Type = "bool", axis3: Type = "bool", - }, + } = .{}, __uses_axis: Meta = .{ .description = "Lorem ipsum dolor sit amet.", }, @@ -369,33 +369,33 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", }, - flip_sensors: Type = struct { + flip_sensors: struct { axis1: Type = "bool", axis2: Type = "bool", axis3: Type = "bool", - }, + } = .{}, __flip_sensors: Meta = .{ .description = "Lorem ipsum dolor sit amet.", }, - swap_sensor: Type = struct { + swap_sensor: struct { axis1: Type = "bool", axis2: Type = "bool", axis3: Type = "bool", - }, + } = .{}, __swap_sensor: Meta = .{ .description = "Lorem ipsum dolor sit amet.", }, - }, + } = .{}, - line: Type = struct { + line: struct { axis: Type = "u16", __axis: Meta = .{ .description = "Lorem ipsum dolor sit amet.", }, - }, + } = .{}, - voltage: Type = struct { + voltage: struct { target: Type = "u16", __target: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -406,7 +406,7 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", .unit = "V", }, - limit: Type = struct { + limit: struct { lower: Type = "u16", __lower: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -417,10 +417,10 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", .unit = "V", }, - }, - }, + } = .{}, + } = .{}, - magnet: Type = struct { + magnet: struct { pitch: Type = "f32", __pitch: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -431,16 +431,16 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", .unit = "mm", }, - }, + } = .{}, - carrier: Type = struct { + carrier: struct { mass: Type = "u16", __mass: Meta = .{ .description = "Lorem ipsum dolor sit amet.", .unit = "mm", }, - arrival: Type = struct { - threshold: Type = struct { + arrival: struct { + threshold: struct { velocity: Type = "f32", __velocity: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -451,11 +451,11 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", .unit = "mm", }, - }, - }, - }, + } = .{}, + } = .{}, + } = .{}, - cas: Type = struct { + cas: struct { buffer: Type = "u16", __buffer: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -466,19 +466,19 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", .unit = "mm/s", }, - }, + } = .{}, mechanical_angle_offset: Type = "f32", - axis: Type = struct { + axis: struct { length: Type = "f32", __length: Meta = .{ .description = "Lorem ipsum dolor sit amet.", .unit = "mm", }, - center: Type = struct { - gain: Type = struct { - current: Type = struct { + center: struct { + gain: struct { + current: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -494,8 +494,8 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - }, - velocity: Type = struct { + } = .{}, + velocity: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -517,8 +517,8 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - }, - position: Type = struct { + } = .{}, + position: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -529,12 +529,12 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - }, - }, - }, - between: Type = struct { - gain: Type = struct { - current: Type = struct { + } = .{}, + } = .{}, + } = .{}, + between: struct { + gain: struct { + current: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -550,8 +550,8 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - }, - velocity: Type = struct { + } = .{}, + velocity: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -573,8 +573,8 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - }, - position: Type = struct { + } = .{}, + position: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -585,12 +585,12 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - }, - }, - }, - }, + } = .{}, + } = .{}, + } = .{}, + } = .{}, - coil: Type = struct { + coil: struct { length: Type = "f32", __length: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -616,21 +616,21 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - center: Type = struct { + center: struct { kf: Type = "f32", __kf: Meta = .{ .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - }, + } = .{}, kdm: Type = "f32", __kdm: Meta = .{ .description = "Lorem ipsum dolor sit amet.", // .unit = "mm", }, - }, + } = .{}, - sonsor: Type = struct { + sonsor: struct { default_magnet_length: Type = "f32", __default_magnet_length: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -641,7 +641,7 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", .unit = "mm", }, - }, + } = .{}, zero_position: Type = "f32", __zero_position: Meta = .{ @@ -650,7 +650,7 @@ pub const Info = struct { }, hall_sensors: []const struct { - magnet_length: Type = struct { + magnet_length: struct { backward: Type = "f32", __backward: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -661,9 +661,9 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", .unit = "mm", }, - }, - position: Type = struct { - on: Type = struct { + } = .{}, + position: struct { + on: struct { backward: Type = "f32", __backward: Meta = .{ .description = "Lorem ipsum dolor sit amet.", @@ -674,8 +674,8 @@ pub const Info = struct { .description = "Lorem ipsum dolor sit amet.", .unit = "mm", }, - }, - }, + } = .{}, + } = .{}, } = &.{ .{}, .{}, .{}, .{}, .{}, .{}, }, From 45b95fcf6c6478a946fdcd7d13cbedeb62ac8028 Mon Sep 17 00:00:00 2001 From: kf Date: Tue, 9 Dec 2025 16:26:30 +0900 Subject: [PATCH 3/7] add, fix: Unit short and long field --- src/Config.zig | 108 ++++++++++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 47 deletions(-) diff --git a/src/Config.zig b/src/Config.zig index 2a40234..b70e0a3 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -399,23 +399,27 @@ pub const Info = struct { target: Type = "u16", __target: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "V", + .unit_short = "V", + .unit_long = "Volt", }, warumup: Type = "u16", __warumup: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "V", + .unit_short = "V", + .unit_long = "Volt", }, limit: struct { lower: Type = "u16", __lower: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "V", + .unit_short = "V", + .unit_long = "Volt", }, upper: Type = "u16", __upper: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "V", + .unit_short = "V", + .unit_long = "Volt", }, } = .{}, } = .{}, @@ -424,12 +428,12 @@ pub const Info = struct { pitch: Type = "f32", __pitch: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "-", + // .unit_short = "-", }, length: Type = "f32", __length: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, } = .{}, @@ -437,19 +441,19 @@ pub const Info = struct { mass: Type = "u16", __mass: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, arrival: struct { threshold: struct { velocity: Type = "f32", __velocity: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, position: Type = "f32", __position: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, } = .{}, } = .{}, @@ -459,12 +463,12 @@ pub const Info = struct { buffer: Type = "u16", __buffer: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, acceleration: Type = "f32", __acceleration: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm/s", + .unit_short = "mm/s", }, } = .{}, @@ -474,7 +478,7 @@ pub const Info = struct { length: Type = "f32", __length: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, center: struct { gain: struct { @@ -482,52 +486,52 @@ pub const Info = struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, i: Type = "f32", __i: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, denominator: Type = "u32", __denominator: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, } = .{}, velocity: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, i: Type = "f32", __i: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, denominator: Type = "u32", __denominator: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, denominator_pi: Type = "u32", __denominator_pi: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, } = .{}, position: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, denominator: Type = "u32", __denominator: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, } = .{}, } = .{}, @@ -538,52 +542,52 @@ pub const Info = struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, i: Type = "f32", __i: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, denominator: Type = "u32", __denominator: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, } = .{}, velocity: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, i: Type = "f32", __i: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, denominator: Type = "u32", __denominator: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, denominator_pi: Type = "u32", __denominator_pi: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, } = .{}, position: struct { p: Type = "f32", __p: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, denominator: Type = "u32", __denominator: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, } = .{}, } = .{}, @@ -594,39 +598,48 @@ pub const Info = struct { length: Type = "f32", __length: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, max_current: Type = "f32", __max_current: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "A", + .unit_short = "A", + .unit_long = "Amp", }, continuous_current: Type = "f32", __continuous_current: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "A", + .unit_short = "A", + .unit_long = "Amp", }, rs: Type = "f32", __rs: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, ls: Type = "f32", __ls: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, center: struct { kf: Type = "f32", __kf: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, } = .{}, - kdm: Type = "f32", - __kdm: Meta = .{ + between: struct { + kf: Type = "f32", + __kf: Meta = .{ + .description = "Lorem ipsum dolor sit amet.", + // .unit_short = "mm", + }, + } = .{}, + kbm: Type = "f32", + __kbm: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - // .unit = "mm", + // .unit_short = "mm", }, } = .{}, @@ -634,19 +647,19 @@ pub const Info = struct { default_magnet_length: Type = "f32", __default_magnet_length: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, ignore_distance: Type = "f32", __ignore_distance: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, } = .{}, zero_position: Type = "f32", __zero_position: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, hall_sensors: []const struct { @@ -654,12 +667,12 @@ pub const Info = struct { backward: Type = "f32", __backward: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, forward: Type = "f32", __forward: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, } = .{}, position: struct { @@ -667,12 +680,12 @@ pub const Info = struct { backward: Type = "f32", __backward: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, forward: Type = "f32", __forward: Meta = .{ .description = "Lorem ipsum dolor sit amet.", - .unit = "mm", + .unit_short = "mm", }, } = .{}, } = .{}, @@ -683,7 +696,8 @@ pub const Info = struct { pub const Type = []const u8; pub const Meta = struct { description: ?[]const u8 = null, - unit: ?[]const u8 = null, + unit_short: ?[]const u8 = null, + unit_long: ?[]const u8 = null, }; }; From edd1df1512b2a29d94aa80c07b3976eddf42d6ee Mon Sep 17 00:00:00 2001 From: kf Date: Wed, 10 Dec 2025 10:37:06 +0900 Subject: [PATCH 4/7] add: description text --- src/Config.zig | 58 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/src/Config.zig b/src/Config.zig index b70e0a3..6052904 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -331,24 +331,38 @@ test Field { pub const Info = struct { id: Type = "u16", __id: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = + \\ID is a identifier number and unique per line. + \\The first driver in the line should have ID number 1. + \\Each connected driver should have consecutively increasing values. + , }, station: Type = "u16", __station: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = + \\CC-Link Station ID is a identifier number and unique per track. + , }, flags: struct { has_neighbor: struct { backward: Type = "bool", __backward: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = + \\States whether there is a driver immediately behind + \\this driver (i.e., a record exists with ID = this + \\driver’s ID − 1). True if such a driver exists; + \\false otherwise. + , }, forward: Type = "bool", - __forward: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - }, + __forward: Meta = .{ .description = + \\States whether there is a driver immediately infront + \\this driver (i.e., a record exists with ID = this + \\driver’s ID + 1). True if such a driver exists; + \\false otherwise. + }, } = .{}, uses_axis: struct { @@ -356,17 +370,29 @@ pub const Info = struct { axis3: Type = "bool", } = .{}, __uses_axis: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + // \\2 must be set before 3 , drivers in the middle of the line + // \\must have 2 and3 true. only tail can have one one or two. + .description = + \\States how many axis are available for the given driver. + \\Axis2 must be set true before axis3. + , }, calibration_completed: Type = "bool", __calibration_completed: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + // "calibratrion cmd was it run at least once", + .description = + \\Indicates whether calibration has been + \\run at least once for this driver. + , }, rockwell_magnet: Type = "bool", __rockwell_magnet: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + // "this has to be true when rockwell inc. magnets are used.", + .description = + \\Set to true when Rockwell magnets are used for this driver. + , }, flip_sensors: struct { @@ -375,7 +401,7 @@ pub const Info = struct { axis3: Type = "bool", } = .{}, __flip_sensors: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = "Flips the sensor readings by 180 degrees. ", }, swap_sensor: struct { @@ -384,34 +410,36 @@ pub const Info = struct { axis3: Type = "bool", } = .{}, __swap_sensor: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = "Swaps the sensors readings on the sides of a coil", }, } = .{}, line: struct { axis: Type = "u16", __axis: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = + \\Total number of axes available in this production line + , }, } = .{}, voltage: struct { target: Type = "u16", __target: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = "for the coils, the voltage that it should run on", .unit_short = "V", .unit_long = "Volt", }, warumup: Type = "u16", __warumup: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = "hsould be applied when apply angle offset", .unit_short = "V", .unit_long = "Volt", }, limit: struct { lower: Type = "u16", __lower: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = "min volt thresh befor alarm", .unit_short = "V", .unit_long = "Volt", }, From ceaa0bd59bb3a3ef1515e339d9776840bbbb934e Mon Sep 17 00:00:00 2001 From: kmotso434 Date: Wed, 10 Dec 2025 14:13:34 +0900 Subject: [PATCH 5/7] fix: Config descriptions --- src/Config.zig | 254 +++++++++++++++++++------------------------------ 1 file changed, 99 insertions(+), 155 deletions(-) diff --git a/src/Config.zig b/src/Config.zig index 6052904..891bce0 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -332,16 +332,16 @@ pub const Info = struct { id: Type = "u16", __id: Meta = .{ .description = - \\ID is a identifier number and unique per line. - \\The first driver in the line should have ID number 1. - \\Each connected driver should have consecutively increasing values. + \\ID is an identifier number and unique per Line. + \\First Driver in Line must have ID number 1. + \\Each Driver in Line must have consecutively increasing IDs. , }, station: Type = "u16", __station: Meta = .{ .description = - \\CC-Link Station ID is a identifier number and unique per track. + \\CC-Link Station ID. Identifier number, unique per Track. , }, @@ -350,48 +350,46 @@ pub const Info = struct { backward: Type = "bool", __backward: Meta = .{ .description = - \\States whether there is a driver immediately behind - \\this driver (i.e., a record exists with ID = this - \\driver’s ID − 1). True if such a driver exists; - \\false otherwise. + \\True if this Driver ID is greater than 1. , }, forward: Type = "bool", - __forward: Meta = .{ .description = - \\States whether there is a driver immediately infront - \\this driver (i.e., a record exists with ID = this - \\driver’s ID + 1). True if such a driver exists; - \\false otherwise. - }, + __forward: Meta = .{ + .description = + \\True if this Driver ID is less than number of Drivers in this + \\Line. + , + }, } = .{}, uses_axis: struct { axis2: Type = "bool", axis3: Type = "bool", + __axis2: Meta = .{ + .description = + \\Whether this Driver uses second Axis. + , + }, + __axis3: Meta = .{ + .description = + \\Whether this Driver uses third Axis. + \\`axis2` must be true if using third Axis. + , + }, } = .{}, __uses_axis: Meta = .{ - // \\2 must be set before 3 , drivers in the middle of the line - // \\must have 2 and3 true. only tail can have one one or two. .description = - \\States how many axis are available for the given driver. - \\Axis2 must be set true before axis3. + \\Axes used by this driver. , }, calibration_completed: Type = "bool", - __calibration_completed: Meta = .{ - // "calibratrion cmd was it run at least once", - .description = - \\Indicates whether calibration has been - \\run at least once for this driver. - , - }, + __calibration_completed: Meta = .{ .hidden = true }, rockwell_magnet: Type = "bool", __rockwell_magnet: Meta = .{ - // "this has to be true when rockwell inc. magnets are used.", .description = - \\Set to true when Rockwell magnets are used for this driver. + \\True if Carriers are Rockwell magnets in this Line. , }, @@ -401,7 +399,9 @@ pub const Info = struct { axis3: Type = "bool", } = .{}, __flip_sensors: Meta = .{ - .description = "Flips the sensor readings by 180 degrees. ", + .description = + \\Invert Carrier movement direction readings. + , }, swap_sensor: struct { @@ -410,7 +410,9 @@ pub const Info = struct { axis3: Type = "bool", } = .{}, __swap_sensor: Meta = .{ - .description = "Swaps the sensors readings on the sides of a coil", + .description = + \\Switch order of the two sensors in Axis. + , }, } = .{}, @@ -418,7 +420,7 @@ pub const Info = struct { axis: Type = "u16", __axis: Meta = .{ .description = - \\Total number of axes available in this production line + \\Total number of Axes used in this Line. , }, } = .{}, @@ -426,26 +428,26 @@ pub const Info = struct { voltage: struct { target: Type = "u16", __target: Meta = .{ - .description = "for the coils, the voltage that it should run on", + .description = "Supplied voltage for motor coils.", .unit_short = "V", .unit_long = "Volt", }, - warumup: Type = "u16", - __warumup: Meta = .{ - .description = "hsould be applied when apply angle offset", + warmup: Type = "u16", + __warmup: Meta = .{ + .description = "Voltage applied to find sensor angle offset.", .unit_short = "V", .unit_long = "Volt", }, limit: struct { lower: Type = "u16", __lower: Meta = .{ - .description = "min volt thresh befor alarm", + .description = "Minimum voltage threshold before alarm.", .unit_short = "V", .unit_long = "Volt", }, upper: Type = "u16", __upper: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = "Maximum voltage threshold before alarm.", .unit_short = "V", .unit_long = "Volt", }, @@ -455,33 +457,43 @@ pub const Info = struct { magnet: struct { pitch: Type = "f32", __pitch: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "-", + .description = "Pole pitch of Carrier magnet.", + .unit_short = "m", + .unit_long = "Meter", }, length: Type = "f32", __length: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .description = "Length of Carrier magnet.", + .unit_short = "m", + .unit_long = "Meter", }, } = .{}, carrier: struct { mass: Type = "u16", __mass: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .description = "Mass of Carrier.", + .unit_short = "dag", + .unit_long = "Decagram", }, arrival: struct { threshold: struct { velocity: Type = "f32", __velocity: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .description = + \\Upper velocity threshold for Carrier movement completion. + , + .unit_short = "m/s", + .unit_long = "Meters per Second", }, position: Type = "f32", __position: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .description = + \\Absolute position error tolerance for Carrier movement + \\completion. + , + .unit_short = "m", + .unit_long = "Meter", }, } = .{}, } = .{}, @@ -490,13 +502,21 @@ pub const Info = struct { cas: struct { buffer: Type = "u16", __buffer: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = + \\Minimum distance between two Carriers before CAS (collision + \\avoidance system) triggers. + , .unit_short = "mm", + .unit_long = "Millimeter", }, acceleration: Type = "f32", __acceleration: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", + .description = + \\Acceleration used to stop Carrier movement when CAS (collision + \\avoidance system) triggers. + , .unit_short = "mm/s", + .unit_long = "Millimeters per Second", }, } = .{}, @@ -505,62 +525,26 @@ pub const Info = struct { axis: struct { length: Type = "f32", __length: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .description = "Distance between each Axis' coil centers.", + .unit_short = "m", + .unit_long = "Meter", }, center: struct { gain: struct { current: struct { p: Type = "f32", - __p: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, i: Type = "f32", - __i: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, denominator: Type = "u32", - __denominator: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, } = .{}, velocity: struct { p: Type = "f32", - __p: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, i: Type = "f32", - __i: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, denominator: Type = "u32", - __denominator: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, - denominator_pi: Type = "u32", - __denominator_pi: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, } = .{}, position: struct { p: Type = "f32", - __p: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, denominator: Type = "u32", - __denominator: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, } = .{}, } = .{}, } = .{}, @@ -568,55 +552,18 @@ pub const Info = struct { gain: struct { current: struct { p: Type = "f32", - __p: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, i: Type = "f32", - __i: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, denominator: Type = "u32", - __denominator: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, } = .{}, velocity: struct { p: Type = "f32", - __p: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, i: Type = "f32", - __i: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, denominator: Type = "u32", - __denominator: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, - denominator_pi: Type = "u32", - __denominator_pi: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, } = .{}, position: struct { p: Type = "f32", - __p: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, denominator: Type = "u32", - __denominator: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", - }, } = .{}, } = .{}, } = .{}, @@ -625,95 +572,91 @@ pub const Info = struct { coil: struct { length: Type = "f32", __length: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .description = "Length of motor coil.", + .unit_short = "m", + .unit_long = "Meter", }, max_current: Type = "f32", __max_current: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", .unit_short = "A", - .unit_long = "Amp", + .unit_long = "Ampere", }, continuous_current: Type = "f32", __continuous_current: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", .unit_short = "A", - .unit_long = "Amp", + .unit_long = "Ampere", }, rs: Type = "f32", __rs: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", + .unit_short = "Ω", + .unit_long = "Ohm (Line to Neutral)", }, ls: Type = "f32", __ls: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", + .unit_short = "H", + .unit_long = "Henry (Line to Neutral)", }, center: struct { kf: Type = "f32", __kf: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", + .unit_short = "N/A_rms", }, } = .{}, between: struct { kf: Type = "f32", __kf: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", + .unit_short = "N/A_rms", }, } = .{}, kbm: Type = "f32", __kbm: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - // .unit_short = "mm", + .unit_short = "V/(m/s)", }, } = .{}, - sonsor: struct { + sensor: struct { default_magnet_length: Type = "f32", __default_magnet_length: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .unit_short = "m", + .unit_long = "Meter", }, ignore_distance: Type = "f32", __ignore_distance: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .unit_short = "m", + .unit_long = "Meter", }, } = .{}, zero_position: Type = "f32", __zero_position: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .unit_short = "m", + .unit_long = "Meter", }, hall_sensors: []const struct { magnet_length: struct { backward: Type = "f32", __backward: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .unit_short = "m", + .unit_long = "Meter", }, forward: Type = "f32", __forward: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .unit_short = "m", + .unit_long = "Meter", }, } = .{}, position: struct { on: struct { backward: Type = "f32", __backward: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .unit_short = "m", + .unit_long = "Meter", }, forward: Type = "f32", __forward: Meta = .{ - .description = "Lorem ipsum dolor sit amet.", - .unit_short = "mm", + .unit_short = "m", + .unit_long = "Meter", }, } = .{}, } = .{}, @@ -723,6 +666,7 @@ pub const Info = struct { pub const Type = []const u8; pub const Meta = struct { + hidden: bool = false, description: ?[]const u8 = null, unit_short: ?[]const u8 = null, unit_long: ?[]const u8 = null, From 14b8dd8e4ab170d53eb4c5831354751501cc5b02 Mon Sep 17 00:00:00 2001 From: kf Date: Wed, 10 Dec 2025 15:05:18 +0900 Subject: [PATCH 6/7] fix: typos --- src/Config.zig | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Config.zig b/src/Config.zig index 891bce0..ca5ae8d 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -404,12 +404,12 @@ pub const Info = struct { , }, - swap_sensor: struct { + swap_sensors: struct { axis1: Type = "bool", axis2: Type = "bool", axis3: Type = "bool", } = .{}, - __swap_sensor: Meta = .{ + __swap_sensors: Meta = .{ .description = \\Switch order of the two sensors in Axis. , @@ -417,8 +417,8 @@ pub const Info = struct { } = .{}, line: struct { - axis: Type = "u16", - __axis: Meta = .{ + axes: Type = "u16", + __axes: Meta = .{ .description = \\Total number of Axes used in this Line. , @@ -497,27 +497,27 @@ pub const Info = struct { }, } = .{}, } = .{}, - } = .{}, - cas: struct { - buffer: Type = "u16", - __buffer: Meta = .{ - .description = - \\Minimum distance between two Carriers before CAS (collision - \\avoidance system) triggers. - , - .unit_short = "mm", - .unit_long = "Millimeter", - }, - acceleration: Type = "f32", - __acceleration: Meta = .{ - .description = - \\Acceleration used to stop Carrier movement when CAS (collision - \\avoidance system) triggers. - , - .unit_short = "mm/s", - .unit_long = "Millimeters per Second", - }, + cas: struct { + buffer: Type = "u16", + __buffer: Meta = .{ + .description = + \\Minimum distance between two Carriers before CAS (collision + \\avoidance system) triggers. + , + .unit_short = "mm", + .unit_long = "Millimeter", + }, + acceleration: Type = "f32", + __acceleration: Meta = .{ + .description = + \\Acceleration used to stop Carrier movement when CAS (collision + \\avoidance system) triggers. + , + .unit_short = "mm/s", + .unit_long = "Millimeters per Second", + }, + } = .{}, } = .{}, mechanical_angle_offset: Type = "f32", From e75e62bf18866cf950df49b1abb49a066956dfb1 Mon Sep 17 00:00:00 2001 From: kf Date: Wed, 10 Dec 2025 15:19:38 +0900 Subject: [PATCH 7/7] fix: CAS units --- src/Config.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Config.zig b/src/Config.zig index ca5ae8d..3b433aa 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -514,8 +514,8 @@ pub const Info = struct { \\Acceleration used to stop Carrier movement when CAS (collision \\avoidance system) triggers. , - .unit_short = "mm/s", - .unit_long = "Millimeters per Second", + .unit_short = "m/s^2", + .unit_long = "Meters per Second squared", }, } = .{}, } = .{},