17th Nov 2016

Dependencies:   mbed

Fork of TEST10_8A_Nucleo_Charger_vApril_copy by SmartCharge

Revision:
3:0069f2cad504
Parent:
2:81b3308d5d45
Child:
4:4fae92446559
--- a/main.cpp	Thu Apr 21 12:31:32 2016 +0000
+++ b/main.cpp	Wed Aug 10 13:25:04 2016 +0000
@@ -1,5 +1,10 @@
 /**
  * Copyright (c) 2016 M2C Ltd
+ * TEST 10.8A  (18% PWM) for first Convex build / Mick's dad house
+ 
+ 2000 samples 
+ 
+ 3 second reset
  *
  */
 
@@ -40,7 +45,7 @@
 #define NUM_SAMPLES 2000 // size of sample series
 
 #define SAMPLE_BLOCKS 1 //CC for reset button
-#define RESET_SECONDS 5 //CC for reset button
+#define RESET_SECONDS 3 //CC for reset button
 
 bool resetDown = false;
 bool resetCharger = false;
@@ -97,8 +102,42 @@
 printf("current_average %.f \n\r", current_average);
 printf("PP Pilot Value = %.0f mV\n\r",readingA2);
         
+  
+  
+//*********************   TEST CONVEX BUILD***********************//
+if(readingA2>3200) 
+{
+    
+    if ((current_average > 2600) &&  (current_average < 2750) || (current_average > 370) && (current_average < 470)) // first reading ˜2702 & ˜755 after 
+    {        
+            control_pilot = PILOT_12V;    // Pilot at 12V 
+    }
+    if (current_average < 100) // first reading ˜2702 & ˜755 after 
+    {        
+            control_pilot = PILOT_12V;    // Pilot at 12V 
+            resetCharger = false;
+    }
+
         
-
+}
+if(readingA2<3200) // tester 32A cable
+{
+       
+        if((current_average > 1900) &&  (current_average <2100) || (current_average > 400) &&  (current_average <470)) // first reading ˜2012 & ˜573 after
+        {      
+            control_pilot = PILOT_9V;    // Pilot at 9V       
+        }
+        if((current_average> 270) && (current_average<350)) // first reading ˜1372 & ˜405 after
+        {       
+            control_pilot = PILOT_6V;    // Pilot at 6V       
+        }
+        if(resetCharger == true)
+        {control_pilot = PILOT_RESET;}
+        
+}//end if(readingA2!=0) 
+  
+        
+/*
 if(readingA2>3200) 
 {
     
@@ -129,7 +168,7 @@
         {control_pilot = PILOT_RESET;}
         
 }//end if(readingA2!=0) 
-
+*/
 
 
         switch(control_pilot) {
@@ -150,7 +189,7 @@
             lock=1;
             my_pwm.period_ms(1);
             my_pwm.pulsewidth_ms(1);
-            my_pwm.write(0.734);
+            my_pwm.write(0.820);                    ///////PWM CHANGED from my_pwm.write(0.734);
             printf("Charger in STATE b\r\n");
             printf("PILOT_9V - Pilot at 9 V \n\r");
             red = 1;
@@ -164,7 +203,7 @@
             lock=1;
             my_pwm.period_ms(1);
             my_pwm.pulsewidth_ms(1);
-            my_pwm.write(0.734);
+            my_pwm.write(0.820);                    ///////PWM CHANGED from my_pwm.write(0.734);
 
             printf("Charger in STATE c\r\n");
             printf("PILOT_6V - Pilot at 6 V \n\r");
@@ -201,7 +240,6 @@
             
         }//end switch
      
-printf("#################\n\r");        
-wait(1); // 1 sec    
+printf("#################\n\r");          
 }//end while (1)
 }//end main()
\ No newline at end of file