Merge pull request #4335 from thinkyhead/rc_status_pad_jp

Debug char, fix compile errors for lcd pins
This commit is contained in:
Scott Lahteine 2016-07-17 14:07:08 -07:00 committed by GitHub
commit 0342661b3f
4 changed files with 26 additions and 24 deletions

View File

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

View File

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

View File

@ -149,19 +149,21 @@
#define LCD_PINS_D6 44 #define LCD_PINS_D6 44
#define LCD_PINS_D7 64 #define LCD_PINS_D7 64
#else #else
#define BEEPER_PIN 33
#define LCD_PINS_RS 16 #define LCD_PINS_RS 16
#define LCD_PINS_ENABLE 17 #define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 23 #define LCD_PINS_D4 23
#define LCD_PINS_D5 25 #define LCD_PINS_D5 25
#define LCD_PINS_D6 27 #define LCD_PINS_D6 27
#define LCD_PINS_D7 29 #define LCD_PINS_D7 29
// Buttons are attached to a shift register #if DISABLED(NEWPANEL)
// Not wired yet #define BEEPER_PIN 33
//#define SHIFT_CLK 38 // Buttons are attached to a shift register
//#define SHIFT_LD 42 // Not wired yet
//#define SHIFT_OUT 40 //#define SHIFT_CLK 38
//#define SHIFT_EN 17 //#define SHIFT_LD 42
//#define SHIFT_OUT 40
//#define SHIFT_EN 17
#endif
#endif #endif
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)

View File

@ -2738,7 +2738,18 @@ void lcd_update() {
} }
} }
void set_utf_strlen(char* s, uint8_t n) {
uint8_t i = 0, j = 0;
while (s[i] && (j < n)) {
if ((s[i] & 0xC0u) != 0x80u) j++;
i++;
}
while (j++ < n) s[i++] = ' ';
s[i] = '\0';
}
void lcd_finishstatus(bool persist=false) { void lcd_finishstatus(bool persist=false) {
set_utf_strlen(lcd_status_message, LCD_WIDTH);
#if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0)) #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
UNUSED(persist); UNUSED(persist);
#endif #endif
@ -2760,32 +2771,19 @@ void lcd_finishstatus(bool persist=false) {
void dontExpireStatus() { expire_status_ms = 0; } void dontExpireStatus() { expire_status_ms = 0; }
#endif #endif
void set_utf_strlen(char* s, uint8_t n) {
uint8_t i = 0, j = 0;
while (s[i] && (j < n)) {
if ((s[i] & 0xc0u) != 0x80u) j++;
i++;
}
while (j++ < n) s[i++] = ' ';
s[i] = '\0';
}
bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
void lcd_setstatus(const char* message, bool persist) { void lcd_setstatus(const char* message, bool persist) {
if (lcd_status_message_level > 0) return; if (lcd_status_message_level > 0) return;
strncpy(lcd_status_message, message, 3 * (LCD_WIDTH)); strncpy(lcd_status_message, message, 3 * (LCD_WIDTH));
set_utf_strlen(lcd_status_message, LCD_WIDTH);
lcd_finishstatus(persist); lcd_finishstatus(persist);
} }
void lcd_setstatuspgm(const char* message, uint8_t level) { void lcd_setstatuspgm(const char* message, uint8_t level) {
if (level >= lcd_status_message_level) { if (level < lcd_status_message_level) return;
strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH)); lcd_status_message_level = level;
set_utf_strlen(lcd_status_message, LCD_WIDTH); strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
lcd_status_message_level = level; lcd_finishstatus(level > 0);
lcd_finishstatus(level > 0);
}
} }
void lcd_setalertstatuspgm(const char* message) { void lcd_setalertstatuspgm(const char* message) {