[stock] around 200bytes flash saving

[all] WSHH used for vario - not tested at all
[all] correction for d>=ofs used with timers
[sky9x/gruvin9x] SD needs 2/3 files opened in the same time
[sky9x] low speed SD when high speed not allowed
This commit is contained in:
bsongis
2012-09-20 17:50:52 +00:00
parent 2fa4a6bb3f
commit 77c87e5da3
14 changed files with 151 additions and 178 deletions
+25 -6
View File
@@ -697,11 +697,17 @@ bool __getSwitch(int8_t swtch)
y = cs->v2;
}
}
else
#endif
{
else {
y = calc100toRESX(cs->v2);
}
#else
if (cs->v1 > CSW_CHOUT_BASE+NUM_CHNOUT) {
y = cs->v2; // it's a timer
}
else {
y = calc100toRESX(cs->v2);
}
#endif
switch (cs->func) {
case CS_VPOS:
@@ -718,11 +724,14 @@ bool __getSwitch(int8_t swtch)
break;
default:
{
if (csLastValue[cs_idx] == -32668)
csLastValue[cs_idx] = x;
int16_t diff = x - csLastValue[cs_idx];
if (cs->func == CS_DIFFEGREATER)
result = (y >= 0 ? (diff >= y) : (diff <= y));
else
result = (abs(diff) >= y);
printf("x=%d last=%d y=%d diff=%d result=%d\n", x, csLastValue[cs_idx], y, diff, result); fflush(stdout);
if (result)
csLastValue[cs_idx] = x;
break;
@@ -1555,6 +1564,8 @@ void resetAll()
#ifdef FRSKY
resetTelemetry();
#endif
for (uint8_t i=0; i<NUM_CSW; i++)
csLastValue[i] = -32668;
}
static uint8_t lastSwPos[2] = {0, 0};
@@ -1930,6 +1941,7 @@ void evalFunctions()
if ((!momentary) || (~activeFunctionSwitches & switch_mask)) {
if (sd->func == FUNC_PLAY_SOUND) {
printf("BEEP\n"); fflush(stdout);
AUDIO_PLAY(AU_FRSKY_FIRST+FSW_PARAM(sd));
}
@@ -2705,7 +2717,9 @@ void perMain()
check_frsky();
#endif
g_menuStack[g_menuStackPtr](evt);
const char *warn = s_warning;
g_menuStack[g_menuStackPtr](warn ? 0 : evt);
if (warn) displayWarning(evt);
drawStatusLine();
refreshDisplay();
@@ -3547,12 +3561,17 @@ int main(void)
hapticOff();
#endif
BACKLIGHT_ON;
g_eeGeneral.optrexDisplay = 1;
lcd_clear();
refreshDisplay();
g_eeGeneral.optrexDisplay = 0;
g_eeGeneral.backlightBright = 0;
g_eeGeneral.contrast = 25;
lcd_clear();
BACKLIGHT_ON;
lcd_clear();
lcd_putcAtt( 48, 24, 'U', DBLSIZE ) ;
lcd_putcAtt( 60, 24, 'S', DBLSIZE ) ;
lcd_putcAtt( 72, 24, 'B', DBLSIZE ) ;