Ver código fonte

Merge pull request #8989 from tcm0116/2.0.x_ubl

[2.0.x] Fix UBL compilation warnings
Scott Lahteine 7 anos atrás
pai
commit
fc67c64b8f
Nenhuma conta vinculada ao e-mail do autor do commit

+ 1
- 1
Marlin/src/feature/pause.h Ver arquivo

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 Ver arquivo

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 Ver arquivo

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 Ver arquivo

1748
      * If the queue is full, the command will fail, so we have to loop
1748
      * If the queue is full, the command will fail, so we have to loop
1749
      * with idle() to make sure the command has been enqueued.
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
       no_reentry = true;
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
       no_reentry = false;
1760
       no_reentry = false;
1755
     }
1761
     }
1756
 
1762
 
2079
       enqueue_and_echo_commands_P(PSTR("G28"));
2085
       enqueue_and_echo_commands_P(PSTR("G28"));
2080
       #if HAS_TEMP_BED
2086
       #if HAS_TEMP_BED
2081
         sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
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
       #endif
2089
       #endif
2084
       sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp);
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
       enqueue_and_echo_commands_P(PSTR("G29 P1"));
2092
       enqueue_and_echo_commands_P(PSTR("G29 P1"));
2087
     }
2093
     }
2088
 
2094
 
2113
       const int ind = ubl_height_amount > 0 ? 9 : 10;
2119
       const int ind = ubl_height_amount > 0 ? 9 : 10;
2114
       strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
2120
       strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
2115
       sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
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
         #endif
2170
         #endif
2165
       ;
2171
       ;
2166
       sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), temp, custom_hotend_temp);
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
     void _lcd_ubl_grid_level_cmd() {
2204
     void _lcd_ubl_grid_level_cmd() {
2199
       char UBL_LCD_GCODE[10];
2205
       char UBL_LCD_GCODE[10];
2200
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points);
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
     void _lcd_ubl_fillin_amount_cmd() {
2245
     void _lcd_ubl_fillin_amount_cmd() {
2240
       char UBL_LCD_GCODE[16];
2246
       char UBL_LCD_GCODE[16];
2241
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount);
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
     void _lcd_ubl_load_mesh_cmd() {
2337
     void _lcd_ubl_load_mesh_cmd() {
2332
       char UBL_LCD_GCODE[10];
2338
       char UBL_LCD_GCODE[10];
2333
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot);
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
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_LOADED "."));
2341
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_LOADED "."));
2336
     }
2342
     }
2337
 
2343
 
2341
     void _lcd_ubl_save_mesh_cmd() {
2347
     void _lcd_ubl_save_mesh_cmd() {
2342
       char UBL_LCD_GCODE[10];
2348
       char UBL_LCD_GCODE[10];
2343
       sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot);
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
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_SAVED "."));
2351
       enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_SAVED "."));
2346
     }
2352
     }
2347
 
2353
 
2392
       dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
2398
       dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
2393
       dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
2399
       dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
2394
       snprintf_P(UBL_LCD_GCODE, sizeof(UBL_LCD_GCODE), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
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
           autotune_temp[e]
3293
           autotune_temp[e]
3288
         #endif
3294
         #endif
3289
       );
3295
       );
3290
-      lcd_enqueue_command_sram(cmd);
3296
+      lcd_enqueue_command(cmd);
3291
     }
3297
     }
3292
 
3298
 
3293
   #endif // PID_AUTOTUNE_MENU
3299
   #endif // PID_AUTOTUNE_MENU

+ 3
- 1
Marlin/src/module/configuration_store.cpp Ver arquivo

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 Ver arquivo

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
 

Carregando…
Cancelar
Salvar