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:
30:8a33a94a1a89
Parent:
29:29dcd5391c36
Child:
31:f8504ef165fb
Child:
32:72e9ea8368da
--- a/main.cpp	Sun May 31 07:28:49 2015 +0000
+++ b/main.cpp	Sun May 31 08:16:05 2015 +0000
@@ -54,7 +54,7 @@
 float deltaflow;
 
 int digital_pot_setpoint; //min = 0x7F, max = 0x00
-char filename[] = "/sd/UPAS0003LOG000000000000.txt";
+char filename[] = "/sd/UPAS0004LOG000000000000.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(9.0335*pow(massflowSet,4)-89.675*pow(massflowSet,3)+334.61*pow(massflowSet,2)-577.32*massflowSet+416.97); //min = 0x7F, max = 0x00
+    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
    
    DigPot.writeRegister(digital_pot_setpoint);
    Wire.begin(SCL, SDA, TWI_FREQUENCY_100K);// 
@@ -115,7 +115,7 @@
    blower = 1;
     
     get_time(); 
-    sprintf(filename, "/sd/UPAS0003LOG_%02d%02d%02d%02d%02d%02d.txt",Year,Month,Date,Hour,Minutes,Seconds);
+    sprintf(filename, "/sd/UPAS0004LOG_%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 = -3.0635*pow(omronVolt,(float)4)+18.617*pow(omronVolt,(float)3)-39.922*pow(omronVolt,(float)2)+37.758*omronVolt-12.603;
+    massflow = -1.747*pow(omronVolt,(float)4)+10.808*pow(omronVolt,(float)3)-23.114*pow(omronVolt,(float)2)+22.124*omronVolt-7.3176;
     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;