- sys-clk-OC: Charging current limit
This commit is contained in:
@@ -209,9 +209,9 @@ void ClockManager::WaitForNextTick()
|
||||
|
||||
bool ClockManager::RefreshContext()
|
||||
{
|
||||
bool fastChargingEnabled = !(this->GetConfig()->GetConfigValue(SysClkConfigValue_DisableFastCharging));
|
||||
uint32_t chargingCurrent = this->GetConfig()->GetConfigValue(SysClkConfigValue_ChargingCurrentLimit);
|
||||
uint32_t chargingLimit = this->GetConfig()->GetConfigValue(SysClkConfigValue_ChargingLimitPercentage);
|
||||
PsmExt::ChargingHandler(fastChargingEnabled, chargingLimit);
|
||||
PsmExt::ChargingHandler(chargingCurrent, chargingLimit);
|
||||
|
||||
bool hasChanged = this->config->Refresh();
|
||||
if (hasChanged) {
|
||||
|
||||
@@ -69,10 +69,15 @@ extern "C"
|
||||
hosversionSet(MAKEHOSVERSION(fw.major, fw.minor, fw.micro));
|
||||
setsysExit();
|
||||
}
|
||||
|
||||
rc = i2cInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalThrow(rc);
|
||||
}
|
||||
|
||||
void __appExit(void)
|
||||
{
|
||||
i2cExit();
|
||||
smExit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(¤t);
|
||||
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))) {
|
||||
|
||||
@@ -58,7 +58,7 @@ protected:
|
||||
};
|
||||
|
||||
namespace PsmExt {
|
||||
void ChargingHandler(bool fastChargingEnabled, uint32_t chargingLimit);
|
||||
void ChargingHandler(uint32_t chargingCurrent, uint32_t chargingLimit);
|
||||
};
|
||||
|
||||
class Governor {
|
||||
|
||||
Reference in New Issue
Block a user