🎨 Apply F() to MKS UI errors, assets

This commit is contained in:
Scott Lahteine
2021-09-28 19:28:29 -05:00
parent 1dafd1887e
commit d1938d54ed
5 changed files with 159 additions and 153 deletions

View File

@@ -697,24 +697,28 @@ void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint1
}
}
void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor) {
while (*string != '\0') {
disp_char_1624(x, y, *string, charColor, bkColor);
string++;
x += 16;
}
void disp_string(uint16_t x, uint16_t y, const char * cstr, uint16_t charColor, uint16_t bkColor) {
for (char c; (c = *cstr); cstr++, x += 16)
disp_char_1624(x, y, c, charColor, bkColor);
}
void disp_string(uint16_t x, uint16_t y, FSTR_P const fstr, uint16_t charColor, uint16_t bkColor) {
PGM_P pstr = FTOP(fstr);
for (char c; (c = pgm_read_byte(pstr)); pstr++, x += 16)
disp_char_1624(x, y, c, charColor, bkColor);
}
void disp_assets_update() {
SPI_TFT.LCD_clear(0x0000);
disp_string(100, 140, "Assets Updating...", 0xFFFF, 0x0000);
disp_string(100, 140, F("Assets Updating..."), 0xFFFF, 0x0000);
}
void disp_assets_update_progress(const char *msg) {
char buf[30];
memset(buf, ' ', COUNT(buf));
strncpy(buf, msg, strlen(msg));
buf[COUNT(buf) - 1] = '\0';
void disp_assets_update_progress(FSTR_P const fmsg) {
static constexpr int buflen = 30;
char buf[buflen];
memset(buf, ' ', buflen);
strncpy_P(buf, FTOP(fmsg), buflen - 1);
buf[buflen - 1] = '\0';
disp_string(100, 165, buf, 0xFFFF, 0x0000);
}