[all] FAI mode enhancements (RSSI / A1 / A2 allowed), telemetry values also forbidden in custom switches

[all] Expo/DR screen cosmetics.
This commit is contained in:
bsongis@gmail.com
2013-06-06 16:54:27 +00:00
parent 4215d5b55d
commit 855c3b6a6c
4 changed files with 53 additions and 28 deletions
+31 -11
View File
@@ -1589,11 +1589,22 @@ uint8_t editDelay(const uint8_t y, const uint8_t event, const uint8_t attr, cons
#if defined(FLIGHT_MODES)
#if defined(CPUARM)
#define FlightModesType uint16_t
#define FlightModesType uint16_t
#else
#define FlightModesType uint8_t
#define FlightModesType uint8_t
#endif
void displayFlightModes(uint8_t x, uint8_t y, FlightModesType value)
{
uint8_t p = MAX_PHASES;
do {
--p;
if (!(value & (1<<p)))
lcd_putc(x, y, '0'+p);
x -= FWNUM;
} while (p!=0);
}
FlightModesType editFlightModes(uint8_t x, uint8_t y, uint8_t event, FlightModesType value, uint8_t attr)
{
lcd_putsColumnLeft(x, y, STR_FLMODE);
@@ -2948,19 +2959,25 @@ static uint8_t s_copySrcCh;
#define STR_MAX(x) _STR_MAX(x)
#if LCD_W >= 212
#define EXPO_LINE_WEIGHT_POS 7*FW
#define EXPO_LINE_EXPO_POS 12*FW
#define EXPO_LINE_SWITCH_POS 13*FW+4
#define EXPO_LINE_SIDE_POS 19*FW
#define EXPO_LINE_WEIGHT_POS 7*FW-1
#define EXPO_LINE_EXPO_POS 11*FW
#define EXPO_LINE_SWITCH_POS 11*FW+5
#define EXPO_LINE_SIDE_POS 15*FW+2
#define EXPO_LINE_SELECT_POS 18
#else
#elif defined(CPUARM)
#define EXPO_LINE_WEIGHT_POS 7*FW-1
#define EXPO_LINE_EXPO_POS 10*FW+5
#define EXPO_LINE_SWITCH_POS 11*FW+2
#define EXPO_LINE_SIDE_POS 14*FW+2
#define EXPO_LINE_SELECT_POS 24
#else
#define EXPO_LINE_WEIGHT_POS 7*FW-1
#define EXPO_LINE_EXPO_POS 11*FW
#define EXPO_LINE_SWITCH_POS 11*FW+4
#if MAX_PHASES == 6
#define EXPO_LINE_SIDE_POS 14*FW+2
#define EXPO_LINE_SIDE_POS 15*FW
#else
#define EXPO_LINE_SIDE_POS 14*FW+5
#define EXPO_LINE_SIDE_POS 15*FW+2
#endif
#define EXPO_LINE_SELECT_POS 24
#endif
@@ -3203,10 +3220,13 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
if (ed->mode!=3) lcd_putc(EXPO_LINE_SIDE_POS, y, ed->mode == 2 ? 126 : 127);
#if defined(CPUARM)
#if defined(CPUARM) && LCD_W >= 212
displayFlightModes(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH-FW-3, y, ed->phases);
if (ed->name[0]) lcd_putsnAtt(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0));
#elif defined(CPUARM)
if (ed->name[0]) lcd_putsnAtt(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0));
#else
editFlightModes(LCD_W-MAX_PHASES*FW-MENUS_SCROLLBAR_WIDTH, y, 0, ed->phases, 0);
displayFlightModes(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ed->phases);
#endif
}
else {
+13 -13
View File
@@ -46,20 +46,20 @@ inline void displayColumnHeader(const char **headers, uint8_t index)
}
#if LCD_W >= 212
#if defined(TRANSLATIONS_FR)
#define MENU_COLUMNS 1
#define COLUMN_X 0
#if defined(TRANSLATIONS_FR)
#define MENU_COLUMNS 1
#define COLUMN_X 0
#else
#define MENU_COLUMNS 2
#endif
#define MENUS_SCROLLBAR_WIDTH 2
#define MENU_COLUMN2_X (14 + LCD_W / 2)
#define lcd_putsColumnLeft(x, y, str) lcd_puts((x > (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH)) ? MENU_COLUMN2_X : 0, y, str)
#else
#define MENU_COLUMNS 2
#endif
#define MENUS_SCROLLBAR_WIDTH 2
#define MENU_COLUMN2_X (14 + LCD_W / 2)
#define lcd_putsColumnLeft(x, y, str) lcd_puts((x > (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH)) ? MENU_COLUMN2_X : 0, y, str)
#else
#define MENUS_SCROLLBAR_WIDTH 0
#define MENU_COLUMNS 1
#define COLUMN_X 0
#define lcd_putsColumnLeft(x, y, str) lcd_putsLeft(y, str)
#define MENUS_SCROLLBAR_WIDTH 0
#define MENU_COLUMNS 1
#define COLUMN_X 0
#define lcd_putsColumnLeft(x, y, str) lcd_putsLeft(y, str)
#endif
// Menus related stuff ...
+7 -4
View File
@@ -996,7 +996,7 @@ bool __getSwitch(int8_t swtch)
#if defined(FRSKY)
// Telemetry
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
if (!TELEMETRY_STREAMING() && cs->v1 >= MIXSRC_FIRST_TELEM+TELEM_TM2)
if ((!TELEMETRY_STREAMING() && cs->v1 >= MIXSRC_FIRST_TELEM+TELEM_TM2) || IS_FAI_FORBIDDEN(cs->v1-1))
return swtch > 0 ? false : true;
#if defined (PCBTARANIS)
@@ -2283,6 +2283,9 @@ tmr10ms_t lastFunctionTime[NUM_CFN] = { 0 };
#if defined(VOICE)
PLAY_FUNCTION(playValue, uint8_t idx)
{
if (IS_FAI_FORBIDDEN(idx))
return;
getvalue_t val = getValue(idx);
switch (idx) {
@@ -2605,7 +2608,7 @@ void evalFunctions()
#endif
#if defined(CPUARM) && defined(SDCARD)
else if (!IS_FAI_ENABLED() && (CFN_FUNC(sd) == FUNC_PLAY_TRACK || CFN_FUNC(sd) == FUNC_PLAY_VALUE)) {
else if (CFN_FUNC(sd) == FUNC_PLAY_TRACK || CFN_FUNC(sd) == FUNC_PLAY_VALUE) {
tmr10ms_t tmr10ms = get_tmr10ms();
uint8_t repeatParam = CFN_PLAY_REPEAT(sd);
if (!lastFunctionTime[i] || (repeatParam && (signed)(tmr10ms-lastFunctionTime[i])>=500*repeatParam)) {
@@ -2620,7 +2623,7 @@ void evalFunctions()
}
}
}
else if (!IS_FAI_ENABLED() && (CFN_FUNC(sd) == FUNC_BACKGND_MUSIC)) {
else if (CFN_FUNC(sd) == FUNC_BACKGND_MUSIC) {
if (!IS_PLAYING(i+1)) {
playCustomFunctionFile(sd, i+1);
}
@@ -2634,7 +2637,7 @@ void evalFunctions()
}
}
#elif defined(VOICE)
else if (!IS_FAI_ENABLED() && (CFN_FUNC(sd) == FUNC_PLAY_TRACK || CFN_FUNC(sd) == FUNC_PLAY_BOTH || CFN_FUNC(sd) == FUNC_PLAY_VALUE)) {
else if (CFN_FUNC(sd) == FUNC_PLAY_TRACK || CFN_FUNC(sd) == FUNC_PLAY_BOTH || CFN_FUNC(sd) == FUNC_PLAY_VALUE) {
tmr10ms_t tmr10ms = get_tmr10ms();
uint8_t repeatParam = CFN_PLAY_REPEAT(sd);
if (!lastFunctionTime[i] || (CFN_FUNC(sd)==FUNC_PLAY_BOTH && active!=(bool)(activeFnSwitches&switch_mask)) || (repeatParam && (signed)(tmr10ms-lastFunctionTime[i])>=1000*repeatParam)) {
+2
View File
@@ -209,6 +209,8 @@
#define IF_FAI_CHOICE(x)
#endif
#define IS_FAI_FORBIDDEN(idx) (IS_FAI_ENABLED() && idx > MIXSRC_FIRST_TELEM-1+TELEM_A2-1)
#if defined(SIMU)
#ifndef FORCEINLINE
#define FORCEINLINE