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 Apr 27, 2024
1 parent e3b56b7 commit 75d40e3
Show file tree
Hide file tree
Showing 24 changed files with 297 additions and 222 deletions.
19 changes: 8 additions & 11 deletions radio/src/gui/colorlcd/fm_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,26 @@
#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)
{
#if LCD_W > LCD_H
initBtnMap(5, MAX_FLIGHT_MODES);
if (columns == 0) columns = 5;
#else
initBtnMap(3, MAX_FLIGHT_MODES);
if (columns == 0) columns = 3;
#endif

initBtnMap(columns, MAX_FLIGHT_MODES);

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

update();

#if LCD_W > LCD_H
lv_obj_set_width(lvobj, 258);
lv_obj_set_height(lvobj, 73);
#else
lv_obj_set_width(lvobj, 156);
lv_obj_set_height(lvobj, 108);
#endif
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 75d40e3

Please sign in to comment.