Skip to content

Commit

Permalink
fix sleep(0) bug introduced in http://tools.assembla.com/chdk/changes…
Browse files Browse the repository at this point in the history
…et/1166 - now only wait_click treats 0 as indefinite wait

git-svn-id: http://tools.assembla.com/svn/chdk/trunk@1185 6794e30b-3f2a-0410-a806-a2bbca1c07ff
  • Loading branch information
reyalp committed May 14, 2011
1 parent 0a440bc commit 5d69339
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/action_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ void action_push_click(long key)

void action_wait_for_click(int timeout)
{
action_push(timeout);
// accept wait_click 0 for infinite, but use -1 internally to avoid confusion with generated waits
action_push(timeout?timeout:-1);
action_push(AS_WAIT_CLICK);
}

Expand Down Expand Up @@ -177,13 +178,14 @@ long action_get_prev(int p)
// does not pop the delay value off the stack or clear the delay value
int action_process_delay(int p)
{
int t = get_tick_count();
unsigned t = get_tick_count();
// FIXME take care if overflow occurs
if (action_stacks[active_stack]->delay_target_ticks == 0)
{
/* setup timer */
long action = action_get_prev(p);
action_stacks[active_stack]->delay_target_ticks = t+((action)?action:86400000);
/* delay of -1 signals indefinite (actually 1 day) delay*/
action_stacks[active_stack]->delay_target_ticks = t+((action == -1)?86400000:action);
return 0;
}
if (action_stacks[active_stack]->delay_target_ticks <= t)
Expand Down Expand Up @@ -269,8 +271,7 @@ int action_stack_standard(long p)
// Initiate a shoot. Remember that stack program flow is reversed!
action_pop();
// XXX FIXME find out how to wait to jpeg save finished
// note, must not wait 0, means forever
action_push_delay((conf.script_shoot_delay)?conf.script_shoot_delay*100:1);
action_push_delay(conf.script_shoot_delay*100);

action_push(AS_WAIT_SAVE);

Expand Down

0 comments on commit 5d69339

Please sign in to comment.