mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 06:14:14 +08:00
IO: Allow control of the blue led state as function of a Pixhawk 2.1 heater
This commit is contained in:
committed by
Lorenz Meier
parent
4b6a11161e
commit
9f14ace0fa
@@ -244,6 +244,11 @@ enum { /* DSM bind states */
|
||||
|
||||
#define PX4IO_P_SETUP_MOTOR_SLEW_MAX 24 /* max motor slew rate */
|
||||
|
||||
#define PX4IO_P_SETUP_THERMAL 25 /* thermal management */
|
||||
#define PX4IO_THERMAL_IGNORE UINT16_MAX
|
||||
#define PX4IO_THERMAL_OFF 0
|
||||
#define PX4IO_THERMAL_FULL 10000
|
||||
|
||||
/* autopilot control values, -10000..10000 */
|
||||
#define PX4IO_PAGE_CONTROLS 51 /**< actuator control groups, one after the other, 8 wide */
|
||||
#define PX4IO_P_CONTROLS_GROUP_0 (PX4IO_PROTOCOL_MAX_CONTROL_COUNT * 0) /**< 0..PX4IO_PROTOCOL_MAX_CONTROL_COUNT - 1 */
|
||||
|
||||
@@ -376,21 +376,36 @@ user_start(int argc, char *argv[])
|
||||
controls_tick();
|
||||
perf_end(controls_perf);
|
||||
|
||||
/*
|
||||
blink blue LED at 4Hz in normal operation. When in
|
||||
override blink 4x faster so the user can clearly see
|
||||
that override is happening. This helps when
|
||||
pre-flight testing the override system
|
||||
/* some boards such as Pixhawk 2.1 made
|
||||
the unfortunate choice to combine the blue led channel with
|
||||
the IMU heater. We need a software hack to fix the hardware hack
|
||||
by allowing to disable the LED / heater.
|
||||
*/
|
||||
uint32_t heartbeat_period_us = 250 * 1000UL;
|
||||
if (r_page_setup[PX4IO_P_SETUP_THERMAL] == PX4IO_THERMAL_IGNORE) {
|
||||
/*
|
||||
blink blue LED at 4Hz in normal operation. When in
|
||||
override blink 4x faster so the user can clearly see
|
||||
that override is happening. This helps when
|
||||
pre-flight testing the override system
|
||||
*/
|
||||
uint32_t heartbeat_period_us = 250 * 1000UL;
|
||||
|
||||
if (r_status_flags & PX4IO_P_STATUS_FLAGS_OVERRIDE) {
|
||||
heartbeat_period_us /= 4;
|
||||
}
|
||||
if (r_status_flags & PX4IO_P_STATUS_FLAGS_OVERRIDE) {
|
||||
heartbeat_period_us /= 4;
|
||||
}
|
||||
|
||||
if ((hrt_absolute_time() - last_heartbeat_time) > heartbeat_period_us) {
|
||||
last_heartbeat_time = hrt_absolute_time();
|
||||
heartbeat_blink();
|
||||
if ((hrt_absolute_time() - last_heartbeat_time) > heartbeat_period_us) {
|
||||
last_heartbeat_time = hrt_absolute_time();
|
||||
heartbeat_blink();
|
||||
}
|
||||
|
||||
} else if (r_page_setup[PX4IO_P_SETUP_THERMAL] < PX4IO_THERMAL_FULL) {
|
||||
/* switch resistive heater off */
|
||||
LED_BLUE(false);
|
||||
|
||||
} else {
|
||||
/* switch resistive heater hard on */
|
||||
LED_BLUE(true);
|
||||
}
|
||||
|
||||
ring_blink();
|
||||
|
||||
@@ -181,7 +181,8 @@ volatile uint16_t r_page_setup[] = {
|
||||
[PX4IO_P_SETUP_SCALE_ROLL] = 10000,
|
||||
[PX4IO_P_SETUP_SCALE_PITCH] = 10000,
|
||||
[PX4IO_P_SETUP_SCALE_YAW] = 10000,
|
||||
[PX4IO_P_SETUP_MOTOR_SLEW_MAX] = 0
|
||||
[PX4IO_P_SETUP_MOTOR_SLEW_MAX] = 0,
|
||||
[PX4IO_P_SETUP_THERMAL] = PX4IO_THERMAL_IGNORE
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4IO_V2
|
||||
|
||||
Reference in New Issue
Block a user