mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
Merge pull request #4351 from Jahnkeanater/patch-1
VTX color based on frequency
This commit is contained in:
commit
45596fc20b
1 changed files with 18 additions and 6 deletions
|
@ -646,12 +646,24 @@ static void applyLedVtxLayer(bool updateNow, timeUs_t *timer)
|
||||||
}
|
}
|
||||||
else { // show frequency
|
else { // show frequency
|
||||||
// calculate the VTX color based on frequency
|
// calculate the VTX color based on frequency
|
||||||
int hue = constrain((frequency - 5645.0 ) * 1.2, 0, 360);
|
if (frequency <= 5672) {
|
||||||
// if we ever want to wrap the hue around the wheel for L band frequencies...
|
color = HSV(WHITE);
|
||||||
//hue = (hue+(hue<0)*((0-hue)/360+1)*361)%361;
|
} else if (frequency <= 5711) {
|
||||||
color.h = hue;
|
color = HSV(RED);
|
||||||
color.s = 0;
|
} else if (frequency <= 5750) {
|
||||||
color.v = pit ? (blink ? 15 : 0) : 255; // blink when in pit mode`
|
color = HSV(ORANGE);
|
||||||
|
} else if (frequency <= 5789) {
|
||||||
|
color = HSV(YELLOW);
|
||||||
|
} else if (frequency <= 5829) {
|
||||||
|
color = HSV(GREEN);
|
||||||
|
} else if (frequency <= 5867) {
|
||||||
|
color = HSV(BLUE);
|
||||||
|
} else if (frequency <= 5906) {
|
||||||
|
color = HSV(DARK_VIOLET);
|
||||||
|
} else {
|
||||||
|
color = HSV(MAGENTA);
|
||||||
|
}
|
||||||
|
color.v = pit ? (blink ? 15 : 0) : 255; // blink when in pit mode
|
||||||
applyLedHsv(LED_MOV_OVERLAY(LED_FLAG_OVERLAY(LED_OVERLAY_VTX)), &color);
|
applyLedHsv(LED_MOV_OVERLAY(LED_FLAG_OVERLAY(LED_OVERLAY_VTX)), &color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue