diff --git a/radio/src/lcd_common.cpp b/radio/src/lcd_common.cpp index 7d0bcf82a..c3b4d3443 100644 --- a/radio/src/lcd_common.cpp +++ b/radio/src/lcd_common.cpp @@ -134,11 +134,7 @@ void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags) { -#if !defined(BOOT) - const pm_uchar *q = (c < 0xC0) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0xC0)*5]; -#else - const pm_uchar *q = &font_5x7[(c-0x20)*5]; -#endif + const pm_uchar * q; lcdNextPos = x-1; @@ -158,14 +154,17 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags) c_remapped = 4; else if (c!=' ') flags &= ~BOLD; - if ((c>= 128) && (flags & DBLSIZE)) - c_remapped = c - 60; } if (flags & DBLSIZE) { - /* each letter consists of ten top bytes followed by - * by ten bottom bytes (20 bytes per * char) */ - q = &font_10x14[((uint16_t)c_remapped)*20]; + if (c >= 0xC0) { + q = &font_10x14_extra[((uint16_t)(c-0xC0))*20]; + } + else { + if (c >= 128) + c_remapped = c - 60; + q = &font_10x14[((uint16_t)c_remapped)*20]; + } lcdPutPattern(x, y, q, 10, 16, flags); } else if (flags & XXLSIZE) { @@ -193,6 +192,11 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags) else #endif { +#if !defined(BOOT) + q = (c < 0xC0) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0xC0)*5]; +#else + q = &font_5x7[(c-0x20)*5]; +#endif lcdPutPattern(x, y, q, 5, 7, flags); } } diff --git a/radio/src/tests/drawswitch_212x64.png b/radio/src/tests/drawswitch_212x64.png new file mode 100755 index 000000000..1da5d9ab5 Binary files /dev/null and b/radio/src/tests/drawswitch_212x64.png differ diff --git a/radio/src/tests/lcd.cpp b/radio/src/tests/lcd.cpp index a2bbc5d7d..f6ecff4f4 100644 --- a/radio/src/tests/lcd.cpp +++ b/radio/src/tests/lcd.cpp @@ -242,5 +242,16 @@ TEST(Lcd, Dblsize) lcd_putsAtt(82, 10, "TST", DBLSIZE); EXPECT_TRUE(checkScreenshot("dblsize")); } - +#endif + +#if defined(PCBTARANIS) +TEST(Lcd, DrawSwitch) +{ + lcd_clear(); + putsSwitches(0, 10, SWSRC_SA0, 0); + putsSwitches(30, 10, SWSRC_SA0, SMLSIZE); + // putsSwitches(60, 10, SWSRC_SA0, MIDSIZE); missing arrows in this font + putsSwitches(90, 10, SWSRC_SA0, DBLSIZE); + EXPECT_TRUE(checkScreenshot("drawswitch")); +} #endif