working version

Dependencies:   mbed mbed-rtos SimpleDMA FreescaleIAP eeprom

Fork of CDMS_CODE_FM_28JAN2017 by samp Srinivasan

Revision:
343:cd7b1734f7a0
Parent:
338:d63eb331a67d
Child:
344:1675dbde0bae
--- a/CDMS_HK.h	Mon Jan 02 14:21:44 2017 +0000
+++ b/CDMS_HK.h	Wed Jan 04 10:55:22 2017 +0000
@@ -457,13 +457,15 @@
             SD_FAULTCOUNT++;
             SD_STATUS = (SD_FAULTCOUNT == 3) ? DEVICE_DISABLED :DEVICE_OC_FAULT;
             if(SD_FAULTCOUNT == 3) {
-                FCTN_CDMS_WR_FLASH(2,DEVICE_DISABLED);
+                WRITE_TO_EEPROM(2,(int32_t)DEVICE_DISABLED);
+                //FCTN_CDMS_WR_FLASH(2,DEVICE_DISABLED);
                 gPC.printf("Declaring SD card permanantly Disabled");
             }
         } else {
+            if(SD_STATUS != DEVICE_POWERED)
+                WRITE_TO_EEPROM(2,(int32_t)DEVICE_POWERED);
+                //FCTN_CDMS_WR_FLASH(2,DEVICE_POWERED);
             SD_STATUS = DEVICE_POWERED;
-            if(SD_STATUS != DEVICE_POWERED)
-                FCTN_CDMS_WR_FLASH(2,DEVICE_POWERED);
             SD_FAULTCOUNT = 0;
         }
     }
@@ -484,13 +486,15 @@
             BAE_FAULTCOUNT++;
             BAE_STATUS = (BAE_FAULTCOUNT == 3)?DEVICE_DISABLED:DEVICE_OC_FAULT;
             if(BAE_FAULTCOUNT == 3) {
-                FCTN_CDMS_WR_FLASH(1,DEVICE_DISABLED);
+                WRITE_TO_EEPROM(1,(int32_t)DEVICE_DISABLED);
+                //FCTN_CDMS_WR_FLASH(1,DEVICE_DISABLED);
                 gPC.printf("Declaring BAE permanantly Disabled");
             }
         } else {
+            if(BAE_STATUS != DEVICE_POWERED)
+                WRITE_TO_EEPROM(1,(int32_t)DEVICE_POWERED);
+                //FCTN_CDMS_WR_FLASH(1,DEVICE_POWERED);
             BAE_STATUS = DEVICE_POWERED;
-            if(SD_STATUS != DEVICE_POWERED);
-            FCTN_CDMS_WR_FLASH(1,DEVICE_POWERED);
             BAE_FAULTCOUNT = 0;
         }
     }
@@ -521,7 +525,8 @@
             PL_FAULTCOUNT++;
             PL_STATUS = (PL_FAULTCOUNT == 3)?DEVICE_DISABLED:DEVICE_OC_FAULT;
             if(PL_FAULTCOUNT == 3) {
-                FCTN_CDMS_WR_FLASH(3,DEVICE_DISABLED);
+                WRITE_TO_EEPROM(3,(int32_t)DEVICE_DISABLED);
+                //FCTN_CDMS_WR_FLASH(3,DEVICE_DISABLED);
                 gPC.printf("Declaring PL_BEE permanantly Disabled");
             }
         } else {
@@ -535,9 +540,10 @@
                 PYLD_DFF_CLK = 0;
                 wait_us(1);
             }
+            if(PL_STATUS != DEVICE_ENABLED)
+                WRITE_TO_EEPROM(3,(int32_t)DEVICE_ENABLED);
+                //FCTN_CDMS_WR_FLASH(3,DEVICE_ENABLED);
             PL_STATUS = DEVICE_ENABLED;
-            if(PL_STATUS != DEVICE_ENABLED)
-                FCTN_CDMS_WR_FLASH(3,DEVICE_ENABLED);
             PL_FAULTCOUNT = 0;
         }
     }