PES 4 - Smart Medication Dispenser / PES4_ProgrammeforDesignReview2

Dependencies:   SDFileSystem mbed

Fork of PES4_Programme by PES 4 - Smart Medication Dispenser

Revision:
81:a869abf56e85
Parent:
80:6e3eb8246ced
Child:
82:2fc026430ff2
diff -r 6e3eb8246ced -r a869abf56e85 source/main.cpp
--- a/source/main.cpp	Sun Apr 08 10:43:33 2018 +0000
+++ b/source/main.cpp	Sun Apr 08 20:27:20 2018 +0000
@@ -29,7 +29,7 @@
 
 s_time medicationTime;
 s_time outputTime;
-s_time currentTime;
+//s_time currentTime;
 s_medContainer medication;
 //s_medContainer medInventory;
 s_medInventory medInventory;
@@ -69,8 +69,6 @@
 
     outputTime = getTime();
 
-    medInventory.currentTime = getTime();
-
     medication.container[0] = 1;
     medication.container[1] = 2;
     medication.container[2] = 2;
@@ -177,7 +175,7 @@
                 /* Console State Switch */
             case 47:
                 printf("\n\rState Switch: Enter next State: \n\r");
-                printf("45\tset Time\n\r46\tread Time\n\r47\tState Switch\n\r48\tServo Board Test Tool\n\r49\tenable servo output\n\r50\tdisable servo output\n\r51\ttest SD Card\n\r52\tread medication\n\r53\tMedication display test tool\n\r60\twrite_medProtocol test\n\r61\twrite_medInventory test\n\r62\twrite_medError test\n\r63\terase_errorPotocol test\n\r64\terase_medPotocol\n\r");
+                printf("45\tset Time\n\r46\tread Time\n\r47\tState Switch\n\r48\tServo Board Test Tool\n\r49\tenable servo output\n\r50\tdisable servo output\n\r51\ttest SD Card\n\r52\tread medication\n\r53\tMedication display test tool\n\r60\twrite_medProtocol\n\r61\twrite_medInventory\n\r62\twrite_medError\n\r63\terase_errorPotocol\n\r64\terase_medPotocol\n\r65\tread_medProtocol\n\r66\tread_medInventory\n\r67\tread_medError\n\r");
                 pc.scanf("%d", &state);
                 printf("Switch to State %d\n\r",state);
                 fflush(stdin);
@@ -333,18 +331,17 @@
                 break;
 
             case 61:
+                medInventory.currentTime = getTime();
                 printf("write_medInventory\n\r");
                 //write_medInventory(medInventory,currentTime,med1,med2,med3,med4,med5,med6);
                 write_medInventory(medInventory);
-                printf("done\n\r");
                 state = 47;
 
                 break;
 
             case 62:
                 printf("write_medError\n\r");
-                write_medError(fail, currentTime);
-                printf("done\n\r");
+                write_medError(fail, medicationTime);
                 state = 47;
 
                 break;
@@ -375,8 +372,17 @@
                 printf("read_medInventory\n\r");
                 medInventory = read_medInventory();
                 printf("done\r\n");
-                printf("%s", medInventory.pill[0]);
+                printf("%s\r\n%d\r\n%s\r\n%d\r\n%s\r\n%d\r\n%s\r\n%d\r\n%s\r\n%d\r\n%s\r\n%d\r\n", medInventory.pill[0], medInventory.medContainer.container[0], medInventory.pill[1], medInventory.medContainer.container[1], medInventory.pill[2], medInventory.medContainer.container[2], medInventory.pill[3], medInventory.medContainer.container[3], medInventory.pill[4], medInventory.medContainer.container[4], medInventory.pill[5], medInventory.medContainer.container[5]);
                 state = 47;
+
+                break;
+
+            case 67:
+                printf("read_medError\n\r");
+                send = read_medError();
+                printf("%s", send);
+                state = 47;
+
                 break;
 
             default: