From e10464c7301c6536b18fc4e417a8c8ff3de2aa54 Mon Sep 17 00:00:00 2001 From: RobertK66 Date: Tue, 28 Nov 2023 14:15:06 +0100 Subject: [PATCH] so0me correction in time module, SRS first command. --- ClimbObc/src/mod/srs/radsensor.c | 4 ++-- ClimbObc/src/mod/tim/obc_time.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ClimbObc/src/mod/srs/radsensor.c b/ClimbObc/src/mod/srs/radsensor.c index 6a9cf41..96a34eb 100644 --- a/ClimbObc/src/mod/srs/radsensor.c +++ b/ClimbObc/src/mod/srs/radsensor.c @@ -102,8 +102,8 @@ void srs_main() { srsTx[9] = srs_crc(srsTx, 8); srsJob.tx_size = 10; srsJob.tx_data = srsTx; - srsJob.rx_size = 0; //10; - srsJob.rx_data = 0; //srsRx; + srsJob.rx_size = 10; + srsJob.rx_data = srsRx; srsJobInProgress = true; i2c_add_job(&srsJob); } diff --git a/ClimbObc/src/mod/tim/obc_time.c b/ClimbObc/src/mod/tim/obc_time.c index 9b2bd86..8ad2a13 100644 --- a/ClimbObc/src/mod/tim/obc_time.c +++ b/ClimbObc/src/mod/tim/obc_time.c @@ -368,6 +368,7 @@ void timSyncUtc(uint16_t year, obc_systime32_t systemTime, juliandayfraction utc float diff = fabs(syncData.newOffset - syncData.oldOffset); if ( diff > 0.00005) { + ObcSystemTime.utcOffset.year = year; ObcSystemTime.utcOffset.dayOfYear = syncData.newOffset; // Now we (re)calculate current Time (from systime and offset) and set this to our RTC registers @@ -484,11 +485,23 @@ obc_systime32_t inline timGetSystime(void) { } uint32_t leapDaysSince1970() { - return 12; + int days = 0; + for (int y=1972; y