90 bytes saved on the channel order array + access functions
This commit is contained in:
@@ -271,7 +271,7 @@ void menuProcSetup(uint8_t event)
|
|||||||
uint8_t attr = sub==subN?INVERS:0;
|
uint8_t attr = sub==subN?INVERS:0;
|
||||||
lcd_puts_P(0, y,STR_RXCHANNELORD);// RAET->AETR
|
lcd_puts_P(0, y,STR_RXCHANNELORD);// RAET->AETR
|
||||||
for (uint8_t i=1; i<=4; i++)
|
for (uint8_t i=1; i<=4; i++)
|
||||||
putsChnLetter((16+i)*FW, y, CHANNEL_ORDER(i), attr);
|
putsChnLetter((16+i)*FW, y, channel_order(i), attr);
|
||||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23);
|
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23);
|
||||||
if((y+=FH)>7*FH) return;
|
if((y+=FH)>7*FH) return;
|
||||||
}subN++;
|
}subN++;
|
||||||
@@ -408,7 +408,7 @@ void menuProcTrainer(uint8_t event)
|
|||||||
blink = (s_editMode>0) ? BLINK : INVERS ;
|
blink = (s_editMode>0) ? BLINK : INVERS ;
|
||||||
|
|
||||||
for (uint8_t i=0; i<NUM_STICKS; i++) {
|
for (uint8_t i=0; i<NUM_STICKS; i++) {
|
||||||
uint8_t chan = pgm_read_byte(chout_ar+g_eeGeneral.templateSetup*4+i); // G: Issue 30.
|
uint8_t chan = channel_order(i+1);
|
||||||
|
|
||||||
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
|
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -56,15 +56,16 @@ int8_t safetyCh[NUM_CHNOUT];
|
|||||||
|
|
||||||
const pm_char s_charTab[] PROGMEM = "_-.,";
|
const pm_char s_charTab[] PROGMEM = "_-.,";
|
||||||
|
|
||||||
//R=1
|
const pm_uint8_t bchout_ar[] PROGMEM = {
|
||||||
//E=2
|
0x1B, 0x1E, 0x27, 0x2D, 0x36, 0x39,
|
||||||
//T=3
|
0x4B, 0x4E, 0x63, 0x6C, 0x72, 0x78,
|
||||||
//A=4
|
0x87, 0x8D, 0x93, 0x9C, 0xB1, 0xB4,
|
||||||
const pm_uint8_t chout_ar[] PROGMEM = { //First number is 0..23 -> template setup, Second is relevant channel out
|
0xC6, 0xC9, 0xD2, 0xD8, 0xE1, 0xE4 };
|
||||||
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,
|
uint8_t channel_order(uint8_t x)
|
||||||
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 };
|
return ( ((pgm_read_byte(bchout_ar + g_eeGeneral.templateSetup) >> (6-(x-1) * 2)) & 3 ) + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
mode1 rud ele thr ail
|
mode1 rud ele thr ail
|
||||||
@@ -78,7 +79,6 @@ const pm_uint8_t modn12x3[] PROGMEM = {
|
|||||||
4, 2, 3, 1,
|
4, 2, 3, 1,
|
||||||
4, 3, 2, 1 };
|
4, 3, 2, 1 };
|
||||||
|
|
||||||
|
|
||||||
char idx2char(int8_t idx)
|
char idx2char(int8_t idx)
|
||||||
{
|
{
|
||||||
if (idx == 0) return ' ';
|
if (idx == 0) return ' ';
|
||||||
|
|||||||
+4
-3
@@ -255,18 +255,19 @@ extern uint16_t DEBUG2;
|
|||||||
|
|
||||||
#define SLAVE_MODE (PING & (1<<INP_G_RF_POW))
|
#define SLAVE_MODE (PING & (1<<INP_G_RF_POW))
|
||||||
|
|
||||||
extern const pm_uint8_t chout_ar[24*4];
|
extern const pm_uint8_t bchout_ar[];
|
||||||
extern const pm_uint8_t modn12x3[4*4];
|
extern const pm_uint8_t modn12x3[];
|
||||||
|
|
||||||
//convert from mode 1 to mode g_eeGeneral.stickMode
|
//convert from mode 1 to mode g_eeGeneral.stickMode
|
||||||
//NOTICE! => 1..4 -> 1..4
|
//NOTICE! => 1..4 -> 1..4
|
||||||
#define CONVERT_MODE(x) (((x)<=4) ? pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + (x)-1) : (x) )
|
#define CONVERT_MODE(x) (((x)<=4) ? pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + (x)-1) : (x) )
|
||||||
#define CHANNEL_ORDER(x) pgm_read_byte(chout_ar + 4*g_eeGeneral.templateSetup + (x)-1)
|
|
||||||
#define THR_STICK (2-(g_eeGeneral.stickMode&1))
|
#define THR_STICK (2-(g_eeGeneral.stickMode&1))
|
||||||
#define ELE_STICK (1+(g_eeGeneral.stickMode&1))
|
#define ELE_STICK (1+(g_eeGeneral.stickMode&1))
|
||||||
#define AIL_STICK ((g_eeGeneral.stickMode&2) ? 0 : 3)
|
#define AIL_STICK ((g_eeGeneral.stickMode&2) ? 0 : 3)
|
||||||
#define RUD_STICK ((g_eeGeneral.stickMode&2) ? 3 : 0)
|
#define RUD_STICK ((g_eeGeneral.stickMode&2) ? 3 : 0)
|
||||||
|
|
||||||
|
extern uint8_t channel_order(uint8_t x);
|
||||||
|
|
||||||
enum EnumKeys {
|
enum EnumKeys {
|
||||||
KEY_MENU ,
|
KEY_MENU ,
|
||||||
KEY_EXIT ,
|
KEY_EXIT ,
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ inline void applyDefaultTemplate()
|
|||||||
MixData *md = mixaddress(i);
|
MixData *md = mixaddress(i);
|
||||||
md->destCh = i+1;
|
md->destCh = i+1;
|
||||||
md->weight = 100;
|
md->weight = 100;
|
||||||
md->srcRaw = CHANNEL_ORDER(i+1);
|
md->srcRaw = channel_order(i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
STORE_MODELVARS;
|
STORE_MODELVARS;
|
||||||
|
|||||||
Reference in New Issue
Block a user