feat(radio): modify Sensor Edit screens to show Ratio + Percentage (#4649)

This commit is contained in:
Frankie Arzu
2024-05-29 13:08:42 +10:00
committed by GitHub
parent 5d20c81126
commit c19f6402d0
5 changed files with 119 additions and 10 deletions
@@ -234,10 +234,15 @@ void menuModelSensor(event_t event)
else {
lcdDrawTextAlignedLeft(y, STR_RATIO);
if (attr) sensor->custom.ratio = checkIncDec(event, sensor->custom.ratio, 0, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10);
if (sensor->custom.ratio == 0)
if (sensor->custom.ratio == 0) {
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
else
} else { // Ratio + Ratio Percent
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr|PREC1);
uint32_t ratio = (sensor->custom.ratio * 1000) / 255;
int ratio_len = countDigits(ratio);
lcdDrawNumber(SENSOR_3RD_COLUMN, y, ratio, LEFT|PREC1);
lcdDrawChar(SENSOR_3RD_COLUMN+(FWNUM*ratio_len)+3, y, '%', 0);
}
break;
}
}