Breathe animation, led solid on arming

This commit is contained in:
Lorenz Meier 2014-11-16 01:21:47 +01:00
parent 8583cf4dcc
commit 8caada2188
2 changed files with 13 additions and 3 deletions

View File

@ -134,6 +134,12 @@ ring_blink(void)
{
#ifdef GPIO_LED4
if (/* IO armed */ (r_status_flags & PX4IO_P_STATUS_FLAGS_SAFETY_OFF)
/* and FMU is armed */ && (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED)) {
LED_RING(1);
return;
}
// XXX this led code does have
// intentionally a few magic numbers.
const unsigned max_brightness = 118;
@ -147,7 +153,11 @@ ring_blink(void)
bool on = ((on_counter * 100) / brightness_counter+1) <= ((brightness * 100) / max_brightness+1);
LED_RING(on);
// XXX once led is PWM driven,
// remove the ! in the line below
// to return to the proper breathe
// animation / pattern (currently inverted)
LED_RING(!on);
brightness_counter++;
if (on) {
@ -349,7 +359,7 @@ user_start(int argc, char *argv[])
heartbeat_blink();
}
ring_blink();
ring_blink();
check_reboot();

View File

@ -140,7 +140,7 @@ extern pwm_limit_t pwm_limit;
#define LED_BLUE(_s) stm32_gpiowrite(GPIO_LED1, !(_s))
#define LED_AMBER(_s) stm32_gpiowrite(GPIO_LED2, !(_s))
#define LED_SAFETY(_s) stm32_gpiowrite(GPIO_LED3, !(_s))
#define LED_RING(_s) stm32_gpiowrite(GPIO_LED4, !(_s))
#define LED_RING(_s) stm32_gpiowrite(GPIO_LED4, (_s))
#ifdef CONFIG_ARCH_BOARD_PX4IO_V1