Permit PSM calls only when initialized
- Change hardcoded int to enum in variable init
This commit is contained in:
parent
87aca212ce
commit
caedcab0ac
@ -445,10 +445,14 @@ void drawCharge() {
|
|||||||
char chargeString[5];
|
char chargeString[5];
|
||||||
|
|
||||||
uint32_t batteryCharge;
|
uint32_t batteryCharge;
|
||||||
ChargerType chargeType = 0;
|
ChargerType chargeType = ChargerType_None;
|
||||||
|
|
||||||
#ifdef __SWITCH__
|
#ifdef __SWITCH__
|
||||||
psmGetBatteryChargePercentage(&batteryCharge);
|
if (psmInitialized)
|
||||||
|
{
|
||||||
|
psmGetBatteryChargePercentage(&batteryCharge);
|
||||||
|
psmGetChargerType(&chargeType);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
batteryCharge = 100;
|
batteryCharge = 100;
|
||||||
#endif
|
#endif
|
||||||
@ -459,10 +463,6 @@ void drawCharge() {
|
|||||||
|
|
||||||
DrawText(interuiregular14, tmpX, 0 + 47 + 10 + 21, themeCurrent.textColor, chargeString);
|
DrawText(interuiregular14, tmpX, 0 + 47 + 10 + 21, themeCurrent.textColor, chargeString);
|
||||||
|
|
||||||
#ifdef __SWITCH__
|
|
||||||
psmGetChargerType(&chargeType);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (chargeType > (ChargerType)ChargerType_None)
|
if (chargeType > (ChargerType)ChargerType_None)
|
||||||
drawImage(tmpX - 20, 0 + 47 + 10 + 5, 9, 15, charging_icon_small, IMAGE_MODE_RGBA32);
|
drawImage(tmpX - 20, 0 + 47 + 10 + 5, 9, 15, charging_icon_small, IMAGE_MODE_RGBA32);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user