Pārlūkot izejas kodu

status_printf => lcd_status_printf_P

Scott Lahteine 7 gadus atpakaļ
vecāks
revīzija
7a7a80e6c5
4 mainītis faili ar 10 papildinājumiem un 18 dzēšanām
  1. 4
    10
      Marlin/Marlin_main.cpp
  2. 1
    3
      Marlin/endstops.cpp
  3. 3
    3
      Marlin/ultralcd.cpp
  4. 2
    2
      Marlin/ultralcd.h

+ 4
- 10
Marlin/Marlin_main.cpp Parādīt failu

@@ -1789,15 +1789,10 @@ static void clean_up_after_endstop_or_probe_move() {
1789 1789
       SERIAL_ECHOLNPGM(" " MSG_FIRST);
1790 1790
 
1791 1791
       #if ENABLED(ULTRA_LCD)
1792
-        char message[3 * (LCD_WIDTH) + 1] = ""; // worst case is kana.utf with up to 3*LCD_WIDTH+1
1793
-        strcat_P(message, PSTR(MSG_HOME " "));
1794
-        if (xx) strcat_P(message, PSTR(MSG_X));
1795
-        if (yy) strcat_P(message, PSTR(MSG_Y));
1796
-        if (zz) strcat_P(message, PSTR(MSG_Z));
1797
-        strcat_P(message, PSTR(" " MSG_FIRST));
1798
-        lcd_setstatus(message);
1792
+        lcd_status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : "");
1799 1793
       #endif
1800 1794
       return true;
1795
+
1801 1796
     }
1802 1797
     return false;
1803 1798
   }
@@ -5153,7 +5148,6 @@ inline void gcode_M31() {
5153 5148
   char buffer[21];
5154 5149
   duration_t elapsed = print_job_timer.duration();
5155 5150
   elapsed.toString(buffer);
5156
-
5157 5151
   lcd_setstatus(buffer);
5158 5152
 
5159 5153
   SERIAL_ECHO_START;
@@ -5700,7 +5694,7 @@ inline void gcode_M104() {
5700 5694
       }
5701 5695
     #endif
5702 5696
 
5703
-    if (code_value_temp_abs() > thermalManager.degHotend(target_extruder)) status_printf(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
5697
+    if (code_value_temp_abs() > thermalManager.degHotend(target_extruder)) lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
5704 5698
   }
5705 5699
 
5706 5700
   #if ENABLED(AUTOTEMP)
@@ -5898,7 +5892,7 @@ inline void gcode_M109() {
5898 5892
       else print_job_timer.start();
5899 5893
     #endif
5900 5894
 
5901
-    if (thermalManager.isHeatingHotend(target_extruder)) status_printf(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
5895
+    if (thermalManager.isHeatingHotend(target_extruder)) lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
5902 5896
   }
5903 5897
 
5904 5898
   #if ENABLED(AUTOTEMP)

+ 1
- 3
Marlin/endstops.cpp Parādīt failu

@@ -170,9 +170,7 @@ void Endstops::report_state() {
170 170
     SERIAL_EOL;
171 171
 
172 172
     #if ENABLED(ULTRA_LCD)
173
-      char msg[3 * strlen(MSG_LCD_ENDSTOPS) + 8 + 1]; // Room for a UTF 8 string
174
-      sprintf_P(msg, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP);
175
-      lcd_setstatus(msg);
173
+      lcd_status_printf_P(0, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP);
176 174
     #endif
177 175
 
178 176
     hit_on_purpose();

+ 3
- 3
Marlin/ultralcd.cpp Parādīt failu

@@ -3565,12 +3565,12 @@ void lcd_setstatuspgm(const char * const message, const uint8_t level) {
3565 3565
   lcd_finishstatus(level > 0);
3566 3566
 }
3567 3567
 
3568
-void status_printf(uint8_t level, const char *status, ...) {
3568
+void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
3569 3569
   if (level < lcd_status_message_level) return;
3570 3570
   lcd_status_message_level = level;
3571 3571
   va_list args;
3572
-  va_start(args, status);
3573
-  vsnprintf_P(lcd_status_message, 3 * (LCD_WIDTH), status, args);
3572
+  va_start(args, fmt);
3573
+  vsnprintf_P(lcd_status_message, 3 * (LCD_WIDTH), fmt, args);
3574 3574
   va_end(args);
3575 3575
   lcd_finishstatus(level > 0);
3576 3576
 }

+ 2
- 2
Marlin/ultralcd.h Parādīt failu

@@ -39,7 +39,7 @@
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 uint8_t level=0);
42
-  void status_printf(uint8_t level, const char *Status, ...);
42
+  void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
43 43
   void lcd_setalertstatuspgm(const char* message);
44 44
   void lcd_reset_alert_level();
45 45
   void lcd_kill_screen();
@@ -154,7 +154,7 @@
154 154
   inline bool lcd_hasstatus() { return false; }
155 155
   inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
156 156
   inline void lcd_setstatuspgm(const char* const message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
157
-  inline void status_printf(uint8_t level, const char *status, ...) { UNUSED(level); UNUSED(status); }
157
+  inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
158 158
   inline void lcd_buttons_update() {}
159 159
   inline void lcd_reset_alert_level() {}
160 160
   inline bool lcd_detected() { return true; }

Notiek ielāde…
Atcelt
Saglabāt