mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal] Implement HAL_GetSystemTimeValid on SystemCore (#8051)
This commit is contained in:
@@ -66,6 +66,8 @@ struct SystemServerDriverStation {
|
||||
nt::BooleanPublisher hasUserCodePublisher;
|
||||
nt::BooleanPublisher hasUserCodeReadyPublisher;
|
||||
|
||||
nt::BooleanSubscriber hasSetWallClockSubscriber;
|
||||
|
||||
nt::ProtobufSubscriber<mrc::ControlData> controlDataSubscriber;
|
||||
nt::ProtobufSubscriber<mrc::MatchInfo> matchInfoSubscriber;
|
||||
nt::StringSubscriber gameSpecificMessageSubscriber;
|
||||
@@ -119,6 +121,10 @@ struct SystemServerDriverStation {
|
||||
consoleLinePublisher =
|
||||
ntInst.GetStringTopic(ROBOT_CONSOLE_LINE_PATH).Publish(options);
|
||||
|
||||
hasSetWallClockSubscriber =
|
||||
ntInst.GetBooleanTopic(ROBOT_HAS_SET_WALL_CLOCK_PATH)
|
||||
.Subscribe(false, options);
|
||||
|
||||
errorInfoPublisher =
|
||||
ntInst.GetProtobufTopic<mrc::ErrorInfo>(ROBOT_ERROR_INFO_PATH)
|
||||
.Publish(options);
|
||||
@@ -643,6 +649,10 @@ HAL_Bool HAL_GetOutputsEnabled(void) {
|
||||
return systemServerDs->controlDataSubscriber.Get().ControlWord.WatchdogActive;
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetSystemTimeValid(int32_t* status) {
|
||||
return systemServerDs->hasSetWallClockSubscriber.Get(false);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace hal {
|
||||
|
||||
@@ -276,10 +276,6 @@ HAL_Bool HAL_GetRSLState(int32_t* status) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetSystemTimeValid(int32_t* status) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) {
|
||||
static std::atomic_bool initialized{false};
|
||||
static wpi::mutex initializeMutex;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#define ROBOT_MATCH_INFO_PATH (ROBOT_CONTROL_DATA_PREFIX "MatchInfo")
|
||||
#define ROBOT_JOYSTICK_DESCRIPTORS_PATH \
|
||||
(ROBOT_CONTROL_DATA_PREFIX "JoystickDescriptors/")
|
||||
#define ROBOT_HAS_SET_WALL_CLOCK_PATH \
|
||||
(ROBOT_CONTROL_DATA_PREFIX "HasSetWallClock")
|
||||
|
||||
#define ROBOT_STATUS_DATA_PREFIX "/Netcomm/Status/"
|
||||
#define ROBOT_HAS_USER_CODE_PATH (ROBOT_STATUS_DATA_PREFIX "HasUserCode")
|
||||
|
||||
Reference in New Issue
Block a user