mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[hal] Ensure HAL status variables are initialized to zero (#3421)
HAL functions don't set the status variable on success, so it's possible to use the status variable in an uninitialized state.
This commit is contained in:
@@ -37,7 +37,7 @@ void GazeboAnalogIn::Listen() {
|
||||
void GazeboAnalogIn::Callback(const gazebo::msgs::ConstFloat64Ptr& msg) {
|
||||
/* This value is going to be divided by the 5V rail in the HAL, so
|
||||
we multiply by that value to make the change neutral */
|
||||
int32_t status;
|
||||
int32_t status = 0;
|
||||
HALSIM_SetAnalogInVoltage(m_index,
|
||||
msg->data() * HAL_GetUserVoltage5V(&status));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user