Repository for CDMS code
Dependencies: SimpleDMA mbed-rtos mbed eeprom
Fork of COM_MNG_TMTC_SIMPLE by
Diff: CDMS_HK.h
- Revision:
- 333:cddef120cae3
- Parent:
- 332:7d2431ce979f
- Child:
- 338:d63eb331a67d
diff -r 7d2431ce979f -r cddef120cae3 CDMS_HK.h --- a/CDMS_HK.h Wed Dec 28 04:25:18 2016 +0000 +++ b/CDMS_HK.h Fri Dec 30 13:31:44 2016 +0000 @@ -15,7 +15,7 @@ AnalogIn TempInput(PIN27); // Input from Current Multiplexer AnalogIn CDMS_temp_sensor(PIN53); -AnalogIn COMRX_RSSI_volatge(PIN70); +AnalogIn COMRX_RSSI_VOLTAGE(PIN70); AnalogIn EPS_BTRY_VOLT (PIN54); DigitalOut SelectLinec3 (PIN79); // MSB of Select Lines @@ -67,7 +67,7 @@ CDMS_HK_MAIN_COUNTER++; FCTN_CDMS_HK(); //collects temperatures - RSSI_volatge = COMRX_RSSI_volatge.read() * 3.3;//to be checked + RSSI_VOLTAGE = COMRX_RSSI_VOLTAGE.read() * 3.3;//to be checked //VERIFY_COMRX(); VERIFY_RTC(); HANDLE_HW_FAULTS(); @@ -76,7 +76,7 @@ uint8_t CDMS_quant[20]; CDMS_quant[0]= COM_ADF_TMP+40; CDMS_quant[1]= (uint8_t)quant_data.CDMS_temp_quant; - CDMS_quant[2]= (uint8_t)RSSI_volatge; + CDMS_quant[2]= (uint8_t)(RSSI_VOLTAGE*10); CDMS_quant[3]= (uint8_t)(EPS_BTRY_VOLT*33*(62.0/11)); for(int i=0; i<16; i++) { CDMS_quant[i+4]= (uint8_t)quant_data.temp_quant[i]; @@ -220,7 +220,7 @@ beacon_array[19] = TIME_LATEST_SPI_SPEED >>16; beacon_array[20] = TIME_LATEST_SPI_SPEED >>8; beacon_array[21] = TIME_LATEST_SPI_SPEED; - beacon_array[22] = (uint8_t)RSSI_volatge; + beacon_array[22] = (uint8_t)(RSSI_VOLTAGE*10); // Add SC bits crc = crc16_gen(beacon_array,132); @@ -258,8 +258,14 @@ void minMaxHkData() { + MAX_COM_ADF_TMP = (MAX_COM_ADF_TMP < COM_ADF_TMP)?COM_ADF_TMP:MAX_COM_ADF_TMP; + MIN_COM_ADF_TMP = (MIN_COM_ADF_TMP > COM_ADF_TMP)?COM_ADF_TMP:MIN_COM_ADF_TMP; + + MAX_RSSI_VOLTAGE = (MAX_RSSI_VOLTAGE < RSSI_VOLTAGE)?RSSI_VOLTAGE:MAX_RSSI_VOLTAGE; + MIN_RSSI_VOLTAGE = (MIN_RSSI_VOLTAGE > RSSI_VOLTAGE)?RSSI_VOLTAGE:MIN_RSSI_VOLTAGE; + if(firstCount==true) { - for (int i = 4; i < 16; ++i) { + for (int i = 0; i < 16; ++i) { min_max_data.temp_min[i] = quant_data.temp_quant[i]; min_max_data.temp_max[i] = quant_data.temp_quant[i]; } @@ -267,11 +273,9 @@ min_max_data.CDMS_temp_min=quant_data.CDMS_temp_quant; min_max_data.CDMS_temp_max=quant_data.CDMS_temp_quant; } else { - for (int i = 4; i < 16; ++i) { + for (int i = 0; i < 16; ++i) { min_max_data.temp_min[i] = saveMin(min_max_data.temp_min[i],quant_data.temp_quant[i]); min_max_data.temp_max[i] = saveMax(min_max_data.temp_max[i],quant_data.temp_quant[i]); - //gPC.printf("\rMax reading, iteration = %d, %d \n",min_max_data.temp_max[i], i); - //gPC.printf("\rMin reading, iteration = %d, %d \n",min_max_data.temp_min[i], i); } min_max_data.CDMS_temp_min = saveMin(min_max_data.CDMS_temp_min,quant_data.CDMS_temp_quant); @@ -391,12 +395,12 @@ void VERIFY_COMRX() { //COMRX_OC_FAULT //$ - if(COMRX_OC_FAULT==0 && RSSI_volatge > 0.4) { + if(COMRX_OC_FAULT==0 && RSSI_VOLTAGE > 0.4) { COMRX_STATUS = COMRX_ALIVE; } else { //RESET_COMRX(); COMRX_RESET_COUNTER++; - if(COMRX_OC_FAULT==0 && RSSI_volatge > 0.4) + if(COMRX_OC_FAULT==0 && RSSI_VOLTAGE > 0.4) COMRX_STATUS = COMRX_ALIVE; else COMRX_STATUS = COMRX_DEAD;