mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 07:23:33 +08:00
IO firmware: Do mixer load as block operation
This commit is contained in:
@@ -88,9 +88,6 @@ static int mixer_callback(uintptr_t handle,
|
|||||||
|
|
||||||
static MixerGroup mixer_group(mixer_callback, 0);
|
static MixerGroup mixer_group(mixer_callback, 0);
|
||||||
|
|
||||||
/* Set the failsafe values of all mixed channels (based on zero throttle, controls centered) */
|
|
||||||
static void mixer_set_failsafe();
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mixer_tick(void)
|
mixer_tick(void)
|
||||||
{
|
{
|
||||||
@@ -479,15 +476,6 @@ mixer_handle_text(const void *buffer, size_t length)
|
|||||||
/* if anything was parsed */
|
/* if anything was parsed */
|
||||||
if (resid != mixer_text_length) {
|
if (resid != mixer_text_length) {
|
||||||
|
|
||||||
/* only set mixer ok if no residual is left over */
|
|
||||||
if (resid == 0) {
|
|
||||||
r_status_flags |= PX4IO_P_STATUS_FLAGS_MIXER_OK;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* not yet reached the end of the mixer, set as not ok */
|
|
||||||
r_status_flags &= ~PX4IO_P_STATUS_FLAGS_MIXER_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
isr_debug(2, "used %u", mixer_text_length - resid);
|
isr_debug(2, "used %u", mixer_text_length - resid);
|
||||||
|
|
||||||
/* copy any leftover text to the base of the buffer for re-use */
|
/* copy any leftover text to the base of the buffer for re-use */
|
||||||
@@ -496,9 +484,6 @@ mixer_handle_text(const void *buffer, size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mixer_text_length = resid;
|
mixer_text_length = resid;
|
||||||
|
|
||||||
/* update failsafe values */
|
|
||||||
mixer_set_failsafe();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -507,7 +492,7 @@ mixer_handle_text(const void *buffer, size_t length)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
mixer_set_failsafe()
|
mixer_set_failsafe()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -190,6 +190,8 @@ extern pwm_limit_t pwm_limit;
|
|||||||
*/
|
*/
|
||||||
extern void mixer_tick(void);
|
extern void mixer_tick(void);
|
||||||
extern int mixer_handle_text(const void *buffer, size_t length);
|
extern int mixer_handle_text(const void *buffer, size_t length);
|
||||||
|
/* Set the failsafe values of all mixed channels (based on zero throttle, controls centered) */
|
||||||
|
extern void mixer_set_failsafe(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Safety switch/LED.
|
* Safety switch/LED.
|
||||||
|
|||||||
@@ -469,8 +469,19 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value)
|
|||||||
* Allow FMU override of arming state (to allow in-air restores),
|
* Allow FMU override of arming state (to allow in-air restores),
|
||||||
* but only if the arming state is not in sync on the IO side.
|
* but only if the arming state is not in sync on the IO side.
|
||||||
*/
|
*/
|
||||||
if (!(r_status_flags & PX4IO_P_STATUS_FLAGS_ARM_SYNC)) {
|
|
||||||
|
if (PX4IO_P_STATUS_FLAGS_MIXER_OK & value) {
|
||||||
|
r_status_flags |= PX4IO_P_STATUS_FLAGS_MIXER_OK;
|
||||||
|
|
||||||
|
} else if (!(r_status_flags & PX4IO_P_STATUS_FLAGS_ARM_SYNC)) {
|
||||||
r_status_flags = value;
|
r_status_flags = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PX4IO_P_STATUS_FLAGS_MIXER_OK & r_status_flags) {
|
||||||
|
|
||||||
|
/* update failsafe values, now that the mixer is set to ok */
|
||||||
|
mixer_set_failsafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user