shooting state / shooting in progress - page 2 - General Discussion and Assistance - CHDK Forum

shooting state / shooting in progress

  • 10 Replies
  • 9704 Views
*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: shooting state / shooting in progress
« Reply #10 on: 09 / December / 2008, 15:18:40 »
Advertisements
To revive this topic a... now that I've familiarized myself with Lua a bit, I figured I could sample shoot_state better.

cyril42e's patch above may not work line number -wise in current trunk, but the changes are still valid. Below a summary of them along with new ones to add it to Lua as well:

Additions to CHDK to put get_shoot_state command into Lua and uBASIC:
############################################################################
platform/a570/sub/100e/stubs_min.S: (this address needs to be found for each camera)
DEF(shoot_state,0x253c)

include/platorm.h:
extern int shoot_state;
short shooting_get_shoot_state();

platform/generic/shooting.c:
short shooting_get_shoot_state()
{
  return shoot_state; // to change to switch to simplify, and move to platform/xxx/lib.c if platform dependant
}

lib/ubasic/tokenizer.c:
  {"get_shoot_state",         TOKENIZER_GET_SHOOT_STATE},

lib/ubasic/tokenizer.h:
  TOKENIZER_GET_SHOOT_STATE,
 
lib/ubasic/ubasic.c factor:
case TOKENIZER_GET_SHOOT_STATE:
    accept(TOKENIZER_GET_SHOOT_STATE);
    r = shooting_get_shoot_state();
    break;


### Lua additions:

core/luascript.c :
static int luaCB_get_shoot_state( lua_State* L )
{
  lua_pushnumber( L, shooting_get_shoot_state() );
  return 1;
}

core/luascript.c register_lua_funcs:
  FUNC(get_shoot_state);

############################################################################

Attached is a Lua script which shoots and logs some things of interest at the same time. It requires the logging library from http://chdk.setepontos.com/index.php/topic,2511.msg23647.html#msg23647 and the shoot_state() command.



 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal