diff --git a/radio/src/gui/menu_model.cpp b/radio/src/gui/menu_model.cpp index 7d2691a31..3f12a67bf 100644 --- a/radio/src/gui/menu_model.cpp +++ b/radio/src/gui/menu_model.cpp @@ -1059,7 +1059,7 @@ void menuModelSetup(uint8_t event) else { putsStrIdx(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1); putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0); - putsTime(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0); + putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0); #if defined(PCBTARANIS) if (attr && m_posHorz < 0) lcd_filled_rect(MODEL_SETUP_2ND_COLUMN, y, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8); #endif @@ -4982,7 +4982,7 @@ void menuModelCustomFunctions(uint8_t event) #if defined(CPUARM) else if (func == FUNC_SET_TIMER) { val_max = 59*60+59; - putsTime(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT, attr); + putsTimer(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT, attr); } #endif #if defined(AUDIO) diff --git a/radio/src/gui/view_main.cpp b/radio/src/gui/view_main.cpp index 480ec89b7..e089b14c2 100644 --- a/radio/src/gui/view_main.cpp +++ b/radio/src/gui/view_main.cpp @@ -318,11 +318,7 @@ void displayTopBar() /* RTC time */ struct gtm t; gettime(&t); - if (t.tm_sec % 2) { - lcd_putcAtt(BAR_TIME_X+1, BAR_Y+1, ':', 0); - } - lcd_outdezNAtt(BAR_TIME_X+1, BAR_Y+1, t.tm_hour, LEADING0, 2); - lcd_outdezNAtt(BAR_TIME_X+3*FWNUM-1, BAR_Y+1, t.tm_min, LEADING0, 2); + putsTime(BAR_TIME_X+1, BAR_Y+1, t, true); /* The background */ lcd_filled_rect(BAR_X, BAR_Y, BAR_W, BAR_H, SOLID, FILL_WHITE|GREY_DEFAULT|ROUND); @@ -344,7 +340,7 @@ void displayTimers() // Main timer if (g_model.timers[0].mode) { TimerState & timerState = timersStates[0]; - putsTime(TIMERS_X, TIMER1_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT); + putsTimer(TIMERS_X, TIMER1_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT); putsTimerMode(TIMERS_X, TIMER1_Y-6, g_model.timers[0].mode, SMLSIZE); if (g_model.timers[0].persistent) lcd_putcAtt(TIMERS_R, TIMER1_Y+1, 'P', SMLSIZE); if (timerState.val < 0) { @@ -357,7 +353,7 @@ void displayTimers() // Second timer if (g_model.timers[1].mode) { TimerState & timerState = timersStates[1]; - putsTime(TIMERS_X, TIMER2_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT); + putsTimer(TIMERS_X, TIMER2_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT); putsTimerMode(TIMERS_X, TIMER2_Y-6, g_model.timers[1].mode, SMLSIZE); if (g_model.timers[1].persistent) lcd_putcAtt(TIMERS_R, TIMER2_Y+1, 'P', SMLSIZE); if (timerState.val < 0) { @@ -374,7 +370,7 @@ void displayTimers() if (g_model.timers[0].mode) { TimerState & timerState = timersStates[0]; uint8_t att = DBLSIZE | (timerState.val<0 ? BLINK|INVERS : 0); - putsTime(12*FW+2+10*FWNUM-4, FH*2, timerState.val, att, att); + putsTimer(12*FW+2+10*FWNUM-4, FH*2, timerState.val, att, att); putsTimerMode(timerState.val >= 0 ? 9*FW-FW/2+3 : 9*FW-FW/2-4, FH*3, g_model.timers[0].mode); } } @@ -840,7 +836,7 @@ void menuMainView(uint8_t event) } } else { // timer2 - putsTime(33+FW+2+10*FWNUM-4, FH*5, timersStates[1].val, DBLSIZE, DBLSIZE); + putsTimer(33+FW+2+10*FWNUM-4, FH*5, timersStates[1].val, DBLSIZE, DBLSIZE); putsTimerMode(timersStates[1].val >= 0 ? 20-FW/2+5 : 20-FW/2-2, FH*6, g_model.timers[1].mode); // lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s } diff --git a/radio/src/gui/view_statistics.cpp b/radio/src/gui/view_statistics.cpp index 9d92a849d..dc7608410 100644 --- a/radio/src/gui/view_statistics.cpp +++ b/radio/src/gui/view_statistics.cpp @@ -58,16 +58,16 @@ void menuStatisticsView(uint8_t event) } lcd_puts( 1*FW, FH*0, STR_TOTTM1TM2THRTHP); - putsTime( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0); - putsTime( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0); + putsTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0); + putsTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0); - putsTime( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0); - putsTime( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0); + putsTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0); + putsTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0); - putsTime( 12*FW+5*FWNUM+1, FH*0, s_timeCumTot, 0, 0); + putsTimer( 12*FW+5*FWNUM+1, FH*0, s_timeCumTot, 0, 0); #if defined(PCBTARANIS) - putsTime(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + sessionTimer, 0, 0); + putsTimer(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + sessionTimer, 0, 0); #endif #if defined(THRTRACE) @@ -147,7 +147,7 @@ void menuStatisticsDebug(uint8_t event) lcd_putsLeft(2*FH, STR_CPU_MAH); putsTelemetryValue(MENU_DEBUG_COL_OFS, 2*FH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, PREC1); - putsTime(17*FW+5*FWNUM+1, 2*FH, g_eeGeneral.globalTimer + sessionTimer, 0, 0); + putsTimer(17*FW+5*FWNUM+1, 2*FH, g_eeGeneral.globalTimer + sessionTimer, 0, 0); #endif #if defined(PCBSKY9X) diff --git a/radio/src/lcd.cpp b/radio/src/lcd.cpp index e5926f877..020d17842 100644 --- a/radio/src/lcd.cpp +++ b/radio/src/lcd.cpp @@ -842,12 +842,12 @@ void lcdDrawTelemetryTopBar() putsVBat(16*FW+1,0,att); if (g_model.timers[0].mode) { att = (timersStates[0].val<0 ? BLINK : 0); - putsTime(22*FW+5*FWNUM+3, 0, timersStates[0].val, att, att); + putsTimer(22*FW+5*FWNUM+3, 0, timersStates[0].val, att, att); lcd_putsiAtt(18*FW+2, 1, STR_VTELEMCHNS, TELEM_TM1, SMLSIZE); } if (g_model.timers[1].mode) { att = (timersStates[1].val<0 ? BLINK : 0); - putsTime(31*FW+5*FWNUM+3, 0, timersStates[1].val, att, att); + putsTimer(31*FW+5*FWNUM+3, 0, timersStates[1].val, att, att); lcd_putsiAtt(27*FW+2, 1, STR_VTELEMCHNS, TELEM_TM2, SMLSIZE); } lcd_invert_line(0); @@ -860,13 +860,24 @@ void lcdDrawTelemetryTopBar() putsVBat(14*FW,0,att); if (g_model.timers[0].mode) { att = (timersStates[0].val<0 ? BLINK : 0); - putsTime(17*FW+5*FWNUM+1, 0, timersStates[0].val, att, att); + putsTimer(17*FW+5*FWNUM+1, 0, timersStates[0].val, att, att); } lcd_invert_line(0); } #endif -void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2) +#if defined(PCBTARANIS) +void putsTime(xcoord_t x, uint8_t y, struct gtm t, bool blink) +{ + if (blink && (t.tm_sec%2)) { + lcd_putcAtt(x, y, ':', 0); + } + lcd_outdezNAtt(x, y, t.tm_hour, LEADING0, 2); + lcd_outdezNAtt(x+3*FWNUM-2, y, t.tm_min, LEADING0, 2); +} +#endif + +void putsTimer(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2) { div_t qr; @@ -1189,7 +1200,7 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, case TELEM_TM1-1: case TELEM_TM2-1: att &= ~NO_UNIT; - putsTime(x, y, val, att, att); + putsTimer(x, y, val, att, att); break; #if defined(FRSKY) case TELEM_MIN_A1-1: @@ -1311,7 +1322,7 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, case TELEM_TM1-1: case TELEM_TM2-1: att &= ~NO_UNIT; - putsTime(x, y, val, att, att); + putsTimer(x, y, val, att, att); break; case TELEM_TX_VOLTAGE-1: diff --git a/radio/src/lcd.h b/radio/src/lcd.h index 185f5079f..21552bfb6 100644 --- a/radio/src/lcd.h +++ b/radio/src/lcd.h @@ -202,7 +202,8 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, #define putstime_t int16_t #endif -void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2); +void putsTime(xcoord_t x, uint8_t y, struct gtm t, bool blink=false); +void putsTimer(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2); #define SOLID 0xff #define DOTTED 0x55 diff --git a/radio/src/telemetry/nmea.cpp b/radio/src/telemetry/nmea.cpp index e803a6b74..0d1165054 100644 --- a/radio/src/telemetry/nmea.cpp +++ b/radio/src/telemetry/nmea.cpp @@ -554,12 +554,12 @@ void menuTelemetryNMEA2(uint8_t event) ignore_break=0; break;} - if (!home_alt) // umschalten zwischen absoluter und relativer Höhe + if (!home_alt) // umschalten zwischen absoluter und relativer H�he home_alt = save_alt; else home_alt=0; - if (save_alt==0) // wenn noch keine Home Höhe gesetzt war, wird sie es jetzt, weil sonst + if (save_alt==0) // wenn noch keine Home H�he gesetzt war, wird sie es jetzt, weil sonst // das Umschalten keine Wirkung zeigt save_alt = home_alt = abs_alt; // absolute altitude AUDIO_MENUS(); // short blip for non negative lift @@ -567,11 +567,11 @@ void menuTelemetryNMEA2(uint8_t event) case EVT_KEY_LONG(KEY_MENU): ignore_break = 1; - save_alt = home_alt = abs_alt; // Home altitude auf aktuelle absolute Höhe setzen + save_alt = home_alt = abs_alt; // Home altitude auf aktuelle absolute H�he setzen AUDIO_MENUS(); // short blip for non negative lift break; - case EVT_KEY_LONG(KEY_EXIT): // Max Altitude auf 0 zurücksetzen + case EVT_KEY_LONG(KEY_EXIT): // Max Altitude auf 0 zur�cksetzen max_alt=0; AUDIO_MENUS(); // short blip for non negative lift break;