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:
79:ed555e9081d0
Parent:
78:a465de6cc47e
Child:
80:5487ba127c82
diff -r a465de6cc47e -r ed555e9081d0 main.cpp
--- a/main.cpp	Fri Sep 11 19:47:06 2015 +0000
+++ b/main.cpp	Tue Sep 15 01:52:08 2015 +0000
@@ -262,6 +262,7 @@
     //if(RTC.OSF()) {                 //Force the menu open if the RTC needs reset.
     //    RunReady = 0;
     //}
+    uint8_t temp_crr = Menu.crr;
     if(RunReady == 0) {
         RGB_LED.set_led(0,1,1); // error code/color
         pc.printf("Change Name\r\n");
@@ -278,10 +279,17 @@
     }
 
     RunReady = 0;
+    if(bleMenu.crr != temp_crr){
+        Menu.crr = bleMenu.crr; // if this was changed in the UBM move it to the primary USM before saving
+    }
     Menu.save_menu(E2PROM, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, RunReady, serial_num);       //Save all data to the EEPROM
     calibrations.initialize(serial_num);
     
-    stop.attach(&check_stop, 60);    // check if we should shut down every 5 seconds, starting 60s after the start.
+    if(!Menu.crr == 2){  // don't shut off when in demo mode
+        stop.attach(&check_stop, 60);    // check if we should shut down every 5 seconds, starting 60s after the start.
+    }
+    
+    
 
     if(volflowSet==1.0) {
         gainFlow = 100;
@@ -435,8 +443,13 @@
 
 
     //** end of initalization **//
-
+    //---------------------------------------------------------------------------------------------//
     //---------------------------------------------------------------------------------------------//
+    if(Menu.crr == 2){  //demo mode never shuts down
+        //default demo mode settings
+        volflowSet = 1.0; //L/min
+        logInerval = 2;
+    }
     //---------------------------------------------------------------------------------------------//
     //---------------------------------------------------------------------------------------------//
     // Main Control Loop