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"
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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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();