Skip to content

Commit

Permalink
Fix ESC information rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveCEvans committed Feb 25, 2024
1 parent bca05ef commit 3e8d31c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/osd/osd_elements.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,21 @@ static int getEscRpmFreq(int i)

static void renderOsdEscRpmOrFreq(getEscRpmOrFreqFnPtr escFnPtr, osdElementParms_t *element)
{
static uint8_t motor = 0;
int x = element->elemPosX;
int y = element->elemPosY;
for (int i=0; i < getMotorCount(); i++) {
char rpmStr[6];
const int rpm = MIN((*escFnPtr)(i),99999);
const int len = tfp_sprintf(rpmStr, "%d", rpm);
rpmStr[len] = '\0';
osdDisplayWrite(element, x, y + i, DISPLAYPORT_SEVERITY_NORMAL, rpmStr);
char rpmStr[6];
const int rpm = MIN((*escFnPtr)(motor),99999);
const int len = tfp_sprintf(rpmStr, "%d", rpm);
rpmStr[len] = '\0';
osdDisplayWrite(element, x, y + motor, DISPLAYPORT_SEVERITY_NORMAL, rpmStr);

if (++motor == getMotorCount()) {
motor = 0;
} else {
element->rendered = false;
}

element->drawElement = false;
}
#endif
Expand Down

0 comments on commit 3e8d31c

Please sign in to comment.