Skip to content

Commit 966ae0d

Browse files
committed
fix(matter): problems found after pressing reset
1 parent 8d6575a commit 966ae0d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: libraries/Matter/examples/MatterOnOffLight/MatterOnOffLight.ino

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ const char *ssid = "your-ssid"; // Change this to your WiFi SSID
3636
const char *password = "your-password"; // Change this to your WiFi password
3737

3838
void setup() {
39+
// Initializa the USER BUTTON (Boot button) GPIO that will act as a toggle switch
40+
pinMode(buttonPin, INPUT_PULLUP);
41+
3942
Serial.begin(115200);
4043
while (!Serial) {
4144
delay(100);
@@ -89,8 +92,6 @@ void loop() {
8992
Serial.println("Matter Node not commissioned yet. Waiting for commissioning.");
9093
}
9194
}
92-
// Initializa the USER BUTTON (Boot button) GPIO that will act as a toggle switch
93-
pinMode(buttonPin, INPUT_PULLUP);
9495
// Initialize the LED (light) GPIO and Matter End Point
9596
pinMode(ledPin, OUTPUT);
9697
Serial.printf("Initial state: %s\r\n", OnOffLight.getOnOff() ? "ON" : "OFF");

Diff for: libraries/Matter/src/Matter.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ static esp_err_t app_attribute_update_cb(
3030
{
3131
esp_err_t err = ESP_OK;
3232
MatterEndPoint *ep = (MatterEndPoint *) priv_data; // endpoint pointer to base class
33-
if (ep == NULL) {
34-
return err;
35-
}
3633
switch(type) {
3734
case PRE_UPDATE: // Callback before updating the value in the database
3835
log_i("Attribute update callback: PRE_UPDATE");
39-
err = ep->attributeChangeCB(endpoint_id, cluster_id, attribute_id, val) ? ESP_OK : ESP_FAIL;
36+
if (ep != NULL) {
37+
err = ep->attributeChangeCB(endpoint_id, cluster_id, attribute_id, val) ? ESP_OK : ESP_FAIL;
38+
}
4039
break;
4140
case POST_UPDATE: // Callback after updating the value in the database
4241
log_i("Attribute update callback: POST_UPDATE");

0 commit comments

Comments
 (0)