- sys-clk-OC: Charging current limit

This commit is contained in:
KazushiM
2023-01-02 16:12:13 +08:00
parent 139c7dfcad
commit 277f8d48e5
14 changed files with 270 additions and 135 deletions

View File

@@ -105,14 +105,19 @@ ReverseNXMode ReverseNXSync::RecheckToolMode() {
}
void PsmExt::ChargingHandler(bool fastChargingEnabled, uint32_t chargingLimit) {
void PsmExt::ChargingHandler(uint32_t chargingCurrent, uint32_t chargingLimit) {
u32 current;
Result res = I2c_Bq24193_GetFastChargeCurrentLimit(&current);
if (R_SUCCEEDED(res)) {
current -= current % 100;
if (current != chargingCurrent)
I2c_Bq24193_SetFastChargeCurrentLimit(chargingCurrent);
}
PsmChargeInfo* info = new PsmChargeInfo;
Service* session = psmGetServiceSession();
serviceDispatchOut(session, Psm_GetBatteryChargeInfoFields, *info);
if (PsmIsFastChargingEnabled(info) != fastChargingEnabled)
serviceDispatch(session, fastChargingEnabled ? Psm_EnableFastBatteryCharging : Psm_DisableFastBatteryCharging);
if (PsmIsChargerConnected(info)) {
u32 chargeNow = 0;
if (R_SUCCEEDED(psmGetBatteryChargePercentage(&chargeNow))) {