Bsongis/radio tools (#6484)

Lua tools now displayed in RADIO / TOOLS
Add a function to write CENTERED text with lcdDrawText
This commit is contained in:
Bertrand Songis
2019-06-08 10:42:29 +02:00
committed by GitHub
parent a3cc0ee830
commit 56a31f20d3
10 changed files with 144 additions and 57 deletions
+7 -7
View File
@@ -316,15 +316,16 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
width = getTextWidth(s, len, flags);
x -= width;
}
else if (flags & CENTERED) {
width = getTextWidth(s, len, flags);
x -= width / 2;
}
#endif
bool setx = false;
while (len--) {
unsigned char c;
switch (flags & (BSS+ZCHAR)) {
case BSS:
c = *s;
break;
switch (flags & ZCHAR) {
#if !defined(BOOT)
case ZCHAR:
c = zchar2char(*s);
@@ -419,7 +420,7 @@ void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFla
{
uint8_t length;
length = *(s++);
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~(BSS|ZCHAR));
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~ZCHAR);
}
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
@@ -446,7 +447,6 @@ void lcdDrawHexChar(coord_t x, coord_t y, uint8_t val, LcdFlags flags)
}
}
void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val)
{
lcdDrawNumber(x, y, val);
@@ -484,7 +484,7 @@ void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t l
if (neg) {
*--s = '-';
}
flags &= ~LEADING0;
flags &= ~(LEADING0 | PREC1 | PREC2);
lcdDrawText(x, y, s, flags);
}
#endif