fix(color): Adjust page padding for several setup pages, backlight page tweaks (#3291)
* Add padding to 'Trims' and 'Throttle' setup pages. * Add padding to pre-flight checks page. Make button size consistent. Fit more buttons per row, Display proper pot and slider names for center beeps. * Add padding to radio setup pages (Sound, Vario, Haptic, Alarm, Backlight and GPS). Move backlight inactivity timer to its own line and add a label (requires translation). * Update translation. * Hide Backlight controls that are not relevant to the backlight mode selected. * Update translation. * Update translation. * Update translation. * Update translation. * Update translation.
This commit is contained in:
@@ -104,9 +104,11 @@ PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
|
|||||||
{
|
{
|
||||||
header.setTitle(STR_PREFLIGHT);
|
header.setTitle(STR_PREFLIGHT);
|
||||||
|
|
||||||
|
body.padAll(8);
|
||||||
|
|
||||||
auto form = new FormWindow(&body, rect_t{});
|
auto form = new FormWindow(&body, rect_t{});
|
||||||
form->setFlexLayout();
|
form->setFlexLayout();
|
||||||
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
FlexGridLayout grid(line_col_dsc, line_row_dsc, 4);
|
||||||
|
|
||||||
// Display checklist
|
// Display checklist
|
||||||
auto line = form->newLine(&grid);
|
auto line = form->newLine(&grid);
|
||||||
@@ -136,7 +138,9 @@ PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
|
|||||||
make_conditional(cst_val, cst_tw);
|
make_conditional(cst_val, cst_tw);
|
||||||
|
|
||||||
// Switch warnings (TODO: add display switch?)
|
// Switch warnings (TODO: add display switch?)
|
||||||
new SwitchWarnMatrix(form, rect_t{});
|
line = form->newLine(&grid);
|
||||||
|
line->padTop(0);
|
||||||
|
new SwitchWarnMatrix(line, rect_t{});
|
||||||
|
|
||||||
// Pots and sliders warning
|
// Pots and sliders warning
|
||||||
#if NUM_POTS + NUM_SLIDERS
|
#if NUM_POTS + NUM_SLIDERS
|
||||||
@@ -146,15 +150,19 @@ PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
|
|||||||
GET_SET_DEFAULT(g_model.potsWarnMode));
|
GET_SET_DEFAULT(g_model.potsWarnMode));
|
||||||
#if (NUM_POTS)
|
#if (NUM_POTS)
|
||||||
// Pot warnings
|
// Pot warnings
|
||||||
auto pwm = new PotWarnMatrix(form, rect_t{});
|
line = form->newLine(&grid);
|
||||||
|
line->padTop(0);
|
||||||
|
auto pwm = new PotWarnMatrix(line, rect_t{});
|
||||||
make_conditional(pwm, pots_wm);
|
make_conditional(pwm, pots_wm);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Center beeps
|
// Center beeps
|
||||||
line = form->newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
|
line->padTop(0);
|
||||||
new StaticText(line, rect_t{}, STR_BEEPCTR, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_BEEPCTR, 0, COLOR_THEME_PRIMARY1);
|
||||||
new CenterBeepsMatrix(form, rect_t{});
|
line = form->newLine(&grid);
|
||||||
|
new CenterBeepsMatrix(line, rect_t{});
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string switchWarninglabel(swsrc_t index)
|
static std::string switchWarninglabel(swsrc_t index)
|
||||||
@@ -165,6 +173,13 @@ static std::string switchWarninglabel(swsrc_t index)
|
|||||||
std::string(getSwitchWarnSymbol(warn_pos));
|
std::string(getSwitchWarnSymbol(warn_pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LCD_W > LCD_H
|
||||||
|
#define SW_BTNS 8
|
||||||
|
#else
|
||||||
|
#define SW_BTNS 4
|
||||||
|
#endif
|
||||||
|
#define SW_BTN_W ((LCD_W-24)/SW_BTNS)
|
||||||
|
|
||||||
SwitchWarnMatrix::SwitchWarnMatrix(Window* parent, const rect_t& r) :
|
SwitchWarnMatrix::SwitchWarnMatrix(Window* parent, const rect_t& r) :
|
||||||
ButtonMatrix(parent, r)
|
ButtonMatrix(parent, r)
|
||||||
{
|
{
|
||||||
@@ -177,7 +192,7 @@ SwitchWarnMatrix::SwitchWarnMatrix(Window* parent, const rect_t& r) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initBtnMap(4, btn_cnt);
|
initBtnMap(SW_BTNS, btn_cnt);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
uint8_t btn_id = 0;
|
uint8_t btn_id = 0;
|
||||||
@@ -188,10 +203,10 @@ SwitchWarnMatrix::SwitchWarnMatrix(Window* parent, const rect_t& r) :
|
|||||||
btn_id++;
|
btn_id++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_set_width(lvobj, LV_DPI_DEF * 2);
|
|
||||||
|
|
||||||
uint8_t rows = ((btn_cnt - 1) / 4) + 1;
|
lv_obj_set_width(lvobj, min((int)btn_cnt, SW_BTNS) * SW_BTN_W);
|
||||||
|
|
||||||
|
uint8_t rows = ((btn_cnt - 1) / SW_BTNS) + 1;
|
||||||
lv_obj_set_height(lvobj, (rows * LV_DPI_DEF) / 3);
|
lv_obj_set_height(lvobj, (rows * LV_DPI_DEF) / 3);
|
||||||
|
|
||||||
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);
|
||||||
@@ -255,7 +270,7 @@ PotWarnMatrix::PotWarnMatrix(Window* parent, const rect_t& r) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initBtnMap(3, btn_cnt);
|
initBtnMap(SW_BTNS, btn_cnt);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
uint8_t btn_id = 0;
|
uint8_t btn_id = 0;
|
||||||
@@ -274,9 +289,9 @@ PotWarnMatrix::PotWarnMatrix(Window* parent, const rect_t& r) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_set_width(lvobj, (LV_DPI_DEF * 3) / 2);
|
lv_obj_set_width(lvobj, min((int)btn_cnt, SW_BTNS) * SW_BTN_W);
|
||||||
|
|
||||||
uint8_t rows = ((btn_cnt - 1) / 4) + 1;
|
uint8_t rows = ((btn_cnt - 1) / SW_BTNS) + 1;
|
||||||
lv_obj_set_height(lvobj, (rows * LV_DPI_DEF) / 3);
|
lv_obj_set_height(lvobj, (rows * LV_DPI_DEF) / 3);
|
||||||
|
|
||||||
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);
|
||||||
@@ -329,7 +344,7 @@ CenterBeepsMatrix::CenterBeepsMatrix(Window* parent, const rect_t& r) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initBtnMap(4, btn_cnt);
|
initBtnMap(SW_BTNS, btn_cnt);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
uint8_t btn_id = 0;
|
uint8_t btn_id = 0;
|
||||||
@@ -341,10 +356,10 @@ CenterBeepsMatrix::CenterBeepsMatrix(Window* parent, const rect_t& r) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_set_width(lvobj, (3 * LV_DPI_DEF) / 2);
|
lv_obj_set_width(lvobj, min((int)btn_cnt, SW_BTNS) * SW_BTN_W);
|
||||||
|
|
||||||
uint8_t rows = ((btn_cnt - 1) / 4) + 1;
|
uint8_t rows = ((btn_cnt - 1) / SW_BTNS) + 1;
|
||||||
lv_obj_set_height(lvobj, (rows * LV_DPI_DEF) / 6);
|
lv_obj_set_height(lvobj, (rows * LV_DPI_DEF) / 3);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@@ -360,7 +375,10 @@ 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(STR_RETA123[ana_idx[btn_id]], isActive(btn_id) ? COLOR_THEME_PRIMARY1 : COLOR_THEME_SECONDARY1).c_str());
|
if (btn_id < NUM_STICKS)
|
||||||
|
setText(btn_id, makeRecolor(STR_RETA123[ana_idx[btn_id]], isActive(btn_id) ? COLOR_THEME_PRIMARY1 : COLOR_THEME_SECONDARY1).c_str());
|
||||||
|
else
|
||||||
|
setText(btn_id, makeRecolor(STR_VSRCRAW[ana_idx[btn_id] + 1], 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)
|
||||||
|
|||||||
@@ -29,11 +29,9 @@
|
|||||||
|
|
||||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||||
|
|
||||||
static const lv_coord_t col_two_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
|
static const lv_coord_t col_two_dsc[] = {LV_GRID_FR(19), LV_GRID_FR(21),
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST};
|
||||||
static const lv_coord_t col_three_dsc[] = {LV_GRID_FR(2), LV_GRID_FR(1), LV_GRID_FR(1),
|
static const lv_coord_t col_four_dsc[] = {LV_GRID_FR(19), LV_GRID_FR(7), LV_GRID_FR(7), LV_GRID_FR(7),
|
||||||
LV_GRID_TEMPLATE_LAST};
|
|
||||||
static const lv_coord_t col_four_dsc[] = {LV_GRID_FR(3), 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_CONTENT,
|
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT,
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST};
|
||||||
@@ -240,23 +238,23 @@ class WindowButtonGroup : public FormGroup
|
|||||||
PageDefs pages;
|
PageDefs pages;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SoundPage : public Page {
|
class SubPage : public Page
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
SoundPage() :
|
SubPage(MenuIcons icon, const char* title) : Page(icon)
|
||||||
Page(ICON_RADIO_SETUP)
|
|
||||||
{
|
{
|
||||||
build();
|
header.setTitle(title);
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void build()
|
|
||||||
{
|
|
||||||
header.setTitle(STR_SOUND_LABEL);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
body.padAll(8);
|
||||||
lv_obj_set_style_pad_column(lvobj, 10, 0);
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class SoundPage : public SubPage {
|
||||||
|
public:
|
||||||
|
SoundPage() : SubPage(ICON_RADIO_SETUP, STR_SOUND_LABEL)
|
||||||
|
{
|
||||||
|
FlexGridLayout grid(col_two_dsc, row_dsc, 3);
|
||||||
|
|
||||||
auto line = body.newLine(&grid);
|
auto line = body.newLine(&grid);
|
||||||
|
|
||||||
@@ -306,27 +304,16 @@ class SoundPage : public Page {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if defined(VARIO)
|
#if defined(VARIO)
|
||||||
class VarioPage : public Page {
|
class VarioPage : public SubPage {
|
||||||
public:
|
public:
|
||||||
VarioPage() :
|
VarioPage() : SubPage(ICON_RADIO_SETUP, STR_VARIO)
|
||||||
Page(ICON_RADIO_SETUP)
|
|
||||||
{
|
{
|
||||||
build();
|
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void build()
|
|
||||||
{
|
|
||||||
header.setTitle(STR_VARIO);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
|
||||||
|
|
||||||
auto line = body.newLine(&grid);
|
auto line = body.newLine(&grid);
|
||||||
|
|
||||||
// Vario volume
|
// Vario volume
|
||||||
new StaticText(line, rect_t{}, TR_VOLUME, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_VOLUME, 0, COLOR_THEME_PRIMARY1);
|
||||||
new Slider(line, rect_t{0,0,lv_pct(50),PAGE_LINE_HEIGHT}, -2, +2, GET_SET_DEFAULT(g_eeGeneral.varioVolume));
|
new Slider(line, rect_t{0,0,lv_pct(50),PAGE_LINE_HEIGHT}, -2, +2, GET_SET_DEFAULT(g_eeGeneral.varioVolume));
|
||||||
line = body.newLine(&grid);
|
line = body.newLine(&grid);
|
||||||
|
|
||||||
@@ -358,22 +345,11 @@ class VarioPage : public Page {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAPTIC)
|
#if defined(HAPTIC)
|
||||||
class HapticPage : public Page {
|
class HapticPage : public SubPage {
|
||||||
public:
|
public:
|
||||||
HapticPage() :
|
HapticPage() : SubPage(ICON_RADIO_SETUP, STR_HAPTIC_LABEL)
|
||||||
Page(ICON_RADIO_SETUP)
|
|
||||||
{
|
{
|
||||||
build();
|
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void build()
|
|
||||||
{
|
|
||||||
header.setTitle(STR_HAPTIC_LABEL);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
|
||||||
|
|
||||||
auto line = body.newLine(&grid);
|
auto line = body.newLine(&grid);
|
||||||
|
|
||||||
@@ -395,22 +371,11 @@ class HapticPage : public Page {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AlarmsPage : public Page {
|
class AlarmsPage : public SubPage {
|
||||||
public:
|
public:
|
||||||
AlarmsPage() :
|
AlarmsPage() : SubPage(ICON_RADIO_SETUP, STR_ALARMS_LABEL)
|
||||||
Page(ICON_RADIO_SETUP)
|
|
||||||
{
|
{
|
||||||
build();
|
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void build()
|
|
||||||
{
|
|
||||||
header.setTitle(STR_ALARMS_LABEL);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
|
||||||
|
|
||||||
auto line = body.newLine(&grid);
|
auto line = body.newLine(&grid);
|
||||||
// Battery warning
|
// Battery warning
|
||||||
@@ -464,25 +429,11 @@ class AlarmsPage : public Page {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BacklightPage : public Page {
|
class BacklightPage : public SubPage {
|
||||||
public:
|
public:
|
||||||
BacklightPage() :
|
BacklightPage() : SubPage(ICON_RADIO_SETUP, STR_BACKLIGHT_LABEL)
|
||||||
Page(ICON_RADIO_SETUP)
|
|
||||||
{
|
{
|
||||||
build();
|
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
FormField* backlightTimeout = nullptr;
|
|
||||||
FormField* backlightOnBright = nullptr;
|
|
||||||
FormField* backlightOffBright = nullptr;
|
|
||||||
|
|
||||||
void build()
|
|
||||||
{
|
|
||||||
header.setTitle(STR_BACKLIGHT_LABEL);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
|
||||||
FlexGridLayout grid(col_three_dsc, row_dsc, 2);
|
|
||||||
|
|
||||||
auto line = body.newLine(&grid);
|
auto line = body.newLine(&grid);
|
||||||
|
|
||||||
@@ -500,20 +451,21 @@ class BacklightPage : public Page {
|
|||||||
blMode->setAvailableHandler(
|
blMode->setAvailableHandler(
|
||||||
[=](int newValue) { return newValue != e_backlight_mode_off; });
|
[=](int newValue) { return newValue != e_backlight_mode_off; });
|
||||||
|
|
||||||
|
backlightTimeout = body.newLine(&grid);
|
||||||
|
|
||||||
// Delay
|
// Delay
|
||||||
auto edit = new NumberEdit(line, rect_t{}, 5, 600,
|
new StaticText(backlightTimeout, rect_t{}, STR_BACKLIGHT_TIMER, 0, COLOR_THEME_PRIMARY1);
|
||||||
|
auto edit = new NumberEdit(backlightTimeout, rect_t{}, 5, 600,
|
||||||
GET_DEFAULT(g_eeGeneral.lightAutoOff * 5),
|
GET_DEFAULT(g_eeGeneral.lightAutoOff * 5),
|
||||||
SET_VALUE(g_eeGeneral.lightAutoOff, newValue / 5));
|
SET_VALUE(g_eeGeneral.lightAutoOff, newValue / 5));
|
||||||
edit->setStep(5);
|
edit->setStep(5);
|
||||||
edit->setSuffix("s");
|
edit->setSuffix("s");
|
||||||
backlightTimeout = edit;
|
|
||||||
|
|
||||||
line = body.newLine(&grid);
|
backlightOnBright = body.newLine(&grid);
|
||||||
|
|
||||||
// Backlight ON bright
|
// Backlight ON bright
|
||||||
new StaticText(line, rect_t{}, STR_BLONBRIGHTNESS, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(backlightOnBright, rect_t{}, STR_BLONBRIGHTNESS, 0, COLOR_THEME_PRIMARY1);
|
||||||
grid.setColSpan(2);
|
new Slider(backlightOnBright, rect_t{0,0,lv_pct(50),PAGE_LINE_HEIGHT}, BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX,
|
||||||
backlightOnBright = new Slider(line, rect_t{0,0,lv_pct(50),PAGE_LINE_HEIGHT}, BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX,
|
|
||||||
[=]() -> int32_t {
|
[=]() -> int32_t {
|
||||||
return BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright;
|
return BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright;
|
||||||
},
|
},
|
||||||
@@ -523,21 +475,20 @@ class BacklightPage : public Page {
|
|||||||
else
|
else
|
||||||
g_eeGeneral.backlightBright = BACKLIGHT_LEVEL_MAX - g_eeGeneral.blOffBright;
|
g_eeGeneral.backlightBright = BACKLIGHT_LEVEL_MAX - g_eeGeneral.blOffBright;
|
||||||
});
|
});
|
||||||
grid.setColSpan(1);
|
|
||||||
line = body.newLine(&grid);
|
backlightOffBright = body.newLine(&grid);
|
||||||
|
|
||||||
// Backlight OFF bright
|
// Backlight OFF bright
|
||||||
new StaticText(line, rect_t{}, STR_BLOFFBRIGHTNESS, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(backlightOffBright, rect_t{}, STR_BLOFFBRIGHTNESS, 0, COLOR_THEME_PRIMARY1);
|
||||||
grid.setColSpan(2);
|
new Slider(backlightOffBright, rect_t{0,0,lv_pct(50),PAGE_LINE_HEIGHT}, BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, GET_DEFAULT(g_eeGeneral.blOffBright),
|
||||||
backlightOffBright = new Slider(line, rect_t{0,0,lv_pct(50),PAGE_LINE_HEIGHT}, BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, GET_DEFAULT(g_eeGeneral.blOffBright),
|
[=](int32_t newValue) {
|
||||||
[=](int32_t newValue) {
|
int32_t onBright = BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright;
|
||||||
int32_t onBright = BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright;
|
if(newValue <= onBright || g_eeGeneral.backlightMode == e_backlight_mode_off)
|
||||||
if(newValue <= onBright || g_eeGeneral.backlightMode == e_backlight_mode_off)
|
g_eeGeneral.blOffBright = newValue;
|
||||||
g_eeGeneral.blOffBright = newValue;
|
else
|
||||||
else
|
g_eeGeneral.blOffBright = onBright;
|
||||||
g_eeGeneral.blOffBright = onBright;
|
});
|
||||||
});
|
|
||||||
grid.setColSpan(1);
|
|
||||||
line = body.newLine(&grid);
|
line = body.newLine(&grid);
|
||||||
|
|
||||||
#if defined(KEYS_BACKLIGHT_GPIO)
|
#if defined(KEYS_BACKLIGHT_GPIO)
|
||||||
@@ -555,54 +506,48 @@ class BacklightPage : public Page {
|
|||||||
updateBacklightControls();
|
updateBacklightControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Window* backlightTimeout = nullptr;
|
||||||
|
Window* backlightOnBright = nullptr;
|
||||||
|
Window* backlightOffBright = nullptr;
|
||||||
|
|
||||||
void updateBacklightControls()
|
void updateBacklightControls()
|
||||||
{
|
{
|
||||||
switch(g_eeGeneral.backlightMode)
|
switch(g_eeGeneral.backlightMode)
|
||||||
{
|
{
|
||||||
case e_backlight_mode_off:
|
case e_backlight_mode_off:
|
||||||
backlightTimeout->enable(false);
|
lv_obj_add_flag(backlightTimeout->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
backlightOnBright->enable(false);
|
lv_obj_add_flag(backlightOnBright->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
backlightOffBright->enable(true);
|
lv_obj_clear_flag(backlightOffBright->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
break;
|
break;
|
||||||
case e_backlight_mode_keys:
|
case e_backlight_mode_keys:
|
||||||
case e_backlight_mode_sticks:
|
case e_backlight_mode_sticks:
|
||||||
case e_backlight_mode_all:
|
case e_backlight_mode_all:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
backlightTimeout->enable(true);
|
lv_obj_clear_flag(backlightTimeout->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
backlightOnBright->enable(true);
|
lv_obj_clear_flag(backlightOnBright->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
backlightOffBright->enable(true);
|
lv_obj_clear_flag(backlightOffBright->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
int32_t onBright = BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright;
|
int32_t onBright = BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright;
|
||||||
if(onBright < g_eeGeneral.blOffBright)
|
if(onBright < g_eeGeneral.blOffBright)
|
||||||
g_eeGeneral.backlightBright = BACKLIGHT_LEVEL_MAX - g_eeGeneral.blOffBright;
|
g_eeGeneral.backlightBright = BACKLIGHT_LEVEL_MAX - g_eeGeneral.blOffBright;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case e_backlight_mode_on:
|
case e_backlight_mode_on:
|
||||||
backlightTimeout->enable(false);
|
lv_obj_add_flag(backlightTimeout->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
backlightOnBright->enable(true);
|
lv_obj_clear_flag(backlightOnBright->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
backlightOffBright->enable(false);
|
lv_obj_add_flag(backlightOffBright->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
resetBacklightTimeout();
|
resetBacklightTimeout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GpsPage : public Page {
|
class GpsPage : public SubPage {
|
||||||
public:
|
public:
|
||||||
GpsPage() :
|
GpsPage() : SubPage(ICON_RADIO_SETUP, STR_GPS)
|
||||||
Page(ICON_RADIO_SETUP)
|
|
||||||
{
|
{
|
||||||
build();
|
FlexGridLayout grid(col_two_dsc, row_dsc, 4);
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void build()
|
|
||||||
{
|
|
||||||
header.setTitle(STR_GPS);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
|
||||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
|
||||||
|
|
||||||
auto line = body.newLine(&grid);
|
auto line = body.newLine(&grid);
|
||||||
// Timezone
|
// Timezone
|
||||||
@@ -629,7 +574,7 @@ RadioSetupPage::RadioSetupPage():
|
|||||||
|
|
||||||
void RadioSetupPage::build(FormWindow * window)
|
void RadioSetupPage::build(FormWindow * window)
|
||||||
{
|
{
|
||||||
FlexGridLayout grid(col_three_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
||||||
window->setFlexLayout();
|
window->setFlexLayout();
|
||||||
|
|
||||||
// Date & time picker including labels
|
// Date & time picker including labels
|
||||||
@@ -718,12 +663,10 @@ void RadioSetupPage::build(FormWindow * window)
|
|||||||
// Switches delay
|
// Switches delay
|
||||||
line = window->newLine(&grid);
|
line = window->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_SWITCHES_DELAY, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_SWITCHES_DELAY, 0, COLOR_THEME_PRIMARY1);
|
||||||
grid.setColSpan(2);
|
|
||||||
auto edit =
|
auto edit =
|
||||||
new NumberEdit(line, rect_t{}, -15, 100 - 15,
|
new NumberEdit(line, rect_t{}, -15, 100 - 15,
|
||||||
GET_SET_VALUE_WITH_OFFSET(g_eeGeneral.switchesDelay, 15));
|
GET_SET_VALUE_WITH_OFFSET(g_eeGeneral.switchesDelay, 15));
|
||||||
edit->setSuffix(std::string("0") + STR_MS);
|
edit->setSuffix(std::string("0") + STR_MS);
|
||||||
grid.setColSpan(1);
|
|
||||||
|
|
||||||
// USB mode
|
// USB mode
|
||||||
line = window->newLine(&grid);
|
line = window->newLine(&grid);
|
||||||
@@ -743,7 +686,6 @@ void RadioSetupPage::build(FormWindow * window)
|
|||||||
line = window->newLine(&grid);
|
line = window->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_RXCHANNELORD, 0,
|
new StaticText(line, rect_t{}, STR_RXCHANNELORD, 0,
|
||||||
COLOR_THEME_PRIMARY1); // RAET->AETR
|
COLOR_THEME_PRIMARY1); // RAET->AETR
|
||||||
grid.setColSpan(2);
|
|
||||||
choice = new Choice(line, rect_t{}, 0, 4 * 3 * 2 - 1,
|
choice = new Choice(line, rect_t{}, 0, 4 * 3 * 2 - 1,
|
||||||
GET_SET_DEFAULT(g_eeGeneral.templateSetup));
|
GET_SET_DEFAULT(g_eeGeneral.templateSetup));
|
||||||
choice->setTextHandler([](uint8_t value) {
|
choice->setTextHandler([](uint8_t value) {
|
||||||
@@ -753,12 +695,10 @@ void RadioSetupPage::build(FormWindow * window)
|
|||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
});
|
});
|
||||||
grid.setColSpan(1);
|
|
||||||
|
|
||||||
// Stick mode
|
// Stick mode
|
||||||
line = window->newLine(&grid);
|
line = window->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_MODE, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_MODE, 0, COLOR_THEME_PRIMARY1);
|
||||||
grid.setColSpan(2);
|
|
||||||
choice = new Choice(line, rect_t{}, 0, 3, GET_DEFAULT(g_eeGeneral.stickMode),
|
choice = new Choice(line, rect_t{}, 0, 3, GET_DEFAULT(g_eeGeneral.stickMode),
|
||||||
[=](uint8_t newValue) {
|
[=](uint8_t newValue) {
|
||||||
mixerTaskStop();
|
mixerTaskStop();
|
||||||
@@ -774,7 +714,6 @@ void RadioSetupPage::build(FormWindow * window)
|
|||||||
std::string(
|
std::string(
|
||||||
&getSourceString(MIXSRC_Rud + modn12x3[4 * value + 1])[1]);
|
&getSourceString(MIXSRC_Rud + modn12x3[4 * value + 1])[1]);
|
||||||
});
|
});
|
||||||
grid.setColSpan(1);
|
|
||||||
|
|
||||||
// Model quick select
|
// Model quick select
|
||||||
line = window->newLine(&grid);
|
line = window->newLine(&grid);
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ ThrottleParams::ThrottleParams() : Page(ICON_MODEL_SETUP)
|
|||||||
header.setTitle(STR_THROTTLE_LABEL);
|
header.setTitle(STR_THROTTLE_LABEL);
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
body.padAll(8);
|
||||||
|
FlexGridLayout grid(line_col_dsc, line_row_dsc, 4);
|
||||||
|
|
||||||
// Throttle reversed
|
// Throttle reversed
|
||||||
auto line = body.newLine(&grid);
|
auto line = body.newLine(&grid);
|
||||||
|
|||||||
@@ -41,11 +41,12 @@ TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
|
|||||||
header.setTitle(STR_TRIMS);
|
header.setTitle(STR_TRIMS);
|
||||||
|
|
||||||
body.setFlexLayout();
|
body.setFlexLayout();
|
||||||
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
body.padAll(8);
|
||||||
|
FlexGridLayout grid(line_col_dsc, line_row_dsc, 4);
|
||||||
|
|
||||||
// Reset trims
|
// Reset trims
|
||||||
auto line = body.newLine();
|
auto line = body.newLine();
|
||||||
lv_obj_set_style_pad_all(line->getLvObj(), lv_dpx(8), 0);
|
line->padBottom(4);
|
||||||
auto btn = new TextButton(line, rect_t{}, STR_RESET_BTN, []() -> uint8_t {
|
auto btn = new TextButton(line, rect_t{}, STR_RESET_BTN, []() -> uint8_t {
|
||||||
resetTrims();
|
resetTrims();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -727,6 +727,7 @@ const char STR_DELETE_THEME[] = TR_DELETE_THEME;
|
|||||||
const char STR_SAVE_THEME[] = TR_SAVE_THEME;
|
const char STR_SAVE_THEME[] = TR_SAVE_THEME;
|
||||||
const char STR_EDIT_COLOR[] = TR_EDIT_COLOR;
|
const char STR_EDIT_COLOR[] = TR_EDIT_COLOR;
|
||||||
const char STR_NO_THEME_IMAGE[] = TR_NO_THEME_IMAGE;
|
const char STR_NO_THEME_IMAGE[] = TR_NO_THEME_IMAGE;
|
||||||
|
const char STR_BACKLIGHT_TIMER[] = TR_BACKLIGHT_TIMER;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(COLORLCD)
|
#if !defined(COLORLCD)
|
||||||
|
|||||||
@@ -747,6 +747,7 @@ extern const char STR_DELETE_THEME[];
|
|||||||
extern const char STR_SAVE_THEME[];
|
extern const char STR_SAVE_THEME[];
|
||||||
extern const char STR_EDIT_COLOR[];
|
extern const char STR_EDIT_COLOR[];
|
||||||
extern const char STR_NO_THEME_IMAGE[];
|
extern const char STR_NO_THEME_IMAGE[];
|
||||||
|
extern const char STR_BACKLIGHT_TIMER[];
|
||||||
#endif
|
#endif
|
||||||
extern const char STR_EXECUTE_FILE[];
|
extern const char STR_EXECUTE_FILE[];
|
||||||
extern const char STR_DELETE_FILE[];
|
extern const char STR_DELETE_FILE[];
|
||||||
|
|||||||
@@ -745,6 +745,7 @@
|
|||||||
#define TR_SAVE_THEME "保存主题?"
|
#define TR_SAVE_THEME "保存主题?"
|
||||||
#define TR_EDIT_COLOR "编辑颜色"
|
#define TR_EDIT_COLOR "编辑颜色"
|
||||||
#define TR_NO_THEME_IMAGE "没有预览图"
|
#define TR_NO_THEME_IMAGE "没有预览图"
|
||||||
|
#define TR_BACKLIGHT_TIMER "持续时间"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "快速选择模型"
|
#define TR_MODEL_QUICK_SELECT "快速选择模型"
|
||||||
|
|||||||
@@ -745,6 +745,7 @@
|
|||||||
#define TR_SAVE_THEME "Uložit motiv?"
|
#define TR_SAVE_THEME "Uložit motiv?"
|
||||||
#define TR_EDIT_COLOR "Upravit barvu"
|
#define TR_EDIT_COLOR "Upravit barvu"
|
||||||
#define TR_NO_THEME_IMAGE "Náhled motivu nedostupný"
|
#define TR_NO_THEME_IMAGE "Náhled motivu nedostupný"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Čas zhasnutí displeje"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Rychlý výběr modelu"
|
#define TR_MODEL_QUICK_SELECT "Rychlý výběr modelu"
|
||||||
|
|||||||
@@ -750,6 +750,7 @@
|
|||||||
#define TR_SAVE_THEME "Gem tema?"
|
#define TR_SAVE_THEME "Gem tema?"
|
||||||
#define TR_EDIT_COLOR "Rediger farve"
|
#define TR_EDIT_COLOR "Rediger farve"
|
||||||
#define TR_NO_THEME_IMAGE "Ingen billede for tema"
|
#define TR_NO_THEME_IMAGE "Ingen billede for tema"
|
||||||
|
#define TR_BACKLIGHT_TIMER TR2("Inaktivitet", "Ved inaktivitet dæmp efter")
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Hurtigvalg af model"
|
#define TR_MODEL_QUICK_SELECT "Hurtigvalg af model"
|
||||||
|
|||||||
@@ -742,6 +742,7 @@
|
|||||||
#define TR_SAVE_THEME "Theme speichern?"
|
#define TR_SAVE_THEME "Theme speichern?"
|
||||||
#define TR_EDIT_COLOR "Farbe bearbeiten"
|
#define TR_EDIT_COLOR "Farbe bearbeiten"
|
||||||
#define TR_NO_THEME_IMAGE "Kein Theme Bild"
|
#define TR_NO_THEME_IMAGE "Kein Theme Bild"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Inaktivitäts Timeout"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "schnelle Modellauswahl"
|
#define TR_MODEL_QUICK_SELECT "schnelle Modellauswahl"
|
||||||
|
|||||||
@@ -743,6 +743,7 @@
|
|||||||
#define TR_SAVE_THEME "Save Theme?"
|
#define TR_SAVE_THEME "Save Theme?"
|
||||||
#define TR_EDIT_COLOR "Edit Color"
|
#define TR_EDIT_COLOR "Edit Color"
|
||||||
#define TR_NO_THEME_IMAGE "No theme image"
|
#define TR_NO_THEME_IMAGE "No theme image"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Inactivity timeout"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||||
|
|||||||
@@ -744,6 +744,7 @@
|
|||||||
#define TR_SAVE_THEME "Save Theme?"
|
#define TR_SAVE_THEME "Save Theme?"
|
||||||
#define TR_EDIT_COLOR "Edit Color"
|
#define TR_EDIT_COLOR "Edit Color"
|
||||||
#define TR_NO_THEME_IMAGE "No theme image"
|
#define TR_NO_THEME_IMAGE "No theme image"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Inactivity timeout"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||||
|
|||||||
@@ -756,6 +756,7 @@
|
|||||||
#define TR_SAVE_THEME "Save Theme?"
|
#define TR_SAVE_THEME "Save Theme?"
|
||||||
#define TR_EDIT_COLOR "Edit Color"
|
#define TR_EDIT_COLOR "Edit Color"
|
||||||
#define TR_NO_THEME_IMAGE "No theme image"
|
#define TR_NO_THEME_IMAGE "No theme image"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Inactivity timeout"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Mallin pikavalinta"
|
#define TR_MODEL_QUICK_SELECT "Mallin pikavalinta"
|
||||||
|
|||||||
@@ -753,6 +753,7 @@
|
|||||||
#define TR_SAVE_THEME "Save Theme?"
|
#define TR_SAVE_THEME "Save Theme?"
|
||||||
#define TR_EDIT_COLOR "Edit Color"
|
#define TR_EDIT_COLOR "Edit Color"
|
||||||
#define TR_NO_THEME_IMAGE "No theme image"
|
#define TR_NO_THEME_IMAGE "No theme image"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Inactivity timeout"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||||
|
|||||||
@@ -745,6 +745,7 @@
|
|||||||
#define TR_SAVE_THEME "Salvo Tema?"
|
#define TR_SAVE_THEME "Salvo Tema?"
|
||||||
#define TR_EDIT_COLOR "Edita colore"
|
#define TR_EDIT_COLOR "Edita colore"
|
||||||
#define TR_NO_THEME_IMAGE "Nessuna immagine trovata"
|
#define TR_NO_THEME_IMAGE "Nessuna immagine trovata"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Tempo d'inattività"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Selezione veloce modello"
|
#define TR_MODEL_QUICK_SELECT "Selezione veloce modello"
|
||||||
|
|||||||
@@ -744,6 +744,7 @@
|
|||||||
#define TR_SAVE_THEME "テーマを保存しますか?"
|
#define TR_SAVE_THEME "テーマを保存しますか?"
|
||||||
#define TR_EDIT_COLOR "カラー編集"
|
#define TR_EDIT_COLOR "カラー編集"
|
||||||
#define TR_NO_THEME_IMAGE "テーマ画像はありません"
|
#define TR_NO_THEME_IMAGE "テーマ画像はありません"
|
||||||
|
#define TR_BACKLIGHT_TIMER "持続時間"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "モデル クイックセレクト"
|
#define TR_MODEL_QUICK_SELECT "モデル クイックセレクト"
|
||||||
|
|||||||
@@ -748,6 +748,7 @@
|
|||||||
#define TR_SAVE_THEME "Save Theme?"
|
#define TR_SAVE_THEME "Save Theme?"
|
||||||
#define TR_EDIT_COLOR "Edit Color"
|
#define TR_EDIT_COLOR "Edit Color"
|
||||||
#define TR_NO_THEME_IMAGE "No theme image"
|
#define TR_NO_THEME_IMAGE "No theme image"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Inactivity timeout"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||||
|
|||||||
@@ -741,6 +741,7 @@
|
|||||||
#define TR_SAVE_THEME "Zapisać motyw?"
|
#define TR_SAVE_THEME "Zapisać motyw?"
|
||||||
#define TR_EDIT_COLOR "Edit Color"
|
#define TR_EDIT_COLOR "Edit Color"
|
||||||
#define TR_NO_THEME_IMAGE "No theme image"
|
#define TR_NO_THEME_IMAGE "No theme image"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Czas bezczynności"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Szybki wybór modelu"
|
#define TR_MODEL_QUICK_SELECT "Szybki wybór modelu"
|
||||||
|
|||||||
@@ -748,6 +748,7 @@
|
|||||||
#define TR_SAVE_THEME "Save Theme?"
|
#define TR_SAVE_THEME "Save Theme?"
|
||||||
#define TR_EDIT_COLOR "Edit Color"
|
#define TR_EDIT_COLOR "Edit Color"
|
||||||
#define TR_NO_THEME_IMAGE "No theme image"
|
#define TR_NO_THEME_IMAGE "No theme image"
|
||||||
|
#define TR_BACKLIGHT_TIMER "Inactivity timeout"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||||
|
|||||||
@@ -743,6 +743,7 @@
|
|||||||
#define TR_SAVE_THEME "保存主題?"
|
#define TR_SAVE_THEME "保存主題?"
|
||||||
#define TR_EDIT_COLOR "编辑颜色"
|
#define TR_EDIT_COLOR "编辑颜色"
|
||||||
#define TR_NO_THEME_IMAGE "没有预览图"
|
#define TR_NO_THEME_IMAGE "没有预览图"
|
||||||
|
#define TR_BACKLIGHT_TIMER "持續時間"
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
#define TR_MODEL_QUICK_SELECT "快速選擇模型"
|
#define TR_MODEL_QUICK_SELECT "快速選擇模型"
|
||||||
|
|||||||
Reference in New Issue
Block a user