feat(colorlcd): Improve trainer page layout, use Add/Replace instead of +=/:= (#3104)
* Adjust trainer setup layout to better use space and avoid scrolling. * Adjust padding for landscape layout. * Change text for trainer mode to 'Add' and 'Replace' instead of '+=' and ':='. Adjust layout to fit. Copy translations from TR_VMLTPX strings.
This commit is contained in:
@@ -30,13 +30,15 @@ RadioTrainerPage::RadioTrainerPage():
|
||||
{
|
||||
}
|
||||
|
||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2),
|
||||
#if LCD_W > LCD_H
|
||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(7), LV_GRID_FR(13), LV_GRID_FR(10), LV_GRID_FR(10), LV_GRID_FR(10),
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
#if LCD_H >= LCD_W
|
||||
static const lv_coord_t col4_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
|
||||
LV_GRID_FR(1), LV_GRID_FR(1),
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
#define MULT_COL_CNT 3
|
||||
#else
|
||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(7), LV_GRID_FR(15), LV_GRID_FR(9), LV_GRID_FR(9),
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
#define MULT_COL_CNT 2
|
||||
#endif
|
||||
|
||||
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
||||
@@ -51,66 +53,61 @@ void RadioTrainerPage::build(FormWindow * form)
|
||||
{
|
||||
FlexGridLayout grid(col_dsc, row_dsc, 2);
|
||||
form->setFlexLayout();
|
||||
form->padAll(4);
|
||||
#if LCD_W > LCD_H
|
||||
form->padLeft(8);
|
||||
form->padRight(8);
|
||||
#endif
|
||||
|
||||
for (uint8_t i = 0; i < NUM_STICKS; i++) {
|
||||
uint8_t chan = channelOrder(i + 1);
|
||||
TrainerMix* td = &g_eeGeneral.trainer.mix[chan - 1];
|
||||
|
||||
auto line = form->newLine(&grid);
|
||||
|
||||
new StaticText(line, rect_t{}, STR_VSRCRAW[chan], 0, COLOR_THEME_PRIMARY1);
|
||||
|
||||
auto box = new FormGroup(line, rect_t{});
|
||||
box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(4));
|
||||
auto box_obj = box->getLvObj();
|
||||
lv_obj_set_width(box_obj, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_flex_cross_place(box_obj, LV_FLEX_ALIGN_CENTER, 0);
|
||||
|
||||
new Choice(box, rect_t{}, STR_TRNMODE, 0, 2, GET_SET_DEFAULT(td->mode));
|
||||
new Choice(box, rect_t{}, STR_TRNCHN, 0, 3, GET_SET_DEFAULT(td->srcChn));
|
||||
auto weight = new NumberEdit(box, rect_t{}, -125, 125,
|
||||
new Choice(line, rect_t{}, STR_TRNMODE, 0, 2, GET_SET_DEFAULT(td->mode));
|
||||
new Choice(line, rect_t{}, STR_TRNCHN, 0, 3, GET_SET_DEFAULT(td->srcChn));
|
||||
auto weight = new NumberEdit(line, rect_t{}, -125, 125,
|
||||
GET_SET_DEFAULT(td->studWeight));
|
||||
weight->setSuffix("%");
|
||||
|
||||
#if LCD_W > LCD_H
|
||||
new DynamicNumber<int16_t>(box, rect_t{},
|
||||
#if LCD_H > LCD_W
|
||||
line = form->newLine(&grid);
|
||||
line->padLeft(30);
|
||||
line->padBottom(8);
|
||||
#endif
|
||||
|
||||
auto d = new DynamicNumber<int16_t>(line, rect_t{},
|
||||
[=]() { return (ppmInput[i] - g_eeGeneral.trainer.calib[i]) * 2; },
|
||||
LEFT | PPM_PRECISION | COLOR_THEME_PRIMARY1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LCD_H >= LCD_W
|
||||
{
|
||||
FlexGridLayout grid4(col4_dsc, row_dsc, 2);
|
||||
auto line = form->newLine(&grid4);
|
||||
|
||||
for (uint8_t i = 0; i < NUM_STICKS; i++) {
|
||||
new DynamicNumber<int16_t>(line, rect_t{},
|
||||
[=]() { return (ppmInput[i] - g_eeGeneral.trainer.calib[i]) * 2; },
|
||||
CENTERED | PPM_PRECISION | COLOR_THEME_PRIMARY1);
|
||||
}
|
||||
}
|
||||
auto line = form->newLine(&grid);
|
||||
line->padTop(10);
|
||||
|
||||
// Trainer multiplier
|
||||
auto lbl = new StaticText(line, rect_t{}, STR_MULTIPLIER, 0, COLOR_THEME_PRIMARY1);
|
||||
lbl->padRight(4);
|
||||
lv_obj_set_grid_cell(lbl->getLvObj(), LV_GRID_ALIGN_END, 0, MULT_COL_CNT, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
auto multiplier = new NumberEdit(line, rect_t{}, -10, 40,
|
||||
GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier));
|
||||
multiplier->setDisplayHandler(
|
||||
[](int32_t value) { return formatNumberAsString(value + 10, PREC1); });
|
||||
lv_obj_set_grid_cell(multiplier->getLvObj(), LV_GRID_ALIGN_START, MULT_COL_CNT, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
#if LCD_H > LCD_W
|
||||
line = form->newLine(&grid);
|
||||
line->padTop(10);
|
||||
#endif
|
||||
|
||||
// Trainer calibration
|
||||
auto line = form->newLine(&grid);
|
||||
auto btn = new TextButton(line, rect_t{}, std::string(STR_CAL), [=]() -> uint8_t {
|
||||
auto btn = new TextButton(line, rect_t{0, 0, 0, 30}, std::string(STR_CAL), [=]() -> uint8_t {
|
||||
memcpy(g_eeGeneral.trainer.calib, ppmInput,
|
||||
sizeof(g_eeGeneral.trainer.calib));
|
||||
SET_DIRTY();
|
||||
return 0;
|
||||
});
|
||||
lv_obj_set_style_min_width(btn->getLvObj(), 2*LV_DPI_DEF/3, 0);
|
||||
|
||||
// Trainer multiplier
|
||||
auto box = new FormGroup(line, rect_t{});
|
||||
box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(4));
|
||||
auto box_obj = box->getLvObj();
|
||||
lv_obj_set_width(box_obj, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_flex_cross_place(box_obj, LV_FLEX_ALIGN_CENTER, 0);
|
||||
|
||||
new StaticText(box, rect_t{}, STR_MULTIPLIER, 0, COLOR_THEME_PRIMARY1);
|
||||
auto multiplier = new NumberEdit(box, rect_t{}, -10, 40,
|
||||
GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier));
|
||||
multiplier->setDisplayHandler(
|
||||
[](int32_t value) { return formatNumberAsString(value + 10, PREC1); });
|
||||
lv_obj_set_grid_cell(btn->getLvObj(), LV_GRID_ALIGN_STRETCH, MULT_COL_CNT+1, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#define TR_VBEEPMODE "Tichý",TR("Alarm","Jen Alarm"),TR("BezKl","Bez kláves"),"Vše"
|
||||
#define TR_COUNTDOWNVALUES "5s","10s","20s","30s"
|
||||
#define TR_VBLMODE TR("Vyp","Vypnuto"),TR("Kláv.","Klávesy"),"Páky","Vše",TR("Zap","Zapnuto")
|
||||
#define TR_TRNMODE "X","+=",":="
|
||||
#define TR_TRNMODE "X","Sečíst","Zaměnit"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
#define TR_AUX_SERIAL_MODES "VYP","Telemetrie zrcadlení","Telemetrie vstup","SBUS Trenér","LUA","CLI","GPS","Debug","SpaceMouse","Externí modul"
|
||||
#define TR_SWTYPES "Žádný","Bez aretace","2-polohový","3-polohový"
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE "Stille","Alarm","NoKey","Alle"
|
||||
#define TR_VBLMODE "FRA","Taster",TR("Ctrl","Controls"),"Begge","TIL"
|
||||
#define TR_TRNMODE "FRA","+=",":="
|
||||
#define TR_TRNMODE "FRA","Læg til","Erstat"
|
||||
#define TR_TRNCHN "KA1","KA2","KA3","KA4"
|
||||
#define TR_AUX_SERIAL_MODES "FRA","Telem spejlet","Telemetri ind","SBUS træner","LUA","CLI","GPS","Debug","SpaceMouse","Eksternt modul"
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE "Stumm","Alarm","NoKey","Alle"
|
||||
#define TR_VBLMODE "AUS","Taste","Stks","Beide","EIN"
|
||||
#define TR_TRNMODE "AUS","+=",":="
|
||||
#define TR_TRNMODE "AUS","Addiere","Ersetze"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
#define TR_AUX_SERIAL_MODES "AUS","Telem weiterl.","Telemetrie In","SBUS Eingang","LUA","CLI","GPS","Debug","SpaceMouse","Externes Modul"
|
||||
#define TR_SWTYPES "Kein","Taster","2POS","3POS"
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE "Quiet","Alarm","NoKey","All"
|
||||
#define TR_VBLMODE "OFF","Keys",TR("Ctrl","Controls"),"Both","ON"
|
||||
#define TR_TRNMODE "OFF","+=",":="
|
||||
#define TR_TRNMODE "OFF","Add","Replace"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
|
||||
#define TR_AUX_SERIAL_MODES "OFF","Telem Mirror","Telemetry In","SBUS Trainer","LUA","CLI","GPS","Debug","SpaceMouse","External module"
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE "Silencio","Alarma","No tecla","Todo"
|
||||
#define TR_VBLMODE "OFF","Teclas","Sticks","Ambos","ON"
|
||||
#define TR_TRNMODE "OFF","+=",":="
|
||||
#define TR_TRNMODE "OFF","Añadir","Cambiar"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
|
||||
#define TR_AUX_SERIAL_MODES "UIT","Telem Mirror","Telemetría","Entrenador SBUS","LUA","CLI","GPS","Debug","SpaceMouse","Módulo externo"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#define TR_MMMINV "---","KÄÄ"
|
||||
#define TR_VBEEPMODE "Äänet","Hälyt","EiNap","Kaikk"
|
||||
#define TR_VBLMODE "OFF","Keys",TR("Ctrl","Controls"),"Both","ON"
|
||||
#define TR_TRNMODE "OFF","+=",":="
|
||||
#define TR_TRNMODE "OFF","Lisää","Korvaa"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
|
||||
#define TR_AUX_SERIAL_MODES "POIS","S-Port Pelik","Telemetry In","SBUS Trainer","LUA","CLI","GPS","Debug","SpaceMouse","External module"
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#define TR_VBEEPMODE "Aucun","Alarm","NoKey","Tout"
|
||||
#define TR_COUNTDOWNVALUES "5s","10s","20s","30s"
|
||||
#define TR_VBLMODE "OFF",TR("Btns","Touches"),TR("Ctrl","Controles"),"Tous","ON"
|
||||
#define TR_TRNMODE "OFF","+=",":="
|
||||
#define TR_TRNMODE "OFF","Ajoute","Remplace"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
#define TR_AUX_SERIAL_MODES "OFF","Recopie Telem","Télémétrie In","Ecolage SBUS","LUA","CLI","GPS","Debug","SpaceMouse","Module externe"
|
||||
#define TR_SWTYPES "Rien","Levier","2-POS","3-POS"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE TR("Silen","Silente"),TR("Avvis","Avvisi"),TR("Notst","No Tasti"),"Tutti"
|
||||
#define TR_VBLMODE TR("OFF","Spenta"),"Tasti",TR("Stks","Sticks"),"Tutti",TR("ON","Accesa")
|
||||
#define TR_TRNMODE "OFF","+=",":="
|
||||
#define TR_TRNMODE "OFF","Add.","Sost."
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
|
||||
#define TR_AUX_SERIAL_MODES "OFF","Replica S-Port","Telemetria","SBUS Trainer","LUA","CLI","GPS","Debug","SpaceMouse","Modulo esterno"
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#define TR_MMMINV "---","リバース"
|
||||
#define TR_VBEEPMODE "消音","アラームのみ","キー音なし","すべて"
|
||||
#define TR_VBLMODE "OFF","クリック時",TR("Ctrl","操作時"),"両方","ON"
|
||||
#define TR_TRNMODE "OFF","+=",":="
|
||||
#define TR_TRNMODE "OFF","加算","置換"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
|
||||
#define TR_AUX_SERIAL_MODES "OFF","テレメトリーミラー","テレメトリーIN","SBUSトレーナー","LUAスクリプト","CLI","GPS","デバッグ","外部モジュール"
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE "Stil","Alarm","NoKey","Alles"
|
||||
#define TR_VBLMODE "UIT",TR("Keys","Toetsen"),TR("Stick","Sticks"),"Beide","AAN"
|
||||
#define TR_TRNMODE "UIT","+=",":="
|
||||
#define TR_TRNMODE "UIT","Add","Replace"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
|
||||
#define TR_AUX_SERIAL_MODES "UIT","Telem Mirror","Telemetry In","SBUS Leerling","LUA","CLI","GPS","Debug","SpaceMouse","External module"
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#define TR_MMMINV "---","REV"
|
||||
#define TR_VBEEPMODE "Cichy","Alarm","BezPr","Wsz."
|
||||
#define TR_VBLMODE TR("Wył","Wyłącz"),TR("Przy","Przycisk"),TR("Drąż","Drązki"),"Oba",TR("Zał","Włącz")
|
||||
#define TR_TRNMODE "Wył","+=",":="
|
||||
#define TR_TRNMODE "Wył","Dodaj","Zastąp"
|
||||
#define TR_TRNCHN "KN1","KN2","KN3","KN4"
|
||||
#define TR_AUX_SERIAL_MODES "Wyłącz","S-Port Kopia","Telemetria","Trener SBUS","LUA","CLI","GPS","Debug","SpaceMouse","Moduł zewnętrzny"
|
||||
#define TR_SWTYPES "Brak","Chwil.","2POZ","3POZ"
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE "Mudo","Alarm","NoKey","Todo"
|
||||
#define TR_VBLMODE "OFF","Chav","Stks","Tudo","ON\0"
|
||||
#define TR_TRNMODE "OFF","+=",":="
|
||||
#define TR_TRNMODE "OFF","Adicionar","Trocar"
|
||||
#define TR_TRNCHN "CH1","CH2","CH3","CH4"
|
||||
#define TR_AUX_SERIAL_MODES "OFF","S-Port Mirror","Telemetry","SBUS Trainer","LUA","CLI","GPS","Debug","SpaceMouse","External module"
|
||||
#define TR_SWTYPES "None","Toggle","2POS","3POS"
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#define TR_VBEEPMODE "Tyst","Alarm","Ej knapp","Alla"
|
||||
#define TR_COUNTDOWNVALUES "5s","10s","20s","30s"
|
||||
#define TR_VBLMODE "Av",TR("Knapp","Knappar"),TR("Spak","Spakar"),"Allt","PÅ"
|
||||
#define TR_TRNMODE "Av","+=",":="
|
||||
#define TR_TRNMODE "Av","Addera","Ersätt"
|
||||
#define TR_TRNCHN "KA1","KA2","KA3","KA4"
|
||||
#define TR_AUX_SERIAL_MODES "AV","Speglad telemetri","Telemetri in","SBUS Lärare","LUA","CLI","GPS","Debug","SpaceMouse","Extern modul"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user