From bb7df04446679c3c52015abaea133319e2de4178 Mon Sep 17 00:00:00 2001 From: P-R-O-C-H-Y <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 31 Jan 2022 12:01:01 +0100 Subject: [PATCH 01/14] Fix - SD mount issue (#6162) * sdSelectCard longer timeout for sdWait * GO_IDLE_STATE command ignores sdWait fail --- libraries/SD/src/sd_diskio.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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) { From 0d665d7e55d9213e8f9d52c7a23bab40a2703468 Mon Sep 17 00:00:00 2001 From: Vlasta Hajek Date: Mon, 31 Jan 2022 12:01:32 +0100 Subject: [PATCH 02/14] fix: restoring handshake timeout (#6165) (#6166) --- libraries/WiFiClientSecure/src/ssl_client.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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; } From 9555ed4b762d2f954dc70afcfb291fb629a88ed8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 31 Jan 2022 12:02:34 +0100 Subject: [PATCH 03/14] Use 8.4.0+2021r2-patch2 toolchains for CI (#6184) with platformio --- .github/scripts/install-platformio-esp32.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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" From 39a2080922face8924a8be1080cee20fa2c1e79c Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Mon, 31 Jan 2022 08:03:43 -0300 Subject: [PATCH 04/14] Fixes onReceive deadlock (#6201) --- cores/esp32/esp32-hal-uart.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index dc22e0dc019..84992e7f05d 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: From 754ceddf48aecfda9c34beeefc8c57e6224d13fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enes=20=C5=9Eim=C5=9Fek?= <62627966+h-enes-simsek@users.noreply.github.com> Date: Mon, 31 Jan 2022 14:04:29 +0300 Subject: [PATCH 05/14] added explanatory comments to WebServer.h (#6204) --- libraries/WebServer/src/WebServer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; } From cbeb7c4df81002b69733af9449790795f3626401 Mon Sep 17 00:00:00 2001 From: mrengineer7777 <44048235+mrengineer7777@users.noreply.github.com> Date: Mon, 31 Jan 2022 05:06:39 -0600 Subject: [PATCH 06/14] Add conditional include to WiFiProv.h (#6192) Resolves issue #6171 --- libraries/WiFiProv/src/WiFiProv.h | 5 +++++ 1 file changed, 5 insertions(+) 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 From 9fe34f655369e64d7988c482f9d53a758d4dac01 Mon Sep 17 00:00:00 2001 From: mrengineer7777 <44048235+mrengineer7777@users.noreply.github.com> Date: Mon, 31 Jan 2022 05:07:37 -0600 Subject: [PATCH 07/14] Resolve WString TODO (#6190) Resolve TODO (XXX) by logging warning message. --- cores/esp32/WString.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); From 96a5ddcd0e6875c78c17cab0d0b6cc1493e8fa2d Mon Sep 17 00:00:00 2001 From: Clemens Kirchgatterer Date: Mon, 31 Jan 2022 12:08:09 +0100 Subject: [PATCH 08/14] Allow HTTPCLIENT_1_1_COMPATIBLE to be disabled (#6200) Allow a user to disable the HTTPCLIENT_1_1_COMPATIBLE flag from the command line, or whichever means available. --- libraries/HTTPClient/src/HTTPClient.h | 2 ++ 1 file changed, 2 insertions(+) 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 From 9f08cf4767d4ac1306aa36b195e1c202b9c9277e Mon Sep 17 00:00:00 2001 From: Matthias Hertel Date: Mon, 31 Jan 2022 12:09:04 +0100 Subject: [PATCH 09/14] Update RequestHandlersImpl.h (#6179) With LittleFS the `fs.exists(path)` returns true also on folders. A `isDirectory()` call is required to set _isFile to false on directories. This enables serving all files from a folder like : `server->serveStatic("/", LittleFS, "/", cacheHeader.c_str()); File f = fs.open(path); _isFile = (f && (! f.isDirectory())); --- libraries/WebServer/src/detail/RequestHandlersImpl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); } From 7a6dae02aa8a43de7927b43362bbd051a1b9b19d Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Mon, 31 Jan 2022 12:15:10 +0100 Subject: [PATCH 10/14] Refactor the CI scripts (#6191) The reason behind this refactoring is that all of the sketch related functions can (and will) be used for other purposes. Build in the sketch directory: This will make it easy to handle artifacts after the build. Separate sketch related functions from IDE installation script. This is the main commit. Create a separate job for the Cmake check. This check was part of one of the Linux build. I believe that it's not the best place for such a check. Checking for the skip landmarks and validity of the the sketch directory were already done by count_sketches. --- .github/scripts/install-arduino-ide.sh | 156 --------------------- .github/scripts/on-push.sh | 100 +++++++------- .github/scripts/sketch_utils.sh | 184 +++++++++++++++++++++++++ .github/workflows/push.yml | 7 + 4 files changed, 245 insertions(+), 202 deletions(-) create mode 100755 .github/scripts/sketch_utils.sh 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/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 From ef35baffb0ebc6c2f471767bb6f29ad4537a6a50 Mon Sep 17 00:00:00 2001 From: Patrick Behal <5472845+im-pro-at@users.noreply.github.com> Date: Mon, 31 Jan 2022 12:25:43 +0100 Subject: [PATCH 11/14] Fix random CaptivePortal.ino crashes (#6206) CaptivePortal.ino example did randomly crash for me ... so I start investigate ;-) Decoding stack results 0x4016faea: WiFiUDP::write(unsigned char const*, unsigned int) at C:\Users\knoeb\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\libraries\WiFi\src\WiFiUdp.cpp line 201 0x400d4a4a: DNSServer::replyWithIP() at C:\Users\knoeb\AppData\Local\Temp\arduino_build_486825\sketch\src\DNSServer\DNSServer.cpp line 187 0x400d4d01: DNSServer::processNextRequest() at C:\Users\knoeb\AppData\Local\Temp\arduino_build_486825\sketch\src\DNSServer\DNSServer.cpp line 117 0x400d3e81: loop() at D:\Drive\Dokumente\HTL_Lehrer\2021_22\Projekte\Stromzaehler_Patrick\arduino/arduino.ino line 1078 0x400dd545: loopTask(void*) at C:\Users\knoeb\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\cores\esp32\main.cpp line 37 0x4008a0de: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143 I found with wireshark a possibility to trigger the crash on demand is: nslookup 3.1o1osr0092ons87rp375p1pq8q066o8p56or1sqsps6rs17r4384q9748qr1r52.699p1r741q737393648s29917o45p16q50rn517rnsp73pp68p1q259s92693qp.s607408539s0p06p7559os0899866344r7qq7rpns960o9576q65.r5n94r5so9784pq1.i.03.s.sophosxl.net The problem was that QNameLength is a signed byte and therefore its not possible to count up to 255. Additionally we need 256 bytes for the QName string to accommodate for the zero termination. --- libraries/DNSServer/src/DNSServer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From dafdc0524965be5d89eafe4cc40cb3e3028b7711 Mon Sep 17 00:00:00 2001 From: Pedro Minatel Date: Tue, 1 Feb 2022 09:24:06 +0000 Subject: [PATCH 12/14] Docs cleanup and version updated to 2.0.2 (#6213) * Docs cleanup and version updated to 2.0.2 * Removed issue template information * Removed issue template file * Added referecnces for the issue and feature request form --- docs/ISSUE_TEMPLATE.md | 47 -------------------------------- docs/source/api/i2c.rst | 2 +- docs/source/boards/boards.rst | 9 ++---- docs/source/boards/generic.rst | 7 +---- docs/source/common/datasheet.inc | 13 +++++++++ docs/source/conf.py | 4 +-- docs/source/getting_started.rst | 19 +++++++------ docs/source/index.rst | 2 +- docs/source/libraries.rst | 18 ++---------- docs/source/tutorials/io_mux.rst | 14 ++++------ 10 files changed, 39 insertions(+), 96 deletions(-) delete mode 100644 docs/ISSUE_TEMPLATE.md create mode 100644 docs/source/common/datasheet.inc 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 From 5be3ff74ea6057c7ee35fcc0cd60defb82786ec3 Mon Sep 17 00:00:00 2001 From: IanSC <8453489+IanSC@users.noreply.github.com> Date: Tue, 1 Feb 2022 19:26:52 +0800 Subject: [PATCH 13/14] Unnecessary operation removed from map() in WMath.cpp (#6218) * Unneccesary Operation Removed (A) extra operation not needed and incorrect: wrong by 0.5 but happens to be thrown out ( delta * dividend + (divisor / 2) ) / divisor delta * dividend divisor = ---------------- + ----------- divisor 2 * divisor = delta * dividend / divisor + 1/2 (B) check first before doing other computations (C) changed to rise/run, easier for future maintainer since it's closer to equation of a line (D) before: mult, shift, add, div, add now: mult, div, add (E) error message easier to trace where thrown * Update WMath.cpp forgot to change variable name --- cores/esp32/WMath.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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) From 3a96fc0e4a166a9221f4a4ab259747d484f19499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Bohne?= Date: Tue, 1 Feb 2022 12:59:32 +0100 Subject: [PATCH 14/14] framebuffer location for no-psram boards (#6219) If board has no PSRAM, we need to set the framebuffer location to DRAM: config.fb_location = CAMERA_FB_IN_DRAM; --- .../ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino | 1 + 1 file changed, 1 insertion(+) 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)