diff --git a/src/Makefile b/src/Makefile index 131bb8705..9083296d8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -107,6 +107,9 @@ SOMO = NO # Values = en, TRANSLATIONS = EN +# DEBUG mode +DEBUG = NO + #------- END BUILD OPTIONS --------------------------- # Define programs and commands. @@ -192,7 +195,7 @@ OPT = s # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. # AVR Studio 4.10 requires dwarf-2. # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 +DBGFMT = dwarf-2 # List any extra directories to look for include files here. @@ -278,6 +281,10 @@ ifeq ($(EXT), FRSKY) endif endif +ifeq ($(DEBUG), YES) + CPPDEFS += -DDEBUG +endif + ifeq ($(PCB), V4) # V4 PCB, so ... CPPDEFS += -DPCBV4 -DAUDIO @@ -352,7 +359,7 @@ endif # -Wall...: warning level # -Wa,...: tell GCC to pass this to the assembler. # -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) +CPPFLAGS = -g$(DBGFMT) CPPFLAGS += $(CPPDEFS) CPPFLAGS += -O$(OPT) #CPPFLAGS += -mint8 diff --git a/src/frsky.cpp b/src/frsky.cpp index 9e9c4ac03..1d8df4727 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -251,6 +251,10 @@ void parseTelemHubByte(uint8_t byte) } } + if ((uint8_t)structPos == offsetof(FrskyHubData, hour)) { + frskyHubData.hour = (frskyHubData.hour + g_eeGeneral.timezone + 24) % 24; + } + state = TS_IDLE; } #endif @@ -664,7 +668,7 @@ void displayRssiLine() lcd_filled_rect(66+36-v, 58, v, 5); } else { - lcd_puts(7*FW, 7*FH+1, STR_NODATA); + lcd_putsAtt(7*FW, 7*FH+1, STR_NODATA, BLINK); lcd_filled_rect(0, DISPLAY_H-8, DISPLAY_W, 8); } } @@ -765,6 +769,10 @@ void menuProcFrsky(uint8_t event) bars_height += 2; } } + if (bars_height == 13) { + // No bars at all! + s_frsky_view = ((event == EVT_KEY_BREAK(KEY_UP)) ? FRSKY_VIEW_MAX : e_frsky_a1a2); + } displayRssiLine(); } else if (s_frsky_view == e_frsky_a1a2) { @@ -834,35 +842,33 @@ void menuProcFrsky(uint8_t event) // Accelerometer #define ACC_LINE (7*FH+1) - lcd_putsLeft(ACC_LINE, STR_ACCEL); - // lcd_puts(4*FW, 7*FH, PSTR("x:")); - lcd_outdezNAtt(4*FW, ACC_LINE, (int32_t)frskyHubData.accelX/10, LEFT|PREC2); - // lcd_putc(lcd_lastPos, 7*FH, 'g'); - // lcd_puts(11*FW, 7*FH, PSTR("y:")); - lcd_outdezNAtt(10*FW, ACC_LINE, (int32_t)frskyHubData.accelY/10, LEFT|PREC2); - // lcd_putc(lcd_lastPos, 7*FH, 'g'); - // lcd_puts(18*FW, 7*FH, PSTR("z:")); - lcd_outdezNAtt(16*FW, ACC_LINE, (int32_t)frskyHubData.accelZ/10, LEFT|PREC2); - // lcd_putc(lcd_lastPos, 7*FH, 'g'); - lcd_filled_rect(0, ACC_LINE-1, DISPLAY_W, 8); + if (frskyStreaming > 0) { + lcd_putsLeft(ACC_LINE, STR_ACCEL); + // lcd_puts(4*FW, 7*FH, PSTR("x:")); + lcd_outdezNAtt(4*FW, ACC_LINE, (int32_t)frskyHubData.accelX/10, LEFT|PREC2); + // lcd_putc(lcd_lastPos, 7*FH, 'g'); + // lcd_puts(11*FW, 7*FH, PSTR("y:")); + lcd_outdezNAtt(10*FW, ACC_LINE, (int32_t)frskyHubData.accelY/10, LEFT|PREC2); + // lcd_putc(lcd_lastPos, 7*FH, 'g'); + // lcd_puts(18*FW, 7*FH, PSTR("z:")); + lcd_outdezNAtt(16*FW, ACC_LINE, (int32_t)frskyHubData.accelZ/10, LEFT|PREC2); + // lcd_putc(lcd_lastPos, 7*FH, 'g'); + lcd_filled_rect(0, ACC_LINE-1, DISPLAY_W, 8); // TODO optim function? + } + else { + displayRssiLine(); + } } else if (s_frsky_view == e_frsky_gps) { -#define DATE_LINE (7*FH+1) - //lcd_putsLeft( DATE_LINE, PSTR("D/T:")); - // Date - lcd_outdezNAtt(3*FW, DATE_LINE, frskyHubData.year+2000, LEFT, 4); - lcd_putc(7*FW-4, DATE_LINE, '-'); - lcd_outdezNAtt(8*FW-4, DATE_LINE, frskyHubData.month, LEFT|LEADING0, 2); - lcd_putc(10*FW-6, DATE_LINE, '-'); - lcd_outdezNAtt(11*FW-6, DATE_LINE, frskyHubData.day, LEFT|LEADING0, 2); - + uint8_t att = (frskyStreaming > 0 ? LEFT|LEADING0 : LEFT|LEADING0|BLINK); // Time - lcd_outdezNAtt(12*FW+5, DATE_LINE, frskyHubData.hour, LEFT|LEADING0, 2); - lcd_putc(14*FW+2, DATE_LINE, ':'); - lcd_outdezNAtt(15*FW+2, DATE_LINE, frskyHubData.min, LEFT|LEADING0, 2); - lcd_putc(17*FW-1, DATE_LINE, ':'); - lcd_outdezNAtt(18*FW-1, DATE_LINE, frskyHubData.sec, LEFT|LEADING0, 2); - lcd_filled_rect(0, DATE_LINE-1, DISPLAY_W, 8); +#define TIME_LINE (7*FH+1) + lcd_outdezNAtt(6*FW+5, TIME_LINE, frskyHubData.hour, att, 2); + lcd_putcAtt(8*FW+2, TIME_LINE, ':', att); + lcd_outdezNAtt(9*FW+2, TIME_LINE, frskyHubData.min, att, 2); + lcd_putcAtt(11*FW-1, TIME_LINE, ':', att); + lcd_outdezNAtt(12*FW-1, TIME_LINE, frskyHubData.sec, att, 2); + lcd_filled_rect(0, TIME_LINE-1, DISPLAY_W, 8); // Latitude #define LAT_LINE (2*FH-4) diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 4b951605c..d98082b77 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -85,6 +85,7 @@ enum menuProcSetupItems { #endif #ifdef FRSKY ITEM_SETUP_NODATA_ALARM, + ITEM_SETUP_TIMEZONE, #endif ITEM_SETUP_MAX }; @@ -110,7 +111,7 @@ void menuProcSetup(uint8_t event) #define SPLASH_ZEROS #endif #ifdef FRSKY -#define FRSKY_ZEROS 0, +#define FRSKY_ZEROS 0, 0, #else #define FRSKY_ZEROS #endif @@ -318,6 +319,14 @@ void menuProcSetup(uint8_t event) } if((y+=FH)>7*FH) return; }subN++; + + if(s_pgOfs7*FH) return; + }subN++; #endif if(s_pgOfs7*FH) return; - lcd_putcAtt( 3*FW, y, '1'+g_eeGeneral.stickMode,(sub==subN+1) ? (s_editMode>0 ? BLINK : INVERS) : 0); + lcd_putcAtt( 3*FW, y, '1'+g_eeGeneral.stickMode,(sub==subN+1) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0); for(uint8_t i=0; i<4; i++) putsChnRaw( (6+4*i)*FW, y, pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0); if (sub==subN+1 && s_editMode>0) @@ -396,7 +405,7 @@ void menuProcTime(uint8_t event) for(uint8_t j=0; j<3;j++) // 3 settings each for date and time (YMD and HMS) { - uint8_t attr = (sub==i && subSub==j) ? (s_editMode>0 ? BLINK : INVERS) : 0; + uint8_t attr = (sub==i && subSub==j) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0; switch(i) { case 0: // DATE @@ -456,7 +465,7 @@ void menuProcTrainer(uint8_t event) lcd_puts(3*FW, 1*FH, STR_MODESRC); y = 2*FH; - blink = (s_editMode>0) ? BLINK : INVERS ; + blink = (s_editMode>0) ? BLINK|INVERS : INVERS ; for (uint8_t i=1; i<=NUM_STICKS; i++) { uint8_t chan = channel_order(i); diff --git a/src/lcd.cpp b/src/lcd.cpp index d23e9ed32..2175f9453 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -72,7 +72,20 @@ 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 ]; const pm_uchar *q = &font_5x8_x20_x7f[ + (c-0x20)*5]; - bool inv = (mode & INVERS) ? true : (mode & BLINK ? BLINK_ON_PHASE : false); + + bool inv = false; + if (mode & BLINK) { + if (BLINK_ON_PHASE) { + if (mode & INVERS) + inv = true; + else + return; + } + } + else if (mode & INVERS) { + inv = true; + } + if(mode & DBLSIZE) { /* each letter consists of ten top bytes followed by @@ -286,9 +299,11 @@ void lcd_outdezNAtt(uint8_t x, uint8_t y, int16_t val, uint8_t flags, uint8_t le } else { x -= 2; - lcd_plot(x+1, y+6); - if (flags & INVERS || (flags & BLINK && BLINK_ON_PHASE)) - lcd_vline(x+1, y, 8); + if ((~flags & BLINK) || (!BLINK_ON_PHASE)) { + lcd_plot(x+1, y+6); + if (flags & INVERS) + lcd_vline(x+1, y, 8); + } } } val = ((uint16_t)val) / 10; diff --git a/src/main_views.cpp b/src/main_views.cpp index c1fb87774..637e5423e 100644 --- a/src/main_views.cpp +++ b/src/main_views.cpp @@ -180,13 +180,13 @@ void menuMainView(uint8_t event) uint8_t phase = getFlightPhase(); lcd_putsnAtt(6*FW+2, 2*FH, g_model.phaseData[phase].name, sizeof(g_model.phaseData[phase].name), ZCHAR); - uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK : 0) | DBLSIZE; + uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK|INVERS : 0) | DBLSIZE; putsModelName(2*FW-2, 0*FH, g_model.name, g_eeGeneral.currModel, DBLSIZE); putsVBat(6*FW-1, 2*FH, att|NO_UNIT); lcd_putc(6*FW, 3*FH, 'V'); if (g_model.timers[0].mode) { - uint8_t att = DBLSIZE | (s_timerState[0]==TMR_BEEPING ? BLINK : 0); + uint8_t att = DBLSIZE | (s_timerState[0]==TMR_BEEPING ? BLINK|INVERS : 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.timers[0].mode, SWCONDENSED); } @@ -205,7 +205,7 @@ void menuMainView(uint8_t event) int16_t val = getTrimValue(getTrimFlightPhase(i, phase), i); if (val < -125 || val > 125) - att = BLINK|ROUND; + att = BLINK|INVERS|ROUND; if (val < -(TL+1)*4) val = -(TL+1); diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 9d9d5dae8..a5c582eba 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -434,10 +434,10 @@ void menuProcModel(uint8_t event) TimerData *timer = &g_model.timers[i]; if (s_pgOfsmode, sub==subN && m_posHorz==0 ? ((s_editMode>0) ? BLINK : INVERS) : 0); + putsTmrMode(PARAM_OFS, y, timer->mode, sub==subN && m_posHorz==0 ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); putsTime(14*FW, y, timer->val, - (sub==subN && m_posHorz==1 ? ((s_editMode>0) ? BLINK : INVERS):0), - (sub==subN && m_posHorz==2 ? ((s_editMode>0) ? BLINK : INVERS):0) ); + (sub==subN && m_posHorz==1 ? ((s_editMode>0) ? BLINK|INVERS : INVERS):0), + (sub==subN && m_posHorz==2 ? ((s_editMode>0) ? BLINK|INVERS : INVERS):0) ); if (sub==subN && (s_editMode>0 || p1valdiff)) { uint16_t timer_val = timer->val; switch (m_posHorz) { @@ -507,7 +507,7 @@ void menuProcModel(uint8_t event) if(s_pgOfs0 ? BLINK : INVERS):0)); + (sub==subN && m_posHorz==0 ? (s_editMode>0 ? BLINK|INVERS : INVERS):0)); if (g_model.protocol == PROTO_PPM) { - lcd_putsiAtt(PARAM_OFS+4*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, (sub==subN && m_posHorz==1) ? ((s_editMode>0) ? BLINK : INVERS) : 0); + lcd_putsiAtt(PARAM_OFS+4*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, (sub==subN && m_posHorz==1) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); lcd_puts(PARAM_OFS+11*FW, y, PSTR("u")); - lcd_outdezAtt(PARAM_OFS+11*FW, y, (g_model.ppmDelay*50)+300, ((sub==subN && m_posHorz==2) ? ((s_editMode>0) ? BLINK : INVERS) : 0)); + lcd_outdezAtt(PARAM_OFS+11*FW, y, (g_model.ppmDelay*50)+300, ((sub==subN && m_posHorz==2) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0)); } #ifdef DSM2 // TODO optimize that? @@ -537,7 +537,7 @@ void menuProcModel(uint8_t event) if ( x < 0 ) x = 0; if ( x > 2 ) x = 2; g_model.ppmNCH = x; - lcd_putsiAtt(PARAM_OFS+5*FW, y, STR_DSM2MODE, x, (sub==subN && m_posHorz==1) ? ((s_editMode>0) ? BLINK : INVERS) : 0); + lcd_putsiAtt(PARAM_OFS+5*FW, y, STR_DSM2MODE, x, (sub==subN && m_posHorz==1) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); } #endif else if (sub==subN) { @@ -568,7 +568,7 @@ void menuProcModel(uint8_t event) if (g_model.protocol == PROTO_PPM) { lcd_putsLeft( y, STR_PPMFRAME); lcd_puts(PARAM_OFS+3*FW, y, STR_MS); - lcd_outdezAtt(PARAM_OFS, y, (int16_t)g_model.ppmFrameLength*5 + 225, ((sub==subN && m_posHorz==0) ? (s_editMode>0 ? BLINK : INVERS) : 0) | PREC1|LEFT); + lcd_outdezAtt(PARAM_OFS, y, (int16_t)g_model.ppmFrameLength*5 + 225, ((sub==subN && m_posHorz==0) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0) | PREC1|LEFT); lcd_putsiAtt(PARAM_OFS+6*FW, y, STR_POSNEG, g_model.pulsePol, (sub==subN && m_posHorz==1) ? INVERS : 0); if(sub==subN && (s_editMode>0 || p1valdiff)) { switch (m_posHorz) { @@ -585,7 +585,7 @@ void menuProcModel(uint8_t event) #if defined(DSM2) || defined(PXX) else if (g_model.protocol == PROTO_DSM2 || g_model.protocol == PROTO_PXX) { lcd_putsLeft( y, STR_RXNUM); - lcd_outdezNAtt(PARAM_OFS-3*FW, y, g_model.modelId, ((sub==subN && m_posHorz==0) ? (s_editMode>0 ? BLINK : INVERS) : 0) | LEADING0|LEFT, 2); + lcd_outdezNAtt(PARAM_OFS-(g_model.protocol==PROTO_DSM2 ? 0 : 3*FW), y, g_model.modelId, ((sub==subN && m_posHorz==0) ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0) | LEADING0|LEFT, 2); if (sub==subN && (s_editMode>0 || p1valdiff)) { switch (m_posHorz) { @@ -643,11 +643,11 @@ void menuProcPhaseOne(uint8_t event) if (v > TRIM_EXTENDED_MAX) { uint8_t p = v - TRIM_EXTENDED_MAX - 1; if (p >= s_currIdx) p++; - lcd_putcAtt((10+t)*FW, y, '0'+p, (attr && m_posHorz==t) ? ((s_editMode>0) ? BLINK : INVERS) : 0); + lcd_putcAtt((10+t)*FW, y, '0'+p, (attr && m_posHorz==t) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); } else { v = TRIM_EXTENDED_MAX; - putsChnLetter((10+t)*FW, y, t+1, (attr && m_posHorz==t) ? ((s_editMode>0) ? BLINK : INVERS) : 0); + putsChnLetter((10+t)*FW, y, t+1, (attr && m_posHorz==t) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); } if (attr && m_posHorz==t && ((s_editMode>0) || p1valdiff)) { v = checkIncDec(event, v, TRIM_EXTENDED_MAX, TRIM_EXTENDED_MAX+MAX_PHASES-1, EE_MODEL); @@ -1571,7 +1571,7 @@ void menuProcLimits(uint8_t event) int8_t limit = (g_model.extendedLimits ? 125 : 100); for (uint8_t j=0; j<4; j++) { - uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK : INVERS) : 0); + uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ; switch(j) { @@ -1669,7 +1669,7 @@ void menuProcCustomSwitches(uint8_t event) y=(i+1)*FH; k=i+s_pgOfs; if(k==NUM_CSW) break; - uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK : INVERS) : 0); + uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); CustomSwData &cs = g_model.customSw[k]; //write SW names here @@ -1760,7 +1760,7 @@ void menuProcFunctionSwitches(uint8_t event) if(k==NUM_CHNOUT) break; FuncSwData *sd = &g_model.funcSw[k]; for (uint8_t j=0; j<3; j++) { - uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK : INVERS) : 0); + uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); uint8_t active = (attr && (s_editMode>0 || p1valdiff)); switch (j) { case 0: @@ -1810,6 +1810,10 @@ void menuProcFunctionSwitches(uint8_t event) lcd_outdezAtt(21*FW, y, val_displayed, attr); } #endif + else if (sd->func == FUNC_RESET) { + val_max = 3; + lcd_putsiAtt(15*FW, y, STR_VFSWRESET, sd->param, attr); + } else if (sd->func <= FUNC_SAFETY_CH16) { val_displayed = (int16_t)(int8_t)sd->param; val_min = -125; @@ -1856,7 +1860,7 @@ void menuProcTelemetry(uint8_t event) FRSKY_setModelAlarms(); // update Fr-Sky module when edit mode exited } - blink = (s_editMode>0) ? BLINK : INVERS ; + blink = (s_editMode>0) ? BLINK|INVERS : INVERS ; uint8_t subN = 1; uint8_t t; diff --git a/src/myeeprom.h b/src/myeeprom.h index 844a41208..128a84f7f 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -98,7 +98,9 @@ PACK(typedef struct t_EEGeneral { uint8_t spare1:1; uint8_t disableMemoryWarning:1; uint8_t disableAlarmWarning:1; - uint8_t stickMode; + uint8_t stickMode:2; + int8_t timezone:5; + uint8_t spare:1; uint8_t inactivityTimer; uint8_t throttleReversed:1; uint8_t minuteBeep:1; @@ -218,12 +220,12 @@ enum Functions { #ifdef SOMO FUNC_PLAY_SOMO, #endif - // FUNC_RESET, + FUNC_RESET, #ifdef LOGS FUNC_LOGS, #endif #ifdef DEBUG - // FUNC_TEST, + FUNC_TEST, #endif FUNC_MAX }; diff --git a/src/o9xstrings.cpp b/src/o9xstrings.cpp index 246ffe96e..db897b010 100644 --- a/src/o9xstrings.cpp +++ b/src/o9xstrings.cpp @@ -58,6 +58,7 @@ const pm_char STR_OPEN9X[] PROGMEM = ISTR(VMIXTRIMS) ISTR(VCSWFUNC) ISTR(VFSWFUNC) + ISTR(VFSWRESET) ISTR(FUNCSOUNDS) #ifdef FRSKY ISTR(VTELEMBARS) @@ -173,7 +174,10 @@ const pm_char STR_THROTTLEWARNING[] PROGMEM = TR_THROTTLEWARNING; const pm_char STR_SWITCHWARNING[] PROGMEM = TR_SWITCHWARNING; const pm_char STR_MEMORYWARNING[] PROGMEM = TR_MEMORYWARNING; const pm_char STR_ALARMWARNING[] PROGMEM = TR_ALARMWARNING; +#ifdef FRSKY const pm_char STR_NODATAALARM[] PROGMEM = TR_NODATAALARM; +const pm_char STR_TIMEZONE[] PROGMEM = TR_TIMEZONE; +#endif const pm_char STR_RXCHANNELORD[] PROGMEM = TR_RXCHANNELORD; const pm_char STR_SLAVE[] PROGMEM = TR_SLAVE; const pm_char STR_MODESRC[] PROGMEM = TR_MODESRC; diff --git a/src/o9xstrings.h b/src/o9xstrings.h index f686f1abf..d1315f14b 100644 --- a/src/o9xstrings.h +++ b/src/o9xstrings.h @@ -75,7 +75,8 @@ extern const pm_char STR_OPEN9X[]; #define OFS_VMIXTRIMS (OFS_VMLTPX2 + sizeof(TR_VMLTPX2)) #define OFS_VCSWFUNC (OFS_VMIXTRIMS + sizeof(TR_VMIXTRIMS)) #define OFS_VFSWFUNC (OFS_VCSWFUNC + sizeof(TR_VCSWFUNC)) -#define OFS_FUNCSOUNDS (OFS_VFSWFUNC + sizeof(TR_VFSWFUNC)) +#define OFS_VFSWRESET (OFS_VFSWFUNC + sizeof(TR_VFSWFUNC)) +#define OFS_FUNCSOUNDS (OFS_VFSWRESET + sizeof(TR_VFSWRESET)) #ifdef FRSKY #define OFS_VTELEMBARS (OFS_FUNCSOUNDS + sizeof(TR_FUNCSOUNDS)) #define OFS_VTELEMUNIT (OFS_VTELEMBARS + sizeof(TR_VTELEMBARS)) @@ -137,6 +138,7 @@ extern const pm_char STR_OPEN9X[]; #define STR_VMIXTRIMS (STR_OPEN9X + OFS_VMIXTRIMS) #define STR_VCSWFUNC (STR_OPEN9X + OFS_VCSWFUNC) #define STR_VFSWFUNC (STR_OPEN9X + OFS_VFSWFUNC) +#define STR_VFSWRESET (STR_OPEN9X + OFS_VFSWRESET) #define STR_FUNCSOUNDS (STR_OPEN9X + OFS_FUNCSOUNDS) #ifdef FRSKY @@ -255,6 +257,7 @@ extern const pm_char STR_SWITCHWARNING[]; extern const pm_char STR_MEMORYWARNING[]; extern const pm_char STR_ALARMWARNING[]; extern const pm_char STR_NODATAALARM[]; +extern const pm_char STR_TIMEZONE[]; extern const pm_char STR_RXCHANNELORD[]; extern const pm_char STR_SLAVE[]; extern const pm_char STR_MODESRC[]; diff --git a/src/open9x.cpp b/src/open9x.cpp index 5c2578671..ccfe4412f 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -1083,6 +1083,16 @@ uint8_t evalSticks(uint8_t phase) return anaCenter; } +#ifdef DEBUG +/* + * This is a test function for debugging purpose, you may insert there your code and compile with the option DEBUG=YES + */ +void testFunc() +{ + printf("testFunc\n"); fflush(stdout); +} +#endif + uint16_t active_functions = 0; // current max = 16 functions void evalFunctions() @@ -1111,6 +1121,27 @@ void evalFunctions() if (sd->func == FUNC_PLAY_SOMO && (~active_functions & mask)) { somoPushPrompt(sd->param); } +#endif + if (sd->func == FUNC_RESET && (~active_functions & mask)) { + switch(sd->param) { + case 0: + case 1: + resetTimer(sd->param); + break; + case 2: + resetAll(); + break; +#ifdef FRSKY + case 3: + resetTelemetry(); + break; +#endif + } + } +#if defined(DEBUG) + if (sd->func == FUNC_TEST && (~active_functions & mask)) { + testFunc(); + } #endif active_functions |= mask; } @@ -1757,10 +1788,6 @@ uint16_t getTmr16KHz() } } -#ifdef DEBUG -extern uint16_t g_time_per10; // instantiated in menus.cpp -#endif - #if defined (PCBV4) ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) //10ms timer #else @@ -1912,11 +1939,6 @@ extern uint16_t g_timeMain; #endif */ -#ifdef DEBUG -uint16_t DEBUG1 = 0; -uint16_t DEBUG2 = 0; -#endif - #endif /* @@ -1938,7 +1960,7 @@ FORCEINLINE void FRSKY_USART0_vect() #if defined (DSM2_SERIAL) FORCEINLINE void DSM2_USART0_vect() -{ +{ UDR0 = *((uint16_t*)pulses2MHzRPtr); pulses2MHzRPtr += sizeof(uint16_t); diff --git a/src/open9x.h b/src/open9x.h index f404eb69f..2e056505b 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -140,9 +140,6 @@ extern RlcFile theFile; //used for any file operation #define OUT_C_LCD_RES 2 #define OUT_C_LCD_CS1 1 -extern uint16_t DEBUG1; -extern uint16_t DEBUG2; - #if defined (PCBV4) # define INP_P_SPARE6 7 diff --git a/src/pulses.cpp b/src/pulses.cpp index ea9e3e488..fb766774e 100644 --- a/src/pulses.cpp +++ b/src/pulses.cpp @@ -48,7 +48,7 @@ uint8_t s_current_protocol = 255; inline void DSM2_EnableTXD(void) { UCSR0B |= (1 << TXEN0); // enable TX - UCSR0B |= (1 << UDRIE0); // enable UDRE0 interrupt + // UCSR0B |= (1 << UDRIE0); // don't enable UDRE0 interrupt, it will be enabled during next setupPulses } #endif diff --git a/src/translations/en.h b/src/translations/en.h index 8beb3e48e..864428444 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -78,7 +78,15 @@ #else #define TR_SOUND "Beep\0 " #endif -#define TR_VFSWFUNC "Security \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_SOMO TR_SDCLOGGS +#ifdef DEBUG +#define TR_TEST "Test\0 " +#else +#define TR_TEST +#endif +#define TR_VFSWFUNC "Security \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_SOMO "Reset " TR_SDCLOGGS TR_TEST + +#define LEN_VFSWRESET "\006" +#define TR_VFSWRESET "Timer1""Timer2""All ""Telem." #define LEN_FUNCSOUNDS "\006" #define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick ""Haptc1""Haptc2""Haptc3" @@ -231,6 +239,7 @@ #define TR_MEMORYWARNING "Memory Warning" #define TR_ALARMWARNING "Alarm Warning" #define TR_NODATAALARM "NO DATA Alarm" +#define TR_TIMEZONE "Time Zone" #define TR_RXCHANNELORD "Rx Channel Ord" #define TR_SLAVE "Slave" #define TR_MODESRC "mode\003% src" diff --git a/src/translations/fr.h b/src/translations/fr.h index 52fa68129..3a192401f 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -78,7 +78,15 @@ #else #define TR_SOUND "Beep\0 " #endif -#define TR_VFSWFUNC "Securite \0 ""Ecolage \0 ""Trim instant " TR_SOUND TR_SOMO TR_SDCLOGGS +#ifdef DEBUG +#define TR_TEST "Test\0 " +#else +#define TR_TEST +#endif +#define TR_VFSWFUNC "Securite \0 ""Ecolage \0 ""Trim instant " TR_SOUND TR_SOMO "Reset " TR_SDCLOGGS TR_TEST + +#define LEN_VFSWRESET "\006" +#define TR_VFSWRESET "Timer1""Timer2""All ""Telem." #define LEN_FUNCSOUNDS "\006" #define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick ""Haptc1""Haptc2""Haptc3" @@ -230,6 +238,7 @@ #define TR_MEMORYWARNING "Alerte Memoire" #define TR_ALARMWARNING "Alerte Alarme" #define TR_NODATAALARM "Alerte Telem." +#define TR_TIMEZONE "Fuseau Horaire" #define TR_RXCHANNELORD "Ordre Voies Rx" #define TR_MODE "Mode" #define TR_SLAVE "Esclave" diff --git a/src/translations/se.h b/src/translations/se.h index 3ddec12a1..ee56c04c4 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -78,7 +78,15 @@ #else #define TR_SOUND "Pip \0 " #endif -#define TR_VFSWFUNC "S\201kerhet \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_SOMO TR_SDCLOGGS +#ifdef DEBUG +#define TR_TEST "Test\0 " +#else +#define TR_TEST +#endif +#define TR_VFSWFUNC "S\201kerhet \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_SOMO "Reset " TR_SDCLOGGS TR_TEST + +#define LEN_VFSWRESET "\006" +#define TR_VFSWRESET "Timer1""Timer2""All ""Telem." #define LEN_FUNCSOUNDS "\006" #define TR_FUNCSOUNDS "Varn1 ""Varn2 ""F\200r ""Ring ""SciFi ""Robot ""Pip ""Tada ""Syrsa ""Siren ""Alarm ""Ratata""Tick ""Vibr1 ""Vibr2 ""Vibr3 " @@ -231,6 +239,7 @@ #define TR_MEMORYWARNING "Minnesvarning" #define TR_ALARMWARNING "Alarmvarning" #define TR_NODATAALARM "NO DATA Varning" +#define TR_TIMEZONE "Time Zone" #define TR_RXCHANNELORD "Kanalordning RX" #define TR_SLAVE "Slav" #define TR_MODESRC "effekt % k\201lla"