Skip to content

Commit

Permalink
fix some example compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitshaoxiang committed Nov 29, 2023
1 parent b1cf076 commit 6c9e4ef
Show file tree
Hide file tree
Showing 73 changed files with 35,677 additions and 29,575 deletions.
174 changes: 162 additions & 12 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,17 +1,167 @@
---

# This is a clang-format config file. Run command below with this file in
# one of the parent directories.
#
# clang-format -style=file -i <filename> (.cpp or .h)
#
# ( -i = in-place editing, without it formatted source goes to stdout )
#
# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html

Language: Cpp
BasedOnStyle: Google
ReflowComments: false
SortIncludes: false
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
...
4 changes: 2 additions & 2 deletions .github/workflows/arduino-action-core2-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ jobs:
# You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace
#############################################################################################################
arduino-boards-fqbn:
- m5stack:esp32:m5stack-core2
- m5stack:esp32:core2

# Specify parameters for each board.
#############################################################################################################
include:
- arduino-boards-fqbn: m5stack:esp32:m5stack-core2
- arduino-boards-fqbn: m5stack:esp32:core2
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
sketches-exclude: WhistleSwitch,50Hz,SimpleFrequencyDetector

Expand Down
15 changes: 7 additions & 8 deletions examples/Advanced/I2C_Tester/I2C_Tester.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ void loop() {
Wire.beginTransmission(
address); // Data transmission to the specified device address
// starts. 开始向指定的设备地址进行传输数据
error =
Wire.endTransmission(); /*Stop data transmission with the slave.
停止与从机的数据传输 0: success. 成功 1: The amount of data
exceeds the transmission buffer capacity limit.
数据量超过传送缓存容纳限制 return value: 2:
Received NACK when sending address. 传送地址时收到 NACK 3:
Received NACK when transmitting data. 传送数据时收到 NACK 4:
Other errors. 其它错误 */
error = Wire.endTransmission(); /*Stop data transmission with the slave.
停止与从机的数据传输 0: success. 成功 1: The amount of
data exceeds the transmission buffer capacity limit.
数据量超过传送缓存容纳限制 return value: 2:
Received NACK when sending address. 传送地址时收到 NACK
3: Received NACK when transmitting data. 传送数据时收到
NACK 4: Other errors. 其它错误 */
if (error == 0) {
M5.Lcd.print(address, HEX);
M5.Lcd.print(" ");
Expand Down
4 changes: 2 additions & 2 deletions examples/Advanced/MultiTask/MultiTask.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ void setup() {
M5.begin(); // Init M5Core2. 初始化M5Core2
// Creat Task1. 创建线程1
xTaskCreatePinnedToCore(
task1, // Function to implement the task.
// 线程对应函数名称(不能有返回值)
task1, // Function to implement the task.
// 线程对应函数名称(不能有返回值)
"task1", // 线程名称
4096, // The size of the task stack specified as the number of *
// bytes.任务堆栈的大小(字节)
Expand Down
2 changes: 1 addition & 1 deletion examples/Advanced/Storage/SPIFFS/SPIFFS/SPIFFS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void setup() {
M5.Lcd.println(
"SPIFFS format start..."); // output format String in LCD.
// 在屏幕上输出格式化字符串
SPIFFS.format(); // Formatting SPIFFS. 格式化SPIFFS
SPIFFS.format(); // Formatting SPIFFS. 格式化SPIFFS
M5.Lcd.println("SPIFFS format finish");
}

Expand Down
2 changes: 1 addition & 1 deletion examples/Advanced/Storage/SPIFFS/SPIFFS_Add/SPIFFS_Add.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void setup() {
M5.Lcd.println(
"\nSPIFFS format start..."); // Screen prints format String.
// 屏幕打印格式化字符串
SPIFFS.format(); // Formatting SPIFFS. 格式化SPIFFS
SPIFFS.format(); // Formatting SPIFFS. 格式化SPIFFS
M5.Lcd.println("SPIFFS format finish");
}
if (SPIFFS.begin()) { // Start SPIFFS, return 1 on success.
Expand Down
2 changes: 1 addition & 1 deletion examples/Advanced/Storage/SPIFFS_Add/SPIFFS_Add.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void setup() {
M5.Lcd.println(
"\nSPIFFS format start..."); // Screen prints format String.
// 屏幕打印格式化字符串
SPIFFS.format(); // Formatting SPIFFS. 格式化SPIFFS
SPIFFS.format(); // Formatting SPIFFS. 格式化SPIFFS
M5.Lcd.println("SPIFFS format finish");
}
if (SPIFFS.begin()) { // Start SPIFFS, return 1 on success.
Expand Down
7 changes: 4 additions & 3 deletions examples/Advanced/WIFI/WiFiSetting/WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ 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
#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
Expand Down Expand Up @@ -98,8 +99,8 @@ class WebServer {
void addHandler(RequestHandler* handler);
void serveStatic(const char* uri, fs::FS& fs, const char* path,
const char* cache_header = NULL);
void onNotFound(THandlerFunction fn); // called when handler is not
// assigned
void onNotFound(THandlerFunction fn); // called when handler is not
// assigned
void onFileUpload(THandlerFunction fn); // handle file uploads

String uri() {
Expand Down
12 changes: 7 additions & 5 deletions examples/Advanced/WIFI/WiFiSetting/WiFiSetting.ino
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ restoreConfig() { /* Check whether there is wifi configuration information
boolean checkConnection() { // Check wifi connection. 检测wifi连接情况
int count = 0; // count. 计数
M5.Lcd.print("Waiting for Wi-Fi connection");
while (count < 30) { /* If you fail to connect to wifi within 30*350ms
(10.5s), return false; otherwise return true.
若在30*500ms(15s)内未能连上wifi,返回false;否则返回true
*/
while (
count <
30) { /* If you fail to connect to wifi within 30*350ms
(10.5s), return false; otherwise return true.
若在30*500ms(15s)内未能连上wifi,返回false;否则返回true
*/
if (WiFi.status() == WL_CONNECTED) {
M5.Lcd.printf("\nConnected!\n");
return (true);
Expand Down Expand Up @@ -179,7 +181,7 @@ void startWebServer() { // Open the web service. 打开Web服务
void setupMode() {
WiFi.mode(WIFI_MODE_STA); // Set Wi-Fi mode to WIFI_MODE_STA.
// 设置Wi-Fi模式为WIFI_MODE_STA
WiFi.disconnect(); // Disconnect wifi connection. 断开wifi连接
WiFi.disconnect(); // Disconnect wifi connection. 断开wifi连接
delay(100);
int n = WiFi.scanNetworks(); // Store the number of wifi scanned into n.
// 将扫描到的wifi个数存储到n中
Expand Down
2 changes: 1 addition & 1 deletion examples/KIT/SCALES_KIT/SCALES_KIT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ confirm for calibration. 将WEIGHT UNIT连接至端口A(G32/33), 校准说
*/

#include <M5Core2.h>
#include <M5Unified.h>
#include <M5GFX.h>
#include "HX711.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/Module/COM_CAT1_SIM7680/COM_CAT1_SIM7680.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publishing. Before use, adjust the DIP switch of the module base to G16/17 ON
- [PubSubClient](https://github.com/knolleary/pubsubclient.git)
*/

#include <M5Core2.h>
#include <M5Unified.h>
#include "M5GFX.h"

// Compatible with SIM76XX series.
Expand Down
2 changes: 1 addition & 1 deletion examples/Unit/LCD_ST7789V2/LCD_ST7789V2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Please connect to Port A,Displays a string on the screen.
请连接端口A,在屏幕上显示字符串。
*/
#include <M5Core2.h>
#include <M5Unified.h>
#include <M5UnitLCD.h>

M5UnitLCD display;
Expand Down
Loading

0 comments on commit 6c9e4ef

Please sign in to comment.