Problem rewriting wait_until_remote_button_is_released - page 2 - General Discussion and Assistance - CHDK Forum  

Problem rewriting wait_until_remote_button_is_released

  • 14 Replies
  • 3902 Views
*

Offline reyalp

  • ******
  • 14098
Re: Problem rewriting wait_until_remote_button_is_released
« Reply #10 on: 07 / July / 2009, 19:58:04 »
Advertisements
Hi Microfunguy,

does not work neither, I really need someone who knows how physw_status[2] needs to be called to check for releasing a key.

Still need help!
Display physw_status in the debug display. See gui.c gui_draw_debug_vals_osd
Don't forget what the H stands for.

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #11 on: 08 / July / 2009, 15:37:37 »
Hi reyalp,

first I want to thank for your answer. But I did already. The problem is that I get the debug messages only if I press half the shutter button or release it. If I press it full, the display gets black and I cannot see the debug value. Fortunately my battery was empty and then the camera told me to replace it. During this low battery period the debug window is visible also if I full press the button.

Here the result of physw_status[2] for shutter button:

Released: 0x408FFF
Half pressed: 0x40AFFE // A is flickering and replaced by 8 sometimes
Full pressed: 0x408FFC

I used a mask of 0x3 to check if released or pressed but it does not exit the loop.

Then I did some further tests, I used a part of he origin usb-switch function to test if the loop executes the code between the do..while loop brackets, here is what I used:

debug_led(1);
_kbd_pwr_on();
tick=get_tick_count();

do
{
  usb_physw[2] = 0;
_kbd_read_keys_r2(usb_physw);
debug_led(usb_physw[2] & USB_MASK); // USB_MASK = 0x40000
}
while((int)get_tick_count()-tick < 10000); // just wait 10 seconds

If I press the shutter button full and then press the external USB switch the blue LED switches on. If I release it the blue LED switches off. So with this test I know the part between the brackets of the do loop gets executed well.

Then I replaced the inner part of the do..while loop by:

  _kbd_read_keys_r2(physw_status);    
  debug_led(physw_status[2] & KBD_MASK); // KBD_MASK = 0x3 // IXUS 860 KEY_SHOOT_FULL

to wait for a key pressed/released instead of external USB switch.
I pressed the shutter button, then released it, but the blue LED swtiches only off.
Releasing it does not switch on the blue LED again. I also tested with different keys / KEY_MASKs like up/down/set, but always the same.
It seems that the physw_status[2] is not updated somehow for internal keys within the do..while loop.

Then I just replaced the KBD_MASK (but still used physw_status instead of usb_physw) by 0x40000 (USB_MASK), then I can use the external USB switch to turn off and on the blue LED again.
So the loop is OK, but CHDK does not recognize any internal key-press, during the loop, only external USB switch.

It is really strange, still need help!
« Last Edit: 08 / July / 2009, 15:54:59 by mr.burns »
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #12 on: 08 / July / 2009, 16:22:00 »
try using kbd_fetch_data to read mmio directly.

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #13 on: 09 / July / 2009, 14:11:10 »
hi, Microfunguy,

what you proposed worked now! Her what I did:

...
do
{
  kbd_fetch_data(kbd_new_state);
  z = kbd_new_state[2] & 0x3;
}
while( (!z) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
...

This solves the problem, thanks for your support and ideas!

Best regards, see you on next problem ;-)
2 x IXUS 860IS 100c
2 x Powershot S110 103a


Re: Problem rewriting wait_until_remote_button_is_released
« Reply #14 on: 09 / July / 2009, 14:57:06 »
what you proposed worked now!

Great !
Not bad for a novice programmer  ...  I mean me  :)

Just as well it worked, I could not think of anything else.


David

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal