[stock] Issue 44 fixed (without AUDIO and VOICE)

[all] Issue 3 fixed (Timer function in custom switches)
[stock] Huge flash savings ...
[stock] No more sink in vario
[all] FAI mode (YES/NO/CHOICE)
This commit is contained in:
bsongis@gmail.com
2013-06-03 19:00:37 +00:00
parent dd7e9ae2b4
commit ffe29e6f1a
28 changed files with 417 additions and 301 deletions
+11
View File
@@ -63,6 +63,10 @@ PCBREV =
# Values = STD, FRSKY, JETI, NMEA, ARDUPILOT, MAVLINK, TELEMETREZ
EXT = STD
# FAI mode
# Values = YES, NO, CHOICE
FAI = NO
# Enable heli menu
# Values = YES, NO
HELI = NO
@@ -893,6 +897,13 @@ ifeq ($(PPM_UNIT), PERCENT_PREC0)
CPPDEFS += -DPPM_UNIT_PERCENT_PREC0
endif
ifeq ($(FAI), YES)
CPPDEFS += -DFAI
endif
ifeq ($(FAI), CHOICE)
CPPDEFS += -DFAI_CHOICE
endif
ifeq ($(HELI), YES)
CPPDEFS += -DHELI
endif
+1 -1
View File
@@ -390,7 +390,7 @@ void eeLoadModel(uint8_t id)
for (uint8_t i=0; i<MAX_TIMERS; i++) {
if (g_model.timers[i].persistent) {
s_timerVal[i] = g_model.timers[i].value;
timersStates[i].val = g_model.timers[i].value;
}
}
+1 -1
View File
@@ -958,7 +958,7 @@ void eeLoadModel(uint8_t id)
#if !defined(PCBSTD)
for (uint8_t i=0; i<MAX_TIMERS; i++) {
if (g_model.timers[i].persistent) {
s_timerVal[i] = g_model.timers[i].value;
timersStates[i].val = g_model.timers[i].value;
}
}
#endif
+11 -6
View File
@@ -173,6 +173,7 @@ enum menuGeneralSetupItems {
IF_PXX(ITEM_SETUP_COUNTRYCODE)
IF_CPUARM(ITEM_SETUP_LANGUAGE)
IF_CPUARM(ITEM_SETUP_IMPERIAL)
IF_FAI_CHOICE(ITEM_SETUP_FAI)
ITEM_SETUP_RX_CHANNEL_ORD,
ITEM_SETUP_STICK_MODE_LABELS,
ITEM_SETUP_STICK_MODE,
@@ -193,7 +194,7 @@ void menuGeneralSetup(uint8_t event)
}
#endif
MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, IF_RTCLOCK(2) IF_RTCLOCK(2) IF_BATTGRAPH(1) LABEL(SOUND), IF_AUDIO(0) IF_BUZZER(0) 0, IF_AUDIO(0) IF_VOICE(0) IF_HAPTIC(LABEL(HAPTIC)) IF_HAPTIC(0) IF_HAPTIC(0) IF_HAPTIC(0) IF_PCBSKY9X(0) IF_9X(0) LABEL(ALARMS), 0, IF_PCBSKY9X(0) IF_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, IF_SPLASH(0) IF_GPS(0) IF_GPS(0) IF_PXX(0) IF_CPUARM(0) IF_CPUARM(0) 0, LABEL(TX_MODE), CASE_PCBTARANIS(0) 1/*to force edit mode*/});
MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, IF_RTCLOCK(2) IF_RTCLOCK(2) IF_BATTGRAPH(1) LABEL(SOUND), IF_AUDIO(0) IF_BUZZER(0) 0, IF_AUDIO(0) IF_VOICE(0) IF_HAPTIC(LABEL(HAPTIC)) IF_HAPTIC(0) IF_HAPTIC(0) IF_HAPTIC(0) IF_PCBSKY9X(0) IF_9X(0) LABEL(ALARMS), 0, IF_PCBSKY9X(0) IF_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, IF_SPLASH(0) IF_GPS(0) IF_GPS(0) IF_PXX(0) IF_CPUARM(0) IF_CPUARM(0) IF_FAI_CHOICE(0) 0, LABEL(TX_MODE), CASE_PCBTARANIS(0) 1/*to force edit mode*/});
uint8_t sub = m_posVert - 1;
@@ -223,8 +224,8 @@ void menuGeneralSetup(uint8_t event)
{
int16_t year = 1900 + t.tm_year;
int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0);
int8_t dmon[] = {31,28,31,30,31,30,31,31,30,31,30,31}; // TODO in flash
dlim += dmon[t.tm_mon];
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
dlim += pgm_read_byte(&dmon[t.tm_mon]);
lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+6*FW-2, y, t.tm_mday, rowattr|LEADING0, 2);
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
break;
@@ -525,6 +526,12 @@ void menuGeneralSetup(uint8_t event)
break;
#endif
#if defined(FAI_CHOICE)
case ITEM_SETUP_FAI:
g_eeGeneral.fai = onoffMenuItem(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, PSTR("FAI Mode"), attr, event ) ;
break;
#endif
case ITEM_SETUP_RX_CHANNEL_ORD:
lcd_putsLeft(y, STR_RXCHANNELORD); // RAET->AETR
for (uint8_t i=1; i<=4; i++)
@@ -551,9 +558,7 @@ void menuGeneralSetup(uint8_t event)
clearKeyEvents();
}
#if defined(ROTARY_ENCODER_NAVIGATION)
if (m_posHorz > 0) {
REPEAT_LAST_CURSOR_MOVE();
}
MOVE_CURSOR_FROM_HERE();
#endif
break;
}
+147 -105
View File
@@ -754,7 +754,6 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
int8_t c = name[cur];
int8_t v = c;
/* TODO work with masks */
if (p1valdiff || IS_ROTARY_RIGHT(event) || IS_ROTARY_LEFT(event) || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_FIRST(KEY_UP)
|| event==EVT_KEY_REPT(KEY_DOWN) || event==EVT_KEY_REPT(KEY_UP)) {
v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0);
@@ -909,22 +908,7 @@ void onModelSetupMenu(const char *result)
void menuModelSetup(uint8_t event)
{
// TODO this is quick & dirty, should be done in place of the return which is hidden inside MENU(...)
#if defined(DSM2)
if (event == EVT_KEY_LONG(KEY_EXIT)) {
s_rangecheck_mode = 0;
}
#endif
#if defined(PCBTARANIS)
if (event == EVT_KEY_LONG(KEY_EXIT)) {
pxxFlag[INTERNAL_MODULE] = 0;
pxxFlag[EXTERNAL_MODULE] = 0;
}
#endif
#if defined(PCBTARANIS)
bool CURSOR_ON_CELL = (m_posHorz >= 0);
#define IF_PORT1_ON(x) (g_model.moduleData[0].rfProtocol == RF_PROTO_OFF ? HIDDEN_ROW : (uint8_t)(x))
#define IF_PORT2_ON(x) (g_model.externalModule == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
#define IF_TRAINER_ON(x) (g_model.trainerMode ? (uint8_t)(x) : HIDDEN_ROW)
@@ -935,17 +919,37 @@ void menuModelSetup(uint8_t event)
#define TRAINER_CHANNELS_ROWS() IF_TRAINER_ON(1)
#define PORT_CHANNELS_ROWS(x) (x==0 ? PORT1_CHANNELS_ROWS() : (x==1 ? PORT2_CHANNELS_ROWS() : TRAINER_CHANNELS_ROWS()))
#define FAILSAFE_ROWS(x) ((g_model.moduleData[x].rfProtocol==RF_PROTO_X16 || g_model.moduleData[x].rfProtocol==RF_PROTO_LR12) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : HIDDEN_ROW)
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, 1+ITEM_MODEL_SETUP_MAX, { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 0, IF_PORT1_ON(1), IF_PORT1_ON(2), IF_PORT1_ON(FAILSAFE_ROWS(0)), LABEL(ExternalModule), g_model.externalModule==MODULE_TYPE_XJT ? (uint8_t)1 : (uint8_t)0, PORT2_CHANNELS_ROWS(), (IS_MODULE_PPM(1) || IS_MODULE_XJT(1) ? (uint8_t)2 : HIDDEN_ROW), IF_PORT2_XJT(FAILSAFE_ROWS(1)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
#define MODEL_SETUP_MAX_LINES (1+ITEM_MODEL_SETUP_MAX)
bool CURSOR_ON_CELL = (m_posHorz >= 0);
MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 0, IF_PORT1_ON(1), IF_PORT1_ON(2), IF_PORT1_ON(FAILSAFE_ROWS(0)), LABEL(ExternalModule), g_model.externalModule==MODULE_TYPE_XJT ? (uint8_t)1 : (uint8_t)0, PORT2_CHANNELS_ROWS(), (IS_MODULE_PPM(1) || IS_MODULE_XJT(1) ? (uint8_t)2 : HIDDEN_ROW), IF_PORT2_XJT(FAILSAFE_ROWS(1)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
#elif defined(CPUM64)
#define CURSOR_ON_CELL (true)
#define CURSOR_ON_CELL (true)
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX)
uint8_t protocol = g_model.protocol;
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX), { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2 });
MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2 });
#else
#define CURSOR_ON_CELL (true)
#define CURSOR_ON_CELL (true)
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX)
uint8_t protocol = g_model.protocol;
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX), { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, IF_PCBSKY9X(1) IF_PCBSKY9X(2) });
MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, IF_PCBSKY9X(1) IF_PCBSKY9X(2) });
#endif
if (!MENU_CHECK(menuTabModel, e_ModelSetup, MODEL_SETUP_MAX_LINES)) {
#if defined(DSM2)
s_rangecheck_mode = 0;
#endif
#if defined(PCBTARANIS)
pxxFlag[INTERNAL_MODULE] = 0;
pxxFlag[EXTERNAL_MODULE] = 0;
#endif
return;
}
TITLE(STR_MENUSETUP);
uint8_t sub = m_posVert - 1;
int8_t editMode = s_editMode;
@@ -1358,8 +1362,8 @@ void menuModelSetup(uint8_t event)
if (IS_PPM_PROTOCOL(protocol)) {
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, m_posHorz!=0 ? attr : 0);
}
else if (attr && m_posHorz > 0 /* TODO avoid it on stock with another macro*/) {
REPEAT_LAST_CURSOR_MOVE();
else if (attr) {
MOVE_CURSOR_FROM_HERE();
}
#endif
@@ -1722,12 +1726,11 @@ void menuModelFlightModesAll(uint8_t event)
putsFlightPhase(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, s_perout_flight_phase+1);
if (sub==MAX_PHASES && !trimsCheckTimer) {
lcd_status_line();
// TODO [ENTER] here
}
return;
}
PhaseData *p = phaseaddress(k);
PhaseData *p = phaseAddress(k);
putsFlightPhase(0, y, k+1, (getFlightPhase()==k ? BOLD : 0) | ((sub==k && m_posHorz<0) ? INVERS : 0));
@@ -1793,7 +1796,7 @@ enum menuModelPhaseItems {
void menuModelPhaseOne(uint8_t event)
{
PhaseData *phase = phaseaddress(s_currIdx);
PhaseData *phase = phaseAddress(s_currIdx);
putsFlightPhase(13*FW, 0, s_currIdx+1, (getFlightPhase()==s_currIdx ? BOLD : 0));
#if defined(GVARS) && !defined(PCBSTD)
@@ -1858,11 +1861,11 @@ void menuModelPhaseOne(uint8_t event)
#if ROTARY_ENCODERS > 2
int16_t v;
if(t < (NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA))
v = phaseaddress(s_currIdx)->rotaryEncoders[t];
v = phaseAddress(s_currIdx)->rotaryEncoders[t];
else
v = g_model.rotaryEncodersExtra[s_currIdx][t-(NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA)];
#else
int16_t v = phaseaddress(s_currIdx)->rotaryEncoders[t];
int16_t v = phaseAddress(s_currIdx)->rotaryEncoders[t];
#endif
if (v < ROTARY_ENCODER_MAX) v = ROTARY_ENCODER_MAX;
v = checkIncDec(event, v, ROTARY_ENCODER_MAX, ROTARY_ENCODER_MAX+MAX_PHASES-1, EE_MODEL);
@@ -1870,11 +1873,11 @@ void menuModelPhaseOne(uint8_t event)
if (v == ROTARY_ENCODER_MAX) v = 0;
#if ROTARY_ENCODERS > 2
if (t < (NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA))
phaseaddress(s_currIdx)->rotaryEncoders[t] = v;
phaseAddress(s_currIdx)->rotaryEncoders[t] = v;
else
g_model.rotaryEncodersExtra[s_currIdx][t-(NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA)] = v;
#else
phaseaddress(s_currIdx)->rotaryEncoders[t] = v;
phaseAddress(s_currIdx)->rotaryEncoders[t] = v;
#endif
}
}
@@ -1984,7 +1987,7 @@ void menuModelFlightModesAll(uint8_t event)
uint8_t y = 1 + (i+1)*FH;
#endif
att = (i==sub ? INVERS : 0);
PhaseData *p = phaseaddress(i);
PhaseData *p = phaseAddress(i);
#if ROTARY_ENCODERS > 2
putsFlightPhase(0, y, i+1, att|CONDENSED|(getFlightPhase()==i ? BOLD : 0));
#else
@@ -2089,7 +2092,7 @@ typedef int16_t (*FnFuncP) (int16_t x);
int16_t expoFn(int16_t x)
{
ExpoData *ed = expoaddress(s_currIdx);
ExpoData *ed = expoAddress(s_currIdx);
int16_t anas[NUM_INPUTS] = {0};
anas[ed->chn] = x;
applyExpos(anas, e_perout_mode_inactive_phase);
@@ -2133,7 +2136,7 @@ struct point_t {
point_t getPoint(uint8_t i)
{
point_t result = {0, 0};
CurveInfo crv = curveinfo(s_curveChan);
CurveInfo crv = curveInfo(s_curveChan);
if (i < crv.points) {
result.x = X0-1-WCHART+i*WCHART/(crv.points/2);
result.y = (LCD_H-1) - (100 + crv.crv[i]) * (LCD_H-1) / 200;
@@ -2164,13 +2167,13 @@ bool moveCurve(uint8_t index, int8_t shift, int8_t custom=0)
return false;
}
int8_t *crv = curveaddress(index);
int8_t *crv = curveAddress(index);
if (shift < 0) {
for (uint8_t i=0; i<custom; i++)
crv[i] = crv[2*i];
}
int8_t *nextCrv = curveaddress(index+1);
int8_t *nextCrv = curveAddress(index+1);
memmove(nextCrv+shift, nextCrv, 5*(MAX_CURVES-index-1)+g_model.curves[MAX_CURVES-1]-g_model.curves[index]);
if (shift < 0) memclear(&g_model.points[NUM_POINTS-1] + shift, -shift);
while (index<MAX_CURVES)
@@ -2196,7 +2199,7 @@ void displayPresetChoice(uint8_t event)
lcd_putcAtt(lcdLastPos, WARNING_LINE_Y, '@', INVERS);
if (s_warning_result) {
CurveInfo crv = curveinfo(s_curveChan);
CurveInfo crv = curveInfo(s_curveChan);
for (uint8_t i=0; i<crv.points; i++)
crv.crv[i] = (i-(crv.points/2)) * s_warning_input_value * 50 / (crv.points-1);
if (crv.custom) {
@@ -2212,12 +2215,12 @@ void onCurveOneMenu(const char *result)
POPUP_INPUT(STR_PRESET, displayPresetChoice, 0, -4, 4);
}
else if (result == STR_CURVE_MIRROR) {
CurveInfo crv = curveinfo(s_curveChan);
CurveInfo crv = curveInfo(s_curveChan);
for (int i=0; i<crv.points; i++)
crv.crv[i] = -crv.crv[i];
}
else if (result == STR_CURVE_CLEAR) {
CurveInfo crv = curveinfo(s_curveChan);
CurveInfo crv = curveInfo(s_curveChan);
for (int i=0; i<crv.points; i++)
crv.crv[i] = 0;
if (crv.custom) {
@@ -2230,7 +2233,7 @@ void onCurveOneMenu(const char *result)
void menuModelCurveOne(uint8_t event)
{
static uint8_t pointsOfs = 0;
CurveInfo crv = curveinfo(s_curveChan);
CurveInfo crv = curveInfo(s_curveChan);
lcd_puts(9*FW, 0, "pt\003X\006Y");
lcd_filled_rect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
@@ -2280,7 +2283,7 @@ void menuModelCurveOne(uint8_t event)
}
break;
}
crv = curveinfo(s_curveChan);
crv = curveInfo(s_curveChan);
}
switch(event) {
@@ -2352,7 +2355,7 @@ void menuModelCurveOne(uint8_t event)
lcd_outdezAtt(PSIZE(TR_MENUCURVE)*FW+1, 0, s_curveChan+1, INVERS|LEFT);
DISPLAY_PROGRESS_BAR(20*FW+1);
CurveInfo crv = curveinfo(s_curveChan);
CurveInfo crv = curveInfo(s_curveChan);
switch(event) {
case EVT_ENTRY:
@@ -2469,7 +2472,7 @@ uint8_t getExpoMixCount(uint8_t expo)
uint8_t ch ;
for(int8_t i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
ch = (expo ? expoaddress(i)->mode : mixaddress(i)->srcRaw);
ch = (expo ? expoAddress(i)->mode : mixAddress(i)->srcRaw);
if (ch != 0) {
count++;
}
@@ -2491,12 +2494,12 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
{
pauseMixerCalculations();
if (expo) {
ExpoData *expo = expoaddress(idx);
ExpoData *expo = expoAddress(idx);
memmove(expo, expo+1, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
memclear(&g_model.expoData[MAX_EXPOS-1], sizeof(ExpoData));
}
else {
MixData *mix = mixaddress(idx);
MixData *mix = mixAddress(idx);
memmove(mix, mix+1, (MAX_MIXERS-(idx+1))*sizeof(MixData));
memclear(&g_model.mixData[MAX_MIXERS-1], sizeof(MixData));
}
@@ -2509,7 +2512,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
{
pauseMixerCalculations();
if (expo) {
ExpoData *expo = expoaddress(idx);
ExpoData *expo = expoAddress(idx);
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
memclear(expo, sizeof(ExpoData));
expo->mode = 3; // pos&neg
@@ -2517,7 +2520,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
expo->weight = 100;
}
else {
MixData *mix = mixaddress(idx);
MixData *mix = mixAddress(idx);
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
memclear(mix, sizeof(MixData));
mix->destCh = s_currCh-1;
@@ -2532,11 +2535,11 @@ void copyExpoMix(uint8_t expo, uint8_t idx)
{
pauseMixerCalculations();
if (expo) {
ExpoData *expo = expoaddress(idx);
ExpoData *expo = expoAddress(idx);
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
}
else {
MixData *mix = mixaddress(idx);
MixData *mix = mixAddress(idx);
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
}
resumeMixerCalculations();
@@ -2563,7 +2566,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
int8_t tgt_idx = (up ? idx-1 : idx+1);
if (expo) {
x = (ExpoData *)expoaddress(idx);
x = (ExpoData *)expoAddress(idx);
if (tgt_idx < 0) {
if (((ExpoData *)x)->chn == 0)
@@ -2579,7 +2582,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
return true;
}
y = (ExpoData *)expoaddress(tgt_idx);
y = (ExpoData *)expoAddress(tgt_idx);
if(((ExpoData *)x)->chn != ((ExpoData *)y)->chn || !((ExpoData *)y)->mode) {
if (up) {
if (((ExpoData *)x)->chn>0) ((ExpoData *)x)->chn--;
@@ -2595,7 +2598,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
size = sizeof(ExpoData);
}
else {
x = (MixData *)mixaddress(idx);
x = (MixData *)mixAddress(idx);
if (tgt_idx < 0) {
if (((MixData *)x)->destCh == 0)
@@ -2611,7 +2614,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
return true;
}
y = (MixData *)mixaddress(tgt_idx);
y = (MixData *)mixAddress(tgt_idx);
uint8_t destCh = ((MixData *)x)->destCh;
if(!((MixData *)y)->srcRaw || destCh != ((MixData *)y)->destCh) {
if (up) {
@@ -2657,7 +2660,7 @@ void menuModelExpoOne(uint8_t event)
}
#endif
ExpoData *ed = expoaddress(s_currIdx);
ExpoData *ed = expoAddress(s_currIdx);
putsMixerSource(7*FW+FW/2, 0, ed->chn+1, 0);
SUBMENU(STR_MENUDREXPO, EXPO_FIELD_MAX, {IF_CPUARM(0) 0, 0, IF_CURVES(0) IF_FLIGHT_MODES((MAX_PHASES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
@@ -2775,7 +2778,7 @@ void menuModelMixOne(uint8_t event)
#endif
TITLE(s_currCh ? STR_INSERTMIX : STR_EDITMIX);
MixData *md2 = mixaddress(s_currIdx) ;
MixData *md2 = mixAddress(s_currIdx) ;
putsChn(lcdLastPos+1*FW, 0, md2->destCh+1,0);
#if defined(ROTARY_ENCODERS)
@@ -2880,9 +2883,7 @@ void menuModelMixOne(uint8_t event)
if (md2->curveParam == 0)
md2->curveMode = MODE_DIFFERENTIAL;
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBTARANIS)
if (m_posHorz != 0) {
REPEAT_LAST_CURSOR_MOVE();
}
MOVE_CURSOR_FROM_HERE();
#else
m_posHorz = 0;
#endif
@@ -2970,7 +2971,7 @@ static uint8_t s_copySrcCh;
void onExpoMixMenu(const char *result)
{
bool expo = (g_menuStack[g_menuStackPtr] == menuModelExposAll);
uint8_t chn = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1);
uint8_t chn = (expo ? expoAddress(s_currIdx)->chn+1 : mixAddress(s_currIdx)->destCh+1);
if (result == STR_EDIT) {
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
@@ -3014,7 +3015,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
if (s_editMode > 0)
s_editMode = 0;
uint8_t chn = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1);
uint8_t chn = (expo ? expoAddress(s_currIdx)->chn+1 : mixAddress(s_currIdx)->destCh+1);
switch (event)
{
@@ -3166,7 +3167,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
for (uint8_t ch=1; ch<=(expo ? NUM_INPUTS : NUM_CHNOUT); ch++) {
void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer;
uint8_t y = 1+(cur-s_pgOfs)*FH;
if (expo ? (i<MAX_EXPOS && (ed=expoaddress(i))->chn+1 == ch && ed->mode) : (i<MAX_MIXERS && (md=mixaddress(i))->srcRaw && md->destCh+1 == ch)) {
if (expo ? (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && ed->mode) : (i<MAX_MIXERS && (md=mixAddress(i))->srcRaw && md->destCh+1 == ch)) {
if (s_pgOfs < cur && cur-s_pgOfs < LCD_LINES) {
if (expo) {
putsMixerSource(0, y, ch, 0);
@@ -3322,7 +3323,7 @@ void menuModelMixAll(uint8_t event)
bool thrOutput(uint8_t ch)
{
for (uint8_t i=0; i<MAX_MIXERS; i++) {
MixData *mix = mixaddress(i);
MixData *mix = mixAddress(i);
if (mix->destCh==ch && mix->srcRaw==MIXSRC_Thr)
return true;
}
@@ -3415,7 +3416,7 @@ void menuModelLimits(uint8_t event)
#endif
if (s_warning_result) {
LimitData *ld = limitaddress(sub);
LimitData *ld = limitAddress(sub);
ld->revert = !ld->revert;
s_warning_result = 0;
AUDIO_WARNING2();
@@ -3440,7 +3441,7 @@ void menuModelLimits(uint8_t event)
return;
}
LimitData *ld = limitaddress(k) ;
LimitData *ld = limitAddress(k) ;
#if LCD_W >= 212 || !defined(PPM_CENTER_ADJUSTABLE)
int16_t v = (ld->revert) ? -ld->offset : ld->offset;
@@ -3452,7 +3453,7 @@ void menuModelLimits(uint8_t event)
#endif
#if defined(PPM_CENTER_ADJUSTABLE)
int8_t limit = ((g_model.extendedLimits && !limitaddress(k)->ppmCenter) ? 125 : 100);
int8_t limit = ((g_model.extendedLimits && !limitAddress(k)->ppmCenter) ? 125 : 100);
#else
int8_t limit = (g_model.extendedLimits ? 125 : 100);
#endif
@@ -3612,7 +3613,7 @@ void menuModelCurvesAll(uint8_t event)
putsStrIdx(0, y, STR_CV, k+1, attr);
#if defined(PCBTARANIS)
editName(4*FW, y, g_model.curveNames[k], sizeof(g_model.curveNames[k]), 0, 0);
CurveInfo crv = curveinfo(k);
CurveInfo crv = curveInfo(k);
lcd_outdezAtt(11*FW, y, crv.points, LEFT);
lcd_putsAtt(lcdLastPos, y, crv.custom ? PSTR("pt'") : PSTR("pt"), 0);
#endif
@@ -3727,7 +3728,7 @@ void menuModelCustomSwitchOne(uint8_t event)
{
TITLE(STR_MENUCUSTOMSWITCH);
CustomSwData * cs = cswaddress(s_currIdx);
CustomSwData * cs = cswAddress(s_currIdx);
uint8_t sw = SWSRC_SW1+s_currIdx;
putsSwitches(14*FW, 0, sw, (getSwitch(sw) ? BOLD : 0));
SIMPLE_SUBMENU_NOTITLE(CSW_FIELD_COUNT);
@@ -3738,14 +3739,14 @@ void menuModelCustomSwitchOne(uint8_t event)
uint8_t y = 1 + (k+1)*FH;
uint8_t i = k + s_pgOfs;
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
uint8_t cstate = CS_STATE(cs->func);
uint8_t cstate = cswFamily(cs->func);
switch(i) {
case CSW_FIELD_FUNCTION:
lcd_putsLeft(y, STR_FUNC);
lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_VCSWFUNC, cs->func, attr);
if (attr) {
CHECK_INCDEC_MODELVAR_ZERO(event, cs->func, CS_MAXF);
if (cstate != CS_STATE(cs->func)) {
if (cstate != cswFamily(cs->func)) {
cs->v1 = 0;
cs->v2 = 0;
}
@@ -3759,6 +3760,10 @@ void menuModelCustomSwitchOne(uint8_t event)
putsSwitches(CSWONE_2ND_COLUMN, y, cs->v1, attr);
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
}
else if (cstate == CS_VTIMER) {
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v1+1, LEFT|attr);
v1_max = 99;
}
else {
putsMixerSource(CSWONE_2ND_COLUMN, y, cs->v1, attr);
}
@@ -3775,6 +3780,10 @@ void menuModelCustomSwitchOne(uint8_t event)
putsSwitches(CSWONE_2ND_COLUMN, y, cs->v2, attr);
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
}
else if (cstate == CS_VTIMER) {
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2+1, LEFT|attr);
v2_max = 99;
}
else if (cstate == CS_VCOMP) {
putsMixerSource(CSWONE_2ND_COLUMN, y, cs->v2, attr);
}
@@ -3800,7 +3809,7 @@ void menuModelCustomSwitchOne(uint8_t event)
#endif
{
v2_min = -125; v2_max = 125;
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2, attr|LEFT);
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2, LEFT|attr);
}
}
@@ -3860,7 +3869,7 @@ void menuModelCustomSwitches(uint8_t event)
for (uint8_t i=0; i<LCD_LINES-1; i++) {
y = 1 + (i+1)*FH;
k = i+s_pgOfs;
CustomSwData * cs = cswaddress(k);
CustomSwData * cs = cswAddress(k);
// CSW name
uint8_t sw = SWSRC_SW1+k;
@@ -3872,7 +3881,7 @@ void menuModelCustomSwitches(uint8_t event)
lcd_putsiAtt(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, 0);
// CSW params
uint8_t cstate = CS_STATE(cs->func);
uint8_t cstate = cswFamily(cs->func);
if (cstate == CS_VBOOL) {
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, 0);
@@ -3882,6 +3891,10 @@ void menuModelCustomSwitches(uint8_t event)
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, 0);
putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, 0);
}
else if (cstate == CS_VTIMER) {
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT);
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2+1, LEFT);
}
else {
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, 0);
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
@@ -3912,13 +3925,14 @@ void menuModelCustomSwitches(uint8_t event)
MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1, {0, NAVIGATION_LINE_BY_LINE|CSW_FIELD_LAST/*repeated...*/});
uint8_t y = 0;
uint8_t k = 0;
int8_t sub = m_posVert - 1;
uint8_t y = 0;
uint8_t k = 0;
int8_t sub = m_posVert - 1;
horzpos_t horz = m_posHorz;
#if LCD_W >= 212
if (m_posHorz>=0) {
displayColumnHeader(STR_CSW_HEADERS, m_posHorz);
if (horz>=0) {
displayColumnHeader(STR_CSW_HEADERS, horz);
}
#endif
@@ -3926,40 +3940,48 @@ void menuModelCustomSwitches(uint8_t event)
y = 1 + (i+1)*FH;
k = i+s_pgOfs;
uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
CustomSwData * cs = cswaddress(k);
uint8_t attr1 = (horz==1 ? attr : 0);
uint8_t attr2 = (horz==2 ? attr : 0);
CustomSwData * cs = cswAddress(k);
// CSW name
uint8_t sw = SWSRC_SW1+k;
putsSwitches(0, y, sw, (getSwitch(sw) ? BOLD : 0) | ((sub==k && m_posHorz<0) ? INVERS : 0));
putsSwitches(0, y, sw, (getSwitch(sw) ? BOLD : 0) | ((sub==k && horz<0) ? INVERS : 0));
// CSW func
lcd_putsiAtt(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, m_posHorz==0 ? attr : 0);
lcd_putsiAtt(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, horz==0 ? attr : 0);
// CSW params
uint8_t cstate = CS_STATE(cs->func);
uint8_t cstate = cswFamily(cs->func);
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
if (cstate == CS_VBOOL) {
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, m_posHorz==1 ? attr : 0);
putsSwitches(CSW_3RD_COLUMN, y, cs->v2, m_posHorz==2 ? attr : 0);
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, attr1);
putsSwitches(CSW_3RD_COLUMN, y, cs->v2, attr2);
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
INCDEC_SET_FLAG(INCDEC_SWITCH);
}
else if (cstate == CS_VCOMP) {
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, m_posHorz==1 ? attr : 0);
putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, m_posHorz==2 ? attr : 0);
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, attr1);
putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, attr2);
INCDEC_SET_FLAG(INCDEC_SOURCE);
}
else if (cstate == CS_VTIMER) {
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT|attr1);
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2+1, LEFT|attr2);
v1_max = 99; v2_max = 99;
INCDEC_SET_FLAG(0);
}
else {
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, (m_posHorz==1 ? attr : 0));
if (m_posHorz == 1)
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, attr1);
if (horz == 1)
INCDEC_SET_FLAG(INCDEC_SOURCE);
else
INCDEC_SET_FLAG(0);
#if defined(FRSKY)
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
putsTelemetryChannel(CSW_3RD_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT | (m_posHorz==2 ? attr : 0));
putsTelemetryChannel(CSW_3RD_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2);
v2_max = maxTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1);
if (cstate == CS_VOFS) {
v2_min = -128;
@@ -3975,43 +3997,43 @@ void menuModelCustomSwitches(uint8_t event)
}
}
else {
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2, LEFT | (m_posHorz==2 ? attr : 0));
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
v2_min = -125; v2_max = 125;
}
#else
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
putsTelemetryChannel(CSW_3RD_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT | (m_posHorz==2 ? attr : 0));
putsTelemetryChannel(CSW_3RD_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2);
v2_min = -128; v2_max = 127;
}
else {
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2, LEFT | (m_posHorz==2 ? attr : 0));
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
v2_min = -125; v2_max = 125;
}
#endif
}
// CSW and switch
putsSwitches(CSW_4TH_COLUMN, y, cs->andsw, m_posHorz==3 ? attr : 0);
putsSwitches(CSW_4TH_COLUMN, y, cs->andsw, horz==3 ? attr : 0);
#if defined(CPUARM)
// CSW duration
if (cs->duration > 0)
lcd_outdezAtt(CSW_5TH_COLUMN, y, 5*cs->duration, (m_posHorz==4 ? attr : 0)|PREC1|LEFT);
lcd_outdezAtt(CSW_5TH_COLUMN, y, 5*cs->duration, (horz==4 ? attr : 0)|PREC1|LEFT);
else
lcd_putsiAtt(CSW_5TH_COLUMN, y, STR_MMMINV, 0, m_posHorz==4 ? attr : 0);
lcd_putsiAtt(CSW_5TH_COLUMN, y, STR_MMMINV, 0, horz==4 ? attr : 0);
// CSW delay
if (cs->delay > 0)
lcd_outdezAtt(CSW_6TH_COLUMN, y, 5*cs->delay, (m_posHorz==5 ? attr : 0)|PREC1|LEFT);
lcd_outdezAtt(CSW_6TH_COLUMN, y, 5*cs->delay, (horz==5 ? attr : 0)|PREC1|LEFT);
else
lcd_putsiAtt(CSW_6TH_COLUMN, y, STR_MMMINV, 0, m_posHorz==5 ? attr : 0);
lcd_putsiAtt(CSW_6TH_COLUMN, y, STR_MMMINV, 0, horz==5 ? attr : 0);
#endif
if ((s_editMode>0 || p1valdiff) && attr) {
switch (m_posHorz) {
switch (horz) {
case CSW_FIELD_FUNCTION:
CHECK_INCDEC_MODELVAR_ZERO(event, cs->func, CS_MAXF);
if (cstate != CS_STATE(cs->func)) {
if (cstate != cswFamily(cs->func)) {
cs->v1 = 0;
cs->v2 = 0;
}
@@ -4270,21 +4292,20 @@ void menuModelCustomFunctions(uint8_t event)
#endif
) {
switch (CFN_GVAR_MODE(sd)) {
// TODO constants
case 0:
case FUNC_ADJUST_GVAR_CONSTANT:
val_displayed = (int8_t)CFN_PARAM(sd);
val_min = -125; val_max = 125;
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
break;
case 1:
case FUNC_ADJUST_GVAR_SOURCE:
val_max = MIXSRC_LAST_CH-1;
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed+1, attr);
break;
case 2:
case FUNC_ADJUST_GVAR_GVAR:
val_max = MAX_GVARS-1;
putsStrIdx(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default:
default: // FUNC_ADJUST_GVAR_INC
val_max = 1;
lcd_putsiAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, PSTR("\002-1+1"), val_displayed, attr);
break;
@@ -4439,9 +4460,15 @@ enum menuModelTelemetryItems {
#define SCREEN_TYPE_ROWS (uint8_t)-1
#endif
#if defined(TOTO)
#define VARIO_RANGE_ROWS 1
#else
#define VARIO_RANGE_ROWS 3
#endif
void menuModelTelemetry(uint8_t event)
{
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, CHANNEL_ROWS CHANNEL_ROWS RSSI_ROWS USRDATA_LINES 0, 0, IF_VARIO((uint8_t)-1) IF_VARIO(0) IF_VARIO(3) SCREEN_TYPE_ROWS, 2, 2, 2, 2, SCREEN_TYPE_ROWS, 2, 2, 2, 2, IF_CPUARM(SCREEN_TYPE_ROWS) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) });
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, CHANNEL_ROWS CHANNEL_ROWS RSSI_ROWS USRDATA_LINES 0, 0, IF_VARIO((uint8_t)-1) IF_VARIO(0) IF_VARIO(VARIO_RANGE_ROWS) SCREEN_TYPE_ROWS, 2, 2, 2, 2, SCREEN_TYPE_ROWS, 2, 2, 2, 2, IF_CPUARM(SCREEN_TYPE_ROWS) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) });
uint8_t sub = m_posVert - 1;
@@ -4625,6 +4652,20 @@ void menuModelTelemetry(uint8_t event)
case ITEM_TELEMETRY_VARIO_RANGE:
lcd_putsLeft(y, STR_LIMIT);
#if defined(TOTO)
lcd_outdezAtt(TELEM_COL2, y, 5+g_model.frsky.varioCenterMax, (m_posHorz==0 ? attr : 0)|PREC1|LEFT);
lcd_outdezAtt(TELEM_COL2+8*FW, y, 10+g_model.frsky.varioMax, (m_posHorz==1 ? attr : 0));
if (attr && (s_editMode>0 || p1valdiff)) {
switch (m_posHorz) {
case 0:
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMax, -15, +15);
break;
case 1:
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMax, -7, 7);
break;
}
}
#else
lcd_outdezAtt(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz<=0 ? attr : 0)|LEFT);
if (g_model.frsky.varioCenterMin == -16)
lcd_putsAtt(TELEM_COL2+4*FW-2, y, STR_OFF, m_posHorz==1 ? attr : 0);
@@ -4648,6 +4689,7 @@ void menuModelTelemetry(uint8_t event)
break;
}
}
#endif
break;
#endif
@@ -4724,8 +4766,8 @@ void menuModelTelemetry(uint8_t event)
putsTelemetryChannel(TELEM_BARS_COLMIN, y, barSource-1, convertTelemValue(barSource, bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
putsTelemetryChannel(TELEM_BARS_COLMAX, y, barSource-1, convertTelemValue(barSource, 255-bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
}
else if (attr && m_posHorz>0) {
REPEAT_LAST_CURSOR_MOVE();
else if (attr) {
MOVE_CURSOR_FROM_HERE();
}
if (attr && (s_editMode>0 || p1valdiff)) {
switch (m_posHorz) {
+24 -19
View File
@@ -204,39 +204,41 @@ void title(const pm_char * s);
#define TITLE(str) title(str)
#if defined(CPUARM)
#define MENU(title, tab, menu, lines_count, ...) \
const uint8_t mstate_tab[] = __VA_ARGS__; \
if (!check(event,menu,tab,DIM(tab),mstate_tab,DIM(mstate_tab)-1,(lines_count)-1)) return; \
TITLE(title)
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
#else
#define MENU(title, tab, menu, lines_count, ...) \
static const pm_uint8_t mstate_tab[] PROGMEM = __VA_ARGS__; \
if (!check(event,menu,tab,DIM(tab),mstate_tab,DIM(mstate_tab)-1,(lines_count)-1)) return; \
TITLE(title)
#define MENU_TAB(...) static const pm_uint8_t mstate_tab[] PROGMEM = __VA_ARGS__
#endif
#define MENU_CHECK(tab, menu, lines_count) \
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1)
#define MENU(title, tab, menu, lines_count, ...) \
MENU_TAB(__VA_ARGS__); \
if (!MENU_CHECK(tab, menu, lines_count)) return; \
TITLE(title)
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
if (!check_simple(event,menu,tab,DIM(tab),(lines_count)-1)) return;
if (!check_simple(event,menu,tab,DIM(tab),(lines_count)-1)) return;
#define SIMPLE_MENU(title, tab, menu, lines_count) \
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
TITLE(title)
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
TITLE(title)
#define SUBMENU_NOTITLE(lines_count, ...) { \
static const pm_uint8_t mstate_tab[] PROGMEM = __VA_ARGS__; \
if (!check(event,0,NULL,0,mstate_tab,DIM(mstate_tab)-1,(lines_count)-1)) return; }
static const pm_uint8_t mstate_tab[] PROGMEM = __VA_ARGS__; \
if (!check(event,0,NULL,0,mstate_tab,DIM(mstate_tab)-1,(lines_count)-1)) return; }
#define SUBMENU(title, lines_count, ...) \
static const pm_uint8_t mstate_tab[] PROGMEM = __VA_ARGS__; \
if (!check(event,0,NULL,0,mstate_tab,DIM(mstate_tab)-1,(lines_count)-1)) return; \
TITLE(title)
static const pm_uint8_t mstate_tab[] PROGMEM = __VA_ARGS__; \
if (!check(event,0,NULL,0,mstate_tab,DIM(mstate_tab)-1,(lines_count)-1)) return; \
TITLE(title)
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
if (!check_submenu_simple(event,(lines_count)-1)) return;
if (!check_submenu_simple(event,(lines_count)-1)) return;
#define SIMPLE_SUBMENU(title, lines_count) \
SIMPLE_SUBMENU_NOTITLE(lines_count); \
TITLE(title)
SIMPLE_SUBMENU_NOTITLE(lines_count); \
TITLE(title)
int8_t selectMenuItem(uint8_t x, uint8_t y, const pm_char *label, const pm_char *values, int8_t value, int8_t min, int8_t max, LcdFlags attr, uint8_t event);
uint8_t onoffMenuItem(uint8_t value, uint8_t x, uint8_t y, const pm_char *label, LcdFlags attr, uint8_t event );
@@ -342,10 +344,13 @@ void menuChannelsView(uint8_t event);
#if defined(PCBTARANIS)
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = 0; }
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
#elif defined(ROTARY_ENCODER_NAVIGATION)
#define REPEAT_LAST_CURSOR_MOVE() { if (EVT_KEY_MASK(event) >= 0x0e) putEvent(event); else m_posHorz = 0; }
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
#else
#define REPEAT_LAST_CURSOR_MOVE() m_posHorz = 0;
#define MOVE_CURSOR_FROM_HERE() REPEAT_LAST_CURSOR_MOVE()
#endif
#if defined(PCBTARANIS)
+18 -14
View File
@@ -317,28 +317,30 @@ void displayTimers()
{
// Main timer
if (g_model.timers[0].mode) {
putsTime(TIMERS_X, TIMER1_Y, s_timerVal[0], MIDSIZE|LEFT, MIDSIZE|LEFT);
TimerState & timerState = timersStates[0];
putsTime(TIMERS_X, TIMER1_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT);
putsTmrMode(TIMERS_X, TIMER1_Y-6, g_model.timers[0].mode, SWCONDENSED|SMLSIZE);
if (g_model.timers[0].persistent) lcd_putcAtt(TIMERS_R, TIMER1_Y+1, 'P', SMLSIZE);
if (s_timerVal[0] < 0) lcd_hline(TIMERS_X-6, TIMER1_Y+2, 4);
if (timerState.val < 0) lcd_hline(TIMERS_X-6, TIMER1_Y+2, 4);
}
// Second timer
if (g_model.timers[1].mode) {
putsTime(TIMERS_X, TIMER2_Y, s_timerVal[1], MIDSIZE|LEFT, MIDSIZE|LEFT);
TimerState & timerState = timersStates[1];
putsTime(TIMERS_X, TIMER2_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT);
putsTmrMode(TIMERS_X, TIMER2_Y-6, g_model.timers[1].mode, SWCONDENSED|SMLSIZE);
if (g_model.timers[1].persistent) lcd_putcAtt(TIMERS_R, TIMER2_Y+1, 'P', SMLSIZE);
if (s_timerVal[1] < 0) lcd_hline(TIMERS_X-6, TIMER2_Y+2, 4);
if (timerState.val < 0) lcd_hline(TIMERS_X-6, TIMER2_Y+2, 4);
}
// Main timer beeping
if (s_timerState[0]==TMR_BEEPING) {
if (timersStates[0].state==TMR_BEEPING) {
if (BLINK_ON_PHASE)
lcd_filled_rect(TIMERS_X-17, TIMER1_Y, 70, 12);
}
// Second timer beeping
if (s_timerState[1]==TMR_BEEPING) {
if (timersStates[1].state==TMR_BEEPING) {
if (BLINK_ON_PHASE)
lcd_filled_rect(TIMERS_X-17, TIMER2_Y, 70, 12);
}
@@ -348,9 +350,10 @@ void displayTimers()
{
// Main timer
if (g_model.timers[0].mode) {
uint8_t att = DBLSIZE | (s_timerState[0]==TMR_BEEPING ? BLINK|INVERS : 0);
putsTime(12*FW+2+10*FWNUM-4, FH*2, s_timerVal[0], att, att);
putsTmrMode(s_timerVal[0] >= 0 ? 9*FW-FW/2+3 : 9*FW-FW/2-4, FH*3, g_model.timers[0].mode, SWCONDENSED);
TimerState & timerState = timersStates[0];
uint8_t att = DBLSIZE | (timerState.state==TMR_BEEPING ? BLINK|INVERS : 0);
putsTime(12*FW+2+10*FWNUM-4, FH*2, timerState.val, att, att);
putsTmrMode(timerState.val >= 0 ? 9*FW-FW/2+3 : 9*FW-FW/2-4, FH*3, g_model.timers[0].mode, SWCONDENSED);
}
}
#endif
@@ -564,7 +567,8 @@ void menuMainView(uint8_t event)
case EVT_KEY_TELEMETRY:
#if defined(FRSKY)
chainMenu(menuTelemetryFrsky);
if (!IS_FAI_ENABLED())
chainMenu(menuTelemetryFrsky);
#elif defined(JETI)
JETI_EnableRXD(); // enable JETI-Telemetry reception
chainMenu(menuTelemetryJeti);
@@ -583,8 +587,8 @@ void menuMainView(uint8_t event)
return;
case EVT_KEY_FIRST(KEY_EXIT):
if (s_timerState[0]==TMR_BEEPING) {
s_timerState[0] = TMR_STOPPED;
if (timersStates[0].state==TMR_BEEPING) {
timersStates[0].state = TMR_STOPPED;
}
else if (s_global_warning) {
s_global_warning = NULL;
@@ -796,8 +800,8 @@ void menuMainView(uint8_t event)
}
}
else { // timer2
putsTime(33+FW+2+10*FWNUM-4, FH*5, s_timerVal[1], DBLSIZE, DBLSIZE);
putsTmrMode(s_timerVal[1] >= 0 ? 20-FW/2+5 : 20-FW/2-2, FH*6, g_model.timers[1].mode, SWCONDENSED);
putsTime(33+FW+2+10*FWNUM-4, FH*5, timersStates[1].val, DBLSIZE, DBLSIZE);
putsTmrMode(timersStates[1].val >= 0 ? 20-FW/2+5 : 20-FW/2-2, FH*6, g_model.timers[1].mode, SWCONDENSED);
// lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s
}
#endif // PCBTARANIS
+2 -2
View File
@@ -54,8 +54,8 @@ void menuStatisticsView(uint8_t event)
}
lcd_puts( 1*FW, FH*1, STR_TM1TM2);
putsTime( 5*FW+5*FWNUM+1, FH*1, s_timerVal[0], 0, 0);
putsTime( 12*FW+5*FWNUM+1, FH*1, s_timerVal[1], 0, 0);
putsTime( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0);
putsTime( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0);
lcd_puts( 1*FW, FH*2, STR_THRTHP);
putsTime( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0);
+8 -8
View File
@@ -685,8 +685,8 @@ void lcdDrawTelemetryTopBar()
uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK : 0);
putsVBat(14*FW,0,att);
if (g_model.timers[0].mode) {
att = (s_timerState[0]==TMR_BEEPING ? BLINK : 0);
putsTime(17*FW+5*FWNUM+1, 0, s_timerVal[0], att, att);
att = (timersStates[0].state==TMR_BEEPING ? BLINK : 0);
putsTime(17*FW+5*FWNUM+1, 0, timersStates[0].val, att, att);
}
lcd_invert_line(0);
}
@@ -697,13 +697,13 @@ void lcdDrawTelemetryTopBar()
uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK : 0);
putsVBat(16*FW+2,0,att);
if (g_model.timers[0].mode) {
att = (s_timerState[0]==TMR_BEEPING ? BLINK : 0);
putsTime(22*FW+5*FWNUM+1, 0, s_timerVal[0], att, att);
att = (timersStates[0].state==TMR_BEEPING ? BLINK : 0);
putsTime(22*FW+5*FWNUM+1, 0, timersStates[0].val, att, att);
lcd_putsiAtt(18*FW+2, 1, STR_VTELEMCHNS, TELEM_TM1, SMLSIZE);
}
if (g_model.timers[1].mode) {
att = (s_timerState[1]==TMR_BEEPING ? BLINK : 0);
putsTime(31*FW+5*FWNUM+1, 0, s_timerVal[1], att, att);
att = (timersStates[1].state==TMR_BEEPING ? BLINK : 0);
putsTime(31*FW+5*FWNUM+1, 0, timersStates[1].val, att, att);
lcd_putsiAtt(27*FW+2, 1, STR_VTELEMCHNS, TELEM_TM2, SMLSIZE);
}
lcd_invert_line(0);
@@ -946,11 +946,11 @@ void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, Lc
#if ROTARY_ENCODERS > 2
int16_t v;
if(idx < (NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA))
v = phaseaddress(phase)->rotaryEncoders[idx];
v = phaseAddress(phase)->rotaryEncoders[idx];
else
v = g_model.rotaryEncodersExtra[phase][idx - (NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA)];
#else
int16_t v = phaseaddress(phase)->rotaryEncoders[idx];
int16_t v = phaseAddress(phase)->rotaryEncoders[idx];
#endif
if (v > ROTARY_ENCODER_MAX) {
+10 -3
View File
@@ -282,16 +282,16 @@ PACK(typedef struct t_EEGeneral {
TrainerData trainer;
uint8_t view; // index of view in main screen
int8_t buzzerMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
uint8_t spare1:1;
uint8_t fai:1;
int8_t beepMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
uint8_t alarmsFlash:1;
uint8_t disableMemoryWarning:1;
uint8_t disableAlarmWarning:1;
uint8_t stickMode:2;
int8_t timezone:5;
uint8_t spare2:1;
uint8_t spare1:1;
uint8_t inactivityTimer;
uint8_t spare3:3;
uint8_t spare2:3;
SPLASH_MODE; /* 3bits */
int8_t hapticMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
uint8_t blOffBright:4;
@@ -606,6 +606,13 @@ enum ResetFunctionParam {
FUNC_RESET_PARAM_LAST = FUNC_RESET_PARAMS_COUNT-1
};
enum AdjustGvarFunctionParam {
FUNC_ADJUST_GVAR_CONSTANT,
FUNC_ADJUST_GVAR_SOURCE,
FUNC_ADJUST_GVAR_GVAR,
FUNC_ADJUST_GVAR_INC,
};
#if defined(CPUARM)
#if defined(PCBTARANIS)
#define LEN_CFN_NAME 10
+118 -99
View File
@@ -316,36 +316,36 @@ void per10ms()
heartbeat |= HEART_TIMER_10MS;
}
PhaseData *phaseaddress(uint8_t idx)
PhaseData *phaseAddress(uint8_t idx)
{
return &g_model.phaseData[idx];
}
ExpoData *expoaddress(uint8_t idx )
ExpoData *expoAddress(uint8_t idx )
{
return &g_model.expoData[idx];
}
MixData *mixaddress(uint8_t idx)
MixData *mixAddress(uint8_t idx)
{
return &g_model.mixData[idx];
}
LimitData *limitaddress(uint8_t idx)
LimitData *limitAddress(uint8_t idx)
{
return &g_model.limitData[idx];
}
int8_t *curveaddress(uint8_t idx)
int8_t *curveAddress(uint8_t idx)
{
return &g_model.points[idx==0 ? 0 : 5*idx+g_model.curves[idx-1]];
}
CurveInfo curveinfo(uint8_t idx)
CurveInfo curveInfo(uint8_t idx)
{
CurveInfo result;
result.crv = curveaddress(idx);
int8_t *next = curveaddress(idx+1);
result.crv = curveAddress(idx);
int8_t *next = curveAddress(idx+1);
uint8_t size = next - result.crv;
if ((size & 1) == 0) {
result.points = (size / 2) + 1;
@@ -358,11 +358,16 @@ CurveInfo curveinfo(uint8_t idx)
return result;
}
CustomSwData *cswaddress(uint8_t idx)
CustomSwData *cswAddress(uint8_t idx)
{
return &g_model.customSw[idx];
}
uint8_t cswFamily(uint8_t func)
{
return (func<CS_AND ? CS_VOFS : (func<CS_EQUAL ? CS_VBOOL : (func<CS_DIFFEGREATER ? CS_VCOMP : (func<CS_TIMER ? CS_VDIFF : CS_VTIMER))));
}
#if defined(CPUM64)
void memclear(void *ptr, uint8_t size)
{
@@ -414,7 +419,7 @@ uint16_t evalChkSum()
inline void applyDefaultTemplate()
{
for (int i=0; i<NUM_STICKS; i++) {
MixData *md = mixaddress(i);
MixData *md = mixAddress(i);
md->destCh = i;
md->weight = 100;
md->srcRaw = channel_order(i+1);
@@ -452,7 +457,7 @@ void modelDefault(uint8_t id)
int16_t intpol(int16_t x, uint8_t idx) // -100, -75, -50, -25, 0 ,25 ,50, 75, 100
{
CurveInfo crv = curveinfo(idx);
CurveInfo crv = curveInfo(idx);
int16_t erg = 0;
x+=RESXu;
@@ -754,7 +759,7 @@ int8_t calcRESXto100(int16_t x)
// rescaled from -262144 to 262144
int16_t applyLimits(uint8_t channel, int32_t value)
{
LimitData * lim = limitaddress(channel);
LimitData * lim = limitAddress(channel);
int16_t ofs = calc1000toRESX(lim->offset); // multiply to 1.24 to get range (-1024..1024)
int16_t lim_p = calc100toRESX(lim->max + 100);
int16_t lim_n = calc100toRESX(lim->min - 100); //multiply by 10.24 to get same range (-1024..1024)
@@ -859,7 +864,7 @@ getvalue_t getValue(uint8_t i)
else if (i<MIXSRC_LAST_GVAR) return GVAR_VALUE(i+1-MIXSRC_GVAR1, getGVarFlightPhase(s_perout_flight_phase, i+1-MIXSRC_GVAR1));
#endif
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_TX_VOLTAGE) return g_vbat100mV;
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_TM2) return s_timerVal[i+1-MIXSRC_FIRST_TELEM+1-TELEM_TM1];
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_TM2) return timersStates[i+1-MIXSRC_FIRST_TELEM+1-TELEM_TM1].val;
#if defined(FRSKY)
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_RSSI_TX) return frskyData.rssi[1].value;
else if (i<MIXSRC_FIRST_TELEM-1+TELEM_RSSI_RX) return frskyData.rssi[0].value;
@@ -939,12 +944,12 @@ bool __getSwitch(int8_t swtch)
else {
s_last_switch_used |= mask;
CustomSwData * cs = cswaddress(cs_idx);
CustomSwData * cs = cswAddress(cs_idx);
uint8_t s = cs->andsw;
if (cs->func == CS_OFF || (s && !__getSwitch(s))) {
result = false;
}
else if ((s=CS_STATE(cs->func)) == CS_VBOOL) {
else if ((s=cswFamily(cs->func)) == CS_VBOOL) {
bool res1 = __getSwitch(cs->v1);
bool res2 = __getSwitch(cs->v2);
switch (cs->func) {
@@ -960,6 +965,9 @@ bool __getSwitch(int8_t swtch)
break;
}
}
else if (s == CS_VTIMER) {
result = int8_t(csLastValue[cs_idx]) >= 0;
}
else {
getvalue_t x = getValue(cs->v1-1);
getvalue_t y;
@@ -1194,7 +1202,7 @@ uint8_t getFlightPhase()
int16_t getRawTrimValue(uint8_t phase, uint8_t idx)
{
PhaseData *p = phaseaddress(phase);
PhaseData *p = phaseAddress(phase);
#if defined(PCBSTD)
return (((int16_t)p->trim[idx]) << 2) + ((p->trim_ext >> (2*idx)) & 0x03);
#else
@@ -1209,7 +1217,7 @@ int16_t getTrimValue(uint8_t phase, uint8_t idx)
void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim)
{
PhaseData *p = phaseaddress(phase);
PhaseData *p = phaseAddress(phase);
#if defined(PCBSTD)
p->trim[idx] = (int8_t)(trim >> 2);
p->trim_ext = (p->trim_ext & ~(0x03 << (2*idx))) + (((trim & 0x03) << (2*idx)));
@@ -1241,11 +1249,11 @@ uint8_t getRotaryEncoderFlightPhase(uint8_t idx)
#if ROTARY_ENCODERS > 2
int16_t value;
if(idx<(NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA))
value = phaseaddress(phase)->rotaryEncoders[idx];
value = phaseAddress(phase)->rotaryEncoders[idx];
else
value = g_model.rotaryEncodersExtra[phase][idx-(NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA)];
#else
int16_t value = phaseaddress(phase)->rotaryEncoders[idx];
int16_t value = phaseAddress(phase)->rotaryEncoders[idx];
#endif
if (value <= ROTARY_ENCODER_MAX) return phase;
uint8_t result = value-ROTARY_ENCODER_MAX-1;
@@ -1261,7 +1269,7 @@ int16_t getRotaryEncoder(uint8_t idx)
if(idx >= (NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA))
return g_model.rotaryEncodersExtra[getRotaryEncoderFlightPhase(idx)][idx-(NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA)];
#endif
return phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx];
return phaseAddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx];
}
void incRotaryEncoder(uint8_t idx, int8_t inc)
@@ -1270,11 +1278,11 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
#if ROTARY_ENCODERS > 2
int16_t *value;
if (idx < (NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA))
value = &(phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
value = &(phaseAddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
else
value = &(g_model.rotaryEncodersExtra[getRotaryEncoderFlightPhase(idx)][idx-(NUM_ROTARY_ENCODERS - NUM_ROTARY_ENCODERS_EXTRA)]);
#else
int16_t *value = &(phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
int16_t *value = &(phaseAddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
#endif
*value = limit((int16_t)-1024, (int16_t)(*value + (inc * 8)), (int16_t)+1024);
eeDirty(EE_MODEL);
@@ -1441,7 +1449,7 @@ getvalue_t convertTelemValue(uint8_t channel, uint8_t value)
getvalue_t convertCswTelemValue(CustomSwData * cs)
{
getvalue_t val;
if (CS_STATE(cs->func)==CS_VOFS)
if (cswFamily(cs->func)==CS_VOFS)
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2);
else
val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2) - convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128);
@@ -2049,17 +2057,15 @@ uint8_t flashCounter = 0;
uint16_t s_timeCumTot;
uint16_t s_timeCumThr; // THR in 1/16 sec
uint16_t s_timeCum16ThrP; // THR% in 1/16 sec
uint8_t s_timerState[2];
int16_t s_timerVal[2];
uint8_t s_timerVal_10ms[2] = {0, 0};
uint8_t trimsCheckTimer = 0;
void resetTimer(uint8_t idx)
{
s_timerState[idx] = TMR_OFF; // is changed to RUNNING dep from mode
s_timerVal[idx] = g_model.timers[idx].start;
s_timerVal_10ms[idx] = 0 ;
TimerState & timerState = timersStates[idx];
timerState.state = TMR_OFF; // is changed to RUNNING dep from mode
timerState.val = g_model.timers[idx].start;
timerState.val_10ms = 0 ;
}
void resetAll()
@@ -2076,7 +2082,7 @@ void resetAll()
resetTelemetry();
#endif
for (uint8_t i=0; i<NUM_CSW; i++)
csLastValue[i] = -32668;
csLastValue[i] = -32768;
#if defined(THRTRACE)
s_traceCnt = 0;
@@ -2084,10 +2090,7 @@ void resetAll()
#endif
}
static uint8_t lastSwPos[2] = {0, 0};
static uint16_t s_cnt[2] = {0, 0};
static uint16_t s_sum[2] = {0, 0};
static uint8_t sw_toggled[2] = {false, false};
TimerState timersStates[MAX_TIMERS] = { { 0 }, { 0 } };
#if defined(THRTRACE)
uint8_t s_traceBuf[MAXTRACE];
@@ -2594,7 +2597,7 @@ void evalFunctions()
#endif
#if defined(CPUARM) && defined(SDCARD)
else if (CFN_FUNC(sd) == FUNC_PLAY_TRACK || CFN_FUNC(sd) == FUNC_PLAY_VALUE) {
else if (!IS_FAI_ENABLED() && (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)) {
@@ -2609,7 +2612,7 @@ void evalFunctions()
}
}
}
else if (CFN_FUNC(sd) == FUNC_BACKGND_MUSIC) {
else if (!IS_FAI_ENABLED() && (CFN_FUNC(sd) == FUNC_BACKGND_MUSIC)) {
if (!IS_PLAYING(i+1)) {
playCustomFunctionFile(sd, i+1);
}
@@ -2623,7 +2626,7 @@ void evalFunctions()
}
}
#elif defined(VOICE)
else if (CFN_FUNC(sd) == FUNC_PLAY_TRACK || CFN_FUNC(sd) == FUNC_PLAY_BOTH || CFN_FUNC(sd) == FUNC_PLAY_VALUE) {
else if (!IS_FAI_ENABLED() && (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)) {
@@ -2808,7 +2811,7 @@ void perOut(uint8_t mode, uint8_t tick10ms)
if (mode==e_perout_mode_normal && pass==0) swOn[i].activeMix = 0;
#endif
MixData *md = mixaddress(i);
MixData *md = mixAddress(i);
if (md->srcRaw == 0) break;
@@ -2977,7 +2980,7 @@ void perOut(uint8_t mode, uint8_t tick10ms)
*ptr = dv;
#if defined(BOLD_FONT)
if (mode==e_perout_mode_normal) {
for (uint8_t m=i-1; m<MAX_MIXERS && mixaddress(m)->destCh==md->destCh; m--)
for (uint8_t m=i-1; m<MAX_MIXERS && mixAddress(m)->destCh==md->destCh; m--)
swOn[m].activeMix = false;
}
#endif
@@ -3178,17 +3181,17 @@ void doMixerCalculations()
uint8_t ch = g_model.thrTraceSrc-NUM_POTS-1;
val = channelOutputs[ch];
int16_t gModelMax = calc100toRESX(g_model.limitData[ch].max)+1024;
int16_t gModelMin = calc100toRESX(g_model.limitData[ch].min)-1024;
int16_t gModelMax = calc100toRESX(limitAddress(ch)->max)+1024;
int16_t gModelMin = calc100toRESX(limitAddress(ch)->min)-1024;
if (g_model.limitData[ch].revert)
if (limitAddress(ch)->revert)
val = -val + gModelMax;
else
val = val - gModelMin;
#if defined(PPM_LIMITS_SYMETRICAL)
if (g_model.limitData[ch].symetrical)
val -= calc1000toRESX(g_model.limitData[ch].offset);
if (limitAddress(ch)->symetrical)
val -= calc1000toRESX(limitAddress(ch)->offset);
#endif
// @@@ open.20.fsguruh optimized calculation; now *8 /8 instead of 10 base; (*16/16 already cause a overrun; unsigned calculation also not possible, because v may be negative)
gModelMax -= gModelMin; // we compare difference between Max and Mix for recaling needed; Max and Min are shifted to 0 by default
@@ -3196,10 +3199,10 @@ void doMixerCalculations()
gModelMax >>= (10-2);
if (gModelMax != 8)
val = (val << 3) / (gModelMax); // recaling only needed if Min, Max differs
val = (val << 3) / (gModelMax); // rescaling only needed if Min, Max differs
// if (gModelMax!=2048) val = (int32_t) (val << 11) / (gModelMax); // recaling only needed if Min, Max differs
// val = val * 10 / (10+(g_model.limitData[ch].max-g_model.limitData[ch].min)/20);
// val = val * 10 / (10+(limitAddress(ch)->max-limitAddress(ch)->min)/20);
if (val<0) val=0; // prevent val be negative, which would corrupt throttle trace and timers; could occur if safetyswitch is smaller than limits
}
else {
@@ -3223,12 +3226,13 @@ void doMixerCalculations()
for (uint8_t i=0; i<MAX_TIMERS; i++) {
int8_t tm = g_model.timers[i].mode;
uint16_t tv = g_model.timers[i].start;
TimerState * timerState = &timersStates[i];
if (tm) {
if (s_timerState[i] == TMR_OFF) {
s_timerState[i] = TMR_RUNNING;
s_cnt[i] = 0;
s_sum[i] = 0;
if (timerState->state == TMR_OFF) {
timerState->state = TMR_RUNNING;
timerState->cnt = 0;
timerState->sum = 0;
}
uint8_t atm = (tm >= 0 ? tm : TMR_VAROFS-tm-1);
@@ -3236,20 +3240,20 @@ void doMixerCalculations()
// value for time described in timer->mode
// OFFABSTHsTH%THt
if (atm == TMRMODE_THR_REL) {
s_cnt[i]++;
s_sum[i]+=val;
timerState->cnt++;
timerState->sum+=val;
}
if (atm>=(TMR_VAROFS+MAX_SWITCH)){ // toggeled switch
if(!(sw_toggled[i] | s_sum[i] | s_cnt[i] | lastSwPos[i])) { lastSwPos[i] = tm < 0; s_sum[i] = 1; } // if initializing then init the lastSwPos
if(!(timerState->toggled | timerState->sum | timerState->cnt | timerState->lastPos)) { timerState->lastPos = tm < 0; timerState->sum = 1; } // if initializing then init the lastPos
uint8_t swPos = getSwitch(tm>0 ? tm-(TMR_VAROFS+MAX_SWITCH-1) : tm+MAX_SWITCH);
if (swPos && !lastSwPos[i]) sw_toggled[i] = !sw_toggled[i]; // if switch is flipped first time -> change counter state
lastSwPos[i] = swPos;
if (swPos && !timerState->lastPos) timerState->toggled = !timerState->toggled; // if switch is flipped first time -> change counter state
timerState->lastPos = swPos;
}
if ( (s_timerVal_10ms[i] += tick10ms ) >= 100 ) {
s_timerVal_10ms[i] -= 100 ;
int16_t newTimerVal = s_timerVal[i];
if ((timerState->val_10ms += tick10ms) >= 100) {
timerState->val_10ms -= 100 ;
int16_t newTimerVal = timerState->val;
if (tv) newTimerVal = tv - newTimerVal;
if (atm==TMRMODE_ABS) {
@@ -3262,17 +3266,17 @@ void doMixerCalculations()
// @@@ open.20.fsguruh: why so complicated? we have already a s_sum field; use it for the half seconds (not showable) as well
// check for s_cnt[i]==0 is not needed because we are shure it is at least 1
#if defined(ACCURAT_THROTTLE_TIMER)
if ((s_sum[i]/s_cnt[i])>=128) { // throttle was normalized to 0 to 128 value (throttle/64*2 (because - range is added as well)
if ((timerState->sum/timerState->cnt)>=128) { // throttle was normalized to 0 to 128 value (throttle/64*2 (because - range is added as well)
newTimerVal++; // add second used of throttle
s_sum[i]-=128*s_cnt[i];
timerState->sum-=128*timerState->cnt;
}
#else
if ((s_sum[i]/s_cnt[i])>=32) { // throttle was normalized to 0 to 32 value (throttle/16*2 (because - range is added as well)
if ((timerState->sum/timerState->cnt)>=32) { // throttle was normalized to 0 to 32 value (throttle/16*2 (because - range is added as well)
newTimerVal++; // add second used of throttle
s_sum[i]-=32*s_cnt[i];
timerState->sum-=32*timerState->cnt;
}
#endif
s_cnt[i]=0;
timerState->cnt=0;
}
else if (atm==TMRMODE_THR_TRG) {
if (val || newTimerVal > 0)
@@ -3280,26 +3284,26 @@ void doMixerCalculations()
}
else {
if (atm<(TMR_VAROFS+MAX_SWITCH))
sw_toggled[i] = tm>0 ? getSwitch(tm-(TMR_VAROFS-1)) : !getSwitch(-tm); // normal switch
if (sw_toggled[i])
timerState->toggled = tm>0 ? getSwitch(tm-(TMR_VAROFS-1)) : !getSwitch(-tm); // normal switch
if (timerState->toggled)
newTimerVal++;
}
switch(s_timerState[i])
switch(timerState->state)
{
case TMR_RUNNING:
if (tv && newTimerVal>=(int16_t)tv) s_timerState[i]=TMR_BEEPING;
if (tv && newTimerVal>=(int16_t)tv) timerState->state = TMR_BEEPING;
break;
case TMR_BEEPING:
if (newTimerVal >= (int16_t)tv + MAX_ALERT_TIME) s_timerState[i]=TMR_STOPPED;
if (newTimerVal >= (int16_t)tv + MAX_ALERT_TIME) timerState->state = TMR_STOPPED;
break;
}
if (tv) newTimerVal = tv - newTimerVal; //if counting backwards - display backwards
if (newTimerVal != s_timerVal[i]) { // beep only if seconds advance
s_timerVal[i] = newTimerVal;
if (s_timerState[i] == TMR_RUNNING) {
if (newTimerVal != timerState->val) { // beep only if seconds advance
timerState->val = newTimerVal;
if (timerState->state == TMR_RUNNING) {
if (g_model.timers[i].countdownBeep && g_model.timers[i].start) { // beep when 30, 15, 10, 5,4,3,2,1 seconds remaining
if (newTimerVal==30) AUDIO_TIMER_30(); // beep three times
if (newTimerVal==20) AUDIO_TIMER_20(); // beep two times
@@ -3310,7 +3314,7 @@ void doMixerCalculations()
AUDIO_TIMER_MINUTE(newTimerVal);
}
}
else if (s_timerState[0] == TMR_BEEPING) {
else if (timerState->state == TMR_BEEPING) {
AUDIO_WARNING1();
}
}
@@ -3330,7 +3334,7 @@ void doMixerCalculations()
s_cnt_1s++;
s_sum_1s+=val;
// @@@ open.20.fsguruh: moved code here; at least val variable conflicts with caculations above, safer here?
// @@@ open.20.fsguruh: moved code here; at least val variable conflicts with calculations above, safer here?
// even reduced code size about 8 bytes, why ever?
if ((tmr10ms_t)(tmr10ms - s_time_tot) >= 100) { // 1sec
s_time_tot += 100;
@@ -3338,7 +3342,6 @@ void doMixerCalculations()
struct t_inactivity *ptrInactivity = &inactivity;
FORCE_INDIRECT(ptrInactivity) ;
ptrInactivity->counter++;
if ((((uint8_t)ptrInactivity->counter)&0x07)==0x01 && g_eeGeneral.inactivityTimer && g_vbat100mV>50 && ptrInactivity->counter > ((uint16_t)g_eeGeneral.inactivityTimer*60))
AUDIO_INACTIVITY();
@@ -3381,6 +3384,30 @@ void doMixerCalculations()
s_cnt_1s = 0;
s_sum_1s = 0;
for (uint8_t i=0; i<NUM_CSW; i++) {
CustomSwData * cs = cswAddress(i);
int8_t *lastValue = (int8_t *)&csLastValue[i];
if (cs->func == CS_TIMER) {
if (*lastValue == 0) {
*lastValue = -cs->v1-1;
}
else if (*lastValue < 0) {
if (++(*lastValue) == 0)
*lastValue = cs->v2;
}
else { // if (*lastValue > 0)
*lastValue -= 1;
}
if (cs->andsw) {
int8_t x;
x = cs->andsw;
if (!getSwitch(x) == 0) {
*lastValue = -1;
}
}
}
}
}
if (s_fade_flight_phases) {
@@ -3440,34 +3467,25 @@ static const pm_uint8_t rate[] PROGMEM = { 0, 0, 100, 40, 16, 7, 3, 1 } ;
uint8_t calcStickScroll( uint8_t index )
{
uint8_t direction ;
int8_t value ;
uint8_t direction;
int8_t value;
if ( ( g_eeGeneral.stickMode & 1 ) == 0 )
{
index ^= 3 ;
}
if ( ( g_eeGeneral.stickMode & 1 ) == 0 )
index ^= 3;
value = calibratedStick[index] / 128 ;
direction = value > 0 ? 0x80 : 0 ;
if ( value < 0 )
{
value = -value ; // (abs)
}
if ( value > 7 )
{
value = 7 ;
}
value = pgm_read_byte(rate+(uint8_t)value) ;
if ( value )
{
StickScrollTimer = STICK_SCROLL_TIMEOUT ; // Seconds
}
return value | direction ;
value = calibratedStick[index] / 128;
direction = value > 0 ? 0x80 : 0;
if (value < 0)
value = -value; // (abs)
if (value > 7)
value = 7;
value = pgm_read_byte(rate+(uint8_t)value);
if (value)
StickScrollTimer = STICK_SCROLL_TIMEOUT; // Seconds
return value | direction;
}
#endif
void perMain()
{
#if defined(SIMU)
@@ -4033,8 +4051,9 @@ void saveTimers()
{
for (uint8_t i=0; i<MAX_TIMERS; i++) {
if (g_model.timers[i].persistent) {
if (g_model.timers[i].value != (uint16_t)s_timerVal[i]) {
g_model.timers[i].value = s_timerVal[i];
TimerState *timerState = &timersStates[i];
if (g_model.timers[i].value != (uint16_t)timerState->val) {
g_model.timers[i].value = timerState->val;
eeDirty(EE_MODEL);
}
}
+40 -18
View File
@@ -198,6 +198,17 @@
typedef __int24 int24_t;
#endif
#if defined(FAI)
#define IS_FAI_ENABLED() true
#define IF_FAI_CHOICE(x)
#elif defined(FAI_CHOICE)
#define IS_FAI_ENABLED() g_eeGeneral.fai
#define IF_FAI_CHOICE(x) x,
#else
#define IS_FAI_ENABLED() false
#define IF_FAI_CHOICE(x)
#endif
#if defined(SIMU)
#ifndef FORCEINLINE
#define FORCEINLINE
@@ -386,7 +397,7 @@ enum EnumKeys {
#define PPM_CENTER 1500
#if defined(PPM_CENTER_ADJUSTABLE)
#define PPM_CH_CENTER(ch) (PPM_CENTER+limitaddress(ch)->ppmCenter)
#define PPM_CH_CENTER(ch) (PPM_CENTER+limitAddress(ch)->ppmCenter)
#else
#define PPM_CH_CENTER(ch) (PPM_CENTER)
#endif
@@ -581,15 +592,16 @@ enum CswFunctions {
CS_LESS,
CS_DIFFEGREATER,
CS_ADIFFEGREATER,
// TODO add CS_TIMER,
CS_MAXF = CS_ADIFFEGREATER
CS_TIMER,
CS_MAXF = CS_TIMER
};
#define CS_VOFS 0
#define CS_VBOOL 1
#define CS_VCOMP 2
#define CS_VDIFF 3
#define CS_STATE(x) ((x)<CS_AND ? CS_VOFS : ((x)<CS_EQUAL ? CS_VBOOL : ((x)<CS_DIFFEGREATER ? CS_VCOMP : CS_VDIFF)))
#define CS_VOFS 0
#define CS_VBOOL 1
#define CS_VCOMP 2
#define CS_VDIFF 3
#define CS_VTIMER 4
uint8_t cswFamily(uint8_t func);
#define NUM_CYC 3
#define NUM_CAL_PPM 4
@@ -862,9 +874,19 @@ extern void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim);
extern uint16_t s_timeCumTot;
extern uint16_t s_timeCumThr; //gewichtete laufzeit in 1/16 sec
extern uint16_t s_timeCum16ThrP; //gewichtete laufzeit in 1/16 sec
extern uint8_t s_timerState[2];
extern int16_t s_timerVal[2];
extern uint8_t s_timerVal_10ms[2];
struct TimerState {
uint8_t lastPos;
uint16_t cnt;
uint16_t sum;
uint8_t toggled;
uint8_t state;
int16_t val;
uint8_t val_10ms;
};
extern TimerState timersStates[MAX_TIMERS];
extern int8_t safetyCh[NUM_CHNOUT];
extern uint8_t trimsCheckTimer;
@@ -1119,19 +1141,19 @@ extern uint16_t lightOffCounter;
extern uint8_t flashCounter;
extern uint8_t mixWarning;
extern PhaseData *phaseaddress(uint8_t idx);
extern ExpoData *expoaddress(uint8_t idx);
extern MixData *mixaddress(uint8_t idx);
extern LimitData *limitaddress(uint8_t idx);
extern int8_t *curveaddress(uint8_t idx);
extern CustomSwData *cswaddress(uint8_t idx);
extern PhaseData *phaseAddress(uint8_t idx);
extern ExpoData *expoAddress(uint8_t idx);
extern MixData *mixAddress(uint8_t idx);
extern LimitData *limitAddress(uint8_t idx);
extern int8_t *curveAddress(uint8_t idx);
extern CustomSwData *cswAddress(uint8_t idx);
struct CurveInfo {
int8_t *crv;
uint8_t points;
bool custom;
};
extern CurveInfo curveinfo(uint8_t idx);
extern CurveInfo curveInfo(uint8_t idx);
extern void deleteExpoMix(uint8_t expo, uint8_t idx);
-1
View File
@@ -88,7 +88,6 @@ void setupPulsesDsm2(uint8_t chns)
{
static uint8_t dsmDat[2+6*2]={0xFF,0x00, 0x00,0xAA, 0x05,0xFF, 0x09,0xFF, 0x0D,0xFF, 0x13,0x54, 0x14,0xAA};
uint8_t counter ;
// CSwData &cs = g_model.customSw[NUM_CSW-1];
Serial_byte = 0 ;
Serial_bit_count = 0 ;
+3 -5
View File
@@ -36,13 +36,11 @@
#include "../opentx.h"
#define PPM_STREAM_INIT { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
#if defined(PCBTARANIS)
// TODO internal module doesn't send PPM
uint16_t ppmStream[NUM_MODULES+1][20] = { { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
uint16_t ppmStream[NUM_MODULES+1][20] = { PPM_STREAM_INIT, PPM_STREAM_INIT, PPM_STREAM_INIT };
#else
uint16_t ppmStream[NUM_MODULES][20] = { MODULES_INIT({ 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }) };
uint16_t ppmStream[NUM_MODULES][20] = { MODULES_INIT(PPM_STREAM_INIT) };
#endif
void setupPulsesPPM(unsigned int port) // Don't enable interrupts through here
+1 -1
View File
@@ -990,7 +990,7 @@ ISR(TIMER1_COMPB_vect) // PXX main interrupt
ISR(TIMER1_COMPC_vect) // DSM2_PPM or PXX end of frame
{
#if defined(DSM2_PPM) && defined(PXX)
if (IS_DSM2_PROTOCOL(g_model.protocol)) { // TODO not s_current_protocol?
if (IS_DSM2_PROTOCOL(s_current_protocol[0])) {
#endif
#if defined(DSM2_PPM)
+4
View File
@@ -135,6 +135,10 @@ inline void boardInit()
#if !defined(CPUM2561)
TIMSK |= (1<<OCIE0) | (1<<TOIE0); // Enable Output-Compare and Overflow interrrupts
#endif
#else
#if !defined(CPUM2561)
TIMSK |= (1<<OCIE0) | (1<<TOIE0); // Enable Output-Compare and Overflow interrrupts
#endif
#endif
}
#endif
+3 -4
View File
@@ -37,6 +37,7 @@
#include "opentx.h"
#define delay_1us() _delay_us(1)
#define delay_2us() _delay_us(2)
void delay_1_5us(uint16_t ms)
{
for (uint16_t i=0; i<ms; i++) delay_1us();
@@ -92,13 +93,11 @@ inline void lcdInit()
LCD_LOCK();
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RES); //LCD_RES
// TODO delay_2us ?
delay_1us();
delay_1us(); // f520 call 0xf4ce delay_1us() ; 0x0xf4ce
delay_2us();
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_RES); // f524 sbi 0x15, 2 IOADR-PORTC_LCD_CTRL; 21 1
delay_1_5us(1500);
for (uint8_t i=0; i<12; i++) {
lcdSendCtl(pgm_read_byte(&lcdInitSequence[i]) ) ;
lcdSendCtl(pgm_read_byte(&lcdInitSequence[i])) ;
}
g_eeGeneral.contrast = 0x22;
LCD_UNLOCK();
+1 -1
View File
@@ -80,7 +80,7 @@ void t_voice::voice_process(void)
PORTB |= (1 << OUT_B_LIGHT); // Latch clock high
if (VoiceQueueCount) {
VoiceSerial = VoiceQueue[VoiceQueueOutIndex++];
VoiceQueueOutIndex &= (VOICE_Q_LENGTH - 1); // TODO flash saving
VoiceQueueOutIndex &= (VOICE_Q_LENGTH - 1);
VoiceQueueCount -= 1;
VoiceTimer = 17;
if (VoiceSerial & 0x8000) { // Looking for sound volume 1F0-1F7
+2 -1
View File
@@ -729,7 +729,8 @@ void telemetryWakeup()
#endif
#if defined(VARIO)
varioWakeup();
if (!IS_FAI_ENABLED())
varioWakeup();
#endif
}
+4 -4
View File
@@ -62,14 +62,14 @@ MixData* setDest(uint8_t dch, uint8_t src, bool clear=false)
MixData * mix;
while (1) {
mix = mixaddress(i);
mix = mixAddress(i);
if (mix->srcRaw && mix->destCh <= dch) {
if (clear && mix->destCh == dch)
deleteExpoMix(0, i);
else {
if (++i==MAX_MIXERS) {
// TODO should return null pointer but needs to be tested then
mix = mixaddress(0);
mix = mixAddress(0);
break;
}
}
@@ -108,7 +108,7 @@ void clearCurves()
void setCurve(uint8_t c, const pm_int8_t ar[])
{
int8_t * cv = curveaddress(c);
int8_t * cv = curveAddress(c);
for (uint8_t i=0; i<5; i++) {
cv[i] = pgm_read_byte(&ar[i]);
}
@@ -116,7 +116,7 @@ void setCurve(uint8_t c, const pm_int8_t ar[])
void setSwitch(uint8_t idx, uint8_t func, int8_t v1, int8_t v2)
{
CustomSwData *cs = cswaddress(idx-1);
CustomSwData *cs = cswAddress(idx-1);
cs->func = func;
cs->v1 = v1;
cs->v2 = v2;
+1 -1
View File
@@ -136,7 +136,7 @@
#define TR_VMIXTRIMS "VYP\0""ZAP\0""Sm\203r""V\212\207k""Plyn""K\206id"
#define LEN_VCSWFUNC "\005"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x""TIM\0"
#define LEN_VFSWFUNC "\013"
+1 -1
View File
@@ -136,7 +136,7 @@
#define TR_VMIXTRIMS "AUS""EIN""Sei""H\203e""Gas""Que" //Mixer Trim Werte
#define LEN_VCSWFUNC "\005"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x""TIM\0"
#define LEN_VFSWFUNC "\012"
+1 -1
View File
@@ -136,7 +136,7 @@
#define TR_VMIXTRIMS "OFF""ON\0""Rud""Ele""Thr""Ail"
#define LEN_VCSWFUNC "\005"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x""TIM\0"
#define LEN_VFSWFUNC "\012"
+1 -1
View File
@@ -136,7 +136,7 @@
#define TR_VMIXTRIMS "OFF""ON\0""Dir""Ele""Ace""Ale"
#define LEN_VCSWFUNC "\005"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x""TIM\0"
#define LEN_VFSWFUNC "\012"
+1 -1
View File
@@ -136,7 +136,7 @@
#define TR_VMIXTRIMS "OFF""ON\0""Dir""Prf""Gaz""Ail"
#define LEN_VCSWFUNC "\005"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x""TIM\0"
#define LEN_VFSWFUNC "\015"
+1 -1
View File
@@ -136,7 +136,7 @@
#define TR_VMIXTRIMS "OFF""ON ""Rud""Ele""Thr""Ail"
#define LEN_VCSWFUNC "\005"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x""TIM\0"
#define LEN_VFSWFUNC "\015"
+1 -1
View File
@@ -136,7 +136,7 @@ Padding for row alignment
#define TR_VMIXTRIMS "OFF""ON\0""Lem""Pfd""Mot""Ail"
#define LEN_VCSWFUNC "\005"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x""TIM\0"
#define LEN_VFSWFUNC "\015"
+1 -1
View File
@@ -136,7 +136,7 @@
#define TR_VMIXTRIMS "AV ""P\203\0""Rod""Hjd""Gas""Ske"
#define LEN_VCSWFUNC "\005"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x"
#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""a<x\0 ""|a|>x""|a|<x""AND\0 ""OR\0 ""XOR\0 ""a=b\0 ""a>b\0 ""a<b\0 ""d}x\0 ""|d|}x""TIM\0"
#define LEN_VFSWFUNC "\012"