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