Clean up comments, USB flash, NULLs

This commit is contained in:
Scott Lahteine
2020-10-24 17:13:10 -05:00
parent ea9e28bb69
commit 6c103b72a2
45 changed files with 231 additions and 238 deletions

View File

@ -294,7 +294,7 @@ namespace Anycubic {
}
void ChironTFT::SendtoTFTLN(PGM_P str = nullptr) {
if (str != nullptr) {
if (str) {
#if ACDEBUG(AC_SOME)
SERIAL_ECHOPGM("> ");
#endif

View File

@ -218,12 +218,12 @@ void AnycubicTFTClass::OnUserConfirmRequired(const char * const msg) {
}
float AnycubicTFTClass::CodeValue() {
return (strtod(&TFTcmdbuffer[TFTbufindr][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindr] + 1], NULL));
return (strtod(&TFTcmdbuffer[TFTbufindr][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindr] + 1], nullptr));
}
bool AnycubicTFTClass::CodeSeen(char code) {
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindr], code);
return (TFTstrchr_pointer != NULL); // Return True if a character was found
return !!TFTstrchr_pointer; // Return True if a character was found
}
bool AnycubicTFTClass::IsNozzleHomed() {
@ -536,7 +536,7 @@ void AnycubicTFTClass::OnPrintTimerStopped() {
}
void AnycubicTFTClass::GetCommandFromTFT() {
char *starpos = NULL;
char *starpos = nullptr;
while (LCD_SERIAL.available() > 0 && TFTbuflen < TFTBUFSIZE) {
serial3_char = LCD_SERIAL.read();
if (serial3_char == '\n' ||
@ -549,10 +549,10 @@ void AnycubicTFTClass::GetCommandFromTFT() {
TFTcmdbuffer[TFTbufindw][serial3_count] = 0; // terminate string
if ((strchr(TFTcmdbuffer[TFTbufindw], 'A') != NULL)) {
if ((strchr(TFTcmdbuffer[TFTbufindw], 'A') != nullptr)) {
int16_t a_command;
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
a_command = ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL))));
a_command = ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], nullptr))));
#if ENABLED(ANYCUBIC_LCD_DEBUG)
if ((a_command > 7) && (a_command != 20)) { // No debugging of status polls, please!
@ -682,8 +682,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
else {
SelectedDirectory[0] = 0;
if (starpos != NULL)
*(starpos - 1) = '\0';
if (starpos) *(starpos - 1) = '\0';
strcpy(SelectedFile, TFTstrchr_pointer + 4);
SENDLINE_DBG_PGM_VAL("J20", "TFT Serial Debug: File Selected... J20 ", SelectedFile); // J20 File Selected

View File

@ -146,9 +146,9 @@
uint16_t FTDI::get_utf8_char_width(utf8_char_t c, font_size_t fs) {
int x = 0, y = 0;
#ifdef TOUCH_UI_UTF8_WESTERN_CHARSET
WesternCharSet::render_glyph(NULL, x, y, fs, c) ||
WesternCharSet::render_glyph(nullptr, x, y, fs, c) ||
#endif
StandardCharSet::render_glyph(NULL, x, y, fs, c);
StandardCharSet::render_glyph(nullptr, x, y, fs, c);
return x;
}
@ -165,7 +165,7 @@
*/
uint16_t FTDI::get_utf8_text_width(const char *str, font_size_t fs) {
return render_utf8_text(NULL, 0, 0, str, fs);
return render_utf8_text(nullptr, 0, 0, str, fs);
}
uint16_t FTDI::get_utf8_text_width(progmem_str pstr, font_size_t fs) {

View File

@ -110,7 +110,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
draw_return_ui();
}
else {
lv_kb_set_ta(kb, nullptr); /*De-assign the text area to hide it cursor if needed*/
lv_kb_set_ta(kb, nullptr); // De-assign the text area to hide it cursor if needed
lv_obj_del(kb);
return;
}
@ -174,7 +174,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
return;
}
/*Add the characters to the text area if set*/
// Add the characters to the text area if set
if (!ext->ta) return;
if (strcmp(txt, "Enter") == 0 || strcmp(txt, LV_SYMBOL_NEW_LINE) == 0)
@ -214,7 +214,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
void lv_draw_keyboard() {
scr = lv_screen_create(KEY_BOARD_UI, "");
/*Create styles for the keyboard*/
// Create styles for the keyboard
static lv_style_t rel_style, pr_style;
lv_style_copy(&rel_style, &lv_style_btn_rel);
@ -229,7 +229,7 @@ void lv_draw_keyboard() {
pr_style.body.main_color = lv_color_make(0x72, 0x42, 0x15);
pr_style.body.grad_color = lv_color_make(0x6A, 0x3A, 0x0C);
/*Create a keyboard and apply the styles*/
// Create a keyboard and apply the styles
lv_obj_t *kb = lv_kb_create(scr, nullptr);
lv_obj_set_event_cb(kb, lv_kb_event_cb);
lv_kb_set_cursor_manage(kb, true);
@ -243,7 +243,7 @@ void lv_draw_keyboard() {
}
#endif
/*Create a text area. The keyboard will write here*/
// Create a text area. The keyboard will write here
lv_obj_t *ta = lv_ta_create(scr, nullptr);
lv_obj_align(ta, nullptr, LV_ALIGN_IN_TOP_MID, 0, 10);
if (keyboard_value == gcodeCommand) {
@ -255,7 +255,7 @@ void lv_draw_keyboard() {
lv_ta_set_text(ta, "");
}
/*Assign the text area to the keyboard*/
// Assign the text area to the keyboard
lv_kb_set_ta(kb, ta);
}