fix(color): Names and number of buttons on Preflight checks screen (#3747)
* Fix preflight checks screen in 2.10. * Fix unnecessary side scrolling.
This commit is contained in:
@@ -134,6 +134,7 @@ PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
|
|||||||
new StaticText(line, rect_t{}, STR_CUSTOM_THROTTLE_WARNING, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_CUSTOM_THROTTLE_WARNING, 0, COLOR_THEME_PRIMARY1);
|
||||||
auto box = new FormGroup::Line(line, window_create(line->getLvObj()));
|
auto box = new FormGroup::Line(line, window_create(line->getLvObj()));
|
||||||
lv_obj_set_layout(box->getLvObj(), LV_LAYOUT_FLEX);
|
lv_obj_set_layout(box->getLvObj(), LV_LAYOUT_FLEX);
|
||||||
|
box->setWidth(LCD_W /2 - 15);
|
||||||
|
|
||||||
auto cst_tw = new CheckBox(
|
auto cst_tw = new CheckBox(
|
||||||
box, rect_t{}, GET_SET_DEFAULT(g_model.enableCustomThrottleWarning));
|
box, rect_t{}, GET_SET_DEFAULT(g_model.enableCustomThrottleWarning));
|
||||||
@@ -153,7 +154,7 @@ PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
|
|||||||
if (adcGetMaxInputs(ADC_INPUT_POT) > 0) {
|
if (adcGetMaxInputs(ADC_INPUT_POT) > 0) {
|
||||||
line = form->newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_POTWARNINGSTATE, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_POTWARNINGSTATE, 0, COLOR_THEME_PRIMARY1);
|
||||||
auto pots_wm = new Choice(line, rect_t{}, {STR_PREFLIGHT_POTSLIDER_CHECK}, 0, 2,
|
auto pots_wm = new Choice(line, rect_t{}, STR_PREFLIGHT_POTSLIDER_CHECK, 0, 2,
|
||||||
GET_SET_DEFAULT(g_model.potsWarnMode));
|
GET_SET_DEFAULT(g_model.potsWarnMode));
|
||||||
|
|
||||||
// Pot warnings
|
// Pot warnings
|
||||||
@@ -262,7 +263,7 @@ PotWarnMatrix::PotWarnMatrix(Window* parent, const rect_t& r) :
|
|||||||
{
|
{
|
||||||
// Setup button layout & texts
|
// Setup button layout & texts
|
||||||
uint8_t btn_cnt = 0;
|
uint8_t btn_cnt = 0;
|
||||||
for (uint8_t i = 0; i <= MAX_POTS; i++) {
|
for (uint8_t i = 0; i < MAX_POTS; i++) {
|
||||||
if (IS_POT_AVAILABLE(i)) {
|
if (IS_POT_AVAILABLE(i)) {
|
||||||
pot_idx[btn_cnt] = i;
|
pot_idx[btn_cnt] = i;
|
||||||
btn_cnt++;
|
btn_cnt++;
|
||||||
@@ -273,7 +274,7 @@ PotWarnMatrix::PotWarnMatrix(Window* parent, const rect_t& r) :
|
|||||||
update();
|
update();
|
||||||
|
|
||||||
uint8_t btn_id = 0;
|
uint8_t btn_id = 0;
|
||||||
for (uint16_t i = 0; i <= MAX_POTS; i++) {
|
for (uint16_t i = 0; i < MAX_POTS; i++) {
|
||||||
if (IS_POT_AVAILABLE(i)) {
|
if (IS_POT_AVAILABLE(i)) {
|
||||||
lv_btnmatrix_set_btn_ctrl(lvobj, btn_id, LV_BTNMATRIX_CTRL_RECOLOR);
|
lv_btnmatrix_set_btn_ctrl(lvobj, btn_id, LV_BTNMATRIX_CTRL_RECOLOR);
|
||||||
setTextWithColor(btn_id);
|
setTextWithColor(btn_id);
|
||||||
@@ -376,10 +377,17 @@ CenterBeepsMatrix::CenterBeepsMatrix(Window* parent, const rect_t& r) :
|
|||||||
|
|
||||||
void CenterBeepsMatrix::setTextWithColor(uint8_t btn_id)
|
void CenterBeepsMatrix::setTextWithColor(uint8_t btn_id)
|
||||||
{
|
{
|
||||||
setText(btn_id, makeRecolor(getAnalogShortLabel(ana_idx[btn_id]),
|
auto max_sticks = adcGetMaxInputs(ADC_INPUT_MAIN);
|
||||||
isActive(btn_id) ? COLOR_THEME_PRIMARY1
|
if (ana_idx[btn_id] < max_sticks)
|
||||||
: COLOR_THEME_SECONDARY1)
|
setText(btn_id, makeRecolor(getAnalogShortLabel(ana_idx[btn_id]),
|
||||||
.c_str());
|
isActive(btn_id) ? COLOR_THEME_PRIMARY1
|
||||||
|
: COLOR_THEME_SECONDARY1)
|
||||||
|
.c_str());
|
||||||
|
else
|
||||||
|
setText(btn_id, makeRecolor(getAnalogLabel(ADC_INPUT_POT, ana_idx[btn_id] - max_sticks),
|
||||||
|
isActive(btn_id) ? COLOR_THEME_PRIMARY1
|
||||||
|
: COLOR_THEME_SECONDARY1)
|
||||||
|
.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CenterBeepsMatrix::onPress(uint8_t btn_id)
|
void CenterBeepsMatrix::onPress(uint8_t btn_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user