forked from Archive/PX4-Autopilot
Reworked manual override flag, reworked arming slightly. Pending testing
This commit is contained in:
parent
d4ca6a29a1
commit
4595cc65b8
|
@ -335,7 +335,7 @@ PX4IO::init()
|
|||
/* dis-arm IO before touching anything */
|
||||
io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING,
|
||||
PX4IO_P_SETUP_ARMING_ARM_OK |
|
||||
PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE |
|
||||
PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK |
|
||||
PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK, 0);
|
||||
|
||||
/* publish RC config to IO */
|
||||
|
@ -541,9 +541,9 @@ PX4IO::io_set_arming_state()
|
|||
clear |= PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK;
|
||||
}
|
||||
if (vstatus.flag_external_manual_override_ok) {
|
||||
set |= PX4IO_P_FEAT_ARMING_MANUAL_OVERRIDE_OK;
|
||||
set |= PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK;
|
||||
} else {
|
||||
clear |= PX4IO_P_FEAT_ARMING_MANUAL_OVERRIDE_OK;
|
||||
clear |= PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK;
|
||||
}
|
||||
|
||||
return io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, clear, set);
|
||||
|
|
|
@ -245,11 +245,12 @@ controls_main(void)
|
|||
/*
|
||||
* Check for manual override.
|
||||
*
|
||||
* The OVERRIDE_OK feature must be set, and we must have R/C input.
|
||||
* The PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK flag must be set, and we
|
||||
* must have R/C input.
|
||||
* Override is enabled if either the hardcoded channel / value combination
|
||||
* is selected, or the AP has requested it.
|
||||
*/
|
||||
if ((r_setup_features & PX4IO_P_FEAT_ARMING_MANUAL_OVERRIDE_OK) &&
|
||||
if ((r_setup_arming & PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK) &&
|
||||
(r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK)) {
|
||||
|
||||
bool override = false;
|
||||
|
@ -260,14 +261,7 @@ controls_main(void)
|
|||
*
|
||||
* XXX This should be configurable.
|
||||
*/
|
||||
if ((r_rc_valid & (1 << 4)) && (r_rc_values[4] > RC_CHANNEL_HIGH_THRESH))
|
||||
override = true;
|
||||
|
||||
/*
|
||||
* Check for an explicit manual override request from the AP.
|
||||
*/
|
||||
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_FMU_OK) &&
|
||||
(r_setup_arming & PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE))
|
||||
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK) && (r_rc_values[4] > RC_CHANNEL_HIGH_THRESH))
|
||||
override = true;
|
||||
|
||||
if (override) {
|
||||
|
|
|
@ -136,12 +136,11 @@
|
|||
/* setup page */
|
||||
#define PX4IO_PAGE_SETUP 100
|
||||
#define PX4IO_P_SETUP_FEATURES 0
|
||||
#define PX4IO_P_FEAT_ARMING_MANUAL_OVERRIDE_OK (1 << 0) /* OK to switch to manual override */
|
||||
|
||||
#define PX4IO_P_SETUP_ARMING 1 /* arming controls */
|
||||
#define PX4IO_P_SETUP_ARMING_ARM_OK (1 << 0) /* OK to arm */
|
||||
#define PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE (1 << 2) /* request switch to manual override */
|
||||
#define PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK (1 << 3)
|
||||
#define PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK (1 << 2) /* OK to switch to manual override via override RC channel */
|
||||
#define PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK (1 << 3) /* OK to perform position / vector control (= position lock) */
|
||||
|
||||
#define PX4IO_P_SETUP_PWM_RATES 2 /* bitmask, 0 = low rate, 1 = high rate */
|
||||
#define PX4IO_P_SETUP_PWM_LOWRATE 3 /* 'low' PWM frame output rate in Hz */
|
||||
|
|
|
@ -140,9 +140,9 @@ volatile uint16_t r_page_setup[] =
|
|||
[PX4IO_P_SETUP_IBATT_BIAS] = 0
|
||||
};
|
||||
|
||||
#define PX4IO_P_SETUP_FEATURES_VALID (PX4IO_P_FEAT_ARMING_MANUAL_OVERRIDE_OK)
|
||||
#define PX4IO_P_SETUP_FEATURES_VALID (0)
|
||||
#define PX4IO_P_SETUP_ARMING_VALID (PX4IO_P_SETUP_ARMING_ARM_OK | \
|
||||
PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE)
|
||||
PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK)
|
||||
#define PX4IO_P_SETUP_RATES_VALID ((1 << IO_SERVO_COUNT) - 1)
|
||||
#define PX4IO_P_SETUP_RELAYS_VALID ((1 << PX4IO_RELAY_CHANNELS) - 1)
|
||||
|
||||
|
@ -283,9 +283,7 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value)
|
|||
value &= PX4IO_P_SETUP_FEATURES_VALID;
|
||||
r_setup_features = value;
|
||||
|
||||
/* update manual override state - disable if no longer OK */
|
||||
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_OVERRIDE) && !(value & PX4IO_P_FEAT_ARMING_MANUAL_OVERRIDE_OK))
|
||||
r_status_flags &= ~PX4IO_P_STATUS_FLAGS_OVERRIDE;
|
||||
/* no implemented feature selection at this point */
|
||||
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue