[wpilib, hal] DigitalGlitchFilter: Fix sim crash and clean up construction (#6937)

Fixes error when >3 are constructed- in java, m_filterAllocated[index] would be evaluated before the bounds check and throw IndexOutOfBounds, in c++ a vague assertion error would be thrown.

Makes DoAdd static in c++

Makes the error message when HAL_SetFilterSelect fails consistent with java
This commit is contained in:
Ryan Blue
2024-08-11 02:30:02 -04:00
committed by GitHub
parent c13c512221
commit dd99ff420c
5 changed files with 61 additions and 30 deletions

View File

@@ -50,6 +50,7 @@ struct DigitalPort {
int32_t centerPwm = 0;
int32_t deadbandMinPwm = 0;
int32_t minPwm = 0;
int32_t filterIndex = 0;
std::string previousAllocation;
};