1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00

Issue #1065 - New function putsTime

This commit is contained in:
bsongis 2014-05-09 14:37:23 +02:00
parent 57193fddfe
commit 3c07e0a227
6 changed files with 37 additions and 29 deletions

View file

@ -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)

View file

@ -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
}

View file

@ -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)

View file

@ -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:

View file

@ -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

View file

@ -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<EFBFBD>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<EFBFBD>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<EFBFBD>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<EFBFBD>cksetzen
max_alt=0;
AUDIO_MENUS(); // short blip for non negative lift
break;