Ignore:
Timestamp:
12/02/09 09:31:02 (4 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/platform/s2is/main.c

    r845 r847  
    203203} 
    204204 
    205 static struct { 
    206         int hackmode; 
    207         int canonmode; 
    208 } modemap[] = { 
    209     { MODE_AUTO,                5 }, 
    210     { MODE_P,                   1 }, 
    211     { MODE_TV,                  3 }, 
    212     { MODE_AV,                  2 }, 
    213     { MODE_M,                   0 }, 
    214     { MODE_PORTRAIT,            6 }, 
    215     { MODE_NIGHT,               8 }, 
    216     { MODE_LANDSCAPE,           7 }, 
    217     { MODE_VIDEO_STD,           16 }, 
    218     { MODE_STITCH,              15 }, 
    219     { MODE_MY_COLORS,           4 }, 
    220     { MODE_SCN_NIGHT,           14 }, 
    221     { MODE_SCN_INDOOR,          13 }, 
    222     { MODE_SCN_FOLIAGE,         9 }, 
    223     { MODE_SCN_SNOW,            10 }, 
    224     { MODE_SCN_BEACH,           11 }, 
    225     { MODE_SCN_FIREWORK,        12 },  
    226 }; 
    227 #define MODESCNT (sizeof(modemap)/sizeof(modemap[0])) 
    228  
    229 int mode_get() { 
    230     int mode, i, t=0xFF; 
    231     mode  = (playrec_mode==1)?MODE_REC:MODE_PLAY; 
    232     mode |= (physw_copy[1] & 0x00000001)?0:MODE_SCREEN_OPENED; 
    233     mode |= (physw_copy[1] & 0x00000002)?0:MODE_SCREEN_ROTATED; 
    234      
    235     t=0xFF; 
    236     _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4); 
    237     for (i=0; i<MODESCNT; ++i) { 
    238         if (modemap[i].canonmode == t) { 
    239             return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK)); 
    240         } 
    241     } 
    242     return (mode); 
    243 } 
     205 
     206int screen_opened(void) { 
     207//    mode |= (physw_copy[1] & 0x00000001)?0:MODE_SCREEN_OPENED; 
     208        return !(physw_copy[1] & 0x00000001); 
     209} 
     210 
     211int screen_rotated(void) { 
     212//    mode |= (physw_copy[1] & 0x00000002)?0:MODE_SCREEN_ROTATED; 
     213        return !(physw_copy[1] & 0x00000002); 
     214} 
     215 
     216int rec_mode_active(void) { 
     217//    mode  = (playrec_mode==1)?MODE_REC:MODE_PLAY; 
     218        return (playrec_mode==1); 
     219} 
Note: See TracChangeset for help on using the changeset viewer.