feat(Zigbee): Applied formatter + add formatter protection
As suggested by code review
This commit is contained in:
parent
42f9cfca60
commit
ff7e50482a
1 changed files with 15 additions and 7 deletions
|
|
@ -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_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_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 */
|
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.
|
* Added here as not supported by ESP Zigbee library.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
// clang-format off
|
||||||
#define ZIGBEE_DEFAULT_DIMMABLE_LIGHT_CONFIG() \
|
#define ZIGBEE_DEFAULT_DIMMABLE_LIGHT_CONFIG() \
|
||||||
{ \
|
{ \
|
||||||
.basic_cfg = \
|
.basic_cfg = \
|
||||||
|
|
@ -61,16 +63,20 @@ typedef struct zigbee_dimmable_light_cfg_s {
|
||||||
.current_level = ESP_ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_DEFAULT_VALUE, \
|
.current_level = ESP_ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_DEFAULT_VALUE, \
|
||||||
}, \
|
}, \
|
||||||
}
|
}
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
class ZigbeeDimmableLight : public ZigbeeEP {
|
class ZigbeeDimmableLight : public ZigbeeEP
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ZigbeeDimmableLight(uint8_t endpoint);
|
ZigbeeDimmableLight(uint8_t endpoint);
|
||||||
~ZigbeeDimmableLight();
|
~ZigbeeDimmableLight();
|
||||||
|
|
||||||
void onLightChange(void (*callback)(bool, uint8_t)) {
|
void onLightChange(void (*callback)(bool, uint8_t))
|
||||||
|
{
|
||||||
_on_light_change = callback;
|
_on_light_change = callback;
|
||||||
}
|
}
|
||||||
void restoreLight() {
|
void restoreLight()
|
||||||
|
{
|
||||||
lightChanged();
|
lightChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,10 +84,12 @@ public:
|
||||||
void setLightLevel(uint8_t level);
|
void setLightLevel(uint8_t level);
|
||||||
void setLight(bool state, uint8_t level);
|
void setLight(bool state, uint8_t level);
|
||||||
|
|
||||||
bool getLightState() {
|
bool getLightState()
|
||||||
|
{
|
||||||
return _current_state;
|
return _current_state;
|
||||||
}
|
}
|
||||||
uint8_t getLightLevel() {
|
uint8_t getLightLevel()
|
||||||
|
{
|
||||||
return _current_level;
|
return _current_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue