diff --git a/src/general_menus.cpp b/src/general_menus.cpp index b4f839605..d43fe9872 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -366,7 +366,7 @@ void menuProcTrainer(uint8_t event) blink = s_editMode ? BLINK : INVERS ; for (uint8_t i=0; i<4; i++) { - uint8_t chan = chout_ar[g_eeGeneral.templateSetup][i]; // G: Issue 30. + uint8_t chan = pgm_read_byte(chout_ar+g_eeGeneral.templateSetup*4+i); // G: Issue 30. volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1]; diff --git a/src/gruvin9x.cpp b/src/gruvin9x.cpp index 0569ce7f3..2a91a167f 100644 --- a/src/gruvin9x.cpp +++ b/src/gruvin9x.cpp @@ -63,6 +63,22 @@ const prog_char APM modi12x3[]= const prog_char APM s_charTab[] = "_-.,"; +//R=1 +//E=2 +//T=3 +//A=4 +const prog_uint8_t APM chout_ar[24][4] = { //First number is 0..23 -> template setup, Second is relevant channel out +{1,2,3,4},{1,2,4,3},{1,3,2,4},{1,3,4,2},{1,4,2,3},{1,4,3,2}, +{2,1,3,4},{2,1,4,3},{2,3,1,4},{2,3,4,1},{2,4,1,3},{2,4,3,1}, +{3,1,2,4},{3,1,4,2},{3,2,1,4},{3,2,4,1},{3,4,1,2},{3,4,2,1}, +{4,1,2,3},{4,1,3,2},{4,2,1,3},{4,2,3,1},{4,3,1,2},{4,3,2,1} }; + +const prog_uint8_t APM modn12x3[4][4]= { + {1, 2, 3, 4}, + {1, 3, 2, 4}, + {4, 2, 3, 1}, + {4, 3, 2, 1} }; + #ifdef TRANSLATIONS int8_t char2idx(char c) { @@ -245,9 +261,12 @@ void applyExpos(int16_t *anas) uint8_t phase = getFlightPhase(); + int8_t cur_chn = -1; for (uint8_t i=0; i=0 && ed.mode&2)) { int16_t k = ed.expo; - if (IS_THROTTLE(ed.chn) && g_model.thrExpo) + if (IS_THROTTLE(cur_chn) && g_model.thrExpo) v = 2*expo((v+RESX)/2, k); else v = expo(v, k); if (ed.curve) v = applyCurve(v, ed.curve, 0); v = ((int32_t)v * ed.weight) / 100; - if (IS_THROTTLE(ed.chn) && g_model.thrExpo) v -= RESX; - anas[ed.chn] = v; + if (IS_THROTTLE(cur_chn) && g_model.thrExpo) v -= RESX; + anas[cur_chn] = v; } } } diff --git a/src/gruvin9x.h b/src/gruvin9x.h index c458c2650..20d296c04 100644 --- a/src/gruvin9x.h +++ b/src/gruvin9x.h @@ -254,31 +254,17 @@ extern uint16_t DEBUG2; #define SLAVE_MODE (PING & (1< template setup, Second is relevant channel out -{1,2,3,4},{1,2,4,3},{1,3,2,4},{1,3,4,2},{1,4,2,3},{1,4,3,2}, -{2,1,3,4},{2,1,4,3},{2,3,1,4},{2,3,4,1},{2,4,1,3},{2,4,3,1}, -{3,1,2,4},{3,1,4,2},{3,2,1,4},{3,2,4,1},{3,4,1,2},{3,4,2,1}, -{4,1,2,3},{4,1,3,2},{4,2,1,3},{4,2,3,1},{4,3,1,2},{4,3,2,1} }; +extern const prog_uint8_t APM chout_ar[24][4]; +extern const prog_uint8_t APM modn12x3[4][4]; //convert from mode 1 to mode g_eeGeneral.stickMode //NOTICE! => 1..4 -> 1..4 -#define CONVERT_MODE(x) (((x)<=4) ? modn12x3[g_eeGeneral.stickMode][((x)-1)] : (x)) -#define CHANNEL_ORDER(x) (chout_ar[g_eeGeneral.templateSetup][(x)-1]) -#define THR_STICK (2-(g_eeGeneral.stickMode&1)) -#define ELE_STICK (1+(g_eeGeneral.stickMode&1)) -#define AIL_STICK ((g_eeGeneral.stickMode&2) ? 0 : 3) -#define RUD_STICK ((g_eeGeneral.stickMode&2) ? 3 : 0) +#define CONVERT_MODE(x) (((x)<=4) ? pgm_read_byte(modn12x3+g_eeGeneral.stickMode*4+(x)-1) : (x)) +#define CHANNEL_ORDER(x) pgm_read_byte(chout_ar+g_eeGeneral.templateSetup*4+(x)-1) +#define THR_STICK (2-(g_eeGeneral.stickMode&1)) +#define ELE_STICK (1+(g_eeGeneral.stickMode&1)) +#define AIL_STICK ((g_eeGeneral.stickMode&2) ? 0 : 3) +#define RUD_STICK ((g_eeGeneral.stickMode&2) ? 3 : 0) enum EnumKeys { KEY_MENU , diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 8942c0ac5..b02e15008 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -1806,7 +1806,7 @@ void menuProcTemplates(uint8_t event) //write mix names here lcd_outdezNAtt(3*FW, y, k+1, (sub==k ? INVERS : 0)|LEADING0, 2); - lcd_putsAtt( 4*FW, y, n_Templates[k],BSS | (s_noHi ? 0 : (sub==k ? INVERS : 0))); + lcd_putsnAtt(4*FW, y, PSTR(TEMPLATES_STR)+TEMPLATES_LEN*k, TEMPLATES_LEN, (s_noHi ? 0 : (sub==k ? INVERS : 0))); y+=FH; } if(y>7*FH) return; diff --git a/src/pers.cpp b/src/pers.cpp index 55533086e..36a0dc961 100644 --- a/src/pers.cpp +++ b/src/pers.cpp @@ -142,13 +142,14 @@ uint8_t Translate() EEPROM_V4::ExpoData expo4[4]; memcpy(&expo4[0], &v4->expoData[0], sizeof(expo4)); memset(&g_model.expoData[0], 0, sizeof(expo4)); + // expos conversion uint8_t e = 0; for (uint8_t ch=0; ch<4 && e=0 && e