@@ -270,14 +270,16 @@ void display_init(TaskHandle_t* gui_h)
270270 .x2 = TOUCH_BUTTON_WIDTH + CONFIG_DISPLAY_OFFSET_X ,
271271 .y2 = (CONFIG_DISPLAY_HEIGHT + (TOUCH_BUTTON_AREA - TOUCH_BUTTON_MARGIN )) + CONFIG_DISPLAY_OFFSET_Y };
272272
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 );
274275 disp_win_virtual_buttons .x1 = ((CONFIG_DISPLAY_WIDTH / 2 ) + CONFIG_DISPLAY_OFFSET_X ) - (TOUCH_BUTTON_WIDTH / 2 );
275276 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 );
277278 disp_win_virtual_buttons .x1
278279 = ((CONFIG_DISPLAY_WIDTH - TOUCH_BUTTON_MARGIN ) + CONFIG_DISPLAY_OFFSET_X ) - TOUCH_BUTTON_WIDTH ;
279280 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 );
281283
282284 vTaskDelay (50 / portTICK_PERIOD_MS );
283285#endif
@@ -537,6 +539,19 @@ void display_icon(const Icon* imgbuf, int x, int y, color_t color, dispWin_t are
537539#endif
538540}
539541
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+
540555static int print_proportional_char (int x , int y )
541556{
542557 uint8_t ch = 0 ;
@@ -554,14 +569,9 @@ static int print_proportional_char(int x, int y)
554569 if ((ch & mask )) {
555570 const int cx = (uint16_t )(x + fontChar .xOffset + i );
556571 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 )) {
562573 continue ;
563574 }
564- #endif
565575 draw_bitmap (cx , cy , 1 , 1 , & _fg );
566576 }
567577 mask >>= 1 ;
@@ -608,9 +618,6 @@ static inline void print_char(uint8_t c, int x, int y)
608618 const uint8_t fz = (cfont .x_size + 7 ) >> 3 ;
609619 uint16_t temp = ((c - cfont .offset ) * (fz * cfont .y_size )) + 4 ;
610620 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-
614621 for (uint8_t j = 0 ; j < cfont .y_size ; ++ j ) {
615622 for (uint16_t k = 0 ; k < fz ; ++ k ) {
616623 uint8_t ch = cfont .font [temp + k ];
@@ -619,9 +626,10 @@ static inline void print_char(uint8_t c, int x, int y)
619626 if (ch & mask ) {
620627 cx = x + i + (k << 3 );
621628 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 ;
624631 }
632+ draw_bitmap (cx , cy , 1 , 1 , & _fg );
625633 }
626634 mask >>= 1 ;
627635 }
0 commit comments