Canon BLE firmware now uses the McopySerial script for it's USB communication.

This commit is contained in:
Matt McWilliams 2023-03-09 21:30:59 -05:00
parent d7017af245
commit 234e69c7a2
1 changed files with 9 additions and 7 deletions

View File

@ -33,7 +33,7 @@ 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(McopySerial::CAMERA); McopySerial mc(McopySerial::CAMERA_IDENTIFIER);
volatile boolean connected = false; volatile boolean connected = false;
@ -54,7 +54,7 @@ void setup()
pinMode(SHUTTTER_BTN, INPUT_PULLUP); pinMode(SHUTTTER_BTN, INPUT_PULLUP);
pinMode(LED, OUTPUT); pinMode(LED, OUTPUT);
//mc.begin(); mc.begin();
canon_ble.init(); canon_ble.init();
delay(1000); delay(1000);
@ -74,8 +74,8 @@ void connectBLE () {
digitalWrite(LED, HIGH); digitalWrite(LED, HIGH);
delay(1000); delay(1000);
//mc.log("Camera paired"); mc.log("Camera paired");
//mc.log(canon_ble.getPairedAddressString()); mc.log(canon_ble.getPairedAddressString());
} }
void loop() void loop()
@ -83,7 +83,7 @@ void loop()
now = millis(); now = millis();
cmd = mc.loop(); cmd = mc.loop();
if (cmd == 'c' && last + 1000 < now) { if (cmd == McopySerial::CAMERA && last + 1000 < now) {
shutter(); shutter();
} }
@ -91,7 +91,9 @@ void loop()
if (digitalRead(SHUTTTER_BTN) == LOW && last + 1000 < now){ if (digitalRead(SHUTTTER_BTN) == LOW && last + 1000 < now){
shutter(); shutter();
} }
blinker.update(); blinker.update();
if (connected && !canon_ble.isConnected()) { if (connected && !canon_ble.isConnected()) {
connected = false; connected = false;
//mc.log("Disconnected"); //mc.log("Disconnected");
@ -103,10 +105,10 @@ void loop()
void shutter () { void shutter () {
digitalWrite(LED, LOW); digitalWrite(LED, LOW);
blinker.resume(); blinker.resume();
//mc.log("Shutter pressed"); mc.log("Shutter pressed");
if(!canon_ble.trigger()){ if(!canon_ble.trigger()){
//mc.log("Trigger Failed"); mc.log("Trigger Failed");
} }
blinker.pause(); blinker.pause();