Merge with latest 2.3

This commit is contained in:
Bertrand Songis
2020-06-18 11:14:07 +02:00
121 changed files with 3269 additions and 1775 deletions
+12 -8
View File
@@ -117,7 +117,6 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
}
}
#if !defined(BOOT)
struct PatternData
{
uint8_t width;
@@ -144,10 +143,11 @@ uint8_t getPatternWidth(const PatternData * pattern)
void getCharPattern(PatternData * pattern, unsigned char c, LcdFlags flags)
{
#if !defined(BOOT)
uint32_t fontsize = FONTSIZE(flags);
unsigned char c_remapped = 0;
if (fontsize == DBLSIZE || (flags&BOLD)) {
if (fontsize == DBLSIZE || (flags & BOLD)) {
// To save space only some DBLSIZE and BOLD chars are available
// c has to be remapped. All non existing chars mapped to 0 (space)
if (c>=',' && c<=':')
@@ -204,6 +204,11 @@ void getCharPattern(PatternData * pattern, unsigned char c, LcdFlags flags)
pattern->height = 7;
pattern->data = (c < 0xC0) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0xC0)*5];
}
#else
pattern->width = 5;
pattern->height = 7;
pattern->data = &font_5x7[(c-0x20)*5];
#endif
}
uint8_t getCharWidth(char c, LcdFlags flags)
@@ -212,7 +217,6 @@ uint8_t getCharWidth(char c, LcdFlags flags)
getCharPattern(&pattern, c, flags);
return getPatternWidth(&pattern);
}
#endif
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags)
{
@@ -287,12 +291,15 @@ void lcdDrawChar(coord_t x, coord_t y, char c)
lcdDrawChar(x, y, c, 0);
}
#if !defined(BOOT)
uint8_t getTextWidth(const char * s, uint8_t len, LcdFlags flags)
{
uint8_t width = 0;
for (int i=0; len==0 || i<len; ++i) {
for (int i = 0; len == 0 || i < len; ++i) {
#if !defined(BOOT)
unsigned char c = *s;
#else
unsigned char c = *s;
#endif
if (!c) {
break;
}
@@ -301,7 +308,6 @@ uint8_t getTextWidth(const char * s, uint8_t len, LcdFlags flags)
}
return width;
}
#endif
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlags flags)
{
@@ -310,7 +316,6 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
const uint8_t orig_len = len;
uint32_t fontsize = FONTSIZE(flags);
#if !defined(BOOT)
uint8_t width = 0;
if (flags & RIGHT) {
width = getTextWidth(s, len, flags);
@@ -320,7 +325,6 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
width = getTextWidth(s, len, flags);
x -= width / 2;
}
#endif
bool setx = false;
while (len--) {