Whitespace: Automated whitespace fixes (large commit)

Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)


* Original commit: espressif/esp-idf@66fb5a29bb
This commit is contained in:
Angus Gratton authored and aleks committed 2022-03-21 13:15:54 +01:00
1 parent fb445432c4
commit e0102243f5
68 files changed
+227 -247

No files matched your search

@@ -3,4 +3,4 @@
cmake_minimum_required(VERSION 3.5)
idf_component_register(SRCS "modbus_params.c"
INCLUDE_DIRS "include"
PRIV_REQUIRES freemodbus)
PRIV_REQUIRES freemodbus)
@@ -2,4 +2,4 @@
# Component Makefile
#
COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_SRCDIRS := .
COMPONENT_SRCDIRS := .
@@ -14,4 +14,3 @@ input_reg_params_t input_reg_params = { 0 };
coil_reg_params_t coil_reg_params = { 0 };
discrete_reg_params_t discrete_reg_params = { 0 };
@@ -8,4 +8,3 @@ PROJECT_NAME := modbus_master
EXTRA_COMPONENT_DIRS := $(IDF_PATH)/examples/protocols/modbus/mb_example_common
include $(IDF_PATH)/make/project.mk
@@ -2,4 +2,3 @@ set(PROJECT_NAME "modbus_master")
idf_component_register(SRCS "master.c"
INCLUDE_DIRS ".")
@@ -148,12 +148,12 @@ static void master_operation_func(void *arg)
float value = 0;
bool alarm_state = false;
const mb_parameter_descriptor_t* param_descriptor = NULL;
ESP_LOGI(MASTER_TAG, "Start modbus test...");
for(uint16_t retry = 0; retry <= MASTER_MAX_RETRY && (!alarm_state); retry++) {
// Read all found characteristics from slave(s)
for (uint16_t cid = 0; (err != ESP_ERR_NOT_FOUND) && cid < MASTER_MAX_CIDS; cid++)
for (uint16_t cid = 0; (err != ESP_ERR_NOT_FOUND) && cid < MASTER_MAX_CIDS; cid++)
{
// Get data from parameters description table
// and use this information to fill the characteristics description table
@@ -244,10 +244,10 @@ static void master_operation_func(void *arg)
vTaskDelay(POLL_TIMEOUT_TICS); // timeout between polls
}
}
vTaskDelay(UPDATE_CIDS_TIMEOUT_TICS); //
vTaskDelay(UPDATE_CIDS_TIMEOUT_TICS); //
}
if (alarm_state) {
if (alarm_state) {
ESP_LOGI(MASTER_TAG, "Alarm triggered by cid #%d.",
param_descriptor->cid);
} else {
@@ -315,6 +315,6 @@ void app_main(void)
// Initialization of device peripheral and objects
ESP_ERROR_CHECK(master_init());
vTaskDelay(10);
master_operation_func(NULL);
}
@@ -8,4 +8,3 @@ PROJECT_NAME := modbus_slave
EXTRA_COMPONENT_DIRS := $(IDF_PATH)/examples/protocols/modbus/mb_example_common
include $(IDF_PATH)/make/project.mk
@@ -1,4 +1,4 @@
set(PROJECT_NAME "modbus_slave")
idf_component_register(SRCS "slave.c"
INCLUDE_DIRS ".")
INCLUDE_DIRS ".")
@@ -128,7 +128,7 @@ void app_main(void)
// Starts of modbus controller and stack
ESP_ERROR_CHECK(mbc_slave_start());
// Set UART pin numbers
ESP_ERROR_CHECK(uart_set_pin(MB_PORT_NUM, CONFIG_MB_UART_TXD,
CONFIG_MB_UART_RXD, CONFIG_MB_UART_RTS,
@@ -136,7 +136,7 @@ void app_main(void)
// Set UART driver mode to Half Duplex
ESP_ERROR_CHECK(uart_set_mode(MB_PORT_NUM, UART_MODE_RS485_HALF_DUPLEX));
ESP_LOGI(SLAVE_TAG, "Modbus slave stack initialized.");
ESP_LOGI(SLAVE_TAG, "Start modbus test...");
@@ -2,4 +2,3 @@ set(PROJECT_NAME "modbus_tcp_master")
idf_component_register(SRCS "tcp_master.c"
INCLUDE_DIRS ".")
@@ -77,7 +77,7 @@
#define MB_MDNS_INSTANCE(pref) pref"mb_master_tcp"
// Enumeration of modbus device addresses accessed by master device
// Enumeration of modbus device addresses accessed by master device
// Each address in the table is a index of TCP slave ip address in mb_communication_info_t::tcp_ip_addr table
enum {
MB_DEVICE_ADDR1 = 1, // Slave address 1
@@ -432,12 +432,12 @@ static void master_operation_func(void *arg)
float value = 0;
bool alarm_state = false;
const mb_parameter_descriptor_t* param_descriptor = NULL;
ESP_LOGI(MASTER_TAG, "Start modbus test...");
for(uint16_t retry = 0; retry <= MASTER_MAX_RETRY && (!alarm_state); retry++) {
// Read all found characteristics from slave(s)
for (uint16_t cid = 0; (err != ESP_ERR_NOT_FOUND) && cid < MASTER_MAX_CIDS; cid++)
for (uint16_t cid = 0; (err != ESP_ERR_NOT_FOUND) && cid < MASTER_MAX_CIDS; cid++)
{
// Get data from parameters description table
// and use this information to fill the characteristics description table
@@ -447,7 +447,7 @@ static void master_operation_func(void *arg)
void* temp_data_ptr = master_get_param_data(param_descriptor);
assert(temp_data_ptr);
uint8_t type = 0;
err = mbc_master_get_parameter(cid, (char*)param_descriptor->param_key,
err = mbc_master_get_parameter(cid, (char*)param_descriptor->param_key,
(uint8_t*)&value, &type);
if (err == ESP_OK) {
*(float*)temp_data_ptr = value;
@@ -455,9 +455,9 @@ static void master_operation_func(void *arg)
(param_descriptor->mb_param_type == MB_PARAM_INPUT)) {
ESP_LOGI(MASTER_TAG, "Characteristic #%d %s (%s) value = %f (0x%x) read successful.",
param_descriptor->cid,
(char*)param_descriptor->param_key,
(char*)param_descriptor->param_key,
(char*)param_descriptor->param_units,
value,
value,
*(uint32_t*)temp_data_ptr);
if (((value > param_descriptor->param_opts.max) ||
(value < param_descriptor->param_opts.min))) {
@@ -469,7 +469,7 @@ static void master_operation_func(void *arg)
const char* rw_str = (state & param_descriptor->param_opts.opt1) ? "ON" : "OFF";
ESP_LOGI(MASTER_TAG, "Characteristic #%d %s (%s) value = %s (0x%x) read successful.",
param_descriptor->cid,
(char*)param_descriptor->param_key,
(char*)param_descriptor->param_key,
(char*)param_descriptor->param_units,
(const char*)rw_str,
*(uint16_t*)temp_data_ptr);
@@ -490,8 +490,8 @@ static void master_operation_func(void *arg)
}
vTaskDelay(UPDATE_CIDS_TIMEOUT_TICS);
}
if (alarm_state) {
if (alarm_state) {
ESP_LOGI(MASTER_TAG, "Alarm triggered by cid #%d.",
param_descriptor->cid);
} else {
@@ -591,7 +591,7 @@ void app_main(void)
// Initialization of device peripheral and objects
ESP_ERROR_CHECK(master_init());
vTaskDelay(10);
master_operation_func(NULL);
#if CONFIG_MB_MDNS_IP_RESOLVER
master_destroy_slave_list(slave_ip_address_table);
@@ -16,4 +16,4 @@ CONFIG_FMB_TIMER_INDEX=0
CONFIG_FMB_TIMER_ISR_IN_IRAM=y
CONFIG_MB_MDNS_IP_RESOLVER=n
CONFIG_MB_SLAVE_IP_FROM_STDIN=y
CONFIG_EXAMPLE_CONNECT_IPV6=n
CONFIG_EXAMPLE_CONNECT_IPV6=n
@@ -8,4 +8,3 @@ EXTRA_COMPONENT_DIRS := $(IDF_PATH)/examples/protocols/modbus/mb_example_common
EXTRA_COMPONENT_DIRS += $(IDF_PATH)/examples/common_components/protocol_examples_common
include $(IDF_PATH)/make/project.mk
@@ -1,4 +1,4 @@
set(PROJECT_NAME "modbus_tcp_slave")
idf_component_register(SRCS "tcp_slave.c"
INCLUDE_DIRS ".")
INCLUDE_DIRS ".")
@@ -15,4 +15,4 @@ menu "Modbus Example Configuration"
This option allows to use mDNS service to resolve IP addresses of the Modbus slaves.
If the option is disabled the ip addresses of slaves are defined in static table.
endmenu
endmenu
@@ -168,10 +168,10 @@ void app_main(void)
void* mbc_slave_handler = NULL;
ESP_ERROR_CHECK(mbc_slave_init_tcp(&mbc_slave_handler)); // Initialization of Modbus controller
mb_param_info_t reg_info; // keeps the Modbus registers access information
mb_register_area_descriptor_t reg_area; // Modbus register area descriptor structure
mb_communication_info_t comm_info = { 0 };
comm_info.ip_port = MB_TCP_PORT_NUMBER;
#if !CONFIG_EXAMPLE_CONNECT_IPV6
@@ -18,4 +18,4 @@ CONFIG_MB_MDNS_IP_RESOLVER=n
CONFIG_MB_SLAVE_IP_FROM_STDIN=y
CONFIG_MB_SLAVE_ADDR=1
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_EXAMPLE_CONNECT_IPV6=n
CONFIG_EXAMPLE_CONNECT_IPV6=n