@@ -49,7 +49,7 @@ extern bool fs_init(void);
4949// UI Colors
5050#define COLOR_BG BLACK
5151#define COLOR_FG WHITE
52- #define COLOR_HIGHLIGHT GRAY
52+ #define COLOR_HIGHLIGHT LITEGRAY
5353
5454// Maximum number of directory entries
5555#define MAX_ENTRIES 128
@@ -146,7 +146,7 @@ static void format_file_size(off_t size, int is_dir, char *buf, size_t buf_size)
146146
147147static void set_default_entry (){
148148 entry_count = 0 ;
149- strncpy (entries [entry_count ].name , "[Default app ]" , sizeof (entries [entry_count ].name ) - 1 );
149+ strncpy (entries [entry_count ].name , "[Default App ]" , sizeof (entries [entry_count ].name ) - 1 );
150150 entries [entry_count ].name [sizeof (entries [entry_count ].name ) - 1 ] = '\0' ;
151151 entries [entry_count ].is_dir = IS_LAST_APP ;
152152 entries [entry_count ].file_size = 0 ;
@@ -340,8 +340,8 @@ static void ui_draw_directory_entry(int entry_idx)
340340 size_buffer , sizeof (size_buffer ));
341341
342342 // Draw filename and file size
343- draw_text (FILE_NAME_X , posY , display_buffer , COLOR_FG , is_selected ? COLOR_HIGHLIGHT : COLOR_BG );
344- draw_text (FILE_SIZE_X , posY , size_buffer , COLOR_FG , is_selected ? COLOR_HIGHLIGHT : COLOR_BG );
343+ draw_text (FILE_NAME_X , posY , display_buffer , is_selected ? COLOR_BG : COLOR_FG , is_selected ? COLOR_HIGHLIGHT : COLOR_BG );
344+ draw_text (FILE_SIZE_X , posY , size_buffer , is_selected ? COLOR_BG : COLOR_FG , is_selected ? COLOR_HIGHLIGHT : COLOR_BG );
345345}
346346
347347/**
@@ -429,14 +429,16 @@ static void ui_draw_status_bar(void)
429429static void ui_draw_battery_status (){
430430 char buf [8 ];
431431 int pcnt = keypad_get_battery ();
432+ if (pcnt < 0 ) return ;
432433 int level = pcnt * 13 / 100 ;
433434 int pad = 0 ;
434435 sprintf (buf ,"%d%%" ,pcnt );
435- int y = UI_Y + HEADER_TITLE_HEIGHT ;
436+ int y = UI_Y ;
436437 if (pcnt < 10 ) { pad = 8 ;}
437438 else if ( pcnt >= 10 && pcnt < 100 ){pad = 0 ;}
438439 else if (pcnt == 100 ){pad = -8 ;}
439- //draw_rect_spi(UI_X, y, UI_X + UI_WIDTH - 1, y + PATH_HEADER_HEIGHT - 1, COLOR_BG);
440+
441+ draw_rect_spi (UI_X + UI_WIDTH - 16 - 20 - 5 - 8 , y , UI_X + UI_WIDTH , y + HEADER_TITLE_HEIGHT , COLOR_BG );
440442 draw_text (UI_X + UI_WIDTH - 16 - 20 - 5 + pad , y + 2 , buf , COLOR_FG , COLOR_BG );
441443 draw_battery_icon (UI_X + UI_WIDTH - 16 ,y + 4 ,level );
442444}
@@ -452,7 +454,7 @@ static void ui_refresh(void)
452454 }else {
453455 ui_draw_status_bar ();
454456 }
455- ui_draw_battery_status ();
457+ text_directory_ui_update_title ();
456458}
457459
458460// Handle key events for navigation and selection
@@ -582,6 +584,9 @@ void text_directory_ui_set_status(const char *msg)
582584
583585void text_directory_ui_update_header (uint8_t nosd ) {
584586 ui_draw_path_header (nosd );
587+ }
588+
589+ void text_directory_ui_update_title (){
585590 ui_draw_battery_status ();
586591}
587592
@@ -616,13 +621,14 @@ void text_directory_ui_run(void)
616621 last_scroll_update = current_time ;
617622 }
618623 if (current_time - last_bat_update > BAT_UPDATE_MS ){
619- text_directory_ui_update_header (! status_flag );
624+ text_directory_ui_update_title ( );
620625 last_bat_update = current_time ;
621626 }
622627 // Check for SD card removal during runtime
623628 if (!sd_card_inserted ()) {
624629 text_directory_ui_set_status ("SD card removed. Please reinsert." );
625630 text_directory_ui_update_header (!status_flag );
631+ text_directory_ui_update_title ();
626632 ui_clear_directory_list ();
627633 update_required = 1 ;
628634 ui_draw_directory_list ();
@@ -635,7 +641,7 @@ void text_directory_ui_run(void)
635641
636642 sleep_ms (20 );
637643 if (current_time - last_bat_update > BAT_UPDATE_MS ){
638- text_directory_ui_update_header (! status_flag );
644+ text_directory_ui_update_title ( );
639645 last_bat_update = current_time ;
640646 }
641647 }
0 commit comments