Przeglądaj źródła

Various fixes for MarlinUI and ExtUI (#12439)

Marcio Teixeira 6 lat temu
rodzic
commit
c1e17037e5

+ 5
- 0
Marlin/Makefile Wyświetl plik

510
   VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/USB
510
   VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/USB
511
   VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/Wire/src
511
   VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/Wire/src
512
   VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/SPI/src
512
   VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/SPI/src
513
+  VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/U8glib/src/clib
513
   VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim
514
   VPATH   += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim
514
   LDSCRIPT = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/linker_scripts/gcc/flash.ld
515
   LDSCRIPT = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/linker_scripts/gcc/flash.ld
515
   LDLIBS   = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/libsam_sam3x8e_gcc_rel.a
516
   LDLIBS   = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/libsam_sam3x8e_gcc_rel.a
611
   CDEFS      += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"'
612
   CDEFS      += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"'
612
   LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp  USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp  USBCore.cpp
613
   LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp  USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp  USBCore.cpp
613
   LIB_SRC    += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
614
   LIB_SRC    += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
615
+
616
+  ifeq ($(U8GLIB), 1)
617
+    LIB_SRC += u8g_com_api.c u8g_pb32h1.c
618
+  endif
614
 endif
619
 endif
615
 
620
 
616
 # Add all the source directories as include directories too
621
 # Add all the source directories as include directories too

+ 1
- 1
Marlin/src/core/macros.h Wyświetl plik

196
 #define MMM_TO_MMS(MM_M) ((MM_M)/60.0f)
196
 #define MMM_TO_MMS(MM_M) ((MM_M)/60.0f)
197
 #define MMS_TO_MMM(MM_S) ((MM_S)*60.0f)
197
 #define MMS_TO_MMM(MM_S) ((MM_S)*60.0f)
198
 
198
 
199
-#define NOOP do{} while(0)
199
+#define NOOP (0)
200
 
200
 
201
 #define CEILING(x,y) (((x) + (y) - 1) / (y))
201
 #define CEILING(x,y) (((x) + (y) - 1) / (y))
202
 
202
 

+ 2
- 2
Marlin/src/core/serial.cpp Wyświetl plik

25
 
25
 
26
 uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE;
26
 uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE;
27
 
27
 
28
-const char errormagic[] PROGMEM = "Error:";
29
-const char echomagic[]  PROGMEM = "echo:";
28
+static const char errormagic[] PROGMEM = "Error:";
29
+static const char echomagic[]  PROGMEM = "echo:";
30
 
30
 
31
 #if NUM_SERIAL > 1
31
 #if NUM_SERIAL > 1
32
   void serialprintPGM_P(const int8_t p, const char * str) {
32
   void serialprintPGM_P(const int8_t p, const char * str) {

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Wyświetl plik

917
     }
917
     }
918
 
918
 
919
     inline void set_message_with_feedback(PGM_P const msg_P) {
919
     inline void set_message_with_feedback(PGM_P const msg_P) {
920
-      ui.setstatusPGM(msg_P);
920
+      ui.set_status_P(msg_P);
921
       ui.quick_feedback();
921
       ui.quick_feedback();
922
     }
922
     }
923
 
923
 

+ 7
- 2
Marlin/src/feature/pause.cpp Wyświetl plik

399
 }
399
 }
400
 
400
 
401
 /**
401
 /**
402
+ * For Paused Print:
403
+ * - Show "Press button (or M108) to resume"
404
+ *
405
+ * For Filament Change:
402
  * - Show "Insert filament and press button to continue"
406
  * - Show "Insert filament and press button to continue"
407
+ *
403
  * - Wait for a click before returning
408
  * - Wait for a click before returning
404
- * - Heaters can time out, reheated before accepting a click
409
+ * - Heaters can time out and must reheat before continuing
405
  *
410
  *
406
  * Used by M125 and M600
411
  * Used by M125 and M600
407
  */
412
  */
408
 
413
 
409
-#if HAS_LCD_MENU && ENABLED(EMERGENCY_PARSER)
414
+#if (HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)) && ENABLED(EMERGENCY_PARSER)
410
   #define _PMSG(L) L
415
   #define _PMSG(L) L
411
 #elif ENABLED(EMERGENCY_PARSER)
416
 #elif ENABLED(EMERGENCY_PARSER)
412
   #define _PMSG(L) L##_M108
417
   #define _PMSG(L) L##_M108

+ 7
- 7
Marlin/src/gcode/bedlevel/G26.cpp Wyświetl plik

164
    */
164
    */
165
   bool user_canceled() {
165
   bool user_canceled() {
166
     if (!ui.button_pressed()) return false; // Return if the button isn't pressed
166
     if (!ui.button_pressed()) return false; // Return if the button isn't pressed
167
-    ui.setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
167
+    ui.set_status_P(PSTR("Mesh Validation Stopped."), 99);
168
     #if HAS_LCD_MENU
168
     #if HAS_LCD_MENU
169
       ui.quick_feedback();
169
       ui.quick_feedback();
170
     #endif
170
     #endif
414
 
414
 
415
     if (g26_bed_temp > 25) {
415
     if (g26_bed_temp > 25) {
416
       #if ENABLED(ULTRA_LCD)
416
       #if ENABLED(ULTRA_LCD)
417
-        ui.setstatusPGM(PSTR("G26 Heating Bed."), 99);
417
+        ui.set_status_P(PSTR("G26 Heating Bed."), 99);
418
         ui.quick_feedback();
418
         ui.quick_feedback();
419
         #if HAS_LCD_MENU
419
         #if HAS_LCD_MENU
420
           ui.capture();
420
           ui.capture();
435
 
435
 
436
   // Start heating the active nozzle
436
   // Start heating the active nozzle
437
   #if ENABLED(ULTRA_LCD)
437
   #if ENABLED(ULTRA_LCD)
438
-    ui.setstatusPGM(PSTR("G26 Heating Nozzle."), 99);
438
+    ui.set_status_P(PSTR("G26 Heating Nozzle."), 99);
439
     ui.quick_feedback();
439
     ui.quick_feedback();
440
   #endif
440
   #endif
441
   thermalManager.setTargetHotend(g26_hotend_temp, active_extruder);
441
   thermalManager.setTargetHotend(g26_hotend_temp, active_extruder);
469
     if (g26_prime_flag == -1) {  // The user wants to control how much filament gets purged
469
     if (g26_prime_flag == -1) {  // The user wants to control how much filament gets purged
470
 
470
 
471
       ui.capture();
471
       ui.capture();
472
-      ui.setstatusPGM(PSTR("User-Controlled Prime"), 99);
472
+      ui.set_status_P(PSTR("User-Controlled Prime"), 99);
473
       ui.chirp();
473
       ui.chirp();
474
 
474
 
475
       set_destination_from_current();
475
       set_destination_from_current();
493
 
493
 
494
       ui.wait_for_release();
494
       ui.wait_for_release();
495
 
495
 
496
-      ui.setstatusPGM(PSTR("Done Priming"), 99);
496
+      ui.set_status_P(PSTR("Done Priming"), 99);
497
       ui.quick_feedback();
497
       ui.quick_feedback();
498
       ui.release();
498
       ui.release();
499
     }
499
     }
501
   #endif
501
   #endif
502
   {
502
   {
503
     #if ENABLED(ULTRA_LCD)
503
     #if ENABLED(ULTRA_LCD)
504
-      ui.setstatusPGM(PSTR("Fixed Length Prime."), 99);
504
+      ui.set_status_P(PSTR("Fixed Length Prime."), 99);
505
       ui.quick_feedback();
505
       ui.quick_feedback();
506
     #endif
506
     #endif
507
     set_destination_from_current();
507
     set_destination_from_current();
894
   } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
894
   } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
895
 
895
 
896
   LEAVE:
896
   LEAVE:
897
-  ui.setstatusPGM(PSTR("Leaving G26"), -1);
897
+  ui.set_status_P(PSTR("Leaving G26"), -1);
898
 
898
 
899
   retract_filament(destination);
899
   retract_filament(destination);
900
   destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
900
   destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;

+ 4
- 4
Marlin/src/gcode/calibrate/G33.cpp Wyświetl plik

522
   if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
522
   if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
523
   if (set_up) SERIAL_PROTOCOLPGM("  (SET-UP)");
523
   if (set_up) SERIAL_PROTOCOLPGM("  (SET-UP)");
524
   SERIAL_EOL();
524
   SERIAL_EOL();
525
-  ui.setstatusPGM(checkingac);
525
+  ui.set_status_P(checkingac);
526
 
526
 
527
   print_calibration_settings(_endstop_results, _angle_results);
527
   print_calibration_settings(_endstop_results, _angle_results);
528
 
528
 
683
           sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev_min * 1000.0));
683
           sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev_min * 1000.0));
684
         else
684
         else
685
           sprintf_P(&mess[15], PSTR("%03i.x"), (int)LROUND(zero_std_dev_min));
685
           sprintf_P(&mess[15], PSTR("%03i.x"), (int)LROUND(zero_std_dev_min));
686
-        ui.setstatus(mess);
686
+        ui.set_status(mess);
687
         print_calibration_settings(_endstop_results, _angle_results);
687
         print_calibration_settings(_endstop_results, _angle_results);
688
         serialprintPGM(save_message);
688
         serialprintPGM(save_message);
689
         SERIAL_EOL();
689
         SERIAL_EOL();
699
         SERIAL_PROTOCOLPGM("std dev:");
699
         SERIAL_PROTOCOLPGM("std dev:");
700
         SERIAL_PROTOCOL_F(zero_std_dev, 3);
700
         SERIAL_PROTOCOL_F(zero_std_dev, 3);
701
         SERIAL_EOL();
701
         SERIAL_EOL();
702
-        ui.setstatus(mess);
702
+        ui.set_status(mess);
703
         if (verbose_level > 1)
703
         if (verbose_level > 1)
704
           print_calibration_settings(_endstop_results, _angle_results);
704
           print_calibration_settings(_endstop_results, _angle_results);
705
       }
705
       }
719
         sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0));
719
         sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0));
720
       else
720
       else
721
         sprintf_P(&mess[15], PSTR("%03i.x"), (int)LROUND(zero_std_dev));
721
         sprintf_P(&mess[15], PSTR("%03i.x"), (int)LROUND(zero_std_dev));
722
-      ui.setstatus(mess);
722
+      ui.set_status(mess);
723
     }
723
     }
724
     ac_home();
724
     ac_home();
725
   }
725
   }

+ 1
- 1
Marlin/src/gcode/lcd/M0_M1.cpp Wyświetl plik

62
   #if HAS_LCD_MENU
62
   #if HAS_LCD_MENU
63
 
63
 
64
     if (has_message)
64
     if (has_message)
65
-      ui.setstatus(args, true);
65
+      ui.set_status(args, true);
66
     else {
66
     else {
67
       LCD_MESSAGEPGM(MSG_USERWAIT);
67
       LCD_MESSAGEPGM(MSG_USERWAIT);
68
       #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
68
       #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0

+ 1
- 1
Marlin/src/gcode/lcd/M117.cpp Wyświetl plik

28
  */
28
  */
29
 void GcodeSuite::M117() {
29
 void GcodeSuite::M117() {
30
 
30
 
31
-  ui.setstatus(parser.string_arg);
31
+  ui.set_status(parser.string_arg);
32
 
32
 
33
 }
33
 }

+ 3
- 0
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp Wyświetl plik

28
 #include "../../sd/cardreader.h"
28
 #include "../../sd/cardreader.h"
29
 #include "../../module/printcounter.h"
29
 #include "../../module/printcounter.h"
30
 #include "../../module/stepper.h"
30
 #include "../../module/stepper.h"
31
+#include "../../lcd/ultralcd.h"
31
 
32
 
32
 #if ENABLED(POWER_LOSS_RECOVERY)
33
 #if ENABLED(POWER_LOSS_RECOVERY)
33
   #include "../../feature/power_loss_recovery.h"
34
   #include "../../feature/power_loss_recovery.h"
100
     else
101
     else
101
   #endif
102
   #endif
102
       print_job_timer.start();
103
       print_job_timer.start();
104
+
105
+  ui.reset_status();
103
 }
106
 }
104
 
107
 
105
 /**
108
 /**

+ 1
- 1
Marlin/src/gcode/stats/M31.cpp Wyświetl plik

40
   char buffer[21];
40
   char buffer[21];
41
   duration_t elapsed = print_job_timer.duration();
41
   duration_t elapsed = print_job_timer.duration();
42
   elapsed.toString(buffer);
42
   elapsed.toString(buffer);
43
-  ui.setstatus(buffer);
43
+  ui.set_status(buffer);
44
 
44
 
45
   SERIAL_ECHO_START_P(port);
45
   SERIAL_ECHO_START_P(port);
46
   SERIAL_ECHOLNPAIR_P(port, "Print time: ", buffer);
46
   SERIAL_ECHOLNPAIR_P(port, "Print time: ", buffer);

+ 1
- 1
Marlin/src/gcode/temperature/M140_M190.cpp Wyświetl plik

64
   }
64
   }
65
   else return;
65
   else return;
66
 
66
 
67
-  ui.setstatusPGM(thermalManager.isHeatingBed() ? PSTR(MSG_BED_HEATING) : PSTR(MSG_BED_COOLING));
67
+  ui.set_status_P(thermalManager.isHeatingBed() ? PSTR(MSG_BED_HEATING) : PSTR(MSG_BED_COOLING));
68
 
68
 
69
   thermalManager.wait_for_bed(no_wait_for_cooling);
69
   thermalManager.wait_for_bed(no_wait_for_cooling);
70
 }
70
 }

+ 4
- 8
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp Wyświetl plik

99
   while (char c = pgm_read_byte(p_str++)) write_byte(c);
99
   while (char c = pgm_read_byte(p_str++)) write_byte(c);
100
 }
100
 }
101
 
101
 
102
-void ST7920_Lite_Status_Screen::write_str(progmem_str str) {
103
-  write_str_P((PGM_P)str);
104
-}
105
-
106
 void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
102
 void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
107
   char str[7];
103
   char str[7];
108
   PGM_P fmt;
104
   PGM_P fmt;
501
   // Draw centered
497
   // Draw centered
502
   if (value > 9) {
498
   if (value > 9) {
503
     write_number(value, 4);
499
     write_number(value, 4);
504
-    write_str(F("% "));
500
+    write_str_P(PSTR("% "));
505
   }
501
   }
506
   else {
502
   else {
507
     write_number(value, 3);
503
     write_number(value, 3);
508
-    write_str(F("%  "));
504
+    write_str_P(PSTR("%  "));
509
   }
505
   }
510
 }
506
 }
511
 
507
 
558
   write_number(temp);
554
   write_number(temp);
559
 
555
 
560
   if (showTarget) {
556
   if (showTarget) {
561
-    write_str(F("\x1A"));
557
+    write_byte('\x1A');
562
     write_number(target);
558
     write_number(target);
563
   };
559
   };
564
 
560
 
565
   if (targetStateChange) {
561
   if (targetStateChange) {
566
-    if (!showTarget) write_str(F("    "));
562
+    if (!showTarget) write_str_P(PSTR("    "));
567
     draw_degree_symbol(5, line, !showTarget);
563
     draw_degree_symbol(5, line, !showTarget);
568
     draw_degree_symbol(9, line,  showTarget);
564
     draw_degree_symbol(9, line,  showTarget);
569
   }
565
   }

+ 0
- 3
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h Wyświetl plik

18
 #include "../../core/macros.h"
18
 #include "../../core/macros.h"
19
 #include "../../libs/duration_t.h"
19
 #include "../../libs/duration_t.h"
20
 
20
 
21
-typedef const __FlashStringHelper *progmem_str;
22
-
23
 class ST7920_Lite_Status_Screen {
21
 class ST7920_Lite_Status_Screen {
24
   private:
22
   private:
25
     static struct st7920_state_t {
23
     static struct st7920_state_t {
47
     static void write_str(const char *str);
45
     static void write_str(const char *str);
48
     static void write_str(const char *str, const uint8_t len);
46
     static void write_str(const char *str, const uint8_t len);
49
     static void write_str_P(PGM_P const str);
47
     static void write_str_P(PGM_P const str);
50
-    static void write_str(progmem_str str);
51
     static void write_number(const int16_t value, const uint8_t digits=3);
48
     static void write_number(const int16_t value, const uint8_t digits=3);
52
 
49
 
53
     static void _extended_function_set(const bool extended, const bool graphics);
50
     static void _extended_function_set(const bool extended, const bool graphics);

+ 1
- 2
Marlin/src/lcd/extensible_ui/lib/example.cpp Wyświetl plik

55
   void onPrintTimerPaused() {}
55
   void onPrintTimerPaused() {}
56
   void onPrintTimerStopped() {}
56
   void onPrintTimerStopped() {}
57
   void onFilamentRunout() {}
57
   void onFilamentRunout() {}
58
-  void onStatusChanged(const char* msg) {}
59
-  void onStatusChanged(progmem_str msg) {}
58
+  void onStatusChanged(const char * const msg) {}
60
   void onFactoryReset() {}
59
   void onFactoryReset() {}
61
   void onLoadSettings() {}
60
   void onLoadSettings() {}
62
   void onStoreSettings() {}
61
   void onStoreSettings() {}

+ 27
- 38
Marlin/src/lcd/extensible_ui/ui_api.cpp Wyświetl plik

94
 } flags;
94
 } flags;
95
 
95
 
96
 namespace ExtUI {
96
 namespace ExtUI {
97
+
97
   #ifdef __SAM3X8E__
98
   #ifdef __SAM3X8E__
98
     /**
99
     /**
99
      * Implement a special millis() to allow time measurement
100
      * Implement a special millis() to allow time measurement
134
       return (uint32_t)(currTime / (F_CPU / 8000));
135
       return (uint32_t)(currTime / (F_CPU / 8000));
135
     }
136
     }
136
 
137
 
137
-  #else
138
-
139
-    // TODO: Implement for AVR
140
-    FORCE_INLINE uint32_t safe_millis() { return millis(); }
141
-
142
-  #endif
138
+  #endif // __SAM3X8E__
143
 
139
 
144
   void delay_us(unsigned long us) {
140
   void delay_us(unsigned long us) {
145
     DELAY_US(us);
141
     DELAY_US(us);
287
   }
283
   }
288
 
284
 
289
   void setActiveTool(const extruder_t extruder, bool no_move) {
285
   void setActiveTool(const extruder_t extruder, bool no_move) {
290
-    const uint8_t e = extruder - E0;
291
-    #if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
292
-      if (e != active_extruder)
293
-        tool_change(e, 0, no_move);
286
+    #if EXTRUDERS > 1
287
+      const uint8_t e = extruder - E0;
288
+      #if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
289
+        if (e != active_extruder)
290
+          tool_change(e, 0, no_move);
291
+      #endif
292
+      active_extruder = e;
294
     #endif
293
     #endif
295
-    active_extruder = e;
296
   }
294
   }
297
 
295
 
298
   extruder_t getActiveTool() {
296
   extruder_t getActiveTool() {
533
 
531
 
534
   float getFeedrate_percent() { return feedrate_percentage; }
532
   float getFeedrate_percent() { return feedrate_percentage; }
535
 
533
 
536
-  void enqueueCommands(progmem_str gcode) {
537
-    enqueue_and_echo_commands_P((PGM_P)gcode);
534
+  void enqueueCommands_P(PGM_P const gcode) {
535
+    enqueue_and_echo_commands_P(gcode);
538
   }
536
   }
539
 
537
 
540
   bool isAxisPositionKnown(const axis_t axis) {
538
   bool isAxisPositionKnown(const axis_t axis) {
541
     return TEST(axis_known_position, axis);
539
     return TEST(axis_known_position, axis);
542
   }
540
   }
543
 
541
 
544
-  progmem_str getFirmwareName_str() {
545
-    return F("Marlin " SHORT_BUILD_VERSION);
542
+  PGM_P getFirmwareName_str() {
543
+    static const char firmware_name[] PROGMEM = "Marlin " SHORT_BUILD_VERSION;
544
+    return firmware_name;
546
   }
545
   }
547
 
546
 
548
   void setTargetTemp_celsius(float value, const heater_t heater) {
547
   void setTargetTemp_celsius(float value, const heater_t heater) {
549
     #if HAS_HEATED_BED
548
     #if HAS_HEATED_BED
550
-    if (heater == BED)
551
-      thermalManager.setTargetBed(clamp(value,0,200));
549
+      if (heater == BED)
550
+        thermalManager.setTargetBed(clamp(value,0,200));
551
+      else
552
     #endif
552
     #endif
553
-      thermalManager.setTargetHotend(clamp(value,0,500), heater - H0);
553
+        thermalManager.setTargetHotend(clamp(value,0,500), heater - H0);
554
   }
554
   }
555
 
555
 
556
   void setTargetTemp_celsius(float value, const extruder_t extruder) {
556
   void setTargetTemp_celsius(float value, const extruder_t extruder) {
579
   }
579
   }
580
 
580
 
581
   bool isPrinting() {
581
   bool isPrinting() {
582
-    return (planner.movesplanned() || IS_SD_PRINTING() || isPrintingFromMedia());
582
+    return (planner.movesplanned() || isPrintingFromMedia() || IFSD(IS_SD_PRINTING(), false));
583
   }
583
   }
584
 
584
 
585
   bool isMediaInserted() {
585
   bool isMediaInserted() {
593
       #if ENABLED(PARK_HEAD_ON_PAUSE)
593
       #if ENABLED(PARK_HEAD_ON_PAUSE)
594
         enqueue_and_echo_commands_P(PSTR("M125"));
594
         enqueue_and_echo_commands_P(PSTR("M125"));
595
       #endif
595
       #endif
596
-      ExtUI::onStatusChanged(PSTR(MSG_PRINT_PAUSED));
596
+      ui.set_status_P(PSTR(MSG_PRINT_PAUSED));
597
     #endif
597
     #endif
598
   }
598
   }
599
 
599
 
600
   void resumePrint() {
600
   void resumePrint() {
601
     #if ENABLED(SDSUPPORT)
601
     #if ENABLED(SDSUPPORT)
602
+      ui.set_status_P(PSTR(MSG_FILAMENT_CHANGE_RESUME_1));
602
       #if ENABLED(PARK_HEAD_ON_PAUSE)
603
       #if ENABLED(PARK_HEAD_ON_PAUSE)
604
+        wait_for_heatup = wait_for_user = false;
603
         enqueue_and_echo_commands_P(PSTR("M24"));
605
         enqueue_and_echo_commands_P(PSTR("M24"));
604
       #else
606
       #else
605
         card.startFileprint();
607
         card.startFileprint();
606
         print_job_timer.start();
608
         print_job_timer.start();
607
       #endif
609
       #endif
608
-      ExtUI::onStatusChanged(PSTR(MSG_PRINTING));
609
     #endif
610
     #endif
610
   }
611
   }
611
 
612
 
613
     #if ENABLED(SDSUPPORT)
614
     #if ENABLED(SDSUPPORT)
614
       wait_for_heatup = wait_for_user = false;
615
       wait_for_heatup = wait_for_user = false;
615
       card.flag.abort_sd_printing = true;
616
       card.flag.abort_sd_printing = true;
616
-      ExtUI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
617
+      ui.set_status_P(PSTR(MSG_PRINT_ABORTED));
617
     #endif
618
     #endif
618
   }
619
   }
619
 
620
 
621
 
622
 
622
   void FileList::refresh() { num_files = 0xFFFF; }
623
   void FileList::refresh() { num_files = 0xFFFF; }
623
 
624
 
624
-  bool FileList::seek(uint16_t pos, bool skip_range_check) {
625
+  bool FileList::seek(const uint16_t pos, const bool skip_range_check) {
625
     #if ENABLED(SDSUPPORT)
626
     #if ENABLED(SDSUPPORT)
626
       if (!skip_range_check && pos > (count() - 1)) return false;
627
       if (!skip_range_check && pos > (count() - 1)) return false;
627
       const uint16_t nr =
628
       const uint16_t nr =
632
 
633
 
633
       card.getfilename_sorted(nr);
634
       card.getfilename_sorted(nr);
634
       return card.filename && card.filename[0] != '\0';
635
       return card.filename && card.filename[0] != '\0';
636
+    #else
637
+      return false;
635
     #endif
638
     #endif
636
   }
639
   }
637
 
640
 
671
     #endif
674
     #endif
672
   }
675
   }
673
 
676
 
674
-  void FileList::changeDir(const char *dirname) {
677
+  void FileList::changeDir(const char * const dirname) {
675
     #if ENABLED(SDSUPPORT)
678
     #if ENABLED(SDSUPPORT)
676
       card.chdir(dirname);
679
       card.chdir(dirname);
677
       num_files = 0xFFFF;
680
       num_files = 0xFFFF;
713
   ExtUI::onIdle();
716
   ExtUI::onIdle();
714
 }
717
 }
715
 
718
 
716
-void MarlinUI::setstatus(const char * const message, const bool persist/*=false*/)  { ExtUI::onStatusChanged(message); }
717
-void MarlinUI::setstatusPGM(PGM_P const message, int8_t level/*=0*/)                { ExtUI::onStatusChanged((progmem_str)message); }
718
-void MarlinUI::setalertstatusPGM(PGM_P const message)                               { setstatusPGM(message, 0); }
719
-
720
-void MarlinUI::status_printf_P(const uint8_t level, const char * const fmt, ...) {
721
-  char buff[64];
722
-  va_list args;
723
-  va_start(args, fmt);
724
-  vsnprintf_P(buff, sizeof(buff), fmt, args);
725
-  va_end(args);
726
-  buff[63] = '\0';
727
-  ExtUI::onStatusChanged(buff);
728
-}
729
-
730
 void MarlinUI::kill_screen(PGM_P const msg) {
719
 void MarlinUI::kill_screen(PGM_P const msg) {
731
   if (!flags.printer_killed) {
720
   if (!flags.printer_killed) {
732
     flags.printer_killed = true;
721
     flags.printer_killed = true;

+ 11
- 9
Marlin/src/lcd/extensible_ui/ui_api.h Wyświetl plik

45
 
45
 
46
 #include "../../inc/MarlinConfig.h"
46
 #include "../../inc/MarlinConfig.h"
47
 
47
 
48
-typedef const __FlashStringHelper *progmem_str;
49
-
50
 namespace ExtUI {
48
 namespace ExtUI {
51
 
49
 
52
   enum axis_t     : uint8_t { X, Y, Z };
50
   enum axis_t     : uint8_t { X, Y, Z };
62
   bool isAxisPositionKnown(const axis_t);
60
   bool isAxisPositionKnown(const axis_t);
63
   bool canMove(const axis_t);
61
   bool canMove(const axis_t);
64
   bool canMove(const extruder_t);
62
   bool canMove(const extruder_t);
65
-  void enqueueCommands(progmem_str);
63
+  void enqueueCommands_P(PGM_P const);
66
 
64
 
67
   /**
65
   /**
68
    * Getters and setters
66
    * Getters and setters
69
    * Should be used by the EXTENSIBLE_UI to query or change Marlin's state.
67
    * Should be used by the EXTENSIBLE_UI to query or change Marlin's state.
70
    */
68
    */
71
-  progmem_str getFirmwareName_str();
69
+  PGM_P getFirmwareName_str();
72
 
70
 
73
   float getActualTemp_celsius(const heater_t);
71
   float getActualTemp_celsius(const heater_t);
74
   float getActualTemp_celsius(const extruder_t);
72
   float getActualTemp_celsius(const extruder_t);
178
    * safe_millis must be called at least every 1 sec to guarantee time
176
    * safe_millis must be called at least every 1 sec to guarantee time
179
    * yield should be called within lengthy loops
177
    * yield should be called within lengthy loops
180
    */
178
    */
181
-  uint32_t safe_millis();
179
+  #ifdef __SAM3X8E__
180
+    uint32_t safe_millis();
181
+  #else
182
+    #define safe_millis() millis() // TODO: Implement for AVR
183
+  #endif
184
+
182
   void delay_us(unsigned long us);
185
   void delay_us(unsigned long us);
183
   void delay_ms(unsigned long ms);
186
   void delay_ms(unsigned long ms);
184
   void yield();
187
   void yield();
205
     public:
208
     public:
206
       FileList();
209
       FileList();
207
       void refresh();
210
       void refresh();
208
-      bool seek(uint16_t, bool skip_range_check = false);
211
+      bool seek(const uint16_t, const bool skip_range_check = false);
209
 
212
 
210
       const char *longFilename();
213
       const char *longFilename();
211
       const char *shortFilename();
214
       const char *shortFilename();
212
       const char *filename();
215
       const char *filename();
213
       bool isDir();
216
       bool isDir();
214
 
217
 
215
-      void changeDir(const char *dirname);
218
+      void changeDir(const char * const dirname);
216
       void upDir();
219
       void upDir();
217
       bool isAtRootDir();
220
       bool isAtRootDir();
218
       uint16_t    count();
221
       uint16_t    count();
234
   void onPrintTimerPaused();
237
   void onPrintTimerPaused();
235
   void onPrintTimerStopped();
238
   void onPrintTimerStopped();
236
   void onFilamentRunout();
239
   void onFilamentRunout();
237
-  void onStatusChanged(const char* msg);
238
-  void onStatusChanged(progmem_str msg);
240
+  void onStatusChanged(const char * const msg);
239
   void onFactoryReset();
241
   void onFactoryReset();
240
   void onStoreSettings();
242
   void onStoreSettings();
241
   void onLoadSettings();
243
   void onLoadSettings();

+ 1
- 1
Marlin/src/lcd/malyanlcd.cpp Wyświetl plik

480
 /**
480
 /**
481
  * Set an alert.
481
  * Set an alert.
482
  */
482
  */
483
-void MarlinUI::setalertstatusPGM(PGM_P const message) {
483
+void MarlinUI::set_alert_status_P(PGM_P const message) {
484
   write_to_lcd_P(PSTR("{E:"));
484
   write_to_lcd_P(PSTR("{E:"));
485
   write_to_lcd_P(message);
485
   write_to_lcd_P(message);
486
   write_to_lcd_P("}");
486
   write_to_lcd_P("}");

+ 1
- 1
Marlin/src/lcd/menu/menu_main.cpp Wyświetl plik

59
   void lcd_sdcard_stop() {
59
   void lcd_sdcard_stop() {
60
     wait_for_heatup = wait_for_user = false;
60
     wait_for_heatup = wait_for_user = false;
61
     card.flag.abort_sd_printing = true;
61
     card.flag.abort_sd_printing = true;
62
-    ui.setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1);
62
+    ui.set_status_P(PSTR(MSG_PRINT_ABORTED), -1);
63
     ui.return_to_status();
63
     ui.return_to_status();
64
   }
64
   }
65
 
65
 

+ 101
- 85
Marlin/src/lcd/ultralcd.cpp Wyświetl plik

29
     #include "../sd/cardreader.h"
29
     #include "../sd/cardreader.h"
30
   #endif
30
   #endif
31
   MarlinUI ui;
31
   MarlinUI ui;
32
+  #if ENABLED(SDSUPPORT)
33
+    #include "../sd/cardreader.h"
34
+  #endif
35
+  #if ENABLED(EXTENSIBLE_UI)
36
+    #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u)
37
+  #endif
38
+
39
+  #define MAX_MESSAGE_LENGTH 63
40
+  uint8_t MarlinUI::status_message_level; // = 0
41
+  char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
32
 #endif
42
 #endif
33
 
43
 
34
 #if HAS_SPI_LCD
44
 #if HAS_SPI_LCD
86
   bool MarlinUI::defer_return_to_status;
96
   bool MarlinUI::defer_return_to_status;
87
 #endif
97
 #endif
88
 
98
 
89
-char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
90
 uint8_t MarlinUI::lcd_status_update_delay = 1; // First update one loop delayed
99
 uint8_t MarlinUI::lcd_status_update_delay = 1; // First update one loop delayed
91
-uint8_t MarlinUI::status_message_level; // = 0
92
 
100
 
93
 #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
101
 #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
94
   millis_t MarlinUI::next_filament_display; // = 0
102
   millis_t MarlinUI::next_filament_display; // = 0
475
 
483
 
476
 void MarlinUI::kill_screen(PGM_P lcd_msg) {
484
 void MarlinUI::kill_screen(PGM_P lcd_msg) {
477
   init();
485
   init();
478
-  setalertstatusPGM(lcd_msg);
486
+  set_alert_status_P(lcd_msg);
479
   draw_kill_screen();
487
   draw_kill_screen();
480
 }
488
 }
481
 
489
 
674
         if (old_sd_status == 2)
682
         if (old_sd_status == 2)
675
           card.beginautostart();  // Initial boot
683
           card.beginautostart();  // Initial boot
676
         else
684
         else
677
-          setstatusPGM(PSTR(MSG_SD_INSERTED));
685
+          set_status_P(PSTR(MSG_SD_INSERTED));
678
       }
686
       }
679
       else {
687
       else {
680
         card.release();
688
         card.release();
681
-        if (old_sd_status != 2) setstatusPGM(PSTR(MSG_SD_REMOVED));
689
+        if (old_sd_status != 2) set_status_P(PSTR(MSG_SD_REMOVED));
682
       }
690
       }
683
 
691
 
684
       refresh();
692
       refresh();
1083
 
1091
 
1084
 #endif // HAS_ENCODER_ACTION
1092
 #endif // HAS_ENCODER_ACTION
1085
 
1093
 
1086
-////////////////////////////////////////////
1087
-/////////////// Status Line ////////////////
1088
-////////////////////////////////////////////
1094
+#endif // HAS_SPI_LCD
1089
 
1095
 
1090
-void MarlinUI::finishstatus(const bool persist) {
1096
+#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
1091
 
1097
 
1092
-  #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
1093
-    UNUSED(persist);
1098
+  #if ENABLED(EXTENSIBLE_UI)
1099
+    #include "extensible_ui/ui_api.h"
1094
   #endif
1100
   #endif
1095
 
1101
 
1096
-  #if ENABLED(LCD_PROGRESS_BAR)
1097
-    progress_bar_ms = millis();
1098
-    #if PROGRESS_MSG_EXPIRE > 0
1099
-      expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
1102
+  ////////////////////////////////////////////
1103
+  /////////////// Status Line ////////////////
1104
+  ////////////////////////////////////////////
1105
+
1106
+  void MarlinUI::finishstatus(const bool persist) {
1107
+
1108
+    #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
1109
+      UNUSED(persist);
1100
     #endif
1110
     #endif
1101
-  #endif
1102
 
1111
 
1103
-  #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
1104
-    next_filament_display = millis() + 5000UL; // Show status message for 5s
1105
-  #endif
1112
+    #if ENABLED(LCD_PROGRESS_BAR)
1113
+      progress_bar_ms = millis();
1114
+      #if PROGRESS_MSG_EXPIRE > 0
1115
+        expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
1116
+      #endif
1117
+    #endif
1106
 
1118
 
1107
-  #if ENABLED(STATUS_MESSAGE_SCROLLING)
1108
-    status_scroll_offset = 0;
1109
-  #endif
1119
+    #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
1120
+      next_filament_display = millis() + 5000UL; // Show status message for 5s
1121
+    #endif
1110
 
1122
 
1111
-  refresh();
1112
-}
1123
+    #if ENABLED(STATUS_MESSAGE_SCROLLING)
1124
+      status_scroll_offset = 0;
1125
+    #endif
1113
 
1126
 
1114
-bool MarlinUI::has_status() { return (status_message[0] != '\0'); }
1127
+    #if ENABLED(EXTENSIBLE_UI)
1128
+      ExtUI::onStatusChanged(status_message);
1129
+    #endif
1115
 
1130
 
1116
-void MarlinUI::setstatus(const char * const message, const bool persist) {
1117
-  if (status_message_level > 0) return;
1131
+    refresh();
1132
+  }
1118
 
1133
 
1119
-  // Here we have a problem. The message is encoded in UTF8, so
1120
-  // arbitrarily cutting it will be a problem. We MUST be sure
1121
-  // that there is no cutting in the middle of a multibyte character!
1134
+  bool MarlinUI::has_status() { return (status_message[0] != '\0'); }
1122
 
1135
 
1123
-  // Get a pointer to the null terminator
1124
-  const char* pend = message + strlen(message);
1136
+  void MarlinUI::set_status(const char * const message, const bool persist) {
1137
+    if (status_message_level > 0) return;
1125
 
1138
 
1126
-  //  If length of supplied UTF8 string is greater than
1127
-  // our buffer size, start cutting whole UTF8 chars
1128
-  while ((pend - message) > MAX_MESSAGE_LENGTH) {
1129
-    --pend;
1130
-    while (!START_OF_UTF8_CHAR(*pend)) --pend;
1131
-  };
1139
+    // Here we have a problem. The message is encoded in UTF8, so
1140
+    // arbitrarily cutting it will be a problem. We MUST be sure
1141
+    // that there is no cutting in the middle of a multibyte character!
1132
 
1142
 
1133
-  // At this point, we have the proper cut point. Use it
1134
-  uint8_t maxLen = pend - message;
1135
-  strncpy(status_message, message, maxLen);
1136
-  status_message[maxLen] = '\0';
1143
+    // Get a pointer to the null terminator
1144
+    const char* pend = message + strlen(message);
1137
 
1145
 
1138
-  finishstatus(persist);
1139
-}
1146
+    //  If length of supplied UTF8 string is greater than
1147
+    // our buffer size, start cutting whole UTF8 chars
1148
+    while ((pend - message) > MAX_MESSAGE_LENGTH) {
1149
+      --pend;
1150
+      while (!START_OF_UTF8_CHAR(*pend)) --pend;
1151
+    };
1140
 
1152
 
1141
-#include <stdarg.h>
1153
+    // At this point, we have the proper cut point. Use it
1154
+    uint8_t maxLen = pend - message;
1155
+    strncpy(status_message, message, maxLen);
1156
+    status_message[maxLen] = '\0';
1142
 
1157
 
1143
-void MarlinUI::status_printf_P(const uint8_t level, PGM_P const fmt, ...) {
1144
-  if (level < status_message_level) return;
1145
-  status_message_level = level;
1146
-  va_list args;
1147
-  va_start(args, fmt);
1148
-  vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args);
1149
-  va_end(args);
1150
-  finishstatus(level > 0);
1151
-}
1158
+    finishstatus(persist);
1159
+  }
1152
 
1160
 
1153
-void MarlinUI::setstatusPGM(PGM_P const message, int8_t level) {
1154
-  if (level < 0) level = status_message_level = 0;
1155
-  if (level < status_message_level) return;
1156
-  status_message_level = level;
1161
+  #include <stdarg.h>
1157
 
1162
 
1158
-  // Here we have a problem. The message is encoded in UTF8, so
1159
-  // arbitrarily cutting it will be a problem. We MUST be sure
1160
-  // that there is no cutting in the middle of a multibyte character!
1163
+  void MarlinUI::status_printf_P(const uint8_t level, PGM_P const fmt, ...) {
1164
+    if (level < status_message_level) return;
1165
+    status_message_level = level;
1166
+    va_list args;
1167
+    va_start(args, fmt);
1168
+    vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args);
1169
+    va_end(args);
1170
+    finishstatus(level > 0);
1171
+  }
1161
 
1172
 
1162
-  // Get a pointer to the null terminator
1163
-  PGM_P pend = message + strlen_P(message);
1173
+  void MarlinUI::set_status_P(PGM_P const message, int8_t level) {
1174
+    if (level < 0) level = status_message_level = 0;
1175
+    if (level < status_message_level) return;
1176
+    status_message_level = level;
1164
 
1177
 
1165
-  //  If length of supplied UTF8 string is greater than
1166
-  // our buffer size, start cutting whole UTF8 chars
1167
-  while ((pend - message) > MAX_MESSAGE_LENGTH) {
1168
-    --pend;
1169
-    while (!START_OF_UTF8_CHAR(pgm_read_byte(pend))) --pend;
1170
-  };
1178
+    // Here we have a problem. The message is encoded in UTF8, so
1179
+    // arbitrarily cutting it will be a problem. We MUST be sure
1180
+    // that there is no cutting in the middle of a multibyte character!
1171
 
1181
 
1172
-  // At this point, we have the proper cut point. Use it
1173
-  uint8_t maxLen = pend - message;
1174
-  strncpy_P(status_message, message, maxLen);
1175
-  status_message[maxLen] = '\0';
1182
+    // Get a pointer to the null terminator
1183
+    PGM_P pend = message + strlen_P(message);
1176
 
1184
 
1177
-  finishstatus(level > 0);
1178
-}
1185
+    //  If length of supplied UTF8 string is greater than
1186
+    // our buffer size, start cutting whole UTF8 chars
1187
+    while ((pend - message) > MAX_MESSAGE_LENGTH) {
1188
+      --pend;
1189
+      while (!START_OF_UTF8_CHAR(pgm_read_byte(pend))) --pend;
1190
+    };
1179
 
1191
 
1180
-void MarlinUI::setalertstatusPGM(PGM_P const message) {
1181
-  setstatusPGM(message, 1);
1182
-  #if HAS_LCD_MENU
1183
-    return_to_status();
1184
-  #endif
1185
-}
1192
+    // At this point, we have the proper cut point. Use it
1193
+    uint8_t maxLen = pend - message;
1194
+    strncpy_P(status_message, message, maxLen);
1195
+    status_message[maxLen] = '\0';
1186
 
1196
 
1187
-#endif // HAS_SPI_LCD
1197
+    finishstatus(level > 0);
1198
+  }
1188
 
1199
 
1189
-#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
1200
+  void MarlinUI::set_alert_status_P(PGM_P const message) {
1201
+    set_status_P(message, 1);
1202
+    #if HAS_LCD_MENU
1203
+      return_to_status();
1204
+    #endif
1205
+  }
1190
 
1206
 
1191
   #include "../module/printcounter.h"
1207
   #include "../module/printcounter.h"
1192
 
1208
 
1202
       msg = paused;
1218
       msg = paused;
1203
     #if ENABLED(SDSUPPORT)
1219
     #if ENABLED(SDSUPPORT)
1204
       else if (IS_SD_PRINTING())
1220
       else if (IS_SD_PRINTING())
1205
-        return setstatus(card.longest_filename(), true);
1221
+        return set_status(card.longest_filename(), true);
1206
     #endif
1222
     #endif
1207
     else if (print_job_timer.isRunning())
1223
     else if (print_job_timer.isRunning())
1208
       msg = printing;
1224
       msg = printing;
1209
     else
1225
     else
1210
       msg = welcome;
1226
       msg = welcome;
1211
 
1227
 
1212
-    setstatusPGM(msg, -1);
1228
+    set_status_P(msg, -1);
1213
   }
1229
   }
1214
 
1230
 
1215
 #endif
1231
 #endif

+ 19
- 21
Marlin/src/lcd/ultralcd.h Wyświetl plik

243
   #if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
243
   #if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
244
     static void init();
244
     static void init();
245
     static void update();
245
     static void update();
246
-    static void setalertstatusPGM(PGM_P message);
246
+    static void set_alert_status_P(PGM_P message);
247
   #else // NO LCD
247
   #else // NO LCD
248
     static inline void init() {}
248
     static inline void init() {}
249
     static inline void update() {}
249
     static inline void update() {}
250
-    static inline void setalertstatusPGM(PGM_P message) { UNUSED(message); }
250
+    static inline void set_alert_status_P(PGM_P message) { UNUSED(message); }
251
   #endif
251
   #endif
252
 
252
 
253
   #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
253
   #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
254
 
254
 
255
+    static char status_message[];
256
+    static bool has_status();
257
+
258
+
259
+    static uint8_t status_message_level;      // Higher levels block lower levels
260
+    static inline void reset_alert_level() { status_message_level = 0; }
261
+
255
     #if HAS_SPI_LCD
262
     #if HAS_SPI_LCD
256
 
263
 
257
       static bool detected();
264
       static bool detected();
296
 
303
 
297
       #endif
304
       #endif
298
 
305
 
299
-      // Status message
300
-      static char status_message[];
301
       #if ENABLED(STATUS_MESSAGE_SCROLLING)
306
       #if ENABLED(STATUS_MESSAGE_SCROLLING)
302
         static uint8_t status_scroll_offset;
307
         static uint8_t status_scroll_offset;
303
       #endif
308
       #endif
304
-      static bool has_status();
305
-
306
       static uint8_t lcd_status_update_delay;
309
       static uint8_t lcd_status_update_delay;
307
-      static uint8_t status_message_level;      // Higher levels block lower levels
308
-      static inline void reset_alert_level() { status_message_level = 0; }
309
 
310
 
310
       #if HAS_PRINT_PROGRESS
311
       #if HAS_PRINT_PROGRESS
311
         #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
312
         #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
341
       static void status_screen();
342
       static void status_screen();
342
 
343
 
343
     #else
344
     #else
344
-
345
       static void refresh() {}
345
       static void refresh() {}
346
-      static inline void reset_alert_level() {}
347
-      static constexpr bool has_status() { return true; }
348
-
349
     #endif
346
     #endif
350
 
347
 
351
     static bool get_blink();
348
     static bool get_blink();
352
     static void kill_screen(PGM_P const lcd_msg);
349
     static void kill_screen(PGM_P const lcd_msg);
353
     static void draw_kill_screen();
350
     static void draw_kill_screen();
354
-    static void setstatus(const char* const message, const bool persist=false);
355
-    static void setstatusPGM(PGM_P const message, const int8_t level=0);
351
+    static void set_status(const char* const message, const bool persist=false);
352
+    static void set_status_P(PGM_P const message, const int8_t level=0);
356
     static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
353
     static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
357
     static void reset_status();
354
     static void reset_status();
358
 
355
 
359
   #else // MALYAN_LCD or NO LCD
356
   #else // MALYAN_LCD or NO LCD
360
 
357
 
361
     static inline void refresh() {}
358
     static inline void refresh() {}
362
-    static inline void setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
363
-    static inline void setstatusPGM(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
359
+    static inline void set_status(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
360
+    static inline void set_status_P(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
364
     static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
361
     static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
365
     static inline void reset_status() {}
362
     static inline void reset_status() {}
366
     static inline void reset_alert_level() {}
363
     static inline void reset_alert_level() {}
508
 
505
 
509
   static void _synchronize();
506
   static void _synchronize();
510
 
507
 
508
+  #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
509
+    static void finishstatus(const bool persist);
510
+  #endif
511
+
511
   #if HAS_SPI_LCD
512
   #if HAS_SPI_LCD
512
     #if HAS_LCD_MENU
513
     #if HAS_LCD_MENU
513
       #if LCD_TIMEOUT_TO_STATUS
514
       #if LCD_TIMEOUT_TO_STATUS
517
       #endif
518
       #endif
518
     #endif
519
     #endif
519
     static void draw_status_screen();
520
     static void draw_status_screen();
520
-    static void finishstatus(const bool persist);
521
-  #else
522
-    static inline void finishstatus(const bool persist) { UNUSED(persist); refresh(); }
523
   #endif
521
   #endif
524
 };
522
 };
525
 
523
 
526
 extern MarlinUI ui;
524
 extern MarlinUI ui;
527
 
525
 
528
-#define LCD_MESSAGEPGM(x)      ui.setstatusPGM(PSTR(x))
529
-#define LCD_ALERTMESSAGEPGM(x) ui.setalertstatusPGM(PSTR(x))
526
+#define LCD_MESSAGEPGM(x)      ui.set_status_P(PSTR(x))
527
+#define LCD_ALERTMESSAGEPGM(x) ui.set_alert_status_P(PSTR(x))

+ 1
- 1
Marlin/src/module/probe.cpp Wyświetl plik

371
 
371
 
372
     PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW);
372
     PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW);
373
     ui.return_to_status();       // To display the new status message
373
     ui.return_to_status();       // To display the new status message
374
-    ui.setstatusPGM(ds_str, 99);
374
+    ui.set_status_P(ds_str, 99);
375
     serialprintPGM(ds_str);
375
     serialprintPGM(ds_str);
376
     SERIAL_EOL();
376
     SERIAL_EOL();
377
 
377
 

+ 1
- 1
Marlin/src/module/temperature.cpp Wyświetl plik

2464
       #if HOTENDS > 1
2464
       #if HOTENDS > 1
2465
         ui.status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), int(e + 1));
2465
         ui.status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), int(e + 1));
2466
       #else
2466
       #else
2467
-        ui.setstatusPGM(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING));
2467
+        ui.set_status_P(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING));
2468
       #endif
2468
       #endif
2469
     }
2469
     }
2470
   #endif
2470
   #endif

+ 2
- 2
Marlin/src/sd/cardreader.cpp Wyświetl plik

521
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
521
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
522
 
522
 
523
       getfilename(0, fname);
523
       getfilename(0, fname);
524
-      ui.setstatus(longFilename[0] ? longFilename : fname);
524
+      ui.set_status(longFilename[0] ? longFilename : fname);
525
       //if (longFilename[0]) {
525
       //if (longFilename[0]) {
526
       //  SERIAL_PROTOCOLPAIR(MSG_SD_FILE_LONG_NAME, longFilename);
526
       //  SERIAL_PROTOCOLPAIR(MSG_SD_FILE_LONG_NAME, longFilename);
527
       //}
527
       //}
545
         emergency_parser.disable();
545
         emergency_parser.disable();
546
       #endif
546
       #endif
547
       SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, fname);
547
       SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, fname);
548
-      ui.setstatus(fname);
548
+      ui.set_status(fname);
549
     }
549
     }
550
   }
550
   }
551
 }
551
 }

Ładowanie…
Anuluj
Zapisz