From 45d011952ff51ce4765cbb67ebe2edaaeb1ad523 Mon Sep 17 00:00:00 2001 From: Eduard Iten Date: Thu, 3 Jul 2025 19:04:20 +0200 Subject: [PATCH] fix(valve): Correct VND7050AJ initialization and pin configuration - Initialize RST pin as active to keep VND7050AJ out of reset state - Clarify S0/S1 pins as output select pins with descriptive comments - Add initialization logging to show configured max open/close times - Ensure proper valve controller startup sequence --- .gemini_commit_message.txt | 7 ++++ .../bindings/vnd7050aj-valve-controller.yaml | 35 +++++++++++++++++++ software/lib/valve/valve.c | 9 +++-- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 .gemini_commit_message.txt create mode 100644 software/apps/slave_node/dts/bindings/vnd7050aj-valve-controller.yaml diff --git a/.gemini_commit_message.txt b/.gemini_commit_message.txt new file mode 100644 index 0000000..90ef846 --- /dev/null +++ b/.gemini_commit_message.txt @@ -0,0 +1,7 @@ +feat(modbus): Implement persistent and improved reconfiguration for Modbus server + +This commit enhances the Modbus server's configuration handling by: + +- Loading saved baudrate and unit ID settings during initialization, ensuring persistence across reboots. +- Providing improved feedback during `modbus_reconfigure`, including logging for successful changes and informing the user when a device restart is required for changes to take effect. +- Saving new configuration settings even if immediate reinitialization fails, allowing them to be applied on the next boot. \ No newline at end of file diff --git a/software/apps/slave_node/dts/bindings/vnd7050aj-valve-controller.yaml b/software/apps/slave_node/dts/bindings/vnd7050aj-valve-controller.yaml new file mode 100644 index 0000000..6e86bfe --- /dev/null +++ b/software/apps/slave_node/dts/bindings/vnd7050aj-valve-controller.yaml @@ -0,0 +1,35 @@ +# VND7050AJ Valve Controller binding +description: VND7050AJ valve controller GPIO configuration + +compatible: "vnd7050aj-valve-controller" + +properties: + in0-gpios: + type: phandle-array + description: GPIO for IN0 control signal + required: true + + in1-gpios: + type: phandle-array + description: GPIO for IN1 control signal + required: true + + rst-gpios: + type: phandle-array + description: GPIO for reset pin + required: true + + sen-gpios: + type: phandle-array + description: GPIO for sense enable pin + required: true + + s0-gpios: + type: phandle-array + description: GPIO for status/select 0 pin + required: true + + s1-gpios: + type: phandle-array + description: GPIO for status/select 1 pin + required: true diff --git a/software/lib/valve/valve.c b/software/lib/valve/valve.c index b0b4e11..059b095 100644 --- a/software/lib/valve/valve.c +++ b/software/lib/valve/valve.c @@ -45,10 +45,13 @@ void valve_init(void) gpio_pin_configure_dt(&valve_gpios.in0, GPIO_OUTPUT_INACTIVE); gpio_pin_configure_dt(&valve_gpios.in1, GPIO_OUTPUT_INACTIVE); - gpio_pin_configure_dt(&valve_gpios.rst, GPIO_OUTPUT_INACTIVE); + gpio_pin_configure_dt(&valve_gpios.rst, GPIO_OUTPUT_ACTIVE); // Keep VND7050AJ out of reset gpio_pin_configure_dt(&valve_gpios.sen, GPIO_OUTPUT_INACTIVE); - gpio_pin_configure_dt(&valve_gpios.s0, GPIO_OUTPUT_INACTIVE); - gpio_pin_configure_dt(&valve_gpios.s1, GPIO_OUTPUT_INACTIVE); + gpio_pin_configure_dt(&valve_gpios.s0, GPIO_OUTPUT_INACTIVE); // S0 select pin - output + gpio_pin_configure_dt(&valve_gpios.s1, GPIO_OUTPUT_INACTIVE); // S1 select pin - output + + LOG_INF("Valve initialized: max_open=%us, max_close=%us", max_opening_time_s, max_closing_time_s); +} } void valve_open(void)