canon_ble #82

Merged
mattmcw merged 149 commits from canon_ble into main 2023-08-01 03:38:52 +00:00
5 changed files with 27 additions and 14 deletions
Showing only changes of commit e27cae353f - Show all commits

View File

@ -1,12 +1,15 @@
#include "McopySerial.h" #include "McopySerial.h"
void McopySerial::begin (int baudRate) { McopySerial::McopySerial () {
baud = baudRate;
begin();
} }
void McopySerial::begin () { void McopySerial::begin () {
Serial.begin(baud);
}
void McopySerial::setBaud (int baudRate) {
baud = baudRate;
} }
void McopySerial::debug (bool state) { void McopySerial::debug (bool state) {

View File

@ -10,8 +10,10 @@ class McopySerial {
volatile bool debugOn = false; volatile bool debugOn = false;
public: public:
McopySerial();
void begin(); void begin();
void begin(int baudRate); void setBaud(int baudRate);
void debug (bool state); void debug (bool state);
void log (String message); void log (String message);

View File

@ -1,12 +1,15 @@
#include "McopySerial.h" #include "McopySerial.h"
void McopySerial::begin (int baudRate) { McopySerial::McopySerial () {
baud = baudRate;
begin();
} }
void McopySerial::begin () { void McopySerial::begin () {
Serial.begin(baud);
}
void McopySerial::setBaud (int baudRate) {
baud = baudRate;
} }
void McopySerial::debug (bool state) { void McopySerial::debug (bool state) {

View File

@ -10,8 +10,10 @@ class McopySerial {
volatile bool debugOn = false; volatile bool debugOn = false;
public: public:
McopySerial();
void begin(); void begin();
void begin(int baudRate); void setBaud(int baudRate);
void debug (bool state); void debug (bool state);
void log (String message); void log (String message);

View File

@ -33,6 +33,8 @@ volatile bool ledState;
const String name_remote = "mcopy"; const String name_remote = "mcopy";
CanonBLERemote canon_ble(name_remote); CanonBLERemote canon_ble(name_remote);
TickTwo blinker(blink, 500); TickTwo blinker(blink, 500);
//McopySerial mc;
volatile boolean connected = false; volatile boolean connected = false;
volatile long now; volatile long now;
@ -47,12 +49,13 @@ void blink(){
void setup() void setup()
{ {
Serial.begin(57600);
esp_log_level_set("*", ESP_LOG_INFO); esp_log_level_set("*", ESP_LOG_INFO);
pinMode(SHUTTTER_BTN, INPUT_PULLUP); pinMode(SHUTTTER_BTN, INPUT_PULLUP);
pinMode(LED, OUTPUT); pinMode(LED, OUTPUT);
//mc.begin();
canon_ble.init(); canon_ble.init();
delay(1000); delay(1000);
blinker.start(); blinker.start();
@ -71,8 +74,8 @@ void connectBLE () {
digitalWrite(LED, HIGH); digitalWrite(LED, HIGH);
delay(1000); delay(1000);
Serial.println("Camera paired"); //mc.log("Camera paired");
Serial.println(canon_ble.getPairedAddressString()); //mc.log(canon_ble.getPairedAddressString());
} }
void loop() void loop()
@ -93,7 +96,7 @@ void loop()
blinker.update(); blinker.update();
if (connected && !canon_ble.isConnected()) { if (connected && !canon_ble.isConnected()) {
connected = false; connected = false;
Serial.println("Disconnected"); //mc.log("Disconnected");
blinker.interval(500); blinker.interval(500);
blinker.resume(); blinker.resume();
} }
@ -102,10 +105,10 @@ void loop()
void shutter () { void shutter () {
digitalWrite(LED, LOW); digitalWrite(LED, LOW);
blinker.resume(); blinker.resume();
Serial.println("Shutter pressed"); //mc.log("Shutter pressed");
if(!canon_ble.trigger()){ if(!canon_ble.trigger()){
Serial.println("Trigger Failed"); //mc.log("Trigger Failed");
} }
blinker.pause(); blinker.pause();