feat(bw): do not show time on main view when RTC not set (#5342)
This commit is contained in:
@@ -674,13 +674,13 @@ void menuMainView(event_t event)
|
|||||||
lcdDrawText(15 * FW, 0, "BIND", 0);
|
lcdDrawText(15 * FW, 0, "BIND", 0);
|
||||||
}
|
}
|
||||||
#if defined(RTCLOCK)
|
#if defined(RTCLOCK)
|
||||||
else if (view_base != VIEW_CHAN_MONITOR) {
|
else if (view_base != VIEW_CHAN_MONITOR && rtcIsValid()) {
|
||||||
drawRtcTime(CLOCK_X, CLOCK_Y, LEFT|TIMEBLINK);
|
drawRtcTime(CLOCK_X, CLOCK_Y, LEFT|TIMEBLINK);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if defined(RTCLOCK)
|
#if defined(RTCLOCK)
|
||||||
if (view_base != VIEW_CHAN_MONITOR) {
|
if (view_base != VIEW_CHAN_MONITOR && rtcIsValid()) {
|
||||||
drawRtcTime(CLOCK_X, CLOCK_Y, LEFT|TIMEBLINK);
|
drawRtcTime(CLOCK_X, CLOCK_Y, LEFT|TIMEBLINK);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ void displayTopBar()
|
|||||||
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER3);
|
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER3);
|
||||||
|
|
||||||
/* RTC time */
|
/* RTC time */
|
||||||
drawRtcTime(BAR_TIME_X, BAR_Y+1, LEFT|TIMEBLINK);
|
if (rtcIsValid()) drawRtcTime(BAR_TIME_X, BAR_Y+1, LEFT|TIMEBLINK);
|
||||||
|
|
||||||
/* The background */
|
/* The background */
|
||||||
lcdDrawFilledRect(BAR_X, BAR_Y, BAR_W, BAR_H, SOLID, FILL_WHITE|GREY(12)|ROUND);
|
lcdDrawFilledRect(BAR_X, BAR_Y, BAR_W, BAR_H, SOLID, FILL_WHITE|GREY(12)|ROUND);
|
||||||
|
|||||||
@@ -493,3 +493,16 @@ uint8_t rtcAdjust(uint16_t year, uint8_t mon, uint8_t day, uint8_t hour, uint8_t
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool rtcIsValid()
|
||||||
|
{
|
||||||
|
struct gtm t;
|
||||||
|
gettime(&t);
|
||||||
|
|
||||||
|
// If year is 2000, rtc circuit aren't working
|
||||||
|
// No RTC battery or other issue
|
||||||
|
if (t.tm_year <= 100)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ struct gtm
|
|||||||
extern gtime_t g_rtcTime;
|
extern gtime_t g_rtcTime;
|
||||||
extern uint8_t g_ms100; // global to allow time set function to reset to zero
|
extern uint8_t g_ms100; // global to allow time set function to reset to zero
|
||||||
|
|
||||||
|
bool rtcIsValid();
|
||||||
void rtcInit();
|
void rtcInit();
|
||||||
void rtcSetTime(const struct gtm * tm);
|
void rtcSetTime(const struct gtm * tm);
|
||||||
gtime_t gmktime (struct gtm *tm);
|
gtime_t gmktime (struct gtm *tm);
|
||||||
|
|||||||
Reference in New Issue
Block a user