Changes done in ECG and BT
Dependencies: SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217
Fork of merged_code2_20sept_2017_4th_oct_2017 by
Diff: main.cpp
- Revision:
- 43:85a7f399cb9d
- Parent:
- 42:c81673b04b6a
- Child:
- 44:05dbea558c9a
--- a/main.cpp Mon Sep 11 10:02:46 2017 +0000 +++ b/main.cpp Mon Sep 11 13:09:29 2017 +0000 @@ -26,10 +26,9 @@ static uint8_t nstate1=0; static uint32_t current_test_pid=0; static uint32_t bt_file_sent_pid=0; -uint32_t pid = 0; // patient ID -bool file_created_status = false; //initialise file created to 0 -static uint32_t pid_btpid[2]; -uint32_t filepid_btpid[2] = {}; +static uint32_t pid = 0; // patient ID +static bool file_created_status = false; //initialise file created to 0 +static uint32_t filepid_btpid[2] = {}; int main() { @@ -292,11 +291,6 @@ case 7: DisableTouch(); glc(pid); // glc measurement - if(get_filecreated_status() == false) //if file is in write mode - { - set_filecreated_status(); - increment_pid (); - } glc_flag=1; wait(1); state1=0; @@ -326,13 +320,7 @@ screen_ecg_2(heart_rate); ecg_flag=1; - } - if(get_filecreated_status() == false) //if file is in write mode - { - set_filecreated_status(); - increment_pid (); - } - + } state=6; eprom_write_8(30,1); nstate=state; @@ -345,11 +333,6 @@ screen_bp2(); // bp main screen bp_countdown(); // countdown for bp bp(pid); // measuring bp earlier bp() changed to bp(pid) 28/4/2017 - if(get_filecreated_status() == false) //if file is in write mode - { - set_filecreated_status(); - increment_pid (); - } state1=0; state=6; eprom_write_8(30,2); @@ -408,9 +391,9 @@ file_created_status = false; } -void increment_pid (void) //increment pid if a test is completed +void increment_filepid (void) //increment pid if a test is completed { - uint32_t filepid_btpid[2] = {}; + //uint32_t filepid_btpid[2] = {}; //set_filecreated_status(); //set it to make it append mode sd_read(filepid_btpid); //read pid from sd card @@ -419,6 +402,17 @@ } +void increment_btpid (void) //increment pid if a test is completed +{ + //uint32_t filepid_btpid[2] = {}; + + //set_filecreated_status(); //set it to make it append mode + sd_read(filepid_btpid); //read pid from sd card + filepid_btpid[0] = filepid_btpid[1] + 1; //increment it by 1 + sd_write(filepid_btpid); //write it back to sd card + +} + uint32_t get_filepid(void) { //uint32_t filepid_btpid[2] = {};