Issue #592 - 422bytes saved on 9x stock!!!

This commit is contained in:
Bertrand Songis
2014-02-06 15:57:59 +01:00
parent cae4d1ecf6
commit 38129abd43
12 changed files with 121 additions and 106 deletions
+7 -5
View File
@@ -1051,7 +1051,7 @@ void menuModelSetup(uint8_t event)
}
else {
putsStrIdx(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
putsTmrMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
putsTime(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
#if defined(PCBTARANIS)
if (attr && m_posHorz < 0) lcd_filled_rect(MODEL_SETUP_2ND_COLUMN, y, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8);
@@ -1060,7 +1060,7 @@ void menuModelSetup(uint8_t event)
div_t qr = div(timer->start, 60);
switch (m_posHorz) {
case 0:
CHECK_INCDEC_MODELVAR(event, timer->mode, -2*(NUM_PSWITCH+NUM_CSW), TMR_VAROFS-1+2*(NUM_PSWITCH+NUM_CSW));
CHECK_INCDEC_MODELVAR(event, timer->mode, SWSRC_FIRST, TMR_VAROFS+SWSRC_LAST-1/*--- which is OFF*/);
break;
case 1:
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
@@ -1840,7 +1840,7 @@ void menuModelFlightModesAll(uint8_t event)
}
else {
putsSwitches((5+LEN_FP_NAME)*FW+FW/2, y, p->swtch, attr);
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, -NUM_SWITCH, NUM_SWITCH);
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, SWSRC_FIRST, SWSRC_LAST);
}
break;
@@ -4298,7 +4298,7 @@ void menuModelCustomSwitchOne(uint8_t event)
case CSW_FIELD_ANDSW:
lcd_putsLeft(y, STR_AND_SWITCH);
putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -NUM_SWITCH, NUM_SWITCH);
if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_CSW_ANDSW, MAX_CSW_ANDSW);
break;
case CSW_FIELD_DURATION:
lcd_putsLeft(y, STR_DURATION);
@@ -4596,7 +4596,9 @@ void menuModelCustomSwitches(uint8_t event)
break;
case CSW_FIELD_ANDSW:
#if defined(CPUARM)
CHECK_INCDEC_MODELSWITCH(event, cs->andsw, -MAX_CSW_ANDSW, MAX_CSW_ANDSW);
INCDEC_SET_FLAG(INCDEC_SWITCH);
INCDEC_ENABLE_CHECK(isSwitchAvailableInCustomSwitches);
cs->andsw = CHECK_INCDEC_PARAM(event, cs->andsw, -MAX_CSW_ANDSW, MAX_CSW_ANDSW);
#else
CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, MAX_CSW_ANDSW);
#endif
+1 -13
View File
@@ -228,18 +228,6 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
#endif
}
}
if (event == EVT_KEY_LONG(KEY_ENTER) && i_max > SWSRC_ON) {
s_editMode = !s_editMode;
if (newval > SWSRC_ON)
newval -= (NUM_SWITCH+1);
else if (newval > 0)
newval += (NUM_SWITCH+1);
else if (newval < SWSRC_OFF)
newval += (NUM_SWITCH+1);
else if (newval < 0)
newval -= (NUM_SWITCH+1);
}
}
#endif
@@ -976,7 +964,7 @@ int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t
{
lcd_putsColumnLeft(x, y, STR_SWITCH);
putsSwitches(x, y, value, attr);
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, -NUM_SWITCH, NUM_SWITCH);
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST, SWSRC_LAST);
return value;
}
+4 -4
View File
@@ -343,7 +343,7 @@ void displayTimers()
if (g_model.timers[0].mode) {
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, STRCONDENSED|SMLSIZE);
putsTimerMode(TIMERS_X, TIMER1_Y-6, g_model.timers[0].mode, SMLSIZE);
if (g_model.timers[0].persistent) lcd_putcAtt(TIMERS_R, TIMER1_Y+1, 'P', SMLSIZE);
if (timerState.val < 0) {
if (BLINK_ON_PHASE) {
@@ -356,7 +356,7 @@ void displayTimers()
if (g_model.timers[1].mode) {
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, STRCONDENSED|SMLSIZE);
putsTimerMode(TIMERS_X, TIMER2_Y-6, g_model.timers[1].mode, SMLSIZE);
if (g_model.timers[1].persistent) lcd_putcAtt(TIMERS_R, TIMER2_Y+1, 'P', SMLSIZE);
if (timerState.val < 0) {
if (BLINK_ON_PHASE) {
@@ -373,7 +373,7 @@ void displayTimers()
TimerState & timerState = timersStates[0];
uint8_t att = DBLSIZE | (timerState.val<0 ? 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, STRCONDENSED);
putsTimerMode(timerState.val >= 0 ? 9*FW-FW/2+3 : 9*FW-FW/2-4, FH*3, g_model.timers[0].mode);
}
}
#endif
@@ -818,7 +818,7 @@ void menuMainView(uint8_t event)
}
else { // timer2
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, STRCONDENSED);
putsTimerMode(timersStates[1].val >= 0 ? 20-FW/2+5 : 20-FW/2-2, FH*6, g_model.timers[1].mode);
// lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s
}
#endif // PCBTARANIS