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:
@@ -268,6 +268,10 @@ 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
|
||||
|
||||
while (len--) {
|
||||
@@ -417,7 +421,7 @@ void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t le
|
||||
if (neg) {
|
||||
*--s = '-';
|
||||
}
|
||||
flags &= ~LEADING0;
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, s, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#ifndef _LCD_H_
|
||||
#define _LCD_H_
|
||||
|
||||
|
||||
#define BOX_WIDTH 31
|
||||
#define coord_t int
|
||||
#define scoord_t int
|
||||
@@ -45,6 +44,7 @@
|
||||
#define BOLD 0x04
|
||||
#define LEFT 0x00
|
||||
#define RIGHT 0x08
|
||||
#define CENTERED 0x20
|
||||
#define FIXEDWIDTH 0x10
|
||||
/* no 0x80 here because of "GV"1 which is aligned LEFT */
|
||||
/* no 0x10 here because of "MODEL"01 which uses LEADING0 */
|
||||
|
||||
Reference in New Issue
Block a user