mirror of
https://github.com/esphome/esphome.git
synced 2026-05-29 06:27:24 +08:00
[zigbee] Fix init-order and missing-field warnings on native ESP-IDF (#16389)
This commit is contained in:
@@ -32,10 +32,9 @@ void ZigbeeAttribute::report_(bool has_lock) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (has_lock or esp_zb_lock_acquire(10 / portTICK_PERIOD_MS)) {
|
if (has_lock or esp_zb_lock_acquire(10 / portTICK_PERIOD_MS)) {
|
||||||
esp_zb_zcl_report_attr_cmd_t cmd = {
|
esp_zb_zcl_report_attr_cmd_t cmd = {};
|
||||||
.address_mode = ESP_ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
|
cmd.address_mode = ESP_ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
|
||||||
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI,
|
cmd.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI;
|
||||||
};
|
|
||||||
cmd.zcl_basic_cmd.dst_addr_u.addr_short = 0x0000;
|
cmd.zcl_basic_cmd.dst_addr_u.addr_short = 0x0000;
|
||||||
cmd.zcl_basic_cmd.dst_endpoint = 1;
|
cmd.zcl_basic_cmd.dst_endpoint = 1;
|
||||||
cmd.zcl_basic_cmd.src_endpoint = this->endpoint_id_;
|
cmd.zcl_basic_cmd.src_endpoint = this->endpoint_id_;
|
||||||
@@ -50,14 +49,13 @@ void ZigbeeAttribute::report_(bool has_lock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp_zb_zcl_reporting_info_t ZigbeeAttribute::get_reporting_info() {
|
esp_zb_zcl_reporting_info_t ZigbeeAttribute::get_reporting_info() {
|
||||||
esp_zb_zcl_reporting_info_t reporting_info = {
|
esp_zb_zcl_reporting_info_t reporting_info = {};
|
||||||
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV,
|
reporting_info.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
|
||||||
.ep = this->endpoint_id_,
|
reporting_info.ep = this->endpoint_id_;
|
||||||
.cluster_id = this->cluster_id_,
|
reporting_info.cluster_id = this->cluster_id_;
|
||||||
.cluster_role = this->role_,
|
reporting_info.cluster_role = this->role_;
|
||||||
.attr_id = this->attr_id_,
|
reporting_info.attr_id = this->attr_id_;
|
||||||
.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC,
|
reporting_info.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC;
|
||||||
};
|
|
||||||
reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID;
|
reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID;
|
||||||
reporting_info.u.send_info.min_interval = 10; /*!< Actual minimum reporting interval */
|
reporting_info.u.send_info.min_interval = 10; /*!< Actual minimum reporting interval */
|
||||||
reporting_info.u.send_info.max_interval = 0; /*!< Actual maximum reporting interval */
|
reporting_info.u.send_info.max_interval = 0; /*!< Actual maximum reporting interval */
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ class ZigbeeAttribute : public Component {
|
|||||||
role_(role),
|
role_(role),
|
||||||
attr_id_(attr_id),
|
attr_id_(attr_id),
|
||||||
attr_type_(attr_type),
|
attr_type_(attr_type),
|
||||||
scale_(scale),
|
max_size_(max_size),
|
||||||
max_size_(max_size) {}
|
scale_(scale) {}
|
||||||
void loop() override;
|
void loop() override;
|
||||||
template<typename T> void add_attr(T value);
|
template<typename T> void add_attr(T value);
|
||||||
esp_zb_zcl_reporting_info_t get_reporting_info();
|
esp_zb_zcl_reporting_info_t get_reporting_info();
|
||||||
|
|||||||
@@ -204,10 +204,9 @@ static void esp_zb_task_(void *pvParameters) {
|
|||||||
|
|
||||||
void ZigbeeComponent::setup() {
|
void ZigbeeComponent::setup() {
|
||||||
global_zigbee = this;
|
global_zigbee = this;
|
||||||
esp_zb_platform_config_t config = {
|
esp_zb_platform_config_t config = {};
|
||||||
.radio_config = ESP_ZB_DEFAULT_RADIO_CONFIG(),
|
config.radio_config = ESP_ZB_DEFAULT_RADIO_CONFIG();
|
||||||
.host_config = ESP_ZB_DEFAULT_HOST_CONFIG(),
|
config.host_config = ESP_ZB_DEFAULT_HOST_CONFIG();
|
||||||
};
|
|
||||||
#ifdef USE_WIFI
|
#ifdef USE_WIFI
|
||||||
if (esp_coex_wifi_i154_enable() != ESP_OK) {
|
if (esp_coex_wifi_i154_enable() != ESP_OK) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
|||||||
Reference in New Issue
Block a user