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

Make Cppcheck happier revived (#13566)

Co-authored-by: Štěpán Dalecký <daleckystepan@gmail.com>
This commit is contained in:
Mark Haslinghuis 2024-05-10 05:23:32 +02:00 committed by GitHub
parent d5af7d2254
commit 5a28ce5129
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 145 additions and 157 deletions

View file

@ -796,7 +796,6 @@ static void applyLedVtxLayer(bool updateNow, timeUs_t *timer)
}
uint8_t band = 255, channel = 255;
uint16_t check = 0;
if (updateNow) {
// keep counter running, so it stays in sync with vtx
@ -807,7 +806,7 @@ static void applyLedVtxLayer(bool updateNow, timeUs_t *timer)
frequency = vtxCommonLookupFrequency(vtxDevice, band, channel);
// check if last vtx values have changed.
check = ((vtxStatus & VTX_STATUS_PIT_MODE) ? 1 : 0) + (power << 1) + (band << 4) + (channel << 8);
uint16_t check = ((vtxStatus & VTX_STATUS_PIT_MODE) ? 1 : 0) + (power << 1) + (band << 4) + (channel << 8);
if (!showSettings && check != lastCheck) {
// display settings for 3 seconds.
showSettings = 15;
@ -821,23 +820,21 @@ static void applyLedVtxLayer(bool updateNow, timeUs_t *timer)
*timer += HZ_TO_US(LED_OVERLAY_VTX_RATE_HZ);
}
hsvColor_t color = {0, 0, 0};
if (showSettings) { // show settings
uint8_t vtxLedCount = 0;
for (int i = 0; i < ledCounts.count && vtxLedCount < 6; ++i) {
const ledConfig_t *ledConfig = &ledStripStatusModeConfig()->ledConfigs[i];
if (ledGetOverlayBit(ledConfig, LED_OVERLAY_VTX)) {
hsvColor_t color = {0, 0, 0};
if (vtxLedCount == 0) {
color.h = HSV(GREEN).h;
color.s = HSV(GREEN).s;
color.v = blink ? 15 : 0; // blink received settings
}
else if (vtxLedCount > 0 && power >= vtxLedCount && !(vtxStatus & VTX_STATUS_PIT_MODE)) { // show power
} else if (vtxLedCount > 0 && power >= vtxLedCount && !(vtxStatus & VTX_STATUS_PIT_MODE)) { // show power
color.h = HSV(ORANGE).h;
color.s = HSV(ORANGE).s;
color.v = blink ? 15 : 0; // blink received settings
}
else { // turn rest off
} else { // turn rest off
color.h = HSV(BLACK).h;
color.s = HSV(BLACK).s;
color.v = HSV(BLACK).v;