Skip to content

Commit 431c6a5

Browse files
committed
Merge branch 'fix_zap_light' into 'main'
Do not use minimum unused endpoint id if server instance is disabled or ESP-Matter data model is disabled Closes CON-1120 See merge request app-frameworks/esp-matter!702
2 parents 89f47b6 + 958c7e9 commit 431c6a5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

components/esp_matter/esp_matter_core.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ namespace node {
224224

225225
static _node_t *node = NULL;
226226

227+
#if defined(CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) && defined(CONFIG_ESP_MATTE_ENABLE_DATA_MODEL)
228+
// If Matter server or ESP-Matter data model is not enabled. we will never use minimum unused endpoint id.
227229
static esp_err_t store_min_unused_endpoint_id()
228230
{
229231
if (!node || !esp_matter_started) {
@@ -287,7 +289,7 @@ static esp_err_t read_min_unused_endpoint_id()
287289
}
288290
return err;
289291
}
290-
292+
#endif // defined(CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) && defined(CONFIG_ESP_MATTE_ENABLE_DATA_MODEL)
291293
} /* node */
292294

293295
namespace cluster {
@@ -1083,14 +1085,13 @@ esp_err_t start(event_callback_t callback, intptr_t callback_arg)
10831085
return err;
10841086
}
10851087
esp_matter_started = true;
1086-
#ifdef CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER
1087-
// If Matter server is not enabled. we will never use minimum unused endpoint id.
1088+
#if defined(CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) && defined(CONFIG_ESP_MATTE_ENABLE_DATA_MODEL)
10881089
err = node::read_min_unused_endpoint_id();
10891090
// If the min_unused_endpoint_id is not found, we will write the current min_unused_endpoint_id in nvs.
10901091
if (err == ESP_ERR_NVS_NOT_FOUND) {
10911092
err = node::store_min_unused_endpoint_id();
10921093
}
1093-
#endif
1094+
#endif // defined(CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) && defined(CONFIG_ESP_MATTE_ENABLE_DATA_MODEL)
10941095
return err;
10951096
}
10961097

@@ -1930,11 +1931,12 @@ endpoint_t *create(node_t *node, uint8_t flags, void *priv_data)
19301931
endpoint->parent_endpoint_id = chip::kInvalidEndpointId;
19311932
endpoint->flags = flags;
19321933
endpoint->priv_data = priv_data;
1933-
1934+
#if defined(CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) && defined(CONFIG_ESP_MATTE_ENABLE_DATA_MODEL)
19341935
/* Store */
19351936
if (esp_matter_started) {
19361937
node::store_min_unused_endpoint_id();
19371938
}
1939+
#endif // defined(CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) && defined(CONFIG_ESP_MATTE_ENABLE_DATA_MODEL)
19381940

19391941
/* Add */
19401942
_endpoint_t *previous_endpoint = NULL;

0 commit comments

Comments
 (0)