Use PGM_P for PSTR pointers (#11977)

This commit is contained in:
Scott Lahteine
2018-09-30 23:44:33 -05:00
committed by GitHub
parent 4d5566a6b7
commit 11ac75edcb
39 changed files with 166 additions and 165 deletions

View File

@ -75,18 +75,18 @@ void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) {
while (*str && len--) write_byte(*str++);
}
void ST7920_Lite_Status_Screen::write_str_P(const char * const str) {
const char *p_str = (const char *)str;
void ST7920_Lite_Status_Screen::write_str_P(PGM_P const str) {
PGM_P p_str = (PGM_P)str;
while (char c = pgm_read_byte_near(p_str++)) write_byte(c);
}
void ST7920_Lite_Status_Screen::write_str(progmem_str str) {
write_str_P((const char*)str);
write_str_P((PGM_P)str);
}
void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
char str[7];
const char *fmt;
PGM_P fmt;
switch (digits) {
case 6: fmt = PSTR("%6d"); break;
case 5: fmt = PSTR("%5d"); break;

View File

@ -48,7 +48,7 @@ class ST7920_Lite_Status_Screen {
static void write_str(const char *str);
static void write_str(const char *str, const uint8_t len);
static void write_str_P(const char * const str);
static void write_str_P(PGM_P const str);
static void write_str(progmem_str str);
static void write_number(const int16_t value, const uint8_t digits=3);