From 99283c6ed6dab046ec9949f1ff9c3e9b44a8d25d Mon Sep 17 00:00:00 2001 From: bsongis Date: Thu, 18 Oct 2012 17:45:34 +0000 Subject: [PATCH] [all] MODS strings removed (unused) [all] EEPROM variants --- src/Makefile | 13 ------------- src/eeprom_arm.cpp | 15 +++++++-------- src/eeprom_avr.cpp | 16 +++++++++++----- src/general_menus.cpp | 10 +++++----- src/model_menus.cpp | 14 +++++++------- src/myeeprom.h | 36 +++++++++++++++++------------------- src/open9x.cpp | 18 +++++++++--------- src/open9x.h | 22 ++++++++++++++++++++-- src/stamp.cpp | 7 +++---- src/translations/cz.h | 2 +- src/translations/de.h | 2 +- src/translations/en.h | 2 +- src/translations/fr.h | 2 +- src/translations/it.h | 2 +- src/translations/se.h | 2 +- 15 files changed, 85 insertions(+), 78 deletions(-) diff --git a/src/Makefile b/src/Makefile index 60ef76f2e..0fd51d61f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -385,19 +385,16 @@ endif # If JETI-Support is enabled ifeq ($(EXT), JETI) - MODS:=${MODS}J CPPDEFS += -DJETI endif ifeq ($(EXT), MAVLINK) - MODS:=${MODS}M CPPDEFS += -DMAVLINK CPPSRC += mavlink.cpp rotarysw.cpp serial.cpp endif # If FRSKY-Support is enabled ifeq ($(EXT), FRSKY) - MODS:=${MODS}F CPPDEFS += -DFRSKY CPPSRC += frsky.cpp # If FRSKY-Hub is enabled @@ -406,7 +403,6 @@ ifeq ($(EXT), FRSKY) endif # If WS HowHigh is enabled ifeq ($(WS_HOW_HIGH), YES) - MODS:=${MODS}W CPPDEFS += -DWS_HOW_HIGH endif # If Vario is enabled @@ -424,7 +420,6 @@ ifeq ($(EEPROM_PROGRESS_BAR), YES) endif ifeq ($(SDCARD), YES) - MODS:=${MODS}S CPPDEFS += -DSDCARD CPPSRC += logs.cpp endif @@ -455,7 +450,6 @@ ifeq ($(PCB), X9D) endif ifeq ($(BLUETOOTH), YES) - MODS:=${MODS}S CPPDEFS += -DBLUETOOTH CPPSRC += sky9x/bluetooth.cpp endif @@ -491,7 +485,6 @@ ifeq ($(PCB), SKY9X) endif ifeq ($(BLUETOOTH), YES) - MODS:=${MODS}S CPPDEFS += -DBLUETOOTH CPPSRC += sky9x/bluetooth.cpp endif @@ -525,7 +518,6 @@ ifeq ($(PCB), GRUVIN9X) ifeq ($(EXTRA_ROTARY_ENCODERS), YES) CPPDEFS += -DEXTRA_ROTARY_ENCODERS - MODS:=${MODS}X endif endif @@ -611,7 +603,6 @@ ifeq ($(DECIMALS), YES) endif ifeq ($(HELI), YES) - MODS:=${MODS}H CPPDEFS += -DHELI endif @@ -738,28 +729,24 @@ stamp_header: @echo "//Automatically generated file (Makefile) - do not edit" > stamp-open9x.h @echo "#define DATE_STR \"`date +%Y-%m-%d`\"" >> stamp-open9x.h @echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-open9x.h - @echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)-$(MODS)\"" >> stamp-open9x.h @echo "#define SVN_STR \"open9x-r$(SVNREV)\"" >> stamp-open9x.h @cat stamp-open9x.h stock-stamp: @echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-open9x-stock.txt @echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-open9x-stock.txt - @echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)\"" >> stamp-open9x-stock.txt @echo "#define SVN_VERS \"open9x-r$(SVNREV)\"" >> stamp-open9x-stock.txt @cat stamp-open9x-stock.txt v4-stamp: @echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-open9x-v4.txt @echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-open9x-v4.txt - @echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)\"" >> stamp-open9x-v4.txt @echo "#define SVN_VERS \"open9x-r$(SVNREV)\"" >> stamp-open9x-v4.txt @cat stamp-open9x-v4.txt arm-stamp: @echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-open9x-arm.txt @echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-open9x-arm.txt - @echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)\"" >> stamp-open9x-arm.txt @echo "#define SVN_VERS \"open9x-r$(SVNREV)\"" >> stamp-open9x-arm.txt @cat stamp-open9x-arm.txt diff --git a/src/eeprom_arm.cpp b/src/eeprom_arm.cpp index 40b7fca2a..6e2179a0e 100644 --- a/src/eeprom_arm.cpp +++ b/src/eeprom_arm.cpp @@ -444,17 +444,16 @@ bool ee32LoadGeneral() read32_eeprom_data( ( File_system[0].block_no << 12) + sizeof( struct t_eeprom_header), ( uint8_t *)&g_eeGeneral, size) ; } - if (g_eeGeneral.myVers == EEPROM_VER && g_eeGeneral.variants == EEPROM_VARIANTS) { + if (g_eeGeneral.version == EEPROM_VER && g_eeGeneral.variant == EEPROM_VARIANT) { uint16_t sum = evalChkSum(); if (g_eeGeneral.chkSum == sum) { return true; } } + #ifdef SIMU - else { - printf("EEPROM version %d (%d) instead of %d (%d)\n", g_eeGeneral.myVers, g_eeGeneral.variants, EEPROM_VER, EEPROM_VARIANTS); - fflush(stdout); - } + printf("EEPROM version %d (%d) instead of %d (%d)\n", g_eeGeneral.version, g_eeGeneral.variant, EEPROM_VER, EEPROM_VARIANT); + fflush(stdout); #endif return false; @@ -513,8 +512,8 @@ void eeLoadModel(uint8_t id) resetProto(); for (uint8_t i=0; imode, (attr && m_posHorz==0) ? blink : 0); - putsTime(MODEL_SETUP_2ND_COLUMN+5*FW-2, y, timer->val, + putsTime(MODEL_SETUP_2ND_COLUMN+5*FW-2, y, timer->start, (attr && m_posHorz==1 ? blink:0), (attr && m_posHorz==2 ? blink:0) ); #if defined(PCBSKY9X) || defined(PCBGRUVIN9X) - lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW-1, y, g_model.timersXtra[k-ITEM_MODEL_TIMER1].remanent ? 'R' : '-', (attr && m_posHorz==3) ? blink : 0); + lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW-1, y, g_model.timers[k-ITEM_MODEL_TIMER1].remanent ? 'R' : '-', (attr && m_posHorz==3) ? blink : 0); #endif if (attr && (editMode>0 || p1valdiff)) { - div_t qr = div(timer->val, 60); + div_t qr = div(timer->start, 60); switch (m_posHorz) { case 0: CHECK_INCDEC_MODELVAR(event, timer->mode, -2*(MAX_PSWITCH+NUM_CSW), TMR_VAROFS-1+2*(MAX_PSWITCH+NUM_CSW)); break; case 1: CHECK_INCDEC_MODELVAR(event, qr.quot, 0, 59); - timer->val = qr.rem + qr.quot*60; + timer->start = qr.rem + qr.quot*60; break; case 2: qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62)-2; - timer->val -= qr.rem ; - if ((int16_t)timer->val < 0) timer->val=0; + timer->start -= qr.rem ; + if ((int16_t)timer->start < 0) timer->start=0; break; #if defined(PCBSKY9X) || defined(PCBGRUVIN9X) case 3: - CHECK_INCDEC_MODELVAR(event, g_model.timersXtra[k-ITEM_MODEL_TIMER1].remanent, 0, 1); + CHECK_INCDEC_MODELVAR(event, g_model.timers[k-ITEM_MODEL_TIMER1].remanent, 0, 1); break; #endif } diff --git a/src/myeeprom.h b/src/myeeprom.h index 844d8fbcc..6a1180ca1 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -124,7 +124,8 @@ enum BacklightMode { #define ALTERNATE_VIEW 0x10 PACK(typedef struct t_EEGeneral { - uint8_t myVers; + uint8_t version; + uint16_t variant; int16_t calibMid[7]; int16_t calibSpanNeg[7]; int16_t calibSpanPos[7]; @@ -166,8 +167,6 @@ PACK(typedef struct t_EEGeneral { EXTRA_SKY9X_FIELDS; - uint8_t variants; - EXTRA_GENERAL_FIELDS; }) EEGeneral; @@ -678,10 +677,20 @@ PACK(typedef struct t_PhaseData { #define TMRMODE_THR 2 #define TMRMODE_THR_REL 3 #define TMRMODE_THR_TRG 4 + +#if defined(PCBGRUVIN9X) || defined(PCBSKY9X) PACK(typedef struct t_TimerData { int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw - uint16_t val; + uint16_t start; + uint16_t remanent:1; + uint16_t value:15; }) TimerData; +#else +PACK(typedef struct t_TimerData { + int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw + uint16_t start; +}) TimerData; +#endif enum Protocols { PROTO_PPM, @@ -721,16 +730,6 @@ enum Dsm2Variants { #define BeepANACenter uint8_t #endif -#if defined(PCBGRUVIN9X) || defined(PCBSKY9X) -PACK(typedef struct t_TimerDataExtra { - uint16_t remanent:1; - uint16_t value:15; -}) TimerDataExtra; -#define EXTRA_MODEL_FIELDS TimerDataExtra timersXtra[MAX_TIMERS] -#else -#define EXTRA_MODEL_FIELDS -#endif - #if defined(PCBSKY9X) PACK(typedef struct { int8_t value; @@ -744,10 +743,10 @@ typedef int8_t model_gvar_t; #if defined(GVARS) #define MAX_GVARS 5 -#define EXTRA_GVARS model_gvar_t gvars[MAX_GVARS] +#define GVARS_DATA model_gvar_t gvars[MAX_GVARS] #else #define MAX_GVARS 0 -#define EXTRA_GVARS +#define GVARS_DATA #endif PACK(typedef struct t_ModelData { @@ -782,13 +781,12 @@ PACK(typedef struct t_ModelData { uint8_t switchWarningStates; + GVARS_DATA; + TELEMETRY_DATA; ROTARY_ENCODER_ARRAY_EXTRA; - EXTRA_MODEL_FIELDS; - - EXTRA_GVARS; }) ModelData; extern EEGeneral g_eeGeneral; diff --git a/src/open9x.cpp b/src/open9x.cpp index e76310296..8c7f4a9ac 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -215,8 +215,8 @@ void memclear(void *ptr, uint8_t size) void generalDefault() { memclear(&g_eeGeneral, sizeof(g_eeGeneral)); - g_eeGeneral.myVers = EEPROM_VER; - g_eeGeneral.variants = EEPROM_VARIANTS; + g_eeGeneral.version = EEPROM_VER; + g_eeGeneral.variant = EEPROM_VARIANT; g_eeGeneral.contrast = 25; g_eeGeneral.vBatWarn = 90; for (int i = 0; i < 7; ++i) { @@ -1609,7 +1609,7 @@ uint8_t trimsCheckTimer = 0; void resetTimer(uint8_t idx) { s_timerState[idx] = TMR_OFF; // is changed to RUNNING dep from mode - s_timerVal[idx] = g_model.timers[idx].val; + s_timerVal[idx] = g_model.timers[idx].start; s_timerVal_10ms[idx] = 0 ; } @@ -2629,7 +2629,7 @@ inline void doMixerCalculations(tmr10ms_t tmr10ms, uint8_t tick10ms) // Timers start for (uint8_t i=0; i<2; i++) { int8_t tm = g_model.timers[i].mode; - uint16_t tv = g_model.timers[i].val; + uint16_t tv = g_model.timers[i].start; if (tm) { if (s_timerState[i] == TMR_OFF) { @@ -2707,14 +2707,14 @@ inline void doMixerCalculations(tmr10ms_t tmr10ms, uint8_t tick10ms) static int16_t last_tmr; if (last_tmr != s_timerVal[0]) { // beep only if seconds advance if (s_timerState[0] == TMR_RUNNING) { - if (g_eeGeneral.preBeep && g_model.timers[0].val) { // beep when 30, 15, 10, 5,4,3,2,1 seconds remaining + if (g_eeGeneral.preBeep && g_model.timers[0].start) { // beep when 30, 15, 10, 5,4,3,2,1 seconds remaining if(s_timerVal[0]==30) AUDIO_TIMER_30(); //beep three times if(s_timerVal[0]==20) AUDIO_TIMER_20(); //beep two times if(s_timerVal[0]==10) AUDIO_TIMER_10(); if(s_timerVal[0]<= 3) AUDIO_TIMER_LT3(s_timerVal[0]); } - if (g_eeGeneral.minuteBeep && (((g_model.timers[0].val ? g_model.timers[0].val-s_timerVal[0] : s_timerVal[0])%60)==0)) { // short beep every minute + if (g_eeGeneral.minuteBeep && (((g_model.timers[0].start ? g_model.timers[0].start-s_timerVal[0] : s_timerVal[0])%60)==0)) { // short beep every minute AUDIO_MINUTE_BEEP(); } } @@ -3270,9 +3270,9 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim void saveTimers() { for (uint8_t i=0; i #include @@ -86,8 +85,10 @@ #endif #if defined(FRSKY) +#define FRSKY_VARIANT 0x0002 #define IF_FRSKY(x) x, #else +#define FRSKY_VARIANT 0x0000 #define IF_FRSKY(x) #endif @@ -133,12 +134,30 @@ #define IF_CURVES(x) #endif +#if defined(GVARS) +#define GVARS_VARIANT 0x0001 +#define IF_GVARS(x) x, +#else +#define GVARS_VARIANT 0x0000 +#define IF_GVARS(x) +#endif + #if defined(PCBSTD) #define WDT_RESET_STOCK() wdt_reset() #else #define WDT_RESET_STOCK() #endif +/* #define HELI_VARIANT 0x0004 +#define VOICE_VARIANT 0x0008 +#define PHASES_VARIANT 0x0010 +#define PXX_VARIANT 0x0020 +#define DSM2_VARIANT 0x0040 +#define VARIO_VARIANT 0x0080 +#define HAPTIC_VARIANT 0x0100 */ + +#define EEPROM_VARIANT (GVARS_VARIANT + FRSKY_VARIANT) + #if defined(PCBSKY9X) #include "board_sky9x.h" #elif defined(PCBGRUVIN9X) @@ -963,7 +982,6 @@ extern inline uint16_t get_tmr10ms() extern const char stamp1[]; extern const char stamp2[]; extern const char stamp3[]; -extern const char stamp4[]; extern uint8_t g_vbat100mV; extern volatile uint8_t g_blinkTmr10ms; diff --git a/src/stamp.cpp b/src/stamp.cpp index fef2d4fda..d8f5ea543 100644 --- a/src/stamp.cpp +++ b/src/stamp.cpp @@ -37,8 +37,7 @@ #define STR2(s) #s #define DEFNUMSTR(s) STR2(s) -const pm_char stamp1[] PROGMEM = "VERS: V" VERS_STR; -const pm_char stamp2[] PROGMEM = " SVN: " SVN_STR; -const pm_char stamp3[] PROGMEM = "DATE: " DATE_STR; -const pm_char stamp4[] PROGMEM = "TIME: " TIME_STR; +const pm_char stamp1[] PROGMEM = " SVN: " SVN_STR; +const pm_char stamp2[] PROGMEM = "DATE: " DATE_STR; +const pm_char stamp3[] PROGMEM = "TIME: " TIME_STR; diff --git a/src/translations/cz.h b/src/translations/cz.h index 963c77dca..05965a04a 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -325,7 +325,7 @@ #define TR_MODESRC " M\205d\003% Zdroj" #define TR_MULTIPLIER "N\200sobi\201" #define TR_CAL "Kal." -#define TR_EEPROMV "EEPROM v" +#define TR_EEPROMV "EEpr:\004-" #define TR_VTRIM "Trim- +" #define TR_BG "BG:" #define TR_MENUTOSTART " [MENU] = START" diff --git a/src/translations/de.h b/src/translations/de.h index 751136fb5..fd5685358 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -325,7 +325,7 @@ #define TR_MODESRC "MODE\003% QUELLE" #define TR_MULTIPLIER "Multiplikator" #define TR_CAL "Kal." -#define TR_EEPROMV "EEPROM v" +#define TR_EEPROMV "EEpr:\004-" #define TR_VTRIM "Trim- +" #define TR_BG "BG:" #define TR_MENUTOSTART "[MENU] > Starten" diff --git a/src/translations/en.h b/src/translations/en.h index 59fef5e57..019334c34 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -326,7 +326,7 @@ #define TR_MODESRC "mode\003% src" #define TR_MULTIPLIER "Multiplier" #define TR_CAL "Cal" -#define TR_EEPROMV "EEPROM v" +#define TR_EEPROMV "EEpr:\004-" #define TR_VTRIM "Trim- +" #define TR_BG "BG:" #define TR_MENUTOSTART "[MENU] TO START" diff --git a/src/translations/fr.h b/src/translations/fr.h index fa21afda8..08afeb4fa 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -323,7 +323,7 @@ #define TR_MODESRC "Mode\003% Source" #define TR_MULTIPLIER "Multiplieur" #define TR_CAL "Cal" -#define TR_EEPROMV "EEPROM v" +#define TR_EEPROMV "EEpr:\004-" #define TR_VTRIM "Trim- +" #define TR_BG "BG:" #define TR_MENUTOSTART "[MENU]POUR DEBUT" diff --git a/src/translations/it.h b/src/translations/it.h index 7d5b6e413..40924f342 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -325,7 +325,7 @@ #define TR_MODESRC "mode\003% src" #define TR_MULTIPLIER "Moltiplica" #define TR_CAL "Cal" -#define TR_EEPROMV "EEPROM v" +#define TR_EEPROMV "EEpr:\004-" #define TR_VTRIM "Trim- +" #define TR_BG "BG:" #define TR_MENUTOSTART "[Men\200] per Cal." diff --git a/src/translations/se.h b/src/translations/se.h index 165c41d5a..c06e8d096 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -322,7 +322,7 @@ #define TR_MODESRC " l\201ge % k\201lla" #define TR_MULTIPLIER "Styrka" #define TR_CAL "Kalib." -#define TR_EEPROMV "EEPROM v" +#define TR_EEPROMV "EEpr:\004-" #define TR_VTRIM "Trim- +" #define TR_BG "BG:" #define TR_MENUTOSTART "[MENU] STARTAR"