Prevent led strip code from calling vtx api when vtx is absent

This commit is contained in:
jflyper 2017-11-11 11:12:02 +09:00
parent 0c84506336
commit b03781c9bb
1 changed files with 6 additions and 6 deletions

View File

@ -586,14 +586,18 @@ static void applyLedVtxLayer(bool updateNow, timeUs_t *timer)
static uint8_t pit = 255;
static uint8_t showSettings = false;
static uint16_t lastCheck = 0;
static bool active = false;
static bool blink = false;
if (!vtxCommonDeviceRegistered()) {
return;
}
uint8_t band = 255, channel = 255;
uint16_t check = 0;
if (updateNow) {
// keep counter running, so it stays in sync with vtx
active = vtxCommonGetBandAndChannel(&band, &channel);
vtxCommonGetBandAndChannel(&band, &channel);
vtxCommonGetPowerIndex(&power);
vtxCommonGetPitMode(&pit);
@ -614,10 +618,6 @@ static void applyLedVtxLayer(bool updateNow, timeUs_t *timer)
*timer += HZ_TO_US(5); // check 5 times a second
}
if (!active) { // no vtx device detected
return;
}
hsvColor_t color = {0, 0, 0};
if (showSettings) { // show settings
uint8_t vtxLedCount = 0;