Skip to content

Commit c5c8636

Browse files
authored
Merge branch 'master' into dnssrvasync
2 parents c0e48f8 + 44f83b0 commit c5c8636

File tree

141 files changed

+4096
-406
lines changed

Some content is hidden

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

141 files changed

+4096
-406
lines changed

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
2. [ ] Please provide related links (*eg. Issue which will be closed by this Pull Request*)
66
3. [ ] Please **update relevant Documentation** if applicable
77
4. [ ] Please check [Contributing guide](https://docs.espressif.com/projects/arduino-esp32/en/latest/contributing.html)
8+
5. [ ] Please **confirm option to "Allow edits and access to secrets by maintainers"** when opening a Pull Request
89

910
*This entire section above can be deleted if all items are checked.*
1011

Diff for: .github/scripts/on-push.sh

+6-12
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,16 @@ if [ "$BUILD_PIO" -eq 0 ]; then
7373

7474
SKETCHES_ESP32="\
7575
$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\
76-
$ARDUINO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino\
76+
$ARDUINO_ESP32_PATH/libraries/BLE/examples/Server/Server.ino\
7777
$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino\
7878
$ARDUINO_ESP32_PATH/libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics.ino\
7979
"
8080

81-
SKETCHES_ESP32XX="\
82-
$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\
83-
$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino\
84-
$ARDUINO_ESP32_PATH/libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics.ino\
85-
"
86-
8781
build "esp32s3" $FQBN_ESP32S3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
88-
build "esp32s2" $FQBN_ESP32S2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
89-
build "esp32c3" $FQBN_ESP32C3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
90-
build "esp32c6" $FQBN_ESP32C6 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
91-
build "esp32h2" $FQBN_ESP32H2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
82+
build "esp32s2" $FQBN_ESP32S2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
83+
build "esp32c3" $FQBN_ESP32C3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
84+
build "esp32c6" $FQBN_ESP32C6 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
85+
build "esp32h2" $FQBN_ESP32H2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
9286
build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
9387
else
9488
source ${SCRIPTS_DIR}/install-platformio-esp32.sh
@@ -98,7 +92,7 @@ else
9892
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
9993
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
10094
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
101-
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
95+
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BLE/examples/Server/Server.ino" && \
10296
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
10397

10498
# Basic sanity testing for other series

Diff for: .github/scripts/sketch_utils.sh

+16
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
126126
# of configuration built in case of a multiconfiguration test.
127127

128128
sketchname=$(basename $sketchdir)
129+
130+
if [[ -n $target ]] && [[ -f "$sketchdir/.skip.$target" ]]; then
131+
echo "Skipping $sketchname for target $target"
132+
exit 0
133+
fi
129134

130135
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
131136
if [ -n "$ARDUINO_BUILD_DIR" ]; then
@@ -159,6 +164,12 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
159164
--build-cache-path "$ARDUINO_CACHE_DIR" \
160165
--build-path "$build_dir" \
161166
$xtra_opts "${sketchdir}"
167+
168+
exit_status=$?
169+
if [ $exit_status -ne 0 ]; then
170+
echo ""ERROR: Compilation failed with error code $exit_status""
171+
exit $exit_status
172+
fi
162173
elif [ -f "$ide_path/arduino-builder" ]; then
163174
echo "Building $sketchname with arduino-builder and FQBN=$currfqbn"
164175
echo "Build path = $build_dir"
@@ -173,6 +184,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
173184
-build-path "$build_dir" \
174185
$xtra_opts "${sketchdir}/${sketchname}.ino"
175186

187+
exit_status=$?
188+
if [ $exit_status -ne 0 ]; then
189+
echo ""ERROR: Compilation failed with error code $exit_status""
190+
exit $exit_status
191+
fi
176192
# $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
177193
# -fqbn=\"$currfqbn\" \
178194
# -warnings="all" \

Diff for: .github/scripts/tests_build.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ while [ ! -z "$1" ]; do
4646
shift
4747
done
4848

49-
source ${SCRIPTS_DIR}/install-arduino-ide.sh
49+
#source ${SCRIPTS_DIR}/install-arduino-ide.sh
50+
source ${SCRIPTS_DIR}/install-arduino-cli.sh
5051
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
5152

5253
args="-ai $ARDUINO_IDE_PATH -au $ARDUINO_USR_PATH"

Diff for: .github/workflows/boards.yml

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ jobs:
4545
- name: Checkout repository
4646
uses: actions/checkout@v3
4747

48+
- name: Check if build.board is uppercase
49+
run: |
50+
board_name=$(echo ${{ matrix.fqbn }} | awk -F':' '{print $NF}')
51+
if grep -q "^$board_name.build.board=[A-Z0-9_]*$" boards.txt; then
52+
echo "$board_name.build.board is valid.";
53+
else
54+
echo "Error: $board_name.build.board is not uppercase!";
55+
exit 1;
56+
fi
57+
4858
- name: Compile sketch
4959
uses: P-R-O-C-H-Y/compile-sketches@main
5060
with:

Diff for: .github/workflows/dangerjs.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: DangerJS Pull Request linter
2+
on:
3+
pull_request_target:
4+
types: [opened, edited, reopened, synchronize]
5+
6+
permissions:
7+
pull-requests: write
8+
contents: write
9+
10+
jobs:
11+
pull-request-style-linter:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out PR head
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.event.pull_request.head.sha }}
18+
19+
- name: DangerJS pull request linter
20+
uses: espressif/shared-github-dangerjs@v1
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ set(LIBRARY_SRCS
115115
libraries/Update/src/Updater.cpp
116116
libraries/Update/src/HttpsOTAUpdate.cpp
117117
libraries/USB/src/USBHID.cpp
118+
libraries/USB/src/USBMIDI.cpp
118119
libraries/USB/src/USBHIDMouse.cpp
119120
libraries/USB/src/USBHIDKeyboard.cpp
120121
libraries/USB/src/USBHIDGamepad.cpp

Diff for: boards.txt

+80-9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ menu.MemoryType=Memory Type
1818
menu.EraseFlash=Erase All Flash Before Sketch Upload
1919
menu.JTAGAdapter=JTAG Adapter
2020
menu.ZigbeeMode=Zigbee Mode
21+
menu.PinNumbers=Pin Numbering
2122

2223
# Custom options
2324
menu.Revision=Board Revision
@@ -429,6 +430,8 @@ esp32c6.menu.PartitionScheme.custom.upload.maximum_size=16777216
429430

430431
esp32c6.menu.CPUFreq.160=160MHz (WiFi)
431432
esp32c6.menu.CPUFreq.160.build.f_cpu=160000000L
433+
esp32c6.menu.CPUFreq.120=120MHz (WiFi)
434+
esp32c6.menu.CPUFreq.120.build.f_cpu=120000000L
432435
esp32c6.menu.CPUFreq.80=80MHz (WiFi)
433436
esp32c6.menu.CPUFreq.80.build.f_cpu=80000000L
434437
esp32c6.menu.CPUFreq.40=40MHz
@@ -16274,7 +16277,7 @@ m5stack-core2.build.f_cpu=240000000L
1627416277
m5stack-core2.build.flash_size=16MB
1627516278
m5stack-core2.build.flash_freq=80m
1627616279
m5stack-core2.build.flash_mode=dio
16277-
m5stack-core2.build.boot=dio
16280+
m5stack-core2.build.boot=qio
1627816281
m5stack-core2.build.partitions=default_16MB
1627916282
m5stack-core2.build.defines=
1628016283

@@ -17109,7 +17112,7 @@ heltec_wifi_kit_32.build.target=esp32
1710917112
heltec_wifi_kit_32.build.mcu=esp32
1711017113
heltec_wifi_kit_32.build.core=esp32
1711117114
heltec_wifi_kit_32.build.variant=heltec_wifi_kit_32
17112-
heltec_wifi_kit_32.build.board=heltec_wifi_kit_32
17115+
heltec_wifi_kit_32.build.board=HELTEC_WIFI_KIT_32
1711317116

1711417117
heltec_wifi_kit_32.build.f_cpu=240000000L
1711517118
heltec_wifi_kit_32.build.flash_size=4MB
@@ -17198,7 +17201,7 @@ heltec_wifi_kit_32_V3.build.target=esp32s3
1719817201
heltec_wifi_kit_32_V3.build.mcu=esp32s3
1719917202
heltec_wifi_kit_32_V3.build.core=esp32
1720017203
heltec_wifi_kit_32_V3.build.variant=heltec_wifi_kit_32_V3
17201-
heltec_wifi_kit_32_V3.build.board=heltec_wifi_kit_32_V3
17204+
heltec_wifi_kit_32_V3.build.board=HELTEC_WIFI_KIT_32_V3
1720217205

1720317206
heltec_wifi_kit_32_V3.build.usb_mode=1
1720417207
heltec_wifi_kit_32_V3.build.cdc_on_boot=0
@@ -17297,7 +17300,7 @@ heltec_wifi_lora_32.build.target=esp32
1729717300
heltec_wifi_lora_32.build.mcu=esp32
1729817301
heltec_wifi_lora_32.build.core=esp32
1729917302
heltec_wifi_lora_32.build.variant=heltec_wifi_lora_32
17300-
heltec_wifi_lora_32.build.board=heltec_wifi_lora_32
17303+
heltec_wifi_lora_32.build.board=HELTEC_WIFI_LORA_32
1730117304

1730217305
heltec_wifi_lora_32.build.f_cpu=240000000L
1730317306
heltec_wifi_lora_32.build.flash_size=4MB
@@ -17434,7 +17437,7 @@ heltec_wifi_lora_32_V2.build.target=esp32
1743417437
heltec_wifi_lora_32_V2.build.mcu=esp32
1743517438
heltec_wifi_lora_32_V2.build.core=esp32
1743617439
heltec_wifi_lora_32_V2.build.variant=heltec_wifi_lora_32_V2
17437-
heltec_wifi_lora_32_V2.build.board=heltec_wifi_lora_32_V2
17440+
heltec_wifi_lora_32_V2.build.board=HELTEC_WIFI_LORA_32_V2
1743817441

1743917442
heltec_wifi_lora_32_V2.build.f_cpu=240000000L
1744017443
heltec_wifi_lora_32_V2.build.flash_size=8MB
@@ -17550,7 +17553,7 @@ heltec_wifi_lora_32_V3.build.target=esp32s3
1755017553
heltec_wifi_lora_32_V3.build.mcu=esp32s3
1755117554
heltec_wifi_lora_32_V3.build.core=esp32
1755217555
heltec_wifi_lora_32_V3.build.variant=heltec_wifi_lora_32_V3
17553-
heltec_wifi_lora_32_V3.build.board=heltec_wifi_32_lora_V3
17556+
heltec_wifi_lora_32_V3.build.board=HELTEC_WIFI_LORA_32_V3
1755417557

1755517558
heltec_wifi_lora_32_V3.build.usb_mode=1
1755617559
heltec_wifi_lora_32_V3.build.cdc_on_boot=0
@@ -17692,7 +17695,7 @@ heltec_wireless_stick.build.target=esp32
1769217695
heltec_wireless_stick.build.mcu=esp32
1769317696
heltec_wireless_stick.build.core=esp32
1769417697
heltec_wireless_stick.build.variant=heltec_wireless_stick
17695-
heltec_wireless_stick.build.board=heltec_wireless_stick
17698+
heltec_wireless_stick.build.board=HELTEC_WIRELESS_STICK
1769617699

1769717700
heltec_wireless_stick.build.f_cpu=240000000L
1769817701
heltec_wireless_stick.build.flash_size=8MB
@@ -17805,7 +17808,7 @@ heltec_wireless_stick_lite.build.target=esp32
1780517808
heltec_wireless_stick_lite.build.mcu=esp32
1780617809
heltec_wireless_stick_lite.build.core=esp32
1780717810
heltec_wireless_stick_lite.build.variant=heltec_wireless_stick_lite
17808-
heltec_wireless_stick_lite.build.board=heltec_wireless_stick_LITE
17811+
heltec_wireless_stick_lite.build.board=HELTEC_WIRELESS_STICK_LITE
1780917812

1781017813
heltec_wireless_stick_lite.build.f_cpu=240000000L
1781117814
heltec_wireless_stick_lite.build.flash_size=4MB
@@ -29688,4 +29691,72 @@ sensebox_mcu_esp32s2.menu.EraseFlash.none.upload.erase_cmd=
2968829691
sensebox_mcu_esp32s2.menu.EraseFlash.all=Enabled
2968929692
sensebox_mcu_esp32s2.menu.EraseFlash.all.upload.erase_cmd=-e
2969029693

29691-
##############################################################
29694+
##############################################################
29695+
29696+
nano_nora.name=Arduino Nano ESP32
29697+
nano_nora.vid.0=0x2341
29698+
nano_nora.pid.0=0x0070
29699+
nano_nora.upload_port.0.vid=0x2341
29700+
nano_nora.upload_port.0.pid=0x0070
29701+
29702+
nano_nora.bootloader.tool=esptool_py
29703+
nano_nora.bootloader.tool.default=esptool_py
29704+
29705+
nano_nora.upload.tool=dfu-util
29706+
nano_nora.upload.tool.default=dfu-util
29707+
nano_nora.upload.tool.network=esp_ota
29708+
nano_nora.upload.protocol=serial
29709+
nano_nora.upload.maximum_size=3145728
29710+
nano_nora.upload.maximum_data_size=327680
29711+
nano_nora.upload.use_1200bps_touch=false
29712+
nano_nora.upload.wait_for_upload_port=false
29713+
29714+
nano_nora.serial.disableDTR=false
29715+
nano_nora.serial.disableRTS=false
29716+
29717+
nano_nora.build.tarch=xtensa
29718+
nano_nora.build.bootloader_addr=0x0
29719+
nano_nora.build.target=esp32s3
29720+
nano_nora.build.mcu=esp32s3
29721+
nano_nora.build.core=esp32
29722+
nano_nora.build.variant=arduino_nano_nora
29723+
nano_nora.build.board=NANO_ESP32
29724+
nano_nora.build.code_debug=0
29725+
29726+
nano_nora.build.usb_mode=0
29727+
nano_nora.build.cdc_on_boot=1
29728+
nano_nora.build.msc_on_boot=0
29729+
nano_nora.build.dfu_on_boot=1
29730+
nano_nora.build.f_cpu=240000000L
29731+
nano_nora.build.flash_size=16MB
29732+
nano_nora.build.flash_freq=80m
29733+
nano_nora.build.flash_mode=dio
29734+
nano_nora.build.boot=qio
29735+
nano_nora.build.boot_freq=80m
29736+
nano_nora.build.partitions=app3M_fat9M_fact512k_16MB
29737+
nano_nora.build.defines=-DBOARD_HAS_PIN_REMAP {build.disable_pin_remap} -DBOARD_HAS_PSRAM '-DUSB_MANUFACTURER="Arduino"' '-DUSB_PRODUCT="Nano ESP32"'
29738+
nano_nora.build.loop_core=-DARDUINO_RUNNING_CORE=1
29739+
nano_nora.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
29740+
nano_nora.build.psram_type=opi
29741+
nano_nora.build.memory_type={build.boot}_{build.psram_type}
29742+
nano_nora.build.disable_pin_remap=
29743+
29744+
nano_nora.tools.esptool_py.program.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0xf70000 "{build.variant.path}/extra/nora_recovery/nora_recovery.ino.bin" 0x10000 "{build.path}/{build.project_name}.bin"
29745+
nano_nora.tools.esptool_py.erase.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset erase_flash
29746+
29747+
nano_nora.menu.PartitionScheme.default=With FAT partition (default)
29748+
nano_nora.menu.PartitionScheme.spiffs=With SPIFFS partition (advanced)
29749+
nano_nora.menu.PartitionScheme.spiffs.build.partitions=app3M_spiffs9M_fact512k_16MB
29750+
29751+
nano_nora.menu.PinNumbers.default=By Arduino pin (default)
29752+
nano_nora.menu.PinNumbers.byGPIONumber=By GPIO number (legacy)
29753+
nano_nora.menu.PinNumbers.byGPIONumber.build.disable_pin_remap=-DBOARD_USES_HW_GPIO_NUMBERS
29754+
29755+
nano_nora.menu.USBMode.default=Normal mode (TinyUSB)
29756+
nano_nora.menu.USBMode.hwcdc=Debug mode (Hardware CDC)
29757+
nano_nora.menu.USBMode.hwcdc.build.usb_mode=1
29758+
nano_nora.menu.USBMode.hwcdc.build.copy_jtag_files=1
29759+
nano_nora.menu.USBMode.hwcdc.build.openocdscript=esp32s3-builtin.cfg
29760+
nano_nora.menu.USBMode.hwcdc.build.debugconfig=esp32s3-arduino.json
29761+
29762+
##############################################################

Diff for: cores/esp32/Arduino.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@
111111
#define analogInPinToBit(P) (P)
112112
#if SOC_GPIO_PIN_COUNT <= 32
113113
#define digitalPinToPort(pin) (0)
114-
#define digitalPinToBitMask(pin) (1UL << (pin))
114+
#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
115115
#define portOutputRegister(port) ((volatile uint32_t*)GPIO_OUT_REG)
116116
#define portInputRegister(port) ((volatile uint32_t*)GPIO_IN_REG)
117117
#define portModeRegister(port) ((volatile uint32_t*)GPIO_ENABLE_REG)
118118
#elif SOC_GPIO_PIN_COUNT <= 64
119-
#define digitalPinToPort(pin) (((pin)>31)?1:0)
120-
#define digitalPinToBitMask(pin) (1UL << (((pin)>31)?((pin)-32):(pin)))
119+
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin)>31)?1:0)
120+
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin)&31))
121121
#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
122122
#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
123123
#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
@@ -139,8 +139,8 @@
139139
#endif
140140
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
141141
#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
142-
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):NOT_AN_INTERRUPT)
143-
#define digitalPinHasPWM(p) ((p)<NUM_DIGITAL_PINS)
142+
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p))<NUM_DIGITAL_PINS)?digitalPinToGPIONumber(p):NOT_AN_INTERRUPT)
143+
#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p))<NUM_DIGITAL_PINS)
144144

145145
typedef bool boolean;
146146
typedef uint8_t byte;
@@ -236,5 +236,6 @@ void noTone(uint8_t _pin);
236236
#endif /* __cplusplus */
237237

238238
#include "pins_arduino.h"
239+
#include "io_pin_remap.h"
239240

240241
#endif /* _ESP32_CORE_ARDUINO_H_ */

Diff for: cores/esp32/Esp.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -225,30 +225,31 @@ String EspClass::getSketchMD5()
225225
const esp_partition_t *running = esp_ota_get_running_partition();
226226
if (!running) {
227227
log_e("Partition could not be found");
228-
229228
return String();
230229
}
230+
231231
const size_t bufSize = SPI_FLASH_SEC_SIZE;
232-
std::unique_ptr<uint8_t[]> buf(new uint8_t[bufSize]);
233-
uint32_t offset = 0;
234-
if(!buf.get()) {
232+
uint8_t *pb = (uint8_t *)malloc(bufSize);
233+
if(!pb) {
235234
log_e("Not enough memory to allocate buffer");
236-
237235
return String();
238236
}
237+
uint32_t offset = 0;
238+
239239
MD5Builder md5;
240240
md5.begin();
241-
while( lengthLeft > 0) {
241+
while(lengthLeft > 0) {
242242
size_t readBytes = (lengthLeft < bufSize) ? lengthLeft : bufSize;
243-
if (!ESP.flashRead(running->address + offset, reinterpret_cast<uint32_t*>(buf.get()), (readBytes + 3) & ~3)) {
243+
if (!ESP.flashRead(running->address + offset, (uint32_t *)pb, (readBytes + 3) & ~3)) {
244+
free(pb);
244245
log_e("Could not read buffer from flash");
245-
246246
return String();
247247
}
248-
md5.add(buf.get(), readBytes);
248+
md5.add(pb, readBytes);
249249
lengthLeft -= readBytes;
250250
offset += readBytes;
251251
}
252+
free(pb);
252253
md5.calculate();
253254
result = md5.toString();
254255
return result;

Diff for: cores/esp32/FunctionalInterrupt.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
#include <stdint.h>
1313

1414
struct InterruptArgStructure {
15-
std::function<void(void)> interruptFunction;
15+
std::function<void(void)> interruptFunction;
1616
};
1717

18-
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode);
19-
18+
// The extra set of parentheses here prevents macros defined
19+
// in io_pin_remap.h from applying to this declaration.
20+
void (attachInterrupt)(uint8_t pin, std::function<void(void)> intRoutine, int mode);
2021

2122
#endif /* CORE_CORE_FUNCTIONALINTERRUPT_H_ */

0 commit comments

Comments
 (0)