Skip to content

Commit ebebdea

Browse files
committed
Compatible with ESP32 up to 2.0.0
1 parent f47a59b commit ebebdea

File tree

136 files changed

+110902
-84846
lines changed

Some content is hidden

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

136 files changed

+110902
-84846
lines changed

Diff for: .clang-format

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveMacros: true
7+
AlignConsecutiveAssignments: true
8+
AlignConsecutiveDeclarations: false
9+
AlignEscapedNewlines: Left
10+
AlignOperands: true
11+
AlignTrailingComments: true
12+
AllowAllArgumentsOnNextLine: true
13+
AllowAllConstructorInitializersOnNextLine: true
14+
AllowAllParametersOfDeclarationOnNextLine: true
15+
AllowShortBlocksOnASingleLine: Never
16+
AllowShortCaseLabelsOnASingleLine: false
17+
AllowShortFunctionsOnASingleLine: false
18+
AllowShortLambdasOnASingleLine: All
19+
AllowShortIfStatementsOnASingleLine: WithoutElse
20+
AllowShortLoopsOnASingleLine: true
21+
AlwaysBreakAfterDefinitionReturnType: None
22+
AlwaysBreakAfterReturnType: None
23+
AlwaysBreakBeforeMultilineStrings: true
24+
AlwaysBreakTemplateDeclarations: Yes
25+
BinPackArguments: true
26+
BinPackParameters: true
27+
BraceWrapping:
28+
AfterCaseLabel: false
29+
AfterClass: false
30+
AfterControlStatement: false
31+
AfterEnum: false
32+
AfterFunction: false
33+
AfterNamespace: false
34+
AfterObjCDeclaration: false
35+
AfterStruct: false
36+
AfterUnion: false
37+
AfterExternBlock: false
38+
BeforeCatch: false
39+
BeforeElse: false
40+
IndentBraces: false
41+
SplitEmptyFunction: true
42+
SplitEmptyRecord: true
43+
SplitEmptyNamespace: true
44+
BreakBeforeBinaryOperators: None
45+
BreakBeforeBraces: Attach
46+
BreakBeforeInheritanceComma: false
47+
BreakInheritanceList: BeforeColon
48+
BreakBeforeTernaryOperators: true
49+
BreakConstructorInitializersBeforeComma: false
50+
BreakConstructorInitializers: BeforeColon
51+
BreakAfterJavaFieldAnnotations: false
52+
BreakStringLiterals: true
53+
ColumnLimit: 80
54+
CommentPragmas: '^ IWYU pragma:'
55+
CompactNamespaces: false
56+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
57+
ConstructorInitializerIndentWidth: 4
58+
ContinuationIndentWidth: 4
59+
Cpp11BracedListStyle: true
60+
DeriveLineEnding: true
61+
DerivePointerAlignment: true
62+
DisableFormat: false
63+
ExperimentalAutoDetectBinPacking: false
64+
FixNamespaceComments: true
65+
ForEachMacros:
66+
- foreach
67+
- Q_FOREACH
68+
- BOOST_FOREACH
69+
IncludeBlocks: Regroup
70+
IncludeCategories:
71+
- Regex: '^<ext/.*\.h>'
72+
Priority: 2
73+
SortPriority: 0
74+
- Regex: '^<.*\.h>'
75+
Priority: 1
76+
SortPriority: 0
77+
- Regex: '^<.*'
78+
Priority: 2
79+
SortPriority: 0
80+
- Regex: '.*'
81+
Priority: 3
82+
SortPriority: 0
83+
IncludeIsMainRegex: '([-_](test|unittest))?$'
84+
IncludeIsMainSourceRegex: ''
85+
IndentCaseLabels: true
86+
IndentGotoLabels: true
87+
IndentPPDirectives: None
88+
IndentWidth: 4
89+
IndentWrappedFunctionNames: false
90+
JavaScriptQuotes: Leave
91+
JavaScriptWrapImports: true
92+
KeepEmptyLinesAtTheStartOfBlocks: false
93+
MacroBlockBegin: ''
94+
MacroBlockEnd: ''
95+
MaxEmptyLinesToKeep: 1
96+
NamespaceIndentation: None
97+
ObjCBinPackProtocolList: Never
98+
ObjCBlockIndentWidth: 2
99+
ObjCSpaceAfterProperty: false
100+
ObjCSpaceBeforeProtocolList: true
101+
PenaltyBreakAssignment: 2
102+
PenaltyBreakBeforeFirstCallParameter: 1
103+
PenaltyBreakComment: 300
104+
PenaltyBreakFirstLessLess: 120
105+
PenaltyBreakString: 1000
106+
PenaltyBreakTemplateDeclaration: 10
107+
PenaltyExcessCharacter: 1000000
108+
PenaltyReturnTypeOnItsOwnLine: 200
109+
PointerAlignment: Left
110+
RawStringFormats:
111+
- Language: Cpp
112+
Delimiters:
113+
- cc
114+
- CC
115+
- cpp
116+
- Cpp
117+
- CPP
118+
- 'c++'
119+
- 'C++'
120+
CanonicalDelimiter: ''
121+
BasedOnStyle: google
122+
- Language: TextProto
123+
Delimiters:
124+
- pb
125+
- PB
126+
- proto
127+
- PROTO
128+
EnclosingFunctions:
129+
- EqualsProto
130+
- EquivToProto
131+
- PARSE_PARTIAL_TEXT_PROTO
132+
- PARSE_TEST_PROTO
133+
- PARSE_TEXT_PROTO
134+
- ParseTextOrDie
135+
- ParseTextProtoOrDie
136+
CanonicalDelimiter: ''
137+
BasedOnStyle: google
138+
ReflowComments: true
139+
SortIncludes: false
140+
SortUsingDeclarations: true
141+
SpaceAfterCStyleCast: false
142+
SpaceAfterLogicalNot: false
143+
SpaceAfterTemplateKeyword: true
144+
SpaceBeforeAssignmentOperators: true
145+
SpaceBeforeCpp11BracedList: false
146+
SpaceBeforeCtorInitializerColon: true
147+
SpaceBeforeInheritanceColon: true
148+
SpaceBeforeParens: ControlStatements
149+
SpaceBeforeRangeBasedForLoopColon: true
150+
SpaceInEmptyBlock: false
151+
SpaceInEmptyParentheses: false
152+
SpacesBeforeTrailingComments: 2
153+
SpacesInAngles: false
154+
SpacesInConditionalStatement: false
155+
SpacesInContainerLiterals: true
156+
SpacesInCStyleCastParentheses: false
157+
SpacesInParentheses: false
158+
SpacesInSquareBrackets: false
159+
SpaceBeforeSquareBrackets: false
160+
Standard: Auto
161+
StatementMacros:
162+
- Q_UNUSED
163+
- QT_REQUIRE_VERSION
164+
TabWidth: 4
165+
UseCRLF: false
166+
UseTab: Never
167+
...
168+

Diff for: .github/workflows/Arduino-Lint-Check.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Arduino Lint Check
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master ]
7+
jobs:
8+
lint:
9+
name: Lint Check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: arduino/arduino-lint-action@v1
14+
with:
15+
library-manager: update
16+
compliance: strict
17+
project-type: all

Diff for: .github/workflows/clang-format-check.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ jobs:
77
strategy:
88
matrix:
99
path:
10-
- check: './example' # path to include
11-
exclude: './examples/Advanced/Display' # path to exclude
10+
- check: './' # path to include
11+
exclude: '(Fonts|utility)' # path to exclude
1212
# - check: 'src'
13-
# exclude: ''
13+
# exclude: '(Fonts)' # Exclude file paths containing "Fonts"
1414
# - check: 'examples'
1515
# exclude: ''
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Run clang-format style check for C/C++/Protobuf programs.
19-
uses: jidicula/clang-format-action@v4.5.0
19+
uses: jidicula/clang-format-action@v4.8.0
2020
with:
2121
clang-format-version: '13'
2222
check-path: ${{ matrix.path['check'] }}

Diff for: examples/Advanced/HallSensor/HallSensor.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,6 @@ void showSignal() {
8888
}
8989
}
9090

91-
void loop(void) { showSignal(); }
91+
void loop(void) {
92+
showSignal();
93+
}

Diff for: examples/Advanced/MultiTask/MultiTask.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ void setup() {
6565
xTaskCreatePinnedToCore(task3, "task3", 4096, NULL, 3, NULL, 0);
6666
}
6767

68-
void loop() {}
68+
void loop() {
69+
}

Diff for: examples/Advanced/QRCode/QRCode.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ void setup() {
2424
// characters. 请根据字符数量选择合适的二维码版本
2525
}
2626

27-
void loop() {}
27+
void loop() {
28+
}

Diff for: examples/Advanced/Storage/Counter/Counter.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ void setup() {
4949
delay(10000); // delay 10. 延迟10s
5050
ESP.restart(); // Restart. 重启
5151
}
52-
void loop() {}
52+
void loop() {
53+
}

Diff for: examples/Advanced/Storage/SPIFFS/SPIFFS_Add/SPIFFS_Add.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,5 @@ void setup() {
7272
}
7373
}
7474

75-
void loop() {}
75+
void loop() {
76+
}

Diff for: examples/Advanced/Storage/SPIFFS/SPIFFS_Delete/SPIFFS_Delete.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ void setup() {
4040
}
4141
}
4242

43-
void loop() {}
43+
void loop() {
44+
}

Diff for: examples/Advanced/WIFI/WiFiSetting/WebServer.cpp

+25-9
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ WebServer::WebServer(IPAddress addr, int port)
5353
_headerKeysCount(0),
5454
_currentHeaders(0),
5555
_contentLength(0),
56-
_chunked(false) {}
56+
_chunked(false) {
57+
}
5758

5859
WebServer::WebServer(int port)
5960
: _server(port),
@@ -69,7 +70,8 @@ WebServer::WebServer(int port)
6970
_headerKeysCount(0),
7071
_currentHeaders(0),
7172
_contentLength(0),
72-
_chunked(false) {}
73+
_chunked(false) {
74+
}
7375

7476
WebServer::~WebServer() {
7577
if (_currentHeaders) delete[] _currentHeaders;
@@ -227,9 +229,13 @@ void WebServer::handleClient() {
227229
}
228230
}
229231

230-
void WebServer::close() { _server.end(); }
232+
void WebServer::close() {
233+
_server.end();
234+
}
231235

232-
void WebServer::stop() { close(); }
236+
void WebServer::stop() {
237+
close();
238+
}
233239

234240
void WebServer::sendHeader(const String& name, const String& value,
235241
bool first) {
@@ -378,7 +384,9 @@ String WebServer::argName(int i) {
378384
return String();
379385
}
380386

381-
int WebServer::args() { return _currentArgCount; }
387+
int WebServer::args() {
388+
return _currentArgCount;
389+
}
382390

383391
bool WebServer::hasArg(String name) {
384392
for (int i = 0; i < _currentArgCount; ++i) {
@@ -416,7 +424,9 @@ String WebServer::headerName(int i) {
416424
return String();
417425
}
418426

419-
int WebServer::headers() { return _headerKeysCount; }
427+
int WebServer::headers() {
428+
return _headerKeysCount;
429+
}
420430

421431
bool WebServer::hasHeader(String name) {
422432
for (int i = 0; i < _headerKeysCount; ++i) {
@@ -427,11 +437,17 @@ bool WebServer::hasHeader(String name) {
427437
return false;
428438
}
429439

430-
String WebServer::hostHeader() { return _hostHeader; }
440+
String WebServer::hostHeader() {
441+
return _hostHeader;
442+
}
431443

432-
void WebServer::onFileUpload(THandlerFunction fn) { _fileUploadHandler = fn; }
444+
void WebServer::onFileUpload(THandlerFunction fn) {
445+
_fileUploadHandler = fn;
446+
}
433447

434-
void WebServer::onNotFound(THandlerFunction fn) { _notFoundHandler = fn; }
448+
void WebServer::onNotFound(THandlerFunction fn) {
449+
_notFoundHandler = fn;
450+
}
435451

436452
void WebServer::_handleRequest() {
437453
bool handled = false;

Diff for: examples/Advanced/WIFI/WiFiSetting/WebServer.h

+17-8
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ enum HTTPClientStatus { HC_NONE, HC_WAIT_READ, HC_WAIT_CLOSE };
4848

4949
#define HTTP_DOWNLOAD_UNIT_SIZE 1460
5050
#define HTTP_UPLOAD_BUFLEN 2048
51-
#define HTTP_MAX_DATA_WAIT 1000 // ms to wait for the client to send the
52-
// request
53-
#define HTTP_MAX_POST_WAIT 1000 // ms to wait for POST data to arrive
54-
#define HTTP_MAX_SEND_WAIT 5000 // ms to wait for data chunk to be ACKed
51+
#define HTTP_MAX_DATA_WAIT \
52+
1000 // ms to wait for the client to send the
53+
// request
54+
#define HTTP_MAX_POST_WAIT 1000 // ms to wait for POST data to arrive
55+
#define HTTP_MAX_SEND_WAIT 5000 // ms to wait for data chunk to be ACKed
5556
#define HTTP_MAX_CLOSE_WAIT \
5657
2000 // ms to wait for the client to close the connection
5758

@@ -103,10 +104,18 @@ class WebServer {
103104
// assigned
104105
void onFileUpload(THandlerFunction fn); // handle file uploads
105106

106-
String uri() { return _currentUri; }
107-
HTTPMethod method() { return _currentMethod; }
108-
WiFiClient client() { return _currentClient; }
109-
HTTPUpload& upload() { return _currentUpload; }
107+
String uri() {
108+
return _currentUri;
109+
}
110+
HTTPMethod method() {
111+
return _currentMethod;
112+
}
113+
WiFiClient client() {
114+
return _currentClient;
115+
}
116+
HTTPUpload& upload() {
117+
return _currentUpload;
118+
}
110119

111120
String arg(String name); // get request argument value by name
112121
String arg(int i); // get request argument value by number

0 commit comments

Comments
 (0)