diff --git a/TFT/src/User/API/Notification.c b/TFT/src/User/API/Notification.c index 23e203c91c..7a22ce5010 100644 --- a/TFT/src/User/API/Notification.c +++ b/TFT/src/User/API/Notification.c @@ -6,8 +6,12 @@ const GUI_RECT toastRect = {START_X + TITLE_END_Y - (TOAST_Y_PAD * 2), TOAST_Y_PAD, LCD_WIDTH - START_X, TITLE_END_Y - TOAST_Y_PAD}; const GUI_RECT toastIconRect = {START_X, TOAST_Y_PAD, START_X + TITLE_END_Y - (TOAST_Y_PAD * 2), TITLE_END_Y - TOAST_Y_PAD}; -// toast notification variables -static TOAST toastlist[TOAST_MSG_COUNT]; +static struct +{ + DIALOG_TYPE style; + uint8_t isNew; + char text[TOAST_MSG_LENGTH]; +} toastlist[TOAST_MSG_COUNT]; static uint8_t nextToastIndex = 0; // next index to store new toast static uint8_t curToastDisplay = 0; // current toast notification being displayed @@ -24,11 +28,9 @@ void addToast(DIALOG_TYPE style, char * text) { LCD_WAKE(); - TOAST t; - strncpy_no_pad(t.text, text, TOAST_MSG_LENGTH); - t.style = style; - t.isNew = true; - toastlist[nextToastIndex] = t; + strncpy_no_pad(toastlist[nextToastIndex].text, text, TOAST_MSG_LENGTH); + toastlist[nextToastIndex].style = style; + toastlist[nextToastIndex].isNew = true; nextToastIndex = (nextToastIndex + 1) % TOAST_MSG_COUNT; } @@ -41,7 +43,7 @@ bool toastRunning(void) // check if any new notification is available static bool toastAvailable(void) { - for (int i = 0; i < TOAST_MSG_COUNT; i++) + for (uint8_t i = 0; i < TOAST_MSG_COUNT; i++) { if (toastlist[i].isNew == true) return true; @@ -62,29 +64,35 @@ void drawToast(bool redraw) // draw icon uint8_t *icon; - uint8_t cursound; - if (toastlist[curToastDisplay].style == DIALOG_TYPE_ERROR) - { - GUI_SetColor(NOTIF_ICON_ERROR_BG_COLOR); - icon = IconCharSelect(CHARICON_ERROR); - cursound = SOUND_ERROR; - } - else if (toastlist[curToastDisplay].style == DIALOG_TYPE_SUCCESS) + SOUND cursound; + + switch (toastlist[curToastDisplay].style) { - GUI_SetColor(NOTIF_ICON_SUCCESS_BG_COLOR); - icon = IconCharSelect(CHARICON_OK_ROUND); - cursound = SOUND_SUCCESS; + case DIALOG_TYPE_ERROR: + GUI_SetColor(NOTIF_ICON_ERROR_BG_COLOR); + icon = IconCharSelect(CHARICON_ERROR); + cursound = SOUND_ERROR; + break; + + case DIALOG_TYPE_SUCCESS: + GUI_SetColor(NOTIF_ICON_SUCCESS_BG_COLOR); + icon = IconCharSelect(CHARICON_OK_ROUND); + cursound = SOUND_SUCCESS; + break; + + default: + GUI_SetColor(NOTIF_ICON_INFO_BG_COLOR); + icon = IconCharSelect(CHARICON_INFO); + cursound = SOUND_TOAST; + break; } - else + + if (!redraw) // if notification is new { - GUI_SetColor(NOTIF_ICON_INFO_BG_COLOR); - icon = IconCharSelect(CHARICON_INFO); - cursound = SOUND_TOAST; + BUZZER_PLAY(cursound); // play sound + nextToastTime = OS_GetTimeMs() + SEC_TO_MS(TOAST_DURATION); // set new timer } - if (cursound >= 0 && !redraw) - BUZZER_PLAY(cursound); - GUI_SetTextMode(GUI_TEXTMODE_TRANS); GUI_FillPrect(&toastIconRect); GUI_SetColor(NOTIF_ICON_FG_COLOR); @@ -99,10 +107,6 @@ void drawToast(bool redraw) // set current toast notification as old/completed toastlist[curToastDisplay].isNew = false; - // set new timer if notification is new - if (!redraw) - nextToastTime = OS_GetTimeMs() + SEC_TO_MS(TOAST_DURATION); - GUI_RestoreColorDefault(); } } @@ -110,10 +114,7 @@ void drawToast(bool redraw) // check and control toast notification display void loopToast(void) { - if (getMenuType() == MENU_TYPE_FULLSCREEN) - return; - - if (OS_GetTimeMs() > nextToastTime) + if (getMenuType() != MENU_TYPE_FULLSCREEN && OS_GetTimeMs() > nextToastTime) { if (toastAvailable()) { @@ -130,17 +131,14 @@ void loopToast(void) } // add new message to notification queue -void addNotification(DIALOG_TYPE style, char *title, char *text, bool ShowDialog) +void addNotification(DIALOG_TYPE style, char *title, char *text, bool draw_dialog) { LCD_WAKE(); - if (nextMsgIndex > MAX_MSG_COUNT - 1) + if (nextMsgIndex >= MAX_MSG_COUNT) { // remove oldest message and move all messages up one step - for (int i = 0; i < MAX_MSG_COUNT - 1; i++) - { - memcpy(&msglist[i], &msglist[i + 1], sizeof(NOTIFICATION)); - } + memmove(msglist, &msglist[1], (MAX_MSG_COUNT - 1) * (sizeof(NOTIFICATION))); nextMsgIndex = MAX_MSG_COUNT - 1; } @@ -148,18 +146,17 @@ void addNotification(DIALOG_TYPE style, char *title, char *text, bool ShowDialog msglist[nextMsgIndex].style = style; strncpy_no_pad(msglist[nextMsgIndex].text, text, MAX_MSG_LENGTH); strncpy_no_pad(msglist[nextMsgIndex].title, title, MAX_MSG_TITLE_LENGTH); + nextMsgIndex++; - if (ShowDialog && MENU_IS_NOT(menuNotification)) - popupReminder(style, (uint8_t *)title, (uint8_t *)msglist[nextMsgIndex].text); - - if (nextMsgIndex < MAX_MSG_COUNT) nextMsgIndex += 1; //(nextMsgIndex + 1) % MAX_MSG_COUNT; + if (draw_dialog && MENU_IS_NOT(menuNotification)) + popupReminder(style, (uint8_t *)title, (uint8_t *)text); if (notificationHandler != NULL) notificationHandler(); notificationDot(); - statusScreen_setMsg((uint8_t *)title, (uint8_t *)text); + statusScreenSetMsg((uint8_t *)title, (uint8_t *)text); } // replay a notification @@ -172,7 +169,7 @@ void replayNotification(uint8_t index) // retrieve a stored notification NOTIFICATION *getNotification(uint8_t index) { - if (strlen(msglist[index].title) > 0 && strlen(msglist[index].text) > 0) + if (msglist[index].title[0] != '\0' && msglist[index].text[0] != '\0') return &msglist[index]; else return NULL; @@ -180,10 +177,7 @@ NOTIFICATION *getNotification(uint8_t index) bool hasNotification(void) { - if (nextMsgIndex == 0) - return false; - else - return true; + return (nextMsgIndex != 0); } void clearNotification(void) @@ -191,11 +185,11 @@ void clearNotification(void) nextMsgIndex = 0; for (int i = 0; i < MAX_MSG_COUNT; i++) { - msglist[i].text[0] = 0; - msglist[i].title[0] = 0; + msglist[i].text[0] = '\0'; + msglist[i].title[0] = '\0'; } notificationDot(); - statusScreen_setReady(); + statusScreenSetReady(); } // check if pressed on titlebar area diff --git a/TFT/src/User/API/Notification.h b/TFT/src/User/API/Notification.h index dfebd867ba..169192805a 100644 --- a/TFT/src/User/API/Notification.h +++ b/TFT/src/User/API/Notification.h @@ -20,13 +20,6 @@ extern "C" { #define MAX_MSG_TITLE_LENGTH 15 #define MAX_MSG_LENGTH 70 -typedef struct -{ - DIALOG_TYPE style; - uint8_t isNew; - char text[TOAST_MSG_LENGTH]; -} TOAST; - typedef struct { DIALOG_TYPE style; diff --git a/TFT/src/User/API/RRFParseACK.cpp b/TFT/src/User/API/RRFParseACK.cpp index db707d1085..0cfa7ad6d2 100644 --- a/TFT/src/User/API/RRFParseACK.cpp +++ b/TFT/src/User/API/RRFParseACK.cpp @@ -209,19 +209,19 @@ void ParseACKJsonParser::value(const char *value) { setupMachine(FW_REPRAPFW); string_end = strstr(string_start, "ELECTRONICS"); - infoSetFirmwareName((uint8_t *)string_start, string_end-string_start); + infoSetFirmwareName(string_start, string_end-string_start); } else if ((string_start = strstr(value, (char *)"access point")) != NULL) // parse M552 { string_end = strstr(string_start, ","); string_start += 13; - infoSetAccessPoint((uint8_t *)string_start, string_end-string_start); + infoSetAccessPoint(string_start, string_end-string_start); if ((string_start = strstr(string_start, (char *)"IP address")) != NULL) { string_end = strstr(string_start, "\\n"); string_start += 11; - infoSetIPAddress((uint8_t *)string_start, string_end-string_start); + infoSetIPAddress(string_start, string_end-string_start); } } else if ((string_start = strstr(value, (char *)"printing byte")) != NULL) // parse M27 {"seq":21,"resp":"SD printing byte 1226/5040433\n"} diff --git a/TFT/src/User/API/interfaceCmd.c b/TFT/src/User/API/interfaceCmd.c index a6bc47f86f..bfbcf5adea 100644 --- a/TFT/src/User/API/interfaceCmd.c +++ b/TFT/src/User/API/interfaceCmd.c @@ -971,7 +971,7 @@ void sendQueueCmd(void) stripChecksum(rawMsg); msgText = stripHead(rawMsg); - statusScreen_setMsg((uint8_t *)"M117", (uint8_t *)msgText); + statusScreenSetMsg((uint8_t *)"M117", (uint8_t *)msgText); if (MENU_IS_NOT(menuStatus)) addToast(DIALOG_TYPE_INFO, (char *)msgText); diff --git a/TFT/src/User/API/parseACK.c b/TFT/src/User/API/parseACK.c index 6f871d1eb3..0b02651b3e 100644 --- a/TFT/src/User/API/parseACK.c +++ b/TFT/src/User/API/parseACK.c @@ -263,7 +263,7 @@ static void __attribute__ ((noinline)) hostActionCommands(void) } else { - statusScreen_setMsg((uint8_t *)magic_echo, (uint8_t *)ack_cache + index); // always display the notification on status screen + statusScreenSetMsg((uint8_t *)magic_echo, (uint8_t *)ack_cache + index); // always display the notification on status screen if (!ack_continue_seen("Ready.")) // avoid to display unneeded/frequent useless notifications (e.g. "My printer Ready.") { @@ -930,6 +930,12 @@ void parseACK(void) if (ack_continue_seen("Z:")) levelingSetProbedPoint(x, y, ack_value()); // save probed Z value } + // parse G30 coordinate unreachable message + else if (ack_seen("Z Probe Past Bed")) + { + levelingSetProbedPoint(infoSettings.machine_size_max[1] + 1, infoSettings.machine_size_max[2] + 1, 0); // cancel waiting for coordinates + BUZZER_PLAY(SOUND_ERROR); + } #if DELTA_PROBE_TYPE != 0 // parse and store Delta calibration settings else if (ack_seen("Calibration OK")) @@ -1212,7 +1218,7 @@ void parseACK(void) // parse M115 capability report else if (ack_seen("FIRMWARE_NAME:")) { - uint8_t * string = (uint8_t *)&ack_cache[ack_index]; + char * string = &ack_cache[ack_index]; uint16_t string_start = ack_index; uint16_t string_end = string_start; @@ -1234,7 +1240,7 @@ void parseACK(void) if (ack_seen("MACHINE_TYPE:")) { - string = (uint8_t *)&ack_cache[ack_index]; + string = &ack_cache[ack_index]; string_start = ack_index; if (ack_seen("EXTRUDER_COUNT:")) @@ -1245,7 +1251,7 @@ void parseACK(void) string_end = ack_index - sizeof("EXTRUDER_COUNT:"); } - infoSetMachineType(string, string_end - string_start); // set firmware name + infoSetMachineType(string, string_end - string_start); // set printer name } } else if (ack_starts_with("Cap:")) diff --git a/TFT/src/User/Configuration.h b/TFT/src/User/Configuration.h index b4656bda21..ba58123521 100644 --- a/TFT/src/User/Configuration.h +++ b/TFT/src/User/Configuration.h @@ -1117,7 +1117,7 @@ * Monitoring Debug * Uncomment/Enable to monitor/show system resources usage in Monitoring menu. */ -#define DEBUG_MONITORING // Default: commented (disabled) +//#define DEBUG_MONITORING // Default: commented (disabled) /** * Generic Debug diff --git a/TFT/src/User/Menu/LevelCorner.c b/TFT/src/User/Menu/LevelCorner.c index 722ac3f4b3..bfa5e039c9 100644 --- a/TFT/src/User/Menu/LevelCorner.c +++ b/TFT/src/User/Menu/LevelCorner.c @@ -1,7 +1,7 @@ #include "LevelCorner.h" #include "includes.h" -const uint8_t valIconIndex[LEVELING_POINT_COUNT] = {4, 5, 1, 0, 3}; +const uint8_t valIconIndex[LEVELING_POINT_COUNT] = {KEY_ICON_4, KEY_ICON_5, KEY_ICON_1, KEY_ICON_0, KEY_ICON_3}; // buffer current Z value measured in Level Corner = {position 1, position 2, position 3, position 4, probe accuracy(M48)} float levelCornerPosition[LEVELING_POINT_COUNT] = {0}; @@ -37,19 +37,6 @@ static void refreshValue(MENUITEMS * levelItems, uint8_t index) menuDrawIconText(&levelItems->items[valIconIndex[index]], valIconIndex[index]); } -static void checkRefreshValue(MENUITEMS * levelItems) -{ - LEVELING_POINT levelingPoint = levelingGetProbedPoint(); - - if (levelingPoint != LEVEL_NO_POINT) - { - levelCornerPosition[levelingPoint] = levelingGetProbedZ(); - refreshValue(levelItems, levelingPoint); - - levelingResetProbedPoint(); // reset to check for new updates - } -} - // show M48 on icon static void drawProbeAccuracyIcon(MENUITEMS * levelItems) { @@ -129,11 +116,25 @@ void menuLevelCorner(void) switch (key_num) { case KEY_ICON_0: - levelingProbePoint(LEVEL_TOP_LEFT); - break; - case KEY_ICON_1: - levelingProbePoint(LEVEL_TOP_RIGHT); + case KEY_ICON_4: + case KEY_ICON_5: + case KEY_ICON_6: + for (int lvlPoint = LEVEL_BOTTOM_LEFT; lvlPoint <= LEVEL_TOP_LEFT; lvlPoint++) + { + if (key_num < KEY_ICON_6 && key_num != valIconIndex[lvlPoint]) + continue; + + levelingProbePoint(lvlPoint); + + // wait until point probing is executed + TASK_LOOP_WHILE(levelingGetProbedPoint() == LEVEL_NO_POINT); + + levelCornerPosition[lvlPoint] = levelingGetProbedZ(); + refreshValue(&levelCornerItems, lvlPoint); + levelingResetProbedPoint(); // reset to check for new updates + } + break; case KEY_ICON_2: @@ -155,25 +156,6 @@ void menuLevelCorner(void) drawProbeAccuracyIcon(&levelCornerItems); break; - case KEY_ICON_4: - levelingProbePoint(LEVEL_BOTTOM_LEFT); - break; - - case KEY_ICON_5: - levelingProbePoint(LEVEL_BOTTOM_RIGHT); - break; - - case KEY_ICON_6: - for (int i = LEVEL_BOTTOM_LEFT; i <= LEVEL_TOP_LEFT; i++) - { - levelingProbePoint(i); - - // following loop needed to guarantee the value for each point beeing probed is updated at least one time on the menu - TASK_LOOP_WHILE(isNotEmptyCmdQueue(), checkRefreshValue(&levelCornerItems)); - } - - break; - case KEY_ICON_7: infoSettings.level_edge = origLevelEdge; // restore original leveling edge value origLevelEdge = -1; @@ -185,7 +167,5 @@ void menuLevelCorner(void) } loopProcess(); - - checkRefreshValue(&levelCornerItems); } } diff --git a/TFT/src/User/Menu/Move.c b/TFT/src/User/Menu/Move.c index f6272f4f96..557556bf08 100644 --- a/TFT/src/User/Menu/Move.c +++ b/TFT/src/User/Menu/Move.c @@ -5,9 +5,9 @@ moveItems.items[p0].label.index = LABEL_##axis##_##dir0; \ moveItems.items[p1].label.index = LABEL_##axis##_##dir1; \ } while(0) -#define X_MOVE_GCODE "G1 X%.2f F%d\n" -#define Y_MOVE_GCODE "G1 Y%.2f F%d\n" -#define Z_MOVE_GCODE "G1 Z%.2f F%d\n" +#define X_MOVE_GCODE "G0 X%.2f F%d\n" +#define Y_MOVE_GCODE "G0 Y%.2f F%d\n" +#define Z_MOVE_GCODE "G0 Z%.2f F%d\n" #define GANTRY_UPDATE_DELAY 500 // 1 seconds is 1000 #ifdef PORTRAIT_MODE @@ -170,7 +170,6 @@ void menuMove(void) moveItems.items[key_num] = itemMoveLen[item_moveLen_index]; menuDrawItem(&moveItems.items[key_num], key_num); - amount = moveLenSteps[item_moveLen_index]; break; diff --git a/TFT/src/User/Menu/ScreenSettings.c b/TFT/src/User/Menu/ScreenSettings.c index 8100fef9ff..4808ac970c 100644 --- a/TFT/src/User/Menu/ScreenSettings.c +++ b/TFT/src/User/Menu/ScreenSettings.c @@ -268,7 +268,7 @@ void menuLanguage(void) if (memcmp(&now, &infoSettings, sizeof(SETTINGS))) { - statusScreen_setReady(); // restore msg buffer when language is changed + statusScreenSetReady(); // restore msg buffer when language is changed storePara(); } } diff --git a/TFT/src/User/Menu/SettingsMenu.c b/TFT/src/User/Menu/SettingsMenu.c index 6d854c344e..a369c4c609 100644 --- a/TFT/src/User/Menu/SettingsMenu.c +++ b/TFT/src/User/Menu/SettingsMenu.c @@ -25,58 +25,34 @@ const MENUITEMS settingsItems = { // {1 * LCD_WIDTH / 3, 1 * BYTE_HEIGHT}, // {2 * LCD_WIDTH / 3, 1 * BYTE_HEIGHT},}; -static uint8_t firmare_name[64] = "Unknown system"; // Marlin firmware version -uint8_t machine_type[64] = "3D Printer"; // Marlin machine type -uint8_t access_point[64] = "Connecting..."; // Access point for RepRapFirmware -uint8_t ip_address[20] = "0.0.0.0"; // IP address for RepRapFirmware +static char firmware_name[64] = "Unknown system"; // Marlin firmware version +char machine_type[64] = "3D Printer"; // Marlin machine type +static char access_point[64] = "Connecting..."; // Access point for RepRapFirmware +static char ip_address[20] = "0.0.0.0"; // IP address for RepRapFirmware -void infoSetFirmwareName(uint8_t *name, uint8_t name_len) +void infoSetFirmwareName(char * name, uint8_t name_len) { - if (name_len > sizeof(firmare_name) - 1) - name_len = sizeof(firmare_name) - 1; - uint8_t i; - for (i = 0; i < name_len; i++) - { - firmare_name[i] = name[i]; - } - firmare_name[i] = 0; + name_len++; // add space for terminal '\0' character + strncpy_no_pad(firmware_name, name, MIN(sizeof(firmware_name), name_len)); } -void infoSetMachineType(uint8_t *machine, uint8_t type_len) +void infoSetMachineType(char * machine, uint8_t type_len) { - if (type_len > sizeof(machine_type) - 1) - type_len = sizeof(machine_type) - 1; - uint8_t i; - for (i = 0; i < type_len; i++) - { - machine_type[i] = machine[i]; - } - machine_type[i] = 0; - statusScreen_setReady(); + type_len++; // add space for terminal '\0' character + strncpy_no_pad(machine_type, machine, MIN(sizeof(machine_type), type_len)); + statusScreenSetReady(); } -void infoSetAccessPoint(uint8_t *ssid, uint8_t ssid_len) +void infoSetAccessPoint(char * ssid, uint8_t ssid_len) { - if (ssid_len > sizeof(access_point) - 1) - ssid_len = sizeof(access_point) - 1; - uint8_t i; - for (i = 0; i < ssid_len; i++) - { - access_point[i] = ssid[i]; - } - access_point[i] = 0; + ssid_len++; // add space for terminal '\0' character + strncpy_no_pad(access_point, ssid, MIN(sizeof(access_point), ssid_len)); } -void infoSetIPAddress(uint8_t *ip, uint8_t ip_len) +void infoSetIPAddress(char * ip, uint8_t ip_len) { - if (ip_len > sizeof(ip_address) - 1) - ip_len = sizeof(ip_address) - 1; - uint8_t i; - for (i = 0; i < ip_len; i++) - { - ip_address[i] = ip[i]; - } - ip_address[i] = 0; + ip_len++; // add space for terminal '\0' character + strncpy_no_pad(ip_address, ip, MIN(sizeof(ip_address), ip_len)); } // Version infomation @@ -135,8 +111,8 @@ void menuInfo(void) // draw info GUI_SetColor(0xDB40); - GUI_DispStringInPrectEOL(&version[0], firmare_name); - GUI_DispStringInPrectEOL(&version[1], machine_type); + GUI_DispStringInPrectEOL(&version[0], (uint8_t *)firmware_name); + GUI_DispStringInPrectEOL(&version[1], (uint8_t *)machine_type); GUI_DispStringInPrectEOL(&version[2], (uint8_t *)hardware); sprintf(buf, "V"STRINGIFY(SOFTWARE_VERSION) " " __DATE__ " in %dMhz", mcuClocks.rccClocks.SYSCLK_Frequency / 1000000); GUI_DispStringInPrectEOL(&version[3], (uint8_t *)buf); @@ -156,9 +132,9 @@ void menuInfo(void) GUI_DispStringInRect(20, LCD_HEIGHT - (BYTE_HEIGHT*2), LCD_WIDTH-20, LCD_HEIGHT, textSelect(LABEL_TOUCH_TO_EXIT)); - while (!isPress()) loopBackEnd(); + while (!isPress()) { loopBackEnd(); } BUZZER_PLAY(SOUND_KEYPRESS); - while (isPress()) loopBackEnd(); + while (isPress()) { loopBackEnd(); } GUI_RestoreColorDefault(); CLOSE_MENU(); diff --git a/TFT/src/User/Menu/SettingsMenu.h b/TFT/src/User/Menu/SettingsMenu.h index 4336796c94..9f295ffe85 100644 --- a/TFT/src/User/Menu/SettingsMenu.h +++ b/TFT/src/User/Menu/SettingsMenu.h @@ -7,12 +7,12 @@ extern "C" { #include -extern uint8_t machine_type[64]; +extern char machine_type[64]; -void infoSetFirmwareName(uint8_t *name, uint8_t name_len); -void infoSetMachineType(uint8_t *machine, uint8_t type_len); -void infoSetAccessPoint(uint8_t *ssid, uint8_t ssid_len); -void infoSetIPAddress(uint8_t *ip, uint8_t ip_len); +void infoSetFirmwareName(char * name, uint8_t name_len); +void infoSetMachineType(char * machine, uint8_t type_len); +void infoSetAccessPoint(char * ssid, uint8_t ssid_len); +void infoSetIPAddress(char * ip, uint8_t ip_len); void menuInfo(void); void menuSettings(void); diff --git a/TFT/src/User/Menu/StatusScreen.c b/TFT/src/User/Menu/StatusScreen.c index 2adc623ae2..d7c625ce69 100644 --- a/TFT/src/User/Menu/StatusScreen.c +++ b/TFT/src/User/Menu/StatusScreen.c @@ -200,21 +200,21 @@ static void drawStatus(void) GUI_RestoreColorDefault(); } -void statusScreen_setMsg(const uint8_t *title, const uint8_t *msg) +void statusScreenSetMsg(const uint8_t *title, const uint8_t *msg) { strncpy_no_pad(msgTitle, (char *)title, sizeof(msgTitle)); strncpy_no_pad(msgBody, (char *)msg, sizeof(msgBody)); msgNeedRefresh = true; } -void statusScreen_setReady(void) +void statusScreenSetReady(void) { strncpy_no_pad(msgTitle, (char *)textSelect(LABEL_STATUS), sizeof(msgTitle)); if (infoHost.connected == false) strncpy_no_pad(msgBody, (char *)textSelect(LABEL_UNCONNECTED), sizeof(msgBody)); else - snprintf(msgBody, sizeof(msgBody), "%s %s", (char *)machine_type, (char *)textSelect(LABEL_READY)); + snprintf(msgBody, sizeof(msgBody), "%s %s", machine_type, (char *)textSelect(LABEL_READY)); msgNeedRefresh = true; } @@ -296,7 +296,7 @@ void menuStatus(void) { if (infoHost.connected != lastConnectionStatus) { - statusScreen_setReady(); + statusScreenSetReady(); lastConnectionStatus = infoHost.connected; } diff --git a/TFT/src/User/Menu/StatusScreen.h b/TFT/src/User/Menu/StatusScreen.h index ffecc99a47..79673477bf 100644 --- a/TFT/src/User/Menu/StatusScreen.h +++ b/TFT/src/User/Menu/StatusScreen.h @@ -10,9 +10,9 @@ extern "C" { extern const GUI_RECT msgRect; -void statusScreen_setMsg(const uint8_t *title,const uint8_t *msg); -void statusScreen_setReady(void); void menuStatus(void); +void statusScreenSetMsg(const uint8_t *title,const uint8_t *msg); +void statusScreenSetReady(void); #ifdef __cplusplus } diff --git a/TFT/src/User/my_misc.h b/TFT/src/User/my_misc.h index 2ce0a59e49..d021c3cc17 100644 --- a/TFT/src/User/my_misc.h +++ b/TFT/src/User/my_misc.h @@ -69,12 +69,12 @@ extern "C" { // call processes from the argument and than loopProcessAndGUI() while condition is true // tasks from argument must be separated by ";" ("TASK_LOOP_WHILE(condition, task1(); task2(); ...)) -#define TASK_LOOP_WHILE(condition, ...) \ - while (condition) \ - { \ - __VA_ARGS__; \ - loopProcessAndGUI(); \ - } +#define TASK_LOOP_WHILE(condition, ...) \ + while(condition) \ + { \ + __VA_ARGS__; \ + loopProcessAndGUI(); \ + } uint8_t inRange(int cur, int tag , int range); long map(long x, long in_min, long in_max, long out_min, long out_max);