Browse Source

Use PSTR versions of lcd_status... to save SRAM

Scott Lahteine 8 years ago
parent
commit
0e6ec34228
4 changed files with 19 additions and 16 deletions
  1. 1
    1
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 1
    0
      Marlin/UBL.h
  3. 13
    11
      Marlin/UBL_G29.cpp
  4. 4
    4
      Marlin/ultralcd.cpp

+ 1
- 1
Marlin/G26_Mesh_Validation_Tool.cpp View File

@@ -128,7 +128,7 @@
128 128
   extern bool code_value_bool();
129 129
   extern bool code_has_value();
130 130
   extern void lcd_init();
131
-  extern void lcd_setstatuspgm(const char* const message, uint8_t level);
131
+  extern void lcd_setstatuspgm(const char* const message, const uint8_t level);
132 132
   #define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS])) //bob
133 133
   bool prepare_move_to_destination_cartesian();
134 134
   void line_to_destination();

+ 1
- 0
Marlin/UBL.h View File

@@ -29,6 +29,7 @@
29 29
 
30 30
   #if ENABLED(AUTO_BED_LEVELING_UBL)
31 31
 
32
+    #define UBL_VERSION "1.00"
32 33
     #define UBL_OK false
33 34
     #define UBL_ERR true
34 35
 

+ 13
- 11
Marlin/UBL_G29.cpp View File

@@ -307,7 +307,8 @@
307 307
   static float x_pos, y_pos, measured_z, card_thickness = 0.0, ubl_constant = 0.0;
308 308
 
309 309
   #if ENABLED(ULTRA_LCD)
310
-    void lcd_setstatus(const char* message, bool persist);
310
+    extern void lcd_setstatus(const char* message, const bool persist);
311
+    extern void lcd_setstatuspgm(const char* message, const uint8_t level);
311 312
   #endif
312 313
 
313 314
   void gcode_G29() {
@@ -655,7 +656,7 @@
655 656
           if (ELAPSED(millis(), nxt)) {
656 657
             SERIAL_PROTOCOLLNPGM("\nZ-Offset Adjustment Stopped.");
657 658
             do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
658
-            lcd_setstatus("Z-Offset Stopped", true);
659
+            lcd_setstatuspgm("Z-Offset Stopped");
659 660
             restore_ubl_active_state_and_leave();
660 661
             goto LEAVE;
661 662
           }
@@ -673,7 +674,8 @@
673 674
     LEAVE:
674 675
 
675 676
     #if ENABLED(ULTRA_LCD)
676
-      lcd_setstatus("                         ", true);
677
+      lcd_reset_alert_level();
678
+      lcd_setstatuspgm("");
677 679
       lcd_quick_feedback();
678 680
     #endif
679 681
 
@@ -977,7 +979,7 @@
977 979
 
978 980
   bool g29_parameter_parsing() {
979 981
     #if ENABLED(ULTRA_LCD)
980
-      lcd_setstatus("Doing G29 UBL !", true);
982
+      lcd_setstatuspgm("Doing G29 UBL!");
981 983
       lcd_quick_feedback();
982 984
     #endif
983 985
 
@@ -1088,7 +1090,7 @@
1088 1090
     ubl_state_recursion_chk++;
1089 1091
     if (ubl_state_recursion_chk != 1) {
1090 1092
       SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
1091
-      lcd_setstatus("save_UBL_active() error", true);
1093
+      lcd_setstatuspgm("save_UBL_active() error");
1092 1094
       lcd_quick_feedback();
1093 1095
       return;
1094 1096
     }
@@ -1099,7 +1101,7 @@
1099 1101
   void restore_ubl_active_state_and_leave() {
1100 1102
     if (--ubl_state_recursion_chk) {
1101 1103
       SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
1102
-      lcd_setstatus("restore_UBL_active() error", true);
1104
+      lcd_setstatuspgm("restore_UBL_active() error");
1103 1105
       lcd_quick_feedback();
1104 1106
       return;
1105 1107
     }
@@ -1114,7 +1116,7 @@
1114 1116
   void g29_what_command() {
1115 1117
     const uint16_t k = E2END - ubl.eeprom_start;
1116 1118
 
1117
-    SERIAL_PROTOCOLPGM("Unified Bed Leveling System Version 1.00 ");
1119
+    SERIAL_PROTOCOLPGM("Unified Bed Leveling System Version " UBL_VERSION " ");
1118 1120
     if (ubl.state.active)
1119 1121
       SERIAL_PROTOCOLCHAR('A');
1120 1122
     else
@@ -1339,7 +1341,7 @@
1339 1341
     memset(not_done, 0xFF, sizeof(not_done));
1340 1342
 
1341 1343
     #if ENABLED(ULTRA_LCD)
1342
-      lcd_setstatus("Fine Tuning Mesh.", true);
1344
+      lcd_setstatuspgm("Fine Tuning Mesh");
1343 1345
     #endif
1344 1346
 
1345 1347
     do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
@@ -1398,7 +1400,7 @@
1398 1400
           lcd_return_to_status();
1399 1401
           //SERIAL_PROTOCOLLNPGM("\nFine Tuning of Mesh Stopped.");
1400 1402
           do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
1401
-          lcd_setstatus("Mesh Editing Stopped", true);
1403
+          lcd_setstatuspgm("Mesh Editing Stopped");
1402 1404
 
1403 1405
           while (ubl_lcd_clicked()) idle();
1404 1406
 
@@ -1426,9 +1428,9 @@
1426 1428
     do_blocking_move_to_xy(lx, ly);
1427 1429
 
1428 1430
     #if ENABLED(ULTRA_LCD)
1429
-      lcd_setstatus("Done Editing Mesh", true);
1431
+      lcd_setstatuspgm("Done Editing Mesh");
1430 1432
     #endif
1431
-    SERIAL_ECHOLNPGM("Done Editing Mesh.");
1433
+    SERIAL_ECHOLNPGM("Done Editing Mesh");
1432 1434
   }
1433 1435
 
1434 1436
 #endif // AUTO_BED_LEVELING_UBL

+ 4
- 4
Marlin/ultralcd.cpp View File

@@ -677,7 +677,7 @@ void kill_screen(const char* lcd_msg) {
677 677
         thermalManager.autotempShutdown();
678 678
       #endif
679 679
       wait_for_heatup = false;
680
-      lcd_setstatus(MSG_PRINT_ABORTED, true);
680
+      lcd_setstatuspgm(PSTR(MSG_PRINT_ABORTED), true);
681 681
     }
682 682
 
683 683
   #endif // SDSUPPORT
@@ -3552,13 +3552,13 @@ void lcd_finishstatus(bool persist=false) {
3552 3552
 
3553 3553
 bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
3554 3554
 
3555
-void lcd_setstatus(const char* const message, bool persist) {
3555
+void lcd_setstatus(const char * const message, const bool persist) {
3556 3556
   if (lcd_status_message_level > 0) return;
3557 3557
   strncpy(lcd_status_message, message, 3 * (LCD_WIDTH));
3558 3558
   lcd_finishstatus(persist);
3559 3559
 }
3560 3560
 
3561
-void lcd_setstatuspgm(const char* const message, uint8_t level) {
3561
+void lcd_setstatuspgm(const char * const message, const uint8_t level) {
3562 3562
   if (level < lcd_status_message_level) return;
3563 3563
   lcd_status_message_level = level;
3564 3564
   strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
@@ -3575,7 +3575,7 @@ void status_printf(uint8_t level, const char *status, ...) {
3575 3575
   lcd_finishstatus(level > 0);
3576 3576
 }
3577 3577
 
3578
-void lcd_setalertstatuspgm(const char* const message) {
3578
+void lcd_setalertstatuspgm(const char * const message) {
3579 3579
   lcd_setstatuspgm(message, 1);
3580 3580
   #if ENABLED(ULTIPANEL)
3581 3581
     lcd_return_to_status();

Loading…
Cancel
Save