I guess the first question is how many discrete commands you want to give? Shoot, zoom in, zoom out, shutdown ?
My use case (orthophoto for aerial surveys) only requires three instructions: "mission start", "shoot", and "mission end". Your script takes the first pulse (any length) as mission start, so I really need only two distinct commands, meaning I don't need a lot of resolution. Right now the APM configuration limits the PWM min and max values to 800 and 2200us (pixhawk hardware can probably do a lot better, but that might mean messing with the [open source!] firmware, which I am not ready to do, as I don't want to destroy my expensive hardware in a crash), so I should be able to use 800us as baseline, 1500us as "shoot", and 2200us as "mission end".
Now I am getting into unknown territory, so I need to understand this process completely:
Assuming my camera has a fast processor, if I recompile CHDK with "CAM_REMOTE_HIGHSPEED_LIMIT 250", I would be able to measure pulses with a 250us resolution. Taking into account the limitations imposed by APM, that would leave me with 750, 1000, 1250, 1500, 1750, and 2000us. I need one of those values for the "no command" state, so that nets me 5 commands. Useful for some, but a waste for me. Maybe I can use a lower resolution? That would mean I don't have to drive my camera hardware so hard, it might be more compatible with slow hardware, and it will probably consume less battery, right?
If I use a CAM_REMOTE_HIGHSPEED_LIMIT value of 700, I get a baseline of 700us, and two usable values at 1400us and 2100us. The mapping would be:
Source (Pixhawk) - Destination (Camera)
800us 700us --> Baseline (awaiting instructions)
1500us 1400us --> Shoot
2200us 2100us --> Mission end
This mapping allows the benefit of sending a pulse 100us longer than needed, that might be useful if the camera clock is not very precise...
Am I correct? Did I miss something? Do you have any suggestions?
Let us know if you need a custom build to try this out.
Unfortunately I don't have the camera with me, and I will not be getting it at least for a month, so right now all I can do is write very long posts... But assuming this change has low chances of bricking my camera I will definitely ask for a custom build.