Skip to content

Commit a73abd7

Browse files
ci(pre-commit): Apply automatic fixes
1 parent 38f5a8e commit a73abd7

File tree

5 files changed

+116
-80
lines changed

5 files changed

+116
-80
lines changed

Diff for: libraries/Zigbee/examples/Zigbee_Window_Covering/Zigbee_Window_Covering.ino

+18-20
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
* @brief This example demonstrates Zigbee Window Covering.
1717
*
1818
* The example demonstrates how to use Zigbee library to create a end device window covering device.
19-
* The window covering is a Zigbee end device, which is moving the blinds (lift+tilt) and reporting
19+
* The window covering is a Zigbee end device, which is moving the blinds (lift+tilt) and reporting
2020
* its current position to the Zigbee network.
21-
*
21+
*
2222
* Use setCoveringType() to set the type of covering (blind, shade, etc.).
23-
*
23+
*
2424
* The example also demonstrates how to use the button to manually control the lift position.
2525
*
2626
* Proper Zigbee mode must be selected in Tools->Zigbee mode
@@ -38,15 +38,14 @@
3838
#include "ZigbeeCore.h"
3939
#include "ep/ZigbeeWindowCovering.h"
4040

41-
4241
#define ZIGBEE_COVERING_ENDPOINT 10
43-
#define BUTTON_PIN 9 // ESP32-C6/H2 Boot button
42+
#define BUTTON_PIN 9 // ESP32-C6/H2 Boot button
4443

45-
#define MAX_LIFT 200 // centimeters from open position (0-900)
46-
#define MIN_LIFT 0
44+
#define MAX_LIFT 200 // centimeters from open position (0-900)
45+
#define MIN_LIFT 0
4746

48-
#define MAX_TILT 40 // centimeters from open position (0-900)
49-
#define MIN_TILT 0
47+
#define MAX_TILT 40 // centimeters from open position (0-900)
48+
#define MIN_TILT 0
5049

5150
uint16_t currentLift = MAX_LIFT;
5251
uint8_t currentLiftPercentage = 100;
@@ -57,7 +56,7 @@ uint8_t currentTiltPercentage = 100;
5756
ZigbeeWindowCovering zbCovering = ZigbeeWindowCovering(ZIGBEE_COVERING_ENDPOINT);
5857

5958
void setup() {
60-
Serial.begin(115200);
59+
Serial.begin(115200);
6160

6261
// Init button for factory reset
6362
pinMode(BUTTON_PIN, INPUT_PULLUP);
@@ -100,7 +99,7 @@ void setup() {
10099
Serial.print(".");
101100
delay(100);
102101
}
103-
Serial.println();
102+
Serial.println();
104103

105104
// Set initial position
106105
zbCovering.setLiftPercentage(currentLiftPercentage);
@@ -124,11 +123,11 @@ void loop() {
124123
}
125124
// Manual lift controll simulation by pressing button
126125
manualControl();
127-
}
126+
}
128127
delay(500);
129128
}
130129

131-
void fullOpen(){
130+
void fullOpen() {
132131
/* This is where you would trigger your motor to go to full open state, currentLift should
133132
be updated until full open has been reached in order to provide feedback to controller of actual position
134133
The stop can be always called, so the movement can be stopped at any time */
@@ -141,7 +140,7 @@ void fullOpen(){
141140
zbCovering.setLiftPercentage(currentLiftPercentage);
142141
}
143142

144-
void fullClose(){
143+
void fullClose() {
145144
/* This is where you would trigger your motor to go to full close state, currentLift should
146145
be updated until full close has been reached in order to provide feedback to controller of actual position
147146
The stop can be always called, so the movement can be stopped at any time */
@@ -164,7 +163,7 @@ void goToLiftPercentage(uint8_t liftPercentage) {
164163
Serial.printf("New requsted lift from Zigbee: %d (%d)\n", currentLift, liftPercentage);
165164

166165
//Update the current position
167-
zbCovering.setLiftPercentage(currentLiftPercentage); //or setLiftPosition()
166+
zbCovering.setLiftPercentage(currentLiftPercentage); //or setLiftPosition()
168167
}
169168

170169
void goToTiltPercentage(uint8_t tiltPercentage) {
@@ -177,13 +176,12 @@ void goToTiltPercentage(uint8_t tiltPercentage) {
177176
Serial.printf("New requsted tilt from Zigbee: %d (%d)\n", currentTilt, tiltPercentage);
178177

179178
//Update the current position
180-
zbCovering.setTiltPercentage(currentTiltPercentage); //or setTiltPosition()
179+
zbCovering.setTiltPercentage(currentTiltPercentage); //or setTiltPosition()
181180
}
182181

183-
184182
void stopMotor() {
185183
// Motor can be stopped while moving cover toward current target, when stopped the actual position should be updated
186-
Serial.println("Stopping motor");
184+
Serial.println("Stopping motor");
187185
// Update the current position of both lift and tilt
188186
zbCovering.setLiftPercentage(currentLiftPercentage);
189187
zbCovering.setTiltPercentage(currentTiltPercentage);
@@ -192,9 +190,9 @@ void stopMotor() {
192190
void manualControl() {
193191
// Simulate lift percentage move by increasing it by 20% each time
194192
currentLiftPercentage += 20;
195-
if(currentLiftPercentage > 100) {
193+
if (currentLiftPercentage > 100) {
196194
currentLiftPercentage = 0;
197195
}
198196
zbCovering.setLiftPercentage(currentLiftPercentage);
199197
// Also setLiftPosition() can be used to set the exact position instead of percentage
200-
}
198+
}

Diff for: libraries/Zigbee/src/ZigbeeEP.h

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ class ZigbeeEP {
125125
_is_bound = true;
126126
}
127127

128-
129128
void onIdentify(void (*callback)(uint16_t)) {
130129
_on_identify = callback;
131130
}

Diff for: libraries/Zigbee/src/ZigbeeHandlers.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ static esp_err_t zb_action_handler(esp_zb_core_action_callback_id_t callback_id,
2929
case ESP_ZB_CORE_IAS_ZONE_ENROLL_RESPONSE_VALUE_CB_ID:
3030
ret = zb_cmd_ias_zone_enroll_response_handler((esp_zb_zcl_ias_zone_enroll_response_message_t *)message);
3131
break;
32-
case ESP_ZB_CORE_WINDOW_COVERING_MOVEMENT_CB_ID: ret = zb_window_covering_movement_resp_handler((esp_zb_zcl_window_covering_movement_message_t *)message); break;
32+
case ESP_ZB_CORE_WINDOW_COVERING_MOVEMENT_CB_ID:
33+
ret = zb_window_covering_movement_resp_handler((esp_zb_zcl_window_covering_movement_message_t *)message);
34+
break;
3335
case ESP_ZB_CORE_CMD_DEFAULT_RESP_CB_ID: ret = zb_cmd_default_resp_handler((esp_zb_zcl_cmd_default_resp_message_t *)message); break;
3436
default: log_w("Receive unhandled Zigbee action(0x%x) callback", callback_id); break;
3537
}

0 commit comments

Comments
 (0)