Browse Source

Allow lcd_setstatusPGM to reset the alert level

Scott Lahteine 8 years ago
parent
commit
6f89db11f0
4 changed files with 23 additions and 26 deletions
  1. 13
    17
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 1
    1
      Marlin/ubl_G29.cpp
  3. 6
    5
      Marlin/ultralcd.cpp
  4. 3
    3
      Marlin/ultralcd.h

+ 13
- 17
Marlin/G26_Mesh_Validation_Tool.cpp View File

131
   void set_destination_to_current();
131
   void set_destination_to_current();
132
   void set_current_to_destination();
132
   void set_current_to_destination();
133
   void prepare_move_to_destination();
133
   void prepare_move_to_destination();
134
-  void lcd_setstatuspgm(const char* const message, const uint8_t level);
134
+  void lcd_setstatusPGM(const char* const message, const int8_t level);
135
   void sync_plan_position_e();
135
   void sync_plan_position_e();
136
   void chirp_at_user();
136
   void chirp_at_user();
137
 
137
 
181
     safe_delay(10);                       // Wait for click to settle
181
     safe_delay(10);                       // Wait for click to settle
182
 
182
 
183
     #if ENABLED(ULTRA_LCD)
183
     #if ENABLED(ULTRA_LCD)
184
-      lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
184
+      lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
185
       lcd_quick_feedback();
185
       lcd_quick_feedback();
186
     #endif
186
     #endif
187
-    lcd_reset_alert_level();
188
 
187
 
189
     while (!ubl_lcd_clicked()) idle();    // Wait for button release
188
     while (!ubl_lcd_clicked()) idle();    // Wait for button release
190
 
189
 
191
     // If the button is suddenly pressed again,
190
     // If the button is suddenly pressed again,
192
     // ask the user to resolve the issue
191
     // ask the user to resolve the issue
193
-    lcd_setstatuspgm(PSTR("Release button"), 99); // will never appear...
192
+    lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear...
194
     while (ubl_lcd_clicked()) idle();             // unless this loop happens
193
     while (ubl_lcd_clicked()) idle();             // unless this loop happens
195
-    lcd_setstatuspgm(PSTR(""));
194
+    lcd_setstatusPGM(PSTR(""), -1);
196
 
195
 
197
     return true;
196
     return true;
198
   }
197
   }
351
     } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
350
     } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
352
 
351
 
353
     LEAVE:
352
     LEAVE:
354
-    lcd_reset_alert_level();
355
-    lcd_setstatuspgm(PSTR("Leaving G26"));
353
+    lcd_setstatusPGM(PSTR("Leaving G26"), -1);
356
 
354
 
357
     retract_filament(destination);
355
     retract_filament(destination);
358
     destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
356
     destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
726
   }
724
   }
727
 
725
 
728
   bool unified_bed_leveling::exit_from_g26() {
726
   bool unified_bed_leveling::exit_from_g26() {
729
-    lcd_reset_alert_level();
730
-    lcd_setstatuspgm(PSTR("Leaving G26"));
727
+    lcd_setstatusPGM(PSTR("Leaving G26"), -1);
731
     while (ubl_lcd_clicked()) idle();
728
     while (ubl_lcd_clicked()) idle();
732
     return UBL_ERR;
729
     return UBL_ERR;
733
   }
730
   }
741
     #if HAS_TEMP_BED
738
     #if HAS_TEMP_BED
742
       #if ENABLED(ULTRA_LCD)
739
       #if ENABLED(ULTRA_LCD)
743
         if (g26_bed_temp > 25) {
740
         if (g26_bed_temp > 25) {
744
-          lcd_setstatuspgm(PSTR("G26 Heating Bed."), 99);
741
+          lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99);
745
           lcd_quick_feedback();
742
           lcd_quick_feedback();
746
       #endif
743
       #endif
747
           has_control_of_lcd_panel = true;
744
           has_control_of_lcd_panel = true;
757
           }
754
           }
758
       #if ENABLED(ULTRA_LCD)
755
       #if ENABLED(ULTRA_LCD)
759
         }
756
         }
760
-        lcd_setstatuspgm(PSTR("G26 Heating Nozzle."), 99);
757
+        lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99);
761
         lcd_quick_feedback();
758
         lcd_quick_feedback();
762
       #endif
759
       #endif
763
     #endif
760
     #endif
774
     }
771
     }
775
 
772
 
776
     #if ENABLED(ULTRA_LCD)
773
     #if ENABLED(ULTRA_LCD)
777
-      lcd_reset_alert_level();
778
-      lcd_setstatuspgm(PSTR(""));
774
+      lcd_setstatusPGM(PSTR(""), -1);
779
       lcd_quick_feedback();
775
       lcd_quick_feedback();
780
     #endif
776
     #endif
781
 
777
 
792
 
788
 
793
       has_control_of_lcd_panel = true;
789
       has_control_of_lcd_panel = true;
794
 
790
 
795
-      lcd_setstatuspgm(PSTR("User-Controlled Prime"), 99);
791
+      lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99);
796
       chirp_at_user();
792
       chirp_at_user();
797
 
793
 
798
       set_destination_to_current();
794
       set_destination_to_current();
819
       while (ubl_lcd_clicked()) idle();           // Debounce Encoder Wheel
815
       while (ubl_lcd_clicked()) idle();           // Debounce Encoder Wheel
820
 
816
 
821
       #if ENABLED(ULTRA_LCD)
817
       #if ENABLED(ULTRA_LCD)
822
-        strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatuspgm() without having it continue;
818
+        strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue;
823
                                                             // So...  We cheat to get a message up.
819
                                                             // So...  We cheat to get a message up.
824
-        lcd_setstatuspgm(PSTR("Done Priming"), 99);
820
+        lcd_setstatusPGM(PSTR("Done Priming"), 99);
825
         lcd_quick_feedback();
821
         lcd_quick_feedback();
826
       #endif
822
       #endif
827
 
823
 
830
     }
826
     }
831
     else {
827
     else {
832
       #if ENABLED(ULTRA_LCD)
828
       #if ENABLED(ULTRA_LCD)
833
-        lcd_setstatuspgm(PSTR("Fixed Length Prime."), 99);
829
+        lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99);
834
         lcd_quick_feedback();
830
         lcd_quick_feedback();
835
       #endif
831
       #endif
836
       set_destination_to_current();
832
       set_destination_to_current();

+ 1
- 1
Marlin/ubl_G29.cpp View File

58
   typedef void (*screenFunc_t)();
58
   typedef void (*screenFunc_t)();
59
   extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
59
   extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
60
   extern void lcd_setstatus(const char* message, const bool persist);
60
   extern void lcd_setstatus(const char* message, const bool persist);
61
-  extern void lcd_setstatuspgm(const char* message, const uint8_t level);
61
+  extern void lcd_setstatusPGM(const char* message, const int8_t level);
62
 
62
 
63
   int    unified_bed_leveling::g29_verbose_level,
63
   int    unified_bed_leveling::g29_verbose_level,
64
          unified_bed_leveling::g29_phase_value,
64
          unified_bed_leveling::g29_phase_value,

+ 6
- 5
Marlin/ultralcd.cpp View File

680
       #if ENABLED(PARK_HEAD_ON_PAUSE)
680
       #if ENABLED(PARK_HEAD_ON_PAUSE)
681
         enqueue_and_echo_commands_P(PSTR("M125"));
681
         enqueue_and_echo_commands_P(PSTR("M125"));
682
       #endif
682
       #endif
683
-      lcd_setstatuspgm(PSTR(MSG_PRINT_PAUSED), true);
683
+      lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1);
684
     }
684
     }
685
 
685
 
686
     void lcd_sdcard_resume() {
686
     void lcd_sdcard_resume() {
690
         card.startFileprint();
690
         card.startFileprint();
691
         print_job_timer.start();
691
         print_job_timer.start();
692
       #endif
692
       #endif
693
-      lcd_setstatuspgm(PSTR(""), true);
693
+      lcd_setstatusPGM(PSTR(""), -1);
694
     }
694
     }
695
 
695
 
696
     void lcd_sdcard_stop() {
696
     void lcd_sdcard_stop() {
703
         for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
703
         for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
704
       #endif
704
       #endif
705
       wait_for_heatup = false;
705
       wait_for_heatup = false;
706
-      LCD_MESSAGEPGM(MSG_PRINT_ABORTED);
706
+      lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1);
707
     }
707
     }
708
 
708
 
709
   #endif // SDSUPPORT
709
   #endif // SDSUPPORT
4095
   lcd_finishstatus(persist);
4095
   lcd_finishstatus(persist);
4096
 }
4096
 }
4097
 
4097
 
4098
-void lcd_setstatuspgm(const char * const message, const uint8_t level) {
4098
+void lcd_setstatusPGM(const char * const message, int8_t level) {
4099
+  if (level < 0) level = lcd_status_message_level = 0;
4099
   if (level < lcd_status_message_level) return;
4100
   if (level < lcd_status_message_level) return;
4100
   lcd_status_message_level = level;
4101
   lcd_status_message_level = level;
4101
   strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
4102
   strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
4113
 }
4114
 }
4114
 
4115
 
4115
 void lcd_setalertstatuspgm(const char * const message) {
4116
 void lcd_setalertstatuspgm(const char * const message) {
4116
-  lcd_setstatuspgm(message, 1);
4117
+  lcd_setstatusPGM(message, 1);
4117
   #if ENABLED(ULTIPANEL)
4118
   #if ENABLED(ULTIPANEL)
4118
     lcd_return_to_status();
4119
     lcd_return_to_status();
4119
   #endif
4120
   #endif

+ 3
- 3
Marlin/ultralcd.h View File

38
   void lcd_init();
38
   void lcd_init();
39
   bool lcd_hasstatus();
39
   bool lcd_hasstatus();
40
   void lcd_setstatus(const char* message, const bool persist=false);
40
   void lcd_setstatus(const char* message, const bool persist=false);
41
-  void lcd_setstatuspgm(const char* message, const uint8_t level=0);
41
+  void lcd_setstatusPGM(const char* message, const int8_t level=0);
42
   void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
42
   void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
43
   void lcd_setalertstatuspgm(const char* message);
43
   void lcd_setalertstatuspgm(const char* message);
44
   void lcd_reset_alert_level();
44
   void lcd_reset_alert_level();
61
     void bootscreen();
61
     void bootscreen();
62
   #endif
62
   #endif
63
 
63
 
64
-  #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
64
+  #define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x))
65
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
65
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
66
 
66
 
67
   #define LCD_UPDATE_INTERVAL 100
67
   #define LCD_UPDATE_INTERVAL 100
153
   inline void lcd_init() {}
153
   inline void lcd_init() {}
154
   inline bool lcd_hasstatus() { return false; }
154
   inline bool lcd_hasstatus() { return false; }
155
   inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
155
   inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
156
-  inline void lcd_setstatuspgm(const char* const message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
156
+  inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
157
   inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
157
   inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
158
   inline void lcd_buttons_update() {}
158
   inline void lcd_buttons_update() {}
159
   inline void lcd_reset_alert_level() {}
159
   inline void lcd_reset_alert_level() {}

Loading…
Cancel
Save