mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Optimize Solenoid Gets. Fixes artf4730.
Implement GetAllSolenoids in the HAL so that SolenoidBase doesn't have to read each solenoid individually. Change-Id: I85559565949f7a7119ead410187235636a63f0ed
This commit is contained in:
committed by
Brad Miller (WPI)
parent
84ca2ab0f5
commit
906fe65e39
@@ -48,9 +48,8 @@ void SolenoidBase::Set(uint8_t value, uint8_t mask, int module) {
|
||||
uint8_t SolenoidBase::GetAll(int module) const {
|
||||
uint8_t value = 0;
|
||||
int32_t status = 0;
|
||||
for (int i = 0; i < m_maxPorts; i++) {
|
||||
value |= getSolenoid(m_ports[module][i], &status) << i;
|
||||
}
|
||||
value = getAllSolenoids(m_ports[module][0], &status);
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user