To fix the hang problem
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
CDMS_HK.h@206:fba4aeebf004, 2016-06-30 (annotated)
- Committer:
- chaithanyarss
- Date:
- Thu Jun 30 14:00:33 2016 +0000
- Revision:
- 206:fba4aeebf004
- Parent:
- 187:2c7263530c57
- Child:
- 207:28a07943dded
For integrating PL_Main with rest of CDMS code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chaithanyarss | 187:2c7263530c57 | 1 | #include "cdms_rtc.h" |
shreeshas95 | 103:b55559925dc1 | 2 | #include "pinconfig.h" |
chaithanyarss | 187:2c7263530c57 | 3 | #include "reset_functions.h" |
chaithanyarss | 187:2c7263530c57 | 4 | #include "DefinitionsAndGlobals.h" |
chaithanyarss | 187:2c7263530c57 | 5 | #include "COM_SND_TM_functions.h" |
chaithanyarss | 206:fba4aeebf004 | 6 | #include "COM_SND_TM_functions.h" |
shreeshas95 | 103:b55559925dc1 | 7 | |
shreeshas95 | 103:b55559925dc1 | 8 | void FCTN_CDMS_HK_MAIN(); |
shreeshas95 | 103:b55559925dc1 | 9 | void FCTN_CDMS_HK(); |
chaithanyarss | 187:2c7263530c57 | 10 | void VERIFY_COMRX(); |
chaithanyarss | 187:2c7263530c57 | 11 | void VERIFY_RTC(); |
chaithanyarss | 187:2c7263530c57 | 12 | void CDMS_HK_SD(); |
chaithanyarss | 187:2c7263530c57 | 13 | void CDMS_HW_FAULTS(); |
chaithanyarss | 187:2c7263530c57 | 14 | void HANDLE_HW_FAULT_SD(); |
chaithanyarss | 187:2c7263530c57 | 15 | void HANDLE_HW_FAULT_BAE(); |
chaithanyarss | 187:2c7263530c57 | 16 | void HANDLE_HW_FAULT_PL(); |
chaithanyarss | 187:2c7263530c57 | 17 | void COLLECT_CDMS_RAM(); |
shreeshas95 | 103:b55559925dc1 | 18 | |
shreeshas95 | 103:b55559925dc1 | 19 | Serial hk_cdms(USBTX, USBRX); |
shreeshas95 | 103:b55559925dc1 | 20 | |
chaithanyarss | 187:2c7263530c57 | 21 | AnalogIn TempInput(PIN27); // Input from Current Multiplexer |
shreeshas95 | 103:b55559925dc1 | 22 | AnalogIn CDMS_temp_sensor(PIN53); |
chaithanyarss | 187:2c7263530c57 | 23 | AnalogIn COMRX_RSSI_volatge(PIN70); |
chaithanyarss | 187:2c7263530c57 | 24 | |
chaithanyarss | 187:2c7263530c57 | 25 | DigitalIn SD_OC_FAULT (PIN90); |
chaithanyarss | 187:2c7263530c57 | 26 | DigitalOut SD_SW_EN_DS (PIN97); |
chaithanyarss | 187:2c7263530c57 | 27 | DigitalOut BAE_SW_EN_DS (PIN47); |
chaithanyarss | 187:2c7263530c57 | 28 | DigitalOut PL_SW_EN_DS (PIN73); |
chaithanyarss | 187:2c7263530c57 | 29 | |
chaithanyarss | 187:2c7263530c57 | 30 | //GPIO PINS |
chaithanyarss | 187:2c7263530c57 | 31 | DigitalIn V_A_PGOOD (PIN88); |
chaithanyarss | 187:2c7263530c57 | 32 | DigitalIn V_B_PGOOD_1 (PIN6); |
chaithanyarss | 187:2c7263530c57 | 33 | DigitalIn V_B_PGOOD_2 (PIN7); |
chaithanyarss | 187:2c7263530c57 | 34 | DigitalIn V_C_PGOOD (PIN54); |
chaithanyarss | 187:2c7263530c57 | 35 | DigitalIn COMRX_OC_FAULT (PIN68); |
chaithanyarss | 187:2c7263530c57 | 36 | DigitalIn COMTX_OC_FAULT (PIN69); |
chaithanyarss | 187:2c7263530c57 | 37 | DigitalIn BAE_OC_FAULT (PIN92); |
chaithanyarss | 187:2c7263530c57 | 38 | DigitalIn PL_GPIO_1_STATUS (PIN71); |
chaithanyarss | 187:2c7263530c57 | 39 | DigitalIn PL_GPIO_2_STATUS (PIN81); |
chaithanyarss | 187:2c7263530c57 | 40 | DigitalIn PL_GPIO_3_STATUS (PIN80); |
chaithanyarss | 187:2c7263530c57 | 41 | DigitalIn PL_BEE_SW_OC_FAULT (PIN4); |
chaithanyarss | 187:2c7263530c57 | 42 | DigitalIn PL_EPS_LATCH_SW_OC_FAULT (); |
chaithanyarss | 187:2c7263530c57 | 43 | DigitalIn V_C_EN_STATUS (); |
chaithanyarss | 187:2c7263530c57 | 44 | DigitalIn V_D_EN_STATUS (); |
shreeshas95 | 103:b55559925dc1 | 45 | |
shreeshas95 | 103:b55559925dc1 | 46 | DigitalOut SelectLinec3 (PIN79); // MSB of Select Lines |
shreeshas95 | 103:b55559925dc1 | 47 | DigitalOut SelectLinec2 (PIN78); |
shreeshas95 | 103:b55559925dc1 | 48 | DigitalOut SelectLinec1 (PIN77); |
shreeshas95 | 103:b55559925dc1 | 49 | DigitalOut SelectLinec0 (PIN76); // LSB of Select Lines |
shreeshas95 | 103:b55559925dc1 | 50 | |
shreeshas95 | 104:a50ae79ca36e | 51 | void FCTN_CDMS_HK_MAIN(void const *args) |
shreeshas95 | 103:b55559925dc1 | 52 | { |
chaithanyarss | 206:fba4aeebf004 | 53 | |
chaithanyarss | 206:fba4aeebf004 | 54 | uint8_t CDMS_HEALTH_DATA[128] = {0}; |
chaithanyarss | 206:fba4aeebf004 | 55 | unsigned char CDMS_HK_FRAME[134] = {0}; |
chaithanyarss | 206:fba4aeebf004 | 56 | char BAE_HK[128] = {0}; |
chaithanyarss | 206:fba4aeebf004 | 57 | uint8_t convoluted_CDMS_HK[270]; |
chaithanyarss | 206:fba4aeebf004 | 58 | uint8_t interleave_CDMS_HK[288]; |
chaithanyarss | 206:fba4aeebf004 | 59 | uint8_t CDMS_HEALTH_FINAL[512] = {0}; |
chaithanyarss | 206:fba4aeebf004 | 60 | uint8_t convoluted_BAE_HK[270]; |
chaithanyarss | 206:fba4aeebf004 | 61 | uint8_t interleave_BAE_HK[288]; |
chaithanyarss | 206:fba4aeebf004 | 62 | uint8_t BAE_HEALTH_FINAL[512] = {0}; |
chaithanyarss | 206:fba4aeebf004 | 63 | unsigned char BAE_HK_FRAME[134] = {0}; |
chaithanyarss | 206:fba4aeebf004 | 64 | |
chaithanyarss | 187:2c7263530c57 | 65 | CDMS_HK_MAIN_STATUS = 0x01; |
chaithanyarss | 187:2c7263530c57 | 66 | CDMS_HK_MAIN_COUNTER++; |
chaithanyarss | 187:2c7263530c57 | 67 | |
chaithanyarss | 187:2c7263530c57 | 68 | FCTN_CDMS_HK(); |
chaithanyarss | 187:2c7263530c57 | 69 | RSSI_volatge = COMRX_RSSI_volatge.read() * 3.3; |
chaithanyarss | 187:2c7263530c57 | 70 | VERIFY_COMRX(); |
chaithanyarss | 187:2c7263530c57 | 71 | VERIFY_RTC(); |
chaithanyarss | 187:2c7263530c57 | 72 | HANDLE_HW_FAULTS(); |
chaithanyarss | 187:2c7263530c57 | 73 | FUNC_CDMS_GPIO_STATUS(); //yet to be done |
chaithanyarss | 187:2c7263530c57 | 74 | |
chaithanyarss | 187:2c7263530c57 | 75 | uint8_t CDMS_quant[19]; |
chaithanyarss | 187:2c7263530c57 | 76 | for(int i=0;i<16;i++) |
chaithanyarss | 187:2c7263530c57 | 77 | { |
chaithanyarss | 187:2c7263530c57 | 78 | CDMS_quant[i]= (uint8_t)quant_data.temp_quant[i]; |
chaithanyarss | 187:2c7263530c57 | 79 | } |
chaithanyarss | 187:2c7263530c57 | 80 | CDMS_quant[16]= (uint8_t)RSSI_volatge; |
chaithanyarss | 187:2c7263530c57 | 81 | CDMS_quant[17]= (uint8_t)quant_data.CDMS_temp_quant; |
chaithanyarss | 187:2c7263530c57 | 82 | |
chaithanyarss | 187:2c7263530c57 | 83 | |
chaithanyarss | 206:fba4aeebf004 | 84 | uint64_t time = FCTN_CDMS_RD_RTC(); //Reading Time from RTC |
chaithanyarss | 187:2c7263530c57 | 85 | time = time>>7; |
chaithanyarss | 187:2c7263530c57 | 86 | uint32_t HK_time = (uint32_t)time; |
chaithanyarss | 187:2c7263530c57 | 87 | for(int i = 0;i<4;i++) |
chaithanyarss | 187:2c7263530c57 | 88 | CDMS_HEALTH_DATA[i] = HK_time[i]; |
chaithanyarss | 206:fba4aeebf004 | 89 | |
chaithanyarss | 187:2c7263530c57 | 90 | // Here: Have to FIT flash data. |
chaithanyarss | 206:fba4aeebf004 | 91 | for(int i = 0;i<19;i++) //Collecting Data from Temp sensors |
chaithanyarss | 206:fba4aeebf004 | 92 | CDMS_HEALTH_DATA[i+24] = CDMS_quant[i]; |
chaithanyarss | 206:fba4aeebf004 | 93 | |
chaithanyarss | 206:fba4aeebf004 | 94 | COLLECT_CDMS_RAM(); //Reading RAM parameters |
chaithanyarss | 187:2c7263530c57 | 95 | |
chaithanyarss | 206:fba4aeebf004 | 96 | CDMS_HEALTH_DATA[126] = GPIO_STATUS; //Reading GPIO Pins |
chaithanyarss | 206:fba4aeebf004 | 97 | CDMS_HEALTH_DATA[127] = GPIO_STATUS >> 8; |
chaithanyarss | 206:fba4aeebf004 | 98 | |
chaithanyarss | 206:fba4aeebf004 | 99 | FCTN_SD_MNGR(); //Adding FSC & TMID to TM frame |
chaithanyarss | 206:fba4aeebf004 | 100 | CDMS_HK_FRAME[0] = 0x20; |
chaithanyarss | 206:fba4aeebf004 | 101 | CDMS_HK_FRAME[1] = FSC_CURRENT[4]+1; |
chaithanyarss | 206:fba4aeebf004 | 102 | CDMS_HK_FRAME[2] = (FSC_CURRENT[4]+1) >> 8; |
chaithanyarss | 206:fba4aeebf004 | 103 | CDMS_HK_FRAME[3] = (FSC_CURRENT[4]+1) >> 16; |
chaithanyarss | 206:fba4aeebf004 | 104 | |
chaithanyarss | 206:fba4aeebf004 | 105 | for(int i = 0;i<128;i++) /*Adding actual CDMS Health data to TM frame*/ |
chaithanyarss | 206:fba4aeebf004 | 106 | CDMS_HK_FRAME[4+i] = CDMS_HEALTH_DATA[i]; |
chaithanyarss | 187:2c7263530c57 | 107 | |
chaithanyarss | 206:fba4aeebf004 | 108 | uint16_t crc = crc16_gen(CDMS_HK_FRAME,132); /*Adding CRC to TM frame*/ |
chaithanyarss | 206:fba4aeebf004 | 109 | CDMS_HK_FRAME[133] = crc; |
chaithanyarss | 206:fba4aeebf004 | 110 | CDMS_HK_FRAME[132] = crc >> 8; |
chaithanyarss | 206:fba4aeebf004 | 111 | |
chaithanyarss | 206:fba4aeebf004 | 112 | Convolution CDMS_HEALTH; |
chaithanyarss | 206:fba4aeebf004 | 113 | Convolution BAE_HEALTH; |
chaithanyarss | 206:fba4aeebf004 | 114 | CDMS_HEALTH.convolutionEncode(CDMS_HK_FRAME , convoluted_CDMS_HK); |
chaithanyarss | 206:fba4aeebf004 | 115 | CDMS_HEALTH.convolutionEncode(CDMS_HK_FRAME + 67, convoluted_CDMS_HK + 135); |
chaithanyarss | 206:fba4aeebf004 | 116 | interleave(convoluted_CDMS_HK , interleave_CDMS_HK); |
chaithanyarss | 206:fba4aeebf004 | 117 | interleave(convoluted_CDMS_HK +135, interleave_CDMS_HK + 144); |
chaithanyarss | 206:fba4aeebf004 | 118 | for(int i=0;i<288;i++) |
chaithanyarss | 206:fba4aeebf004 | 119 | CDMS_HEALTH_FINAL[i] = interleave_CDMS_HK[i]; |
chaithanyarss | 206:fba4aeebf004 | 120 | |
chaithanyarss | 206:fba4aeebf004 | 121 | SD_WRITE(CDMS_HEALTH_FINAL,FSC_CURRENT[4]+1,4); |
chaithanyarss | 206:fba4aeebf004 | 122 | hk_cdms.printf("CDMS hk succesfully completed\r\n"); |
chaithanyarss | 206:fba4aeebf004 | 123 | |
chaithanyarss | 206:fba4aeebf004 | 124 | |
chaithanyarss | 206:fba4aeebf004 | 125 | /*---------------------------------- BAE HK --------------------------------------------*/ |
chaithanyarss | 206:fba4aeebf004 | 126 | |
chaithanyarss | 206:fba4aeebf004 | 127 | BAE_HK_I2C = FCTN_I2C_READ(BAE_HK,134); |
chaithanyarss | 206:fba4aeebf004 | 128 | if(BAE_HK_I2C == 0){ |
chaithanyarss | 206:fba4aeebf004 | 129 | TIME_LATEST_I2C_SPEED = FCTN_CDMS_RD_RTC() >> 7; |
chaithanyarss | 206:fba4aeebf004 | 130 | hk_cdms.printf("Bae hk data received"); |
chaithanyarss | 187:2c7263530c57 | 131 | } |
chaithanyarss | 206:fba4aeebf004 | 132 | else |
chaithanyarss | 206:fba4aeebf004 | 133 | { |
chaithanyarss | 206:fba4aeebf004 | 134 | for(int i = 0;i<128;i++) |
chaithanyarss | 206:fba4aeebf004 | 135 | BAE_HK[i] = 0; |
chaithanyarss | 206:fba4aeebf004 | 136 | } |
chaithanyarss | 206:fba4aeebf004 | 137 | for(int i = 0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 138 | BAE_HK[i] = HK_time[i]; |
chaithanyarss | 206:fba4aeebf004 | 139 | BAE_HK_FRAME[0] = 0x28; |
chaithanyarss | 206:fba4aeebf004 | 140 | BAE_HK_FRAME[1] = FSC_CURRENT[5]+1; |
chaithanyarss | 206:fba4aeebf004 | 141 | BAE_HK_FRAME[2] = (FSC_CURRENT[5]+1) >> 8; |
chaithanyarss | 206:fba4aeebf004 | 142 | BAE_HK_FRAME[3] = (FSC_CURRENT[5]+1) >> 16; |
chaithanyarss | 206:fba4aeebf004 | 143 | for(int i = 0;i<128;i++) /*Adding actual CDMS Health data to TM frame*/ |
chaithanyarss | 206:fba4aeebf004 | 144 | BAE_HK_FRAME[4+i] = BAE_HK[i]; |
chaithanyarss | 206:fba4aeebf004 | 145 | crc = crc16_gen(BAE_HK_FRAME,132); /*Adding CRC to TM frame*/ |
chaithanyarss | 206:fba4aeebf004 | 146 | BAE_HK_FRAME[133] = crc; |
chaithanyarss | 206:fba4aeebf004 | 147 | BAE_HK_FRAME[132] = crc >> 8; |
chaithanyarss | 206:fba4aeebf004 | 148 | BAE_HEALTH.convolutionEncode(BAE_HK_FRAME , convoluted_BAE_HK); |
chaithanyarss | 206:fba4aeebf004 | 149 | BAE_HEALTH.convolutionEncode(BAE_HK_FRAME + 67, convoluted_BAE_HK + 135); |
chaithanyarss | 206:fba4aeebf004 | 150 | interleave(convoluted_BAE_HK , interleave_BAE_HK); |
chaithanyarss | 206:fba4aeebf004 | 151 | interleave(convoluted_BAE_HK +135, interleave_BAE_HK + 144); |
chaithanyarss | 206:fba4aeebf004 | 152 | for(int i=0;i<288;i++) |
chaithanyarss | 206:fba4aeebf004 | 153 | BAE_HEALTH_FINAL[i] = interleave_BAE_HK[i]; |
chaithanyarss | 206:fba4aeebf004 | 154 | SD_WRITE(BAE_HEALTH_FINAL,FSC_CURRENT[5]+1,5); |
chaithanyarss | 206:fba4aeebf004 | 155 | hk_cdms.printf("BAE hk succesfully completed\r\n"); |
shreeshas95 | 103:b55559925dc1 | 156 | } |
shreeshas95 | 103:b55559925dc1 | 157 | |
shreeshas95 | 103:b55559925dc1 | 158 | int quantiz(float start,float step,float x) |
shreeshas95 | 103:b55559925dc1 | 159 | { |
shreeshas95 | 103:b55559925dc1 | 160 | int y=(x-start)/step; |
shreeshas95 | 103:b55559925dc1 | 161 | if(y<=0)y=0; |
shreeshas95 | 103:b55559925dc1 | 162 | if(y>=255)y=255; |
shreeshas95 | 103:b55559925dc1 | 163 | return y; |
shreeshas95 | 103:b55559925dc1 | 164 | } |
shreeshas95 | 103:b55559925dc1 | 165 | |
chaithanyarss | 187:2c7263530c57 | 166 | void saveMin(char x,char y) |
chaithanyarss | 187:2c7263530c57 | 167 | { |
chaithanyarss | 187:2c7263530c57 | 168 | return (y<x)?y:x; |
shreeshas95 | 103:b55559925dc1 | 169 | } |
chaithanyarss | 187:2c7263530c57 | 170 | |
chaithanyarss | 187:2c7263530c57 | 171 | void saveMax(char x,char y) |
chaithanyarss | 187:2c7263530c57 | 172 | { |
chaithanyarss | 187:2c7263530c57 | 173 | return (y>x)?y:x; |
shreeshas95 | 103:b55559925dc1 | 174 | } |
chaithanyarss | 187:2c7263530c57 | 175 | |
chaithanyarss | 187:2c7263530c57 | 176 | void minMaxHkData() |
chaithanyarss | 187:2c7263530c57 | 177 | { |
shreeshas95 | 103:b55559925dc1 | 178 | if(firstCount==true){ |
shreeshas95 | 103:b55559925dc1 | 179 | for (int i = 0; i < 16; ++i){ |
shreeshas95 | 103:b55559925dc1 | 180 | min_max_data.temp_min[i] = quant_data.temp_quant[i]; |
shreeshas95 | 103:b55559925dc1 | 181 | min_max_data.temp_max[i] = quant_data.temp_quant[i]; |
shreeshas95 | 103:b55559925dc1 | 182 | } |
shreeshas95 | 103:b55559925dc1 | 183 | |
shreeshas95 | 103:b55559925dc1 | 184 | min_max_data.CDMS_temp_min=quant_data.CDMS_temp_quant; |
shreeshas95 | 103:b55559925dc1 | 185 | min_max_data.CDMS_temp_max=quant_data.CDMS_temp_quant; |
shreeshas95 | 103:b55559925dc1 | 186 | } |
shreeshas95 | 103:b55559925dc1 | 187 | else { |
shreeshas95 | 103:b55559925dc1 | 188 | for (int i = 0; i < 16; ++i) |
shreeshas95 | 103:b55559925dc1 | 189 | { |
chaithanyarss | 187:2c7263530c57 | 190 | min_max_data.temp_min[i] = saveMin(min_max_data.temp_min[i],quant_data.temp_quant[i]); |
chaithanyarss | 187:2c7263530c57 | 191 | min_max_data.temp_max[i] = saveMax(min_max_data.temp_max[i],quant_data.temp_quant[i]); |
shreeshas95 | 103:b55559925dc1 | 192 | } |
shreeshas95 | 103:b55559925dc1 | 193 | |
chaithanyarss | 187:2c7263530c57 | 194 | min_max_data.CDMS_temp_min = saveMin(min_max_data.CDMS_temp_min,quant_data.CDMS_temp_quant); |
chaithanyarss | 187:2c7263530c57 | 195 | min_max_data.CDMS_temp_max = saveMax(min_max_data.CDMS_temp_max,quant_data.CDMS_temp_quant); |
shreeshas95 | 103:b55559925dc1 | 196 | } |
shreeshas95 | 103:b55559925dc1 | 197 | firstCount=false; |
shreeshas95 | 103:b55559925dc1 | 198 | } |
shreeshas95 | 103:b55559925dc1 | 199 | |
shreeshas95 | 103:b55559925dc1 | 200 | void FCTN_CDMS_HK() |
shreeshas95 | 103:b55559925dc1 | 201 | { |
shreeshas95 | 103:b55559925dc1 | 202 | |
shreeshas95 | 103:b55559925dc1 | 203 | int Iteration=0; |
shreeshas95 | 103:b55559925dc1 | 204 | |
shreeshas95 | 103:b55559925dc1 | 205 | SelectLinec0=0; |
shreeshas95 | 103:b55559925dc1 | 206 | SelectLinec1=0; |
shreeshas95 | 103:b55559925dc1 | 207 | SelectLinec2=0; |
shreeshas95 | 103:b55559925dc1 | 208 | SelectLinec3=0; |
shreeshas95 | 103:b55559925dc1 | 209 | |
shreeshas95 | 103:b55559925dc1 | 210 | for(Iteration=0; Iteration<16; Iteration++){ |
shreeshas95 | 103:b55559925dc1 | 211 | |
shreeshas95 | 103:b55559925dc1 | 212 | actual_data.temp_actual[Iteration]=TempInput.read(); |
shreeshas95 | 103:b55559925dc1 | 213 | |
shreeshas95 | 103:b55559925dc1 | 214 | SelectLinec0=!(SelectLinec0); |
shreeshas95 | 103:b55559925dc1 | 215 | if(Iteration%2==1) |
shreeshas95 | 103:b55559925dc1 | 216 | SelectLinec1=!(SelectLinec1); |
shreeshas95 | 103:b55559925dc1 | 217 | if(Iteration%4==3) |
shreeshas95 | 103:b55559925dc1 | 218 | SelectLinec2=!(SelectLinec2); |
chaithanyarss | 187:2c7263530c57 | 219 | if(Iteration%8==7) [0] |
shreeshas95 | 103:b55559925dc1 | 220 | SelectLinec3=!(SelectLinec3); |
shreeshas95 | 103:b55559925dc1 | 221 | } |
shreeshas95 | 103:b55559925dc1 | 222 | |
chaithanyarss | 187:2c7263530c57 | 223 | actual_data.CDMS_temp_actual=(-90.7*3.3*CDMS_temp_sensor.read())+190.1543; |
shreeshas95 | 103:b55559925dc1 | 224 | |
shreeshas95 | 103:b55559925dc1 | 225 | for(Iteration=0;Iteration<16;Iteration++){ |
shreeshas95 | 103:b55559925dc1 | 226 | |
shreeshas95 | 103:b55559925dc1 | 227 | if(Iteration<14){ |
shreeshas95 | 103:b55559925dc1 | 228 | |
shreeshas95 | 103:b55559925dc1 | 229 | actual_data.temp_actual[Iteration]=actual_data.temp_actual[Iteration]*3.3; |
shreeshas95 | 103:b55559925dc1 | 230 | int resistance; |
shreeshas95 | 103:b55559925dc1 | 231 | |
shreeshas95 | 103:b55559925dc1 | 232 | resistance=24000*actual_data.temp_actual[Iteration]/(3.3-actual_data.temp_actual[Iteration]); |
shreeshas95 | 103:b55559925dc1 | 233 | if(actual_data.temp_actual[Iteration]>1.47) |
shreeshas95 | 103:b55559925dc1 | 234 | { |
shreeshas95 | 103:b55559925dc1 | 235 | actual_data.temp_actual[Iteration]=3694/log(24.032242*resistance); |
shreeshas95 | 103:b55559925dc1 | 236 | } |
shreeshas95 | 103:b55559925dc1 | 237 | else{ |
shreeshas95 | 103:b55559925dc1 | 238 | |
shreeshas95 | 103:b55559925dc1 | 239 | actual_data.temp_actual[Iteration]=3365.4/log(7.60573*resistance); |
shreeshas95 | 103:b55559925dc1 | 240 | } |
shreeshas95 | 103:b55559925dc1 | 241 | } |
shreeshas95 | 103:b55559925dc1 | 242 | else |
shreeshas95 | 103:b55559925dc1 | 243 | actual_data.temp_actual[Iteration]=(-90.7*3.3*actual_data.temp_actual[Iteration])+190.1543; |
shreeshas95 | 103:b55559925dc1 | 244 | } |
shreeshas95 | 103:b55559925dc1 | 245 | |
shreeshas95 | 103:b55559925dc1 | 246 | for(Iteration=0;Iteration<16;Iteration++){ |
shreeshas95 | 103:b55559925dc1 | 247 | |
shreeshas95 | 103:b55559925dc1 | 248 | if(Iteration<14){ |
shreeshas95 | 103:b55559925dc1 | 249 | |
shreeshas95 | 103:b55559925dc1 | 250 | quant_data.temp_quant[Iteration]=quantiz(tstart_thermistor,tstep_thermistor,actual_data.temp_actual[Iteration]); |
shreeshas95 | 103:b55559925dc1 | 251 | } |
shreeshas95 | 103:b55559925dc1 | 252 | else |
shreeshas95 | 103:b55559925dc1 | 253 | quant_data.temp_quant[Iteration]=quantiz(tstart,tstep,actual_data.temp_actual[Iteration]); |
shreeshas95 | 103:b55559925dc1 | 254 | } |
shreeshas95 | 103:b55559925dc1 | 255 | |
shreeshas95 | 103:b55559925dc1 | 256 | quant_data.CDMS_temp_quant=quantiz(tstart,tstep,actual_data.CDMS_temp_actual); |
shreeshas95 | 103:b55559925dc1 | 257 | |
shreeshas95 | 103:b55559925dc1 | 258 | minMaxHkData(); |
chaithanyarss | 187:2c7263530c57 | 259 | } |
chaithanyarss | 187:2c7263530c57 | 260 | |
chaithanyarss | 187:2c7263530c57 | 261 | void FUNC_CDMS_GPIO_STATUS() //Polls the status of Input GPIO PINS |
chaithanyarss | 187:2c7263530c57 | 262 | { |
chaithanyarss | 187:2c7263530c57 | 263 | //V_A_PGOOD //TRZ EN |
chaithanyarss | 187:2c7263530c57 | 264 | GPIO_STATUS=(V_A_PGOOD)?(GPIO_STATUS)||((uint16_t)(0x1<<15)):(GPIO_STATUS)&(~((uint16_t)(0x1<<15))); |
chaithanyarss | 187:2c7263530c57 | 265 | //V_B_PGOOD_1 //3V3BPGOOD //$ |
chaithanyarss | 187:2c7263530c57 | 266 | GPIO_STATUS=(V_B_PGOOD_1)?(GPIO_STATUS)||((uint16_t)(0x1<<14)):(GPIO_STATUS)&(~((uint16_t)(0x1<<14))); |
chaithanyarss | 187:2c7263530c57 | 267 | //V_B_PGOOD_2 //3V3BEN //$ |
chaithanyarss | 187:2c7263530c57 | 268 | GPIO_STATUS=(V_B_PGOOD_2)?(GPIO_STATUS)||((uint16_t)(0x1<<13)):(GPIO_STATUS)&(~((uint16_t)(0x1<<13))); |
chaithanyarss | 187:2c7263530c57 | 269 | //V_C_PGOOD //3V3CPGOOD //$ |
chaithanyarss | 187:2c7263530c57 | 270 | GPIO_STATUS=(V_C_PGOOD)?(GPIO_STATUS)||((uint16_t)(0x1<<12)):(GPIO_STATUS)&(~((uint16_t)(0x1<<12))); |
chaithanyarss | 187:2c7263530c57 | 271 | //COMRX_OC_FAULT //$ |
chaithanyarss | 187:2c7263530c57 | 272 | GPIO_STATUS=(COMRX_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<11)):(GPIO_STATUS)&(~((uint16_t)(0x1<<11))); |
chaithanyarss | 187:2c7263530c57 | 273 | // COMTX_OC_FAULT //$ |
chaithanyarss | 187:2c7263530c57 | 274 | GPIO_STATUS=(COMTX_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<10)):(GPIO_STATUS)&(~((uint16_t)(0x1<<10))); |
chaithanyarss | 187:2c7263530c57 | 275 | //BAE_OC_FAULT //$ |
chaithanyarss | 187:2c7263530c57 | 276 | GPIO_STATUS=(BAE_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<9)):(GPIO_STATUS)&(~((uint16_t)(0x1<<9))); |
chaithanyarss | 187:2c7263530c57 | 277 | //PL_GPIO_1_STATUS //$ |
chaithanyarss | 187:2c7263530c57 | 278 | GPIO_STATUS=(PL_GPIO_1_STATUS)?(GPIO_STATUS)||((uint16_t)(0x1<<8)):(GPIO_STATUS)&(~((uint16_t)(0x1<<8))); |
chaithanyarss | 187:2c7263530c57 | 279 | //PL_GPIO_2_STATUS //$ |
chaithanyarss | 187:2c7263530c57 | 280 | GPIO_STATUS=(PL_GPIO_2_STATUS)?(GPIO_STATUS)||((uint16_t)(0x1<<7)):(GPIO_STATUS)&(~((uint16_t)(0x1<<7))); |
chaithanyarss | 187:2c7263530c57 | 281 | //PL_GPIO_3_STATUS //$ |
chaithanyarss | 187:2c7263530c57 | 282 | GPIO_STATUS=(PL_GPIO_3_STATUS)?(GPIO_STATUS)||((uint16_t)(0x1<<6)):(GPIO_STATUS)&(~((uint16_t)(0x1<<6))); |
chaithanyarss | 187:2c7263530c57 | 283 | //PL_BEE_SW_OC_FAULT //to be verified |
chaithanyarss | 187:2c7263530c57 | 284 | GPIO_STATUS=(PL_BEE_SW_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<5)):(GPIO_STATUS)&(~((uint16_t)(0x1<<5))); |
chaithanyarss | 187:2c7263530c57 | 285 | //PL_EPS_LATCH_SW_OC_FAULT // to be verified |
chaithanyarss | 187:2c7263530c57 | 286 | GPIO_STATUS=(PL_EPS_LATCH_SW_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<4)):(GPIO_STATUS)&(~((uint16_t)(0x1<<4))); |
chaithanyarss | 187:2c7263530c57 | 287 | |
chaithanyarss | 187:2c7263530c57 | 288 | } |
chaithanyarss | 187:2c7263530c57 | 289 | |
chaithanyarss | 187:2c7263530c57 | 290 | void VERIFY_COMRX() |
chaithanyarss | 187:2c7263530c57 | 291 | { |
chaithanyarss | 187:2c7263530c57 | 292 | //COMRX_OC_FAULT //$ |
chaithanyarss | 187:2c7263530c57 | 293 | if(PIN68==0 && RSSI_volatge > 0.4) |
chaithanyarss | 187:2c7263530c57 | 294 | COMRX_STATUS = COMRX_ALIVE; |
chaithanyarss | 187:2c7263530c57 | 295 | else |
chaithanyarss | 187:2c7263530c57 | 296 | { |
chaithanyarss | 187:2c7263530c57 | 297 | RESET_COMRX(); |
chaithanyarss | 187:2c7263530c57 | 298 | COMRX_RESET_COUNTER++; |
chaithanyarss | 187:2c7263530c57 | 299 | if(PIN68==0 && RSSI_volatge > 0.4) |
chaithanyarss | 187:2c7263530c57 | 300 | COMRX_STATUS = COMRX_ALIVE; |
chaithanyarss | 187:2c7263530c57 | 301 | else |
chaithanyarss | 187:2c7263530c57 | 302 | COMRX_STATUS = COMRX_DEAD; |
chaithanyarss | 187:2c7263530c57 | 303 | } |
chaithanyarss | 187:2c7263530c57 | 304 | } |
chaithanyarss | 187:2c7263530c57 | 305 | |
chaithanyarss | 187:2c7263530c57 | 306 | void VERIFY_RTC(){ |
chaithanyarss | 187:2c7263530c57 | 307 | |
chaithanyarss | 187:2c7263530c57 | 308 | if(RTC_STATUS = 0x00) |
chaithanyarss | 187:2c7263530c57 | 309 | { |
chaithanyarss | 187:2c7263530c57 | 310 | SPI_mutex.lock(); |
chaithanyarss | 187:2c7263530c57 | 311 | gCS_RTC=1; |
chaithanyarss | 187:2c7263530c57 | 312 | gCS_RTC=0; |
chaithanyarss | 187:2c7263530c57 | 313 | spi.write(0x0F); |
chaithanyarss | 187:2c7263530c57 | 314 | if(spi.write(0x00) & 0x04 == 0x04) |
chaithanyarss | 187:2c7263530c57 | 315 | { |
chaithanyarss | 187:2c7263530c57 | 316 | RTC_STATUS = Not_started; |
chaithanyarss | 187:2c7263530c57 | 317 | RESET_RTC(); |
chaithanyarss | 187:2c7263530c57 | 318 | RTC_FAULTCOUNT++; |
chaithanyarss | 187:2c7263530c57 | 319 | } |
chaithanyarss | 187:2c7263530c57 | 320 | gCS_RTC=1; |
chaithanyarss | 187:2c7263530c57 | 321 | SPI_mutex.unlock(); |
chaithanyarss | 187:2c7263530c57 | 322 | } |
chaithanyarss | 187:2c7263530c57 | 323 | } |
chaithanyarss | 187:2c7263530c57 | 324 | |
chaithanyarss | 187:2c7263530c57 | 325 | void HANDLE_HW_FAULTS() |
chaithanyarss | 187:2c7263530c57 | 326 | { |
chaithanyarss | 187:2c7263530c57 | 327 | HANDLE_HW_FAULT_SD(); |
chaithanyarss | 187:2c7263530c57 | 328 | HANDLE_HW_FAULT_BAE(); |
chaithanyarss | 187:2c7263530c57 | 329 | HANDLE_HW_FAULT_PL() |
chaithanyarss | 187:2c7263530c57 | 330 | } |
chaithanyarss | 187:2c7263530c57 | 331 | |
chaithanyarss | 187:2c7263530c57 | 332 | void HANDLE_HW_FAULT_SD() |
chaithanyarss | 187:2c7263530c57 | 333 | { |
chaithanyarss | 187:2c7263530c57 | 334 | if(SD_STATUS != DEVICE_DISABLED) |
chaithanyarss | 187:2c7263530c57 | 335 | { |
chaithanyarss | 187:2c7263530c57 | 336 | if(SD_STATUS = DEVICE_OC_FAULT) |
chaithanyarss | 187:2c7263530c57 | 337 | SD_SW_EN_DS = 0; //powering on SD |
chaithanyarss | 187:2c7263530c57 | 338 | |
chaithanyarss | 187:2c7263530c57 | 339 | if(SD_OC_FAULT == 0) |
chaithanyarss | 187:2c7263530c57 | 340 | { |
chaithanyarss | 187:2c7263530c57 | 341 | SD_SW_EN_DS = 1; //switching off SD card |
chaithanyarss | 187:2c7263530c57 | 342 | |
chaithanyarss | 187:2c7263530c57 | 343 | SD_FAULTCOUNT++; |
chaithanyarss | 187:2c7263530c57 | 344 | SD_STATUS = (SD_FAULTCOUNT == 3)?DEVICE_DISABLED:DEVICE_OC_FAULT; |
chaithanyarss | 187:2c7263530c57 | 345 | } |
chaithanyarss | 187:2c7263530c57 | 346 | else |
chaithanyarss | 187:2c7263530c57 | 347 | { |
chaithanyarss | 187:2c7263530c57 | 348 | SD_STATUS = DEVICE_POWERED; |
chaithanyarss | 187:2c7263530c57 | 349 | SD_FAULTCOUNT = 0; |
chaithanyarss | 187:2c7263530c57 | 350 | } |
chaithanyarss | 187:2c7263530c57 | 351 | } |
chaithanyarss | 187:2c7263530c57 | 352 | } |
chaithanyarss | 187:2c7263530c57 | 353 | |
chaithanyarss | 187:2c7263530c57 | 354 | void HANDLE_HW_FAULT_BAE() |
chaithanyarss | 187:2c7263530c57 | 355 | { |
chaithanyarss | 187:2c7263530c57 | 356 | if(BAE_STATUS != DEVICE_DISABLED) |
chaithanyarss | 187:2c7263530c57 | 357 | { |
chaithanyarss | 187:2c7263530c57 | 358 | if(BAE_STATUS = DEVICE_OC_FAULT) |
chaithanyarss | 206:fba4aeebf004 | 359 | BAE_SW_EN_DS = 0; //Power ON BAE |
chaithanyarss | 187:2c7263530c57 | 360 | |
chaithanyarss | 187:2c7263530c57 | 361 | if(BAE_OC_FAULT == 0) // If OC Fault |
chaithanyarss | 187:2c7263530c57 | 362 | { |
chaithanyarss | 206:fba4aeebf004 | 363 | BAE_SW_EN_DS = 1; //Switch OFF BAE |
chaithanyarss | 187:2c7263530c57 | 364 | BAE_FAULTCOUNT++; |
chaithanyarss | 187:2c7263530c57 | 365 | BAE_STATUS = (BAE_FAULTCOUNT == 3)?DEVICE_DISABLED:DEVICE_OC_FAULT; |
chaithanyarss | 187:2c7263530c57 | 366 | } |
chaithanyarss | 187:2c7263530c57 | 367 | else |
chaithanyarss | 187:2c7263530c57 | 368 | { |
chaithanyarss | 187:2c7263530c57 | 369 | BAE_STATUS = DEVICE_POWERED; |
chaithanyarss | 187:2c7263530c57 | 370 | BAE_FAULTCOUNT = 0; |
chaithanyarss | 187:2c7263530c57 | 371 | } |
chaithanyarss | 187:2c7263530c57 | 372 | } |
chaithanyarss | 187:2c7263530c57 | 373 | } |
chaithanyarss | 187:2c7263530c57 | 374 | |
chaithanyarss | 187:2c7263530c57 | 375 | void HANDLE_HW_FAULT_PL() |
chaithanyarss | 187:2c7263530c57 | 376 | { |
chaithanyarss | 187:2c7263530c57 | 377 | if(PL_STATUS != DEVICE_DISABLED) |
chaithanyarss | 187:2c7263530c57 | 378 | { |
chaithanyarss | 187:2c7263530c57 | 379 | if(PL_STATUS = DEVICE_OC_FAULT) |
chaithanyarss | 206:fba4aeebf004 | 380 | PL_SW_EN_DS = 0; //Power ON PL |
chaithanyarss | 187:2c7263530c57 | 381 | |
chaithanyarss | 206:fba4aeebf004 | 382 | if(PL_BEE_SW_OC_FAULT == 0) // if OC Fault |
chaithanyarss | 187:2c7263530c57 | 383 | { |
chaithanyarss | 206:fba4aeebf004 | 384 | PL_SW_EN_DS = 1; // switching OFF PL |
chaithanyarss | 187:2c7263530c57 | 385 | PL_FAULTCOUNT++; |
chaithanyarss | 187:2c7263530c57 | 386 | PL_STATUS = (PL_FAULTCOUNT == 3)?DEVICE_DISABLED:DEVICE_OC_FAULT; |
chaithanyarss | 187:2c7263530c57 | 387 | } |
chaithanyarss | 187:2c7263530c57 | 388 | else |
chaithanyarss | 187:2c7263530c57 | 389 | { |
chaithanyarss | 187:2c7263530c57 | 390 | if(PL_STATUS == DEVICE_OC_FAULT) |
chaithanyarss | 187:2c7263530c57 | 391 | PL_SW_EN_DS = 0; //Switching OFF PL |
chaithanyarss | 187:2c7263530c57 | 392 | PL_STATUS = DEVICE_ENABLED; |
chaithanyarss | 187:2c7263530c57 | 393 | PL_FAULTCOUNT = 0; |
chaithanyarss | 187:2c7263530c57 | 394 | } |
chaithanyarss | 187:2c7263530c57 | 395 | } |
chaithanyarss | 187:2c7263530c57 | 396 | |
chaithanyarss | 187:2c7263530c57 | 397 | void COLLECT_CDMS_RAM() |
chaithanyarss | 187:2c7263530c57 | 398 | { |
chaithanyarss | 187:2c7263530c57 | 399 | /*--------------------Current FSC's---------------------*/\ |
chaithanyarss | 187:2c7263530c57 | 400 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 401 | CDMS_HEALTH_DATA[i+43] = FSC_LAST[5] >> (i*8); |
chaithanyarss | 206:fba4aeebf004 | 402 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 403 | CDMS_HEALTH_DATA[i+47] = FSC_CURRENT[5] >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 404 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 405 | CDMS_HEALTH_DATA[i+51] = FSC_LAST[4] >> (i*8); |
chaithanyarss | 206:fba4aeebf004 | 406 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 407 | CDMS_HEALTH_DATA[i+55] = FSC_CURRENT[4] >> (i*8); |
chaithanyarss | 206:fba4aeebf004 | 408 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 409 | CDMS_HEALTH_DATA[i+59] = FSC_LAST[3] >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 410 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 411 | CDMS_HEALTH_DATA[i+63] = FSC_CURRENT[3] >> (i*8); |
chaithanyarss | 206:fba4aeebf004 | 412 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 413 | CDMS_HEALTH_DATA[i+67] = FSC_LAST[2] >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 414 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 415 | CDMS_HEALTH_DATA[i+71] = FSC_CURRENT[2] >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 416 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 417 | CDMS_HEALTH_DATA[i+75] = FSC_LAST[1] >> (i*8); |
chaithanyarss | 206:fba4aeebf004 | 418 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 419 | CDMS_HEALTH_DATA[i+79] = FSC_CURRENT[1] >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 420 | /*---------------------Latest Time----------------------*/ |
chaithanyarss | 187:2c7263530c57 | 421 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 422 | CDMS_HEALTH_DATA[i+83] = TIME_LATEST_SPI_SPEED >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 423 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 424 | CDMS_HEALTH_DATA[i+87] = TIME_LATEST_SD_RD >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 425 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 426 | CDMS_HEALTH_DATA[i+91] = TIME_LATEST_SD_WR >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 427 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 428 | CDMS_HEALTH_DATA[i+95] = TIME_LATEST_I2C_SPEED >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 429 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 430 | CDMS_HEALTH_DATA[i+99] = TIME_LATEST_I2C_BAE >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 431 | for(int i=0;i<4;i++) |
chaithanyarss | 206:fba4aeebf004 | 432 | CDMS_HEALTH_DATA[i+103] = TIME_LATEST_RTC >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 433 | for(int i=0;i<2;i++) |
chaithanyarss | 206:fba4aeebf004 | 434 | CDMS_HEALTH_DATA[i+107] = COMRX_RESET_COUNTER >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 435 | for(int i=0;i<2;i++) |
chaithanyarss | 206:fba4aeebf004 | 436 | CDMS_HEALTH_DATA[i+107] = PL_RCV_SC_DATA_COUNTER >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 437 | for(int i=0;i<2;i++) |
chaithanyarss | 206:fba4aeebf004 | 438 | CDMS_HEALTH_DATA[i+111] = PL_MAIN_COUNTER >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 439 | for(int i=0;i<2;i++) |
chaithanyarss | 206:fba4aeebf004 | 440 | CDMS_HEALTH_DATA[i+113] = CDMS_HK_MAIN_COUNTER >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 441 | for(int i=0;i<2;i++) |
chaithanyarss | 206:fba4aeebf004 | 442 | CDMS_HEALTH_DATA[i+115] = CDMS_I2C_ERR_BAE_COUNTER >> (i*8); |
chaithanyarss | 187:2c7263530c57 | 443 | for(int i=0;i<2;i++) |
chaithanyarss | 206:fba4aeebf004 | 444 | CDMS_HEALTH_DATA[i+117] = CDMS_I2C_ERR_SPEED_COUNTER >> (i*8); |
chaithanyarss | 206:fba4aeebf004 | 445 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | CDMS_STANDBY_PL << 7; |
chaithanyarss | 206:fba4aeebf004 | 446 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((CDMS_INIT_STATUS << 6) & 0x40); |
chaithanyarss | 206:fba4aeebf004 | 447 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((CDMS_HK_MAIN_STATUS << 5) & 0x20); |
chaithanyarss | 206:fba4aeebf004 | 448 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((CDMS_HK_STATUS << 3) & 0x18); |
chaithanyarss | 206:fba4aeebf004 | 449 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((COMRX_STATUS << 2) & 0x04); |
chaithanyarss | 206:fba4aeebf004 | 450 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((CDMS_RTC_BL << 1) & 0x02); |
chaithanyarss | 206:fba4aeebf004 | 451 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] & 0xFE; |
chaithanyarss | 187:2c7263530c57 | 452 | |
chaithanyarss | 206:fba4aeebf004 | 453 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | PL_RCV_SC_DATA_STATUS << 7; |
chaithanyarss | 206:fba4aeebf004 | 454 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_SESSION << 6) & 0x40); |
chaithanyarss | 206:fba4aeebf004 | 455 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_RX << 5) & 0x20); |
chaithanyarss | 206:fba4aeebf004 | 456 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((RF_SW_STATUS << 4) & 0x10); |
chaithanyarss | 206:fba4aeebf004 | 457 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_TX << 3) & 0x08); |
chaithanyarss | 206:fba4aeebf004 | 458 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_TX_STATUS << 2) & 0x04); |
chaithanyarss | 206:fba4aeebf004 | 459 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_MNG_TMTC << 1) & 0x02); |
chaithanyarss | 206:fba4aeebf004 | 460 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | (CDMS_STANDBY_HK & 0x01); |
chaithanyarss | 187:2c7263530c57 | 461 | |
chaithanyarss | 206:fba4aeebf004 | 462 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | PL_INIT_STATUS << 7; |
chaithanyarss | 206:fba4aeebf004 | 463 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | ((PL_MAIN_STATUS << 6) & 0x40); |
chaithanyarss | 206:fba4aeebf004 | 464 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | ((PL_LOW_POWER << 5) & 0x20); |
chaithanyarss | 206:fba4aeebf004 | 465 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | ((PL_STATE << 3) & 0x18); |
chaithanyarss | 206:fba4aeebf004 | 466 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | (PL_STATUS & 0x07); |
shreeshas95 | 103:b55559925dc1 | 467 | } |