summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd.c')
-rw-r--r--firmware/drivers/lcd.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c
index be71c25311..352de748fd 100644
--- a/firmware/drivers/lcd.c
+++ b/firmware/drivers/lcd.c
@@ -504,7 +504,7 @@ int lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
504 504
505 while((ch = *str++)) { 505 while((ch = *str++)) {
506 /* Limit to char generation table */ 506 /* Limit to char generation table */
507 if ((ch < ASCII_MIN) || (ch > 0xda)) 507 if (ch < ASCII_MIN)
508 /* replace unsupported letters with question marks */ 508 /* replace unsupported letters with question marks */
509 ch = ' '-ASCII_MIN; 509 ch = ' '-ASCII_MIN;
510 else 510 else
@@ -526,10 +526,10 @@ int lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
526 * Put a string at specified bit position 526 * Put a string at specified bit position
527 */ 527 */
528 528
529void lcd_putspropxy(int x, int y, char *str, int thisfont) 529void lcd_putspropxy(int x, int y, unsigned char *str, int thisfont)
530{ 530{
531 int ch; 531 unsigned int ch;
532 int nx = char_dw_8x8_prop[(int)*str][8] >> 4; 532 int nx;
533 int ny=8; 533 int ny=8;
534 unsigned char *src; 534 unsigned char *src;
535 int lcd_x = x; 535 int lcd_x = x;
@@ -537,26 +537,24 @@ void lcd_putspropxy(int x, int y, char *str, int thisfont)
537 537
538 (void)thisfont; 538 (void)thisfont;
539 539
540 while (((ch = *str++) != '\0') && (lcd_x + nx < LCD_WIDTH)) 540 while (((ch = *str++) != '\0'))
541 { 541 {
542 if (lcd_y + ny > LCD_HEIGHT)
543 return;
544
545 /* Limit to char generation table */ 542 /* Limit to char generation table */
546 if ((ch < ASCII_MIN) || (ch > 0xda)) 543 if (ch < ASCII_MIN)
547 /* replace unsupported letters with question marks */ 544 /* replace unsupported letters with question marks */
548 ch = ' '-ASCII_MIN; 545 ch = ' '-ASCII_MIN;
549 else 546 else
550 ch -= ASCII_MIN; 547 ch -= ASCII_MIN;
551 548
552 src = char_dw_8x8_prop[ch];
553
554 nx = char_dw_8x8_prop[ch][8] >> 4; 549 nx = char_dw_8x8_prop[ch][8] >> 4;
555 550
551 if(lcd_x + nx > LCD_WIDTH)
552 break;
553
554 src = char_dw_8x8_prop[ch];
556 lcd_bitmap (src, lcd_x, lcd_y, nx, ny, true); 555 lcd_bitmap (src, lcd_x, lcd_y, nx, ny, true);
557 556
558 lcd_x += nx+1; 557 lcd_x += nx+1;
559
560 } 558 }
561} 559}
562 560
@@ -933,10 +931,10 @@ void lcd_puts_scroll(int x, int y, char* string )
933 ch[0] = string[0]; 931 ch[0] = string[0];
934 width = 0; 932 width = 0;
935 for (s->space = 0; 933 for (s->space = 0;
936 string[(int)s->space] && 934 ch[0] &&
937 (width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8)); 935 (width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8));
938 ) { 936 ) {
939 width += lcd_getstringsize(ch, 0, &w, &h); 937 width += w;
940 ch[0]=string[(int)++s->space]; 938 ch[0]=string[(int)++s->space];
941 } 939 }
942#endif 940#endif