mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[hal] Fix unfinished/incorrect GetCPUTemp functions (#5598)
This commit is contained in:
@@ -28,7 +28,7 @@ DEFINE_CAPI(int32_t, UserFaults6V, 0)
|
||||
DEFINE_CAPI(int32_t, UserFaults5V, 0)
|
||||
DEFINE_CAPI(int32_t, UserFaults3V3, 0)
|
||||
DEFINE_CAPI(double, BrownoutVoltage, 6.75)
|
||||
DEFINE_CAPI(int32_t, CPUTemp, 16)
|
||||
DEFINE_CAPI(double, CPUTemp, 45.0)
|
||||
|
||||
int32_t HALSIM_RegisterRoboRioSerialNumberCallback(
|
||||
HAL_RoboRioStringCallback callback, void* param, HAL_Bool initialNotify) {
|
||||
|
||||
@@ -828,6 +828,56 @@ Java_edu_wpi_first_hal_simulation_RoboRioDataJNI_setBrownoutVoltage
|
||||
HALSIM_SetRoboRioBrownoutVoltage(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_RoboRioDataJNI
|
||||
* Method: registerCPUTempCallback
|
||||
* Signature: (Ljava/lang/Object;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_RoboRioDataJNI_registerCPUTempCallback
|
||||
(JNIEnv* env, jclass, jobject callback, jboolean initialNotify)
|
||||
{
|
||||
return sim::AllocateCallbackNoIndex(env, callback, initialNotify,
|
||||
&HALSIM_RegisterRoboRioCPUTempCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_RoboRioDataJNI
|
||||
* Method: cancelCPUTempCallback
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_RoboRioDataJNI_cancelCPUTempCallback
|
||||
(JNIEnv* env, jclass, jint handle)
|
||||
{
|
||||
return sim::FreeCallbackNoIndex(env, handle,
|
||||
&HALSIM_CancelRoboRioCPUTempCallback);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_RoboRioDataJNI
|
||||
* Method: getCPUTemp
|
||||
* Signature: ()D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_RoboRioDataJNI_getCPUTemp
|
||||
(JNIEnv*, jclass)
|
||||
{
|
||||
return HALSIM_GetRoboRioCPUTemp();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_RoboRioDataJNI
|
||||
* Method: setCPUTemp
|
||||
* Signature: (D)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_simulation_RoboRioDataJNI_setCPUTemp
|
||||
(JNIEnv*, jclass, jdouble cpuTemp)
|
||||
{
|
||||
HALSIM_SetRoboRioCPUTemp(cpuTemp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_simulation_RoboRioDataJNI
|
||||
* Method: getSerialNumber
|
||||
|
||||
@@ -145,8 +145,8 @@ int32_t HALSIM_RegisterRoboRioCPUTempCallback(HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify);
|
||||
void HALSIM_CancelRoboRioCPUTempCallback(int32_t uid);
|
||||
HAL_Bool HALSIM_GetRoboRioCPUTemp(void);
|
||||
void HALSIM_SetRoboRioUserCPUTemp(HAL_Bool userActive3V3);
|
||||
double HALSIM_GetRoboRioCPUTemp(void);
|
||||
void HALSIM_SetRoboRioCPUTemp(double cpuTemp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -32,7 +32,7 @@ void RoboRioData::ResetData() {
|
||||
userFaults5V.Reset(0);
|
||||
userFaults3V3.Reset(0);
|
||||
brownoutVoltage.Reset(6.75);
|
||||
cpuTemp.Reset(100);
|
||||
cpuTemp.Reset(45.0);
|
||||
m_serialNumber = "";
|
||||
m_comments = "";
|
||||
}
|
||||
@@ -133,7 +133,7 @@ DEFINE_CAPI(int32_t, UserFaults6V, userFaults6V)
|
||||
DEFINE_CAPI(int32_t, UserFaults5V, userFaults5V)
|
||||
DEFINE_CAPI(int32_t, UserFaults3V3, userFaults3V3)
|
||||
DEFINE_CAPI(double, BrownoutVoltage, brownoutVoltage)
|
||||
DEFINE_CAPI(int32_t, CPUTemp, cpuTemp)
|
||||
DEFINE_CAPI(double, CPUTemp, cpuTemp)
|
||||
|
||||
int32_t HALSIM_RegisterRoboRioSerialNumberCallback(
|
||||
HAL_RoboRioStringCallback callback, void* param, HAL_Bool initialNotify) {
|
||||
|
||||
@@ -58,7 +58,7 @@ class RoboRioData {
|
||||
SimDataValue<int32_t, HAL_MakeInt, GetUserFaults3V3Name> userFaults3V3{0};
|
||||
SimDataValue<double, HAL_MakeDouble, GetBrownoutVoltageName> brownoutVoltage{
|
||||
6.75};
|
||||
SimDataValue<double, HAL_MakeDouble, GetCPUTempName> cpuTemp{100};
|
||||
SimDataValue<double, HAL_MakeDouble, GetCPUTempName> cpuTemp{45.0};
|
||||
|
||||
int32_t RegisterSerialNumberCallback(HAL_RoboRioStringCallback callback,
|
||||
void* param, HAL_Bool initialNotify);
|
||||
|
||||
Reference in New Issue
Block a user