Add getString and print methods

This commit is contained in:
Matt McWilliams 2023-03-18 17:04:06 -04:00
parent 174b900cd8
commit 210dc85558
6 changed files with 51 additions and 3 deletions

View File

@ -63,3 +63,14 @@ void McopySerial::log (String message) {
Serial.println(message); Serial.println(message);
} }
} }
String McopySerial::getString () {
while (Serial.available() == 0) {
//Wait for value string
}
return Serial.readString();
}
void McopySerial::print (String message) {
Serial.println(message);
}

View File

@ -26,6 +26,7 @@ class McopySerial {
static const char CAMERA_CAPPER_IDENTIFIER = '8'; static const char CAMERA_CAPPER_IDENTIFIER = '8';
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9'; static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0'; static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
static const char CAMERA_EXPOSURE = 'G';
static const char CAMERA_FORWARD = 'e'; static const char CAMERA_FORWARD = 'e';
static const char CAMERA_IDENTIFIER = 'k'; static const char CAMERA_IDENTIFIER = 'k';
static const char CAMERA_PROJECTORS_IDENTIFIER = '5'; static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
@ -43,6 +44,7 @@ class McopySerial {
static const char CAPPER_ON = 'A'; static const char CAPPER_ON = 'A';
static const char CONNECT = 'i'; static const char CONNECT = 'i';
static const char DEBUG = 'd'; static const char DEBUG = 'd';
static const char ERROR = 'E';
static const char LIGHT = 'l'; static const char LIGHT = 'l';
static const char LIGHT_IDENTIFIER = 'o'; static const char LIGHT_IDENTIFIER = 'o';
static const char MCOPY_IDENTIFIER = 'm'; static const char MCOPY_IDENTIFIER = 'm';
@ -59,7 +61,8 @@ class McopySerial {
static const char PROJECTOR_SECOND_IDENTIFIER = 't'; static const char PROJECTOR_SECOND_IDENTIFIER = 't';
static const char PROJECTORS = 'x'; static const char PROJECTORS = 'x';
static const char PROJECTORS_IDENTIFIER = 'd'; static const char PROJECTORS_IDENTIFIER = 'd';
static const char TAKEUP_BACKWARD = 'E'; static const char STATE = 'H';
static const char TAKEUP_BACKWARD = 'F';
static const char TAKEUP_FORWARD = 'D'; static const char TAKEUP_FORWARD = 'D';
/* END CMD FLAGS */ /* END CMD FLAGS */
@ -70,6 +73,8 @@ class McopySerial {
void setIdentity(char identity); void setIdentity(char identity);
char loop(); char loop();
void confirm(char cmd); void confirm(char cmd);
String getString();
void print(String message);
void debug (bool state); void debug (bool state);
void log (String message); void log (String message);

View File

@ -63,3 +63,14 @@ void McopySerial::log (String message) {
Serial.println(message); Serial.println(message);
} }
} }
String McopySerial::getString () {
while (Serial.available() == 0) {
//Wait for value string
}
return Serial.readString();
}
void McopySerial::print (String message) {
Serial.println(message);
}

View File

@ -26,6 +26,7 @@ class McopySerial {
static const char CAMERA_CAPPER_IDENTIFIER = '8'; static const char CAMERA_CAPPER_IDENTIFIER = '8';
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9'; static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0'; static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
static const char CAMERA_EXPOSURE = 'G';
static const char CAMERA_FORWARD = 'e'; static const char CAMERA_FORWARD = 'e';
static const char CAMERA_IDENTIFIER = 'k'; static const char CAMERA_IDENTIFIER = 'k';
static const char CAMERA_PROJECTORS_IDENTIFIER = '5'; static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
@ -43,6 +44,7 @@ class McopySerial {
static const char CAPPER_ON = 'A'; static const char CAPPER_ON = 'A';
static const char CONNECT = 'i'; static const char CONNECT = 'i';
static const char DEBUG = 'd'; static const char DEBUG = 'd';
static const char ERROR = 'E';
static const char LIGHT = 'l'; static const char LIGHT = 'l';
static const char LIGHT_IDENTIFIER = 'o'; static const char LIGHT_IDENTIFIER = 'o';
static const char MCOPY_IDENTIFIER = 'm'; static const char MCOPY_IDENTIFIER = 'm';
@ -59,7 +61,8 @@ class McopySerial {
static const char PROJECTOR_SECOND_IDENTIFIER = 't'; static const char PROJECTOR_SECOND_IDENTIFIER = 't';
static const char PROJECTORS = 'x'; static const char PROJECTORS = 'x';
static const char PROJECTORS_IDENTIFIER = 'd'; static const char PROJECTORS_IDENTIFIER = 'd';
static const char TAKEUP_BACKWARD = 'E'; static const char STATE = 'H';
static const char TAKEUP_BACKWARD = 'F';
static const char TAKEUP_FORWARD = 'D'; static const char TAKEUP_FORWARD = 'D';
/* END CMD FLAGS */ /* END CMD FLAGS */
@ -70,6 +73,8 @@ class McopySerial {
void setIdentity(char identity); void setIdentity(char identity);
char loop(); char loop();
void confirm(char cmd); void confirm(char cmd);
String getString();
void print(String message);
void debug (bool state); void debug (bool state);
void log (String message); void log (String message);

View File

@ -63,3 +63,14 @@ void McopySerial::log (String message) {
Serial.println(message); Serial.println(message);
} }
} }
String McopySerial::getString () {
while (Serial.available() == 0) {
//Wait for value string
}
return Serial.readString();
}
void McopySerial::print (String message) {
Serial.println(message);
}

View File

@ -26,6 +26,7 @@ class McopySerial {
static const char CAMERA_CAPPER_IDENTIFIER = '8'; static const char CAMERA_CAPPER_IDENTIFIER = '8';
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9'; static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0'; static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
static const char CAMERA_EXPOSURE = 'G';
static const char CAMERA_FORWARD = 'e'; static const char CAMERA_FORWARD = 'e';
static const char CAMERA_IDENTIFIER = 'k'; static const char CAMERA_IDENTIFIER = 'k';
static const char CAMERA_PROJECTORS_IDENTIFIER = '5'; static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
@ -43,6 +44,7 @@ class McopySerial {
static const char CAPPER_ON = 'A'; static const char CAPPER_ON = 'A';
static const char CONNECT = 'i'; static const char CONNECT = 'i';
static const char DEBUG = 'd'; static const char DEBUG = 'd';
static const char ERROR = 'E';
static const char LIGHT = 'l'; static const char LIGHT = 'l';
static const char LIGHT_IDENTIFIER = 'o'; static const char LIGHT_IDENTIFIER = 'o';
static const char MCOPY_IDENTIFIER = 'm'; static const char MCOPY_IDENTIFIER = 'm';
@ -59,7 +61,8 @@ class McopySerial {
static const char PROJECTOR_SECOND_IDENTIFIER = 't'; static const char PROJECTOR_SECOND_IDENTIFIER = 't';
static const char PROJECTORS = 'x'; static const char PROJECTORS = 'x';
static const char PROJECTORS_IDENTIFIER = 'd'; static const char PROJECTORS_IDENTIFIER = 'd';
static const char TAKEUP_BACKWARD = 'E'; static const char STATE = 'H';
static const char TAKEUP_BACKWARD = 'F';
static const char TAKEUP_FORWARD = 'D'; static const char TAKEUP_FORWARD = 'D';
/* END CMD FLAGS */ /* END CMD FLAGS */
@ -70,6 +73,8 @@ class McopySerial {
void setIdentity(char identity); void setIdentity(char identity);
char loop(); char loop();
void confirm(char cmd); void confirm(char cmd);
String getString();
void print(String message);
void debug (bool state); void debug (bool state);
void log (String message); void log (String message);