feat: Convert PPM_UNIT build option to runtime radio setting (#3993)
This commit is contained in:
@@ -462,11 +462,11 @@ void drawSourceCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, source_t sou
|
||||
dc->drawNumber(x, y, calcRESXto100(value), flags);
|
||||
}
|
||||
else if (source <= MIXSRC_LAST_CH) {
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
dc->drawNumber(x, y, calcRESXto1000(value), flags|PREC1);
|
||||
#else
|
||||
dc->drawNumber(x, y, calcRESXto100(value), flags);
|
||||
#endif
|
||||
if (g_eeGeneral.ppmunit == PPM_PERCENT_PREC1) {
|
||||
dc->drawNumber(x, y, calcRESXto1000(value), flags|PREC1);
|
||||
} else {
|
||||
dc->drawNumber(x, y, calcRESXto100(value), flags);
|
||||
}
|
||||
}
|
||||
else {
|
||||
dc->drawNumber(x, y, value, flags);
|
||||
|
||||
@@ -773,6 +773,11 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
new StaticText(line, rect_t{}, STR_UNITS_SYSTEM, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(line, rect_t{}, STR_VUNITSSYSTEM, 0, 1, GET_SET_DEFAULT(g_eeGeneral.imperial));
|
||||
|
||||
// PPM units
|
||||
line = window->newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_UNITS_PPM, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(line, rect_t{}, STR_PPMUNIT, PPM_PERCENT_PREC0, PPM_PERCENT_PREC1, GET_SET_DEFAULT(g_eeGeneral.ppmunit));
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
/* case ITEM_SETUP_FAI:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "FAI Mode");
|
||||
|
||||
@@ -49,12 +49,6 @@ static const lv_coord_t col_dsc[] = {LV_GRID_FR(7), LV_GRID_FR(15), LV_GRID_FR(9
|
||||
|
||||
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
#define PPM_PRECISION PREC1
|
||||
#else
|
||||
#define PPM_PRECISION 0
|
||||
#endif
|
||||
|
||||
void RadioTrainerPage::build(FormWindow * form)
|
||||
{
|
||||
FlexGridLayout grid(col_dsc, row_dsc, 2);
|
||||
@@ -85,9 +79,13 @@ void RadioTrainerPage::build(FormWindow * form)
|
||||
line->padBottom(8);
|
||||
#endif
|
||||
|
||||
LcdFlags flags = LEFT | COLOR_THEME_PRIMARY1;
|
||||
if (g_eeGeneral.ppmunit == PPM_PERCENT_PREC1)
|
||||
flags |= PREC1;
|
||||
|
||||
new DynamicNumber<int16_t>(line, rect_t{},
|
||||
[=]() { return (trainerInput[i] - g_eeGeneral.trainer.calib[i]) * 2; },
|
||||
LEFT | PPM_PRECISION | COLOR_THEME_PRIMARY1);
|
||||
flags);
|
||||
}
|
||||
|
||||
auto line = form->newLine(&grid);
|
||||
|
||||
Reference in New Issue
Block a user