diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp index 91bf6e5275..a59c68b169 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp @@ -193,7 +193,7 @@ void CommandScheduler::Run() { // Run the periodic method of all registered subsystems. for (auto&& subsystem : m_impl->subsystems) { subsystem.getFirst()->Periodic(); - if (frc::RobotBase::IsSimulation()) { + if constexpr (frc::RobotBase::IsSimulation()) { subsystem.getFirst()->SimulationPeriodic(); } m_watchdog.AddEpoch("Subsystem Periodic()"); diff --git a/wpilibc/src/main/native/cpp/IterativeRobot.cpp b/wpilibc/src/main/native/cpp/IterativeRobot.cpp index a81601fecd..72fb79b6ae 100644 --- a/wpilibc/src/main/native/cpp/IterativeRobot.cpp +++ b/wpilibc/src/main/native/cpp/IterativeRobot.cpp @@ -24,7 +24,7 @@ IterativeRobot::IterativeRobot() : IterativeRobotBase(kPacketPeriod) { void IterativeRobot::StartCompetition() { RobotInit(); - if (IsSimulation()) { + if constexpr (IsSimulation()) { SimulationInit(); } diff --git a/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp b/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp index 98c4b3e541..7b29130b91 100644 --- a/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp +++ b/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp @@ -170,7 +170,7 @@ void IterativeRobotBase::LoopFunc() { Shuffleboard::Update(); m_watchdog.AddEpoch("Shuffleboard::Update()"); - if (IsSimulation()) { + if constexpr (IsSimulation()) { SimulationPeriodic(); m_watchdog.AddEpoch("SimulationPeriodic()"); } diff --git a/wpilibc/src/main/native/cpp/TimedRobot.cpp b/wpilibc/src/main/native/cpp/TimedRobot.cpp index 7daa833b7d..144cdbe2e8 100644 --- a/wpilibc/src/main/native/cpp/TimedRobot.cpp +++ b/wpilibc/src/main/native/cpp/TimedRobot.cpp @@ -24,7 +24,7 @@ using namespace frc; void TimedRobot::StartCompetition() { RobotInit(); - if (IsSimulation()) { + if constexpr (IsSimulation()) { SimulationInit(); }