Cleanup code and use clang-formatter to improve readabilty.

This commit is contained in:
Knutwurst
2023-06-14 15:11:17 +02:00
parent 1e27c22bdd
commit 9afe777c26
3 changed files with 1972 additions and 1973 deletions

View File

@@ -6,25 +6,25 @@ AlignAfterOpenBracket: Align
AlignArrayOfStructures: None AlignArrayOfStructures: None
AlignConsecutiveAssignments: AlignConsecutiveAssignments:
Enabled: true Enabled: true
AcrossEmptyLines: true AcrossEmptyLines: false
AcrossComments: true AcrossComments: true
AlignCompound: true AlignCompound: true
PadOperators: true PadOperators: true
AlignConsecutiveBitFields: AlignConsecutiveBitFields:
Enabled: true Enabled: true
AcrossEmptyLines: true AcrossEmptyLines: false
AcrossComments: true AcrossComments: true
AlignCompound: false AlignCompound: false
PadOperators: false PadOperators: false
AlignConsecutiveDeclarations: AlignConsecutiveDeclarations:
Enabled: true Enabled: true
AcrossEmptyLines: true AcrossEmptyLines: false
AcrossComments: true AcrossComments: true
AlignCompound: false AlignCompound: false
PadOperators: false PadOperators: false
AlignConsecutiveMacros: AlignConsecutiveMacros:
Enabled: true Enabled: true
AcrossEmptyLines: true AcrossEmptyLines: false
AcrossComments: true AcrossComments: true
AlignCompound: false AlignCompound: false
PadOperators: false PadOperators: false
@@ -62,16 +62,15 @@ BraceWrapping:
AfterObjCDeclaration: false AfterObjCDeclaration: false
AfterStruct: false AfterStruct: false
AfterUnion: false AfterUnion: false
BeforeCatch: false BeforeCatch: true
BeforeElse: false BeforeElse: true
BeforeLambdaBody: false BeforeLambdaBody: false
BeforeWhile: false BeforeWhile: false
IndentBraces: false IndentBraces: true
SplitEmptyFunction: true SplitEmptyFunction: true
SplitEmptyRecord: true SplitEmptyRecord: true
SplitEmptyNamespace: true SplitEmptyNamespace: true
BreakAfterAttributes: Never BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true BreakArrays: true
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always BreakBeforeConceptDeclarations: Always
@@ -115,17 +114,17 @@ IncludeCategories:
CaseSensitive: false CaseSensitive: false
IncludeIsMainRegex: '(Test)?$' IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: '' IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false IndentAccessModifiers: true
IndentCaseBlocks: false IndentCaseBlocks: true
IndentCaseLabels: false IndentCaseLabels: true
IndentExternBlock: AfterExternBlock IndentExternBlock: AfterExternBlock
IndentGotoLabels: true IndentGotoLabels: true
IndentPPDirectives: None IndentPPDirectives: BeforeHash
IndentRequiresClause: true IndentRequiresClause: true
IndentWidth: 4 IndentWidth: 2
IndentWrappedFunctionNames: false IndentWrappedFunctionNames: true
InsertBraces: false InsertBraces: true
InsertNewlineAtEOF: false InsertNewlineAtEOF: true
InsertTrailingCommas: None InsertTrailingCommas: None
IntegerLiteralSeparator: IntegerLiteralSeparator:
Binary: 0 Binary: 0
@@ -134,15 +133,13 @@ IntegerLiteralSeparator:
DecimalMinDigits: 0 DecimalMinDigits: 0
Hex: 0 Hex: 0
HexMinDigits: 0 HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature LambdaBodyIndentation: Signature
LineEnding: DeriveLF LineEnding: DeriveLF
MacroBlockBegin: '' MacroBlockBegin: ''
MacroBlockEnd: '' MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 2
NamespaceIndentation: None NamespaceIndentation: All
ObjCBinPackProtocolList: Auto ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2 ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true ObjCBreakBeforeNestedBlockParam: true

File diff suppressed because it is too large Load Diff

View File

@@ -24,11 +24,11 @@
#include "../../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"
#include "../../../module/probe.h" #include "../../../module/probe.h"
char *itostr2(const uint8_t &x); char* itostr2(const uint8_t& x);
#ifndef ULTRA_LCD #ifndef ULTRA_LCD
char *itostr3(const int); char* itostr3(const int);
char *ftostr32(const float &); char* ftostr32(const float&);
#endif #endif
#define TFTBUFSIZE 4 #define TFTBUFSIZE 4
@@ -194,48 +194,48 @@ enum AnycubicMediaPauseState {
class AnycubicTouchscreenClass { class AnycubicTouchscreenClass {
public: public:
AnycubicTouchscreenClass(); AnycubicTouchscreenClass();
void Setup(); void Setup();
void CommandScan(); void CommandScan();
void FilamentRunout(); void FilamentRunout();
void DoFilamentRunoutCheck(); void DoFilamentRunoutCheck();
void UserConfirmRequired(const char *); void UserConfirmRequired(const char*);
void SDCardStateChange(bool); void SDCardStateChange(bool);
void SDCardError(); void SDCardError();
void KillTFT(); void KillTFT();
void OnPrintTimerStarted(); void OnPrintTimerStarted();
void OnPrintTimerPaused(); void OnPrintTimerPaused();
void OnPrintTimerStopped(); void OnPrintTimerStopped();
#if BOTH(ANYCUBIC_TFT_DEBUG, KNUTWURST_DGUS2_TFT) #if BOTH(ANYCUBIC_TFT_DEBUG, KNUTWURST_DGUS2_TFT)
void Command(const char * const command); void Command(const char* const command);
#endif #endif
#if ENABLED(KNUTWURST_CHIRON) #if ENABLED(KNUTWURST_CHIRON)
void LevelingDone(); void LevelingDone();
#endif #endif
private: private:
char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
int TFTbuflen = 0; int TFTbuflen = 0;
int TFTbufindr = 0; int TFTbufindr = 0;
int TFTbufindw = 0; int TFTbufindw = 0;
char serial3_char; char serial3_char;
int serial3_count = 0; int serial3_count = 0;
char *TFTstrchr_pointer; char* TFTstrchr_pointer;
char FlagResumFromOutage = 0; char FlagResumFromOutage = 0;
uint8_t tmp_extruder = 0; uint8_t tmp_extruder = 0;
uint16_t HeaterCheckCount = 0; uint16_t HeaterCheckCount = 0;
int currentFlowRate = 0; int currentFlowRate = 0;
bool PrintdoneAndPowerOFF = true; bool PrintdoneAndPowerOFF = true;
bool powerOFFflag = 0; bool powerOFFflag = 0;
xy_uint8_t selectedmeshpoint; xy_uint8_t selectedmeshpoint;
float live_Zoffset; float live_Zoffset;
static AnycubicMediaPrintState mediaPrintingState; static AnycubicMediaPrintState mediaPrintingState;
static AnycubicMediaPauseState mediaPauseState; static AnycubicMediaPauseState mediaPauseState;
#if defined(POWER_OUTAGE_TEST) #if defined(POWER_OUTAGE_TEST)
struct OutageDataStruct { struct OutageDataStruct {
@@ -245,36 +245,35 @@ static AnycubicMediaPauseState mediaPauseState;
float last_bed_temp; float last_bed_temp;
float last_hotend_temp; float last_hotend_temp;
long lastSDposition; long lastSDposition;
} } OutageData;
OutageData;
#endif #endif
int CodeValueInt(); int CodeValueInt();
float CodeValue(); float CodeValue();
bool CodeSeen(char); bool CodeSeen(char);
void StartPrint(); void StartPrint();
void PausePrint(); void PausePrint();
void ResumePrint(); void ResumePrint();
void StopPrint(); void StopPrint();
void GetCommandFromTFT(); void GetCommandFromTFT();
void CheckHeaterError(); void CheckHeaterError();
void FilamentChangePause(); void FilamentChangePause();
void HandleSpecialMenu(); void HandleSpecialMenu();
void RenderCurrentFileList(); void RenderCurrentFileList();
void RenderSpecialMenu(uint16_t); void RenderSpecialMenu(uint16_t);
void RenderCurrentFolder(uint16_t); void RenderCurrentFolder(uint16_t);
char currentTouchscreenSelection[64]; char currentTouchscreenSelection[64];
char currentFileOrDirectory[64]; char currentFileOrDirectory[64];
String flowRateBuffer; String flowRateBuffer;
String zOffsetBuffer; String zOffsetBuffer;
uint8_t SpecialMenu = false; uint8_t SpecialMenu = false;
uint8_t MMLMenu = false; uint8_t MMLMenu = false;
uint8_t FlowMenu = false; uint8_t FlowMenu = false;
uint8_t BLTouchMenu = false; uint8_t BLTouchMenu = false;
uint8_t LevelMenu = false; uint8_t LevelMenu = false;
uint8_t CaseLight = true; uint8_t CaseLight = true;
#if ENABLED(KNUTWURST_MEGA_P_LASER) #if ENABLED(KNUTWURST_MEGA_P_LASER)
typedef struct { typedef struct {