瀏覽代碼

Merge pull request #8989 from tcm0116/2.0.x_ubl

[2.0.x] Fix UBL compilation warnings
Scott Lahteine 7 年之前
父節點
當前提交
fc67c64b8f
沒有連結到貢獻者的電子郵件帳戶。

+ 1
- 1
Marlin/src/feature/pause.h 查看文件

@@ -30,7 +30,7 @@
30 30
 
31 31
 #include "../libs/nozzle.h"
32 32
 
33
-extern bool did_pause_print;
33
+extern uint8_t did_pause_print;
34 34
 
35 35
 bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0,
36 36
                  const int8_t max_beep_count=0, const bool show_lcd=false

+ 19
- 1
Marlin/src/gcode/queue.cpp 查看文件

@@ -147,9 +147,27 @@ static bool drain_injected_commands_P() {
147 147
  */
148 148
 void enqueue_and_echo_commands_P(const char * const pgcode) {
149 149
   injected_commands_P = pgcode;
150
-  drain_injected_commands_P(); // first command executed asap (when possible)
150
+  (void)drain_injected_commands_P(); // first command executed asap (when possible)
151 151
 }
152 152
 
153
+#if HAS_QUEUE_NOW
154
+  /**
155
+   * Enqueue and return only when commands are actually enqueued
156
+   */
157
+  void enqueue_and_echo_command_now(const char* cmd, bool say_ok/*=false*/) {
158
+    while (!enqueue_and_echo_command(cmd, say_ok)) idle();
159
+  }
160
+  #if HAS_LCD_QUEUE_NOW
161
+    /**
162
+     * Enqueue from program memory and return only when commands are actually enqueued
163
+     */
164
+    void enqueue_and_echo_commands_P_now(const char * const pgcode) {
165
+      enqueue_and_echo_commands_P(pgcode);
166
+      while (drain_injected_commands_P()) idle();
167
+    }
168
+  #endif
169
+#endif
170
+
153 171
 /**
154 172
  * Send an "ok" message to the host, indicating
155 173
  * that a command was successfully processed.

+ 16
- 0
Marlin/src/gcode/queue.h 查看文件

@@ -90,6 +90,22 @@ void enqueue_and_echo_commands_P(const char * const pgcode);
90 90
  */
91 91
 bool enqueue_and_echo_command(const char* cmd, bool say_ok=false);
92 92
 
93
+#define HAS_LCD_QUEUE_NOW (ENABLED(ULTIPANEL) && (ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)))
94
+#define HAS_QUEUE_NOW (ENABLED(SDSUPPORT) || HAS_LCD_QUEUE_NOW)
95
+
96
+#if HAS_QUEUE_NOW
97
+  /**
98
+   * Enqueue and return only when commands are actually enqueued
99
+   */
100
+  void enqueue_and_echo_command_now(const char* cmd, bool say_ok=false);
101
+  #if HAS_LCD_QUEUE_NOW
102
+    /**
103
+     * Enqueue from program memory and return only when commands are actually enqueued
104
+     */
105
+    void enqueue_and_echo_commands_P_now(const char * const cmd);
106
+  #endif
107
+#endif
108
+
93 109
 /**
94 110
  * Add to the circular command queue the next command from:
95 111
  *  - The command-injection queue (injected_commands_P)

+ 19
- 13
Marlin/src/lcd/ultralcd.cpp 查看文件

@@ -1748,9 +1748,15 @@ void kill_screen(const char* lcd_msg) {
1748 1748
      * If the queue is full, the command will fail, so we have to loop
1749 1749
      * with idle() to make sure the command has been enqueued.
1750 1750
      */
1751
-    void lcd_enqueue_command_sram(char * const cmd) {
1751
+    void lcd_enqueue_command(char * const cmd) {
1752 1752
       no_reentry = true;
1753
-      while (enqueue_and_echo_command(cmd)) idle();
1753
+      enqueue_and_echo_command_now(cmd);
1754
+      no_reentry = false;
1755
+    }
1756
+
1757
+    void lcd_enqueue_commands_P(const char * const cmd) {
1758
+      no_reentry = true;
1759
+      enqueue_and_echo_commands_P_now(cmd);
1754 1760
       no_reentry = false;
1755 1761
     }
1756 1762
 
@@ -2079,10 +2085,10 @@ void kill_screen(const char* lcd_msg) {
2079 2085
       enqueue_and_echo_commands_P(PSTR("G28"));
2080 2086
       #if HAS_TEMP_BED
2081 2087
         sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
2082
-        lcd_enqueue_command_sram(UBL_LCD_GCODE);
2088
+        lcd_enqueue_command(UBL_LCD_GCODE);
2083 2089
       #endif
2084 2090
       sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp);
2085
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2091
+      lcd_enqueue_command(UBL_LCD_GCODE);
2086 2092
       enqueue_and_echo_commands_P(PSTR("G29 P1"));
2087 2093
     }
2088 2094
 
@@ -2113,7 +2119,7 @@ void kill_screen(const char* lcd_msg) {
2113 2119
       const int ind = ubl_height_amount > 0 ? 9 : 10;
2114 2120
       strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
2115 2121
       sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
2116
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2122
+      lcd_enqueue_command(UBL_LCD_GCODE);
2117 2123
     }
2118 2124
 
2119 2125
     /**
@@ -2164,8 +2170,8 @@ void kill_screen(const char* lcd_msg) {
2164 2170
         #endif
2165 2171
       ;
2166 2172
       sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), temp, custom_hotend_temp);
2167
-      lcd_enqueue_command_sram("G28");
2168
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2173
+      lcd_enqueue_commands_P(PSTR("G28"));
2174
+      lcd_enqueue_command(UBL_LCD_GCODE);
2169 2175
     }
2170 2176
 
2171 2177
     /**
@@ -2198,7 +2204,7 @@ void kill_screen(const char* lcd_msg) {
2198 2204
     void _lcd_ubl_grid_level_cmd() {
2199 2205
       char UBL_LCD_GCODE[10];
2200 2206
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points);
2201
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2207
+      lcd_enqueue_command(UBL_LCD_GCODE);
2202 2208
     }
2203 2209
 
2204 2210
     /**
@@ -2239,7 +2245,7 @@ void kill_screen(const char* lcd_msg) {
2239 2245
     void _lcd_ubl_fillin_amount_cmd() {
2240 2246
       char UBL_LCD_GCODE[16];
2241 2247
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount);
2242
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2248
+      lcd_enqueue_command(UBL_LCD_GCODE);
2243 2249
     }
2244 2250
 
2245 2251
     /**
@@ -2331,7 +2337,7 @@ void kill_screen(const char* lcd_msg) {
2331 2337
     void _lcd_ubl_load_mesh_cmd() {
2332 2338
       char UBL_LCD_GCODE[10];
2333 2339
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot);
2334
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2340
+      lcd_enqueue_command(UBL_LCD_GCODE);
2335 2341
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_LOADED "."));
2336 2342
     }
2337 2343
 
@@ -2341,7 +2347,7 @@ void kill_screen(const char* lcd_msg) {
2341 2347
     void _lcd_ubl_save_mesh_cmd() {
2342 2348
       char UBL_LCD_GCODE[10];
2343 2349
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot);
2344
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2350
+      lcd_enqueue_command(UBL_LCD_GCODE);
2345 2351
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_SAVED "."));
2346 2352
     }
2347 2353
 
@@ -2392,7 +2398,7 @@ void kill_screen(const char* lcd_msg) {
2392 2398
       dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
2393 2399
       dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
2394 2400
       snprintf_P(UBL_LCD_GCODE, sizeof(UBL_LCD_GCODE), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
2395
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2401
+      lcd_enqueue_command(UBL_LCD_GCODE);
2396 2402
     }
2397 2403
 
2398 2404
     /**
@@ -3287,7 +3293,7 @@ void kill_screen(const char* lcd_msg) {
3287 3293
           autotune_temp[e]
3288 3294
         #endif
3289 3295
       );
3290
-      lcd_enqueue_command_sram(cmd);
3296
+      lcd_enqueue_command(cmd);
3291 3297
     }
3292 3298
 
3293 3299
   #endif // PID_AUTOTUNE_MENU

+ 3
- 1
Marlin/src/module/configuration_store.cpp 查看文件

@@ -759,7 +759,9 @@ void MarlinSettings::postprocess() {
759 759
     }
760 760
     else {
761 761
       float dummy = 0;
762
-      bool dummyb;
762
+      #if DISABLED(AUTO_BED_LEVELING_UBL) || DISABLED(FWRETRACT)
763
+        bool dummyb;
764
+      #endif
763 765
 
764 766
       working_crc = 0;  // Init to 0. Accumulated by EEPROM_READ
765 767
 

+ 1
- 1
Marlin/src/sd/cardreader.cpp 查看文件

@@ -287,7 +287,7 @@ void CardReader::openAndPrintFile(const char *name) {
287 287
   char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null
288 288
   sprintf_P(cmd, PSTR("M23 %s"), name);
289 289
   for (char *c = &cmd[4]; *c; c++) *c = tolower(*c);
290
-  enqueue_and_echo_command(cmd);
290
+  enqueue_and_echo_command_now(cmd);
291 291
   enqueue_and_echo_commands_P(PSTR("M24"));
292 292
 }
293 293
 

Loading…
取消
儲存