Merge pull request #4550 from mikeller/hide_rtc_date_time_if_undefined

Hide RTC date/time in CLI 'status' if it is undefined.
This commit is contained in:
Martin Budden 2017-11-12 05:22:35 +00:00 committed by GitHub
commit c14da43e8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -2964,9 +2964,10 @@ static void cliStatus(char *cmdline)
#ifdef USE_RTC_TIME
char buf[FORMATTED_DATE_TIME_BUFSIZE];
dateTime_t dt;
rtcGetDateTime(&dt);
dateTimeFormatLocal(buf, &dt);
cliPrintLinef("Current Time: %s", buf);
if (rtcGetDateTime(&dt)) {
dateTimeFormatLocal(buf, &dt);
cliPrintLinef("Current Time: %s", buf);
}
#endif
cliPrintLinef("Voltage: %d * 0.1V (%dS battery - %s)", getBatteryVoltage(), getBatteryCellCount(), getBatteryStateString());