feat(valve): Make end-position current thresholds configurable

Introduces separate Modbus holding registers for configurable end-position
current thresholds for both opening and closing valve movements.

- Added REG_HOLDING_VALVE_END_CURRENT_THRESHOLD_OPEN_MA and
  REG_HOLDING_VALVE_END_CURRENT_THRESHOLD_CLOSE_MA to modbus_server.h.
- Modified valve.c to use these new thresholds and save/load them via settings.
- Added new setter functions to valve.h.
- Created new shell_valve library with commands to set/get these thresholds.
- Updated modbus_tool.py to include new menu options for setting thresholds.
- Updated docs/modbus-registers.de.md to document the new registers.

This enhances the flexibility and calibration of the valve control system.
This commit is contained in:
2025-07-10 23:42:41 +02:00
parent bd8a7a766c
commit 92bb171e85
10 changed files with 198 additions and 12 deletions

View File

@@ -88,6 +88,10 @@ enum {
* @brief Safety timeout in seconds for the closing process.
*/
REG_HOLDING_MAX_CLOSING_TIME_S = 0x0002,
/**
* @brief Minimum current threshold in mA for end-position detection.
*/
REG_HOLDING_VALVE_END_CURRENT_THRESHOLD_MA = 0x0003,
/**
* @brief Bitmask for reading and writing digital outputs. Bit 0: Output 1,
* Bit 1: Output 2. 1=ON, 0=OFF.

View File

@@ -99,6 +99,20 @@ void valve_set_max_open_time(uint16_t seconds);
*/
void valve_set_max_close_time(uint16_t seconds);
/**
* @brief Sets the current threshold for end-position detection during opening.
*
* @param current_ma The current threshold in milliamps.
*/
void valve_set_end_current_threshold_open(uint16_t current_ma);
/**
* @brief Sets the current threshold for end-position detection during closing.
*
* @param current_ma The current threshold in milliamps.
*/
void valve_set_end_current_threshold_close(uint16_t current_ma);
/**
* @brief Gets the configured maximum opening time.
*