RTC and SD logs #4556

rtcUnixEpochTime
only:alphax-4k-gdi
This commit is contained in:
rusefillc 2024-08-28 21:05:47 -04:00 committed by Andrey
parent a8c5fe343f
commit 9037ccef12
5 changed files with 21 additions and 1 deletions

View File

@ -417,6 +417,7 @@ float mapFast
int16_t autoscale rawAuxTemp2;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawAmbientTemp;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
uint32_t rtcUnixEpochTime
uint8_t[60 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
uint8_t[56 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
end_struct

View File

@ -202,6 +202,10 @@ void updateDevConsoleState() {
}
#endif /* EFI_PROD_CODE */
#if EFI_RTC
engine->outputChannels.rtcUnixEpochTime = getEpochTime();
#endif
#if HAL_USE_ADC
printFullAdcReportIfNeeded();
#endif /* HAL_USE_ADC */

View File

@ -52,6 +52,19 @@ void setRtcDateTime(efidatetime_t const * const dateTime) {
rtcSetTime(&RTCD1, &timespec);
}
static time_t rtc_encode(const RTCDateTime *timespec) {
struct tm tim;
rtcConvertDateTimeToStructTm(timespec, &tim, NULL);
return mktime(&tim);
}
uint32_t getEpochTime() {
RTCDateTime timespec;
rtcGetTime(&RTCD1, &timespec);
return rtc_encode(&timespec);
}
efidatetime_t getRtcDateTime() {
RTCDateTime timespec;
rtcGetTime(&RTCD1, &timespec);

View File

@ -14,6 +14,7 @@
#if EFI_RTC
void initRtc();
void printRtcDateTime();
uint32_t getEpochTime();
efidatetime_t getRtcDateTime();
void setRtcDateTime(const efidatetime_t * const dateTime);

View File

@ -1527,6 +1527,7 @@ gaugeCategory = ECU Status
firmwareVersionGauge = firmwareVersion , @@GAUGE_NAME_FW_VERSION@@, "%", 0, 100, 0, 0, 100, 100, 0, 0
timeSecondsGauge = seconds, @@GAUGE_NAME_UPTIME@@, "sec", 0, 100, 0, 0, 100, 100, 0, 0
tuneCrc16Gauge = tuneCrc16, @@GAUGE_NAME_TUNE_CRC16@@, "", 0, 64000, 0, 0, 64000, 64000, 0, 0
rtcUnixEpochTimeGauge = rtcUnixEpochTime, "Epoch Time", "sec", 0, 100, 0, 0, 100, 100, 0, 0
gaugeCategory = Debug
debugF1Gauge = debugFloatField1, {bitStringValue( debugFieldF1List, debugMode )}, "", 0, 100, 0, 0, 100, 100, 4, 4