add warning to tc, cleanup

This commit is contained in:
HookedBehemoth 2020-02-23 16:23:30 +01:00
parent 9c69fde167
commit be6cd3955a
2 changed files with 7 additions and 15 deletions

View File

@ -1,7 +1,7 @@
/** /**
* @file tc.h * @file tc.h
* @brief Temperature control (tc) service IPC wrapper. * @brief Temperature control (tc) service IPC wrapper.
* @author yellows8 * @author Behemoth
* @copyright libnx Authors * @copyright libnx Authors
*/ */
#pragma once #pragma once
@ -18,8 +18,9 @@ void tcExit(void);
Service* tcGetServiceSession(void); Service* tcGetServiceSession(void);
Result tcEnableFanControl(void); Result tcEnableFanControl(void);
/// @warning Disabling your fan can damage your system.
Result tcDisableFanControl(void); Result tcDisableFanControl(void);
Result tcIsFanControlEnabled(bool *status); Result tcIsFanControlEnabled(bool *status);
/// Only available on [5.0.0+] /// Only available on [5.0.0+].
Result tcGetSkinTemperatureMilliC(s32 *skinTemp); Result tcGetSkinTemperatureMilliC(s32 *skinTemp);

View File

@ -33,12 +33,9 @@ Result tcDisableFanControl(void) {
} }
Result tcIsFanControlEnabled(bool *status) { Result tcIsFanControlEnabled(bool *status) {
struct { u8 tmp=0;
u8 status; Result rc = serviceDispatchOut(&g_tcSrv, 8, tmp);
} out; if (R_SUCCEEDED(rc)) *status = tmp & 1;
Result rc = serviceDispatchOut(&g_tcSrv, 8, out);
if (R_SUCCEEDED(rc)) *status = out.status;
return rc; return rc;
} }
@ -46,11 +43,5 @@ Result tcGetSkinTemperatureMilliC(s32 *skinTemp) {
if (hosversionBefore(5,0,0)) if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
struct { return serviceDispatchOut(&g_tcSrv, 9, *skinTemp);
s32 skinTemp;
} out;
Result rc = serviceDispatchOut(&g_tcSrv, 9, out);
if (R_SUCCEEDED(rc)) *skinTemp = out.skinTemp;
return rc;
} }