diff --git a/.github/scripts/install-arduino-ide.sh b/.github/scripts/install-arduino-ide.sh index 5647229cb40..0f36120b3a9 100755 --- a/.github/scripts/install-arduino-ide.sh +++ b/.github/scripts/install-arduino-ide.sh @@ -34,9 +34,6 @@ else fi export OS_NAME -ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp" -ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp" - if [ "$OS_IS_MACOS" == "1" ]; then export ARDUINO_IDE_PATH="/Applications/Arduino.app/Contents/Java" export ARDUINO_USR_PATH="$HOME/Documents/Arduino" @@ -81,156 +78,3 @@ if [ ! -d "$ARDUINO_IDE_PATH" ]; then echo "" fi -function build_sketch(){ # build_sketch [extra-options] - if [ "$#" -lt 2 ]; then - echo "ERROR: Illegal number of parameters" - echo "USAGE: build_sketch [extra-options]" - return 1 - fi - - local fqbn="$1" - local sketch="$2" - local xtra_opts="$3" - local win_opts="" - if [ "$OS_IS_WINDOWS" == "1" ]; then - local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"` - local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"` - win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version" - fi - - #echo "" - #echo "Compiling '"$(basename "$sketch")"' ..." - mkdir -p "$ARDUINO_BUILD_DIR" - mkdir -p "$ARDUINO_CACHE_DIR" - $ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \ - -fqbn=$fqbn \ - -warnings="all" \ - -tools "$ARDUINO_IDE_PATH/tools-builder" \ - -tools "$ARDUINO_IDE_PATH/tools" \ - -built-in-libraries "$ARDUINO_IDE_PATH/libraries" \ - -hardware "$ARDUINO_IDE_PATH/hardware" \ - -hardware "$ARDUINO_USR_PATH/hardware" \ - -libraries "$ARDUINO_USR_PATH/libraries" \ - -build-cache "$ARDUINO_CACHE_DIR" \ - -build-path "$ARDUINO_BUILD_DIR" \ - $win_opts $xtra_opts "$sketch" -} - -function count_sketches(){ # count_sketches - local examples="$1" - local target="$2" - rm -rf sketches.txt - if [ ! -d "$examples" ]; then - touch sketches.txt - return 0 - fi - local sketches=$(find $examples -name *.ino) - local sketchnum=0 - for sketch in $sketches; do - local sketchdir=$(dirname $sketch) - local sketchdirname=$(basename $sketchdir) - local sketchname=$(basename $sketch) - if [[ "$sketchdirname.ino" != "$sketchname" ]]; then - continue - elif [[ -f "$sketchdir/.skip.$target" ]]; then - continue - else - echo $sketch >> sketches.txt - sketchnum=$(($sketchnum + 1)) - fi - done - return $sketchnum -} - -function build_sketches(){ # build_sketches [extra-options] - local fqbn=$1 - local target="$2" - local examples=$3 - local chunk_idex=$4 - local chunks_num=$5 - local xtra_opts=$6 - - if [ "$#" -lt 3 ]; then - echo "ERROR: Illegal number of parameters" - echo "USAGE: build_sketches [ ] [extra-options]" - return 1 - fi - - if [ "$#" -lt 5 ]; then - chunk_idex="0" - chunks_num="1" - xtra_opts=$4 - fi - - if [ "$chunks_num" -le 0 ]; then - echo "ERROR: Chunks count must be positive number" - return 1 - fi - if [ "$chunk_idex" -ge "$chunks_num" ] && [ "$chunks_num" -ge 2 ]; then - echo "ERROR: Chunk index must be less than chunks count" - return 1 - fi - - set +e - count_sketches "$examples" "$target" - local sketchcount=$? - set -e - local sketches=$(cat sketches.txt) - rm -rf sketches.txt - - local chunk_size=$(( $sketchcount / $chunks_num )) - local all_chunks=$(( $chunks_num * $chunk_size )) - if [ "$all_chunks" -lt "$sketchcount" ]; then - chunk_size=$(( $chunk_size + 1 )) - fi - - local start_index=0 - local end_index=0 - if [ "$chunk_idex" -ge "$chunks_num" ]; then - start_index=$chunk_idex - end_index=$sketchcount - else - start_index=$(( $chunk_idex * $chunk_size )) - if [ "$sketchcount" -le "$start_index" ]; then - echo "Skipping job" - return 0 - fi - - end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size )) - if [ "$end_index" -gt "$sketchcount" ]; then - end_index=$sketchcount - fi - fi - - local start_num=$(( $start_index + 1 )) - echo "Found $sketchcount Sketches for target '$target'"; - echo "Chunk Index : $chunk_idex" - echo "Chunk Count : $chunks_num" - echo "Chunk Size : $chunk_size" - echo "Start Sketch: $start_num" - echo "End Sketch : $end_index" - - local sketchnum=0 - for sketch in $sketches; do - local sketchdir=$(dirname $sketch) - local sketchdirname=$(basename $sketchdir) - local sketchname=$(basename $sketch) - if [ "${sketchdirname}.ino" != "$sketchname" ] \ - || [ -f "$sketchdir/.skip.$target" ]; then - continue - fi - sketchnum=$(($sketchnum + 1)) - if [ "$sketchnum" -le "$start_index" ] \ - || [ "$sketchnum" -gt "$end_index" ]; then - continue - fi - echo "" - echo "Building Sketch Index $(($sketchnum - 1)) - $sketchdirname" - build_sketch "$fqbn" "$sketch" "$xtra_opts" - local result=$? - if [ $result -ne 0 ]; then - return $result - fi - done - return 0 -} diff --git a/.github/scripts/install-platformio-esp32.sh b/.github/scripts/install-platformio-esp32.sh index 0d27967bfa8..a19e11b9ae6 100755 --- a/.github/scripts/install-platformio-esp32.sh +++ b/.github/scripts/install-platformio-esp32.sh @@ -3,9 +3,9 @@ export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32" PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master" -XTENSA32_TOOLCHAIN_VERSION="8.4.0+2021r1" -XTENSA32S2_TOOLCHAIN_VERSION="8.4.0+2021r1" -RISCV_TOOLCHAIN_VERSION="8.4.0+2021r1" +XTENSA32_TOOLCHAIN_VERSION="8.4.0+2021r2-patch2" +XTENSA32S2_TOOLCHAIN_VERSION="8.4.0+2021r2-patch2" +RISCV_TOOLCHAIN_VERSION="8.4.0+2021r2-patch2" ESPTOOLPY_VERSION="~1.30100.0" ESPRESSIF_ORGANIZATION_NAME="espressif" diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index dbca978fdfb..5d8ffe9cd3e 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -2,6 +2,40 @@ set -e +function build(){ + local target=$1 + local fqbn=$2 + local chunk_index=$3 + local chunks_cnt=$4 + local sketches=$5 + + local BUILD_SKETCH="${SCRIPTS_DIR}/sketch_utils.sh build" + local BUILD_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh chunk_build" + + local args="$ARDUINO_IDE_PATH $ARDUINO_USR_PATH" + + args+=" \"$fqbn\"" + + if [ "$OS_IS_LINUX" == "1" ]; then + args+=" $target" + args+=" $ARDUINO_ESP32_PATH/libraries" + args+=" $chunk_index $chunks_cnt" + ${BUILD_SKETCHES} ${args} + else + if [ "$OS_IS_WINDOWS" == "1" ]; then + local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"` + local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"` + win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version + -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version" + args+=" ${win_opts}" + fi + + for sketch in ${sketches}; do + ${BUILD_SKETCH} ${args} ${sketch} + done + fi +} + if [ -z "$GITHUB_WORKSPACE" ]; then export GITHUB_WORKSPACE="$PWD" export GITHUB_REPOSITORY="espressif/arduino-esp32" @@ -22,57 +56,31 @@ fi #echo "Updating submodules ..." #git -C "$GITHUB_WORKSPACE" submodule update --init --recursive > /dev/null 2>&1 +SCRIPTS_DIR="./.github/scripts" if [ "$BUILD_PIO" -eq 0 ]; then - # ArduinoIDE ESP32 Test - TARGET="esp32" - FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app" source ./.github/scripts/install-arduino-ide.sh - source ./.github/scripts/install-arduino-core-esp32.sh - if [ "$OS_IS_WINDOWS" == "1" ]; then - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino" - elif [ "$OS_IS_MACOS" == "1" ]; then - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino" - else - # CMake Test - if [ "$CHUNK_INDEX" -eq 0 ]; then - bash "$ARDUINO_ESP32_PATH/.github/scripts/check-cmakelists.sh" - fi - build_sketches "$FQBN" "$TARGET" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT" - fi + source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh - # ArduinoIDE ESP32S2 Test - TARGET="esp32s2" - FQBN="espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app" - if [ "$OS_IS_WINDOWS" == "1" ]; then - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" - elif [ "$OS_IS_MACOS" == "1" ]; then - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" - else - build_sketches "$FQBN" "$TARGET" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT" - fi + FQBN_ESP32="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app" + FQBN_ESP32S2="espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app" + FQBN_ESP32C3="espressif:esp32:esp32c3:PartitionScheme=huge_app" - # ArduinoIDE ESP32C3 Test - TARGET="esp32c3" - FQBN="espressif:esp32:esp32c3:PartitionScheme=huge_app" - if [ "$OS_IS_WINDOWS" == "1" ]; then - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" - elif [ "$OS_IS_MACOS" == "1" ]; then - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \ - build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" - else - build_sketches "$FQBN" "$TARGET" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT" - fi + SKETCHES_ESP32="\ + $ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\ + $ARDUINO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino\ + $ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino\ + " + + SKETCHES_ESP32XX="\ + $ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\ + $ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino\ + " + + build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 + build "esp32s2" $FQBN_ESP32S2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX + build "esp32c3" $FQBN_ESP32C3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX else - source ./.github/scripts/install-platformio-esp32.sh + source ./${SCRIPTS_DIR}/install-platformio-esp32.sh # PlatformIO ESP32 Test BOARD="esp32dev" OPTIONS="board_build.partitions = huge_app.csv" diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh new file mode 100755 index 00000000000..abc6a0476e5 --- /dev/null +++ b/.github/scripts/sketch_utils.sh @@ -0,0 +1,184 @@ +#!/bin/bash + +function build_sketch(){ # build_sketch [extra-options] + if [ "$#" -lt 4 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: ${0} build [extra-options]" + return 1 + fi + + ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp" + local ide_path=$1 + local usr_path=$2 + local fqbn=$3 + local sketch=$4 + local xtra_opts=$5 + local win_opts=$6 + + build_dir="$(dirname $sketch)/build" + mkdir -p "$build_dir" + mkdir -p "$ARDUINO_CACHE_DIR" + $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \ + -fqbn=$fqbn \ + -warnings="all" \ + -tools "$ide_path/tools-builder" \ + -tools "$ide_path/tools" \ + -built-in-libraries "$ide_path/libraries" \ + -hardware "$ide_path/hardware" \ + -hardware "$usr_path/hardware" \ + -libraries "$usr_path/libraries" \ + -build-cache "$ARDUINO_CACHE_DIR" \ + -build-path "$build_dir" \ + $win_opts $xtra_opts "$sketch" +} + +function count_sketches(){ # count_sketches + local path=$1 + local target=$2 + + if [ $# -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: ${0} count " + fi + + rm -rf sketches.txt + if [ ! -d "$path" ]; then + touch sketches.txt + return 0 + fi + + local sketches=$(find $path -name *.ino) + local sketchnum=0 + for sketch in $sketches; do + local sketchdir=$(dirname $sketch) + local sketchdirname=$(basename $sketchdir) + local sketchname=$(basename $sketch) + if [[ "$sketchdirname.ino" != "$sketchname" ]]; then + continue + elif [[ -f "$sketchdir/.skip.$target" ]]; then + continue + else + echo $sketch >> sketches.txt + sketchnum=$(($sketchnum + 1)) + fi + done + return $sketchnum +} + +function build_sketches(){ # build_sketches [extra-options] + local ide_path=$1 + local usr_path=$2 + local fqbn=$3 + local target=$4 + local path=$5 + local chunk_idex=$6 + local chunks_num=$7 + local xtra_opts=$8 + + if [ "$#" -lt 7 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: ${0} chunk_build [ ] [extra-options]" + return 1 + fi + + if [ "$chunks_num" -le 0 ]; then + echo "ERROR: Chunks count must be positive number" + return 1 + fi + if [ "$chunk_idex" -ge "$chunks_num" ] && [ "$chunks_num" -ge 2 ]; then + echo "ERROR: Chunk index must be less than chunks count" + return 1 + fi + + set +e + count_sketches "$path" "$target" + local sketchcount=$? + set -e + local sketches=$(cat sketches.txt) + rm -rf sketches.txt + + local chunk_size=$(( $sketchcount / $chunks_num )) + local all_chunks=$(( $chunks_num * $chunk_size )) + if [ "$all_chunks" -lt "$sketchcount" ]; then + chunk_size=$(( $chunk_size + 1 )) + fi + + local start_index=0 + local end_index=0 + if [ "$chunk_idex" -ge "$chunks_num" ]; then + start_index=$chunk_idex + end_index=$sketchcount + else + start_index=$(( $chunk_idex * $chunk_size )) + if [ "$sketchcount" -le "$start_index" ]; then + echo "Skipping job" + return 0 + fi + + end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size )) + if [ "$end_index" -gt "$sketchcount" ]; then + end_index=$sketchcount + fi + fi + + local start_num=$(( $start_index + 1 )) + echo "Found $sketchcount Sketches for target '$target'"; + echo "Chunk Index : $chunk_idex" + echo "Chunk Count : $chunks_num" + echo "Chunk Size : $chunk_size" + echo "Start Sketch: $start_num" + echo "End Sketch : $end_index" + + local sketchnum=0 + for sketch in $sketches; do + local sketchdir=$(dirname $sketch) + local sketchdirname=$(basename $sketchdir) + local sketchname=$(basename $sketch) + sketchnum=$(($sketchnum + 1)) + if [ "$sketchnum" -le "$start_index" ] \ + || [ "$sketchnum" -gt "$end_index" ]; then + continue + fi + echo "" + echo "Building Sketch Index $(($sketchnum - 1)) - $sketchdirname" + build_sketch "$ide_path" "$usr_path" "$fqbn" "$sketch" "$xtra_opts" + local result=$? + if [ $result -ne 0 ]; then + return $result + fi + done + return 0 +} + +USAGE=" +USAGE: ${0} [command] [options] +Available commands: + count: Count sketches. + build: Build a sketch. + chunk_build: Build a chunk of sketches. +" + +cmd=$1 +shift +if [ -z $cmd ]; then + echo "ERROR: No command supplied" + echo "$USAGE" + exit 2 +fi + +case "$cmd" in + "count") + count_sketches $* + ;; + "build") + build_sketch $* + ;; + "chunk_build") + build_sketches $* + ;; + *) + echo "ERROR: Unrecognized command" + echo "$USAGE" + exit 2 +esac + diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index b5afd130dbd..773f2961f24 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -14,6 +14,13 @@ concurrency: jobs: + cmake-check: + name: Check cmake file + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: bash ./.github/scripts/check-cmakelists.sh + # Ubuntu build-arduino-linux: name: Arduino ${{ matrix.chunk }} on ubuntu-latest diff --git a/cores/esp32/WMath.cpp b/cores/esp32/WMath.cpp index bb75fc8a2f6..931ac96637b 100644 --- a/cores/esp32/WMath.cpp +++ b/cores/esp32/WMath.cpp @@ -67,14 +67,14 @@ long random(long howsmall, long howbig) } long map(long x, long in_min, long in_max, long out_min, long out_max) { - const long dividend = out_max - out_min; - const long divisor = in_max - in_min; - const long delta = x - in_min; - if(divisor == 0){ - log_e("Invalid map input range, min == max"); - return -1; //AVR returns -1, SAM returns 0 + const long run = in_max - in_min; + if(run == 0){ + log_e("map(): Invalid input range, min == max"); + return -1; // AVR returns -1, SAM returns 0 } - return (delta * dividend + (divisor / 2)) / divisor + out_min; + const long rise = out_max - out_min; + const long delta = x - in_min; + return (delta * rise) / run + out_min; } uint16_t makeWord(uint16_t w) diff --git a/cores/esp32/WString.cpp b/cores/esp32/WString.cpp index ded2a3c1e78..4badf63d0fe 100644 --- a/cores/esp32/WString.cpp +++ b/cores/esp32/WString.cpp @@ -24,6 +24,7 @@ #include #include "WString.h" #include "stdlib_noniso.h" +#include "esp32-hal-log.h" /*********************************************/ /* Constructors */ @@ -774,7 +775,8 @@ void String::replace(const String& find, const String& replace) { if(size == len()) return; if(size > capacity() && !changeBuffer(size)) - return; // XXX: tell user! + log_w("String.Replace() Insufficient space to replace string"); + return; int index = len() - 1; while(index >= 0 && (index = lastIndexOf(find, index)) >= 0) { readFrom = wbuffer() + index + find.len(); diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 298b731d41e..233060408d2 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -106,9 +106,7 @@ static void uart_event_task(void *args) switch(event.type) { //Event of UART receving data case UART_DATA: - UART_MUTEX_LOCK(); if(uart->onReceive) uart->onReceive(); - UART_MUTEX_UNLOCK(); break; //Event of HW FIFO overflow detected case UART_FIFO_OVF: diff --git a/docs/ISSUE_TEMPLATE.md b/docs/ISSUE_TEMPLATE.md deleted file mode 100644 index 5cf96ef213b..00000000000 --- a/docs/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,47 +0,0 @@ -Make your question, not a Statement, inclusive. Include all pertinent information: - -What you are trying to do -Describe your system (Hardware, computer, O/S, core version, environment) -Describe what is failing -Show the shortest possible code that will duplicate the error -Show the EXACT error message (it doesn't work is not enough) -Then if someone is interested and knowledgeable you might get a answer. All of this work on your part shows us that you have worked to solve YOUR problem. The more complete your issue posting is, the more likely someone will volunteer their time to help you. - -If you have a Guru Meditation Error or Backtrace, ***please decode it***: -[ExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecoder) - ------------------------------ Remove above ----------------------------- - - -### Hardware: -||||||| -|:---|---|---|---|---|---| -|Board|ESP32 Dev Module|node32|ttgo_lora|ESP32-S2-Saola|Custom w/ ESP32-S2-WROVER 16MB| -|Version/Date|1.0.4|2.0.0|0badbeef|11/jul/2017|today's master| -|IDE name|Arduino IDE|Atom + Platform.io|IDF component|VSCode| -|Flash Frequency|40Mhz|80Mhz| -|PSRAM enabled|yes|no| -|Upload Speed|115200| -|Computer OS|Windows 10|Mac OSX|Ubuntu| - -### Description: -Describe your problem here - - -### Sketch: (leave the backquotes for [code formatting](https://help.github.com/articles/creating-and-highlighting-code-blocks/)) -```cpp - -//Change the code below by your sketch -#include - -void setup() { -} - -void loop() { -} -``` - -### Debug Messages: -``` -Enable Core debug level: Debug on tools menu of Arduino IDE, then put the serial output here -``` diff --git a/docs/source/api/i2c.rst b/docs/source/api/i2c.rst index 4c690488e28..f53d8f27a3c 100644 --- a/docs/source/api/i2c.rst +++ b/docs/source/api/i2c.rst @@ -381,4 +381,4 @@ Here is an example of how to use the I2C in Slave Mode. .. literalinclude:: ../../../libraries/Wire/examples/WireSlave/WireSlave.ino :language: arduino -.. _Arduino Wire Library: https://www.arduino.cc/en/reference/wire \ No newline at end of file +.. _Arduino Wire Library: https://www.arduino.cc/en/reference/wire diff --git a/docs/source/boards/boards.rst b/docs/source/boards/boards.rst index 12dbe4b175d..b0376f9c398 100644 --- a/docs/source/boards/boards.rst +++ b/docs/source/boards/boards.rst @@ -98,18 +98,13 @@ Generic Vendor .. note:: Create one file per board or one file with multiple boards. Do not add board information/description on this file. +.. include:: ../common/datasheet.inc + Resources --------- -* `ESP32 Datasheet`_ (Datasheet) -* `ESP32-S2 Datasheet`_ (Datasheet) -* `ESP32-C3 Datasheet`_ (Datasheet) - .. _Espressif Systems: https://www.espressif.com .. _Espressif Product Selector: https://products.espressif.com/ -.. _ESP32 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf -.. _ESP32-S2 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf -.. _ESP32-C3 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf .. |board_lolin_d32| raw:: html diff --git a/docs/source/boards/generic.rst b/docs/source/boards/generic.rst index 95bbcbeda4f..8ca4a79eace 100644 --- a/docs/source/boards/generic.rst +++ b/docs/source/boards/generic.rst @@ -26,9 +26,4 @@ Pin Layout Add here the pin layout image (not required). -Resources ---------- - -* `ESP32`_ (Datasheet) - -.. _ESP32: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf +.. include:: ../common/datasheet.inc diff --git a/docs/source/common/datasheet.inc b/docs/source/common/datasheet.inc new file mode 100644 index 00000000000..5f68b0115ff --- /dev/null +++ b/docs/source/common/datasheet.inc @@ -0,0 +1,13 @@ +Datasheet +--------- + +* `ESP32`_ (Datasheet) +* `ESP32-S2`_ (Datasheet) +* `ESP32-C3`_ (Datasheet) +* `ESP32-S3`_ (Datasheet) + +.. _Espressif Product Selector: https://products.espressif.com/ +.. _ESP32: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf +.. _ESP32-S2: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf +.. _ESP32-C3: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf +.. _ESP32-S3: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf diff --git a/docs/source/conf.py b/docs/source/conf.py index 33b42328007..36d9fbf4286 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,11 +18,11 @@ # -- Project information ----------------------------------------------------- project = 'Arduino-ESP32' -copyright = '2021, Espressif' +copyright = '2022, Espressif' author = 'Espressif' # The full version, including alpha/beta/rc tags -release = '2.0.0' +release = '2.0.2' # -- General configuration --------------------------------------------------- diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index 91b66b343a3..66c917283ad 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -34,10 +34,10 @@ Here are the ESP32 series supported by the Arduino-ESP32 project: ======== ====== =========== =================================== SoC Stable Development Datasheet ======== ====== =========== =================================== -ESP32 Yes Yes `ESP32 Datasheet`_ -ESP32-S2 Yes Yes `ESP32-S2 Datasheet`_ -ESP32-C3 Yes Yes `ESP32-C3 Datasheet`_ -ESP32-S3 No No `ESP32-S3 Datasheet`_ +ESP32 Yes Yes `ESP32`_ +ESP32-S2 Yes Yes `ESP32-S2`_ +ESP32-C3 Yes Yes `ESP32-C3`_ +ESP32-S3 No Yes `ESP32-S3`_ ======== ====== =========== =================================== See `Boards `_ for more details about ESP32 development boards. @@ -91,7 +91,9 @@ Before opening a new issue, please read this: Be sure to search for a similar reported issue. This avoids duplicating or creating noise in the GitHub Issues reporting. We also have the troubleshooting guide to save your time on the most common issues reported by users. -For more details, see the `Issue Template `_. +For more details about creating new Issue, see the `Issue Template `_. + +If you have any new idea, see the `Feature request Template `_. First Steps ----------- @@ -114,15 +116,14 @@ in the examples menu or inside each library folder. https://github.com/espressif/arduino-esp32/tree/master/libraries + +.. include:: common/datasheet.inc + Resources --------- .. _Espressif Systems: https://www.espressif.com .. _Espressif Product Selector: https://products.espressif.com/ -.. _ESP32 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf -.. _ESP32-S2 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf -.. _ESP32-C3 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf -.. _ESP32-S3 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf .. _Arduino.cc: https://www.arduino.cc/en/Main/Software .. _Arduino Reference: https://www.arduino.cc/reference/en/ .. _ESP32 Forum: https://esp32.com diff --git a/docs/source/index.rst b/docs/source/index.rst index 60d39d8442a..02f62c30290 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,7 +8,7 @@ Here you will find all the relevant information about the project. This is a work in progress documentation and we will appreciate your help! We are looking for contributors! .. toctree:: - :maxdepth: 2 + :maxdepth: 1 :caption: Contents: Getting Started diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 12dd8cfd37f..a6f37644dbd 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -64,12 +64,7 @@ Notes .. note:: Some peripherals are not available for all ESP32 families. To see more details about it, see the corresponding SoC at `Product Selector `_ page. -Datasheet -^^^^^^^^^ - -* `ESP32 `_ -* `ESP32-S2 `_ -* `ESP32-C3 `_ +.. include:: common/datasheet.inc APIs ---- @@ -78,13 +73,6 @@ The Arduino ESP32 offers some unique APIs, described in this section: .. toctree:: :maxdepth: 1 + :glob: - Bluetooth - Deep Sleep - ESPNOW - GPIO - I2C - RainMaker - Reset Reason - USB - Wi-Fi + api/* diff --git a/docs/source/tutorials/io_mux.rst b/docs/source/tutorials/io_mux.rst index 547be0e184b..8bdbb0799c3 100644 --- a/docs/source/tutorials/io_mux.rst +++ b/docs/source/tutorials/io_mux.rst @@ -62,7 +62,7 @@ JTAG Dedicated GPIOs SD/SDIO/MMC HostController Dedicated GPIOs Motor PWM Any GPIO SDIO/SPI SlaveController Dedicated GPIOs -UART Any GPIO +UART Any GPIO[1] I2C Any GPIO I2S Any GPIO LED PWM Any GPIO @@ -72,8 +72,11 @@ Parallel QSPI Dedicated GPIOs EMAC Dedicated GPIOs Pulse Counter Any GPIO TWAI Any GPIO +USB Dedicated GPIOs ============================== =================================== +[1] except for the download/programming mode decided by the bootloader. + This table is present on each datasheet provided by Espressif. Usage Examples @@ -106,16 +109,11 @@ To change the pins, we must call the ``Wire.setPins(int sda, int scl);`` functio A similar approach also applies for the other peripherals. +.. include:: ../common/datasheet.inc + Resources --------- -* `ESP32`_ (Datasheet) -* `ESP32-S2`_ (Datasheet) -* `ESP32-C3`_ (Datasheet) - .. _Espressif Systems: https://www.espressif.com .. _Espressif Product Selector: https://products.espressif.com/ -.. _ESP32: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf -.. _ESP32-S2: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf -.. _ESP32-C3: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf .. _IO MUX GPIO: https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf#iomuxgpio diff --git a/libraries/DNSServer/src/DNSServer.h b/libraries/DNSServer/src/DNSServer.h index a10ef9eaaf1..a8de0eff73b 100644 --- a/libraries/DNSServer/src/DNSServer.h +++ b/libraries/DNSServer/src/DNSServer.h @@ -66,8 +66,8 @@ struct DNSHeader struct DNSQuestion { - uint8_t QName[255] ; - int8_t QNameLength ; + uint8_t QName[256] ; //need 1 Byte for zero termination! + uint8_t QNameLength ; uint16_t QType ; uint16_t QClass ; } ; @@ -106,4 +106,4 @@ class DNSServer void replyWithIP(); void replyWithCustomCode(); }; -#endif \ No newline at end of file +#endif diff --git a/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino b/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino index 44ff625bf05..515391c9785 100644 --- a/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino +++ b/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino @@ -62,6 +62,7 @@ void setup() { config.frame_size = FRAMESIZE_SVGA; config.jpeg_quality = 12; config.fb_count = 1; + config.fb_location = CAMERA_FB_IN_DRAM; } #if defined(CAMERA_MODEL_ESP_EYE) diff --git a/libraries/HTTPClient/src/HTTPClient.h b/libraries/HTTPClient/src/HTTPClient.h index 1bb84d6d6b5..fb6a7d4db87 100644 --- a/libraries/HTTPClient/src/HTTPClient.h +++ b/libraries/HTTPClient/src/HTTPClient.h @@ -27,7 +27,9 @@ #ifndef HTTPClient_H_ #define HTTPClient_H_ +#ifndef HTTPCLIENT_1_1_COMPATIBLE #define HTTPCLIENT_1_1_COMPATIBLE +#endif #include #include diff --git a/libraries/SD/src/sd_diskio.cpp b/libraries/SD/src/sd_diskio.cpp index cf85f67d5b1..038c26ade36 100644 --- a/libraries/SD/src/sd_diskio.cpp +++ b/libraries/SD/src/sd_diskio.cpp @@ -121,7 +121,7 @@ bool sdSelectCard(uint8_t pdrv) { ardu_sdcard_t * card = s_cards[pdrv]; digitalWrite(card->ssPin, LOW); - bool s = sdWait(pdrv, 300); + bool s = sdWait(pdrv, 500); if (!s) { log_e("Select Failed"); digitalWrite(card->ssPin, HIGH); @@ -506,10 +506,17 @@ DSTATUS ff_sd_initialize(uint8_t pdrv) card->spi->transfer(0XFF); } - if (sdTransaction(pdrv, GO_IDLE_STATE, 0, NULL) != 1) { + // Fix mount issue - sdWait fail ignored before command GO_IDLE_STATE + digitalWrite(card->ssPin, LOW); + if(!sdWait(pdrv, 500)){ + log_w("sdWait fail ignored, card initialize continues"); + } + if (sdCommand(pdrv, GO_IDLE_STATE, 0, NULL) != 1){ + sdDeselectCard(pdrv); log_w("GO_IDLE_STATE failed"); goto unknown_card; } + sdDeselectCard(pdrv); token = sdTransaction(pdrv, CRC_ON_OFF, 1, NULL); if (token == 0x5) { diff --git a/libraries/WebServer/src/WebServer.h b/libraries/WebServer/src/WebServer.h index c169da82229..0293a09f209 100644 --- a/libraries/WebServer/src/WebServer.h +++ b/libraries/WebServer/src/WebServer.h @@ -85,13 +85,13 @@ class WebServer void requestAuthentication(HTTPAuthMethod mode = BASIC_AUTH, const char* realm = NULL, const String& authFailMsg = String("") ); typedef std::function THandlerFunction; - void on(const Uri &uri, THandlerFunction handler); - void on(const Uri &uri, HTTPMethod method, THandlerFunction fn); - void on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn); + void on(const Uri &uri, THandlerFunction fn); + void on(const Uri &uri, HTTPMethod method, THandlerFunction fn); + void on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn); //ufn handles file uploads void addHandler(RequestHandler* handler); void serveStatic(const char* uri, fs::FS& fs, const char* path, const char* cache_header = NULL ); void onNotFound(THandlerFunction fn); //called when handler is not assigned - void onFileUpload(THandlerFunction fn); //handle file uploads + void onFileUpload(THandlerFunction ufn); //handle file uploads String uri() { return _currentUri; } HTTPMethod method() { return _currentMethod; } diff --git a/libraries/WebServer/src/detail/RequestHandlersImpl.h b/libraries/WebServer/src/detail/RequestHandlersImpl.h index 699015746b3..4a7c28e58ae 100644 --- a/libraries/WebServer/src/detail/RequestHandlersImpl.h +++ b/libraries/WebServer/src/detail/RequestHandlersImpl.h @@ -68,7 +68,8 @@ class StaticRequestHandler : public RequestHandler { , _path(path) , _cache_header(cache_header) { - _isFile = fs.exists(path); + File f = fs.open(path); + _isFile = (f && (! f.isDirectory())); log_v("StaticRequestHandler: path=%s uri=%s isFile=%d, cache_header=%s\r\n", path, uri, _isFile, cache_header ? cache_header : ""); // issue 5506 - cache_header can be nullptr _baseUriLength = _uri.length(); } diff --git a/libraries/WiFiClientSecure/src/ssl_client.cpp b/libraries/WiFiClientSecure/src/ssl_client.cpp index 0d28e85acae..46f74205044 100644 --- a/libraries/WiFiClientSecure/src/ssl_client.cpp +++ b/libraries/WiFiClientSecure/src/ssl_client.cpp @@ -335,8 +335,13 @@ void stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, cons mbedtls_ssl_config_free(&ssl_client->ssl_conf); mbedtls_ctr_drbg_free(&ssl_client->drbg_ctx); mbedtls_entropy_free(&ssl_client->entropy_ctx); + + // save only interesting field + int timeout = ssl_client->handshake_timeout; // reset embedded pointers to zero memset(ssl_client, 0, sizeof(sslclient_context)); + + ssl_client->handshake_timeout = timeout; } diff --git a/libraries/WiFiProv/src/WiFiProv.h b/libraries/WiFiProv/src/WiFiProv.h index 11dfd2e47e1..bbcab41a6f8 100644 --- a/libraries/WiFiProv/src/WiFiProv.h +++ b/libraries/WiFiProv/src/WiFiProv.h @@ -17,6 +17,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef WiFiProv_h +#define WiFiProv_h + #include "WiFi.h" #include "wifi_provisioning/manager.h" //Select the scheme using which you want to provision @@ -48,3 +51,5 @@ class WiFiProvClass }; extern WiFiProvClass WiFiProv; + +#endif