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:
Wed Sep 23 01:59:41 2015 +0000
Parent:
85:a95dd5f03818
Child:
87:c920521283b2
Commit message:
Added check to make sure the start and stop times are valid when using programmable start or stop times.

Changed in this revision

Calibration.lib Show annotated file Show diff for this revision Revisions of this file
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/Calibration.lib	Fri Sep 18 16:00:46 2015 +0000
+++ b/Calibration.lib	Wed Sep 23 01:59:41 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/Vockens-Group-Sensors/code/Calibration/#68014331c715
+https://developer.mbed.org/teams/Vockens-Group-Sensors/code/Calibration/#f6493d2aedcf
--- a/Universal_Serial_Menu.lib	Fri Sep 18 16:00:46 2015 +0000
+++ b/Universal_Serial_Menu.lib	Wed Sep 23 01:59:41 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/Vockens-Group-Sensors/code/Universal_Serial_Menu/#32238c2da2eb
+https://developer.mbed.org/teams/Vockens-Group-Sensors/code/Universal_Serial_Menu/#017c76261a83
--- a/main.cpp	Fri Sep 18 16:00:46 2015 +0000
+++ b/main.cpp	Wed Sep 23 01:59:41 2015 +0000
@@ -132,8 +132,8 @@
 
 void check_stop()   // this checks if it's time to stop and shutdown
 {
-    RTC.get_time(); //debug
-    pc.printf("%02d:%02d:%02d on %d/%d/%d) \r\n",RTC.hour, RTC.minutes, RTC.seconds, RTC.month, RTC.date, RTC.year);//debig
+    //RTC.get_time(); //debug
+    //pc.printf("%02d:%02d:%02d on %d/%d/%d) \r\n",RTC.hour, RTC.minutes, RTC.seconds, RTC.month, RTC.date, RTC.year);//debug
     if(RTC.compare(Menu.f_sec, Menu.f_min, Menu.f_hour, Menu.f_day, Menu.f_month, Menu.f_year)) {
         pbKill = 0; // this is were we shut everything down
     }
@@ -256,7 +256,7 @@
     //if(RTC.OSF()) {                 //Force the menu open if the RTC needs reset.
     //    RunReady = 0;
     //}
-
+Reopen:
     uint8_t temp_crr = Menu.crr;
     if((Menu.crr &0x01) == 0) { // crr bit 0, should the menu be optional
         RGB_LED.set_led(1,1,1);
@@ -280,20 +280,37 @@
             pbKill = 0;
         }
     }
-
+    /*if(((Menu.crr & 0x02) != 0) || ((Menu.crr & 0x02) != 0)) {
+        RTC.get_time();
+        if(RTC.OSF()) {  //Don't proceed if the time needs to be reset
+            RGB_LED.set_led(0,1,1); // error code/color
+            pc.printf("Please fix the Time before exiting!\r\n");
+            RunReady = 0;
+            goto Reopen;
+        }
+    }*/
+    if((Menu.crr & 0x02) != 0) {
+        RTC.get_time();
+        if(RTC.compare(Menu.s_sec, Menu.s_min, Menu.s_hour, Menu.s_day, Menu.s_month, Menu.s_year)) {  //Don't proceed if it's already time to start
+            RGB_LED.set_led(0,1,1); // error code/color
+            pc.printf("Please fix the START time before exiting!\r\n");
+            RunReady = 0;
+            goto Reopen;
+        }
+    }
     // Compare function for 519(UBCUO) mode to have it wait for the start time to start
-    if((Menu.crr & 0x04) == 1) {
+    if((Menu.crr & 0x04) != 0) {
         RTC.get_time();
         //Need to add in a compare function to check to see if the start time has already passed.
         if(RTC.compare(Menu.f_sec, Menu.f_min, Menu.f_hour, Menu.f_day, Menu.f_month, Menu.f_year)) {  //Don't proceed if it's already time to stop
             RGB_LED.set_led(0,1,1); // error code/color
-            pc.printf("Please fix the START or STOP times before exiting!\r\n");
-            Menu.Start(pc, E2PROM, RTC, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, Menu.menu_ops, 0, serial_num, calibrations);  //Forces you to open the menu
-            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
+            pc.printf("Please fix the STOP time before exiting!\r\n");
+            RunReady = 0;
+            goto Reopen;
         }
-        pc.printf("You're done, you can now disconect the USB cable.\r\n");
     }
-
+    pc.printf("You're done, you can now disconect the USB cable.\r\n");
+    
     if(bleMenu.crr != temp_crr) {
         Menu.crr = bleMenu.crr; // if this was changed in the UBM move it to the primary USM before saving
     }