mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 23:05:19 +03:00
Merge pull request #4538 from jflyper/bfdev-fix-4535
Prevent led strip code from calling vtx api when vtx is absent
This commit is contained in:
commit
16c4cfed3c
1 changed files with 6 additions and 6 deletions
|
@ -586,14 +586,18 @@ static void applyLedVtxLayer(bool updateNow, timeUs_t *timer)
|
||||||
static uint8_t pit = 255;
|
static uint8_t pit = 255;
|
||||||
static uint8_t showSettings = false;
|
static uint8_t showSettings = false;
|
||||||
static uint16_t lastCheck = 0;
|
static uint16_t lastCheck = 0;
|
||||||
static bool active = false;
|
|
||||||
static bool blink = false;
|
static bool blink = false;
|
||||||
|
|
||||||
|
if (!vtxCommonDeviceRegistered()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t band = 255, channel = 255;
|
uint8_t band = 255, channel = 255;
|
||||||
uint16_t check = 0;
|
uint16_t check = 0;
|
||||||
|
|
||||||
if (updateNow) {
|
if (updateNow) {
|
||||||
// keep counter running, so it stays in sync with vtx
|
// keep counter running, so it stays in sync with vtx
|
||||||
active = vtxCommonGetBandAndChannel(&band, &channel);
|
vtxCommonGetBandAndChannel(&band, &channel);
|
||||||
vtxCommonGetPowerIndex(&power);
|
vtxCommonGetPowerIndex(&power);
|
||||||
vtxCommonGetPitMode(&pit);
|
vtxCommonGetPitMode(&pit);
|
||||||
|
|
||||||
|
@ -614,10 +618,6 @@ static void applyLedVtxLayer(bool updateNow, timeUs_t *timer)
|
||||||
*timer += HZ_TO_US(5); // check 5 times a second
|
*timer += HZ_TO_US(5); // check 5 times a second
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!active) { // no vtx device detected
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
hsvColor_t color = {0, 0, 0};
|
hsvColor_t color = {0, 0, 0};
|
||||||
if (showSettings) { // show settings
|
if (showSettings) { // show settings
|
||||||
uint8_t vtxLedCount = 0;
|
uint8_t vtxLedCount = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue