1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 17:55:19 +03:00

Prevents lines from wrapping when writing text

This commit is contained in:
bsongis 2014-07-01 22:53:10 +02:00
parent be0ebe833c
commit 72ef865c10
4 changed files with 9 additions and 1 deletions

View file

@ -56,6 +56,7 @@ uint8_t lcdNextPos;
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags) void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
{ {
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ]; uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
uint8_t *end = &displayBuf[ y / 8 * LCD_W + LCD_W ];
bool blink = false; bool blink = false;
bool inv = false; bool inv = false;
@ -75,7 +76,7 @@ void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width
// we need to work on the previous byte when INVERS // we need to work on the previous byte when INVERS
p--; p--;
for (int8_t i=0; i<width+2; i++) { for (int8_t i=0; i<width+2 && p<end; i++) {
uint8_t lines = (height+7)/8; uint8_t lines = (height+7)/8;
assert(lines <= 5); assert(lines <= 5);
uint8_t b[5] = { 0 }; uint8_t b[5] = { 0 };

View file

@ -1062,6 +1062,13 @@ TEST(Lcd, Prec2_Right)
EXPECT_TRUE(checkScreenshot("prec2_right")); EXPECT_TRUE(checkScreenshot("prec2_right"));
} }
TEST(Lcd, Line_Wrap)
{
lcd_clear();
lcd_puts(LCD_W-10, 0, "TEST");
EXPECT_TRUE(checkScreenshot("line_wrap"));
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B