mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilibc] Errors: Use fmtlib
This commit is contained in:
@@ -22,8 +22,7 @@ using namespace frc;
|
||||
|
||||
DigitalInput::DigitalInput(int channel) {
|
||||
if (!SensorUtil::CheckDigitalChannel(channel)) {
|
||||
throw FRC_MakeError(err::ChannelIndexOutOfRange,
|
||||
"Digital Channel " + wpi::Twine{channel});
|
||||
throw FRC_MakeError(err::ChannelIndexOutOfRange, "Channel {}", channel);
|
||||
}
|
||||
m_channel = channel;
|
||||
|
||||
@@ -31,7 +30,7 @@ DigitalInput::DigitalInput(int channel) {
|
||||
std::string stackTrace = wpi::GetStackTrace(1);
|
||||
m_handle = HAL_InitializeDIOPort(HAL_GetPort(channel), true,
|
||||
stackTrace.c_str(), &status);
|
||||
FRC_CheckErrorStatus(status, "Digital Channel " + wpi::Twine{channel});
|
||||
FRC_CheckErrorStatus(status, "Channel {}", channel);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_DigitalInput, channel + 1);
|
||||
SendableRegistry::GetInstance().AddLW(this, "DigitalInput", channel);
|
||||
@@ -44,7 +43,7 @@ DigitalInput::~DigitalInput() {
|
||||
bool DigitalInput::Get() const {
|
||||
int32_t status = 0;
|
||||
bool value = HAL_GetDIO(m_handle, &status);
|
||||
FRC_CheckErrorStatus(status, "Get");
|
||||
FRC_CheckErrorStatus(status, "Channel {}", m_channel);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user