Quickly hack up implementation of turn indicators.
With an LED strip length of 10, arrange the leds clockwise from 1 to 10 starting with led 1 at the north west (10:30hrs) with led 5 north east (01:30hrs), led 6 south east and led 10 south west. When armed or not, moving the roll stick to the left will make the leds on the left flash, and same for right and also for pitch forwards and backwards too.
This commit is contained in:
parent
651a433718
commit
bad872377b
|
@ -45,6 +45,7 @@ static volatile uint8_t ws2811LedDataTransferInProgress = 0;
|
|||
static rgbColor24bpp_t ledColorBuffer[LED_STRIP_LENGTH];
|
||||
|
||||
const rgbColor24bpp_t black = { {0, 0, 0} };
|
||||
const rgbColor24bpp_t orange = { {255, 128, 0} };
|
||||
const rgbColor24bpp_t white = { {255, 255, 255} };
|
||||
|
||||
void setLedColor(uint16_t index, const rgbColor24bpp_t *color)
|
||||
|
|
|
@ -46,3 +46,4 @@ void setStripColors(const rgbColor24bpp_t *colors);
|
|||
|
||||
extern const rgbColor24bpp_t black;
|
||||
extern const rgbColor24bpp_t white;
|
||||
extern const rgbColor24bpp_t orange;
|
||||
|
|
|
@ -394,7 +394,10 @@ void updateLedStrip(void)
|
|||
|
||||
static uint8_t stripState = 0;
|
||||
|
||||
const rgbColor24bpp_t *flashColor;
|
||||
|
||||
if (stripState == 0) {
|
||||
flashColor = &orange;
|
||||
if (f.ARMED) {
|
||||
setStripColors(stripOrientation);
|
||||
} else {
|
||||
|
@ -402,12 +405,30 @@ void updateLedStrip(void)
|
|||
}
|
||||
stripState = 1;
|
||||
} else {
|
||||
flashColor = &black;
|
||||
if (feature(FEATURE_VBAT) && shouldSoundBatteryAlarm()) {
|
||||
setStripColor(&black);
|
||||
}
|
||||
stripState = 0;
|
||||
}
|
||||
|
||||
if (rcCommand[ROLL] < -100) {
|
||||
setLedColor(0, flashColor);
|
||||
setLedColor(9, flashColor);
|
||||
}
|
||||
if (rcCommand[ROLL] > 100) {
|
||||
setLedColor(4, flashColor);
|
||||
setLedColor(5, flashColor);
|
||||
}
|
||||
if (rcCommand[PITCH] > 100) {
|
||||
setLedColor(0, flashColor);
|
||||
setLedColor(4, flashColor);
|
||||
}
|
||||
if (rcCommand[PITCH] < -100) {
|
||||
setLedColor(5, flashColor);
|
||||
setLedColor(9, flashColor);
|
||||
}
|
||||
|
||||
ws2811UpdateStrip();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue