Move mcopy serial script. Add work (isn't working).

This commit is contained in:
Matt McWilliams 2023-03-08 21:28:09 -05:00
parent 346c303edb
commit 95e2e997e5
5 changed files with 36 additions and 3 deletions

View File

@ -1,13 +1,27 @@
/// mcopy Serial Library
#include "McopySerial.h" #include "McopySerial.h"
McopySerial::McopySerial () { McopySerial::McopySerial () {
} }
void McopySerial::on()
void McopySerial::begin () { void McopySerial::begin () {
Serial.begin(baud); Serial.begin(baud);
} }
void McopySerial::loop () {
if (Serial.available()) {
cmdChar = (char) Serial.read();
}
if (cmdChar != 'z') {
//cmd(cmdChar);
cmdChar = 'z';
}
}
void McopySerial::setBaud (int baudRate) { void McopySerial::setBaud (int baudRate) {
baud = baudRate; baud = baudRate;
} }

View File

@ -3,17 +3,21 @@
#include "Arduino.h" #include "Arduino.h"
typedef void (*mcopy_callback)(void);
class McopySerial { class McopySerial {
private: private:
volatile int baud = 57600; volatile int baud = 57600;
volatile bool debugOn = false; volatile bool debugOn = false;
volatile char cmdChar = 'z';
public: public:
McopySerial(); McopySerial();
void begin(); void begin();
void setBaud(int baudRate); void setBaud(int baudRate);
void loop();
void debug (bool state); void debug (bool state);
void log (String message); void log (String message);

View File

@ -1,3 +0,0 @@
#!/bin/bash
cp McopySerial.* ../../mcopy_cam_canon/

View File

@ -1,13 +1,27 @@
/// mcopy Serial Library
#include "McopySerial.h" #include "McopySerial.h"
McopySerial::McopySerial () { McopySerial::McopySerial () {
} }
void McopySerial::on()
void McopySerial::begin () { void McopySerial::begin () {
Serial.begin(baud); Serial.begin(baud);
} }
void McopySerial::loop () {
if (Serial.available()) {
cmdChar = (char) Serial.read();
}
if (cmdChar != 'z') {
//cmd(cmdChar);
cmdChar = 'z';
}
}
void McopySerial::setBaud (int baudRate) { void McopySerial::setBaud (int baudRate) {
baud = baudRate; baud = baudRate;
} }

View File

@ -3,17 +3,21 @@
#include "Arduino.h" #include "Arduino.h"
typedef void (*mcopy_callback)(void);
class McopySerial { class McopySerial {
private: private:
volatile int baud = 57600; volatile int baud = 57600;
volatile bool debugOn = false; volatile bool debugOn = false;
volatile char cmdChar = 'z';
public: public:
McopySerial(); McopySerial();
void begin(); void begin();
void setBaud(int baudRate); void setBaud(int baudRate);
void loop();
void debug (bool state); void debug (bool state);
void log (String message); void log (String message);