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

Update LED throttle mode to use rcData instead of rcThrottle, avoid

having to reference min/maxThrottle.

Range was not being calculated correctly.

Throttle color now blends with the current color of the LED so that at
mid throttle any orientation color is still correct when mixing Throttle
and Flight Mode on an LED.

Fix tabs.  Reduce nesting level.
This commit is contained in:
Dominic Clifton 2014-09-19 01:46:41 +01:00
parent 9723df947e
commit d904741f43
4 changed files with 20 additions and 6 deletions

View file

@ -643,15 +643,21 @@ void applyLedIndicatorLayer(uint8_t indicatorFlashState)
void applyLedThrottleLayer()
{
const ledConfig_t *ledConfig;
hsvColor_t color;
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);
}
ledConfig = &ledConfigs[ledIndex];
if(!(ledConfig->flags & LED_FUNCTION_THROTTLE)) {
continue;
}
getLedHsv(ledIndex, &color);
int scaled = scaleRange(rcData[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX, -60, +60);
scaled += HSV_HUE_MAX;
color.h = scaled % HSV_HUE_MAX;
setLedHsv(ledIndex, &color);
}
}