Skip to content

Commit 1277de9

Browse files
committed
fix(zigbee): Fix warnings of missing initializer for member
1 parent 3216b49 commit 1277de9

File tree

4 files changed

+70
-136
lines changed

4 files changed

+70
-136
lines changed

Diff for: libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp

+14-28
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,20 @@ void ZigbeeCarbonDioxideSensor::setReporting(uint16_t min_interval, uint16_t max
4545
if (delta > 0) {
4646
log_e("Delta reporting is currently not supported by the carbon dioxide sensor");
4747
}
48-
// clang-format off
49-
esp_zb_zcl_reporting_info_t reporting_info = {
50-
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV,
51-
.ep = _endpoint,
52-
.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT,
53-
.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
54-
.attr_id = ESP_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID,
55-
.u =
56-
{
57-
.send_info =
58-
{
59-
.min_interval = min_interval,
60-
.max_interval = max_interval,
61-
.delta =
62-
{
63-
.u16 = delta,
64-
},
65-
.def_min_interval = min_interval,
66-
.def_max_interval = max_interval,
67-
},
68-
},
69-
.dst =
70-
{
71-
.profile_id = ESP_ZB_AF_HA_PROFILE_ID,
72-
},
73-
.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC,
74-
};
75-
// clang-format on
48+
esp_zb_zcl_reporting_info_t reporting_info;
49+
memset(&reporting_info, 0, sizeof(esp_zb_zcl_reporting_info_t));
50+
reporting_info.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
51+
reporting_info.ep = _endpoint;
52+
reporting_info.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT;
53+
reporting_info.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
54+
reporting_info.attr_id = ESP_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID;
55+
reporting_info.u.send_info.min_interval = min_interval;
56+
reporting_info.u.send_info.max_interval = max_interval;
57+
reporting_info.u.send_info.def_min_interval = min_interval;
58+
reporting_info.u.send_info.def_max_interval = max_interval;
59+
reporting_info.u.send_info.delta.u16 = delta;
60+
reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID;
61+
reporting_info.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC;
7662
esp_zb_lock_acquire(portMAX_DELAY);
7763
esp_zb_zcl_update_reporting_info(&reporting_info);
7864
esp_zb_lock_release();

Diff for: libraries/Zigbee/src/ep/ZigbeeFlowSensor.cpp

+14-28
Original file line numberDiff line numberDiff line change
@@ -41,34 +41,20 @@ void ZigbeeFlowSensor::setTolerance(float tolerance) {
4141
}
4242

4343
void ZigbeeFlowSensor::setReporting(uint16_t min_interval, uint16_t max_interval, float delta) {
44-
// clang-format off
45-
esp_zb_zcl_reporting_info_t reporting_info = {
46-
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV,
47-
.ep = _endpoint,
48-
.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_FLOW_MEASUREMENT,
49-
.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
50-
.attr_id = ESP_ZB_ZCL_ATTR_FLOW_MEASUREMENT_VALUE_ID,
51-
.u =
52-
{
53-
.send_info =
54-
{
55-
.min_interval = min_interval,
56-
.max_interval = max_interval,
57-
.delta =
58-
{
59-
.u16 = (uint16_t)(delta * 10), // Convert delta to ZCL uint16_t
60-
},
61-
.def_min_interval = min_interval,
62-
.def_max_interval = max_interval,
63-
},
64-
},
65-
.dst =
66-
{
67-
.profile_id = ESP_ZB_AF_HA_PROFILE_ID,
68-
},
69-
.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC,
70-
};
71-
// clang-format on
44+
esp_zb_zcl_reporting_info_t reporting_info;
45+
memset(&reporting_info, 0, sizeof(esp_zb_zcl_reporting_info_t));
46+
reporting_info.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
47+
reporting_info.ep = _endpoint;
48+
reporting_info.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_FLOW_MEASUREMENT;
49+
reporting_info.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
50+
reporting_info.attr_id = ESP_ZB_ZCL_ATTR_FLOW_MEASUREMENT_VALUE_ID;
51+
reporting_info.u.send_info.min_interval = min_interval;
52+
reporting_info.u.send_info.max_interval = max_interval;
53+
reporting_info.u.send_info.def_min_interval = min_interval;
54+
reporting_info.u.send_info.def_max_interval = max_interval;
55+
reporting_info.u.send_info.delta.u16 = (uint16_t)(delta * 10); // Convert delta to ZCL uint16_t
56+
reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID;
57+
reporting_info.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC;
7258
esp_zb_lock_acquire(portMAX_DELAY);
7359
esp_zb_zcl_update_reporting_info(&reporting_info);
7460
esp_zb_lock_release();

Diff for: libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp

+14-28
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,20 @@ void ZigbeePressureSensor::setTolerance(uint16_t tolerance) {
3838
}
3939

4040
void ZigbeePressureSensor::setReporting(uint16_t min_interval, uint16_t max_interval, uint16_t delta) {
41-
// clang-format off
42-
esp_zb_zcl_reporting_info_t reporting_info = {
43-
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV,
44-
.ep = _endpoint,
45-
.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_PRESSURE_MEASUREMENT,
46-
.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
47-
.attr_id = ESP_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_VALUE_ID,
48-
.u =
49-
{
50-
.send_info =
51-
{
52-
.min_interval = min_interval,
53-
.max_interval = max_interval,
54-
.delta =
55-
{
56-
.u16 = delta, // x hPa
57-
},
58-
.def_min_interval = min_interval,
59-
.def_max_interval = max_interval,
60-
},
61-
},
62-
.dst =
63-
{
64-
.profile_id = ESP_ZB_AF_HA_PROFILE_ID,
65-
},
66-
.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC,
67-
};
68-
// clang-format on
41+
esp_zb_zcl_reporting_info_t reporting_info;
42+
memset(&reporting_info, 0, sizeof(esp_zb_zcl_reporting_info_t));
43+
reporting_info.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
44+
reporting_info.ep = _endpoint;
45+
reporting_info.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_PRESSURE_MEASUREMENT;
46+
reporting_info.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
47+
reporting_info.attr_id = ESP_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_VALUE_ID;
48+
reporting_info.u.send_info.min_interval = min_interval;
49+
reporting_info.u.send_info.max_interval = max_interval;
50+
reporting_info.u.send_info.def_min_interval = min_interval;
51+
reporting_info.u.send_info.def_max_interval = max_interval;
52+
reporting_info.u.send_info.delta.u16 = delta; // x hPa
53+
reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID;
54+
reporting_info.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC;
6955
esp_zb_lock_acquire(portMAX_DELAY);
7056
esp_zb_zcl_update_reporting_info(&reporting_info);
7157
esp_zb_lock_release();

Diff for: libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp

+28-52
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,20 @@ void ZigbeeTempSensor::setTolerance(float tolerance) {
3535
}
3636

3737
void ZigbeeTempSensor::setReporting(uint16_t min_interval, uint16_t max_interval, float delta) {
38-
esp_zb_zcl_reporting_info_t reporting_info = {
39-
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV,
40-
.ep = _endpoint,
41-
.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT,
42-
.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
43-
.attr_id = ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID,
44-
.u =
45-
{
46-
.send_info =
47-
{
48-
.min_interval = min_interval,
49-
.max_interval = max_interval,
50-
.delta =
51-
{
52-
.u16 = (uint16_t)(delta * 100), // Convert delta to ZCL uint16_t
53-
},
54-
.def_min_interval = min_interval,
55-
.def_max_interval = max_interval,
56-
},
57-
},
58-
.dst =
59-
{
60-
.profile_id = ESP_ZB_AF_HA_PROFILE_ID,
61-
},
62-
.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC,
63-
};
38+
esp_zb_zcl_reporting_info_t reporting_info;
39+
memset(&reporting_info, 0, sizeof(esp_zb_zcl_reporting_info_t));
40+
reporting_info.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
41+
reporting_info.ep = _endpoint;
42+
reporting_info.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT;
43+
reporting_info.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
44+
reporting_info.attr_id = ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID;
45+
reporting_info.u.send_info.min_interval = min_interval;
46+
reporting_info.u.send_info.max_interval = max_interval;
47+
reporting_info.u.send_info.def_min_interval = min_interval;
48+
reporting_info.u.send_info.def_max_interval = max_interval;
49+
reporting_info.u.send_info.delta.u16 = (uint16_t)(delta * 100); // Convert delta to ZCL uint16_t
50+
reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID;
51+
reporting_info.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC,
6452
esp_zb_lock_acquire(portMAX_DELAY);
6553
esp_zb_zcl_update_reporting_info(&reporting_info);
6654
esp_zb_lock_release();
@@ -136,32 +124,20 @@ void ZigbeeTempSensor::reportHumidity() {
136124
}
137125

138126
void ZigbeeTempSensor::setHumidityReporting(uint16_t min_interval, uint16_t max_interval, float delta) {
139-
esp_zb_zcl_reporting_info_t reporting_info = {
140-
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV,
141-
.ep = _endpoint,
142-
.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_REL_HUMIDITY_MEASUREMENT,
143-
.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
144-
.attr_id = ESP_ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_ID,
145-
.u =
146-
{
147-
.send_info =
148-
{
149-
.min_interval = min_interval,
150-
.max_interval = max_interval,
151-
.delta =
152-
{
153-
.u16 = (uint16_t)(delta * 100), // Convert delta to ZCL uint16_t
154-
},
155-
.def_min_interval = min_interval,
156-
.def_max_interval = max_interval,
157-
},
158-
},
159-
.dst =
160-
{
161-
.profile_id = ESP_ZB_AF_HA_PROFILE_ID,
162-
},
163-
.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC,
164-
};
127+
esp_zb_zcl_reporting_info_t reporting_info;
128+
memset(&reporting_info, 0, sizeof(esp_zb_zcl_reporting_info_t));
129+
reporting_info.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
130+
reporting_info.ep = _endpoint;
131+
reporting_info.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_REL_HUMIDITY_MEASUREMENT;
132+
reporting_info.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
133+
reporting_info.attr_id = ESP_ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_ID;
134+
reporting_info.u.send_info.min_interval = min_interval;
135+
reporting_info.u.send_info.max_interval = max_interval;
136+
reporting_info.u.send_info.def_min_interval = min_interval;
137+
reporting_info.u.send_info.def_max_interval = max_interval;
138+
reporting_info.u.send_info.delta.u16 = (uint16_t)(delta * 100); // Convert delta to ZCL uint16_t
139+
reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID;
140+
reporting_info.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC;
165141
esp_zb_lock_acquire(portMAX_DELAY);
166142
esp_zb_zcl_update_reporting_info(&reporting_info);
167143
esp_zb_lock_release();

0 commit comments

Comments
 (0)