Skip to content

Commit 0ce6c95

Browse files
authored
Merge branch 'master' into ci/test_report
2 parents 4018084 + dbfde15 commit 0ce6c95

File tree

179 files changed

+6799
-1605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+6799
-1605
lines changed

Diff for: .github/ISSUE_TEMPLATE/Issue-report.yml

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ body:
4141
options:
4242
- latest master (checkout manually)
4343
- latest development Release Candidate (RC-X)
44+
- v3.1.2
45+
- v3.1.1
4446
- v3.1.0
4547
- v3.0.7
4648
- v3.0.6

Diff for: .github/ISSUE_TEMPLATE/config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
blank_issues_enabled: false
22
contact_links:
3-
- name: Arduino ESP32 Gitter Channel
4-
url: https://gitter.im/espressif/arduino-esp32
5-
about: Community channel for questions and help
3+
- name: Arduino Core for Espressif Discord Server
4+
url: https://discord.gg/8xY6e9crwv
5+
about: Community Discord server for questions and help
66
- name: ESP32 Forum - Arduino
77
url: https://esp32.com/viewforum.php?f=19
88
about: Official Forum for questions

Diff for: .github/workflows/dangerjs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ jobs:
2020
uses: espressif/shared-github-dangerjs@v1
2121
env:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
with:
24+
instructions-cla-link: "https://cla-assistant.io/espressif/arduino-esp32"
25+
instructions-contributions-file: "docs/en/contributing.rst"
2326
rule-max-commits: "false"
2427
commit-messages-min-summary-length: "10"

Diff for: .github/workflows/upload-idf-component.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ on:
44
workflow_dispatch:
55
inputs:
66
tag:
7-
description: 'Tag to push to the component registry'
7+
description: 'Version to push to the component registry'
8+
required: true
9+
git_ref:
10+
description: 'Git ref with the source to push to the component registry'
811
required: true
912
workflow_run:
1013
workflows: ["ESP32 Arduino Release"]
@@ -44,7 +47,7 @@ jobs:
4447
4548
- uses: actions/checkout@v4
4649
with:
47-
ref: ${{ env.RELEASE_TAG }}
50+
ref: ${{ inputs.git_ref || env.RELEASE_TAG }}
4851
submodules: "recursive"
4952

5053
- name: Upload components to the component registry

Diff for: CMakeLists.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ set(ARDUINO_LIBRARY_Matter_SRCS
181181
libraries/Matter/src/MatterEndpoints/MatterPressureSensor.cpp
182182
libraries/Matter/src/MatterEndpoints/MatterOccupancySensor.cpp
183183
libraries/Matter/src/MatterEndpoints/MatterOnOffPlugin.cpp
184+
libraries/Matter/src/MatterEndpoints/MatterThermostat.cpp
184185
libraries/Matter/src/Matter.cpp)
185186

186187
set(ARDUINO_LIBRARY_PPP_SRCS
@@ -242,7 +243,11 @@ set(ARDUINO_LIBRARY_USB_SRCS
242243
set(ARDUINO_LIBRARY_WebServer_SRCS
243244
libraries/WebServer/src/WebServer.cpp
244245
libraries/WebServer/src/Parsing.cpp
245-
libraries/WebServer/src/detail/mimetable.cpp)
246+
libraries/WebServer/src/detail/mimetable.cpp
247+
libraries/WebServer/src/middleware/MiddlewareChain.cpp
248+
libraries/WebServer/src/middleware/AuthenticationMiddleware.cpp
249+
libraries/WebServer/src/middleware/CorsMiddleware.cpp
250+
libraries/WebServer/src/middleware/LoggingMiddleware.cpp)
246251

247252
set(ARDUINO_LIBRARY_NetworkClientSecure_SRCS
248253
libraries/NetworkClientSecure/src/ssl_client.cpp
@@ -285,6 +290,10 @@ set(ARDUINO_LIBRARY_Zigbee_SRCS
285290
libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp
286291
libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp
287292
libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp
293+
libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp
294+
libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp
295+
libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp
296+
libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp
288297
)
289298

290299
set(ARDUINO_LIBRARY_BLE_SRCS

Diff for: README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
[![External Libraries Test](https://img.shields.io/github/actions/workflow/status/espressif/arduino-esp32/lib.yml?branch=master&event=schedule&label=External%20Libraries%20Test)](https://github.com/espressif/arduino-esp32/blob/gh-pages/LIBRARIES_TEST.md)
66
[![Runtime Tests](https://github.com/espressif/arduino-esp32/blob/gh-pages/runtime-tests-results/badge.svg)](https://github.com/espressif/arduino-esp32/blob/gh-pages/runtime-tests-results/RUNTIME_TESTS_REPORT.md)
77

8-
### Need help or have a question? Join the chat at [Gitter](https://gitter.im/espressif/arduino-esp32) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions)
8+
### Need help or have a question? Join the chat at [Discord](https://discord.gg/8xY6e9crwv) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions)
9+
10+
[![Discord invite](https://img.shields.io/discord/1327272229427216425?logo=discord&logoColor=white&logoSize=auto&label=Discord)](https://discord.gg/8xY6e9crwv)
911

1012
## Contents
1113

Diff for: boards.txt

+748
Large diffs are not rendered by default.

Diff for: cores/esp32/Arduino.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@
3333
#include "freertos/FreeRTOS.h"
3434
#include "freertos/task.h"
3535
#include "freertos/semphr.h"
36-
#include "esp32-hal.h"
3736
#include "esp8266-compat.h"
3837
#include "soc/gpio_reg.h"
3938

4039
#include "stdlib_noniso.h"
4140
#include "binary.h"
4241
#include "extra_attr.h"
4342

43+
#include "pins_arduino.h"
44+
#include "io_pin_remap.h"
45+
#include "esp32-hal.h"
46+
4447
#define PI 3.1415926535897932384626433832795
4548
#define HALF_PI 1.5707963267948966192313216916398
4649
#define TWO_PI 6.283185307179586476925286766559
@@ -248,8 +251,4 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
248251
void noTone(uint8_t _pin);
249252

250253
#endif /* __cplusplus */
251-
252-
#include "pins_arduino.h"
253-
#include "io_pin_remap.h"
254-
255254
#endif /* _ESP32_CORE_ARDUINO_H_ */

Diff for: cores/esp32/Client.h

-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
class Client : public Stream {
2727
public:
2828
virtual int connect(IPAddress ip, uint16_t port) = 0;
29-
virtual int connect(IPAddress ip, uint16_t port, int32_t timeout) = 0;
3029
virtual int connect(const char *host, uint16_t port) = 0;
31-
virtual int connect(const char *host, uint16_t port, int32_t timeout) = 0;
3230
virtual size_t write(uint8_t) = 0;
3331
virtual size_t write(const uint8_t *buf, size_t size) = 0;
3432
virtual int available() = 0;

Diff for: cores/esp32/FirmwareMSC.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include "esp_partition.h"
2020
#include "esp_ota_ops.h"
2121
#include "esp_image_format.h"
22-
#include "esp32-hal.h"
2322
#include "pins_arduino.h"
23+
#include "esp32-hal.h"
2424
#include "firmware_msc_fat.h"
2525
#include "spi_flash_mmap.h"
2626

Diff for: cores/esp32/USBCDC.cpp

+51-17
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ ESP_EVENT_DEFINE_BASE(ARDUINO_USB_CDC_EVENTS);
2525
esp_err_t arduino_usb_event_post(esp_event_base_t event_base, int32_t event_id, void *event_data, size_t event_data_size, TickType_t ticks_to_wait);
2626
esp_err_t arduino_usb_event_handler_register_with(esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler, void *event_handler_arg);
2727

28-
#define MAX_USB_CDC_DEVICES 2
29-
USBCDC *devices[MAX_USB_CDC_DEVICES] = {NULL, NULL};
28+
USBCDC *devices[CFG_TUD_CDC];
3029

3130
static uint16_t load_cdc_descriptor(uint8_t *dst, uint8_t *itf) {
3231
uint8_t str_index = tinyusb_add_string_descriptor("TinyUSB CDC");
@@ -38,23 +37,43 @@ static uint16_t load_cdc_descriptor(uint8_t *dst, uint8_t *itf) {
3837
return TUD_CDC_DESC_LEN;
3938
}
4039

40+
static uint16_t load_cdc_descriptor2(uint8_t *dst, uint8_t *itf) {
41+
uint8_t str_index = tinyusb_add_string_descriptor("TinyUSB CDC2");
42+
uint8_t ep_ntfy = tinyusb_get_free_in_endpoint();
43+
TU_VERIFY(ep_ntfy != 0);
44+
uint8_t ep_in = tinyusb_get_free_in_endpoint();
45+
TU_VERIFY(ep_in != 0);
46+
uint8_t ep_out = tinyusb_get_free_out_endpoint();
47+
TU_VERIFY(ep_out != 0);
48+
uint8_t descriptor[TUD_CDC_DESC_LEN] = {
49+
// Interface number, string index, EP notification address and size, EP data address (out, in) and size.
50+
TUD_CDC_DESCRIPTOR(*itf, str_index, (uint8_t)(0x80 | ep_ntfy), CFG_TUD_ENDOINT_SIZE, ep_out, (uint8_t)(0x80 | ep_in), CFG_TUD_ENDOINT_SIZE)
51+
};
52+
*itf += 2;
53+
memcpy(dst, descriptor, TUD_CDC_DESC_LEN);
54+
return TUD_CDC_DESC_LEN;
55+
}
56+
4157
// Invoked when line state DTR & RTS are changed via SET_CONTROL_LINE_STATE
4258
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
43-
if (itf < MAX_USB_CDC_DEVICES && devices[itf] != NULL) {
59+
//log_v("ITF: %u, DTR: %u, RTS: %u", itf, dtr, rts);
60+
if (itf < CFG_TUD_CDC && devices[itf] != NULL) {
4461
devices[itf]->_onLineState(dtr, rts);
4562
}
4663
}
4764

4865
// Invoked when line coding is change via SET_LINE_CODING
4966
void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const *p_line_coding) {
50-
if (itf < MAX_USB_CDC_DEVICES && devices[itf] != NULL) {
67+
//log_v("ITF: %u, BITRATE: %lu, STOP_BITS: %u, PARITY: %u, DATA_BITS: %u", itf, p_line_coding->bit_rate, p_line_coding->stop_bits, p_line_coding->parity, p_line_coding->data_bits);
68+
if (itf < CFG_TUD_CDC && devices[itf] != NULL) {
5169
devices[itf]->_onLineCoding(p_line_coding->bit_rate, p_line_coding->stop_bits, p_line_coding->parity, p_line_coding->data_bits);
5270
}
5371
}
5472

5573
// Invoked when received new data
5674
void tud_cdc_rx_cb(uint8_t itf) {
57-
if (itf < MAX_USB_CDC_DEVICES && devices[itf] != NULL) {
75+
//log_v("ITF: %u", itf);
76+
if (itf < CFG_TUD_CDC && devices[itf] != NULL) {
5877
devices[itf]->_onRX();
5978
}
6079
}
@@ -66,13 +85,13 @@ void tud_cdc_send_break_cb(uint8_t itf, uint16_t duration_ms) {
6685

6786
// Invoked when space becomes available in TX buffer
6887
void tud_cdc_tx_complete_cb(uint8_t itf) {
69-
if (itf < MAX_USB_CDC_DEVICES && devices[itf] != NULL) {
88+
if (itf < CFG_TUD_CDC && devices[itf] != NULL) {
7089
devices[itf]->_onTX();
7190
}
7291
}
7392

7493
static void ARDUINO_ISR_ATTR cdc0_write_char(char c) {
75-
if (devices[0] != NULL) {
94+
if (CFG_TUD_CDC && devices[0] != NULL) {
7695
tud_cdc_n_write_char(0, c);
7796
}
7897
}
@@ -84,9 +103,15 @@ static void usb_unplugged_cb(void *arg, esp_event_base_t event_base, int32_t eve
84103
USBCDC::USBCDC(uint8_t itfn)
85104
: itf(itfn), bit_rate(0), stop_bits(0), parity(0), data_bits(0), dtr(false), rts(false), connected(false), reboot_enable(true), rx_queue(NULL), tx_lock(NULL),
86105
tx_timeout_ms(250) {
87-
tinyusb_enable_interface(USB_INTERFACE_CDC, TUD_CDC_DESC_LEN, load_cdc_descriptor);
88-
if (itf < MAX_USB_CDC_DEVICES) {
106+
if (itf < CFG_TUD_CDC) {
107+
if (itf == 0) {
108+
tinyusb_enable_interface(USB_INTERFACE_CDC, TUD_CDC_DESC_LEN, load_cdc_descriptor);
109+
} else {
110+
tinyusb_enable_interface(USB_INTERFACE_CDC2, TUD_CDC_DESC_LEN, load_cdc_descriptor2);
111+
}
89112
arduino_usb_event_handler_register_with(ARDUINO_USB_EVENTS, ARDUINO_USB_STOPPED_EVENT, usb_unplugged_cb, this);
113+
} else {
114+
log_e("Maximum of %u CDC devices are supported", CFG_TUD_CDC);
90115
}
91116
}
92117

@@ -142,6 +167,9 @@ size_t USBCDC::setRxBufferSize(size_t rx_queue_len) {
142167
}
143168

144169
void USBCDC::begin(unsigned long baud) {
170+
if (itf >= CFG_TUD_CDC) {
171+
return;
172+
}
145173
if (tx_lock == NULL) {
146174
tx_lock = xSemaphoreCreateMutex();
147175
}
@@ -153,6 +181,9 @@ void USBCDC::begin(unsigned long baud) {
153181
}
154182

155183
void USBCDC::end() {
184+
if (itf >= CFG_TUD_CDC) {
185+
return;
186+
}
156187
connected = false;
157188
devices[itf] = NULL;
158189
setRxBufferSize(0);
@@ -298,14 +329,14 @@ bool USBCDC::rebootEnabled(void) {
298329
}
299330

300331
int USBCDC::available(void) {
301-
if (itf >= MAX_USB_CDC_DEVICES || rx_queue == NULL) {
332+
if (itf >= CFG_TUD_CDC || rx_queue == NULL) {
302333
return -1;
303334
}
304335
return uxQueueMessagesWaiting(rx_queue);
305336
}
306337

307338
int USBCDC::peek(void) {
308-
if (itf >= MAX_USB_CDC_DEVICES || rx_queue == NULL) {
339+
if (itf >= CFG_TUD_CDC || rx_queue == NULL) {
309340
return -1;
310341
}
311342
uint8_t c;
@@ -316,7 +347,7 @@ int USBCDC::peek(void) {
316347
}
317348

318349
int USBCDC::read(void) {
319-
if (itf >= MAX_USB_CDC_DEVICES || rx_queue == NULL) {
350+
if (itf >= CFG_TUD_CDC || rx_queue == NULL) {
320351
return -1;
321352
}
322353
uint8_t c = 0;
@@ -327,7 +358,7 @@ int USBCDC::read(void) {
327358
}
328359

329360
size_t USBCDC::read(uint8_t *buffer, size_t size) {
330-
if (itf >= MAX_USB_CDC_DEVICES || rx_queue == NULL) {
361+
if (itf >= CFG_TUD_CDC || rx_queue == NULL) {
331362
return -1;
332363
}
333364
uint8_t c = 0;
@@ -339,7 +370,7 @@ size_t USBCDC::read(uint8_t *buffer, size_t size) {
339370
}
340371

341372
void USBCDC::flush(void) {
342-
if (itf >= MAX_USB_CDC_DEVICES || tx_lock == NULL || !tud_cdc_n_connected(itf)) {
373+
if (itf >= CFG_TUD_CDC || tx_lock == NULL || !tud_cdc_n_connected(itf)) {
343374
return;
344375
}
345376
if (xSemaphoreTake(tx_lock, tx_timeout_ms / portTICK_PERIOD_MS) != pdPASS) {
@@ -350,7 +381,7 @@ void USBCDC::flush(void) {
350381
}
351382

352383
int USBCDC::availableForWrite(void) {
353-
if (itf >= MAX_USB_CDC_DEVICES || tx_lock == NULL || !tud_cdc_n_connected(itf)) {
384+
if (itf >= CFG_TUD_CDC || tx_lock == NULL || !tud_cdc_n_connected(itf)) {
354385
return 0;
355386
}
356387
if (xSemaphoreTake(tx_lock, tx_timeout_ms / portTICK_PERIOD_MS) != pdPASS) {
@@ -362,7 +393,7 @@ int USBCDC::availableForWrite(void) {
362393
}
363394

364395
size_t USBCDC::write(const uint8_t *buffer, size_t size) {
365-
if (itf >= MAX_USB_CDC_DEVICES || tx_lock == NULL || buffer == NULL || size == 0 || !tud_cdc_n_connected(itf)) {
396+
if (itf >= CFG_TUD_CDC || tx_lock == NULL || buffer == NULL || size == 0 || !tud_cdc_n_connected(itf)) {
366397
return 0;
367398
}
368399
if (xPortInIsrContext()) {
@@ -415,6 +446,9 @@ uint32_t USBCDC::baudRate() {
415446
}
416447

417448
void USBCDC::setDebugOutput(bool en) {
449+
if (itf) {
450+
return;
451+
}
418452
if (en) {
419453
uartSetDebug(NULL);
420454
ets_install_putc2((void (*)(char)) & cdc0_write_char);
@@ -424,7 +458,7 @@ void USBCDC::setDebugOutput(bool en) {
424458
}
425459

426460
USBCDC::operator bool() const {
427-
if (itf >= MAX_USB_CDC_DEVICES) {
461+
if (itf >= CFG_TUD_CDC) {
428462
return false;
429463
}
430464
return connected;

0 commit comments

Comments
 (0)