Compatible with ESP32 up to 2.0.0

This commit is contained in:
TinyuChiu
2022-08-11 17:01:46 +08:00
parent f47a59b23b
commit ebebdeaee2
136 changed files with 110690 additions and 84634 deletions
+168
View File
@@ -0,0 +1,168 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
...
+17
View File
@@ -0,0 +1,17 @@
name: Arduino Lint Check
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
lint:
name: Lint Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: arduino/arduino-lint-action@v1
with:
library-manager: update
compliance: strict
project-type: all
+4 -4
View File
@@ -7,16 +7,16 @@ jobs:
strategy:
matrix:
path:
- check: './example' # path to include
exclude: './examples/Advanced/Display' # path to exclude
- check: './' # path to include
exclude: '(Fonts|utility)' # path to exclude
# - check: 'src'
# exclude: ''
# exclude: '(Fonts)' # Exclude file paths containing "Fonts"
# - check: 'examples'
# exclude: ''
steps:
- uses: actions/checkout@v2
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.5.0
uses: jidicula/clang-format-action@v4.8.0
with:
clang-format-version: '13'
check-path: ${{ matrix.path['check'] }}
+3 -1
View File
@@ -88,4 +88,6 @@ void showSignal() {
}
}
void loop(void) { showSignal(); }
void loop(void) {
showSignal();
}
+2 -1
View File
@@ -65,4 +65,5 @@ void setup() {
xTaskCreatePinnedToCore(task3, "task3", 4096, NULL, 3, NULL, 0);
}
void loop() {}
void loop() {
}
+2 -1
View File
@@ -24,4 +24,5 @@ void setup() {
// characters. 请根据字符数量选择合适的二维码版本
}
void loop() {}
void loop() {
}
@@ -49,4 +49,5 @@ void setup() {
delay(10000); // delay 10. 延迟10s
ESP.restart(); // Restart. 重启
}
void loop() {}
void loop() {
}
@@ -72,4 +72,5 @@ void setup() {
}
}
void loop() {}
void loop() {
}
@@ -40,4 +40,5 @@ void setup() {
}
}
void loop() {}
void loop() {
}
@@ -53,7 +53,8 @@ WebServer::WebServer(IPAddress addr, int port)
_headerKeysCount(0),
_currentHeaders(0),
_contentLength(0),
_chunked(false) {}
_chunked(false) {
}
WebServer::WebServer(int port)
: _server(port),
@@ -69,7 +70,8 @@ WebServer::WebServer(int port)
_headerKeysCount(0),
_currentHeaders(0),
_contentLength(0),
_chunked(false) {}
_chunked(false) {
}
WebServer::~WebServer() {
if (_currentHeaders) delete[] _currentHeaders;
@@ -227,9 +229,13 @@ void WebServer::handleClient() {
}
}
void WebServer::close() { _server.end(); }
void WebServer::close() {
_server.end();
}
void WebServer::stop() { close(); }
void WebServer::stop() {
close();
}
void WebServer::sendHeader(const String& name, const String& value,
bool first) {
@@ -378,7 +384,9 @@ String WebServer::argName(int i) {
return String();
}
int WebServer::args() { return _currentArgCount; }
int WebServer::args() {
return _currentArgCount;
}
bool WebServer::hasArg(String name) {
for (int i = 0; i < _currentArgCount; ++i) {
@@ -416,7 +424,9 @@ String WebServer::headerName(int i) {
return String();
}
int WebServer::headers() { return _headerKeysCount; }
int WebServer::headers() {
return _headerKeysCount;
}
bool WebServer::hasHeader(String name) {
for (int i = 0; i < _headerKeysCount; ++i) {
@@ -427,11 +437,17 @@ bool WebServer::hasHeader(String name) {
return false;
}
String WebServer::hostHeader() { return _hostHeader; }
String WebServer::hostHeader() {
return _hostHeader;
}
void WebServer::onFileUpload(THandlerFunction fn) { _fileUploadHandler = fn; }
void WebServer::onFileUpload(THandlerFunction fn) {
_fileUploadHandler = fn;
}
void WebServer::onNotFound(THandlerFunction fn) { _notFoundHandler = fn; }
void WebServer::onNotFound(THandlerFunction fn) {
_notFoundHandler = fn;
}
void WebServer::_handleRequest() {
bool handled = false;
+17 -8
View File
@@ -48,10 +48,11 @@ enum HTTPClientStatus { HC_NONE, HC_WAIT_READ, HC_WAIT_CLOSE };
#define HTTP_DOWNLOAD_UNIT_SIZE 1460
#define HTTP_UPLOAD_BUFLEN 2048
#define HTTP_MAX_DATA_WAIT 1000 // ms to wait for the client to send the
// request
#define HTTP_MAX_POST_WAIT 1000 // ms to wait for POST data to arrive
#define HTTP_MAX_SEND_WAIT 5000 // ms to wait for data chunk to be ACKed
#define HTTP_MAX_DATA_WAIT \
1000 // ms to wait for the client to send the
// request
#define HTTP_MAX_POST_WAIT 1000 // ms to wait for POST data to arrive
#define HTTP_MAX_SEND_WAIT 5000 // ms to wait for data chunk to be ACKed
#define HTTP_MAX_CLOSE_WAIT \
2000 // ms to wait for the client to close the connection
@@ -103,10 +104,18 @@ class WebServer {
// assigned
void onFileUpload(THandlerFunction fn); // handle file uploads
String uri() { return _currentUri; }
HTTPMethod method() { return _currentMethod; }
WiFiClient client() { return _currentClient; }
HTTPUpload& upload() { return _currentUpload; }
String uri() {
return _currentUri;
}
HTTPMethod method() {
return _currentMethod;
}
WiFiClient client() {
return _currentClient;
}
HTTPUpload& upload() {
return _currentUpload;
}
String arg(String name); // get request argument value by name
String arg(int i); // get request argument value by number
@@ -3,7 +3,8 @@
class RequestHandler {
public:
virtual ~RequestHandler() {}
virtual ~RequestHandler() {
}
virtual bool canHandle(HTTPMethod method, String uri) {
(void)method;
(void)uri;
@@ -27,8 +28,12 @@ class RequestHandler {
(void)upload;
}
RequestHandler* next() { return _next; }
void next(RequestHandler* r) { _next = r; }
RequestHandler* next() {
return _next;
}
void next(RequestHandler* r) {
_next = r;
}
private:
RequestHandler* _next = nullptr;
@@ -8,7 +8,8 @@ class FunctionRequestHandler : public RequestHandler {
FunctionRequestHandler(WebServer::THandlerFunction fn,
WebServer::THandlerFunction ufn, const String& uri,
HTTPMethod method)
: _fn(fn), _ufn(ufn), _uri(uri), _method(method) {}
: _fn(fn), _ufn(ufn), _uri(uri), _method(method) {
}
bool canHandle(HTTPMethod requestMethod, String requestUri) override {
if (_method != HTTP_ANY && _method != requestMethod) return false;
@@ -57,4 +57,5 @@ void setup() {
M5.Lcd.println(WiFi.RSSI()); // Output signal strength. 输出信号强度
}
void loop() {}
void loop() {
}
+28 -24
View File
@@ -15,7 +15,6 @@ extern const unsigned char m5stack_startup_music[];
MPU9250 IMU;
// #define LEDS_PIN 15
// #define LEDS_NUM 10
// CRGB ledsBuff[LEDS_NUM];
@@ -145,34 +144,39 @@ void buttons_test() {
static byte c1;
byte utf8ascii(byte ascii) {
if ( ascii<128 ) // Standard ASCII-set 0..0x7F handling
{ c1=0;
return( ascii );
if (ascii < 128) // Standard ASCII-set 0..0x7F handling
{
c1 = 0;
return (ascii);
}
// get previous input
byte last = c1; // get last char
c1=ascii; // remember actual character
byte last = c1; // get last char
c1 = ascii; // remember actual character
switch (last) // conversion depending on first UTF8-character
{ case 0xC2: return (ascii); break;
case 0xC3: return (ascii | 0xC0); break;
case 0x82: if(ascii==0xAC) return(0x80); // special case Euro-symbol
switch (last) // conversion depending on first UTF8-character
{
case 0xC2:
return (ascii);
break;
case 0xC3:
return (ascii | 0xC0);
break;
case 0x82:
if (ascii == 0xAC) return (0x80); // special case Euro-symbol
}
return (0); // otherwise: return zero, if character has to be ignored
return (0); // otherwise: return zero, if character has to be ignored
}
String utf8ascii(String s)
{
String r="";
char c;
for (int i=0; i<s.length(); i++)
{
c = utf8ascii(s.charAt(i));
if (c!=0) r+=c;
}
return r;
String utf8ascii(String s) {
String r = "";
char c;
for (int i = 0; i < s.length(); i++) {
c = utf8ascii(s.charAt(i));
if (c != 0) r += c;
}
return r;
}
void wifi_test() {
@@ -210,9 +214,9 @@ void wifi_test() {
Serial.print(")");
M5.Lcd.print(")");
Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? " "
: "*");
: "*");
M5.Lcd.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? " "
: "*");
: "*");
delay(5);
}
}
@@ -487,7 +491,7 @@ void setup() {
// adc_test();
// }
startupLogo();
//ledBar();
// ledBar();
Wire.begin();
// Lcd display
+2 -1
View File
@@ -30,4 +30,5 @@ void setup() {
The loop() function is an infinite loop in which the program runs repeatedly
在setup()函数中的程序执行完后,会接着执行loop()函数中的程序
loop()函数是一个死循环,其中的程序会不断的重复运行 */
void loop() {}
void loop() {
}
+2 -1
View File
@@ -65,4 +65,5 @@ void setup() {
}
}
void loop() {}
void loop() {
}
@@ -15,7 +15,9 @@
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(
M5STACK_FIRE_NEO_NUM_LEDS, M5STACK_FIRE_NEO_DATA_PIN, NEO_GRB + NEO_KHZ800);
void setup() { pixels.begin(); }
void setup() {
pixels.begin();
}
void loop() {
static int pixelNumber = 0; // = random(0, M5STACK_FIRE_NEO_NUM_LEDS - 1);
+8 -7
View File
@@ -635,8 +635,8 @@ byte MFRC522::PICC_REQA_or_WUPA(
* single 4 1 MIFARE
* Classic double 7 2 MIFARE
* Ultralight
* triple 10 3 Not currently
* in use?
* triple 10 3 Not
* currently in use?
*
* @return STATUS_OK on success, STATUS_??? otherwise.
*/
@@ -670,8 +670,9 @@ byte MFRC522::PICC_Select(
// Description of buffer structure:
// Byte 0: SEL Indicates the Cascade Level:
//PICC_CMD_SEL_CL1, PICC_CMD_SEL_CL2 or PICC_CMD_SEL_CL3 Byte 1: NVB
//Number of Valid Bits (in complete command, not just the UID): High nibble:
// PICC_CMD_SEL_CL1, PICC_CMD_SEL_CL2 or PICC_CMD_SEL_CL3 Byte 1: NVB
// Number of Valid Bits (in complete command, not just the UID): High
// nibble:
// complete bytes, Low nibble: Extra bits. Byte 2: UID-data or CT
// See explanation below. CT means Cascade Tag. Byte 3: UID-data
// Byte 4: UID-data Byte 5: UID-data
@@ -920,7 +921,7 @@ byte MFRC522::PICC_HaltA() {
// Send the command.
// The standard says:
// If the PICC responds with any modulation during a period of 1 ms
//after the end of the frame containing the HLTA command, this
// after the end of the frame containing the HLTA command, this
// response shall be interpreted as 'not acknowledge'.
// We interpret that this way: Only STATUS_TIMEOUT is an success.
result = PCD_TransceiveData(buffer, sizeof(buffer), NULL, 0);
@@ -1599,10 +1600,10 @@ void MFRC522::PICC_DumpMifareClassicSectorToSerial(
// The access bits are stored in a peculiar fashion.
// There are four groups:
// g[3] Access bits for the sector trailer, block 3 (for sectors
//0-31) or block 15 (for sectors 32-39) g[2] Access bits for
// 0-31) or block 15 (for sectors 32-39) g[2] Access bits for
// block 2 (for sectors 0-31) or blocks 10-14 (for sectors 32-39) g[1]
// Access bits for block 1 (for sectors 0-31) or blocks 5-9 (for sectors
//32-39) g[0] Access bits for block 0 (for sectors 0-31) or blocks
// 32-39) g[0] Access bits for block 0 (for sectors 0-31) or blocks
// 0-4 (for sectors 32-39)
// Each group has access bits [C1 C2 C3]. In this code C1 is MSB and C3 is
// LSB. The four CX bits are stored together in a nible cx and an inverted
-1
View File
@@ -3,7 +3,6 @@
#include "MFRC522_I2C.h"
// 0x28 is i2c address on SDA. Check your address with i2cscanner if not match.
MFRC522 mfrc522(0x28); // Create MFRC522 instance.

Some files were not shown because too many files have changed in this diff Show More