From 1e2c76c3430f99a093863d97ccc974ee5228327c Mon Sep 17 00:00:00 2001 From: Peter Nemere Date: Tue, 12 Nov 2024 09:55:34 +1000 Subject: [PATCH] Generate HK file with sclk as int --- api/dataimport/sdfToRSI/readHousekeeping.go | 2 +- api/dataimport/sdfToRSI/util.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/dataimport/sdfToRSI/readHousekeeping.go b/api/dataimport/sdfToRSI/readHousekeeping.go index bd74e854..4eff345d 100644 --- a/api/dataimport/sdfToRSI/readHousekeeping.go +++ b/api/dataimport/sdfToRSI/readHousekeeping.go @@ -215,7 +215,7 @@ func processHousekeeping(lineNo int, lineData string, lines []string, sclk strin // SCLK,PMC,hk_fcnt,f_pixl_sdd_1_conv,f_pixl_sdd_2_conv,f_pixl_arm_resist_conv,f_head_sdd_1_conv,f_head_sdd_2_conv,f_hvps_fvmon_conv,f_hvps_fimon_conv,f_hvps_hvmon_conv,f_hvps_himon_conv,i_motor_1_conv,i_motor_2_conv,i_motor_3_conv,i_motor_4_conv,i_motor_5_conv,i_motor_6_conv hk2 := fmt.Sprintf("%v, %v, %v, %v, %v, %v, %v, %v, %v, %v, %v, %v, %v, %v, %v, %v, %v, %v\n", - makeWriteSCLK(sclk), pmc, fcnt, fVal[1], fVal[0], fVal[2], fVal[3], fVal[4], fVal[5], fVal[6], fVal[7], fVal[8], + makeWriteSCLInt(sclk), pmc, fcnt, fVal[1], fVal[0], fVal[2], fVal[3], fVal[4], fVal[5], fVal[6], fVal[7], fVal[8], motorPos[0], motorPos[1], motorPos[2], motorPos[3], motorPos[4], motorPos[5]) return hktime, hk, hk2, nil diff --git a/api/dataimport/sdfToRSI/util.go b/api/dataimport/sdfToRSI/util.go index 81ff96b6..1ba75c7e 100644 --- a/api/dataimport/sdfToRSI/util.go +++ b/api/dataimport/sdfToRSI/util.go @@ -174,7 +174,7 @@ func readNumBetween(line string, prefix string, suffix string, readType int) (in return val, 0, lastPos, nil } -func makeWriteSCLK(readSCLK string) string { +func makeWriteSCLInt(readSCLK string) int64 { unixSec := readTimestamp(readSCLK) // Work out where we are relative to the epoch above, and add to it to work out SCLK to use @@ -182,6 +182,12 @@ func makeWriteSCLK(readSCLK string) string { sclk := 720239544 + secSinceEpoch + return sclk +} + +func makeWriteSCLK(readSCLK string) string { + sclk := makeWriteSCLInt(readSCLK) + // Return as hex return fmt.Sprintf("%X", sclk) }