docs: Update German documentation and project plan
- Updated Doxygen comments in header files (valve.h, fwu.h, modbus_server.h) to be consistent and in English. - Translated German register names in docs/modbus-registers.de.md to English. - Updated docs/concept.de.md to reflect new details on current measurement and sensors. - Updated docs/planning.de.md to reflect completed tasks in Phase 1.
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
#ifndef ADC_SENSOR_H
|
||||
#define ADC_SENSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @file adc_sensor.h
|
||||
* @brief API for the ADC sensor library.
|
||||
*
|
||||
* This library provides functions to initialize and read from the ADC sensors,
|
||||
* specifically for measuring supply voltage and motor current.
|
||||
* It can operate in a real or simulated mode.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes the ADC sensor system.
|
||||
*
|
||||
* This function sets up the necessary ADC channels and configurations.
|
||||
* It should be called once before any other function in this library.
|
||||
* In simulated mode, it logs the simulated values.
|
||||
*
|
||||
* @return 0 on success, or a negative error code on failure.
|
||||
*/
|
||||
int adc_sensor_init(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current supply voltage reading.
|
||||
*
|
||||
* This function reads the value from the corresponding ADC channel and converts
|
||||
* it to millivolts.
|
||||
*
|
||||
* @return The supply voltage in millivolts (mV).
|
||||
*/
|
||||
uint16_t adc_sensor_get_voltage_mv(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current motor current reading (legacy function).
|
||||
*
|
||||
* This function reads the current from the opening channel (IN0).
|
||||
* For backward compatibility only. Use adc_sensor_get_current_open_ma()
|
||||
* instead.
|
||||
*
|
||||
* @return The motor current in milliamps (mA).
|
||||
*/
|
||||
uint16_t adc_sensor_get_current_ma(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the motor opening current reading (IN0 current sense).
|
||||
*
|
||||
* This function reads the current from the VND7050AJ IN0 current sense channel.
|
||||
* Used for monitoring valve opening current.
|
||||
*
|
||||
* @return The motor opening current in milliamps (mA).
|
||||
*/
|
||||
uint16_t adc_sensor_get_current_open_ma(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the motor closing current reading (IN1 current sense).
|
||||
*
|
||||
* This function reads the current from the VND7050AJ IN1 current sense channel.
|
||||
* Used for monitoring valve closing current.
|
||||
*
|
||||
* @return The motor closing current in milliamps (mA).
|
||||
*/
|
||||
uint16_t adc_sensor_get_current_close_ma(void);
|
||||
|
||||
#endif /* ADC_SENSOR_H */
|
||||
@@ -17,56 +17,56 @@
|
||||
*/
|
||||
enum {
|
||||
/**
|
||||
* @brief Kombiniertes Status-Register für das Ventil.
|
||||
* High-Byte: Bewegung (0=Idle, 1=Öffnet, 2=Schliesst, 3=Fehler).
|
||||
* Low-Byte: Zustand (0=Geschlossen, 1=Geöffnet).
|
||||
* @brief Combined status register for the valve.
|
||||
* High-Byte: Movement (0=Idle, 1=Opening, 2=Closing, 3=Error).
|
||||
* Low-Byte: State (0=Closed, 1=Open).
|
||||
*/
|
||||
REG_INPUT_VALVE_STATE_MOVEMENT = 0x0000,
|
||||
/**
|
||||
* @brief Motorstrom beim Öffnen in Milliampere (mA) - IN0 current sense.
|
||||
* @brief Motor current during opening in milliamperes (mA).
|
||||
*/
|
||||
REG_INPUT_MOTOR_OPEN_CURRENT_MA = 0x0001,
|
||||
/**
|
||||
* @brief Motorstrom beim Schließen in Milliampere (mA) - IN1 current sense.
|
||||
* @brief Motor current during closing in milliamperes (mA).
|
||||
*/
|
||||
REG_INPUT_MOTOR_CLOSE_CURRENT_MA = 0x0002,
|
||||
/**
|
||||
* @brief Bitmaske der digitalen Eingänge. Bit 0: Eingang 1, Bit 1: Eingang 2.
|
||||
* 1=Aktiv.
|
||||
* @brief Bitmask of digital inputs. Bit 0: Input 1, Bit 1: Input 2.
|
||||
* 1=Active.
|
||||
*/
|
||||
REG_INPUT_DIGITAL_INPUTS_STATE = 0x0020,
|
||||
/**
|
||||
* @brief Event-Flags für Taster (Clear-on-Read). Bit 0: Taster 1 gedrückt.
|
||||
* Bit 1: Taster 2 gedrückt.
|
||||
* @brief Event flags for buttons (Clear-on-Read). Bit 0: Button 1 pressed.
|
||||
* Bit 1: Button 2 pressed.
|
||||
*/
|
||||
REG_INPUT_BUTTON_EVENTS = 0x0021,
|
||||
/**
|
||||
* @brief Firmware-Version, z.B. 0x0102 für v1.2.
|
||||
* @brief Firmware version, e.g., 0x0102 for v1.2.
|
||||
*/
|
||||
REG_INPUT_FIRMWARE_VERSION_MAJOR_MINOR = 0x00F0,
|
||||
/**
|
||||
* @brief Firmware-Version Patch-Level, z.B. 3 für v1.2.3.
|
||||
* @brief Firmware version patch level, e.g., 3 for v1.2.3.
|
||||
*/
|
||||
REG_INPUT_FIRMWARE_VERSION_PATCH = 0x00F1,
|
||||
/**
|
||||
* @brief Gerätestatus (0=OK, 1=Allgemeiner Fehler).
|
||||
* @brief Device status (0=OK, 1=General Error).
|
||||
*/
|
||||
REG_INPUT_DEVICE_STATUS = 0x00F2,
|
||||
/**
|
||||
* @brief Untere 16 Bit der Uptime in Sekunden.
|
||||
* @brief Lower 16 bits of uptime in seconds.
|
||||
*/
|
||||
REG_INPUT_UPTIME_SECONDS_LOW = 0x00F3,
|
||||
/**
|
||||
* @brief Obere 16 Bit der Uptime in Sekunden.
|
||||
* @brief Upper 16 bits of uptime in seconds.
|
||||
*/
|
||||
REG_INPUT_UPTIME_SECONDS_HIGH = 0x00F4,
|
||||
/**
|
||||
* @brief Aktuelle Versorgungsspannung in Millivolt (mV).
|
||||
* @brief Current supply voltage in millivolts (mV).
|
||||
*/
|
||||
REG_INPUT_SUPPLY_VOLTAGE_MV = 0x00F5,
|
||||
/**
|
||||
* @brief CRC16 des zuletzt im Puffer empfangenen Daten-Chunks für das
|
||||
* Firmware-Update.
|
||||
* @brief CRC16 of the last received data chunk in the buffer for firmware
|
||||
* update.
|
||||
*/
|
||||
REG_INPUT_FWU_LAST_CHUNK_CRC = 0x0100
|
||||
};
|
||||
@@ -77,52 +77,52 @@ enum {
|
||||
*/
|
||||
enum {
|
||||
/**
|
||||
* @brief Ventilsteuerungsbefehl (1=Öffnen, 2=Schliessen, 0=Bewegung stoppen).
|
||||
* @brief Valve control command (1=Open, 2=Close, 0=Stop movement).
|
||||
*/
|
||||
REG_HOLDING_VALVE_COMMAND = 0x0000,
|
||||
/**
|
||||
* @brief Sicherheits-Timeout in Sekunden für den Öffnen-Vorgang.
|
||||
* @brief Safety timeout in seconds for the opening process.
|
||||
*/
|
||||
REG_HOLDING_MAX_OPENING_TIME_S = 0x0001,
|
||||
/**
|
||||
* @brief Sicherheits-Timeout in Sekunden für den Schliessen-Vorgang.
|
||||
* @brief Safety timeout in seconds for the closing process.
|
||||
*/
|
||||
REG_HOLDING_MAX_CLOSING_TIME_S = 0x0002,
|
||||
/**
|
||||
* @brief Bitmaske zum Lesen und Schreiben der digitalen Ausgänge. Bit 0:
|
||||
* Ausgang 1, Bit 1: Ausgang 2. 1=AN, 0=AUS.
|
||||
* @brief Bitmask for reading and writing digital outputs. Bit 0: Output 1,
|
||||
* Bit 1: Output 2. 1=ON, 0=OFF.
|
||||
*/
|
||||
REG_HOLDING_DIGITAL_OUTPUTS_STATE = 0x0010,
|
||||
/**
|
||||
* @brief Timeout des Fail-Safe-Watchdogs in Sekunden. 0=Deaktiviert.
|
||||
* @brief Fail-safe watchdog timeout in seconds. 0=Disabled.
|
||||
*/
|
||||
REG_HOLDING_WATCHDOG_TIMEOUT_S = 0x00F0,
|
||||
/**
|
||||
* @brief Schreiben von 1 startet das Gerät neu.
|
||||
* @brief Writing 1 restarts the device.
|
||||
*/
|
||||
REG_HOLDING_DEVICE_RESET = 0x00F1,
|
||||
/**
|
||||
* @brief Befehl für das Firmware-Update.
|
||||
* 1: Verify Chunk - Slave schreibt den letzten Chunk ins Flash.
|
||||
* 2: Finalize Update - Installation abschliessen und neu starten.
|
||||
* @brief Command for firmware update.
|
||||
* 1: Verify Chunk - Slave writes the last chunk to flash.
|
||||
* 2: Finalize Update - Complete installation and restart.
|
||||
*/
|
||||
REG_HOLDING_FWU_COMMAND = 0x0100,
|
||||
/**
|
||||
* @brief Untere 16 Bit des 32-Bit-Offsets für den nächsten
|
||||
* Firmware-Update-Chunk.
|
||||
* @brief Lower 16 bits of the 32-bit offset for the next firmware update
|
||||
* chunk.
|
||||
*/
|
||||
REG_HOLDING_FWU_CHUNK_OFFSET_LOW = 0x0101,
|
||||
/**
|
||||
* @brief Obere 16 Bit des 32-Bit-Offsets für den nächsten
|
||||
* Firmware-Update-Chunk.
|
||||
* @brief Upper 16 bits of the 32-bit offset for the next firmware update
|
||||
* chunk.
|
||||
*/
|
||||
REG_HOLDING_FWU_CHUNK_OFFSET_HIGH = 0x0102,
|
||||
/**
|
||||
* @brief Grösse des nächsten Firmware-Update-Chunks in Bytes (max. 256).
|
||||
* @brief Size of the next firmware update chunk in bytes (max. 256).
|
||||
*/
|
||||
REG_HOLDING_FWU_CHUNK_SIZE = 0x0103,
|
||||
/**
|
||||
* @brief Startadresse des 256-Byte-Puffers für Firmware-Update-Daten.
|
||||
* @brief Start address of the 256-byte buffer for firmware update data.
|
||||
*/
|
||||
REG_HOLDING_FWU_DATA_BUFFER = 0x0180,
|
||||
};
|
||||
|
||||
@@ -13,19 +13,9 @@
|
||||
* configuring the maximum opening and closing times.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Defines the GPIO pins used for the valve controller.
|
||||
*/
|
||||
struct valve_gpios {
|
||||
const struct gpio_dt_spec
|
||||
in0; /**< Control input 0 for the VND7050AJ driver. */
|
||||
const struct gpio_dt_spec
|
||||
in1; /**< Control input 1 for the VND7050AJ driver. */
|
||||
const struct gpio_dt_spec rst; /**< Reset pin for the VND7050AJ driver. */
|
||||
const struct gpio_dt_spec sen; /**< Sense (current measurement) pin. */
|
||||
const struct gpio_dt_spec s0; /**< S0 select pin. */
|
||||
const struct gpio_dt_spec s1; /**< S1 select pin. */
|
||||
};
|
||||
#define VALVE_CHANNEL_OPEN 0
|
||||
#define VALVE_CHANNEL_CLOSE 1
|
||||
#define VALVE_ENDPOSITION_CHECK_INTERVAL K_MSEC(100)
|
||||
|
||||
/**
|
||||
* @brief Represents the static state of the valve (open or closed).
|
||||
@@ -49,8 +39,11 @@ enum valve_movement {
|
||||
* @brief Initializes the valve control system.
|
||||
*
|
||||
* Configures the GPIOs and loads saved settings for timeouts.
|
||||
* This function must be called before any other valve functions.
|
||||
*
|
||||
* @return 0 on success, or a negative error code on failure.
|
||||
*/
|
||||
void valve_init(void);
|
||||
int valve_init(void);
|
||||
|
||||
/**
|
||||
* @brief Starts opening the valve.
|
||||
@@ -120,4 +113,31 @@ uint16_t valve_get_max_open_time(void);
|
||||
*/
|
||||
uint16_t valve_get_max_close_time(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current drawn by the valve motor during opening.
|
||||
*
|
||||
* @return The motor current in milliamps.
|
||||
*/
|
||||
int32_t valve_get_opening_current(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current drawn by the valve motor during closing.
|
||||
*
|
||||
* @return The motor current in milliamps.
|
||||
*/
|
||||
int32_t valve_get_closing_current(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the temperature of the valve motor driver.
|
||||
*
|
||||
* @return The temperature in degrees Celsius.
|
||||
*/
|
||||
int32_t valve_get_vnd_temp(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the voltage supplied to the valve motor driver.
|
||||
*
|
||||
* @return The voltage in millivolts.
|
||||
*/
|
||||
int32_t valve_get_vnd_voltage(void);
|
||||
#endif // VALVE_H
|
||||
|
||||
Reference in New Issue
Block a user