sensslen / LibLanc

Arduino Library to communicate to Lanc enabled Cameras
MIT License
16 stars 2 forks source link

How to set up new commands for a different camera #12

Open Morgan-Caldbeck opened 7 months ago

Morgan-Caldbeck commented 7 months ago

Hey there,

I'm reading through some of the code but don't fully understand it yet. I have a Zcam camera, which supports lanc control. I would like to connect to it and control via an Arduino board with various switches and encoders. Seems easy enough with this library to define the pins being used on the board and assign commands to be triggered.

Here is a link to the camera protocol I would like to use. Zcam lanc protocol

If you could walk me through or give me steps to set this up it would be greatly appreciated!

sensslen commented 7 months ago

Well, can you try whether the zoom command already works? In general lanc is a standard and thus the commands stay the same.

Morgan-Caldbeck commented 7 months ago

Well, can you try whether the zoom command already works? In general lanc is a standard and thus the commands stay the same.

I would, however the zcam is a cinema camera using a non-motor controlled zoom lens, so that particular command wouldn’t trigger anything. They are using their own customized control protocol, as shown in the link I included that gives a breakdown of the various camera commands.

I would guess that the rec start/stop function would the lanc standard, that would be a better starting point. Once I understand how to add the hex/binary commands I could build the rest out myself.

sensslen commented 7 months ago

Have you tried? The commands do match.....

Morgan-Caldbeck commented 7 months ago

Where do you have the commands mapped out? I would like to understand what I’m seeing here before I push things to the camera.

sensslen commented 7 months ago

There is no command map. Basically the library sends the commands as specified by the lanc protocol. https://github.com/sensslen/LibLanc/blob/4789109d77b78914f79eb230d19405823da24b53/LibLancBlocking.cpp#L35 for example sends activates a zoom command.

Morgan-Caldbeck commented 7 months ago

Okay, I see. Is there any way to map custom commands then? Because the ones I would like to execute don’t exist in the standard lanc protocol. Such as the key emulation for navigating the cameras menus, as well as eND+/- and iso+/-

sensslen commented 7 months ago

As of now, the simple answer is no. However I've been thinking of seperating the communication layer (transmitting/receiving bytes) from the actual commands. Then this would be very easy. Unfortunately I don't have much time currently so I don't know when I would be able to pull this refactor of. Feel free to jump in here.

The basic Idea here is to have an abstract class called ILancCommand for example. This class would have a method to get the two bytes to be sent and another method that is called upon receiving a byte. The communication layer (link layer?) would then provide a method to set the next command (similar to the current zoom method).

sensslen commented 2 months ago

I'm happy to report that today I implemented a commanding mechanism. @Morgan-Caldbeck would you mind checking whether the commands present in version 3.0.0 suit your needs? You should be able to implement your own command and both LancBlocking and LancNonBlocking will accept them for processing.