USB Remote Switch in CHDK - version 2 implementation thread - page 3 - General Discussion and Assistance - CHDK Forum

USB Remote Switch in CHDK - version 2 implementation thread

  • 220 Replies
  • 67123 Views
*

Offline vnd

  • *
  • 36
Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #20 on: 10 / December / 2011, 08:20:51 »
Advertisements
If the code is going to be rewritten, I'd suggest implementing a low-level "driver" for each remote, with these functions:

get_remote_state()  - called periodically from kbd_process(), return one of HALF-PRESS, FULL_PRESS, RELEASE
wait_for_synch() - optional function for high-precision synchronization, called from wait_until_remote_button_is_released()

The code in kbd_process() should not query the usb directly, but use this interface.


Here is a more detailed proposal.

*

Offline zeno

  • *****
  • 891
Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #21 on: 10 / December / 2011, 10:15:54 »
Having read through most of this, including the proposals, I'm slightly worried that the ability to determine the pulse length (i.e. the value currently returned by get_usb_power - the number of 10ms ticks that power was applied) might be lost. There are quite a few of us whose scripts depend on this.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #22 on: 10 / December / 2011, 10:42:43 »
Having read through most of this, including the proposals, I'm slightly worried that the ability to determine the pulse length (i.e. the value currently returned by get_usb_power - the number of 10ms ticks that power was applied) might be lost. There are quite a few of us whose scripts depend on this.
I understand your concern as I'm actually interested in cleaning this whole thing up for scripting purposes too.  That's why I proposed that we expand a bit on that function - creating a FIFO buffer of measured pulse lengths so that you don't lose any while doing other processing.

Quote
5. Add scripting support to buffer up to 10 pulses widths - never miss a command.
6. Add scripting support for pulse counting - returns number of pulses since last called.

So, no worries - scripting will not get hurt in this process.

Update :  Incidentally,  get_usb_power() is actually supported in my_kbd_read_keys() , independent of the USB remote code. 

« Last Edit: 10 / December / 2011, 10:54:30 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #23 on: 10 / December / 2011, 10:47:20 »
Update :  have been communicating with vnd via email to discuss what the current code actually supports ( and what actually works ).   Should finish that up in the next couple of days,  at which point a discussion about what to do next is probably appropriate.

Ported :   A1200    SD940   G10    Powershot N    G16


Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #24 on: 10 / December / 2011, 12:05:20 »
If the code is going to be rewritten, I'd suggest implementing a low-level "driver" for each remote, with these functions:

...
I like this idea.  If done correctly,  it should be possible to add new devices fairly cleanly & easily (the gentles devices come to mind) at some point in the future. 

Also,  it should be possible to add new decoupled "functions" to define what a device does when activated, independent of which device is connected. In addition to the core "halfshoot / fullshoot / release" logic,  functions for real remote zoom, bracketing, video etc could be  added.

If the recent thread about CHDK : Elf Edition gets traction and enables loadable modules,  this gets really exciting !

In the attachment are some of my thoughts on how the synchable remote currently works and what are the problems with CA-1.
This makes sense but is it worth trying to fix the existing kbd.c code to do this ? 
« Last Edit: 10 / December / 2011, 12:22:04 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #25 on: 18 / December / 2011, 09:31:27 »
Update :  I think vnd and I are pretty much done working on the current code.  For reference,  I've attached what we have done here.  This cleaned up version of kbd.c builds, runs and the USB remote works (at least in "Alex Scriptless Remote" mode).  But as it should compile essentially identically to the current code (with all its problems),  I would not propose merging into the trunk unless this cleanup effort dies and some more testing is done.

Also for reference (should somebody follow this someday),  here's a flowchart of the "syncable remote" logic.


Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline an0n

  • ***
  • 152
Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #26 on: 28 / December / 2011, 22:55:47 »
To waterwingz,

Thanks very much for  your work with CHDK.
As a long time user of CHDK, one of the main attractions is the ability to use the remote shutter control for my camera, ...it has it's quirks, but even so I have worked with that because of the benefits. As an "ordinary user" I encourage your work although knowing it probably means a lot of effort from you, thanks.

I have been delaying publishing an update to the User Guide which is done except for the USB Remote description, I should check here more often. Anyway I have been trying to test the operation and research the Wiki and here but still can't produce a proper description, so now I will wait to see your outcomes and update that section later. I would appreciate if you could let me know of any menu changes to include.
Thanks, An0n.
A720IS.

Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #27 on: 29 / December / 2011, 00:44:01 »
I have been delaying publishing an update to the User Guide which is done except for the USB Remote description, I should check here more often. Anyway I have been trying to test the operation and research the Wiki and here but still can't produce a proper description, so now I will wait to see your outcomes and update that section later. I would appreciate if you could let me know of any menu changes to include.
an0n : it might be a while before I have anything that you can write about (although I have a new framework for USB remote operations running now).  And what I have will go into the new dev / unstable branch at least at first so the regular users might not see it for a while.  One of the frustrations of trying to get new code produced is understanding what the old code was supposed to do - especially the parts about sync'ing in continuous modes and remote zoom.  And there are several fairly obvious errors in the code, which does not help the process.

So one option now for your excellent User Guide is to better describe what it does today.  I updated the stuff in the wiki several month ago :  http://chdk.wikia.com/wiki/USB_Remote_Cable.   I could probably draft a couple of additional pages of notes now that I think I know how it is supposed to work.  Would be interested in converting that into something for your guide ?

Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline an0n

  • ***
  • 152
Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #28 on: 02 / January / 2012, 03:05:23 »
To waterwingz,

Ok, thanks for the offer, I won't take it up for now, you already have plenty to keep you busy. I have made some changes and will go with them for now and change again if / when you have completed the new work. FWIW, I use the synchable remote, (it seems to be more reliable) and although I would have used remote zoom I could not get it to operate with my camera, trying many combinations. For quick access to Enable Remote, (and anything else) there is the User Menu, or with ALT press F/Set goes straight to Scripting params.
an0n.
A720IS.

Re: USB Remote Switch in CHDK - an open discussion about cleaning up the code
« Reply #29 on: 02 / January / 2012, 08:36:39 »
I would have used remote zoom I could not get it to operate with my camera, trying many combinations.
What did you think remote zoom was supposed to do?  Or more important,  what did you want it to do?

I've read the code and I think I understand what it does.  There is also this link> SYNCHRONISED ZOOMING.

What I think I see is a process where you have to play with the camera setup, click your remote to zoom one or more steps and then wait for the zoom to time out so that you can press the shutter button to take a picture.   I must be missing something - how is that useful, even when syncing multiple cameras ? You have to do so many things right at the camera that the remote is no benefit at all ?
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics