public static string SATStruct_str(SATTelemetry_t data) { string str = ""; SATTelemetry_t tlm = data; str += tlm.COMTelemetry.RSSI_level.ToString() + ","; str += tlm.COMTelemetry.COM_MCU_temp.ToString() + ","; str += tlm.COMTelemetry.ADF_temp.ToString() + ","; str += tlm.CTRLTelemetry.MET.ToString() + ","; str += tlm.CTRLTelemetry.EXPStat.ToString() + ","; str += tlm.CTRLTelemetry.CTRL_MCU_temp.ToString() + ","; str += tlm.PWRTelemetry.MPP1.U.ToString() + ","; str += tlm.PWRTelemetry.MPP1.I.ToString() + ","; str += tlm.PWRTelemetry.MPP2.U.ToString() + ","; str += tlm.PWRTelemetry.MPP2.I.ToString() + ","; str += tlm.PWRTelemetry.MPP3.U.ToString() + ","; str += tlm.PWRTelemetry.MPP3.I.ToString() + ","; str += tlm.PWRTelemetry.SolarPanelTemperature.T_XT.ToString() + ","; str += tlm.PWRTelemetry.SolarPanelTemperature.T_XB.ToString() + ","; str += tlm.PWRTelemetry.SolarPanelTemperature.T_YT.ToString() + ","; str += tlm.PWRTelemetry.SolarPanelTemperature.T_YB.ToString() + ","; str += tlm.PWRTelemetry.SolarPanelTemperature.T_ZT.ToString() + ","; str += tlm.PWRTelemetry.SolarPanelTemperature.T_ZB.ToString() + ","; str += tlm.PWRTelemetry.BatteryTelemetry.U.ToString() + ","; str += tlm.PWRTelemetry.BatteryTelemetry.I_Ch.ToString() + ","; str += tlm.PWRTelemetry.BatteryTelemetry.I_Dis.ToString() + ","; str += tlm.PWRTelemetry.BatteryTelemetry.T.ToString() + ","; str += tlm.PWRTelemetry.BatteryTelemetry.Pwr_balance.ToString() + ","; str += tlm.PWRTelemetry.OtherTelemetry.VBUS_I.ToString() + ","; str += tlm.PWRTelemetry.OtherTelemetry.MCU_T.ToString() + ","; str += tlm.PWRTelemetry.PWRState.state.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_Hv_current.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_tok_magnitude.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_Hv_current.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_ion_tok_magnitude.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_ion_tok_exponent.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_adc.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_gain_adc.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_gain_ui.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_Temp.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_Hi_volt.ToString() + ","; str += tlm.EXPbinTelemetry.Telemetry_bin_status.ToString() + ","; return(str); }
public static SATTelemetry_t fill_SATStruct(byte[] src, int offset) { SATTelemetry_t tlm = new SATTelemetry_t(); tlm.COMTelemetry.RSSI_level = (int16_t)((src[offset + 1] << 8 | src[offset + 0])); tlm.COMTelemetry.COM_MCU_temp = (int8_t)src[offset + 2]; tlm.COMTelemetry.ADF_temp = (int8_t)src[offset + 3]; tlm.CTRLTelemetry.MET = (uint32_t)((src[offset + 7] << 24) | (src[offset + 6] << 16) | (src[offset + 5] << 8) | (src[offset + 4] << 0)); tlm.CTRLTelemetry.EXPStat = (uint8_t)src[offset + 8]; tlm.CTRLTelemetry.CTRL_MCU_temp = (int8_t)src[offset + 9]; tlm.PWRTelemetry.MPP1.U = (uint16_t)((uint16_t)(src[offset + 11] * (uint16_t)256) + (uint16_t)src[offset + 10]); tlm.PWRTelemetry.MPP1.I = (uint16_t)((uint16_t)(src[offset + 13] * (uint16_t)256) + (uint16_t)src[offset + 12]); tlm.PWRTelemetry.MPP2.U = (uint16_t)((uint16_t)(src[offset + 15] * (uint16_t)256) + (uint16_t)src[offset + 14]); tlm.PWRTelemetry.MPP2.I = (uint16_t)((uint16_t)(src[offset + 17] * (uint16_t)256) + (uint16_t)src[offset + 16]); tlm.PWRTelemetry.MPP3.U = (uint16_t)((uint16_t)(src[offset + 19] * (uint16_t)256) + (uint16_t)src[offset + 18]); tlm.PWRTelemetry.MPP3.I = (uint16_t)((uint16_t)(src[offset + 21] * (uint16_t)256) + (uint16_t)src[offset + 20]); tlm.PWRTelemetry.SolarPanelTemperature.T_XT = (int8_t)src[offset + 22]; tlm.PWRTelemetry.SolarPanelTemperature.T_XB = (int8_t)src[offset + 23]; tlm.PWRTelemetry.SolarPanelTemperature.T_YT = (int8_t)src[offset + 24]; tlm.PWRTelemetry.SolarPanelTemperature.T_YB = (int8_t)src[offset + 25]; tlm.PWRTelemetry.SolarPanelTemperature.T_ZT = (int8_t)src[offset + 26]; tlm.PWRTelemetry.SolarPanelTemperature.T_ZB = (int8_t)src[offset + 27]; tlm.PWRTelemetry.BatteryTelemetry.U = (uint16_t)((uint16_t)(src[offset + 29] * (uint16_t)256) + (uint16_t)src[offset + 28]); tlm.PWRTelemetry.BatteryTelemetry.I_Ch = (uint16_t)((uint16_t)(src[offset + 31] * (uint16_t)256) + (uint16_t)src[offset + 30]); tlm.PWRTelemetry.BatteryTelemetry.I_Dis = (uint16_t)((uint16_t)(src[offset + 33] * (uint16_t)256) + (uint16_t)src[offset + 32]); tlm.PWRTelemetry.BatteryTelemetry.T = (int8_t)src[offset + 34]; tlm.PWRTelemetry.BatteryTelemetry.Pwr_balance = (src[offset + 38] << 24) | (src[offset + 37] << 16) | (src[offset + 36] << 8) | (src[offset + 35] << 0); tlm.PWRTelemetry.OtherTelemetry.VBUS_I = (uint16_t)((uint16_t)(src[offset + 40] * (uint16_t)256) + (uint16_t)src[offset + 39]); tlm.PWRTelemetry.OtherTelemetry.MCU_T = (int8_t)src[offset + 41]; tlm.PWRTelemetry.PWRState.state = (uint8_t)src[offset + 42]; tlm.EXPbinTelemetry.Telemetry_bin_Hv_current = (uint16_t)((uint16_t)(src[offset + 44] * (uint16_t)256) + (uint16_t)src[offset + 43]); tlm.EXPbinTelemetry.Telemetry_bin_tok_magnitude = (uint16_t)((uint16_t)(src[offset + 46] * (uint16_t)256) + (uint16_t)src[offset + 45]); tlm.EXPbinTelemetry.Telemetry_bin_Hv_current = (uint8_t)src[offset + 47]; tlm.EXPbinTelemetry.Telemetry_bin_ion_tok_magnitude = (uint16_t)((uint16_t)(src[offset + 49] * (uint16_t)256) + (uint16_t)src[offset + 48]); tlm.EXPbinTelemetry.Telemetry_bin_ion_tok_exponent = (uint8_t)src[offset + 50]; tlm.EXPbinTelemetry.Telemetry_bin_adc = (uint16_t)((uint16_t)(src[offset + 52] * (uint16_t)256) + (uint16_t)src[offset + 51]); tlm.EXPbinTelemetry.Telemetry_bin_gain_adc = (uint8_t)src[offset + 53]; tlm.EXPbinTelemetry.Telemetry_bin_gain_ui = (uint8_t)src[offset + 54]; tlm.EXPbinTelemetry.Telemetry_bin_Temp = (uint16_t)((uint16_t)(src[offset + 56] * (uint16_t)256) + (uint16_t)src[offset + 55]); tlm.EXPbinTelemetry.Telemetry_bin_Hi_volt = (uint16_t)((uint16_t)(src[offset + 58] * (uint16_t)256) + (uint16_t)src[offset + 57]); tlm.EXPbinTelemetry.Telemetry_bin_status = (uint8_t)src[offset + 59]; return(tlm); }