[hal] Implement HAL_GetSystemTimeValid on SystemCore (#8051)

This commit is contained in:
Thad House
2025-07-14 23:45:28 -07:00
committed by GitHub
parent abeaa40e38
commit ef24c1df97
3 changed files with 12 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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")