Problem rewriting wait_until_remote_button_is_released - General Discussion and Assistance - CHDK Forum

Problem rewriting wait_until_remote_button_is_released

  • 14 Replies
  • 4018 Views
Problem rewriting wait_until_remote_button_is_released
« on: 05 / July / 2009, 13:20:53 »
Advertisements
Hi all,

I hardwired the shutter-button of two Ixus 860 to synchronize both cams without external USB button.
Then I wanted to rewrite the synch routine 'wait_until_remote_button_is_released' (in kbd.c) to get a better synchronisation compared to hard-wiring only.
Here is my attempt:

void wait_until_remote_button_is_released(void)
{
asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack

#define DELAY_TIMEOUT 10000
#define KBD_MASK  0x00000003 // KEY_SHOOT_FULL IXUS 860

int tick;
long z, *x;

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

do
{
  z = physw_status[2] & KBD_MASK;
  _kbd_read_keys_r2(physw_status);
}
while( (!z) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));

_kbd_pwr_off();

debug_led(0);

asm volatile ("LDMFD SP!, {R0-R11,LR}\n");
}

I set the cameras under Remote-parameters to:

Enable Remote: yes
Enable Synchable remote: yes
Enables synch: yes

If I press the shutter button half, the cameras are focusing.
If I the press the shutter-button full then the blue led switches to on, so my rewritten function is executed.
But if I release the shutter button the camera does not shoot. It still waits until the 10 seconds of the loop are finished, then it takes the photo. I want to exit the loop if the shutter-button is released, but it does not work :(

What in my function I did wrong?

Thanks for any help!

« Last Edit: 05 / July / 2009, 13:24:21 by mr.burns »
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #1 on: 05 / July / 2009, 14:21:19 »
I do not understand why you are rewriting it.

Does CHDK not work  ?

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #2 on: 05 / July / 2009, 16:18:47 »
Hi Microfunguy,

Don't get me wrong, I don't know why you ask this, my main question is that my function does not work as expected, independent for what I need it.
But if you are interested let me try to make it more clear what I want to do.
I want to combine two IXUS 860 to a 3D camera. I don't want to use an external USB switch to synchronize the two cams . Instead I hardwired both cams, that means I opened the cams and connected the shutter-button from first cam with the 2nd cam by wire.
But just hardwiring cannot make sure that both cameras take the photo at exactly the same time, because the cams are doing a lot of things in the background processs, and may one cam is executing a different process than the other. This can cause a small delay on pressing the shutter-button if one cam can end it's current backround process earlier than the other one, which finally leads into eralier taking a photo compared to the 2nd cam.
To get both cameras as synchronized as possible I want to use the synchronize function of CHDK. But the original function waits for USB switch release, but I need the function wait for shutter-button release.
As I wrote my function works partly. Only problem is, if I release the shutter-button, it does not exit the loop and I don't know why.

Still help needed, any ideas?
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #3 on: 05 / July / 2009, 16:54:09 »
Have you read this ?



Re: Problem rewriting wait_until_remote_button_is_released
« Reply #4 on: 05 / July / 2009, 17:18:23 »
Hi Microfunguy,

yes I read this, and used/modified this code to work with IXUS 860 instead of Ixus55.
But as I wrote it does not work. For some reason it does not exit the loop if I release the shutter button, it only exits if 10 seconds are passed.
Sorry if I ask this, are you software developer? The code which is provided in the link, I don't understand completely, if you are familiar with software development can you help me with this:

1. #define KBD_MASK 0x4

If I go to the kbd.c of Ixus55 I cannot see any key which has MASK 0x4, so what is the 0x4 for?
I thought it should be 0x00000004 (KEY_SHOOT_FULL) to wait for shutter-button release, may someone can explain?

2. x = (void*)0xc0220208;
What is this line for, x is never read!?!

3. What is correct code to wait until shutter-button is released using physw_status[] for IXUS 860?
KEY_SHOOT_FULL for IXUS 860 is 0x00000003

Thanks for any further help!
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #5 on: 05 / July / 2009, 18:04:16 »
are you software developer?
I just copy-and-paste code.

Quote
If I go to the kbd.c of Ixus55 I cannot see any key which has MASK 0x4
I thought it should be 0x00000004 (KEY_SHOOT_FULL)

It is, same thing.


Quote
2. x = (void*)0xc0220208;
What is this line for, x is never read!?!
That is correct, it can be deleted.
In ixus55 kbd.c is :
    volatile long *mmio2 = (void*)0xc0220208;

That refers to a memory-mapped input/output, a memory location that stores the state of various switches.
He is not using that, he is using the three-element structure physw_status instead, in particular physw_status[2].

Quote
3. What is correct code to wait until shutter-button is released using physw_status[] for IXUS 860?
KEY_SHOOT_FULL for IXUS 860 is 0x00000003
In ixus860 kbd.c :
{ 2, KEY_SHOOT_FULL   , 0x00000003 },

That tells us the switch status should be in physw_status[2].
So, z = physw_status[2] & KBD_MASK;

That method does not work with all cameras, you will just have to try it.



Re: Problem rewriting wait_until_remote_button_is_released
« Reply #6 on: 06 / July / 2009, 02:26:31 »
Hi,

it seems that physw_status[2] & 0x00000003 works, I tested inside the loop with

if (!z) // or z I don't remember right now
  debug_led(0);

and immediately after full pressing the shutter-button the blue LED switches off.
But it does not exit the loop if I release the button.

I still need help!
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #7 on: 06 / July / 2009, 14:44:07 »
If you load SDM 1.80 onto your ixus860, does the remote switch work ?

Anyway, try :

do
{
  _kbd_read_keys_r2(physw_status);
  z = physw_status[2] & KBD_MASK;
}
« Last Edit: 06 / July / 2009, 14:53:06 by Microfunguy »


Re: Problem rewriting wait_until_remote_button_is_released
« Reply #8 on: 07 / July / 2009, 16:01:18 »
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!
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: Problem rewriting wait_until_remote_button_is_released
« Reply #9 on: 07 / July / 2009, 18:35:28 »
Still need help!

That is why I have asked you the question :-

"If you load SDM 1.80 onto your ixus860, does the remote switch work ?"

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal