mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
Rover: fixed AUTO_KICKSTART GPIO pin handling
This commit is contained in:
parent
eb6c66af7e
commit
c76f8a5242
@ -40,11 +40,19 @@ static bool auto_check_trigger(void)
|
||||
}
|
||||
|
||||
if (g.auto_trigger_pin != -1) {
|
||||
hal.gpio->pinMode(g.auto_trigger_pin, GPIO_INPUT);
|
||||
if (hal.gpio->read(g.auto_trigger_pin) == 0) {
|
||||
gcs_send_text_P(SEVERITY_LOW, PSTR("Triggered AUTO with pin"));
|
||||
auto_triggered = true;
|
||||
return true;
|
||||
int8_t pin = hal.gpio->analogPinToDigitalPin(g.auto_trigger_pin);
|
||||
if (pin != -1) {
|
||||
// ensure we are in input mode
|
||||
hal.gpio->pinMode(pin, GPIO_INPUT);
|
||||
|
||||
// enable pullup
|
||||
hal.gpio->write(pin, 1);
|
||||
|
||||
if (hal.gpio->read(pin) == 0) {
|
||||
gcs_send_text_P(SEVERITY_LOW, PSTR("Triggered AUTO with pin"));
|
||||
auto_triggered = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user