Kill warnings (#2623)

* dead code

* rtc_helper: clean-up warnings

* kill unused
This commit is contained in:
Andrey G 2021-05-05 01:55:27 +03:00 committed by GitHub
parent ac879d7fc6
commit e6cf82845b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 26 deletions

View File

@ -47,13 +47,6 @@
EXTERN_ENGINE; EXTERN_ENGINE;
// 10 seconds
#define CONSOLE_WRITE_TIMEOUT 10000
#if (defined(TS_PRIMARY_SERIAL) && ! EFI_SIMULATOR)
static event_listener_t consoleEventListener;
#endif
bool consoleByteArrived = false; bool consoleByteArrived = false;
void onDataArrived(void) { void onDataArrived(void) {

View File

@ -30,6 +30,7 @@ void date_set_tm(struct tm *timp) {
} }
void date_get_tm(struct tm *timp) { void date_get_tm(struct tm *timp) {
(void)timp;
#if EFI_RTC #if EFI_RTC
rtcGetTime(&RTCD1, &timespec); rtcGetTime(&RTCD1, &timespec);
rtcConvertDateTimeToStructTm(&timespec, timp, NULL); rtcConvertDateTimeToStructTm(&timespec, timp, NULL);
@ -39,24 +40,21 @@ void date_get_tm(struct tm *timp) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
// Lua needs this function, but we don't necessarily have to implement it // Lua needs this function, but we don't necessarily have to implement it
extern "C" int _gettimeofday(timeval* tv, void* tzvp) { extern "C" int _gettimeofday(timeval* tv, void* tzvp) {
(void)tv; (void)tzvp;
return 0; return 0;
} }
#endif #endif
static time_t GetTimeUnixSec(void) {
#if EFI_RTC #if EFI_RTC
static time_t GetTimeUnixSec(void) {
struct tm tim; struct tm tim;
rtcGetTime(&RTCD1, &timespec); rtcGetTime(&RTCD1, &timespec);
rtcConvertDateTimeToStructTm(&timespec, &tim, NULL); rtcConvertDateTimeToStructTm(&timespec, &tim, NULL);
return mktime(&tim); return mktime(&tim);
#else
return (time_t)0;
#endif
} }
static void SetTimeUnixSec(time_t unix_time) { static void SetTimeUnixSec(time_t unix_time) {
#if EFI_RTC
struct tm tim; struct tm tim;
#if defined __GNUC__ #if defined __GNUC__
@ -72,7 +70,6 @@ static void SetTimeUnixSec(time_t unix_time) {
rtcConvertStructTmToDateTime(&tim, 0, &timespec); rtcConvertStructTmToDateTime(&tim, 0, &timespec);
rtcSetTime(&RTCD1, &timespec); rtcSetTime(&RTCD1, &timespec);
#endif
} }
static void put2(int offset, char *lcd_str, int value) { static void put2(int offset, char *lcd_str, int value) {
@ -92,7 +89,6 @@ static void put2(int offset, char *lcd_str, int value) {
* @return true if we seem to know current date, false if no valid RTC state * @return true if we seem to know current date, false if no valid RTC state
*/ */
bool dateToStringShort(char *lcd_str) { bool dateToStringShort(char *lcd_str) {
#if EFI_RTC
strcpy(lcd_str, "000000_000000\0"); strcpy(lcd_str, "000000_000000\0");
struct tm timp; struct tm timp;
date_get_tm(&timp); date_get_tm(&timp);
@ -111,14 +107,9 @@ bool dateToStringShort(char *lcd_str) {
put2(11, lcd_str, timp.tm_sec); // seconds put2(11, lcd_str, timp.tm_sec); // seconds
return true; return true;
#else
lcd_str[0] = 0;
return false;
#endif
} }
void dateToString(char *lcd_str) { void dateToString(char *lcd_str) {
#if EFI_RTC
// todo: // todo:
// re-implement this along the lines of chvprintf("%04u-%02u-%02u %02u:%02u:%02u\r\n", timp.tm_year + 1900, timp.tm_mon + 1, timp.tm_mday, timp.tm_hour, // re-implement this along the lines of chvprintf("%04u-%02u-%02u %02u:%02u:%02u\r\n", timp.tm_year + 1900, timp.tm_mon + 1, timp.tm_mday, timp.tm_hour,
// timp.tm_min, timp.tm_sec); // timp.tm_min, timp.tm_sec);
@ -133,13 +124,8 @@ void dateToString(char *lcd_str) {
put2(6, lcd_str, timp.tm_hour); put2(6, lcd_str, timp.tm_hour);
put2(9, lcd_str, timp.tm_min); put2(9, lcd_str, timp.tm_min);
put2(12, lcd_str, timp.tm_sec); put2(12, lcd_str, timp.tm_sec);
#else
lcd_str[0] = 0;
#endif /* EFI_RTC */
} }
#if EFI_RTC
void printDateTime(void) { void printDateTime(void) {
static time_t unix_time; static time_t unix_time;
struct tm timp; struct tm timp;
@ -167,7 +153,19 @@ void setDateTime(const char *strDate) {
} }
efiPrintf("date_set Date parameter %s is wrong", strDate); efiPrintf("date_set Date parameter %s is wrong", strDate);
} }
#endif /* EFI_RTC */
#else /* EFI_RTC */
bool dateToStringShort(char *lcd_str) {
lcd_str[0] = 0;
return false;
}
void dateToString(char *lcd_str) {
lcd_str[0] = 0;
}
#endif
void initRtc(void) { void initRtc(void) {
#if EFI_RTC #if EFI_RTC

View File

@ -76,7 +76,6 @@ static IntermediateLogging intermediateLogging;
bool Logging::validateBuffer(const char *text, uint32_t extraLen) { bool Logging::validateBuffer(const char *text, uint32_t extraLen) {
if (remainingSize() < extraLen + 1) { if (remainingSize() < extraLen + 1) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
const char * msg = extraLen > 50 ? "(long)" : text;
warning(CUSTOM_LOGGING_BUFFER_OVERFLOW, "output overflow %s %d", name, extraLen); warning(CUSTOM_LOGGING_BUFFER_OVERFLOW, "output overflow %s %d", name, extraLen);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
return true; return true;