PES 4 - Smart Medication Dispenser / PES4_ProgrammeforDesignReview2

Dependencies:   SDFileSystem mbed

Fork of PES4_Programme by PES 4 - Smart Medication Dispenser

Revision:
56:218601547d13
Parent:
55:bdab541f434d
Child:
57:79fed71031da
--- a/source/main.cpp	Fri Mar 30 13:05:13 2018 +0000
+++ b/source/main.cpp	Sat Mar 31 15:53:13 2018 +0000
@@ -146,11 +146,12 @@
                 printf("\rSD Card test finished\r\n\n");
                 state = 47;
                 break;
-
+           
+                
             case 52:
-                user[0] = readMedication(0);
-                if(user[0].valid) {
-                    printf("\rtest read successful\r\n\n");
+                user[1] = readMedication(1);
+                if(user[1].valid) {
+                    printf("\rread successful\r\n\n");
                 } else {
                     printf("\rread failed\r\n\n");
                 }
@@ -158,8 +159,8 @@
                 break;
 
             case 53:
-                if(user[0].valid == false) {
-                    printf("\r\nNo valid data in struct, try to run case 52\r\n\n");
+                if(user[1].valid == false) {
+                    printf("\r\nNo valid data in struct, try to run case 54\r\n\n");
                 } else {
                     printf("\r\nMedication display test tool:\r\n");
                     printf("Enter Day (0..6) and Moment (0..4)\r\nTo exit enter Day > 6:\r\n");
@@ -172,15 +173,17 @@
                             pc.scanf("%d", &moment);
                             printf("\r\nMedication for weekday %d Moment %d is ",day,moment);
                             for(int i=0; i<6; i++) {
-                                printf("%d", user[0].medication.day[day].moment[moment].medContainer.container[i]);
+                                printf("%d", user[1].medication.day[day].moment[moment].medContainer.container[i]);
                             }
+                            printf("\r\nThe Alarmclock  is set for %02d:%02d",user[1].medication.day[day].moment[moment].time.hour,user[1].medication.day[day].moment[moment].time.minute);                          
                         }
                         printf("\r\n");
                         fflush(stdin);
                     }
                     printf("exit Tool\n\r");
                 }
-
+                state = 47;
+                break;
             default:
                 state = 47; /* Go to State Switch */
                 break;