mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[hal] Add SimValue reset() function (#3064)
This enables correct behavior for resetting incremental sensor values like encoder counts or gyro accumulated angle with WebSockets.
This commit is contained in:
@@ -114,10 +114,7 @@ double ADXRS450_Gyro::GetRate() const {
|
||||
|
||||
void ADXRS450_Gyro::Reset() {
|
||||
if (m_simAngle) {
|
||||
m_simAngle.Set(0.0);
|
||||
}
|
||||
if (m_simRate) {
|
||||
m_simRate.Set(0.0);
|
||||
m_simAngle.Reset();
|
||||
}
|
||||
m_spi.ResetAccumulator();
|
||||
}
|
||||
|
||||
@@ -105,6 +105,12 @@ class SimDeviceSim {
|
||||
*/
|
||||
operator HAL_SimDeviceHandle() const { return m_handle; } // NOLINT
|
||||
|
||||
/**
|
||||
* Get all sim devices with the given prefix.
|
||||
*
|
||||
* @param prefix the prefix to filter sim devices
|
||||
* @param callback callback function to call for each sim device
|
||||
*/
|
||||
template <typename F>
|
||||
static void EnumerateDevices(const char* prefix, F callback) {
|
||||
return HALSIM_EnumerateSimDevices(
|
||||
|
||||
Reference in New Issue
Block a user