[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:
bsongis@gmail.com
2013-08-17 07:07:01 +00:00
parent cb3a0cb823
commit 8c4610ede7
9 changed files with 67 additions and 52 deletions
-9
View File
@@ -233,10 +233,6 @@ FLIGHT_MODES = YES
# Values = YES, NO
CURVES = YES
# Customizable Curves
# Values = YES, NO
XCURVES = YES
# Global Vars
# Values = YES, NO
GVARS = NO
@@ -274,7 +270,6 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
TRGT = avr-
MCU = atmega64
OPT = s
XCURVES = NO
SDCARD = NO
THR_TRACE = NO
EXTRAINCDIRS = targets/stock
@@ -793,10 +788,6 @@ ifeq ($(CURVES), YES)
CPPDEFS += -DCURVES
endif
ifeq ($(XCURVES), YES)
CPPDEFS += -DXCURVES
endif
ifeq ($(GVARS), YES)
CPPDEFS += -DGVARS
EEPROM_VARIANT += ${GVARS_VARIANT}
+21 -24
View File
@@ -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
View File
@@ -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
+11
View File
@@ -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
+11 -4
View File
@@ -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);
+4 -4
View File
@@ -257,10 +257,10 @@ enum ModuleIndex {
#endif
enum BacklightMode {
e_backlight_mode_off = 0,
e_backlight_mode_keys,
e_backlight_mode_sticks,
e_backlight_mode_both,
e_backlight_mode_off = 0,
e_backlight_mode_keys = 1,
e_backlight_mode_sticks = 2,
e_backlight_mode_all = e_backlight_mode_keys+e_backlight_mode_sticks,
e_backlight_mode_on
};
+8 -6
View File
@@ -416,7 +416,7 @@ void generalDefault()
#endif
#if !defined(CPUM64)
g_eeGeneral.backlightMode = e_backlight_mode_both;
g_eeGeneral.backlightMode = e_backlight_mode_all;
g_eeGeneral.lightAutoOff = 2;
g_eeGeneral.inactivityTimer = 10;
#endif
@@ -1499,11 +1499,13 @@ FORCEINLINE void convertUnit(getvalue_t & val, uint8_t & unit)
#define INAC_DEVISOR 512 // bypass splash screen with stick movement
#define INAC_DEV_SHIFT 9 // shift right value for stick movement
uint16_t stickMoveValue()
uint8_t inputsMoveValue()
{
uint16_t sum = 0;
uint8_t sum = 0;
for (uint8_t i=0; i<NUM_STICKS; i++)
sum += anaIn(i) >> INAC_DEV_SHIFT;
for (uint8_t i=0; i<NUM_SWITCHES; i++)
sum += getValue(MIXSRC_FIRST_SWITCH+i) >> 10;
return sum;
}
@@ -1518,7 +1520,7 @@ void checkBacklight()
uint8_t x = g_blinkTmr10ms;
if (tmr10ms != x) {
tmr10ms = x;
uint16_t tsum = stickMoveValue();
uint8_t tsum = inputsMoveValue();
if (tsum != inactivity.sum) {
inactivity.sum = tsum;
inactivity.counter = 0;
@@ -1578,7 +1580,7 @@ void doSplash()
getADC(); // init ADC array
uint16_t inacSum = stickMoveValue();
uint8_t inacSum = inputsMoveValue();
tmr10ms_t tgtime = get_tmr10ms() + SPLASH_TIMEOUT;
while (tgtime != get_tmr10ms()) {
@@ -1590,7 +1592,7 @@ void doSplash()
getADC();
uint16_t tsum = stickMoveValue();
uint8_t tsum = inputsMoveValue();
#if defined(FSPLASH) || defined(XSPLASH)
if (!(g_eeGeneral.splashMode & 0x04))
+1 -1
View File
@@ -729,7 +729,7 @@ void watchdogSetTimeout(uint32_t timeout);
struct t_inactivity
{
uint16_t counter;
uint16_t sum;
uint8_t sum;
};
extern struct t_inactivity inactivity;
+2 -2
View File
@@ -53,8 +53,8 @@
#define LEN_VRENAVIG "\003"
#define TR_VRENAVIG "No REaREb"
#define LEN_VBLMODE "\004"
#define TR_VBLMODE "OFF ""Keys""Stks""Both""ON\0"
#define LEN_VBLMODE TR("\004", "\006")
#define TR_VBLMODE TR("OFF\0""Keys""Stks""Both""ON\0", "OFF\0 ""Keys\0 ""Inputs""Both\0 ""ON\0")
#define LEN_TRNMODE "\003"
#define TR_TRNMODE "OFF"" +="" :="