Procházet zdrojové kódy

Cleanup LCD interface, add lcd_reset_status

Scott Lahteine před 7 roky
rodič
revize
46b32e4548

+ 2
- 2
Marlin/G26_Mesh_Validation_Tool.cpp Zobrazit soubor

@@ -191,7 +191,7 @@
191 191
     // ask the user to resolve the issue
192 192
     lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear...
193 193
     while (ubl_lcd_clicked()) idle();             // unless this loop happens
194
-    lcd_setstatusPGM(PSTR(""), -1);
194
+    lcd_reset_status();
195 195
 
196 196
     return true;
197 197
   }
@@ -771,7 +771,7 @@
771 771
     }
772 772
 
773 773
     #if ENABLED(ULTRA_LCD)
774
-      lcd_setstatusPGM(PSTR(""), -1);
774
+      lcd_reset_status();
775 775
       lcd_quick_feedback();
776 776
     #endif
777 777
 

+ 6
- 14
Marlin/ubl_G29.cpp Zobrazit soubor

@@ -40,8 +40,6 @@
40 40
   extern float destination[XYZE], current_position[XYZE];
41 41
 
42 42
   void lcd_return_to_status();
43
-  bool lcd_clicked();
44
-  void lcd_implementation_clear();
45 43
   void lcd_mesh_edit_setup(float initial);
46 44
   float lcd_mesh_edit();
47 45
   void lcd_z_offset_edit_setup(float);
@@ -54,12 +52,6 @@
54 52
   #define SIZE_OF_LITTLE_RAISE 1
55 53
   #define BIG_RAISE_NOT_NEEDED 0
56 54
 
57
-  extern void lcd_status_screen();
58
-  typedef void (*screenFunc_t)();
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);
61
-  extern void lcd_setstatusPGM(const char* message, const int8_t level);
62
-
63 55
   int    unified_bed_leveling::g29_verbose_level,
64 56
          unified_bed_leveling::g29_phase_value,
65 57
          unified_bed_leveling::g29_repetition_cnt,
@@ -662,7 +654,7 @@
662 654
         do_blocking_move_to_z(measured_z);  // Get close to the bed, but leave some space so we don't damage anything
663 655
                                             // The user is not going to be locking in a new Z-Offset very often so
664 656
                                             // it won't be that painful to spin the Encoder Wheel for 1.5mm
665
-        lcd_implementation_clear();
657
+        lcd_refresh();
666 658
         lcd_z_offset_edit_setup(measured_z);
667 659
 
668 660
         KEEPALIVE_STATE(PAUSED_FOR_USER);
@@ -698,7 +690,7 @@
698 690
 
699 691
         state.z_offset = measured_z;
700 692
 
701
-        lcd_implementation_clear();
693
+        lcd_refresh();
702 694
         restore_ubl_active_state_and_leave();
703 695
       }
704 696
     }
@@ -940,7 +932,7 @@
940 932
 
941 933
     SERIAL_PROTOCOLPGM("Place shim under nozzle");
942 934
     LCD_MESSAGEPGM("Place shim & measure"); // TODO: Make translatable string
943
-    lcd_goto_screen(lcd_status_screen);
935
+    lcd_return_to_status();
944 936
     echo_and_take_a_measurement();
945 937
 
946 938
     const float z1 = measure_point_with_encoder();
@@ -979,7 +971,7 @@
979 971
     do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
980 972
     do_blocking_move_to_xy(lx, ly);
981 973
 
982
-    lcd_goto_screen(lcd_status_screen);
974
+    lcd_return_to_status();
983 975
     mesh_index_pair location;
984 976
     do {
985 977
       location = find_closest_mesh_point_of_type(INVALID, lx, ly, USE_NOZZLE_AS_REFERENCE, NULL, false);
@@ -1456,7 +1448,7 @@
1456 1448
 
1457 1449
       if (do_ubl_mesh_map) display_map(g29_map_type);  // show the user which point is being adjusted
1458 1450
 
1459
-      lcd_implementation_clear();
1451
+      lcd_refresh();
1460 1452
 
1461 1453
       lcd_mesh_edit_setup(new_z);
1462 1454
 
@@ -1497,7 +1489,7 @@
1497 1489
 
1498 1490
       z_values[location.x_index][location.y_index] = new_z;
1499 1491
 
1500
-      lcd_implementation_clear();
1492
+      lcd_refresh();
1501 1493
 
1502 1494
     } while (location.x_index >= 0 && --g29_repetition_cnt > 0);
1503 1495
 

+ 5
- 3
Marlin/ultralcd.cpp Zobrazit soubor

@@ -626,6 +626,8 @@ void lcd_status_screen() {
626 626
   lcd_implementation_status_screen();
627 627
 }
628 628
 
629
+void lcd_reset_status() { lcd_setstatusPGM(PSTR(""), -1); }
630
+
629 631
 /**
630 632
  *
631 633
  * draw the kill screen
@@ -633,7 +635,7 @@ void lcd_status_screen() {
633 635
  */
634 636
 void kill_screen(const char* lcd_msg) {
635 637
   lcd_init();
636
-  lcd_setalertstatuspgm(lcd_msg);
638
+  lcd_setalertstatusPGM(lcd_msg);
637 639
   #if ENABLED(DOGLCD)
638 640
     u8g.firstPage();
639 641
     do {
@@ -705,7 +707,7 @@ void kill_screen(const char* lcd_msg) {
705 707
         card.startFileprint();
706 708
         print_job_timer.start();
707 709
       #endif
708
-      lcd_setstatusPGM(PSTR(""), -1);
710
+      lcd_reset_status();
709 711
     }
710 712
 
711 713
     void lcd_sdcard_stop() {
@@ -4160,7 +4162,7 @@ void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
4160 4162
   lcd_finishstatus(level > 0);
4161 4163
 }
4162 4164
 
4163
-void lcd_setalertstatuspgm(const char * const message) {
4165
+void lcd_setalertstatusPGM(const char * const message) {
4164 4166
   lcd_setstatusPGM(message, 1);
4165 4167
   #if ENABLED(ULTIPANEL)
4166 4168
     lcd_return_to_status();

+ 8
- 7
Marlin/ultralcd.h Zobrazit soubor

@@ -39,8 +39,8 @@
39 39
   bool lcd_hasstatus();
40 40
   void lcd_setstatus(const char* message, const bool persist=false);
41 41
   void lcd_setstatusPGM(const char* message, const int8_t level=0);
42
+  void lcd_setalertstatusPGM(const char* message);
42 43
   void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
43
-  void lcd_setalertstatuspgm(const char* message);
44 44
   void lcd_reset_alert_level();
45 45
   void lcd_kill_screen();
46 46
   void kill_screen(const char* lcd_msg);
@@ -64,9 +64,6 @@
64 64
     void bootscreen();
65 65
   #endif
66 66
 
67
-  #define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x))
68
-  #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
69
-
70 67
   #define LCD_UPDATE_INTERVAL 100
71 68
 
72 69
   #if ENABLED(ULTIPANEL)
@@ -152,22 +149,26 @@
152 149
   #endif
153 150
 
154 151
 #else // no LCD
152
+
155 153
   inline void lcd_update() {}
156 154
   inline void lcd_init() {}
157 155
   inline bool lcd_hasstatus() { return false; }
158 156
   inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
159 157
   inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
158
+  inline void lcd_setalertstatusPGM(const char* message) { UNUSED(message); }
160 159
   inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
161 160
   inline void lcd_buttons_update() {}
162 161
   inline void lcd_reset_alert_level() {}
163 162
   inline bool lcd_detected() { return true; }
164 163
   inline void lcd_refresh() {}
165 164
 
166
-  #define LCD_MESSAGEPGM(x) NOOP
167
-  #define LCD_ALERTMESSAGEPGM(x) NOOP
168
-
169 165
 #endif // ULTRA_LCD
170 166
 
167
+#define LCD_MESSAGEPGM(x)      lcd_setstatusPGM(PSTR(x))
168
+#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatusPGM(PSTR(x))
169
+
170
+void lcd_reset_status();
171
+
171 172
 #if ENABLED(AUTO_BED_LEVELING_UBL)
172 173
   void lcd_mesh_edit_setup(float initial);
173 174
   float lcd_mesh_edit();

Loading…
Zrušit
Uložit