Ignore:
Timestamp:
12/02/09 09:31:02 (3 years ago)
Author:
reyalp
Message:

Mode override support. See http://chdk.kernreaktor.org/mantis/view.php?id=64
All cameras except ixus40_sd400 should be supported

rec_mode_active (checks play_rec_mode, weak, can be overriden on cameras that need it)
screen_opened, screen_rotated: only defined on swivel screen cams, check phsw_ bits for screen pos

  • move old play/rec checking code to rec_switch_state. #ifdef'd out for now
  • move mode enum into it's own header file: modelist.h to allow easy lua generation.
  • use playrec_mode on tx1

+ add new generated lua file LUALIB/GEN/modelist.lua
+ add lua library LUALIB/capmode.lua see http://chdk.wikia.com/wiki/LUA/Scripts:Standard/Lualib/Capmode
+ add test scripts see

http://chdk.wikia.com/wiki/UBASIC/Scripts:Standard/Test/Setmode
http://chdk.wikia.com/wiki/LUA/Scripts:Standard/Test/Setmode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/platform.h

    r842 r847  
    1313#define MODE_SHOOTING_MASK      0x00FF 
    1414 
    15 enum { 
    16 MODE_AUTO               =1, 
    17 MODE_P                  , 
    18 MODE_TV                 , 
    19 MODE_AV                 , 
    20 MODE_M                  , 
    21 MODE_PORTRAIT           , 
    22 MODE_NIGHT              , 
    23 MODE_LANDSCAPE          , 
    24 MODE_VIDEO_STD          , 
    25 MODE_VIDEO_SPEED        , 
    26 MODE_VIDEO_COMPACT      , 
    27 MODE_VIDEO_MY_COLORS    , 
    28 MODE_VIDEO_COLOR_ACCENT , 
    29 MODE_VIDEO_COLOR_SWAP   , 
    30 MODE_STITCH             , 
    31 MODE_MY_COLORS          , 
    32 MODE_SCN_WATER          , 
    33 MODE_SCN_NIGHT          , 
    34 MODE_SCN_CHILD          , 
    35 MODE_SCN_PARTY          , 
    36 MODE_SCN_GRASS          , 
    37 MODE_SCN_SNOW           , 
    38 MODE_SCN_BEACH          , 
    39 MODE_SCN_FIREWORK       , 
    40 MODE_SCN_COLOR_ACCENT   , 
    41 MODE_SCN_COLOR_SWAP     , 
    42 MODE_VIDEO_HIRES        , 
    43 MODE_SCN_AQUARIUM       , 
    44 MODE_COLOR_ACCENT       , 
    45 MODE_SCN_NIGHT1         , 
    46 MODE_SCN_ISO_3200       , 
    47 MODE_SCN_SPORT          , 
    48 MODE_SCN_KIDS_PETS      , 
    49 MODE_INDOOR             , 
    50 MODE_KIDS_PETS          , 
    51 MODE_NIGHT_SNAPSHOT     , 
    52 MODE_DIGITAL_MACRO      , 
    53 MODE_SCN_FOLIAGE        , 
    54 MODE_VIDEO_TIME_LAPSE   , 
    55 MODE_SCN_INDOOR         , 
    56 MODE_SCN_PORTRAIT       , 
    57 MODE_SUPER_MACRO        , 
    58 MODE_VIDEO_PORTRAIT     , 
    59 MODE_VIDEO_NIGHT        , 
    60 MODE_VIDEO_INDOOR       , 
    61 MODE_VIDEO_FOLIAGE      , 
    62 MODE_VIDEO_SNOW         , 
    63 MODE_VIDEO_BEACH        , 
    64 MODE_VIDEO_AQUARIUM     , 
    65 MODE_VIDEO_SUPER_MACRO  , 
    66 MODE_VIDEO_STITCH       , 
    67 MODE_VIDEO_MANUAL       , 
    68 MODE_SPORTS             , 
    69 MODE_QUICK                          , 
    70 MODE_SCN_SUNSET         , 
    71 MODE_SCN_UNDERWATER     , 
    72 MODE_EASY               , 
    73 MODE_SCN_DIGITAL_MACRO  , 
    74 MODE_SCN_STITCH         , 
    75 }; 
     15/* capture mode constants. These are in their own header for easier sed processing*/ 
     16#include "modelist.h" 
    7617 
    7718// this is nasty, but not as nasty as checking each of the flags all over the place 
     
    9334                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_STITCH || \ 
    9435                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_MANUAL) 
     36/* propcase ID constants. These are in their own header files for easier sed processing */ 
    9537#if CAM_PROPSET == 2     // most digic3 cameras 
    9638 #include "propset2.h" 
     
    13779#define ZOOM_DIGITAL_OUT         12 
    13880#define ZOOM_DIGITAL_REACHED_MAX 13 
     81 
     82typedef struct { 
     83        int hackmode; // platform independent mode values from MODE_xxx enum 
     84        int canonmode; // PROPCASE_SHOOTING_MODE value 
     85} CapturemodeMap; 
    13986 
    14087typedef struct { 
     
    412359void shooting_iso_bracketing(); 
    413360/******************************************************************/ 
     361// capture mode functions 
     362// return a CHDK mode enum for a PROPCASE_SHOOTING_MODE value, or 0 if not found 
     363int shooting_mode_canon2chdk(int canonmode); 
     364// return a PROPCASE_SHOOTING_MODE value for a CHDK mode enum value, or -1 if not found. 0 is a valid mode on some cameras. 
     365int shooting_mode_chdk2canon(int hackmode); 
     366// set capture mode from CHDK mode, returns 0 if mode not found or not in rec, otherwise 1 
     367int shooting_set_mode_chdk(int mode); 
     368// set capture mode from PROPCASE_SHOOTING_MODE value. return 0 if not in rec or mode is -1, otherwise 1 
     369int shooting_set_mode_canon(int mode); 
     370 
     371// returns 0 if in play, nonzero if rec 
     372int rec_mode_active(void);  
     373 
     374// not used. Right now this is just to preserve code from earlier version of mode_get() 
     375// in case we want to check play/rec switch state in the future. 
     376// WARNING: it isn't known if all variants of this check the switch state or some other bit. 
     377// should return 0 is switch is in play position, non-zero otherwise 
     378//int rec_switch_state(void); 
     379 
     380// swivel screen state. 
     381#ifdef CAM_SWIVEL_SCREEN 
     382// 0 not open, non-zero open 
     383int screen_opened(void); 
     384// 0 not rotated, non-zero rotated 
     385int screen_rotated(void); 
     386#endif 
     387 
     388/******************************************************************/ 
    414389void clear_values(); 
    415390/******************************************************************/ 
    416  
    417391 
    418392int mode_get(); 
     
    502476void  SetLogicalEventActive(unsigned event, unsigned state); 
    503477void SetScriptMode(unsigned mode); 
    504 void SetCurrentCaptureModeType(unsigned mode); 
    505478 
    506479#define started() debug_led(1) 
Note: See TracChangeset for help on using the changeset viewer.