@@ -270,14 +270,16 @@ void display_init(TaskHandle_t* gui_h)
270
270
.x2 = TOUCH_BUTTON_WIDTH + CONFIG_DISPLAY_OFFSET_X ,
271
271
.y2 = (CONFIG_DISPLAY_HEIGHT + (TOUCH_BUTTON_AREA - TOUCH_BUTTON_MARGIN )) + CONFIG_DISPLAY_OFFSET_Y };
272
272
273
- display_print_in_area ("<" , CENTER , CENTER , disp_win_virtual_buttons , 0 );
273
+ display_set_font (JADE_SYMBOLS_16x16_FONT , NULL );
274
+ display_print_in_area ("H" , CENTER , CENTER , disp_win_virtual_buttons , 0 );
274
275
disp_win_virtual_buttons .x1 = ((CONFIG_DISPLAY_WIDTH / 2 ) + CONFIG_DISPLAY_OFFSET_X ) - (TOUCH_BUTTON_WIDTH / 2 );
275
276
disp_win_virtual_buttons .x2 = ((CONFIG_DISPLAY_WIDTH / 2 ) + CONFIG_DISPLAY_OFFSET_X ) + (TOUCH_BUTTON_WIDTH / 2 );
276
- display_print_in_area ("OK " , CENTER , CENTER , disp_win_virtual_buttons , 0 );
277
+ display_print_in_area ("J " , CENTER , CENTER , disp_win_virtual_buttons , 0 );
277
278
disp_win_virtual_buttons .x1
278
279
= ((CONFIG_DISPLAY_WIDTH - TOUCH_BUTTON_MARGIN ) + CONFIG_DISPLAY_OFFSET_X ) - TOUCH_BUTTON_WIDTH ;
279
280
disp_win_virtual_buttons .x2 = (CONFIG_DISPLAY_WIDTH - TOUCH_BUTTON_MARGIN ) + CONFIG_DISPLAY_OFFSET_X ;
280
- display_print_in_area (">" , CENTER , CENTER , disp_win_virtual_buttons , 0 );
281
+ display_print_in_area ("I" , CENTER , CENTER , disp_win_virtual_buttons , 0 );
282
+ display_set_font (DEFAULT_FONT , NULL );
281
283
282
284
vTaskDelay (50 / portTICK_PERIOD_MS );
283
285
#endif
@@ -537,6 +539,19 @@ void display_icon(const Icon* imgbuf, int x, int y, color_t color, dispWin_t are
537
539
#endif
538
540
}
539
541
542
+ static inline bool is_within_limits (int cx , int cy )
543
+ {
544
+ // Allow for characters to be printed in the virtual button area
545
+ #ifndef CONFIG_DISPLAY_TOUCHSCREEN
546
+ if ((cx < CONFIG_DISPLAY_OFFSET_X ) || (cy < CONFIG_DISPLAY_OFFSET_Y )
547
+ || (cx > (CONFIG_DISPLAY_WIDTH + CONFIG_DISPLAY_OFFSET_X ))
548
+ || (cy > (CONFIG_DISPLAY_HEIGHT + CONFIG_DISPLAY_OFFSET_Y ))) {
549
+ return false;
550
+ }
551
+ #endif
552
+ return true;
553
+ }
554
+
540
555
static int print_proportional_char (int x , int y )
541
556
{
542
557
uint8_t ch = 0 ;
@@ -554,14 +569,9 @@ static int print_proportional_char(int x, int y)
554
569
if ((ch & mask )) {
555
570
const int cx = (uint16_t )(x + fontChar .xOffset + i );
556
571
const int cy = (uint16_t )(y + j + fontChar .adjYOffset );
557
- #if !defined(CONFIG_BOARD_TYPE_M5_CORES3 ) && !defined(CONFIG_BOARD_TYPE_TTGO_TWATCHS3 ) \
558
- && !defined(CONFIG_BOARD_TYPE_WS_TOUCH_LCD2 )
559
- if ((cx < CONFIG_DISPLAY_OFFSET_X ) || (cy < CONFIG_DISPLAY_OFFSET_Y )
560
- || (cx > (CONFIG_DISPLAY_WIDTH + CONFIG_DISPLAY_OFFSET_X ))
561
- || (cy > (CONFIG_DISPLAY_HEIGHT + CONFIG_DISPLAY_OFFSET_Y ))) {
572
+ if (!is_within_limits (cx , cy )) {
562
573
continue ;
563
574
}
564
- #endif
565
575
draw_bitmap (cx , cy , 1 , 1 , & _fg );
566
576
}
567
577
mask >>= 1 ;
@@ -608,9 +618,6 @@ static inline void print_char(uint8_t c, int x, int y)
608
618
const uint8_t fz = (cfont .x_size + 7 ) >> 3 ;
609
619
uint16_t temp = ((c - cfont .offset ) * (fz * cfont .y_size )) + 4 ;
610
620
uint16_t cx , cy ;
611
- const uint16_t x_limit = (CONFIG_DISPLAY_WIDTH + CONFIG_DISPLAY_OFFSET_X );
612
- const uint16_t y_limit = (CONFIG_DISPLAY_HEIGHT + CONFIG_DISPLAY_OFFSET_Y );
613
-
614
621
for (uint8_t j = 0 ; j < cfont .y_size ; ++ j ) {
615
622
for (uint16_t k = 0 ; k < fz ; ++ k ) {
616
623
uint8_t ch = cfont .font [temp + k ];
@@ -619,9 +626,10 @@ static inline void print_char(uint8_t c, int x, int y)
619
626
if (ch & mask ) {
620
627
cx = x + i + (k << 3 );
621
628
cy = y + j ;
622
- if (cx <= x_limit && cy <= y_limit ) {
623
- draw_bitmap ( cx , cy , 1 , 1 , & _fg ) ;
629
+ if (! is_within_limits ( cx , cy ) ) {
630
+ continue ;
624
631
}
632
+ draw_bitmap (cx , cy , 1 , 1 , & _fg );
625
633
}
626
634
mask >>= 1 ;
627
635
}
0 commit comments