From 8f7a40075aed6b44358a050091fe803097919c42 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Thu, 20 Apr 2023 22:37:37 -0400 Subject: [PATCH] Add connected and identified member booleans to determine when fully connected to mcopy. --- ino/components/mcopy_light/McopySerial.cpp | 2 ++ ino/components/mcopy_light/McopySerial.h | 3 +++ ino/lib/McopySerial/McopySerial.cpp | 2 ++ ino/lib/McopySerial/McopySerial.h | 3 +++ ino/mcopy_JKMM100/McopySerial.cpp | 2 ++ ino/mcopy_JKMM100/McopySerial.h | 3 +++ ino/mcopy_arri_s_firmware/McopySerial.cpp | 2 ++ ino/mcopy_arri_s_firmware/McopySerial.h | 3 +++ ino/mcopy_cam_canon_ble/McopySerial.cpp | 2 ++ ino/mcopy_cam_canon_ble/McopySerial.h | 3 +++ ino/mcopy_cam_relay/McopySerial.cpp | 2 ++ ino/mcopy_cam_relay/McopySerial.h | 3 +++ 12 files changed, 30 insertions(+) diff --git a/ino/components/mcopy_light/McopySerial.cpp b/ino/components/mcopy_light/McopySerial.cpp index d1af619..7662948 100644 --- a/ino/components/mcopy_light/McopySerial.cpp +++ b/ino/components/mcopy_light/McopySerial.cpp @@ -32,11 +32,13 @@ void McopySerial::_internal () { } void McopySerial::_connect () { + connected = true; Serial.println(CONNECT); log("connect()"); } void McopySerial::_identify () { + identified = true; Serial.println(id); log("identify()"); } diff --git a/ino/components/mcopy_light/McopySerial.h b/ino/components/mcopy_light/McopySerial.h index f02c089..0762c6d 100644 --- a/ino/components/mcopy_light/McopySerial.h +++ b/ino/components/mcopy_light/McopySerial.h @@ -20,6 +20,9 @@ class McopySerial { public: + volatile bool connected = false; + volatile bool identified = false; + /* CMD FLAGS */ const char BLACK = 'b'; const char CAMERA = 'c'; diff --git a/ino/lib/McopySerial/McopySerial.cpp b/ino/lib/McopySerial/McopySerial.cpp index d1af619..7662948 100644 --- a/ino/lib/McopySerial/McopySerial.cpp +++ b/ino/lib/McopySerial/McopySerial.cpp @@ -32,11 +32,13 @@ void McopySerial::_internal () { } void McopySerial::_connect () { + connected = true; Serial.println(CONNECT); log("connect()"); } void McopySerial::_identify () { + identified = true; Serial.println(id); log("identify()"); } diff --git a/ino/lib/McopySerial/McopySerial.h b/ino/lib/McopySerial/McopySerial.h index f02c089..0762c6d 100644 --- a/ino/lib/McopySerial/McopySerial.h +++ b/ino/lib/McopySerial/McopySerial.h @@ -20,6 +20,9 @@ class McopySerial { public: + volatile bool connected = false; + volatile bool identified = false; + /* CMD FLAGS */ const char BLACK = 'b'; const char CAMERA = 'c'; diff --git a/ino/mcopy_JKMM100/McopySerial.cpp b/ino/mcopy_JKMM100/McopySerial.cpp index d1af619..7662948 100644 --- a/ino/mcopy_JKMM100/McopySerial.cpp +++ b/ino/mcopy_JKMM100/McopySerial.cpp @@ -32,11 +32,13 @@ void McopySerial::_internal () { } void McopySerial::_connect () { + connected = true; Serial.println(CONNECT); log("connect()"); } void McopySerial::_identify () { + identified = true; Serial.println(id); log("identify()"); } diff --git a/ino/mcopy_JKMM100/McopySerial.h b/ino/mcopy_JKMM100/McopySerial.h index f02c089..0762c6d 100644 --- a/ino/mcopy_JKMM100/McopySerial.h +++ b/ino/mcopy_JKMM100/McopySerial.h @@ -20,6 +20,9 @@ class McopySerial { public: + volatile bool connected = false; + volatile bool identified = false; + /* CMD FLAGS */ const char BLACK = 'b'; const char CAMERA = 'c'; diff --git a/ino/mcopy_arri_s_firmware/McopySerial.cpp b/ino/mcopy_arri_s_firmware/McopySerial.cpp index d1af619..7662948 100644 --- a/ino/mcopy_arri_s_firmware/McopySerial.cpp +++ b/ino/mcopy_arri_s_firmware/McopySerial.cpp @@ -32,11 +32,13 @@ void McopySerial::_internal () { } void McopySerial::_connect () { + connected = true; Serial.println(CONNECT); log("connect()"); } void McopySerial::_identify () { + identified = true; Serial.println(id); log("identify()"); } diff --git a/ino/mcopy_arri_s_firmware/McopySerial.h b/ino/mcopy_arri_s_firmware/McopySerial.h index f02c089..0762c6d 100644 --- a/ino/mcopy_arri_s_firmware/McopySerial.h +++ b/ino/mcopy_arri_s_firmware/McopySerial.h @@ -20,6 +20,9 @@ class McopySerial { public: + volatile bool connected = false; + volatile bool identified = false; + /* CMD FLAGS */ const char BLACK = 'b'; const char CAMERA = 'c'; diff --git a/ino/mcopy_cam_canon_ble/McopySerial.cpp b/ino/mcopy_cam_canon_ble/McopySerial.cpp index d1af619..7662948 100644 --- a/ino/mcopy_cam_canon_ble/McopySerial.cpp +++ b/ino/mcopy_cam_canon_ble/McopySerial.cpp @@ -32,11 +32,13 @@ void McopySerial::_internal () { } void McopySerial::_connect () { + connected = true; Serial.println(CONNECT); log("connect()"); } void McopySerial::_identify () { + identified = true; Serial.println(id); log("identify()"); } diff --git a/ino/mcopy_cam_canon_ble/McopySerial.h b/ino/mcopy_cam_canon_ble/McopySerial.h index f02c089..0762c6d 100644 --- a/ino/mcopy_cam_canon_ble/McopySerial.h +++ b/ino/mcopy_cam_canon_ble/McopySerial.h @@ -20,6 +20,9 @@ class McopySerial { public: + volatile bool connected = false; + volatile bool identified = false; + /* CMD FLAGS */ const char BLACK = 'b'; const char CAMERA = 'c'; diff --git a/ino/mcopy_cam_relay/McopySerial.cpp b/ino/mcopy_cam_relay/McopySerial.cpp index d1af619..7662948 100644 --- a/ino/mcopy_cam_relay/McopySerial.cpp +++ b/ino/mcopy_cam_relay/McopySerial.cpp @@ -32,11 +32,13 @@ void McopySerial::_internal () { } void McopySerial::_connect () { + connected = true; Serial.println(CONNECT); log("connect()"); } void McopySerial::_identify () { + identified = true; Serial.println(id); log("identify()"); } diff --git a/ino/mcopy_cam_relay/McopySerial.h b/ino/mcopy_cam_relay/McopySerial.h index f02c089..0762c6d 100644 --- a/ino/mcopy_cam_relay/McopySerial.h +++ b/ino/mcopy_cam_relay/McopySerial.h @@ -20,6 +20,9 @@ class McopySerial { public: + volatile bool connected = false; + volatile bool identified = false; + /* CMD FLAGS */ const char BLACK = 'b'; const char CAMERA = 'c';