From 8d6f48cddcbdbaf62f30a4e9e0d494c51edfb5ed Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Sun, 8 Jun 2014 04:37:11 +0100 Subject: [PATCH] Change LED strip colors based on flight mode. --- src/main/mw.c | 98 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 87 insertions(+), 11 deletions(-) diff --git a/src/main/mw.c b/src/main/mw.c index 0606901e39..f758105c77 100755 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -348,21 +348,84 @@ void updateInflightCalibrationState(void) } } +#define LED_RED {255, 0, 0 } +#define LED_GREEN {0, 255, 0 } +#define LED_BLUE {0, 0, 255} +#define LED_CYAN {0, 255, 255} +#define LED_YELLOW {255, 255, 0 } +#define LED_ORANGE {255, 128, 0 } +#define LED_PINK {255, 0, 128} +#define LED_PURPLE {192, 64, 255} + static const rgbColor24bpp_t stripOrientation[] = { - {{0, 255, 0}}, - {{0, 255, 0}}, - {{0, 255, 0}}, - {{0, 255, 0}}, - {{0, 255, 0}}, - - {{255, 0, 0}}, - {{255, 0, 0}}, - {{255, 0, 0}}, - {{255, 0, 0}}, - {{255, 0, 0}} + {LED_GREEN}, + {LED_GREEN}, + {LED_GREEN}, + {LED_GREEN}, + {LED_GREEN}, + {LED_RED}, + {LED_RED}, + {LED_RED}, + {LED_RED}, + {LED_RED} }; +static const rgbColor24bpp_t stripHorizon[] = +{ + {LED_BLUE}, + {LED_BLUE}, + {LED_BLUE}, + {LED_BLUE}, + {LED_BLUE}, + {LED_YELLOW}, + {LED_YELLOW}, + {LED_YELLOW}, + {LED_YELLOW}, + {LED_YELLOW} +}; + +static const rgbColor24bpp_t stripAngle[] = +{ + {LED_CYAN}, + {LED_CYAN}, + {LED_CYAN}, + {LED_CYAN}, + {LED_CYAN}, + {LED_YELLOW}, + {LED_YELLOW}, + {LED_YELLOW}, + {LED_YELLOW}, + {LED_YELLOW} +}; + +static const rgbColor24bpp_t stripMag[] = +{ + {LED_PURPLE}, + {LED_PURPLE}, + {LED_PURPLE}, + {LED_PURPLE}, + {LED_PURPLE}, + {LED_ORANGE}, + {LED_ORANGE}, + {LED_ORANGE}, + {LED_ORANGE}, + {LED_ORANGE} +}; + +static const rgbColor24bpp_t stripHeadfree[] = +{ + {LED_PINK}, + {LED_PINK}, + {LED_PINK}, + {LED_PINK}, + {LED_PINK}, + {LED_ORANGE}, + {LED_ORANGE}, + {LED_ORANGE}, + {LED_ORANGE}, + {LED_ORANGE} +}; static const rgbColor24bpp_t stripReds[] = { @@ -408,6 +471,19 @@ void updateLedStrip(void) setStripColors(stripReds); } + if (f.HORIZON_MODE) { + setStripColors(stripHorizon); + } else if (f.ANGLE_MODE) { + setStripColors(stripAngle); +#ifdef MAG + } else if (f.MAG_MODE) { + setStripColors(stripMag); +#endif + } else if (f.HEADFREE_MODE) { + setStripColors(stripHeadfree); + } + + // LAYER 2 if (batteryFlashNow) {