diff --git a/hemocube/hemocube_mock/hemocube_mock.ino b/hemocube/hemocube_mock/hemocube_mock.ino index 1fc994d..44f090d 100644 --- a/hemocube/hemocube_mock/hemocube_mock.ino +++ b/hemocube/hemocube_mock/hemocube_mock.ino @@ -1,7 +1,7 @@ #include struct DeviceData { - char deviceId[20]; // Assuming a device ID of up to 19 characters + char deviceId[20]; // int intValue; // float floatValue; }; @@ -17,9 +17,9 @@ void readDataFromEEPROM(DeviceData &data, int address) { void setup() { // put your setup code here, to run once: - // Serial.begin(115200); + Serial.begin(115200); - Serial.begin(9600); + // Serial.begin(9600); // DeviceData myDevice; // strcpy(myDevice.deviceId, "HCV-000-3001"); @@ -33,145 +33,152 @@ void setup() { } void loop() { - // put your main code here, to run repeatedly: + mockV0Device(); + // mockV1Device(); + // mockV2Device(); +} + +void mockV0Device() { // // TEST: Buffer + Sample - // while (Serial.available() == 0) {} //wait for data available - // String bufferCommand = Serial.readString(); //read until timeout - // bufferCommand.trim(); // remove any \r \n whitespace at the end of the String - // if (bufferCommand == "B") { - // Serial.println("#Start Buffer"); - // delay(2000); - // Serial.println("#Buffer Completed"); - // } + while (Serial.available() == 0) {} //wait for data available + String bufferCommand = Serial.readString(); //read until timeout + bufferCommand.trim(); // remove any \r \n whitespace at the end of the String + if (bufferCommand == "B") { + Serial.println("#Start Buffer"); + delay(2000); + Serial.println("#Buffer Completed"); + } - // while (Serial.available() == 0) {} //wait for data available - // String SampleCommand = Serial.readString(); //read until timeout - // SampleCommand.trim(); // remove any \r \n whitespace at the end of the String - // if (SampleCommand == "S") { - // Serial.println("#Sample Started"); - // delay(2000); - // Serial.println("#Sample Completed"); - // } + while (Serial.available() == 0) {} //wait for data available + String SampleCommand = Serial.readString(); //read until timeout + SampleCommand.trim(); // remove any \r \n whitespace at the end of the String + if (SampleCommand == "S") { + Serial.println("#Sample Started"); + delay(2000); + Serial.println("#Sample Completed"); + } - // while (Serial.available() == 0) {} //wait for data available - // String resultCommand = Serial.readString(); //read until timeout - // resultCommand.trim(); // remove any \r \n whitespace at the end of the String - // if (resultCommand == "P") { - // delay(3000); - // // RESULT SN HCV1002 BUFFER_555_GREEN_INTENSITY BUFFER_427_BLUE_INTENSITY SAMPLE_555_GREEN_INTENSITY SAMPLE_427_BLUE_INTENSITY REND - // // Serial.println("RESULT SN HCV1002 23729 24801.67 19190.67 6995.67 REND"); // normal - // // Serial.println("RESULT SN HCV1002 24900.67 26578.33 19760.00 9071.67 REND"); // NBL - // Serial.println("RESULT SN HCV1002 17974.33 9247.67 19952 12217 REND"); // negative abs - // delay(15000); - // } + while (Serial.available() == 0) {} //wait for data available + String resultCommand = Serial.readString(); //read until timeout + resultCommand.trim(); // remove any \r \n whitespace at the end of the String + if (resultCommand == "P") { + delay(3000); + // RESULT SN HCV1002 BUFFER_555_GREEN_INTENSITY BUFFER_427_BLUE_INTENSITY SAMPLE_555_GREEN_INTENSITY SAMPLE_427_BLUE_INTENSITY REND + // Serial.println("RESULT SN HCV1002 23729 24801.67 19190.67 6995.67 REND"); // normal + // Serial.println("RESULT SN HCV1002 24900.67 26578.33 19760.00 9071.67 REND"); // NBL + Serial.println("RESULT SN HCV1002 17974.33 9247.67 19952 12217 REND"); // negative abs + delay(15000); + } - // // TEST: Device diagonistics - // while (Serial.available() == 0) {} //wait for data available - // String infoCommand = Serial.readString(); //read until timeout - // infoCommand.trim(); // remove any \r \n whitespace at the end of the String - // if (infoCommand == "I") { - // Serial.println("SN HCV2002"); - // } - // while (Serial.available() == 0) {} //wait for data available - // String diagnosticsCommand = Serial.readString(); //read until timeout - // diagnosticsCommand.trim(); // remove any \r \n whitespace at the end of the String - // if (diagnosticsCommand == "D") { - // Serial.println("PG 7016"); - // delay(500); - // Serial.println("PG 10668"); - // delay(500); - // Serial.println("PG 14294"); - // delay(500); - // Serial.println("PG 17875"); - // delay(500); - // Serial.println("PG 21470"); - // delay(500); + // TEST: Device diagonistics + while (Serial.available() == 0) {} //wait for data available + String infoCommand = Serial.readString(); //read until timeout + infoCommand.trim(); // remove any \r \n whitespace at the end of the String + if (infoCommand == "I") { + Serial.println("SN HCV2002"); + } + while (Serial.available() == 0) {} //wait for data available + String diagnosticsCommand = Serial.readString(); //read until timeout + diagnosticsCommand.trim(); // remove any \r \n whitespace at the end of the String + if (diagnosticsCommand == "D") { + Serial.println("PG 7016"); + delay(500); + Serial.println("PG 10668"); + delay(500); + Serial.println("PG 14294"); + delay(500); + Serial.println("PG 17875"); + delay(500); + Serial.println("PG 21470"); + delay(500); - // Serial.println("PB 17"); - // delay(500); - // Serial.println("PB 3225"); - // delay(500); - // Serial.println("PB 6776"); - // delay(500); - // Serial.println("PB 10429"); - // delay(500); - // Serial.println("END"); - // } + Serial.println("PB 17"); + delay(500); + Serial.println("PB 3225"); + delay(500); + Serial.println("PB 6776"); + delay(500); + Serial.println("PB 10429"); + delay(500); + Serial.println("END"); + } +} +void mockV1Device() { + // two path length device + // TEST: Device Info + Buffer + Sample + while (Serial.available() == 0) {} + String infoCommand = Serial.readString(); + infoCommand.trim(); + if (infoCommand == "I") { + Serial.println("SN HCV-000-3001"); + } - // // two path length device - // // TEST: Device Info + Buffer + Sample - // while (Serial.available() == 0) {} - // String infoCommand = Serial.readString(); - // infoCommand.trim(); - // if (infoCommand == "I") { - // Serial.println("SN HCV-000-3001"); - // } + while (Serial.available() == 0) {} + String bufferCommand = Serial.readString(); + bufferCommand.trim(); + if (bufferCommand == "B") { + Serial.println("#BS"); + delay(2000); + Serial.println("#BC"); + } - // while (Serial.available() == 0) {} - // String bufferCommand = Serial.readString(); - // bufferCommand.trim(); - // if (bufferCommand == "B") { - // Serial.println("#BS"); - // delay(2000); - // Serial.println("#BC"); - // } + while (Serial.available() == 0) {} + String SampleCommand = Serial.readString(); + SampleCommand.trim(); + if (SampleCommand == "S") { + Serial.println("#SS"); + delay(2000); + Serial.println("#SC"); + } - // while (Serial.available() == 0) {} - // String SampleCommand = Serial.readString(); - // SampleCommand.trim(); - // if (SampleCommand == "S") { - // Serial.println("#SS"); - // delay(2000); - // Serial.println("#SC"); - // } + while (Serial.available() == 0) {} + String resultCommand = Serial.readString(); + resultCommand.trim(); + if (resultCommand == "P") { + delay(3000); + Serial.println("RESULT"); - // while (Serial.available() == 0) {} - // String resultCommand = Serial.readString(); - // resultCommand.trim(); - // if (resultCommand == "P") { - // delay(3000); - // Serial.println("RESULT"); + // // deoxy error + // Serial.println("LB1 25215"); + // Serial.println("LB2 25599"); + // Serial.println("LB3 24856"); + // Serial.println("LB4 25584"); + // Serial.println("LS1 560"); + // Serial.println("LS2 71"); + // Serial.println("LS3 3447"); + // Serial.println("LS4 4092"); - // // // deoxy error - // // Serial.println("LB1 25215"); - // // Serial.println("LB2 25599"); - // // Serial.println("LB3 24856"); - // // Serial.println("LB4 25584"); - // // Serial.println("LS1 560"); - // // Serial.println("LS2 71"); - // // Serial.println("LS3 3447"); - // // Serial.println("LS4 4092"); + // // // SCT, no error + Serial.println("LB1 23777"); + Serial.println("LB2 24130"); + Serial.println("LB3 23442"); + Serial.println("LB4 23945"); + Serial.println("LS1 2521"); + Serial.println("LS2 973"); + Serial.println("LS3 10252"); + Serial.println("LS4 11017"); - // // // // SCT, no error - // Serial.println("LB1 23777"); - // Serial.println("LB2 24130"); - // Serial.println("LB3 23442"); - // Serial.println("LB4 23945"); - // Serial.println("LS1 2521"); - // Serial.println("LS2 973"); - // Serial.println("LS3 10252"); - // Serial.println("LS4 11017"); + // buffer high error + // Serial.println("LB1 21616"); + // Serial.println("LB2 21002"); + // Serial.println("LB3 24402"); + // Serial.println("LB4 24076"); + // Serial.println("LS1 507"); + // Serial.println("LS2 720"); + // Serial.println("LS3 2293"); + // Serial.println("LS4 6601"); - // // buffer high error - // // Serial.println("LB1 21616"); - // // Serial.println("LB2 21002"); - // // Serial.println("LB3 24402"); - // // Serial.println("LB4 24076"); - // // Serial.println("LS1 507"); - // // Serial.println("LS2 720"); - // // Serial.println("LS3 2293"); - // // Serial.println("LS4 6601"); + Serial.println("REND"); + delay(15000); + } +} - // Serial.println("REND"); - // delay(15000); - // } - - - // V2 - New board +void mockV2Device() { + // V2 Device // TEST: Device Info + Buffer + Sample while (Serial.available() == 0) { String command = Serial.readString();