     
   //         digitalWrite(13, LOW );
      // Serial.println("Writing board state to file");
-//        writeBoardStateToFile(BOARD_CONFIG_FILE_FULL_PATH);
+        writeBoardStateToFile(BOARD_CONFIG_FILE_FULL_PATH);
       // g_iWriteToFile=1;
     
 //        system("shutdown -r now");

    {
    case UP:
//      g_iNewCode = 0;      
//      initBoardStateFromFile(BOARD_CONFIG_FILE_FULL_PATH);
       //      g_iWriteToFile=0;
  //     digitalWrite(13, HIGH );
      break;

  // Open File
  FILE *fp;
  char sJsonFile[CONFIG_FILE_MAX_SIZE];
  memset(sJsonFile,'\0',CONFIG_FILE_MAX_SIZE);
 
  // Read file
  fp = fopen(_sFullFilePath, "r"); 
//  Serial.println("File Open");

  #ifdef DEBUG_CAT
    trace_info("%s(): File: %s\n", __func__, _sFullFilePath);   
  #endif     

  if( fp )
  {
    if( !fgets(sJsonFile, CONFIG_FILE_MAX_SIZE, fp) )
    {
      /*
      #ifdef DEBUG_CAT
        trace_info("%s(): ERROR reading file. Content: %s\n", __func__, sJsonFile);   
      #endif
      */
      
      Serial.print("ERROR reading file. Content: ");  
//      Serial.println(sJsonFile);  
      
      // The file is empty for some reason. Let's use the standard init function
      //initBoardState();
      return;
    }
    else
    {
      /*
      #ifdef DEBUG_CAT
        trace_info("%s(): SUCCESS reading file. Content: %s\n", __func__, sJsonFile);   
      #endif
      */
      Serial.print("SUCCESS reading file. Content: ");  
//      Serial.println(sJsonFile);  
    }
  }
  else
  {
     Serial.print("ERROR opening file: ");
     Serial.println(_sFullFilePath);
     return;     
  }
  /*
