mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 09:45:33 +03:00
Canvas OSD was already correct for AHI
Reverted changes for canvas OSD. The fix now only affects character based OSDs.
This commit is contained in:
parent
61951e044c
commit
2c98f3de6f
5 changed files with 14 additions and 20 deletions
|
@ -329,7 +329,7 @@ void osdDrawArtificialHorizonLine(displayCanvas_t *canvas, float pitchAngle, flo
|
||||||
displayCanvasContextPop(canvas);
|
displayCanvasContextPop(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool osdCanvasDrawArtificialHorizonWidget(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float pitchAngle, float rollAngle, bool isInverted)
|
static bool osdCanvasDrawArtificialHorizonWidget(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float pitchAngle, float rollAngle)
|
||||||
{
|
{
|
||||||
UNUSED(display);
|
UNUSED(display);
|
||||||
UNUSED(p);
|
UNUSED(p);
|
||||||
|
@ -346,10 +346,7 @@ static bool osdCanvasDrawArtificialHorizonWidget(displayPort_t *display, display
|
||||||
int ahiX = (canvas->width - ahiWidth) / 2;
|
int ahiX = (canvas->width - ahiWidth) / 2;
|
||||||
int ahiHeight = osdConfig()->ahi_height;
|
int ahiHeight = osdConfig()->ahi_height;
|
||||||
int ahiY = ((canvas->height - ahiHeight) / 2);
|
int ahiY = ((canvas->height - ahiHeight) / 2);
|
||||||
if (isInverted)
|
ahiY += osdConfig()->ahi_vertical_offset;
|
||||||
ahiY -= osdConfig()->ahi_vertical_offset;
|
|
||||||
else
|
|
||||||
ahiY += osdConfig()->ahi_vertical_offset;
|
|
||||||
|
|
||||||
if (ahiY < 0) {
|
if (ahiY < 0) {
|
||||||
ahiY = 0;
|
ahiY = 0;
|
||||||
|
@ -402,7 +399,7 @@ static bool osdCanvasDrawArtificialHorizonWidget(displayPort_t *display, display
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void osdCanvasDrawArtificialHorizon(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float pitchAngle, float rollAngle, bool isInverted)
|
void osdCanvasDrawArtificialHorizon(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float pitchAngle, float rollAngle)
|
||||||
{
|
{
|
||||||
UNUSED(display);
|
UNUSED(display);
|
||||||
UNUSED(p);
|
UNUSED(p);
|
||||||
|
@ -417,7 +414,7 @@ void osdCanvasDrawArtificialHorizon(displayPort_t *display, displayCanvas_t *can
|
||||||
float totalError = fabsf(prevPitchAngle - pitchAngle) + fabsf(prevRollAngle - rollAngle);
|
float totalError = fabsf(prevPitchAngle - pitchAngle) + fabsf(prevRollAngle - rollAngle);
|
||||||
if ((now > nextDrawMinMs && totalError > 0.05f)|| now > nextDrawMaxMs) {
|
if ((now > nextDrawMinMs && totalError > 0.05f)|| now > nextDrawMaxMs) {
|
||||||
|
|
||||||
if (!osdCanvasDrawArtificialHorizonWidget(display, canvas, p, pitchAngle, rollAngle, isInverted)) {
|
if (!osdCanvasDrawArtificialHorizonWidget(display, canvas, p, pitchAngle, rollAngle)) {
|
||||||
switch ((osd_ahi_style_e)osdConfig()->ahi_style) {
|
switch ((osd_ahi_style_e)osdConfig()->ahi_style) {
|
||||||
case OSD_AHI_STYLE_DEFAULT:
|
case OSD_AHI_STYLE_DEFAULT:
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,6 @@ typedef struct osdDrawPoint_s osdDrawPoint_t;
|
||||||
|
|
||||||
void osdCanvasDrawVario(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float zvel);
|
void osdCanvasDrawVario(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float zvel);
|
||||||
void osdCanvasDrawDirArrow(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float degrees);
|
void osdCanvasDrawDirArrow(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float degrees);
|
||||||
void osdCanvasDrawArtificialHorizon(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float pitchAngle, float rollAngle, bool isInverted);
|
void osdCanvasDrawArtificialHorizon(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, float pitchAngle, float rollAngle);
|
||||||
void osdCanvasDrawHeadingGraph(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, int heading);
|
void osdCanvasDrawHeadingGraph(displayPort_t *display, displayCanvas_t *canvas, const osdDrawPoint_t *p, int heading);
|
||||||
bool osdCanvasDrawSidebars(displayPort_t *display, displayCanvas_t *canvas);
|
bool osdCanvasDrawSidebars(displayPort_t *display, displayCanvas_t *canvas);
|
||||||
|
|
|
@ -147,21 +147,19 @@ void osdDrawArtificialHorizon(displayPort_t *display, displayCanvas_t *canvas, c
|
||||||
{
|
{
|
||||||
uint8_t gx;
|
uint8_t gx;
|
||||||
uint8_t gy;
|
uint8_t gy;
|
||||||
bool isInverted = false;
|
|
||||||
|
|
||||||
// Correct pitch when inverted
|
|
||||||
if (rollAngle < -1.570796f || rollAngle > 1.570796f) {
|
|
||||||
isInverted = true;
|
|
||||||
pitchAngle = -pitchAngle;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(USE_CANVAS)
|
#if defined(USE_CANVAS)
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
osdCanvasDrawArtificialHorizon(display, canvas, p, pitchAngle, rollAngle, isInverted);
|
osdCanvasDrawArtificialHorizon(display, canvas, p, pitchAngle, rollAngle);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
// Correct pitch when inverted
|
||||||
|
if (rollAngle < -1.570796f || rollAngle > 1.570796f) {
|
||||||
|
pitchAngle = -pitchAngle;
|
||||||
|
}
|
||||||
|
|
||||||
osdDrawPointGetGrid(&gx, &gy, display, canvas, p);
|
osdDrawPointGetGrid(&gx, &gy, display, canvas, p);
|
||||||
osdGridDrawArtificialHorizon(display, gx, gy, pitchAngle, rollAngle, isInverted);
|
osdGridDrawArtificialHorizon(display, gx, gy, pitchAngle, rollAngle);
|
||||||
#if defined(USE_CANVAS)
|
#if defined(USE_CANVAS)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -109,11 +109,10 @@ static float osdGetAspectRatioCorrection(void)
|
||||||
return osdDisplayIsPAL() ? 12.0f/15.0f : 12.0f/18.46f;
|
return osdDisplayIsPAL() ? 12.0f/15.0f : 12.0f/18.46f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void osdGridDrawArtificialHorizon(displayPort_t *display, unsigned gx, unsigned gy, float pitchAngle, float rollAngle, bool isInverted)
|
void osdGridDrawArtificialHorizon(displayPort_t *display, unsigned gx, unsigned gy, float pitchAngle, float rollAngle)
|
||||||
{
|
{
|
||||||
UNUSED(gx);
|
UNUSED(gx);
|
||||||
UNUSED(gy);
|
UNUSED(gy);
|
||||||
UNUSED(isInverted);
|
|
||||||
|
|
||||||
uint8_t elemPosX;
|
uint8_t elemPosX;
|
||||||
uint8_t elemPosY;
|
uint8_t elemPosY;
|
||||||
|
|
|
@ -30,6 +30,6 @@ typedef struct displayPort_s displayPort_t;
|
||||||
|
|
||||||
void osdGridDrawVario(displayPort_t *display, unsigned gx, unsigned gy, float zvel);
|
void osdGridDrawVario(displayPort_t *display, unsigned gx, unsigned gy, float zvel);
|
||||||
void osdGridDrawDirArrow(displayPort_t *display, unsigned gx, unsigned gy, float degrees);
|
void osdGridDrawDirArrow(displayPort_t *display, unsigned gx, unsigned gy, float degrees);
|
||||||
void osdGridDrawArtificialHorizon(displayPort_t *display, unsigned gx, unsigned gy, float pitchAngle, float rollAngle, bool isInverted);
|
void osdGridDrawArtificialHorizon(displayPort_t *display, unsigned gx, unsigned gy, float pitchAngle, float rollAngle);
|
||||||
void osdGridDrawHeadingGraph(displayPort_t *display, unsigned gx, unsigned gy, int heading);
|
void osdGridDrawHeadingGraph(displayPort_t *display, unsigned gx, unsigned gy, int heading);
|
||||||
void osdGridDrawSidebars(displayPort_t *display);
|
void osdGridDrawSidebars(displayPort_t *display);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue