1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-26 13:52:06 +00:00

Add battery indicator

This commit is contained in:
Such Meme, Many Skill 2020-03-03 15:19:42 +01:00
parent 405cb46b77
commit d93b50205a
2 changed files with 15 additions and 1 deletions

View file

@ -8,6 +8,7 @@
#include "gfx.h" #include "gfx.h"
#include "fs.h" #include "fs.h"
#include "../mem/minerva.h" #include "../mem/minerva.h"
#include "../power/max17050.h"
#include <stdarg.h> #include <stdarg.h>
const char fixedoptions[3][50] = { const char fixedoptions[3][50] = {
@ -24,10 +25,22 @@ const char sizevalues[4][3] = {
}; };
void clearscreen(){ void clearscreen(){
int battery = 0;
max17050_get_property(MAX17050_RepSOC, &battery);
gfx_clear_grey(0x1B); gfx_clear_grey(0x1B);
SWAPCOLOR(COLOR_DEFAULT);
SWAPBGCOLOR(COLOR_WHITE);
gfx_box(0, 1263, 719, 1279, COLOR_WHITE);
gfx_con_setpos(0, 1263);
gfx_printf("Move: Vol+/- | Select: Pow | Battery: %3d%%", battery >> 8);
gfx_box(0, 0, 719, 15, COLOR_WHITE); gfx_box(0, 0, 719, 15, COLOR_WHITE);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
gfx_printf("%k%KTegraexplorer v1.3.1%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT); gfx_printf("Tegraexplorer v1.3.1\n");
RESETCOLOR;
} }
int message(u32 color, const char* message, ...){ int message(u32 color, const char* message, ...){

View file

@ -3,6 +3,7 @@
#include "fs.h" #include "fs.h"
#define SWAPCOLOR(color) gfx_printf("%k", color) #define SWAPCOLOR(color) gfx_printf("%k", color)
#define SWAPBGCOLOR(color) gfx_printf("%K", color)
#define RESETCOLOR gfx_printf("%k%K", COLOR_WHITE, COLOR_DEFAULT) #define RESETCOLOR gfx_printf("%k%K", COLOR_WHITE, COLOR_DEFAULT)
int makemenu(menu_item menu[], int menuamount); int makemenu(menu_item menu[], int menuamount);