Merge branch 'init_identify_when_enable_endpoint_v1_4' into 'release/v1.4'

components/esp_matter: init identify after chip::Platform::MemoryInit (backport v1.4)

See merge request app-frameworks/esp-matter!1108
This commit is contained in:
Shu Chen
2025-04-24 11:06:36 +08:00
2 changed files with 17 additions and 4 deletions
@@ -945,10 +945,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
}
}
/* Extra initialization */
uint16_t endpoint_id = endpoint::get_id(endpoint);
identification::init(endpoint_id, config->identify_type);
/* Commands */
command::create_identify(cluster);
+17
View File
@@ -513,6 +513,23 @@ esp_err_t enable(endpoint_t *endpoint)
generated_command_ids = NULL;
cluster_id = cluster::get_id((cluster_t*)cluster);
/* Init identify if exists and not initialized */
if (cluster_id == chip::app::Clusters::Identify::Id && current_endpoint->identify == NULL) {
_attribute_t *identify_type_attr = (_attribute_t *)attribute::get(
current_endpoint->endpoint_id, cluster_id, chip::app::Clusters::Identify::Attributes::IdentifyType::Id);
if (identify_type_attr) {
if (identification::init(current_endpoint->endpoint_id, identify_type_attr->val.val.u8) != ESP_OK) {
ESP_LOGE(TAG, "Failed to init identification");
err = ESP_FAIL;
break;
}
} else {
ESP_LOGE(TAG, "Can't get IdentifyType attribute in Identify cluster");
err = ESP_ERR_INVALID_STATE;
break;
}
}
/* Client Generated Commands */
command_flag = COMMAND_FLAG_ACCEPTED;
command = cluster->command_list;