Browse Source

Merge pull request #6877 from thinkyhead/bf_scrolling_status

Scrolling status message (option)
Scott Lahteine 8 years ago
parent
commit
58556991da
37 changed files with 224 additions and 92 deletions
  1. 3
    0
      Marlin/Configuration_adv.h
  2. 7
    8
      Marlin/Marlin_main.cpp
  3. 1
    1
      Marlin/SdBaseFile.cpp
  4. 2
    2
      Marlin/SdBaseFile.h
  5. 3
    0
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  6. 3
    0
      Marlin/example_configurations/Felix/Configuration_adv.h
  7. 3
    0
      Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h
  8. 3
    0
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  9. 3
    0
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  10. 3
    0
      Marlin/example_configurations/K8200/Configuration_adv.h
  11. 3
    0
      Marlin/example_configurations/K8400/Configuration_adv.h
  12. 3
    0
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  13. 3
    0
      Marlin/example_configurations/SCARA/Configuration_adv.h
  14. 3
    0
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  15. 3
    0
      Marlin/example_configurations/TinyBoy2/Configuration_adv.h
  16. 3
    0
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  17. 3
    0
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
  18. 3
    0
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
  19. 3
    0
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  20. 3
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  21. 3
    0
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  22. 3
    0
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  23. 3
    0
      Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h
  24. 3
    0
      Marlin/example_configurations/makibox/Configuration_adv.h
  25. 3
    0
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  26. 3
    0
      Marlin/example_configurations/wt150/Configuration_adv.h
  27. 1
    1
      Marlin/gcode.h
  28. 1
    1
      Marlin/planner.cpp
  29. 5
    2
      Marlin/temperature.cpp
  30. 20
    5
      Marlin/temperature.h
  31. 2
    2
      Marlin/ubl_motion.cpp
  32. 27
    13
      Marlin/ultralcd.cpp
  33. 33
    14
      Marlin/ultralcd_impl_DOGM.h
  34. 25
    12
      Marlin/ultralcd_impl_HD44780.h
  35. 14
    14
      Marlin/utility.cpp
  36. 16
    16
      Marlin/utility.h
  37. 1
    1
      Marlin/vector_3.h

+ 3
- 0
Marlin/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 7
- 8
Marlin/Marlin_main.cpp View File

@@ -5746,9 +5746,9 @@ inline void gcode_M17() {
5746 5746
     static bool sd_print_paused = false;
5747 5747
   #endif
5748 5748
 
5749
-  static void filament_change_beep(const int max_beep_count, const bool init=false) {
5749
+  static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
5750 5750
     static millis_t next_buzz = 0;
5751
-    static uint16_t runout_beep = 0;
5751
+    static int8_t runout_beep = 0;
5752 5752
 
5753 5753
     if (init) next_buzz = runout_beep = 0;
5754 5754
 
@@ -5762,8 +5762,9 @@ inline void gcode_M17() {
5762 5762
     }
5763 5763
   }
5764 5764
 
5765
-  static bool pause_print(const float& retract, const float& z_lift, const float& x_pos, const float& y_pos,
5766
-                          const float& unload_length = 0 , int max_beep_count = 0, bool show_lcd = false) {
5765
+  static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos,
5766
+                          const float &unload_length = 0 , int8_t max_beep_count = 0, bool show_lcd = false
5767
+  ) {
5767 5768
     if (move_away_flag) return false; // already paused
5768 5769
 
5769 5770
     if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder) && unload_length > 0) {
@@ -5772,8 +5773,6 @@ inline void gcode_M17() {
5772 5773
       return false;
5773 5774
     }
5774 5775
 
5775
-    const bool job_running = print_job_timer.isRunning();
5776
-
5777 5776
     // Indicate that the printer is paused
5778 5777
     move_away_flag = true;
5779 5778
 
@@ -5857,7 +5856,7 @@ inline void gcode_M17() {
5857 5856
     return true;
5858 5857
   }
5859 5858
 
5860
-  static void wait_for_filament_reload(int max_beep_count = 0) {
5859
+  static void wait_for_filament_reload(int8_t max_beep_count = 0) {
5861 5860
     bool nozzle_timed_out = false;
5862 5861
 
5863 5862
     // Wait for filament insert by user and press button
@@ -5882,7 +5881,7 @@ inline void gcode_M17() {
5882 5881
     KEEPALIVE_STATE(IN_HANDLER);
5883 5882
   }
5884 5883
 
5885
-  static void resume_print(const float& load_length = 0, const float& initial_extrude_length = 0, int max_beep_count = 0) {
5884
+  static void resume_print(const float &load_length = 0, const float &initial_extrude_length = 0, int8_t max_beep_count = 0) {
5886 5885
     bool nozzle_timed_out = false;
5887 5886
 
5888 5887
     if (!move_away_flag) return;

+ 1
- 1
Marlin/SdBaseFile.cpp View File

@@ -1819,7 +1819,7 @@ fail:
1819 1819
 //------------------------------------------------------------------------------
1820 1820
 // suppress cpplint warnings with NOLINT comment
1821 1821
 #if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
1822
-  void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0;  // NOLINT
1822
+  void (*SdBaseFile::oldDateTime_)(uint16_t &date, uint16_t &time) = 0;  // NOLINT
1823 1823
 #endif  // ALLOW_DEPRECATED_FUNCTIONS
1824 1824
 
1825 1825
 

+ 2
- 2
Marlin/SdBaseFile.h View File

@@ -402,7 +402,7 @@ class SdBaseFile {
402 402
    * \param[in] dateTime The user's call back function.
403 403
    */
404 404
   static void dateTimeCallback(
405
-    void (*dateTime)(uint16_t& date, uint16_t& time)) {  // NOLINT
405
+    void (*dateTime)(uint16_t &date, uint16_t &time)) {  // NOLINT
406 406
     oldDateTime_ = dateTime;
407 407
     dateTime_ = dateTime ? oldToNew : 0;
408 408
   }
@@ -477,7 +477,7 @@ class SdBaseFile {
477 477
   //------------------------------------------------------------------------------
478 478
   // rest are private
479 479
  private:
480
-  static void (*oldDateTime_)(uint16_t& date, uint16_t& time);  // NOLINT
480
+  static void (*oldDateTime_)(uint16_t &date, uint16_t &time);  // NOLINT
481 481
   static void oldToNew(uint16_t* date, uint16_t* time) {
482 482
     uint16_t d;
483 483
     uint16_t t;

+ 3
- 0
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/Felix/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

@@ -443,6 +443,9 @@
443 443
 // Include a page of printer information in the LCD Main Menu
444 444
 #define LCD_INFO_MENU
445 445
 
446
+// Scroll a longer status message into view
447
+//#define STATUS_MESSAGE_SCROLLING
448
+
446 449
 // On the Info Screen, display XY with one decimal place when possible
447 450
 #define LCD_DECIMAL_SMALL_XY
448 451
 

+ 3
- 0
Marlin/example_configurations/K8200/Configuration_adv.h View File

@@ -455,6 +455,9 @@
455 455
 // Include a page of printer information in the LCD Main Menu
456 456
 //#define LCD_INFO_MENU
457 457
 
458
+// Scroll a longer status message into view
459
+//#define STATUS_MESSAGE_SCROLLING
460
+
458 461
 // On the Info Screen, display XY with one decimal place when possible
459 462
 //#define LCD_DECIMAL_SMALL_XY
460 463
 

+ 3
- 0
Marlin/example_configurations/K8400/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/TinyBoy2/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 #define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

@@ -444,6 +444,9 @@
444 444
 // Include a page of printer information in the LCD Main Menu
445 445
 //#define LCD_INFO_MENU
446 446
 
447
+// Scroll a longer status message into view
448
+//#define STATUS_MESSAGE_SCROLLING
449
+
447 450
 // On the Info Screen, display XY with one decimal place when possible
448 451
 //#define LCD_DECIMAL_SMALL_XY
449 452
 

+ 3
- 0
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h View File

@@ -444,6 +444,9 @@
444 444
 // Include a page of printer information in the LCD Main Menu
445 445
 //#define LCD_INFO_MENU
446 446
 
447
+// Scroll a longer status message into view
448
+//#define STATUS_MESSAGE_SCROLLING
449
+
447 450
 // On the Info Screen, display XY with one decimal place when possible
448 451
 //#define LCD_DECIMAL_SMALL_XY
449 452
 

+ 3
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

@@ -444,6 +444,9 @@
444 444
 // Include a page of printer information in the LCD Main Menu
445 445
 //#define LCD_INFO_MENU
446 446
 
447
+// Scroll a longer status message into view
448
+//#define STATUS_MESSAGE_SCROLLING
449
+
447 450
 // On the Info Screen, display XY with one decimal place when possible
448 451
 //#define LCD_DECIMAL_SMALL_XY
449 452
 

+ 3
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

@@ -444,6 +444,9 @@
444 444
 // Include a page of printer information in the LCD Main Menu
445 445
 //#define LCD_INFO_MENU
446 446
 
447
+// Scroll a longer status message into view
448
+//#define STATUS_MESSAGE_SCROLLING
449
+
447 450
 // On the Info Screen, display XY with one decimal place when possible
448 451
 //#define LCD_DECIMAL_SMALL_XY
449 452
 

+ 3
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

@@ -449,6 +449,9 @@
449 449
 // Include a page of printer information in the LCD Main Menu
450 450
 //#define LCD_INFO_MENU
451 451
 
452
+// Scroll a longer status message into view
453
+//#define STATUS_MESSAGE_SCROLLING
454
+
452 455
 // On the Info Screen, display XY with one decimal place when possible
453 456
 //#define LCD_DECIMAL_SMALL_XY
454 457
 

+ 3
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

@@ -444,6 +444,9 @@
444 444
 // Include a page of printer information in the LCD Main Menu
445 445
 //#define LCD_INFO_MENU
446 446
 
447
+// Scroll a longer status message into view
448
+//#define STATUS_MESSAGE_SCROLLING
449
+
447 450
 // On the Info Screen, display XY with one decimal place when possible
448 451
 //#define LCD_DECIMAL_SMALL_XY
449 452
 

+ 3
- 0
Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/makibox/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 //#define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 3
- 0
Marlin/example_configurations/wt150/Configuration_adv.h View File

@@ -442,6 +442,9 @@
442 442
 // Include a page of printer information in the LCD Main Menu
443 443
 #define LCD_INFO_MENU
444 444
 
445
+// Scroll a longer status message into view
446
+//#define STATUS_MESSAGE_SCROLLING
447
+
445 448
 // On the Info Screen, display XY with one decimal place when possible
446 449
 //#define LCD_DECIMAL_SMALL_XY
447 450
 

+ 1
- 1
Marlin/gcode.h View File

@@ -133,7 +133,7 @@ public:
133 133
     // Code is found in the string. If not found, value_ptr is unchanged.
134 134
     // This allows "if (seen('A')||seen('B'))" to use the last-found value.
135 135
     static bool seen(const char c) {
136
-      char *p = strchr(command_args, c);
136
+      const char *p = strchr(command_args, c);
137 137
       const bool b = !!p;
138 138
       if (b) value_ptr = DECIMAL_SIGNED(p[1]) ? &p[1] : NULL;
139 139
       return b;

+ 1
- 1
Marlin/planner.cpp View File

@@ -1510,7 +1510,7 @@ void Planner::sync_from_steppers() {
1510 1510
 /**
1511 1511
  * Setters for planner position (also setting stepper position).
1512 1512
  */
1513
-void Planner::set_position_mm(const AxisEnum axis, const float& v) {
1513
+void Planner::set_position_mm(const AxisEnum axis, const float &v) {
1514 1514
   #if ENABLED(DISTINCT_E_FACTORS)
1515 1515
     const uint8_t axis_index = axis + (axis == E_AXIS ? active_extruder : 0);
1516 1516
     last_extruder = active_extruder;

+ 5
- 2
Marlin/temperature.cpp View File

@@ -67,8 +67,11 @@ float Temperature::current_temperature[HOTENDS] = { 0.0 },
67 67
       Temperature::current_temperature_bed = 0.0;
68 68
 int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
69 69
         Temperature::target_temperature[HOTENDS] = { 0 },
70
-        Temperature::current_temperature_bed_raw = 0,
71
-        Temperature::target_temperature_bed = 0;
70
+        Temperature::current_temperature_bed_raw = 0;
71
+
72
+#if HAS_HEATER_BED
73
+  int16_t Temperature::target_temperature_bed = 0;
74
+#endif
72 75
 
73 76
 #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
74 77
   float Temperature::redundant_temperature = 0.0;

+ 20
- 5
Marlin/temperature.h View File

@@ -92,6 +92,10 @@ enum ADCSensorState {
92 92
 
93 93
 #define ACTUAL_ADC_SAMPLES max(int(MIN_ADC_ISR_LOOPS), int(SensorsReady))
94 94
 
95
+#if !HAS_HEATER_BED
96
+  constexpr int16_t target_temperature_bed = 0;
97
+#endif
98
+
95 99
 class Temperature {
96 100
 
97 101
   public:
@@ -100,8 +104,11 @@ class Temperature {
100 104
                  current_temperature_bed;
101 105
     static int16_t current_temperature_raw[HOTENDS],
102 106
                    target_temperature[HOTENDS],
103
-                   current_temperature_bed_raw,
104
-                   target_temperature_bed;
107
+                   current_temperature_bed_raw;
108
+
109
+    #if HAS_HEATER_BED
110
+      static int16_t target_temperature_bed;
111
+    #endif
105 112
 
106 113
     static volatile bool in_temp_isr;
107 114
 
@@ -382,9 +389,17 @@ class Temperature {
382 389
     }
383 390
 
384 391
     static void setTargetBed(const int16_t celsius) {
385
-      target_temperature_bed = celsius;
386
-      #if WATCH_THE_BED
387
-        start_watching_bed();
392
+      #if HAS_HEATER_BED
393
+        target_temperature_bed =
394
+          #ifdef BED_MAXTEMP
395
+            min(celsius, BED_MAXTEMP)
396
+          #else
397
+            celsius
398
+          #endif
399
+        ;
400
+        #if WATCH_THE_BED
401
+          start_watching_bed();
402
+        #endif
388 403
       #endif
389 404
     }
390 405
 

+ 2
- 2
Marlin/ubl_motion.cpp View File

@@ -585,8 +585,8 @@
585 585
       float seg_dest[XYZE];  // per-segment destination, initialize to first segment
586 586
       LOOP_XYZE(i) seg_dest[i] = current_position[i] + segment_distance[i];
587 587
 
588
-      const float& dx_seg = segment_distance[X_AXIS];  // alias for clarity
589
-      const float& dy_seg = segment_distance[Y_AXIS];
588
+      const float &dx_seg = segment_distance[X_AXIS];  // alias for clarity
589
+      const float &dy_seg = segment_distance[Y_AXIS];
590 590
 
591 591
       float rx = RAW_X_POSITION(seg_dest[X_AXIS]),  // assume raw vs logical coordinates shifted but not scaled.
592 592
             ry = RAW_Y_POSITION(seg_dest[Y_AXIS]);

+ 27
- 13
Marlin/ultralcd.cpp View File

@@ -60,6 +60,9 @@ int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2
60 60
 
61 61
 uint8_t lcd_status_message_level;
62 62
 char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
63
+#if ENABLED(STATUS_MESSAGE_SCROLLING)
64
+  uint8_t status_scroll_pos = 0;
65
+#endif
63 66
 
64 67
 #if ENABLED(DOGLCD)
65 68
   #include "ultralcd_impl_DOGM.h"
@@ -3961,22 +3964,29 @@ void lcd_update() {
3961 3964
   } // ELAPSED(ms, next_lcd_update_ms)
3962 3965
 }
3963 3966
 
3964
-void set_utf_strlen(char* s, uint8_t n) {
3965
-  uint8_t i = 0, j = 0;
3966
-  while (s[i] && (j < n)) {
3967
-    #if ENABLED(MAPPER_NON)
3968
-      j++;
3969
-    #else
3970
-      if ((s[i] & 0xC0u) != 0x80u) j++;
3971
-    #endif
3972
-    i++;
3967
+#if DISABLED(STATUS_MESSAGE_SCROLLING)
3968
+
3969
+  void set_utf_strlen(char* s, uint8_t n) {
3970
+    uint8_t i = 0, j = 0;
3971
+    while (s[i] && (j < n)) {
3972
+      #if ENABLED(MAPPER_NON)
3973
+        j++;
3974
+      #else
3975
+        if ((s[i] & 0xC0u) != 0x80u) j++;
3976
+      #endif
3977
+      i++;
3978
+    }
3979
+    while (j++ < n) s[i++] = ' ';
3980
+    s[i] = '\0';
3973 3981
   }
3974
-  while (j++ < n) s[i++] = ' ';
3975
-  s[i] = '\0';
3976
-}
3982
+
3983
+#endif // !STATUS_MESSAGE_SCROLLING
3977 3984
 
3978 3985
 void lcd_finishstatus(bool persist=false) {
3979
-  set_utf_strlen(lcd_status_message, LCD_WIDTH);
3986
+  #if DISABLED(STATUS_MESSAGE_SCROLLING)
3987
+    set_utf_strlen(lcd_status_message, LCD_WIDTH);
3988
+  #endif
3989
+
3980 3990
   #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
3981 3991
     UNUSED(persist);
3982 3992
   #endif
@@ -3992,6 +4002,10 @@ void lcd_finishstatus(bool persist=false) {
3992 4002
   #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
3993 4003
     previous_lcd_status_ms = millis();  //get status message to show up for a while
3994 4004
   #endif
4005
+
4006
+  #if ENABLED(STATUS_MESSAGE_SCROLLING)
4007
+    status_scroll_pos = 0;
4008
+  #endif
3995 4009
 }
3996 4010
 
3997 4011
 #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0

+ 33
- 14
Marlin/ultralcd_impl_DOGM.h View File

@@ -234,13 +234,24 @@ char lcd_print_and_count(const char c) {
234 234
   else return charset_mapper(c);
235 235
 }
236 236
 
237
-void lcd_print(const char* const str) {
238
-  for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c);
237
+/**
238
+ * Core LCD printing functions
239
+ * On DOGM all strings go through a filter for utf
240
+ * But only use lcd_print_utf and lcd_printPGM_utf for translated text
241
+ */
242
+void lcd_print(const char* const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c); }
243
+void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd_print(c); }
244
+
245
+void lcd_print_utf(const char* const str, const uint8_t maxLength=LCD_WIDTH) {
246
+  char c;
247
+  for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
248
+    n -= charset_mapper(c);
239 249
 }
240 250
 
241
-/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
242
-void lcd_printPGM(const char* str) {
243
-  for (; char c = pgm_read_byte(str); ++str) lcd_print(c);
251
+void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) {
252
+  char c;
253
+  for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
254
+    n -= charset_mapper(c);
244 255
 }
245 256
 
246 257
 // Initialize or re-initialize the LCD
@@ -320,7 +331,7 @@ static void lcd_implementation_init() {
320 331
 void lcd_kill_screen() {
321 332
   lcd_setFont(FONT_MENU);
322 333
   u8g.setPrintPos(0, u8g.getHeight()/4*1);
323
-  lcd_print(lcd_status_message);
334
+  lcd_print_utf(lcd_status_message);
324 335
   u8g.setPrintPos(0, u8g.getHeight()/4*2);
325 336
   lcd_printPGM(PSTR(MSG_HALTED));
326 337
   u8g.setPrintPos(0, u8g.getHeight()/4*3);
@@ -395,6 +406,20 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
395 406
   }
396 407
 }
397 408
 
409
+inline void lcd_implementation_status_message() {
410
+  #if ENABLED(STATUS_MESSAGE_SCROLLING)
411
+    lcd_print_utf(lcd_status_message + status_scroll_pos);
412
+    const uint8_t slen = lcd_strlen(lcd_status_message);
413
+    if (slen > LCD_WIDTH) {
414
+      // Skip any non-printing bytes
415
+      while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
416
+      if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
417
+    }
418
+  #else
419
+    lcd_print_utf(lcd_status_message);
420
+  #endif
421
+}
422
+
398 423
 //#define DOGM_SD_PERCENT
399 424
 
400 425
 static void lcd_implementation_status_screen() {
@@ -645,10 +670,7 @@ static void lcd_implementation_status_screen() {
645 670
 
646 671
     #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
647 672
       if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) {  //Display both Status message line and Filament display on the last line
648
-        const char *str = lcd_status_message;
649
-        uint8_t i = LCD_WIDTH;
650
-        char c;
651
-        while (i-- && (c = *str++)) lcd_print(c);
673
+        lcd_implementation_status_message();
652 674
       }
653 675
       else {
654 676
         lcd_printPGM(PSTR(LCD_STR_FILAM_DIA));
@@ -660,10 +682,7 @@ static void lcd_implementation_status_screen() {
660 682
         u8g.print('%');
661 683
       }
662 684
     #else
663
-      const char *str = lcd_status_message;
664
-      uint8_t i = LCD_WIDTH;
665
-      char c;
666
-      while (i-- && (c = *str++)) lcd_print(c);
685
+      lcd_implementation_status_message();
667 686
     #endif
668 687
   }
669 688
 }

+ 25
- 12
Marlin/ultralcd_impl_HD44780.h View File

@@ -380,16 +380,22 @@ static void lcd_implementation_init(
380 380
 
381 381
 void lcd_implementation_clear() { lcd.clear(); }
382 382
 
383
-/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
384
-void lcd_printPGM(const char *str) {
385
-  for (; char c = pgm_read_byte(str); ++str) charset_mapper(c);
386
-}
383
+void lcd_print(const char c) { charset_mapper(c); }
384
+
385
+void lcd_print(const char * const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd.print(c); }
386
+void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd.print(c); }
387 387
 
388
-void lcd_print(const char* const str) {
389
-  for (uint8_t i = 0; const char c = str[i]; ++i) charset_mapper(c);
388
+void lcd_print_utf(const char * const str, const uint8_t maxLength=LCD_WIDTH) {
389
+  char c;
390
+  for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
391
+    n -= charset_mapper(c);
390 392
 }
391 393
 
392
-void lcd_print(const char c) { charset_mapper(c); }
394
+void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) {
395
+  char c;
396
+  for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
397
+    n -= charset_mapper(c);
398
+}
393 399
 
394 400
 #if ENABLED(SHOW_BOOTSCREEN)
395 401
 
@@ -545,7 +551,7 @@ void lcd_print(const char c) { charset_mapper(c); }
545 551
 
546 552
 void lcd_kill_screen() {
547 553
   lcd.setCursor(0, 0);
548
-  lcd_print(lcd_status_message);
554
+  lcd_print_utf(lcd_status_message);
549 555
   #if LCD_HEIGHT < 4
550 556
     lcd.setCursor(0, 2);
551 557
   #else
@@ -818,10 +824,17 @@ static void lcd_implementation_status_screen() {
818 824
 
819 825
   #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT
820 826
 
821
-  const char *str = lcd_status_message;
822
-  uint8_t i = LCD_WIDTH;
823
-  char c;
824
-  while (i-- && (c = *str++)) lcd_print(c);
827
+  #if ENABLED(STATUS_MESSAGE_SCROLLING)
828
+    lcd_print_utf(lcd_status_message + status_scroll_pos);
829
+    const uint8_t slen = lcd_strlen(lcd_status_message);
830
+    if (slen > LCD_WIDTH) {
831
+      // Skip any non-printing bytes
832
+      while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
833
+      if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
834
+    }
835
+  #else
836
+    lcd_print_utf(lcd_status_message);
837
+  #endif
825 838
 }
826 839
 
827 840
 #if ENABLED(ULTIPANEL)

+ 14
- 14
Marlin/utility.cpp View File

@@ -57,14 +57,14 @@ void safe_delay(millis_t ms) {
57 57
   #define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
58 58
 
59 59
   // Convert unsigned int to string with 12 format
60
-  char* itostr2(const uint8_t& xx) {
60
+  char* itostr2(const uint8_t &xx) {
61 61
     conv[5] = DIGIMOD(xx, 10);
62 62
     conv[6] = DIGIMOD(xx, 1);
63 63
     return &conv[5];
64 64
   }
65 65
 
66 66
   // Convert signed int to rj string with 123 or -12 format
67
-  char* itostr3(const int& x) {
67
+  char* itostr3(const int &x) {
68 68
     int xx = x;
69 69
     conv[4] = MINUSOR(xx, RJDIGIT(xx, 100));
70 70
     conv[5] = RJDIGIT(xx, 10);
@@ -73,7 +73,7 @@ void safe_delay(millis_t ms) {
73 73
   }
74 74
 
75 75
   // Convert unsigned int to lj string with 123 format
76
-  char* itostr3left(const int& xx) {
76
+  char* itostr3left(const int &xx) {
77 77
     char *str = &conv[6];
78 78
     *str = DIGIMOD(xx, 1);
79 79
     if (xx >= 10) {
@@ -85,7 +85,7 @@ void safe_delay(millis_t ms) {
85 85
   }
86 86
 
87 87
   // Convert signed int to rj string with 1234, _123, -123, _-12, or __-1 format
88
-  char *itostr4sign(const int& x) {
88
+  char *itostr4sign(const int &x) {
89 89
     const bool neg = x < 0;
90 90
     const int xx = neg ? -x : x;
91 91
     if (x >= 1000) {
@@ -116,7 +116,7 @@ void safe_delay(millis_t ms) {
116 116
   }
117 117
 
118 118
   // Convert unsigned float to string with 1.23 format
119
-  char* ftostr12ns(const float& x) {
119
+  char* ftostr12ns(const float &x) {
120 120
     const long xx = (x < 0 ? -x : x) * 100;
121 121
     conv[3] = DIGIMOD(xx, 100);
122 122
     conv[4] = '.';
@@ -126,7 +126,7 @@ void safe_delay(millis_t ms) {
126 126
   }
127 127
 
128 128
   // Convert signed float to fixed-length string with 023.45 / -23.45 format
129
-  char *ftostr32(const float& x) {
129
+  char *ftostr32(const float &x) {
130 130
     long xx = x * 100;
131 131
     conv[1] = MINUSOR(xx, DIGIMOD(xx, 10000));
132 132
     conv[2] = DIGIMOD(xx, 1000);
@@ -140,7 +140,7 @@ void safe_delay(millis_t ms) {
140 140
   #if ENABLED(LCD_DECIMAL_SMALL_XY)
141 141
 
142 142
     // Convert float to rj string with 1234, _123, -123, _-12, 12.3, _1.2, or -1.2 format
143
-    char *ftostr4sign(const float& fx) {
143
+    char *ftostr4sign(const float &fx) {
144 144
       const int x = fx * 10;
145 145
       if (!WITHIN(x, -99, 999)) return itostr4sign((int)fx);
146 146
       const bool neg = x < 0;
@@ -155,7 +155,7 @@ void safe_delay(millis_t ms) {
155 155
   #endif // LCD_DECIMAL_SMALL_XY
156 156
 
157 157
   // Convert float to fixed-length string with +123.4 / -123.4 format
158
-  char* ftostr41sign(const float& x) {
158
+  char* ftostr41sign(const float &x) {
159 159
     int xx = x * 10;
160 160
     conv[1] = MINUSOR(xx, '+');
161 161
     conv[2] = DIGIMOD(xx, 1000);
@@ -167,7 +167,7 @@ void safe_delay(millis_t ms) {
167 167
   }
168 168
 
169 169
   // Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format
170
-  char* ftostr43sign(const float& x, char plus/*=' '*/) {
170
+  char* ftostr43sign(const float &x, char plus/*=' '*/) {
171 171
     long xx = x * 1000;
172 172
     conv[1] = xx ? MINUSOR(xx, plus) : ' ';
173 173
     conv[2] = DIGIMOD(xx, 1000);
@@ -179,7 +179,7 @@ void safe_delay(millis_t ms) {
179 179
   }
180 180
 
181 181
   // Convert unsigned float to rj string with 12345 format
182
-  char* ftostr5rj(const float& x) {
182
+  char* ftostr5rj(const float &x) {
183 183
     const long xx = x < 0 ? -x : x;
184 184
     conv[2] = RJDIGIT(xx, 10000);
185 185
     conv[3] = RJDIGIT(xx, 1000);
@@ -190,7 +190,7 @@ void safe_delay(millis_t ms) {
190 190
   }
191 191
 
192 192
   // Convert signed float to string with +1234.5 format
193
-  char* ftostr51sign(const float& x) {
193
+  char* ftostr51sign(const float &x) {
194 194
     long xx = x * 10;
195 195
     conv[0] = MINUSOR(xx, '+');
196 196
     conv[1] = DIGIMOD(xx, 10000);
@@ -203,7 +203,7 @@ void safe_delay(millis_t ms) {
203 203
   }
204 204
 
205 205
   // Convert signed float to string with +123.45 format
206
-  char* ftostr52sign(const float& x) {
206
+  char* ftostr52sign(const float &x) {
207 207
     long xx = x * 100;
208 208
     conv[0] = MINUSOR(xx, '+');
209 209
     conv[1] = DIGIMOD(xx, 10000);
@@ -216,7 +216,7 @@ void safe_delay(millis_t ms) {
216 216
   }
217 217
 
218 218
   // Convert unsigned float to string with 1234.56 format omitting trailing zeros
219
-  char* ftostr62rj(const float& x) {
219
+  char* ftostr62rj(const float &x) {
220 220
     const long xx = (x < 0 ? -x : x) * 100;
221 221
     conv[0] = RJDIGIT(xx, 100000);
222 222
     conv[1] = RJDIGIT(xx, 10000);
@@ -229,7 +229,7 @@ void safe_delay(millis_t ms) {
229 229
   }
230 230
 
231 231
   // Convert signed float to space-padded string with -_23.4_ format
232
-  char* ftostr52sp(const float& x) {
232
+  char* ftostr52sp(const float &x) {
233 233
     long xx = x * 100;
234 234
     uint8_t dig;
235 235
     conv[1] = MINUSOR(xx, RJDIGIT(xx, 10000));

+ 16
- 16
Marlin/utility.h View File

@@ -32,53 +32,53 @@ void safe_delay(millis_t ms);
32 32
 #if ENABLED(ULTRA_LCD)
33 33
 
34 34
   // Convert unsigned int to string with 12 format
35
-  char* itostr2(const uint8_t& x);
35
+  char* itostr2(const uint8_t &x);
36 36
 
37 37
   // Convert signed int to rj string with 123 or -12 format
38
-  char* itostr3(const int& x);
38
+  char* itostr3(const int &x);
39 39
 
40 40
   // Convert unsigned int to lj string with 123 format
41
-  char* itostr3left(const int& xx);
41
+  char* itostr3left(const int &xx);
42 42
 
43 43
   // Convert signed int to rj string with _123, -123, _-12, or __-1 format
44
-  char *itostr4sign(const int& x);
44
+  char *itostr4sign(const int &x);
45 45
 
46 46
   // Convert unsigned float to string with 1.23 format
47
-  char* ftostr12ns(const float& x);
47
+  char* ftostr12ns(const float &x);
48 48
 
49 49
   // Convert signed float to fixed-length string with 023.45 / -23.45 format
50
-  char *ftostr32(const float& x);
50
+  char *ftostr32(const float &x);
51 51
 
52 52
   // Convert float to fixed-length string with +123.4 / -123.4 format
53
-  char* ftostr41sign(const float& x);
53
+  char* ftostr41sign(const float &x);
54 54
 
55 55
   // Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format
56
-  char* ftostr43sign(const float& x, char plus=' ');
56
+  char* ftostr43sign(const float &x, char plus=' ');
57 57
 
58 58
   // Convert unsigned float to rj string with 12345 format
59
-  char* ftostr5rj(const float& x);
59
+  char* ftostr5rj(const float &x);
60 60
 
61 61
   // Convert signed float to string with +1234.5 format
62
-  char* ftostr51sign(const float& x);
62
+  char* ftostr51sign(const float &x);
63 63
 
64 64
   // Convert signed float to space-padded string with -_23.4_ format
65
-  char* ftostr52sp(const float& x);
65
+  char* ftostr52sp(const float &x);
66 66
 
67 67
   // Convert signed float to string with +123.45 format
68
-  char* ftostr52sign(const float& x);
68
+  char* ftostr52sign(const float &x);
69 69
 
70 70
   // Convert unsigned float to string with 1234.56 format omitting trailing zeros
71
-  char* ftostr62rj(const float& x);
71
+  char* ftostr62rj(const float &x);
72 72
 
73 73
   // Convert float to rj string with 123 or -12 format
74
-  FORCE_INLINE char *ftostr3(const float& x) { return itostr3((int)x); }
74
+  FORCE_INLINE char *ftostr3(const float &x) { return itostr3((int)x); }
75 75
 
76 76
   #if ENABLED(LCD_DECIMAL_SMALL_XY)
77 77
     // Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format
78
-    char *ftostr4sign(const float& fx);
78
+    char *ftostr4sign(const float &fx);
79 79
   #else
80 80
     // Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format
81
-    FORCE_INLINE char *ftostr4sign(const float& x) { return itostr4sign((int)x); }
81
+    FORCE_INLINE char *ftostr4sign(const float &x) { return itostr4sign((int)x); }
82 82
   #endif
83 83
 
84 84
 #endif // ULTRA_LCD

+ 1
- 1
Marlin/vector_3.h View File

@@ -77,7 +77,7 @@ struct matrix_3x3 {
77 77
 };
78 78
 
79 79
 
80
-void apply_rotation_xyz(matrix_3x3 rotationMatrix, float& x, float& y, float& z);
80
+void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float &y, float &z);
81 81
 
82 82
 #endif // HAS_ABL
83 83
 #endif // VECTOR_3_H

Loading…
Cancel
Save