Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 30e55fc

Browse filesBrowse files
authored
Merge pull request espressif#10732 from SuGlider/matter_while_serial
feat(matter): General Review - remove while(!serial) ipv6(enable) and fixes some commentaries in the code
2 parents 1ef1e7d + 43c419e commit 30e55fc
Copy full SHA for 30e55fc
Expand file treeCollapse file tree

37 files changed

+153
-185
lines changed

‎libraries/Matter/examples/MatterColorLight/MatterColorLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterColorLight/MatterColorLight.ino
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Color Light Endpoint
2222
MatterColorLight ColorLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff & HSV Color state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -43,10 +47,6 @@ bool button_state = false; // false = released | true = pres
4347
const uint32_t debouceTime = 250; // button debouncing time (ms)
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

46-
// WiFi is manually set and started
47-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
48-
const char *password = "your-password"; // Change this to your WiFi password
49-
5050
// Set the RGB LED Light based on the current state of the Color Light
5151
bool setLightState(bool state, espHsvColor_t colorHSV) {
5252

@@ -76,15 +76,10 @@ void setup() {
7676
pinMode(ledPin, OUTPUT);
7777

7878
Serial.begin(115200);
79-
while (!Serial) {
80-
delay(100);
81-
}
8279

8380
// We start by connecting to a WiFi network
8481
Serial.print("Connecting to ");
8582
Serial.println(ssid);
86-
// enable IPv6
87-
WiFi.enableIPv6(true);
8883
// Manually connect to WiFi
8984
WiFi.begin(ssid, password);
9085
// Wait for connection

‎libraries/Matter/examples/MatterCommissionTest/MatterCommissionTest.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterCommissionTest/MatterCommissionTest.ino
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,10 @@ const char *password = "your-password"; // Change this to your WiFi password
2626

2727
void setup() {
2828
Serial.begin(115200);
29-
while (!Serial) {
30-
delay(100);
31-
}
3229

3330
// We start by connecting to a WiFi network
3431
Serial.print("Connecting to ");
3532
Serial.println(ssid);
36-
// enable IPv6
37-
WiFi.enableIPv6(true);
3833
// Manually connect to WiFi
3934
WiFi.begin(ssid, password);
4035
// Wait for connection

‎libraries/Matter/examples/MatterComposedLights/MatterComposedLights.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterComposedLights/MatterComposedLights.ino
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,10 @@ void setup() {
5555
pinMode(buttonPin, INPUT_PULLUP);
5656

5757
Serial.begin(115200);
58-
while (!Serial) {
59-
delay(100);
60-
}
6158

6259
// We start by connecting to a WiFi network
6360
Serial.print("Connecting to ");
6461
Serial.println(ssid);
65-
// enable IPv6
66-
WiFi.enableIPv6(true);
6762
// Manually connect to WiFi
6863
WiFi.begin(ssid, password);
6964
// Wait for connection

‎libraries/Matter/examples/MatterContactSensor/MatterContactSensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterContactSensor/MatterContactSensor.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
// Matter Contact Sensor Endpoint
3737
MatterContactSensor ContactSensor;
3838

39+
// WiFi is manually set and started
40+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
41+
const char *password = "your-password"; // Change this to your WiFi password
42+
3943
// LED will be used to indicate the Contact Sensor state
4044
// set your board RGB LED pin here
4145
#ifdef RGB_BUILTIN
@@ -48,10 +52,6 @@ const uint8_t ledPin = 2; // Set your pin here if your board has not defined LE
4852
// set your board USER BUTTON pin here - decommissioning and Manual Contact Sensor toggle button
4953
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
5054

51-
// WiFi is manually set and started
52-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
53-
const char *password = "your-password"; // Change this to your WiFi password
54-
5555
// Button control
5656
uint32_t button_time_stamp = 0; // debouncing control
5757
bool button_state = false; // false = released | true = pressed

‎libraries/Matter/examples/MatterDimmableLight/MatterDimmableLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterDimmableLight/MatterDimmableLight.ino
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Dimmable Light Endpoint
2222
MatterDimmableLight DimmableLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff & Brightness state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -43,10 +47,6 @@ bool button_state = false; // false = released | true = pres
4347
const uint32_t debouceTime = 250; // button debouncing time (ms)
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

46-
// WiFi is manually set and started
47-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
48-
const char *password = "your-password"; // Change this to your WiFi password
49-
5050
// Set the RGB LED Light based on the current state of the Dimmable Light
5151
bool setLightState(bool state, uint8_t brightness) {
5252
if (state) {
@@ -72,15 +72,10 @@ void setup() {
7272
pinMode(ledPin, OUTPUT);
7373

7474
Serial.begin(115200);
75-
while (!Serial) {
76-
delay(100);
77-
}
7875

7976
// We start by connecting to a WiFi network
8077
Serial.print("Connecting to ");
8178
Serial.println(ssid);
82-
// enable IPv6
83-
WiFi.enableIPv6(true);
8479
// Manually connect to WiFi
8580
WiFi.begin(ssid, password);
8681
// Wait for connection

‎libraries/Matter/examples/MatterEnhancedColorLight/MatterEnhancedColorLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterEnhancedColorLight/MatterEnhancedColorLight.ino
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Color Light Endpoint
2222
MatterEnhancedColorLight EnhancedColorLight;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// It will use HSV color to control all Matter Attribute Changes
2529
HsvColor_t currentHSVColor = {0, 0, 0};
2630

@@ -46,10 +50,6 @@ bool button_state = false; // false = released | true = pres
4650
const uint32_t debouceTime = 250; // button debouncing time (ms)
4751
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4852

49-
// WiFi is manually set and started
50-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
51-
const char *password = "your-password"; // Change this to your WiFi password
52-
5353
// Set the RGB LED Light based on the current state of the Enhanced Color Light
5454
bool setLightState(bool state, espHsvColor_t colorHSV, uint8_t brighteness, uint16_t temperature_Mireds) {
5555

@@ -80,15 +80,10 @@ void setup() {
8080
pinMode(ledPin, OUTPUT);
8181

8282
Serial.begin(115200);
83-
while (!Serial) {
84-
delay(100);
85-
}
8683

8784
// We start by connecting to a WiFi network
8885
Serial.print("Connecting to ");
8986
Serial.println(ssid);
90-
// enable IPv6
91-
WiFi.enableIPv6(true);
9287
// Manually connect to WiFi
9388
WiFi.begin(ssid, password);
9489
// Wait for connection

‎libraries/Matter/examples/MatterFan/MatterFan.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterFan/MatterFan.ino
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
// Fan Endpoint - On/Off control + Speed Percent Control + Fan Modes
2121
MatterFan Fan;
2222

23+
// WiFi is manually set and started
24+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
25+
const char *password = "your-password"; // Change this to your WiFi password
26+
2327
// set your board USER BUTTON pin here - used for toggling On/Off and decommission the Matter Node
2428
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
2529

@@ -41,10 +45,6 @@ const uint8_t dcMotorPin = 2; // Set your pin here if your board has not define
4145
#warning "Do not forget to set the RGB LED pin"
4246
#endif
4347

44-
// WiFi is manually set and started
45-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
46-
const char *password = "your-password"; // Change this to your WiFi password
47-
4848
void fanDCMotorDrive(bool fanState, uint8_t speedPercent) {
4949
// drive the Fan DC motor
5050
if (fanState == false) {
@@ -71,15 +71,10 @@ void setup() {
7171
pinMode(dcMotorPin, OUTPUT);
7272

7373
Serial.begin(115200);
74-
while (!Serial) {
75-
delay(100);
76-
}
7774

7875
// We start by connecting to a WiFi network
7976
Serial.print("Connecting to ");
8077
Serial.println(ssid);
81-
// enable IPv6
82-
WiFi.enableIPv6(true);
8378
// Manually connect to WiFi
8479
WiFi.begin(ssid, password);
8580
// Wait for connection

‎libraries/Matter/examples/MatterHumiditySensor/MatterHumiditySensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterHumiditySensor/MatterHumiditySensor.ino
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
// Matter Humidity Sensor Endpoint
2828
MatterHumiditySensor SimulatedHumiditySensor;
2929

30-
// set your board USER BUTTON pin here - decommissioning button
31-
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
32-
3330
// WiFi is manually set and started
3431
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
3532
const char *password = "your-password"; // Change this to your WiFi password
3633

34+
// set your board USER BUTTON pin here - decommissioning button
35+
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
36+
3737
// Button control - decommision the Matter Node
3838
uint32_t button_time_stamp = 0; // debouncing control
3939
bool button_state = false; // false = released | true = pressed

‎libraries/Matter/examples/MatterMinimum/MatterMinimum.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterMinimum/MatterMinimum.ino
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
// Single On/Off Light Endpoint - at least one per node
2929
MatterOnOffLight OnOffLight;
3030

31+
// WiFi is manually set and started
32+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
33+
const char *password = "your-password"; // Change this to your WiFi password
34+
3135
// Light GPIO that can be controlled by Matter APP
3236
#ifdef LED_BUILTIN
3337
const uint8_t ledPin = LED_BUILTIN;
@@ -44,23 +48,18 @@ bool button_state = false; // false = released | true = pres
4448
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4549

4650
// Matter Protocol Endpoint (On/OFF Light) Callback
47-
bool matterCB(bool state) {
51+
bool onOffLightCallback(bool state) {
4852
digitalWrite(ledPin, state ? HIGH : LOW);
4953
// This callback must return the success state to Matter core
5054
return true;
5155
}
5256

53-
// WiFi is manually set and started
54-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
55-
const char *password = "your-password"; // Change this to your WiFi password
56-
5757
void setup() {
5858
// Initialize the USER BUTTON (Boot button) that will be used to decommission the Matter Node
5959
pinMode(buttonPin, INPUT_PULLUP);
6060
// Initialize the LED GPIO
6161
pinMode(ledPin, OUTPUT);
6262

63-
WiFi.enableIPv6(true);
6463
// Manually connect to WiFi
6564
WiFi.begin(ssid, password);
6665
// Wait for connection
@@ -72,7 +71,7 @@ void setup() {
7271
OnOffLight.begin();
7372

7473
// Associate a callback to the Matter Controller
75-
OnOffLight.onChange(matterCB);
74+
OnOffLight.onChange(onOffLightCallback);
7675

7776
// Matter beginning - Last step, after all EndPoints are initialized
7877
Matter.begin();

‎libraries/Matter/examples/MatterOccupancySensor/MatterOccupancySensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterOccupancySensor/MatterOccupancySensor.ino
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
// Matter Occupancy Sensor Endpoint
3535
MatterOccupancySensor OccupancySensor;
3636

37-
// set your board USER BUTTON pin here - decommissioning only
38-
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
39-
4037
// WiFi is manually set and started
4138
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
4239
const char *password = "your-password"; // Change this to your WiFi password
4340

41+
// set your board USER BUTTON pin here - decommissioning only
42+
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
43+
4444
// Button control
4545
uint32_t button_time_stamp = 0; // debouncing control
4646
bool button_state = false; // false = released | true = pressed

‎libraries/Matter/examples/MatterOnOffLight/MatterOnOffLight.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterOnOffLight/MatterOnOffLight.ino
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#include <WiFi.h>
1818
#include <Preferences.h>
1919

20+
// WiFi is manually set and started
21+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
22+
const char *password = "your-password"; // Change this to your WiFi password
23+
2024
// List of Matter Endpoints for this Node
2125
// On/Off Light Endpoint
2226
MatterOnOffLight OnOffLight;
@@ -42,10 +46,6 @@ bool button_state = false; // false = released | true = pres
4246
const uint32_t debouceTime = 250; // button debouncing time (ms)
4347
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4448

45-
// WiFi is manually set and started
46-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
47-
const char *password = "your-password"; // Change this to your WiFi password
48-
4949
// Matter Protocol Endpoint Callback
5050
bool setLightOnOff(bool state) {
5151
Serial.printf("User Callback :: New Light State = %s\r\n", state ? "ON" : "OFF");
@@ -67,15 +67,10 @@ void setup() {
6767
pinMode(ledPin, OUTPUT);
6868

6969
Serial.begin(115200);
70-
while (!Serial) {
71-
delay(100);
72-
}
7370

7471
// We start by connecting to a WiFi network
7572
Serial.print("Connecting to ");
7673
Serial.println(ssid);
77-
// enable IPv6
78-
WiFi.enableIPv6(true);
7974
// Manually connect to WiFi
8075
WiFi.begin(ssid, password);
8176
// Wait for connection

‎libraries/Matter/examples/MatterOnOffPlugin/MatterOnOffPlugin.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterOnOffPlugin/MatterOnOffPlugin.ino
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// On/Off Plugin Endpoint
2222
MatterOnOffPlugin OnOffPlugin;
2323

24+
// WiFi is manually set and started
25+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
26+
const char *password = "your-password"; // Change this to your WiFi password
27+
2428
// it will keep last OnOff state stored, using Preferences
2529
Preferences matterPref;
2630
const char *onOffPrefKey = "OnOff";
@@ -41,10 +45,6 @@ uint32_t button_time_stamp = 0; // debouncing control
4145
bool button_state = false; // false = released | true = pressed
4246
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
4347

44-
// WiFi is manually set and started
45-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
46-
const char *password = "your-password"; // Change this to your WiFi password
47-
4848
// Matter Protocol Endpoint Callback
4949
bool setPluginOnOff(bool state) {
5050
Serial.printf("User Callback :: New Plugin State = %s\r\n", state ? "ON" : "OFF");

‎libraries/Matter/examples/MatterPressureSensor/MatterPressureSensor.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterPressureSensor/MatterPressureSensor.ino
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
// Matter Pressure Sensor Endpoint
2828
MatterPressureSensor SimulatedPressureSensor;
2929

30-
// set your board USER BUTTON pin here - decommissioning button
31-
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
32-
3330
// WiFi is manually set and started
3431
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
3532
const char *password = "your-password"; // Change this to your WiFi password
3633

34+
// set your board USER BUTTON pin here - decommissioning button
35+
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
36+
3737
// Button control - decommision the Matter Node
3838
uint32_t button_time_stamp = 0; // debouncing control
3939
bool button_state = false; // false = released | true = pressed

‎libraries/Matter/examples/MatterSmartButon/MatterSmartButon.ino

Copy file name to clipboardExpand all lines: libraries/Matter/examples/MatterSmartButon/MatterSmartButon.ino
+5-9Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
// Generic Switch Endpoint - works as a smart button with a single click
2121
MatterGenericSwitch SmartButton;
2222

23+
// WiFi is manually set and started
24+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
25+
const char *password = "your-password"; // Change this to your WiFi password
26+
2327
// set your board USER BUTTON pin here
2428
const uint8_t buttonPin = BOOT_PIN; // Set your pin here. Using BOOT Button.
2529

@@ -29,24 +33,16 @@ bool button_state = false; // false = released | true = pres
2933
const uint32_t debouceTime = 250; // button debouncing time (ms)
3034
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
3135

32-
// WiFi is manually set and started
33-
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
34-
const char *password = "your-password"; // Change this to your WiFi password
35-
3636
void setup() {
3737
// Initialize the USER BUTTON (Boot button) GPIO that will act as a smart button or to decommission the Matter Node
3838
pinMode(buttonPin, INPUT_PULLUP);
3939

4040
Serial.begin(115200);
41-
while (!Serial) {
42-
delay(100);
43-
}
4441

4542
// We start by connecting to a WiFi network
4643
Serial.print("Connecting to ");
4744
Serial.println(ssid);
48-
// enable IPv6
49-
WiFi.enableIPv6(true);
45+
5046
// Manually connect to WiFi
5147
WiFi.begin(ssid, password);
5248
// Wait for connection

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.