Browse Source

Fix UBL compilation warnings

Thomas Moore 6 years ago
parent
commit
8afc4f8d9d

+ 1
- 1
Marlin/src/feature/pause.h View File

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

+ 19
- 1
Marlin/src/gcode/queue.cpp View File

147
  */
147
  */
148
 void enqueue_and_echo_commands_P(const char * const pgcode) {
148
 void enqueue_and_echo_commands_P(const char * const pgcode) {
149
   injected_commands_P = pgcode;
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
  * Send an "ok" message to the host, indicating
172
  * Send an "ok" message to the host, indicating
155
  * that a command was successfully processed.
173
  * that a command was successfully processed.

+ 16
- 0
Marlin/src/gcode/queue.h View File

90
  */
90
  */
91
 bool enqueue_and_echo_command(const char* cmd, bool say_ok=false);
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
  * Add to the circular command queue the next command from:
110
  * Add to the circular command queue the next command from:
95
  *  - The command-injection queue (injected_commands_P)
111
  *  - The command-injection queue (injected_commands_P)

+ 19
- 13
Marlin/src/lcd/ultralcd.cpp View File

1751
      * If the queue is full, the command will fail, so we have to loop
1751
      * If the queue is full, the command will fail, so we have to loop
1752
      * with idle() to make sure the command has been enqueued.
1752
      * with idle() to make sure the command has been enqueued.
1753
      */
1753
      */
1754
-    void lcd_enqueue_command_sram(char * const cmd) {
1754
+    void lcd_enqueue_command(char * const cmd) {
1755
       no_reentry = true;
1755
       no_reentry = true;
1756
-      while (enqueue_and_echo_command(cmd)) idle();
1756
+      enqueue_and_echo_command_now(cmd);
1757
+      no_reentry = false;
1758
+    }
1759
+
1760
+    void lcd_enqueue_commands_P(const char * const cmd) {
1761
+      no_reentry = true;
1762
+      enqueue_and_echo_commands_P_now(cmd);
1757
       no_reentry = false;
1763
       no_reentry = false;
1758
     }
1764
     }
1759
 
1765
 
2082
       enqueue_and_echo_commands_P(PSTR("G28"));
2088
       enqueue_and_echo_commands_P(PSTR("G28"));
2083
       #if HAS_TEMP_BED
2089
       #if HAS_TEMP_BED
2084
         sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
2090
         sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
2085
-        lcd_enqueue_command_sram(UBL_LCD_GCODE);
2091
+        lcd_enqueue_command(UBL_LCD_GCODE);
2086
       #endif
2092
       #endif
2087
       sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp);
2093
       sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp);
2088
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2094
+      lcd_enqueue_command(UBL_LCD_GCODE);
2089
       enqueue_and_echo_commands_P(PSTR("G29 P1"));
2095
       enqueue_and_echo_commands_P(PSTR("G29 P1"));
2090
     }
2096
     }
2091
 
2097
 
2116
       const int ind = ubl_height_amount > 0 ? 9 : 10;
2122
       const int ind = ubl_height_amount > 0 ? 9 : 10;
2117
       strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
2123
       strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
2118
       sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
2124
       sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
2119
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2125
+      lcd_enqueue_command(UBL_LCD_GCODE);
2120
     }
2126
     }
2121
 
2127
 
2122
     /**
2128
     /**
2167
         #endif
2173
         #endif
2168
       ;
2174
       ;
2169
       sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), temp, custom_hotend_temp);
2175
       sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), temp, custom_hotend_temp);
2170
-      lcd_enqueue_command_sram("G28");
2171
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2176
+      lcd_enqueue_commands_P(PSTR("G28"));
2177
+      lcd_enqueue_command(UBL_LCD_GCODE);
2172
     }
2178
     }
2173
 
2179
 
2174
     /**
2180
     /**
2201
     void _lcd_ubl_grid_level_cmd() {
2207
     void _lcd_ubl_grid_level_cmd() {
2202
       char UBL_LCD_GCODE[10];
2208
       char UBL_LCD_GCODE[10];
2203
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points);
2209
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points);
2204
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2210
+      lcd_enqueue_command(UBL_LCD_GCODE);
2205
     }
2211
     }
2206
 
2212
 
2207
     /**
2213
     /**
2242
     void _lcd_ubl_fillin_amount_cmd() {
2248
     void _lcd_ubl_fillin_amount_cmd() {
2243
       char UBL_LCD_GCODE[16];
2249
       char UBL_LCD_GCODE[16];
2244
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount);
2250
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount);
2245
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2251
+      lcd_enqueue_command(UBL_LCD_GCODE);
2246
     }
2252
     }
2247
 
2253
 
2248
     /**
2254
     /**
2334
     void _lcd_ubl_load_mesh_cmd() {
2340
     void _lcd_ubl_load_mesh_cmd() {
2335
       char UBL_LCD_GCODE[10];
2341
       char UBL_LCD_GCODE[10];
2336
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot);
2342
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot);
2337
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2343
+      lcd_enqueue_command(UBL_LCD_GCODE);
2338
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_LOADED "."));
2344
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_LOADED "."));
2339
     }
2345
     }
2340
 
2346
 
2344
     void _lcd_ubl_save_mesh_cmd() {
2350
     void _lcd_ubl_save_mesh_cmd() {
2345
       char UBL_LCD_GCODE[10];
2351
       char UBL_LCD_GCODE[10];
2346
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot);
2352
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot);
2347
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2353
+      lcd_enqueue_command(UBL_LCD_GCODE);
2348
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_SAVED "."));
2354
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_SAVED "."));
2349
     }
2355
     }
2350
 
2356
 
2395
       dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
2401
       dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
2396
       dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
2402
       dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
2397
       snprintf_P(UBL_LCD_GCODE, sizeof(UBL_LCD_GCODE), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
2403
       snprintf_P(UBL_LCD_GCODE, sizeof(UBL_LCD_GCODE), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
2398
-      lcd_enqueue_command_sram(UBL_LCD_GCODE);
2404
+      lcd_enqueue_command(UBL_LCD_GCODE);
2399
     }
2405
     }
2400
 
2406
 
2401
     /**
2407
     /**
3290
           autotune_temp[e]
3296
           autotune_temp[e]
3291
         #endif
3297
         #endif
3292
       );
3298
       );
3293
-      lcd_enqueue_command_sram(cmd);
3299
+      lcd_enqueue_command(cmd);
3294
     }
3300
     }
3295
 
3301
 
3296
   #endif // PID_AUTOTUNE_MENU
3302
   #endif // PID_AUTOTUNE_MENU

+ 3
- 1
Marlin/src/module/configuration_store.cpp View File

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

+ 1
- 1
Marlin/src/sd/cardreader.cpp View File

287
   char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null
287
   char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null
288
   sprintf_P(cmd, PSTR("M23 %s"), name);
288
   sprintf_P(cmd, PSTR("M23 %s"), name);
289
   for (char *c = &cmd[4]; *c; c++) *c = tolower(*c);
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
   enqueue_and_echo_commands_P(PSTR("M24"));
291
   enqueue_and_echo_commands_P(PSTR("M24"));
292
 }
292
 }
293
 
293
 

Loading…
Cancel
Save