rosalina: add battery info in debug info

This commit is contained in:
TuxSH 2024-08-02 17:22:53 +02:00
parent 2ddf5d334c
commit 2c49a04516
3 changed files with 15 additions and 4 deletions

View File

@ -68,6 +68,8 @@ typedef struct Menu {
extern u32 menuCombo; extern u32 menuCombo;
extern bool isHidInitialized; extern bool isHidInitialized;
extern u32 mcuFwVersion; extern u32 mcuFwVersion;
extern u8 mcuInfoTable[9];
extern bool mcuInfoTableRead;
// From main.c // From main.c
extern bool isN3DS; extern bool isN3DS;

View File

@ -43,6 +43,8 @@
u32 menuCombo = 0; u32 menuCombo = 0;
bool isHidInitialized = false; bool isHidInitialized = false;
u32 mcuFwVersion = 0; u32 mcuFwVersion = 0;
u8 mcuInfoTable[9] = {0};
bool mcuInfoTableRead = false;
// libctru redefinition: // libctru redefinition:
@ -226,6 +228,9 @@ static Result menuUpdateMcuInfo(void)
mcuFwVersion = SYSTEM_VERSION(major - 0x10, minor, 0); mcuFwVersion = SYSTEM_VERSION(major - 0x10, minor, 0);
} }
if (!mcuInfoTableRead)
mcuInfoTableRead = R_SUCCEEDED(MCUHWC_ReadRegister(0x7F, mcuInfoTable, sizeof(mcuInfoTable)));
svcCloseHandle(*mcuHwcHandlePtr); svcCloseHandle(*mcuHwcHandlePtr);
return res; return res;
} }

View File

@ -125,14 +125,18 @@ void RosalinaMenu_ShowDebugInfo(void)
10, posY, COLOR_WHITE, "Kernel version: %lu.%lu-%lu\n", 10, posY, COLOR_WHITE, "Kernel version: %lu.%lu-%lu\n",
GET_VERSION_MAJOR(kernelVer), GET_VERSION_MINOR(kernelVer), GET_VERSION_REVISION(kernelVer) GET_VERSION_MAJOR(kernelVer), GET_VERSION_MINOR(kernelVer), GET_VERSION_REVISION(kernelVer)
); );
if (mcuFwVersion != 0) if (mcuFwVersion != 0 && mcuInfoTableRead)
{ {
posY = Draw_DrawFormattedString( posY = Draw_DrawFormattedString(
10, posY, COLOR_WHITE, "MCU FW version: %lu.%lu\n", 10, posY, COLOR_WHITE, "MCU FW version: %lu.%lu (PMIC vendor: %hhu)\n",
GET_VERSION_MAJOR(mcuFwVersion), GET_VERSION_MINOR(mcuFwVersion) GET_VERSION_MAJOR(mcuFwVersion), GET_VERSION_MINOR(mcuFwVersion),
mcuInfoTable[1]
);
posY = Draw_DrawFormattedString(
10, posY, COLOR_WHITE, "Battery: vendor: %hhu gauge IC ver.: %hhu.%hhu RCOMP: %hhu\n",
mcuInfoTable[2], mcuInfoTable[3], mcuInfoTable[4], mcuInfoTable[4]
); );
} }
if (R_SUCCEEDED(FSUSER_GetSdmcSpeedInfo(&speedInfo))) if (R_SUCCEEDED(FSUSER_GetSdmcSpeedInfo(&speedInfo)))
{ {
u32 clkDiv = 1 << (1 + (speedInfo.sdClkCtrl & 0xFF)); u32 clkDiv = 1 << (1 + (speedInfo.sdClkCtrl & 0xFF));