diff --git a/src/Makefile b/src/Makefile index ed99bc368..131bb8705 100644 --- a/src/Makefile +++ b/src/Makefile @@ -580,22 +580,24 @@ stamp: font.lbm: font_6x1.xbm @echo @echo "Convert font from xbm to lbm:" - $(XBM2LBM) $< + $(XBM2LBM) yes $< + $(XBM2LBM) no translations/font_se.xbm font_dblsize.lbm: font_dblsize.xbm @echo @echo "Convert font from xbm to lbm:" - $(XBM2LBM) $< + $(XBM2LBM) yes $< + $(XBM2LBM) no translations/font_dblsize_se.xbm sticks.lbm: sticks_4x1.xbm @echo @echo "Convert font from xbm to lbm:" - $(XBM2LBM) $< + $(XBM2LBM) yes $< s9xsplash.lbm: s9xsplash.xbm @echo @echo "Convert font from xbm to lbm:" - $(XBM2LBM) $< + $(XBM2LBM) yes $< # Eye candy. # AVR Studio 3.x does not check make's exit code but relies on diff --git a/src/beeper.cpp b/src/beeper.cpp index cb21e9f6f..06b220f0a 100644 --- a/src/beeper.cpp +++ b/src/beeper.cpp @@ -46,11 +46,11 @@ uint8_t hapticTick = 0; // The various "beep" tone lengths static const pm_uint8_t beepTab[] PROGMEM = { // key, trim, warn2, warn1, error - 1, 1, 8, 30, 100, //xShort - 1, 1, 8, 30, 100, //short + 1, 1, 2, 10, 60, //xShort + 1, 1, 4, 20, 80, //short 1, 1, 8, 30, 100, //normal - 1, 1, 15, 50, 150, //long - 10, 10, 30, 50, 150, //xLong + 2, 2, 15, 40, 120, //long + 5, 5, 30, 50, 150, //xLong }; void beep(uint8_t val) diff --git a/src/frsky.cpp b/src/frsky.cpp index e2706ffd0..7873904f1 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -486,9 +486,9 @@ void FRSKY10mspoll(void) *ptr++ = (A22PKT + FrskyAlarmSendState); // fc - fb - fa - f9 } else { - *ptr++ = (g_eeGeneral.beeperMode != -2/*TODO constant*/ ? ((2+alarm+g_model.frskyRssiAlarms[alarm].level) % 4) : alarm_off); + *ptr++ = (g_eeGeneral.beeperMode != -2/*TODO constant*/ ? ((2+alarm+g_model.frsky.rssiAlarms[alarm].level) % 4) : alarm_off); *ptr++ = 0x00 ; - frskyPushValue(ptr, 50+g_model.frskyRssiAlarms[alarm].value); + frskyPushValue(ptr, 50+g_model.frsky.rssiAlarms[alarm].value); *ptr++ = (RSSI1PKT-alarm); // f7 - f6 } @@ -725,7 +725,7 @@ void menuProcFrsky(uint8_t event) putsModelName(0, 0, g_model.name, g_eeGeneral.currModel, 0); uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK : 0); putsVBat(14*FW,0,att); - if (g_model.timer1.mode) { + if (g_model.timers[0].mode) { att = (s_timerState[0]==TMR_BEEPING ? BLINK : 0); putsTime(17*FW, 0, s_timerVal[0], att, att); } diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 5d90d5461..4b951605c 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -94,22 +94,28 @@ void menuProcSetup(uint8_t event) #undef PARAM_OFS #define PARAM_OFS 17*FW - MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, 0, 0, #ifdef AUDIO - 0, +#define AUDIO_ZEROS 0, +#else +#define AUDIO_ZEROS #endif #ifdef HAPTIC - 0, 0, +#define HAPTIC_ZEROS 0, 0, +#else +#define HAPTIC_ZEROS #endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #ifdef SPLASH - 0, +#define SPLASH_ZEROS 0, +#else +#define SPLASH_ZEROS #endif - 0, 0, 0, 0, #ifdef FRSKY - 0, +#define FRSKY_ZEROS 0, +#else +#define FRSKY_ZEROS #endif - 0, -1, 1}); + + MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, 0, 0, AUDIO_ZEROS HAPTIC_ZEROS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SPLASH_ZEROS 0, 0, 0, 0, FRSKY_ZEROS 0, (uint8_t)-1, 1}); int8_t sub = m_posVert; uint8_t y = 1*FH; @@ -226,7 +232,7 @@ void menuProcSetup(uint8_t event) if(s_pgOfs7*FH) return; }subN++; diff --git a/src/lcd.cpp b/src/lcd.cpp index 219ed7431..d23e9ed32 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -33,14 +33,6 @@ #include "open9x.h" -const pm_uchar font[] PROGMEM = { -#include "font.lbm" -}; - -const pm_uchar font_dblsize[] PROGMEM = { -#include "font_dblsize.lbm" -}; - #define font_5x8_x20_x7f (font+2) #define font_10x16_x20_x7f (font_dblsize+2) @@ -75,7 +67,7 @@ void lcd_img(uint8_t x, uint8_t y, const pm_uchar * img, uint8_t idx, uint8_t mo uint8_t lcd_lastPos; -void lcd_putcAtt(uint8_t x, uint8_t y, const char c, uint8_t mode) +void lcd_putcAtt(uint8_t x, uint8_t y, const unsigned char c, uint8_t mode) { uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ]; @@ -85,15 +77,15 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const char c, uint8_t mode) { /* each letter consists of ten top bytes followed by * by ten bottom bytes (20 bytes per * char) */ - q = &font_10x16_x20_x7f[(c-0x20)*10 + ((c-0x20)/16)*160]; + q = &font_10x16_x20_x7f[((uint16_t)c-0x20)*10 + (((uint16_t)c-0x20)/16)*160]; for(char i=5; i>=0; i--) { if (mode & CONDENSED && i==0) break; uint8_t b1=0, b2=0, b3=0, b4=0; if (i>0) { b1 = pgm_read_byte(q); /*top byte*/ - b3 = pgm_read_byte(160+q); /*bottom byte*/ + b3 = pgm_read_byte((uint16_t)160+q); /*bottom byte*/ b2 = pgm_read_byte(++q); /*top byte*/ - b4 = pgm_read_byte(160+q); /*bottom byte*/ + b4 = pgm_read_byte((uint16_t)160+q); /*bottom byte*/ } if(inv) { b1=~b1; @@ -152,7 +144,7 @@ void lcd_putsiAtt(uint8_t x,uint8_t y,const pm_char * s,uint8_t idx, uint8_t fla void lcd_putsnAtt(uint8_t x,uint8_t y,const pm_char * s,uint8_t len,uint8_t mode) { while(len!=0) { - char c; + unsigned char c; switch (mode & (BSS+ZCHAR)) { case BSS: c = *s; @@ -465,7 +457,7 @@ void putsChnRaw(uint8_t x, uint8_t y, uint8_t idx, uint8_t att) putsStrIdx(x, y, STR_TMR, idx - (NUM_STICKS+NUM_POTS+2+3+NUM_PPM+NUM_CHNOUT), att); #ifdef FRSKY else - lcd_putsiAtt(x, y, STR_TELEMCHNS, idx-1-(NUM_STICKS+NUM_POTS+2+3+NUM_PPM+MAX_TIMERS+NUM_CHNOUT), att); + lcd_putsiAtt(x, y, STR_TELEMCHNS, idx-1-(NUM_STICKS+NUM_POTS+2+3+NUM_PPM+NUM_CHNOUT+MAX_TIMERS), att); #endif } @@ -475,6 +467,16 @@ void putsChn(uint8_t x, uint8_t y, uint8_t idx, uint8_t att) putsChnRaw(x, y, idx+20, att); } +void putsMixerSource(uint8_t x, uint8_t y, uint8_t idx, uint8_t att) +{ + if (idx<=NUM_STICKS+NUM_POTS+2) + putsChnRaw(x, y, idx, att); + else if (idx<=NUM_STICKS+NUM_POTS+2+MAX_SWITCH) + putsSwitches(x, y, idx-NUM_STICKS-NUM_POTS-2, att); + else + putsChnRaw(x, y, idx-MAX_SWITCH, att); +} + void putsChnLetter(uint8_t x, uint8_t y, uint8_t idx, uint8_t attr) { lcd_putsiAtt(x, y, STR_RETA123, idx-1, attr); @@ -497,17 +499,17 @@ void putsSwitches(uint8_t x, uint8_t y, int8_t idx, uint8_t att) if (idx == 0) return lcd_putsiAtt(x, y, STR_MMMINV, 0, att); if (~att & SWONLY) { - if (idx == MAX_SWITCH) + if (idx == SWITCH_ON) return lcd_putsiAtt(x, y, STR_OFFON, 1, att); - if (idx == -MAX_SWITCH) + if (idx == SWITCH_OFF) return lcd_putsiAtt(x, y, STR_OFFON, 0, att); } if (idx<0) { lcd_vlineStip(x-2, y, 8, 0x5E/*'!'*/); idx = -idx; } - if (idx >= MAX_SWITCH) { - idx -= ((att & SWONLY) ? MAX_SWITCH-1 : MAX_SWITCH); + if (idx > MAX_SWITCH) { + idx -= ((att & SWONLY) ? MAX_SWITCH : MAX_SWITCH+1); if (~att & SWCONDENSED) lcd_putcAtt(x+3*FW, y, 'm', att); } lcd_putsiAtt(x, y, STR_VSWITCHES, idx-1, att); @@ -520,8 +522,12 @@ void putsFlightPhase(uint8_t x, uint8_t y, int8_t idx, uint8_t att) putsStrIdx(x, y, STR_FP, idx-1, att); } -void putsCurve(uint8_t x, uint8_t y, uint8_t idx, uint8_t att) +void putsCurve(uint8_t x, uint8_t y, int8_t idx, uint8_t att) { + if (idx < 0) { + lcd_putcAtt(x-1*FW, y, '!', att); + idx = -idx + 6; + } if (idx < CURVE_BASE) lcd_putsiAtt(x, y, STR_VCURVEFUNC, idx, att); else diff --git a/src/lcd.h b/src/lcd.h index a4b398439..4418e0204 100644 --- a/src/lcd.h +++ b/src/lcd.h @@ -80,7 +80,7 @@ extern uint8_t displayBuf[DISPLAY_W*DISPLAY_H/8]; extern uint8_t lcd_lastPos; extern void lcd_putc(unsigned char x,unsigned char y,const char c); -extern void lcd_putcAtt(unsigned char x,unsigned char y,const char c,uint8_t mode); +extern void lcd_putcAtt(unsigned char x,unsigned char y,const unsigned char c,uint8_t mode); extern void lcd_putsAtt(unsigned char x,unsigned char y,const pm_char * s,uint8_t mode); extern void lcd_putsiAtt(uint8_t x,uint8_t y,const pm_char * s,uint8_t idx, uint8_t mode); @@ -99,8 +99,9 @@ extern void putsStrIdx(uint8_t x, uint8_t y, const pm_char *str, uint8_t idx, ui extern void putsModelName(uint8_t x, uint8_t y, char *name, uint8_t id, uint8_t att); extern void putsSwitches(uint8_t x, uint8_t y, int8_t swtch, uint8_t att=0); +extern void putsMixerSource(uint8_t x, uint8_t y, uint8_t idx, uint8_t att=0); extern void putsFlightPhase(uint8_t x, uint8_t y, int8_t idx, uint8_t att=0); -extern void putsCurve(uint8_t x, uint8_t y, uint8_t idx, uint8_t att=0); +extern void putsCurve(uint8_t x, uint8_t y, int8_t idx, uint8_t att=0); extern void putsTmrMode(uint8_t x, uint8_t y, int8_t mode, uint8_t att); extern void putsChnRaw(uint8_t x,uint8_t y,uint8_t idx1,uint8_t att); diff --git a/src/main_views.cpp b/src/main_views.cpp index 840c2e7a9..c1fb87774 100644 --- a/src/main_views.cpp +++ b/src/main_views.cpp @@ -185,10 +185,10 @@ void menuMainView(uint8_t event) putsVBat(6*FW-1, 2*FH, att|NO_UNIT); lcd_putc(6*FW, 3*FH, 'V'); - if (g_model.timer1.mode) { + if (g_model.timers[0].mode) { uint8_t att = DBLSIZE | (s_timerState[0]==TMR_BEEPING ? BLINK : 0); putsTime(12*FW+3, FH*2, s_timerVal[0], att, att); - putsTmrMode(s_timerVal[0] >= 0 ? 9*FW-FW/2+5 : 9*FW-FW/2-2, FH*3, g_model.timer1.mode, SWCONDENSED); + putsTmrMode(s_timerVal[0] >= 0 ? 9*FW-FW/2+5 : 9*FW-FW/2-2, FH*3, g_model.timers[0].mode, SWCONDENSED); } // trim sliders @@ -298,7 +298,7 @@ void menuMainView(uint8_t event) } else { // timer2 putsTime(33+FW+2, FH*5, s_timerVal[1], DBLSIZE, DBLSIZE); - putsTmrMode(s_timerVal[1] >= 0 ? 20-FW/2+5 : 20-FW/2-2, FH*6, g_model.timer2.mode, SWCONDENSED); + putsTmrMode(s_timerVal[1] >= 0 ? 20-FW/2+5 : 20-FW/2-2, FH*6, g_model.timers[1].mode, SWCONDENSED); // lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s } diff --git a/src/menus.cpp b/src/menus.cpp index 412f49d9e..2ab32dda3 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -37,7 +37,6 @@ #include "menus.h" int16_t calibratedStick[NUM_STICKS+NUM_POTS]; -int16_t ex_chans[NUM_CHNOUT]; // Outputs + intermidiates uint8_t s_pgOfs; int8_t s_editMode; uint8_t s_noHi; diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 8d0ace278..041c70281 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -430,8 +430,8 @@ void menuProcModel(uint8_t event) if((y+=FH)>7*FH) return; }subN++; - TimerData *timer = &g_model.timer1; - for (uint8_t i=0; i<2; i++, timer=&g_model.timer2) { + for (uint8_t i=0; i<2; i++) { + TimerData *timer = &g_model.timers[i]; if (s_pgOfsmode, sub==subN && m_posHorz==0 ? ((s_editMode>0) ? BLINK : INVERS) : 0); @@ -938,7 +938,7 @@ uint8_t getExpoMixCount(uint8_t expo) uint8_t ch ; for(int8_t i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) { - ch = (expo ? expoaddress(i)->mode : mixaddress(i)->destCh); + ch = (expo ? expoaddress(i)->mode : mixaddress(i)->srcRaw); if (ch != 0) { count++; } @@ -984,7 +984,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx) MixData *mix = mixaddress(idx); memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData)); memset(mix,0,sizeof(MixData)); - mix->destCh = s_currCh; + mix->destCh = s_currCh-1; mix->srcRaw = s_currCh; mix->weight = 100; } @@ -1060,14 +1060,14 @@ bool swapMix(uint8_t &idx, uint8_t up) int8_t tgt_idx = (up ? idx-1 : idx+1); if (tgt_idx < 0) { - if (x->destCh == 1) + if (x->destCh == 0) return false; x->destCh--; return true; } if (tgt_idx == MAX_MIXERS) { - if (x->destCh == NUM_CHNOUT) + if (x->destCh == NUM_CHNOUT-1) return false; x->destCh++; return true; @@ -1076,11 +1076,11 @@ bool swapMix(uint8_t &idx, uint8_t up) MixData *y = mixaddress(tgt_idx); if(x->destCh != y->destCh) { if (up) { - if (x->destCh>1) x->destCh--; + if (x->destCh>0) x->destCh--; else return false; } else { - if (x->destChdestCh++; + if (x->destChdestCh++; else return false; } return true; @@ -1180,8 +1180,8 @@ void menuProcMixOne(uint8_t event) { TITLEP(s_currCh ? STR_INSERTMIX : STR_EDITMIX); MixData *md2 = mixaddress(s_currIdx) ; - putsChn(lcd_lastPos+1*FW,0,md2->destCh,0); - SIMPLE_SUBMENU_NOTITLE(13); + putsChn(lcd_lastPos+1*FW,0,md2->destCh+1,0); + SIMPLE_SUBMENU_NOTITLE(14); int8_t sub = m_posVert; @@ -1192,8 +1192,8 @@ void menuProcMixOne(uint8_t event) switch(i) { case 0: lcd_puts(2*FW, y, STR_SOURCE); - putsChnRaw(FW*10, y, md2->srcRaw, attr); - if(attr) CHECK_INCDEC_MODELVAR(event, md2->srcRaw, 1,NUM_XCHNRAW); + putsMixerSource(FW*10, y, md2->srcRaw, attr); + if(attr) CHECK_INCDEC_MODELVAR(event, md2->srcRaw, 1, NUM_XCHNMIX); // TODO use enum break; case 1: lcd_puts(2*FW, y, STR_WEIGHT); @@ -1201,35 +1201,41 @@ void menuProcMixOne(uint8_t event) if (attr) CHECK_INFLIGHT_INCDEC_MODELVAR(event, md2->weight, -125, 125, 0, STR_MIXERWEIGHT); break; case 2: + // TODO INFLIGHT + lcd_puts(2*FW, y, STR_DIFFERENTIAL); + lcd_outdezAtt(FW*10, y, md2->differential, attr|LEFT); + if (attr) CHECK_INCDEC_MODELVAR(event, md2->differential, 0, 100); + break; + case 3: lcd_puts(2*FW, y, STR_OFFSET); lcd_outdezAtt(FW*10, y, md2->sOffset, attr|LEFT|INFLIGHT(md2->sOffset)); if (attr) CHECK_INFLIGHT_INCDEC_MODELVAR(event, md2->sOffset, -125, 125, 0, STR_MIXEROFFSET); break; - case 3: + case 4: lcd_puts(2*FW, y, STR_TRIM); lcd_putsiAtt(FW*10, y, STR_VMIXTRIMS, (md2->srcRaw <= 4) ? md2->carryTrim : 1, attr); if (attr) CHECK_INCDEC_MODELVAR( event, md2->carryTrim, TRIM_ON, TRIM_OFFSET); break; - case 4: + case 5: lcd_puts(2*FW, y, STR_CURVES); putsCurve(FW*10, y, md2->curve, attr); - if(attr) CHECK_INCDEC_MODELVAR( event, md2->curve, 0,MAX_CURVE5+MAX_CURVE9+7-1); - if(attr && md2->curve>=CURVE_BASE && event==EVT_KEY_FIRST(KEY_MENU)){ - s_curveChan = md2->curve-CURVE_BASE; + if(attr) CHECK_INCDEC_MODELVAR( event, md2->curve, -MAX_CURVE5-MAX_CURVE9, MAX_CURVE5+MAX_CURVE9+7-1); + if(attr && event==EVT_KEY_FIRST(KEY_MENU) && (md2->curve<0 || md2->curve>=CURVE_BASE)){ + s_curveChan = (md2->curve<0 ? -md2->curve-1 : md2->curve-CURVE_BASE); pushMenu(menuProcCurveOne); } break; - case 5: + case 6: lcd_puts( 2*FW,y,STR_SWITCH); putsSwitches(10*FW, y,md2->swtch,attr); if(attr) CHECK_INCDEC_MODELVAR( event, md2->swtch, -MAX_SWITCH, MAX_SWITCH); break; - case 6: + case 7: lcd_puts( 2*FW,y,STR_FPHASE); putsFlightPhase(10*FW, y, md2->phase, attr); if(attr) CHECK_INCDEC_MODELVAR( event, md2->phase, -MAX_PHASES, MAX_PHASES); break; - case 7: + case 8: lcd_puts( 2*FW,y,STR_WARNING); if(md2->mixWarn) lcd_outdezAtt(FW*10,y,md2->mixWarn,attr|LEFT); @@ -1237,27 +1243,27 @@ void menuProcMixOne(uint8_t event) lcd_putsAtt(FW*10, y, STR_OFF, attr); if(attr) CHECK_INCDEC_MODELVAR( event, md2->mixWarn, 0,3); break; - case 8: + case 9: lcd_puts( 2*FW,y,STR_MULTPX); lcd_putsiAtt(10*FW, y, STR_VMLTPX, md2->mltpx, attr); if(attr) CHECK_INCDEC_MODELVAR( event, md2->mltpx, 0, 2); break; - case 9: + case 10: lcd_puts( 2*FW,y,STR_DELAYDOWN); lcd_outdezAtt(FW*16,y,md2->delayDown,attr); if(attr) CHECK_INCDEC_MODELVAR( event, md2->delayDown, 0,15); break; - case 10: + case 11: lcd_puts( 2*FW,y,STR_DELAYUP); lcd_outdezAtt(FW*16,y,md2->delayUp,attr); if(attr) CHECK_INCDEC_MODELVAR( event, md2->delayUp, 0,15); break; - case 11: + case 12: lcd_puts( 2*FW,y,STR_SLOWDOWN); lcd_outdezAtt(FW*16,y,md2->speedDown,attr); if(attr) CHECK_INCDEC_MODELVAR( event, md2->speedDown, 0,15); break; - case 12: + case 13: lcd_puts( 2*FW,y,STR_SLOWUP); lcd_outdezAtt(FW*16,y,md2->speedUp,attr); if(attr) CHECK_INCDEC_MODELVAR( event, md2->speedUp, 0,15); @@ -1277,7 +1283,7 @@ inline void displayMixerLine(uint8_t row, uint8_t mix, uint8_t ch, uint8_t idx, if (idx > 0) lcd_putsiAtt(FW, y, STR_VMLTPX2, md->mltpx, 0); - putsChnRaw(4*FW+2, y, md->srcRaw, 0); + putsMixerSource(4*FW+2, y, md->srcRaw, 0); uint8_t attr = ((s_copyMode || cur != row) ? 0 : INVERS); lcd_outdezAtt(11*FW+7, y, md->weight, attr); @@ -1393,7 +1399,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_) if (!s_currCh || (s_copyMode && !s_copyTgtOfs)) { s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE); s_copySrcIdx = s_currIdx; - s_copySrcCh = expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh; + s_copySrcCh = expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1; s_copySrcRow = sub; break; } @@ -1425,7 +1431,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_) case EVT_KEY_LONG(KEY_RIGHT): if (s_copyMode && !s_copyTgtOfs) { if (reachExpoMixCountLimit(expo)) break; - s_currCh = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh); + s_currCh = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1); if (_event == EVT_KEY_LONG(KEY_RIGHT)) s_currIdx++; insertExpoMix(expo, s_currIdx); pushMenu(expo ? menuProcExpoOne : menuProcMixOne); @@ -1469,7 +1475,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_) for (uint8_t ch=1; ch<=(expo ? NUM_STICKS : NUM_CHNOUT); ch++) { MixData *md=NULL; ExpoData *ed=NULL; - if (expo ? (ichn+1 == ch && ed->mode) : (idestCh == ch)) { + if (expo ? (ichn+1 == ch && ed->mode) : (idestCh+1 == ch)) { if (s_pgOfs < cur && cur-s_pgOfs < 8) { if (expo) putsChnRaw(0, (cur-s_pgOfs)*FH, ch, 0); @@ -1499,7 +1505,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_) displayMixerLine(cur, i, ch, mixCnt, sub, _event); } cur++; mixCnt++; i++; md++; ed++; - } while (expo ? (ichn+1 == ch && ed->mode) : (idestCh == ch)); + } while (expo ? (ichn+1 == ch && ed->mode) : (idestCh+1 == ch)); if (s_copyMode == MOVE_MODE && s_pgOfs < cur && cur-s_pgOfs < 8 && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) { uint8_t y = (cur-s_pgOfs)*FH; lcd_rect(22, y-1, DISPLAY_W-1-21, 9, DOTTED); @@ -1676,11 +1682,11 @@ void menuProcCustomSwitches(uint8_t event) if (cstate == CS_VOFS) { - putsChnRaw(12*FW-2, y, cs.v1, m_posHorz==1 ? attr : 0); + putsChnRaw(12*FW-2, y, cs.v1, (m_posHorz==1 ? attr : 0)); #if defined(FRSKY) - if (cs.v1 > NUM_XCHNCSW-NUM_TELEMETRY-MAX_TIMERS+2) { - putsTelemetryChannel(20*FW, y, cs.v1 - (NUM_XCHNCSW-NUM_TELEMETRY-MAX_TIMERS+3), 128+cs.v2, m_posHorz==2 ? attr : 0); + if (cs.v1 > NUM_XCHNCSW-NUM_TELEMETRY) { + putsTelemetryChannel(20*FW, y, cs.v1 - (NUM_XCHNCSW-NUM_TELEMETRY+1), 128+cs.v2, m_posHorz==2 ? attr : 0); v2_min = -128; v2_max = 127; } else @@ -1698,8 +1704,8 @@ void menuProcCustomSwitches(uint8_t event) { putsSwitches(12*FW-2, y, cs.v1, m_posHorz==1 ? attr : 0); putsSwitches(17*FW, y, cs.v2, m_posHorz==2 ? attr : 0); - v1_min = -MAX_SWITCH; v1_max = MAX_SWITCH; - v2_min = -MAX_SWITCH; v2_max = MAX_SWITCH; + v1_min = SWITCH_OFF; v1_max = SWITCH_ON; + v2_min = SWITCH_OFF; v2_max = SWITCH_ON; } else // cstate == CS_COMP { @@ -1723,11 +1729,11 @@ void menuProcCustomSwitches(uint8_t event) if (cstate == CS_VOFS) { if (cs.v1 == CHOUT_BASE+NUM_CHNOUT+1 && v1 < cs.v1) cs.v2 = -98; #ifdef FRSKY - if (cs.v1 == CHOUT_BASE+NUM_CHNOUT+3 && v1 < cs.v1) cs.v2 = -128; + if (cs.v1 == CHOUT_BASE+NUM_CHNOUT+MAX_TIMERS+1 && v1 < cs.v1) cs.v2 = -128; #endif if (cs.v1 == CHOUT_BASE+NUM_CHNOUT && v1 > cs.v1) cs.v2 = 0; #ifdef FRSKY - if (cs.v1 == CHOUT_BASE+NUM_CHNOUT+2 && v1 > cs.v1) cs.v2 = -98; + if (cs.v1 == CHOUT_BASE+NUM_CHNOUT+MAX_TIMERS && v1 > cs.v1) cs.v2 = -98; #endif } break; @@ -1760,7 +1766,7 @@ void menuProcFunctionSwitches(uint8_t event) case 0: putsSwitches(3, y, sd->swtch, attr); if (active) { - CHECK_INCDEC_MODELVAR( event, sd->swtch, -MAX_SWITCH-MAX_PSWITCH-NUM_CSW, MAX_SWITCH+MAX_PSWITCH+NUM_CSW); + CHECK_INCDEC_MODELVAR( event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH); } break; case 1: @@ -1832,9 +1838,9 @@ void menuProcFunctionSwitches(uint8_t event) void menuProcTelemetry(uint8_t event) { #if defined(FRSKY_HUB) || defined(WS_HOW_HIGH) - MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, 22, {0, -1, 1, 0, 2, 2, -1, 1, 0, 2, 2, -1, 1, 1, -1, 0, 0, -1, 2, 2, 2, 2}); + MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, 22, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, (uint8_t)-1, 0, 0, (uint8_t)-1, 2, 2, 2, 2}); #else - MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, 19, {0, -1, 1, 0, 2, 2, -1, 1, 0, 2, 2, -1, 1, 1, -1, 2, 2, 2, 2}); + MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, 19, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, (uint8_t)-1, 2, 2, 2, 2}); #endif int8_t sub = m_posVert; @@ -1937,17 +1943,17 @@ void menuProcTelemetry(uint8_t event) if(s_pgOfs0 || p1valdiff)) { switch (m_posHorz) { case 0: - CHECK_INCDEC_MODELVAR(event, g_model.frskyRssiAlarms[j].level, -3, 2); // circular (saves flash) + CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[j].level, -3, 2); // circular (saves flash) break; case 1: - CHECK_INCDEC_MODELVAR(event, g_model.frskyRssiAlarms[j].value, -30, 30); + CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[j].value, -30, 30); break; } } diff --git a/src/myeeprom.h b/src/myeeprom.h index 50133c840..f2c5f638b 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -48,7 +48,7 @@ #define WARN_MEM (!(g_eeGeneral.warnOpts & WARN_MEM_BIT)) #define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 ) -#define EEPROM_VER 204 +#define EEPROM_VER 205 #ifndef PACK #define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__)) @@ -138,6 +138,7 @@ PACK(typedef struct t_LimitData { int16_t offset; }) LimitData; +// TODO enum #define SRC_RUD 1 #define SRC_ELE 2 #define SRC_THR 3 @@ -145,11 +146,29 @@ PACK(typedef struct t_LimitData { #define MIX_P1 5 #define MIX_P2 6 #define MIX_P3 7 -#define MIX_HALF 8 -#define MIX_FULL 9 -#define MIX_CYC1 10 -#define MIX_CYC2 11 -#define MIX_CYC3 12 +#define MIX_MAX 8 +#define MIX_3POS 9 +#define MIX_THR 10 +#define MIX_RUD 11 +#define MIX_ELE 12 +#define MIX_ID0 13 +#define MIX_ID1 14 +#define MIX_ID2 15 +#define MIX_AIL 16 +#define MIX_GEA 17 +#define MIX_TRN 18 +#define MIX_SW1 19 +#define MIX_SW9 27 +#define MIX_SWA 28 +#define MIX_SWB 29 +#define MIX_SWC 30 +#define MIX_CYC1 31 +#define MIX_CYC2 32 +#define MIX_CYC3 33 +#define MIX_PPM1 34 +#define MIX_PPM8 41 +#define MIX_CH1 42 +#define MIX_CH16 57 #define TRIM_ON 0 #define TRIM_OFF 1 @@ -159,40 +178,21 @@ PACK(typedef struct t_LimitData { #define MLTPX_MUL 1 #define MLTPX_REP 2 -/* PACK(typedef struct t_MixData { - uint8_t destCh:5; // 0, 1..NUM_CHNOUT - uint16_t differential:7; - int16_t phase:4; // -5=!FP4, 0=normal, 5=FP4 + uint8_t destCh:4; // 0, 1..NUM_CHNOUT + int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4 int8_t weight; int8_t swtch:6; uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means := - int8_t curve:6; + int8_t curve:6; uint8_t mixWarn:2; // mixer warning uint8_t delayUp:4; uint8_t delayDown:4; uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle) uint8_t speedDown:4; // 0 nichts - uint8_t carryTrim:2; - uint8_t srcRaw:6; // - int8_t sOffset; -}) MixData; -*/ - -PACK(typedef struct t_MixData { - uint8_t destCh:5; // 0, 1..NUM_CHNOUT - uint8_t mixWarn:3; // mixer warning - uint8_t srcRaw; // - int8_t weight; - int8_t swtch; - uint8_t curve; - uint8_t delayUp:4; - uint8_t delayDown:4; - uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle) - uint8_t speedDown:4; // 0 nichts - uint8_t carryTrim:2; - uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means := - int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4 + uint16_t srcRaw:7; // + uint16_t differential:7; + uint16_t carryTrim:2; int8_t sOffset; }) MixData; @@ -282,6 +282,7 @@ PACK(typedef struct t_FrSkyData { uint16_t blades:2; // How many blades for RPMs, 0=2 blades, 1=3 blades uint16_t spare:2; FrSkyBarData bars[4]; + FrSkyRSSIAlarm rssiAlarms[2]; }) FrSkyData; PACK(typedef struct t_SwashRingData { // Swash Ring data @@ -337,7 +338,7 @@ PACK(typedef struct t_TimerData { PACK(typedef struct t_ModelData { char name[10]; // 10 must be first for eeLoadModelName - TimerData timer1; // TODO timers array + TimerData timers[MAX_TIMERS]; uint8_t protocol:3; uint8_t thrTrim:1; // Enable Throttle Trim int8_t ppmNCH:4; @@ -349,7 +350,6 @@ PACK(typedef struct t_ModelData { uint8_t spare2:1; int8_t ppmDelay; uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7 - TimerData timer2; MixData mixData[MAX_MIXERS]; LimitData limitData[NUM_CHNOUT]; ExpoData expoData[MAX_EXPOS]; @@ -363,7 +363,6 @@ PACK(typedef struct t_ModelData { int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments uint8_t thrTraceSrc; uint8_t modelId; - FrSkyRSSIAlarm frskyRssiAlarms[2]; // TODO next EEPROM: merge with FrSkyData }) ModelData; extern EEGeneral g_eeGeneral; diff --git a/src/o9xstrings.cpp b/src/o9xstrings.cpp index 1163915a0..246ffe96e 100644 --- a/src/o9xstrings.cpp +++ b/src/o9xstrings.cpp @@ -126,6 +126,7 @@ const pm_char STR_INSERTMIX[] PROGMEM = TR_INSERTMIX; const pm_char STR_EDITMIX[] PROGMEM = TR_EDITMIX; const pm_char STR_SOURCE[] PROGMEM = TR_SOURCE; const pm_char STR_WEIGHT[] PROGMEM = TR_WEIGHT; +const pm_char STR_DIFFERENTIAL[] PROGMEM = TR_DIFFERENTIAL; const pm_char STR_OFFSET[] PROGMEM = TR_OFFSET; const pm_char STR_TRIM[] PROGMEM = TR_TRIM; const pm_char STR_CURVES[] PROGMEM = TR_CURVES; @@ -280,3 +281,18 @@ const pm_char STR_DREXPO[] PROGMEM = TR_DREXPO; const pm_char STR_MINLIMIT[] PROGMEM = TR_MINLIMIT; const pm_char STR_MAXLIMIT[] PROGMEM = TR_MAXLIMIT; #endif + +const pm_uchar font[] PROGMEM = { +#include "font.lbm" +#ifdef TRANSLATIONS_SE +#include "font_se.lbm" +#endif +}; + +const pm_uchar font_dblsize[] PROGMEM = { +// TODO flash saving with locale extensions +#include "font_dblsize.lbm" +#ifdef TRANSLATIONS_SE +#include "font_dblsize_se.lbm" +#endif +}; diff --git a/src/o9xstrings.h b/src/o9xstrings.h index e2952dddf..f686f1abf 100644 --- a/src/o9xstrings.h +++ b/src/o9xstrings.h @@ -36,10 +36,16 @@ #if defined(TRANSLATIONS_FR) #include "translations/fr.h" +#define LEN_SPECIAL_CHARS 0 #elif defined(TRANSLATIONS_IT) #include "translations/it.h" +#define LEN_SPECIAL_CHARS 0 +#elif defined(TRANSLATIONS_SE) +#include "translations/se.h" +#define LEN_SPECIAL_CHARS 6 #else #include "translations/en.h" +#define LEN_SPECIAL_CHARS 0 #endif #define PSIZE(x) ( sizeof(x) - 1 ) @@ -205,6 +211,7 @@ extern const pm_char STR_INSERTMIX[]; extern const pm_char STR_EDITMIX[]; extern const pm_char STR_SOURCE[]; extern const pm_char STR_WEIGHT[]; +extern const pm_char STR_DIFFERENTIAL[]; extern const pm_char STR_OFFSET[]; extern const pm_char STR_TRIM[]; extern const pm_char STR_CURVES[]; @@ -334,3 +341,6 @@ extern const pm_char STR_DREXPO[]; extern const pm_char STR_MINLIMIT[]; extern const pm_char STR_MAXLIMIT[]; #endif + +extern const pm_uchar font[]; +extern const pm_uchar font_dblsize[]; diff --git a/src/open9x.cpp b/src/open9x.cpp index f268aacf5..be4dd250e 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -104,7 +104,8 @@ char idx2char(int8_t idx) } if (idx < 27) return 'A' + idx - 1; if (idx < 37) return '0' + idx - 27; - if (idx <= ZCHAR_MAX) return pgm_read_byte(s_charTab+idx-37); + if (idx <= 40) return pgm_read_byte(s_charTab+idx-37); + if (idx <= ZCHAR_MAX) return 'z' + 5 + idx - 40; return ' '; } @@ -155,39 +156,32 @@ int16_t intpol(int16_t x, uint8_t idx) // -100, -75, -50, -25, 0 ,25 ,50, 75, 10 return erg / 25; // 100*D5/RESX; } -int16_t applyCurve(int16_t x, uint8_t idx, uint8_t srcRaw) +int16_t applyCurve(int16_t x, int8_t idx) { + /* already tried to have only one return at the end */ switch(idx) { - case 0: - return x; - case 1: - if (srcRaw == MIX_FULL) { //FULL - if (x<0 ) x=-RESX; //x|x>0 - else x=-RESX+2*x; - } - else { - if (x<0) x=0; //x|x>0 - } - return x; - case 2: - if (srcRaw == MIX_FULL) { //FULL - if (x>0) x=RESX; //x|x<0 - else x=RESX+2*x; - } - else { - if (x>0) x=0; //x|x<0 - } - return x; - case 3: // x|abs(x) - return abs(x); - case 4: //f|f>0 - return x>0 ? RESX : 0; - case 5: //f|f<0 - return x<0 ? -RESX : 0; - case 6: //f|abs(f) - return x>0 ? RESX : -RESX; + case 0: + return x; + case 1: + if (x < 0) x = 0; //x|x>0 + return x; + case 2: + if (x > 0) x = 0; //x|x<0 + return x; + case 3: // x|abs(x) + return abs(x); + case 4: //f|f>0 + return x > 0 ? RESX : 0; + case 5: //f|f<0 + return x < 0 ? -RESX : 0; + case 6: //f|abs(f) + return x > 0 ? RESX : -RESX; } - return intpol(x, idx-7); + if (idx < 0) { + x = -x; + idx = -idx + 6; + } + return intpol(x, idx - 7); } // expo-funktion: @@ -285,7 +279,7 @@ void applyExpos(int16_t *anas, uint8_t phase) cur_chn = ed.chn; int16_t k = ed.expo; v = expo(v, k); - if (ed.curve) v = applyCurve(v, ed.curve > 10 ? ed.curve + 4 : ed.curve, 0); + if (ed.curve) v = applyCurve(v, ed.curve > 10 ? ed.curve + 4 : ed.curve); v = ((int32_t)v * ed.weight) / 100; anas[cur_chn] = v; } @@ -293,30 +287,44 @@ void applyExpos(int16_t *anas, uint8_t phase) } } -/*TODO evaluate impact FORCEINLINE */ +/*TODO check the stack used for recursive calls */ +/*TODO use the new MIX_xxx */ +int16_t ex_chans[NUM_CHNOUT] = {0}; // Outputs (before LIMITS) of the last perMain +#ifdef HELI +int16_t cyc_anas[3] = {0}; +#endif int16_t getValue(uint8_t i) { - if(i throttle trim if applicable - int16_t v = anas[i]; int32_t vv = 2*RESX; int16_t trim = getTrimValue(getTrimFlightPhase(i, phase), i); if (i==THR_STICK && g_model.thrTrim) { if (g_eeGeneral.throttleReversed) - trim = -trim; + trim = -trim; + int16_t v = anas[i]; vv = ((int32_t)trim-TRIM_MIN)*(RESX-v)/(2*RESX); } else if (trimsCheckTimer > 0) { @@ -1006,12 +1014,12 @@ uint8_t evalSticks(uint8_t phase) { #ifdef HELI uint16_t d = 0; - if(g_model.swashR.value) { + if (g_model.swashR.value) { uint32_t v = (int32_t(calibratedStick[ELE_STICK])*calibratedStick[ELE_STICK] + int32_t(calibratedStick[AIL_STICK])*calibratedStick[AIL_STICK]); uint32_t q = int32_t(RESX)*g_model.swashR.value/100; q *= q; - if(v>q) + if (v>q) d = isqrt32(v); } #endif @@ -1031,8 +1039,8 @@ uint8_t evalSticks(uint8_t phase) g_eeGeneral.calibSpanNeg[i]))); #endif - if(v <= -RESX) v = -RESX; - if(v >= RESX) v = RESX; + if(v < -RESX) v = -RESX; + if(v > RESX) v = RESX; if (g_eeGeneral.throttleReversed && ch==THR_STICK) v = -v; @@ -1062,8 +1070,8 @@ uint8_t evalSticks(uint8_t phase) v = int32_t(v)*g_model.swashR.value*RESX/(int32_t(d)*100); #endif + anas[ch] = v; //set values for mixer } - anas[ch] = v; //set values for mixer } /* EXPOs */ @@ -1113,7 +1121,7 @@ void evalFunctions() } } -void perOut(int16_t *chanOut, uint8_t phase) +void perOut(uint8_t phase) { uint8_t anaCenter = evalSticks(phase); @@ -1122,9 +1130,6 @@ void perOut(int16_t *chanOut, uint8_t phase) if(((bpanaCenter ^ anaCenter) & anaCenter)) AUDIO_POT_STICK_MIDDLE(); bpanaCenter = anaCenter; - anas[MIX_HALF-1] = RESX; // HALF - anas[MIX_FULL-1] = RESX; // FULL - #ifdef HELI if(g_model.swashR.value) { @@ -1147,8 +1152,8 @@ void perOut(int16_t *chanOut, uint8_t phase) int16_t vp = anas[ELE_STICK]+trims[ELE_STICK]; int16_t vr = anas[AIL_STICK]+trims[AIL_STICK]; int16_t vc = 0; - if(g_model.swashR.collectiveSource) - vc = anas[g_model.swashR.collectiveSource-1]; + if (g_model.swashR.collectiveSource) + vc = getValue(g_model.swashR.collectiveSource-1); if(g_model.swashR.invertELE) vp = -vp; if(g_model.swashR.invertAIL) vr = -vr; @@ -1159,30 +1164,30 @@ void perOut(int16_t *chanOut, uint8_t phase) case (SWASH_TYPE_120): vp = REZ_SWASH_Y(vp); vr = REZ_SWASH_X(vr); - anas[MIX_CYC1-1] = vc - vp; - anas[MIX_CYC2-1] = vc + vp/2 + vr; - anas[MIX_CYC3-1] = vc + vp/2 - vr; + cyc_anas[0] = vc - vp; + cyc_anas[1] = vc + vp/2 + vr; + cyc_anas[2] = vc + vp/2 - vr; break; case (SWASH_TYPE_120X): vp = REZ_SWASH_X(vp); vr = REZ_SWASH_Y(vr); - anas[MIX_CYC1-1] = vc - vr; - anas[MIX_CYC2-1] = vc + vr/2 + vp; - anas[MIX_CYC3-1] = vc + vr/2 - vp; + cyc_anas[0] = vc - vr; + cyc_anas[1] = vc + vr/2 + vp; + cyc_anas[2] = vc + vr/2 - vp; break; case (SWASH_TYPE_140): vp = REZ_SWASH_Y(vp); vr = REZ_SWASH_Y(vr); - anas[MIX_CYC1-1] = vc - vp; - anas[MIX_CYC2-1] = vc + vp + vr; - anas[MIX_CYC3-1] = vc + vp - vr; + cyc_anas[0] = vc - vp; + cyc_anas[1] = vc + vp + vr; + cyc_anas[2] = vc + vp - vr; break; case (SWASH_TYPE_90): vp = REZ_SWASH_Y(vp); vr = REZ_SWASH_Y(vr); - anas[MIX_CYC1-1] = vc - vp; - anas[MIX_CYC2-1] = vc + vr; - anas[MIX_CYC3-1] = vc - vr; + cyc_anas[0] = vc - vp; + cyc_anas[1] = vc + vr; + cyc_anas[2] = vc - vr; break; default: break; @@ -1190,10 +1195,6 @@ void perOut(int16_t *chanOut, uint8_t phase) } #endif - for (uint8_t i=0; idestCh==0) || (md->destCh>NUM_CHNOUT)) break; + if (md->srcRaw==0) break; if (md->phase != 0) { if (md->phase > 0) { @@ -1225,21 +1226,27 @@ void perOut(int16_t *chanOut, uint8_t phase) uint8_t swTog; //swOn[i]=false; - if (!getSwitch(md->swtch,1)) { // switch on? if no switch selected => on + if (!getSwitch(md->swtch, 1)) { // switch on? (if no switch selected => on) swTog = swOn[i]; swOn[i] = false; - if(md->srcRaw!=MIX_HALF && md->srcRaw!=MIX_FULL) continue;// if not MAX or FULL - next loop - if(md->mltpx==MLTPX_REP) continue; // if switch is off and REPLACE then off - v = (md->srcRaw == MIX_FULL ? -RESX : 0); // switch is off and it is either MAX=0 or FULL=-512 + continue; } - else { - swTog = !swOn[i]; - swOn[i] = true; - uint8_t k = md->srcRaw-1; + + swTog = !swOn[i]; + swOn[i] = true; + uint8_t k = md->srcRaw-1; + + if (k < NUM_STICKS) v = anas[k]; //Switch is on. MAX=FULL=512 or value. - if (k>=CHOUT_BASE && (kmixWarn) mixWarning |= 1<<(md->mixWarn-1); // Mix warning + else if (k>=CHOUT_BASE && k=MIX_3POS && kmixWarn) mixWarning |= 1<<(md->mixWarn-1); // Mix warning //========== INPUT OFFSET =============== if(md->sOffset) v += calc100toRESX(md->sOffset); @@ -1257,7 +1264,7 @@ void perOut(int16_t *chanOut, uint8_t phase) // v * weight / 100 = anas => anas*100/weight = v if(md->mltpx==MLTPX_REP) { - act[i] = (int32_t)anas[md->destCh-1+CHOUT_BASE]*DEL_MULT; + act[i] = (int32_t)ex_chans[md->destCh]*DEL_MULT; act[i] *=100; if(md->weight) act[i] /= md->weight; } @@ -1295,7 +1302,7 @@ void perOut(int16_t *chanOut, uint8_t phase) //========== CURVES =============== if (md->curve) - v = applyCurve(v, md->curve, md->srcRaw); + v = applyCurve(v, md->curve); //========== TRIMS =============== if (md->srcRaw>0 && md->srcRaw<=NUM_STICKS) { @@ -1311,7 +1318,12 @@ void perOut(int16_t *chanOut, uint8_t phase) //========== MULTIPLEX =============== int32_t dv = (int32_t)v*md->weight; - int32_t *ptr = &chans[md->destCh-1]; // Save calculating address several times + + uint8_t differential = md->differential; + if (differential && dv<0) + dv = (dv * (100-differential)) / 100; + + int32_t *ptr = &chans[md->destCh]; // Save calculating address several times switch(md->mltpx){ case MLTPX_REP: *ptr = dv; @@ -1327,48 +1339,13 @@ void perOut(int16_t *chanOut, uint8_t phase) break; } } - - //========== LIMITS =============== - for (uint8_t i=0;i 1024*100 - // later we multiply by the limit (up to 100) and then we need to normalize - // at the end chans[i] = chans[i]/100 => -1024..1024 - // interpolate value with min/max so we get smooth motion from center to stop - // this limits based on v original values and min=-1024, max=1024 RESX=1024 - //printf("chans%d=%d\n", i, chans[i]);fflush(stdout); - int32_t q = chans[i];// + (int32_t)g_model.limitData[i].offset*100; // offset before limit - - chans[i] /= 100; // chans back to -1024..1024 - ex_chans[i] = chans[i]; //for getswitch - - int16_t ofs = g_model.limitData[i].offset; - int16_t lim_p = 10*(g_model.limitData[i].max+100); - int16_t lim_n = 10*(g_model.limitData[i].min-100); //multiply by 10 to get same range as ofs (-1000..1000) - if(ofs>lim_p) ofs = lim_p; - if(ofs0) ? - q*((int32_t)lim_p-ofs)/100000 : - -q*((int32_t)lim_n-ofs)/100000 ; //div by 100000 -> output = -1024..1024 - - q += calc1000toRESX(ofs); - lim_p = calc1000toRESX(lim_p); - lim_n = calc1000toRESX(lim_n); - if(q>lim_p) q = lim_p; - if(q 1024*100 + // later we multiply by the limit (up to 100) and then we need to normalize + // at the end chans[i] = chans[i]/100 => -1024..1024 + // interpolate value with min/max so we get smooth motion from center to stop + // this limits based on v original values and min=-1024, max=1024 RESX=1024 + //printf("chans%d=%d\n", i, chans[i]);fflush(stdout); + int32_t q = (s_fade_flight_phases ? (sum_chans512[i] / weight) * 16 : chans[i]); + ex_chans[i] = q / 100; // for the next perMain + + int16_t ofs = g_model.limitData[i].offset; + int16_t lim_p = 10*(g_model.limitData[i].max+100); + int16_t lim_n = 10*(g_model.limitData[i].min-100); //multiply by 10 to get same range as ofs (-1000..1000) + if (ofs>lim_p) ofs = lim_p; + if(ofs0) ? + q*((int32_t)lim_p-ofs)/100000 : + -q*((int32_t)lim_n-ofs)/100000 ; //div by 100000 -> output = -1024..1024 + + q += calc1000toRESX(ofs); + lim_p = calc1000toRESX(lim_p); + lim_n = calc1000toRESX(lim_n); + if(q>lim_p) q = lim_p; + if(q=(TMR_VAROFS+MAX_SWITCH-1)){ // toggeled switch + if (atm>=(TMR_VAROFS+MAX_SWITCH)){ // toggeled switch if(!(sw_toggled[i] | s_sum[i] | s_cnt[i] | lastSwPos[i])) lastSwPos[i] = tm < 0; // if initializing then init the lastSwPos - uint8_t swPos = getSwitch(tm>0 ? tm-(TMR_VAROFS+MAX_SWITCH-1-1) : tm+(TMR_VAROFS+MAX_SWITCH-1-1), 0); + uint8_t swPos = getSwitch(tm>0 ? tm-(TMR_VAROFS+MAX_SWITCH-1) : tm+(TMR_VAROFS+MAX_SWITCH-1), 0); if (swPos && !lastSwPos[i]) sw_toggled[i] = !sw_toggled[i]; // if switch is flipped first time -> change counter state lastSwPos[i] = swPos; } @@ -1570,7 +1552,7 @@ void perMain() s_timerVal[i]++; } else { - if (atm<(TMR_VAROFS+MAX_SWITCH-1)) + if (atm<(TMR_VAROFS+MAX_SWITCH)) sw_toggled[i] = getSwitch((tm>0 ? tm-(TMR_VAROFS-1) : tm+(TMR_VAROFS-1)), 0); // normal switch if (sw_toggled[i]) s_timerVal[i]++; @@ -1589,13 +1571,12 @@ void perMain() if (tv) s_timerVal[i] = tv - s_timerVal[i]; //if counting backwards - display backwards } } - ++i; - } while(1); + }; 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.timer1.val) { // beep when 30, 15, 10, 5,4,3,2,1 seconds remaining + if (g_eeGeneral.preBeep && g_model.timers[0].val) { // 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(); @@ -1605,7 +1586,7 @@ void perMain() g_LightOffCounter = FLASH_DURATION; } - if (g_eeGeneral.minuteBeep && (((g_model.timer1.val ? g_model.timer1.val-s_timerVal[0] : s_timerVal[0])%60)==0)) { // short beep every minute + 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 AUDIO_MINUTE_BEEP(); if(g_eeGeneral.flashBeep) g_LightOffCounter = FLASH_DURATION; } @@ -2220,7 +2201,7 @@ int main(void) clearKeyEvents(); //make sure no keys are down before proceeding - perOut(g_chans512, getFlightPhase()); + // TODO perMain()? perOut(g_chans512, getFlightPhase()); // TODO is it really needed? lcdSetRefVolt(g_eeGeneral.contrast); g_LightOffCounter = g_eeGeneral.lightAutoOff*500; //turn on light for x seconds - no need to press key Issue 152 diff --git a/src/open9x.h b/src/open9x.h index 338a69b0e..422cc3bd2 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -328,17 +328,18 @@ enum EnumKeys { #define CS_VCOMP 2 #define CS_STATE(x) ((x)destCh = i+1; + md->destCh = i; md->weight = 100; md->srcRaw = channel_order(i+1); } diff --git a/src/simpgmspace.h b/src/simpgmspace.h index c747d4e89..461c9aa46 100644 --- a/src/simpgmspace.h +++ b/src/simpgmspace.h @@ -86,7 +86,7 @@ void sig(int sgn) #define APM -typedef unsigned char pm_uchar; +typedef const unsigned char pm_uchar; typedef const char pm_char; typedef const uint16_t pm_uint16_t; typedef const uint8_t pm_uint8_t; diff --git a/src/templates.cpp b/src/templates.cpp index 9a7298f03..385ad23b4 100644 --- a/src/templates.cpp +++ b/src/templates.cpp @@ -80,7 +80,7 @@ const pm_char * const n_Templates[] PROGMEM = MixData* setDest(uint8_t dch) { uint8_t i = 0; - while ((g_model.mixData[i].destCh<=dch) && (g_model.mixData[i].destCh) && (i STK #define ICC(x) icc[(x)-1] uint8_t icc[4] = {0}; - for(uint8_t i=1; i<=4; i++) //generate inverse array - for(uint8_t j=1; j<=4; j++) if(CC(i)==j) icc[j-1]=i; + for (uint8_t i=0; i<4; i++) //generate inverse array + for(uint8_t j=0; j<4; j++) if(CC(i+1)==j+1) icc[j]=i; switch (idx){ // Simple 4-Ch @@ -145,7 +145,7 @@ void applyTemplate(uint8_t idx) // T-Cut case (1): - md=setDest(ICC(STK_THR)); md->srcRaw=MIX_HALF; md->weight=-100; md->swtch=DSW_THR; md->mltpx=MLTPX_REP; + md=setDest(ICC(STK_THR)); md->srcRaw=MIX_MAX; md->weight=-100; md->swtch=DSW_THR; md->mltpx=MLTPX_REP; break; // V-Tail @@ -171,9 +171,9 @@ void applyTemplate(uint8_t idx) md=setDest(ICC(STK_AIL)); md->srcRaw=SRC_ELE; md->weight=-36; md=setDest(ICC(STK_AIL)); md->srcRaw=SRC_AIL; md->weight= 62; md=setDest(ICC(STK_AIL)); md->srcRaw=SRC_THR; md->weight= 55; - md=setDest(6); md->srcRaw=SRC_ELE; md->weight=-36; - md=setDest(6); md->srcRaw=SRC_AIL; md->weight=-62; - md=setDest(6); md->srcRaw=SRC_THR; md->weight= 55; + md=setDest(5); md->srcRaw=SRC_ELE; md->weight=-36; + md=setDest(5); md->srcRaw=SRC_AIL; md->weight=-62; + md=setDest(5); md->srcRaw=SRC_THR; md->weight= 55; break; // Heli Setup @@ -192,24 +192,24 @@ void applyTemplate(uint8_t idx) md=setDest(ICC(STK_THR)); md->srcRaw=SRC_THR; md->weight= 100; md->swtch=DSW_ID0; md->curve=CV(1); md->carryTrim=TRIM_OFF; md=setDest(ICC(STK_THR)); md->srcRaw=SRC_THR; md->weight= 100; md->swtch=DSW_ID1; md->curve=CV(2); md->carryTrim=TRIM_OFF; md=setDest(ICC(STK_THR)); md->srcRaw=SRC_THR; md->weight= 110; md->swtch=DSW_ID2; md->curve=CV(2); md->carryTrim=TRIM_OFF; - md=setDest(ICC(STK_THR)); md->srcRaw=MIX_HALF; md->weight=-125; md->swtch=DSW_THR; md->mltpx=MLTPX_REP; md->carryTrim=TRIM_OFF; + md=setDest(ICC(STK_THR)); md->srcRaw=MIX_MAX; md->weight=-125; md->swtch=DSW_THR; md->mltpx=MLTPX_REP; md->carryTrim=TRIM_OFF; md=setDest(ICC(STK_RUD)); md->srcRaw=SRC_RUD; md->weight=100; - md=setDest(5); md->srcRaw=MIX_HALF; md->weight= 50; md->swtch=-DSW_GEA; md->carryTrim=TRIM_OFF; - md=setDest(5); md->srcRaw=MIX_HALF; md->weight=-50; md->swtch= DSW_GEA; md->carryTrim=TRIM_OFF; - md=setDest(5); md->srcRaw=STK_P3; md->weight= 40; md->carryTrim=TRIM_OFF; + md=setDest(4); md->srcRaw=MIX_MAX; md->weight= 50; md->swtch=-DSW_GEA; md->carryTrim=TRIM_OFF; + md=setDest(4); md->srcRaw=MIX_MAX; md->weight=-50; md->swtch= DSW_GEA; md->carryTrim=TRIM_OFF; + md=setDest(4); md->srcRaw=STK_P3; md->weight= 40; md->carryTrim=TRIM_OFF; - md=setDest(6); md->srcRaw=CH(9); md->weight= -50; - md=setDest(6); md->srcRaw=CH(10); md->weight=-100; - md=setDest(6); md->srcRaw=CH(11); md->weight=-100; md->carryTrim=TRIM_OFF; + md=setDest(5); md->srcRaw=CH(9); md->weight= -50; + md=setDest(5); md->srcRaw=CH(10); md->weight=-100; + md=setDest(5); md->srcRaw=CH(11); md->weight=-100; md->carryTrim=TRIM_OFF; - md=setDest(9); md->srcRaw=SRC_ELE; md->weight= 60; - md=setDest(10); md->srcRaw=SRC_AIL; md->weight=-52; - md=setDest(11); md->srcRaw=SRC_THR; md->weight= 70; md->swtch=DSW_ID0; md->curve=CV(3); md->carryTrim=TRIM_OFF; - md=setDest(11); md->srcRaw=SRC_THR; md->weight= 70; md->swtch=DSW_ID1; md->curve=CV(4); md->carryTrim=TRIM_OFF; - md=setDest(11); md->srcRaw=SRC_THR; md->weight= 70; md->swtch=DSW_ID2; md->curve=CV(4); md->carryTrim=TRIM_OFF; - md=setDest(11); md->srcRaw=SRC_THR; md->weight=100; md->swtch=DSW_THR; md->curve=CV(5); md->carryTrim=TRIM_OFF; md->mltpx=MLTPX_REP; + md=setDest(8); md->srcRaw=SRC_ELE; md->weight= 60; + md=setDest(9); md->srcRaw=SRC_AIL; md->weight=-52; + md=setDest(10); md->srcRaw=SRC_THR; md->weight= 70; md->swtch=DSW_ID0; md->curve=CV(3); md->carryTrim=TRIM_OFF; + md=setDest(10); md->srcRaw=SRC_THR; md->weight= 70; md->swtch=DSW_ID1; md->curve=CV(4); md->carryTrim=TRIM_OFF; + md=setDest(10); md->srcRaw=SRC_THR; md->weight= 70; md->swtch=DSW_ID2; md->curve=CV(4); md->carryTrim=TRIM_OFF; + md=setDest(10); md->srcRaw=SRC_THR; md->weight=100; md->swtch=DSW_THR; md->curve=CV(5); md->carryTrim=TRIM_OFF; md->mltpx=MLTPX_REP; //Set up Curves setCurve(CURVE5(1), heli_ar1); @@ -221,10 +221,10 @@ void applyTemplate(uint8_t idx) // Servo Test case (6): - md=setDest(15); md->srcRaw=CH(16); md->weight= 100; md->speedUp = 8; md->speedDown = 8; - md=setDest(16); md->srcRaw=MIX_FULL; md->weight= 110; md->swtch=DSW_SW1; - md=setDest(16); md->srcRaw=MIX_HALF; md->weight=-110; md->swtch=DSW_SW2; md->mltpx=MLTPX_REP; - md=setDest(16); md->srcRaw=MIX_HALF; md->weight= 110; md->swtch=DSW_SW3; md->mltpx=MLTPX_REP; + md=setDest(14); md->srcRaw=CH(16); md->weight= 100; md->speedUp = 8; md->speedDown = 8; + md=setDest(15); md->srcRaw=MIX_SW1; md->weight= 110; md->swtch=DSW_SW1; + md=setDest(15); md->srcRaw=MIX_MAX; md->weight=-110; md->swtch=DSW_SW2; md->mltpx=MLTPX_REP; + md=setDest(15); md->srcRaw=MIX_MAX; md->weight= 110; md->swtch=DSW_SW3; md->mltpx=MLTPX_REP; setSwitch(1,CS_LESS,CH(15),CH(16)); setSwitch(2,CS_VPOS,CH(15), 105); diff --git a/src/translations/en.h b/src/translations/en.h index c96841806..8beb3e48e 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -120,7 +120,7 @@ #define TR_VSWITCHES "THR""RUD""ELE""ID0""ID1""ID2""AIL""GEA""TRN""SW1""SW2""SW3""SW4""SW5""SW6""SW7""SW8""SW9""SWA""SWB""SWC" #define LEN_VSRCRAW "\004" -#define TR_VSRCRAW "RUD ""ELE ""THR ""AIL ""P1 ""P2 ""P3 ""HALF""FULL""CYC1""CYC2""CYC3" +#define TR_VSRCRAW "Rud ""Ele ""Thr ""Ail ""P1 ""P2 ""P3 ""MAX ""3POS""CYC1""CYC2""CYC3" #define LEN_VTMRMODES "\003" #define TR_VTMRMODES "OFF""ABS""THs""TH%""THt" @@ -179,6 +179,7 @@ #define TR_SOURCE "Source" #define TR_WEIGHT "Weight" #define TR_MIXERWEIGHT "Mixer Weight" +#define TR_DIFFERENTIAL "Differ" #define TR_OFFSET "Offset" #define TR_MIXEROFFSET "Mixer Offset" #define TR_DRWEIGHT "DR Weight" diff --git a/src/translations/font_dblsize_se.lbm b/src/translations/font_dblsize_se.lbm new file mode 100644 index 000000000..761bba099 --- /dev/null +++ b/src/translations/font_dblsize_se.lbm @@ -0,0 +1,2 @@ +0x00,0x00,0x60,0x60,0x6e,0x6a,0x6e,0xe0,0xc0,0x80,0x00,0x00,0x6c,0x6c,0x60,0x60,0x6c,0xec,0xc0,0x80,0x80,0xc0,0xec,0x6c,0x60,0x60,0x6c,0xec,0xc0,0x80,0xe0,0xf0,0xb8,0x9e,0x9a,0x9a,0x9e,0xb8,0xf0,0xe0,0xe0,0xf6,0xba,0x9c,0x8e,0x8e,0x9c,0xba,0xf6,0xe0,0xe0,0xf6,0x36,0x18,0x18,0x18,0x18,0x36,0xf6,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x3c,0x7e,0x66,0x66,0x66,0x66,0x66,0x7f,0x7f,0x18,0x3c,0x7e,0x66,0x66,0x66,0x66,0x66,0x7f,0x7f,0x1f,0x3f,0x70,0x60,0x60,0x60,0x60,0x70,0x3f,0x1f,0x7f,0x7f,0x01,0x01,0x01,0x01,0x01,0x01,0x7f,0x7f,0x7f,0x7f,0x01,0x01,0x01,0x01,0x01,0x01,0x7f,0x7f,0x1f,0x3f,0x70,0x60,0x60,0x60,0x60,0x70,0x3f,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/src/translations/font_dblsize_se.xbm b/src/translations/font_dblsize_se.xbm new file mode 100644 index 000000000..3226ec633 --- /dev/null +++ b/src/translations/font_dblsize_se.xbm @@ -0,0 +1,30 @@ +#define font_dblsize_se_width 160 +#define font_dblsize_se_height 16 +static unsigned char font_dblsize_se_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x1e, 0xb6, 0x19, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x50, 0x30, 0xc3, 0x0c, 0x12, 0x7a, 0x19, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x30, 0xc3, 0x0c, 0x3f, 0xfc, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x7f, 0xce, 0xf9, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf0, 0xc3, 0xcf, 0xe1, 0x87, 0x1f, 0x0e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfc, 0xf1, 0xe7, 0xdf, 0xc0, 0x03, 0x0f, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x7e, 0xf8, + 0xff, 0xff, 0x0f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3c, 0xf0, 0xff, 0xff, 0x0f, 0x0c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfc, 0xf3, 0x3f, 0xf0, 0xc0, 0x03, 0x0f, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfb, 0x3f, 0xf0, + 0xc0, 0x03, 0x0f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x1f, 0x3c, 0xf0, 0xc0, 0x03, 0x0f, 0x0c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x1f, 0x7c, 0xf8, 0xc0, 0x03, 0x1f, 0x0e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfb, 0xef, 0xdf, + 0xc0, 0x03, 0xfb, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf3, 0xcf, 0xcf, 0xc0, 0x03, 0xf3, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/src/translations/font_se.lbm b/src/translations/font_se.lbm new file mode 100644 index 000000000..8d767a82b --- /dev/null +++ b/src/translations/font_se.lbm @@ -0,0 +1 @@ +0x20,0x54,0x56,0x54,0x78,0x20,0x56,0x54,0x56,0x78,0x38,0x46,0x44,0x46,0x38,0x7c,0x13,0x13,0x12,0x7c,0x7c,0x13,0x12,0x13,0x7c,0x3c,0x43,0x42,0x43,0x3c, diff --git a/src/translations/font_se.xbm b/src/translations/font_se.xbm new file mode 100644 index 000000000..349d7271f --- /dev/null +++ b/src/translations/font_se.xbm @@ -0,0 +1,6 @@ +#define font_6x1_se_width 30 +#define font_6x1_se_height 8 +static unsigned char font_6x1_se_bits[] = { + 0x00, 0x00, 0xa3, 0x14, 0x44, 0x29, 0xe7, 0x1c, 0xce, 0xb9, 0x18, 0x23, + 0x10, 0xc6, 0x18, 0x23, 0xde, 0xc7, 0xff, 0x23, 0x31, 0xc6, 0x18, 0x23, + 0xde, 0xbb, 0x18, 0x1d, 0x00, 0x00, 0x00, 0x00 }; diff --git a/src/translations/fr.h b/src/translations/fr.h index ca01b7443..52fa68129 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -120,7 +120,7 @@ #define TR_VSWITCHES "GAZ""DIR""PRF""ID0""ID1""ID2""AIL""GEA""TRN""SW1""SW2""SW3""SW4""SW5""SW6""SW7""SW8""SW9""SWA""SWB""SWC" #define LEN_VSRCRAW "\004" -#define TR_VSRCRAW "DIR ""PRF ""GAZ ""AIL ""P1 ""P2 ""P3 ""DEMI""TOUT""CYC1""CYC2""CYC3" +#define TR_VSRCRAW "Dir ""Prf ""Gaz ""Ail ""P1 ""P2 ""P3 ""MAX ""3POS""CYC1""CYC2""CYC3" #define LEN_VTMRMODES "\003" #define TR_VTMRMODES "OFF""ABS""GZs""GZ%""GZt" @@ -178,6 +178,7 @@ #define TR_SOURCE "Source" #define TR_WEIGHT "Ratio" #define TR_MIXERWEIGHT "Ratio Mixage" +#define TR_DIFFERENTIAL "Differ" #define TR_OFFSET "Offset" #define TR_MIXEROFFSET "Offset Mixage" #define TR_DRWEIGHT "Ratio DR" diff --git a/src/translations/se.h b/src/translations/se.h new file mode 100644 index 000000000..9f453994e --- /dev/null +++ b/src/translations/se.h @@ -0,0 +1,309 @@ +// NON ZERO TERMINATED STRINGS +#define LEN_OFFON "\003" +#define TR_OFFON "AV ""P[ " + +#define LEN_MMMINV "\003" +#define TR_MMMINV "---""INV" + +#define LEN_NCHANNELS "\004" +#define TR_NCHANNELS "4CH 6KN 8KN 10KN12KN14KN16KN" + +#define LEN_VBEEPMODE "\006" +#define TR_VBEEPMODE "Tyst ""Alarm ""Ej Knp""Alla " + +#define LEN_VBEEPLEN "\006" +#define TR_VBEEPLEN "xKort ""Kort ""Normal""L{ng ""xL{ng " + +#define LEN_ADCFILTER "\004" +#define TR_ADCFILTER "SING""OSMP""FILT" + +#define LEN_WARNSW "\004" +#define TR_WARNSW "Ned ""AV ""Upp " + +#define LEN_TRNMODE "\003" +#define TR_TRNMODE " AV"" +="" :=" + +#define LEN_TRNCHN "\003" +#define TR_TRNCHN "kn1kn2kn3kn4" + +#define LEN_DATETIME "\005" +#define TR_DATETIME "DAG: ""TID: " + +#define LEN_VTRIMINC "\006" +#define TR_VTRIMINC "Exp ""xFin ""Fin ""Medium""Grov " + +#define LEN_RETA123 "\001" +#define TR_RETA123 "RETA123" + +#define LEN_VPROTOS "\005" +#define TR_VPROTOS "PPM ""PXX ""DSM2 ""PPM16" + +#define LEN_POSNEG "\003" +#define TR_POSNEG "POS""NEG" + +#define LEN_VCURVEFUNC "\003" +#define TR_VCURVEFUNC "---""x>0""x<0""|x|""f>0""f<0""|f|" + +#define LEN_CURVMODES "\005" +#define TR_CURVMODES "EDIT ""PRSET""A.THR" + +#define LEN_EXPLABELS "\006" +#define TR_EXPLABELS "Vikt ""Expo ""Kurva ""Fas ""Brytar""N|r "" " // TODO remove all the trailing spaces + +#define LEN_VMLTPX "\010" +#define TR_VMLTPX "Addera ""F}rst|rk""Ers|tt " + +#define LEN_VMLTPX2 "\002" +#define TR_VMLTPX2 "+=""*="":=" + +#define LEN_VMIXTRIMS "\006" +#define TR_VMIXTRIMS "P[ ""AV ""Offset" + +#define LEN_VCSWFUNC "\007" +#define TR_VCSWFUNC "----\0 ""v>ofs ""vofs""(v)v2 ""v1=v2 ""v1<=v2 " + +#define LEN_VFSWFUNC "\015" +#ifdef LOGS +#define TR_SDCLOGGS "SDCARD Logs " +#else +#define TR_SDCLOGGS +#endif +#ifdef SOMO +#define TR_SOMO "Spela Sp{r\0 " +#else +#define TR_SOMO +#endif +#ifdef AUDIO +#define TR_SOUND "Spela Ljud\0 " +#else +#define TR_SOUND "Pip \0 " +#endif +#define TR_VFSWFUNC "S|kerhet \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_SOMO TR_SDCLOGGS + +#define LEN_FUNCSOUNDS "\006" +#define TR_FUNCSOUNDS "Varn1 ""Varn2 ""F{r ""Ring ""SciFi ""Robot ""Pip ""Tada ""Syrsa ""Siren ""Alarm ""Ratata""Tick ""Vibr1 ""Vibr2 ""Vibr3 " + +#define LEN_VTELEMBARS "\004" +#define TR_VTELEMBARS "---\0""A1\0 ""A2\0 ""H]JD""VARV""TANK""T1\0 ""T2\0 ""FART""BATT" + +#define LEN_VTELEMUNIT "\003" +#define TR_VTELEMUNIT "v\0 ""A\0 ""-\0 ""kts""kmh""M/h""m\0 ""@\0 ""%\0" +#define STR_V (STR_VTELEMUNIT+1) +#define STR_A (STR_VTELEMUNIT+4) + +#define LEN_VALARM "\003" +#define TR_VALARM "---""Gul""Ora""R}d" + +#define LEN_VALARMFN "\001" +#define TR_VALARMFN "<>" + +#define LEN_VTELPROTO "\004" +#if defined(WS_HOW_HIGH) +#define TR_VTELPROTO "--- Hub WSHH" +#elif defined(FRSKY_HUB) +#define TR_VTELPROTO "--- Hub " +#endif + +#define LEN_VTEMPLATES "\014" +#define TR_VTEMPLATES "Enkel 4kanal""Gasklippning""V-Stj|rt ""Deltavinge ""eCCPM ""Helikopter ""Servotest " + +#define LEN_VSWASHTYPE "\004" +#define TR_VSWASHTYPE "--- ""120 ""120X""140 ""90 " + +#define LEN_VKEYS "\005" +#define TR_VKEYS " MENU"" EXIT"" Ned"" Upp""H}ger""V|nst" + +#define LEN_RE1RE2 "\003" +#define TR_RE1RE2 "RE1""RE2" + +#define LEN_VSWITCHES "\003" +#define TR_VSWITCHES "GAS""SID""H]J""ID0""ID1""ID2""SKE""LAN""TRN""BR1""BR2""BR3""BR4""BR5""BR6""BR7""BR8""BR9""BRA""BRB""BRC" + +#define LEN_VSRCRAW "\004" +#define TR_VSRCRAW "SID ""H]J ""GAS ""SKE ""P1 ""P2 ""P3 ""MAX ""FULL""CYK1""CYK2""CYK3" + +#define LEN_VTMRMODES "\003" +#define TR_VTMRMODES "AV ""ABS""THs""TH%""THt" + +#if defined(FRSKY_HUB) +#define LEN_TELEMCHNS "\004" +#define TR_TELEMCHNS "AD1 AD2 H]JDVARVTANKT@1 T@2 FARTBATT" +#elif defined(WS_HOW_HIGH) +#define LEN_TELEMCHNS "\003" +#define TR_TELEMCHNS "AD1AD2H]J" +#elif defined(FRSKY) +#define LEN_TELEMCHNS "\003" +#define TR_TELEMCHNS "AD1AD2" +#endif + +#define LEN_DSM2MODE "\007" +#define TR_DSM2MODE "LP4/LP5DSMonlyDSMX " + +// ZERO TERMINATED STRINGS +#define TR_POPUPS "(MENU)\004(EXIT)" +#define OFS_EXIT 7 +#define TR_MENUWHENDONE "(MENU) AVSLUTAR" +#define TR_FREE "\200\201\202\203\204\205" +#define TR_DELETEMODEL "RADERA MODELL" +#define TR_COPYINGMODEL "Kopierar Modell" +#define TR_MOVINGMODEL "Flyttar Modell" +#define TR_LOADINGMODEL "Laddar Modell" +#define TR_NAME "Namn" +#define TR_TIMER "Timer" +#define TR_ELIMITS "Gr|nser++" +#define TR_ETRIMS "Trimmar++" +#define TR_TRIMINC "Trim}kn." +#define TR_TTRACE "F}lj Gas" +#define TR_TTRIM "GasTrim" +#define TR_BEEPCTR "Centerpip" +#define TR_PROTO "Protokoll" +#define TR_PPMFRAME "PPM frame" +#define TR_MS "ms" +#define TR_SWITCH "Brytare" +#define TR_TRIMS "Trimmar" +#define TR_FADEIN "Tona In" +#define TR_FADEOUT "Tona Ut" +#define TR_DEFAULT "Standard" +#define TR_CHECKTRIMS "Kolla\005Trimmar" +#define TR_SWASHTYPE "Swashtyp" +#define TR_COLLECTIVE "Kollektiv" +#define TR_SWASHRING "Swashring" +#define TR_ELEDIRECTION "H]JD Riktning" +#define TR_AILDIRECTION "SKEV Riktning" +#define TR_COLDIRECTION "KOLL Riktning" +#define TR_MODE "Mod" +#define TR_NOFREEEXPO "Expo saknas!" +#define TR_NOFREEMIXER "Mixer saknas!" +#define TR_INSERTMIX "ADDERA MIX" +#define TR_EDITMIX "EDITERA MIX" +#define TR_SOURCE "K|lla" +#define TR_WEIGHT "Vikt" +#define TR_MIXERWEIGHT "Mixer-vikt" +#define TR_DIFFERENTIAL "Differential" +#define TR_OFFSET "Offset" +#define TR_MIXEROFFSET "Mixer-offset" +#define TR_DRWEIGHT "DR-vikt" +#define TR_DREXPO "DR-expo" +#define TR_TRIM "Trim" +#define TR_CURVES "Kurvor" +#define TR_FPHASE "Flygfas" +#define TR_WARNING "Varning" +#define TR_OFF "AV " +#define TR_MULTPX "Multpx" +#define TR_DELAYDOWN "F}rdr}jn. Ned" +#define TR_DELAYUP "F}rdr}jn. Upp" +#define TR_SLOWDOWN "Tr}ghet Ned" +#define TR_SLOWUP "Tr}ghet Upp" +#define TR_MIXER "MIXER" +#define TR_CV "KU" +#define TR_SW "BR" +#define TR_ACHANNEL "A\002kanal " +#define TR_RANGE "Omr{de" +#define TR_BAR "Data" +#define TR_ALARM "Alarm" +#define TR_USRDATA "Anv\\ndardata" +#define TR_BLADES "Blad" +#define TR_BARS "Staplar som visas" +#define TR_CLEARMIXMENU "NOLLA MIXAR (MENU)" +#ifdef AUDIO +#define TR_BEEPERMODE "H}gtalare l|ge" +#define TR_BEEPERLEN "H}gtalare tid" +#define TR_SPKRPITCH "H}gtalare ton" +#else +#define TR_BEEPERMODE "Summer l|ge" +#define TR_BEEPERLEN "Summer tid" +#endif +#define TR_HAPTICMODE "Vibrator l|ge" +#define TR_HAPTICSTRENGTH "Vibrator Niv{" +#define TR_CONTRAST "Kontrast" +#define TR_BATTERYWARNING "Batterivarning" +#define TR_INACTIVITYALARM "Inaktivitetslarm" +#define TR_FILTERADC "ADC-filter" +#define TR_THROTTLEREVERSE "Inverterad Gas" +#define TR_MINUTEBEEP "Minutpip" +#define TR_BEEPCOUNTDOWN "Nedr|kningspip" +#define TR_FLASHONBEEP "Pip vid blink" +#define TR_LIGHTSWITCH "Ljusbrytare" +#define TR_LIGHTOFFAFTER "Ljus av efter" +#define TR_SPLASHSCREEN "Bild vid start" +#define TR_THROTTLEWARNING "Gasvarning" +#define TR_SWITCHWARNING "Brytarvarning" +#define TR_MEMORYWARNING "Minnesvarning" +#define TR_ALARMWARNING "Alarmvarning" +#define TR_NODATAALARM "NO DATA Varning" +#define TR_RXCHANNELORD "Kanalordning RX" +#define TR_SLAVE "Slav" +#define TR_MODESRC "effekt % k|lla" +#define TR_MULTIPLIER "F}rst|rkn." +#define TR_CAL "Cal" +#define TR_EEPROMV "EEPROM v" +#define TR_VTRIM "Trim- +" +#define TR_BG "BG" +#define TR_MENUTOSTART "(MENU) STARTAR" +#define TR_SETMIDPOINT " CENTRERA " +#define TR_MOVESTICKSPOTS "R]R SPAKAR/RATTAR" +#define TR_ALTnDST "Hjd:\010Dst:" +#define TR_RXBATT "Rx Batt:" +#define TR_TXnRX "Tx:\0Rx:" +#define OFS_RX 4 +#define TR_SPDnMAX "Frt:\010Max:" +#define TR_TEMP1nTEMP2 "T@1:\007T@2:" +#define TR_RPMnFUEL "RMP:\006Tank:" +#define TR_ACCEL "Acc:" +#define TR_NODATA "NO DATA" +#define TR_TM1TM2 "TM1\015TM2" +#define TR_THRTHP "THR\015TH%" +#define TR_TOT "TOT" +#define TR_TMR1LATMAXUS "tmr1Lat max\004us" +#define TR_TMR1LATMINUS "tmr1Lat min\004us" +#define TR_TMR1JITTERUS "tmr1 Jitter\004us" +#define TR_TMAINMAXMS "tmain max\006ms" +#define TR_T10MSUS "t10ms\010us" +#define TR_FREESTACKMINB "Free Stack min\004b" +#define TR_MENUTORESET "(MENU) NOLLAR " +#define TR_PPM "PPM" +#define TR_CH "KN" +#define TR_TMR "TMR" +#define TR_MODEL "MODELL" +#define TR_FP "FF" +#define TR_EEPROMLOWMEM "EEPROM low mem" +#define TR_ALERT " OBS" +#define TR_PRESSANYKEYTOSKIP "Tryck ned en knapp" +#define TR_THROTTLENOTIDLE "Gasen ej avst|ngd!" +#define TR_RESETTHROTTLE "Sl{ av gasen" +#define TR_ALARMSDISABLED "Alarmen Avst|ngda!" +#define TR_SWITCHESNOTOFF "Brytare P{slagna!" +#define TR_PLEASERESETTHEM "St|ng av dem" +#define TR_MESSAGE "MEDDELANDE" +#define TR_PRESSANYKEY "Tryck ned en knapp" +#define TR_BADEEPROMDATA "EEprom Datafel " +#define TR_EEPROMFORMATTING "Formaterar EEprom" +#define TR_EEPROMOVERFLOW "Fel i EEprom" +#define TR_MENURADIOSETUP "INST\\LLNINGAR" +#define TR_MENUDATEANDTIME "DAG OCH TID" +#define TR_MENUTRAINER "TRAINER (PPM IN)" +#define TR_MENUVERSION "VERSION" +#define TR_MENUDIAG "DIAGNOS" +#define TR_MENUANA "ANA" +#define TR_MENUCALIBRATION "KALIBRERING" +#define TR_MENUSERROR "FEL I MENY" +#define TR_MENUMODELSEL "MODELL" +#define TR_MENUSETUP "KONF." +#define TR_MENUFLIGHTPHASE "FLYGFAS" +#define TR_MENUFLIGHTPHASES "FLYGFASER" +#define TR_MENUHELISETUP "HELIKOPTER" +#define TR_MENUDREXPO "DR/EXPO" +#define TR_MENULIMITS "GR\\NSER" +#define TR_MENUCURVES "KURVOR" +#define TR_MENUCURVE "KURVA" +#define TR_MENUCUSTOMSWITCHES "SPEC.BRYTARE" +#define TR_MENUFUNCSWITCHES "FUNK.BRYTARE" +#define TR_MENUTELEMETRY "TELEMETRI" +#define TR_MENUTEMPLATES "MALLAR" +#define TR_MENUSTAT "STATSISTIK" +#define TR_MENUDEBUG "DEBUG" +#define TR_RXNUM "RxNum" +#define TR_SYNCMENU "Synk (MENY)" +#define TR_BACK "EXIT" +#define TR_MINLIMIT "Mininiv{" +#define TR_MAXLIMIT "Maxiniv{"