I can't get FocusControl to work via ATEM(ext) Arduino library

3 posts / 0 new
Last post
Offline

Location

San Diego
United States
Joined: 29/09/2016
Posts: 2
I can't get FocusControl to work via ATEM(ext) Arduino library

(edited title for clarity)

Hi All, 

I am building a wifi-based follow focus based on the ESP8266 platform (Adafruit Feather Huzzah).  I am having trouble getting control of focus as it seems to be jumping all over the place.  I'm hoping someone has some insight.

My setup: ATEM 2M/E Production 4K, Blackmagic Studio Camera HD, Metabones EF to MFT T Smart Adapter, Canon EF 70-200mm 2.8 Non-IS lens

My problem: The numbers returned by getCameraControlFocus() seem to be "out of range"  Also, I have lots of reconnects, maybe this is normal?

Here is my code:

void loop() {
    // Check for packets, respond to them etc. Keeping the connection alive!
    AtemSwitcher.runLoop();

    // If the switcher has been initialized, check for button presses as reflect status of switcher in button lights:
    if (AtemSwitcher.hasInitialized())  {
      if (!AtemOnline)  {
        AtemOnline = true;
        Serial << F("Connected\n");

      }

      long timeout, origValue;   // Timing

      long focusActual = AtemSwitcher.getCameraControlFocus(camera);
      long focus = 100;

      if (focus != focusActual) {
        Serial << F("Setting focus to ") << focus << F(" from ") << focusActual << F("\n");

        AtemSwitcher.setCameraControlFocus(camera, focus);

        timeout = millis();
        do {
          AtemSwitcher.runLoop();
        } while (AtemSwitcher.getCameraControlFocus(camera) != focus && !AtemSwitcher.hasTimedOut(timeout, timeOutDelay));
      }

    }
    else {
      if (AtemOnline)  {
        AtemOnline = false;

        Serial << F("Connection lost...\n");
      }
    }

}

And here is the output from the Serial Monitor:

ATEM _hasInitialized = TRUE
Connected
Setting focus to 100 from -14119
Setting focus to 100 from -14119
Setting focus to 100 from -14119
Connection to ATEM Switcher has timed out - reconnecting!
Sending connect packet to ATEM switcher on IP 10.100.0.2 from port 54418
Connection lost...
rpID: 0
rpID: 1
rpID: 3
rpID: 5
rpID: 7
rpID: 8
rpID: 9
rpID: 10
rpID: 11
rpID: 12
rpID: 13
rpID: 14
rpID: 15
rpID: 17
rpID: 19
rpID: 20
rpID: 21
rpID: 22
rpID: 23
rpID: 25 - ACK!
ATEM _hasInitialized = TRUE
Connected
Setting focus to 100 from -13919
Setting focus to 100 from -13919
Setting focus to 100 from -13919
Connection to ATEM Switcher has timed out - reconnecting!
Sending connect packet to ATEM switcher on IP 10.100.0.2 from port 62470
Connection lost...
rpID: 0
rpID: 1
rpID: 2
rpID: 3
rpID: 5
rpID: 6
rpID: 7
rpID: 8
rpID: 9
rpID: 10
rpID: 11
rpID: 12
rpID: 13
rpID: 14
rpID: 15
rpID: 17
rpID: 19
rpID: 20
rpID: 22
rpID: 23
rpID: 25 - ACK!

And this repeats indefinitely.

The rub here for me is the docs section from Skaarhoj's protocol page: 

16-17
int16

if Adjustment Domain = 0 and Adjust Feature = 0

Focus

Camera Focus get values are absolute.
0-65535
void setCameraControlFocus(uint8_t input, int focus)

Some thought dumping here:

"get values are absolute."  Does that mean that set values are relative?  Also, the values being negative seem out of range.  Am I experiencing an overflow?  If 65535 is the range, that should fit in a uint16 but it's defined as int?

 

Thanks for insight from anyone who might help.

 

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
Test

Hi Daniel,

What have you tested?

First I would test whether the focus control in ATEM software actually controls the focus of the lens.

Second I would make the Arduino read the focus every second and then adjust the focus using the ATEM software and observe the focus value on via serial monitor to see if the Arduino is reading the change in focus.

Let me know what the results are.

Colin

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller

 

Offline

Location

San Diego
United States
Joined: 29/09/2016
Posts: 2
Not even sure where to start

Not even sure where to start on what I've tested... it's a lot.  I was able to get back today and work a little bit more with the ATEM.  I think this might be an issue (or difference) with the UDP implementation between the two UDP libraries.  As I mentioned in my previous post, I'm using the ESP8266 platform (with Arduino).  I was able to set the serial output to 0x80 which provided some more information.   What I get consistently when that is set is the following:
ERROR: Packet size mismatch: 0 != 1420
ERROR: Packet size mismatch: 0 != 1420
ERROR: Packet size mismatch: 0 != 12
ERROR: Packet size mismatch: 0 != 12
ERROR: Packet size mismatch: 0 != 12
ERROR: Packet size mismatch: 0 != 12
ERROR: Packet size mismatch: 0 != 12
ERROR: Packet size mismatch: 0 != 12
ERROR: Packet size mismatch: 0 != 12
 
Upon digging, it looks like this is a direct take from the Udp library used in ATEMbase.cpp.  I'm going to try to dig up an Ethernet Arduino and see if that resolves the problem.  If it does, there's a bit more digging than the latest ESP8266 changes made by the Skaarhoj folks.
 
Daniel