mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Get MatchTime from NetComms (fixes artf2538)
Change-Id: I7ea438ce4610087bceac696a958e3c1e3ead238a
This commit is contained in:
@@ -214,6 +214,7 @@ extern "C"
|
||||
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes);
|
||||
int HALGetJoystickPOVs(uint8_t joystickNum, HALJoystickPOVs *povs);
|
||||
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count);
|
||||
int HALGetMatchTime(float *matchTime);
|
||||
|
||||
void HALSetNewDataSem(pthread_cond_t *);
|
||||
|
||||
|
||||
@@ -206,6 +206,11 @@ int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint
|
||||
return FRC_NetworkCommunication_getJoystickButtons(joystickNum, buttons, count);
|
||||
}
|
||||
|
||||
int HALGetMatchTime(float *matchTime)
|
||||
{
|
||||
return FRC_NetworkCommunication_getMatchTime(matchTime);
|
||||
}
|
||||
|
||||
void HALSetNewDataSem(pthread_cond_t * param)
|
||||
{
|
||||
setNewDataSem(param);
|
||||
|
||||
@@ -397,9 +397,9 @@ void DriverStation::WaitForData()
|
||||
*/
|
||||
double DriverStation::GetMatchTime()
|
||||
{
|
||||
if (m_approxMatchTimeOffset < 0.0)
|
||||
return 0.0;
|
||||
return Timer::GetFPGATimestamp() - m_approxMatchTimeOffset;
|
||||
float matchTime;
|
||||
HALGetMatchTime(&matchTime);
|
||||
return (double)matchTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -433,10 +433,7 @@ public class DriverStation implements RobotState.Interface {
|
||||
* @return Match time in seconds since the beginning of autonomous
|
||||
*/
|
||||
public double getMatchTime() {
|
||||
if (m_approxMatchTimeOffset < 0.0) {
|
||||
return 0.0;
|
||||
}
|
||||
return Timer.getFPGATimestamp() - m_approxMatchTimeOffset;
|
||||
return FRCNetworkCommunicationsLibrary.HALGetMatchTime();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -468,6 +468,7 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
|
||||
return HALAllianceStationID.Blue2;
|
||||
case 5:
|
||||
return HALAllianceStationID.Blue3;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,6 +535,20 @@ JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCom
|
||||
return env->NewDirectByteBuffer(returnByteArray, 4);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary
|
||||
|
||||
* Method: HALGetMatchTime
|
||||
* Signature: ()F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_HALGetMatchTime
|
||||
(JNIEnv * env, jclass)
|
||||
{
|
||||
jfloat matchTime;
|
||||
HALGetMatchTime((float*)&matchTime);
|
||||
return matchTime;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary
|
||||
* Method: HALGetSystemActive
|
||||
|
||||
Reference in New Issue
Block a user