feat(radio): sticky LS bold when set, color LS list display bold like BW (#5357)
This commit is contained in:
@@ -297,12 +297,15 @@ void menuModelLogicalSwitches(event_t event)
|
|||||||
drawSwitch(0, y, sw, (sub==k ? INVERS : 0) | (getSwitch(sw) ? BOLD : 0));
|
drawSwitch(0, y, sw, (sub==k ? INVERS : 0) | (getSwitch(sw) ? BOLD : 0));
|
||||||
|
|
||||||
if (cs->func > 0) {
|
if (cs->func > 0) {
|
||||||
// CSW func
|
|
||||||
lcdDrawTextAtIndex(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, 0);
|
|
||||||
|
|
||||||
// CSW params
|
// CSW params
|
||||||
uint8_t cstate = lswFamily(cs->func);
|
uint8_t cstate = lswFamily(cs->func);
|
||||||
|
|
||||||
|
// CSW func
|
||||||
|
LcdFlags flags = 0;
|
||||||
|
if (cstate == LS_FAMILY_STICKY && getLSStickyState(k))
|
||||||
|
flags = BOLD;
|
||||||
|
lcdDrawTextAtIndex(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, flags);
|
||||||
|
|
||||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||||
drawSwitch(CSW_2ND_COLUMN, y, cs->v1, 0);
|
drawSwitch(CSW_2ND_COLUMN, y, cs->v1, 0);
|
||||||
drawSwitch(CSW_3RD_COLUMN, y, cs->v2, 0);
|
drawSwitch(CSW_3RD_COLUMN, y, cs->v2, 0);
|
||||||
|
|||||||
@@ -110,9 +110,6 @@ void menuModelLogicalSwitches(event_t event)
|
|||||||
unsigned int sw = SWSRC_FIRST_LOGICAL_SWITCH+k;
|
unsigned int sw = SWSRC_FIRST_LOGICAL_SWITCH+k;
|
||||||
drawSwitch(0, y, sw, (getSwitch(sw) ? BOLD : 0) | ((sub==k && CURSOR_ON_LINE()) ? INVERS : 0));
|
drawSwitch(0, y, sw, (getSwitch(sw) ? BOLD : 0) | ((sub==k && CURSOR_ON_LINE()) ? INVERS : 0));
|
||||||
|
|
||||||
// CSW func
|
|
||||||
lcdDrawTextAtIndex(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, horz==0 ? attr : 0);
|
|
||||||
|
|
||||||
// CSW params
|
// CSW params
|
||||||
unsigned int cstate = lswFamily(cs->func);
|
unsigned int cstate = lswFamily(cs->func);
|
||||||
mixsrc_t v1_val = cs->v1;
|
mixsrc_t v1_val = cs->v1;
|
||||||
@@ -120,6 +117,12 @@ void menuModelLogicalSwitches(event_t event)
|
|||||||
int16_t v2_min = 0, v2_max = MIXSRC_LAST_TELEM;
|
int16_t v2_min = 0, v2_max = MIXSRC_LAST_TELEM;
|
||||||
int16_t v3_min =-1, v3_max = 100;
|
int16_t v3_min =-1, v3_max = 100;
|
||||||
|
|
||||||
|
// CSW func
|
||||||
|
LcdFlags flags = 0;
|
||||||
|
if (cstate == LS_FAMILY_STICKY && getLSStickyState(k))
|
||||||
|
flags = BOLD;
|
||||||
|
lcdDrawTextAtIndex(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, (horz==0 ? attr : 0) | flags);
|
||||||
|
|
||||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||||
drawSwitch(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
drawSwitch(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||||
drawSwitch(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
drawSwitch(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
||||||
|
|||||||
@@ -342,22 +342,26 @@ class LogicalSwitchButton : public ListLineButton
|
|||||||
etx_obj_add_style(lsFunc, styles->text_align_left, LV_PART_MAIN);
|
etx_obj_add_style(lsFunc, styles->text_align_left, LV_PART_MAIN);
|
||||||
lv_obj_set_pos(lsFunc, FN_X, FN_Y);
|
lv_obj_set_pos(lsFunc, FN_X, FN_Y);
|
||||||
lv_obj_set_size(lsFunc, FN_W, FN_H);
|
lv_obj_set_size(lsFunc, FN_W, FN_H);
|
||||||
|
lv_obj_set_style_text_font(lsFunc, getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||||
|
|
||||||
lsV1 = lv_label_create(lvobj);
|
lsV1 = lv_label_create(lvobj);
|
||||||
etx_obj_add_style(lsV1, styles->text_align_center, LV_PART_MAIN);
|
etx_obj_add_style(lsV1, styles->text_align_center, LV_PART_MAIN);
|
||||||
etx_font(lsV1, FONT_XS_INDEX, ETX_STATE_V1_SMALL_FONT);
|
etx_font(lsV1, FONT_XS_INDEX, ETX_STATE_V1_SMALL_FONT);
|
||||||
lv_obj_set_pos(lsV1, V1_X, V1_Y);
|
lv_obj_set_pos(lsV1, V1_X, V1_Y);
|
||||||
lv_obj_set_size(lsV1, V1_W, V1_H);
|
lv_obj_set_size(lsV1, V1_W, V1_H);
|
||||||
|
lv_obj_set_style_text_font(lsV1, getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||||
|
|
||||||
lsV2 = lv_label_create(lvobj);
|
lsV2 = lv_label_create(lvobj);
|
||||||
etx_obj_add_style(lsV2, styles->text_align_center, LV_PART_MAIN);
|
etx_obj_add_style(lsV2, styles->text_align_center, LV_PART_MAIN);
|
||||||
lv_obj_set_pos(lsV2, V2_X, V2_Y);
|
lv_obj_set_pos(lsV2, V2_X, V2_Y);
|
||||||
lv_obj_set_size(lsV2, V2_W, V2_H);
|
lv_obj_set_size(lsV2, V2_W, V2_H);
|
||||||
|
lv_obj_set_style_text_font(lsV2, getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||||
|
|
||||||
lsAnd = lv_label_create(lvobj);
|
lsAnd = lv_label_create(lvobj);
|
||||||
etx_obj_add_style(lsAnd, styles->text_align_center, LV_PART_MAIN);
|
etx_obj_add_style(lsAnd, styles->text_align_center, LV_PART_MAIN);
|
||||||
lv_obj_set_pos(lsAnd, AND_X, AND_Y);
|
lv_obj_set_pos(lsAnd, AND_X, AND_Y);
|
||||||
lv_obj_set_size(lsAnd, AND_W, AND_H);
|
lv_obj_set_size(lsAnd, AND_W, AND_H);
|
||||||
|
lv_obj_set_style_text_font(lsAnd, getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||||
|
|
||||||
lsDuration = lv_label_create(lvobj);
|
lsDuration = lv_label_create(lvobj);
|
||||||
etx_obj_add_style(lsDuration, styles->text_align_center, LV_PART_MAIN);
|
etx_obj_add_style(lsDuration, styles->text_align_center, LV_PART_MAIN);
|
||||||
@@ -380,6 +384,35 @@ class LogicalSwitchButton : public ListLineButton
|
|||||||
return getSwitch(SWSRC_FIRST_LOGICAL_SWITCH + index);
|
return getSwitch(SWSRC_FIRST_LOGICAL_SWITCH + index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkEvents() override
|
||||||
|
{
|
||||||
|
ListLineButton::checkEvents();
|
||||||
|
check(isActive());
|
||||||
|
|
||||||
|
LogicalSwitchData* ls = lswAddress(index);
|
||||||
|
uint8_t lsFamily = lswFamily(ls->func);
|
||||||
|
|
||||||
|
if (lsFamily == LS_FAMILY_STICKY && getLSStickyState(index))
|
||||||
|
lv_obj_add_state(lsFunc, LV_STATE_USER_1);
|
||||||
|
else
|
||||||
|
lv_obj_clear_state(lsFunc, LV_STATE_USER_1);
|
||||||
|
|
||||||
|
if ((lsFamily == LS_FAMILY_BOOL || lsFamily == LS_FAMILY_EDGE || lsFamily == LS_FAMILY_STICKY) && getSwitch(ls->v1))
|
||||||
|
lv_obj_add_state(lsV1, LV_STATE_USER_1);
|
||||||
|
else
|
||||||
|
lv_obj_clear_state(lsV1, LV_STATE_USER_1);
|
||||||
|
|
||||||
|
if ((lsFamily == LS_FAMILY_BOOL || lsFamily == LS_FAMILY_STICKY) && getSwitch(ls->v2))
|
||||||
|
lv_obj_add_state(lsV2, LV_STATE_USER_1);
|
||||||
|
else
|
||||||
|
lv_obj_clear_state(lsV2, LV_STATE_USER_1);
|
||||||
|
|
||||||
|
if (getSwitch(ls->andsw))
|
||||||
|
lv_obj_add_state(lsAnd, LV_STATE_USER_1);
|
||||||
|
else
|
||||||
|
lv_obj_clear_state(lsAnd, LV_STATE_USER_1);
|
||||||
|
}
|
||||||
|
|
||||||
void refresh() override
|
void refresh() override
|
||||||
{
|
{
|
||||||
if (!init) return;
|
if (!init) return;
|
||||||
|
|||||||
@@ -490,6 +490,11 @@ PACK(typedef struct {
|
|||||||
uint16_t duration:15;
|
uint16_t duration:15;
|
||||||
}) ls_stay_struct;
|
}) ls_stay_struct;
|
||||||
|
|
||||||
|
bool getLSStickyState(uint8_t idx)
|
||||||
|
{
|
||||||
|
return lswFm[mixerCurrentFlightMode].lsw[idx].lastValue & 1;
|
||||||
|
}
|
||||||
|
|
||||||
void logicalSwitchesInit(bool force)
|
void logicalSwitchesInit(bool force)
|
||||||
{
|
{
|
||||||
for (unsigned int idx=0; idx<MAX_LOGICAL_SWITCHES; idx++) {
|
for (unsigned int idx=0; idx<MAX_LOGICAL_SWITCHES; idx++) {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ typedef int16_t delayval_t;
|
|||||||
uint8_t lswFamily(uint8_t func);
|
uint8_t lswFamily(uint8_t func);
|
||||||
int16_t lswTimerValue(delayval_t val);
|
int16_t lswTimerValue(delayval_t val);
|
||||||
|
|
||||||
|
bool getLSStickyState(uint8_t idx);
|
||||||
void evalLogicalSwitches(bool isCurrentFlightmode=true);
|
void evalLogicalSwitches(bool isCurrentFlightmode=true);
|
||||||
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
||||||
void logicalSwitchesReset();
|
void logicalSwitchesReset();
|
||||||
|
|||||||
Reference in New Issue
Block a user