Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WebSocketClient WiflyInterface mbed messages
Fork of BatteryModelTester by
Revision 11:ce00133ab2f4, committed 2016-11-29
- Comitter:
- fmferrari
- Date:
- Tue Nov 29 16:24:14 2016 +0000
- Parent:
- 10:e8b66718a103
- Commit message:
- - Added SoC output
Changed in this revision
--- 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;
--- 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{
--- 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:
