Add status bar (battery info)

This gets updated in menus and backup/restore options and it's still visible to other options
This commit is contained in:
Kostas Missos
2018-07-09 16:06:17 +03:00
parent 2f120d1cbb
commit 828b616468
7 changed files with 77 additions and 35 deletions

View File

@@ -354,7 +354,7 @@ void config_hw()
void print_fuseinfo()
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
u32 burntFuses = 0;
@@ -407,7 +407,7 @@ void print_fuseinfo()
void print_kfuseinfo()
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%kKFuse contents:\n\n%k", 0xFF00DDFF, 0xFFCCCCCC);
@@ -442,7 +442,7 @@ void print_kfuseinfo()
void print_mmc_info()
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
static const u32 SECTORS_TO_MIB_COEFF = 11;
@@ -599,7 +599,7 @@ void print_sdcard_info()
{
static const u32 SECTORS_TO_MIB_COEFF = 11;
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
if (sd_mount())
@@ -651,7 +651,7 @@ void print_sdcard_info()
void print_tsec_key()
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
sdmmc_storage_t storage;
@@ -1137,7 +1137,8 @@ static void dump_emmc_selected(emmcPartType_t dumpType)
{
int res = 0;
u32 timer = 0;
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
tui_sbar(&gfx_con, 1);
gfx_con_setpos(&gfx_con, 0, 0);
if (!sd_mount())
@@ -1381,7 +1382,8 @@ static void restore_emmc_selected(emmcPartType_t restoreType)
{
int res = 0;
u32 timer = 0;
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
tui_sbar(&gfx_con, 1);
gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%kThis is a dangerous operation\nand may render your device inoperative!\n\n", 0xFFFFDD00);
@@ -1513,7 +1515,7 @@ void dump_package1()
u8 *secmon = (u8 *)calloc(1, 0x40000);
u8 *loader = (u8 *)calloc(1, 0x40000);
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
if (!sd_mount())
@@ -1882,7 +1884,7 @@ void toggle_autorcm(){
sdmmc_storage_t storage;
sdmmc_t sdmmc;
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
if (!sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_4, SDMMC_BUS_WIDTH_8, 4))
@@ -1984,7 +1986,7 @@ int fix_attributes(char *path, u32 *total, u32 is_root, u32 check_first_run)
void fix_sd_attr(u32 type)
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
char path[256];
@@ -2143,7 +2145,7 @@ void print_battery_charger_info()
void print_battery_info()
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
print_fuel_gauge_info();
@@ -2189,7 +2191,7 @@ void print_battery_info()
/* void fix_fuel_gauge_configuration()
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
int battVoltage, avgCurrent;
@@ -2242,7 +2244,7 @@ void print_battery_info()
{
int avgCurrent;
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%k\nThis will wipe your battery stats completely!\n"
@@ -2253,7 +2255,7 @@ void print_battery_info()
u32 btn = btn_wait();
if (btn & BTN_POWER)
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%kKeep the USB cable connected!%k\n\n", 0xFFFFDD00, 0xFFCCCCCC);
gfx_con_getpos(&gfx_con, &gfx_con.savedx, &gfx_con.savedy);
@@ -2288,7 +2290,7 @@ void print_battery_info()
void fix_battery_desync()
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_clear_partial_grey(&gfx_ctxt, 0x1B, 0, 1256);
gfx_con_setpos(&gfx_con, 0, 0);
max77620_low_battery_monitor_config();