Explorar el Código

Merge pull request #4335 from thinkyhead/rc_status_pad_jp

Debug char, fix compile errors for lcd pins
Scott Lahteine hace 9 años
padre
commit
0342661b3f
Se han modificado 4 ficheros con 26 adiciones y 24 borrados
  1. 1
    0
      Marlin/Marlin.h
  2. 1
    0
      Marlin/Marlin_main.cpp
  3. 9
    7
      Marlin/pins_RAMPS_14.h
  4. 15
    17
      Marlin/ultralcd.cpp

+ 1
- 0
Marlin/Marlin.h Ver fichero

@@ -105,6 +105,7 @@ extern const char echomagic[] PROGMEM;
105 105
 
106 106
 #define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
107 107
 
108
+void serial_echopair_P(const char* s_P, char v);
108 109
 void serial_echopair_P(const char* s_P, int v);
109 110
 void serial_echopair_P(const char* s_P, long v);
110 111
 void serial_echopair_P(const char* s_P, float v);

+ 1
- 0
Marlin/Marlin_main.cpp Ver fichero

@@ -572,6 +572,7 @@ void prepare_move_to_destination();
572 572
   void plan_cubic_move(const float offset[4]);
573 573
 #endif
574 574
 
575
+void serial_echopair_P(const char* s_P, char v)          { serialprintPGM(s_P); SERIAL_CHAR(v); }
575 576
 void serial_echopair_P(const char* s_P, int v)           { serialprintPGM(s_P); SERIAL_ECHO(v); }
576 577
 void serial_echopair_P(const char* s_P, long v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
577 578
 void serial_echopair_P(const char* s_P, float v)         { serialprintPGM(s_P); SERIAL_ECHO(v); }

+ 9
- 7
Marlin/pins_RAMPS_14.h Ver fichero

@@ -149,19 +149,21 @@
149 149
     #define LCD_PINS_D6 44
150 150
     #define LCD_PINS_D7 64
151 151
   #else
152
-    #define BEEPER_PIN 33
153 152
     #define LCD_PINS_RS 16
154 153
     #define LCD_PINS_ENABLE 17
155 154
     #define LCD_PINS_D4 23
156 155
     #define LCD_PINS_D5 25
157 156
     #define LCD_PINS_D6 27
158 157
     #define LCD_PINS_D7 29
159
-    // Buttons are attached to a shift register
160
-    // Not wired yet
161
-    //#define SHIFT_CLK 38
162
-    //#define SHIFT_LD 42
163
-    //#define SHIFT_OUT 40
164
-    //#define SHIFT_EN 17
158
+    #if DISABLED(NEWPANEL)
159
+      #define BEEPER_PIN 33
160
+      // Buttons are attached to a shift register
161
+      // Not wired yet
162
+      //#define SHIFT_CLK 38
163
+      //#define SHIFT_LD 42
164
+      //#define SHIFT_OUT 40
165
+      //#define SHIFT_EN 17
166
+    #endif
165 167
   #endif
166 168
 
167 169
   #if ENABLED(NEWPANEL)

+ 15
- 17
Marlin/ultralcd.cpp Ver fichero

@@ -2738,7 +2738,18 @@ void lcd_update() {
2738 2738
   }
2739 2739
 }
2740 2740
 
2741
+void set_utf_strlen(char* s, uint8_t n) {
2742
+  uint8_t i = 0, j = 0;
2743
+  while (s[i] && (j < n)) {
2744
+    if ((s[i] & 0xC0u) != 0x80u) j++;
2745
+    i++;
2746
+  }
2747
+  while (j++ < n) s[i++] = ' ';
2748
+  s[i] = '\0';
2749
+}
2750
+
2741 2751
 void lcd_finishstatus(bool persist=false) {
2752
+  set_utf_strlen(lcd_status_message, LCD_WIDTH);
2742 2753
   #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
2743 2754
     UNUSED(persist);
2744 2755
   #endif
@@ -2760,32 +2771,19 @@ void lcd_finishstatus(bool persist=false) {
2760 2771
   void dontExpireStatus() { expire_status_ms = 0; }
2761 2772
 #endif
2762 2773
 
2763
-void set_utf_strlen(char* s, uint8_t n) {
2764
-  uint8_t i = 0, j = 0;
2765
-  while (s[i] && (j < n)) {
2766
-    if ((s[i] & 0xc0u) != 0x80u) j++;
2767
-    i++;
2768
-  }
2769
-  while (j++ < n) s[i++] = ' ';
2770
-  s[i] = '\0';
2771
-}
2772
-
2773 2774
 bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
2774 2775
 
2775 2776
 void lcd_setstatus(const char* message, bool persist) {
2776 2777
   if (lcd_status_message_level > 0) return;
2777 2778
   strncpy(lcd_status_message, message, 3 * (LCD_WIDTH));
2778
-  set_utf_strlen(lcd_status_message, LCD_WIDTH);
2779 2779
   lcd_finishstatus(persist);
2780 2780
 }
2781 2781
 
2782 2782
 void lcd_setstatuspgm(const char* message, uint8_t level) {
2783
-  if (level >= lcd_status_message_level) {
2784
-    strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
2785
-    set_utf_strlen(lcd_status_message, LCD_WIDTH);
2786
-    lcd_status_message_level = level;
2787
-    lcd_finishstatus(level > 0);
2788
-  }
2783
+  if (level < lcd_status_message_level) return;
2784
+  lcd_status_message_level = level;
2785
+  strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
2786
+  lcd_finishstatus(level > 0);
2789 2787
 }
2790 2788
 
2791 2789
 void lcd_setalertstatuspgm(const char* message) {

Loading…
Cancelar
Guardar