kopia lustrzana https://github.com/SP8EBC/ParaTNC
daily1
rodzic
0116e6111e
commit
7d5a106046
|
@ -10,11 +10,11 @@
|
|||
|
||||
#include "config_data.h"
|
||||
|
||||
extern const config_data_basic_t config_data_basic;
|
||||
extern const config_data_mode_t config_data_mode;
|
||||
extern const config_data_umb_t config_data_umb;
|
||||
extern const config_data_rtu_t config_data_rtu;
|
||||
extern const config_data_wx_sources_t config_data_wx_sources;
|
||||
extern const config_data_basic_t config_data_basic_first;
|
||||
extern const config_data_mode_t config_data_mode_first;
|
||||
extern const config_data_umb_t config_data_umb_first;
|
||||
extern const config_data_rtu_t config_data_rtu_first;
|
||||
extern const config_data_wx_sources_t config_data_wx_sources_first;
|
||||
|
||||
|
||||
#endif /* CONFIG_DATA_EXTERNS_H_ */
|
||||
|
|
|
@ -26,17 +26,17 @@ extern uint16_t rte_rtu_number_of_successfull_serial_comm;
|
|||
|
||||
//#ifdef _MODBUS_RTU
|
||||
|
||||
extern rtu_register_data_t RTU_GETTERS_F1_NAME;
|
||||
extern rtu_register_data_t rte_wx_modbus_rtu_f1;
|
||||
|
||||
extern rtu_register_data_t RTU_GETTERS_F2_NAME;
|
||||
extern rtu_register_data_t rte_wx_modbus_rtu_f2;
|
||||
|
||||
extern rtu_register_data_t RTU_GETTERS_F3_NAME;
|
||||
extern rtu_register_data_t rte_wx_modbus_rtu_f3;
|
||||
|
||||
extern rtu_register_data_t RTU_GETTERS_F4_NAME;
|
||||
extern rtu_register_data_t rte_wx_modbus_rtu_f4;
|
||||
|
||||
extern rtu_register_data_t RTU_GETTERS_F5_NAME;
|
||||
extern rtu_register_data_t rte_wx_modbus_rtu_f5;
|
||||
|
||||
extern rtu_register_data_t RTU_GETTERS_F6_NAME;
|
||||
extern rtu_register_data_t rte_wx_modbus_rtu_f6;
|
||||
|
||||
extern rtu_exception_t rte_rtu_last_modbus_exception;
|
||||
extern uint32_t rte_rtu_last_modbus_rx_error_timestamp;
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef enum wx_pwr_state_t {
|
|||
WX_PWR_DISABLED
|
||||
}wx_pwr_state_t;
|
||||
|
||||
void wx_get_all_measurements(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb);
|
||||
void wx_get_all_measurements(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb, const config_data_rtu_t * const config_rtu);
|
||||
int32_t wx_get_bme280_temperature_pressure_humidity(float * const temperature, float * const pressure, int8_t * const humidity);
|
||||
|
||||
void wx_pool_anemometer(void);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "config_data.h"
|
||||
|
||||
int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb);
|
||||
int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb, const config_data_rtu_t * const config_rtu);
|
||||
int32_t wx_get_humidity_bme280(int8_t * const humidity);
|
||||
|
||||
#endif /* WX_HANDLER_HUMIDITY_H_ */
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "config_data.h"
|
||||
|
||||
int32_t wx_get_pressure_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb);
|
||||
int32_t wx_get_pressure_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb, const config_data_rtu_t * const config_rtu);
|
||||
int32_t wx_get_pressure_ms5611(float * const pressure);
|
||||
int32_t wx_get_pressure_bme280(float * const pressure);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "config_data.h"
|
||||
|
||||
int32_t wx_get_temperature_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb);
|
||||
int32_t wx_get_temperature_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb, const config_data_rtu_t * const config_rtu);
|
||||
int32_t wx_get_temperature_dallas(void);
|
||||
int32_t wx_get_temperature_ms5611(float * const temperature);
|
||||
int32_t wx_get_temperature_bme280(float * const temperature);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
const config_data_mode_t config_data_mode = {
|
||||
const config_data_mode_t config_data_mode_first = {
|
||||
#ifdef _DIGI
|
||||
.digi = 1,
|
||||
#else
|
||||
|
@ -109,7 +109,7 @@ const config_data_mode_t config_data_mode = {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
const config_data_basic_t config_data_basic = {
|
||||
const config_data_basic_t config_data_basic_first = {
|
||||
.callsign = _CALL,
|
||||
.ssid = _SSID,
|
||||
.latitude = _LAT,
|
||||
|
@ -168,7 +168,7 @@ const config_data_basic_t config_data_basic = {
|
|||
* Data sources for different parameters
|
||||
*
|
||||
*/
|
||||
const config_data_wx_sources_t config_data_wx_sources = {
|
||||
const config_data_wx_sources_t config_data_wx_sources_first = {
|
||||
#ifdef _TEMPERATURE_INTERNAL
|
||||
.temperature = WX_SOURCE_INTERNAL,
|
||||
#endif
|
||||
|
@ -233,7 +233,7 @@ const config_data_wx_sources_t config_data_wx_sources = {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
const config_data_umb_t config_data_umb = {
|
||||
const config_data_umb_t config_data_umb_first = {
|
||||
#ifdef _UMB_SLAVE_ID
|
||||
.slave_id = _UMB_SLAVE_ID,
|
||||
#else
|
||||
|
@ -265,7 +265,7 @@ const config_data_umb_t config_data_umb = {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
const config_data_rtu_t config_data_rtu = {
|
||||
const config_data_rtu_t config_data_rtu_first = {
|
||||
.slave_speed = _RTU_SLAVE_SPEED,
|
||||
|
||||
.slave_parity = _RTU_SLAVE_PARITY,
|
||||
|
|
63
src/main.c
63
src/main.c
|
@ -93,6 +93,13 @@
|
|||
#pragma GCC diagnostic ignored "-Wreturn-type"
|
||||
#pragma GCC diagnostic ignored "-Wempty-body"
|
||||
|
||||
// used configuration structures
|
||||
const config_data_mode_t * main_config_data_mode = 0;
|
||||
const config_data_basic_t * main_config_data_basic = 0;
|
||||
const config_data_wx_sources_t * main_config_data_wx_sources = 0;
|
||||
const config_data_umb_t * main_config_data_umb = 0;
|
||||
const config_data_rtu_t * main_config_data_rtu = 0;
|
||||
|
||||
// global variable incremented by the SysTick handler to measure time in miliseconds
|
||||
uint32_t master_time = 0;
|
||||
|
||||
|
@ -298,7 +305,7 @@ int main(int argc, char* argv[]){
|
|||
#endif
|
||||
|
||||
// if Victron VE-direct protocol is enabled set the baudrate to the 19200u
|
||||
if (config_data_mode.victron == 1) {
|
||||
if (main_config_data_mode->victron == 1) {
|
||||
main_target_kiss_baudrate = 19200u;
|
||||
|
||||
// and disable the kiss TNC option as it shares the same port
|
||||
|
@ -358,15 +365,15 @@ int main(int argc, char* argv[]){
|
|||
}
|
||||
#endif
|
||||
//#elif (defined(PARATNC_HWREV_B) || defined(PARATNC_HWREV_C)) && defined(_MODBUS_RTU)
|
||||
if (config_data_mode.wx_modbus == 1) {
|
||||
if (main_config_data_mode->wx_modbus == 1) {
|
||||
|
||||
rtu_serial_init(&rte_rtu_pool_queue, 1, main_wx_srl_ctx_ptr, &config_data_rtu);
|
||||
rtu_serial_init(&rte_rtu_pool_queue, 1, main_wx_srl_ctx_ptr, main_config_data_rtu);
|
||||
|
||||
main_target_wx_baudrate = config_data_rtu.slave_speed;
|
||||
main_target_wx_baudrate = main_config_data_rtu->slave_speed;
|
||||
|
||||
// initialize serial ports according to RS485 network configuration for Modbus-RTU
|
||||
srl_init(main_kiss_srl_ctx_ptr, USART1, srl_usart1_rx_buffer, RX_BUFFER_1_LN, srl_usart1_tx_buffer, TX_BUFFER_1_LN, main_target_kiss_baudrate, 1);
|
||||
srl_init(main_wx_srl_ctx_ptr, USART2, srl_usart2_rx_buffer, RX_BUFFER_2_LN, srl_usart2_tx_buffer, TX_BUFFER_2_LN, main_target_wx_baudrate, config_data_rtu.slave_stop_bits);
|
||||
srl_init(main_wx_srl_ctx_ptr, USART2, srl_usart2_rx_buffer, RX_BUFFER_2_LN, srl_usart2_tx_buffer, TX_BUFFER_2_LN, main_target_wx_baudrate, main_config_data_rtu->slave_stop_bits);
|
||||
srl_switch_tx_delay(main_wx_srl_ctx_ptr, 1);
|
||||
|
||||
// enabling rtu master code
|
||||
|
@ -397,7 +404,7 @@ int main(int argc, char* argv[]){
|
|||
memset (main_own_path, 0x00, sizeof(main_own_path));
|
||||
|
||||
// configuring an APRS path used to transmit own packets (telemetry, wx, beacons)
|
||||
main_own_path_ln = ConfigPath(main_own_path, &config_data_basic);
|
||||
main_own_path_ln = ConfigPath(main_own_path, main_config_data_basic);
|
||||
|
||||
#ifdef INTERNAL_WATCHDOG
|
||||
// enable write access to watchdog registers
|
||||
|
@ -439,7 +446,7 @@ int main(int argc, char* argv[]){
|
|||
Configure_GPIO(GPIOA,12,GPPP_OUTPUT_50MHZ);
|
||||
|
||||
// initializing the digipeater configuration
|
||||
digi_init(&config_data_mode);
|
||||
digi_init(main_config_data_mode);
|
||||
|
||||
#ifdef _METEO
|
||||
|
||||
|
@ -548,11 +555,11 @@ int main(int argc, char* argv[]){
|
|||
|
||||
#ifdef _METEO
|
||||
// getting all meteo measuremenets to be sure that WX frames want be sent with zeros
|
||||
wx_get_all_measurements(&config_data_wx_sources, &config_data_mode, &config_data_umb);
|
||||
wx_get_all_measurements(main_config_data_wx_sources, main_config_data_mode, main_config_data_umb, main_config_data_rtu);
|
||||
#endif
|
||||
|
||||
// start serial port i/o transaction depending on station configuration
|
||||
if (config_data_mode.victron == 1) {
|
||||
if (main_config_data_mode->victron == 1) {
|
||||
// initializing protocol parser
|
||||
ve_direct_parser_init(&rte_pv_struct, &rte_pv_average);
|
||||
|
||||
|
@ -580,8 +587,8 @@ int main(int argc, char* argv[]){
|
|||
#endif
|
||||
|
||||
// initialize UMB transaction
|
||||
if (config_data_mode.wx_umb == 1) {
|
||||
umb_0x26_status_request(&rte_wx_umb, &rte_wx_umb_context, &config_data_umb);
|
||||
if (main_config_data_mode->wx_umb == 1) {
|
||||
umb_0x26_status_request(&rte_wx_umb, &rte_wx_umb_context, main_config_data_umb);
|
||||
}
|
||||
|
||||
#ifdef INTERNAL_WATCHDOG
|
||||
|
@ -602,8 +609,12 @@ int main(int argc, char* argv[]){
|
|||
// incrementing current cpu ticks
|
||||
main_current_cpu_idle_ticks++;
|
||||
|
||||
if (rte_main_reboot_req == 1)
|
||||
if (rte_main_reboot_req == 1) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
else {
|
||||
;
|
||||
}
|
||||
|
||||
if (GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0)) {
|
||||
|
||||
|
@ -650,7 +661,7 @@ int main(int argc, char* argv[]){
|
|||
//digi_check_with_viscous(&ax25_rxed_frame);
|
||||
|
||||
// check if this packet needs to be repeated (digipeated) and do it if it is necessary
|
||||
digi_process(&ax25_rxed_frame, &config_data_basic, &config_data_mode);
|
||||
digi_process(&ax25_rxed_frame, main_config_data_basic, main_config_data_mode);
|
||||
#endif
|
||||
#endif
|
||||
ax25_new_msg_rx_flag = 0;
|
||||
|
@ -658,7 +669,7 @@ int main(int argc, char* argv[]){
|
|||
}
|
||||
|
||||
// if Victron VE.direct client is enabled
|
||||
if (config_data_mode.victron == 1) {
|
||||
if (main_config_data_mode->victron == 1) {
|
||||
|
||||
// if new KISS message has been received from the host
|
||||
if (main_kiss_srl_ctx_ptr->srl_rx_state == SRL_RX_DONE || main_kiss_srl_ctx_ptr->srl_rx_state == SRL_RX_ERROR) {
|
||||
|
@ -694,19 +705,19 @@ int main(int argc, char* argv[]){
|
|||
srl_receive_data(main_kiss_srl_ctx_ptr, VE_DIRECT_MAX_FRAME_LN, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
else if (config_data_mode.wx_umb == 1) {
|
||||
else if (main_config_data_mode->wx_umb == 1) {
|
||||
// if some UMB data have been received
|
||||
if (main_wx_srl_ctx_ptr->srl_rx_state == SRL_RX_DONE) {
|
||||
umb_pooling_handler(&rte_wx_umb_context, REASON_RECEIVE_IDLE, master_time, &config_data_umb);
|
||||
umb_pooling_handler(&rte_wx_umb_context, REASON_RECEIVE_IDLE, master_time, main_config_data_umb);
|
||||
}
|
||||
|
||||
// if there were an error during receiving frame from host, restart rxing once again
|
||||
if (main_wx_srl_ctx_ptr->srl_rx_state == SRL_RX_ERROR) {
|
||||
umb_pooling_handler(&rte_wx_umb_context, REASON_RECEIVE_ERROR, master_time, &config_data_umb);
|
||||
umb_pooling_handler(&rte_wx_umb_context, REASON_RECEIVE_ERROR, master_time, main_config_data_umb);
|
||||
}
|
||||
|
||||
if (main_wx_srl_ctx_ptr->srl_tx_state == SRL_TX_IDLE) {
|
||||
umb_pooling_handler(&rte_wx_umb_context, REASON_TRANSMIT_IDLE, master_time, &config_data_umb);
|
||||
umb_pooling_handler(&rte_wx_umb_context, REASON_TRANSMIT_IDLE, master_time, main_config_data_umb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -749,13 +760,13 @@ int main(int argc, char* argv[]){
|
|||
rtu_serial_start();
|
||||
}
|
||||
|
||||
if (config_data_mode.wx == 1) {
|
||||
wx_get_all_measurements(&config_data_wx_sources, &config_data_mode, &config_data_umb);
|
||||
if (main_config_data_mode->wx == 1) {
|
||||
wx_get_all_measurements(main_config_data_wx_sources, main_config_data_mode, main_config_data_umb, main_config_data_rtu);
|
||||
}
|
||||
|
||||
|
||||
if (config_data_mode.wx_umb == 1) {
|
||||
umb_0x26_status_request(&rte_wx_umb, &rte_wx_umb_context, &config_data_umb);
|
||||
if (main_config_data_mode->wx_umb == 1) {
|
||||
umb_0x26_status_request(&rte_wx_umb, &rte_wx_umb_context, main_config_data_umb);
|
||||
}
|
||||
|
||||
if (main_davis_serial_enabled == 1) {
|
||||
|
@ -781,7 +792,7 @@ int main(int argc, char* argv[]){
|
|||
if (main_one_minute_pool_timer < 10) {
|
||||
|
||||
#ifndef _MUTE_OWN
|
||||
packet_tx_handler(&config_data_basic, &config_data_mode);
|
||||
packet_tx_handler(main_config_data_basic, main_config_data_mode);
|
||||
#endif
|
||||
|
||||
main_one_minute_pool_timer = 60000;
|
||||
|
@ -820,13 +831,13 @@ int main(int argc, char* argv[]){
|
|||
if (main_ten_second_pool_timer < 10) {
|
||||
|
||||
//#if defined(_UMB_MASTER)
|
||||
if (config_data_mode.wx_umb == 1) {
|
||||
umb_channel_pool(&rte_wx_umb, &rte_wx_umb_context, &config_data_umb);
|
||||
if (main_config_data_mode->wx_umb == 1) {
|
||||
umb_channel_pool(&rte_wx_umb, &rte_wx_umb_context, main_config_data_umb);
|
||||
}
|
||||
//#endif
|
||||
|
||||
//#if defined(_UMB_MASTER)
|
||||
if (config_data_mode.wx_umb == 1) {
|
||||
if (main_config_data_mode->wx_umb == 1) {
|
||||
rte_wx_umb_qf = umb_get_current_qf(&rte_wx_umb_context, master_time);
|
||||
}
|
||||
//#endif
|
||||
|
|
|
@ -14,17 +14,17 @@ uint8_t rte_rtu_number_of_serial_io_errors = 0;
|
|||
|
||||
uint16_t rte_rtu_number_of_successfull_serial_comm = 0;
|
||||
|
||||
rtu_register_data_t RTU_GETTERS_F1_NAME;
|
||||
rtu_register_data_t rte_wx_modbus_rtu_f1;
|
||||
|
||||
rtu_register_data_t RTU_GETTERS_F2_NAME;
|
||||
rtu_register_data_t rte_wx_modbus_rtu_f2;
|
||||
|
||||
rtu_register_data_t RTU_GETTERS_F3_NAME;
|
||||
rtu_register_data_t rte_wx_modbus_rtu_f3;
|
||||
|
||||
rtu_register_data_t RTU_GETTERS_F4_NAME;
|
||||
rtu_register_data_t rte_wx_modbus_rtu_f4;
|
||||
|
||||
rtu_register_data_t RTU_GETTERS_F5_NAME;
|
||||
rtu_register_data_t rte_wx_modbus_rtu_f5;
|
||||
|
||||
rtu_register_data_t RTU_GETTERS_F6_NAME;
|
||||
rtu_register_data_t rte_wx_modbus_rtu_f6;
|
||||
|
||||
rtu_exception_t rte_rtu_last_modbus_exception;
|
||||
uint32_t rte_rtu_last_modbus_exception_timestamp;
|
||||
|
|
|
@ -51,19 +51,14 @@ static const config_data_wx_sources_t internal = {
|
|||
#define MODBUS_QF_PRESSURE_DEGR (1 << 6)
|
||||
|
||||
|
||||
void wx_get_all_measurements(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb) {
|
||||
void wx_get_all_measurements(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb, const config_data_rtu_t * const config_rtu) {
|
||||
|
||||
int32_t return_value = 0;
|
||||
int32_t parameter_result = 0; // stores which parameters have been retrieved successfully. this is used for failsafe handling
|
||||
int32_t backup_parameter_result = 0; // uses during retrieving backup
|
||||
|
||||
int32_t temperature_result = 0;
|
||||
int32_t pressure_result = 0;
|
||||
int32_t humidity_result = 0;
|
||||
|
||||
parameter_result |= wx_get_temperature_measurement(config_sources, config_mode, config_umb);
|
||||
parameter_result |= wx_get_pressure_measurement(config_sources, config_mode, config_umb);
|
||||
parameter_result |= wx_get_humidity_measurement(config_sources, config_mode, config_umb);
|
||||
parameter_result |= wx_get_temperature_measurement(config_sources, config_mode, config_umb, config_rtu);
|
||||
parameter_result |= wx_get_pressure_measurement(config_sources, config_mode, config_umb, config_rtu);
|
||||
parameter_result |= wx_get_humidity_measurement(config_sources, config_mode, config_umb, config_rtu);
|
||||
|
||||
// check if all parameters (except wind) were collected successfully
|
||||
if (parameter_result == (WX_HANDLER_PARAMETER_RESULT_TEMPERATURE | WX_HANDLER_PARAMETER_RESULT_PRESSURE | WX_HANDLER_PARAMETER_RESULT_HUMIDITY | WX_HANDLER_PARAMETER_RESULT_TEMP_INTERNAL)) {
|
||||
|
@ -76,7 +71,7 @@ void wx_get_all_measurements(const config_data_wx_sources_t * const config_sourc
|
|||
// check what is the primary source of temperature
|
||||
if (config_sources->temperature != WX_SOURCE_INTERNAL) {
|
||||
// if this is something different than an internal source use the internal sensor
|
||||
backup_parameter_result |= wx_get_temperature_measurement(&internal, config_mode, config_umb);
|
||||
backup_parameter_result |= wx_get_temperature_measurement(&internal, config_mode, config_umb, config_rtu);
|
||||
}
|
||||
else {
|
||||
; //
|
||||
|
@ -86,14 +81,14 @@ void wx_get_all_measurements(const config_data_wx_sources_t * const config_sourc
|
|||
if ((parameter_result & WX_HANDLER_PARAMETER_RESULT_PRESSURE) == 0) {
|
||||
|
||||
if (config_sources->pressure != WX_SOURCE_INTERNAL) {
|
||||
backup_parameter_result |= wx_get_pressure_measurement(&internal, config_mode, config_umb);
|
||||
backup_parameter_result |= wx_get_pressure_measurement(&internal, config_mode, config_umb, config_rtu);
|
||||
}
|
||||
}
|
||||
|
||||
if ((parameter_result & WX_HANDLER_PARAMETER_RESULT_HUMIDITY) == 0) {
|
||||
|
||||
if (config_sources->pressure != WX_SOURCE_INTERNAL) {
|
||||
backup_parameter_result |= wx_get_humidity_measurement(&internal, config_mode, config_umb);
|
||||
backup_parameter_result |= wx_get_humidity_measurement(&internal, config_mode, config_umb, config_rtu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <modbus_rtu/rtu_getters.h>
|
||||
#include <modbus_rtu/rtu_return_values.h>
|
||||
|
||||
int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb) {
|
||||
int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb, const config_data_rtu_t * const config_rtu) {
|
||||
|
||||
int32_t out = 0;
|
||||
int32_t measurement_result = 0;
|
||||
|
@ -48,7 +48,7 @@ int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const confi
|
|||
case WX_SOURCE_FULL_RTU: {
|
||||
|
||||
// get the value read from RTU registers
|
||||
measurement_result = rtu_get_humidity(&rte_wx_humidity);
|
||||
measurement_result = rtu_get_humidity(&rte_wx_humidity, config_rtu);
|
||||
|
||||
// check
|
||||
if (measurement_result == MODBUS_RET_OK || measurement_result == MODBUS_RET_DEGRADED) {
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
#include <drivers/ms5611.h>
|
||||
#include <drivers/bme280.h>
|
||||
|
||||
int32_t wx_get_pressure_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb) {
|
||||
#include <modbus_rtu/rtu_getters.h>
|
||||
#include <modbus_rtu/rtu_return_values.h>
|
||||
|
||||
int32_t wx_get_pressure_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb, const config_data_rtu_t * const config_rtu) {
|
||||
|
||||
int32_t output = 0;
|
||||
int32_t measurement_retval = 0;
|
||||
|
@ -91,6 +94,21 @@ int32_t wx_get_pressure_measurement(const config_data_wx_sources_t * const confi
|
|||
}
|
||||
case WX_SOURCE_RTU:
|
||||
case WX_SOURCE_FULL_RTU: {
|
||||
|
||||
// get the value read from RTU registers
|
||||
measurement_retval = rtu_get_humidity(&rte_wx_humidity, config_rtu);
|
||||
|
||||
// check
|
||||
if (measurement_retval == MODBUS_RET_OK || measurement_retval == MODBUS_RET_DEGRADED) {
|
||||
|
||||
// set the flag that external temperature is available
|
||||
output |= WX_HANDLER_PARAMETER_RESULT_HUMIDITY;
|
||||
|
||||
if (measurement_retval == BME280_OK) {
|
||||
rte_wx_humidity_valid = rte_wx_humidity;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case WX_SOURCE_DAVIS_SERIAL:
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
uint8_t wx_inhibit_slew_rate_check = 1;
|
||||
|
||||
int32_t wx_get_temperature_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb) {
|
||||
int32_t wx_get_temperature_measurement(const config_data_wx_sources_t * const config_sources, const config_data_mode_t * const config_mode, const config_data_umb_t * const config_umb, const config_data_rtu_t * const config_rtu) {
|
||||
|
||||
|
||||
int32_t measurement_result = -1; // used for return values from various functions
|
||||
|
@ -97,7 +97,7 @@ int32_t wx_get_temperature_measurement(const config_data_wx_sources_t * const co
|
|||
case WX_SOURCE_FULL_RTU: {
|
||||
|
||||
// get the value read from RTU registers
|
||||
measurement_result = rtu_get_temperature(&rte_wx_temperature_external);
|
||||
measurement_result = rtu_get_temperature(&rte_wx_temperature_external, config_rtu);
|
||||
|
||||
// check
|
||||
if (measurement_result == MODBUS_RET_OK || measurement_result == MODBUS_RET_DEGRADED) {
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
#ifndef INCLUDE_MODBUS_RTU_RTU_CONFIGURATION_H_
|
||||
#define INCLUDE_MODBUS_RTU_RTU_CONFIGURATION_H_
|
||||
|
||||
#include "station_config.h"
|
||||
//#include "station_config.h"
|
||||
|
||||
//#ifdef _MODBUS_RTU
|
||||
|
||||
#define RTU_GETTERS_F1_NAME rte_wx_modbus_rtu_f1
|
||||
#define RTU_GETTERS_F2_NAME rte_wx_modbus_rtu_f2
|
||||
#define RTU_GETTERS_F3_NAME rte_wx_modbus_rtu_f3
|
||||
#define RTU_GETTERS_F4_NAME rte_wx_modbus_rtu_f4
|
||||
#define RTU_GETTERS_F5_NAME rte_wx_modbus_rtu_f5
|
||||
#define RTU_GETTERS_F6_NAME rte_wx_modbus_rtu_f6
|
||||
//#define RTU_GETTERS_F1_NAME rte_wx_modbus_rtu_f1
|
||||
//#define RTU_GETTERS_F2_NAME rte_wx_modbus_rtu_f2
|
||||
//#define RTU_GETTERS_F3_NAME rte_wx_modbus_rtu_f3
|
||||
//#define RTU_GETTERS_F4_NAME rte_wx_modbus_rtu_f4
|
||||
//#define RTU_GETTERS_F5_NAME rte_wx_modbus_rtu_f5
|
||||
//#define RTU_GETTERS_F6_NAME rte_wx_modbus_rtu_f6
|
||||
|
||||
//#endif
|
||||
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
#define INCLUDE_MODBUS_RTU_RTU_GETTERS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "config_data.h"
|
||||
|
||||
int32_t rtu_get_temperature(float* out);
|
||||
int32_t rtu_get_pressure(float* out);
|
||||
int32_t rtu_get_wind_direction(uint16_t* out);
|
||||
int32_t rtu_get_wind_speed(uint16_t* out);
|
||||
int32_t rtu_get_wind_gusts(uint16_t* out);
|
||||
int32_t rtu_get_humidity(int8_t* out);
|
||||
int32_t rtu_get_temperature(float* out, const config_data_rtu_t * const config);
|
||||
int32_t rtu_get_pressure(float* out, const config_data_rtu_t * const config);
|
||||
int32_t rtu_get_wind_direction(uint16_t* out, const config_data_rtu_t * const config);
|
||||
int32_t rtu_get_wind_speed(uint16_t* out, const config_data_rtu_t * const config);
|
||||
int32_t rtu_get_wind_gusts(uint16_t* out, const config_data_rtu_t * const config);
|
||||
int32_t rtu_get_humidity(int8_t* out, const config_data_rtu_t * const config);
|
||||
|
||||
void rtu_get_raw_values_string(char* out, uint16_t out_buffer_ln, uint8_t* generated_string_ln);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "rte_rtu.h"
|
||||
#include "main.h"
|
||||
|
||||
int32_t rtu_get_temperature(float* out) {
|
||||
int32_t rtu_get_temperature(float* out, const config_data_rtu_t * const config) {
|
||||
|
||||
int32_t retval = MODBUS_RET_UNINITIALIZED;
|
||||
|
||||
|
@ -34,56 +34,63 @@ int32_t rtu_get_temperature(float* out) {
|
|||
// the timestamp of last update of the register value
|
||||
uint32_t last_update_timestam = 0;
|
||||
|
||||
#ifdef _MODBUS_RTU
|
||||
#ifdef _RTU_SLAVE_TEMPERATURE_SOURCE
|
||||
#if (_RTU_SLAVE_TEMPERATURE_SOURCE == 1)
|
||||
source = &RTU_GETTERS_F1_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_1;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_1;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_1;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_1;
|
||||
switch (config->temperature_source) {
|
||||
case 1:
|
||||
source = &rte_wx_modbus_rtu_f1;
|
||||
scaling_a = config->slave_1_scaling_a;
|
||||
scaling_b = config->slave_1_scaling_b;
|
||||
scaling_c = config->slave_1_scaling_c;
|
||||
scaling_d = config->slave_1_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[0];
|
||||
#elif (_RTU_SLAVE_TEMPERATURE_SOURCE == 2)
|
||||
source = &RTU_GETTERS_F2_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_2;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_2;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_2;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_2;
|
||||
break;
|
||||
case 2:
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
scaling_a = config->slave_2_scaling_a;
|
||||
scaling_b = config->slave_2_scaling_b;
|
||||
scaling_c = config->slave_2_scaling_c;
|
||||
scaling_d = config->slave_2_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[1];
|
||||
#elif (_RTU_SLAVE_TEMPERATURE_SOURCE == 3)
|
||||
source = &RTU_GETTERS_F3_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_3;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_3;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_3;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_3;
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
break;
|
||||
case 3:
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
scaling_a = config->slave_3_scaling_a;
|
||||
scaling_b = config->slave_3_scaling_b;
|
||||
scaling_c = config->slave_3_scaling_c;
|
||||
scaling_d = config->slave_3_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[2];
|
||||
#elif (_RTU_SLAVE_TEMPERATURE_SOURCE == 4)
|
||||
source = &RTU_GETTERS_F4_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_4;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_4;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_4;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_4;
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
break;
|
||||
case 4:
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
scaling_a = config->slave_4_scaling_a;
|
||||
scaling_b = config->slave_4_scaling_b;
|
||||
scaling_c = config->slave_4_scaling_c;
|
||||
scaling_d = config->slave_4_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[3];
|
||||
#elif (_RTU_SLAVE_TEMPERATURE_SOURCE == 5)
|
||||
source = &RTU_GETTERS_F5_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_5;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_5;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_5;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_5;
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
break;
|
||||
case 5:
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
scaling_a = config->slave_5_scaling_a;
|
||||
scaling_b = config->slave_5_scaling_b;
|
||||
scaling_c = config->slave_5_scaling_c;
|
||||
scaling_d = config->slave_5_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[4];
|
||||
#elif (_RTU_SLAVE_TEMPERATURE_SOURCE == 6)
|
||||
source = &RTU_GETTERS_F6_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_6;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_6;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_6;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_6;
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
break;
|
||||
case 6:
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
scaling_a = config->slave_6_scaling_a;
|
||||
scaling_b = config->slave_6_scaling_b;
|
||||
scaling_c = config->slave_6_scaling_c;
|
||||
scaling_d = config->slave_6_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[5];
|
||||
#else
|
||||
#error "Wrong Modbus Configuration"
|
||||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
#endif
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
break;
|
||||
default:
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
// copy the raw value from modbus register data
|
||||
|
@ -115,12 +122,11 @@ int32_t rtu_get_temperature(float* out) {
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int32_t rtu_get_pressure(float* out) {
|
||||
int32_t rtu_get_pressure(float* out, const config_data_rtu_t * const config) {
|
||||
|
||||
int32_t retval = MODBUS_RET_UNINITIALIZED;
|
||||
|
||||
|
@ -135,56 +141,63 @@ int32_t rtu_get_pressure(float* out) {
|
|||
// the timestamp of last update of the register value
|
||||
uint32_t last_update_timestam = 0;
|
||||
|
||||
#ifdef _MODBUS_RTU
|
||||
#ifdef _RTU_SLAVE_PRESSURE_SOURCE
|
||||
#if (_RTU_SLAVE_PRESSURE_SOURCE == 1)
|
||||
source = &RTU_GETTERS_F1_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_1;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_1;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_1;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_1;
|
||||
switch (config->pressure_source) {
|
||||
case 1:
|
||||
source = &rte_wx_modbus_rtu_f1;
|
||||
scaling_a = config->slave_1_scaling_a;
|
||||
scaling_b = config->slave_1_scaling_b;
|
||||
scaling_c = config->slave_1_scaling_c;
|
||||
scaling_d = config->slave_1_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[0];
|
||||
#elif (_RTU_SLAVE_PRESSURE_SOURCE == 2)
|
||||
source = &RTU_GETTERS_F2_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_2;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_2;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_2;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_2;
|
||||
break;
|
||||
case 2:
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
scaling_a = config->slave_2_scaling_a;
|
||||
scaling_b = config->slave_2_scaling_b;
|
||||
scaling_c = config->slave_2_scaling_c;
|
||||
scaling_d = config->slave_2_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[1];
|
||||
#elif (_RTU_SLAVE_PRESSURE_SOURCE == 3)
|
||||
source = &RTU_GETTERS_F3_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_3;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_3;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_3;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_3;
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
break;
|
||||
case 3:
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
scaling_a = config->slave_3_scaling_a;
|
||||
scaling_b = config->slave_3_scaling_b;
|
||||
scaling_c = config->slave_3_scaling_c;
|
||||
scaling_d = config->slave_3_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[2];
|
||||
#elif (_RTU_SLAVE_PRESSURE_SOURCE == 4)
|
||||
source = &RTU_GETTERS_F4_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_4;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_4;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_4;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_4;
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
break;
|
||||
case 4:
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
scaling_a = config->slave_4_scaling_a;
|
||||
scaling_b = config->slave_4_scaling_b;
|
||||
scaling_c = config->slave_4_scaling_c;
|
||||
scaling_d = config->slave_4_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[3];
|
||||
#elif (_RTU_SLAVE_PRESSURE_SOURCE == 5)
|
||||
source = &RTU_GETTERS_F5_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_5;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_5;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_5;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_5;
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
break;
|
||||
case 5:
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
scaling_a = config->slave_5_scaling_a;
|
||||
scaling_b = config->slave_5_scaling_b;
|
||||
scaling_c = config->slave_5_scaling_c;
|
||||
scaling_d = config->slave_5_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[4];
|
||||
#elif (_RTU_SLAVE_PRESSURE_SOURCE == 6)
|
||||
source = &RTU_GETTERS_F6_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_6;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_6;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_6;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_6;
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
break;
|
||||
case 6:
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
scaling_a = config->slave_6_scaling_a;
|
||||
scaling_b = config->slave_6_scaling_b;
|
||||
scaling_c = config->slave_6_scaling_c;
|
||||
scaling_d = config->slave_6_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[5];
|
||||
#else
|
||||
#error "Wrong Modbus Configuration"
|
||||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
#endif
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
break;
|
||||
default:
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
// copy the raw value from modbus register data
|
||||
|
@ -215,12 +228,11 @@ int32_t rtu_get_pressure(float* out) {
|
|||
*out = physical_register_value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int32_t rtu_get_wind_direction(uint16_t* out) {
|
||||
int32_t rtu_get_wind_direction(uint16_t* out, const config_data_rtu_t * const config) {
|
||||
|
||||
int32_t retval = MODBUS_RET_UNINITIALIZED;
|
||||
|
||||
|
@ -233,56 +245,63 @@ int32_t rtu_get_wind_direction(uint16_t* out) {
|
|||
// the timestamp of last update of the register value
|
||||
uint32_t last_update_timestam = 0;
|
||||
|
||||
#ifdef _MODBUS_RTU
|
||||
#ifdef _RTU_SLAVE_WIND_DIRECTION_SORUCE
|
||||
#if (_RTU_SLAVE_WIND_DIRECTION_SORUCE == 1)
|
||||
source = &RTU_GETTERS_F1_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_1;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_1;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_1;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_1;
|
||||
switch (config->wind_direction_source) {
|
||||
case 1:
|
||||
source = &rte_wx_modbus_rtu_f1;
|
||||
scaling_a = config->slave_1_scaling_a;
|
||||
scaling_b = config->slave_1_scaling_b;
|
||||
scaling_c = config->slave_1_scaling_c;
|
||||
scaling_d = config->slave_1_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[0];
|
||||
#elif (_RTU_SLAVE_WIND_DIRECTION_SORUCE == 2)
|
||||
source = &RTU_GETTERS_F2_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_2;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_2;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_2;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_2;
|
||||
break;
|
||||
case 2:
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
scaling_a = config->slave_2_scaling_a;
|
||||
scaling_b = config->slave_2_scaling_b;
|
||||
scaling_c = config->slave_2_scaling_c;
|
||||
scaling_d = config->slave_2_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[1];
|
||||
#elif (_RTU_SLAVE_WIND_DIRECTION_SORUCE == 3)
|
||||
source = &RTU_GETTERS_F3_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_3;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_3;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_3;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_3;
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
break;
|
||||
case 3:
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
scaling_a = config->slave_3_scaling_a;
|
||||
scaling_b = config->slave_3_scaling_b;
|
||||
scaling_c = config->slave_3_scaling_c;
|
||||
scaling_d = config->slave_3_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[2];
|
||||
#elif (_RTU_SLAVE_WIND_DIRECTION_SORUCE == 4)
|
||||
source = &RTU_GETTERS_F4_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_4;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_4;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_4;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_4;
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
break;
|
||||
case 4:
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
scaling_a = config->slave_4_scaling_a;
|
||||
scaling_b = config->slave_4_scaling_b;
|
||||
scaling_c = config->slave_4_scaling_c;
|
||||
scaling_d = config->slave_4_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[3];
|
||||
#elif (_RTU_SLAVE_WIND_DIRECTION_SORUCE == 5)
|
||||
source = &RTU_GETTERS_F5_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_5;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_5;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_5;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_5;
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
break;
|
||||
case 5:
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
scaling_a = config->slave_5_scaling_a;
|
||||
scaling_b = config->slave_5_scaling_b;
|
||||
scaling_c = config->slave_5_scaling_c;
|
||||
scaling_d = config->slave_5_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[4];
|
||||
#elif (_RTU_SLAVE_WIND_DIRECTION_SORUCE == 6)
|
||||
source = &RTU_GETTERS_F6_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_6;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_6;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_6;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_6;
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
break;
|
||||
case 6:
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
scaling_a = config->slave_6_scaling_a;
|
||||
scaling_b = config->slave_6_scaling_b;
|
||||
scaling_c = config->slave_6_scaling_c;
|
||||
scaling_d = config->slave_6_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[5];
|
||||
#else
|
||||
#error "Wrong Modbus Configuration"
|
||||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
#endif
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
break;
|
||||
default:
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
// copy the raw value from modbus register data
|
||||
|
@ -312,12 +331,11 @@ int32_t rtu_get_wind_direction(uint16_t* out) {
|
|||
*out = physical_register_value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int32_t rtu_get_wind_speed(uint16_t* out) {
|
||||
int32_t rtu_get_wind_speed(uint16_t* out, const config_data_rtu_t * const config) {
|
||||
|
||||
int32_t retval = MODBUS_RET_UNINITIALIZED;
|
||||
|
||||
|
@ -330,56 +348,63 @@ int32_t rtu_get_wind_speed(uint16_t* out) {
|
|||
// the timestamp of last update of the register value
|
||||
uint32_t last_update_timestam = 0;
|
||||
|
||||
#ifdef _MODBUS_RTU
|
||||
#ifdef _RTU_SLAVE_WIND_SPEED_SOURCE
|
||||
#if (_RTU_SLAVE_WIND_SPEED_SOURCE == 1)
|
||||
source = &RTU_GETTERS_F1_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_1;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_1;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_1;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_1;
|
||||
switch (config->wind_speed_source) {
|
||||
case 1:
|
||||
source = &rte_wx_modbus_rtu_f1;
|
||||
scaling_a = config->slave_1_scaling_a;
|
||||
scaling_b = config->slave_1_scaling_b;
|
||||
scaling_c = config->slave_1_scaling_c;
|
||||
scaling_d = config->slave_1_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[0];
|
||||
#elif (_RTU_SLAVE_WIND_SPEED_SOURCE == 2)
|
||||
source = &RTU_GETTERS_F2_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_2;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_2;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_2;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_2;
|
||||
break;
|
||||
case 2:
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
scaling_a = config->slave_2_scaling_a;
|
||||
scaling_b = config->slave_2_scaling_b;
|
||||
scaling_c = config->slave_2_scaling_c;
|
||||
scaling_d = config->slave_2_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[1];
|
||||
#elif (_RTU_SLAVE_WIND_SPEED_SOURCE == 3)
|
||||
source = &RTU_GETTERS_F3_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_3;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_3;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_3;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_3;
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
break;
|
||||
case 3:
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
scaling_a = config->slave_3_scaling_a;
|
||||
scaling_b = config->slave_3_scaling_b;
|
||||
scaling_c = config->slave_3_scaling_c;
|
||||
scaling_d = config->slave_3_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[2];
|
||||
#elif (_RTU_SLAVE_WIND_SPEED_SOURCE == 4)
|
||||
source = &RTU_GETTERS_F4_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_4;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_4;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_4;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_4;
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
break;
|
||||
case 4:
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
scaling_a = config->slave_4_scaling_a;
|
||||
scaling_b = config->slave_4_scaling_b;
|
||||
scaling_c = config->slave_4_scaling_c;
|
||||
scaling_d = config->slave_4_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[3];
|
||||
#elif (_RTU_SLAVE_WIND_SPEED_SOURCE == 5)
|
||||
source = &RTU_GETTERS_F5_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_5;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_5;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_5;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_5;
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
break;
|
||||
case 5:
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
scaling_a = config->slave_5_scaling_a;
|
||||
scaling_b = config->slave_5_scaling_b;
|
||||
scaling_c = config->slave_5_scaling_c;
|
||||
scaling_d = config->slave_5_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[4];
|
||||
#elif (_RTU_SLAVE_WIND_SPEED_SOURCE == 6)
|
||||
source = &RTU_GETTERS_F6_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_6;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_6;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_6;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_6;
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
break;
|
||||
case 6:
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
scaling_a = config->slave_6_scaling_a;
|
||||
scaling_b = config->slave_6_scaling_b;
|
||||
scaling_c = config->slave_6_scaling_c;
|
||||
scaling_d = config->slave_6_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[5];
|
||||
#else
|
||||
#error "Wrong Modbus Configuration"
|
||||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
#endif
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
break;
|
||||
default:
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
// copy the raw value from modbus register data
|
||||
|
@ -409,12 +434,11 @@ int32_t rtu_get_wind_speed(uint16_t* out) {
|
|||
*out = physical_register_value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int32_t rtu_get_wind_gusts(uint16_t* out) {
|
||||
int32_t rtu_get_wind_gusts(uint16_t* out, const config_data_rtu_t * const config) {
|
||||
int32_t retval = MODBUS_RET_UNINITIALIZED;
|
||||
|
||||
rtu_register_data_t* source = 0;
|
||||
|
@ -426,56 +450,63 @@ int32_t rtu_get_wind_gusts(uint16_t* out) {
|
|||
// the timestamp of last update of the register value
|
||||
uint32_t last_update_timestam = 0;
|
||||
|
||||
#ifdef _MODBUS_RTU
|
||||
#ifdef _RTU_SLAVE_WIND_GUSTS_SOURCE
|
||||
#if (_RTU_SLAVE_WIND_GUSTS_SOURCE == 1)
|
||||
source = &RTU_GETTERS_F1_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_1;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_1;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_1;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_1;
|
||||
switch (config->wind_gusts_source) {
|
||||
case 1:
|
||||
source = &rte_wx_modbus_rtu_f1;
|
||||
scaling_a = config->slave_1_scaling_a;
|
||||
scaling_b = config->slave_1_scaling_b;
|
||||
scaling_c = config->slave_1_scaling_c;
|
||||
scaling_d = config->slave_1_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[0];
|
||||
#elif (_RTU_SLAVE_WIND_GUSTS_SOURCE == 2)
|
||||
source = &RTU_GETTERS_F2_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_2;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_2;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_2;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_2;
|
||||
break;
|
||||
case 2:
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
scaling_a = config->slave_2_scaling_a;
|
||||
scaling_b = config->slave_2_scaling_b;
|
||||
scaling_c = config->slave_2_scaling_c;
|
||||
scaling_d = config->slave_2_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[1];
|
||||
#elif (_RTU_SLAVE_WIND_GUSTS_SOURCE == 3)
|
||||
source = &RTU_GETTERS_F3_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_3;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_3;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_3;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_3;
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
break;
|
||||
case 3:
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
scaling_a = config->slave_3_scaling_a;
|
||||
scaling_b = config->slave_3_scaling_b;
|
||||
scaling_c = config->slave_3_scaling_c;
|
||||
scaling_d = config->slave_3_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[2];
|
||||
#elif (_RTU_SLAVE_WIND_GUSTS_SOURCE == 4)
|
||||
source = &RTU_GETTERS_F4_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_4;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_4;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_4;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_4;
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
break;
|
||||
case 4:
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
scaling_a = config->slave_4_scaling_a;
|
||||
scaling_b = config->slave_4_scaling_b;
|
||||
scaling_c = config->slave_4_scaling_c;
|
||||
scaling_d = config->slave_4_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[3];
|
||||
#elif (_RTU_SLAVE_WIND_GUSTS_SOURCE == 5)
|
||||
source = &RTU_GETTERS_F5_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_5;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_5;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_5;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_5;
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
break;
|
||||
case 5:
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
scaling_a = config->slave_5_scaling_a;
|
||||
scaling_b = config->slave_5_scaling_b;
|
||||
scaling_c = config->slave_5_scaling_c;
|
||||
scaling_d = config->slave_5_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[4];
|
||||
#elif (_RTU_SLAVE_WIND_GUSTS_SOURCE == 6)
|
||||
source = &RTU_GETTERS_F6_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_6;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_6;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_6;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_6;
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
break;
|
||||
case 6:
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
scaling_a = config->slave_6_scaling_a;
|
||||
scaling_b = config->slave_6_scaling_b;
|
||||
scaling_c = config->slave_6_scaling_c;
|
||||
scaling_d = config->slave_6_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[5];
|
||||
#else
|
||||
#error "Wrong Modbus Configuration"
|
||||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
#endif
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
break;
|
||||
default:
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
// copy the raw value from modbus register data
|
||||
|
@ -506,12 +537,11 @@ int32_t rtu_get_wind_gusts(uint16_t* out) {
|
|||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int32_t rtu_get_humidity(int8_t* out) {
|
||||
int32_t rtu_get_humidity(int8_t* out, const config_data_rtu_t * const config) {
|
||||
|
||||
int32_t retval = MODBUS_RET_UNINITIALIZED;
|
||||
|
||||
|
@ -525,42 +555,63 @@ int32_t rtu_get_humidity(int8_t* out) {
|
|||
// the timestamp of last update of the register value
|
||||
uint32_t last_update_timestam = 0;
|
||||
|
||||
#ifdef _MODBUS_RTU
|
||||
#ifdef _RTU_SLAVE_HUMIDITY_SOURCE
|
||||
#if (_RTU_SLAVE_HUMIDITY_SOURCE == 1)
|
||||
source = &RTU_GETTERS_F1_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_1;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_1;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_1;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_1;
|
||||
switch (config->humidity_source) {
|
||||
case 1:
|
||||
source = &rte_wx_modbus_rtu_f1;
|
||||
scaling_a = config->slave_1_scaling_a;
|
||||
scaling_b = config->slave_1_scaling_b;
|
||||
scaling_c = config->slave_1_scaling_c;
|
||||
scaling_d = config->slave_1_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[0];
|
||||
#elif (_RTU_SLAVE_HUMIDITY_SOURCE == 2)
|
||||
source = &RTU_GETTERS_F2_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_2;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_2;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_2;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_2;
|
||||
break;
|
||||
case 2:
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
scaling_a = config->slave_2_scaling_a;
|
||||
scaling_b = config->slave_2_scaling_b;
|
||||
scaling_c = config->slave_2_scaling_c;
|
||||
scaling_d = config->slave_2_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[1];
|
||||
#elif (_RTU_SLAVE_HUMIDITY_SOURCE == 3)
|
||||
source = &RTU_GETTERS_F3_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_3;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_3;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_3;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_3;
|
||||
source = &rte_wx_modbus_rtu_f2;
|
||||
break;
|
||||
case 3:
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
scaling_a = config->slave_3_scaling_a;
|
||||
scaling_b = config->slave_3_scaling_b;
|
||||
scaling_c = config->slave_3_scaling_c;
|
||||
scaling_d = config->slave_3_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[2];
|
||||
#elif (_RTU_SLAVE_HUMIDITY_SOURCE == 4)
|
||||
source = &RTU_GETTERS_F4_NAME;
|
||||
scaling_a = _RTU_SLAVE_SCALING_A_4;
|
||||
scaling_b = _RTU_SLAVE_SCALING_B_4;
|
||||
scaling_c = _RTU_SLAVE_SCALING_C_4;
|
||||
scaling_d = _RTU_SLAVE_SCALING_D_4;
|
||||
source = &rte_wx_modbus_rtu_f3;
|
||||
break;
|
||||
case 4:
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
scaling_a = config->slave_4_scaling_a;
|
||||
scaling_b = config->slave_4_scaling_b;
|
||||
scaling_c = config->slave_4_scaling_c;
|
||||
scaling_d = config->slave_4_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[3];
|
||||
#else
|
||||
#error "Wrong Modbus Configuration"
|
||||
#endif
|
||||
#else
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
#endif
|
||||
source = &rte_wx_modbus_rtu_f4;
|
||||
break;
|
||||
case 5:
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
scaling_a = config->slave_5_scaling_a;
|
||||
scaling_b = config->slave_5_scaling_b;
|
||||
scaling_c = config->slave_5_scaling_c;
|
||||
scaling_d = config->slave_5_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[4];
|
||||
source = &rte_wx_modbus_rtu_f5;
|
||||
break;
|
||||
case 6:
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
scaling_a = config->slave_6_scaling_a;
|
||||
scaling_b = config->slave_6_scaling_b;
|
||||
scaling_c = config->slave_6_scaling_c;
|
||||
scaling_d = config->slave_6_scaling_d;
|
||||
last_update_timestam = rte_rtu_pool_queue.last_successfull_call_to_function[5];
|
||||
source = &rte_wx_modbus_rtu_f6;
|
||||
break;
|
||||
default:
|
||||
retval = MODBUS_RET_NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
if (retval == MODBUS_RET_UNINITIALIZED && source != 0) {
|
||||
// copy the raw value from modbus register data
|
||||
|
@ -592,7 +643,6 @@ int32_t rtu_get_humidity(int8_t* out) {
|
|||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -607,31 +657,19 @@ void rtu_get_raw_values_string(char* out, uint16_t out_buffer_ln, uint8_t* gener
|
|||
uint16_t f6_value = 0;
|
||||
|
||||
int string_ln = 0;
|
||||
#ifdef _MODBUS_RTU
|
||||
#if defined(_RTU_SLAVE_ID_1)
|
||||
f1_value = RTU_GETTERS_F1_NAME.registers_values[0];
|
||||
#endif
|
||||
|
||||
#if defined(_RTU_SLAVE_ID_2)
|
||||
f2_value = RTU_GETTERS_F2_NAME.registers_values[0];
|
||||
#endif
|
||||
f1_value = rte_wx_modbus_rtu_f1.registers_values[0];
|
||||
|
||||
#if defined(_RTU_SLAVE_ID_3)
|
||||
f3_value = RTU_GETTERS_F3_NAME.registers_values[0];
|
||||
#endif
|
||||
f2_value = rte_wx_modbus_rtu_f2.registers_values[0];
|
||||
|
||||
#if defined(_RTU_SLAVE_ID_4)
|
||||
f4_value = RTU_GETTERS_F4_NAME.registers_values[0];
|
||||
#endif
|
||||
f3_value = rte_wx_modbus_rtu_f3.registers_values[0];
|
||||
|
||||
#if defined(_RTU_SLAVE_ID_5)
|
||||
f5_value = RTU_GETTERS_F5_NAME.registers_values[0];
|
||||
#endif
|
||||
f4_value = rte_wx_modbus_rtu_f4.registers_values[0];
|
||||
|
||||
f5_value = rte_wx_modbus_rtu_f5.registers_values[0];
|
||||
|
||||
f6_value = rte_wx_modbus_rtu_f6.registers_values[0];
|
||||
|
||||
#if defined(_RTU_SLAVE_ID_6)
|
||||
f6_value = RTU_GETTERS_F6_NAME.registers_values[0];
|
||||
#endif
|
||||
#endif
|
||||
string_ln = snprintf(out, out_buffer_ln, ">F1V %X, F2V %X, F3V %X, F4V %X, F5V %X, F6V %X",
|
||||
(int) f1_value,
|
||||
(int) f2_value,
|
||||
|
|
Ładowanie…
Reference in New Issue