mirror of
https://github.com/clockworkpi/PicoCalc.git
synced 2025-12-12 18:28:53 +01:00
Update multi booter
This commit is contained in:
parent
bdbac6751e
commit
4449860332
@ -344,6 +344,22 @@ void draw_rect_spi(int x1, int y1, int x2, int y2, int c) {
|
||||
lcd_spi_raise_cs();
|
||||
}
|
||||
|
||||
//16x6
|
||||
void draw_battery_icon(int x0, int y0, int level) {
|
||||
draw_rect_spi(x0, y0, x0+14, y0+6, WHITE);
|
||||
draw_rect_spi(x0 + 1, y0 + 1, x0+12, y0+5, BLACK);
|
||||
|
||||
// (2x2)
|
||||
draw_rect_spi(x0 + 14, y0 + 2, x0+14+2, y0+2+2, WHITE);
|
||||
|
||||
for (int i = 0; i <= 13; i++) {
|
||||
if (i < level) {
|
||||
draw_rect_spi(x0 + 1 + i * 1, y0 + 1, x0 + 1 + i*1+1, y0+1+4, WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************************
|
||||
Print a char on the LCD display
|
||||
Any characters not in the font will print as a space.
|
||||
|
||||
@ -123,7 +123,7 @@ void draw_rect_spi(int x1, int y1, int x2, int y2, int c);
|
||||
void define_region_spi(int xstart, int ystart, int xend, int yend, int rw);
|
||||
void draw_line_spi(int x1, int y1, int x2, int y2, int color);
|
||||
void lcd_print_string_color(char *s, int fg, int bg);
|
||||
|
||||
void draw_battery_icon(int x0, int y0, int level);
|
||||
//Print the bitmap of a char on the video output
|
||||
// x, y - the top left of the char
|
||||
// width, height - size of the char's bitmap
|
||||
|
||||
@ -429,11 +429,16 @@ static void ui_draw_status_bar(void)
|
||||
static void ui_draw_battery_status(){
|
||||
char buf[8];
|
||||
int pcnt = keypad_get_battery();
|
||||
|
||||
int level = pcnt * 13 / 100;
|
||||
int pad = 0;
|
||||
sprintf(buf,"%d%%",pcnt);
|
||||
int y = UI_Y + HEADER_TITLE_HEIGHT;
|
||||
if(pcnt < 10) { pad = 8;}
|
||||
else if( pcnt >= 10 && pcnt < 100){pad = 0;}
|
||||
else if(pcnt == 100){pad = -8;}
|
||||
//draw_rect_spi(UI_X, y, UI_X + UI_WIDTH - 1, y + PATH_HEADER_HEIGHT - 1, COLOR_BG);
|
||||
draw_text(UI_X + 240, y + 2, buf, COLOR_FG, COLOR_BG);
|
||||
draw_text(UI_X + UI_WIDTH-16-20-5+pad, y + 2, buf, COLOR_FG, COLOR_BG);
|
||||
draw_battery_icon(UI_X+UI_WIDTH-16,y+4,level);
|
||||
}
|
||||
// Refresh the entire UI
|
||||
static void ui_refresh(void)
|
||||
@ -572,6 +577,7 @@ void text_directory_ui_set_status(const char *msg)
|
||||
ui_draw_status_bar();
|
||||
}
|
||||
|
||||
|
||||
void text_directory_ui_update_header(uint8_t nosd) {
|
||||
ui_draw_path_header(nosd);
|
||||
ui_draw_battery_status();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user