From 5951ad99b88dc4ea7c5281ac6fa56760a7693596 Mon Sep 17 00:00:00 2001 From: kf Date: Mon, 22 Dec 2025 14:00:50 +0900 Subject: [PATCH 1/8] refactor: doc cmt Config.zig Info struct --- src/Config.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Config.zig b/src/Config.zig index 3b433aa..312f6ee 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -328,6 +328,8 @@ test Field { try walkFields(@This(), ""); } +/// Provides metadata for the field, including its type, description, +/// visibility, and unit information. pub const Info = struct { id: Type = "u16", __id: Meta = .{ From 23e38f8f8da677dbe39d93d253be6f699e0fa057 Mon Sep 17 00:00:00 2001 From: kf Date: Mon, 22 Dec 2025 15:24:42 +0900 Subject: [PATCH 2/8] feat: add meta info struct --- src/Log.zig | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/Log.zig b/src/Log.zig index 761517a..69a03fc 100644 --- a/src/Log.zig +++ b/src/Log.zig @@ -54,6 +54,55 @@ pub const Config = packed struct(u32) { _: u6 = 0, }; +/// Provides metadata for the field, type. +pub const Info = struct { + // Driver log. + driver: struct { + cycle: Type = "bool", + cycle_time: Type = "bool", + vdc: Type = "bool", + com_bwd_sent: Type = "bool", + com_bwd_arrived: Type = "bool", + com_fwd_sent: Type = "bool", + com_fwd_arrived: Type = "bool", + com_bwd_sent_cycles: Type = "bool", + com_fwd_sent_cycles: Type = "bool", + } = .{}, + + // Sensor log. + sensor: struct { + alarm: Type = "bool", + valid: Type = "bool", + active: Type = "bool", + angle: Type = "bool", + average_angle: Type = "bool", + distance: Type = "bool", + velocity: Type = "bool", + } = .{}, + + // Axis log. + axis: struct { + current_d: Type = "bool", + current_q: Type = "bool", + reference_current_d: Type = "bool", + reference_current_q: Type = "bool", + carrier_id: Type = "bool", + carrier_position: Type = "bool", + carrier_state: Type = "bool", + average_angle_diff: Type = "bool", + carrier_reference_velocity: Type = "bool", + carrier_velocity: Type = "bool", + } = .{}, + // _: u6 = 0, + 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, + }; +}; + pub const Start = enum(u3) { immediate = 0, sensor_on = 1, From 4395043dcf4e3dbe2e4d7c7921c1748cab3504aa Mon Sep 17 00:00:00 2001 From: kf Date: Fri, 26 Dec 2025 15:30:43 +0900 Subject: [PATCH 3/8] feat: add fields to info struct --- src/Log.zig | 83 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 34 deletions(-) diff --git a/src/Log.zig b/src/Log.zig index 69a03fc..99904c6 100644 --- a/src/Log.zig +++ b/src/Log.zig @@ -56,44 +56,59 @@ pub const Config = packed struct(u32) { /// Provides metadata for the field, type. pub const Info = struct { - // Driver log. - driver: struct { - cycle: Type = "bool", - cycle_time: Type = "bool", - vdc: Type = "bool", - com_bwd_sent: Type = "bool", - com_bwd_arrived: Type = "bool", - com_fwd_sent: Type = "bool", - com_fwd_arrived: Type = "bool", - com_bwd_sent_cycles: Type = "bool", - com_fwd_sent_cycles: Type = "bool", - } = .{}, + cycles: Type = "u32", + config: struct { + // Driver log. + driver: struct { + cycle: Type = "bool", + cycle_time: Type = "bool", + vdc: Type = "bool", + com_bwd_sent: Type = "bool", + com_bwd_arrived: Type = "bool", + com_fwd_sent: Type = "bool", + com_fwd_arrived: Type = "bool", + com_bwd_sent_cycles: Type = "bool", + com_fwd_sent_cycles: Type = "bool", + } = .{}, - // Sensor log. - sensor: struct { - alarm: Type = "bool", - valid: Type = "bool", - active: Type = "bool", - angle: Type = "bool", - average_angle: Type = "bool", - distance: Type = "bool", - velocity: Type = "bool", + // Sensor log. + sensor: struct { + alarm: Type = "bool", + valid: Type = "bool", + active: Type = "bool", + angle: Type = "bool", + average_angle: Type = "bool", + distance: Type = "bool", + velocity: Type = "bool", + } = .{}, + + // Axis log. + axis: struct { + current_d: Type = "bool", + current_q: Type = "bool", + reference_current_d: Type = "bool", + reference_current_q: Type = "bool", + carrier_id: Type = "bool", + carrier_position: Type = "bool", + carrier_state: Type = "bool", + average_angle_diff: Type = "bool", + carrier_reference_velocity: Type = "bool", + carrier_velocity: Type = "bool", + } = .{}, + // _: u6 = 0, } = .{}, - // Axis log. - axis: struct { - current_d: Type = "bool", - current_q: Type = "bool", - reference_current_d: Type = "bool", - reference_current_q: Type = "bool", - carrier_id: Type = "bool", - carrier_position: Type = "bool", - carrier_state: Type = "bool", - average_angle_diff: Type = "bool", - carrier_reference_velocity: Type = "bool", - carrier_velocity: Type = "bool", + axis: [3][]const u8 = .{"bool"} ** 3, + hall_sensor: [6][]const u8 = .{"bool"} ** 6, + carrier: [4][]const u8 = .{"u12"} ** 4, + + start: struct { + kind: Type = "enum", + combinator: Type = "enum", + hall_sensor: [6][]const u8 = .{"bool"} ** 6, + carrier: [4][]const u8 = .{"u12"} ** 4, } = .{}, - // _: u6 = 0, + pub const Type = []const u8; pub const Meta = struct { hidden: bool = false, From 1e11e1cd4524743ab56fe01c2aedee2768b65baa Mon Sep 17 00:00:00 2001 From: kf Date: Fri, 26 Dec 2025 15:34:35 +0900 Subject: [PATCH 4/8] refactor: added missing field --- src/Log.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Log.zig b/src/Log.zig index 99904c6..54199fa 100644 --- a/src/Log.zig +++ b/src/Log.zig @@ -96,6 +96,7 @@ pub const Info = struct { carrier_velocity: Type = "bool", } = .{}, // _: u6 = 0, + _: Type = u6, } = .{}, axis: [3][]const u8 = .{"bool"} ** 3, From d036218a4cba123dff949cdd9315840f2032c31a Mon Sep 17 00:00:00 2001 From: kf Date: Fri, 2 Jan 2026 19:11:52 +0900 Subject: [PATCH 5/8] feat: add descriptions --- src/Log.zig | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/Log.zig b/src/Log.zig index 54199fa..deb5ac0 100644 --- a/src/Log.zig +++ b/src/Log.zig @@ -57,9 +57,19 @@ pub const Config = packed struct(u32) { /// Provides metadata for the field, type. pub const Info = struct { cycles: Type = "u32", + __cycles: Meta = .{ + .description = + \\Operating frequency, 15000 cycles per second. + , + }, config: struct { // Driver log. driver: struct { + driver: Meta = .{ + .description = + \\Driver properties to be logged. + , + }, cycle: Type = "bool", cycle_time: Type = "bool", vdc: Type = "bool", @@ -73,6 +83,11 @@ pub const Info = struct { // Sensor log. sensor: struct { + __sensor: Meta = .{ + .description = + \\Sensor properties to be logged. + , + }, alarm: Type = "bool", valid: Type = "bool", active: Type = "bool", @@ -84,6 +99,11 @@ pub const Info = struct { // Axis log. axis: struct { + __axis: Meta = .{ + .description = + \\Axis properties to be logged. + , + }, current_d: Type = "bool", current_q: Type = "bool", reference_current_d: Type = "bool", @@ -100,15 +120,54 @@ pub const Info = struct { } = .{}, axis: [3][]const u8 = .{"bool"} ** 3, + __axis: Meta = .{ + .description = + \\Axis available to Driver. + , + }, hall_sensor: [6][]const u8 = .{"bool"} ** 6, + __hall_sensor: Meta = .{ + \\Driver Hall Sensor states. + , + }, carrier: [4][]const u8 = .{"u12"} ** 4, + __carrier: Meta = .{ + .description = + \\ID of the availabe Carriers of Driver. + , + }, start: struct { kind: Type = "enum", + __kind: Meta = .{ + .description = + \\Kind of starting condition. + , + }, combinator: Type = "enum", + __combinator: Meta = .{ + .description = + \\How conditions are combined. + , + }, hall_sensor: [6][]const u8 = .{"bool"} ** 6, + __hall_sensor: Meta = .{ + .description = + \\Which Hall Sensors must be in the set state. + , + }, carrier: [4][]const u8 = .{"u12"} ** 4, + __carrier: Meta = .{ + .description = + \\Which Carrier must be in the set state. + , + }, } = .{}, + __start: Meta = .{ + .description = + \\Conditions required to start logging. + , + }, pub const Type = []const u8; pub const Meta = struct { From d0875169c7733bdcefcdce3626610d5a8d18ecd4 Mon Sep 17 00:00:00 2001 From: kf Date: Mon, 5 Jan 2026 11:18:21 +0900 Subject: [PATCH 6/8] refactor: chg descriptions --- src/Log.zig | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Log.zig b/src/Log.zig index deb5ac0..dc9313a 100644 --- a/src/Log.zig +++ b/src/Log.zig @@ -59,7 +59,8 @@ pub const Info = struct { cycles: Type = "u32", __cycles: Meta = .{ .description = - \\Operating frequency, 15000 cycles per second. + \\Duration of logging process. + \\15000 cycles per second. , }, config: struct { @@ -122,18 +123,18 @@ pub const Info = struct { axis: [3][]const u8 = .{"bool"} ** 3, __axis: Meta = .{ .description = - \\Axis available to Driver. + \\Axes to be included in the logging process. , }, hall_sensor: [6][]const u8 = .{"bool"} ** 6, __hall_sensor: Meta = .{ - \\Driver Hall Sensor states. + \\Hall Sensors to be included in the logging process. , }, carrier: [4][]const u8 = .{"u12"} ** 4, __carrier: Meta = .{ .description = - \\ID of the availabe Carriers of Driver. + \\Carriers IDs to be included in the logging process. , }, @@ -141,7 +142,7 @@ pub const Info = struct { kind: Type = "enum", __kind: Meta = .{ .description = - \\Kind of starting condition. + \\Conditions to start logging process. , }, combinator: Type = "enum", @@ -153,19 +154,19 @@ pub const Info = struct { hall_sensor: [6][]const u8 = .{"bool"} ** 6, __hall_sensor: Meta = .{ .description = - \\Which Hall Sensors must be in the set state. + \\Hall Sensors state to start logging. , }, carrier: [4][]const u8 = .{"u12"} ** 4, __carrier: Meta = .{ .description = - \\Which Carrier must be in the set state. + \\Carrier state to start logging. , }, } = .{}, __start: Meta = .{ .description = - \\Conditions required to start logging. + \\Configuration to start logging process. , }, From 5a4dc60720d36b3bd54832f0d8ac6b0df8f53cd9 Mon Sep 17 00:00:00 2001 From: kf Date: Thu, 8 Jan 2026 13:33:41 +0900 Subject: [PATCH 7/8] refactor: Changing description and unit style. Change code style. --- src/Config.zig | 9 ++++---- src/Log.zig | 63 +++++++++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/Config.zig b/src/Config.zig index 312f6ee..6d06a7e 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -504,8 +504,7 @@ pub const Info = struct { buffer: Type = "u16", __buffer: Meta = .{ .description = - \\Minimum distance between two Carriers before CAS (collision - \\avoidance system) triggers. + \\Minimum distance between two Carriers before CAS triggers. , .unit_short = "mm", .unit_long = "Millimeter", @@ -513,13 +512,13 @@ pub const Info = struct { acceleration: Type = "f32", __acceleration: Meta = .{ .description = - \\Acceleration used to stop Carrier movement when CAS (collision - \\avoidance system) triggers. + \\Acceleration used to stop Carrier movement when CAS triggers. , - .unit_short = "m/s^2", + .unit_short = "m/s²", .unit_long = "Meters per Second squared", }, } = .{}, + __cas: Meta = .{ .description = "Collision Avoidance System" }, } = .{}, mechanical_angle_offset: Type = "f32", diff --git a/src/Log.zig b/src/Log.zig index dc9313a..73d24f2 100644 --- a/src/Log.zig +++ b/src/Log.zig @@ -56,7 +56,7 @@ pub const Config = packed struct(u32) { /// Provides metadata for the field, type. pub const Info = struct { - cycles: Type = "u32", + cycles: []const u8 = "u32", __cycles: Meta = .{ .description = \\Duration of logging process. @@ -71,15 +71,15 @@ pub const Info = struct { \\Driver properties to be logged. , }, - cycle: Type = "bool", - cycle_time: Type = "bool", - vdc: Type = "bool", - com_bwd_sent: Type = "bool", - com_bwd_arrived: Type = "bool", - com_fwd_sent: Type = "bool", - com_fwd_arrived: Type = "bool", - com_bwd_sent_cycles: Type = "bool", - com_fwd_sent_cycles: Type = "bool", + cycle: []const u8 = "bool", + cycle_time: []const u8 = "bool", + vdc: []const u8 = "bool", + com_bwd_sent: []const u8 = "bool", + com_bwd_arrived: []const u8 = "bool", + com_fwd_sent: []const u8 = "bool", + com_fwd_arrived: []const u8 = "bool", + com_bwd_sent_cycles: []const u8 = "bool", + com_fwd_sent_cycles: []const u8 = "bool", } = .{}, // Sensor log. @@ -89,13 +89,13 @@ pub const Info = struct { \\Sensor properties to be logged. , }, - alarm: Type = "bool", - valid: Type = "bool", - active: Type = "bool", - angle: Type = "bool", - average_angle: Type = "bool", - distance: Type = "bool", - velocity: Type = "bool", + alarm: []const u8 = "bool", + valid: []const u8 = "bool", + active: []const u8 = "bool", + angle: []const u8 = "bool", + average_angle: []const u8 = "bool", + distance: []const u8 = "bool", + velocity: []const u8 = "bool", } = .{}, // Axis log. @@ -105,19 +105,18 @@ pub const Info = struct { \\Axis properties to be logged. , }, - current_d: Type = "bool", - current_q: Type = "bool", - reference_current_d: Type = "bool", - reference_current_q: Type = "bool", - carrier_id: Type = "bool", - carrier_position: Type = "bool", - carrier_state: Type = "bool", - average_angle_diff: Type = "bool", - carrier_reference_velocity: Type = "bool", - carrier_velocity: Type = "bool", + current_d: []const u8 = "bool", + current_q: []const u8 = "bool", + reference_current_d: []const u8 = "bool", + reference_current_q: []const u8 = "bool", + carrier_id: []const u8 = "bool", + carrier_position: []const u8 = "bool", + carrier_state: []const u8 = "bool", + average_angle_diff: []const u8 = "bool", + carrier_reference_velocity: []const u8 = "bool", + carrier_velocity: []const u8 = "bool", } = .{}, - // _: u6 = 0, - _: Type = u6, + _: []const u8 = "u6", } = .{}, axis: [3][]const u8 = .{"bool"} ** 3, @@ -128,6 +127,7 @@ pub const Info = struct { }, hall_sensor: [6][]const u8 = .{"bool"} ** 6, __hall_sensor: Meta = .{ + .description = \\Hall Sensors to be included in the logging process. , }, @@ -139,13 +139,13 @@ pub const Info = struct { }, start: struct { - kind: Type = "enum", + kind: []const u8 = "enum", __kind: Meta = .{ .description = \\Conditions to start logging process. , }, - combinator: Type = "enum", + combinator: []const u8 = "enum", __combinator: Meta = .{ .description = \\How conditions are combined. @@ -170,7 +170,6 @@ pub const Info = struct { , }, - pub const Type = []const u8; pub const Meta = struct { hidden: bool = false, description: ?[]const u8 = null, From ffe2448af6a83f7e12300156ba1aae67e14e73ec Mon Sep 17 00:00:00 2001 From: kf Date: Thu, 8 Jan 2026 17:49:38 +0900 Subject: [PATCH 8/8] feat: set `carrier` to "hidden" in `Info` struct --- src/Log.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Log.zig b/src/Log.zig index 73d24f2..c800402 100644 --- a/src/Log.zig +++ b/src/Log.zig @@ -133,6 +133,7 @@ pub const Info = struct { }, carrier: [4][]const u8 = .{"u12"} ** 4, __carrier: Meta = .{ + .hidden = true, .description = \\Carriers IDs to be included in the logging process. , @@ -159,6 +160,7 @@ pub const Info = struct { }, carrier: [4][]const u8 = .{"u12"} ** 4, __carrier: Meta = .{ + .hidden = true, .description = \\Carrier state to start logging. ,