mirror of
https://github.com/opentx/opentx.git
synced 2025-07-20 14:55:13 +03:00
Optimization: removed usage of gettime() where possible
This commit is contained in:
parent
3ada9f7cf5
commit
43598fb6df
6 changed files with 9 additions and 18 deletions
|
@ -316,9 +316,7 @@ void displayTopBar()
|
|||
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER3);
|
||||
|
||||
/* RTC time */
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
putsTime(BAR_TIME_X, BAR_Y+1, t, LEFT|TIMEBLINK);
|
||||
putsRtcTime(BAR_TIME_X, BAR_Y+1, LEFT|TIMEBLINK);
|
||||
|
||||
/* The background */
|
||||
lcd_filled_rect(BAR_X, BAR_Y, BAR_W, BAR_H, SOLID, FILL_WHITE|GREY(12)|ROUND);
|
||||
|
|
|
@ -215,7 +215,7 @@ 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, struct gtm t, LcdFlags att);
|
||||
void putsRtcTime(xcoord_t x, uint8_t y, LcdFlags att);
|
||||
void putsTimer(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
|
||||
|
||||
#define SOLID 0xff
|
||||
|
|
|
@ -602,9 +602,9 @@ void lcdDrawTelemetryTopBar()
|
|||
#endif
|
||||
|
||||
#if defined(CPUARM) && defined(RTCLOCK)
|
||||
void putsTime(xcoord_t x, uint8_t y, struct gtm t, LcdFlags att)
|
||||
void putsRtcTime(xcoord_t x, uint8_t y, LcdFlags att)
|
||||
{
|
||||
putsTimer(x, y, t.tm_hour*60+t.tm_min, att, att);
|
||||
putsTimer(x, y, getValue(MIXSRC_FIRST_TELEM-1+TELEM_TX_TIME), att, att);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -928,10 +928,7 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val,
|
|||
#if defined(CPUARM) && defined(RTCLOCK)
|
||||
case TELEM_TX_TIME-1:
|
||||
{
|
||||
gtm t;
|
||||
t.tm_hour = val / 60;
|
||||
t.tm_min = val % 60;
|
||||
putsTime(x, y, t, att);
|
||||
putsRtcTime(x, y, att);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -326,11 +326,7 @@ getvalue_t getValue(uint8_t i)
|
|||
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_TX_VOLTAGE) return g_vbat100mV;
|
||||
#if defined(CPUARM) && defined(RTCLOCK)
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_TX_TIME) {
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
return t.tm_hour*60 + t.tm_min;
|
||||
}
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_TX_TIME) return (g_rtcTime % SECS_PER_DAY) / 60; // number of minutes from midnight
|
||||
#endif
|
||||
else if (i<=MIXSRC_FIRST_TELEM-1+TELEM_TIMER2) return timersStates[i-MIXSRC_FIRST_TELEM+1-TELEM_TIMER1].val;
|
||||
#if defined(FRSKY)
|
||||
|
|
|
@ -107,9 +107,6 @@ verify (twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT (int));
|
|||
#define TM_YEAR_BASE 1900
|
||||
verify (base_year_is_a_multiple_of_100, TM_YEAR_BASE % 100 == 0);
|
||||
|
||||
#define SECS_PER_HOUR 3600ul
|
||||
#define SECS_PER_DAY 86400ul
|
||||
|
||||
/* Return 1 if YEAR + TM_YEAR_BASE is a leap year. */
|
||||
static inline int
|
||||
leapyear (long int year)
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
|
||||
#include <inttypes.h>
|
||||
|
||||
#define SECS_PER_HOUR 3600ul
|
||||
#define SECS_PER_DAY 86400ul
|
||||
|
||||
typedef long int gtime_t;
|
||||
|
||||
struct gtm
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue