fix the linking issues when slave id option is disabled v1

This commit is contained in:
Alex Lisitsyn
2025-04-26 00:41:47 +08:00
parent e8317c2822
commit acd7c14457
3 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -304,7 +304,7 @@ static void master_operation_func(void *arg)
const mb_parameter_descriptor_t* param_descriptor = NULL;
ESP_LOGI(TAG, "Start modbus test...");
#if CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT
// Command - 17 (0x11) Report Slave ID (Serial Line only)
// The command contains vendor specific data and should be interpreted accordingly.
// This version of command handler needs to define the maximum number
@@ -324,6 +324,7 @@ static void master_operation_func(void *arg)
} else {
ESP_LOG_BUFFER_HEX_LEVEL("SLAVE_INFO", (void*)info_buf, sizeof(info_buf), ESP_LOG_WARN);
}
#endif
for(uint16_t retry = 0; retry <= MASTER_MAX_RETRY && (!alarm_state); retry++) {
// Read all found characteristics from slave(s)
+2
View File
@@ -230,6 +230,7 @@ void app_main(void)
ESP_LOGI(TAG, "Modbus slave stack initialized.");
ESP_LOGI(TAG, "Start modbus test...");
#if CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT
uint8_t ext_data[] = {0x11, 0x22, 0x33, 0x44, 0x55};
// This is the way to set Slave ID fields to retrieve it by master using report slave ID command.
int err = eMBSetSlaveID(comm_info.slave_addr, true, (uint8_t *)&ext_data, sizeof(ext_data));
@@ -238,6 +239,7 @@ void app_main(void)
} else {
ESP_LOGE("SET_SLAVE_ID", "Set slave ID fail, err=%d.", err);
}
#endif
// The cycle below will be terminated when parameter holdingRegParams.dataChan0
// incremented each access cycle reaches the CHAN_DATA_MAX_VAL value.