Code supports writing to the SD card as well as working with the Volckens group smartphone apps for the mbed HRM1017

Dependencies:   ADS1115 BLE_API BME280 Calibration CronoDot EEPROM LSM303 MCP40D17 NCP5623BMUTBG SDFileSystem SI1145 STC3100 mbed nRF51822

Fork of UPAS_BLE_and_USB by Volckens Group Sensors

Revision:
33:bc73a2493821
Parent:
31:f8504ef165fb
Child:
34:481403146690
Child:
36:2d90be7655e1
--- a/main.cpp	Sun May 31 15:28:20 2015 +0000
+++ b/main.cpp	Sun May 31 16:10:43 2015 +0000
@@ -54,7 +54,7 @@
 float deltaflow;
 
 int digital_pot_setpoint; //min = 0x7F, max = 0x00
-char filename[] = "/sd/UPAS0004LOG_00-00-00_00:00:00.txt";
+char filename[] = "/sd/UPAS0005LOG000000000000.txt";
 
 TwoWire Wire = TwoWire(NRF_TWI0);    
 SDFileSystem sd(SPIS_PSELMOSI, SPIS_PSELMISO, SPIS_PSELSCK, SPIS_PSELSS, "sd"); // I believe this matches Todd's pinout, let me know if this doesn't work. (p12, p13, p15, p14)
@@ -107,7 +107,7 @@
     atmoRho = ((press-((6.1078*pow((float)10,(float)((7.5*temp)/(237.3+temp))))*(rh/100)))*100)/(287.0531*(temp+273.15))+((6.1078*pow((float)10,(float)((7.5*temp)/(237.3+temp))))*(rh/100)*100)/(461.4964*(temp+273.15));
     massflowSet = volflowSet*atmoRho;
     //Digtal pot tf from file: UPAS v2 OSU-PrimaryFlowData FullSet 2015-05-29 CQ mods.xlsx
-    digital_pot_setpoint = (int)floor(7.6546*pow(massflowSet,4)-77.167*pow(massflowSet,3)+293*pow(massflowSet,2)-516.79*massflowSet+383.83); //min = 0x7F, max = 0x00
+    digital_pot_setpoint = (int)floor(9.2456*pow(massflowSet,4)-89.538*pow(massflowSet,3)+329.03*pow(massflowSet,2)-566.12*massflowSet+412.72); //min = 0x7F, max = 0x00
    
    DigPot.writeRegister(digital_pot_setpoint);
    Wire.begin(SCL, SDA, TWI_FREQUENCY_100K);// 
@@ -115,7 +115,7 @@
    blower = 1;
     
     get_time(); 
-    sprintf(filename, "/sd/UPAS0004LOG_%02d-%02d-%02d_%02d:%02d:%02d.txt",Year,Month,Date,Hour,Minutes,Seconds);
+    sprintf(filename, "/sd/UPAS0005LOG_%02d-%02d-%02d_%02d-%02d-%02d.txt",Year,Month,Date,Hour,Minutes,Seconds);
     FILE *fp = fopen(filename, "w");
     fclose(fp);
 
@@ -129,7 +129,7 @@
     
     omronVolt = (omronReading*4.096)/(32768*2);
     //Mass Flow tf from file: UPAS v2 OSU-PrimaryFlowData FullSet 2015-05-29 CQ mods.xlsx
-    massflow = -1.747*pow(omronVolt,(float)4)+10.808*pow(omronVolt,(float)3)-23.114*pow(omronVolt,(float)2)+22.124*omronVolt-7.3176;
+    massflow = -2.4541*pow(omronVolt,(float)4)+15.522*pow(omronVolt,(float)3)-34.578*pow(omronVolt,(float)2)+34.05*omronVolt-11.794;
     atmoRho = ((press-((6.1078*pow((float)10,(float)((7.5*temp)/(237.3+temp))))*(rh/100)))*100)/(287.0531*(temp+273.15))+((6.1078*pow((float)10,(float)((7.5*temp)/(237.3+temp))))*(rh/100)*100)/(461.4964*(temp+273.15));
     volflow = massflow/atmoRho;
     deltaflow = volflow-volflowSet;