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:
29:29dcd5391c36
Parent:
28:39747a95e989
Child:
30:8a33a94a1a89
--- a/main.cpp	Sun May 31 07:22:24 2015 +0000
+++ b/main.cpp	Sun May 31 07:28:49 2015 +0000
@@ -54,7 +54,7 @@
 float deltaflow;
 
 int digital_pot_setpoint; //min = 0x7F, max = 0x00
-char filename[] = "/sd/UPAS0002LOG000000000000.txt";
+char filename[] = "/sd/UPAS0003LOG000000000000.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(6.8682*pow(massflowSet,4)-70.574*pow(massflowSet,3)+271.95*pow(massflowSet,2)-483.03*massflowSet+356.69); //min = 0x7F, max = 0x00
+    digital_pot_setpoint = (int)floor(9.0335*pow(massflowSet,4)-89.675*pow(massflowSet,3)+334.61*pow(massflowSet,2)-577.32*massflowSet+416.97); //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/UPAS0002LOG_%02d%02d%02d%02d%02d%02d.txt",Year,Month,Date,Hour,Minutes,Seconds);
+    sprintf(filename, "/sd/UPAS0003LOG_%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 = -2.2954*pow(omronVolt,(float)4)+14.443*pow(omronVolt,(float)3)-31.573*pow(omronVolt,(float)2)+30.476*omronVolt-10.291;
+    massflow = -3.0635*pow(omronVolt,(float)4)+18.617*pow(omronVolt,(float)3)-39.922*pow(omronVolt,(float)2)+37.758*omronVolt-12.603;
     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;