Skip to content

Commit 43c009f

Browse files
committed
Fix Paper caught in constant reboot issue
1 parent b40e81e commit 43c009f

File tree

236 files changed

+88700
-90287
lines changed

Some content is hidden

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

236 files changed

+88700
-90287
lines changed

.clang-format

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
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+
...

.github/workflows/clang-format-check.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ jobs:
77
strategy:
88
matrix:
99
path:
10-
- check: './' # path to include
11-
exclude: '' # path to exclude
10+
- check: "./" # path to include
11+
exclude: "(utility)" # path to exclude
1212
# - check: 'src'
1313
# exclude: ''
1414
# - check: 'examples'
1515
# exclude: ''
1616
steps:
17-
- uses: actions/checkout@v2
18-
- name: Run clang-format style check for C/C++/Protobuf programs.
19-
uses: jidicula/[email protected]
20-
with:
21-
clang-format-version: '13'
22-
check-path: ${{ matrix.path['check'] }}
23-
exclude-regex: ${{ matrix.path['exclude'] }}
17+
- uses: actions/checkout@v2
18+
- name: Run clang-format style check for C/C++/Protobuf programs.
19+
uses: jidicula/[email protected]
20+
with:
21+
clang-format-version: "13"
22+
check-path: ${{ matrix.path['check'] }}
23+
exclude-regex: ${{ matrix.path['exclude'] }}

examples/Basics/TOUCH/TOUCH.ino

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ void setup() {
1515
canvas.pushCanvas(0, 0, UPDATE_MODE_DU4);
1616
}
1717

18-
1918
void loop() {
2019
if (M5.TP.available()) {
2120
if (!M5.TP.isFingerUp()) {

examples/KIT/SCALES_KIT/SCALES_KIT.ino

+6-8
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
* Copyright (c) 2022 by M5Stack
44
* Equipped with M5Paper sample source code
55
* 配套 M5Paper 示例源代码
6-
* Visit the website for more
7-
information:https://docs.m5stack.com/en/app/scales_kit
8-
* 获取更多资料请访问:https://docs.m5stack.com/zh_CN/app/scales_kit
6+
* Visit for more information: https://docs.m5stack.com/en/app/scales_kit
7+
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/app/scales_kit
98
*
10-
* describe: SCALES KIT WEIGHT UNIT EXAMPLE.
11-
* date:2022/02/25
9+
* Describe: SCALES KIT WEIGHT UNIT EXAMPLE.
10+
* Date:2022/02/25
1211
*******************************************************************************
13-
Libraries:
12+
Depend Libraries:
1413
- [HX711](https://github.com/bogde/HX711)
15-
1614
*/
1715

1816
#include <M5EPD.h>
@@ -29,7 +27,7 @@ M5Canvas canvas(&display);
2927
HX711 scale;
3028

3129
void setup() {
32-
M5.begin(true, false, true, true, false);
30+
M5.begin(true, false, true, true, false);
3331

3432
display.begin();
3533

examples/Unit/KEY/KEY.ino

+26-21
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@
33
* Copyright (c) 2022 by M5Stack
44
* Equipped with M5Paper sample source code
55
* 配套 M5Paper 示例源代码
6-
* Visit the website for more information:
7-
* 获取更多资料请访问:
6+
* Visit for more information: https://docs.m5stack.com/en/unit/key
7+
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/key
88
*
9+
* Describe: KEY. 按键.
10+
* Date: 2022/6/1
11+
*******************************************************************************
12+
* Please connect UNIT-KEY to PORT.B
13+
* 请将 UNIT-KEY 连接到 PORT.B
914
* Please follow the steps below to add FastLED library:
1015
* - Arduino menu --> Manage Libraries... --> FastLED --> install
1116
* 在烧录前请按以下步骤添加 FastLED 库:
1217
* - Arduino menu --> Manage Libraries... --> FastLED --> install
13-
*
14-
* Please connect UNIT-KEY to PORT.B
15-
* 请将 UNIT-KEY 连接到 PORT.B
16-
*
17-
* describe: KEY. 按键.
18-
* date: 2022/6/1
19-
*******************************************************************************
2018
*/
2119

2220
#include <M5EPD.h>
@@ -35,17 +33,20 @@ void changeLedColor();
3533

3634
void setup() {
3735
M5.begin(); // Init M5Stack 初始化M5Stack
38-
M5.EPD.SetRotation(90); //Set the rotation of the display. 设置屏幕旋转角度
39-
M5.EPD.Clear(true); //Clear the screen. 清屏
40-
M5.RTC.begin(); //Init the RTC. 初始化 RTC
41-
canvas.createCanvas(540, 960); //Create a canvas. 创建画布
42-
canvas.setTextSize(3); //Set the text size. 设置文字大小
43-
canvas.drawString("UNIT-KEY Example", 135, 350); //Draw a string. 绘制字符串
44-
canvas.pushCanvas(0,0,UPDATE_MODE_DU4); //Update the screen. 更新屏幕
36+
M5.EPD.SetRotation(
37+
90); // Set the rotation of the display. 设置屏幕旋转角度
38+
M5.EPD.Clear(true); // Clear the screen. 清屏
39+
M5.RTC.begin(); // Init the RTC. 初始化 RTC
40+
canvas.createCanvas(540, 960); // Create a canvas. 创建画布
41+
canvas.setTextSize(3); // Set the text size. 设置文字大小
42+
canvas.drawString("UNIT-KEY Example", 135,
43+
350); // Draw a string. 绘制字符串
44+
canvas.pushCanvas(0, 0, UPDATE_MODE_DU4); // Update the screen. 更新屏幕
4545

4646
pinMode(KEY_PIN, INPUT_PULLUP); // Init Key pin. 初始化Key引脚.
4747

48-
FastLED.addLeds<SK6812, DATA_PIN, GRB>(leds, 1); // Init FastLED. 初始化FastLED.
48+
FastLED.addLeds<SK6812, DATA_PIN, GRB>(leds,
49+
1); // Init FastLED. 初始化FastLED.
4950

5051
xTaskCreate(
5152
LED, "led", 1000, NULL, 0,
@@ -55,7 +56,8 @@ void setup() {
5556
void loop() {
5657
if (!digitalRead(KEY_PIN)) { // If Key was pressed. 如果按键按下.
5758
changeLedColor(); // Change LED color. 更换LED呼吸灯颜色.
58-
while (!digitalRead(KEY_PIN)) // Hold until the key released. 在松开按键前保持状态.
59+
while (!digitalRead(
60+
KEY_PIN)) // Hold until the key released. 在松开按键前保持状态.
5961
;
6062
}
6163
delay(100);
@@ -64,12 +66,14 @@ void loop() {
6466
void LED(void *parameter) {
6567
leds[0] = CRGB::Red;
6668
for (;;) {
67-
for (int i = 0; i < 255; i++) { // Set LED brightness from 0 to 255. 设置LED亮度从0到255.
69+
for (int i = 0; i < 255;
70+
i++) { // Set LED brightness from 0 to 255. 设置LED亮度从0到255.
6871
FastLED.setBrightness(i);
6972
FastLED.show();
7073
delay(5);
7174
}
72-
for (int i = 255; i > 0; i--) { // Set LED brightness from 255 to 0. 设置LED亮度从255到0.
75+
for (int i = 255; i > 0;
76+
i--) { // Set LED brightness from 255 to 0. 设置LED亮度从255到0.
7377
FastLED.setBrightness(i);
7478
FastLED.show();
7579
delay(5);
@@ -81,7 +85,8 @@ void LED(void *parameter) {
8185
void changeLedColor() {
8286
ledColor++;
8387
if (ledColor > 2) ledColor = 0;
84-
switch (ledColor) { // Change LED colors between R,G,B. 在红绿蓝中切换LED颜色.
88+
switch (
89+
ledColor) { // Change LED colors between R,G,B. 在红绿蓝中切换LED颜色.
8590
case 0:
8691
leds[0] = CRGB::Red;
8792
break;

examples/Unit/LIMIT/LIMIT.ino

+15-14
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
* Copyright (c) 2022 by M5Stack
44
* Equipped with M5Paper sample source code
55
* 配套 M5Paper 示例源代码
6-
* Visit the website for more information: https://docs.m5stack.com/zh_CN/products
7-
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/products
8-
*
9-
* Please connect UNIT-LIMIT to PORT.B
10-
* 请将 UNIT-LIMIT 连接到 PORT.B
6+
* Visit for more information: https://docs.m5stack.com/en/unit/Unit%20Limit
7+
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/Unit%20Limit
118
*
12-
* describe: Limit.
13-
* date: 2022/6/1
9+
* Describe: Limit.
10+
* Date: 2022/6/1
1411
*******************************************************************************
12+
* Please connect UNIT-LIMIT to PORT.B
13+
* 请将 UNIT-LIMIT 连接到 PORT.B
1514
*/
1615

1716
#include <M5EPD.h>
@@ -22,13 +21,15 @@ M5EPD_Canvas canvas(&M5.EPD);
2221

2322
void setup() {
2423
M5.begin(); // Init M5Stack 初始化M5Stack
25-
M5.EPD.SetRotation(90); //Set the rotation of the display. 设置屏幕旋转角度
26-
M5.EPD.Clear(true); //Clear the screen. 清屏
27-
M5.RTC.begin(); //Init the RTC. 初始化 RTC
28-
canvas.createCanvas(540, 960); //Create a canvas. 创建画布
29-
canvas.setTextSize(3); //Set the text size. 设置文字大小
30-
canvas.drawString("UNIT-LIMIT Example", 110, 350); //Draw a string. 绘制字符串
31-
canvas.pushCanvas(0,0,UPDATE_MODE_DU4); //Update the screen. 更新屏幕
24+
M5.EPD.SetRotation(
25+
90); // Set the rotation of the display. 设置屏幕旋转角度
26+
M5.EPD.Clear(true); // Clear the screen. 清屏
27+
M5.RTC.begin(); // Init the RTC. 初始化 RTC
28+
canvas.createCanvas(540, 960); // Create a canvas. 创建画布
29+
canvas.setTextSize(3); // Set the text size. 设置文字大小
30+
canvas.drawString("UNIT-LIMIT Example", 110,
31+
350); // Draw a string. 绘制字符串
32+
canvas.pushCanvas(0, 0, UPDATE_MODE_DU4); // Update the screen. 更新屏幕
3233

3334
Serial.begin(115200);
3435

0 commit comments

Comments
 (0)