Skip to content

Commit dfeea6c

Browse files
authored
Updates upstream
2 parents 0122fc3 + bf9ad4f commit dfeea6c

File tree

21 files changed

+332
-100
lines changed

21 files changed

+332
-100
lines changed

boards.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,15 @@ esp32h2.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api_zczr -lesp_zb_cli_co
531531
esp32h2.menu.ZigbeeMode.rcp=Zigbee RCP (radio co-processor)
532532
esp32h2.menu.ZigbeeMode.rcp.build.zigbee_mode=-DZIGBEE_MODE_RCP
533533
esp32h2.menu.ZigbeeMode.rcp.build.zigbee_libs=-lesp_zb_api_rcp -lesp_zb_cli_command -lzboss_stack.rcp -lzboss_port
534-
534+
esp32h2.menu.ZigbeeMode.ed_debug=Zigbee ED (end device) - Debug
535+
esp32h2.menu.ZigbeeMode.ed_debug.build.zigbee_mode=-DZIGBEE_MODE_ED
536+
esp32h2.menu.ZigbeeMode.ed_debug.build.zigbee_libs=-lesp_zb_api_ed.debug -lesp_zb_cli_command -lzboss_stack.ed.debug -lzboss_port.debug
537+
esp32h2.menu.ZigbeeMode.zczr_debug=Zigbee ZCZR (coordinator/router) - Debug
538+
esp32h2.menu.ZigbeeMode.zczr_debug.build.zigbee_mode=-DZIGBEE_MODE_ZCZR
539+
esp32h2.menu.ZigbeeMode.zczr_debug.build.zigbee_libs=-lesp_zb_api_zczr.debug -lesp_zb_cli_command -lzboss_stack.zczr.debug -lzboss_port.debug
540+
esp32h2.menu.ZigbeeMode.rcp_debug=Zigbee RCP (radio co-processor) - Debug
541+
esp32h2.menu.ZigbeeMode.rcp_debug.build.zigbee_mode=-DZIGBEE_MODE_RCP
542+
esp32h2.menu.ZigbeeMode.rcp_debug.build.zigbee_libs=-lesp_zb_api_rcp.debug -lesp_zb_cli_command -lzboss_stack.rcp.debug -lzboss_port.debug
535543

536544
##############################################################
537545

@@ -723,6 +731,15 @@ esp32c6.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api_zczr -lesp_zb_cli_co
723731
esp32c6.menu.ZigbeeMode.rcp=Zigbee RCP (radio co-processor)
724732
esp32c6.menu.ZigbeeMode.rcp.build.zigbee_mode=-DZIGBEE_MODE_RCP
725733
esp32c6.menu.ZigbeeMode.rcp.build.zigbee_libs=-lesp_zb_api_rcp -lesp_zb_cli_command -lzboss_stack.rcp -lzboss_port
734+
esp32c6.menu.ZigbeeMode.ed_debug=Zigbee ED (end device) - Debug
735+
esp32c6.menu.ZigbeeMode.ed_debug.build.zigbee_mode=-DZIGBEE_MODE_ED
736+
esp32c6.menu.ZigbeeMode.ed_debug.build.zigbee_libs=-lesp_zb_api_ed.debug -lesp_zb_cli_command -lzboss_stack.ed.debug -lzboss_port.debug
737+
esp32c6.menu.ZigbeeMode.zczr_debug=Zigbee ZCZR (coordinator/router) - Debug
738+
esp32c6.menu.ZigbeeMode.zczr_debug.build.zigbee_mode=-DZIGBEE_MODE_ZCZR
739+
esp32c6.menu.ZigbeeMode.zczr_debug.build.zigbee_libs=-lesp_zb_api_zczr.debug -lesp_zb_cli_command -lzboss_stack.zczr.debug -lzboss_port.debug
740+
esp32c6.menu.ZigbeeMode.rcp_debug=Zigbee RCP (radio co-processor) - Debug
741+
esp32c6.menu.ZigbeeMode.rcp_debug.build.zigbee_mode=-DZIGBEE_MODE_RCP
742+
esp32c6.menu.ZigbeeMode.rcp_debug.build.zigbee_libs=-lesp_zb_api_rcp.debug -lesp_zb_cli_command -lzboss_stack.rcp.debug -lzboss_port.debug
726743

727744
##############################################################
728745

cores/esp32/esp32-hal-uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include "hal/gpio_hal.h"
3434
#include "esp_rom_gpio.h"
3535

36-
static int s_uart_debug_nr = 0; // UART number for debug output
37-
#define REF_TICK_BAUDRATE_LIMIT 250000 // this is maximum UART badrate using REF_TICK as clock
36+
static int s_uart_debug_nr = 0; // UART number for debug output
37+
#define REF_TICK_BAUDRATE_LIMIT 250000 // this is maximum UART badrate using REF_TICK as clock
3838

3939
struct uart_struct_t {
4040

libraries/AsyncUDP/keywords.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
AsyncUDP KEYWORD1
1010
AsyncUDPPacket KEYWORD1
11+
AsyncUDPMessage KEYWORD1
1112

1213
#######################################
1314
# Methods and Functions (KEYWORD2)
@@ -19,6 +20,21 @@ listen KEYWORD2
1920
listenMulticast KEYWORD2
2021
close KEYWORD2
2122
write KEYWORD2
23+
space KEYWORD2
24+
flush KEYWORD2
25+
isBroadcast KEYWORD2
26+
isMulticast KEYWORD2
27+
isIPv6 KEYWORD2
28+
interface KEYWORD2
29+
localIPv6 KEYWORD2
30+
remoteIPv6 KEYWORD2
31+
remoteMac KEYWORD2
32+
send KEYWORD2
33+
peek KEYWORD2
34+
available KEYWORD2
35+
writeTo KEYWORD2
36+
broadcastTo KEYWORD2
37+
sendTo KEYWORD2
2238
broadcast KEYWORD2
2339
onPacket KEYWORD2
2440
data KEYWORD2
@@ -27,7 +43,17 @@ localIP KEYWORD2
2743
localPort KEYWORD2
2844
remoteIP KEYWORD2
2945
remotePort KEYWORD2
46+
listenIP KEYWORD2
47+
listenIPv6 KEYWORD2
48+
lastErr KEYWORD2
49+
_s_recv KEYWORD2
3050

3151
#######################################
3252
# Constants (LITERAL1)
3353
#######################################
54+
55+
TCPIP_ADAPTER_IF_STA LITERAL1
56+
TCPIP_ADAPTER_IF_STA LITERAL1
57+
TCPIP_ADAPTER_IF_AP LITERAL1
58+
TCPIP_ADAPTER_IF_ETH LITERAL1
59+
TCPIP_ADAPTER_IF_PPP LITERAL1
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/*
16+
* This example is the smallest code that will create a Matter Device which can be
17+
* commissioned and controlled from a Matter Environment APP.
18+
* It controls a GPIO that could be attached to a LED for visualization.
19+
* Additionally the ESP32 will send debug messages indicating the Matter activity.
20+
* Turning DEBUG Level ON may be useful to following Matter Accessory and Controller messages.
21+
*/
22+
23+
// Matter Manager
24+
#include <Matter.h>
25+
#include <WiFi.h>
26+
27+
// List of Matter Endpoints for this Node
28+
// Single On/Off Light Endpoint - at least one per node
29+
MatterOnOffLight OnOffLight;
30+
31+
// Light GPIO that can be controlled by Matter APP
32+
#ifdef LED_BUILTIN
33+
const uint8_t ledPin = LED_BUILTIN;
34+
#else
35+
const uint8_t ledPin = 2; // Set your pin here if your board has not defined LED_BUILTIN
36+
#endif
37+
38+
// Matter Protocol Endpoint (On/OFF Light) Callback
39+
bool matterCB(bool state) {
40+
digitalWrite(ledPin, state ? HIGH : LOW);
41+
// This callback must return the success state to Matter core
42+
return true;
43+
}
44+
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+
49+
void setup() {
50+
// Initialize the LED GPIO
51+
pinMode(ledPin, OUTPUT);
52+
53+
WiFi.enableIPv6(true);
54+
// Manually connect to WiFi
55+
WiFi.begin(ssid, password);
56+
// Wait for connection
57+
while (WiFi.status() != WL_CONNECTED) {
58+
delay(500);
59+
}
60+
61+
// Initialize at least one Matter EndPoint
62+
OnOffLight.begin();
63+
64+
// Associate a callback to the Matter Controller
65+
OnOffLight.onChange(matterCB);
66+
67+
// Matter beginning - Last step, after all EndPoints are initialized
68+
Matter.begin();
69+
70+
if (!Matter.isDeviceCommissioned()) {
71+
log_i("Matter Node is not commissioned yet.");
72+
log_i("Initiate the device discovery in your Matter environment.");
73+
log_i("Commission it to your Matter hub with the manual pairing code or QR code");
74+
log_i("Manual pairing code: %s\r\n", Matter.getManualPairingCode().c_str());
75+
log_i("QR code URL: %s\r\n", Matter.getOnboardingQRCodeUrl().c_str());
76+
}
77+
}
78+
79+
void loop() {
80+
delay(500);
81+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"fqbn_append": "PartitionScheme=huge_app",
3+
"requires": [
4+
"CONFIG_SOC_WIFI_SUPPORTED=y",
5+
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
6+
]
7+
}

libraries/Update/src/Update.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#ifndef ESP32UPDATER_H
88
#define ESP32UPDATER_H
99

10+
#ifndef UPDATE_NOCRYPT
1011
#define UPDATE_NOCRYPT
12+
#endif
1113

1214
#include <Arduino.h>
1315
#include <MD5Builder.h>
@@ -145,11 +147,13 @@ class UpdateClass {
145147
sets the expected MD5 for the firmware (hexString)
146148
If calc_post_decryption is true, the update library will calculate the MD5 after the decryption, if false the calculation occurs before the decryption
147149
*/
148-
bool setMD5(const char *expected_md5
150+
bool setMD5(
151+
const char *expected_md5
149152
#ifndef UPDATE_NOCRYPT
150-
, bool calc_post_decryption = true
153+
,
154+
bool calc_post_decryption = true
151155
#endif /* #ifdef UPDATE_NOCRYPT */
152-
);
156+
);
153157

154158
/*
155159
returns the MD5 String of the successfully ended firmware

libraries/Update/src/Updater.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ bool UpdateClass::_enablePartition(const esp_partition_t *partition) {
7373
UpdateClass::UpdateClass()
7474
: _error(0),
7575
#ifndef UPDATE_NOCRYPT
76-
_cryptKey(0), _cryptBuffer(0),
76+
_cryptKey(0), _cryptBuffer(0),
7777
#endif /* UPDATE_NOCRYPT */
78-
_buffer(0), _skipBuffer(0), _bufferLen(0), _size(0), _progress_callback(NULL), _progress(0), _paroffset(0), _command(U_FLASH), _partition(NULL)
78+
_buffer(0), _skipBuffer(0), _bufferLen(0), _size(0), _progress_callback(NULL), _progress(0), _paroffset(0), _command(U_FLASH), _partition(NULL)
7979
#ifndef UPDATE_NOCRYPT
80-
, _cryptMode(U_AES_DECRYPT_AUTO), _cryptAddress(0), _cryptCfg(0xf)
80+
,
81+
_cryptMode(U_AES_DECRYPT_AUTO), _cryptAddress(0), _cryptCfg(0xf)
8182
#endif /* UPDATE_NOCRYPT */
82-
{}
83+
{
84+
}
8385

8486
UpdateClass &UpdateClass::onProgress(THandlerFunction_Progress fn) {
8587
_progress_callback = fn;
@@ -378,7 +380,7 @@ bool UpdateClass::_writeBuffer() {
378380
return false;
379381
}
380382
}
381-
#endif /* UPDATE_NOCRYPT */
383+
#endif /* UPDATE_NOCRYPT */
382384
//first bytes of new firmware
383385
uint8_t skip = 0;
384386
if (!_progress && _command == U_FLASH) {
@@ -476,9 +478,11 @@ bool UpdateClass::_verifyEnd() {
476478
return false;
477479
}
478480

479-
bool UpdateClass::setMD5(const char *expected_md5
481+
bool UpdateClass::setMD5(
482+
const char *expected_md5
480483
#ifndef UPDATE_NOCRYPT
481-
,bool calc_post_decryption
484+
,
485+
bool calc_post_decryption
482486
#endif /* UPDATE_NOCRYPT */
483487
) {
484488
if (strlen(expected_md5) != 32) {

libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light/Zigbee_Color_Dimmable_Light.ino

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ void identify(uint16_t time) {
6464

6565
/********************* Arduino functions **************************/
6666
void setup() {
67+
Serial.begin(115200);
68+
while (!Serial) {
69+
delay(10);
70+
}
71+
6772
// Init RMT and leave light OFF
6873
rgbLedWrite(LED_PIN, 0, 0, 0);
6974

@@ -80,12 +85,21 @@ void setup() {
8085
zbColorLight.setManufacturerAndModel("Espressif", "ZBColorLightBulb");
8186

8287
// Add endpoint to Zigbee Core
83-
log_d("Adding ZigbeeLight endpoint to Zigbee Core");
88+
Serial.println("Adding ZigbeeLight endpoint to Zigbee Core");
8489
Zigbee.addEndpoint(&zbColorLight);
8590

86-
// When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE
87-
log_d("Calling Zigbee.begin()");
88-
Zigbee.begin();
91+
// When all EPs are registered, start Zigbee in End Device mode
92+
if (!Zigbee.begin()) {
93+
Serial.println("Zigbee failed to start!");
94+
Serial.println("Rebooting...");
95+
ESP.restart();
96+
}
97+
Serial.println("Connecting to network");
98+
while (!Zigbee.connected()) {
99+
Serial.print(".");
100+
delay(100);
101+
}
102+
Serial.println();
89103
}
90104

91105
void loop() {
@@ -98,7 +112,8 @@ void loop() {
98112
delay(50);
99113
if ((millis() - startTime) > 3000) {
100114
// If key pressed for more than 3secs, factory reset Zigbee and reboot
101-
Serial.printf("Resetting Zigbee to factory settings, reboot.\n");
115+
Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
116+
delay(1000);
102117
Zigbee.factoryReset();
103118
}
104119
}

libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch/Zigbee_Color_Dimmer_Switch.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ ZigbeeColorDimmerSwitch zbSwitch = ZigbeeColorDimmerSwitch(SWITCH_ENDPOINT_NUMBE
4646

4747
/********************* Arduino functions **************************/
4848
void setup() {
49-
5049
Serial.begin(115200);
5150
while (!Serial) {
5251
delay(10);
@@ -68,11 +67,15 @@ void setup() {
6867
Zigbee.setRebootOpenNetwork(180);
6968

7069
//When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR mode
71-
Zigbee.begin(ZIGBEE_COORDINATOR);
70+
if (!Zigbee.begin(ZIGBEE_COORDINATOR)) {
71+
Serial.println("Zigbee failed to start!");
72+
Serial.println("Rebooting...");
73+
ESP.restart();
74+
}
7275

7376
Serial.println("Waiting for Light to bound to the switch");
7477
//Wait for switch to bound to a light:
75-
while (!zbSwitch.isBound()) {
78+
while (!zbSwitch.bound()) {
7679
Serial.printf(".");
7780
delay(500);
7881
}

libraries/Zigbee/examples/Zigbee_On_Off_Light/Zigbee_On_Off_Light.ino

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ void setLED(bool value) {
4545

4646
/********************* Arduino functions **************************/
4747
void setup() {
48+
Serial.begin(115200);
49+
while (!Serial) {
50+
delay(10);
51+
}
4852
// Init LED and turn it OFF (if LED_PIN == RGB_BUILTIN, the rgbLedWrite() will be used under the hood)
4953
pinMode(LED_PIN, OUTPUT);
5054
digitalWrite(LED_PIN, LOW);
@@ -59,12 +63,21 @@ void setup() {
5963
zbLight.onLightChange(setLED);
6064

6165
//Add endpoint to Zigbee Core
62-
log_d("Adding ZigbeeLight endpoint to Zigbee Core");
66+
Serial.println("Adding ZigbeeLight endpoint to Zigbee Core");
6367
Zigbee.addEndpoint(&zbLight);
6468

6569
// When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE
66-
log_d("Calling Zigbee.begin()");
67-
Zigbee.begin();
70+
if (!Zigbee.begin()) {
71+
Serial.println("Zigbee failed to start!");
72+
Serial.println("Rebooting...");
73+
ESP.restart();
74+
}
75+
Serial.println("Connecting to network");
76+
while (!Zigbee.connected()) {
77+
Serial.print(".");
78+
delay(100);
79+
}
80+
Serial.println();
6881
}
6982

7083
void loop() {
@@ -77,7 +90,8 @@ void loop() {
7790
delay(50);
7891
if ((millis() - startTime) > 3000) {
7992
// If key pressed for more than 3secs, factory reset Zigbee and reboot
80-
Serial.printf("Resetting Zigbee to factory settings, reboot.\n");
93+
Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
94+
delay(1000);
8195
Zigbee.factoryReset();
8296
}
8397
}

0 commit comments

Comments
 (0)