Merge pull request #4335 from thinkyhead/rc_status_pad_jp

Debug char, fix compile errors for lcd pins
2.0.x
Scott Lahteine 8 years ago committed by GitHub
commit 0342661b3f

@ -105,6 +105,7 @@ extern const char echomagic[] PROGMEM;
#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, long v);
void serial_echopair_P(const char* s_P, float v);

@ -572,6 +572,7 @@ void prepare_move_to_destination();
void plan_cubic_move(const float offset[4]);
#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, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_P(const char* s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); }

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

@ -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) {
set_utf_strlen(lcd_status_message, LCD_WIDTH);
#if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
UNUSED(persist);
#endif
@ -2760,32 +2771,19 @@ void lcd_finishstatus(bool persist=false) {
void dontExpireStatus() { expire_status_ms = 0; }
#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'); }
void lcd_setstatus(const char* message, bool persist) {
if (lcd_status_message_level > 0) return;
strncpy(lcd_status_message, message, 3 * (LCD_WIDTH));
set_utf_strlen(lcd_status_message, LCD_WIDTH);
lcd_finishstatus(persist);
}
void lcd_setstatuspgm(const char* message, uint8_t level) {
if (level >= lcd_status_message_level) {
strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
set_utf_strlen(lcd_status_message, LCD_WIDTH);
lcd_status_message_level = level;
lcd_finishstatus(level > 0);
}
if (level < lcd_status_message_level) return;
lcd_status_message_level = level;
strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
lcd_finishstatus(level > 0);
}
void lcd_setalertstatuspgm(const char* message) {

Loading…
Cancel
Save