Documentation updated
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file config.h
|
||||
* @brief Main configuration file for the Equipment emulator.
|
||||
* @brief Main configuration file for the CRAH Unit (TCP) emulator.
|
||||
* @author Emmanuel Hernandez Cruz
|
||||
* @date 2025-09-02
|
||||
*
|
||||
@@ -8,12 +8,6 @@
|
||||
* and the Modbus register map for the device.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup WiFiConfig WiFi Configuration
|
||||
* @brief Network parameters for WiFi connection.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
@@ -21,6 +15,11 @@
|
||||
#include "Equipment/Equipment.h"
|
||||
|
||||
#if defined(USE_MODBUS_IP)
|
||||
/**
|
||||
* @defgroup ModbusTCPConfig Modbus IP Configuration
|
||||
* @brief Parameters for Modbus TCP communication.
|
||||
* @{
|
||||
*/
|
||||
#include <ModbusIP_ESP8266.h>
|
||||
const char *ssid = "esrlok_portable"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "m7g6eNMe?cy8S@z"; /**< @brief The password for the WiFi network. */
|
||||
@@ -30,15 +29,30 @@
|
||||
|
||||
ModbusIP mb;
|
||||
#else
|
||||
/**
|
||||
* @defgroup ModbusRTUConfig Modbus RTU Configuration
|
||||
* @brief Parameters for serial Modbus RTU communication.
|
||||
* @{
|
||||
*/
|
||||
#include <ModbusRTU.h>
|
||||
const int BAUDRATE = 19200; /**< @brief The serial communication speed in bits per second. */
|
||||
const int RX_PIN = 17; /**< @brief The GPIO pin used for receiving data (RX). */
|
||||
const int TX_PIN = 16; /**< @brief The GPIO pin used for transmitting data (TX). */
|
||||
const int RST_PIN = 4; /**< @brief The GPIO pin connected to the RS485 driver's DE/RE pins for direction control. */
|
||||
const int MODBUS_ID = 1; /**< @brief The unique slave ID for this device on the Modbus bus. */
|
||||
/** @} */
|
||||
|
||||
/** @brief Global instance of the Modbus RTU server. */
|
||||
ModbusRTU mb;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief The main loop update interval in milliseconds.
|
||||
*/
|
||||
int interval = 250;
|
||||
|
||||
/**
|
||||
* @defgroup ModbusMapConfig Modbus Map Configuration
|
||||
* @brief Defines the Modbus register map and related parameters for the emulator.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief The Modbus map for the Equipment device.
|
||||
* This array defines all the Modbus points available on the emulated device.
|
||||
@@ -124,11 +138,15 @@ modbusMap mb_map[] =
|
||||
{COIL, 264, 0, "Alarm Reset"}
|
||||
};
|
||||
//Size of modbus map used in FOR cycles, automatically calculated.
|
||||
|
||||
/**
|
||||
* @brief The total number of entries in the `mb_map` array.
|
||||
* This is calculated at compile time and used for iterating over the map.
|
||||
*/
|
||||
const int map_size = sizeof(mb_map) / sizeof(mb_map[0]);
|
||||
/** @} */
|
||||
|
||||
/** @brief The main loop update interval in milliseconds. */
|
||||
int interval = 250;
|
||||
/** @} */ // End of ModbusMapConfig group
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
Reference in New Issue
Block a user