From f6fdae3212e678fe11d4ec9cf355a884756371ae Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 14 Mar 2026 10:33:36 -0700 Subject: [PATCH] [hal,wpilib] Rename RuntimeType constants to all caps --- .../java/org/wpilib/hardware/hal/HALUtil.java | 4 ++-- hal/src/main/native/cpp/jni/HALUtil.cpp | 10 +++++----- hal/src/main/native/include/wpi/hal/HAL.h | 8 ++++---- hal/src/main/native/sim/HAL.cpp | 2 +- hal/src/main/native/systemcore/HAL.cpp | 2 +- hal/src/test/native/cpp/HALTest.cpp | 2 +- ntcoreffi/src/main/native/cpp/DataLogManager.cpp | 2 +- wpilibc/src/main/native/cppcs/RobotBase.cpp | 16 ++++++++-------- .../native/include/wpi/system/RuntimeType.hpp | 10 +++++----- .../java/org/wpilib/framework/RobotBase.java | 4 ++-- .../main/java/org/wpilib/system/RuntimeType.java | 16 ++++++++-------- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/hal/src/main/java/org/wpilib/hardware/hal/HALUtil.java b/hal/src/main/java/org/wpilib/hardware/hal/HALUtil.java index 304e0b5925..3b0156a56e 100644 --- a/hal/src/main/java/org/wpilib/hardware/hal/HALUtil.java +++ b/hal/src/main/java/org/wpilib/hardware/hal/HALUtil.java @@ -38,7 +38,7 @@ public final class HALUtil extends JNIWrapper { public static final int RUNTIME_ROBORIO = 0; /** roboRIO 2.0. */ - public static final int RUNTIME_ROBORIO2 = 1; + public static final int RUNTIME_ROBORIO_2 = 1; /** Simulation runtime. */ public static final int RUNTIME_SIMULATION = 2; @@ -82,7 +82,7 @@ public final class HALUtil extends JNIWrapper { * * @return HAL Runtime Type * @see RUNTIME_ROBORIO - * @see RUNTIME_ROBORIO2 + * @see RUNTIME_ROBORIO_2 * @see RUNTIME_SIMULATION * @see "HAL_GetRuntimeType" */ diff --git a/hal/src/main/native/cpp/jni/HALUtil.cpp b/hal/src/main/native/cpp/jni/HALUtil.cpp index 6f739fd90f..1c701e94f4 100644 --- a/hal/src/main/native/cpp/jni/HALUtil.cpp +++ b/hal/src/main/native/cpp/jni/HALUtil.cpp @@ -32,13 +32,13 @@ using namespace wpi::util::java; #define kRIOStatusResourceNotInitialized -52010 static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_ROBORIO == - HAL_Runtime_RoboRIO); -static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_ROBORIO2 == - HAL_Runtime_RoboRIO2); + HAL_RUNTIME_ROBORIO); +static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_ROBORIO_2 == + HAL_RUNTIME_ROBORIO_2); static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_SIMULATION == - HAL_Runtime_Simulation); + HAL_RUNTIME_SIMULATION); static_assert(org_wpilib_hardware_hal_HALUtil_RUNTIME_SYSTEMCORE == - HAL_Runtime_Systemcore); + HAL_RUNTIME_SYSTEMCORE); static JavaVM* jvm = nullptr; static JException illegalArgExCls; diff --git a/hal/src/main/native/include/wpi/hal/HAL.h b/hal/src/main/native/include/wpi/hal/HAL.h index 72edf2dff4..0e40d9ffcb 100644 --- a/hal/src/main/native/include/wpi/hal/HAL.h +++ b/hal/src/main/native/include/wpi/hal/HAL.h @@ -26,13 +26,13 @@ */ HAL_ENUM(HAL_RuntimeType) { /** roboRIO 1.0 */ - HAL_Runtime_RoboRIO, + HAL_RUNTIME_ROBORIO, /** roboRIO 2.0 */ - HAL_Runtime_RoboRIO2, + HAL_RUNTIME_ROBORIO_2, /** Simulation runtime */ - HAL_Runtime_Simulation, + HAL_RUNTIME_SIMULATION, /** Systemcore */ - HAL_Runtime_Systemcore, + HAL_RUNTIME_SYSTEMCORE, }; #ifdef __cplusplus diff --git a/hal/src/main/native/sim/HAL.cpp b/hal/src/main/native/sim/HAL.cpp index f0e77b56e5..a354004ea5 100644 --- a/hal/src/main/native/sim/HAL.cpp +++ b/hal/src/main/native/sim/HAL.cpp @@ -54,7 +54,7 @@ class SimPeriodicCallbackRegistry : public impl::SimCallbackRegistryBase { }; } // namespace -static HAL_RuntimeType runtimeType{HAL_Runtime_Simulation}; +static HAL_RuntimeType runtimeType{HAL_RUNTIME_SIMULATION}; static wpi::util::spinlock gOnShutdownMutex; static std::vector> gOnShutdown; static SimPeriodicCallbackRegistry gSimPeriodicBefore; diff --git a/hal/src/main/native/systemcore/HAL.cpp b/hal/src/main/native/systemcore/HAL.cpp index a4eab1560a..3b4e8035ce 100644 --- a/hal/src/main/native/systemcore/HAL.cpp +++ b/hal/src/main/native/systemcore/HAL.cpp @@ -155,7 +155,7 @@ const char* HAL_GetErrorMessage(int32_t code) { } } -static HAL_RuntimeType runtimeType = HAL_Runtime_Systemcore; +static HAL_RuntimeType runtimeType = HAL_RUNTIME_SYSTEMCORE; HAL_RuntimeType HAL_GetRuntimeType(void) { return runtimeType; diff --git a/hal/src/test/native/cpp/HALTest.cpp b/hal/src/test/native/cpp/HALTest.cpp index 011830dcbf..6c64511935 100644 --- a/hal/src/test/native/cpp/HALTest.cpp +++ b/hal/src/test/native/cpp/HALTest.cpp @@ -8,6 +8,6 @@ namespace wpi::hal { TEST(HALTest, RuntimeType) { - EXPECT_EQ(HAL_RuntimeType::HAL_Runtime_Simulation, HAL_GetRuntimeType()); + EXPECT_EQ(HAL_RuntimeType::HAL_RUNTIME_SIMULATION, HAL_GetRuntimeType()); } } // namespace wpi::hal diff --git a/ntcoreffi/src/main/native/cpp/DataLogManager.cpp b/ntcoreffi/src/main/native/cpp/DataLogManager.cpp index cbb7d1d33e..a587c854f0 100644 --- a/ntcoreffi/src/main/native/cpp/DataLogManager.cpp +++ b/ntcoreffi/src/main/native/cpp/DataLogManager.cpp @@ -174,7 +174,7 @@ inline void RemoveRefreshedDataEventHandle(WPI_EventHandle event) {} } // namespace DriverStation // #ifdef __FIRST_SYSTEMCORE__ -// static constexpr int kRoboRIO = 0; +// static constexpr int ROBORIO = 0; // namespace RobotBase { // inline int GetRuntimeType() { // nLoadOut::tTargetClass targetClass = nLoadOut::getTargetClass(); diff --git a/wpilibc/src/main/native/cppcs/RobotBase.cpp b/wpilibc/src/main/native/cppcs/RobotBase.cpp index 8d67bc7748..d5ea33b083 100644 --- a/wpilibc/src/main/native/cppcs/RobotBase.cpp +++ b/wpilibc/src/main/native/cppcs/RobotBase.cpp @@ -29,14 +29,14 @@ #include "wpi/util/print.hpp" #include "wpi/util/timestamp.hpp" -static_assert(wpi::RuntimeType::kRoboRIO == - static_cast(HAL_Runtime_RoboRIO)); -static_assert(wpi::RuntimeType::kRoboRIO2 == - static_cast(HAL_Runtime_RoboRIO2)); -static_assert(wpi::RuntimeType::kSimulation == - static_cast(HAL_Runtime_Simulation)); -static_assert(wpi::RuntimeType::kSystemcore == - static_cast(HAL_Runtime_Systemcore)); +static_assert(wpi::RuntimeType::ROBORIO == + static_cast(HAL_RUNTIME_ROBORIO)); +static_assert(wpi::RuntimeType::ROBORIO_2 == + static_cast(HAL_RUNTIME_ROBORIO_2)); +static_assert(wpi::RuntimeType::SIMULATION == + static_cast(HAL_RUNTIME_SIMULATION)); +static_assert(wpi::RuntimeType::SYSTEMCORE == + static_cast(HAL_RUNTIME_SYSTEMCORE)); using SetCameraServerSharedFP = void (*)(wpi::CameraServerShared*); diff --git a/wpilibc/src/main/native/include/wpi/system/RuntimeType.hpp b/wpilibc/src/main/native/include/wpi/system/RuntimeType.hpp index b69796d872..e10b00594b 100644 --- a/wpilibc/src/main/native/include/wpi/system/RuntimeType.hpp +++ b/wpilibc/src/main/native/include/wpi/system/RuntimeType.hpp @@ -8,13 +8,13 @@ namespace wpi { /** * Runtime type. */ -enum RuntimeType { +enum class RuntimeType { /// roboRIO 1.0. - kRoboRIO, + ROBORIO, /// roboRIO 2.0. - kRoboRIO2, + ROBORIO_2, /// Simulation runtime. - kSimulation, - kSystemcore + SIMULATION, + SYSTEMCORE }; } // namespace wpi diff --git a/wpilibj/src/main/java/org/wpilib/framework/RobotBase.java b/wpilibj/src/main/java/org/wpilib/framework/RobotBase.java index 05f27a694c..4174313633 100644 --- a/wpilibj/src/main/java/org/wpilib/framework/RobotBase.java +++ b/wpilibj/src/main/java/org/wpilib/framework/RobotBase.java @@ -162,7 +162,7 @@ public abstract class RobotBase implements AutoCloseable { * @return If the robot is running in simulation. */ public static boolean isSimulation() { - return getRuntimeType() == RuntimeType.kSimulation; + return getRuntimeType() == RuntimeType.SIMULATION; } /** @@ -172,7 +172,7 @@ public abstract class RobotBase implements AutoCloseable { */ public static boolean isReal() { RuntimeType runtimeType = getRuntimeType(); - return runtimeType == RuntimeType.kSystemcore; + return runtimeType == RuntimeType.SYSTEMCORE; } /** diff --git a/wpilibj/src/main/java/org/wpilib/system/RuntimeType.java b/wpilibj/src/main/java/org/wpilib/system/RuntimeType.java index b67616e67e..7879005fef 100644 --- a/wpilibj/src/main/java/org/wpilib/system/RuntimeType.java +++ b/wpilibj/src/main/java/org/wpilib/system/RuntimeType.java @@ -9,13 +9,13 @@ import org.wpilib.hardware.hal.HALUtil; /** Runtime type. */ public enum RuntimeType { /** roboRIO 1.0. */ - kRoboRIO(HALUtil.RUNTIME_ROBORIO), + ROBORIO(HALUtil.RUNTIME_ROBORIO), /** roboRIO 2.0. */ - kRoboRIO2(HALUtil.RUNTIME_ROBORIO2), + ROBORIO_2(HALUtil.RUNTIME_ROBORIO_2), /** Simulation runtime. */ - kSimulation(HALUtil.RUNTIME_SIMULATION), + SIMULATION(HALUtil.RUNTIME_SIMULATION), /** Systemcore. */ - kSystemcore(HALUtil.RUNTIME_SYSTEMCORE); + SYSTEMCORE(HALUtil.RUNTIME_SYSTEMCORE); /** RuntimeType value. */ public final int value; @@ -32,10 +32,10 @@ public enum RuntimeType { */ public static RuntimeType getValue(int type) { return switch (type) { - case HALUtil.RUNTIME_ROBORIO -> RuntimeType.kRoboRIO; - case HALUtil.RUNTIME_ROBORIO2 -> RuntimeType.kRoboRIO2; - case HALUtil.RUNTIME_SYSTEMCORE -> RuntimeType.kSystemcore; - default -> RuntimeType.kSimulation; + case HALUtil.RUNTIME_ROBORIO -> RuntimeType.ROBORIO; + case HALUtil.RUNTIME_ROBORIO_2 -> RuntimeType.ROBORIO_2; + case HALUtil.RUNTIME_SYSTEMCORE -> RuntimeType.SYSTEMCORE; + default -> RuntimeType.SIMULATION; }; } }