Full-press without releasing half-press

  • 27 Replies
  • 5359 Views
*

Offline waldo

  • ***
  • 238
  • Publish
    Full-press without releasing half-press
    « on: 21 / May / 2008, 19:00:56 »
    Advertisements
    There was some discussion recently about separating the functionality of the half-press and full-press buttons.

    I implemented the release half without releasing full on a version for the SD800.  It works well to fire shots off rapidly (I use it to quickly shoot and reposition the camera for pictures intended to be stiched together as a panorama).  This may break some scripts since click "shoot_full" and release "shoot_full" no longer have the side effect of releasing the half-press.

    Here's what I changed.  Code for other cameras would differ somewhat:

    in platform/xxx/kbd.c:

       in keymap[] array:

          change:
    Code: [Select]
    {1, KEY_SHOOT_FULL, 0xC0000000 },
          to:
    Code: [Select]
    {1, KEY_SHOOT_FULL, 0x80000000 },
       Function kbd_key_press():
          Change for loop as follows:
    Code: [Select]
    for (i=0;keymap[i].hackkey;i++) {
    if (keymap[i].hackkey == key) {

    ///special case for pressing both half and full press
    ///assumes half press is next item in key map after full press
    if (key == KEY_SHOOT_FULL)
    kbd_mod_state[keymap[i].grp] &= ~(keymap[i].canonkey | keymap[i+1].canonkey);
    else
    kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
    return;
    }
    }


    in core/kbd.c:
       Function kbd_sched_shoot():

          Following the line:
    Code: [Select]
    KBD_STACK_PUSH(SCRIPT_WAIT_SAVE);
          Add:
    Code: [Select]
    KBD_STACK_PUSH(KEY_SHOOT_HALF);
    KBD_STACK_PUSH(SCRIPT_RELEASE);


    I think these are the only areas changed but someone can correct me if I left something out.

    *

    Offline cyril42e

    • ***
    • 111
    • SD1000/Ixus70 1.02a
      • CR-TEKnologies
  • Publish
    Re: Full-press without releasing half-press
    « Reply #1 on: 24 / June / 2008, 17:25:08 »
    I like the idea very much! I just noticed the original behavior (which prevents from taking several shots with the same focus/exposure settings in a script without burst mode), and was investigating.

    I guess we have KEY_SHOOT_FULL = KEY_SHOOT_FULL | KEY_SHOOT_HALF because when shoot_full is pressed, shoot_half must be pressed too. The problem with waldo's solution, as he admitted, is that if you just do "click shoot_full" with everything else released, then shoot_half stays pressed.

    So what I would suggest is to set KEY_SHOOT_FULL such that KEY_SHOOT_FULL & KEY_SHOOT_HALF = 0, as waldo suggested, when KEY_SHOOT_FULL is pressed to press KEY_SHOOT_HALF too as waldo suggested as well, but also to raise a flag when KEY_SHOOT_HALF is automatically pressed because of KEY_SHOOT_FULL, so that we can release KEY_SHOOT_HALF only if it was automatically pressed because of KEY_SHOOT_FULL. And still fixing kbd_sched_shoot as waldo suggested, because it assumes that releasing shoot_full releases shoot_half (it seems to be the only place in CHDK).

    Shouldn't break anything, allows more possibilities, and more intuitive behavior (if you press shoot_half, you have to release it, if you don't press it, you don't have to release it).

    Am I missing something?

    For SD1000, it would be:
    Code: (diff) [Select]
    platform/ixus70_sd1000/kbd.c:22
    +static int auto_pressed_half=0;

    platform/ixus70_sd1000/kbd.c:299,kbd_key_press
     if (keymap[i].hackkey == key){
    + if ((key == KEY_SHOOT_FULL) && (kbd_mod_state[keymap[i+1].grp] & keymap[i+1].canonkey))
    + {
    + auto_pressed_half = 1;
    + kbd_mod_state[keymap[i+1].grp] &= ~keymap[i+1].canonkey;
    + } else
    + if (key == KEY_SHOOT_HALF) auto_pressed_half = 0;

    platform/ixus70_sd1000/kbd.c:316,kbd_key_release
     if (keymap[i].hackkey == key){
    + if ((key == KEY_SHOOT_FULL) && auto_pressed_half)
    + kbd_mod_state[keymap[i+1].grp] |= keymap[i+1].canonkey;
    + if (key == KEY_SHOOT_HALF)
    + kbd_mod_state[keymap[i-1].grp] |= keymap[i-1].canonkey;

    platform/ixus70_sd1000/kbd.c:458
    - {1, KEY_SHOOT_FULL, 0xC0000000 }, // note 3 here!
    + {1, KEY_SHOOT_FULL, 0x80000000 }, // note 3 here!

    core/kbd.c:167,kbd_sched_shoot
         KBD_STACK_PUSH(SCRIPT_WAIT_SAVE);
    +    KBD_STACK_PUSH(KEY_SHOOT_HALF);
    +    KBD_STACK_PUSH(SCRIPT_RELEASE);

    PS @ waldo: thanks for your contribution :)
    « Last Edit: 24 / June / 2008, 18:22:45 by cyril42e »

    *

    Offline fudgey

    • *****
    • 1705
    • a570is
  • Publish
    Re: Full-press without releasing half-press
    « Reply #2 on: 10 / July / 2011, 05:52:20 »
    Now this is the mother of all bumps but now it's my turn to be bothered about this... I consider the current behavior a bug, because

    press("shoot_half")
    press("shoot_full")
    release("shoot_full")

    and

    press("shoot_half")
    click("shoot_full")

    end up releasing shoot_half, which is just plain wrong. Quick firing is a precious feature, I already wrote a fast timelapse script relying on this without remembering that it's broken. :(

    Some cameras are known to crash with scripts that press/release full/half shutter too quickly, so this is a touchy area. We probably have a large number of scripts that rely on shoot_half being pressed/released automatically. So, waldo's patch would probably not be a good idea as is.

    But if cyril42e's fix works, it sounds like a very good compromise.


    *

    Offline reyalp

    • ******
    • 9962
  • Publish
    Re: Full-press without releasing half-press
    « Reply #3 on: 10 / July / 2011, 15:47:32 »
    Agree, the current behavior is undesirable.

    Another possible solution would be to add a new key e.g. "shoot_full_only" (better name ?) which really only controls the shoot_full bit, and leave shoot_full behavior as it is now.

    Either one of these would require changing a bunch of cameras :(
    Don't forget what the H stands for.


    *

    Offline fudgey

    • *****
    • 1705
    • a570is
  • Publish
    Re: Full-press without releasing half-press
    « Reply #4 on: 10 / July / 2011, 16:01:16 »
    Another possible solution would be to add a new key e.g. "shoot_full_only" (better name ?) which really only controls the shoot_full bit, and leave shoot_full behavior as it is now.

    Either one of these would require changing a bunch of cameras :(

    Yea, shoot_full_only is actually what I had in mind as well before I found this thread... ;)

    I was going to give a quick test to cyril42e's fix but it appears the code has changed quite a bit with the introduction of the action stack so would've needed to put some more time on it even for a single cam.

  • Publish
    Re: Full-press without releasing half-press
    « Reply #5 on: 13 / July / 2011, 13:37:35 »
    I was going to give a quick test to cyril42e's fix but it appears the code has changed quite a bit with the introduction of the action stack so would've needed to put some more time on it even for a single cam.


    I was also suprised that the shoot_full automagically released the shoot_half bit.  Two days ago I tried chdk for the first time and all time timelapse scripts I tried on my A590 didn't work as expected.  Unneeded focus, unneeded motor movements. Thanks to this thread I figured out what was wrong.

    Here is a patch that introduces shoot_full_only on A590.  It seems easy to apply this to other camera's, just add 1 line to  platform/xxxx/kbd.c

    Code: [Select]
    Index: include/keyboard.h
    ===================================================================
    --- include/keyboard.h (revision 1236)
    +++ include/keyboard.h (working copy)
    @@ -38,6 +38,10 @@
     #define KEY_AE_LOCK   31 // G12 AE/FE Lock button
     #define KEY_METERING   32 // G12 metering mode button
     
    +// Use this like SHOOT_FULL, with the difference that this one
    +// does not automagically release KEY_SHOOT_HALF
    +#define KEY_SHOOT_FULL_ONLY 33
    +
     #define JOGDIAL_LEFT      100
     #define JOGDIAL_RIGHT     101
     
    Index: platform/a590/kbd.c
    ===================================================================
    --- platform/a590/kbd.c (revision 1236)
    +++ platform/a590/kbd.c (working copy)
    @@ -441,6 +441,7 @@
      { 2, KEY_RIGHT , 0x00000040 },
      { 2, KEY_SET , 0x00000100 },
      { 1, KEY_SHOOT_FULL , 0xC0000000 },
    + { 1, KEY_SHOOT_FULL_ONLY, 0x80000000 },
      { 1, KEY_SHOOT_HALF , 0x40000000 },
      { 2, KEY_ZOOM_IN , 0x00000004 },
      { 2, KEY_ZOOM_OUT , 0x00000008 },
    Index: core/script.c
    ===================================================================
    --- core/script.c (revision 1236)
    +++ core/script.c (working copy)
    @@ -726,6 +726,7 @@
         { KEY_SET,          "set"        },
         { KEY_SHOOT_HALF,   "shoot_half" },
         { KEY_SHOOT_FULL,   "shoot_full" },
    +    { KEY_SHOOT_FULL_ONLY,   "shoot_full_only" },
         { KEY_ZOOM_IN,      "zoom_in"    },
         { KEY_ZOOM_OUT,     "zoom_out"   },
         { KEY_MENU,         "menu"       },


    *

    Offline fudgey

    • *****
    • 1705
    • a570is
  • Publish
    Re: Full-press without releasing half-press
    « Reply #6 on: 13 / July / 2011, 14:07:04 »
    Thanks erikoo, I think I'll prepare a patch to do that for all platforms soonish.

    *

    Offline fudgey

    • *****
    • 1705
    • a570is
  • Publish
    Re: Full-press without releasing half-press
    « Reply #7 on: 13 / July / 2011, 15:07:37 »
    Right, here we go, a patch attached to add key shoot_full_only to all cameras. Batch-build succeeds and a570 100e appears to work (tested with a lua script).

    About 3 cameras didn't have or'ed shoot_full, they do now. Makes me wonder if those were the ones crashing on scripts that weren't careful with how they used shoot_half (such as old MDFB versions)...

    Some comments say key order matters, hopefully not enough to screw this patch up. Those keymasks used on many cameras supposedly don't need updating as no new keys were truly introduced.

    Comments?


    *

    Offline funnel

    • ****
    • 349
  • Publish
    Re: Full-press without releasing half-press
    « Reply #8 on: 14 / July / 2011, 05:39:15 »
    Tried on sx220 and I it's working without problems. With the modified script the camera shoots twice as fast as before.

    *

    Offline philmoz

    • *****
    • 2936
      • Photos
  • Publish
    Re: Full-press without releasing half-press
    « Reply #9 on: 14 / July / 2011, 05:46:14 »
    Tried on sx220 and I it's working without problems. With the modified script the camera shoots twice as fast as before.

    Can you post the script, I'd like to try this on the G12 & SX30.

    Phil.
    CHDK ports:
      sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
      g12 (1.00c, 1.00e, 1.00f & 1.00g)
      sx130is (1.01d & 1.01f)
      ixus310hs (1.00a & 1.01a)
      sx40hs (1.00d, 1.00g & 1.00i)
      g1x (1.00e, 1.00f & 1.00g)

     

    Related Topics