Yep, I messed it up the first time around. Here is a improved version. //////////////////////////////
// Our physical mode dial switch values. If scripts are to access this then something different will need to happen here
#define MODE_DIAL_A 0x0000000f
#define MODE_DIAL_P 0x00000007
#define MODE_DIAL_TV 0x00000005
#define MODE_DIAL_AV 0x00000004
#define MODE_DIAL_M 0x00000006
#define MODE_DIAL_C 0x00000003
#define MODE_DIAL_BLANK 0x00000009
#define MODE_DIAL_VIDEO 0x0000000d
#define MODE_DIAL_SCN 0x0000000c
#define MODE_DIAL_LOWLIGHT 0x0000000e
// Put your overrides in here, name the hackmode what you want it to select.
static CapturemodeMap mode_dial_map[] = {
// { hackmode , canonmode } // canonmode for the physical mode dial
{ 0 , 0x00000000 }, // saving selected mode here.
{ MODE_P , MODE_DIAL_A }, // Auto
{ MODE_P , MODE_DIAL_P },
{ MODE_TV , MODE_DIAL_TV },
{ MODE_AV , MODE_DIAL_AV },
{ MODE_M , MODE_DIAL_M },
{ MODE_P , MODE_DIAL_C },
{ MODE_M , MODE_DIAL_BLANK },
{ MODE_VIDEO_STD, MODE_DIAL_VIDEO },
{ MODE_M , MODE_DIAL_SCN },
{ MODE_M , MODE_DIAL_LOWLIGHT },
{ 0, 0 }
};
#define MODE_DIAL_REG 1
#define MODE_DIAL_SET mode_dial_map[0]
#define MODE_DIAL_AUTO mode_dial_map[1] // utilizing this for mask, may not work this way in all cameras
/////////////////////////////////////////
// Mode dial override
temp = kbd_new_state[MODE_DIAL_REG] & MODE_DIAL_AUTO.canonmode; //get new dial position - using auto as the mask
if (MODE_DIAL_SET.canonmode != temp) { //has the dial moved?
i = 1; // 0 is used to hold values
while (mode_dial_map[i].canonmode){ //runs till the end {0,0}
if (mode_dial_map[i].canonmode == temp) { //find what's set and it's override
MODE_DIAL_SET.canonmode = mode_dial_map[i].canonmode;
MODE_DIAL_SET.hackmode = mode_dial_map[i].hackmode;
break;
}
i++;
}
/*switch (MODE_DIAL_SET.canonmode) { //make these do something interesting - Our own C modes!
case MODE_DIAL_A:
case MODE_DIAL_BLANK:
case MODE_DIAL_LOWLIGHT:
case MODE_DIAL_C:
case DIAL_MODE_SCN:
} */
}
// the camera detects when the switch status changes, so needs to be set in every my_kbd_read_keys() pass.
kbd_new_state[MODE_DIAL_REG] = (MODE_DIAL_AUTO.canonmode | (kbd_new_state[MODE_DIAL_REG] & ~MODE_DIAL_AUTO.canonmode));
if (MODE_DIAL_SET.hackmode != (mode_get() & MODE_SHOOTING_MASK))
shooting_set_mode_chdk(MODE_DIAL_SET.hackmode);
//////////////////////////
Side effect of setting by "shooting_set_mode_chdk()" is there is not couple seconds wasted by canon's splash when changing modes, but now there is no canon "C" mode, only our hacked modes we can add. I did notice prop 50 holds a special value in C mode (otherwise is always the same as 49), maybe there's is a way to set to C?
This obviously isn't finished as it should be an option in the menu, an speaking of which, how could should the gui go for this? Also, a way to read the dial while in script mode needs to be added and disabling it while a script is running.
What's everyone think?