- A fork of Damien's program.

Dependencies:   WebSocketClient WiflyInterface mbed messages

Fork of BatteryModelTester by Damien Frost

Files at this revision

API Documentation at this revision

Comitter:
fmferrari
Date:
Tue Nov 29 16:24:14 2016 +0000
Parent:
10:e8b66718a103
Commit message:
- Added SoC output

Changed in this revision

headers/globals.h Show annotated file Show diff for this revision Revisions of this file
source/globals.cpp Show annotated file Show diff for this revision Revisions of this file
source/pwm.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r e8b66718a103 -r ce00133ab2f4 headers/globals.h
--- a/headers/globals.h	Tue Nov 29 15:02:01 2016 +0000
+++ b/headers/globals.h	Tue Nov 29 16:24:14 2016 +0000
@@ -65,6 +65,7 @@
 extern float TempSensor;
 extern float VoltageMeasurement;
 extern float CurrentMeasurement;
+extern float SocOutput;
 extern float PwmPeriod_us;
 extern float Duty_us;
 extern char* wifissid;
diff -r e8b66718a103 -r ce00133ab2f4 source/globals.cpp
--- a/source/globals.cpp	Tue Nov 29 15:02:01 2016 +0000
+++ b/source/globals.cpp	Tue Nov 29 16:24:14 2016 +0000
@@ -54,6 +54,7 @@
 float TempSensor = 0.0f;
 float VoltageMeasurement = 0.0f;
 float CurrentMeasurement = 0.0f;
+float SocOutput = 0.0f;
 float PwmPeriod_us = 20.0f;
 float Duty_us = 10.0f;
 char* wifissid = "SC";
@@ -113,7 +114,7 @@
     int intresult;    
     
     if(IotStatus.CheckFlag(SF_SERVERCONNECTED)){
-        sprintf(msg_buffer, "%d,%d,%.5f,%.5f,%.5f,%.5f", IoT_ID, SendCounter,TempSensor, VoltageMeasurement, CurrentMeasurement, PwmPeriod_us);
+        sprintf(msg_buffer, "%d,%d,%.5f,%.5f,%.5f,%.5f,%.5f", IoT_ID, SendCounter,TempSensor, VoltageMeasurement, CurrentMeasurement, PwmPeriod_us, SocOutput);
         INFO("Sending: %s", msg_buffer);    // When this line is commented out, the mbed never tries to reconnect to the server after one try. SUPER. Keeping this here also uses precious CPU time
         intresult = ws.send(msg_buffer);
     }else{
diff -r e8b66718a103 -r ce00133ab2f4 source/pwm.cpp
--- a/source/pwm.cpp	Tue Nov 29 15:02:01 2016 +0000
+++ b/source/pwm.cpp	Tue Nov 29 16:24:14 2016 +0000
@@ -235,22 +235,7 @@
 }
 
 void TIM1_CC_IRQHandler(void){
-    
-    // States of the PWM module:
-    /*
-    #define PWMST_SETUPCONV 0
-    #define PWMST_STARTCONV 1
-    #define PWMST_RUNSCSKDC 2
-    #define PWMST_CALCNEWPH 3
-    #define PWMST_SETNEWPH  4
-    #define PWMST_SHIFT     5
-    #define PWMST_SAMPLECHTROUGH    6
-    #define PWMST_WAITSAMPLETROUGH  7    
-    #define PWMST_WAIT              8
-    #define PWMST_SAMPLECHHILL      9
-    #define PWMST_WAITSAMPLEHILL    10
-    #define PWMST_MAXST             11
-    */
+  
     
     if(((TIM1->SR & TIM_SR_CC4IF) > 0)&&(IotStatus.CheckFlag(SS_PWMOVERRUNFLAG) == false)){
         // Block any other interrupts from occuring:
@@ -275,7 +260,7 @@
         db = 0;
         
         // Read battery model outputs:
-        
+        SocOutput = 1.0;
         
         
         // Clear the flag: