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
Diff: main.cpp
- Revision:
- 83:9153d6c3af81
- Parent:
- 82:e01326a63ae9
- Child:
- 84:85d11d422da3
--- a/main.cpp Wed Sep 16 00:11:34 2015 +0000 +++ b/main.cpp Wed Sep 16 05:09:07 2015 +0000 @@ -265,28 +265,47 @@ 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, 3, serial_num, calibrations); }else if(RunReady == 0) { RGB_LED.set_led(0,1,1); // error code/color - pc.printf("Change Name\r\n"); - while(RunReady == 0) { + //pc.printf("Change Name\r\n"); + 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 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); } + if(Menu.menu_ops == 513 && Menu.crr == 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 pbKill = 0; } } -// Add in compare function for 519(UBCUO) mode to have it wait for the start time to start + // Compare function for 519(UBCUO) mode to have it wait for the start time to start + if(Menu.menu_ops == 519){ + RTC.get_time(); + 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(1,0,0); // 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("You're done, you can now disconect the USB cable."); + 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 + RGB_LED.set_led(1,1,0); + while(!RTC.compare(Menu.s_sec, Menu.s_min, Menu.s_hour, Menu.s_day, Menu.s_month, Menu.s_year)) { // this while waits for the start time by looping until the start time + pc.printf("%d\r\n",serial_num); + // serial print a count down?? + } + } + + calibrations.initialize(serial_num); - if(!Menu.crr == 1){ // don't shut off when in demo mode + if(Menu.crr == 0){ // 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. }