Changeset 607


Ignore:
Timestamp:
11/30/08 10:40:36 (5 years ago)
Author:
reyalp
Message:

+ add lua functions for flash parameters (onboard flash memory, not light)

num=get_flash_params_count() -- num is the number of parameters
str,num=get_parameter_data(id) -- str is the parameter value as a lua string,

which may contain embedded NULLs or other non-printable characters. If the size of the flash parameter is 4 bytes or less, a second value is returned, containing the parameter value as a number if the parameter id is invalid, or the parameter size is 0, then nil is returned.

scripts/examples/paramdmp.lua contains an example

  • added CAMERA_HAS_JOGDAIL for g7/g9/sx100is, and used it instead of checking individual camera defines
Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/luascript.c

    r606 r607  
    201201} 
    202202 
     203static int luaCB_get_parameter_data( lua_State* L ) 
     204{ 
     205  extern long* FlashParamsTable[];  
     206 
     207  unsigned size; 
     208  unsigned id = luaL_checknumber( L, 1 ); 
     209  unsigned val; 
     210 
     211  if (id >= get_flash_params_count()) { 
     212    // return nil 
     213    return 0; 
     214  } 
     215 
     216  size = FlashParamsTable[id][1]>>16; 
     217  if (size == 0) { 
     218    // return nil 
     219    return 0; 
     220  } 
     221  if (size >= 1 && size <= 4) { 
     222    val = 0; 
     223    get_parameter_data( id, &val, size ); 
     224    lua_pushlstring( L, (char *)&val, size ); 
     225    // for convenience, params that fit in a number are returned in one as a second result 
     226    lua_pushnumber( L, val ); 
     227    return 2; 
     228  } 
     229  else { 
     230    char *buf = malloc(size); 
     231    if(!buf) { 
     232      luaL_error( L, "malloc failed in luaCB_get_parameter_data" ); 
     233    } 
     234    get_parameter_data( id, buf, size ); 
     235    lua_pushlstring( L, buf, size ); 
     236    free(buf); 
     237    return 1; 
     238  } 
     239} 
     240 
     241static int luaCB_get_flash_params_count( lua_State* L ) 
     242{ 
     243  lua_pushnumber( L, get_flash_params_count() ); 
     244  return 1; 
     245} 
     246 
    203247static int luaCB_set_av96_direct( lua_State* L ) 
    204248{ 
     
    383427} 
    384428 
    385 #if defined (CAMERA_g7) || defined (CAMERA_sx100is) || defined (CAMERA_g9) 
     429#if CAM_HAS_JOGDIAL 
    386430static int luaCB_wheel_right( lua_State* L ) 
    387431{ 
     
    857901  FUNC(get_zoom); 
    858902  FUNC(get_exp_count); 
     903  FUNC(get_flash_params_count); 
     904  FUNC(get_parameter_data); 
    859905 
    860906  FUNC(set_av96_direct); 
     
    884930  FUNC(is_pressed); 
    885931  FUNC(is_key); 
    886 #if defined (CAMERA_g7) || defined (CAMERA_sx100is) 
     932#ifdef CAM_HAS_JOGDIAL 
    887933  FUNC(wheel_right); 
    888934  FUNC(wheel_left); 
  • trunk/doc/version.txt

    r604 r607  
    22 
    33version / revision / author 
     4 
     50.8.7 / #606-607 / reyalp 
     6+ add lua functions for flash parameters (onboard flash memory, not light) 
     7  num=get_flash_params_count() -- num is the number of parameters 
     8  str,num=get_parameter_data(id) -- str is the parameter value as a lua string, 
     9    which may contain embedded NULLs or other non-printable characters. If the size of the flash 
     10    parameter is 4 bytes or less, a second value is returned, containing the parameter value as a number 
     11    if the parameter id is invalid, or the parameter size is 0, then nil is returned. 
     12  scripts/examples/paramdmp.lua contains an example 
     13* added CAMERA_HAS_JOGDAIL for g7/g9/sx100is, and used it instead of checking individual camera defines 
     14+ Lua string lib. see http://www.lua.org/manual/5.1/manual.html#5.4 
     15* Updated get_buildinfo to return two additional fields: 
     16  os: string, either "dryos" or "vxworks" 
     17  platformid: number 
     18* llibtst.lua is updated to test string lib, and no longer reports a listdir failure under dryos. 
     19* removed some redundant entries from sig_ref_vxworks_2.txt 
    420 
    521 
  • trunk/include/camera.h

    r595 r607  
    3434    #undef  CAM_FEATURE_FEATHER             // Cameras with "feather" or touch wheel. 
    3535    #define CAM_HAS_IS                  1   // Camera has image stabilizer 
     36        #undef  CAM_HAS_JOGDIAL                 // Camera has a "jog dial" 
    3637 
    3738    #undef  CAM_CONSOLE_LOG_ENABLED         // Development: internal camera stdout -> A/stdout.txt 
     
    7172    #undef  CAM_HAS_IS 
    7273    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1 
     74        #define CAM_HAS_JOGDIAL             1 
    7375    #define DNG_SUPPORT                 1 
    7476    // pattern 
     
    110112    #define CAM_EMUL_KEYPRESS_DURATION  10 
    111113    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1 
     114        #define CAM_HAS_JOGDIAL             1 
    112115    #define CAM_EV_IN_VIDEO             1 
    113116//      #define CAM_CONSOLE_LOG_ENABLED     1 
     
    13931396    #define CAM_RAW_ROWS                2480   // for new 8 MP 
    13941397    #undef CAM_SYNCH  
    1395 #define CAM_CAN_MUTE_MICROPHONE     1  
    1396 #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1  
    1397    #define CAM_ADJUSTABLE_ALT_BUTTON   1 
    1398    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1 
    1399    #undef  CAM_VIDEO_CONTROL 
    1400    #define DNG_SUPPORT                 1 
    1401    #define CAM_REAR_CURTAIN            1 
     1398    #define CAM_CAN_MUTE_MICROPHONE     1  
     1399    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1  
     1400    #define CAM_ADJUSTABLE_ALT_BUTTON   1 
     1401    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1 
     1402    #undef  CAM_VIDEO_CONTROL 
     1403    #define DNG_SUPPORT                 1 
     1404    #define CAM_REAR_CURTAIN            1 
     1405    #define CAM_HAS_JOGDIAL             1 
    14021406    // pattern 
    14031407    #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green 
  • trunk/lib/ubasic/ubasic.c

    r604 r607  
    19081908static void wheel_left_statement(void){ 
    19091909  accept(TOKENIZER_WHEEL_LEFT); 
    1910 #if defined (CAMERA_g7) || defined (CAMERA_sx100is) || defined (CAMERA_g9) 
     1910#ifdef CAM_HAS_JOGDIAL 
    19111911  JogDial_CCW(); 
    19121912#endif 
     
    19171917static void wheel_right_statement(void){ 
    19181918  accept(TOKENIZER_WHEEL_RIGHT); 
    1919 #if defined (CAMERA_g7) || defined (CAMERA_sx100is) 
     1919#ifdef CAM_HAS_JOGIDAL 
    19201920  JogDial_CW(); 
    19211921#endif 
  • trunk/version.inc

    r603 r607  
    1 BUILD_NUMBER := 0.8.6 
     1BUILD_NUMBER := 0.8.7 
Note: See TracChangeset for help on using the changeset viewer.