[all] Issue 104 fixed (inputs instead of sticks for BL activation). Should spare some flash on stock, but I didn't check
[Taranis] No scrollbar on failsafe screen (and some arrangements to keep consistency with other menus) [Taranis] PPM_UNIT=PREC0 / US taken into account in channels view
This commit is contained in:
+21
-24
@@ -650,15 +650,17 @@ void menuModelFailsafe(uint8_t event)
|
||||
bool newLongNames = false;
|
||||
uint8_t ch;
|
||||
|
||||
SUBMENU_NOTITLE(32, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0});
|
||||
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
popMenu();
|
||||
return;
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER) && s_editMode) {
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert];
|
||||
eeDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(32);
|
||||
|
||||
SET_SCROLLBAR_X(0);
|
||||
|
||||
if (m_posVert >= 16)
|
||||
ch = 16;
|
||||
else
|
||||
@@ -687,17 +689,8 @@ void menuModelFailsafe(uint8_t event)
|
||||
else
|
||||
val = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
|
||||
|
||||
if (m_posVert == ch && event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line] = val;
|
||||
eeDirty(EE_MODEL);
|
||||
s_editMode = 0;
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
killEvents(event);
|
||||
}
|
||||
|
||||
// Channel name if present, number if not
|
||||
uint8_t lenLabel = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name));
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
|
||||
if (lenLabel > 4) {
|
||||
newLongNames = longNames = true;
|
||||
}
|
||||
@@ -707,18 +700,23 @@ void menuModelFailsafe(uint8_t event)
|
||||
else
|
||||
putsChn(x+1-ofs, y, ch+1, SMLSIZE);
|
||||
|
||||
uint8_t wbar = (longNames ? 48 : 58);
|
||||
|
||||
// Value
|
||||
LcdFlags flags = PREC1 | TINSIZE;
|
||||
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (m_posVert == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode)
|
||||
flags |= BLINK;
|
||||
}
|
||||
|
||||
lcd_outdezNAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), flags);
|
||||
#if defined(PPM_UNIT_US)
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
lcd_outdezAtt(x+LCD_W/2-4-wbar-ofs, y, PPM_CH_CENTER(ch)+val/2, flags);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
uint8_t wbar = (longNames ? 48 : 58);
|
||||
lcd_outdezAtt(x+LCD_W/2-4-wbar-ofs, y, calcRESXto1000(val), PREC1|flags);
|
||||
#else
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
lcd_outdezAtt(x+LCD_W/2-4-wbar-ofs, y, calcRESXto1000(val)/10, flags);
|
||||
#endif
|
||||
|
||||
// Gauge
|
||||
lcd_rect(x+LCD_W/2-3-wbar-ofs, y, wbar+1, 6);
|
||||
@@ -735,7 +733,6 @@ void menuModelFailsafe(uint8_t event)
|
||||
}
|
||||
|
||||
longNames = newLongNames;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+9
-2
@@ -317,6 +317,10 @@ void title(const pm_char * s)
|
||||
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
|
||||
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
|
||||
|
||||
#if LCD_W >= 212
|
||||
uint8_t scrollbar_X = LCD_W-1;
|
||||
#endif
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
|
||||
{
|
||||
vertpos_t l_posVert = m_posVert;
|
||||
@@ -476,6 +480,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
case EVT_ENTRY:
|
||||
l_posVert = POS_VERT_INIT;
|
||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||
SET_SCROLLBAR_X(LCD_W-1);
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
if (menuTab) {
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
@@ -491,6 +496,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
case EVT_ENTRY_UP:
|
||||
s_editMode = 0;
|
||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||
SET_SCROLLBAR_X(LCD_W-1);
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_BREAK:
|
||||
@@ -502,6 +508,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
#elif defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ENTRY_UP:
|
||||
s_editMode = 0;
|
||||
SET_SCROLLBAR_X(LCD_W-1);
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_BREAK:
|
||||
@@ -749,8 +756,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
}
|
||||
|
||||
#if LCD_W >= 212
|
||||
if (maxrow > LCD_LINES-1)
|
||||
displayScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, maxrow, LCD_LINES-1);
|
||||
if (maxrow > LCD_LINES-1 && scrollbar_X)
|
||||
displayScrollbar(scrollbar_X, FH, LCD_H-FH, s_pgOfs, maxrow, LCD_LINES-1);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
@@ -45,6 +45,17 @@ inline void displayColumnHeader(const char **headers, uint8_t index)
|
||||
lcd_putsAtt(17*FW, 0, headers[index], 0);
|
||||
}
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void displayScrollbar(xcoord_t x, uint8_t y, uint8_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
#endif
|
||||
|
||||
#if LCD_W >= 212
|
||||
extern uint8_t scrollbar_X;
|
||||
#define SET_SCROLLBAR_X(x) scrollbar_X = (x);
|
||||
#else
|
||||
#define SET_SCROLLBAR_X(x)
|
||||
#endif
|
||||
|
||||
#if LCD_W >= 212
|
||||
#if defined(TRANSLATIONS_FR)
|
||||
#define MENU_COLUMNS 1
|
||||
|
||||
@@ -76,7 +76,7 @@ void menuChannelsView(uint8_t event)
|
||||
uint8_t ofs = (col ? 0 : 1);
|
||||
|
||||
// Channel name if present, number if not
|
||||
uint8_t lenLabel = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name));
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
|
||||
if (lenLabel > 4) {
|
||||
newLongNames = longNames = true;
|
||||
}
|
||||
@@ -86,10 +86,17 @@ void menuChannelsView(uint8_t event)
|
||||
else
|
||||
putsChn(x+1-ofs, y, ch+1, SMLSIZE);
|
||||
|
||||
uint8_t wbar = (longNames ? 48 : 58);
|
||||
|
||||
// Value
|
||||
lcd_outdezNAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1 | TINSIZE);
|
||||
#if defined(PPM_UNIT_US)
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
lcd_outdezAtt(x+LCD_W/2-3-wbar-ofs, y+1, PPM_CH_CENTER(ch)+val/2, TINSIZE);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
uint8_t wbar = (longNames ? 48 : 58);
|
||||
lcd_outdezAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE);
|
||||
#else
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
lcd_outdezAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE); // G: Don't like the decimal part*
|
||||
#endif
|
||||
|
||||
// Gauge
|
||||
lcd_rect(x+LCD_W/2-3-wbar-ofs, y, wbar+1, 6);
|
||||
|
||||
Reference in New Issue
Block a user