mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Add LED profile feature - 4278
This commit is contained in:
parent
e0fc9300ed
commit
4ec536a317
15 changed files with 333 additions and 101 deletions
|
@ -42,6 +42,7 @@
|
|||
#include "flight/pid.h"
|
||||
|
||||
#include "io/beeper.h"
|
||||
#include "io/ledstrip.h"
|
||||
#include "io/motors.h"
|
||||
#include "io/pidaudio.h"
|
||||
#include "io/osd.h"
|
||||
|
@ -242,6 +243,10 @@ static const adjustmentConfig_t defaultAdjustmentConfigs[ADJUSTMENT_FUNCTION_COU
|
|||
.adjustmentFunction = ADJUSTMENT_OSD_PROFILE,
|
||||
.mode = ADJUSTMENT_MODE_SELECT,
|
||||
.data = { .switchPositions = 3 }
|
||||
}, {
|
||||
.adjustmentFunction = ADJUSTMENT_LED_PROFILE,
|
||||
.mode = ADJUSTMENT_MODE_SELECT,
|
||||
.data = { .switchPositions = 3 }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -665,11 +670,20 @@ static uint8_t applySelectAdjustment(adjustmentFunction_e adjustmentFunction, ui
|
|||
}
|
||||
#endif
|
||||
break;
|
||||
#ifdef USE_OSD_PROFILES
|
||||
case ADJUSTMENT_OSD_PROFILE:
|
||||
#ifdef USE_OSD_PROFILES
|
||||
if (getCurrentOsdProfileIndex() != (position + 1)) {
|
||||
changeOsdProfileIndex(position+1);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ADJUSTMENT_LED_PROFILE:
|
||||
#ifdef USE_LED_STRIP
|
||||
#ifndef UNIT_TEST
|
||||
if (getLedProfile() != position) {
|
||||
setLedProfile(position);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -793,6 +807,9 @@ void processRcAdjustments(controlRateConfig_t *controlRateConfig)
|
|||
&& adjustmentState->config->adjustmentFunction != ADJUSTMENT_RATE_PROFILE // Rate profile already has an OSD element
|
||||
#ifdef USE_OSD_PROFILES
|
||||
&& adjustmentState->config->adjustmentFunction != ADJUSTMENT_OSD_PROFILE
|
||||
#endif
|
||||
#ifdef USE_LED_STRIP
|
||||
&& adjustmentState->config->adjustmentFunction != ADJUSTMENT_LED_PROFILE
|
||||
#endif
|
||||
) {
|
||||
adjustmentRangeNameIndex = adjustmentFunction;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue