Skip to content

Commit fa7d6a4

Browse files
ci(pre-commit): Apply automatic fixes
1 parent 68e253f commit fa7d6a4

File tree

3 files changed

+49
-51
lines changed

3 files changed

+49
-51
lines changed

libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#include "Zigbee.h"
3434

35-
#define USE_GLOBAL_ON_RESPONSE_CALLBACK 1 // Set to 0 to use local callback specified directly for the endpoint.
35+
#define USE_GLOBAL_ON_RESPONSE_CALLBACK 1 // Set to 0 to use local callback specified directly for the endpoint.
3636

3737
/* Zigbee temperature + humidity sensor configuration */
3838
#define TEMP_SENSOR_ENDPOINT_NUMBER 10
@@ -45,29 +45,29 @@ uint8_t button = BOOT_PIN;
4545

4646
ZigbeeTempSensor zbTempSensor = ZigbeeTempSensor(TEMP_SENSOR_ENDPOINT_NUMBER);
4747

48-
uint8_t dataToSend = 2; // Temperature and humidity values are reported in same endpoint, so 2 values are reported
49-
bool resend = false;
48+
uint8_t dataToSend = 2; // Temperature and humidity values are reported in same endpoint, so 2 values are reported
49+
bool resend = false;
5050

5151
/************************ Callbacks *****************************/
5252
#if USE_GLOBAL_ON_RESPONSE_CALLBACK
53-
void onGlobalResponse(zb_cmd_type_t command, esp_zb_zcl_status_t status, uint8_t endpoint, uint16_t cluster){
54-
Serial.printf("Global response command: %d, status: %s, endpoint: %d, cluster: 0x%04x\r\n", command, esp_zb_zcl_status_to_name(status), endpoint, cluster);
55-
if((command == ZB_CMD_REPORT_ATTRIBUTE) && (endpoint == TEMP_SENSOR_ENDPOINT_NUMBER)){
56-
switch (status){
53+
void onGlobalResponse(zb_cmd_type_t command, esp_zb_zcl_status_t status, uint8_t endpoint, uint16_t cluster) {
54+
Serial.printf("Global response command: %d, status: %s, endpoint: %d, cluster: 0x%04x\r\n", command, esp_zb_zcl_status_to_name(status), endpoint, cluster);
55+
if ((command == ZB_CMD_REPORT_ATTRIBUTE) && (endpoint == TEMP_SENSOR_ENDPOINT_NUMBER)) {
56+
switch (status) {
5757
case ESP_ZB_ZCL_STATUS_SUCCESS: dataToSend--; break;
58-
case ESP_ZB_ZCL_STATUS_FAIL: resend = true; break;
59-
default: break;// add more statuses like ESP_ZB_ZCL_STATUS_INVALID_VALUE, ESP_ZB_ZCL_STATUS_TIMEOUT etc.
58+
case ESP_ZB_ZCL_STATUS_FAIL: resend = true; break;
59+
default: break; // add more statuses like ESP_ZB_ZCL_STATUS_INVALID_VALUE, ESP_ZB_ZCL_STATUS_TIMEOUT etc.
6060
}
6161
}
6262
}
6363
#else
64-
void onResponse(zb_cmd_type_t command, esp_zb_zcl_status_t status){
64+
void onResponse(zb_cmd_type_t command, esp_zb_zcl_status_t status) {
6565
Serial.printf("Response command: %d, status: %s\r\n", command, esp_zb_zcl_status_to_name(status));
66-
if(command == ZB_CMD_REPORT_ATTRIBUTE){
67-
switch (status){
66+
if (command == ZB_CMD_REPORT_ATTRIBUTE) {
67+
switch (status) {
6868
case ESP_ZB_ZCL_STATUS_SUCCESS: dataToSend--; break;
69-
case ESP_ZB_ZCL_STATUS_FAIL: resend = true; break;
70-
default: break;// add more statuses like ESP_ZB_ZCL_STATUS_INVALID_VALUE, ESP_ZB_ZCL_STATUS_TIMEOUT etc.
69+
case ESP_ZB_ZCL_STATUS_FAIL: resend = true; break;
70+
default: break; // add more statuses like ESP_ZB_ZCL_STATUS_INVALID_VALUE, ESP_ZB_ZCL_STATUS_TIMEOUT etc.
7171
}
7272
}
7373
}
@@ -85,29 +85,28 @@ static void meausureAndSleep(void *arg) {
8585
zbTempSensor.setTemperature(temperature);
8686
zbTempSensor.setHumidity(humidity);
8787

88-
8988
// Report temperature and humidity values
90-
zbTempSensor.report(); // reports temperature and humidity values (if humidity sensor is not added, only temperature is reported)
89+
zbTempSensor.report(); // reports temperature and humidity values (if humidity sensor is not added, only temperature is reported)
9190
Serial.printf("Reported temperature: %.2f°C, Humidity: %.2f%%\r\n", temperature, humidity);
9291

9392
unsigned long startTime = millis();
9493
const unsigned long timeout = REPORT_TIMEOUT;
9594

9695
Serial.printf("Waiting for data report to be confirmed \r\n");
9796
// Wait until data was succesfully sent
98-
while(dataToSend != 0){
99-
if(resend){
100-
Serial.println("Resending data on failure!");
101-
resend = false;
102-
dataToSend = 2;
103-
zbTempSensor.report(); // report again
97+
while (dataToSend != 0) {
98+
if (resend) {
99+
Serial.println("Resending data on failure!");
100+
resend = false;
101+
dataToSend = 2;
102+
zbTempSensor.report(); // report again
104103
}
105104
if (millis() - startTime >= timeout) {
106105
Serial.println("Report timeout!");
107106
break;
108107
}
109108
Serial.printf(".");
110-
delay(50); // 50ms delay to avoid busy-waiting
109+
delay(50); // 50ms delay to avoid busy-waiting
111110
}
112111

113112
// Put device to deep sleep after data was sent successfully or timeout
@@ -176,8 +175,8 @@ void setup() {
176175
Serial.println();
177176
Serial.println("Successfully connected to Zigbee network");
178177

179-
// Start Temperature sensor reading task
180-
xTaskCreate(meausureAndSleep, "temp_sensor_update", 2048, NULL, 10, NULL);
178+
// Start Temperature sensor reading task
179+
xTaskCreate(meausureAndSleep, "temp_sensor_update", 2048, NULL, 10, NULL);
181180
}
182181

183182
void loop() {

libraries/Zigbee/src/ZigbeeEP.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class ZigbeeEP {
141141
virtual void zbReadTimeCluster(const esp_zb_zcl_attribute_t *attribute); //already implemented
142142
virtual void zbIASZoneStatusChangeNotification(const esp_zb_zcl_ias_zone_status_change_notification_message_t *message) {};
143143
virtual void zbIASZoneEnrollResponse(const esp_zb_zcl_ias_zone_enroll_response_message_t *message) {};
144-
virtual void zbDefaultResponse(const esp_zb_zcl_cmd_default_resp_message_t *message); //already implemented
144+
virtual void zbDefaultResponse(const esp_zb_zcl_cmd_default_resp_message_t *message); //already implemented
145145

146146
virtual void addBoundDevice(zb_device_params_t *device) {
147147
_bound_devices.push_back(device);
@@ -165,7 +165,7 @@ class ZigbeeEP {
165165
}
166166

167167
// Convert ZCL status to name
168-
168+
169169
private:
170170
char *_read_manufacturer;
171171
char *_read_model;
@@ -175,7 +175,6 @@ class ZigbeeEP {
175175
int32_t _read_timezone;
176176

177177
protected:
178-
179178
uint8_t _endpoint;
180179
esp_zb_ha_standard_devices_t _device_id;
181180
esp_zb_endpoint_config_t _ep_config;

libraries/Zigbee/src/ZigbeeTypes.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44

55
// Foundation Command Types
66
typedef enum {
7-
ZB_CMD_READ_ATTRIBUTE = 0x00U, /*!< Read attributes command */
8-
ZB_CMD_READ_ATTRIBUTE_RESPONSE = 0x01U, /*!< Read attributes response command */
9-
ZB_CMD_WRITE_ATTRIBUTE = 0x02U, /*!< Write attributes foundation command */
10-
ZB_CMD_WRITE_ATTRIBUTE_UNDIVIDED = 0x03U, /*!< Write attributes undivided command */
11-
ZB_CMD_WRITE_ATTRIBUTE_RESPONSE = 0x04U, /*!< Write attributes response command */
12-
ZB_CMD_WRITE_ATTRIBUTE_NO_RESPONSE = 0x05U, /*!< Write attributes no response command */
13-
ZB_CMD_CONFIGURE_REPORTING = 0x06U, /*!< Configure reporting command */
14-
ZB_CMD_CONFIGURE_REPORTING_RESPONSE = 0x07U, /*!< Configure reporting response command */
15-
ZB_CMD_READ_REPORTING_CONFIG = 0x08U, /*!< Read reporting config command */
16-
ZB_CMD_READ_REPORTING_CONFIG_RESPONSE= 0x09U, /*!< Read reporting config response command */
17-
ZB_CMD_REPORT_ATTRIBUTE = 0x0aU, /*!< Report attribute command */
18-
ZB_CMD_DEFAULT_RESPONSE = 0x0bU, /*!< Default response command */
19-
ZB_CMD_DISCOVER_ATTRIBUTES = 0x0cU, /*!< Discover attributes command */
20-
ZB_CMD_DISCOVER_ATTRIBUTES_RESPONSE = 0x0dU, /*!< Discover attributes response command */
21-
ZB_CMD_READ_ATTRIBUTE_STRUCTURED = 0x0eU, /*!< Read attributes structured */
22-
ZB_CMD_WRITE_ATTRIBUTE_STRUCTURED = 0x0fU, /*!< Write attributes structured */
23-
ZB_CMD_WRITE_ATTRIBUTE_STRUCTURED_RESPONSE = 0x10U, /*!< Write attributes structured response */
24-
ZB_CMD_DISCOVER_COMMANDS_RECEIVED = 0x11U, /*!< Discover Commands Received command */
25-
ZB_CMD_DISCOVER_COMMANDS_RECEIVED_RESPONSE = 0x12U, /*!< Discover Commands Received response command */
26-
ZB_CMD_DISCOVER_COMMANDS_GENERATED = 0x13U, /*!< Discover Commands Generated command */
27-
ZB_CMD_DISCOVER_COMMANDS_GENERATED_RESPONSE = 0x14U, /*!< Discover Commands Generated response command */
28-
ZB_CMD_DISCOVER_ATTRIBUTES_EXTENDED = 0x15U, /*!< Discover attributes extended command */
7+
ZB_CMD_READ_ATTRIBUTE = 0x00U, /*!< Read attributes command */
8+
ZB_CMD_READ_ATTRIBUTE_RESPONSE = 0x01U, /*!< Read attributes response command */
9+
ZB_CMD_WRITE_ATTRIBUTE = 0x02U, /*!< Write attributes foundation command */
10+
ZB_CMD_WRITE_ATTRIBUTE_UNDIVIDED = 0x03U, /*!< Write attributes undivided command */
11+
ZB_CMD_WRITE_ATTRIBUTE_RESPONSE = 0x04U, /*!< Write attributes response command */
12+
ZB_CMD_WRITE_ATTRIBUTE_NO_RESPONSE = 0x05U, /*!< Write attributes no response command */
13+
ZB_CMD_CONFIGURE_REPORTING = 0x06U, /*!< Configure reporting command */
14+
ZB_CMD_CONFIGURE_REPORTING_RESPONSE = 0x07U, /*!< Configure reporting response command */
15+
ZB_CMD_READ_REPORTING_CONFIG = 0x08U, /*!< Read reporting config command */
16+
ZB_CMD_READ_REPORTING_CONFIG_RESPONSE = 0x09U, /*!< Read reporting config response command */
17+
ZB_CMD_REPORT_ATTRIBUTE = 0x0aU, /*!< Report attribute command */
18+
ZB_CMD_DEFAULT_RESPONSE = 0x0bU, /*!< Default response command */
19+
ZB_CMD_DISCOVER_ATTRIBUTES = 0x0cU, /*!< Discover attributes command */
20+
ZB_CMD_DISCOVER_ATTRIBUTES_RESPONSE = 0x0dU, /*!< Discover attributes response command */
21+
ZB_CMD_READ_ATTRIBUTE_STRUCTURED = 0x0eU, /*!< Read attributes structured */
22+
ZB_CMD_WRITE_ATTRIBUTE_STRUCTURED = 0x0fU, /*!< Write attributes structured */
23+
ZB_CMD_WRITE_ATTRIBUTE_STRUCTURED_RESPONSE = 0x10U, /*!< Write attributes structured response */
24+
ZB_CMD_DISCOVER_COMMANDS_RECEIVED = 0x11U, /*!< Discover Commands Received command */
25+
ZB_CMD_DISCOVER_COMMANDS_RECEIVED_RESPONSE = 0x12U, /*!< Discover Commands Received response command */
26+
ZB_CMD_DISCOVER_COMMANDS_GENERATED = 0x13U, /*!< Discover Commands Generated command */
27+
ZB_CMD_DISCOVER_COMMANDS_GENERATED_RESPONSE = 0x14U, /*!< Discover Commands Generated response command */
28+
ZB_CMD_DISCOVER_ATTRIBUTES_EXTENDED = 0x15U, /*!< Discover attributes extended command */
2929
ZB_CMD_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE = 0x16U, /*!< Discover attributes extended response command */
30-
} zb_cmd_type_t;
30+
} zb_cmd_type_t;

0 commit comments

Comments
 (0)