mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'init_identify_when_enable_endpoint' into 'main'
components/esp_matter: init identify after chip::Platform::MemoryInit See merge request app-frameworks/esp-matter!1101
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -521,6 +521,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;
|
||||
|
||||
Reference in New Issue
Block a user