Skip to content

Commit

Permalink
BUGFIX:GPS not working. Invalid values passed to px4_arch_configgpio
Browse files Browse the repository at this point in the history
   This is the root cause of #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.
  • Loading branch information
David Sidrane authored and dagar committed Jun 14, 2018
1 parent 695c274 commit 7f174b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/drivers/camera_trigger/interfaces/src/gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 7f174b4

Please sign in to comment.