mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Enable using of any RC channel to set the color hue modifier.
Can be set via MSP (bumped to version 22) New CLI command: mode_color 7 0 AUX_Channel AUX_Channel: ROLL = 0 PITCH = 1 YAW = 2 THROTTLE = 3 AUX1 = 4 AUX2 = 5 AUX3 = 6 AUX4 = 7 AUX5 = 8 AUX6 = 9 AUX7 = 10 AUX8 = 11 Fixed CLI defaults printing for #1019.
This commit is contained in:
parent
bd1d96dff9
commit
431295ab21
7 changed files with 24 additions and 5 deletions
|
@ -170,6 +170,7 @@ static const specialColorIndexes_t defaultSpecialColors[] = {
|
|||
};
|
||||
|
||||
static int scaledThrottle;
|
||||
static int scaledAux;
|
||||
|
||||
static void updateLedRingCounts(void);
|
||||
|
||||
|
@ -253,7 +254,7 @@ bool parseLedStripConfig(int ledIndex, const char *config)
|
|||
RING_COLORS,
|
||||
PARSE_STATE_COUNT
|
||||
};
|
||||
static const char chunkSeparators[PARSE_STATE_COUNT] = {',', ':', ':',':', '\0'};
|
||||
static const char chunkSeparators[PARSE_STATE_COUNT] = {',', ':', ':', ':', '\0'};
|
||||
|
||||
ledConfig_t *ledConfig = &masterConfig.ledConfigs[ledIndex];
|
||||
memset(ledConfig, 0, sizeof(ledConfig_t));
|
||||
|
@ -492,7 +493,7 @@ static void applyLedFixedLayers()
|
|||
}
|
||||
|
||||
if (ledGetOverlayBit(ledConfig, LED_OVERLAY_THROTTLE)) {
|
||||
hOffset += ((scaledThrottle - 10) * 4) / 3;
|
||||
hOffset += scaledAux;
|
||||
}
|
||||
|
||||
color.h = (color.h + hOffset) % (HSV_HUE_MAX + 1);
|
||||
|
@ -962,6 +963,7 @@ void ledStripUpdate(uint32_t currentTime)
|
|||
// apply all layers; triggered timed functions has to update timers
|
||||
|
||||
scaledThrottle = ARMING_FLAG(ARMED) ? scaleRange(rcData[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX, 10, 100) : 10;
|
||||
scaledAux = scaleRange(rcData[masterConfig.ledstrip_aux_channel], PWM_RANGE_MIN, PWM_RANGE_MAX, 0, HSV_HUE_MAX + 1);
|
||||
|
||||
applyLedFixedLayers();
|
||||
|
||||
|
@ -1035,6 +1037,10 @@ bool setModeColor(ledModeIndex_e modeIndex, int modeColorIndex, int colorIndex)
|
|||
if (modeColorIndex < 0 || modeColorIndex >= LED_SPECIAL_COLOR_COUNT)
|
||||
return false;
|
||||
masterConfig.specialColors.color[modeColorIndex] = colorIndex;
|
||||
} else if (modeIndex == LED_AUX_CHANNEL) {
|
||||
if (modeColorIndex < 0 || modeColorIndex >= 1)
|
||||
return false;
|
||||
masterConfig.ledstrip_aux_channel = colorIndex;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue