Skip to content

Commit

Permalink
Revised input edit page for color LCD radios.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Mitchell committed Jul 6, 2024
1 parent 08c90dc commit 463fa68
Show file tree
Hide file tree
Showing 26 changed files with 287 additions and 201 deletions.
1 change: 0 additions & 1 deletion radio/src/gui/colorlcd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ set(GUI_SRC
curveedit.cpp
fm_matrix.cpp
gvar_numberedit.cpp
input_edit_adv.cpp
input_edit.cpp
input_source.cpp
mixer_edit_adv.cpp
Expand Down
14 changes: 8 additions & 6 deletions radio/src/gui/colorlcd/fm_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,24 @@
#include "opentx.h"
#include "themes/etx_lv_theme.h"

template <class T>
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input) :
template<class T>
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input, uint8_t columns) :
ButtonMatrix(parent, r), input(input)
{
initBtnMap(FM_COLS, MAX_FLIGHT_MODES);
if (columns == 0) columns = DEF_COLS;

initBtnMap(columns, MAX_FLIGHT_MODES);

for (int i = 0; i < MAX_FLIGHT_MODES; i++) {
setTextAndState(i);
}

update();

lv_obj_set_width(lvobj, FM_COLS * (FM_BTN_W + 3) + 3);
lv_obj_set_height(lvobj, FM_ROWS * (EdgeTxStyles::UI_ELEMENT_HEIGHT + 3) +3);
lv_obj_set_width(lvobj, columns * (FM_BTN_W + 3) + 3);
lv_obj_set_height(lvobj, ((MAX_FLIGHT_MODES + columns - 1) / columns) * (EdgeTxStyles::UI_ELEMENT_HEIGHT + 3) +3);

padAll(PAD_SMALL);
padAll(PAD_TINY);
}

template <class T>
Expand Down
5 changes: 2 additions & 3 deletions radio/src/gui/colorlcd/fm_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ struct MixData;
template<class T>
struct FMMatrix : public ButtonMatrix {
T* input;
FMMatrix(Window* parent, const rect_t& rect, T* input);
FMMatrix(Window* parent, const rect_t& rect, T* input, uint8_t columns = 0);
void onPress(uint8_t btn_id);
bool isActive(uint8_t btn_id);
void setTextAndState(uint8_t btn_id);

static LAYOUT_VAL(FM_BTN_W, 48, 48)
static LAYOUT_VAL(FM_COLS, 5, 3)
static LAYOUT_VAL(FM_ROWS, 2, 3)
static LAYOUT_VAL(DEF_COLS, 5, 3)
};

extern template struct FMMatrix<ExpoData>;
Expand Down
Loading

0 comments on commit 463fa68

Please sign in to comment.