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 Jun 7, 2024
1 parent 26c96cc commit 341ae7b
Show file tree
Hide file tree
Showing 24 changed files with 302 additions and 222 deletions.
22 changes: 10 additions & 12 deletions radio/src/gui/colorlcd/fm_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,26 @@
#include "opentx.h"
#include "themes/etx_lv_theme.h"

#if PORTRAIT_LCD
#define FM_COLS 3
#define FM_ROWS 3
template<class T>
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input, uint8_t columns) :
ButtonMatrix(parent, r), input(input)
{
#if LCD_W > LCD_H
if (columns == 0) columns = 5;
#else
#define FM_COLS 5
#define FM_ROWS 2
if (columns == 0) columns = 3;
#endif

template <class T>
FMMatrix<T>::FMMatrix(Window* parent, const rect_t& r, T* input) :
ButtonMatrix(parent, r), input(input)
{
initBtnMap(FM_COLS, MAX_FLIGHT_MODES);
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 * 51 + 3);
lv_obj_set_height(lvobj, ((MAX_FLIGHT_MODES + columns- 1) / columns) * 35 + 3);

padAll(PAD_SMALL);
}
Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/fm_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ 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);
Expand Down
Loading

0 comments on commit 341ae7b

Please sign in to comment.