Anurag Muglikar
/
pacemaker_new
Pacemaker models
Revision 9:9d028e2a7c61, committed 2018-12-12
- Comitter:
- ncshy
- Date:
- Wed Dec 12 19:00:49 2018 +0000
- Parent:
- 8:1c786926bb66
- Commit message:
- Made final change for QoS1 and initial PACEMAKER statement
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Dec 12 09:00:31 2018 +0000 +++ b/main.cpp Wed Dec 12 19:00:49 2018 +0000 @@ -149,7 +149,7 @@ message.payloadlen = strlen(buf); int rc = client.publish(topic, message); - client.yield(50); + client.yield(100); if(rc == 0){ printf("Success PUB%d\n", rc); }else{ @@ -195,6 +195,7 @@ int heart_rate; int num_paces; + int normal_count = 0; //printf("calc...\n"); // I want to check the heart rate in bpm for the alarm, // so if my window time is smaller than 60 seconds I want to have @@ -233,6 +234,7 @@ int rate_flag = 0; int pace_flag = 0; + client.yield(100); if(rc == 0){ printf("Success PUB%d\n", rc); @@ -244,14 +246,17 @@ if (heart_rate > URL) { monitor_alarm(RATE_ALARM); rate_flag = 1; - } else if (num_paces > PACE_THRESH) { + } + if (num_paces > PACE_THRESH) { monitor_alarm(PACE_ALARM); pace_flag = 1; - }else{ - sprintf(buf, "Normal :%d", 1); + } + if(heart_rate < URL && num_paces < PACE_THRESH){ + normal_count++; + sprintf(buf, "Normal :%d", normal_count); } LcdControl.locate(0, 1); - LcdControl.printf("AF: %d AS: %d", rate_flag, pace_flag); + LcdControl.printf("AF:%d AS:%d NC:%03d", rate_flag, pace_flag, normal_count); rate_flag=0; pace_flag=0; message.qos = MQTT::QOS0; @@ -324,7 +329,7 @@ switch(case_count) { case 1: - LRI = 300; + LRI = 1100; HRI = 1500; break; case 2: @@ -381,7 +386,7 @@ led_fast_alarm = 0; pc.baud(9600); LcdControl.cls(); - LcdControl.printf("Hello"); + LcdControl.printf("PACEMAKER"); // Enable the ISR to receive snse signals from heart simulator wifi.set_credentials(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD); wifi.connect();