From ff7e50482a68ef55cd32c7b3b29f2143f3e0895e Mon Sep 17 00:00:00 2001 From: FaBjE <5355001+FaBjE@users.noreply.github.com> Date: Sat, 14 Dec 2024 17:57:00 +0100 Subject: [PATCH] feat(Zigbee): Applied formatter + add formatter protection As suggested by code review --- libraries/Zigbee/src/ep/ZigbeeDimmableLight.h | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h index 7e16d11b9..4c92899eb 100644 --- a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h +++ b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h @@ -15,7 +15,8 @@ * * */ -typedef struct zigbee_dimmable_light_cfg_s { +typedef struct zigbee_dimmable_light_cfg_s +{ esp_zb_basic_cluster_cfg_t basic_cfg; /*!< Basic cluster configuration, @ref esp_zb_basic_cluster_cfg_s */ esp_zb_identify_cluster_cfg_t identify_cfg; /*!< Identify cluster configuration, @ref esp_zb_identify_cluster_cfg_s */ esp_zb_groups_cluster_cfg_t groups_cfg; /*!< Groups cluster configuration, @ref esp_zb_groups_cluster_cfg_s */ @@ -29,6 +30,7 @@ typedef struct zigbee_dimmable_light_cfg_s { * Added here as not supported by ESP Zigbee library. * */ +// clang-format off #define ZIGBEE_DEFAULT_DIMMABLE_LIGHT_CONFIG() \ { \ .basic_cfg = \ @@ -61,16 +63,20 @@ typedef struct zigbee_dimmable_light_cfg_s { .current_level = ESP_ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_DEFAULT_VALUE, \ }, \ } +// clang-format on -class ZigbeeDimmableLight : public ZigbeeEP { +class ZigbeeDimmableLight : public ZigbeeEP +{ public: ZigbeeDimmableLight(uint8_t endpoint); ~ZigbeeDimmableLight(); - void onLightChange(void (*callback)(bool, uint8_t)) { + void onLightChange(void (*callback)(bool, uint8_t)) + { _on_light_change = callback; } - void restoreLight() { + void restoreLight() + { lightChanged(); } @@ -78,10 +84,12 @@ public: void setLightLevel(uint8_t level); void setLight(bool state, uint8_t level); - bool getLightState() { + bool getLightState() + { return _current_state; } - uint8_t getLightLevel() { + uint8_t getLightLevel() + { return _current_level; } @@ -108,4 +116,4 @@ private: uint8_t _current_level; }; -#endif // SOC_IEEE802154_SUPPORTED +#endif // SOC_IEEE802154_SUPPORTED