Properly display voltage state

This commit is contained in:
Joel16 2018-11-23 00:12:06 -06:00
parent 1534eaef0c
commit dba7cd6818
3 changed files with 14 additions and 26 deletions

View File

@ -204,31 +204,20 @@ char *SwitchIdent_GetVoltageState(Service *srv) {
char *states[]= char *states[]=
{ {
"max77620_sd0", "Power state needs shutdown",
"max77620_sd1", "Power state needs sleep",
"max77620_sd2", "Performance boost cannot be entered",
"max77620_sd3", "Normal",
"max77620_ldo0 -> 1.2 V",
"max77620_ldo1",
"max77620_ldo2 -> 3.3 V - 1.8 V",
"max77620_ldo3",
"max77620_ldo4 -> 0.85 V",
"max77620_ldo5",
"max77620_ldo6 -> 2.9 V",
"max77620_ldo7",
"max77620_ldo8 -> 1.05 V",
"max77621_cpu",
"max77621_gpu",
"Unknown" "Unknown"
}; };
if (R_SUCCEEDED(ret = psmGetBatteryVoltageState(&out))) { if (R_SUCCEEDED(ret = psmGetBatteryVoltageState(&out))) {
if (out < 15) if (out < 4)
return states[out]; return states[out];
} }
printf("psmGetBatteryVoltageState() failed: 0x%x.\n\n", ret); printf("psmGetBatteryVoltageState() failed: 0x%x.\n\n", ret);
return states[15]; return states[4];
} }
u64 SwitchIdent_GetRawBatteryChargePercentage(Service *srv) { u64 SwitchIdent_GetRawBatteryChargePercentage(Service *srv) {

View File

@ -108,7 +108,7 @@ int main(int argc, char **argv) {
char hostname[128]; char hostname[128];
Result ret = gethostname(hostname, sizeof(hostname)); Result ret = gethostname(hostname, sizeof(hostname));
// 21 // 21
printf("\x1b[21;0H"); printf("\x1b[22;0H");
printf("\x1b[36;1m*\x1b[0m IP: \x1b[36;1m%s\n", R_SUCCEEDED(ret)? hostname : NULL); printf("\x1b[36;1m*\x1b[0m IP: \x1b[36;1m%s\n", R_SUCCEEDED(ret)? hostname : NULL);
printf("\x1b[36;1m*\x1b[0m Wireless LAN: \x1b[36;1m%s\n", SwitchIdent_GetFlag(SetSysFlag_WirelessLanEnable)? "Enabled" : "Disabled"); printf("\x1b[36;1m*\x1b[0m Wireless LAN: \x1b[36;1m%s\n", SwitchIdent_GetFlag(SetSysFlag_WirelessLanEnable)? "Enabled" : "Disabled");
printf("\x1b[36;1m*\x1b[0m Bluetooth: \x1b[36;1m%s\n", SwitchIdent_GetFlag(SetSysFlag_BluetoothEnable)? "Enabled" : "Disabled"); printf("\x1b[36;1m*\x1b[0m Bluetooth: \x1b[36;1m%s\n", SwitchIdent_GetFlag(SetSysFlag_BluetoothEnable)? "Enabled" : "Disabled");
@ -131,7 +131,7 @@ int main(int argc, char **argv) {
Utils_GetSizeString(nand_s_free_str, SwitchIdent_GetFreeStorage(FsStorageId_NandSystem)); Utils_GetSizeString(nand_s_free_str, SwitchIdent_GetFreeStorage(FsStorageId_NandSystem));
Utils_GetSizeString(nand_s_used_str, SwitchIdent_GetUsedStorage(FsStorageId_NandSystem)); Utils_GetSizeString(nand_s_used_str, SwitchIdent_GetUsedStorage(FsStorageId_NandSystem));
printf("\x1b[31;0H"); printf("\x1b[32;0H");
printf("\x1b[35;1m*\x1b[0m Total SD Capacity: \x1b[35;1m%s\n", sd_total_str); printf("\x1b[35;1m*\x1b[0m Total SD Capacity: \x1b[35;1m%s\n", sd_total_str);
printf("\x1b[35;1m*\x1b[0m Free SD Capacity: \x1b[35;1m%s\n", sd_free_str); printf("\x1b[35;1m*\x1b[0m Free SD Capacity: \x1b[35;1m%s\n", sd_free_str);
printf("\x1b[35;1m*\x1b[0m Used storage: \x1b[35;1m%s\n", sd_used_str); printf("\x1b[35;1m*\x1b[0m Used storage: \x1b[35;1m%s\n", sd_used_str);
@ -161,13 +161,12 @@ int main(int argc, char **argv) {
*/ */
printf("\x1b[16;0H"); printf("\x1b[16;0H");
printf("\x1b[94;1m*\x1b[0m Battery percentage: \x1b[94;1m%lu %%\x1b[0m (\x1b[94;1m%s\x1b[0m) \x1b[0m \n", SwitchIdent_GetBatteryPercent(), SwitchIdent_IsCharging()? "charging" : "not charging"); printf("\x1b[94;1m*\x1b[0m Battery percentage: \x1b[94;1m%lu %%\x1b[0m (\x1b[94;1m%s\x1b[0m) \x1b[0m \n", SwitchIdent_GetBatteryPercent(), SwitchIdent_IsCharging()? "charging" : "not charging");
// Voltage state needs more clarification printf("\x1b[94;1m*\x1b[0m Battery voltage state: \x1b[94;1m%s \n", SwitchIdent_GetVoltageState(&psm_service));
//printf("\x1b[94;1m*\x1b[0m Battery voltage state: \x1b[94;1m%s \n", SwitchIdent_GetVoltageState(&psm_service));
printf("\x1b[94;1m*\x1b[0m Battery charger type: \x1b[94;1m%s \n", SwitchIdent_GetChargerType()); printf("\x1b[94;1m*\x1b[0m Battery charger type: \x1b[94;1m%s \n", SwitchIdent_GetChargerType());
printf("\x1b[94;1m*\x1b[0m Battery charging enabled: \x1b[94;1m%s \n", SwitchIdent_IsChargingEnabled(&psm_service)? "Yes" : "No"); printf("\x1b[94;1m*\x1b[0m Battery charging enabled: \x1b[94;1m%s \n", SwitchIdent_IsChargingEnabled(&psm_service)? "Yes" : "No");
printf("\x1b[94;1m*\x1b[0m Battery ample power supplied: \x1b[94;1m%s \n\n", SwitchIdent_IsEnoughPowerSupplied(&psm_service)? "Yes" : "No"); printf("\x1b[94;1m*\x1b[0m Battery ample power supplied: \x1b[94;1m%s \n\n", SwitchIdent_IsEnoughPowerSupplied(&psm_service)? "Yes" : "No");
printf("\x1b[27;0H"); printf("\x1b[28;0H");
printf("\x1b[36;1m*\x1b[0m State: \x1b[36;1m%s \n", SwitchIdent_GetOperationMode()); printf("\x1b[36;1m*\x1b[0m State: \x1b[36;1m%s \n", SwitchIdent_GetOperationMode());
printf("\x1b[36;1m*\x1b[0m SD card status: \x1b[36;1m%s \n", isSDInserted? "Inserted" : "Not inserted"); printf("\x1b[36;1m*\x1b[0m SD card status: \x1b[36;1m%s \n", isSDInserted? "Inserted" : "Not inserted");
printf("\x1b[36;1m*\x1b[0m Game card status: \x1b[36;1m%s \n\n", isGameCardInserted? "Inserted" : "Not inserted"); printf("\x1b[36;1m*\x1b[0m Game card status: \x1b[36;1m%s \n\n", isGameCardInserted? "Inserted" : "Not inserted");

View File

@ -53,10 +53,10 @@ static void Menu_System(void) {
static void Menu_Power(void) { static void Menu_Power(void) {
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 50, "Battery percentage:", "%lu %% (%s)", SwitchIdent_GetBatteryPercent(), SwitchIdent_IsCharging()? "charging" : "not charging"); Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 50, "Battery percentage:", "%lu %% (%s)", SwitchIdent_GetBatteryPercent(), SwitchIdent_IsCharging()? "charging" : "not charging");
//Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 100, "Battery voltage state:", SwitchIdent_GetVoltageState(&psm_service)); Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 100, "Battery voltage state:", SwitchIdent_GetVoltageState(&psm_service));
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 100, "Battery charger type:", SwitchIdent_GetChargerType()); Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 150, "Battery charger type:", SwitchIdent_GetChargerType());
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 150, "Battery charging enabled:", SwitchIdent_IsChargingEnabled(&psm_service)? "Yes" : "No"); Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 200, "Battery charging enabled:", SwitchIdent_IsChargingEnabled(&psm_service)? "Yes" : "No");
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 200, "Battery ample power supplied:", SwitchIdent_IsEnoughPowerSupplied(&psm_service)? "Yes" : "No"); Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 250, "Battery ample power supplied:", SwitchIdent_IsEnoughPowerSupplied(&psm_service)? "Yes" : "No");
} }
static void Menu_Storage(void) { static void Menu_Storage(void) {