Skip to content

Commit

Permalink
Merge pull request #1 from retronx-team/develop
Browse files Browse the repository at this point in the history
HOS 14.0.0+ removed ts:GetTemperatureMilliC
  • Loading branch information
KWottrich authored Oct 2, 2022
2 parents b0b5642 + dcd0d5d commit d7da756
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
29 changes: 23 additions & 6 deletions sysmodule/src/clocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,25 +314,42 @@ std::uint32_t Clocks::GetNearestHz(SysClkModule module, std::uint32_t inHz)
return clockTable[i];
}

std::int32_t Clocks::GetTsTemperatureMilli(TsLocation location) {
Result rc;
std::int32_t millis = 0;

if(hosversionAtLeast(14,0,0))
{
rc = tsGetTemperature(location, &millis);
ASSERT_RESULT_OK(rc, "tsGetTemperature(%u)", location);
millis *= 1000;
}
else
{
rc = tsGetTemperatureMilliC(location, &millis);
ASSERT_RESULT_OK(rc, "tsGetTemperatureMilliC(%u)", location);
}

return millis;
}

std::uint32_t Clocks::GetTemperatureMilli(SysClkThermalSensor sensor)
{
Result rc;
std::int32_t millis = 0;

if(sensor == SysClkThermalSensor_SOC)
{
rc = tsGetTemperatureMilliC(TsLocation_External, &millis);
ASSERT_RESULT_OK(rc, "tsGetTemperatureMilliC");
millis = GetTsTemperatureMilli(TsLocation_External);
}
else if(sensor == SysClkThermalSensor_PCB)
{
rc = tsGetTemperatureMilliC(TsLocation_Internal, &millis);
ASSERT_RESULT_OK(rc, "tsGetTemperatureMilliC");
millis = GetTsTemperatureMilli(TsLocation_Internal);
}
else if(sensor == SysClkThermalSensor_Skin)
{
if(hosversionAtLeast(5,0,0))
{
Result rc;
rc = tcGetSkinTemperatureMilliC(&millis);
ASSERT_RESULT_OK(rc, "tcGetSkinTemperatureMilliC");
}
Expand All @@ -343,4 +360,4 @@ std::uint32_t Clocks::GetTemperatureMilli(SysClkThermalSensor sensor)
}

return std::max(0, millis);
}
}
1 change: 1 addition & 0 deletions sysmodule/src/clocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Clocks
static std::uint32_t GetTemperatureMilli(SysClkThermalSensor sensor);

protected:
static std::int32_t GetTsTemperatureMilli(TsLocation location);
static PcvModule GetPcvModule(SysClkModule sysclkModule);
static PcvModuleId GetPcvModuleId(SysClkModule sysclkModule);
static std::uint32_t GetNearestHz(SysClkModule module, std::uint32_t inHz);
Expand Down

0 comments on commit d7da756

Please sign in to comment.