Skip to content

Commit

Permalink
Merge branch 'master' into rtc_getvoltlow
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinyu-Zhao authored Jun 28, 2024
2 parents 3f5a507 + 1a7732a commit 88d6b07
Show file tree
Hide file tree
Showing 87 changed files with 38,276 additions and 29,823 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
...
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,20 @@ 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
<<<<<<< HEAD:.github/workflows/arduino-action-compile.yml
- m5stack:esp32:m5stack_core2
=======
- m5stack:esp32:core2
>>>>>>> d7b4461c702d44503857638f1447dcb2325f0d64:.github/workflows/arduino-action-core2-compile.yml

# Specify parameters for each board.
#############################################################################################################
include:
- arduino-boards-fqbn: m5stack:esp32:m5stack-core2
<<<<<<< HEAD:.github/workflows/arduino-action-compile.yml
- arduino-boards-fqbn: m5stack:esp32:m5stack_core2
=======
- arduino-boards-fqbn: m5stack:esp32:core2
>>>>>>> d7b4461c702d44503857638f1447dcb2325f0d64:.github/workflows/arduino-action-core2-compile.yml
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
sketches-exclude: WhistleSwitch,50Hz,SimpleFrequencyDetector

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# M5Core2 Library

[![Arduino Compile](https://github.com/m5stack/M5Core2/actions/workflows/arduino-action-core2-compile.yml/badge.svg)](https://github.com/m5stack/M5Core2/actions/workflows/arduino-action-stickc-compile.yml)
[![Arduino Compile](https://github.com/m5stack/M5Core2/actions/workflows/arduino-action-compile.yml/badge.svg)](https://github.com/m5stack/M5Core2/actions/workflows/arduino-action-compile.yml)
[![Arduino Lint](https://github.com/m5stack/M5Core2/actions/workflows/Arduino-Lint-Check.yml/badge.svg)](https://github.com/m5stack/M5Core2/actions/workflows/Arduino-Lint-Check.yml)
[![Clang Format](https://github.com/m5stack/M5Core2/actions/workflows/clang-format-check.yml/badge.svg)](https://github.com/m5stack/M5Core2/actions/workflows/clang-format-check.yml)

Expand Down
2 changes: 1 addition & 1 deletion README_cn.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# M5Core2 Library

[![Arduino Compile](https://github.com/m5stack/M5Core2/actions/workflows/arduino-action-core2-compile.yml/badge.svg)](https://github.com/m5stack/M5Core2/actions/workflows/arduino-action-stickc-compile.yml)
[![Arduino Compile](https://github.com/m5stack/M5Core2/actions/workflows/arduino-action-compile.yml/badge.svg)](https://github.com/m5stack/M5Core2/actions/workflows/arduino-action-compile.yml)
[![Arduino Lint](https://github.com/m5stack/M5Core2/actions/workflows/Arduino-Lint-Check.yml/badge.svg)](https://github.com/m5stack/M5Core2/actions/workflows/Arduino-Lint-Check.yml)
[![Clang Format](https://github.com/m5stack/M5Core2/actions/workflows/clang-format-check.yml/badge.svg)](https://github.com/m5stack/M5Core2/actions/workflows/clang-format-check.yml)

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
4 changes: 2 additions & 2 deletions examples/Basics/record/record.ino
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void loop() {
// 将触摸坐标存储在pos.内
if (pos.y > 240) {
if (pos.x < 109) {
M5.Axp.SetLDOEnable(3, true); // Open the vibration. 开启震动马达
M5.Axp.SetVibration(true); // Open the vibration. 开启震动马达
delay(100);
M5.Axp.SetLDOEnable(3, false);
M5.Axp.SetVibration(false);
data_offset = 0;
M5.Spk.InitI2SSpeakOrMic(MODE_MIC);
size_t byte_read;
Expand Down
4 changes: 2 additions & 2 deletions examples/Basics/speak/speak.ino
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ void loop() {
// 将触摸坐标存储在pos.内
if (pos.y > 240)
if (pos.x < 109) {
M5.Axp.SetLDOEnable(3, true); // Open the vibration. 开启震动马达
M5.Axp.SetVibration(true); // Open the vibration. 开启震动马达
delay(100);
M5.Axp.SetLDOEnable(3, false);
M5.Axp.SetVibration(false);
delay(100);
M5.Spk.PlaySound(
previewR,
Expand Down
8 changes: 4 additions & 4 deletions examples/Basics/vibrate/vibrate.ino
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
*******************************************************************************
* Copyright (c) 2021 by M5Stack
* Copyright (c) 2023 by M5Stack
* Equipped with M5Core2 sample source code
* 配套 M5Core2 示例源代码
* Visit for more information: https://docs.m5stack.com/en/core/core2
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/core2
*
* Describe: vibrate example. 震动电机示例
* Date: 2021/9/18
* Date: 2023/11/17
*******************************************************************************
*/
#include <M5Core2.h>
Expand All @@ -25,8 +25,8 @@ The loop() function is an infinite loop in which the program runs repeatedly
在setup()函数中的程序执行完后,会接着执行loop()函数中的程序
loop()函数是一个死循环,其中的程序会不断的重复运行 */
void loop() {
M5.Axp.SetLDOEnable(3, true); // Open the vibration. 开启震动马达
M5.Axp.SetVibration(true); // Open the vibration. 开启震动马达
delay(1000);
M5.Axp.SetLDOEnable(3, false); // Open the vibration. 关闭震动马达
M5.Axp.SetVibration(false); // Open the vibration. 关闭震动马达
delay(1000);
}
6 changes: 3 additions & 3 deletions examples/FactoryTest/FactoryTest/FactoryTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ void AppSetting() {
}

if (MoterBtn.inHotZone(pos)) {
M5.Axp.SetLDOEnable(3, MoterState);
M5.Axp.SetVibration(MoterState);
if (MoterState == 1) {
Disbuff.fillRect(193, 103, 14, 47, TFT_GREEN);
} else {
Expand Down Expand Up @@ -1935,10 +1935,10 @@ void setup() {
InitI2SSpakerOrMic(MODE_SPK);
xTaskCreatePinnedToCore(i2s_task, "i2s_task", 4096, NULL, 3, NULL, 0);

M5.Axp.SetLDOEnable(3, true);
M5.Axp.SetVibration(true);
CoverScrollText("Motor Test", M5.Lcd.color565(SUCCE_COLOR));
delay(150);
M5.Axp.SetLDOEnable(3, false);
M5.Axp.SetVibration(false);

M5.Axp.SetLed(1);
CoverScrollText("LED Test", M5.Lcd.color565(SUCCE_COLOR));
Expand Down
Loading

0 comments on commit 88d6b07

Please sign in to comment.