diff --git a/ino/lib/McopySerial/McopySerial.cpp b/ino/lib/McopySerial/McopySerial.cpp index 4b15df1..34e5532 100644 --- a/ino/lib/McopySerial/McopySerial.cpp +++ b/ino/lib/McopySerial/McopySerial.cpp @@ -1,12 +1,15 @@ #include "McopySerial.h" -void McopySerial::begin (int baudRate) { - baud = baudRate; - begin(); +McopySerial::McopySerial () { + } void McopySerial::begin () { + Serial.begin(baud); +} +void McopySerial::setBaud (int baudRate) { + baud = baudRate; } void McopySerial::debug (bool state) { diff --git a/ino/lib/McopySerial/McopySerial.h b/ino/lib/McopySerial/McopySerial.h index de3c700..a011713 100644 --- a/ino/lib/McopySerial/McopySerial.h +++ b/ino/lib/McopySerial/McopySerial.h @@ -10,8 +10,10 @@ class McopySerial { volatile bool debugOn = false; public: + McopySerial(); + void begin(); - void begin(int baudRate); + void setBaud(int baudRate); 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 4b15df1..34e5532 100644 --- a/ino/mcopy_cam_canon/McopySerial.cpp +++ b/ino/mcopy_cam_canon/McopySerial.cpp @@ -1,12 +1,15 @@ #include "McopySerial.h" -void McopySerial::begin (int baudRate) { - baud = baudRate; - begin(); +McopySerial::McopySerial () { + } void McopySerial::begin () { + Serial.begin(baud); +} +void McopySerial::setBaud (int baudRate) { + baud = baudRate; } void McopySerial::debug (bool state) { diff --git a/ino/mcopy_cam_canon/McopySerial.h b/ino/mcopy_cam_canon/McopySerial.h index de3c700..a011713 100644 --- a/ino/mcopy_cam_canon/McopySerial.h +++ b/ino/mcopy_cam_canon/McopySerial.h @@ -10,8 +10,10 @@ class McopySerial { volatile bool debugOn = false; public: + McopySerial(); + void begin(); - void begin(int baudRate); + void setBaud(int baudRate); void debug (bool state); void log (String message); diff --git a/ino/mcopy_cam_canon/mcopy_cam_canon.ino b/ino/mcopy_cam_canon/mcopy_cam_canon.ino index ac3568a..e25ce57 100644 --- a/ino/mcopy_cam_canon/mcopy_cam_canon.ino +++ b/ino/mcopy_cam_canon/mcopy_cam_canon.ino @@ -33,6 +33,8 @@ volatile bool ledState; const String name_remote = "mcopy"; CanonBLERemote canon_ble(name_remote); TickTwo blinker(blink, 500); +//McopySerial mc; + volatile boolean connected = false; volatile long now; @@ -47,12 +49,13 @@ void blink(){ void setup() { - Serial.begin(57600); esp_log_level_set("*", ESP_LOG_INFO); pinMode(SHUTTTER_BTN, INPUT_PULLUP); pinMode(LED, OUTPUT); + //mc.begin(); + canon_ble.init(); delay(1000); blinker.start(); @@ -71,8 +74,8 @@ void connectBLE () { digitalWrite(LED, HIGH); delay(1000); - Serial.println("Camera paired"); - Serial.println(canon_ble.getPairedAddressString()); + //mc.log("Camera paired"); + //mc.log(canon_ble.getPairedAddressString()); } void loop() @@ -93,7 +96,7 @@ void loop() blinker.update(); if (connected && !canon_ble.isConnected()) { connected = false; - Serial.println("Disconnected"); + //mc.log("Disconnected"); blinker.interval(500); blinker.resume(); } @@ -102,10 +105,10 @@ void loop() void shutter () { digitalWrite(LED, LOW); blinker.resume(); - Serial.println("Shutter pressed"); + //mc.log("Shutter pressed"); if(!canon_ble.trigger()){ - Serial.println("Trigger Failed"); + //mc.log("Trigger Failed"); } blinker.pause();