McopySerial now has a confirm() method which marks the end of a command. This is a wrapper around Serial.println()
This commit is contained in:
parent
234e69c7a2
commit
e09fe7d42f
|
@ -8,6 +8,8 @@ McopySerial::McopySerial (char identity) {
|
||||||
|
|
||||||
void McopySerial::begin () {
|
void McopySerial::begin () {
|
||||||
Serial.begin(baud);
|
Serial.begin(baud);
|
||||||
|
Serial.flush();
|
||||||
|
Serial.setTimeout(serialDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
char McopySerial::loop () {
|
char McopySerial::loop () {
|
||||||
|
@ -52,6 +54,10 @@ void McopySerial::debug (bool state) {
|
||||||
debugOn = state;
|
debugOn = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void McopySerial::confirm (char cmd) {
|
||||||
|
Serial.println(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void McopySerial::log (String message) {
|
void McopySerial::log (String message) {
|
||||||
if (debugOn) {
|
if (debugOn) {
|
||||||
Serial.println(message);
|
Serial.println(message);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
class McopySerial {
|
class McopySerial {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const int serialDelay = 5;
|
||||||
|
|
||||||
volatile int baud = 57600;
|
volatile int baud = 57600;
|
||||||
volatile bool debugOn = false;
|
volatile bool debugOn = false;
|
||||||
volatile char cmdChar = 'z';
|
volatile char cmdChar = 'z';
|
||||||
|
@ -67,6 +69,7 @@ class McopySerial {
|
||||||
void setBaud(int baudRate);
|
void setBaud(int baudRate);
|
||||||
void setIdentity(char identity);
|
void setIdentity(char identity);
|
||||||
char loop();
|
char loop();
|
||||||
|
void confirm(char cmd);
|
||||||
|
|
||||||
void debug (bool state);
|
void debug (bool state);
|
||||||
void log (String message);
|
void log (String message);
|
||||||
|
|
|
@ -8,6 +8,8 @@ McopySerial::McopySerial (char identity) {
|
||||||
|
|
||||||
void McopySerial::begin () {
|
void McopySerial::begin () {
|
||||||
Serial.begin(baud);
|
Serial.begin(baud);
|
||||||
|
Serial.flush();
|
||||||
|
Serial.setTimeout(serialDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
char McopySerial::loop () {
|
char McopySerial::loop () {
|
||||||
|
@ -52,6 +54,10 @@ void McopySerial::debug (bool state) {
|
||||||
debugOn = state;
|
debugOn = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void McopySerial::confirm (char cmd) {
|
||||||
|
Serial.println(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void McopySerial::log (String message) {
|
void McopySerial::log (String message) {
|
||||||
if (debugOn) {
|
if (debugOn) {
|
||||||
Serial.println(message);
|
Serial.println(message);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
class McopySerial {
|
class McopySerial {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const int serialDelay = 5;
|
||||||
|
|
||||||
volatile int baud = 57600;
|
volatile int baud = 57600;
|
||||||
volatile bool debugOn = false;
|
volatile bool debugOn = false;
|
||||||
volatile char cmdChar = 'z';
|
volatile char cmdChar = 'z';
|
||||||
|
@ -67,6 +69,7 @@ class McopySerial {
|
||||||
void setBaud(int baudRate);
|
void setBaud(int baudRate);
|
||||||
void setIdentity(char identity);
|
void setIdentity(char identity);
|
||||||
char loop();
|
char loop();
|
||||||
|
void confirm(char cmd);
|
||||||
|
|
||||||
void debug (bool state);
|
void debug (bool state);
|
||||||
void log (String message);
|
void log (String message);
|
||||||
|
|
Loading…
Reference in New Issue