32#include "generated/airframe.h"
35#ifdef LIGHT_SCHEDULER_ALERT_HEADER
36#include LIGHT_SCHEDULER_ALERT_HEADER
39#ifndef LIGHT_SCHEDULER_MODE
40#define LIGHT_SCHEDULER_MODE LIGHT_SCHEDULER_MODE_RAINBOW
43#ifndef LIGHT_SCHEDULER_RED
44#define LIGHT_SCHEDULER_RED 255
47#ifndef LIGHT_SCHEDULER_GREEN
48#define LIGHT_SCHEDULER_GREEN 255
51#ifndef LIGHT_SCHEDULER_BLUE
52#define LIGHT_SCHEDULER_BLUE 255
55#ifndef LIGHT_SCHEDULER_BRIGHTNESS
56#define LIGHT_SCHEDULER_BRIGHTNESS 255
60#ifndef LIGHT_SCHEDULER_COLOR
61#define LIGHT_SCHEDULER_COLOR LIGHT_SCHEDULER_COLOR_CUSTOM
65#ifndef LIGHT_SCHEDULER_ALERT_COLOR
66#define LIGHT_SCHEDULER_ALERT_COLOR LIGHT_SCHEDULER_COLOR_RED
70#ifndef LIGHT_SCHEDULER_ALERT_SPARKLE
71#define LIGHT_SCHEDULER_ALERT_SPARKLE FALSE
127 static const uint8_t palette[] = {
134 if ((r >> 8) % 5 == 0) {
169#ifdef LIGHT_SCHEDULER_ALERT
#define LIGHT_SCHEDULER_ALERT_COLOR
Alert color, shown in every mode while LIGHT_SCHEDULER_ALERT is true.
uint8_t light_scheduler_green
green value in color mode
#define LIGHT_SCHEDULER_RED
uint8_t light_scheduler_color
selected preset (light_scheduler_color_t)
static void light_scheduler_sparkle(void)
Sparkle: every led takes a random bright color, with white twinkles and short dark blinks.
#define LIGHT_SCHEDULER_BRIGHTNESS
uint8_t light_scheduler_mode
one of LIGHT_SCHEDULER_MODE_*
static const uint8_t light_scheduler_presets[LIGHT_SCHEDULER_COLOR_FLAG_FIRST][3]
RGB values of the single color presets.
uint8_t light_scheduler_blue
blue value in color mode
#define LIGHT_SCHEDULER_ALERT_SPARKLE
Show the sparkle effect instead of the alert color while LIGHT_SCHEDULER_ALERT is true.
#define LIGHT_SCHEDULER_BLUE
void light_scheduler_set_color(uint8_t color)
Settings handler: apply a color preset to red/green/blue (or select a flag) and switch to color mode.
static void light_scheduler_set(uint32_t n, uint8_t r, uint8_t g, uint8_t b)
set one led, scaled by the brightness setting
static uint32_t sparkle_rand(void)
xorshift32 pseudo random numbers for the sparkle effect
uint8_t light_scheduler_red
red value in color mode
#define LIGHT_SCHEDULER_MODE
Optional header needed by the alert condition.
void light_scheduler_init(void)
void light_scheduler_periodic(void)
static uint32_t sparkle_seed
#define LIGHT_SCHEDULER_COLOR
Startup color preset, overrides LIGHT_SCHEDULER_RED/GREEN/BLUE when not custom.
static const uint8_t light_scheduler_flags[LIGHT_SCHEDULER_COLOR_NB - LIGHT_SCHEDULER_COLOR_FLAG_FIRST][3]
Flags: three color presets, from the first to the last led of a strip.
#define LIGHT_SCHEDULER_GREEN
uint8_t light_scheduler_brightness
brightness scaling (255 = full)
basic LED scheduler based on WS2812 RGB led driver
#define LIGHT_SCHEDULER_COLOR_FLAG_FIRST
#define LIGHT_SCHEDULER_MODE_SPARKLE
@ LIGHT_SCHEDULER_COLOR_BLUE
@ LIGHT_SCHEDULER_COLOR_FLAG_ITALY
first flag, red | white | green
@ LIGHT_SCHEDULER_COLOR_FLAG_FRANCE
blue | white | red
@ LIGHT_SCHEDULER_COLOR_GREEN
@ LIGHT_SCHEDULER_COLOR_WHITE
@ LIGHT_SCHEDULER_COLOR_ORANGE
@ LIGHT_SCHEDULER_COLOR_PURPLE
@ LIGHT_SCHEDULER_COLOR_FLAG_NETHERLANDS
red | white | blue
@ LIGHT_SCHEDULER_COLOR_YELLOW
@ LIGHT_SCHEDULER_COLOR_NB
@ LIGHT_SCHEDULER_COLOR_CUSTOM
@ LIGHT_SCHEDULER_COLOR_RED
@ LIGHT_SCHEDULER_COLOR_CYAN
@ LIGHT_SCHEDULER_COLOR_MAGENTA
#define LIGHT_SCHEDULER_MODE_COLOR
#define LIGHT_SCHEDULER_MODE_OFF
void light_ws2812_arch_set(uint32_t led_number, uint8_t r, uint8_t g, uint8_t b)
set color RGB color of one led
void light_ws2812_arch_init(void)
ws2812 driver based on ChibiOS
#define WS2812_NB_LEDS
Number of LEDs.
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.