Skip to content

Commit 409d3ce

Browse files
authored
Merge branch 'espressif:master' into master
2 parents 25d6cc2 + 5484129 commit 409d3ce

Some content is hidden

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

60 files changed

+497
-157
lines changed

.github/workflows/hil.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
gen_chunks:
1919
if: |
2020
contains(github.event.pull_request.labels.*.name, 'hil_test') ||
21-
github.event_name == 'schedule'
21+
(github.event_name == 'schedule' && github.repository == 'espressif/arduino-esp32')
2222
name: Generate Chunks matrix
2323
runs-on: ubuntu-latest
2424
outputs:

.github/workflows/upload-idf-component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Push components to https://components.espressif.com
22
on:
33
push:
44
tags:
5-
- *
5+
- '*'
66
jobs:
77
upload_components:
88
runs-on: ubuntu-latest

Kconfig.projbuild

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,19 @@ config AUTOSTART_ARDUINO
2121

2222
choice ARDUINO_RUNNING_CORE
2323
bool "Core on which Arduino's setup() and loop() are running"
24-
default ARDUINO_RUN_CORE1
24+
default ARDUINO_RUN_CORE0 if FREERTOS_UNICORE
25+
default ARDUINO_RUN_CORE1 if !FREERTOS_UNICORE
2526
help
2627
Select on which core Arduino's setup() and loop() functions run
2728

2829
config ARDUINO_RUN_CORE0
2930
bool "CORE 0"
3031
config ARDUINO_RUN_CORE1
3132
bool "CORE 1"
33+
depends on !FREERTOS_UNICORE
3234
config ARDUINO_RUN_NO_AFFINITY
3335
bool "BOTH"
36+
depends on !FREERTOS_UNICORE
3437

3538
endchoice
3639

@@ -48,16 +51,19 @@ config ARDUINO_LOOP_STACK_SIZE
4851

4952
choice ARDUINO_EVENT_RUNNING_CORE
5053
bool "Core on which Arduino's event handler is running"
51-
default ARDUINO_EVENT_RUN_CORE1
54+
default ARDUINO_EVENT_RUN_CORE0 if FREERTOS_UNICORE
55+
default ARDUINO_EVENT_RUN_CORE1 if !FREERTOS_UNICORE
5256
help
5357
Select on which core Arduino's WiFi.onEvent() run
5458

5559
config ARDUINO_EVENT_RUN_CORE0
5660
bool "CORE 0"
5761
config ARDUINO_EVENT_RUN_CORE1
5862
bool "CORE 1"
63+
depends on !FREERTOS_UNICORE
5964
config ARDUINO_EVENT_RUN_NO_AFFINITY
6065
bool "BOTH"
66+
depends on !FREERTOS_UNICORE
6167

6268
endchoice
6369

@@ -67,33 +73,71 @@ config ARDUINO_EVENT_RUNNING_CORE
6773
default 1 if ARDUINO_EVENT_RUN_CORE1
6874
default -1 if ARDUINO_EVENT_RUN_NO_AFFINITY
6975

76+
choice ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
77+
bool "Core on which Arduino's Serial Event task is running"
78+
default ARDUINO_SERIAL_EVENT_RUN_CORE0 if FREERTOS_UNICORE
79+
default ARDUINO_SERIAL_EVENT_RUN_NO_AFFINITY if !FREERTOS_UNICORE
80+
help
81+
Select on which core Arduino's Serial Event task run
82+
83+
config ARDUINO_SERIAL_EVENT_RUN_CORE0
84+
bool "CORE 0"
85+
config ARDUINO_SERIAL_EVENT_RUN_CORE1
86+
bool "CORE 1"
87+
depends on !FREERTOS_UNICORE
88+
config ARDUINO_SERIAL_EVENT_RUN_NO_AFFINITY
89+
bool "BOTH"
90+
depends on !FREERTOS_UNICORE
91+
92+
endchoice
93+
94+
config ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
95+
int
96+
default 0 if ARDUINO_SERIAL_EVENT_RUN_CORE0
97+
default 1 if ARDUINO_SERIAL_EVENT_RUN_CORE1
98+
default -1 if ARDUINO_SERIAL_EVENT_RUN_NO_AFFINITY
99+
100+
config ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
101+
int "Serial Event task stack size"
102+
default 2048
103+
help
104+
Amount of stack available for the Serial Event task.
105+
106+
config ARDUINO_SERIAL_EVENT_TASK_PRIORITY
107+
int "Priority of the Serial Event task"
108+
default 24
109+
help
110+
Select at what priority you want the Serial Event task to run.
111+
70112
choice ARDUINO_UDP_RUNNING_CORE
71113
bool "Core on which Arduino's UDP is running"
72-
default ARDUINO_UDP_RUN_CORE1
114+
default ARDUINO_UDP_RUN_CORE0
73115
help
74116
Select on which core Arduino's UDP run
75117

76118
config ARDUINO_UDP_RUN_CORE0
77119
bool "CORE 0"
78120
config ARDUINO_UDP_RUN_CORE1
79121
bool "CORE 1"
122+
depends on !FREERTOS_UNICORE
80123
config ARDUINO_UDP_RUN_NO_AFFINITY
81124
bool "BOTH"
125+
depends on !FREERTOS_UNICORE
82126

83127
endchoice
84128

85-
config ARDUINO_UDP_TASK_PRIORITY
86-
int "Priority of the UDP task"
87-
default 3
88-
help
89-
Select at what priority you want the UDP task to run.
90-
91129
config ARDUINO_UDP_RUNNING_CORE
92130
int
93131
default 0 if ARDUINO_UDP_RUN_CORE0
94132
default 1 if ARDUINO_UDP_RUN_CORE1
95133
default -1 if ARDUINO_UDP_RUN_NO_AFFINITY
96134

135+
config ARDUINO_UDP_TASK_PRIORITY
136+
int "Priority of the UDP task"
137+
default 3
138+
help
139+
Select at what priority you want the UDP task to run.
140+
97141
config ARDUINO_ISR_IRAM
98142
bool "Run interrupts in IRAM"
99143
default "n"
@@ -356,3 +400,4 @@ config ARDUINO_SELECTIVE_Wire
356400

357401

358402
endmenu
403+

cores/esp32/HardwareSerial.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
#include "driver/uart.h"
1010
#include "freertos/queue.h"
1111

12+
#ifndef ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
13+
#define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE 2048
14+
#endif
15+
16+
#ifndef ARDUINO_SERIAL_EVENT_TASK_PRIORITY
17+
#define ARDUINO_SERIAL_EVENT_TASK_PRIORITY (configMAX_PRIORITIES-1)
18+
#endif
19+
20+
#ifndef ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
21+
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE -1
22+
#endif
23+
1224
#ifndef SOC_RX0
1325
#if CONFIG_IDF_TARGET_ESP32
1426
#define SOC_RX0 3
@@ -159,7 +171,7 @@ HardwareSerial::~HardwareSerial()
159171
void HardwareSerial::_createEventTask(void *args)
160172
{
161173
// Creating UART event Task
162-
xTaskCreate(_uartEventTask, "uart_event_task", 2048, this, configMAX_PRIORITIES - 1, &_eventTask);
174+
xTaskCreateUniversal(_uartEventTask, "uart_event_task", ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE, this, ARDUINO_SERIAL_EVENT_TASK_PRIORITY, &_eventTask, ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE);
163175
if (_eventTask == NULL) {
164176
log_e(" -- UART%d Event Task not Created!", _uart_nr);
165177
}

cores/esp32/Tone.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ void setToneChannel(uint8_t channel){
9595
if(tone_init()){
9696
tone_msg_t tone_msg = {
9797
.tone_cmd = TONE_SET_CHANNEL,
98+
.pin = 0, // Ignored
99+
.frequency = 0, // Ignored
100+
.duration = 0, // Ignored
98101
.channel = channel
99102
};
100103
xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY);
@@ -106,7 +109,10 @@ void noTone(uint8_t _pin){
106109
if(tone_init()){
107110
tone_msg_t tone_msg = {
108111
.tone_cmd = TONE_END,
109-
.pin = _pin
112+
.pin = _pin,
113+
.frequency = 0, // Ignored
114+
.duration = 0, // Ignored
115+
.channel = 0 // Ignored
110116
};
111117
xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY);
112118
}
@@ -124,7 +130,8 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration){
124130
.tone_cmd = TONE_START,
125131
.pin = _pin,
126132
.frequency = frequency,
127-
.duration = duration
133+
.duration = duration,
134+
.channel = 0 // Ignored
128135
};
129136
xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY);
130137
}

cores/esp32/WString.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,24 @@ String::String(double value, unsigned int decimalPlaces) {
137137
}
138138
}
139139

140+
String::String(long long value, unsigned char base) {
141+
init();
142+
char buf[2 + 8 * sizeof(long long)];
143+
if (base==10) {
144+
sprintf(buf, "%lld", value); // NOT SURE - NewLib Nano ... does it support %lld?
145+
} else {
146+
lltoa(value, buf, base);
147+
}
148+
*this = buf;
149+
}
150+
151+
String::String(unsigned long long value, unsigned char base) {
152+
init();
153+
char buf[1 + 8 * sizeof(unsigned long long)];
154+
ulltoa(value, buf, base);
155+
*this = buf;
156+
}
157+
140158
String::~String() {
141159
invalidate();
142160
}
@@ -408,6 +426,17 @@ unsigned char String::concat(double num) {
408426
return concat(string, strlen(string));
409427
}
410428

429+
unsigned char String::concat(long long num) {
430+
char buf[2 + 3 * sizeof(long long)];
431+
return concat(buf, sprintf(buf, "%lld", num)); // NOT SURE - NewLib Nano ... does it support %lld?
432+
}
433+
434+
unsigned char String::concat(unsigned long long num) {
435+
char buf[1 + 3 * sizeof(unsigned long long)];
436+
ulltoa(num, buf, 10);
437+
return concat(buf, strlen(buf));
438+
}
439+
411440
unsigned char String::concat(const __FlashStringHelper * str) {
412441
if (!str) return 0;
413442
int length = strlen_P((PGM_P)str);
@@ -493,6 +522,20 @@ StringSumHelper & operator +(const StringSumHelper &lhs, double num) {
493522
return a;
494523
}
495524

525+
StringSumHelper & operator +(const StringSumHelper &lhs, long long num) {
526+
StringSumHelper &a = const_cast<StringSumHelper&>(lhs);
527+
if(!a.concat(num))
528+
a.invalidate();
529+
return a;
530+
}
531+
532+
StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long long num) {
533+
StringSumHelper &a = const_cast<StringSumHelper&>(lhs);
534+
if(!a.concat(num))
535+
a.invalidate();
536+
return a;
537+
}
538+
496539
StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *rhs)
497540
{
498541
StringSumHelper &a = const_cast<StringSumHelper&>(lhs);

cores/esp32/WString.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ class String {
7373
explicit String(unsigned long, unsigned char base = 10);
7474
explicit String(float, unsigned int decimalPlaces = 2);
7575
explicit String(double, unsigned int decimalPlaces = 2);
76+
explicit String(long long, unsigned char base = 10);
77+
explicit String(unsigned long long, unsigned char base = 10);
7678
~String(void);
7779

7880
// memory management
@@ -122,6 +124,8 @@ class String {
122124
unsigned char concat(unsigned long num);
123125
unsigned char concat(float num);
124126
unsigned char concat(double num);
127+
unsigned char concat(long long num);
128+
unsigned char concat(unsigned long long num);
125129
unsigned char concat(const __FlashStringHelper * str);
126130

127131
// if there's not enough memory for the concatenated value, the string
@@ -166,6 +170,14 @@ class String {
166170
concat(num);
167171
return (*this);
168172
}
173+
String & operator +=(long long num) {
174+
concat(num);
175+
return (*this);
176+
}
177+
String & operator +=(unsigned long long num) {
178+
concat(num);
179+
return (*this);
180+
}
169181
String & operator += (const __FlashStringHelper *str){
170182
concat(str);
171183
return (*this);
@@ -182,6 +194,8 @@ class String {
182194
friend StringSumHelper & operator +(const StringSumHelper &lhs, float num);
183195
friend StringSumHelper & operator +(const StringSumHelper &lhs, double num);
184196
friend StringSumHelper & operator +(const StringSumHelper &lhs, const __FlashStringHelper *rhs);
197+
friend StringSumHelper & operator +(const StringSumHelper &lhs, long long num);
198+
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long long num);
185199

186200
// comparison (only works w/ Strings and "strings")
187201
operator StringIfHelperType() const {
@@ -373,6 +387,12 @@ class StringSumHelper: public String {
373387
StringSumHelper(double num) :
374388
String(num) {
375389
}
390+
StringSumHelper(long long num) :
391+
String(num) {
392+
}
393+
StringSumHelper(unsigned long long num) :
394+
String(num) {
395+
}
376396
};
377397

378398
extern const String emptyString;

0 commit comments

Comments
 (0)