Input & Mixer edit advanced: more compact screens
This commit is contained in:
committed by
Raphael Coeffic
parent
3687088b41
commit
180ceec537
@@ -26,22 +26,32 @@ template<class T>
|
|||||||
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input) :
|
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input) :
|
||||||
ButtonMatrix(parent, r), input(input)
|
ButtonMatrix(parent, r), input(input)
|
||||||
{
|
{
|
||||||
|
#if LCD_W > LCD_H
|
||||||
|
initBtnMap(5, MAX_FLIGHT_MODES + 1);
|
||||||
|
#else
|
||||||
initBtnMap(3, MAX_FLIGHT_MODES);
|
initBtnMap(3, MAX_FLIGHT_MODES);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < MAX_FLIGHT_MODES; i++) {
|
for (int i = 0; i < MAX_FLIGHT_MODES; i++) {
|
||||||
setText(i, std::to_string(i).c_str());
|
setText(i, std::to_string(i).c_str());
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
#if LCD_W > LCD_H
|
||||||
|
// hide last element
|
||||||
|
lv_btnmatrix_set_btn_ctrl(lvobj, MAX_FLIGHT_MODES, LV_BTNMATRIX_CTRL_HIDDEN);
|
||||||
lv_obj_set_width(lvobj, LV_DPI_DEF * 2);
|
lv_obj_set_width(lvobj, LV_DPI_DEF * 2);
|
||||||
|
lv_obj_set_height(lvobj, LV_DPI_DEF / 2);
|
||||||
|
#else
|
||||||
lv_obj_set_width(lvobj, LV_DPI_DEF);
|
lv_obj_set_width(lvobj, LV_DPI_DEF);
|
||||||
|
lv_obj_set_height(lvobj, LV_DPI_DEF);
|
||||||
|
#endif
|
||||||
|
|
||||||
lv_obj_set_style_bg_opa(lvobj, LV_OPA_0, LV_PART_MAIN);
|
lv_obj_set_style_bg_opa(lvobj, LV_OPA_0, LV_PART_MAIN);
|
||||||
|
|
||||||
lv_obj_set_style_pad_all(lvobj, 4, LV_PART_MAIN);
|
lv_obj_set_style_pad_all(lvobj, lv_dpx(4), LV_PART_MAIN);
|
||||||
// lv_obj_set_style_pad_left(lvobj, LV_DPI_DEF / 10, LV_PART_MAIN);
|
lv_obj_set_style_pad_row(lvobj, lv_dpx(4), LV_PART_MAIN);
|
||||||
|
lv_obj_set_style_pad_column(lvobj, lv_dpx(4), LV_PART_MAIN);
|
||||||
lv_obj_set_style_pad_row(lvobj, 4, LV_PART_MAIN);
|
|
||||||
lv_obj_set_style_pad_column(lvobj, 4, LV_PART_MAIN);
|
|
||||||
|
|
||||||
lv_obj_remove_style(lvobj, nullptr, LV_PART_MAIN | LV_STATE_FOCUSED);
|
lv_obj_remove_style(lvobj, nullptr, LV_PART_MAIN | LV_STATE_FOCUSED);
|
||||||
lv_obj_remove_style(lvobj, nullptr, LV_PART_MAIN | LV_STATE_EDITED);
|
lv_obj_remove_style(lvobj, nullptr, LV_PART_MAIN | LV_STATE_EDITED);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||||
|
|
||||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
|
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2),
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST};
|
||||||
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,17 @@ MixEditAdvanced::MixEditAdvanced(int8_t channel, uint8_t index) :
|
|||||||
buildBody(form);
|
buildBody(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
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(1), LV_GRID_FR(1),
|
||||||
|
LV_GRID_FR(1), LV_GRID_FR(1),
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST};
|
||||||
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
||||||
|
#else
|
||||||
|
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
|
||||||
|
LV_GRID_TEMPLATE_LAST};
|
||||||
|
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT,
|
||||||
|
LV_GRID_TEMPLATE_LAST};
|
||||||
|
#endif
|
||||||
|
|
||||||
void MixEditAdvanced::buildBody(FormWindow* form)
|
void MixEditAdvanced::buildBody(FormWindow* form)
|
||||||
{
|
{
|
||||||
@@ -70,7 +78,6 @@ void MixEditAdvanced::buildBody(FormWindow* form)
|
|||||||
new CheckBox(line, rect_t{}, GET_SET_INVERTED(mix->carryTrim));
|
new CheckBox(line, rect_t{}, GET_SET_INVERTED(mix->carryTrim));
|
||||||
|
|
||||||
// Warning
|
// Warning
|
||||||
line = form->newLine(&grid);
|
|
||||||
new StaticText(line, rect_t{}, STR_MIXWARNING, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_MIXWARNING, 0, COLOR_THEME_PRIMARY1);
|
||||||
auto edit = new NumberEdit(line, rect_t{}, 0, 3, GET_SET_DEFAULT(mix->mixWarn));
|
auto edit = new NumberEdit(line, rect_t{}, 0, 3, GET_SET_DEFAULT(mix->mixWarn));
|
||||||
edit->setZeroText(STR_OFF);
|
edit->setZeroText(STR_OFF);
|
||||||
@@ -83,7 +90,6 @@ void MixEditAdvanced::buildBody(FormWindow* form)
|
|||||||
edit->setSuffix("s");
|
edit->setSuffix("s");
|
||||||
|
|
||||||
// Delay down
|
// Delay down
|
||||||
line = form->newLine(&grid);
|
|
||||||
new StaticText(line, rect_t{}, STR_DELAYDOWN, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_DELAYDOWN, 0, COLOR_THEME_PRIMARY1);
|
||||||
edit =
|
edit =
|
||||||
new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->delayDown),
|
new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->delayDown),
|
||||||
@@ -98,7 +104,6 @@ void MixEditAdvanced::buildBody(FormWindow* form)
|
|||||||
edit->setSuffix("s");
|
edit->setSuffix("s");
|
||||||
|
|
||||||
// Slow down
|
// Slow down
|
||||||
line = form->newLine(&grid);
|
|
||||||
new StaticText(line, rect_t{}, STR_SLOWDOWN, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_SLOWDOWN, 0, COLOR_THEME_PRIMARY1);
|
||||||
edit =
|
edit =
|
||||||
new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->speedDown),
|
new NumberEdit(line, rect_t{}, 0, DELAY_MAX, GET_DEFAULT(mix->speedDown),
|
||||||
|
|||||||
Reference in New Issue
Block a user