ソースを参照

Clean up, optimize ExtUI/TFT code (#21333)

Scott Lahteine 3年前
コミット
1affbe2100
コミッターのメールアドレスに関連付けられたアカウントが存在しません

+ 1
- 1
Marlin/src/feature/bedlevel/bedlevel.cpp ファイルの表示

@@ -98,7 +98,7 @@ TemporaryBedLevelingState::TemporaryBedLevelingState(const bool enable) : saved(
98 98
 
99 99
 #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
100 100
 
101
-  void set_z_fade_height(const float zfh, const bool do_report/*=true*/) {
101
+  void set_z_fade_height(const float &zfh, const bool do_report/*=true*/) {
102 102
 
103 103
     if (planner.z_fade_height == zfh) return;
104 104
 

+ 1
- 1
Marlin/src/feature/bedlevel/bedlevel.h ファイルの表示

@@ -38,7 +38,7 @@ void set_bed_leveling_enabled(const bool enable=true);
38 38
 void reset_bed_level();
39 39
 
40 40
 #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
41
-  void set_z_fade_height(const float zfh, const bool do_report=true);
41
+  void set_z_fade_height(const float &zfh, const bool do_report=true);
42 42
 #endif
43 43
 
44 44
 #if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY)

+ 4
- 4
Marlin/src/lcd/extui/anycubic_chiron_lcd.cpp ファイルの表示

@@ -74,7 +74,7 @@ namespace ExtUI {
74 74
     // into buff.
75 75
 
76 76
     // Example:
77
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
77
+    //  static_assert(sizeof(myDataStruct) <= eeprom_data_size);
78 78
     //  memcpy(buff, &myDataStruct, sizeof(myDataStruct));
79 79
   }
80 80
 
@@ -84,7 +84,7 @@ namespace ExtUI {
84 84
     // from buff
85 85
 
86 86
     // Example:
87
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
87
+    //  static_assert(sizeof(myDataStruct) <= eeprom_data_size);
88 88
     //  memcpy(&myDataStruct, buff, sizeof(myDataStruct));
89 89
   }
90 90
 
@@ -101,12 +101,12 @@ namespace ExtUI {
101 101
   #if HAS_MESH
102 102
     void onMeshLevelingStart() {}
103 103
 
104
-    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
104
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float &zval) {
105 105
       // Called when any mesh points are updated
106 106
       //SERIAL_ECHOLNPAIR("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
107 107
     }
108 108
 
109
-    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {
109
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) {
110 110
       // Called to indicate a special condition
111 111
       //SERIAL_ECHOLNPAIR("onMeshUpdate() x:", xpos, " y:", ypos, " state:", state);
112 112
     }

+ 3
- 3
Marlin/src/lcd/extui/anycubic_i3mega_lcd.cpp ファイルの表示

@@ -65,7 +65,7 @@ namespace ExtUI {
65 65
     // into buff.
66 66
 
67 67
     // Example:
68
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
68
+    //  static_assert(sizeof(myDataStruct) <= eeprom_data_size);
69 69
     //  memcpy(buff, &myDataStruct, sizeof(myDataStruct));
70 70
   }
71 71
 
@@ -75,7 +75,7 @@ namespace ExtUI {
75 75
     // from buff
76 76
 
77 77
     // Example:
78
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
78
+    //  static_assert(sizeof(myDataStruct) <= eeprom_data_size);
79 79
     //  memcpy(&myDataStruct, buff, sizeof(myDataStruct));
80 80
   }
81 81
 
@@ -93,7 +93,7 @@ namespace ExtUI {
93 93
 
94 94
     void onMeshLevelingStart() {}
95 95
 
96
-    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
96
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float &zval) {
97 97
       // Called when any mesh points are updated
98 98
     }
99 99
   #endif

+ 5
- 5
Marlin/src/lcd/extui/dgus_lcd.cpp ファイルの表示

@@ -61,7 +61,7 @@ namespace ExtUI {
61 61
   void onUserConfirmRequired(const char * const msg) {
62 62
     if (msg) {
63 63
       ScreenHandler.sendinfoscreen(PSTR("Please confirm."), nullptr, msg, nullptr, true, true, false, true);
64
-      ScreenHandler.SetupConfirmAction(ExtUI::setUserConfirmed);
64
+      ScreenHandler.SetupConfirmAction(setUserConfirmed);
65 65
       ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
66 66
     }
67 67
     else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP ) {
@@ -84,7 +84,7 @@ namespace ExtUI {
84 84
     // into buff.
85 85
 
86 86
     // Example:
87
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
87
+    //  static_assert(sizeof(myDataStruct) <= eeprom_data_size);
88 88
     //  memcpy(buff, &myDataStruct, sizeof(myDataStruct));
89 89
   }
90 90
 
@@ -94,7 +94,7 @@ namespace ExtUI {
94 94
     // from buff
95 95
 
96 96
     // Example:
97
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
97
+    //  static_assert(sizeof(myDataStruct) <= eeprom_data_size);
98 98
     //  memcpy(&myDataStruct, buff, sizeof(myDataStruct));
99 99
   }
100 100
 
@@ -111,11 +111,11 @@ namespace ExtUI {
111 111
   #if HAS_MESH
112 112
     void onMeshLevelingStart() {}
113 113
 
114
-    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
114
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float &zval) {
115 115
       // Called when any mesh points are updated
116 116
     }
117 117
 
118
-    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {
118
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) {
119 119
       // Called to indicate a special condition
120 120
     }
121 121
   #endif

+ 4
- 4
Marlin/src/lcd/extui/example.cpp ファイルの表示

@@ -70,7 +70,7 @@ namespace ExtUI {
70 70
     // into buff.
71 71
 
72 72
     // Example:
73
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
73
+    //  static_assert(sizeof(myDataStruct) <= eeprom_data_size);
74 74
     //  memcpy(buff, &myDataStruct, sizeof(myDataStruct));
75 75
   }
76 76
 
@@ -80,7 +80,7 @@ namespace ExtUI {
80 80
     // from buff
81 81
 
82 82
     // Example:
83
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
83
+    //  static_assert(sizeof(myDataStruct) <= eeprom_data_size);
84 84
     //  memcpy(&myDataStruct, buff, sizeof(myDataStruct));
85 85
   }
86 86
 
@@ -97,11 +97,11 @@ namespace ExtUI {
97 97
   #if HAS_MESH
98 98
     void onMeshLevelingStart() {}
99 99
 
100
-    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
100
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float &zval) {
101 101
       // Called when any mesh points are updated
102 102
     }
103 103
 
104
-    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {
104
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) {
105 105
       // Called to indicate a special condition
106 106
     }
107 107
   #endif

+ 1
- 1
Marlin/src/lcd/extui/lib/anycubic_chiron/FileNavigator.cpp ファイルの表示

@@ -73,7 +73,7 @@ namespace Anycubic {
73 73
     // Each time we change folder we reset the file index to 0 and keep track
74 74
     // of the current position as the TFT panel isnt aware of folders trees.
75 75
     if (index > 0) {
76
-      --currentindex; // go back a file to take account off the .. we added to the root.
76
+      --currentindex; // go back a file to take account of the .. added to the root.
77 77
       if (index > lastindex)
78 78
         currentindex += files;
79 79
       else

+ 3
- 2
Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp ファイルの表示

@@ -288,7 +288,7 @@ namespace Anycubic {
288 288
     SERIAL_ECHOLNPGM("Select SD file then press resume");
289 289
   }
290 290
 
291
-  void ChironTFT::SendtoTFT(PGM_P str) {  // A helper to print PROGMEN string to the panel
291
+  void ChironTFT::SendtoTFT(PGM_P str) {  // A helper to print PROGMEM string to the panel
292 292
     #if ACDEBUG(AC_SOME)
293 293
       SERIAL_ECHOPGM_P(str);
294 294
     #endif
@@ -880,6 +880,7 @@ namespace Anycubic {
880 880
       }  break;
881 881
     }
882 882
   }
883
-} // namespace
883
+
884
+} // Anycubic
884 885
 
885 886
 #endif // ANYCUBIC_LCD_CHIRON

+ 35
- 32
Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.h ファイルの表示

@@ -32,46 +32,49 @@
32 32
 #include "chiron_tft_defs.h"
33 33
 #include "../../../../inc/MarlinConfigPre.h"
34 34
 #include "../../ui_api.h"
35
+
35 36
 namespace Anycubic {
36 37
 
37 38
   class ChironTFT {
38
-    static printer_state_t  printer_state;
39
-    static paused_state_t   pause_state;
40
-    static heater_state_t   hotend_state;
41
-    static heater_state_t   hotbed_state;
42
-    static xy_uint8_t       selectedmeshpoint;
43
-    static char             panel_command[MAX_CMND_LEN];
44
-    static uint8_t          command_len;
45
-    static char             selectedfile[MAX_PATH_LEN];
46
-    static float            live_Zoffset;
47
-    static file_menu_t      file_menu;
39
+    private:
40
+      static printer_state_t  printer_state;
41
+      static paused_state_t   pause_state;
42
+      static heater_state_t   hotend_state;
43
+      static heater_state_t   hotbed_state;
44
+      static xy_uint8_t       selectedmeshpoint;
45
+      static char             panel_command[MAX_CMND_LEN];
46
+      static uint8_t          command_len;
47
+      static char             selectedfile[MAX_PATH_LEN];
48
+      static float            live_Zoffset;
49
+      static file_menu_t      file_menu;
50
+
48 51
     public:
49 52
       ChironTFT();
50
-      void Startup();
51
-      void IdleLoop();
52
-      void PrinterKilled(PGM_P,PGM_P);
53
-      void MediaEvent(media_event_t);
54
-      void TimerEvent(timer_event_t);
55
-      void FilamentRunout();
56
-      void ConfirmationRequest(const char * const );
57
-      void StatusChange(const char * const );
58
-      void PowerLossRecovery();
53
+      static void Startup();
54
+      static void IdleLoop();
55
+      static void PrinterKilled(PGM_P,PGM_P);
56
+      static void MediaEvent(media_event_t);
57
+      static void TimerEvent(timer_event_t);
58
+      static void FilamentRunout();
59
+      static void ConfirmationRequest(const char * const );
60
+      static void StatusChange(const char * const );
61
+      static void PowerLossRecovery();
59 62
 
60 63
     private:
61
-      void SendtoTFT(PGM_P);
62
-      void SendtoTFTLN(PGM_P);
63
-      bool ReadTFTCommand();
64
-      int8_t Findcmndpos(const char *, char);
65
-      void CheckHeaters();
66
-      void SendFileList(int8_t);
67
-      void SelectFile();
68
-      void InjectCommandandWait(PGM_P);
69
-      void ProcessPanelRequest();
70
-      void PanelInfo(uint8_t);
71
-      void PanelAction(uint8_t);
72
-      void PanelProcess(uint8_t);
64
+      static void SendtoTFT(PGM_P);
65
+      static void SendtoTFTLN(PGM_P);
66
+      static bool ReadTFTCommand();
67
+      static int8_t Findcmndpos(const char *, char);
68
+      static void CheckHeaters();
69
+      static void SendFileList(int8_t);
70
+      static void SelectFile();
71
+      static void InjectCommandandWait(PGM_P);
72
+      static void ProcessPanelRequest();
73
+      static void PanelInfo(uint8_t);
74
+      static void PanelAction(uint8_t);
75
+      static void PanelProcess(uint8_t);
73 76
   };
74 77
 
75 78
   extern ChironTFT Chiron;
76 79
 
77
-}
80
+} // Anycubic

+ 3
- 1
Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h ファイルの表示

@@ -109,6 +109,7 @@
109 109
 #define AC_cmnd_power_loss_recovery    PSTR("G28XYR5\nG28Z")           // Lift, home X and Y then home Z when in 'safe' position
110 110
 
111 111
 namespace Anycubic {
112
+
112 113
   enum heater_state_t : uint8_t {
113 114
     AC_heater_off,
114 115
     AC_heater_temp_set,
@@ -148,4 +149,5 @@ namespace Anycubic {
148 149
     AC_menu_change_to_file,
149 150
     AC_menu_change_to_command
150 151
   };
151
-}
152
+
153
+} // Anycubic

+ 119
- 117
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp ファイルの表示

@@ -2,7 +2,7 @@
2 2
  * anycubic_i3mega_lcd.cpp  --- Support for Anycubic i3 Mega TFT
3 3
  * Created by Christian Hopp on 09.12.17.
4 4
  * Improved by David Ramiro
5
- * Converted to ext_iu by John BouAntoun 21 June 2020
5
+ * Converted to ExtUI by John BouAntoun 21 June 2020
6 6
  *
7 7
  * This library is free software; you can redistribute it and/or
8 8
  * modify it under the terms of the GNU Lesser General Public
@@ -32,44 +32,46 @@
32 32
 #include "../../../../inc/MarlinConfig.h"
33 33
 
34 34
 // command sending macro's with debugging capability
35
-#define SEND_PGM(x)                                 send_P(PSTR(x))
36
-#define SENDLINE_PGM(x)                             sendLine_P(PSTR(x))
37
-#define SEND_PGM_VAL(x,y)                           (send_P(PSTR(x)), sendLine(i16tostr3rj(y)))
38
-#define SEND(x)                                     send(x)
39
-#define SENDLINE(x)                                 sendLine(x)
35
+#define SEND_PGM(x)       send_P(PSTR(x))
36
+#define SENDLINE_PGM(x)   sendLine_P(PSTR(x))
37
+#define SEND_PGM_VAL(x,y) (send_P(PSTR(x)), sendLine(i16tostr3rj(y)))
38
+#define SEND(x)           send(x)
39
+#define SENDLINE(x)       sendLine(x)
40 40
 #if ENABLED(ANYCUBIC_LCD_DEBUG)
41
-  #define SENDLINE_DBG_PGM(x,y)                     (sendLine_P(PSTR(x)), SERIAL_ECHOLNPGM(y))
42
-  #define SENDLINE_DBG_PGM_VAL(x,y,z)               (sendLine_P(PSTR(x)), SERIAL_ECHOPGM(y), SERIAL_ECHOLN(z))
41
+  #define SENDLINE_DBG_PGM(x,y)       (sendLine_P(PSTR(x)), SERIAL_ECHOLNPGM(y))
42
+  #define SENDLINE_DBG_PGM_VAL(x,y,z) (sendLine_P(PSTR(x)), SERIAL_ECHOPGM(y), SERIAL_ECHOLN(z))
43 43
 #else
44
-  #define SENDLINE_DBG_PGM(x,y)                     sendLine_P(PSTR(x))
45
-  #define SENDLINE_DBG_PGM_VAL(x,y,z)               sendLine_P(PSTR(x))
44
+  #define SENDLINE_DBG_PGM(x,y)       sendLine_P(PSTR(x))
45
+  #define SENDLINE_DBG_PGM_VAL(x,y,z) sendLine_P(PSTR(x))
46 46
 #endif
47 47
 
48 48
 AnycubicTFTClass AnycubicTFT;
49 49
 
50
-static void sendNewLine(void) {
51
-  LCD_SERIAL.write('\r');
52
-  LCD_SERIAL.write('\n');
53
-}
54
-
55
-static void send(const char *str) {
56
-  LCD_SERIAL.print(str);
57
-}
58
-
59
-static void sendLine(const char *str) {
60
-  send(str);
61
-  sendNewLine();
62
-}
63
-
50
+char AnycubicTFTClass::TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
51
+int AnycubicTFTClass::TFTbuflen = 0,
52
+    AnycubicTFTClass::TFTbufindr = 0,
53
+    AnycubicTFTClass::TFTbufindw = 0;
54
+char AnycubicTFTClass::serial3_char;
55
+int AnycubicTFTClass::serial3_count = 0;
56
+char* AnycubicTFTClass::TFTstrchr_pointer;
57
+uint8_t AnycubicTFTClass::SpecialMenu = false;
58
+AnycubicMediaPrintState AnycubicTFTClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
59
+AnycubicMediaPauseState AnycubicTFTClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
60
+
61
+char AnycubicTFTClass::SelectedDirectory[30];
62
+char AnycubicTFTClass::SelectedFile[FILENAME_LENGTH];
63
+
64
+// Serial helpers
65
+static void sendNewLine(void) { LCD_SERIAL.write('\r'); LCD_SERIAL.write('\n'); }
66
+static void send(const char *str) { LCD_SERIAL.print(str); }
64 67
 static void send_P(PGM_P str) {
65 68
   while (const char c = pgm_read_byte(str++))
66 69
     LCD_SERIAL.write(c);
67 70
 }
71
+static void sendLine(const char *str) { send(str); sendNewLine(); }
72
+static void sendLine_P(PGM_P str) { send_P(str); sendNewLine(); }
68 73
 
69
-static void sendLine_P(PGM_P str) {
70
-  send_P(str);
71
-  sendNewLine();
72
-}
74
+using namespace ExtUI;
73 75
 
74 76
 AnycubicTFTClass::AnycubicTFTClass() {}
75 77
 
@@ -80,7 +82,7 @@ void AnycubicTFTClass::OnSetup() {
80 82
   LCD_SERIAL.begin(LCD_BAUDRATE);
81 83
 
82 84
   SENDLINE_DBG_PGM("J17", "TFT Serial Debug: Main board reset... J17"); // J17 Main board reset
83
-  ExtUI::delay_ms(10);
85
+  delay_ms(10);
84 86
 
85 87
   // initialise the state of the key pins running on the tft
86 88
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
@@ -95,13 +97,13 @@ void AnycubicTFTClass::OnSetup() {
95 97
 
96 98
   // DoSDCardStateCheck();
97 99
   SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12"); // J12 Ready
98
-  ExtUI::delay_ms(10);
100
+  delay_ms(10);
99 101
 
100 102
   DoFilamentRunoutCheck();
101 103
   SelectedFile[0] = 0;
102 104
 
103 105
   #if ENABLED(STARTUP_CHIME)
104
-    ExtUI::injectCommands_P(PSTR("M300 P250 S554\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P500 S831"));
106
+    injectCommands_P(PSTR("M300 P250 S554\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P500 S831"));
105 107
   #endif
106 108
   #if ENABLED(ANYCUBIC_LCD_DEBUG)
107 109
     SERIAL_ECHOLNPGM("TFT Serial Debug: Finished startup");
@@ -119,8 +121,8 @@ void AnycubicTFTClass::OnCommandScan() {
119 121
       #endif
120 122
       mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
121 123
       mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
122
-      ExtUI::injectCommands_P(PSTR("M84\nM27")); // disable stepper motors and force report of SD status
123
-      ExtUI::delay_ms(200);
124
+      injectCommands_P(PSTR("M84\nM27")); // disable stepper motors and force report of SD status
125
+      delay_ms(200);
124 126
       // tell printer to release resources of print to indicate it is done
125 127
       SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Stopped... J14");
126 128
     }
@@ -224,8 +226,8 @@ bool AnycubicTFTClass::CodeSeen(char code) {
224 226
 }
225 227
 
226 228
 bool AnycubicTFTClass::IsNozzleHomed() {
227
-  const float xPosition = ExtUI::getAxisPosition_mm((ExtUI::axis_t) ExtUI::X);
228
-  const float yPosition = ExtUI::getAxisPosition_mm((ExtUI::axis_t) ExtUI::Y);
229
+  const float xPosition = getAxisPosition_mm((axis_t) X);
230
+  const float yPosition = getAxisPosition_mm((axis_t) Y);
229 231
   return WITHIN(xPosition, X_MIN_POS - 0.1, X_MIN_POS + 0.1) &&
230 232
          WITHIN(yPosition, Y_MIN_POS - 0.1, Y_MIN_POS + 0.1);
231 233
 }
@@ -246,48 +248,48 @@ void AnycubicTFTClass::HandleSpecialMenu() {
246 248
             switch (SelectedDirectory[2]) {
247 249
               case '1': // "<01ZUp0.1>"
248 250
                 SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1");
249
-                ExtUI::injectCommands_P(PSTR("G91\nG1 Z+0.1\nG90"));
251
+                injectCommands_P(PSTR("G91\nG1 Z+0.1\nG90"));
250 252
                 break;
251 253
 
252 254
               case '2': // "<02ZUp0.02>"
253 255
                 SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02");
254
-                ExtUI::injectCommands_P(PSTR("G91\nG1 Z+0.02\nG90"));
256
+                injectCommands_P(PSTR("G91\nG1 Z+0.02\nG90"));
255 257
                 break;
256 258
 
257 259
               case '3': // "<03ZDn0.02>"
258 260
                 SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02");
259
-                ExtUI::injectCommands_P(PSTR("G91\nG1 Z-0.02\nG90"));
261
+                injectCommands_P(PSTR("G91\nG1 Z-0.02\nG90"));
260 262
                 break;
261 263
 
262 264
               case '4': // "<04ZDn0.1>"
263 265
                 SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1");
264
-                ExtUI::injectCommands_P(PSTR("G91\nG1 Z-0.1\nG90"));
266
+                injectCommands_P(PSTR("G91\nG1 Z-0.1\nG90"));
265 267
                 break;
266 268
 
267 269
               case '5': // "<05PrehtBed>"
268 270
                 SERIAL_ECHOLNPGM("Special Menu: Preheat Bed");
269
-                ExtUI::injectCommands_P(PSTR("M140 S65"));
271
+                injectCommands_P(PSTR("M140 S65"));
270 272
                 break;
271 273
 
272 274
               case '6': // "<06SMeshLvl>"
273 275
                 SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling");
274
-                ExtUI::injectCommands_P(PSTR("G29S1"));
276
+                injectCommands_P(PSTR("G29S1"));
275 277
                 break;
276 278
 
277 279
               case '7': // "<07MeshNPnt>"
278 280
                 SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point");
279
-                ExtUI::injectCommands_P(PSTR("G29S2"));
281
+                injectCommands_P(PSTR("G29S2"));
280 282
                 break;
281 283
 
282 284
               case '8': // "<08HtEndPID>"
283 285
                 SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID");
284 286
                 // need to dwell for half a second to give the fan a chance to start before the pid tuning starts
285
-                ExtUI::injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1"));
287
+                injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1"));
286 288
                 break;
287 289
 
288 290
               case '9': // "<09HtBedPID>"
289 291
                 SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid");
290
-                ExtUI::injectCommands_P(PSTR("M303 E-1 S65 C6 U1"));
292
+                injectCommands_P(PSTR("M303 E-1 S65 C6 U1"));
291 293
                 break;
292 294
 
293 295
               default:
@@ -299,12 +301,12 @@ void AnycubicTFTClass::HandleSpecialMenu() {
299 301
             switch (SelectedDirectory[2]) {
300 302
               case '0': // "<10FWDeflts>"
301 303
                 SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
302
-                ExtUI::injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108"));
304
+                injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108"));
303 305
                 break;
304 306
 
305 307
               case '1': // "<11SvEEPROM>"
306 308
                 SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
307
-                ExtUI::injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661"));
309
+                injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661"));
308 310
                 break;
309 311
 
310 312
               default:
@@ -316,38 +318,38 @@ void AnycubicTFTClass::HandleSpecialMenu() {
316 318
             switch (SelectedDirectory[2]) {
317 319
               case '1': // "<01PrehtBed>"
318 320
                 SERIAL_ECHOLNPGM("Special Menu: Preheat Bed");
319
-                ExtUI::injectCommands_P(PSTR("M140 S65"));
321
+                injectCommands_P(PSTR("M140 S65"));
320 322
                 break;
321 323
 
322 324
               case '2': // "<02ABL>"
323 325
                 SERIAL_ECHOLNPGM("Special Menu: Auto Bed Leveling");
324
-                ExtUI::injectCommands_P(PSTR("G29N"));
326
+                injectCommands_P(PSTR("G29N"));
325 327
                 break;
326 328
 
327 329
               case '3': // "<03HtendPID>"
328 330
                 SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID");
329 331
                 // need to dwell for half a second to give the fan a chance to start before the pid tuning starts
330
-                ExtUI::injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1"));
332
+                injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1"));
331 333
                 break;
332 334
 
333 335
               case '4': // "<04HtbedPID>"
334 336
                 SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid");
335
-                ExtUI::injectCommands_P(PSTR("M303 E-1 S65 C6 U1"));
337
+                injectCommands_P(PSTR("M303 E-1 S65 C6 U1"));
336 338
                 break;
337 339
 
338 340
               case '5': // "<05FWDeflts>"
339 341
                 SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
340
-                ExtUI::injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108"));
342
+                injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108"));
341 343
                 break;
342 344
 
343 345
               case '6': // "<06SvEEPROM>"
344 346
                 SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
345
-                ExtUI::injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661"));
347
+                injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661"));
346 348
                 break;
347 349
 
348 350
               case '7': // <07SendM108>
349 351
                 SERIAL_ECHOLNPGM("Special Menu: Send User Confirmation");
350
-                ExtUI::injectCommands_P(PSTR("M108"));
352
+                injectCommands_P(PSTR("M108"));
351 353
                 break;
352 354
 
353 355
               default:
@@ -373,11 +375,11 @@ void AnycubicTFTClass::RenderCurrentFileList() {
373 375
     uint16_t selectedNumber = 0;
374 376
     SelectedDirectory[0] = 0;
375 377
     SelectedFile[0] = 0;
376
-    ExtUI::FileList currentFileList;
378
+    FileList currentFileList;
377 379
 
378 380
     SENDLINE_PGM("FN "); // Filelist start
379 381
 
380
-    if (!ExtUI::isMediaInserted() && !SpecialMenu) {
382
+    if (!isMediaInserted() && !SpecialMenu) {
381 383
       SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02");
382 384
 
383 385
       SENDLINE_PGM("<Special_Menu>");
@@ -462,7 +464,7 @@ void AnycubicTFTClass::RenderSpecialMenu(uint16_t selectedNumber) {
462 464
 }
463 465
 
464 466
 void AnycubicTFTClass::RenderCurrentFolder(uint16_t selectedNumber) {
465
-  ExtUI::FileList currentFileList;
467
+  FileList currentFileList;
466 468
   uint16_t cnt = selectedNumber;
467 469
   uint16_t max_files;
468 470
   uint16_t dir_files = currentFileList.count();
@@ -514,7 +516,7 @@ void AnycubicTFTClass::OnPrintTimerStarted() {
514 516
 
515 517
 void AnycubicTFTClass::OnPrintTimerPaused() {
516 518
   #if ENABLED(SDSUPPORT)
517
-    if (ExtUI::isPrintingFromMedia()) {
519
+    if (isPrintingFromMedia()) {
518 520
       mediaPrintingState = AMPRINTSTATE_PAUSED;
519 521
       mediaPauseState    = AMPAUSESTATE_PARKING;
520 522
     }
@@ -558,38 +560,38 @@ void AnycubicTFTClass::GetCommandFromTFT() {
558 560
 
559 561
         switch (a_command) {
560 562
           case 0: { // A0 GET HOTEND TEMP
561
-            float hotendActualTemp = ExtUI::getActualTemp_celsius((ExtUI::extruder_t) (ExtUI::extruder_t) ExtUI::E0);
563
+            float hotendActualTemp = getActualTemp_celsius((extruder_t) (extruder_t) E0);
562 564
             SEND_PGM_VAL("A0V ", int(hotendActualTemp + 0.5));
563 565
           }
564 566
           break;
565 567
 
566 568
           case 1: { // A1  GET HOTEND TARGET TEMP
567
-            float hotendTargetTemp = ExtUI::getTargetTemp_celsius((ExtUI::extruder_t) (ExtUI::extruder_t) ExtUI::E0);
569
+            float hotendTargetTemp = getTargetTemp_celsius((extruder_t) (extruder_t) E0);
568 570
             SEND_PGM_VAL("A1V ", int(hotendTargetTemp + 0.5));
569 571
           }
570 572
           break;
571 573
 
572 574
           case 2: { // A2 GET HOTBED TEMP
573
-            float heatedBedActualTemp = ExtUI::getActualTemp_celsius((ExtUI::heater_t) ExtUI::BED);
575
+            float heatedBedActualTemp = getActualTemp_celsius((heater_t) BED);
574 576
             SEND_PGM_VAL("A2V ", int(heatedBedActualTemp + 0.5));
575 577
           }
576 578
           break;
577 579
 
578 580
           case 3: { // A3 GET HOTBED TARGET TEMP
579
-            float heatedBedTargetTemp = ExtUI::getTargetTemp_celsius((ExtUI::heater_t) ExtUI::BED);
581
+            float heatedBedTargetTemp = getTargetTemp_celsius((heater_t) BED);
580 582
             SEND_PGM_VAL("A3V ", int(heatedBedTargetTemp + 0.5));
581 583
           } break;
582 584
 
583 585
           case 4: { // A4 GET FAN SPEED
584
-            float fanPercent = ExtUI::getActualFan_percent(ExtUI::FAN0);
586
+            float fanPercent = getActualFan_percent(FAN0);
585 587
             fanPercent = constrain(fanPercent, 0, 100);
586 588
             SEND_PGM_VAL("A4V ", int(fanPercent));
587 589
           } break;
588 590
 
589 591
           case 5: { // A5 GET CURRENT COORDINATE
590
-            const float xPosition = ExtUI::getAxisPosition_mm(ExtUI::X),
591
-                        yPosition = ExtUI::getAxisPosition_mm(ExtUI::Y),
592
-                        zPosition = ExtUI::getAxisPosition_mm(ExtUI::Z);
592
+            const float xPosition = getAxisPosition_mm(X),
593
+                        yPosition = getAxisPosition_mm(Y),
594
+                        zPosition = getAxisPosition_mm(Z);
593 595
             SEND_PGM("A5V X: "); LCD_SERIAL.print(xPosition);
594 596
             SEND_PGM(   " Y: "); LCD_SERIAL.print(yPosition);
595 597
             SEND_PGM(   " Z: "); LCD_SERIAL.print(zPosition);
@@ -598,10 +600,10 @@ void AnycubicTFTClass::GetCommandFromTFT() {
598 600
 
599 601
           case 6: // A6 GET SD CARD PRINTING STATUS
600 602
             #if ENABLED(SDSUPPORT)
601
-              if (ExtUI::isPrintingFromMedia()) {
603
+              if (isPrintingFromMedia()) {
602 604
                 SEND_PGM("A6V ");
603
-                if (ExtUI::isMediaInserted())
604
-                  SENDLINE(ui8tostr3rj(ExtUI::getProgress_percent()));
605
+                if (isMediaInserted())
606
+                  SENDLINE(ui8tostr3rj(getProgress_percent()));
605 607
                 else
606 608
                   SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02");
607 609
               }
@@ -611,7 +613,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
611 613
             break;
612 614
 
613 615
           case 7: { // A7 GET PRINTING TIME
614
-            const uint32_t elapsedSeconds = ExtUI::getProgress_seconds_elapsed();
616
+            const uint32_t elapsedSeconds = getProgress_seconds_elapsed();
615 617
             SEND_PGM("A7V ");
616 618
             if (elapsedSeconds != 0) {  // print time
617 619
               const uint32_t elapsedMinutes = elapsedSeconds / 60;
@@ -634,14 +636,14 @@ void AnycubicTFTClass::GetCommandFromTFT() {
634 636
 
635 637
           case 9: // A9 pause sd print
636 638
             #if ENABLED(SDSUPPORT)
637
-              if (ExtUI::isPrintingFromMedia())
639
+              if (isPrintingFromMedia())
638 640
                 PausePrint();
639 641
             #endif
640 642
             break;
641 643
 
642 644
           case 10: // A10 resume sd print
643 645
             #if ENABLED(SDSUPPORT)
644
-              if (ExtUI::isPrintingFromMediaPaused())
646
+              if (isPrintingFromMediaPaused())
645 647
                 ResumePrint();
646 648
             #endif
647 649
             break;
@@ -656,7 +658,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
656 658
 
657 659
           case 13: // A13 SELECTION FILE
658 660
             #if ENABLED(SDSUPPORT)
659
-              if (ExtUI::isMediaInserted()) {
661
+              if (isMediaInserted()) {
660 662
                 starpos = (strchr(TFTstrchr_pointer + 4, '*'));
661 663
                 if (TFTstrchr_pointer[4] == '/') {
662 664
                   strcpy(SelectedDirectory, TFTstrchr_pointer + 5);
@@ -685,7 +687,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
685 687
 
686 688
           case 14: // A14 START PRINTING
687 689
             #if ENABLED(SDSUPPORT)
688
-              if (!ExtUI::isPrinting() && strlen(SelectedFile) > 0)
690
+              if (!isPrinting() && strlen(SelectedFile) > 0)
689 691
                 StartPrint();
690 692
             #endif
691 693
             break;
@@ -698,13 +700,13 @@ void AnycubicTFTClass::GetCommandFromTFT() {
698 700
             unsigned int tempvalue;
699 701
             if (CodeSeen('S')) {
700 702
               tempvalue = constrain(CodeValue(), 0, 275);
701
-              ExtUI::setTargetTemp_celsius(tempvalue, (ExtUI::extruder_t) ExtUI::E0);
703
+              setTargetTemp_celsius(tempvalue, (extruder_t) E0);
702 704
             }
703
-            else if (CodeSeen('C') && !ExtUI::isPrinting()) {
704
-              if (ExtUI::getAxisPosition_mm(ExtUI::Z) < 10)
705
-                ExtUI::injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
705
+            else if (CodeSeen('C') && !isPrinting()) {
706
+              if (getAxisPosition_mm(Z) < 10)
707
+                injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
706 708
               tempvalue = constrain(CodeValue(), 0, 275);
707
-              ExtUI::setTargetTemp_celsius(tempvalue, (ExtUI::extruder_t) ExtUI::E0);
709
+              setTargetTemp_celsius(tempvalue, (extruder_t) E0);
708 710
             }
709 711
           }
710 712
           break;
@@ -713,7 +715,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
713 715
             unsigned int tempbed;
714 716
             if (CodeSeen('S')) {
715 717
               tempbed = constrain(CodeValue(), 0, 100);
716
-              ExtUI::setTargetTemp_celsius(tempbed, (ExtUI::heater_t)ExtUI::BED);
718
+              setTargetTemp_celsius(tempbed, (heater_t)BED);
717 719
             }
718 720
           }
719 721
           break;
@@ -723,18 +725,18 @@ void AnycubicTFTClass::GetCommandFromTFT() {
723 725
             if (CodeSeen('S')) {
724 726
               fanPercent = CodeValue();
725 727
               fanPercent = constrain(fanPercent, 0, 100);
726
-              ExtUI::setTargetFan_percent(fanPercent, ExtUI::FAN0);
728
+              setTargetFan_percent(fanPercent, FAN0);
727 729
             }
728 730
             else
729 731
               fanPercent = 100;
730 732
 
731
-            ExtUI::setTargetFan_percent(fanPercent, ExtUI::FAN0);
733
+            setTargetFan_percent(fanPercent, FAN0);
732 734
             SENDLINE_PGM("");
733 735
           }
734 736
           break;
735 737
 
736 738
           case 19: // A19 stop stepper drivers - sent on stop extrude command and on turn motors off command
737
-            if (!ExtUI::isPrinting()) {
739
+            if (!isPrinting()) {
738 740
               quickstop_stepper();
739 741
               disable_all_steppers();
740 742
             }
@@ -750,23 +752,23 @@ void AnycubicTFTClass::GetCommandFromTFT() {
750 752
             break;
751 753
 
752 754
           case 21: // A21 all home
753
-            if (!ExtUI::isPrinting() && !ExtUI::isPrintingFromMediaPaused()) {
755
+            if (!isPrinting() && !isPrintingFromMediaPaused()) {
754 756
               if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) {
755 757
                 if (CodeSeen('X'))
756
-                  ExtUI::injectCommands_P(PSTR("G28X"));
758
+                  injectCommands_P(PSTR("G28X"));
757 759
                 if (CodeSeen('Y'))
758
-                  ExtUI::injectCommands_P(PSTR("G28Y"));
760
+                  injectCommands_P(PSTR("G28Y"));
759 761
                 if (CodeSeen('Z'))
760
-                  ExtUI::injectCommands_P(PSTR("G28Z"));
762
+                  injectCommands_P(PSTR("G28Z"));
761 763
               }
762 764
               else if (CodeSeen('C')) {
763
-                ExtUI::injectCommands_P(G28_STR);
765
+                injectCommands_P(G28_STR);
764 766
               }
765 767
             }
766 768
             break;
767 769
 
768 770
           case 22: // A22 move X/Y/Z or extrude
769
-            if (!ExtUI::isPrinting()) {
771
+            if (!isPrinting()) {
770 772
               float coorvalue;
771 773
               unsigned int movespeed = 0;
772 774
               char commandStr[30];
@@ -819,38 +821,38 @@ void AnycubicTFTClass::GetCommandFromTFT() {
819 821
                   SERIAL_ECHOPGM("TFT Serial Debug: A22 Move final request with gcode... ");
820 822
                   SERIAL_ECHOLN(fullCommandStr);
821 823
                 #endif
822
-                ExtUI::injectCommands(fullCommandStr);
824
+                injectCommands(fullCommandStr);
823 825
               }
824 826
             }
825 827
             SENDLINE_PGM("");
826 828
             break;
827 829
 
828 830
           case 23: // A23 preheat pla
829
-            if (!ExtUI::isPrinting()) {
830
-              if (ExtUI::getAxisPosition_mm(ExtUI::Z) < 10)
831
-                ExtUI::injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
831
+            if (!isPrinting()) {
832
+              if (getAxisPosition_mm(Z) < 10)
833
+                injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
832 834
 
833
-              ExtUI::setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (ExtUI::heater_t) ExtUI::BED);
834
-              ExtUI::setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (ExtUI::extruder_t) ExtUI::E0);
835
+              setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t) BED);
836
+              setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t) E0);
835 837
               SENDLINE_PGM("OK");
836 838
             }
837 839
             break;
838 840
 
839 841
           case 24:// A24 preheat abs
840
-            if (!ExtUI::isPrinting()) {
841
-              if (ExtUI::getAxisPosition_mm(ExtUI::Z) < 10)
842
-                ExtUI::injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
842
+            if (!isPrinting()) {
843
+              if (getAxisPosition_mm(Z) < 10)
844
+                injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
843 845
 
844
-              ExtUI::setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (ExtUI::heater_t) ExtUI::BED);
845
-              ExtUI::setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (ExtUI::extruder_t) ExtUI::E0);
846
+              setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t) BED);
847
+              setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t) E0);
846 848
               SENDLINE_PGM("OK");
847 849
             }
848 850
             break;
849 851
 
850 852
           case 25: // A25 cool down
851
-            if (!ExtUI::isPrinting()) {
852
-              ExtUI::setTargetTemp_celsius(0, (ExtUI::heater_t) ExtUI::BED);
853
-              ExtUI::setTargetTemp_celsius(0, (ExtUI::extruder_t) ExtUI::E0);
853
+            if (!isPrinting()) {
854
+              setTargetTemp_celsius(0, (heater_t) BED);
855
+              setTargetTemp_celsius(0, (extruder_t) E0);
854 856
 
855 857
               SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Cooling down... J12"); // J12 cool down
856 858
             }
@@ -858,9 +860,9 @@ void AnycubicTFTClass::GetCommandFromTFT() {
858 860
 
859 861
           case 26: // A26 refresh SD
860 862
             #if ENABLED(SDSUPPORT)
861
-              if (ExtUI::isMediaInserted()) {
863
+              if (isMediaInserted()) {
862 864
                 if (strlen(SelectedDirectory) > 0) {
863
-                  ExtUI::FileList currentFileList;
865
+                  FileList currentFileList;
864 866
                   if ((SelectedDirectory[0] == '.') && (SelectedDirectory[1] == '.')) {
865 867
                     currentFileList.upDir();
866 868
                   }
@@ -914,7 +916,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
914 916
 
915 917
 void AnycubicTFTClass::DoSDCardStateCheck() {
916 918
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
917
-    bool isInserted = ExtUI::isMediaInserted();
919
+    bool isInserted = isMediaInserted();
918 920
     if (isInserted)
919 921
       SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isInserted");
920 922
     else
@@ -925,12 +927,12 @@ void AnycubicTFTClass::DoSDCardStateCheck() {
925 927
 
926 928
 void AnycubicTFTClass::DoFilamentRunoutCheck() {
927 929
   #if ENABLED(FILAMENT_RUNOUT_SENSOR)
928
-    // NOTE: ExtUI::getFilamentRunoutState() only returns the runout state if the job is printing
930
+    // NOTE: getFilamentRunoutState() only returns the runout state if the job is printing
929 931
     // we want to actually check the status of the pin here, regardless of printstate
930 932
     if (READ(FIL_RUNOUT1_PIN)) {
931 933
       if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) {
932 934
         // play tone to indicate filament is out
933
-        ExtUI::injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567"));
935
+        injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567"));
934 936
 
935 937
         // tell the user that the filament has run out and wait
936 938
         SENDLINE_DBG_PGM("J23", "TFT Serial Debug: Blocking filament prompt... J23");
@@ -944,30 +946,30 @@ void AnycubicTFTClass::DoFilamentRunoutCheck() {
944 946
 
945 947
 void AnycubicTFTClass::StartPrint() {
946 948
   #if ENABLED(SDSUPPORT)
947
-    if (!ExtUI::isPrinting() && strlen(SelectedFile) > 0) {
949
+    if (!isPrinting() && strlen(SelectedFile) > 0) {
948 950
       #if ENABLED(ANYCUBIC_LCD_DEBUG)
949 951
         SERIAL_ECHOPGM("TFT Serial Debug: About to print file ... ");
950
-        SERIAL_ECHO(ExtUI::isPrinting());
952
+        SERIAL_ECHO(isPrinting());
951 953
         SERIAL_ECHOPGM(" ");
952 954
         SERIAL_ECHOLN(SelectedFile);
953 955
       #endif
954 956
       mediaPrintingState = AMPRINTSTATE_PRINTING;
955 957
       mediaPauseState    = AMPAUSESTATE_NOT_PAUSED;
956
-      ExtUI::printFile(SelectedFile);
958
+      printFile(SelectedFile);
957 959
     }
958 960
   #endif // SDUPPORT
959 961
 }
960 962
 
961 963
 void AnycubicTFTClass::PausePrint() {
962 964
   #if ENABLED(SDSUPPORT)
963
-    if (ExtUI::isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) {
965
+    if (isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) {
964 966
       mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED;
965 967
       mediaPauseState    = AMPAUSESTATE_NOT_PAUSED; // need the userconfirm method to update pause state
966 968
       SENDLINE_DBG_PGM("J05", "TFT Serial Debug: SD print pause started... J05"); // J05 printing pause
967 969
 
968 970
       // for some reason pausing the print doesn't retract the extruder so force a manual one here
969
-      ExtUI::injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90"));
970
-      ExtUI::pausePrint();
971
+      injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90"));
972
+      pausePrint();
971 973
     }
972 974
   #endif
973 975
 }
@@ -996,14 +998,14 @@ void AnycubicTFTClass::ResumePrint() {
996 998
       // SENDLINE_DBG_PGM("J05", "TFT Serial Debug: Resume called with heater timeout... J05"); // J05 printing pause
997 999
 
998 1000
       // reheat the nozzle
999
-      ExtUI::setUserConfirmed();
1001
+      setUserConfirmed();
1000 1002
     }
1001 1003
     else {
1002 1004
       mediaPrintingState = AMPRINTSTATE_PRINTING;
1003 1005
       mediaPauseState    = AMPAUSESTATE_NOT_PAUSED;
1004 1006
 
1005 1007
       SENDLINE_DBG_PGM("J04", "TFT Serial Debug: SD print resumed... J04"); // J04 printing form sd card now
1006
-      ExtUI::resumePrint();
1008
+      resumePrint();
1007 1009
     }
1008 1010
   #endif
1009 1011
 }
@@ -1015,8 +1017,8 @@ void AnycubicTFTClass::StopPrint() {
1015 1017
     SENDLINE_DBG_PGM("J16", "TFT Serial Debug: SD print stop called... J16");
1016 1018
 
1017 1019
     // for some reason stopping the print doesn't retract the extruder so force a manual one here
1018
-    ExtUI::injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90"));
1019
-    ExtUI::stopPrint();
1020
+    injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90"));
1021
+    stopPrint();
1020 1022
   #endif
1021 1023
 }
1022 1024
 

+ 38
- 40
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.h ファイルの表示

@@ -2,7 +2,7 @@
2 2
  * anycubic_i3mega_lcd.h  --- Support for Anycubic i3 Mega TFT
3 3
  * Created by Christian Hopp on 09.12.17.
4 4
  * Improved by David Ramiro
5
- * Converted to ext_iu by John BouAntoun 21 June 2020
5
+ * Converted to ExtUI by John BouAntoun 21 June 2020
6 6
  *
7 7
  * This library is free software; you can redistribute it and/or
8 8
  * modify it under the terms of the GNU Lesser General Public
@@ -48,49 +48,47 @@ enum AnycubicMediaPauseState {
48 48
 class AnycubicTFTClass {
49 49
 public:
50 50
   AnycubicTFTClass();
51
-  void OnSetup();
52
-  void OnCommandScan();
53
-  void OnKillTFT();
54
-  void OnSDCardStateChange(bool);
55
-  void OnSDCardError();
56
-  void OnFilamentRunout();
57
-  void OnUserConfirmRequired(const char *);
58
-  void OnPrintTimerStarted();
59
-  void OnPrintTimerPaused();
60
-  void OnPrintTimerStopped();
51
+  static void OnSetup();
52
+  static void OnCommandScan();
53
+  static void OnKillTFT();
54
+  static void OnSDCardStateChange(bool);
55
+  static void OnSDCardError();
56
+  static void OnFilamentRunout();
57
+  static void OnUserConfirmRequired(const char *);
58
+  static void OnPrintTimerStarted();
59
+  static void OnPrintTimerPaused();
60
+  static void OnPrintTimerStopped();
61 61
 
62 62
 private:
63
-  char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
64
-  int TFTbuflen=0;
65
-  int TFTbufindr = 0;
66
-  int TFTbufindw = 0;
67
-  char serial3_char;
68
-  int serial3_count = 0;
69
-  char *TFTstrchr_pointer;
70
-  uint8_t SpecialMenu = false;
71
-  AnycubicMediaPrintState mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
72
-  AnycubicMediaPauseState mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
63
+  static char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
64
+  static int TFTbuflen, TFTbufindr, TFTbufindw;
65
+  static char serial3_char;
66
+  static int serial3_count;
67
+  static char *TFTstrchr_pointer;
68
+  static uint8_t SpecialMenu;
69
+  static AnycubicMediaPrintState mediaPrintingState;
70
+  static AnycubicMediaPauseState mediaPauseState;
73 71
 
74
-  float CodeValue();
75
-  bool CodeSeen(char);
76
-  bool IsNozzleHomed();
77
-  void RenderCurrentFileList();
78
-  void RenderSpecialMenu(uint16_t);
79
-  void RenderCurrentFolder(uint16_t);
80
-  void GetCommandFromTFT();
81
-  void CheckSDCardChange();
82
-  void CheckPauseState();
83
-  void CheckPrintCompletion();
84
-  void HandleSpecialMenu();
85
-  void DoSDCardStateCheck();
86
-  void DoFilamentRunoutCheck();
87
-  void StartPrint();
88
-  void PausePrint();
89
-  void ResumePrint();
90
-  void StopPrint();
72
+  static float CodeValue();
73
+  static bool CodeSeen(char);
74
+  static bool IsNozzleHomed();
75
+  static void RenderCurrentFileList();
76
+  static void RenderSpecialMenu(uint16_t);
77
+  static void RenderCurrentFolder(uint16_t);
78
+  static void GetCommandFromTFT();
79
+  static void CheckSDCardChange();
80
+  static void CheckPauseState();
81
+  static void CheckPrintCompletion();
82
+  static void HandleSpecialMenu();
83
+  static void DoSDCardStateCheck();
84
+  static void DoFilamentRunoutCheck();
85
+  static void StartPrint();
86
+  static void PausePrint();
87
+  static void ResumePrint();
88
+  static void StopPrint();
91 89
 
92
-  char SelectedDirectory[30];
93
-  char SelectedFile[FILENAME_LENGTH];
90
+  static char SelectedDirectory[30];
91
+  static char SelectedFile[FILENAME_LENGTH];
94 92
 };
95 93
 
96 94
 extern AnycubicTFTClass AnycubicTFT;

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp ファイルの表示

@@ -140,7 +140,7 @@ namespace ExtUI {
140 140
   #if HAS_LEVELING && HAS_MESH
141 141
     void onMeshLevelingStart() {}
142 142
 
143
-    void onMeshUpdate(const int8_t x, const int8_t y, const float val) {
143
+    void onMeshUpdate(const int8_t x, const int8_t y, const float &val) {
144 144
       BedMeshScreen::onMeshUpdate(x, y, val);
145 145
     }
146 146
 

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.h ファイルの表示

@@ -51,7 +51,7 @@ class BedMeshScreen : public BaseScreen, public CachedScreen<BED_MESH_SCREEN_CAC
51 51
     static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1);
52 52
 
53 53
   public:
54
-    static void onMeshUpdate(const int8_t x, const int8_t y, const float val);
54
+    static void onMeshUpdate(const int8_t x, const int8_t y, const float &val);
55 55
     static void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t);
56 56
     static void onEntry();
57 57
     static void onRedraw(draw_mode_t);

+ 1
- 3
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp ファイルの表示

@@ -97,9 +97,7 @@ void StressTestScreen::onEntry() {
97 97
   mydata.message = PSTR("Test 1: Stress testing...");
98 98
 
99 99
   // Turn off heaters.
100
-  setTargetTemp_celsius(0, E0);
101
-  setTargetTemp_celsius(0, E1);
102
-  setTargetTemp_celsius(0, BED);
100
+  coolDown();
103 101
 
104 102
   runTestOnBootup(true);
105 103
 }

+ 1
- 6
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp ファイルの表示

@@ -101,13 +101,8 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) {
101 101
       case 11: UI_INCREMENT(TargetFan_percent, FAN0); break;
102 102
     #endif
103 103
     case 30:
104
-      #define _HOTEND_OFF(N) setTargetTemp_celsius(0, E##N);
105
-      REPEAT(HOTENDS, _HOTEND_OFF);
106
-      TERN_(HAS_HEATED_BED, setTargetTemp_celsius(0, BED));
104
+      coolDown();
107 105
       TERN_(HAS_HEATED_CHAMBER, setTargetTemp_celsius(0, CHAMBER));
108
-      #if HAS_FAN
109
-        setTargetFan_percent(0, FAN0);
110
-      #endif
111 106
       break;
112 107
     default:
113 108
       return false;

+ 1
- 1
Marlin/src/lcd/extui/malyan_lcd.cpp ファイルの表示

@@ -528,7 +528,7 @@ namespace ExtUI {
528 528
 
529 529
   #if HAS_MESH
530 530
     void onMeshLevelingStart() {}
531
-    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {}
531
+    void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float &zval) {}
532 532
     void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {}
533 533
   #endif
534 534
 

+ 62
- 73
Marlin/src/lcd/extui/ui_api.cpp ファイルの表示

@@ -305,7 +305,7 @@ namespace ExtUI {
305 305
     return epos;
306 306
   }
307 307
 
308
-  void setAxisPosition_mm(const float position, const axis_t axis, const feedRate_t feedrate/*=0*/) {
308
+  void setAxisPosition_mm(const float &position, const axis_t axis, const feedRate_t feedrate/*=0*/) {
309 309
     // Get motion limit from software endstops, if any
310 310
     float min, max;
311 311
     soft_endstop.get_manual_axis_limits((AxisEnum)axis, min, max);
@@ -323,7 +323,7 @@ namespace ExtUI {
323 323
     line_to_current_position(feedrate ?: manual_feedrate_mm_s[axis]);
324 324
   }
325 325
 
326
-  void setAxisPosition_mm(const float position, const extruder_t extruder, const feedRate_t feedrate/*=0*/) {
326
+  void setAxisPosition_mm(const float &position, const extruder_t extruder, const feedRate_t feedrate/*=0*/) {
327 327
     setActiveTool(extruder, true);
328 328
 
329 329
     current_position.e = position;
@@ -435,7 +435,7 @@ namespace ExtUI {
435 435
       };
436 436
     }
437 437
 
438
-    void  setAxisCurrent_mA(const float mA, const axis_t axis) {
438
+    void setAxisCurrent_mA(const float &mA, const axis_t axis) {
439 439
       switch (axis) {
440 440
         #if AXIS_IS_TMC(X)
441 441
           case X: stepperX.rms_current(constrain(mA, 400, 1500)); break;
@@ -459,7 +459,7 @@ namespace ExtUI {
459 459
       };
460 460
     }
461 461
 
462
-    void  setAxisCurrent_mA(const float mA, const extruder_t extruder) {
462
+    void setAxisCurrent_mA(const float &mA, const extruder_t extruder) {
463 463
       switch (extruder) {
464 464
         #if AXIS_IS_TMC(E0)
465 465
           case E0: stepperE0.rms_current(constrain(mA, 400, 1500)); break;
@@ -503,7 +503,7 @@ namespace ExtUI {
503 503
       }
504 504
     }
505 505
 
506
-    void setTMCBumpSensitivity(const float value, const axis_t axis) {
506
+    void setTMCBumpSensitivity(const float &value, const axis_t axis) {
507 507
       switch (axis) {
508 508
         #if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
509 509
           #if X_SENSORLESS
@@ -547,12 +547,12 @@ namespace ExtUI {
547 547
     return planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)];
548 548
   }
549 549
 
550
-  void setAxisSteps_per_mm(const float value, const axis_t axis) {
550
+  void setAxisSteps_per_mm(const float &value, const axis_t axis) {
551 551
     planner.settings.axis_steps_per_mm[axis] = value;
552 552
     planner.refresh_positioning();
553 553
   }
554 554
 
555
-  void setAxisSteps_per_mm(const float value, const extruder_t extruder) {
555
+  void setAxisSteps_per_mm(const float &value, const extruder_t extruder) {
556 556
     UNUSED_E(extruder);
557 557
     planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)] = value;
558 558
     planner.refresh_positioning();
@@ -585,12 +585,12 @@ namespace ExtUI {
585 585
     return planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)];
586 586
   }
587 587
 
588
-  void setAxisMaxAcceleration_mm_s2(const float value, const axis_t axis) {
588
+  void setAxisMaxAcceleration_mm_s2(const float &value, const axis_t axis) {
589 589
     planner.set_max_acceleration(axis, value);
590 590
     planner.reset_acceleration_rates();
591 591
   }
592 592
 
593
-  void setAxisMaxAcceleration_mm_s2(const float value, const extruder_t extruder) {
593
+  void setAxisMaxAcceleration_mm_s2(const float &value, const extruder_t extruder) {
594 594
     UNUSED_E(extruder);
595 595
     planner.set_max_acceleration(E_AXIS_N(extruder - E0), value);
596 596
     planner.reset_acceleration_rates();
@@ -604,7 +604,7 @@ namespace ExtUI {
604 604
 
605 605
     #if HAS_FILAMENT_RUNOUT_DISTANCE
606 606
       float getFilamentRunoutDistance_mm()                 { return runout.runout_distance(); }
607
-      void setFilamentRunoutDistance_mm(const float value) { runout.set_runout_distance(constrain(value, 0, 999)); }
607
+      void setFilamentRunoutDistance_mm(const float &value) { runout.set_runout_distance(constrain(value, 0, 999)); }
608 608
     #endif
609 609
   #endif
610 610
 
@@ -617,7 +617,7 @@ namespace ExtUI {
617 617
 
618 618
     #if CASELIGHT_USES_BRIGHTNESS
619 619
       float getCaseLightBrightness_percent()                 { return ui8_to_percent(caselight.brightness); }
620
-      void setCaseLightBrightness_percent(const float value) {
620
+      void setCaseLightBrightness_percent(const float &value) {
621 621
          caselight.brightness = map(constrain(value, 0, 100), 0, 100, 0, 255);
622 622
          caselight.update_brightness();
623 623
       }
@@ -629,7 +629,7 @@ namespace ExtUI {
629 629
       return (extruder < EXTRUDERS) ? planner.extruder_advance_K[extruder - E0] : 0;
630 630
     }
631 631
 
632
-    void setLinearAdvance_mm_mm_s(const float value, const extruder_t extruder) {
632
+    void setLinearAdvance_mm_mm_s(const float &value, const extruder_t extruder) {
633 633
       if (extruder < EXTRUDERS)
634 634
         planner.extruder_advance_K[extruder - E0] = constrain(value, 0, 10);
635 635
     }
@@ -641,28 +641,16 @@ namespace ExtUI {
641 641
       return planner.junction_deviation_mm;
642 642
     }
643 643
 
644
-    void setJunctionDeviation_mm(const float value) {
644
+    void setJunctionDeviation_mm(const float &value) {
645 645
       planner.junction_deviation_mm = constrain(value, 0.001, 0.3);
646 646
       TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk());
647 647
     }
648 648
 
649 649
   #else
650
-
651
-    float getAxisMaxJerk_mm_s(const axis_t axis) {
652
-      return planner.max_jerk[axis];
653
-    }
654
-
655
-    float getAxisMaxJerk_mm_s(const extruder_t) {
656
-      return planner.max_jerk.e;
657
-    }
658
-
659
-    void setAxisMaxJerk_mm_s(const float value, const axis_t axis) {
660
-      planner.set_max_jerk((AxisEnum)axis, value);
661
-    }
662
-
663
-    void setAxisMaxJerk_mm_s(const float value, const extruder_t) {
664
-      planner.set_max_jerk(E_AXIS, value);
665
-    }
650
+    float getAxisMaxJerk_mm_s(const axis_t axis) { return planner.max_jerk[axis]; }
651
+    float getAxisMaxJerk_mm_s(const extruder_t) { return planner.max_jerk.e; }
652
+    void setAxisMaxJerk_mm_s(const float &value, const axis_t axis) { planner.set_max_jerk((AxisEnum)axis, value); }
653
+    void setAxisMaxJerk_mm_s(const float &value, const extruder_t) { planner.set_max_jerk(E_AXIS, value); }
666 654
   #endif
667 655
 
668 656
   feedRate_t getFeedrate_mm_s()                       { return feedrate_mm_s; }
@@ -676,11 +664,12 @@ namespace ExtUI {
676 664
   void setFlow_percent(const int16_t flow, const extruder_t extr) { planner.set_flow(extr, flow); }
677 665
   void setMinFeedrate_mm_s(const feedRate_t fr)       { planner.settings.min_feedrate_mm_s = fr; }
678 666
   void setMinTravelFeedrate_mm_s(const feedRate_t fr) { planner.settings.min_travel_feedrate_mm_s = fr; }
679
-  void setPrintingAcceleration_mm_s2(const float acc) { planner.settings.acceleration = acc; }
680
-  void setRetractAcceleration_mm_s2(const float acc)  { planner.settings.retract_acceleration = acc; }
681
-  void setTravelAcceleration_mm_s2(const float acc)   { planner.settings.travel_acceleration = acc; }
667
+  void setPrintingAcceleration_mm_s2(const float &acc) { planner.settings.acceleration = acc; }
668
+  void setRetractAcceleration_mm_s2(const float &acc)  { planner.settings.retract_acceleration = acc; }
669
+  void setTravelAcceleration_mm_s2(const float &acc)   { planner.settings.travel_acceleration = acc; }
682 670
 
683 671
   #if ENABLED(BABYSTEPPING)
672
+
684 673
     bool babystepAxis_steps(const int16_t steps, const axis_t axis) {
685 674
       switch (axis) {
686 675
         #if ENABLED(BABYSTEP_XY)
@@ -738,11 +727,12 @@ namespace ExtUI {
738 727
      * Converts a mm displacement to a number of whole number of
739 728
      * steps that is at least mm long.
740 729
      */
741
-    int16_t mmToWholeSteps(const float mm, const axis_t axis) {
730
+    int16_t mmToWholeSteps(const float &mm, const axis_t axis) {
742 731
       const float steps = mm / planner.steps_to_mm[axis];
743 732
       return steps > 0 ? CEIL(steps) : FLOOR(steps);
744 733
     }
745
-  #endif
734
+
735
+  #endif // BABYSTEPPING
746 736
 
747 737
   float getZOffset_mm() {
748 738
     return (0.0f
@@ -754,7 +744,7 @@ namespace ExtUI {
754 744
     );
755 745
   }
756 746
 
757
-  void setZOffset_mm(const float value) {
747
+  void setZOffset_mm(const float &value) {
758 748
     #if HAS_BED_PROBE
759 749
       if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
760 750
         probe.offset.z = value;
@@ -772,7 +762,7 @@ namespace ExtUI {
772 762
       return hotend_offset[extruder - E0][axis];
773 763
     }
774 764
 
775
-    void setNozzleOffset_mm(const float value, const axis_t axis, const extruder_t extruder) {
765
+    void setNozzleOffset_mm(const float &value, const axis_t axis, const extruder_t extruder) {
776 766
       if (extruder - E0 >= HOTENDS) return;
777 767
       hotend_offset[extruder - E0][axis] = value;
778 768
     }
@@ -790,25 +780,21 @@ namespace ExtUI {
790 780
   #endif // HAS_HOTEND_OFFSET
791 781
 
792 782
   #if HAS_BED_PROBE
793
-    float getProbeOffset_mm(const axis_t axis) {
794
-      return probe.offset.pos[axis];
795
-    }
796
-    void setProbeOffset_mm(const float val, const axis_t axis) {
797
-      probe.offset.pos[axis] = val;
798
-    }
783
+    float getProbeOffset_mm(const axis_t axis) { return probe.offset.pos[axis]; }
784
+    void setProbeOffset_mm(const float &val, const axis_t axis) { probe.offset.pos[axis] = val; }
799 785
   #endif
800 786
 
801 787
   #if ENABLED(BACKLASH_GCODE)
802 788
     float getAxisBacklash_mm(const axis_t axis)       { return backlash.distance_mm[axis]; }
803
-    void setAxisBacklash_mm(const float value, const axis_t axis)
789
+    void setAxisBacklash_mm(const float &value, const axis_t axis)
804 790
                                                       { backlash.distance_mm[axis] = constrain(value,0,5); }
805 791
 
806 792
     float getBacklashCorrection_percent()             { return ui8_to_percent(backlash.correction); }
807
-    void setBacklashCorrection_percent(const float value) { backlash.correction = map(constrain(value, 0, 100), 0, 100, 0, 255); }
793
+    void setBacklashCorrection_percent(const float &value) { backlash.correction = map(constrain(value, 0, 100), 0, 100, 0, 255); }
808 794
 
809 795
     #ifdef BACKLASH_SMOOTHING_MM
810 796
       float getBacklashSmoothing_mm()                 { return backlash.smoothing_mm; }
811
-      void setBacklashSmoothing_mm(const float value) { backlash.smoothing_mm = constrain(value, 0, 999); }
797
+      void setBacklashSmoothing_mm(const float &value) { backlash.smoothing_mm = constrain(value, 0, 999); }
812 798
     #endif
813 799
   #endif
814 800
 
@@ -824,7 +810,7 @@ namespace ExtUI {
824 810
     #if HAS_MESH
825 811
       bed_mesh_t& getMeshArray() { return Z_VALUES_ARR; }
826 812
       float getMeshPoint(const xy_uint8_t &pos) { return Z_VALUES(pos.x, pos.y); }
827
-      void setMeshPoint(const xy_uint8_t &pos, const float zoff) {
813
+      void setMeshPoint(const xy_uint8_t &pos, const float &zoff) {
828 814
         if (WITHIN(pos.x, 0, GRID_MAX_POINTS_X) && WITHIN(pos.y, 0, GRID_MAX_POINTS_Y)) {
829 815
           Z_VALUES(pos.x, pos.y) = zoff;
830 816
           TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
@@ -838,6 +824,7 @@ namespace ExtUI {
838 824
   #endif
839 825
 
840 826
   #if ENABLED(PRINTCOUNTER)
827
+    char* getFailedPrints_str(char buffer[21])   { strcpy(buffer,i16tostr3left(print_job_timer.getStats().totalPrints - print_job_timer.getStats().finishedPrints)); return buffer; }
841 828
     char* getTotalPrints_str(char buffer[21])    { strcpy(buffer,i16tostr3left(print_job_timer.getStats().totalPrints));    return buffer; }
842 829
     char* getFinishedPrints_str(char buffer[21]) { strcpy(buffer,i16tostr3left(print_job_timer.getStats().finishedPrints)); return buffer; }
843 830
     char* getTotalPrintTime_str(char buffer[21]) { return duration_t(print_job_timer.getStats().printTime).toString(buffer); }
@@ -856,14 +843,14 @@ namespace ExtUI {
856 843
     float getPIDValues_Ki(const extruder_t tool) { return unscalePID_i(PID_PARAM(Ki, tool)); }
857 844
     float getPIDValues_Kd(const extruder_t tool) { return unscalePID_d(PID_PARAM(Kd, tool)); }
858 845
 
859
-    void setPIDValues(const float p, const float i, const float d, extruder_t tool) {
846
+    void setPIDValues(const float &p, const float &i, const float &d, extruder_t tool) {
860 847
       thermalManager.temp_hotend[tool].pid.Kp = p;
861 848
       thermalManager.temp_hotend[tool].pid.Ki = scalePID_i(i);
862 849
       thermalManager.temp_hotend[tool].pid.Kd = scalePID_d(d);
863 850
       thermalManager.updatePID();
864 851
     }
865 852
 
866
-    void startPIDTune(const float temp, extruder_t tool) {
853
+    void startPIDTune(const float &temp, extruder_t tool) {
867 854
       thermalManager.PID_autotune(temp, (heater_id_t)tool, 8, true);
868 855
     }
869 856
   #endif
@@ -873,14 +860,14 @@ namespace ExtUI {
873 860
     float getBedPIDValues_Ki() { return unscalePID_i(thermalManager.temp_bed.pid.Ki); }
874 861
     float getBedPIDValues_Kd() { return unscalePID_d(thermalManager.temp_bed.pid.Kd); }
875 862
 
876
-    void setBedPIDValues(const float p, const float i, const float d) {
863
+    void setBedPIDValues(const float &p, const float &i, const float &d) {
877 864
       thermalManager.temp_bed.pid.Kp = p;
878 865
       thermalManager.temp_bed.pid.Ki = scalePID_i(i);
879 866
       thermalManager.temp_bed.pid.Kd = scalePID_d(d);
880 867
       thermalManager.updatePID();
881 868
     }
882 869
 
883
-    void startBedPIDTune(const float temp) {
870
+    void startBedPIDTune(const float &temp) {
884 871
       thermalManager.PID_autotune(temp, H_BED, 4, true);
885 872
     }
886 873
   #endif
@@ -900,7 +887,8 @@ namespace ExtUI {
900 887
     return firmware_name;
901 888
   }
902 889
 
903
-  void setTargetTemp_celsius(float value, const heater_t heater) {
890
+  void setTargetTemp_celsius(const float &inval, const heater_t heater) {
891
+    float value = inval;
904 892
     #ifdef TOUCH_UI_LCD_TEMP_SCALING
905 893
       value *= TOUCH_UI_LCD_TEMP_SCALING;
906 894
     #endif
@@ -924,7 +912,8 @@ namespace ExtUI {
924 912
     }
925 913
   }
926 914
 
927
-  void setTargetTemp_celsius(float value, const extruder_t extruder) {
915
+  void setTargetTemp_celsius(const float &inval, const extruder_t extruder) {
916
+    float value = inval;
928 917
     #ifdef TOUCH_UI_LCD_TEMP_SCALING
929 918
       value *= TOUCH_UI_LCD_TEMP_SCALING;
930 919
     #endif
@@ -935,7 +924,7 @@ namespace ExtUI {
935 924
     #endif
936 925
   }
937 926
 
938
-  void setTargetFan_percent(const float value, const fan_t fan) {
927
+  void setTargetFan_percent(const float &value, const fan_t fan) {
939 928
     #if HAS_FAN
940 929
       if (fan < FAN_COUNT)
941 930
         thermalManager.set_fan_speed(fan - FAN0, map(constrain(value, 0, 100), 0, 100, 0, 255));
@@ -945,25 +934,27 @@ namespace ExtUI {
945 934
     #endif
946 935
   }
947 936
 
948
-  void setFeedrate_percent(const float value) {
949
-    feedrate_percentage = constrain(value, 10, 500);
950
-  }
937
+  void setFeedrate_percent(const float &value) { feedrate_percentage = constrain(value, 10, 500); }
951 938
 
952
-  bool awaitingUserConfirm() {
953
-    return wait_for_user;
939
+  void coolDown() {
940
+    #if HAS_HOTEND
941
+      HOTEND_LOOP() thermalManager.setTargetHotend(0, e);
942
+    #endif
943
+    TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(0));
944
+    TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
954 945
   }
955 946
 
956
-  void setUserConfirmed() {
957
-    TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
958
-  }
947
+  bool awaitingUserConfirm() { return wait_for_user; }
948
+
949
+  void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); }
959 950
 
960 951
   void printFile(const char *filename) {
961 952
     UNUSED(filename);
962
-    IFSD(card.openAndPrintFile(filename), NOOP);
953
+    TERN_(SDSUPPORT, card.openAndPrintFile(filename));
963 954
   }
964 955
 
965 956
   bool isPrintingFromMediaPaused() {
966
-    return IFSD(isPrintingFromMedia() && !IS_SD_PRINTING(), false);
957
+    return TERN0(SDSUPPORT, isPrintingFromMedia() && !IS_SD_PRINTING());
967 958
   }
968 959
 
969 960
   bool isPrintingFromMedia() {
@@ -978,16 +969,14 @@ namespace ExtUI {
978 969
   }
979 970
 
980 971
   bool isPrinting() {
981
-    return (commandsInQueue() || isPrintingFromMedia() || IFSD(IS_SD_PRINTING(), false)) || print_job_timer.isRunning() || print_job_timer.isPaused();
972
+    return (commandsInQueue() || isPrintingFromMedia() || TERN0(SDSUPPORT, IS_SD_PRINTING())) || print_job_timer.isRunning() || print_job_timer.isPaused();
982 973
   }
983 974
 
984 975
   bool isPrintingPaused() {
985 976
     return isPrinting() && (isPrintingFromMediaPaused() || print_job_timer.isPaused());
986 977
   }
987 978
 
988
-  bool isMediaInserted() {
989
-    return IFSD(IS_SD_INSERTED() && card.isMounted(), false);
990
-  }
979
+  bool isMediaInserted() { return TERN0(SDSUPPORT, IS_SD_INSERTED() && card.isMounted()); }
991 980
 
992 981
   void pausePrint() { ui.pause_print(); }
993 982
   void resumePrint() { ui.resume_print(); }
@@ -1022,27 +1011,27 @@ namespace ExtUI {
1022 1011
   }
1023 1012
 
1024 1013
   const char* FileList::filename() {
1025
-    return IFSD(card.longest_filename(), "");
1014
+    return TERN(SDSUPPORT, card.longest_filename(), "");
1026 1015
   }
1027 1016
 
1028 1017
   const char* FileList::shortFilename() {
1029
-    return IFSD(card.filename, "");
1018
+    return TERN(SDSUPPORT, card.filename, "");
1030 1019
   }
1031 1020
 
1032 1021
   const char* FileList::longFilename() {
1033
-    return IFSD(card.longFilename, "");
1022
+    return TERN(SDSUPPORT, card.longFilename, "");
1034 1023
   }
1035 1024
 
1036 1025
   bool FileList::isDir() {
1037
-    return IFSD(card.flag.filenameIsDir, false);
1026
+    return TERN0(SDSUPPORT, card.flag.filenameIsDir);
1038 1027
   }
1039 1028
 
1040 1029
   uint16_t FileList::count() {
1041
-    return IFSD((num_files = (num_files == 0xFFFF ? card.get_num_Files() : num_files)), 0);
1030
+    return TERN0(SDSUPPORT, (num_files = (num_files == 0xFFFF ? card.get_num_Files() : num_files)));
1042 1031
   }
1043 1032
 
1044 1033
   bool FileList::isAtRootDir() {
1045
-    return IFSD(card.flag.workDirIsRoot, true);
1034
+    return TERN1(SDSUPPORT, card.flag.workDirIsRoot);
1046 1035
   }
1047 1036
 
1048 1037
   void FileList::upDir() {

+ 37
- 36
Marlin/src/lcd/extui/ui_api.h ファイルの表示

@@ -102,11 +102,11 @@ namespace ExtUI {
102 102
   #if HAS_TRINAMIC_CONFIG
103 103
     float getAxisCurrent_mA(const axis_t);
104 104
     float getAxisCurrent_mA(const extruder_t);
105
-    void  setAxisCurrent_mA(const float, const axis_t);
106
-    void  setAxisCurrent_mA(const float, const extruder_t);
105
+    void  setAxisCurrent_mA(const float&, const axis_t);
106
+    void  setAxisCurrent_mA(const float&, const extruder_t);
107 107
 
108 108
      int getTMCBumpSensitivity(const axis_t);
109
-    void setTMCBumpSensitivity(const float, const axis_t);
109
+    void setTMCBumpSensitivity(const float&, const axis_t);
110 110
   #endif
111 111
 
112 112
   float getActualTemp_celsius(const heater_t);
@@ -150,10 +150,10 @@ namespace ExtUI {
150 150
     #if HAS_MESH
151 151
       bed_mesh_t& getMeshArray();
152 152
       float getMeshPoint(const xy_uint8_t &pos);
153
-      void setMeshPoint(const xy_uint8_t &pos, const float zval);
153
+      void setMeshPoint(const xy_uint8_t &pos, const float &zval);
154 154
       void onMeshLevelingStart();
155
-      void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
156
-      inline void onMeshUpdate(const xy_int8_t &pos, const float zval) { onMeshUpdate(pos.x, pos.y, zval); }
155
+      void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float &zval);
156
+      inline void onMeshUpdate(const xy_int8_t &pos, const float &zval) { onMeshUpdate(pos.x, pos.y, zval); }
157 157
 
158 158
       typedef enum : uint8_t {
159 159
         MESH_START,    // Prior to start of probe
@@ -178,41 +178,42 @@ namespace ExtUI {
178 178
     char* getFilamentUsed_str(char buffer[21]);
179 179
   #endif
180 180
 
181
-  void setTargetTemp_celsius(const float, const heater_t);
182
-  void setTargetTemp_celsius(const float, const extruder_t);
183
-  void setTargetFan_percent(const float, const fan_t);
184
-  void setAxisPosition_mm(const float, const axis_t, const feedRate_t=0);
185
-  void setAxisPosition_mm(const float, const extruder_t, const feedRate_t=0);
186
-  void setAxisSteps_per_mm(const float, const axis_t);
187
-  void setAxisSteps_per_mm(const float, const extruder_t);
181
+  void setTargetTemp_celsius(const float&, const heater_t);
182
+  void setTargetTemp_celsius(const float&, const extruder_t);
183
+  void setTargetFan_percent(const float&, const fan_t);
184
+  void coolDown();
185
+  void setAxisPosition_mm(const float&, const axis_t, const feedRate_t=0);
186
+  void setAxisPosition_mm(const float&, const extruder_t, const feedRate_t=0);
187
+  void setAxisSteps_per_mm(const float&, const axis_t);
188
+  void setAxisSteps_per_mm(const float&, const extruder_t);
188 189
   void setAxisMaxFeedrate_mm_s(const feedRate_t, const axis_t);
189 190
   void setAxisMaxFeedrate_mm_s(const feedRate_t, const extruder_t);
190
-  void setAxisMaxAcceleration_mm_s2(const float, const axis_t);
191
-  void setAxisMaxAcceleration_mm_s2(const float, const extruder_t);
191
+  void setAxisMaxAcceleration_mm_s2(const float&, const axis_t);
192
+  void setAxisMaxAcceleration_mm_s2(const float&, const extruder_t);
192 193
   void setFeedrate_mm_s(const feedRate_t);
193 194
   void setMinFeedrate_mm_s(const feedRate_t);
194 195
   void setMinTravelFeedrate_mm_s(const feedRate_t);
195
-  void setPrintingAcceleration_mm_s2(const float);
196
-  void setRetractAcceleration_mm_s2(const float);
197
-  void setTravelAcceleration_mm_s2(const float);
198
-  void setFeedrate_percent(const float);
196
+  void setPrintingAcceleration_mm_s2(const float&);
197
+  void setRetractAcceleration_mm_s2(const float&);
198
+  void setTravelAcceleration_mm_s2(const float&);
199
+  void setFeedrate_percent(const float&);
199 200
   void setFlow_percent(const int16_t, const extruder_t);
200 201
   bool awaitingUserConfirm();
201 202
   void setUserConfirmed();
202 203
 
203 204
   #if ENABLED(LIN_ADVANCE)
204 205
     float getLinearAdvance_mm_mm_s(const extruder_t);
205
-    void setLinearAdvance_mm_mm_s(const float, const extruder_t);
206
+    void setLinearAdvance_mm_mm_s(const float&, const extruder_t);
206 207
   #endif
207 208
 
208 209
   #if HAS_JUNCTION_DEVIATION
209 210
     float getJunctionDeviation_mm();
210
-    void setJunctionDeviation_mm(const float);
211
+    void setJunctionDeviation_mm(const float&);
211 212
   #else
212 213
     float getAxisMaxJerk_mm_s(const axis_t);
213 214
     float getAxisMaxJerk_mm_s(const extruder_t);
214
-    void setAxisMaxJerk_mm_s(const float, const axis_t);
215
-    void setAxisMaxJerk_mm_s(const float, const extruder_t);
215
+    void setAxisMaxJerk_mm_s(const float&, const axis_t);
216
+    void setAxisMaxJerk_mm_s(const float&, const extruder_t);
216 217
   #endif
217 218
 
218 219
   extruder_t getTool(const uint8_t extruder);
@@ -220,7 +221,7 @@ namespace ExtUI {
220 221
   void setActiveTool(const extruder_t, bool no_move);
221 222
 
222 223
   #if ENABLED(BABYSTEPPING)
223
-    int16_t mmToWholeSteps(const float mm, const axis_t axis);
224
+    int16_t mmToWholeSteps(const float& mm, const axis_t axis);
224 225
 
225 226
     bool babystepAxis_steps(const int16_t steps, const axis_t axis);
226 227
     void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles);
@@ -228,28 +229,28 @@ namespace ExtUI {
228 229
 
229 230
   #if HAS_HOTEND_OFFSET
230 231
     float getNozzleOffset_mm(const axis_t, const extruder_t);
231
-    void setNozzleOffset_mm(const float, const axis_t, const extruder_t);
232
+    void setNozzleOffset_mm(const float&, const axis_t, const extruder_t);
232 233
     void normalizeNozzleOffset(const axis_t axis);
233 234
   #endif
234 235
 
235 236
   float getZOffset_mm();
236
-  void setZOffset_mm(const float);
237
+  void setZOffset_mm(const float&);
237 238
 
238 239
   #if HAS_BED_PROBE
239 240
     float getProbeOffset_mm(const axis_t);
240
-    void setProbeOffset_mm(const float, const axis_t);
241
+    void setProbeOffset_mm(const float&, const axis_t);
241 242
   #endif
242 243
 
243 244
   #if ENABLED(BACKLASH_GCODE)
244 245
     float getAxisBacklash_mm(const axis_t);
245
-    void setAxisBacklash_mm(const float, const axis_t);
246
+    void setAxisBacklash_mm(const float&, const axis_t);
246 247
 
247 248
     float getBacklashCorrection_percent();
248
-    void setBacklashCorrection_percent(const float);
249
+    void setBacklashCorrection_percent(const float&);
249 250
 
250 251
     #ifdef BACKLASH_SMOOTHING_MM
251 252
       float getBacklashSmoothing_mm();
252
-      void setBacklashSmoothing_mm(const float);
253
+      void setBacklashSmoothing_mm(const float&);
253 254
     #endif
254 255
   #endif
255 256
 
@@ -261,7 +262,7 @@ namespace ExtUI {
261 262
 
262 263
     #if HAS_FILAMENT_RUNOUT_DISTANCE
263 264
       float getFilamentRunoutDistance_mm();
264
-      void setFilamentRunoutDistance_mm(const float);
265
+      void setFilamentRunoutDistance_mm(const float&);
265 266
     #endif
266 267
   #endif
267 268
 
@@ -271,7 +272,7 @@ namespace ExtUI {
271 272
 
272 273
     #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
273 274
       float getCaseLightBrightness_percent();
274
-      void setCaseLightBrightness_percent(const float);
275
+      void setCaseLightBrightness_percent(const float&);
275 276
     #endif
276 277
   #endif
277 278
 
@@ -279,16 +280,16 @@ namespace ExtUI {
279 280
     float getPIDValues_Kp(const extruder_t);
280 281
     float getPIDValues_Ki(const extruder_t);
281 282
     float getPIDValues_Kd(const extruder_t);
282
-    void setPIDValues(const float, const float, const float, extruder_t);
283
-    void startPIDTune(const float, extruder_t);
283
+    void setPIDValues(const float&, const float&, const float&, extruder_t);
284
+    void startPIDTune(const float&, extruder_t);
284 285
   #endif
285 286
 
286 287
   #if ENABLED(PIDTEMPBED)
287 288
     float getBedPIDValues_Kp();
288 289
     float getBedPIDValues_Ki();
289 290
     float getBedPIDValues_Kd();
290
-    void setBedPIDValues(const float, const float, const float);
291
-    void startBedPIDTune(const float);
291
+    void setBedPIDValues(const float&, const float&, const float&);
292
+    void startBedPIDTune(const float&);
292 293
   #endif
293 294
 
294 295
   /**

+ 0
- 2
Marlin/src/sd/cardreader.h ファイルの表示

@@ -23,8 +23,6 @@
23 23
 
24 24
 #include "../inc/MarlinConfig.h"
25 25
 
26
-#define IFSD(A,B) TERN(SDSUPPORT,A,B)
27
-
28 26
 #if ENABLED(SDSUPPORT)
29 27
 
30 28
 extern const char M23_STR[], M24_STR[];

読み込み中…
キャンセル
保存