Skip to content

Commit

Permalink
Fix Paper caught in constant reboot issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinyu-Zhao committed Jul 17, 2023
1 parent b40e81e commit 5144bf5
Show file tree
Hide file tree
Showing 236 changed files with 88,700 additions and 90,287 deletions.
167 changes: 167 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
---
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
...
18 changes: 9 additions & 9 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ jobs:
strategy:
matrix:
path:
- check: './' # path to include
exclude: '' # path to exclude
- check: "./" # path to include
exclude: "utility" # path to exclude
# - check: 'src'
# exclude: ''
# - check: 'examples'
# exclude: ''
steps:
- uses: actions/checkout@v2
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: '13'
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}
- uses: actions/checkout@v2
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: "13"
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}
1 change: 0 additions & 1 deletion examples/Basics/TOUCH/TOUCH.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ void setup() {
canvas.pushCanvas(0, 0, UPDATE_MODE_DU4);
}


void loop() {
if (M5.TP.available()) {
if (!M5.TP.isFingerUp()) {
Expand Down
14 changes: 6 additions & 8 deletions examples/KIT/SCALES_KIT/SCALES_KIT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
* Copyright (c) 2022 by M5Stack
* Equipped with M5Paper sample source code
* 配套 M5Paper 示例源代码
* Visit the website for more
information:https://docs.m5stack.com/en/app/scales_kit
* 获取更多资料请访问:https://docs.m5stack.com/zh_CN/app/scales_kit
* Visit for more information: https://docs.m5stack.com/en/app/scales_kit
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/app/scales_kit
*
* describe: SCALES KIT WEIGHT UNIT EXAMPLE.
* date:2022/02/25
* Describe: SCALES KIT WEIGHT UNIT EXAMPLE.
* Date:2022/02/25
*******************************************************************************
Libraries:
Depend Libraries:
- [HX711](https://github.com/bogde/HX711)
*/

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

void setup() {
M5.begin(true, false, true, true, false);
M5.begin(true, false, true, true, false);

display.begin();

Expand Down
47 changes: 26 additions & 21 deletions examples/Unit/KEY/KEY.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@
* Copyright (c) 2022 by M5Stack
* Equipped with M5Paper sample source code
* 配套 M5Paper 示例源代码
* Visit the website for more information:
* 获取更多资料请访问:
* Visit for more information: https://docs.m5stack.com/en/unit/key
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/key
*
* Describe: KEY. 按键.
* Date: 2022/6/1
*******************************************************************************
* Please connect UNIT-KEY to PORT.B
* 请将 UNIT-KEY 连接到 PORT.B
* Please follow the steps below to add FastLED library:
* - Arduino menu --> Manage Libraries... --> FastLED --> install
* 在烧录前请按以下步骤添加 FastLED 库:
* - Arduino menu --> Manage Libraries... --> FastLED --> install
*
* Please connect UNIT-KEY to PORT.B
* 请将 UNIT-KEY 连接到 PORT.B
*
* describe: KEY. 按键.
* date: 2022/6/1
*******************************************************************************
*/

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

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

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

FastLED.addLeds<SK6812, DATA_PIN, GRB>(leds, 1); // Init FastLED. 初始化FastLED.
FastLED.addLeds<SK6812, DATA_PIN, GRB>(leds,
1); // Init FastLED. 初始化FastLED.

xTaskCreate(
LED, "led", 1000, NULL, 0,
Expand All @@ -55,7 +56,8 @@ void setup() {
void loop() {
if (!digitalRead(KEY_PIN)) { // If Key was pressed. 如果按键按下.
changeLedColor(); // Change LED color. 更换LED呼吸灯颜色.
while (!digitalRead(KEY_PIN)) // Hold until the key released. 在松开按键前保持状态.
while (!digitalRead(
KEY_PIN)) // Hold until the key released. 在松开按键前保持状态.
;
}
delay(100);
Expand All @@ -64,12 +66,14 @@ void loop() {
void LED(void *parameter) {
leds[0] = CRGB::Red;
for (;;) {
for (int i = 0; i < 255; i++) { // Set LED brightness from 0 to 255. 设置LED亮度从0到255.
for (int i = 0; i < 255;
i++) { // Set LED brightness from 0 to 255. 设置LED亮度从0到255.
FastLED.setBrightness(i);
FastLED.show();
delay(5);
}
for (int i = 255; i > 0; i--) { // Set LED brightness from 255 to 0. 设置LED亮度从255到0.
for (int i = 255; i > 0;
i--) { // Set LED brightness from 255 to 0. 设置LED亮度从255到0.
FastLED.setBrightness(i);
FastLED.show();
delay(5);
Expand All @@ -81,7 +85,8 @@ void LED(void *parameter) {
void changeLedColor() {
ledColor++;
if (ledColor > 2) ledColor = 0;
switch (ledColor) { // Change LED colors between R,G,B. 在红绿蓝中切换LED颜色.
switch (
ledColor) { // Change LED colors between R,G,B. 在红绿蓝中切换LED颜色.
case 0:
leds[0] = CRGB::Red;
break;
Expand Down
29 changes: 15 additions & 14 deletions examples/Unit/LIMIT/LIMIT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
* Copyright (c) 2022 by M5Stack
* Equipped with M5Paper sample source code
* 配套 M5Paper 示例源代码
* Visit the website for more information: https://docs.m5stack.com/zh_CN/products
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/products
*
* Please connect UNIT-LIMIT to PORT.B
* 请将 UNIT-LIMIT 连接到 PORT.B
* Visit for more information: https://docs.m5stack.com/en/unit/Unit%20Limit
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/Unit%20Limit
*
* describe: Limit.
* date: 2022/6/1
* Describe: Limit.
* Date: 2022/6/1
*******************************************************************************
* Please connect UNIT-LIMIT to PORT.B
* 请将 UNIT-LIMIT 连接到 PORT.B
*/

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

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

Serial.begin(115200);

Expand Down
Loading

0 comments on commit 5144bf5

Please sign in to comment.