mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
[hal, wpilib] Remove analog accumulator and analog gyro (#7697)
The 2 high level classes were temporarily kept to keep the examples compiling. We will remove those when we have the interface into the built in IMU.
This commit is contained in:
@@ -16,15 +16,6 @@
|
||||
}, \
|
||||
this, true)
|
||||
|
||||
#define REGISTER_AIN_ACCUM(halsim, jsonid, ctype, haltype) \
|
||||
HALSIM_RegisterAnalogInAccumulator##halsim##Callback( \
|
||||
m_channel, \
|
||||
[](const char* name, void* param, const struct HAL_Value* value) { \
|
||||
static_cast<HALSimWSProviderAnalogIn*>(param)->ProcessHalCallback( \
|
||||
{{jsonid, static_cast<ctype>(value->data.v_##haltype)}}); \
|
||||
}, \
|
||||
this, true)
|
||||
|
||||
namespace wpilibws {
|
||||
|
||||
void HALSimWSProviderAnalogIn::Initialize(WSRegisterFunc webRegisterFunc) {
|
||||
@@ -42,17 +33,6 @@ void HALSimWSProviderAnalogIn::RegisterCallbacks() {
|
||||
m_oversampleCbKey =
|
||||
REGISTER_AIN(OversampleBits, "<oversample_bits", int32_t, int);
|
||||
m_voltageCbKey = REGISTER_AIN(Voltage, ">voltage", double, double);
|
||||
|
||||
m_accumInitCbKey =
|
||||
REGISTER_AIN_ACCUM(Initialized, "<accum_init", bool, boolean);
|
||||
m_accumValueCbKey = REGISTER_AIN_ACCUM(Value, ">accum_value", int64_t,
|
||||
long); // NOLINT(runtime/int)
|
||||
m_accumCountCbKey = REGISTER_AIN_ACCUM(Count, ">accum_count", int64_t,
|
||||
long); // NOLINT(runtime/int)
|
||||
m_accumCenterCbKey =
|
||||
REGISTER_AIN_ACCUM(Center, "<accum_center", int32_t, int);
|
||||
m_accumDeadbandCbKey =
|
||||
REGISTER_AIN_ACCUM(Deadband, "<accum_deadband", int32_t, int);
|
||||
}
|
||||
|
||||
void HALSimWSProviderAnalogIn::CancelCallbacks() {
|
||||
@@ -65,24 +45,12 @@ void HALSimWSProviderAnalogIn::DoCancelCallbacks() {
|
||||
HALSIM_CancelAnalogInAverageBitsCallback(m_channel, m_avgbitsCbKey);
|
||||
HALSIM_CancelAnalogInOversampleBitsCallback(m_channel, m_oversampleCbKey);
|
||||
HALSIM_CancelAnalogInVoltageCallback(m_channel, m_voltageCbKey);
|
||||
HALSIM_CancelAnalogInAccumulatorInitializedCallback(m_channel,
|
||||
m_accumInitCbKey);
|
||||
HALSIM_CancelAnalogInAccumulatorValueCallback(m_channel, m_accumValueCbKey);
|
||||
HALSIM_CancelAnalogInAccumulatorCountCallback(m_channel, m_accumCountCbKey);
|
||||
HALSIM_CancelAnalogInAccumulatorCenterCallback(m_channel, m_accumCenterCbKey);
|
||||
HALSIM_CancelAnalogInAccumulatorDeadbandCallback(m_channel,
|
||||
m_accumDeadbandCbKey);
|
||||
|
||||
// Reset callback IDs
|
||||
m_initCbKey = 0;
|
||||
m_avgbitsCbKey = 0;
|
||||
m_oversampleCbKey = 0;
|
||||
m_voltageCbKey = 0;
|
||||
m_accumInitCbKey = 0;
|
||||
m_accumValueCbKey = 0;
|
||||
m_accumCountCbKey = 0;
|
||||
m_accumCenterCbKey = 0;
|
||||
m_accumDeadbandCbKey = 0;
|
||||
}
|
||||
|
||||
void HALSimWSProviderAnalogIn::OnNetValueChanged(const wpi::json& json) {
|
||||
@@ -90,12 +58,6 @@ void HALSimWSProviderAnalogIn::OnNetValueChanged(const wpi::json& json) {
|
||||
if ((it = json.find(">voltage")) != json.end()) {
|
||||
HALSIM_SetAnalogInVoltage(m_channel, it.value());
|
||||
}
|
||||
if ((it = json.find(">accum_value")) != json.end()) {
|
||||
HALSIM_SetAnalogInAccumulatorValue(m_channel, it.value());
|
||||
}
|
||||
if ((it = json.find(">accum_count")) != json.end()) {
|
||||
HALSIM_SetAnalogInAccumulatorCount(m_channel, it.value());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace wpilibws
|
||||
|
||||
@@ -29,11 +29,6 @@ class HALSimWSProviderAnalogIn : public HALSimWSHalChanProvider {
|
||||
int32_t m_avgbitsCbKey = 0;
|
||||
int32_t m_oversampleCbKey = 0;
|
||||
int32_t m_voltageCbKey = 0;
|
||||
int32_t m_accumInitCbKey = 0;
|
||||
int32_t m_accumValueCbKey = 0;
|
||||
int32_t m_accumCountCbKey = 0;
|
||||
int32_t m_accumCenterCbKey = 0;
|
||||
int32_t m_accumDeadbandCbKey = 0;
|
||||
};
|
||||
|
||||
} // namespace wpilibws
|
||||
|
||||
Reference in New Issue
Block a user