aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/px4io.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/px4io/px4io.h')
-rw-r--r--apps/px4io/px4io.h57
1 files changed, 42 insertions, 15 deletions
diff --git a/apps/px4io/px4io.h b/apps/px4io/px4io.h
index ad10961b4..1c9d11e99 100644
--- a/apps/px4io/px4io.h
+++ b/apps/px4io/px4io.h
@@ -70,49 +70,75 @@ struct sys_state_s {
bool armed; /* IO armed */
bool arm_ok; /* FMU says OK to arm */
+ uint16_t servo_rate; /* output rate of servos in Hz */
- /*
+ /**
* Data from the remote control input(s)
*/
unsigned rc_channels;
uint16_t rc_channel_data[PX4IO_INPUT_CHANNELS];
uint64_t rc_channels_timestamp;
- /*
+ /**
* Control signals from FMU.
*/
uint16_t fmu_channel_data[PX4IO_OUTPUT_CHANNELS];
- /*
+ /**
* Mixed servo outputs
*/
uint16_t servos[IO_SERVO_COUNT];
- /*
+ /**
* Relay controls
*/
bool relays[PX4IO_RELAY_CHANNELS];
- /*
- * If true, we are using the FMU controls.
+ /**
+ * If true, we are using the FMU controls, else RC input if available.
*/
- bool mixer_use_fmu;
+ bool mixer_manual_override;
- /*
+ /**
+ * If true, FMU input is available.
+ */
+ bool mixer_fmu_available;
+
+ /**
* If true, state that should be reported to FMU has been updated.
*/
bool fmu_report_due;
- /*
- * If true, new control data from the FMU has been received.
+ /**
+ * Last FMU receive time, in microseconds since system boot
*/
- bool fmu_data_received;
+ uint64_t fmu_data_received_time;
- /*
+ /**
* Current serial interface mode, per the serial_rx_mode parameter
* in the config packet.
*/
uint8_t serial_rx_mode;
+
+ /**
+ * If true, the RC signal has been lost for more than a timeout interval
+ */
+ bool rc_lost;
+
+ /**
+ * If true, the connection to FMU has been lost for more than a timeout interval
+ */
+ bool fmu_lost;
+
+ /**
+ * If true, FMU is ready for autonomous position control. Only used for LED indication
+ */
+ bool vector_flight_mode_ok;
+
+ /**
+ * If true, IO performs an on-board manual override with the RC channel values
+ */
+ bool manual_override_ok;
};
extern struct sys_state_s system_state;
@@ -140,8 +166,8 @@ extern volatile int timers[TIMER_NUM_TIMERS];
#define LED_SAFETY(_s) stm32_gpiowrite(GPIO_LED3, !(_s))
#define POWER_SERVO(_s) stm32_gpiowrite(GPIO_SERVO_PWR_EN, (_s))
-#define POWER_ACC1(_s) stm32_gpiowrite(GPIO_SERVO_ACC1_EN, (_s))
-#define POWER_ACC2(_s) stm32_gpiowrite(GPIO_SERVO_ACC2_EN, (_s))
+#define POWER_ACC1(_s) stm32_gpiowrite(GPIO_ACC1_PWR_EN, (_s))
+#define POWER_ACC2(_s) stm32_gpiowrite(GPIO_ACC2_PWR_EN, (_s))
#define POWER_RELAY1(_s) stm32_gpiowrite(GPIO_RELAY1_EN, (_s))
#define POWER_RELAY2(_s) stm32_gpiowrite(GPIO_RELAY2_EN, (_s))
@@ -172,7 +198,8 @@ extern void controls_main(void);
extern int dsm_init(const char *device);
extern bool dsm_input(void);
extern int sbus_init(const char *device);
-extern bool sbus_input(void);
+extern bool sbus_input(int fd, unsigned max_channels, uint16_t *channel_data, unsigned *channel_count,
+ uint64_t *receive_time, bool *updated);
/*
* Assertion codes