Skip to content

Commit 197b265

Browse files
authored
Merge branch 'espressif:master' into master
2 parents 151bebd + 77065bf commit 197b265

File tree

18 files changed

+1549
-178
lines changed

18 files changed

+1549
-178
lines changed

.github/scripts/on-push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ else
108108
replace_script+="data['packages']['toolchain-xtensa-esp32']['optional']=True;"
109109
replace_script+="data['packages']['toolchain-xtensa-esp32s3']['optional']=False;"
110110
replace_script+="data['packages']['tool-esptoolpy']['owner']='tasmota';"
111-
replace_script+="data['packages']['tool-esptoolpy']['version']='https://github.com/tasmota/esptool/releases/download/v3.3/esptool-3.3.zip';"
111+
replace_script+="data['packages']['tool-esptoolpy']['version']='https://github.com/tasmota/esptool/releases/download/v4.2.1/esptool-4.2.1.zip';"
112112
replace_script+="fp.seek(0);fp.truncate();json.dump(data, fp, indent=2);fp.close()"
113113
python -c "$replace_script"
114114

.github/workflows/push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@ jobs:
9797
run: |
9898
. ${IDF_PATH}/export.sh
9999
idf.py create-project test
100+
echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults
100101
idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ tools/esptool.exe
88
tools/mkspiffs
99
tools/mklittlefs
1010
tools/mkfatfs.exe
11+
12+
# Ignore editor backup files and macOS system metadata
1113
.DS_Store
14+
.*.swp
15+
.*.swo
16+
*~
17+
18+
# Ignore build folder
19+
/build
1220

13-
#Ignore files built by Visual Studio/Visual Micro
21+
# Ignore files built by Visual Studio/Visual Micro
1422
[Dd]ebug*/
1523
[Rr]elease*/
1624
.vs/

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ set(BLE_SRCS
161161
)
162162

163163
set(includedirs
164-
variants/${IDF_TARGET}/
164+
variants/${CONFIG_ARDUINO_VARIANT}/
165165
cores/esp32/
166166
libraries/ArduinoOTA/src
167167
libraries/AsyncUDP/src
@@ -202,13 +202,19 @@ set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl b
202202

203203
idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})
204204

205-
string(TOUPPER ${CONFIG_IDF_TARGET} idf_target_caps)
205+
if(NOT CONFIG_FREERTOS_HZ EQUAL 1000 AND NOT "$ENV{ARDUINO_SKIP_TICK_CHECK}")
206+
# See delay() in cores/esp32/esp32-hal-misc.c.
207+
message(FATAL_ERROR "esp32-arduino requires CONFIG_FREERTOS_HZ=1000 "
208+
"(currently ${CONFIG_FREERTOS_HZ})")
209+
endif()
210+
211+
string(TOUPPER ${CONFIG_ARDUINO_VARIANT} idf_target_caps)
206212
target_compile_options(${COMPONENT_TARGET} PUBLIC
207213
-DARDUINO=10812
208214
-DARDUINO_${idf_target_caps}_DEV
209215
-DARDUINO_ARCH_ESP32
210216
-DARDUINO_BOARD="${idf_target_caps}_DEV"
211-
-DARDUINO_VARIANT="${CONFIG_IDF_TARGET}"
217+
-DARDUINO_VARIANT="${CONFIG_ARDUINO_VARIANT}"
212218
-DESP32)
213219

214220
if(CONFIG_AUTOSTART_ARDUINO)

Kconfig.projbuild

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
menu "Arduino Configuration"
22

3+
config ARDUINO_VARIANT
4+
string "Arduino target variant (board)"
5+
default IDF_TARGET
6+
help
7+
The name of a target variant (e.g., a specific board) in the variants/
8+
folder, e.g. "heltec_wifi_lora_32_V2". The name is case sensitive.
9+
Specifying a variant name different from the target enables additional
10+
customization, for example the definition of GPIO pins.
11+
312
config ENABLE_ARDUINO_DEPENDS
413
bool
514
select LWIP_SO_RCVBUF

boards.txt

Lines changed: 1178 additions & 109 deletions
Large diffs are not rendered by default.

docs/source/esp-idf_component.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ If you are writing code that does not require Arduino to compile and you want yo
140140
FreeRTOS Tick Rate (Hz)
141141
-----------------------
142142

143-
You might notice that Arduino-esp32's `delay()` function will only work in multiples of 10ms. That is because, by default, esp-idf handles task events 100 times per second.
144-
To fix that behavior, you need to set FreeRTOS tick rate to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`.
143+
The Arduino component requires the FreeRTOS tick rate `CONFIG_FREERTOS_HZ` set to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`.
145144

146145
Compilation Errors
147146
------------------

libraries/ESP32/examples/ESPNow/Basic/Master/Master.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
// Global copy of slave
3636
esp_now_peer_info_t slave;
37-
#define CHANNEL 3
37+
#define CHANNEL 1
3838
#define PRINTSCANRESULTS 0
3939
#define DELETEBEFOREPAIR 0
4040

libraries/HTTPClient/src/HTTPClient.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,8 +1551,6 @@ void HTTPClient::setCookie(String date, String headerValue)
15511551
String value;
15521552
int pos1, pos2;
15531553

1554-
headerValue.toLowerCase();
1555-
15561554
struct tm tm;
15571555
strptime(date.c_str(), HTTP_TIME_PATTERN, &tm);
15581556
cookie.date = mktime(&tm);
@@ -1567,6 +1565,9 @@ void HTTPClient::setCookie(String date, String headerValue)
15671565
return; // invalid cookie header
15681566
}
15691567

1568+
// only Cookie Attributes are case insensitive from this point on
1569+
headerValue.toLowerCase();
1570+
15701571
// expires
15711572
if (headerValue.indexOf("expires=") >= 0){
15721573
pos1 = headerValue.indexOf("expires=") + strlen("expires=");

libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ LightSwitch switch_ch1 = {gpio_switch1, false};
3131
LightSwitch switch_ch2 = {gpio_switch2, false};
3232

3333
//The framework provides some standard device types like switch, lightbulb, fan, temperature sensor.
34-
static Switch my_switch1("Switch_ch1", &gpio_relay1);
35-
static Switch my_switch2("Switch_ch2", &gpio_relay2);
34+
static Switch my_switch1;
35+
static Switch my_switch2;
3636

3737
void sysProvEvent(arduino_event_t *sys_event)
3838
{
39-
switch (sys_event->event_id) {
39+
switch (sys_event->event_id) {
4040
case ARDUINO_EVENT_PROV_START:
4141
#if CONFIG_IDF_TARGET_ESP32
4242
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
4343
printQR(service_name, pop, "ble");
4444
#else
4545
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
4646
printQR(service_name, pop, "softap");
47-
#endif
47+
#endif
4848
break;
4949
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
5050
Serial.printf("\nConnected to Wi-Fi!\n");
@@ -60,18 +60,18 @@ void write_callback(Device *device, Param *param, const param_val_t val, void *p
6060
const char *param_name = param->getParamName();
6161

6262
if(strcmp(device_name, "Switch_ch1") == 0) {
63-
63+
6464
Serial.printf("Lightbulb = %s\n", val.val.b? "true" : "false");
65-
65+
6666
if(strcmp(param_name, "Power") == 0) {
6767
Serial.printf("Received value = %s for %s - %s\n", val.val.b? "true" : "false", device_name, param_name);
6868
switch_state_ch1 = val.val.b;
6969
(switch_state_ch1 == false) ? digitalWrite(gpio_relay1, LOW) : digitalWrite(gpio_relay1, HIGH);
7070
param->updateAndReport(val);
7171
}
72-
72+
7373
} else if(strcmp(device_name, "Switch_ch2") == 0) {
74-
74+
7575
Serial.printf("Switch value = %s\n", val.val.b? "true" : "false");
7676

7777
if(strcmp(param_name, "Power") == 0) {
@@ -80,9 +80,9 @@ void write_callback(Device *device, Param *param, const param_val_t val, void *p
8080
(switch_state_ch2 == false) ? digitalWrite(gpio_relay2, LOW) : digitalWrite(gpio_relay2, HIGH);
8181
param->updateAndReport(val);
8282
}
83-
83+
8484
}
85-
85+
8686
}
8787

8888
void ARDUINO_ISR_ATTR isr(void* arg) {
@@ -92,8 +92,9 @@ void ARDUINO_ISR_ATTR isr(void* arg) {
9292

9393
void setup()
9494
{
95+
9596
uint32_t chipId = 0;
96-
97+
9798
Serial.begin(115200);
9899

99100
// Configure the input GPIOs
@@ -102,7 +103,7 @@ void setup()
102103
attachInterruptArg(switch_ch1.pin, isr, &switch_ch1, CHANGE);
103104
pinMode(switch_ch2.pin, INPUT_PULLUP);
104105
attachInterruptArg(switch_ch2.pin, isr, &switch_ch2, CHANGE);
105-
106+
106107
// Set the Relays GPIOs as output mode
107108
pinMode(gpio_relay1, OUTPUT);
108109
pinMode(gpio_relay2, OUTPUT);
@@ -112,20 +113,24 @@ void setup()
112113
digitalWrite(gpio_relay2, DEFAULT_POWER_MODE);
113114
digitalWrite(gpio_led, false);
114115

115-
Node my_node;
116+
Node my_node;
116117
my_node = RMaker.initNode("Sonoff Dual R3");
117118

119+
//Initialize switch device
120+
my_switch1 = Switch("Switch_ch1", &gpio_relay1);
121+
my_switch2 = Switch("Switch_ch2", &gpio_relay2);
122+
118123
//Standard switch device
119124
my_switch1.addCb(write_callback);
120125
my_switch2.addCb(write_callback);
121126

122-
//Add switch device to the node
127+
//Add switch device to the node
123128
my_node.addDevice(my_switch1);
124129
my_node.addDevice(my_switch2);
125130

126-
//This is optional
131+
//This is optional
127132
RMaker.enableOTA(OTA_USING_PARAMS);
128-
//If you want to enable scheduling, set time zone for your region using setTimeZone().
133+
//If you want to enable scheduling, set time zone for your region using setTimeZone().
129134
//The list of available values are provided here https://rainmaker.espressif.com/docs/time-service.html
130135
// RMaker.setTimeZone("Asia/Shanghai");
131136
// Alternatively, enable the Timezone service and let the phone apps set the appropriate timezone

libraries/RainMaker/examples/RMakerSwitch/RMakerSwitch.ino

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ static int gpio_switch = 16;
2121
bool switch_state = true;
2222

2323
//The framework provides some standard device types like switch, lightbulb, fan, temperaturesensor.
24-
static Switch my_switch("Switch", &gpio_switch);
24+
static Switch my_switch;
2525

2626
void sysProvEvent(arduino_event_t *sys_event)
2727
{
28-
switch (sys_event->event_id) {
28+
switch (sys_event->event_id) {
2929
case ARDUINO_EVENT_PROV_START:
3030
#if CONFIG_IDF_TARGET_ESP32S2
3131
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
3232
printQR(service_name, pop, "softap");
3333
#else
3434
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
3535
printQR(service_name, pop, "ble");
36-
#endif
36+
#endif
3737
break;
3838
default:;
3939
}
@@ -59,18 +59,21 @@ void setup()
5959
pinMode(gpio_switch, OUTPUT);
6060
digitalWrite(gpio_switch, DEFAULT_POWER_MODE);
6161

62-
Node my_node;
62+
Node my_node;
6363
my_node = RMaker.initNode("ESP RainMaker Node");
6464

65+
//Initialize switch device
66+
my_switch = Switch("Switch", &gpio_switch);
67+
6568
//Standard switch device
6669
my_switch.addCb(write_callback);
67-
68-
//Add switch device to the node
70+
71+
//Add switch device to the node
6972
my_node.addDevice(my_switch);
7073

71-
//This is optional
74+
//This is optional
7275
RMaker.enableOTA(OTA_USING_PARAMS);
73-
//If you want to enable scheduling, set time zone for your region using setTimeZone().
76+
//If you want to enable scheduling, set time zone for your region using setTimeZone().
7477
//The list of available values are provided here https://rainmaker.espressif.com/docs/time-service.html
7578
// RMaker.setTimeZone("Asia/Shanghai");
7679
// Alternatively, enable the Timezone service and let the phone apps set the appropriate timezone

package/package_esp32_index.template.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
{
6060
"packager": "esp32",
6161
"name": "esptool_py",
62-
"version": "3.3.0"
62+
"version": "4.2.1"
6363
},
6464
{
6565
"packager": "esp32",
@@ -297,56 +297,56 @@
297297
},
298298
{
299299
"name": "esptool_py",
300-
"version": "3.3.0",
300+
"version": "4.2.1",
301301
"systems": [
302302
{
303303
"host": "i686-mingw32",
304-
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.2/esptool-3.3-windows.zip",
305-
"archiveFileName": "esptool-3.3-windows.zip",
306-
"checksum": "SHA-256:55a1d7165414bf4dbd2bb16ca094e555d671958450f5d1536b457a518d2b15df",
307-
"size": "7436864"
304+
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-windows.zip",
305+
"archiveFileName": "esptool-4.2.1-windows.zip",
306+
"checksum": "SHA-256:582560067bfbd9895f4862eb5fdf87558ddee5d4d30e7575c9b8bcb0dd60fd94",
307+
"size": "6368279"
308308
},
309309
{
310310
"host": "x86_64-mingw32",
311-
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.2/esptool-3.3-windows.zip",
312-
"archiveFileName": "esptool-3.3-windows.zip",
313-
"checksum": "SHA-256:55a1d7165414bf4dbd2bb16ca094e555d671958450f5d1536b457a518d2b15df",
314-
"size": "7436864"
311+
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-windows.zip",
312+
"archiveFileName": "esptool-4.2.1-windows.zip",
313+
"checksum": "SHA-256:582560067bfbd9895f4862eb5fdf87558ddee5d4d30e7575c9b8bcb0dd60fd94",
314+
"size": "6368279"
315315
},
316316
{
317317
"host": "x86_64-apple-darwin",
318-
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.2/esptool-3.3-macos.tar.gz",
319-
"archiveFileName": "esptool-3.3-macos.tar.gz",
320-
"checksum": "SHA-256:3e5f7b521ae33c8c63f3b48efc909c08f37bef1a083c0eafa408312c09900afd",
321-
"size": "6944975"
318+
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-macos.tar.gz",
319+
"archiveFileName": "esptool-4.2.1-macos.tar.gz",
320+
"checksum": "SHA-256:a984f7ad8bdb40c42d0d368bf4bb21b69a9587aed46b7b6d7de23ca58a3f150d",
321+
"size": "5816598"
322322
},
323323
{
324324
"host": "x86_64-pc-linux-gnu",
325-
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.2/esptool-3.3-linux.tar.gz",
326-
"archiveFileName": "esptool-3.3-linux.tar.gz",
327-
"checksum": "SHA-256:fbe91a49e5f5deca4881f5eed32e8903faf97bfd365fe2d0d1512b80bdb67f5e",
328-
"size": "97026"
325+
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-linux.tar.gz",
326+
"archiveFileName": "esptool-4.2.1-linux.tar.gz",
327+
"checksum": "SHA-256:5a45fb77eb6574554ec2f45230d0b350f26f9c24ab3b6c13c4031ebdf72a34ab",
328+
"size": "90123"
329329
},
330330
{
331331
"host": "i686-pc-linux-gnu",
332-
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.2/esptool-3.3-linux.tar.gz",
333-
"archiveFileName": "esptool-3.3-linux.tar.gz",
334-
"checksum": "SHA-256:fbe91a49e5f5deca4881f5eed32e8903faf97bfd365fe2d0d1512b80bdb67f5e",
335-
"size": "97026"
332+
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-linux.tar.gz",
333+
"archiveFileName": "esptool-4.2.1-linux.tar.gz",
334+
"checksum": "SHA-256:5a45fb77eb6574554ec2f45230d0b350f26f9c24ab3b6c13c4031ebdf72a34ab",
335+
"size": "90123"
336336
},
337337
{
338338
"host": "arm-linux-gnueabihf",
339-
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.2/esptool-3.3-linux.tar.gz",
340-
"archiveFileName": "esptool-3.3-linux.tar.gz",
341-
"checksum": "SHA-256:fbe91a49e5f5deca4881f5eed32e8903faf97bfd365fe2d0d1512b80bdb67f5e",
342-
"size": "97026"
339+
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-linux.tar.gz",
340+
"archiveFileName": "esptool-4.2.1-linux.tar.gz",
341+
"checksum": "SHA-256:5a45fb77eb6574554ec2f45230d0b350f26f9c24ab3b6c13c4031ebdf72a34ab",
342+
"size": "90123"
343343
},
344344
{
345345
"host": "aarch64-linux-gnu",
346-
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.2/esptool-3.3-linux.tar.gz",
347-
"archiveFileName": "esptool-3.3-linux.tar.gz",
348-
"checksum": "SHA-256:fbe91a49e5f5deca4881f5eed32e8903faf97bfd365fe2d0d1512b80bdb67f5e",
349-
"size": "97026"
346+
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-3.3-linux.tar.gz",
347+
"archiveFileName": "esptool-4.2.1-linux.tar.gz",
348+
"checksum": "SHA-256:5a45fb77eb6574554ec2f45230d0b350f26f9c24ab3b6c13c4031ebdf72a34ab",
349+
"size": "90123"
350350
}
351351
]
352352
},

0 commit comments

Comments
 (0)