Skip to content

Commit

Permalink
Merge pull request #8717 from iNavFlight/dzikuvx-mah-scalig-bfcompat
Browse files Browse the repository at this point in the history
Disable mAh scaling for BF compatibility
  • Loading branch information
DzikuVx committed Jan 20, 2023
2 parents 37af691 + 45b56ad commit 8325080
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,14 +1626,22 @@ static bool osdDrawSingleElement(uint8_t item)
break;

case OSD_MAH_DRAWN: {
if (osdFormatCentiNumber(buff, getMAhDrawn() * 100, 1000, 0, (osdConfig()->mAh_used_precision - 2), osdConfig()->mAh_used_precision)) {
// Shown in mAh
buff[osdConfig()->mAh_used_precision] = SYM_AH;

if (isBfCompatibleVideoSystem(osdConfig())) {
//BFcompat is unable to work with scaled values and it only has mAh symbol to work with
tfp_sprintf(buff, "%4d", (int)getMAhDrawn());
buff[4] = SYM_MAH;
buff[5] = '\0';
} else {
// Shown in Ah
buff[osdConfig()->mAh_used_precision] = SYM_MAH;
if (osdFormatCentiNumber(buff, getMAhDrawn() * 100, 1000, 0, (osdConfig()->mAh_used_precision - 2), osdConfig()->mAh_used_precision)) {
// Shown in mAh
buff[osdConfig()->mAh_used_precision] = SYM_AH;
} else {
// Shown in Ah
buff[osdConfig()->mAh_used_precision] = SYM_MAH;
}
buff[(osdConfig()->mAh_used_precision + 1)] = '\0';
}
buff[(osdConfig()->mAh_used_precision + 1)] = '\0';
osdUpdateBatteryCapacityOrVoltageTextAttributes(&elemAttr);
break;
}
Expand Down

0 comments on commit 8325080

Please sign in to comment.