fix master-slave connection repair issues

This commit is contained in:
Alex Lisitsyn committed 2025-06-16 10:38:12 +01:00
1 parent 0f015336ef
commit 6f01b858ee
26 files changed
+260 -224

No files matched your search

@@ -1,7 +1,7 @@
dependencies:
idf: ">=5.0"
espressif/esp-modbus:
version: "^2.0.0"
version: "^2"
override_path: "../../../../"
mb_example_common:
path: "../../../mb_example_common"
@@ -1,7 +1,7 @@
dependencies:
idf: ">=5.0"
espressif/esp-modbus:
version: "^2.0.0"
version: "^2"
override_path: "../../../../"
mb_example_common:
path: "../../../mb_example_common"
@@ -1,7 +1,8 @@
#
# Modbus configuration
#
CONFIG_MB_COMM_MODE_ASCII=y
CONFIG_MB_COMM_MODE_ASCII=n
CONFIG_MB_COMM_MODE_RTU=y
CONFIG_MB_SLAVE_ADDR=1
CONFIG_MB_UART_BAUD_RATE=115200
CONFIG_FMB_TIMER_USE_ISR_DISPATCH_METHOD=y
@@ -2,10 +2,10 @@ dependencies:
idf:
version: ">=5.0"
espressif/esp-modbus:
version: "^2.0.0"
version: "^2"
override_path: "../../../../"
espressif/mdns:
version: "^1.0.0"
version: "^1"
mb_example_common:
path: "../../../mb_example_common"
protocol_examples_common:
@@ -1,7 +1,7 @@
dependencies:
idf: ">=5.0"
espressif/esp-modbus:
version: "^2.0.0"
version: "^2"
override_path: "../../../../"
espressif/mdns:
version: "^1.0.0"
+2 -2
View File
@@ -36,7 +36,7 @@
#define MB_REG_HOLDING_START_AREA0 (HOLD_OFFSET(holding_data0))
#define MB_REG_HOLDING_START_AREA0_SIZE ((size_t)((HOLD_OFFSET(holding_data4) - HOLD_OFFSET(holding_data0)) << 1))
#define MB_REG_HOLDING_START_AREA1 (HOLD_OFFSET(holding_data4))
#define MB_REG_HOLDING_START_AREA1_SIZE ((size_t)((HOLD_OFFSET(holding_area1_end) - HOLD_OFFSET(holding_data4)) << 1))
#define MB_REG_HOLDING_START_AREA1_SIZE ((size_t)((HOLD_OFFSET(holding_area1_end) - HOLD_OFFSET(holding_data4)) << 1) + 4)
#define MB_REG_HOLDING_START_AREA2 (HOLD_OFFSET(holding_u8_a))
#define MB_REG_HOLDING_START_AREA2_SIZE ((size_t)((HOLD_OFFSET(holding_area2_end) - HOLD_OFFSET(holding_u8_a)) << 1))
@@ -327,7 +327,7 @@ static esp_err_t slave_init(mb_communication_info_t *pcomm_info)
reg_area.type = MB_PARAM_HOLDING; // Set type of register area
reg_area.start_offset = MB_REG_HOLDING_START_AREA1; // Offset of register area in Modbus protocol
reg_area.address = (void*)&holding_reg_params.holding_data4; // Set pointer to storage instance
reg_area.size = sizeof(float) << 2; // Set the size of register storage instance
reg_area.size = MB_REG_HOLDING_START_AREA1_SIZE; // Set the size of register storage instance
reg_area.access = MB_ACCESS_RW;
err = mbc_slave_set_descriptor(slave_handle, reg_area);
MB_RETURN_ON_FALSE((err == ESP_OK), ESP_ERR_INVALID_STATE,