23
23
* and also the correct partition scheme must be selected in Tools->Partition Scheme.
24
24
*
25
25
* Please check the README.md for instructions and more detailed description.
26
- *
26
+ *
27
27
* Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/)
28
28
*/
29
29
@@ -94,7 +94,7 @@ static void enableGpioInterrupt(bool enabled) {
94
94
95
95
/* ******************** Arduino functions **************************/
96
96
void setup () {
97
-
97
+
98
98
Serial.begin (115200 );
99
99
while (!Serial) {
100
100
delay (10 );
@@ -112,7 +112,7 @@ void setup() {
112
112
113
113
// Open network for 180 seconds after boot
114
114
Zigbee.setRebootOpenNetwork (180 );
115
-
115
+
116
116
// Init button switch
117
117
for (int i = 0 ; i < PAIR_SIZE (buttonFunctionPair); i++) {
118
118
pinMode (buttonFunctionPair[i].pin , INPUT_PULLUP);
@@ -128,21 +128,23 @@ void setup() {
128
128
// When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR mode
129
129
log_d (" Calling Zigbee.begin()" );
130
130
Zigbee.begin (ZIGBEE_COORDINATOR);
131
-
131
+
132
132
Serial.println (" Waiting for Light to bound to the switch" );
133
133
// Wait for switch to bound to a light:
134
- while (!zbSwitch.isBound ())
135
- {
134
+ while (!zbSwitch.isBound ()) {
136
135
Serial.printf (" ." );
137
136
delay (500 );
138
137
}
139
138
140
139
// Optional: read manufacturer and model name from the bound light
141
- std::list<zb_device_params_t *> boundLights = zbSwitch.getBoundDevices ();
140
+ std::list<zb_device_params_t *> boundLights = zbSwitch.getBoundDevices ();
142
141
// List all bound lights
143
- for (const auto & device : boundLights) {
142
+ for (const auto & device : boundLights) {
144
143
Serial.printf (" Device on endpoint %d, short address: 0x%x\n " , device->endpoint , device->short_addr );
145
- Serial.printf (" IEEE Address: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n " , device->ieee_addr [0 ], device->ieee_addr [1 ], device->ieee_addr [2 ], device->ieee_addr [3 ], device->ieee_addr [4 ], device->ieee_addr [5 ], device->ieee_addr [6 ], device->ieee_addr [7 ]);
144
+ Serial.printf (
145
+ " IEEE Address: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n " , device->ieee_addr [0 ], device->ieee_addr [1 ], device->ieee_addr [2 ], device->ieee_addr [3 ],
146
+ device->ieee_addr [4 ], device->ieee_addr [5 ], device->ieee_addr [6 ], device->ieee_addr [7 ]
147
+ );
146
148
Serial.printf (" Light manufacturer: %s" , zbSwitch.readManufacturer (device->endpoint , device->short_addr ));
147
149
Serial.printf (" Light model: %s" , zbSwitch.readModel (device->endpoint , device->short_addr ));
148
150
}
@@ -156,7 +158,6 @@ void loop() {
156
158
SwitchData buttonSwitch;
157
159
static SwitchState buttonState = SWITCH_IDLE;
158
160
bool eventFlag = false ;
159
-
160
161
161
162
/* check if there is any queue received, if yes read out the buttonSwitch */
162
163
if (xQueueReceive (gpio_evt_queue, &buttonSwitch, portMAX_DELAY)) {
0 commit comments