Skip to content

Commit 911a0a5

Browse files
committed
Merge branch 'fix/switch' into 'main'
components/esp-matter: Update feature checks on switch cluster and update documentation. See merge request app-frameworks/esp-matter!988
2 parents 96cb173 + dbddd5b commit 911a0a5

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

components/esp_matter/esp_matter_feature.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -2802,7 +2802,6 @@ uint32_t get_id()
28022802

28032803
esp_err_t add(cluster_t *cluster)
28042804
{
2805-
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"));
28062805
uint32_t as_feature_map = feature::action_switch::get_id();
28072806
uint32_t ms_feature_map = feature::momentary_switch::get_id();
28082807
uint32_t feature_map = get_feature_map_value(cluster);
@@ -2824,8 +2823,6 @@ uint32_t get_id()
28242823

28252824
esp_err_t add(cluster_t *cluster)
28262825
{
2827-
uint32_t momentary_and_momentart_switch_release_feature_map = feature::momentary_switch::get_id() | feature::momentary_switch_release::get_id();
2828-
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"));
28292826
uint32_t msr_feature_map = feature::momentary_switch_release::get_id();
28302827
uint32_t as_feature_map = feature::action_switch::get_id();
28312828
uint32_t ms_feature_map = feature::momentary_switch::get_id();
@@ -2850,10 +2847,7 @@ uint32_t get_id()
28502847

28512848
esp_err_t add(cluster_t *cluster, config_t *config)
28522849
{
2853-
uint32_t momentary_and_momentart_switch_release_feature_map = feature::momentary_switch::get_id() | feature::momentary_switch_release::get_id();
2854-
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"));
28552850
uint32_t as_feature_map = feature::action_switch::get_id();
2856-
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"));
28572851
uint32_t ms_feature_map = feature::momentary_switch::get_id();
28582852
uint32_t msr_feature_map = feature::momentary_switch_release::get_id();
28592853
uint32_t ms_and_msr = ms_feature_map | msr_feature_map;

components/esp_matter/esp_matter_feature.h

+8-5
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ esp_err_t add(cluster_t *cluster);
15031503

15041504
} /* momentary_switch */
15051505

1506-
// MomentarySwitchRelease feature is dependent on MomentarySwitch feature, in order to add
1506+
// MomentarySwitchRelease feature has dependency on MomentarySwitch and !ActionSwitch features, in order to add
15071507
// MomentarySwitchRelease feature one must add MomentarySwitch feature first.
15081508

15091509
namespace momentary_switch_release {
@@ -1513,8 +1513,8 @@ esp_err_t add(cluster_t *cluster);
15131513

15141514
} /* momentary_switch_release */
15151515

1516-
// MomentarySwitchRelease feature is dependent on MomentarySwitch and MomentarySwitchRelease feature, in order to add
1517-
// MomentarySwitchRelease feature one must add MomentarySwitch and MomentarySwitchRelease feature first.
1516+
// MomentarySwitchLongPress feature has dependency on MomentarySwitch and (MomentarySwitchRelease or ActionSwitch) features, in order to add
1517+
// MomentarySwitchLongPress feature one must add MomentarySwitch and (MomentarySwitchRelease or ActionSwitch) features first.
15181518

15191519
namespace momentary_switch_long_press {
15201520

@@ -1523,8 +1523,8 @@ esp_err_t add(cluster_t *cluster);
15231523

15241524
} /* momentary_switch_long_press */
15251525

1526-
// MomentarySwitchRelease feature is dependent on MomentarySwitch and MomentarySwitchRelease feature, in order to add
1527-
// MomentarySwitchRelease feature one must add MomentarySwitch and MomentarySwitchRelease feature first.
1526+
// MomentarySwitchMultiPress feature has dependency on ActionSwitch or (MomentarySwitch and MomentarySwitchRelease) features, in order to add
1527+
// MomentarySwitchMultiPress feature one must add ActionSwitch or (MomentarySwitch and MomentarySwitchRelease) features first.
15281528

15291529
namespace momentary_switch_multi_press {
15301530

@@ -1538,6 +1538,9 @@ esp_err_t add(cluster_t *cluster, config_t *config);
15381538

15391539
} /* momentary_switch_multi_press */
15401540

1541+
// ActionSwitch feature has dependency on MomentarySwitch feature, in order to add
1542+
// ActionSwitch feature one must add MomentarySwitch feature first.
1543+
15411544
namespace action_switch {
15421545

15431546
uint32_t get_id();

0 commit comments

Comments
 (0)