🎨 Updated string macros

This commit is contained in:
Scott Lahteine
2021-09-25 02:27:07 -05:00
parent dc4d2165f2
commit 262cd757fc
51 changed files with 237 additions and 234 deletions

View File

@ -21,10 +21,7 @@
*/
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "../../../HAL/shared/Marduino.h"
#include "../../../inc/MarlinConfig.h"
#ifndef DWIN_WIDTH
#define DWIN_WIDTH 272
@ -74,7 +71,7 @@ inline void DWIN_Text(size_t &i, const char * const string, uint16_t rlimit=0xFF
i += len;
}
inline void DWIN_Text(size_t &i, const __FlashStringHelper * string, uint16_t rlimit=0xFFFF) {
inline void DWIN_Text(size_t &i, FSTR_P string, uint16_t rlimit=0xFFFF) {
if (!string) return;
const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, _MIN(rlimit, strlen_P((PGM_P)string))); // cast to PGM_P (const char*) measure with strlen_P.
if (len == 0) return;
@ -177,9 +174,9 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
// rlimit: For draw less chars than string length use rlimit
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF);
inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) {
inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P title) {
// Note that this won't work on AVR, only 32-bit systems!
DWIN_Draw_String(bShow, size, color, bColor, x, y, reinterpret_cast<const char*>(title));
DWIN_Draw_String(bShow, size, color, bColor, x, y, FTOP(title));
}
// Draw a positive integer