BUGFIX:GPS not working. Invalid values passed to px4_arch_configgpio

This is the root cause of https://github.com/PX4/Firmware/issues/9461
   The _pins array was initialized to -1. It was used to index the
   _gpios array. The value at _gpios[-1] was a number that mapped to
   Analog mode on Port A pin 0. These is the UART4_TX pin and was
   being reconfigured by the fault in the camera_trigger to an
   alaog input.
This commit is contained in:
David Sidrane
2018-06-13 09:47:34 -10:00
committed by Daniel Agar
parent ae389ed0e3
commit a38b94c7dd
@@ -22,8 +22,11 @@ CameraInterfaceGPIO::~CameraInterfaceGPIO()
void CameraInterfaceGPIO::setup()
{
for (unsigned i = 0; i < arraySize(_pins); i++) {
px4_arch_configgpio(_gpios[_pins[i]]);
px4_arch_gpiowrite(_gpios[_pins[i]], !_polarity);
// Pin range is ranges from 1 to 6
if (_pins[i] > 0 && _pins[i] < (int)arraySize(_gpios)) {
px4_arch_configgpio(_gpios[_pins[i]]);
px4_arch_gpiowrite(_gpios[_pins[i]], !_polarity);
}
}
}