mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpilib] Revert throw on nonexistent SimDevice name in SimDeviceSim (#5053)
This breaks current vendor use of SimDeviceSim.
This reverts commit d991f6e435 (#5041).
This commit is contained in:
@@ -11,37 +11,20 @@
|
||||
#include <hal/SimDevice.h>
|
||||
#include <hal/simulation/SimDeviceData.h>
|
||||
|
||||
#include "frc/Errors.h"
|
||||
|
||||
using namespace frc;
|
||||
using namespace frc::sim;
|
||||
|
||||
SimDeviceSim::SimDeviceSim(const char* name)
|
||||
: m_handle{HALSIM_GetSimDeviceHandle(name)} {
|
||||
if (m_handle == 0) {
|
||||
throw FRC_MakeError(err::InvalidParameter,
|
||||
"No sim device exists with name '{}'.", name);
|
||||
}
|
||||
}
|
||||
: m_handle{HALSIM_GetSimDeviceHandle(name)} {}
|
||||
|
||||
SimDeviceSim::SimDeviceSim(const char* name, int index) {
|
||||
m_handle =
|
||||
HALSIM_GetSimDeviceHandle(fmt::format("{}[{}]", name, index).c_str());
|
||||
if (m_handle == 0) {
|
||||
throw FRC_MakeError(err::InvalidParameter,
|
||||
"No sim device exists with name '{}[{}]'.", name,
|
||||
index);
|
||||
}
|
||||
}
|
||||
|
||||
SimDeviceSim::SimDeviceSim(const char* name, int index, int channel) {
|
||||
m_handle = HALSIM_GetSimDeviceHandle(
|
||||
fmt::format("{}[{},{}]", name, index, channel).c_str());
|
||||
if (m_handle == 0) {
|
||||
throw FRC_MakeError(err::InvalidParameter,
|
||||
"No sim device exists with name '{}[{},{}]'.", name,
|
||||
index, channel);
|
||||
}
|
||||
}
|
||||
|
||||
SimDeviceSim::SimDeviceSim(HAL_SimDeviceHandle handle) : m_handle(handle) {}
|
||||
|
||||
Reference in New Issue
Block a user