1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Flash saving (78bytes)

This commit is contained in:
bsongis 2012-05-09 07:50:53 +00:00
parent 44b3e31d5a
commit d29e2e25b2

View file

@ -491,61 +491,58 @@ void menuProcTime(uint8_t event)
void menuProcTrainer(uint8_t event) void menuProcTrainer(uint8_t event)
{ {
uint8_t y; uint8_t y;
bool edit; bool slave = SLAVE_MODE;
uint8_t blink ;
if (SLAVE_MODE) { // i am the slave MENU(STR_MENUTRAINER, menuTabDiag, e_Trainer, slave ? 1 : 7, {0, 2, 2, 2, 2, 0/*, 0*/});
SIMPLE_MENU(STR_MENUTRAINER, menuTabDiag, e_Trainer, 1);
if (slave) { // i am the slave
lcd_puts(7*FW, 3*FH, STR_SLAVE); lcd_puts(7*FW, 3*FH, STR_SLAVE);
} }
else { else {
MENU(STR_MENUTRAINER, menuTabDiag, e_Trainer, 7, {0, 2, 2, 2, 2, 0/*, 0*/}); uint8_t attr;
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
lcd_puts(3*FW, 1*FH, STR_MODESRC); lcd_puts(3*FW, 1*FH, STR_MODESRC);
y = 2*FH; y = 2*FH;
blink = (s_editMode>0) ? BLINK|INVERS : INVERS ;
for (uint8_t i=1; i<=NUM_STICKS; i++) { for (uint8_t i=1; i<=NUM_STICKS; i++) {
uint8_t chan = channel_order(i); uint8_t chan = channel_order(i);
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1]; volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
putsChnRaw(0, y, chan, 0); putsChnRaw(0, y, chan, 0);
for (uint8_t j=0; j<3; j++) { for (uint8_t j=0; j<3; j++) {
edit = (m_posVert==i && m_posHorz==j);
bool incdec = (edit && s_editMode>0); attr = ((m_posVert==i && m_posHorz==j) ? blink : 0);
switch(j) { switch(j) {
case 0: case 0:
lcd_putsiAtt(4*FW, y, STR_TRNMODE, td->mode, edit ? blink : 0); lcd_putsiAtt(4*FW, y, STR_TRNMODE, td->mode, attr);
if (incdec) if (attr) CHECK_INCDEC_GENVAR(event, td->mode, 0, 2);
CHECK_INCDEC_GENVAR(event, td->mode, 0, 2);
break; break;
case 1: case 1:
lcd_outdezAtt(11*FW, y, td->studWeight, edit ? blink : 0); lcd_outdezAtt(11*FW, y, td->studWeight, attr);
if (incdec) if (attr) CHECK_INCDEC_GENVAR(event, td->studWeight, -100, 100);
CHECK_INCDEC_GENVAR(event, td->studWeight, -100, 100);
break; break;
case 2: case 2:
lcd_putsiAtt(12*FW, y, STR_TRNCHN, td->srcChn, edit ? blink : 0); lcd_putsiAtt(12*FW, y, STR_TRNCHN, td->srcChn, attr);
if (incdec) if (attr) CHECK_INCDEC_GENVAR(event, td->srcChn, 0, 3);
CHECK_INCDEC_GENVAR(event, td->srcChn, 0, 3);
break; break;
} }
} }
y += FH; y += FH;
} }
edit = (m_posVert==5); attr = (m_posVert==5) ? blink : 0;
lcd_putsLeft(6*FH, STR_MULTIPLIER); lcd_putsLeft(6*FH, STR_MULTIPLIER);
lcd_outdezAtt(LEN_MULTIPLIER*FW+3*FW, 6*FH, g_eeGeneral.PPM_Multiplier+10, (edit ? INVERS : 0)|PREC1); lcd_outdezAtt(LEN_MULTIPLIER*FW+3*FW, 6*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1);
if (edit) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40); if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
edit = (m_posVert==6); attr = (m_posVert==6) ? blink : 0;
lcd_putsAtt(0*FW, 7*FH, STR_CAL, edit ? INVERS : 0); lcd_putsAtt(0*FW, 7*FH, STR_CAL, attr);
for (uint8_t i=0; i<4; i++) { for (uint8_t i=0; i<4; i++) {
uint8_t x = (i*8+16)*FW/2; uint8_t x = (i*8+16)*FW/2;
#if defined (DECIMALS_DISPLAYED) #if defined (DECIMALS_DISPLAYED)
@ -555,7 +552,7 @@ void menuProcTrainer(uint8_t event)
#endif #endif
} }
if (edit) { if (attr) {
if (event==EVT_KEY_FIRST(KEY_MENU)){ if (event==EVT_KEY_FIRST(KEY_MENU)){
memcpy(g_eeGeneral.trainer.calib, g_ppmIns, sizeof(g_eeGeneral.trainer.calib)); memcpy(g_eeGeneral.trainer.calib, g_ppmIns, sizeof(g_eeGeneral.trainer.calib));
eeDirty(EE_GENERAL); eeDirty(EE_GENERAL);