Skip to content

Commit 87accc0

Browse files
authored
Merge branch 'master' into esp_insights
2 parents 76977d1 + d135e8a commit 87accc0

File tree

152 files changed

+1860
-469
lines changed

Some content is hidden

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

152 files changed

+1860
-469
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ boards.sloeber.txt
3232
# Ignore docs build (Sphinx)
3333
docs/build
3434
docs/source/_build
35+
__pycache__/
36+
_build/
3537

3638
# Test log files
3739
*.log

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,10 @@ if(NOT CONFIG_FREERTOS_HZ EQUAL 1000 AND NOT "$ENV{ARDUINO_SKIP_TICK_CHECK}")
222222
endif()
223223

224224
string(TOUPPER ${CONFIG_ARDUINO_VARIANT} idf_target_caps)
225+
string(REPLACE "-" "_" idf_target_for_macro "${idf_target_caps}")
225226
target_compile_options(${COMPONENT_TARGET} PUBLIC
226227
-DARDUINO=10812
227-
-DARDUINO_${idf_target_caps}_DEV
228+
-DARDUINO_${idf_target_for_macro}_DEV
228229
-DARDUINO_ARCH_ESP32
229230
-DARDUINO_BOARD="${idf_target_caps}_DEV"
230231
-DARDUINO_VARIANT="${CONFIG_ARDUINO_VARIANT}"

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
vojtech.bartoska@espressif.com.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ Finally, if you are sure no one else had the issue, follow the **Issue template*
5656
We welcome contributions to the Arduino ESP32 project!
5757

5858
See [contributing](https://docs.espressif.com/projects/arduino-esp32/en/latest/contributing.html) in the documentation for more information on how to contribute to the project.
59+
60+
> We would like to have this repository in a polite and friendly atmosphere, so please be kind and respectful to others. For more details, look at [Code of Conduct](https://github.com/espressif/arduino-esp32/blob/master/CODE_OF_CONDUCT.md).

boards.txt

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,9 @@ rmp.vid.0=0x303a
22412241
rmp.pid.0=0x80F6
22422242

22432243
rmp.upload.tool=esptool_py
2244+
rmp.upload.tool.default=esptool_py
2245+
rmp.upload.tool.network=esp_ota
2246+
22442247
rmp.upload.maximum_size=1310720
22452248
rmp.upload.maximum_data_size=327680
22462249
rmp.upload.flags=
@@ -10000,6 +10003,9 @@ esp32doit-devkit-v1.menu.EraseFlash.all.upload.erase_cmd=-e
1000010003
esp32doit-espduino.name=DOIT ESPduino32
1000110004

1000210005
esp32doit-espduino.upload.tool=esptool_py
10006+
esp32doit-espduino.upload.tool.default=esptool_py
10007+
esp32doit-espduino.upload.tool.network=esp_ota
10008+
1000310009
esp32doit-espduino.upload.maximum_size=1310720
1000410010
esp32doit-espduino.upload.maximum_data_size=327680
1000510011
esp32doit-espduino.upload.wait_for_upload_port=true
@@ -13153,7 +13159,10 @@ oroca_edubot.menu.EraseFlash.all.upload.erase_cmd=-e
1315313159

1315413160
fm-devkit.name=ESP32 FM DevKit
1315513161

13156-
fm-devkit.upload.tool=esptool
13162+
fm-devkit.upload.tool=esptool_py
13163+
fm-devkit.upload.tool.default=esptool_py
13164+
fm-devkit.upload.tool.network=esp_ota
13165+
1315713166
fm-devkit.upload.maximum_size=1310720
1315813167
fm-devkit.upload.maximum_data_size=327680
1315913168
fm-devkit.upload.flags=
@@ -19659,3 +19668,118 @@ redpill_esp32s3.menu.EraseFlash.all=Enabled
1965919668
redpill_esp32s3.menu.EraseFlash.all.upload.erase_cmd=-e
1966019669

1966119670
##############################################################
19671+
19672+
esp32c3m1IKit.name=ESP-C3-M1-I-Kit
19673+
19674+
esp32c3m1IKit.bootloader.tool=esptool_py
19675+
esp32c3m1IKit.bootloader.tool.default=esptool_py
19676+
19677+
esp32c3m1IKit.upload.tool=esptool_py
19678+
esp32c3m1IKit.upload.tool.default=esptool_py
19679+
esp32c3m1IKit.upload.tool.network=esp_ota
19680+
19681+
esp32c3m1IKit.upload.maximum_size=1310720
19682+
esp32c3m1IKit.upload.maximum_data_size=327680
19683+
esp32c3m1IKit.upload.flags=
19684+
esp32c3m1IKit.upload.extra_flags=
19685+
esp32c3m1IKit.upload.use_1200bps_touch=false
19686+
esp32c3m1IKit.upload.wait_for_upload_port=false
19687+
19688+
esp32c3m1IKit.serial.disableDTR=false
19689+
esp32c3m1IKit.serial.disableRTS=false
19690+
19691+
esp32c3m1IKit.build.tarch=riscv32
19692+
esp32c3m1IKit.build.target=esp
19693+
esp32c3m1IKit.build.mcu=esp32c3
19694+
esp32c3m1IKit.build.core=esp32
19695+
esp32c3m1IKit.build.variant=esp_c3_m1_i_kit
19696+
esp32c3m1IKit.build.board=ESP32C3_M1_I_KIT
19697+
esp32c3m1IKit.build.bootloader_addr=0x0
19698+
19699+
esp32c3m1IKit.build.cdc_on_boot=0
19700+
esp32c3m1IKit.build.f_cpu=160000000L
19701+
esp32c3m1IKit.build.flash_size=4MB
19702+
esp32c3m1IKit.build.flash_freq=80m
19703+
esp32c3m1IKit.build.flash_mode=qio
19704+
esp32c3m1IKit.build.boot=qio
19705+
esp32c3m1IKit.build.partitions=default
19706+
esp32c3m1IKit.build.defines=
19707+
19708+
esp32c3m1IKit.menu.CDCOnBoot.default=Disabled
19709+
esp32c3m1IKit.menu.CDCOnBoot.default.build.cdc_on_boot=0
19710+
esp32c3m1IKit.menu.CDCOnBoot.cdc=Enabled
19711+
esp32c3m1IKit.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
19712+
19713+
esp32c3m1IKit.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
19714+
esp32c3m1IKit.menu.PartitionScheme.default.build.partitions=default
19715+
esp32c3m1IKit.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
19716+
esp32c3m1IKit.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
19717+
esp32c3m1IKit.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
19718+
esp32c3m1IKit.menu.PartitionScheme.minimal.build.partitions=minimal
19719+
esp32c3m1IKit.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
19720+
esp32c3m1IKit.menu.PartitionScheme.no_ota.build.partitions=no_ota
19721+
esp32c3m1IKit.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
19722+
esp32c3m1IKit.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
19723+
esp32c3m1IKit.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
19724+
esp32c3m1IKit.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
19725+
esp32c3m1IKit.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
19726+
esp32c3m1IKit.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
19727+
esp32c3m1IKit.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
19728+
esp32c3m1IKit.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
19729+
esp32c3m1IKit.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
19730+
esp32c3m1IKit.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
19731+
esp32c3m1IKit.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
19732+
esp32c3m1IKit.menu.PartitionScheme.huge_app.build.partitions=huge_app
19733+
esp32c3m1IKit.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
19734+
esp32c3m1IKit.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
19735+
esp32c3m1IKit.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
19736+
esp32c3m1IKit.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
19737+
esp32c3m1IKit.menu.PartitionScheme.rainmaker=RainMaker
19738+
esp32c3m1IKit.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
19739+
esp32c3m1IKit.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
19740+
19741+
esp32c3m1IKit.menu.CPUFreq.160=160MHz (WiFi)
19742+
esp32c3m1IKit.menu.CPUFreq.160.build.f_cpu=160000000L
19743+
esp32c3m1IKit.menu.CPUFreq.80=80MHz (WiFi)
19744+
esp32c3m1IKit.menu.CPUFreq.80.build.f_cpu=80000000L
19745+
esp32c3m1IKit.menu.CPUFreq.40=40MHz
19746+
esp32c3m1IKit.menu.CPUFreq.40.build.f_cpu=40000000L
19747+
esp32c3m1IKit.menu.CPUFreq.20=20MHz
19748+
esp32c3m1IKit.menu.CPUFreq.20.build.f_cpu=20000000L
19749+
esp32c3m1IKit.menu.CPUFreq.10=10MHz
19750+
esp32c3m1IKit.menu.CPUFreq.10.build.f_cpu=10000000L
19751+
19752+
esp32c3m1IKit.menu.UploadSpeed.921600=921600
19753+
esp32c3m1IKit.menu.UploadSpeed.921600.upload.speed=921600
19754+
esp32c3m1IKit.menu.UploadSpeed.115200=115200
19755+
esp32c3m1IKit.menu.UploadSpeed.115200.upload.speed=115200
19756+
esp32c3m1IKit.menu.UploadSpeed.256000.windows=256000
19757+
esp32c3m1IKit.menu.UploadSpeed.256000.upload.speed=256000
19758+
esp32c3m1IKit.menu.UploadSpeed.230400.windows.upload.speed=256000
19759+
esp32c3m1IKit.menu.UploadSpeed.230400=230400
19760+
esp32c3m1IKit.menu.UploadSpeed.230400.upload.speed=230400
19761+
esp32c3m1IKit.menu.UploadSpeed.460800.linux=460800
19762+
esp32c3m1IKit.menu.UploadSpeed.460800.macosx=460800
19763+
esp32c3m1IKit.menu.UploadSpeed.460800.upload.speed=460800
19764+
esp32c3m1IKit.menu.UploadSpeed.512000.windows=512000
19765+
esp32c3m1IKit.menu.UploadSpeed.512000.upload.speed=512000
19766+
19767+
esp32c3m1IKit.menu.DebugLevel.none=None
19768+
esp32c3m1IKit.menu.DebugLevel.none.build.code_debug=0
19769+
esp32c3m1IKit.menu.DebugLevel.error=Error
19770+
esp32c3m1IKit.menu.DebugLevel.error.build.code_debug=1
19771+
esp32c3m1IKit.menu.DebugLevel.warn=Warn
19772+
esp32c3m1IKit.menu.DebugLevel.warn.build.code_debug=2
19773+
esp32c3m1IKit.menu.DebugLevel.info=Info
19774+
esp32c3m1IKit.menu.DebugLevel.info.build.code_debug=3
19775+
esp32c3m1IKit.menu.DebugLevel.debug=Debug
19776+
esp32c3m1IKit.menu.DebugLevel.debug.build.code_debug=4
19777+
esp32c3m1IKit.menu.DebugLevel.verbose=Verbose
19778+
esp32c3m1IKit.menu.DebugLevel.verbose.build.code_debug=5
19779+
19780+
esp32c3m1IKit.menu.EraseFlash.none=Disabled
19781+
esp32c3m1IKit.menu.EraseFlash.none.upload.erase_cmd=
19782+
esp32c3m1IKit.menu.EraseFlash.all=Enabled
19783+
esp32c3m1IKit.menu.EraseFlash.all.upload.erase_cmd=-e
19784+
19785+
##############################################################

cores/esp32/HWCDC.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ static uint8_t rx_data_buf[64];
3232
static intr_handle_t intr_handle = NULL;
3333
static volatile bool initial_empty = false;
3434
static xSemaphoreHandle tx_lock = NULL;
35-
static uint32_t tx_timeout_ms = 200;
35+
36+
// workaround for when USB CDC is not connected
37+
static uint32_t tx_timeout_ms = 0;
38+
static bool tx_timeout_change_request = false;
39+
3640
static esp_event_loop_handle_t arduino_hw_cdc_event_loop_handle = NULL;
3741

3842
static esp_err_t arduino_hw_cdc_event_post(esp_event_base_t event_base, int32_t event_id, void *event_data, size_t event_data_size, BaseType_t *task_unblocked){
@@ -72,9 +76,14 @@ static void hw_cdc_isr_handler(void *arg) {
7276
if (usb_serial_jtag_ll_txfifo_writable() == 1) {
7377
// We disable the interrupt here so that the interrupt won't be triggered if there is no data to send.
7478
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
75-
7679
if(!initial_empty){
7780
initial_empty = true;
81+
// First time USB is plugged and the application has not explicitly set TX Timeout, set it to default 100ms.
82+
// Otherwise, USB is still unplugged and the timeout will be kept as Zero in order to avoid any delay in the
83+
// application whenever it uses write() and the TX Queue gets full.
84+
if (!tx_timeout_change_request) {
85+
tx_timeout_ms = 100;
86+
}
7887
//send event?
7988
//ets_printf("CONNECTED\n");
8089
arduino_hw_cdc_event_post(ARDUINO_HW_CDC_EVENTS, ARDUINO_HW_CDC_CONNECTED_EVENT, &event, sizeof(arduino_hw_cdc_event_data_t), &xTaskWoken);
@@ -197,6 +206,9 @@ void HWCDC::end()
197206

198207
void HWCDC::setTxTimeoutMs(uint32_t timeout){
199208
tx_timeout_ms = timeout;
209+
// it registers that the user has explicitly requested to use a value as TX timeout
210+
// used for the workaround with unplugged USB and TX Queue Full that causes a delay on every write()
211+
tx_timeout_change_request = true;
200212
}
201213

202214
/*

cores/esp32/HardwareSerial.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,12 @@ int HardwareSerial::peek(void)
450450

451451
int HardwareSerial::read(void)
452452
{
453-
if(available()) {
454-
return uartRead(_uart);
453+
uint8_t c = 0;
454+
if (uartReadBytes(_uart, &c, 1, 0) == 1) {
455+
return c;
456+
} else {
457+
return -1;
455458
}
456-
return -1;
457459
}
458460

459461
// read characters into buffer
@@ -462,16 +464,13 @@ int HardwareSerial::read(void)
462464
// the buffer is NOT null terminated.
463465
size_t HardwareSerial::read(uint8_t *buffer, size_t size)
464466
{
465-
size_t avail = available();
466-
if (size < avail) {
467-
avail = size;
468-
}
469-
size_t count = 0;
470-
while(count < avail) {
471-
*buffer++ = uartRead(_uart);
472-
count++;
473-
}
474-
return count;
467+
return uartReadBytes(_uart, buffer, size, 0);
468+
}
469+
470+
// Overrides Stream::readBytes() to be faster using IDF
471+
size_t HardwareSerial::readBytes(uint8_t *buffer, size_t length)
472+
{
473+
return uartReadBytes(_uart, buffer, length, (uint32_t)getTimeout());
475474
}
476475

477476
void HardwareSerial::flush(void)

cores/esp32/HardwareSerial.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ class HardwareSerial: public Stream
118118
{
119119
return read((uint8_t*) buffer, size);
120120
}
121+
// Overrides Stream::readBytes() to be faster using IDF
122+
size_t readBytes(uint8_t *buffer, size_t length);
123+
size_t readBytes(char *buffer, size_t length)
124+
{
125+
return readBytes((uint8_t *) buffer, length);
126+
}
121127
void flush(void);
122128
void flush( bool txOnly);
123129
size_t write(uint8_t);

0 commit comments

Comments
 (0)