From eda6d21d872831b052bf02fb57774b1252cf4930 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Fri, 13 Sep 2024 10:49:28 +0300 Subject: [PATCH 01/17] fix(events): Fix crash in getStdFunctionAddress (#10321) --- libraries/Network/src/NetworkEvents.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/Network/src/NetworkEvents.cpp b/libraries/Network/src/NetworkEvents.cpp index 9ebf00b47..3643734b4 100644 --- a/libraries/Network/src/NetworkEvents.cpp +++ b/libraries/Network/src/NetworkEvents.cpp @@ -228,7 +228,10 @@ void NetworkEvents::removeEvent(NetworkEventCb cbEvent, arduino_event_id_t event template static size_t getStdFunctionAddress(std::function f) { typedef T(fnType)(U...); fnType **fnPointer = f.template target(); - return (size_t)*fnPointer; + if (fnPointer != nullptr) { + return (size_t)*fnPointer; + } + return (size_t)fnPointer; } void NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event) { From 648094c733d94919b71effe9c25b6dfd5e582340 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Fri, 13 Sep 2024 10:49:49 +0300 Subject: [PATCH 02/17] fix(api): Update Arduino Stream class (#10328) * fix(api): Update Arduino Stream class Upstream code contains some fixes * Update Stream.h * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- cores/esp32/Stream.cpp | 309 ++++++++++++++++++++--------------------- cores/esp32/Stream.h | 119 +++++++++------- 2 files changed, 219 insertions(+), 209 deletions(-) diff --git a/cores/esp32/Stream.cpp b/cores/esp32/Stream.cpp index 1eb8e512a..5c2060eaa 100644 --- a/cores/esp32/Stream.cpp +++ b/cores/esp32/Stream.cpp @@ -18,14 +18,14 @@ Created July 2011 parsing functions based on TextFinder library by Michael Margolis + + findMulti/findUntil routines written by Jim Leonard/Xuth */ #include "Arduino.h" #include "Stream.h" -#include "esp32-hal.h" #define PARSE_TIMEOUT 1000 // default number of milli-seconds to wait -#define NO_SKIP_CHAR 1 // a magic char not found in a valid ASCII numeric field // private method to read stream with timeout int Stream::timedRead() { @@ -55,18 +55,26 @@ int Stream::timedPeek() { // returns peek of the next digit in the stream or -1 if timeout // discards non-numeric characters -int Stream::peekNextDigit() { +int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal) { int c; while (1) { c = timedPeek(); - if (c < 0) { - return c; // timeout - } - if (c == '-') { + + if (c < 0 || c == '-' || (c >= '0' && c <= '9') || (detectDecimal && c == '.')) { return c; } - if (c >= '0' && c <= '9') { - return c; + + switch (lookahead) { + case SKIP_NONE: return -1; // Fail code. + case SKIP_WHITESPACE: + switch (c) { + case ' ': + case '\t': + case '\r': + case '\n': break; + default: return -1; // Fail code. + } + case SKIP_ALL: break; } read(); // discard non-numeric } @@ -79,9 +87,6 @@ void Stream::setTimeout(unsigned long timeout) // sets the maximum number of mi { _timeout = timeout; } -unsigned long Stream::getTimeout(void) { - return _timeout; -} // find returns true if the target string is found bool Stream::find(const char *target) { @@ -105,13 +110,142 @@ bool Stream::findUntil(const char *target, const char *terminator) { bool Stream::findUntil(const char *target, size_t targetLen, const char *terminator, size_t termLen) { if (terminator == NULL) { MultiTarget t[1] = {{target, targetLen, 0}}; - return findMulti(t, 1) == 0 ? true : false; + return findMulti(t, 1) == 0; } else { MultiTarget t[2] = {{target, targetLen, 0}, {terminator, termLen, 0}}; - return findMulti(t, 2) == 0 ? true : false; + return findMulti(t, 2) == 0; } } +// returns the first valid (long) integer value from the current position. +// lookahead determines how parseInt looks ahead in the stream. +// See LookaheadMode enumeration at the top of the file. +// Lookahead is terminated by the first character that is not a valid part of an integer. +// Once parsing commences, 'ignore' will be skipped in the stream. +long Stream::parseInt(LookaheadMode lookahead, char ignore) { + bool isNegative = false; + long value = 0; + int c; + + c = peekNextDigit(lookahead, false); + // ignore non numeric leading characters + if (c < 0) { + return 0; // zero returned if timeout + } + + do { + if ((char)c == ignore) + ; // ignore this character + else if (c == '-') { + isNegative = true; + } else if (c >= '0' && c <= '9') { // is c a digit? + value = value * 10 + c - '0'; + } + read(); // consume the character we got with peek + c = timedPeek(); + } while ((c >= '0' && c <= '9') || (char)c == ignore); + + if (isNegative) { + value = -value; + } + return value; +} + +// as parseInt but returns a floating point value +float Stream::parseFloat(LookaheadMode lookahead, char ignore) { + bool isNegative = false; + bool isFraction = false; + double value = 0.0; + int c; + double fraction = 1.0; + + c = peekNextDigit(lookahead, true); + // ignore non numeric leading characters + if (c < 0) { + return 0; // zero returned if timeout + } + + do { + if ((char)c == ignore) + ; // ignore + else if (c == '-') { + isNegative = true; + } else if (c == '.') { + isFraction = true; + } else if (c >= '0' && c <= '9') { // is c a digit? + if (isFraction) { + fraction *= 0.1; + value = value + fraction * (c - '0'); + } else { + value = value * 10 + c - '0'; + } + } + read(); // consume the character we got with peek + c = timedPeek(); + } while ((c >= '0' && c <= '9') || (c == '.' && !isFraction) || (char)c == ignore); + + if (isNegative) { + value = -value; + } + + return value; +} + +// read characters from stream into buffer +// terminates if length characters have been read, or timeout (see setTimeout) +// returns the number of characters placed in the buffer +// the buffer is NOT null terminated. +// +size_t Stream::readBytes(char *buffer, size_t length) { + size_t count = 0; + while (count < length) { + int c = timedRead(); + if (c < 0) { + break; + } + *buffer++ = (char)c; + count++; + } + return count; +} + +// as readBytes with terminator character +// terminates if length characters have been read, timeout, or if the terminator character detected +// returns the number of characters placed in the buffer (0 means no valid data found) + +size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) { + size_t index = 0; + while (index < length) { + int c = timedRead(); + if (c < 0 || (char)c == terminator) { + break; + } + *buffer++ = (char)c; + index++; + } + return index; // return number of characters, not including null terminator +} + +String Stream::readString() { + String ret; + int c = timedRead(); + while (c >= 0) { + ret += (char)c; + c = timedRead(); + } + return ret; +} + +String Stream::readStringUntil(char terminator) { + String ret; + int c = timedRead(); + while (c >= 0 && (char)c != terminator) { + ret += (char)c; + c = timedRead(); + } + return ret; +} + int Stream::findMulti(struct Stream::MultiTarget *targets, int tCount) { // any zero length target string automatically matches and would make // a mess of the rest of the algorithm. @@ -129,7 +263,7 @@ int Stream::findMulti(struct Stream::MultiTarget *targets, int tCount) { for (struct MultiTarget *t = targets; t < targets + tCount; ++t) { // the simple case is if we match, deal with that first. - if (c == t->str[t->index]) { + if ((char)c == t->str[t->index]) { if (++t->index == t->len) { return t - targets; } else { @@ -149,7 +283,7 @@ int Stream::findMulti(struct Stream::MultiTarget *targets, int tCount) { do { --t->index; // first check if current char works against the new current index - if (c != t->str[t->index]) { + if ((char)c != t->str[t->index]) { continue; } @@ -182,146 +316,3 @@ int Stream::findMulti(struct Stream::MultiTarget *targets, int tCount) { // unreachable return -1; } - -// returns the first valid (long) integer value from the current position. -// initial characters that are not digits (or the minus sign) are skipped -// function is terminated by the first character that is not a digit. -long Stream::parseInt() { - return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) -} - -// as above but a given skipChar is ignored -// this allows format characters (typically commas) in values to be ignored -long Stream::parseInt(char skipChar) { - boolean isNegative = false; - long value = 0; - int c; - - c = peekNextDigit(); - // ignore non numeric leading characters - if (c < 0) { - return 0; // zero returned if timeout - } - - do { - if (c == skipChar) { - } // ignore this character - else if (c == '-') { - isNegative = true; - } else if (c >= '0' && c <= '9') { // is c a digit? - value = value * 10 + c - '0'; - } - read(); // consume the character we got with peek - c = timedPeek(); - } while ((c >= '0' && c <= '9') || c == skipChar); - - if (isNegative) { - value = -value; - } - return value; -} - -// as parseInt but returns a floating point value -float Stream::parseFloat() { - return parseFloat(NO_SKIP_CHAR); -} - -// as above but the given skipChar is ignored -// this allows format characters (typically commas) in values to be ignored -float Stream::parseFloat(char skipChar) { - boolean isNegative = false; - boolean isFraction = false; - long value = 0; - int c; - float fraction = 1.0; - - c = peekNextDigit(); - // ignore non numeric leading characters - if (c < 0) { - return 0; // zero returned if timeout - } - - do { - if (c == skipChar) { - } // ignore - else if (c == '-') { - isNegative = true; - } else if (c == '.') { - isFraction = true; - } else if (c >= '0' && c <= '9') { // is c a digit? - value = value * 10 + c - '0'; - if (isFraction) { - fraction *= 0.1f; - } - } - read(); // consume the character we got with peek - c = timedPeek(); - } while ((c >= '0' && c <= '9') || c == '.' || c == skipChar); - - if (isNegative) { - value = -value; - } - if (isFraction) { - return value * fraction; - } else { - return value; - } -} - -// read characters from stream into buffer -// terminates if length characters have been read, or timeout (see setTimeout) -// returns the number of characters placed in the buffer -// the buffer is NOT null terminated. -// -size_t Stream::readBytes(char *buffer, size_t length) { - size_t count = 0; - while (count < length) { - int c = timedRead(); - if (c < 0) { - break; - } - *buffer++ = (char)c; - count++; - } - return count; -} - -// as readBytes with terminator character -// terminates if length characters have been read, timeout, or if the terminator character detected -// returns the number of characters placed in the buffer (0 means no valid data found) - -size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) { - if (length < 1) { - return 0; - } - size_t index = 0; - while (index < length) { - int c = timedRead(); - if (c < 0 || c == terminator) { - break; - } - *buffer++ = (char)c; - index++; - } - return index; // return number of characters, not including null terminator -} - -String Stream::readString() { - String ret; - int c = timedRead(); - while (c >= 0) { - ret += (char)c; - c = timedRead(); - } - return ret; -} - -String Stream::readStringUntil(char terminator) { - String ret; - int c = timedRead(); - while (c >= 0 && c != terminator) { - ret += (char)c; - c = timedRead(); - } - return ret; -} diff --git a/cores/esp32/Stream.h b/cores/esp32/Stream.h index 5a83747a5..123694f6f 100644 --- a/cores/esp32/Stream.h +++ b/cores/esp32/Stream.h @@ -1,72 +1,83 @@ /* - Stream.h - base class for character-based streams. - Copyright (c) 2010 David A. Mellis. All right reserved. + Stream.h - base class for character-based streams. + Copyright (c) 2010 David A. Mellis. All right reserved. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - parsing functions based on TextFinder library by Michael Margolis - */ + parsing functions based on TextFinder library by Michael Margolis +*/ -#ifndef Stream_h -#define Stream_h +#pragma once #include #include "Print.h" // compatibility macros for testing /* - #define getInt() parseInt() - #define getInt(skipChar) parseInt(skipchar) - #define getFloat() parseFloat() - #define getFloat(skipChar) parseFloat(skipChar) - #define getString( pre_string, post_string, buffer, length) - readBytesBetween( pre_string, terminator, buffer, length) - */ +#define getInt() parseInt() +#define getInt(ignore) parseInt(ignore) +#define getFloat() parseFloat() +#define getFloat(ignore) parseFloat(ignore) +#define getString( pre_string, post_string, buffer, length) +readBytesBetween( pre_string, terminator, buffer, length) +*/ + +// This enumeration provides the lookahead options for parseInt(), parseFloat() +// The rules set out here are used until either the first valid character is found +// or a time out occurs due to lack of input. +enum LookaheadMode { + SKIP_ALL, // All invalid characters are ignored. + SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid. + SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped. +}; + +#define NO_IGNORE_CHAR '\x01' // a char not found in a valid ASCII numeric field class Stream : public Print { protected: - unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read - unsigned long _startMillis; // used for timeout measurement - int timedRead(); // private method to read stream with timeout - int timedPeek(); // private method to peek stream with timeout - int peekNextDigit(); // returns the next numeric digit in the stream or -1 if timeout + unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read + unsigned long _startMillis; // used for timeout measurement + int timedRead(); // private method to read stream with timeout + int timedPeek(); // private method to peek stream with timeout + int peekNextDigit(LookaheadMode lookahead, bool detectDecimal); // returns the next numeric digit in the stream or -1 if timeout public: virtual int available() = 0; virtual int read() = 0; virtual int peek() = 0; - Stream() : _startMillis(0) { + Stream() { _timeout = 1000; } - virtual ~Stream() {} // parsing methods void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second - unsigned long getTimeout(void); + unsigned long getTimeout(void) { + return _timeout; + } bool find(const char *target); // reads data from the stream until the target string is found - bool find(uint8_t *target) { - return find((char *)target); + bool find(const uint8_t *target) { + return find((const char *)target); } // returns true if target string is found, false if timed out (see setTimeout) bool find(const char *target, size_t length); // reads data from the stream until the target string of given length is found bool find(const uint8_t *target, size_t length) { - return find((char *)target, length); + return find((const char *)target, length); } // returns true if target string is found, false if timed out @@ -76,22 +87,26 @@ public: bool findUntil(const char *target, const char *terminator); // as find but search ends if the terminator string is found bool findUntil(const uint8_t *target, const char *terminator) { - return findUntil((char *)target, terminator); + return findUntil((const char *)target, terminator); } bool findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen); // as above but search ends if the terminate string is found bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) { - return findUntil((char *)target, targetLen, terminate, termLen); + return findUntil((const char *)target, targetLen, terminate, termLen); } - long parseInt(); // returns the first valid (long) integer value from the current position. - // initial characters that are not digits (or the minus sign) are skipped - // integer is terminated by the first character that is not a digit. + long parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); + // returns the first valid (long) integer value from the current position. + // lookahead determines how parseInt looks ahead in the stream. + // See LookaheadMode enumeration at the top of the file. + // Lookahead is terminated by the first character that is not a valid part of an integer. + // Once parsing commences, 'ignore' will be skipped in the stream. - float parseFloat(); // float version of parseInt + float parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); + // float version of parseInt - virtual size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer - virtual size_t readBytes(uint8_t *buffer, size_t length) { + size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer + size_t readBytes(uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); } // terminates if length characters have been read or timeout (see setTimeout) @@ -105,15 +120,19 @@ public: // returns the number of characters placed in the buffer (0 means no valid data found) // Arduino String functions to be added here - virtual String readString(); + String readString(); String readStringUntil(char terminator); protected: - long parseInt(char skipChar); // as above but the given skipChar is ignored - // as above but the given skipChar is ignored - // this allows format characters (typically commas) in values to be ignored - - float parseFloat(char skipChar); // as above but the given skipChar is ignored + long parseInt(char ignore) { + return parseInt(SKIP_ALL, ignore); + } + float parseFloat(char ignore) { + return parseFloat(SKIP_ALL, ignore); + } + // These overload exists for compatibility with any class that has derived + // Stream and used parseFloat/Int with a custom ignore character. To keep + // the public API simple, these overload remains protected. struct MultiTarget { const char *str; // string you're searching for @@ -126,4 +145,4 @@ protected: int findMulti(struct MultiTarget *targets, int tCount); }; -#endif +#undef NO_IGNORE_CHAR From 8a87df3b952a1149d8fb5caa8006700ce89b25d4 Mon Sep 17 00:00:00 2001 From: TD-er Date: Fri, 13 Sep 2024 09:50:06 +0200 Subject: [PATCH 03/17] NetworkClientRxBuffer::clear() may not always clear (#10288) (#10331) Fixes: #10288 --- libraries/Network/src/NetworkClient.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/Network/src/NetworkClient.cpp b/libraries/Network/src/NetworkClient.cpp index 614a310de..0782b74f2 100644 --- a/libraries/Network/src/NetworkClient.cpp +++ b/libraries/Network/src/NetworkClient.cpp @@ -148,9 +148,13 @@ public: void clear() { if (r_available()) { - fillBuffer(); + _pos = _fill; + while (fillBuffer()) { + _pos = _fill; + } } - _pos = _fill; + _pos = 0; + _fill = 0; } }; From 8c25325e181b3ec0717187c66bba15e7c2af2494 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Fri, 13 Sep 2024 11:10:12 +0300 Subject: [PATCH 04/17] fix(webserver): OTHER_AUTH will leak memory --- libraries/WebServer/src/WebServer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/WebServer/src/WebServer.cpp b/libraries/WebServer/src/WebServer.cpp index 3996d3bdb..4f010b839 100644 --- a/libraries/WebServer/src/WebServer.cpp +++ b/libraries/WebServer/src/WebServer.cpp @@ -268,6 +268,7 @@ bool WebServer::authenticate(THandlerFunctionAuthCheck fn) { String *ret = fn(OTHER_AUTH, authReq, {}); if (ret) { log_v("Authentication Success"); + delete ret; return true; } } From ac0de431e7d2c27fe9c44f3003a5b54f71f031f8 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Fri, 13 Sep 2024 05:30:38 -0300 Subject: [PATCH 05/17] fix(arduino): rain maker common version (#10338) Fixes Arduino components for Windows 11 with IDF 5.1.4 when building Arduino as IDF component. --- idf_component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idf_component.yml b/idf_component.yml index 187420011..21ec39b4d 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -68,7 +68,7 @@ dependencies: rules: - if: "target != esp32c2" espressif/rmaker_common: - version: "^1.4.3" + version: "^1.4.6" rules: - if: "target != esp32c2" espressif/esp_insights: From 9e60bbe4bc05e8d27050d23ce3a61a955c1851eb Mon Sep 17 00:00:00 2001 From: TD-er Date: Fri, 13 Sep 2024 10:39:54 +0200 Subject: [PATCH 06/17] [WebServer] Mark functions as const + reduce copy of strings (#10339) * [WebServer] Mark functions as const + reduce copy of strings * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- libraries/WebServer/src/Parsing.cpp | 4 ++-- libraries/WebServer/src/WebServer.cpp | 24 +++++++++---------- libraries/WebServer/src/WebServer.h | 34 +++++++++++++-------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/libraries/WebServer/src/Parsing.cpp b/libraries/WebServer/src/Parsing.cpp index 3cb7b84a4..875ca3057 100644 --- a/libraries/WebServer/src/Parsing.cpp +++ b/libraries/WebServer/src/Parsing.cpp @@ -280,7 +280,7 @@ bool WebServer::_collectHeader(const char *headerName, const char *headerValue) return false; } -void WebServer::_parseArguments(String data) { +void WebServer::_parseArguments(const String &data) { log_v("args: %s", data.c_str()); if (_currentArgs) { delete[] _currentArgs; @@ -387,7 +387,7 @@ int WebServer::_uploadReadByte(NetworkClient &client) { return res; } -bool WebServer::_parseForm(NetworkClient &client, String boundary, uint32_t len) { +bool WebServer::_parseForm(NetworkClient &client, const String &boundary, uint32_t len) { (void)len; log_v("Parse Form: Boundary: %s Length: %d", boundary.c_str(), len); String line; diff --git a/libraries/WebServer/src/WebServer.cpp b/libraries/WebServer/src/WebServer.cpp index 4f010b839..53c575d2c 100644 --- a/libraries/WebServer/src/WebServer.cpp +++ b/libraries/WebServer/src/WebServer.cpp @@ -674,14 +674,14 @@ void WebServer::_streamFileCore(const size_t fileSize, const String &fileName, c send(code, contentType, ""); } -String WebServer::pathArg(unsigned int i) { +String WebServer::pathArg(unsigned int i) const { if (_currentHandler != nullptr) { return _currentHandler->pathArg(i); } return ""; } -String WebServer::arg(String name) { +String WebServer::arg(const String &name) const { for (int j = 0; j < _postArgsLen; ++j) { if (_postArgs[j].key == name) { return _postArgs[j].value; @@ -695,25 +695,25 @@ String WebServer::arg(String name) { return ""; } -String WebServer::arg(int i) { +String WebServer::arg(int i) const { if (i < _currentArgCount) { return _currentArgs[i].value; } return ""; } -String WebServer::argName(int i) { +String WebServer::argName(int i) const { if (i < _currentArgCount) { return _currentArgs[i].key; } return ""; } -int WebServer::args() { +int WebServer::args() const { return _currentArgCount; } -bool WebServer::hasArg(String name) { +bool WebServer::hasArg(const String &name) const { for (int j = 0; j < _postArgsLen; ++j) { if (_postArgs[j].key == name) { return true; @@ -727,7 +727,7 @@ bool WebServer::hasArg(String name) { return false; } -String WebServer::header(String name) { +String WebServer::header(const String &name) const { for (int i = 0; i < _headerKeysCount; ++i) { if (_currentHeaders[i].key.equalsIgnoreCase(name)) { return _currentHeaders[i].value; @@ -749,25 +749,25 @@ void WebServer::collectHeaders(const char *headerKeys[], const size_t headerKeys } } -String WebServer::header(int i) { +String WebServer::header(int i) const { if (i < _headerKeysCount) { return _currentHeaders[i].value; } return ""; } -String WebServer::headerName(int i) { +String WebServer::headerName(int i) const { if (i < _headerKeysCount) { return _currentHeaders[i].key; } return ""; } -int WebServer::headers() { +int WebServer::headers() const { return _headerKeysCount; } -bool WebServer::hasHeader(String name) { +bool WebServer::hasHeader(const String &name) const { for (int i = 0; i < _headerKeysCount; ++i) { if ((_currentHeaders[i].key.equalsIgnoreCase(name)) && (_currentHeaders[i].value.length() > 0)) { return true; @@ -776,7 +776,7 @@ bool WebServer::hasHeader(String name) { return false; } -String WebServer::hostHeader() { +String WebServer::hostHeader() const { return _hostHeader; } diff --git a/libraries/WebServer/src/WebServer.h b/libraries/WebServer/src/WebServer.h index a107e223b..0f3405430 100644 --- a/libraries/WebServer/src/WebServer.h +++ b/libraries/WebServer/src/WebServer.h @@ -158,10 +158,10 @@ public: void onNotFound(THandlerFunction fn); //called when handler is not assigned void onFileUpload(THandlerFunction ufn); //handle file uploads - String uri() { + String uri() const { return _currentUri; } - HTTPMethod method() { + HTTPMethod method() const { return _currentMethod; } virtual NetworkClient &client() { @@ -174,24 +174,24 @@ public: return *_currentRaw; } - String pathArg(unsigned int i); // get request path argument by number - String arg(String name); // get request argument value by name - String arg(int i); // get request argument value by number - String argName(int i); // get request argument name by number - int args(); // get arguments count - bool hasArg(String name); // check if argument exists + String pathArg(unsigned int i) const; // get request path argument by number + String arg(const String &name) const; // get request argument value by name + String arg(int i) const; // get request argument value by number + String argName(int i) const; // get request argument name by number + int args() const; // get arguments count + bool hasArg(const String &name) const; // check if argument exists void collectHeaders(const char *headerKeys[], const size_t headerKeysCount); // set the request headers to collect - String header(String name); // get request header value by name - String header(int i); // get request header value by number - String headerName(int i); // get request header name by number - int headers(); // get header count - bool hasHeader(String name); // check if header exists + String header(const String &name) const; // get request header value by name + String header(int i) const; // get request header value by number + String headerName(int i) const; // get request header name by number + int headers() const; // get header count + bool hasHeader(const String &name) const; // check if header exists - int clientContentLength() { + int clientContentLength() const { return _clientContentLength; } // return "content-length" of incoming HTTP header from "_currentClient" - String hostHeader(); // get request host header if available or empty String if not + String hostHeader() const; // get request host header if available or empty String if not // send response to the client // code - HTTP response code, can be 200 or 404 @@ -240,9 +240,9 @@ protected: void _handleRequest(); void _finalizeResponse(); bool _parseRequest(NetworkClient &client); - void _parseArguments(String data); + void _parseArguments(const String &data); static String _responseCodeToString(int code); - bool _parseForm(NetworkClient &client, String boundary, uint32_t len); + bool _parseForm(NetworkClient &client, const String &boundary, uint32_t len); bool _parseFormUploadAborted(); void _uploadWriteByte(uint8_t b); int _uploadReadByte(NetworkClient &client); From a7cec020df8f1a815bd8dfd2559f51a2216bcf1c Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Sun, 15 Sep 2024 20:15:24 -0300 Subject: [PATCH 07/17] Merge commit from fork --- .github/workflows/tests_results.yml | 26 ++++++++++++++++++---- .github/workflows/upload-idf-component.yml | 9 +++++++- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests_results.yml b/.github/workflows/tests_results.yml index 8dbe3d937..a255016c4 100644 --- a/.github/workflows/tests_results.yml +++ b/.github/workflows/tests_results.yml @@ -41,6 +41,24 @@ jobs: original_sha=$(cat ./artifacts/parent-artifacts/sha.txt) original_ref=$(cat ./artifacts/parent-artifacts/ref.txt) original_conclusion=$(cat ./artifacts/parent-artifacts/conclusion.txt) + + # Sanitize the values to avoid security issues + + # Event: Allow alphabetical characters and underscores + original_event=$(echo "$original_event" | tr -cd '[:alpha:]_') + + # Action: Allow alphabetical characters and underscores + original_action=$(echo "$original_action" | tr -cd '[:alpha:]_') + + # SHA: Allow alphanumeric characters + original_sha=$(echo "$original_sha" | tr -cd '[:alnum:]') + + # Ref: Allow alphanumeric characters, slashes, underscores, dots, and dashes + original_ref=$(echo "$original_ref" | tr -cd '[:alnum:]/_.-') + + # Conclusion: Allow alphabetical characters and underscores + original_conclusion=$(echo "$original_conclusion" | tr -cd '[:alpha:]_') + echo "original_event=$original_event" >> $GITHUB_ENV echo "original_action=$original_action" >> $GITHUB_ENV echo "original_sha=$original_sha" >> $GITHUB_ENV @@ -71,10 +89,10 @@ jobs: uses: actions/github-script@v7 with: script: | - const ref = '${{ env.original_ref }}'; + const ref = process.env.original_ref; const key_prefix = 'tests-' + ref + '-'; - if ('${{ env.original_event }}' == 'pull_request' && '${{ env.original_action }}' != 'closed') { + if (process.env.original_event == 'pull_request' && process.env.original_action != 'closed') { console.log('Skipping cache cleanup for open PR'); return; } @@ -104,12 +122,12 @@ jobs: script: | const owner = '${{ github.repository_owner }}'; const repo = '${{ github.repository }}'.split('/')[1]; - const sha = '${{ env.original_sha }}'; + const sha = process.env.original_sha; core.debug(`owner: ${owner}`); core.debug(`repo: ${repo}`); core.debug(`sha: ${sha}`); const { context: name, state } = (await github.rest.repos.createCommitStatus({ - context: 'Runtime Tests / Report results (${{ env.original_event }} -> workflow_run -> workflow_run)', + context: `Runtime Tests / Report results (${process.env.original_event} -> workflow_run -> workflow_run)`, owner: owner, repo: repo, sha: sha, diff --git a/.github/workflows/upload-idf-component.yml b/.github/workflows/upload-idf-component.yml index 22912de6d..c716e8144 100644 --- a/.github/workflows/upload-idf-component.yml +++ b/.github/workflows/upload-idf-component.yml @@ -6,18 +6,25 @@ on: types: - completed +permissions: + contents: read + jobs: upload_components: runs-on: ubuntu-latest steps: - name: Get the release tag + env: + head_branch: ${{ github.event.workflow_run.head_branch }} run: | if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then echo "Release workflow failed. Exiting..." exit 1 fi - branch=${{ github.event.workflow_run.head_branch }} + # Read and sanitize the branch/tag name + branch=$(echo "$head_branch" | tr -cd '[:alnum:]/_.-') + if [[ $branch == refs/tags/* ]]; then tag="${branch#refs/tags/}" elif [[ $branch =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then From 44a484475c940b7b212b745b3c39798869589343 Mon Sep 17 00:00:00 2001 From: wurongmin <55608753+wurongmin@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:26:21 +0800 Subject: [PATCH 08/17] add waveshare_esp32_touch_amoled_241 (#10342) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(variants): add waveshare_esp32_touch_amoled_241 * feat(boards variants): add waveshare_esp32_touch_amoled_241 * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- boards.txt | 202 ++++++++++++++++++ .../pins_arduino.h | 60 ++++++ 2 files changed, 262 insertions(+) create mode 100644 variants/waveshare_esp32_touch_amoled_241/pins_arduino.h diff --git a/boards.txt b/boards.txt index 55f8743a9..ecb66378e 100644 --- a/boards.txt +++ b/boards.txt @@ -41426,3 +41426,205 @@ jczn_2432s028r.menu.ZigbeeMode.zczr.build.zigbee_mode=-DZIGBEE_MODE_ZCZR jczn_2432s028r.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api_zczr -lesp_zb_cli_command -lzboss_stack.zczr -lzboss_port ############################################################## + +waveshare_esp32_touch_amoled_241.name=Waveshare ESP32-Touch-AMOLED-2.41 +waveshare_esp32_touch_amoled_241.vid.0=0x303a +waveshare_esp32_touch_amoled_241.pid.0=0x8242 +waveshare_esp32_touch_amoled_241.upload_port.0.vid=0x303a +waveshare_esp32_touch_amoled_241.upload_port.0.pid=0x8242 + +waveshare_esp32_touch_amoled_241.bootloader.tool=esptool_py +waveshare_esp32_touch_amoled_241.bootloader.tool.default=esptool_py + +waveshare_esp32_touch_amoled_241.upload.tool=esptool_py +waveshare_esp32_touch_amoled_241.upload.tool.default=esptool_py +waveshare_esp32_touch_amoled_241.upload.tool.network=esp_ota + +waveshare_esp32_touch_amoled_241.upload.maximum_size=1310720 + +waveshare_esp32_touch_amoled_241.upload.maximum_data_size=327680 +waveshare_esp32_touch_amoled_241.upload.flags= +waveshare_esp32_touch_amoled_241.upload.extra_flags= +waveshare_esp32_touch_amoled_241.upload.use_1200bps_touch=false +waveshare_esp32_touch_amoled_241.upload.wait_for_upload_port=false + +waveshare_esp32_touch_amoled_241.serial.disableDTR=false +waveshare_esp32_touch_amoled_241.serial.disableRTS=false + +waveshare_esp32_touch_amoled_241.build.tarch=xtensa +waveshare_esp32_touch_amoled_241.build.bootloader_addr=0x0 +waveshare_esp32_touch_amoled_241.build.target=esp32s3 +waveshare_esp32_touch_amoled_241.build.mcu=esp32s3 +waveshare_esp32_touch_amoled_241.build.core=esp32 +waveshare_esp32_touch_amoled_241.build.variant=waveshare_esp32_touch_amoled_241 +waveshare_esp32_touch_amoled_241.build.board=WAVESHARE_ESP32_TOUCH_AMOLED_241 + +waveshare_esp32_touch_amoled_241.build.usb_mode=1 +waveshare_esp32_touch_amoled_241.build.cdc_on_boot=0 +waveshare_esp32_touch_amoled_241.build.msc_on_boot=0 +waveshare_esp32_touch_amoled_241.build.dfu_on_boot=0 +waveshare_esp32_touch_amoled_241.build.f_cpu=240000000L +waveshare_esp32_touch_amoled_241.build.flash_size=16MB + +waveshare_esp32_touch_amoled_241.build.flash_freq=80m +waveshare_esp32_touch_amoled_241.build.flash_mode=dio +waveshare_esp32_touch_amoled_241.build.boot=qio +waveshare_esp32_touch_amoled_241.build.boot_freq=80m +waveshare_esp32_touch_amoled_241.build.partitions=default +waveshare_esp32_touch_amoled_241.build.defines= +waveshare_esp32_touch_amoled_241.build.loop_core= +waveshare_esp32_touch_amoled_241.build.event_core= +waveshare_esp32_touch_amoled_241.build.psram_type=qspi +waveshare_esp32_touch_amoled_241.build.memory_type={build.boot}_{build.psram_type} + +waveshare_esp32_touch_amoled_241.menu.PSRAM.disabled=Disabled +waveshare_esp32_touch_amoled_241.menu.PSRAM.disabled.build.defines= +waveshare_esp32_touch_amoled_241.menu.PSRAM.disabled.build.psram_type=qspi +waveshare_esp32_touch_amoled_241.menu.PSRAM.enabled=Enabled +waveshare_esp32_touch_amoled_241.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +waveshare_esp32_touch_amoled_241.menu.PSRAM.enabled.build.psram_type=opi + +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio=QIO 80MHz +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio.build.flash_mode=dio +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio.build.boot=qio +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio.build.boot_freq=80m +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio.build.flash_freq=80m +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120=QIO 120MHz +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120.build.flash_mode=dio +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120.build.boot=qio +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120.build.boot_freq=120m +waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120.build.flash_freq=80m + +waveshare_esp32_touch_amoled_241.menu.LoopCore.1=Core 1 +waveshare_esp32_touch_amoled_241.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +waveshare_esp32_touch_amoled_241.menu.LoopCore.0=Core 0 +waveshare_esp32_touch_amoled_241.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +waveshare_esp32_touch_amoled_241.menu.EventsCore.1=Core 1 +waveshare_esp32_touch_amoled_241.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +waveshare_esp32_touch_amoled_241.menu.EventsCore.0=Core 0 +waveshare_esp32_touch_amoled_241.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +waveshare_esp32_touch_amoled_241.menu.USBMode.hwcdc=Hardware CDC and JTAG +waveshare_esp32_touch_amoled_241.menu.USBMode.hwcdc.build.usb_mode=1 +waveshare_esp32_touch_amoled_241.menu.USBMode.default=USB-OTG (TinyUSB) +waveshare_esp32_touch_amoled_241.menu.USBMode.default.build.usb_mode=0 + +waveshare_esp32_touch_amoled_241.menu.CDCOnBoot.default=Disabled +waveshare_esp32_touch_amoled_241.menu.CDCOnBoot.default.build.cdc_on_boot=0 +waveshare_esp32_touch_amoled_241.menu.CDCOnBoot.cdc=Enabled +waveshare_esp32_touch_amoled_241.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +waveshare_esp32_touch_amoled_241.menu.MSCOnBoot.default=Disabled +waveshare_esp32_touch_amoled_241.menu.MSCOnBoot.default.build.msc_on_boot=0 +waveshare_esp32_touch_amoled_241.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +waveshare_esp32_touch_amoled_241.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +waveshare_esp32_touch_amoled_241.menu.DFUOnBoot.default=Disabled +waveshare_esp32_touch_amoled_241.menu.DFUOnBoot.default.build.dfu_on_boot=0 +waveshare_esp32_touch_amoled_241.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +waveshare_esp32_touch_amoled_241.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +waveshare_esp32_touch_amoled_241.menu.UploadMode.default=UART0 / Hardware CDC +waveshare_esp32_touch_amoled_241.menu.UploadMode.default.upload.use_1200bps_touch=false +waveshare_esp32_touch_amoled_241.menu.UploadMode.default.upload.wait_for_upload_port=false +waveshare_esp32_touch_amoled_241.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +waveshare_esp32_touch_amoled_241.menu.UploadMode.cdc.upload.use_1200bps_touch=true +waveshare_esp32_touch_amoled_241.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.default.build.partitions=default +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) + +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.no_ota.build.partitions=no_ota +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.huge_app.build.partitions=huge_app +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker=RainMaker 4MB +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.fatflash.build.partitions=ffat +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 + +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 + +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.otanofs=OTA no FS (2MB APP with OTA) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.otanofs.build.custom_partitions=partitions_otanofs_4MB +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.otanofs.upload.maximum_size=2031616 +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.all_app=Max APP (4MB APP no OTA) +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.all_app.build.custom_partitions=partitions_all_app_4MB +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.all_app.upload.maximum_size=4128768 + +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.custom=Custom +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.custom.build.partitions= +waveshare_esp32_touch_amoled_241.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +waveshare_esp32_touch_amoled_241.menu.CPUFreq.240=240MHz (WiFi) +waveshare_esp32_touch_amoled_241.menu.CPUFreq.240.build.f_cpu=240000000L +waveshare_esp32_touch_amoled_241.menu.CPUFreq.160=160MHz (WiFi) +waveshare_esp32_touch_amoled_241.menu.CPUFreq.160.build.f_cpu=160000000L +waveshare_esp32_touch_amoled_241.menu.CPUFreq.80=80MHz (WiFi) +waveshare_esp32_touch_amoled_241.menu.CPUFreq.80.build.f_cpu=80000000L +waveshare_esp32_touch_amoled_241.menu.CPUFreq.40=40MHz +waveshare_esp32_touch_amoled_241.menu.CPUFreq.40.build.f_cpu=40000000L +waveshare_esp32_touch_amoled_241.menu.CPUFreq.20=20MHz +waveshare_esp32_touch_amoled_241.menu.CPUFreq.20.build.f_cpu=20000000L +waveshare_esp32_touch_amoled_241.menu.CPUFreq.10=10MHz +waveshare_esp32_touch_amoled_241.menu.CPUFreq.10.build.f_cpu=10000000L + +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.921600=921600 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.921600.upload.speed=921600 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.115200=115200 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.115200.upload.speed=115200 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.256000.windows=256000 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.256000.upload.speed=256000 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.230400.windows.upload.speed=256000 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.230400=230400 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.230400.upload.speed=230400 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.460800.linux=460800 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.460800.macosx=460800 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.460800.upload.speed=460800 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.512000.windows=512000 +waveshare_esp32_touch_amoled_241.menu.UploadSpeed.512000.upload.speed=512000 + +waveshare_esp32_touch_amoled_241.menu.DebugLevel.none=None +waveshare_esp32_touch_amoled_241.menu.DebugLevel.none.build.code_debug=0 +waveshare_esp32_touch_amoled_241.menu.DebugLevel.error=Error +waveshare_esp32_touch_amoled_241.menu.DebugLevel.error.build.code_debug=1 +waveshare_esp32_touch_amoled_241.menu.DebugLevel.warn=Warn +waveshare_esp32_touch_amoled_241.menu.DebugLevel.warn.build.code_debug=2 +waveshare_esp32_touch_amoled_241.menu.DebugLevel.info=Info +waveshare_esp32_touch_amoled_241.menu.DebugLevel.info.build.code_debug=3 +waveshare_esp32_touch_amoled_241.menu.DebugLevel.debug=Debug +waveshare_esp32_touch_amoled_241.menu.DebugLevel.debug.build.code_debug=4 +waveshare_esp32_touch_amoled_241.menu.DebugLevel.verbose=Verbose +waveshare_esp32_touch_amoled_241.menu.DebugLevel.verbose.build.code_debug=5 + +waveshare_esp32_touch_amoled_241.menu.EraseFlash.none=Disabled +waveshare_esp32_touch_amoled_241.menu.EraseFlash.none.upload.erase_cmd= +waveshare_esp32_touch_amoled_241.menu.EraseFlash.all=Enabled +waveshare_esp32_touch_amoled_241.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## diff --git a/variants/waveshare_esp32_touch_amoled_241/pins_arduino.h b/variants/waveshare_esp32_touch_amoled_241/pins_arduino.h new file mode 100644 index 000000000..7c26553fc --- /dev/null +++ b/variants/waveshare_esp32_touch_amoled_241/pins_arduino.h @@ -0,0 +1,60 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +// BN: ESP32 Family Device +#define USB_VID 0x303a +#define USB_PID 0x8242 + +#define USB_MANUFACTURER "Waveshare" +#define USB_PRODUCT "ESP32-Touch-AMOLED-2.41" +#define USB_SERIAL "" + +// display QSPI SPI2 +#define QSPI_CS 9 +#define QSPI_SCK 10 +#define QSPI_D0 11 +#define QSPI_D1 12 +#define QSPI_D2 13 +#define QSPI_D3 14 +#define AMOLED_RESET 21 +#define AMOLED_TE -1 +#define AMOLED_PWR_EN -1 + +// Touch I2C +#define TP_SCL 48 +#define TP_SDA 47 +#define TP_RST -1 +#define TP_INT -1 + +// Onboard RTC for PCF85063 +#define RTC_SCL 48 +#define RTC_SDA 47 +#define RTC_ADDRESS 0x51 +#define RTC_INT -1 + +// Onboard QMI8658 IMU +#define QMI8658_SDA 47 +#define QMI8658_SCL 48 +#define QMI8658_ADDRESS 0x6b +#define QMI8658_INT1 -1 + +// Partial voltage measurement method +#define BAT_ADC 17 + +// Def for I2C that shares the IMU I2C pins +static const uint8_t SDA = 47; +static const uint8_t SCL = 48; + +// UART0 pins +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +//esp32s3-PSFlash SPI1/SPI0 +static const uint8_t SS = 34; // FSPICS0 +static const uint8_t MOSI = 35; // FSPID +static const uint8_t MISO = 37; // FSPIQ +static const uint8_t SCK = 36; // FSPICLK +#endif /* Pins_Arduino_h */ From 3978870f9f1250c18c01db14f69bcbbccfbeffaf Mon Sep 17 00:00:00 2001 From: TD-er Date: Mon, 16 Sep 2024 11:26:43 +0200 Subject: [PATCH 09/17] [WiFiScan] Allow allocation in _scanDone() to fail and prevent memory leak (#10335) * [WiFiScan] Allow allocation to fail and prevent memory leak When there are many AP's seen during a scan, the allocation of `_scanResult` may fail. Thus add `(std::nothrow)` to the `new` call. Also it is possible the array was still present before allocating a new one. * [WiFiScan] Use nullptr instead of 0 As suggested by @me-no-dev --- libraries/WiFi/src/WiFiScan.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libraries/WiFi/src/WiFiScan.cpp b/libraries/WiFi/src/WiFiScan.cpp index 9ebf28f8f..ffacc57f0 100644 --- a/libraries/WiFi/src/WiFiScan.cpp +++ b/libraries/WiFi/src/WiFiScan.cpp @@ -48,7 +48,7 @@ uint32_t WiFiScanClass::_scanTimeout = 60000; uint16_t WiFiScanClass::_scanCount = 0; uint32_t WiFiScanClass::_scanActiveMinTime = 100; -void *WiFiScanClass::_scanResult = 0; +void *WiFiScanClass::_scanResult = nullptr; void WiFiScanClass::setScanTimeout(uint32_t ms) { WiFiScanClass::_scanTimeout = ms; @@ -117,13 +117,18 @@ int16_t */ void WiFiScanClass::_scanDone() { esp_wifi_scan_get_ap_num(&(WiFiScanClass::_scanCount)); + if (WiFiScanClass::_scanResult) { + delete[] reinterpret_cast(WiFiScanClass::_scanResult); + WiFiScanClass::_scanResult = nullptr; + } + if (WiFiScanClass::_scanCount) { - WiFiScanClass::_scanResult = new wifi_ap_record_t[WiFiScanClass::_scanCount]; + WiFiScanClass::_scanResult = new (std::nothrow) wifi_ap_record_t[WiFiScanClass::_scanCount]; if (!WiFiScanClass::_scanResult) { WiFiScanClass::_scanCount = 0; } else if (esp_wifi_scan_get_ap_records(&(WiFiScanClass::_scanCount), (wifi_ap_record_t *)_scanResult) != ESP_OK) { delete[] reinterpret_cast(WiFiScanClass::_scanResult); - WiFiScanClass::_scanResult = 0; + WiFiScanClass::_scanResult = nullptr; WiFiScanClass::_scanCount = 0; } } @@ -176,7 +181,7 @@ void WiFiScanClass::scanDelete() { WiFiGenericClass::clearStatusBits(WIFI_SCAN_DONE_BIT); if (WiFiScanClass::_scanResult) { delete[] reinterpret_cast(WiFiScanClass::_scanResult); - WiFiScanClass::_scanResult = 0; + WiFiScanClass::_scanResult = nullptr; WiFiScanClass::_scanCount = 0; } } From 2f8902654013d153753e59ac02ba4ff769be94bf Mon Sep 17 00:00:00 2001 From: Lee Leahy <58274669+LeeLeahy2@users.noreply.github.com> Date: Sun, 15 Sep 2024 23:28:26 -1000 Subject: [PATCH 10/17] =?UTF-8?q?Fix(NetworkEvents):=20Don't=20skip=20even?= =?UTF-8?q?t=20callbacks=20in=20NetworkEvents::remo=E2=80=A6=20(#10337)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix(NetworkEvents): Don't skip event callbacks in NetworkEvents::removeEvent Fixes Issue 10318 Includes pull request 10321 that fixes 10316 This change: * Adds code to find the event callbacks * Issues error when duplicate callbacks insertion attempts are made * Issues error when callbacks are not found during removal * Fix(NetworkEvents): Don't skip event callbacks in NetworkEvents::removeEvent Fixes Issue 10318 Includes pull request 10321 that fixes 10316 This change: * Adds code to find the event callbacks * Issues warning when duplicate callbacks insertion attempts are made * Issues warning when callbacks are not found during removal --------- Co-authored-by: Me No Dev --- libraries/Network/src/NetworkEvents.cpp | 141 ++++++++++++++++++++---- libraries/Network/src/NetworkEvents.h | 3 + 2 files changed, 121 insertions(+), 23 deletions(-) diff --git a/libraries/Network/src/NetworkEvents.cpp b/libraries/Network/src/NetworkEvents.cpp index 3643734b4..bb02282e9 100644 --- a/libraries/Network/src/NetworkEvents.cpp +++ b/libraries/Network/src/NetworkEvents.cpp @@ -134,10 +134,73 @@ void NetworkEvents::checkForEvent() { free(event); } +uint32_t NetworkEvents::findEvent(NetworkEventCb cbEvent, arduino_event_id_t event) { + uint32_t i; + + if (!cbEvent) { + return cbEventList.size(); + } + + for (i = 0; i < cbEventList.size(); i++) { + NetworkEventCbList_t entry = cbEventList[i]; + if (entry.cb == cbEvent && entry.event == event) { + break; + } + } + return i; +} + +template static size_t getStdFunctionAddress(std::function f) { + typedef T(fnType)(U...); + fnType **fnPointer = f.template target(); + if (fnPointer != nullptr) { + return (size_t)*fnPointer; + } + return (size_t)fnPointer; +} + +uint32_t NetworkEvents::findEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event) { + uint32_t i; + + if (!cbEvent) { + return cbEventList.size(); + } + + for (i = 0; i < cbEventList.size(); i++) { + NetworkEventCbList_t entry = cbEventList[i]; + if (getStdFunctionAddress(entry.fcb) == getStdFunctionAddress(cbEvent) && entry.event == event) { + break; + } + } + return i; +} + +uint32_t NetworkEvents::findEvent(NetworkEventSysCb cbEvent, arduino_event_id_t event) { + uint32_t i; + + if (!cbEvent) { + return cbEventList.size(); + } + + for (i = 0; i < cbEventList.size(); i++) { + NetworkEventCbList_t entry = cbEventList[i]; + if (entry.scb == cbEvent && entry.event == event) { + break; + } + } + return i; +} + network_event_handle_t NetworkEvents::onEvent(NetworkEventCb cbEvent, arduino_event_id_t event) { if (!cbEvent) { return 0; } + + if (findEvent(cbEvent, event) < cbEventList.size()) { + log_w("Attempt to add duplicate event handler!"); + return 0; + } + NetworkEventCbList_t newEventHandler; newEventHandler.cb = cbEvent; newEventHandler.fcb = NULL; @@ -151,6 +214,12 @@ network_event_handle_t NetworkEvents::onEvent(NetworkEventFuncCb cbEvent, arduin if (!cbEvent) { return 0; } + + if (findEvent(cbEvent, event) < cbEventList.size()) { + log_w("Attempt to add duplicate event handler!"); + return 0; + } + NetworkEventCbList_t newEventHandler; newEventHandler.cb = NULL; newEventHandler.fcb = cbEvent; @@ -164,6 +233,12 @@ network_event_handle_t NetworkEvents::onEvent(NetworkEventSysCb cbEvent, arduino if (!cbEvent) { return 0; } + + if (findEvent(cbEvent, event) < cbEventList.size()) { + log_w("Attempt to add duplicate event handler!"); + return 0; + } + NetworkEventCbList_t newEventHandler; newEventHandler.cb = NULL; newEventHandler.fcb = NULL; @@ -177,6 +252,12 @@ network_event_handle_t NetworkEvents::onSysEvent(NetworkEventCb cbEvent, arduino if (!cbEvent) { return 0; } + + if (findEvent(cbEvent, event) < cbEventList.size()) { + log_w("Attempt to add duplicate event handler!"); + return 0; + } + NetworkEventCbList_t newEventHandler; newEventHandler.cb = cbEvent; newEventHandler.fcb = NULL; @@ -190,6 +271,12 @@ network_event_handle_t NetworkEvents::onSysEvent(NetworkEventFuncCb cbEvent, ard if (!cbEvent) { return 0; } + + if (findEvent(cbEvent, event) < cbEventList.size()) { + log_w("Attempt to add duplicate event handler!"); + return 0; + } + NetworkEventCbList_t newEventHandler; newEventHandler.cb = NULL; newEventHandler.fcb = cbEvent; @@ -203,6 +290,12 @@ network_event_handle_t NetworkEvents::onSysEvent(NetworkEventSysCb cbEvent, ardu if (!cbEvent) { return 0; } + + if (findEvent(cbEvent, event) < cbEventList.size()) { + log_w("Attempt to add duplicate event handler!"); + return 0; + } + NetworkEventCbList_t newEventHandler; newEventHandler.cb = NULL; newEventHandler.fcb = NULL; @@ -213,51 +306,51 @@ network_event_handle_t NetworkEvents::onSysEvent(NetworkEventSysCb cbEvent, ardu } void NetworkEvents::removeEvent(NetworkEventCb cbEvent, arduino_event_id_t event) { + uint32_t i; + if (!cbEvent) { return; } - for (uint32_t i = 0; i < cbEventList.size(); i++) { - NetworkEventCbList_t entry = cbEventList[i]; - if (entry.cb == cbEvent && entry.event == event) { - cbEventList.erase(cbEventList.begin() + i); - } + i = findEvent(cbEvent, event); + if (i >= cbEventList.size()) { + log_w("Event handler not found!"); + return; } -} -template static size_t getStdFunctionAddress(std::function f) { - typedef T(fnType)(U...); - fnType **fnPointer = f.template target(); - if (fnPointer != nullptr) { - return (size_t)*fnPointer; - } - return (size_t)fnPointer; + cbEventList.erase(cbEventList.begin() + i); } void NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event) { + uint32_t i; + if (!cbEvent) { return; } - for (uint32_t i = 0; i < cbEventList.size(); i++) { - NetworkEventCbList_t entry = cbEventList[i]; - if (getStdFunctionAddress(entry.fcb) == getStdFunctionAddress(cbEvent) && entry.event == event) { - cbEventList.erase(cbEventList.begin() + i); - } + i = findEvent(cbEvent, event); + if (i >= cbEventList.size()) { + log_w("Event handler not found!"); + return; } + + cbEventList.erase(cbEventList.begin() + i); } void NetworkEvents::removeEvent(NetworkEventSysCb cbEvent, arduino_event_id_t event) { + uint32_t i; + if (!cbEvent) { return; } - for (uint32_t i = 0; i < cbEventList.size(); i++) { - NetworkEventCbList_t entry = cbEventList[i]; - if (entry.scb == cbEvent && entry.event == event) { - cbEventList.erase(cbEventList.begin() + i); - } + i = findEvent(cbEvent, event); + if (i >= cbEventList.size()) { + log_w("Event handler not found!"); + return; } + + cbEventList.erase(cbEventList.begin() + i); } void NetworkEvents::removeEvent(network_event_handle_t id) { @@ -265,8 +358,10 @@ void NetworkEvents::removeEvent(network_event_handle_t id) { NetworkEventCbList_t entry = cbEventList[i]; if (entry.id == id) { cbEventList.erase(cbEventList.begin() + i); + return; } } + log_w("Event handler not found!"); } int NetworkEvents::setStatusBits(int bits) { diff --git a/libraries/Network/src/NetworkEvents.h b/libraries/Network/src/NetworkEvents.h index a68fde595..ac324d198 100644 --- a/libraries/Network/src/NetworkEvents.h +++ b/libraries/Network/src/NetworkEvents.h @@ -155,6 +155,9 @@ public: protected: bool initNetworkEvents(); + uint32_t findEvent(NetworkEventCb cbEvent, arduino_event_id_t event); + uint32_t findEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event); + uint32_t findEvent(NetworkEventSysCb cbEvent, arduino_event_id_t event); network_event_handle_t onSysEvent(NetworkEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); network_event_handle_t onSysEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); network_event_handle_t onSysEvent(NetworkEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); From e989445b621a27b72be7064bd6b609f1f1895377 Mon Sep 17 00:00:00 2001 From: TD-er Date: Tue, 17 Sep 2024 10:54:48 +0200 Subject: [PATCH 11/17] Fix missing virtual declarations in Stream.h (#10348) * Fix missing virtual declarations in Stream.h Fixes some changes made in PR #10328 * Remove the virtual destructor as Print class has one As pointed out by @JAndrassy --- cores/esp32/Stream.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cores/esp32/Stream.h b/cores/esp32/Stream.h index 123694f6f..37346cdb9 100644 --- a/cores/esp32/Stream.h +++ b/cores/esp32/Stream.h @@ -105,8 +105,8 @@ public: float parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); // float version of parseInt - size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer - size_t readBytes(uint8_t *buffer, size_t length) { + virtual size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer + virtual size_t readBytes(uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); } // terminates if length characters have been read or timeout (see setTimeout) @@ -120,7 +120,7 @@ public: // returns the number of characters placed in the buffer (0 means no valid data found) // Arduino String functions to be added here - String readString(); + virtual String readString(); String readStringUntil(char terminator); protected: From c55f5aa5065b6ebfc0c1e8f5ef7f36b7e1605f71 Mon Sep 17 00:00:00 2001 From: ClockeNessMnstr Date: Tue, 17 Sep 2024 07:58:01 -0400 Subject: [PATCH 12/17] change(esp_now_serial): No teardown on retry limit (#10293) * change(ESP_NOW_Serial): No teardown on retry limit After max retries is met once the ESP_NOW_Serial_Class performs "end()". This removes the peer from ESP_NOW. Further messages to and from ESP_NOW_Serial are not received or sent. Peer should stay in ESP_NOW to re-establish connection even with data loss. This change will "retry and drop" the data piece by piece instead of aborting the connection. * feat(espnow): Add remove on fail parameter * feat(espnow): By default keep the peer when sending fails --------- Co-authored-by: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> --- libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp | 13 ++++++++++--- libraries/ESP_NOW/src/ESP32_NOW_Serial.h | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp b/libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp index e4220d456..17740d133 100644 --- a/libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp +++ b/libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp @@ -11,7 +11,7 @@ * */ -ESP_NOW_Serial_Class::ESP_NOW_Serial_Class(const uint8_t *mac_addr, uint8_t channel, wifi_interface_t iface, const uint8_t *lmk) +ESP_NOW_Serial_Class::ESP_NOW_Serial_Class(const uint8_t *mac_addr, uint8_t channel, wifi_interface_t iface, const uint8_t *lmk, bool remove_on_fail) : ESP_NOW_Peer(mac_addr, channel, iface, lmk) { tx_ring_buf = NULL; rx_queue = NULL; @@ -19,6 +19,7 @@ ESP_NOW_Serial_Class::ESP_NOW_Serial_Class(const uint8_t *mac_addr, uint8_t chan queued_size = 0; queued_buff = NULL; resend_count = 0; + _remove_on_fail = remove_on_fail; } ESP_NOW_Serial_Class::~ESP_NOW_Serial_Class() { @@ -264,9 +265,15 @@ void ESP_NOW_Serial_Class::onSent(bool success) { //the data is lost in this case vRingbufferReturnItem(tx_ring_buf, queued_buff); queued_buff = NULL; - xSemaphoreGive(tx_sem); - end(); log_e(MACSTR " : RE-SEND_MAX[%u]", MAC2STR(addr()), resend_count); + //if we are not able to send the data and remove_on_fail is set, remove the peer + if (_remove_on_fail) { + xSemaphoreGive(tx_sem); + end(); + return; + } + //log_d(MACSTR ": NEXT", MAC2STR(addr())); + checkForTxData(); } } } diff --git a/libraries/ESP_NOW/src/ESP32_NOW_Serial.h b/libraries/ESP_NOW/src/ESP32_NOW_Serial.h index 42349f6c2..b1f414563 100644 --- a/libraries/ESP_NOW/src/ESP32_NOW_Serial.h +++ b/libraries/ESP_NOW/src/ESP32_NOW_Serial.h @@ -17,12 +17,13 @@ private: size_t queued_size; uint8_t *queued_buff; size_t resend_count; + bool _remove_on_fail; bool checkForTxData(); size_t tryToSend(); public: - ESP_NOW_Serial_Class(const uint8_t *mac_addr, uint8_t channel, wifi_interface_t iface = WIFI_IF_AP, const uint8_t *lmk = NULL); + ESP_NOW_Serial_Class(const uint8_t *mac_addr, uint8_t channel, wifi_interface_t iface = WIFI_IF_AP, const uint8_t *lmk = NULL, bool remove_on_fail = false); ~ESP_NOW_Serial_Class(); size_t setRxBufferSize(size_t); size_t setTxBufferSize(size_t); From 100b3c67cf8c6857a5ac7e45dce5fb0ad817a824 Mon Sep 17 00:00:00 2001 From: TD-er Date: Wed, 18 Sep 2024 10:20:19 +0200 Subject: [PATCH 13/17] Reduce copy of Strings in WebServer RequestHandler (#10345) * Reduce copy of Strings in WebServer RequestHandler * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- .../examples/WebServer/WebServer.ino | 8 ++--- .../WebServer/src/detail/RequestHandler.h | 18 ++++++------ .../src/detail/RequestHandlersImpl.h | 29 ++++++++++--------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/libraries/WebServer/examples/WebServer/WebServer.ino b/libraries/WebServer/examples/WebServer/WebServer.ino index 9871826bb..809a95ce1 100644 --- a/libraries/WebServer/examples/WebServer/WebServer.ino +++ b/libraries/WebServer/examples/WebServer/WebServer.ino @@ -146,16 +146,16 @@ public: // @param requestMethod method of the http request line. // @param requestUri request resource from the http request line. // @return true when method can be handled. - bool canHandle(WebServer &server, HTTPMethod requestMethod, String uri) override { + bool canHandle(WebServer &server, HTTPMethod requestMethod, const String &uri) override { return ((requestMethod == HTTP_POST) || (requestMethod == HTTP_DELETE)); } // canHandle() - bool canUpload(WebServer &server, String uri) override { + bool canUpload(WebServer &server, const String &uri) override { // only allow upload on root fs level. return (uri == "/"); } // canUpload() - bool handle(WebServer &server, HTTPMethod requestMethod, String requestUri) override { + bool handle(WebServer &server, HTTPMethod requestMethod, const String &requestUri) override { // ensure that filename starts with '/' String fName = requestUri; if (!fName.startsWith("/")) { @@ -177,7 +177,7 @@ public: } // handle() // uploading process - void upload(WebServer UNUSED &server, String requestUri, HTTPUpload &upload) override { + void upload(WebServer UNUSED &server, const String &requestUri, HTTPUpload &upload) override { // ensure that filename starts with '/' static size_t uploadSize; diff --git a/libraries/WebServer/src/detail/RequestHandler.h b/libraries/WebServer/src/detail/RequestHandler.h index f19e7ab46..c730ce25b 100644 --- a/libraries/WebServer/src/detail/RequestHandler.h +++ b/libraries/WebServer/src/detail/RequestHandler.h @@ -12,16 +12,16 @@ public: note: old handler API for backward compatibility */ - virtual bool canHandle(HTTPMethod method, String uri) { + virtual bool canHandle(HTTPMethod method, const String &uri) { (void)method; (void)uri; return false; } - virtual bool canUpload(String uri) { + virtual bool canUpload(const String &uri) { (void)uri; return false; } - virtual bool canRaw(String uri) { + virtual bool canRaw(const String &uri) { (void)uri; return false; } @@ -30,34 +30,34 @@ public: note: new handler API with support for filters etc. */ - virtual bool canHandle(WebServer &server, HTTPMethod method, String uri) { + virtual bool canHandle(WebServer &server, HTTPMethod method, const String &uri) { (void)server; (void)method; (void)uri; return false; } - virtual bool canUpload(WebServer &server, String uri) { + virtual bool canUpload(WebServer &server, const String &uri) { (void)server; (void)uri; return false; } - virtual bool canRaw(WebServer &server, String uri) { + virtual bool canRaw(WebServer &server, const String &uri) { (void)server; (void)uri; return false; } - virtual bool handle(WebServer &server, HTTPMethod requestMethod, String requestUri) { + virtual bool handle(WebServer &server, HTTPMethod requestMethod, const String &requestUri) { (void)server; (void)requestMethod; (void)requestUri; return false; } - virtual void upload(WebServer &server, String requestUri, HTTPUpload &upload) { + virtual void upload(WebServer &server, const String &requestUri, HTTPUpload &upload) { (void)server; (void)requestUri; (void)upload; } - virtual void raw(WebServer &server, String requestUri, HTTPRaw &raw) { + virtual void raw(WebServer &server, const String &requestUri, HTTPRaw &raw) { (void)server; (void)requestUri; (void)raw; diff --git a/libraries/WebServer/src/detail/RequestHandlersImpl.h b/libraries/WebServer/src/detail/RequestHandlersImpl.h index b6eae6ade..c66c294dd 100644 --- a/libraries/WebServer/src/detail/RequestHandlersImpl.h +++ b/libraries/WebServer/src/detail/RequestHandlersImpl.h @@ -21,7 +21,7 @@ public: delete _uri; } - bool canHandle(HTTPMethod requestMethod, String requestUri) override { + bool canHandle(HTTPMethod requestMethod, const String &requestUri) override { if (_method != HTTP_ANY && _method != requestMethod) { return false; } @@ -29,7 +29,7 @@ public: return _uri->canHandle(requestUri, pathArgs); } - bool canUpload(String requestUri) override { + bool canUpload(const String &requestUri) override { if (!_ufn || !canHandle(HTTP_POST, requestUri)) { return false; } @@ -37,7 +37,7 @@ public: return true; } - bool canRaw(String requestUri) override { + bool canRaw(const String &requestUri) override { if (!_ufn || _method == HTTP_GET) { return false; } @@ -45,7 +45,7 @@ public: return true; } - bool canHandle(WebServer &server, HTTPMethod requestMethod, String requestUri) override { + bool canHandle(WebServer &server, HTTPMethod requestMethod, const String &requestUri) override { if (_method != HTTP_ANY && _method != requestMethod) { return false; } @@ -53,7 +53,7 @@ public: return _uri->canHandle(requestUri, pathArgs) && (_filter != NULL ? _filter(server) : true); } - bool canUpload(WebServer &server, String requestUri) override { + bool canUpload(WebServer &server, const String &requestUri) override { if (!_ufn || !canHandle(server, HTTP_POST, requestUri)) { return false; } @@ -61,7 +61,7 @@ public: return true; } - bool canRaw(WebServer &server, String requestUri) override { + bool canRaw(WebServer &server, const String &requestUri) override { if (!_ufn || _method == HTTP_GET || (_filter != NULL ? _filter(server) == false : false)) { return false; } @@ -69,7 +69,7 @@ public: return true; } - bool handle(WebServer &server, HTTPMethod requestMethod, String requestUri) override { + bool handle(WebServer &server, HTTPMethod requestMethod, const String &requestUri) override { if (!canHandle(server, requestMethod, requestUri)) { return false; } @@ -78,14 +78,14 @@ public: return true; } - void upload(WebServer &server, String requestUri, HTTPUpload &upload) override { + void upload(WebServer &server, const String &requestUri, HTTPUpload &upload) override { (void)upload; if (canUpload(server, requestUri)) { _ufn(); } } - void raw(WebServer &server, String requestUri, HTTPRaw &raw) override { + void raw(WebServer &server, const String &requestUri, HTTPRaw &raw) override { (void)raw; if (canRaw(server, requestUri)) { _ufn(); @@ -118,7 +118,7 @@ public: _baseUriLength = _uri.length(); } - bool canHandle(HTTPMethod requestMethod, String requestUri) override { + bool canHandle(HTTPMethod requestMethod, const String &requestUri) override { if (requestMethod != HTTP_GET) { return false; } @@ -130,7 +130,7 @@ public: return true; } - bool canHandle(WebServer &server, HTTPMethod requestMethod, String requestUri) override { + bool canHandle(WebServer &server, HTTPMethod requestMethod, const String &requestUri) override { if (requestMethod != HTTP_GET) { return false; } @@ -146,7 +146,7 @@ public: return true; } - bool handle(WebServer &server, HTTPMethod requestMethod, String requestUri) override { + bool handle(WebServer &server, HTTPMethod requestMethod, const String &requestUri) override { if (!canHandle(server, requestMethod, requestUri)) { return false; } @@ -154,13 +154,12 @@ public: log_v("StaticRequestHandler::handle: request=%s _uri=%s\r\n", requestUri.c_str(), _uri.c_str()); String path(_path); - String eTagCode; if (!_isFile) { // Base URI doesn't point to a file. // If a directory is requested, look for index file. if (requestUri.endsWith("/")) { - requestUri += "index.htm"; + return handle(server, requestMethod, String(requestUri + "index.htm")); } // Append whatever follows this URI in request to get the file path. @@ -184,6 +183,8 @@ public: return false; } + String eTagCode; + if (server._eTagEnabled) { if (server._eTagFunction) { eTagCode = (server._eTagFunction)(_fs, path); From 462870df2404eb1a5693a627474c2aa5c2da5e78 Mon Sep 17 00:00:00 2001 From: wurongmin <55608753+wurongmin@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:20:36 +0800 Subject: [PATCH 14/17] fix(variant): Rename waveshare esp32-s3 board. (#10355) * feat(variants): modify the one I successfully merged earlier * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- boards.txt | 346 +++++++++--------- .../pins_arduino.h | 2 +- 2 files changed, 174 insertions(+), 174 deletions(-) rename variants/{waveshare_esp32_touch_amoled_241 => waveshare_esp32_s3_touch_amoled_241}/pins_arduino.h (96%) diff --git a/boards.txt b/boards.txt index ecb66378e..88fb110b0 100644 --- a/boards.txt +++ b/boards.txt @@ -41427,204 +41427,204 @@ jczn_2432s028r.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api_zczr -lesp_zb ############################################################## -waveshare_esp32_touch_amoled_241.name=Waveshare ESP32-Touch-AMOLED-2.41 -waveshare_esp32_touch_amoled_241.vid.0=0x303a -waveshare_esp32_touch_amoled_241.pid.0=0x8242 -waveshare_esp32_touch_amoled_241.upload_port.0.vid=0x303a -waveshare_esp32_touch_amoled_241.upload_port.0.pid=0x8242 +waveshare_esp32_s3_touch_amoled_241.name=Waveshare ESP32-S3-Touch-AMOLED-2.41 +waveshare_esp32_s3_touch_amoled_241.vid.0=0x303a +waveshare_esp32_s3_touch_amoled_241.pid.0=0x8242 +waveshare_esp32_s3_touch_amoled_241.upload_port.0.vid=0x303a +waveshare_esp32_s3_touch_amoled_241.upload_port.0.pid=0x8242 -waveshare_esp32_touch_amoled_241.bootloader.tool=esptool_py -waveshare_esp32_touch_amoled_241.bootloader.tool.default=esptool_py +waveshare_esp32_s3_touch_amoled_241.bootloader.tool=esptool_py +waveshare_esp32_s3_touch_amoled_241.bootloader.tool.default=esptool_py -waveshare_esp32_touch_amoled_241.upload.tool=esptool_py -waveshare_esp32_touch_amoled_241.upload.tool.default=esptool_py -waveshare_esp32_touch_amoled_241.upload.tool.network=esp_ota +waveshare_esp32_s3_touch_amoled_241.upload.tool=esptool_py +waveshare_esp32_s3_touch_amoled_241.upload.tool.default=esptool_py +waveshare_esp32_s3_touch_amoled_241.upload.tool.network=esp_ota -waveshare_esp32_touch_amoled_241.upload.maximum_size=1310720 +waveshare_esp32_s3_touch_amoled_241.upload.maximum_size=1310720 -waveshare_esp32_touch_amoled_241.upload.maximum_data_size=327680 -waveshare_esp32_touch_amoled_241.upload.flags= -waveshare_esp32_touch_amoled_241.upload.extra_flags= -waveshare_esp32_touch_amoled_241.upload.use_1200bps_touch=false -waveshare_esp32_touch_amoled_241.upload.wait_for_upload_port=false +waveshare_esp32_s3_touch_amoled_241.upload.maximum_data_size=327680 +waveshare_esp32_s3_touch_amoled_241.upload.flags= +waveshare_esp32_s3_touch_amoled_241.upload.extra_flags= +waveshare_esp32_s3_touch_amoled_241.upload.use_1200bps_touch=false +waveshare_esp32_s3_touch_amoled_241.upload.wait_for_upload_port=false -waveshare_esp32_touch_amoled_241.serial.disableDTR=false -waveshare_esp32_touch_amoled_241.serial.disableRTS=false +waveshare_esp32_s3_touch_amoled_241.serial.disableDTR=false +waveshare_esp32_s3_touch_amoled_241.serial.disableRTS=false -waveshare_esp32_touch_amoled_241.build.tarch=xtensa -waveshare_esp32_touch_amoled_241.build.bootloader_addr=0x0 -waveshare_esp32_touch_amoled_241.build.target=esp32s3 -waveshare_esp32_touch_amoled_241.build.mcu=esp32s3 -waveshare_esp32_touch_amoled_241.build.core=esp32 -waveshare_esp32_touch_amoled_241.build.variant=waveshare_esp32_touch_amoled_241 -waveshare_esp32_touch_amoled_241.build.board=WAVESHARE_ESP32_TOUCH_AMOLED_241 +waveshare_esp32_s3_touch_amoled_241.build.tarch=xtensa +waveshare_esp32_s3_touch_amoled_241.build.bootloader_addr=0x0 +waveshare_esp32_s3_touch_amoled_241.build.target=esp32s3 +waveshare_esp32_s3_touch_amoled_241.build.mcu=esp32s3 +waveshare_esp32_s3_touch_amoled_241.build.core=esp32 +waveshare_esp32_s3_touch_amoled_241.build.variant=waveshare_esp32_s3_touch_amoled_241 +waveshare_esp32_s3_touch_amoled_241.build.board=WAVESHARE_ESP32_S3_TOUCH_AMOLED_241 -waveshare_esp32_touch_amoled_241.build.usb_mode=1 -waveshare_esp32_touch_amoled_241.build.cdc_on_boot=0 -waveshare_esp32_touch_amoled_241.build.msc_on_boot=0 -waveshare_esp32_touch_amoled_241.build.dfu_on_boot=0 -waveshare_esp32_touch_amoled_241.build.f_cpu=240000000L -waveshare_esp32_touch_amoled_241.build.flash_size=16MB +waveshare_esp32_s3_touch_amoled_241.build.usb_mode=1 +waveshare_esp32_s3_touch_amoled_241.build.cdc_on_boot=0 +waveshare_esp32_s3_touch_amoled_241.build.msc_on_boot=0 +waveshare_esp32_s3_touch_amoled_241.build.dfu_on_boot=0 +waveshare_esp32_s3_touch_amoled_241.build.f_cpu=240000000L +waveshare_esp32_s3_touch_amoled_241.build.flash_size=16MB -waveshare_esp32_touch_amoled_241.build.flash_freq=80m -waveshare_esp32_touch_amoled_241.build.flash_mode=dio -waveshare_esp32_touch_amoled_241.build.boot=qio -waveshare_esp32_touch_amoled_241.build.boot_freq=80m -waveshare_esp32_touch_amoled_241.build.partitions=default -waveshare_esp32_touch_amoled_241.build.defines= -waveshare_esp32_touch_amoled_241.build.loop_core= -waveshare_esp32_touch_amoled_241.build.event_core= -waveshare_esp32_touch_amoled_241.build.psram_type=qspi -waveshare_esp32_touch_amoled_241.build.memory_type={build.boot}_{build.psram_type} +waveshare_esp32_s3_touch_amoled_241.build.flash_freq=80m +waveshare_esp32_s3_touch_amoled_241.build.flash_mode=dio +waveshare_esp32_s3_touch_amoled_241.build.boot=qio +waveshare_esp32_s3_touch_amoled_241.build.boot_freq=80m +waveshare_esp32_s3_touch_amoled_241.build.partitions=default +waveshare_esp32_s3_touch_amoled_241.build.defines= +waveshare_esp32_s3_touch_amoled_241.build.loop_core= +waveshare_esp32_s3_touch_amoled_241.build.event_core= +waveshare_esp32_s3_touch_amoled_241.build.psram_type=qspi +waveshare_esp32_s3_touch_amoled_241.build.memory_type={build.boot}_{build.psram_type} -waveshare_esp32_touch_amoled_241.menu.PSRAM.disabled=Disabled -waveshare_esp32_touch_amoled_241.menu.PSRAM.disabled.build.defines= -waveshare_esp32_touch_amoled_241.menu.PSRAM.disabled.build.psram_type=qspi -waveshare_esp32_touch_amoled_241.menu.PSRAM.enabled=Enabled -waveshare_esp32_touch_amoled_241.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -waveshare_esp32_touch_amoled_241.menu.PSRAM.enabled.build.psram_type=opi +waveshare_esp32_s3_touch_amoled_241.menu.PSRAM.disabled=Disabled +waveshare_esp32_s3_touch_amoled_241.menu.PSRAM.disabled.build.defines= +waveshare_esp32_s3_touch_amoled_241.menu.PSRAM.disabled.build.psram_type=qspi +waveshare_esp32_s3_touch_amoled_241.menu.PSRAM.enabled=Enabled +waveshare_esp32_s3_touch_amoled_241.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +waveshare_esp32_s3_touch_amoled_241.menu.PSRAM.enabled.build.psram_type=opi -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio=QIO 80MHz -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio.build.flash_mode=dio -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio.build.boot=qio -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio.build.boot_freq=80m -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio.build.flash_freq=80m -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120=QIO 120MHz -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120.build.flash_mode=dio -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120.build.boot=qio -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120.build.boot_freq=120m -waveshare_esp32_touch_amoled_241.menu.FlashMode.qio120.build.flash_freq=80m +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio=QIO 80MHz +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio.build.flash_mode=dio +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio.build.boot=qio +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio.build.boot_freq=80m +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio.build.flash_freq=80m +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio120=QIO 120MHz +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio120.build.flash_mode=dio +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio120.build.boot=qio +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio120.build.boot_freq=120m +waveshare_esp32_s3_touch_amoled_241.menu.FlashMode.qio120.build.flash_freq=80m -waveshare_esp32_touch_amoled_241.menu.LoopCore.1=Core 1 -waveshare_esp32_touch_amoled_241.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 -waveshare_esp32_touch_amoled_241.menu.LoopCore.0=Core 0 -waveshare_esp32_touch_amoled_241.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 +waveshare_esp32_s3_touch_amoled_241.menu.LoopCore.1=Core 1 +waveshare_esp32_s3_touch_amoled_241.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +waveshare_esp32_s3_touch_amoled_241.menu.LoopCore.0=Core 0 +waveshare_esp32_s3_touch_amoled_241.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 -waveshare_esp32_touch_amoled_241.menu.EventsCore.1=Core 1 -waveshare_esp32_touch_amoled_241.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 -waveshare_esp32_touch_amoled_241.menu.EventsCore.0=Core 0 -waveshare_esp32_touch_amoled_241.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 +waveshare_esp32_s3_touch_amoled_241.menu.EventsCore.1=Core 1 +waveshare_esp32_s3_touch_amoled_241.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +waveshare_esp32_s3_touch_amoled_241.menu.EventsCore.0=Core 0 +waveshare_esp32_s3_touch_amoled_241.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 -waveshare_esp32_touch_amoled_241.menu.USBMode.hwcdc=Hardware CDC and JTAG -waveshare_esp32_touch_amoled_241.menu.USBMode.hwcdc.build.usb_mode=1 -waveshare_esp32_touch_amoled_241.menu.USBMode.default=USB-OTG (TinyUSB) -waveshare_esp32_touch_amoled_241.menu.USBMode.default.build.usb_mode=0 +waveshare_esp32_s3_touch_amoled_241.menu.USBMode.hwcdc=Hardware CDC and JTAG +waveshare_esp32_s3_touch_amoled_241.menu.USBMode.hwcdc.build.usb_mode=1 +waveshare_esp32_s3_touch_amoled_241.menu.USBMode.default=USB-OTG (TinyUSB) +waveshare_esp32_s3_touch_amoled_241.menu.USBMode.default.build.usb_mode=0 -waveshare_esp32_touch_amoled_241.menu.CDCOnBoot.default=Disabled -waveshare_esp32_touch_amoled_241.menu.CDCOnBoot.default.build.cdc_on_boot=0 -waveshare_esp32_touch_amoled_241.menu.CDCOnBoot.cdc=Enabled -waveshare_esp32_touch_amoled_241.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +waveshare_esp32_s3_touch_amoled_241.menu.CDCOnBoot.default=Disabled +waveshare_esp32_s3_touch_amoled_241.menu.CDCOnBoot.default.build.cdc_on_boot=0 +waveshare_esp32_s3_touch_amoled_241.menu.CDCOnBoot.cdc=Enabled +waveshare_esp32_s3_touch_amoled_241.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 -waveshare_esp32_touch_amoled_241.menu.MSCOnBoot.default=Disabled -waveshare_esp32_touch_amoled_241.menu.MSCOnBoot.default.build.msc_on_boot=0 -waveshare_esp32_touch_amoled_241.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) -waveshare_esp32_touch_amoled_241.menu.MSCOnBoot.msc.build.msc_on_boot=1 +waveshare_esp32_s3_touch_amoled_241.menu.MSCOnBoot.default=Disabled +waveshare_esp32_s3_touch_amoled_241.menu.MSCOnBoot.default.build.msc_on_boot=0 +waveshare_esp32_s3_touch_amoled_241.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +waveshare_esp32_s3_touch_amoled_241.menu.MSCOnBoot.msc.build.msc_on_boot=1 -waveshare_esp32_touch_amoled_241.menu.DFUOnBoot.default=Disabled -waveshare_esp32_touch_amoled_241.menu.DFUOnBoot.default.build.dfu_on_boot=0 -waveshare_esp32_touch_amoled_241.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) -waveshare_esp32_touch_amoled_241.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 +waveshare_esp32_s3_touch_amoled_241.menu.DFUOnBoot.default=Disabled +waveshare_esp32_s3_touch_amoled_241.menu.DFUOnBoot.default.build.dfu_on_boot=0 +waveshare_esp32_s3_touch_amoled_241.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +waveshare_esp32_s3_touch_amoled_241.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 -waveshare_esp32_touch_amoled_241.menu.UploadMode.default=UART0 / Hardware CDC -waveshare_esp32_touch_amoled_241.menu.UploadMode.default.upload.use_1200bps_touch=false -waveshare_esp32_touch_amoled_241.menu.UploadMode.default.upload.wait_for_upload_port=false -waveshare_esp32_touch_amoled_241.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) -waveshare_esp32_touch_amoled_241.menu.UploadMode.cdc.upload.use_1200bps_touch=true -waveshare_esp32_touch_amoled_241.menu.UploadMode.cdc.upload.wait_for_upload_port=true +waveshare_esp32_s3_touch_amoled_241.menu.UploadMode.default=UART0 / Hardware CDC +waveshare_esp32_s3_touch_amoled_241.menu.UploadMode.default.upload.use_1200bps_touch=false +waveshare_esp32_s3_touch_amoled_241.menu.UploadMode.default.upload.wait_for_upload_port=false +waveshare_esp32_s3_touch_amoled_241.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +waveshare_esp32_s3_touch_amoled_241.menu.UploadMode.cdc.upload.use_1200bps_touch=true +waveshare_esp32_s3_touch_amoled_241.menu.UploadMode.cdc.upload.wait_for_upload_port=true -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.default.build.partitions=default -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.default.build.partitions=default +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.defaultffat.build.partitions=default_ffat -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.no_ota.build.partitions=no_ota -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3g.build.partitions=noota_3g -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.huge_app.build.partitions=huge_app -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker=RainMaker 4MB -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker.build.partitions=rainmaker -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.fatflash.build.partitions=ffat -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.no_ota.build.partitions=no_ota +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.huge_app.build.partitions=huge_app +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.rainmaker=RainMaker 4MB +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.fatflash.build.partitions=ffat +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.otanofs=OTA no FS (2MB APP with OTA) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.otanofs.build.custom_partitions=partitions_otanofs_4MB -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.otanofs.upload.maximum_size=2031616 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.all_app=Max APP (4MB APP no OTA) -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.all_app.build.custom_partitions=partitions_all_app_4MB -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.all_app.upload.maximum_size=4128768 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.otanofs=OTA no FS (2MB APP with OTA) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.otanofs.build.custom_partitions=partitions_otanofs_4MB +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.otanofs.upload.maximum_size=2031616 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.all_app=Max APP (4MB APP no OTA) +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.all_app.build.custom_partitions=partitions_all_app_4MB +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.all_app.upload.maximum_size=4128768 -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.custom=Custom -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.custom.build.partitions= -waveshare_esp32_touch_amoled_241.menu.PartitionScheme.custom.upload.maximum_size=16777216 +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.custom=Custom +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.custom.build.partitions= +waveshare_esp32_s3_touch_amoled_241.menu.PartitionScheme.custom.upload.maximum_size=16777216 -waveshare_esp32_touch_amoled_241.menu.CPUFreq.240=240MHz (WiFi) -waveshare_esp32_touch_amoled_241.menu.CPUFreq.240.build.f_cpu=240000000L -waveshare_esp32_touch_amoled_241.menu.CPUFreq.160=160MHz (WiFi) -waveshare_esp32_touch_amoled_241.menu.CPUFreq.160.build.f_cpu=160000000L -waveshare_esp32_touch_amoled_241.menu.CPUFreq.80=80MHz (WiFi) -waveshare_esp32_touch_amoled_241.menu.CPUFreq.80.build.f_cpu=80000000L -waveshare_esp32_touch_amoled_241.menu.CPUFreq.40=40MHz -waveshare_esp32_touch_amoled_241.menu.CPUFreq.40.build.f_cpu=40000000L -waveshare_esp32_touch_amoled_241.menu.CPUFreq.20=20MHz -waveshare_esp32_touch_amoled_241.menu.CPUFreq.20.build.f_cpu=20000000L -waveshare_esp32_touch_amoled_241.menu.CPUFreq.10=10MHz -waveshare_esp32_touch_amoled_241.menu.CPUFreq.10.build.f_cpu=10000000L +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.240=240MHz (WiFi) +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.240.build.f_cpu=240000000L +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.160=160MHz (WiFi) +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.160.build.f_cpu=160000000L +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.80=80MHz (WiFi) +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.80.build.f_cpu=80000000L +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.40=40MHz +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.40.build.f_cpu=40000000L +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.20=20MHz +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.20.build.f_cpu=20000000L +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.10=10MHz +waveshare_esp32_s3_touch_amoled_241.menu.CPUFreq.10.build.f_cpu=10000000L -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.921600=921600 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.921600.upload.speed=921600 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.115200=115200 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.115200.upload.speed=115200 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.256000.windows=256000 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.256000.upload.speed=256000 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.230400.windows.upload.speed=256000 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.230400=230400 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.230400.upload.speed=230400 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.460800.linux=460800 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.460800.macosx=460800 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.460800.upload.speed=460800 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.512000.windows=512000 -waveshare_esp32_touch_amoled_241.menu.UploadSpeed.512000.upload.speed=512000 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.921600=921600 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.921600.upload.speed=921600 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.115200=115200 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.115200.upload.speed=115200 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.256000.windows=256000 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.256000.upload.speed=256000 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.230400.windows.upload.speed=256000 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.230400=230400 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.230400.upload.speed=230400 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.460800.linux=460800 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.460800.macosx=460800 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.460800.upload.speed=460800 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.512000.windows=512000 +waveshare_esp32_s3_touch_amoled_241.menu.UploadSpeed.512000.upload.speed=512000 -waveshare_esp32_touch_amoled_241.menu.DebugLevel.none=None -waveshare_esp32_touch_amoled_241.menu.DebugLevel.none.build.code_debug=0 -waveshare_esp32_touch_amoled_241.menu.DebugLevel.error=Error -waveshare_esp32_touch_amoled_241.menu.DebugLevel.error.build.code_debug=1 -waveshare_esp32_touch_amoled_241.menu.DebugLevel.warn=Warn -waveshare_esp32_touch_amoled_241.menu.DebugLevel.warn.build.code_debug=2 -waveshare_esp32_touch_amoled_241.menu.DebugLevel.info=Info -waveshare_esp32_touch_amoled_241.menu.DebugLevel.info.build.code_debug=3 -waveshare_esp32_touch_amoled_241.menu.DebugLevel.debug=Debug -waveshare_esp32_touch_amoled_241.menu.DebugLevel.debug.build.code_debug=4 -waveshare_esp32_touch_amoled_241.menu.DebugLevel.verbose=Verbose -waveshare_esp32_touch_amoled_241.menu.DebugLevel.verbose.build.code_debug=5 +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.none=None +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.none.build.code_debug=0 +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.error=Error +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.error.build.code_debug=1 +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.warn=Warn +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.warn.build.code_debug=2 +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.info=Info +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.info.build.code_debug=3 +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.debug=Debug +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.debug.build.code_debug=4 +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.verbose=Verbose +waveshare_esp32_s3_touch_amoled_241.menu.DebugLevel.verbose.build.code_debug=5 -waveshare_esp32_touch_amoled_241.menu.EraseFlash.none=Disabled -waveshare_esp32_touch_amoled_241.menu.EraseFlash.none.upload.erase_cmd= -waveshare_esp32_touch_amoled_241.menu.EraseFlash.all=Enabled -waveshare_esp32_touch_amoled_241.menu.EraseFlash.all.upload.erase_cmd=-e +waveshare_esp32_s3_touch_amoled_241.menu.EraseFlash.none=Disabled +waveshare_esp32_s3_touch_amoled_241.menu.EraseFlash.none.upload.erase_cmd= +waveshare_esp32_s3_touch_amoled_241.menu.EraseFlash.all=Enabled +waveshare_esp32_s3_touch_amoled_241.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## diff --git a/variants/waveshare_esp32_touch_amoled_241/pins_arduino.h b/variants/waveshare_esp32_s3_touch_amoled_241/pins_arduino.h similarity index 96% rename from variants/waveshare_esp32_touch_amoled_241/pins_arduino.h rename to variants/waveshare_esp32_s3_touch_amoled_241/pins_arduino.h index 7c26553fc..cb6c5f40a 100644 --- a/variants/waveshare_esp32_touch_amoled_241/pins_arduino.h +++ b/variants/waveshare_esp32_s3_touch_amoled_241/pins_arduino.h @@ -9,7 +9,7 @@ #define USB_PID 0x8242 #define USB_MANUFACTURER "Waveshare" -#define USB_PRODUCT "ESP32-Touch-AMOLED-2.41" +#define USB_PRODUCT "ESP32-S3-Touch-AMOLED-2.41" #define USB_SERIAL "" // display QSPI SPI2 From 8d772d5e8912dc49c7f9167087a78b57a0613727 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Wed, 18 Sep 2024 08:51:46 -0300 Subject: [PATCH 15/17] ESP Matter + Arduino as IDF Component Light example (#10290) * feat(matter): partition file for matter The declaration includes a partition for keys and SSL certificates. * feat(matter): matter light source code Adds necessary Matter + Arduino source code that will create a Matter compatible Light. * feat(matter): adds sdkconfig and CMake files Adds target sdkconfig files and the CMakeLists.txt in orde to build the application using Arduino+Matter as IDF component * fix(matter): wrong folder name * feat(matter): include example into registry * fix(matter): error with type in wrong place A declaration was incorrect due to a typo error. Sintax was corrected by deleting `BuiltInLED`. * feat(matter): add readme documentation * feat(matter): remove soc with no wifi or no ble * feat(matter): adjust all sdkconfig files * feat(matter): improve code and led status * feat(matter): add button and led gpio with kconfig * fix(matter): remove commented lines * fix(matter): remove commented lines * feat(matter): added a 2.4GHz SSID note Both the ESP32 device and the Smartphone running the Matter APP shall be in the same WiFi Network in order to achieve a successful commissioning process. * feat(matter): arduino managed comonent version Preparing the Arduino Managed Component to use Core version 3.0.5 or higher. * feat(matter): adds information about google Goggle Home Assistant requires special configurtation in order to allow the Light to show up in the GHA APP. * feat(matter): arduino component version Set final Arduino Managed Component to 3.0.5 necessary because of -DESP32=ESP32, in order to compile the project. * ci(pre-commit): Apply automatic fixes * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(typo): typo and commentaries * fix(matter): spell check ignore for CI * ci(pre-commit): Apply automatic fixes * fix(matter): spell check ignore for CI * fix(matter): spell check ignore for CI * fix(matter): spell check ignore for CI * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- idf_component.yml | 1 + .../esp_matter_light/CMakeLists.txt | 27 ++ .../esp_matter_light/README.md | 90 ++++ .../esp_matter_light/main/CMakeLists.txt | 5 + .../esp_matter_light/main/Kconfig.projbuild | 102 +++++ .../esp_matter_light/main/builtinLED.cpp | 237 +++++++++++ .../esp_matter_light/main/builtinLED.h | 74 ++++ .../esp_matter_light/main/idf_component.yml | 12 + .../main/matter_accessory_driver.cpp | 89 ++++ .../main/matter_accessory_driver.h | 47 +++ .../esp_matter_light/main/matter_light.cpp | 384 ++++++++++++++++++ .../esp_matter_light/partitions.csv | 10 + .../sdkconfig.defaults.c6_thread | 79 ++++ .../sdkconfig.defaults.esp32c3 | 64 +++ .../sdkconfig.defaults.esp32c6 | 79 ++++ .../sdkconfig.defaults.esp32s3 | 64 +++ 16 files changed, 1364 insertions(+) create mode 100644 idf_component_examples/esp_matter_light/CMakeLists.txt create mode 100644 idf_component_examples/esp_matter_light/README.md create mode 100644 idf_component_examples/esp_matter_light/main/CMakeLists.txt create mode 100644 idf_component_examples/esp_matter_light/main/Kconfig.projbuild create mode 100644 idf_component_examples/esp_matter_light/main/builtinLED.cpp create mode 100644 idf_component_examples/esp_matter_light/main/builtinLED.h create mode 100644 idf_component_examples/esp_matter_light/main/idf_component.yml create mode 100644 idf_component_examples/esp_matter_light/main/matter_accessory_driver.cpp create mode 100644 idf_component_examples/esp_matter_light/main/matter_accessory_driver.h create mode 100644 idf_component_examples/esp_matter_light/main/matter_light.cpp create mode 100644 idf_component_examples/esp_matter_light/partitions.csv create mode 100644 idf_component_examples/esp_matter_light/sdkconfig.defaults.c6_thread create mode 100644 idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c3 create mode 100644 idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6 create mode 100644 idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32s3 diff --git a/idf_component.yml b/idf_component.yml index 21ec39b4d..9c06ef0fb 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -97,3 +97,4 @@ dependencies: examples: - path: ./idf_component_examples/hello_world - path: ./idf_component_examples/hw_cdc_hello_world + - path: ./idf_component_examples/esp_matter_light diff --git a/idf_component_examples/esp_matter_light/CMakeLists.txt b/idf_component_examples/esp_matter_light/CMakeLists.txt new file mode 100644 index 000000000..16a7533f2 --- /dev/null +++ b/idf_component_examples/esp_matter_light/CMakeLists.txt @@ -0,0 +1,27 @@ +# The following lines of boilerplate have to be in your project's +# CMakeLists in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) + +set(PROJECT_VER "1.0") +set(PROJECT_VER_NUMBER 1) + +# This should be done before using the IDF_TARGET variable. +include($ENV{IDF_PATH}/tools/cmake/project.cmake) + +project(arduino_managed_component_light) + +# WARNING: This is just an example for using key for decrypting the encrypted OTA image +# Please do not use it as is. +if(CONFIG_ENABLE_ENCRYPTED_OTA) + target_add_binary_data(light.elf "esp_image_encryption_key.pem" TEXT) +endif() + +if(CONFIG_IDF_TARGET_ESP32C2) + include(relinker) +endif() + +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) +# For RISCV chips, project_include.cmake sets -Wno-format, but does not clear various +# flags that depend on -Wformat +idf_build_set_property(COMPILE_OPTIONS "-Wno-format-nonliteral;-Wno-format-security" APPEND) diff --git a/idf_component_examples/esp_matter_light/README.md b/idf_component_examples/esp_matter_light/README.md new file mode 100644 index 000000000..13a55f8ef --- /dev/null +++ b/idf_component_examples/esp_matter_light/README.md @@ -0,0 +1,90 @@ +| Supported Targets | ESP32-S3 | ESP32-C3 | ESP32-C6 | +| ----------------- | -------- | -------- | -------- | + + +# Managed Component Light + +This example is configured by default to work with the ESP32-S3, which has the RGB LED GPIO set as pin 48 and the BOOT button on GPIO 0. + +This example creates a Color Temperature Light device using the esp_matter component downloaded from the [Espressif Component Registry](https://components.espressif.com/) instead of an extra component locally, so the example can work without setting up the esp-matter environment. + +See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware. + +The code is based on the Arduino API and uses Arduino as an IDF Component. + +## How to use it + +Once the device runs for the first time, it must be commissioned to the Matter Fabric of the available Matter Environment. +Possible Matter Environments are: +- Amazon Alexa +- Google Home Assistant (*) +- Apple Home +- Open Source Home Assistant + +(*) Google Home Assistant requires the user to set up a Matter Light using the [Google Home Developer Console](https://developers.home.google.com/codelabs/matter-device#2). It is necessary to create a Matter Light device with VID = 0xFFF1 and PID = 0x8000. Otherwise, the Light won't show up in the GHA APP. This action is necessary because the Firmware uses Testing credentials and Google requires the user to create the testing device before using it. + +There is no QR Code to be used when the Smartphone APP wants to add the Matter Device. +Please enter the code manually: `34970112332` + +The devboard has a built-in LED that will be used as the Matter Light. +The default setting of the code uses pin 48 for the ESP32-S3. +Please change it in `main/matter_accessory_driver.h` or in the `sdkconfig.defaults.` file. + +## LED Status and Factory Mode + +The WS2812b built-in LED will turn purple as soon as the device is flashed and runs for the first time. +The purple color indicates that the Matter Accessory has not been commissioned yet. +After using a Matter provider Smartphone APP to add a Matter device to your Home Application, it may turn orange to indicate that it has no Wi-Fi connection. + +Once it connects to the Wi-Fi network, the LED will turn white to indicate that Matter is working and the device is connected to the Matter Environment. +Please note that Matter over Wi-Fi using an ESP32 device will connect to a 2.4 GHz Wi-Fi SSID, therefore the Commissioner APP Smartphone shall be connected to this SSID. + +The Matter and Wi-Fi configuration will be stored in NVS to ensure that it will connect to the Matter Fabric and Wi-Fi Network again once it is reset. + +The Matter Smartphone APP will control the light state (ON/OFF), temperature (Warm/Cold White), and brightness. + +## On Board Light toggle button + +The built-in BOOT button will toggle On/Off and replicate the new state to the Matter Environment, making it visible in the Matter Smartphone APP as well. + +## Returning to the Factory State + +Holding the BOOT button pressed for more than 10 seconds and then releasing it will erase all Matter and Wi-Fi configuration, forcing it to reset to factory state. After that, the device needs to be commissioned again. Previous setups done in the Smartphone APP won't work again; therefore, the virtual device shall be removed from the APP. + +## Building the Application using Wi-Fi and Matter + +Use ESP-IDF 5.1.4 from https://github.com/espressif/esp-idf/tree/release/v5.1 +This example has been tested with Arduino Core 3.0.4 + +The project will download all necessary components, including the Arduino Core. +Run `idf.py SDKCONFIG_DEFAULTS="sdkconfig.defaults..idf" -p flash monitor` + +Example for ESP32-S3/Linux | macOS: +`idf.py SDKCONFIG_DEFAULTS="sdkconfig.defaults.esp32s3" -p /dev/ttyACM0 flash monitor` +Example for ESP32-C3/Windows: +`idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.esp32c3" -p com3 flash monitor` + +It may be necessary to delete some folders and files before running `idf.py` +Linux/macOS: `rm -rf build managed_components sdkconfig dependencies.lock` +Windows: `rmdir /s/q build managed_components` and `del sdkconfig dependencies.lock` + +There is a configuration file for these SoC: esp32s3, esp32c3, esp32c6. +Those are the tested devices that have a WS2812 RGB LED and can run BLE, Wi-Fi and Matter. + +In case it is necessary to change the Button Pin or the REG LED Pin, please use the `menuconfig` +`idf.py menuconfig` and change the Menu Option `Light Matter Accessory` + +## Using OpenThread with Matter + +This is possible with the ESP32-C6. +It is neessasy to have a Thread Border Routed in the Matter Environment. Check you matter hardware provider. +In order to build the application that will use Thread Networking instead of Wi-Fi, please execute: + +Example for ESP32-S3/Linux | macOS: +`idf.py SDKCONFIG_DEFAULTS="sdkconfig.defaults.c6_thread" -p /dev/ttyACM0 flash monitor` +Example for ESP32-C3/Windows: +`idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.c6_thread" -p com3 flash monitor` + +It may be necessary to delete some folders and files before running `idf.py` +Linux/macOS: `rm -rf build managed_components sdkconfig dependencies.lock` +Windows: `rmdir /s/q build managed_components` and `del sdkconfig dependencies.lock` diff --git a/idf_component_examples/esp_matter_light/main/CMakeLists.txt b/idf_component_examples/esp_matter_light/main/CMakeLists.txt new file mode 100644 index 000000000..6b91a8cf5 --- /dev/null +++ b/idf_component_examples/esp_matter_light/main/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register(SRC_DIRS "." + INCLUDE_DIRS ".") + +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) +target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/idf_component_examples/esp_matter_light/main/Kconfig.projbuild b/idf_component_examples/esp_matter_light/main/Kconfig.projbuild new file mode 100644 index 000000000..6e6abcb7f --- /dev/null +++ b/idf_component_examples/esp_matter_light/main/Kconfig.projbuild @@ -0,0 +1,102 @@ +menu "Light Matter Accessory" + menu "On Board Light ON/OFF Button" + config BUTTON_PIN + int + prompt "Button 1 GPIO" + default ENV_GPIO_BOOT_BUTTON + range -1 ENV_GPIO_IN_RANGE_MAX + help + The GPIO pin for button that will be used to turn on/off the Matter Light. It shall be connected to a push button. It can use the BOOT button of the development board. + endmenu + + + menu "LEDs" + config WS2812_PIN + int + prompt "WS2812 RGB LED GPIO" + default ENV_GPIO_RGB_LED + range -1 ENV_GPIO_OUT_RANGE_MAX + help + The GPIO pin for the Matter Light that will be driven by RMT. It shall be connected to one single WS2812 RGB LED. + endmenu + + # TARGET CONFIGURATION + if IDF_TARGET_ESP32C3 + config ENV_GPIO_RANGE_MIN + int + default 0 + + config ENV_GPIO_RANGE_MAX + int + default 19 + # GPIOs 20/21 are always used by UART in examples + + config ENV_GPIO_IN_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX + + config ENV_GPIO_OUT_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX + + config ENV_GPIO_BOOT_BUTTON + int + default 9 + + config ENV_GPIO_RGB_LED + int + default 8 + endif + if IDF_TARGET_ESP32C6 + config ENV_GPIO_RANGE_MIN + int + default 0 + + config ENV_GPIO_RANGE_MAX + int + default 30 + # GPIOs 16/17 are always used by UART in examples + + config ENV_GPIO_IN_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX + + config ENV_GPIO_OUT_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX + + config ENV_GPIO_BOOT_BUTTON + int + default 9 + + config ENV_GPIO_RGB_LED + int + default 8 + endif + if IDF_TARGET_ESP32S3 + config ENV_GPIO_RANGE_MIN + int + default 0 + + config ENV_GPIO_RANGE_MAX + int + default 48 + + config ENV_GPIO_IN_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX + + config ENV_GPIO_OUT_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX + + config ENV_GPIO_BOOT_BUTTON + int + default 0 + + config ENV_GPIO_RGB_LED + int + default 48 + endif + +endmenu diff --git a/idf_component_examples/esp_matter_light/main/builtinLED.cpp b/idf_component_examples/esp_matter_light/main/builtinLED.cpp new file mode 100644 index 000000000..8795dde27 --- /dev/null +++ b/idf_component_examples/esp_matter_light/main/builtinLED.cpp @@ -0,0 +1,237 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. + This will implement the onboard WS2812b LED as a LED indicator + It can be used to indicate some state or status of the device + The LED can be controlled using RGB, HSV or color temperature, brightness + + In this example, the LED Indicator class is used as the Matter light accessory +*/ + +#include "builtinLED.h" + +typedef struct { + uint16_t hue; + uint8_t saturation; +} HS_color_t; + +static const HS_color_t temperatureTable[] = { + {4, 100}, {8, 100}, {11, 100}, {14, 100}, {16, 100}, {18, 100}, {20, 100}, {22, 100}, {24, 100}, {25, 100}, {27, 100}, {28, 100}, {30, 100}, {31, 100}, + {31, 95}, {30, 89}, {30, 85}, {29, 80}, {29, 76}, {29, 73}, {29, 69}, {28, 66}, {28, 63}, {28, 60}, {28, 57}, {28, 54}, {28, 52}, {27, 49}, + {27, 47}, {27, 45}, {27, 43}, {27, 41}, {27, 39}, {27, 37}, {27, 35}, {27, 33}, {27, 31}, {27, 30}, {27, 28}, {27, 26}, {27, 25}, {27, 23}, + {27, 22}, {27, 21}, {27, 19}, {27, 18}, {27, 17}, {27, 15}, {28, 14}, {28, 13}, {28, 12}, {29, 10}, {29, 9}, {30, 8}, {31, 7}, {32, 6}, + {34, 5}, {36, 4}, {41, 3}, {49, 2}, {0, 0}, {294, 2}, {265, 3}, {251, 4}, {242, 5}, {237, 6}, {233, 7}, {231, 8}, {229, 9}, {228, 10}, + {227, 11}, {226, 11}, {226, 12}, {225, 13}, {225, 13}, {224, 14}, {224, 14}, {224, 15}, {224, 15}, {223, 16}, {223, 16}, {223, 17}, {223, 17}, {223, 17}, + {222, 18}, {222, 18}, {222, 19}, {222, 19}, {222, 19}, {222, 19}, {222, 20}, {222, 20}, {222, 20}, {222, 21}, {222, 21} +}; + +/* step brightness table: gamma = 2.3 */ +static const uint8_t gamma_table[MAX_PROGRESS] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, + 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, + 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, + 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 86, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, + 105, 107, 108, 110, 111, 112, 114, 115, 117, 118, 120, 121, 123, 124, 126, 128, 129, 131, 132, 134, 135, 137, 139, 140, 142, 144, 145, 147, 149, + 150, 152, 154, 156, 157, 159, 161, 163, 164, 166, 168, 170, 172, 174, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, + 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 226, 228, 230, 232, 234, 236, 239, 241, 243, 245, 248, 250, 252, 255, +}; + +BuiltInLED::BuiltInLED() { + pin_number = (uint8_t)-1; // no pin number + state = false; // LED is off + hsv_color.value = 0; // black color +} + +BuiltInLED::~BuiltInLED() { + end(); +} + +led_indicator_color_hsv_t BuiltInLED::rgb2hsv(led_indicator_color_rgb_t rgb) { + led_indicator_color_hsv_t hsv; + uint8_t minRGB, maxRGB; + uint8_t delta; + + minRGB = rgb.r < rgb.g ? (rgb.r < rgb.b ? rgb.r : rgb.b) : (rgb.g < rgb.b ? rgb.g : rgb.b); + maxRGB = rgb.r > rgb.g ? (rgb.r > rgb.b ? rgb.r : rgb.b) : (rgb.g > rgb.b ? rgb.g : rgb.b); + hsv.value = 0; + hsv.v = maxRGB; + delta = maxRGB - minRGB; + + if (delta == 0) { + hsv.h = 0; + hsv.s = 0; + } else { + hsv.s = delta * 255 / maxRGB; + + if (rgb.r == maxRGB) { + hsv.h = (60 * (rgb.g - rgb.b) / delta + 360) % 360; + } else if (rgb.g == maxRGB) { + hsv.h = (60 * (rgb.b - rgb.r) / delta + 120); + } else { + hsv.h = (60 * (rgb.r - rgb.g) / delta + 240); + } + } + return hsv; +} + +led_indicator_color_rgb_t BuiltInLED::hsv2rgb(led_indicator_color_hsv_t hsv) { + led_indicator_color_rgb_t rgb; + uint8_t rgb_max = hsv.v; + uint8_t rgb_min = rgb_max * (255 - hsv.s) / 255.0f; + + uint8_t i = hsv.h / 60; + uint8_t diff = hsv.h % 60; + + // RGB adjustment amount by hue + uint8_t rgb_adj = (rgb_max - rgb_min) * diff / 60; + rgb.value = 0; + switch (i) { + case 0: + rgb.r = rgb_max; + rgb.g = rgb_min + rgb_adj; + rgb.b = rgb_min; + break; + case 1: + rgb.r = rgb_max - rgb_adj; + rgb.g = rgb_max; + rgb.b = rgb_min; + break; + case 2: + rgb.r = rgb_min; + rgb.g = rgb_max; + rgb.b = rgb_min + rgb_adj; + break; + case 3: + rgb.r = rgb_min; + rgb.g = rgb_max - rgb_adj; + rgb.b = rgb_max; + break; + case 4: + rgb.r = rgb_min + rgb_adj; + rgb.g = rgb_min; + rgb.b = rgb_max; + break; + default: + rgb.r = rgb_max; + rgb.g = rgb_min; + rgb.b = rgb_max - rgb_adj; + break; + } + + // gamma correction + rgb.r = gamma_table[rgb.r]; + rgb.g = gamma_table[rgb.g]; + rgb.b = gamma_table[rgb.b]; + return rgb; +} + +void BuiltInLED::begin(uint8_t pin) { + if (pin < NUM_DIGITAL_PINS) { + pin_number = pin; + log_i("Initializing pin %d", pin); + } else { + log_e("Invalid pin (%d) number", pin); + } +} +void BuiltInLED::end() { + state = false; + write(); // turn off the LED + if (pin_number < NUM_DIGITAL_PINS) { + if (!rmtDeinit(pin_number)) { + log_e("Failed to deinitialize RMT"); + } + } +} + +void BuiltInLED::on() { + state = true; +} + +void BuiltInLED::off() { + state = false; +} + +void BuiltInLED::toggle() { + state = !state; +} + +bool BuiltInLED::getState() { + return state; +} + +bool BuiltInLED::write() { + led_indicator_color_rgb_t rgb_color = getRGB(); + log_d("Writing to pin %d with state = %s", pin_number, state ? "ON" : "OFF"); + log_d("HSV: %d, %d, %d", hsv_color.h, hsv_color.s, hsv_color.v); + log_d("RGB: %d, %d, %d", rgb_color.r, rgb_color.g, rgb_color.b); + if (pin_number < NUM_DIGITAL_PINS) { + if (state) { + rgbLedWrite(pin_number, rgb_color.r, rgb_color.g, rgb_color.b); + } else { + rgbLedWrite(pin_number, 0, 0, 0); + } + return true; + } else { + log_e("Invalid pin (%d) number", pin_number); + return false; + } +} + +void BuiltInLED::setBrightness(uint8_t brightness) { + hsv_color.v = brightness; +} + +uint8_t BuiltInLED::getBrightness() { + return hsv_color.v; +} + +void BuiltInLED::setHSV(led_indicator_color_hsv_t hsv) { + if (hsv.h > MAX_HUE) { + hsv.h = MAX_HUE; + } + hsv_color.value = hsv.value; +} + +led_indicator_color_hsv_t BuiltInLED::getHSV() { + return hsv_color; +} + +void BuiltInLED::setRGB(led_indicator_color_rgb_t rgb_color) { + hsv_color = rgb2hsv(rgb_color); +} + +led_indicator_color_rgb_t BuiltInLED::getRGB() { + return hsv2rgb(hsv_color); +} + +void BuiltInLED::setTemperature(uint32_t temperature) { + uint16_t hue; + uint8_t saturation; + + log_d("Requested Temperature: %ld", temperature); + //hsv_color.v = gamma_table[((temperature >> 25) & 0x7F)]; + temperature &= 0xFFFFFF; + if (temperature < 600) { + hue = 0; + saturation = 100; + } else { + if (temperature > 10000) { + hue = 222; + saturation = 21 + (temperature - 10000) * 41 / 990000; + } else { + temperature -= 600; + temperature /= 100; + hue = temperatureTable[temperature].hue; + saturation = temperatureTable[temperature].saturation; + } + } + saturation = (saturation * 255) / 100; + // brightness is not changed + hsv_color.h = hue; + hsv_color.s = saturation; + log_d("Calculated Temperature: %ld, Hue: %d, Saturation: %d, Brightness: %d", temperature, hue, saturation, hsv_color.v); +} diff --git a/idf_component_examples/esp_matter_light/main/builtinLED.h b/idf_component_examples/esp_matter_light/main/builtinLED.h new file mode 100644 index 000000000..1ca8c9355 --- /dev/null +++ b/idf_component_examples/esp_matter_light/main/builtinLED.h @@ -0,0 +1,74 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. + This will implement the onboard WS2812b LED as a LED indicator + It can be used to indicate some state or status of the device + The LED can be controlled using RGB, HSV or color temperature, brightness + + In this example, the BuiltInLED class is used as the Matter light accessory +*/ + +#pragma once + +#include + +#define MAX_HUE 360 +#define MAX_SATURATION 255 +#define MAX_BRIGHTNESS 255 +#define MAX_PROGRESS 256 + +typedef struct { + union { + struct { + uint32_t v : 8; /*!< Brightness/Value of the LED. 0-255 */ + uint32_t s : 8; /*!< Saturation of the LED. 0-255 */ + uint32_t h : 9; /*!< Hue of the LED. 0-360 */ + }; + uint32_t value; /*!< IHSV value of the LED. */ + }; +} led_indicator_color_hsv_t; + +typedef struct { + union { + struct { + uint32_t r : 8; /*!< Red component of the LED color. Range: 0-255. */ + uint32_t g : 8; /*!< Green component of the LED color. Range: 0-255. */ + uint32_t b : 8; /*!< Blue component of the LED color. Range: 0-255. */ + }; + uint32_t value; /*!< Combined RGB value of the LED color. */ + }; +} led_indicator_color_rgb_t; + +class BuiltInLED { +private: + uint8_t pin_number; + bool state; + led_indicator_color_hsv_t hsv_color; + +public: + BuiltInLED(); + ~BuiltInLED(); + + static led_indicator_color_hsv_t rgb2hsv(led_indicator_color_rgb_t rgb_value); + static led_indicator_color_rgb_t hsv2rgb(led_indicator_color_hsv_t hsv); + + void begin(uint8_t pin); + void end(); + + void on(); + void off(); + void toggle(); + bool getState(); + + bool write(); + + void setBrightness(uint8_t brightness); + uint8_t getBrightness(); + void setHSV(led_indicator_color_hsv_t hsv); + led_indicator_color_hsv_t getHSV(); + void setRGB(led_indicator_color_rgb_t color); + led_indicator_color_rgb_t getRGB(); + void setTemperature(uint32_t temperature); +}; diff --git a/idf_component_examples/esp_matter_light/main/idf_component.yml b/idf_component_examples/esp_matter_light/main/idf_component.yml new file mode 100644 index 000000000..2b4ae4b34 --- /dev/null +++ b/idf_component_examples/esp_matter_light/main/idf_component.yml @@ -0,0 +1,12 @@ +dependencies: + espressif/esp_matter: + version: "^1.3.0" + # Adds Arduino Core from GitHub repository using main branch + espressif/arduino-esp32: + version: "^3.0.5" + override_path: "../../../" + pre_release: true + + # testing - using Arduino from the repository + # version: "master" # branch or commit + # git: https://github.com/espressif/arduino-esp32.git diff --git a/idf_component_examples/esp_matter_light/main/matter_accessory_driver.cpp b/idf_component_examples/esp_matter_light/main/matter_accessory_driver.cpp new file mode 100644 index 000000000..523c38e68 --- /dev/null +++ b/idf_component_examples/esp_matter_light/main/matter_accessory_driver.cpp @@ -0,0 +1,89 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +#include +#include +#include +#include "builtinLED.h" +#include "matter_accessory_driver.h" + +/* Do any conversions/remapping for the actual value here */ +esp_err_t light_accessory_set_power(void *led, uint8_t val) { + BuiltInLED *builtinLED = (BuiltInLED *)led; + esp_err_t err = ESP_OK; + if (val) { + builtinLED->on(); + } else { + builtinLED->off(); + } + if (!builtinLED->write()) { + err = ESP_FAIL; + } + log_i("LED set power: %d", val); + return err; +} + +esp_err_t light_accessory_set_brightness(void *led, uint8_t val) { + esp_err_t err = ESP_OK; + BuiltInLED *builtinLED = (BuiltInLED *)led; + int value = REMAP_TO_RANGE(val, MATTER_BRIGHTNESS, STANDARD_BRIGHTNESS); + + builtinLED->setBrightness(value); + if (!builtinLED->write()) { + err = ESP_FAIL; + } + log_i("LED set brightness: %d", value); + return err; +} + +esp_err_t light_accessory_set_hue(void *led, uint8_t val) { + esp_err_t err = ESP_OK; + BuiltInLED *builtinLED = (BuiltInLED *)led; + int value = REMAP_TO_RANGE(val, MATTER_HUE, STANDARD_HUE); + led_indicator_color_hsv_t hsv = builtinLED->getHSV(); + hsv.h = value; + builtinLED->setHSV(hsv); + if (!builtinLED->write()) { + err = ESP_FAIL; + } + log_i("LED set hue: %d", value); + return err; +} + +esp_err_t light_accessory_set_saturation(void *led, uint8_t val) { + esp_err_t err = ESP_OK; + BuiltInLED *builtinLED = (BuiltInLED *)led; + int value = REMAP_TO_RANGE(val, MATTER_SATURATION, STANDARD_SATURATION); + led_indicator_color_hsv_t hsv = builtinLED->getHSV(); + hsv.s = value; + builtinLED->setHSV(hsv); + if (!builtinLED->write()) { + err = ESP_FAIL; + } + log_i("LED set saturation: %d", value); + return err; +} + +esp_err_t light_accessory_set_temperature(void *led, uint16_t val) { + esp_err_t err = ESP_OK; + BuiltInLED *builtinLED = (BuiltInLED *)led; + uint32_t value = REMAP_TO_RANGE_INVERSE(val, STANDARD_TEMPERATURE_FACTOR); + builtinLED->setTemperature(value); + if (!builtinLED->write()) { + err = ESP_FAIL; + } + log_i("LED set temperature: %ld", value); + return err; +} + +app_driver_handle_t light_accessory_init() { + /* Initialize led */ + static BuiltInLED builtinLED; + + const uint8_t pin = WS2812_PIN; // set your board WS2812b pin here + builtinLED.begin(pin); + return (app_driver_handle_t)&builtinLED; +} diff --git a/idf_component_examples/esp_matter_light/main/matter_accessory_driver.h b/idf_component_examples/esp_matter_light/main/matter_accessory_driver.h new file mode 100644 index 000000000..3bf6655ab --- /dev/null +++ b/idf_component_examples/esp_matter_light/main/matter_accessory_driver.h @@ -0,0 +1,47 @@ +#include +#include + +// set your board WS2812b pin here (e.g. 48 is the default pin for the ESP32-S3 devkit) +#ifndef CONFIG_WS2812_PIN +#define WS2812_PIN 48 // ESP32-S3 DevKitC built-in LED +#else +#define WS2812_PIN CONFIG_WS2812_PIN // From sdkconfig.defaults. +#endif + +#ifndef RGB_BUILTIN +#define RGB_BUILTIN WS2812_PIN +#endif + +// Set your board button pin here (e.g. 0 is the default pin for the ESP32-S3 devkit) +#ifndef CONFIG_BUTTON_PIN +#define BUTTON_PIN 0 // ESP32-S3 DevKitC built-in button +#else +#define BUTTON_PIN CONFIG_BUTTON_PIN // From sdkconfig.defaults. +#endif + +/** Standard max values (used for remapping attributes) */ +#define STANDARD_BRIGHTNESS 255 +#define STANDARD_HUE 360 +#define STANDARD_SATURATION 255 +#define STANDARD_TEMPERATURE_FACTOR 1000000 + +/** Matter max values (used for remapping attributes) */ +#define MATTER_BRIGHTNESS 254 +#define MATTER_HUE 254 +#define MATTER_SATURATION 254 +#define MATTER_TEMPERATURE_FACTOR 1000000 + +/** Default attribute values used during initialization */ +#define DEFAULT_POWER true +#define DEFAULT_BRIGHTNESS 64 +#define DEFAULT_HUE 128 +#define DEFAULT_SATURATION 254 + +typedef void *app_driver_handle_t; + +esp_err_t light_accessory_set_power(void *led, uint8_t val); +esp_err_t light_accessory_set_brightness(void *led, uint8_t val); +esp_err_t light_accessory_set_hue(void *led, uint8_t val); +esp_err_t light_accessory_set_saturation(void *led, uint8_t val); +esp_err_t light_accessory_set_temperature(void *led, uint16_t val); +app_driver_handle_t light_accessory_init(); diff --git a/idf_component_examples/esp_matter_light/main/matter_light.cpp b/idf_component_examples/esp_matter_light/main/matter_light.cpp new file mode 100644 index 000000000..6079ce46a --- /dev/null +++ b/idf_component_examples/esp_matter_light/main/matter_light.cpp @@ -0,0 +1,384 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +#include +#include "matter_accessory_driver.h" + +#include + +#include +#include +#include + +#include +#include + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD +#include +#include "esp_openthread_types.h" + +#define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \ + { .radio_mode = RADIO_MODE_NATIVE, } + +#define ESP_OPENTHREAD_DEFAULT_HOST_CONFIG() \ + { .host_connection_mode = HOST_CONNECTION_MODE_NONE, } + +#define ESP_OPENTHREAD_DEFAULT_PORT_CONFIG() \ + { .storage_partition_name = "nvs", .netif_queue_size = 10, .task_queue_size = 10, } +#endif + +// set your board button pin here +const uint8_t button_gpio = BUTTON_PIN; // GPIO BOOT Button + +uint16_t light_endpoint_id = 0; + +using namespace esp_matter; +using namespace esp_matter::attribute; +using namespace esp_matter::endpoint; +using namespace chip::app::Clusters; + +constexpr auto k_timeout_seconds = 300; + +#if CONFIG_ENABLE_ENCRYPTED_OTA +extern const char decryption_key_start[] asm("_binary_esp_image_encryption_key_pem_start"); +extern const char decryption_key_end[] asm("_binary_esp_image_encryption_key_pem_end"); + +static const char *s_decryption_key = decryption_key_start; +static const uint16_t s_decryption_key_len = decryption_key_end - decryption_key_start; +#endif // CONFIG_ENABLE_ENCRYPTED_OTA + +bool isAccessoryCommissioned() { + return chip::Server::GetInstance().GetFabricTable().FabricCount() > 0; +} + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION +bool isWifiConnected() { + return chip::DeviceLayer::ConnectivityMgr().IsWiFiStationConnected(); +} +#endif + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD +bool isThreadConnected() { + return chip::DeviceLayer::ConnectivityMgr().IsThreadAttached(); +} +#endif + +static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg) { + switch (event->Type) { + case chip::DeviceLayer::DeviceEventType::kInterfaceIpAddressChanged: + log_i( + "Interface %s Address changed", event->InterfaceIpAddressChanged.Type == chip::DeviceLayer::InterfaceIpChangeType::kIpV4_Assigned ? "IPv4" : "IPV6" + ); + break; + + case chip::DeviceLayer::DeviceEventType::kCommissioningComplete: log_i("Commissioning complete"); break; + + case chip::DeviceLayer::DeviceEventType::kFailSafeTimerExpired: log_i("Commissioning failed, fail safe timer expired"); break; + + case chip::DeviceLayer::DeviceEventType::kCommissioningSessionStarted: log_i("Commissioning session started"); break; + + case chip::DeviceLayer::DeviceEventType::kCommissioningSessionStopped: log_i("Commissioning session stopped"); break; + + case chip::DeviceLayer::DeviceEventType::kCommissioningWindowOpened: log_i("Commissioning window opened"); break; + + case chip::DeviceLayer::DeviceEventType::kCommissioningWindowClosed: log_i("Commissioning window closed"); break; + + case chip::DeviceLayer::DeviceEventType::kFabricRemoved: + { + log_i("Fabric removed successfully"); + if (chip::Server::GetInstance().GetFabricTable().FabricCount() == 0) { + chip::CommissioningWindowManager &commissionMgr = chip::Server::GetInstance().GetCommissioningWindowManager(); + constexpr auto kTimeoutSeconds = chip::System::Clock::Seconds16(k_timeout_seconds); + if (!commissionMgr.IsCommissioningWindowOpen()) { + /* After removing last fabric, this example does not remove the Wi-Fi credentials + * and still has IP connectivity so, only advertising on DNS-SD. + */ + CHIP_ERROR err = commissionMgr.OpenBasicCommissioningWindow(kTimeoutSeconds, chip::CommissioningWindowAdvertisement::kDnssdOnly); + if (err != CHIP_NO_ERROR) { + log_e("Failed to open commissioning window, err:%" CHIP_ERROR_FORMAT, err.Format()); + } + } + } + break; + } + + case chip::DeviceLayer::DeviceEventType::kFabricWillBeRemoved: log_i("Fabric will be removed"); break; + + case chip::DeviceLayer::DeviceEventType::kFabricUpdated: log_i("Fabric is updated"); break; + + case chip::DeviceLayer::DeviceEventType::kFabricCommitted: log_i("Fabric is committed"); break; + + case chip::DeviceLayer::DeviceEventType::kBLEDeinitialized: log_i("BLE deinitialized and memory reclaimed"); break; + + default: break; + } +} + +esp_err_t matter_light_attribute_update( + app_driver_handle_t driver_handle, uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val +) { + esp_err_t err = ESP_OK; + if (endpoint_id == light_endpoint_id) { + void *led = (void *)driver_handle; + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { + err = light_accessory_set_power(led, val->val.b); + } + } else if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { + err = light_accessory_set_brightness(led, val->val.u8); + } + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { + err = light_accessory_set_hue(led, val->val.u8); + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { + err = light_accessory_set_saturation(led, val->val.u8); + } else if (attribute_id == ColorControl::Attributes::ColorTemperatureMireds::Id) { + err = light_accessory_set_temperature(led, val->val.u16); + } + } + } + return err; +} + +esp_err_t matter_light_set_defaults(uint16_t endpoint_id) { + esp_err_t err = ESP_OK; + + void *led = endpoint::get_priv_data(endpoint_id); + node_t *node = node::get(); + endpoint_t *endpoint = endpoint::get(node, endpoint_id); + cluster_t *cluster = NULL; + attribute_t *attribute = NULL; + esp_matter_attr_val_t val = esp_matter_invalid(NULL); + + /* Setting brightness */ + cluster = cluster::get(endpoint, LevelControl::Id); + attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id); + attribute::get_val(attribute, &val); + err |= light_accessory_set_brightness(led, val.val.u8); + + /* Setting color */ + cluster = cluster::get(endpoint, ColorControl::Id); + attribute = attribute::get(cluster, ColorControl::Attributes::ColorMode::Id); + attribute::get_val(attribute, &val); + if (val.val.u8 == (uint8_t)ColorControl::ColorMode::kCurrentHueAndCurrentSaturation) { + /* Setting hue */ + attribute = attribute::get(cluster, ColorControl::Attributes::CurrentHue::Id); + attribute::get_val(attribute, &val); + err |= light_accessory_set_hue(led, val.val.u8); + /* Setting saturation */ + attribute = attribute::get(cluster, ColorControl::Attributes::CurrentSaturation::Id); + attribute::get_val(attribute, &val); + err |= light_accessory_set_saturation(led, val.val.u8); + } else if (val.val.u8 == (uint8_t)ColorControl::ColorMode::kColorTemperature) { + /* Setting temperature */ + attribute = attribute::get(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id); + attribute::get_val(attribute, &val); + err |= light_accessory_set_temperature(led, val.val.u16); + } else { + log_e("Color mode not supported"); + } + + /* Setting power */ + cluster = cluster::get(endpoint, OnOff::Id); + attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id); + attribute::get_val(attribute, &val); + err |= light_accessory_set_power(led, val.val.b); + + return err; +} + +void button_driver_init() { + /* Initialize button */ + pinMode(button_gpio, INPUT_PULLUP); +} + +// This callback is called for every attribute update. The callback implementation shall +// handle the desired attributes and return an appropriate error code. If the attribute +// is not of your interest, please do not return an error code and strictly return ESP_OK. +static esp_err_t app_attribute_update_cb( + attribute::callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data +) { + esp_err_t err = ESP_OK; + + if (type == PRE_UPDATE) { + /* Driver update */ + app_driver_handle_t driver_handle = (app_driver_handle_t)priv_data; + err = matter_light_attribute_update(driver_handle, endpoint_id, cluster_id, attribute_id, val); + } + + return err; +} + +// This callback is invoked when clients interact with the Identify Cluster. +// In the callback implementation, an endpoint can identify itself. (e.g., by flashing an LED or light). +static esp_err_t app_identification_cb(identification::callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, uint8_t effect_variant, void *priv_data) { + log_i("Identification callback: type: %u, effect: %u, variant: %u", type, effect_id, effect_variant); + return ESP_OK; +} + +void setup() { + esp_err_t err = ESP_OK; + + /* Initialize driver */ + app_driver_handle_t light_handle = light_accessory_init(); + button_driver_init(); + + /* Create a Matter node and add the mandatory Root Node device type on endpoint 0 */ + node::config_t node_config; + + // node handle can be used to add/modify other endpoints. + node_t *node = node::create(&node_config, app_attribute_update_cb, app_identification_cb); + if (node == nullptr) { + log_e("Failed to create Matter node"); + abort(); + } + + extended_color_light::config_t light_config; + light_config.on_off.on_off = DEFAULT_POWER; + light_config.on_off.lighting.start_up_on_off = nullptr; + light_config.level_control.current_level = DEFAULT_BRIGHTNESS; + light_config.level_control.lighting.start_up_current_level = DEFAULT_BRIGHTNESS; + light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; + light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; + light_config.color_control.color_temperature.startup_color_temperature_mireds = nullptr; + + // endpoint handles can be used to add/modify clusters. + endpoint_t *endpoint = extended_color_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle); + if (endpoint == nullptr) { + log_e("Failed to create extended color light endpoint"); + abort(); + } + + light_endpoint_id = endpoint::get_id(endpoint); + log_i("Light created with endpoint_id %d", light_endpoint_id); + + /* Mark deferred persistence for some attributes that might be changed rapidly */ + cluster_t *level_control_cluster = cluster::get(endpoint, LevelControl::Id); + attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id); + attribute::set_deferred_persistence(current_level_attribute); + + cluster_t *color_control_cluster = cluster::get(endpoint, ColorControl::Id); + attribute_t *current_x_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::CurrentX::Id); + attribute::set_deferred_persistence(current_x_attribute); + attribute_t *current_y_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::CurrentY::Id); // codespell:ignore + attribute::set_deferred_persistence(current_y_attribute); + attribute_t *color_temp_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::ColorTemperatureMireds::Id); + attribute::set_deferred_persistence(color_temp_attribute); + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + /* Set OpenThread platform config */ + esp_openthread_platform_config_t config = { + .radio_config = ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG(), + .host_config = ESP_OPENTHREAD_DEFAULT_HOST_CONFIG(), + .port_config = ESP_OPENTHREAD_DEFAULT_PORT_CONFIG(), + }; + set_openthread_platform_config(&config); +#endif + + /* Matter start */ + err = esp_matter::start(app_event_cb); + if (err != ESP_OK) { + log_e("Failed to start Matter, err:%d", err); + abort(); + } + +#if CONFIG_ENABLE_ENCRYPTED_OTA + err = esp_matter_ota_requestor_encrypted_init(s_decryption_key, s_decryption_key_len); + if (err != ESP_OK) { + log_e("Failed to initialized the encrypted OTA, err: %d", err); + abort(); + } +#endif // CONFIG_ENABLE_ENCRYPTED_OTA + +#if CONFIG_ENABLE_CHIP_SHELL + esp_matter::console::diagnostics_register_commands(); + esp_matter::console::wifi_register_commands(); +#if CONFIG_OPENTHREAD_CLI + esp_matter::console::otcli_register_commands(); +#endif + esp_matter::console::init(); +#endif +} + +void loop() { + static uint32_t button_time_stamp = 0; + static bool button_state = false; + static bool started = false; + + if (!isAccessoryCommissioned()) { + log_w("Accessory not commissioned yet. Waiting for commissioning."); +#ifdef RGB_BUILTIN + rgbLedWrite(RGB_BUILTIN, 48, 0, 20); // Purple indicates accessory not commissioned +#endif + delay(5000); + return; + } + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION + if (!isWifiConnected()) { + log_w("Wi-Fi not connected yet. Waiting for connection."); +#ifdef RGB_BUILTIN + rgbLedWrite(RGB_BUILTIN, 48, 20, 0); // Orange indicates accessory not connected to Wi-Fi +#endif + delay(5000); + return; + } +#endif + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + if (!isThreadConnected()) { + log_w("Thread not connected yet. Waiting for connection."); +#ifdef RGB_BUILTIN + rgbLedWrite(RGB_BUILTIN, 0, 20, 48); // Blue indicates accessory not connected to Trhead +#endif + delay(5000); + return; + } +#endif + + // Once all network connections are established, the accessory is ready for use + // Run it only once + if (!started) { + log_i("Accessory is commissioned and connected to Wi-Fi. Ready for use."); + started = true; + // Starting driver with default values + matter_light_set_defaults(light_endpoint_id); + } + + // Check if the button is pressed and toggle the light right away + if (digitalRead(button_gpio) == LOW && !button_state) { + // deals with button debounce + button_time_stamp = millis(); // record the time while the button is pressed. + button_state = true; // pressed. + + // Toggle button is pressed - toggle the light + log_i("Toggle button pressed"); + + endpoint_t *endpoint = endpoint::get(node::get(), light_endpoint_id); + cluster_t *cluster = cluster::get(endpoint, OnOff::Id); + attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id); + + esp_matter_attr_val_t val = esp_matter_invalid(NULL); + attribute::get_val(attribute, &val); + val.val.b = !val.val.b; + attribute::update(light_endpoint_id, OnOff::Id, OnOff::Attributes::OnOff::Id, &val); + } + + // Check if the button is released and handle the factory reset + uint32_t time_diff = millis() - button_time_stamp; + if (button_state && time_diff > 100 && digitalRead(button_gpio) == HIGH) { + button_state = false; // released. It can be pressed again after 100ms debounce. + + // Factory reset is triggered if the button is pressed for more than 10 seconds + if (time_diff > 10000) { + log_i("Factory reset triggered. Light will restored to factory settings."); + esp_matter::factory_reset(); + } + } + + delay(50); // WDT is happier with a delay +} diff --git a/idf_component_examples/esp_matter_light/partitions.csv b/idf_component_examples/esp_matter_light/partitions.csv new file mode 100644 index 000000000..ffe5f242e --- /dev/null +++ b/idf_component_examples/esp_matter_light/partitions.csv @@ -0,0 +1,10 @@ +# Name, Type, SubType, Offset, Size, Flags +# Note: Firmware partition offset needs to be 64K aligned, initial 36K (9 sectors) are reserved for bootloader and partition table +esp_secure_cert, 0x3F, ,0xd000, 0x2000, encrypted +nvs, data, nvs, 0x10000, 0xC000, +nvs_keys, data, nvs_keys,, 0x1000, encrypted +otadata, data, ota, , 0x2000 +phy_init, data, phy, , 0x1000, +ota_0, app, ota_0, 0x20000, 0x1E0000, +ota_1, app, ota_1, 0x200000, 0x1E0000, +fctry, data, nvs, 0x3E0000, 0x6000 diff --git a/idf_component_examples/esp_matter_light/sdkconfig.defaults.c6_thread b/idf_component_examples/esp_matter_light/sdkconfig.defaults.c6_thread new file mode 100644 index 000000000..502480f94 --- /dev/null +++ b/idf_component_examples/esp_matter_light/sdkconfig.defaults.c6_thread @@ -0,0 +1,79 @@ +CONFIG_IDF_TARGET="esp32c6" + +# Arduino Settings +CONFIG_FREERTOS_HZ=1000 +CONFIG_AUTOSTART_ARDUINO=y + +# Log Levels +# Boot Messages - Log level +CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y +# Arduino Log Level +CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO=y +# IDF Log Level +CONFIG_LOG_DEFAULT_LEVEL_ERROR=y + +# Default to 921600 baud when flashing and monitoring device +CONFIG_ESPTOOLPY_BAUD_921600B=y +CONFIG_ESPTOOLPY_BAUD=921600 +CONFIG_ESPTOOLPY_COMPRESSED=y +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y + +# libsodium +CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y + +# NIMBLE +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_EXT_ADV=n +CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n + +# FreeRTOS should use legacy API +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y + +# Enable OpenThread +CONFIG_OPENTHREAD_ENABLED=y +CONFIG_OPENTHREAD_SRP_CLIENT=y +CONFIG_OPENTHREAD_DNS_CLIENT=y +CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n +CONFIG_OPENTHREAD_LOG_LEVEL_NOTE=y +CONFIG_OPENTHREAD_CLI=n + +# Disable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=n + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# LwIP config for OpenThread +CONFIG_LWIP_IPV6_NUM_ADDRESSES=8 +CONFIG_LWIP_MULTICAST_PING=y + +# MDNS platform +CONFIG_USE_MINIMAL_MDNS=n +CONFIG_ENABLE_EXTENDED_DISCOVERY=y + +# Enable OTA Requester +CONFIG_ENABLE_OTA_REQUESTOR=n + +# Disable STA and AP for ESP32C6 +CONFIG_ENABLE_WIFI_STATION=n +CONFIG_ENABLE_WIFI_AP=n + +# Enable chip shell +CONFIG_ENABLE_CHIP_SHELL=n + +# Disable persist subscriptions +CONFIG_ENABLE_PERSIST_SUBSCRIPTIONS=n + +# MRP configs +CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL_FOR_THREAD=5000 +CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL_FOR_THREAD=5000 +CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST_FOR_THREAD=5000 +CONFIG_MRP_MAX_RETRANS=3 + +# Enable HKDF in mbedtls +CONFIG_MBEDTLS_HKDF_C=y diff --git a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c3 b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c3 new file mode 100644 index 000000000..df6d6b0d5 --- /dev/null +++ b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c3 @@ -0,0 +1,64 @@ +CONFIG_IDF_TARGET="esp32c3" + +# Arduino Settings +CONFIG_FREERTOS_HZ=1000 +CONFIG_AUTOSTART_ARDUINO=y + +# Log Levels +# Boot Messages - Log level +CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y +# Arduino Log Level +CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO=y +# IDF Log Level +CONFIG_LOG_DEFAULT_LEVEL_ERROR=y + +# Default to 921600 baud when flashing and monitoring device +CONFIG_ESPTOOLPY_BAUD_921600B=y +CONFIG_ESPTOOLPY_BAUD=921600 +CONFIG_ESPTOOLPY_COMPRESSED=y +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y + +#enable BT +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y + +#disable BT connection reattempt +CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n + +#enable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=y + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_OFFSET=0xC000 + +# Disable chip shell +CONFIG_ENABLE_CHIP_SHELL=n + +# Enable OTA Requester +CONFIG_ENABLE_OTA_REQUESTOR=n + +#enable lwIP route hooks +CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y +CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y + +# disable softap by default +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n +CONFIG_ENABLE_WIFI_STATION=y +CONFIG_ENABLE_WIFI_AP=n + +# Disable DS Peripheral +CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n + +# Use compact attribute storage mode +CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y + +# Enable HKDF in mbedtls +CONFIG_MBEDTLS_HKDF_C=y + +# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1) +# unique local addresses for fabrics(MAX_FABRIC), a link local address(1) +CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 diff --git a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6 b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6 new file mode 100644 index 000000000..f228f3158 --- /dev/null +++ b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6 @@ -0,0 +1,79 @@ +CONFIG_IDF_TARGET="esp32c6" + +# Arduino Settings +CONFIG_FREERTOS_HZ=1000 +CONFIG_AUTOSTART_ARDUINO=y + +# Log Levels +# Boot Messages - Log level +CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y +# Arduino Log Level +CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO=y +# IDF Log Level +CONFIG_LOG_DEFAULT_LEVEL_ERROR=y + +# Default to 921600 baud when flashing and monitoring device +CONFIG_ESPTOOLPY_BAUD_921600B=y +CONFIG_ESPTOOLPY_BAUD=921600 +CONFIG_ESPTOOLPY_COMPRESSED=y +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y + +#enable BT +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y + +#disable BT connection reattempt +CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n + +#enable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=y + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_OFFSET=0xC000 + +# Disable chip shell +CONFIG_ENABLE_CHIP_SHELL=n + +# Enable OTA Requester +CONFIG_ENABLE_OTA_REQUESTOR=n + +#enable lwIP route hooks +CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y +CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y + +# disable softap by default +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n +CONFIG_ENABLE_WIFI_STATION=y +CONFIG_ENABLE_WIFI_AP=n + +# Disable DS Peripheral +CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n + +# Use compact attribute storage mode +CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y + +# Enable HKDF in mbedtls +CONFIG_MBEDTLS_HKDF_C=y + +# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1) +# unique local addresses for fabrics(MAX_FABRIC), a link local address(1) +CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 + +# libsodium +CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y + +# NIMBLE +CONFIG_BT_NIMBLE_EXT_ADV=n +CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=y + +# FreeRTOS should use legacy API +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y + +# Use minimal mDNS +CONFIG_USE_MINIMAL_MDNS=y +CONFIG_ENABLE_EXTENDED_DISCOVERY=y diff --git a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32s3 b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32s3 new file mode 100644 index 000000000..9c1aa36b6 --- /dev/null +++ b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32s3 @@ -0,0 +1,64 @@ +CONFIG_IDF_TARGET="esp32s3" + +# Arduino Settings +CONFIG_FREERTOS_HZ=1000 +CONFIG_AUTOSTART_ARDUINO=y + +# Log Levels +# Boot Messages - Log level +CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y +# Arduino Log Level +CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO=y +# IDF Log Level +CONFIG_LOG_DEFAULT_LEVEL_ERROR=y + +# Default to 921600 baud when flashing and monitoring device +CONFIG_ESPTOOLPY_BAUD_921600B=y +CONFIG_ESPTOOLPY_BAUD=921600 +CONFIG_ESPTOOLPY_COMPRESSED=y +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y + +#enable BT +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y + +#disable BT connection reattempt +CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n + +#enable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=y + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_OFFSET=0xC000 + +# Disable chip shell +CONFIG_ENABLE_CHIP_SHELL=n + +# Enable OTA Requester +CONFIG_ENABLE_OTA_REQUESTOR=n + +#enable lwIP route hooks +CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y +CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y + +# disable softap by default +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n +CONFIG_ENABLE_WIFI_STATION=y +CONFIG_ENABLE_WIFI_AP=n + +# Disable DS Peripheral +CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n + +# Use compact attribute storage mode +CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y + +# Enable HKDF in mbedtls +CONFIG_MBEDTLS_HKDF_C=y + +# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1) +# unique local addresses for fabrics(MAX_FABRIC), a link local address(1) +CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 From ab951cf08a363b4dcf4479325b1cfed300128c1d Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Wed, 18 Sep 2024 14:52:03 +0300 Subject: [PATCH 16/17] IDF release/v5.1 (#10320) * IDF release/v5.1 e026fd1f * IDF release/v5.1 99775566 * IDF release/v5.1 8af42a08 * IDF release/v5.1 33fbade6 * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- package/package_esp32_index.template.json | 128 +++++++++++----------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 8ea4f6cb4..751617ee1 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -42,7 +42,7 @@ { "packager": "esp32", "name": "esp32-arduino-libs", - "version": "idf-release_v5.1-e026fd1f" + "version": "idf-release_v5.1-33fbade6" }, { "packager": "esp32", @@ -77,7 +77,7 @@ { "packager": "esp32", "name": "openocd-esp32", - "version": "v0.12.0-esp32-20240726" + "version": "v0.12.0-esp32-20240821" }, { "packager": "esp32", @@ -105,63 +105,63 @@ "tools": [ { "name": "esp32-arduino-libs", - "version": "idf-release_v5.1-e026fd1f", + "version": "idf-release_v5.1-33fbade6", "systems": [ { "host": "i686-mingw32", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "checksum": "SHA-256:4d2ab6f04042f7b3ca7f84564306ed901be2eb48874d38e992b548c78aad5d08", - "size": "308534003" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "checksum": "SHA-256:578f325fa9fca635d9c6c3b19726cb26077751e3155b677317bde2e0b371df7d", + "size": "309285463" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "checksum": "SHA-256:4d2ab6f04042f7b3ca7f84564306ed901be2eb48874d38e992b548c78aad5d08", - "size": "308534003" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "checksum": "SHA-256:578f325fa9fca635d9c6c3b19726cb26077751e3155b677317bde2e0b371df7d", + "size": "309285463" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "checksum": "SHA-256:4d2ab6f04042f7b3ca7f84564306ed901be2eb48874d38e992b548c78aad5d08", - "size": "308534003" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "checksum": "SHA-256:578f325fa9fca635d9c6c3b19726cb26077751e3155b677317bde2e0b371df7d", + "size": "309285463" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "checksum": "SHA-256:4d2ab6f04042f7b3ca7f84564306ed901be2eb48874d38e992b548c78aad5d08", - "size": "308534003" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "checksum": "SHA-256:578f325fa9fca635d9c6c3b19726cb26077751e3155b677317bde2e0b371df7d", + "size": "309285463" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "checksum": "SHA-256:4d2ab6f04042f7b3ca7f84564306ed901be2eb48874d38e992b548c78aad5d08", - "size": "308534003" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "checksum": "SHA-256:578f325fa9fca635d9c6c3b19726cb26077751e3155b677317bde2e0b371df7d", + "size": "309285463" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "checksum": "SHA-256:4d2ab6f04042f7b3ca7f84564306ed901be2eb48874d38e992b548c78aad5d08", - "size": "308534003" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "checksum": "SHA-256:578f325fa9fca635d9c6c3b19726cb26077751e3155b677317bde2e0b371df7d", + "size": "309285463" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "checksum": "SHA-256:4d2ab6f04042f7b3ca7f84564306ed901be2eb48874d38e992b548c78aad5d08", - "size": "308534003" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "checksum": "SHA-256:578f325fa9fca635d9c6c3b19726cb26077751e3155b677317bde2e0b371df7d", + "size": "309285463" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-e026fd1f.zip", - "checksum": "SHA-256:4d2ab6f04042f7b3ca7f84564306ed901be2eb48874d38e992b548c78aad5d08", - "size": "308534003" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.1-33fbade6.zip", + "checksum": "SHA-256:578f325fa9fca635d9c6c3b19726cb26077751e3155b677317bde2e0b371df7d", + "size": "309285463" } ] }, @@ -539,56 +539,56 @@ }, { "name": "openocd-esp32", - "version": "v0.12.0-esp32-20240726", + "version": "v0.12.0-esp32-20240821", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240726/openocd-esp32-linux-amd64-0.12.0-esp32-20240726.tar.gz", - "archiveFileName": "openocd-esp32-linux-amd64-0.12.0-esp32-20240726.tar.gz", - "checksum": "SHA-256:31fabbda5f39262ea4ed8cbba8adedc1d39838f01043cfab95435743c126ac56", - "size": "2368175" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240821/openocd-esp32-linux-amd64-0.12.0-esp32-20240821.tar.gz", + "archiveFileName": "openocd-esp32-linux-amd64-0.12.0-esp32-20240821.tar.gz", + "checksum": "SHA-256:f8c68541fa38307bc0c0763b7e1e3fe4e943d5d45da07d817a73b492e103b652", + "size": "2373094" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240726/openocd-esp32-linux-arm64-0.12.0-esp32-20240726.tar.gz", - "archiveFileName": "openocd-esp32-linux-arm64-0.12.0-esp32-20240726.tar.gz", - "checksum": "SHA-256:05589effadc93440ecca4a8ecc64e78dc94185a4ab72bc54634751dd7b6060d0", - "size": "2239793" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240821/openocd-esp32-linux-arm64-0.12.0-esp32-20240821.tar.gz", + "archiveFileName": "openocd-esp32-linux-arm64-0.12.0-esp32-20240821.tar.gz", + "checksum": "SHA-256:4d6e263d84e447354dc685848557d6c284dda7fe007ee451f729a7edfa7baad7", + "size": "2251272" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240726/openocd-esp32-linux-armel-0.12.0-esp32-20240726.tar.gz", - "archiveFileName": "openocd-esp32-linux-armel-0.12.0-esp32-20240726.tar.gz", - "checksum": "SHA-256:25d241fd7467cc5aa8ec3256f2efca27d86bde7cf5577c32f742ad1cc598ad7d", - "size": "2388355" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240821/openocd-esp32-linux-armel-0.12.0-esp32-20240821.tar.gz", + "archiveFileName": "openocd-esp32-linux-armel-0.12.0-esp32-20240821.tar.gz", + "checksum": "SHA-256:9d45679f2c4cf450d5e2350047cf57bb76dde2487d30cebce0a72c9173b5c45b", + "size": "2390074" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240726/openocd-esp32-macos-0.12.0-esp32-20240726.tar.gz", - "archiveFileName": "openocd-esp32-macos-0.12.0-esp32-20240726.tar.gz", - "checksum": "SHA-256:c3fb8209dd046f83e9fe98b054649020991aea0ac95cf175a41967d446330148", - "size": "2478569" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240821/openocd-esp32-macos-0.12.0-esp32-20240821.tar.gz", + "archiveFileName": "openocd-esp32-macos-0.12.0-esp32-20240821.tar.gz", + "checksum": "SHA-256:565c8fabc5f19a6e7a0864a294d74b307eec30b9291d16d3fc90e273f0330cb4", + "size": "2485320" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240726/openocd-esp32-macos-arm64-0.12.0-esp32-20240726.tar.gz", - "archiveFileName": "openocd-esp32-macos-arm64-0.12.0-esp32-20240726.tar.gz", - "checksum": "SHA-256:45b317f233ae7bf3059a93db925d8794affd393b170ef496da08fa3f2b360ac7", - "size": "2522358" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240821/openocd-esp32-macos-arm64-0.12.0-esp32-20240821.tar.gz", + "archiveFileName": "openocd-esp32-macos-arm64-0.12.0-esp32-20240821.tar.gz", + "checksum": "SHA-256:68c5c7cf3d15b9810939a5edabc6ff2c9f4fc32262de91fc292a180bc5cc0637", + "size": "2530336" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240726/openocd-esp32-win32-0.12.0-esp32-20240726.zip", - "archiveFileName": "openocd-esp32-win32-0.12.0-esp32-20240726.zip", - "checksum": "SHA-256:9735c9ada83bab1ff2b306f06b96421572fa12d01a751e09e10f243222fd95c4", - "size": "2907592" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240821/openocd-esp32-win32-0.12.0-esp32-20240821.zip", + "archiveFileName": "openocd-esp32-win32-0.12.0-esp32-20240821.zip", + "checksum": "SHA-256:463fc2903ddaf03f86ff50836c5c63cc696550b0446140159eddfd2e85570c5d", + "size": "2916409" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240726/openocd-esp32-win64-0.12.0-esp32-20240726.zip", - "archiveFileName": "openocd-esp32-win64-0.12.0-esp32-20240726.zip", - "checksum": "SHA-256:139d5ae128ea12023793e8bccdde7dd14383ad38c265cf66c9c6cc7c804e1333", - "size": "2907591" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20240821/openocd-esp32-win64-0.12.0-esp32-20240821.zip", + "archiveFileName": "openocd-esp32-win64-0.12.0-esp32-20240821.zip", + "checksum": "SHA-256:550f57369f1f1f6cc600b5dffa3378fd6164d8ea8db7c567cf41091771f090cb", + "size": "2916408" } ] }, From 7018cd114d00249674567846c9d67fbb3a1240a3 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Wed, 18 Sep 2024 14:54:00 +0300 Subject: [PATCH 17/17] Update core version to 3.0.5 --- cores/esp32/esp_arduino_version.h | 2 +- libraries/ArduinoOTA/library.properties | 2 +- libraries/AsyncUDP/library.properties | 2 +- libraries/BLE/library.properties | 2 +- libraries/BluetoothSerial/library.properties | 2 +- libraries/DNSServer/library.properties | 2 +- libraries/EEPROM/library.properties | 2 +- libraries/ESP32/library.properties | 2 +- libraries/ESP_I2S/library.properties | 2 +- libraries/ESP_NOW/library.properties | 2 +- libraries/ESP_SR/library.properties | 2 +- libraries/ESPmDNS/library.properties | 2 +- libraries/Ethernet/library.properties | 2 +- libraries/FFat/library.properties | 2 +- libraries/FS/library.properties | 2 +- libraries/HTTPClient/library.properties | 2 +- libraries/HTTPUpdate/library.properties | 2 +- libraries/HTTPUpdateServer/library.properties | 2 +- libraries/Insights/library.properties | 2 +- libraries/LittleFS/library.properties | 2 +- libraries/NetBIOS/library.properties | 2 +- libraries/Network/library.properties | 2 +- libraries/NetworkClientSecure/library.properties | 2 +- libraries/OpenThread/library.properties | 2 +- libraries/PPP/library.properties | 2 +- libraries/Preferences/library.properties | 2 +- libraries/RainMaker/library.properties | 2 +- libraries/SD/library.properties | 2 +- libraries/SD_MMC/library.properties | 2 +- libraries/SPI/library.properties | 2 +- libraries/SPIFFS/library.properties | 2 +- libraries/SimpleBLE/library.properties | 2 +- libraries/TFLiteMicro/library.properties | 2 +- libraries/Ticker/library.properties | 2 +- libraries/USB/library.properties | 2 +- libraries/Update/library.properties | 2 +- libraries/WebServer/library.properties | 2 +- libraries/WiFi/library.properties | 2 +- libraries/WiFiProv/library.properties | 2 +- libraries/Wire/library.properties | 2 +- package.json | 2 +- platform.txt | 2 +- 42 files changed, 42 insertions(+), 42 deletions(-) diff --git a/cores/esp32/esp_arduino_version.h b/cores/esp32/esp_arduino_version.h index adc8415db..d541b534a 100644 --- a/cores/esp32/esp_arduino_version.h +++ b/cores/esp32/esp_arduino_version.h @@ -23,7 +23,7 @@ extern "C" { /** Minor version number (x.X.x) */ #define ESP_ARDUINO_VERSION_MINOR 0 /** Patch version number (x.x.X) */ -#define ESP_ARDUINO_VERSION_PATCH 4 +#define ESP_ARDUINO_VERSION_PATCH 5 /** * Macro to convert ARDUINO version number into an integer diff --git a/libraries/ArduinoOTA/library.properties b/libraries/ArduinoOTA/library.properties index a8336230f..d3d9d0849 100644 --- a/libraries/ArduinoOTA/library.properties +++ b/libraries/ArduinoOTA/library.properties @@ -1,5 +1,5 @@ name=ArduinoOTA -version=3.0.4 +version=3.0.5 author=Ivan Grokhotkov and Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables Over The Air upgrades, via wifi and espota.py UDP request/TCP download. diff --git a/libraries/AsyncUDP/library.properties b/libraries/AsyncUDP/library.properties index 92332f785..ba0cb8386 100644 --- a/libraries/AsyncUDP/library.properties +++ b/libraries/AsyncUDP/library.properties @@ -1,5 +1,5 @@ name=ESP32 Async UDP -version=3.0.4 +version=3.0.5 author=Me-No-Dev maintainer=Me-No-Dev sentence=Async UDP Library for ESP32 diff --git a/libraries/BLE/library.properties b/libraries/BLE/library.properties index 82395a1f6..74dbf9c85 100644 --- a/libraries/BLE/library.properties +++ b/libraries/BLE/library.properties @@ -1,5 +1,5 @@ name=BLE -version=3.0.4 +version=3.0.5 author=Neil Kolban maintainer=Dariusz Krempa sentence=BLE functions for ESP32 diff --git a/libraries/BluetoothSerial/library.properties b/libraries/BluetoothSerial/library.properties index a91e8455e..b7595ef3d 100644 --- a/libraries/BluetoothSerial/library.properties +++ b/libraries/BluetoothSerial/library.properties @@ -1,5 +1,5 @@ name=BluetoothSerial -version=3.0.4 +version=3.0.5 author=Evandro Copercini maintainer=Evandro Copercini sentence=Simple UART to Classical Bluetooth bridge for ESP32 diff --git a/libraries/DNSServer/library.properties b/libraries/DNSServer/library.properties index bb4ed950f..fc1ce2d91 100644 --- a/libraries/DNSServer/library.properties +++ b/libraries/DNSServer/library.properties @@ -1,5 +1,5 @@ name=DNSServer -version=3.0.4 +version=3.0.5 author=Kristijan Novoselić maintainer=Kristijan Novoselić, sentence=A simple DNS server for ESP32. diff --git a/libraries/EEPROM/library.properties b/libraries/EEPROM/library.properties index 6297bedcb..d82b97dcf 100644 --- a/libraries/EEPROM/library.properties +++ b/libraries/EEPROM/library.properties @@ -1,5 +1,5 @@ name=EEPROM -version=3.0.4 +version=3.0.5 author=Ivan Grokhotkov maintainer=Paolo Becchi sentence=Enables reading and writing data a sequential, addressable FLASH storage diff --git a/libraries/ESP32/library.properties b/libraries/ESP32/library.properties index c0897f23e..0f79f5cf0 100644 --- a/libraries/ESP32/library.properties +++ b/libraries/ESP32/library.properties @@ -1,5 +1,5 @@ name=ESP32 -version=3.0.4 +version=3.0.5 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 sketches examples diff --git a/libraries/ESP_I2S/library.properties b/libraries/ESP_I2S/library.properties index ad0e4fbdc..d165941af 100644 --- a/libraries/ESP_I2S/library.properties +++ b/libraries/ESP_I2S/library.properties @@ -1,5 +1,5 @@ name=ESP_I2S -version=3.0.4 +version=3.0.5 author=me-no-dev maintainer=me-no-dev sentence=Library for ESP I2S communication diff --git a/libraries/ESP_NOW/library.properties b/libraries/ESP_NOW/library.properties index 1d1dc8926..262454bb0 100644 --- a/libraries/ESP_NOW/library.properties +++ b/libraries/ESP_NOW/library.properties @@ -1,5 +1,5 @@ name=ESP_NOW -version=3.0.4 +version=3.0.5 author=me-no-dev maintainer=P-R-O-C-H-Y sentence=Library for ESP_NOW diff --git a/libraries/ESP_SR/library.properties b/libraries/ESP_SR/library.properties index bf3ab3a14..6f0d447d2 100644 --- a/libraries/ESP_SR/library.properties +++ b/libraries/ESP_SR/library.properties @@ -1,5 +1,5 @@ name=ESP_SR -version=3.0.4 +version=3.0.5 author=me-no-dev maintainer=me-no-dev sentence=Library for ESP Sound Recognition diff --git a/libraries/ESPmDNS/library.properties b/libraries/ESPmDNS/library.properties index 64ff66c3a..32a2fe246 100644 --- a/libraries/ESPmDNS/library.properties +++ b/libraries/ESPmDNS/library.properties @@ -1,5 +1,5 @@ name=ESPmDNS -version=3.0.4 +version=3.0.5 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 mDNS Library diff --git a/libraries/Ethernet/library.properties b/libraries/Ethernet/library.properties index 1fc7df219..ea92455fe 100644 --- a/libraries/Ethernet/library.properties +++ b/libraries/Ethernet/library.properties @@ -1,5 +1,5 @@ name=Ethernet -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables network connection (local and Internet) using the ESP32 Ethernet. diff --git a/libraries/FFat/library.properties b/libraries/FFat/library.properties index 87dda7b12..e01f1e2f2 100644 --- a/libraries/FFat/library.properties +++ b/libraries/FFat/library.properties @@ -1,5 +1,5 @@ name=FFat -version=3.0.4 +version=3.0.5 author=Hristo Gochkov, Ivan Grokhtkov, Larry Bernstone maintainer=Hristo Gochkov sentence=ESP32 FAT on Flash File System diff --git a/libraries/FS/library.properties b/libraries/FS/library.properties index 676faf43e..9bdcdb835 100644 --- a/libraries/FS/library.properties +++ b/libraries/FS/library.properties @@ -1,5 +1,5 @@ name=FS -version=3.0.4 +version=3.0.5 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 File System diff --git a/libraries/HTTPClient/library.properties b/libraries/HTTPClient/library.properties index 40da6a0cd..2c1e160ef 100644 --- a/libraries/HTTPClient/library.properties +++ b/libraries/HTTPClient/library.properties @@ -1,5 +1,5 @@ name=HTTPClient -version=3.0.4 +version=3.0.5 author=Markus Sattler maintainer=Markus Sattler sentence=HTTP Client for ESP32 diff --git a/libraries/HTTPUpdate/library.properties b/libraries/HTTPUpdate/library.properties index ab7e9b6f8..aca3f3927 100644 --- a/libraries/HTTPUpdate/library.properties +++ b/libraries/HTTPUpdate/library.properties @@ -1,5 +1,5 @@ name=HTTPUpdate -version=3.0.4 +version=3.0.5 author=Markus Sattler maintainer=Markus Sattler sentence=Http Update for ESP32 diff --git a/libraries/HTTPUpdateServer/library.properties b/libraries/HTTPUpdateServer/library.properties index 249eb5ea1..03f6b299b 100644 --- a/libraries/HTTPUpdateServer/library.properties +++ b/libraries/HTTPUpdateServer/library.properties @@ -1,5 +1,5 @@ name=HTTPUpdateServer -version=3.0.4 +version=3.0.5 author=Hristo Kapanakov maintainer= sentence=Simple HTTP Update server based on the WebServer diff --git a/libraries/Insights/library.properties b/libraries/Insights/library.properties index cabf05f28..a948dbe7a 100644 --- a/libraries/Insights/library.properties +++ b/libraries/Insights/library.properties @@ -1,5 +1,5 @@ name=ESP Insights -version=3.0.4 +version=3.0.5 author=Sanket Wadekar maintainer=Sanket Wadekar sentence=ESP Insights diff --git a/libraries/LittleFS/library.properties b/libraries/LittleFS/library.properties index f443b70bc..fac629fab 100644 --- a/libraries/LittleFS/library.properties +++ b/libraries/LittleFS/library.properties @@ -1,5 +1,5 @@ name=LittleFS -version=3.0.4 +version=3.0.5 author= maintainer= sentence=LittleFS for esp32 diff --git a/libraries/NetBIOS/library.properties b/libraries/NetBIOS/library.properties index fdf9b63a0..c073252d6 100644 --- a/libraries/NetBIOS/library.properties +++ b/libraries/NetBIOS/library.properties @@ -1,5 +1,5 @@ name=NetBIOS -version=3.0.4 +version=3.0.5 author=Pablo@xpablo.cz maintainer=Hristo Gochkov sentence=Enables NBNS (NetBIOS) name resolution. diff --git a/libraries/Network/library.properties b/libraries/Network/library.properties index 49aadb7b8..2a80ad844 100644 --- a/libraries/Network/library.properties +++ b/libraries/Network/library.properties @@ -1,5 +1,5 @@ name=Networking -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=General network management library. diff --git a/libraries/NetworkClientSecure/library.properties b/libraries/NetworkClientSecure/library.properties index 2a0ca88ff..f71bc7ef0 100644 --- a/libraries/NetworkClientSecure/library.properties +++ b/libraries/NetworkClientSecure/library.properties @@ -1,5 +1,5 @@ name=NetworkClientSecure -version=3.0.4 +version=3.0.5 author=Evandro Luis Copercini maintainer=Github Community sentence=Enables secure network connection (local and Internet) using the ESP32 built-in WiFi. diff --git a/libraries/OpenThread/library.properties b/libraries/OpenThread/library.properties index 6a16dabdd..39c632972 100644 --- a/libraries/OpenThread/library.properties +++ b/libraries/OpenThread/library.properties @@ -1,5 +1,5 @@ name=OpenThread -version=3.0.4 +version=3.0.5 author=Rodrigo Garcia | GitHub @SuGlider maintainer=Rodrigo Garcia sentence=Library for OpenThread Network on ESP32. diff --git a/libraries/PPP/library.properties b/libraries/PPP/library.properties index 0403b576d..47264f1fd 100644 --- a/libraries/PPP/library.properties +++ b/libraries/PPP/library.properties @@ -1,5 +1,5 @@ name=PPP -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables network connection using GSM Modem. diff --git a/libraries/Preferences/library.properties b/libraries/Preferences/library.properties index 8437425c0..1923e59fc 100644 --- a/libraries/Preferences/library.properties +++ b/libraries/Preferences/library.properties @@ -1,5 +1,5 @@ name=Preferences -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Provides friendly access to ESP32's Non-Volatile Storage diff --git a/libraries/RainMaker/library.properties b/libraries/RainMaker/library.properties index e6bdd2f45..cf67e9772 100644 --- a/libraries/RainMaker/library.properties +++ b/libraries/RainMaker/library.properties @@ -1,5 +1,5 @@ name=ESP RainMaker -version=3.0.4 +version=3.0.5 author=Sweety Mhaiske maintainer=Hristo Gochkov sentence=ESP RainMaker Support diff --git a/libraries/SD/library.properties b/libraries/SD/library.properties index 98d93943a..ca7344368 100644 --- a/libraries/SD/library.properties +++ b/libraries/SD/library.properties @@ -1,5 +1,5 @@ name=SD -version=3.0.4 +version=3.0.5 author=Arduino, SparkFun maintainer=Arduino sentence=Enables reading and writing on SD cards. For all Arduino boards. diff --git a/libraries/SD_MMC/library.properties b/libraries/SD_MMC/library.properties index 242fc62ec..176947e40 100644 --- a/libraries/SD_MMC/library.properties +++ b/libraries/SD_MMC/library.properties @@ -1,5 +1,5 @@ name=SD_MMC -version=3.0.4 +version=3.0.5 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 SDMMC File System diff --git a/libraries/SPI/library.properties b/libraries/SPI/library.properties index 804f86e93..8d704b266 100644 --- a/libraries/SPI/library.properties +++ b/libraries/SPI/library.properties @@ -1,5 +1,5 @@ name=SPI -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. For all Arduino boards, BUT Arduino DUE. diff --git a/libraries/SPIFFS/library.properties b/libraries/SPIFFS/library.properties index 9aaf1d9c5..a901b32ef 100644 --- a/libraries/SPIFFS/library.properties +++ b/libraries/SPIFFS/library.properties @@ -1,5 +1,5 @@ name=SPIFFS -version=3.0.4 +version=3.0.5 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 SPIFFS File System diff --git a/libraries/SimpleBLE/library.properties b/libraries/SimpleBLE/library.properties index c49cd51b3..ab634e304 100644 --- a/libraries/SimpleBLE/library.properties +++ b/libraries/SimpleBLE/library.properties @@ -1,5 +1,5 @@ name=SimpleBLE -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Provides really simple BLE advertizer with just on and off diff --git a/libraries/TFLiteMicro/library.properties b/libraries/TFLiteMicro/library.properties index 1a9664766..026411cd3 100644 --- a/libraries/TFLiteMicro/library.properties +++ b/libraries/TFLiteMicro/library.properties @@ -1,5 +1,5 @@ name=TFLite Micro -version=3.0.4 +version=3.0.5 author=Sanket Wadekar maintainer=Sanket Wadekar sentence=TensorFlow Lite for Microcontrollers diff --git a/libraries/Ticker/library.properties b/libraries/Ticker/library.properties index 297e3221b..3486c45fb 100644 --- a/libraries/Ticker/library.properties +++ b/libraries/Ticker/library.properties @@ -1,5 +1,5 @@ name=Ticker -version=3.0.4 +version=3.0.5 author=Bert Melis maintainer=Hristo Gochkov sentence=Allows to call functions with a given interval. diff --git a/libraries/USB/library.properties b/libraries/USB/library.properties index 209fca7eb..abfa26376 100644 --- a/libraries/USB/library.properties +++ b/libraries/USB/library.properties @@ -1,5 +1,5 @@ name=USB -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=ESP32S2 USB Library diff --git a/libraries/Update/library.properties b/libraries/Update/library.properties index b70add08c..1aece5b16 100644 --- a/libraries/Update/library.properties +++ b/libraries/Update/library.properties @@ -1,5 +1,5 @@ name=Update -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=ESP32 Sketch Update Library diff --git a/libraries/WebServer/library.properties b/libraries/WebServer/library.properties index 10dc2ff1a..8985e6f51 100644 --- a/libraries/WebServer/library.properties +++ b/libraries/WebServer/library.properties @@ -1,5 +1,5 @@ name=WebServer -version=3.0.4 +version=3.0.5 author=Ivan Grokhotkov maintainer=Ivan Grokhtkov sentence=Simple web server library diff --git a/libraries/WiFi/library.properties b/libraries/WiFi/library.properties index 5acbee867..fa63459c1 100644 --- a/libraries/WiFi/library.properties +++ b/libraries/WiFi/library.properties @@ -1,5 +1,5 @@ name=WiFi -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables network connection (local and Internet) using the ESP32 built-in WiFi. diff --git a/libraries/WiFiProv/library.properties b/libraries/WiFiProv/library.properties index 886697c9a..cbba5a3fb 100644 --- a/libraries/WiFiProv/library.properties +++ b/libraries/WiFiProv/library.properties @@ -1,5 +1,5 @@ name=WiFiProv -version=3.0.4 +version=3.0.5 author=Switi Mhaiske maintainer=Hristo Gochkov sentence=Enables provisioning. diff --git a/libraries/Wire/library.properties b/libraries/Wire/library.properties index 0c7fa749a..2d4ef887e 100644 --- a/libraries/Wire/library.properties +++ b/libraries/Wire/library.properties @@ -1,5 +1,5 @@ name=Wire -version=3.0.4 +version=3.0.5 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. For esp8266 boards. diff --git a/package.json b/package.json index 487bcc77a..6dbb69ad3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "framework-arduinoespressif32", - "version": "3.0.4", + "version": "3.0.5", "description": "Arduino Wiring-based Framework for the Espressif ESP32, ESP32-S and ESP32-C series of SoCs", "keywords": [ "framework", diff --git a/platform.txt b/platform.txt index 0c1ff5bf5..073d5fd41 100644 --- a/platform.txt +++ b/platform.txt @@ -1,5 +1,5 @@ name=ESP32 Arduino -version=3.0.4 +version=3.0.5 tools.esp32-arduino-libs.path={runtime.platform.path}/tools/esp32-arduino-libs tools.esp32-arduino-libs.path.windows={runtime.platform.path}\tools\esp32-arduino-libs