瀏覽代碼

Cleanup LCD interface, add lcd_reset_status

Scott Lahteine 8 年之前
父節點
當前提交
46b32e4548
共有 4 個文件被更改,包括 21 次插入26 次删除
  1. 2
    2
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 6
    14
      Marlin/ubl_G29.cpp
  3. 5
    3
      Marlin/ultralcd.cpp
  4. 8
    7
      Marlin/ultralcd.h

+ 2
- 2
Marlin/G26_Mesh_Validation_Tool.cpp 查看文件

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

+ 6
- 14
Marlin/ubl_G29.cpp 查看文件

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

+ 5
- 3
Marlin/ultralcd.cpp 查看文件

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

+ 8
- 7
Marlin/ultralcd.h 查看文件

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

Loading…
取消
儲存