1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Merge pull request #83 from goebish/cleanflight-throttle-led

Throttle level indicator led mode
This commit is contained in:
Dominic Clifton 2014-09-19 00:18:55 +01:00
commit 9723df947e
4 changed files with 28 additions and 3 deletions

View file

@ -258,13 +258,14 @@ static const uint8_t directionMappings[DIRECTION_COUNT] = {
LED_DIRECTION_DOWN
};
static const char functionCodes[] = { 'I', 'W', 'F', 'A' };
static const char functionCodes[] = { 'I', 'W', 'F', 'A', 'T' };
#define FUNCTION_COUNT (sizeof(functionCodes) / sizeof(functionCodes[0]))
static const uint16_t functionMappings[FUNCTION_COUNT] = {
LED_FUNCTION_INDICATOR,
LED_FUNCTION_WARNING,
LED_FUNCTION_FLIGHT_MODE,
LED_FUNCTION_ARM_STATE
LED_FUNCTION_ARM_STATE,
LED_FUNCTION_THROTTLE
};
// grid offsets
@ -639,6 +640,21 @@ void applyLedIndicatorLayer(uint8_t indicatorFlashState)
}
}
void applyLedThrottleLayer()
{
const ledConfig_t *ledConfig;
uint8_t ledIndex;
for (ledIndex = 0; ledIndex < ledCount; ledIndex++) {
ledConfig = &ledConfigs[ledIndex];
if(ledConfig->flags & LED_FUNCTION_THROTTLE) {
int hue = scaleRange(rcCommand[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX, hsv_lightBlue.h, hsv_red.h);
hsvColor_t color = {hue , 0 , 255};
setLedHsv(ledIndex, &color);
}
}
}
static uint8_t frameCounter = 0;
static uint8_t previousRow;
@ -706,6 +722,7 @@ void updateLedStrip(void)
// LAYER 1
applyLedModeLayer();
applyLedThrottleLayer();
// LAYER 2