[stock128] Less RAM used!!!

This commit is contained in:
bsongis@gmail.com
2013-04-08 17:34:33 +00:00
parent ad82ce9c1b
commit 541c5aa000
10 changed files with 68 additions and 62 deletions
+6 -4
View File
@@ -298,7 +298,8 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
MCU = atmega128 MCU = atmega128
OPT = 2 OPT = 2
SDCARD = NO SDCARD = NO
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM128 -DEEPROM_VARIANT=0x8000 EEPROM_VARIANT += ${M128_VARIANT}
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM128 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
EXTRAINCDIRS = stock EXTRAINCDIRS = stock
BOARDSRC = stock/board_stock.cpp BOARDSRC = stock/board_stock.cpp
EXTRABOARDSRC = stock/lcd_driver.cpp EXTRABOARDSRC = stock/lcd_driver.cpp
@@ -592,9 +593,10 @@ CPPDEFS += -DTRANSLATIONS_$(TRANSLATIONS)
# TTS language # TTS language
CPPDEFS += -DTTS_$(TTS) CPPDEFS += -DTTS_$(TTS)
GVARS_VARIANT = +1 GVARS_VARIANT = +0x0001
FRSKY_VARIANT = +2 FRSKY_VARIANT = +0x0002
3POS_VARIANT = +4 3POS_VARIANT = +0x0004
M128_VARIANT = +0x8000
EEPROM_VARIANT = 0 EEPROM_VARIANT = 0
ifeq ($(UNITS), IMPERIAL) ifeq ($(UNITS), IMPERIAL)
+1 -1
View File
@@ -813,7 +813,7 @@ bool eeLoadGeneral()
if (theFile.readRlc((uint8_t*)&g_eeGeneral, 1) == 1 && g_eeGeneral.version == EEPROM_VER) { if (theFile.readRlc((uint8_t*)&g_eeGeneral, 1) == 1 && g_eeGeneral.version == EEPROM_VER) {
theFile.openRlc(FILE_GENERAL); theFile.openRlc(FILE_GENERAL);
if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(EEGeneral)) { if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(EEGeneral)) {
#if defined(CPUM64) #if defined(PCBSTD)
if (g_eeGeneral.variant == EEPROM_VARIANT && g_eeGeneral.chkSum == evalChkSum()) { if (g_eeGeneral.variant == EEPROM_VARIANT && g_eeGeneral.chkSum == evalChkSum()) {
return true; return true;
} }
+2 -2
View File
@@ -813,7 +813,7 @@ void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att)
putsStrIdx(x, y, STR_PPM, idx-MIXSRC_PPM1+1, att); putsStrIdx(x, y, STR_PPM, idx-MIXSRC_PPM1+1, att);
else if (idx <= MIXSRC_LAST_CH) else if (idx <= MIXSRC_LAST_CH)
putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att); putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
#if defined(GVARS) || !defined(CPUM64) #if defined(GVARS) || !defined(PCBSTD)
else if (idx <= MIXSRC_LAST_GVAR) else if (idx <= MIXSRC_LAST_GVAR)
putsStrIdx(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att); putsStrIdx(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
#endif #endif
@@ -860,7 +860,7 @@ void putsSwitches(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
} }
#endif #endif
#if !defined(CPUM64) #if !defined(PCBSTD)
else if (idx >= SWSRC_TRAINER_SHORT) { else if (idx >= SWSRC_TRAINER_SHORT) {
idx -= SWSRC_TRAINER_SHORT; idx -= SWSRC_TRAINER_SHORT;
lcd_putcAtt(x+3*FW, y, (idx & 1) ? CHR_LONG : CHR_SHORT, att); lcd_putcAtt(x+3*FW, y, (idx & 1) ? CHR_LONG : CHR_SHORT, att);
+6 -6
View File
@@ -1447,7 +1447,7 @@ enum menuModelPhaseItems {
IF_ROTARY_ENCODERS(ITEM_MODEL_PHASE_ROTARY_ENCODERS) IF_ROTARY_ENCODERS(ITEM_MODEL_PHASE_ROTARY_ENCODERS)
ITEM_MODEL_PHASE_FADE_IN, ITEM_MODEL_PHASE_FADE_IN,
ITEM_MODEL_PHASE_FADE_OUT, ITEM_MODEL_PHASE_FADE_OUT,
#if defined(GVARS) && !defined(CPUM64) #if defined(GVARS) && !defined(PCBSTD)
ITEM_MODEL_PHASE_GVARS_LABEL, ITEM_MODEL_PHASE_GVARS_LABEL,
ITEM_MODEL_PHASE_GV1, ITEM_MODEL_PHASE_GV1,
ITEM_MODEL_PHASE_GV2, ITEM_MODEL_PHASE_GV2,
@@ -1463,7 +1463,7 @@ void menuModelPhaseOne(uint8_t event)
PhaseData *phase = phaseaddress(s_currIdx); PhaseData *phase = phaseaddress(s_currIdx);
putsFlightPhase(13*FW, 0, s_currIdx+1, (getFlightPhase()==s_currIdx ? BOLD : 0)); putsFlightPhase(13*FW, 0, s_currIdx+1, (getFlightPhase()==s_currIdx ? BOLD : 0));
#if defined(GVARS) && !defined(CPUM64) #if defined(GVARS) && !defined(PCBSTD)
static const pm_uint8_t mstate_tab_phase1[] PROGMEM = {0, 0, 0, (uint8_t)-1, 2, 2, 2, 2, 2}; static const pm_uint8_t mstate_tab_phase1[] PROGMEM = {0, 0, 0, (uint8_t)-1, 2, 2, 2, 2, 2};
static const pm_uint8_t mstate_tab_others[] PROGMEM = {0, 0, 3, IF_ROTARY_ENCODERS(NUM_ROTARY_ENCODERS-1) 0, 0, (uint8_t)-1, 2, 2, 2, 2, 2}; static const pm_uint8_t mstate_tab_others[] PROGMEM = {0, 0, 3, IF_ROTARY_ENCODERS(NUM_ROTARY_ENCODERS-1) 0, 0, (uint8_t)-1, 2, 2, 2, 2, 2};
@@ -1480,7 +1480,7 @@ void menuModelPhaseOne(uint8_t event)
int8_t sub = m_posVert; int8_t sub = m_posVert;
int8_t editMode = s_editMode; int8_t editMode = s_editMode;
#if defined(GVARS) && !defined(CPUM64) #if defined(GVARS) && !defined(PCBSTD)
if (s_currIdx == 0 && sub>=ITEM_MODEL_PHASE_SWITCH) sub += ITEM_MODEL_PHASE_FADE_IN-ITEM_MODEL_PHASE_SWITCH; if (s_currIdx == 0 && sub>=ITEM_MODEL_PHASE_SWITCH) sub += ITEM_MODEL_PHASE_FADE_IN-ITEM_MODEL_PHASE_SWITCH;
for (uint8_t k=0; k<LCD_LINES-1; k++) { for (uint8_t k=0; k<LCD_LINES-1; k++) {
@@ -1557,7 +1557,7 @@ void menuModelPhaseOne(uint8_t event)
phase->fadeOut = EDIT_DELAY(0, y, event, attr, STR_FADEOUT, phase->fadeOut); phase->fadeOut = EDIT_DELAY(0, y, event, attr, STR_FADEOUT, phase->fadeOut);
break; break;
#if defined(GVARS) && !defined(CPUM64) #if defined(GVARS) && !defined(PCBSTD)
case ITEM_MODEL_PHASE_GVARS_LABEL: case ITEM_MODEL_PHASE_GVARS_LABEL:
lcd_putsLeft(y, STR_GLOBAL_VARS); lcd_putsLeft(y, STR_GLOBAL_VARS);
break; break;
@@ -3050,7 +3050,7 @@ void menuModelLimits(uint8_t event)
void menuModelCurvesAll(uint8_t event) void menuModelCurvesAll(uint8_t event)
{ {
#if defined(GVARS) && defined(CPUM64) #if defined(GVARS) && defined(PCBSTD)
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES+MAX_GVARS); SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES+MAX_GVARS);
#else #else
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES); SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES);
@@ -3077,7 +3077,7 @@ void menuModelCurvesAll(uint8_t event)
uint8_t y = 1 + FH + i*FH; uint8_t y = 1 + FH + i*FH;
uint8_t k = i + s_pgOfs; uint8_t k = i + s_pgOfs;
uint8_t attr = (sub == k ? INVERS : 0); uint8_t attr = (sub == k ? INVERS : 0);
#if defined(GVARS) && defined(CPUM64) #if defined(GVARS) && defined(PCBSTD)
if (k < MAX_CURVES) { if (k < MAX_CURVES) {
putsStrIdx(0, y, STR_CV, k+1, attr); putsStrIdx(0, y, STR_CV, k+1, attr);
} }
+26 -17
View File
@@ -52,35 +52,36 @@
#define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 ) #define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#define EEPROM_VER 214 #define EEPROM_VER 214
#elif defined(PCBSKY9X) #elif defined(PCBSKY9X)
#define EEPROM_VER 214 #define EEPROM_VER 214
#elif defined(PCBGRUVIN9X) || defined(CPUM128) #elif defined(PCBGRUVIN9X)
#define EEPROM_VER 214 #define EEPROM_VER 214
#elif defined(CPUM128)
#define EEPROM_VER 215
#else #else
#define EEPROM_VER 213 #define EEPROM_VER 213
#endif #endif
#ifndef PACK #ifndef PACK
#define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__)) #define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))
#endif #endif
typedef int16_t gvar_t; typedef int16_t gvar_t;
#if !defined(CPUM64) #if !defined(PCBSTD)
typedef char gvar_name_t[6]; typedef char gvar_name_t[6];
#define GVAR_MAX 1024 #define GVAR_MAX 1024
#endif #endif
#define RESERVE_RANGE_FOR_GVARS 10 #define RESERVE_RANGE_FOR_GVARS 10
// even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc. // even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc.
#if defined(CPUM64) && defined(GVARS) #if defined(PCBSTD) && defined(GVARS)
#define MAX_GVARS 5 #define MAX_GVARS 5
#define MODEL_GVARS_DATA gvar_t gvars[MAX_GVARS]; #define MODEL_GVARS_DATA gvar_t gvars[MAX_GVARS];
#define PHASE_GVARS_DATA #define PHASE_GVARS_DATA
#define GVAR_VALUE(x, p) g_model.gvars[x] #define GVAR_VALUE(x, p) g_model.gvars[x]
#elif defined(CPUM64) #elif defined(PCBSTD)
#define MAX_GVARS 0 #define MAX_GVARS 0
#define MODEL_GVARS_DATA #define MODEL_GVARS_DATA
#define PHASE_GVARS_DATA #define PHASE_GVARS_DATA
@@ -252,7 +253,7 @@ PACK(typedef struct t_ExpoData {
char name[LEN_EXPOMIX_NAME]; char name[LEN_EXPOMIX_NAME];
int8_t curveParam; int8_t curveParam;
}) ExpoData; }) ExpoData;
#elif defined(CPUM64) #elif defined(PCBSTD)
PACK(typedef struct t_ExpoData { PACK(typedef struct t_ExpoData {
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
int8_t swtch:6; int8_t swtch:6;
@@ -354,7 +355,7 @@ PACK( union u_int8int16_t {
#define DELAY_MAX 15 /* 7.5 seconds */ #define DELAY_MAX 15 /* 7.5 seconds */
#define SLOW_MAX 15 /* 7.5 seconds */ #define SLOW_MAX 15 /* 7.5 seconds */
#if defined(CPUM64) #if defined(PCBSTD)
PACK(typedef struct t_MixData { PACK(typedef struct t_MixData {
uint8_t destCh:4; // 0, 1..NUM_CHNOUT uint8_t destCh:4; // 0, 1..NUM_CHNOUT
uint8_t curveMode:1; // O=curve, 1=differential uint8_t curveMode:1; // O=curve, 1=differential
@@ -823,7 +824,7 @@ PACK(typedef struct t_SwashRingData { // Swash Ring data
#define ROTARY_ENCODER_ARRAY_EXTRA #define ROTARY_ENCODER_ARRAY_EXTRA
#endif #endif
#if defined(CPUM64) #if defined(PCBSTD)
#define TRIM_ARRAY int8_t trim[4]; int8_t trim_ext:8 #define TRIM_ARRAY int8_t trim[4]; int8_t trim_ext:8
#else #else
#define TRIM_ARRAY int16_t trim[4] #define TRIM_ARRAY int16_t trim[4]
@@ -859,7 +860,7 @@ PACK(typedef struct t_PhaseData {
#define MAX_EXPOS 32 #define MAX_EXPOS 32
#define NUM_CSW 32 // number of custom switches #define NUM_CSW 32 // number of custom switches
#define NUM_CFN 32 // number of functions assigned to switches #define NUM_CFN 32 // number of functions assigned to switches
#elif defined(PCBGRUVIN9X) || defined(CPUM128) #elif defined(PCBGRUVIN9X)
#define MAX_MODELS 30 #define MAX_MODELS 30
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16 #define NUM_CHNOUT 16 // number of real output channels CH1-CH16
#define MAX_PHASES 6 #define MAX_PHASES 6
@@ -867,6 +868,14 @@ PACK(typedef struct t_PhaseData {
#define MAX_EXPOS 16 #define MAX_EXPOS 16
#define NUM_CSW 15 // number of custom switches #define NUM_CSW 15 // number of custom switches
#define NUM_CFN 24 // number of functions assigned to switches #define NUM_CFN 24 // number of functions assigned to switches
#elif defined(CPUM128)
#define MAX_MODELS 30
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
#define MAX_PHASES 5
#define MAX_MIXERS 32
#define MAX_EXPOS 14
#define NUM_CSW 12 // number of custom switches
#define NUM_CFN 16 // number of functions assigned to switches
#else #else
#define MAX_MODELS 16 #define MAX_MODELS 16
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16 #define NUM_CHNOUT 16 // number of real output channels CH1-CH16
@@ -952,7 +961,7 @@ enum SwitchSources {
SWSRC_FIRST_MOMENT_SWITCH, SWSRC_FIRST_MOMENT_SWITCH,
SWSRC_LAST_MOMENT_SWITCH = SWSRC_FIRST_MOMENT_SWITCH+SWSRC_ON-1, SWSRC_LAST_MOMENT_SWITCH = SWSRC_FIRST_MOMENT_SWITCH+SWSRC_ON-1,
#if !defined(CPUM64) #if !defined(PCBSTD)
SWSRC_TRAINER_SHORT, SWSRC_TRAINER_SHORT,
SWSRC_TRAINER_LONG, SWSRC_TRAINER_LONG,
#endif #endif
@@ -1142,7 +1151,7 @@ enum FailsafeModes {
#if defined(MAVLINK) #if defined(MAVLINK)
#define TELEMETRY_DATA MavlinkData mavlink; #define TELEMETRY_DATA MavlinkData mavlink;
#elif defined(FRSKY) || !defined(CPUM64) #elif defined(FRSKY)
#define TELEMETRY_DATA FrSkyData frsky; #define TELEMETRY_DATA FrSkyData frsky;
#else #else
#define TELEMETRY_DATA #define TELEMETRY_DATA
@@ -1168,7 +1177,7 @@ PACK(typedef struct t_ModelData {
uint8_t extendedTrims:1; uint8_t extendedTrims:1;
uint8_t spare1:1; uint8_t spare1:1;
int8_t ppmDelay; int8_t ppmDelay;
BeepANACenter beepANACenter; // 1<<0->A1.. 1<<6->A7 BeepANACenter beepANACenter; // 1<<0->A1.. 1<<6->A7
MixData mixData[MAX_MIXERS]; MixData mixData[MAX_MIXERS];
LimitData limitData[NUM_CHNOUT]; LimitData limitData[NUM_CHNOUT];
ExpoData expoData[MAX_EXPOS]; ExpoData expoData[MAX_EXPOS];
@@ -1177,7 +1186,7 @@ PACK(typedef struct t_ModelData {
int8_t points[NUM_POINTS]; int8_t points[NUM_POINTS];
CustomSwData customSw[NUM_CSW]; CustomSwData customSw[NUM_CSW];
CustomFnData funcSw[NUM_CFN]; CustomFnData funcSw[NUM_CFN];
SwashRingData swashR; SwashRingData swashR;
PhaseData phaseData[MAX_PHASES]; PhaseData phaseData[MAX_PHASES];
+20 -20
View File
@@ -670,14 +670,13 @@ void applyExpos(int16_t *anas)
else else
v = expo(v, GET_GVAR(curveParam, -100, 100, s_perout_flight_phase)); v = expo(v, GET_GVAR(curveParam, -100, 100, s_perout_flight_phase));
} }
int16_t weight=GET_GVAR(ed.weight, 0, 100, s_perout_flight_phase); int16_t weight = GET_GVAR(ed.weight, 0, 100, s_perout_flight_phase);
weight=calc100to256(weight); weight = calc100to256(weight);
v = ((int32_t)v * weight) >> 8; v = ((int32_t)v * weight) >> 8;
// v = ((int32_t)v * GET_GVAR(ed.weight, 0, 100, s_perout_flight_phase)) / 100;
anas[cur_chn] = v; anas[cur_chn] = v;
} //endif }
} //endif getSwitch }
} //endfor }
} }
#if !defined(CPUARM) #if !defined(CPUARM)
@@ -1228,7 +1227,7 @@ uint8_t getFlightPhase()
int16_t getRawTrimValue(uint8_t phase, uint8_t idx) int16_t getRawTrimValue(uint8_t phase, uint8_t idx)
{ {
PhaseData *p = phaseaddress(phase); PhaseData *p = phaseaddress(phase);
#if defined(CPUM64) #if defined(PCBSTD)
return (((int16_t)p->trim[idx]) << 2) + ((p->trim_ext >> (2*idx)) & 0x03); return (((int16_t)p->trim[idx]) << 2) + ((p->trim_ext >> (2*idx)) & 0x03);
#else #else
return p->trim[idx]; return p->trim[idx];
@@ -1243,7 +1242,7 @@ int16_t getTrimValue(uint8_t phase, uint8_t idx)
void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim) void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim)
{ {
PhaseData *p = phaseaddress(phase); PhaseData *p = phaseaddress(phase);
#if defined(CPUM64) #if defined(PCBSTD)
p->trim[idx] = (int8_t)(trim >> 2); p->trim[idx] = (int8_t)(trim >> 2);
p->trim_ext = (p->trim_ext & ~(0x03 << (2*idx))) + (((trim & 0x03) << (2*idx))); p->trim_ext = (p->trim_ext & ~(0x03 << (2*idx))) + (((trim & 0x03) << (2*idx)));
#else #else
@@ -1318,7 +1317,7 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
uint8_t s_gvar_timer = 0; uint8_t s_gvar_timer = 0;
uint8_t s_gvar_last = 0; uint8_t s_gvar_last = 0;
#if defined(CPUM64) #if defined(PCBSTD)
int16_t getGVarValue(int16_t x, int16_t min, int16_t max) int16_t getGVarValue(int16_t x, int16_t min, int16_t max)
{ {
if (GV_IS_GV_VALUE(x,min,max)) { if (GV_IS_GV_VALUE(x,min,max)) {
@@ -1736,7 +1735,7 @@ uint8_t checkTrim(uint8_t event)
#if defined(GVARS) #if defined(GVARS)
#define TRIM_REUSED() trimGvar[idx] >= 0 #define TRIM_REUSED() trimGvar[idx] >= 0
if (TRIM_REUSED()) { if (TRIM_REUSED()) {
#if defined(CPUM64) #if defined(PCBSTD)
phase = 0; phase = 0;
#else #else
phase = getGVarFlightPhase(s_perout_flight_phase, trimGvar[idx]); phase = getGVarFlightPhase(s_perout_flight_phase, trimGvar[idx]);
@@ -2321,7 +2320,7 @@ PLAY_FUNCTION(playValue, uint8_t idx)
} }
#endif #endif
#if !defined(CPUM64) #if !defined(PCBSTD)
uint8_t mSwitchDuration[1+NUM_ROTARY_ENCODERS] = { 0 }; uint8_t mSwitchDuration[1+NUM_ROTARY_ENCODERS] = { 0 };
#define CFN_PRESSLONG_DURATION 100 #define CFN_PRESSLONG_DURATION 100
#endif #endif
@@ -2367,7 +2366,7 @@ void evalFunctions()
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i); MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
uint8_t momentary = 0; uint8_t momentary = 0;
#if !defined(CPUM64) #if !defined(PCBSTD)
#define MOMENTARY_START_TEST() ( (momentary && !(activeSwitches & switch_mask) && active) || \ #define MOMENTARY_START_TEST() ( (momentary && !(activeSwitches & switch_mask) && active) || \
(short_long==1 && !active && mSwitchDuration[mswitch]>0 && mSwitchDuration[mswitch]<CFN_PRESSLONG_DURATION) || \ (short_long==1 && !active && mSwitchDuration[mswitch]>0 && mSwitchDuration[mswitch]<CFN_PRESSLONG_DURATION) || \
@@ -2408,7 +2407,7 @@ void evalFunctions()
if (active) newActiveSwitches |= switch_mask; if (active) newActiveSwitches |= switch_mask;
if (momentary || short_long) { if (momentary || short_long) {
#if !defined(CPUM64) #if !defined(PCBSTD)
bool swState = active; bool swState = active;
#endif #endif
@@ -2439,7 +2438,7 @@ void evalFunctions()
active = (activeFnSwitches & switch_mask); active = (activeFnSwitches & switch_mask);
momentary = false; momentary = false;
} }
#if !defined(CPUM64) #if !defined(PCBSTD)
if (short_long) { if (short_long) {
if (swState) { if (swState) {
if (mSwitchDuration[mswitch] < 255) if (mSwitchDuration[mswitch] < 255)
@@ -2982,7 +2981,8 @@ void perOut(uint8_t mode, uint8_t tick10ms)
if (tmp.dword<0) { if (tmp.dword<0) {
if ((tmp.words_t.hi&0xFF80)!=0xFF80) tmp.words_t.hi=0xFF86; // set to min nearly if ((tmp.words_t.hi&0xFF80)!=0xFF80) tmp.words_t.hi=0xFF86; // set to min nearly
} else { }
else {
if ((tmp.words_t.hi|0x007F)!=0x007F) tmp.words_t.hi=0x0079; // set to max nearly if ((tmp.words_t.hi|0x007F)!=0x007F) tmp.words_t.hi=0x0079; // set to max nearly
} }
*ptr=tmp.dword; *ptr=tmp.dword;
@@ -3313,9 +3313,9 @@ void doMixerCalculations()
AUDIO_INACTIVITY(); AUDIO_INACTIVITY();
#if defined(AUDIO) #if defined(AUDIO)
if (mixWarning & 1) if ((s_timeCumTot&0x03)== 0) AUDIO_MIX_WARNING(1); if (mixWarning & 1) if ((s_timeCumTot&0x03)==0) AUDIO_MIX_WARNING(1);
if (mixWarning & 2) if ((s_timeCumTot&0x03)== 1) AUDIO_MIX_WARNING(2); if (mixWarning & 2) if ((s_timeCumTot&0x03)==1) AUDIO_MIX_WARNING(2);
if (mixWarning & 4) if ((s_timeCumTot&0x03)== 2) AUDIO_MIX_WARNING(3); if (mixWarning & 4) if ((s_timeCumTot&0x03)==2) AUDIO_MIX_WARNING(3);
#endif #endif
#if defined(ACCURAT_THROTTLE_TIMER) #if defined(ACCURAT_THROTTLE_TIMER)
@@ -3633,7 +3633,7 @@ uint16_t getTmr16KHz()
ISR(TIMER2_OVF_vect, ISR_NOBLOCK) ISR(TIMER2_OVF_vect, ISR_NOBLOCK)
{ {
cli(); cli();
TIMSK &= ~ (1<<TOIE2) ; // stop reentrance TIMSK &= ~(1<<TOIE2) ; // stop reentrance
sei(); sei();
#if defined(AUDIO) #if defined(AUDIO)
@@ -3789,7 +3789,7 @@ ISR(USART0_UDRE_vect)
else { else {
FRSKY_USART0_vect(); FRSKY_USART0_vect();
} }
#elif defined (FRSKY) #elif defined(FRSKY)
FRSKY_USART0_vect(); FRSKY_USART0_vect();
#else #else
DSM2_USART0_vect(); DSM2_USART0_vect();
+2 -2
View File
@@ -772,7 +772,7 @@ extern void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim);
#endif #endif
#if defined(GVARS) #if defined(GVARS)
#if defined(CPUM64) #if defined(PCBSTD)
int16_t getGVarValue(int16_t x, int16_t min, int16_t max); int16_t getGVarValue(int16_t x, int16_t min, int16_t max);
void setGVarValue(uint8_t x, int8_t value); void setGVarValue(uint8_t x, int8_t value);
#define GET_GVAR(x, min, max, p) getGVarValue(x, min, max) #define GET_GVAR(x, min, max, p) getGVarValue(x, min, max)
@@ -1118,7 +1118,7 @@ extern void moveTrimsToOffsets();
#if defined(CPUARM) #if defined(CPUARM)
#define MASK_CFN_TYPE uint32_t // current max = 32 function switches #define MASK_CFN_TYPE uint32_t // current max = 32 function switches
#define MASK_FUNC_TYPE uint32_t // current max = 32 functions #define MASK_FUNC_TYPE uint32_t // current max = 32 functions
#elif defined(CPUM64) #elif defined(PCBSTD)
#define MASK_CFN_TYPE uint16_t // current max = 16 function switches #define MASK_CFN_TYPE uint16_t // current max = 16 function switches
#define MASK_FUNC_TYPE uint16_t // current max = 16 functions #define MASK_FUNC_TYPE uint16_t // current max = 16 functions
#else #else
+1 -5
View File
@@ -41,11 +41,7 @@
#define BACKLIGHT_BIT 0x04 #define BACKLIGHT_BIT 0x04
#define SPARE_BIT 0x08 #define SPARE_BIT 0x08
#if defined(CPUM64) #define VOICE_Q_LENGTH 8
#define VOICE_Q_LENGTH 8
#else
#define VOICE_Q_LENGTH 16
#endif
// Voice states // Voice states
#define V_STARTUP 0 #define V_STARTUP 0
+1 -2
View File
@@ -474,8 +474,7 @@ ISR(USART0_RX_vect)
uint8_t data; uint8_t data;
UCSR0B &= ~(1 << RXCIE0); // disable Interrupt UCSR0B &= ~(1 << RXCIE0); // disable Interrupt
sei() ; sei();
stat = UCSR0A; // USART control and Status Register 0 A stat = UCSR0A; // USART control and Status Register 0 A
+3 -3
View File
@@ -765,7 +765,7 @@ void menuMainView(uint8_t event)
} }
#endif // PCBGRUVIN9X && ROTARY_ENCODERS #endif // PCBGRUVIN9X && ROTARY_ENCODERS
// Curstom Switches // Custom Switches
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
for (uint8_t i=0; i<NUM_CSW; i++) { for (uint8_t i=0; i<NUM_CSW; i++) {
int8_t len = getSwitch(SWSRC_SW1+i, 0) ? BAR_HEIGHT : 1; int8_t len = getSwitch(SWSRC_SW1+i, 0) ? BAR_HEIGHT : 1;
@@ -779,7 +779,7 @@ void menuMainView(uint8_t event)
#elif defined(PCBGRUVIN9X) #elif defined(PCBGRUVIN9X)
for (uint8_t i=0; i<NUM_CSW; i++) for (uint8_t i=0; i<NUM_CSW; i++)
putsSwitches(2*FW-2 + (i/3)*(4*FW-2) + (i/3>1 ? 3*FW : 0), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i, 0) ? INVERS : 0); putsSwitches(2*FW-2 + (i/3)*(4*FW-2) + (i/3>1 ? 3*FW : 0), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i, 0) ? INVERS : 0);
#elif !defined(CPUM64) #elif !defined(PCBSTD)
for (uint8_t i=0; i<NUM_CSW; i++) for (uint8_t i=0; i<NUM_CSW; i++)
putsSwitches(2*FW-2 + (i/3)*(4*FW-1), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i, 0) ? INVERS : 0); putsSwitches(2*FW-2 + (i/3)*(4*FW-1), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i, 0) ? INVERS : 0);
#else #else
@@ -814,7 +814,7 @@ void menuMainView(uint8_t event)
s_gvar_timer--; s_gvar_timer--;
s_warning = PSTR("Global Variable"); s_warning = PSTR("Global Variable");
displayBox(); displayBox();
#if defined(CPUM64) #if defined(PCBSTD)
lcd_putsAtt(16+4*FW, 5*FH, PSTR("[\010]"), BOLD); lcd_putsAtt(16+4*FW, 5*FH, PSTR("[\010]"), BOLD);
lcd_outdezAtt(16+4*FW+4*FW+FW/2, 5*FH, GVAR_VALUE(s_gvar_last, s_perout_flight_phase), BOLD); lcd_outdezAtt(16+4*FW+4*FW+FW/2, 5*FH, GVAR_VALUE(s_gvar_last, s_perout_flight_phase), BOLD);
#else #else