Some new fields now inflight modifiable: DR/EXPOS expo / weight, MIXER weight / offset
This commit is contained in:
+4
-2
@@ -583,11 +583,13 @@ void menuMainView(uint8_t event)
|
||||
#ifdef NAVIGATION_RE1
|
||||
check_rotary_encoder();
|
||||
if (s_warning) {
|
||||
int8_t value = (((uint8_t)(*s_inflight_value)) >> s_inflight_bitshift) - s_inflight_shift;
|
||||
if (p1valdiff) {
|
||||
*s_inflight_value = s_inflight_shift + checkIncDecModel(event, (*s_inflight_value)-s_inflight_shift, s_inflight_min, s_inflight_max);
|
||||
value = checkIncDecModel(event, value, s_inflight_min, s_inflight_max);
|
||||
*s_inflight_value = (((uint8_t)(*s_inflight_value)) & ((1 << s_inflight_bitshift) - 1)) + ((s_inflight_shift + value) << s_inflight_bitshift);
|
||||
}
|
||||
displayBox();
|
||||
lcd_outdezAtt(16, 4*FH, (int8_t)(*s_inflight_value-s_inflight_shift), LEFT);
|
||||
lcd_outdezAtt(16, 4*FH, value, LEFT);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+7
-5
@@ -486,14 +486,15 @@ void displayBox()
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
int8_t *s_inflight_value = NULL;
|
||||
int16_t s_inflight_min;
|
||||
int16_t s_inflight_max;
|
||||
int16_t s_inflight_shift;
|
||||
int8_t s_inflight_min;
|
||||
int8_t s_inflight_max;
|
||||
int8_t s_inflight_shift;
|
||||
uint8_t s_inflight_bitshift;
|
||||
const pm_char *s_inflight_label;
|
||||
|
||||
void checkInFlightIncDecModel(uint8_t event, int8_t *value, int16_t i_min, int16_t i_max, int8_t i_shift, const pm_char *label)
|
||||
void checkInFlightIncDecModel(uint8_t event, int8_t *value, int8_t i_min, int8_t i_max, int8_t i_shift, const pm_char *label, uint8_t bitshift)
|
||||
{
|
||||
*value = i_shift + checkIncDecModel(event, (*value)-i_shift, i_min, i_max);
|
||||
*value = (((uint8_t)(*value)) & ((1 << bitshift) - 1)) + ((i_shift + checkIncDecModel(event, (((uint8_t)(*value)) >> bitshift)-i_shift, i_min, i_max)) << bitshift);
|
||||
|
||||
if (event == EVT_KEY_LONG(BTN_RE1)) {
|
||||
if (value == s_inflight_value) {
|
||||
@@ -505,6 +506,7 @@ void checkInFlightIncDecModel(uint8_t event, int8_t *value, int16_t i_min, int16
|
||||
s_inflight_max = i_max;
|
||||
s_inflight_shift = i_shift;
|
||||
s_inflight_label = label;
|
||||
s_inflight_bitshift = bitshift;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-4
@@ -108,18 +108,25 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
#ifdef NAVIGATION_RE1
|
||||
extern int8_t *s_inflight_value;
|
||||
extern const pm_char *s_inflight_label;
|
||||
extern int16_t s_inflight_min;
|
||||
extern int16_t s_inflight_max;
|
||||
extern int16_t s_inflight_shift;
|
||||
extern int8_t s_inflight_min;
|
||||
extern int8_t s_inflight_max;
|
||||
extern int8_t s_inflight_shift;
|
||||
extern uint8_t s_inflight_bitshift;
|
||||
#define PREPARE_INFLIGHT_BITFIELD(a) int8_t *bitfield = (a)
|
||||
#define INFLIGHT(val) (s_inflight_value==&val ? SURROUNDED : 0)
|
||||
void checkInFlightIncDecModel(uint8_t event, int8_t *value, int16_t i_min, int16_t i_max, int8_t i_shift, const pm_char *label);
|
||||
void checkInFlightIncDecModel(uint8_t event, int8_t *value, int8_t i_min, int8_t i_max, int8_t i_shift, const pm_char *label, uint8_t bitshift=0);
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, imin, imax, ishift, label) \
|
||||
checkInFlightIncDecModel(event, &var, imin, imax, ishift, label)
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR_BITFIELD(event, var, imin, imax, ishift, label, bitshift) \
|
||||
checkInFlightIncDecModel(event, bitfield, imin, imax, ishift, label, bitshift);
|
||||
void check_rotary_encoder();
|
||||
#else
|
||||
#define PREPARE_INFLIGHT_BITFIELD(a)
|
||||
#define INFLIGHT(val) 0
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, min, max, shift, label) \
|
||||
var = shift+checkIncDecModel(event,var-(shift),min,max)
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR_BITFIELD(event, var, min, max, shift, label, bitshift) \
|
||||
var = shift+checkIncDecModel(event,var-(shift),min,max)
|
||||
#endif
|
||||
|
||||
// Menus related stuff ...
|
||||
|
||||
+14
-12
@@ -1103,19 +1103,21 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
|
||||
inline void editExpoVals(uint8_t event, uint8_t which, bool edit, uint8_t y, uint8_t idt)
|
||||
{
|
||||
uint8_t invBlk = edit ? INVERS : 0;
|
||||
// if(edit && stopBlink) invBlk = INVERS;
|
||||
|
||||
ExpoData *ed = expoaddress(idt); // TODO volatile
|
||||
|
||||
switch(which)
|
||||
{
|
||||
case 0:
|
||||
lcd_outdezAtt(9*FW+5, y, ed->weight, invBlk);
|
||||
if(edit) CHECK_INCDEC_MODELVAR(event, ed->weight, 0, 100);
|
||||
{
|
||||
PREPARE_INFLIGHT_BITFIELD(&ed->expo - 1);
|
||||
lcd_outdezAtt(9*FW+5, y, ed->weight, invBlk|INFLIGHT(*bitfield));
|
||||
if (edit) CHECK_INFLIGHT_INCDEC_MODELVAR_BITFIELD(event, ed->weight, 0, 100, 0, STR_DRWEIGHT, 1);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
lcd_outdezAtt(9*FW+5, y, ed->expo, invBlk);
|
||||
if(edit) CHECK_INCDEC_MODELVAR(event, ed->expo, -100, 100);
|
||||
lcd_outdezAtt(9*FW+5, y, ed->expo, invBlk|INFLIGHT(ed->expo));
|
||||
if (edit) CHECK_INFLIGHT_INCDEC_MODELVAR(event, ed->expo, -100, 100, 0, STR_DREXPO);
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
@@ -1195,14 +1197,14 @@ void menuProcMixOne(uint8_t event)
|
||||
if(attr) CHECK_INCDEC_MODELVAR(event, md2->srcRaw, 1,NUM_XCHNRAW);
|
||||
break;
|
||||
case 1:
|
||||
lcd_puts( 2*FW,y,STR_WEIGHT);
|
||||
lcd_outdezAtt(FW*10,y,md2->weight,attr|LEFT);
|
||||
if(attr) CHECK_INCDEC_MODELVAR(event, md2->weight, -125,125);
|
||||
lcd_puts(2*FW, y, STR_WEIGHT);
|
||||
lcd_outdezAtt(FW*10, y, md2->weight, attr|LEFT|INFLIGHT(md2->weight));
|
||||
if (attr) CHECK_INFLIGHT_INCDEC_MODELVAR(event, md2->weight, -125, 125, 0, STR_MIXERWEIGHT);
|
||||
break;
|
||||
case 2:
|
||||
lcd_puts( 2*FW,y,STR_OFFSET);
|
||||
lcd_outdezAtt(FW*10,y,md2->sOffset,attr|LEFT);
|
||||
if(attr) CHECK_INCDEC_MODELVAR( event, md2->sOffset, -125,125);
|
||||
lcd_puts(2*FW, y, STR_OFFSET);
|
||||
lcd_outdezAtt(FW*10, y, md2->sOffset, attr|LEFT|INFLIGHT(md2->sOffset));
|
||||
if (attr) CHECK_INFLIGHT_INCDEC_MODELVAR(event, md2->sOffset, -125, 125, 0, STR_MIXEROFFSET);
|
||||
break;
|
||||
case 3:
|
||||
// TODO hidden when src is not a STICK as it has no sense
|
||||
@@ -1346,7 +1348,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_)
|
||||
event -= KEY_EXIT;
|
||||
}
|
||||
|
||||
TITLEP(expo ? STR_DREXPO : STR_MIXER);
|
||||
TITLEP(expo ? STR_MENUDREXPO : STR_MIXER);
|
||||
lcd_outdezAtt(lcd_lastPos+2*FW+FW/2, 0, getExpoMixCount(expo));
|
||||
lcd_puts(lcd_lastPos, 0, expo ? PSTR("/14") : PSTR("/32"));
|
||||
SIMPLE_MENU_NOTITLE(menuTabModel, expo ? e_ExposAll : e_MixAll, s_maxLines);
|
||||
|
||||
+4
-1
@@ -134,7 +134,6 @@ const pm_char STR_DELAYDOWN[] PROGMEM = TR_DELAYDOWN;
|
||||
const pm_char STR_DELAYUP[] PROGMEM = TR_DELAYUP;
|
||||
const pm_char STR_SLOWDOWN[] PROGMEM = TR_SLOWDOWN;
|
||||
const pm_char STR_SLOWUP[] PROGMEM = TR_SLOWUP;
|
||||
const pm_char STR_DREXPO[] PROGMEM = TR_DREXPO;
|
||||
const pm_char STR_MIXER[] PROGMEM = TR_MIXER;
|
||||
const pm_char STR_COPYTRIMMENU[] PROGMEM = TR_COPYTRIMMENU;
|
||||
const pm_char STR_CV[] PROGMEM = TR_CV;
|
||||
@@ -273,6 +272,10 @@ const pm_char STR_SYNCMENU[] PROGMEM = TR_SYNCMENU;
|
||||
|
||||
#if defined(NAVIGATION_RE1)
|
||||
const pm_char STR_BACK[] PROGMEM = TR_BACK;
|
||||
const pm_char STR_MIXERWEIGHT[] PROGMEM = TR_MIXERWEIGHT;
|
||||
const pm_char STR_MIXEROFFSET[] PROGMEM = TR_MIXEROFFSET;
|
||||
const pm_char STR_DRWEIGHT[] PROGMEM = TR_DRWEIGHT;
|
||||
const pm_char STR_DREXPO[] PROGMEM = TR_DREXPO;
|
||||
const pm_char STR_MINLIMIT[] PROGMEM = TR_MINLIMIT;
|
||||
const pm_char STR_MAXLIMIT[] PROGMEM = TR_MAXLIMIT;
|
||||
#endif
|
||||
|
||||
+7
-1
@@ -216,7 +216,6 @@ extern const pm_char STR_DELAYDOWN[];
|
||||
extern const pm_char STR_DELAYUP[];
|
||||
extern const pm_char STR_SLOWDOWN[];
|
||||
extern const pm_char STR_SLOWUP[];
|
||||
extern const pm_char STR_DREXPO[];
|
||||
extern const pm_char STR_MIXER[];
|
||||
extern const pm_char STR_COPYTRIMMENU[];
|
||||
extern const pm_char STR_CV[];
|
||||
@@ -325,8 +324,15 @@ extern const pm_char STR_MENUSTAT[];
|
||||
extern const pm_char STR_MENUDEBUG[];
|
||||
extern const pm_char STR_RXNUM[];
|
||||
extern const pm_char STR_SYNCMENU[];
|
||||
#endif
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
extern const pm_char STR_BACK[];
|
||||
#define LEN_BACK PSIZE(TR_BACK)
|
||||
extern const pm_char STR_MIXERWEIGHT[];
|
||||
extern const pm_char STR_MIXEROFFSET[];
|
||||
extern const pm_char STR_DRWEIGHT[];
|
||||
extern const pm_char STR_DREXPO[];
|
||||
extern const pm_char STR_MINLIMIT[];
|
||||
extern const pm_char STR_MAXLIMIT[];
|
||||
#endif
|
||||
|
||||
+7
-7
@@ -2288,19 +2288,19 @@ int main(void)
|
||||
|
||||
EIMSK = (3<<INT5) | (3<<INT2); // enable the two rot. enc. ext. int. pairs.
|
||||
/***************************************************/
|
||||
|
||||
/*
|
||||
* SOMO set-up (V4 board only)
|
||||
*/
|
||||
OCR4A = 0x7d;
|
||||
TCCR4B = (1 << WGM42) | (3<<CS40); // CTC OCR1A, 16MHz / 64 (4us ticks)
|
||||
#endif
|
||||
|
||||
#if defined (PCBV4)
|
||||
OCR4A = 0x7d;
|
||||
TCCR4B = (1 << WGM42) | (3<<CS40); // CTC OCR1A, 16MHz / 64 (4us ticks)
|
||||
#endif
|
||||
startPulses();
|
||||
|
||||
wdt_enable(WDTO_500MS);
|
||||
/*** Keep this code block directly before the main loop ****/
|
||||
/***********************************************************/
|
||||
|
||||
while(1){
|
||||
while(1) {
|
||||
uint16_t t0 = getTmr16KHz();
|
||||
|
||||
getADC[g_eeGeneral.filterInput]();
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#define TR_CURVMODES "EDIT ""PRSET""A.THR"
|
||||
|
||||
#define LEN_EXPLABELS 6
|
||||
#define TR_EXPLABELS "Weight""Expo ""Phase ""Swtch ""When ""Curve "" "
|
||||
#define TR_EXPLABELS "Weight""Expo ""Phase ""Swtch ""When ""Curve "" " // TODO remove all the trailing spaces
|
||||
|
||||
#define LEN_VMLTPX 8
|
||||
#define TR_VMLTPX "Add ""Multiply""Replace "
|
||||
@@ -173,7 +173,11 @@
|
||||
#define TR_EDITMIX "EDIT MIX "
|
||||
#define TR_SOURCE "Source"
|
||||
#define TR_WEIGHT "Weight"
|
||||
#define TR_MIXERWEIGHT "Mixer Weight"
|
||||
#define TR_OFFSET "Offset"
|
||||
#define TR_MIXEROFFSET "Mixer Offset"
|
||||
#define TR_DRWEIGHT "DR Weight"
|
||||
#define TR_DREXPO "DR Expo"
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_CURVES "Curves"
|
||||
#define TR_FPHASE "F.Phase"
|
||||
@@ -184,7 +188,6 @@
|
||||
#define TR_DELAYUP "Delay Up"
|
||||
#define TR_SLOWDOWN "Slow Down"
|
||||
#define TR_SLOWUP "Slow Up"
|
||||
#define TR_DREXPO "DR/EXPO"
|
||||
#define TR_MIXER "MIXER"
|
||||
#define TR_COPYTRIMMENU "COPY TRIM [MENU]"
|
||||
#define TR_CV "CV"
|
||||
@@ -285,7 +288,7 @@
|
||||
#define TR_MENUFLIGHTPHASE "FLIGHT PHASE"
|
||||
#define TR_MENUFLIGHTPHASES "FLIGHT PHASES"
|
||||
#define TR_MENUHELISETUP "HELI SETUP"
|
||||
#define TR_MENUDREXPO "DR/EXPO"
|
||||
#define TR_MENUDREXPO "DR/EXPO" // TODO flash saving this string is 2 times here
|
||||
#define TR_MENULIMITS "LIMITS"
|
||||
#define TR_MENUCURVES "CURVES"
|
||||
#define TR_MENUCURVE "CURVE"
|
||||
|
||||
@@ -167,13 +167,17 @@
|
||||
#define TR_AILDIRECTION "Direction AIL"
|
||||
#define TR_COLDIRECTION "Direction COL"
|
||||
#define TR_MODE "MODE"
|
||||
#define TR_NOFREEEXPO "Max expo atteint!"
|
||||
#define TR_NOFREEEXPO "Max expos atteint!"
|
||||
#define TR_NOFREEMIXER "Max mixages atteint!"
|
||||
#define TR_INSERTMIX "INSERER MIXAGE "
|
||||
#define TR_EDITMIX "EDITER MIXAGE "
|
||||
#define TR_SOURCE "Source"
|
||||
#define TR_WEIGHT "Ratio"
|
||||
#define TR_MIXERWEIGHT "Ratio Mixage"
|
||||
#define TR_OFFSET "Offset"
|
||||
#define TR_MIXEROFFSET "Offset Mixage"
|
||||
#define TR_DRWEIGHT "Ratio DR"
|
||||
#define TR_DREXPO "Expo DR"
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_CURVES "Courbe"
|
||||
#define TR_FPHASE "P.Vol"
|
||||
@@ -184,7 +188,6 @@
|
||||
#define TR_DELAYUP "Retard Haut"
|
||||
#define TR_SLOWDOWN "Ralentir Haut"
|
||||
#define TR_SLOWUP "Ralentir Bas"
|
||||
#define TR_DREXPO "DR/EXPO"
|
||||
#define TR_MIXER "MIXEUR"
|
||||
#define TR_COPYTRIMMENU "COPIER TRIM [MENU]"
|
||||
#define TR_CV "CV"
|
||||
@@ -213,7 +216,7 @@
|
||||
#define TR_FILTERADC "Filtre ADC"
|
||||
#define TR_THROTTLEREVERSE "Inversion Gaz"
|
||||
#define TR_MINUTEBEEP "Bip t.minutes"
|
||||
#define TR_BEEPCOUNTDOWN "Bip a rebours"
|
||||
#define TR_BEEPCOUNTDOWN "Bip a rebours"
|
||||
#define TR_FLASHONBEEP "Flash quand bip"
|
||||
#define TR_LIGHTSWITCH "Inter eclairage"
|
||||
#define TR_LIGHTOFFAFTER "Eclair. off apres"
|
||||
|
||||
Reference in New Issue
Block a user