From 210dc85558e8c9426efcd75d4936a8011f1fdf0f Mon Sep 17 00:00:00 2001 From: mattmcw Date: Sat, 18 Mar 2023 17:04:06 -0400 Subject: [PATCH] Add getString and print methods --- ino/lib/McopySerial/McopySerial.cpp | 11 +++++++++++ ino/lib/McopySerial/McopySerial.h | 7 ++++++- ino/mcopy_JKMM100/McopySerial.cpp | 11 +++++++++++ ino/mcopy_JKMM100/McopySerial.h | 7 ++++++- ino/mcopy_cam_canon/McopySerial.cpp | 11 +++++++++++ ino/mcopy_cam_canon/McopySerial.h | 7 ++++++- 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/ino/lib/McopySerial/McopySerial.cpp b/ino/lib/McopySerial/McopySerial.cpp index c849017..247ef79 100644 --- a/ino/lib/McopySerial/McopySerial.cpp +++ b/ino/lib/McopySerial/McopySerial.cpp @@ -62,4 +62,15 @@ void McopySerial::log (String message) { if (debugOn) { 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); } \ No newline at end of file diff --git a/ino/lib/McopySerial/McopySerial.h b/ino/lib/McopySerial/McopySerial.h index 4e89a0a..db2f9ba 100644 --- a/ino/lib/McopySerial/McopySerial.h +++ b/ino/lib/McopySerial/McopySerial.h @@ -26,6 +26,7 @@ class McopySerial { static const char CAMERA_CAPPER_IDENTIFIER = '8'; static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9'; static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0'; + static const char CAMERA_EXPOSURE = 'G'; static const char CAMERA_FORWARD = 'e'; static const char CAMERA_IDENTIFIER = 'k'; static const char CAMERA_PROJECTORS_IDENTIFIER = '5'; @@ -43,6 +44,7 @@ class McopySerial { static const char CAPPER_ON = 'A'; static const char CONNECT = 'i'; static const char DEBUG = 'd'; + static const char ERROR = 'E'; static const char LIGHT = 'l'; static const char LIGHT_IDENTIFIER = 'o'; static const char MCOPY_IDENTIFIER = 'm'; @@ -59,7 +61,8 @@ class McopySerial { static const char PROJECTOR_SECOND_IDENTIFIER = 't'; static const char PROJECTORS = 'x'; 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'; /* END CMD FLAGS */ @@ -70,6 +73,8 @@ class McopySerial { void setIdentity(char identity); char loop(); void confirm(char cmd); + String getString(); + void print(String message); void debug (bool state); void log (String message); diff --git a/ino/mcopy_JKMM100/McopySerial.cpp b/ino/mcopy_JKMM100/McopySerial.cpp index c849017..247ef79 100644 --- a/ino/mcopy_JKMM100/McopySerial.cpp +++ b/ino/mcopy_JKMM100/McopySerial.cpp @@ -62,4 +62,15 @@ void McopySerial::log (String message) { if (debugOn) { 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); } \ No newline at end of file diff --git a/ino/mcopy_JKMM100/McopySerial.h b/ino/mcopy_JKMM100/McopySerial.h index 4e89a0a..db2f9ba 100644 --- a/ino/mcopy_JKMM100/McopySerial.h +++ b/ino/mcopy_JKMM100/McopySerial.h @@ -26,6 +26,7 @@ class McopySerial { static const char CAMERA_CAPPER_IDENTIFIER = '8'; static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9'; static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0'; + static const char CAMERA_EXPOSURE = 'G'; static const char CAMERA_FORWARD = 'e'; static const char CAMERA_IDENTIFIER = 'k'; static const char CAMERA_PROJECTORS_IDENTIFIER = '5'; @@ -43,6 +44,7 @@ class McopySerial { static const char CAPPER_ON = 'A'; static const char CONNECT = 'i'; static const char DEBUG = 'd'; + static const char ERROR = 'E'; static const char LIGHT = 'l'; static const char LIGHT_IDENTIFIER = 'o'; static const char MCOPY_IDENTIFIER = 'm'; @@ -59,7 +61,8 @@ class McopySerial { static const char PROJECTOR_SECOND_IDENTIFIER = 't'; static const char PROJECTORS = 'x'; 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'; /* END CMD FLAGS */ @@ -70,6 +73,8 @@ class McopySerial { void setIdentity(char identity); char loop(); void confirm(char cmd); + String getString(); + void print(String message); void debug (bool state); void log (String message); diff --git a/ino/mcopy_cam_canon/McopySerial.cpp b/ino/mcopy_cam_canon/McopySerial.cpp index c849017..247ef79 100644 --- a/ino/mcopy_cam_canon/McopySerial.cpp +++ b/ino/mcopy_cam_canon/McopySerial.cpp @@ -62,4 +62,15 @@ void McopySerial::log (String message) { if (debugOn) { 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); } \ No newline at end of file diff --git a/ino/mcopy_cam_canon/McopySerial.h b/ino/mcopy_cam_canon/McopySerial.h index 4e89a0a..db2f9ba 100644 --- a/ino/mcopy_cam_canon/McopySerial.h +++ b/ino/mcopy_cam_canon/McopySerial.h @@ -26,6 +26,7 @@ class McopySerial { static const char CAMERA_CAPPER_IDENTIFIER = '8'; static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9'; static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0'; + static const char CAMERA_EXPOSURE = 'G'; static const char CAMERA_FORWARD = 'e'; static const char CAMERA_IDENTIFIER = 'k'; static const char CAMERA_PROJECTORS_IDENTIFIER = '5'; @@ -43,6 +44,7 @@ class McopySerial { static const char CAPPER_ON = 'A'; static const char CONNECT = 'i'; static const char DEBUG = 'd'; + static const char ERROR = 'E'; static const char LIGHT = 'l'; static const char LIGHT_IDENTIFIER = 'o'; static const char MCOPY_IDENTIFIER = 'm'; @@ -59,7 +61,8 @@ class McopySerial { static const char PROJECTOR_SECOND_IDENTIFIER = 't'; static const char PROJECTORS = 'x'; 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'; /* END CMD FLAGS */ @@ -70,6 +73,8 @@ class McopySerial { void setIdentity(char identity); char loop(); void confirm(char cmd); + String getString(); + void print(String message); void debug (bool state); void log (String message);