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

Files at this revision

API Documentation at this revision

Comitter:
joshuasmth04
Date:
Thu Sep 24 19:45:17 2015 +0000
Parent:
88:9142f21a4715
Child:
90:26a08de1a0ac
Commit message:
Changed program flow after opening admen menu to restart if any of the program flow settings have changed. Also opening the admen menu now counts as opening the menu in general.

Changed in this revision

Universal_Serial_Menu.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Universal_Serial_Menu.lib	Wed Sep 23 19:54:09 2015 +0000
+++ b/Universal_Serial_Menu.lib	Thu Sep 24 19:45:17 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/Vockens-Group-Sensors/code/Universal_Serial_Menu/#695f919ee41d
+https://developer.mbed.org/teams/Vockens-Group-Sensors/code/Universal_Serial_Menu/#64fcc47ca3c0
--- a/main.cpp	Wed Sep 23 19:54:09 2015 +0000
+++ b/main.cpp	Thu Sep 24 19:45:17 2015 +0000
@@ -225,7 +225,8 @@
 
 int main()
 {
-
+    uint8_t temp_crr;
+Restart:
 // Setup and Initialization
 //---------------------------------------------------------------------------------------------//
     Menu.read_menu(E2PROM, logInerval,refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, RunReady, serial_num);   //Read all data from the EEPROM here
@@ -257,8 +258,8 @@
     //    RunReady = 0;
     //}
 Reopen:
-    uint8_t temp_crr = Menu.crr;
-    if((Menu.crr &0x01) == 0) { // crr bit 0, should the menu be optional
+    temp_crr = Menu.crr;
+    if((Menu.crr &0x01) != 0x01) { // crr bit 0, should the menu be optional
         RGB_LED.set_led(1,1,1);
         wait(5);
         RGB_LED.set_led(1,1,0);
@@ -270,7 +271,7 @@
         while(RunReady == 0 || RTC.OSF()) {
             RGB_LED.set_led(0,1,1);   // error code/color
             RunReady = Menu.Start(pc, E2PROM, RTC, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, Menu.menu_ops, 0.25, serial_num, calibrations);  //Forces you to open the menu
-            RGB_LED.set_led(0,10,10); // error code/color
+            RGB_LED.set_led(0,5,5); // error code/color
             bleMenu.open_menu(txPayload, rxCharacteristic, E2PROM, RTC, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, Menu.menu_ops ,RunReady, 0.25, serial_num, calibrations);
         }
 
@@ -309,11 +310,18 @@
             goto Reopen;
         }
     }
-    pc.printf("You're done, you can now disconect the USB cable.\r\n");
     
-    if(bleMenu.crr != temp_crr) {
+    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
     }
+    if(Menu.crr != temp_crr) {
+        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
+        //RunReady = ?;
+        goto Restart;
+    }
+    
+    pc.printf("You're done, you can now disconect the USB cable.\r\n");
     RunReady = 0;
     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
     RGB_LED.set_led(1,1,0);