public void GET_HK_2Test() { EPS eps = new EPS(); EPS.eps_hk_t ans = eps.GET_HK_2(0); int i; for (i = 0; i < 3; i++) { Assert.AreEqual(ans.vboost[i], eps.BoostConverters[i].Volt); Assert.AreEqual(ans.curin[i], eps.BoostConverters[i].CurrentIn); } Assert.AreEqual(ans.vbatt, eps.OnboardBattery.Vbat); ushort photoCurrent = 0; for (i = 0; i < 3; i++) { photoCurrent += eps.BoostConverters[i].CurrentOut; } Assert.AreEqual(ans.cursun, photoCurrent); Assert.AreEqual(ans.cursys, eps.OnboardBattery.CurrentOut); for (i = 0; i < 6; i++) { Assert.AreEqual(ans.curout[i], ((Channel)eps.Outputs[i]).CurrentOut); } for (i = 0; i < 8; i++) { Assert.AreEqual(ans.output[i], eps.Outputs[i].Status); Assert.AreEqual(ans.output_on_delta[i], eps.CurrentConfig.OutputInitialOnDelay[i]); Assert.AreEqual(ans.output_off_delta[i], eps.CurrentConfig.OutputInitialOffDelay[i]); } for (i = 0; i < 6; i++) { Assert.AreEqual(ans.latchup[i], ((Channel)eps.Outputs[i]).LatchupNum); } Assert.AreEqual(ans.wdt_csp_pings_left[0], eps.Wdts[(int)WdtType.CSP0].PingLeft); Assert.AreEqual(ans.wdt_csp_pings_left[1], eps.Wdts[(int)WdtType.CSP1].PingLeft); Assert.AreEqual(ans.wdt_gnd_time_left, eps.Wdts[(int)WdtType.GND].TimeLeft); Assert.AreEqual(ans.wdt_i2c_time_left, eps.Wdts[(int)WdtType.I2C].TimeLeft); Assert.AreEqual(ans.counter_boot, eps.RebootCount); Assert.AreEqual(ans.counter_wdt_csp[0], eps.Wdts[(int)WdtType.CSP0].RebootCounter); Assert.AreEqual(ans.counter_wdt_csp[1], eps.Wdts[(int)WdtType.CSP1].RebootCounter); Assert.AreEqual(ans.counter_wdt_gnd, eps.Wdts[(int)WdtType.GND].RebootCounter); Assert.AreEqual(ans.counter_wdt_i2c, eps.Wdts[(int)WdtType.I2C].RebootCounter); for (i = 0; i < 3; i++) { Assert.AreEqual(ans.temp[i], eps.BoostConverters[i].Temperture); } Assert.AreEqual(ans.temp[3], eps.OnboardBattery.Temperture); Assert.AreEqual(ans.temp[4], eps.OnboardBattery.Temperture); Assert.AreEqual(ans.temp[5], eps.OnboardBattery.Temperture); // external - need to change Assert.AreEqual(ans.bootcause, eps.LastResetCause); Assert.AreEqual(ans.battmode, (byte)eps.OnboardBattery.BattState); Assert.AreEqual(ans.pptmode, (byte)eps.CurrentConfig.PptMode); }
public static byte[] getBytes(EPS.eps_hk_t str) { byte[] ans = new byte[140]; //TODO: determine size int index = 0; copyToByteArr(ans, str.commandReply, ref index); copyToByteArr(ans, str.vboost, ref index); copyToByteArr(ans, str.vbatt, ref index); copyToByteArr(ans, str.curin, ref index); copyToByteArr(ans, str.cursun, ref index); copyToByteArr(ans, str.cursys, ref index); copyToByteArr(ans, str.reserved1, ref index); copyToByteArr(ans, str.curout, ref index); copyToByteArr(ans, str.output, ref index); copyToByteArr(ans, str.output_on_delta, ref index); copyToByteArr(ans, str.output_off_delta, ref index); copyToByteArr(ans, str.latchup, ref index); ushort roundUpToIntSize1 = 0; copyToByteArr(ans, roundUpToIntSize1, ref index); copyToByteArr(ans, str.wdt_i2c_time_left, ref index); copyToByteArr(ans, str.wdt_gnd_time_left, ref index); copyToByteArr(ans, str.wdt_csp_pings_left, ref index); copyToByteArr(ans, str.counter_wdt_i2c, ref index); copyToByteArr(ans, str.counter_wdt_gnd, ref index); copyToByteArr(ans, str.counter_wdt_csp, ref index); byte roundUpToIntSize2 = 0; copyToByteArr(ans, roundUpToIntSize2, ref index); copyToByteArr(ans, str.counter_boot, ref index); copyToByteArr(ans, str.temp, ref index); ans[index] = str.bootcause; index += 1; ans[index] = str.battmode; index += 1; ans[index] = str.pptmode; index += 1; copyToByteArr(ans, str.reserved2, ref index); return(ans); }