From dbddd5bb51a7b1d977ab0117036f2732eb40b737 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav Date: Fri, 20 Dec 2024 12:02:11 +0530 Subject: [PATCH] components/esp-matter: Update feature checks on switch cluster and update documentation. --- components/esp_matter/esp_matter_feature.cpp | 6 ------ components/esp_matter/esp_matter_feature.h | 13 ++++++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/components/esp_matter/esp_matter_feature.cpp b/components/esp_matter/esp_matter_feature.cpp index d6d706465..98e81ec17 100644 --- a/components/esp_matter/esp_matter_feature.cpp +++ b/components/esp_matter/esp_matter_feature.cpp @@ -2802,7 +2802,6 @@ uint32_t get_id() esp_err_t add(cluster_t *cluster) { - VerifyOrReturnError((get_feature_map_value(cluster) & feature::momentary_switch::get_id()) == feature::momentary_switch::get_id(), ESP_ERR_NOT_SUPPORTED, ESP_LOGE(TAG, "Momentary switch release is not supported because momentary is absent")); uint32_t as_feature_map = feature::action_switch::get_id(); uint32_t ms_feature_map = feature::momentary_switch::get_id(); uint32_t feature_map = get_feature_map_value(cluster); @@ -2824,8 +2823,6 @@ uint32_t get_id() esp_err_t add(cluster_t *cluster) { - uint32_t momentary_and_momentart_switch_release_feature_map = feature::momentary_switch::get_id() | feature::momentary_switch_release::get_id(); - VerifyOrReturnError((get_feature_map_value(cluster) & momentary_and_momentart_switch_release_feature_map) == momentary_and_momentart_switch_release_feature_map, ESP_ERR_NOT_SUPPORTED, ESP_LOGE(TAG, "Momentary switch long press is not supported because momentary switch and/or momentary switch release is absent")); uint32_t msr_feature_map = feature::momentary_switch_release::get_id(); uint32_t as_feature_map = feature::action_switch::get_id(); uint32_t ms_feature_map = feature::momentary_switch::get_id(); @@ -2850,10 +2847,7 @@ uint32_t get_id() esp_err_t add(cluster_t *cluster, config_t *config) { - uint32_t momentary_and_momentart_switch_release_feature_map = feature::momentary_switch::get_id() | feature::momentary_switch_release::get_id(); - VerifyOrReturnError((get_feature_map_value(cluster) & momentary_and_momentart_switch_release_feature_map) == momentary_and_momentart_switch_release_feature_map, ESP_ERR_NOT_SUPPORTED, ESP_LOGE(TAG, "Momentary switch multi press is not supported because momentary switch and/or momentary switch releaseis absent")); uint32_t as_feature_map = feature::action_switch::get_id(); - VerifyOrReturnError((get_feature_map_value(cluster) & as_feature_map) != as_feature_map, ESP_ERR_NOT_SUPPORTED, ESP_LOGE(TAG, "Momentary switch multi press is not supported because action switch is absent")); uint32_t ms_feature_map = feature::momentary_switch::get_id(); uint32_t msr_feature_map = feature::momentary_switch_release::get_id(); uint32_t ms_and_msr = ms_feature_map | msr_feature_map; diff --git a/components/esp_matter/esp_matter_feature.h b/components/esp_matter/esp_matter_feature.h index d483162ad..5094b480e 100644 --- a/components/esp_matter/esp_matter_feature.h +++ b/components/esp_matter/esp_matter_feature.h @@ -1503,7 +1503,7 @@ esp_err_t add(cluster_t *cluster); } /* momentary_switch */ -// MomentarySwitchRelease feature is dependent on MomentarySwitch feature, in order to add +// MomentarySwitchRelease feature has dependency on MomentarySwitch and !ActionSwitch features, in order to add // MomentarySwitchRelease feature one must add MomentarySwitch feature first. namespace momentary_switch_release { @@ -1513,8 +1513,8 @@ esp_err_t add(cluster_t *cluster); } /* momentary_switch_release */ -// MomentarySwitchRelease feature is dependent on MomentarySwitch and MomentarySwitchRelease feature, in order to add -// MomentarySwitchRelease feature one must add MomentarySwitch and MomentarySwitchRelease feature first. +// MomentarySwitchLongPress feature has dependency on MomentarySwitch and (MomentarySwitchRelease or ActionSwitch) features, in order to add +// MomentarySwitchLongPress feature one must add MomentarySwitch and (MomentarySwitchRelease or ActionSwitch) features first. namespace momentary_switch_long_press { @@ -1523,8 +1523,8 @@ esp_err_t add(cluster_t *cluster); } /* momentary_switch_long_press */ -// MomentarySwitchRelease feature is dependent on MomentarySwitch and MomentarySwitchRelease feature, in order to add -// MomentarySwitchRelease feature one must add MomentarySwitch and MomentarySwitchRelease feature first. +// MomentarySwitchMultiPress feature has dependency on ActionSwitch or (MomentarySwitch and MomentarySwitchRelease) features, in order to add +// MomentarySwitchMultiPress feature one must add ActionSwitch or (MomentarySwitch and MomentarySwitchRelease) features first. namespace momentary_switch_multi_press { @@ -1538,6 +1538,9 @@ esp_err_t add(cluster_t *cluster, config_t *config); } /* momentary_switch_multi_press */ +// ActionSwitch feature has dependency on MomentarySwitch feature, in order to add +// ActionSwitch feature one must add MomentarySwitch feature first. + namespace action_switch { uint32_t get_id();