| 1 | #include "kbd.h" |
|---|
| 2 | #include "stdlib.h" |
|---|
| 3 | #include "platform.h" |
|---|
| 4 | #include "core.h" |
|---|
| 5 | #include "keyboard.h" |
|---|
| 6 | #include "conf.h" |
|---|
| 7 | #include "action_stack.h" |
|---|
| 8 | #include "camera.h" |
|---|
| 9 | #include "histogram.h" |
|---|
| 10 | #include "gui_lang.h" |
|---|
| 11 | #include "console.h" |
|---|
| 12 | #include "lang.h" |
|---|
| 13 | #include "gui_lang.h" |
|---|
| 14 | |
|---|
| 15 | long kbd_last_clicked; |
|---|
| 16 | int state_kbd_script_run; |
|---|
| 17 | int kbd_blocked; |
|---|
| 18 | static long delay_target_ticks; |
|---|
| 19 | static int soft_half_press = 0; |
|---|
| 20 | static int key_pressed; |
|---|
| 21 | |
|---|
| 22 | // ------ add by Masuji SUTO (start) -------------- |
|---|
| 23 | static int mvideo,mplay; |
|---|
| 24 | static int nSW=0; |
|---|
| 25 | static int nRmt=0; |
|---|
| 26 | static int nWt=0; |
|---|
| 27 | static int nCount=0; |
|---|
| 28 | static int nCa=0; |
|---|
| 29 | static int nCount2=0; |
|---|
| 30 | static int nTxvideo=0; |
|---|
| 31 | static int nTxzoom=0; |
|---|
| 32 | static int nTxzname=KEY_ZOOM_IN; |
|---|
| 33 | static int nPlyname=KEY_LEFT; |
|---|
| 34 | static int nIntzpos; |
|---|
| 35 | static int nReczoom=0; |
|---|
| 36 | static int nTxtblcr=0; |
|---|
| 37 | int shutter_int=0; |
|---|
| 38 | |
|---|
| 39 | #if defined(CAMERA_ixus960_sd950) |
|---|
| 40 | static int nFirst=1; |
|---|
| 41 | #endif |
|---|
| 42 | |
|---|
| 43 | #if defined(CAMERA_a450) || defined(CAMERA_ixus50_sd400) || defined(CAMERA_ixusizoom_sd30) || \ |
|---|
| 44 | defined(CAMERA_ixus40_sd300) || defined(CAMERA_ixus55_sd450) || defined(CAMERA_ixus60_sd600) || \ |
|---|
| 45 | defined(CAMERA_ixus65_sd630) || defined(CAMERA_ixus70_sd1000) || defined(CAMERA_ixus700_sd500) || \ |
|---|
| 46 | defined(CAMERA_ixus750_sd550) || defined(CAMERA_ixus850_sd800) || defined(CAMERA_ixus900_sd900) || \ |
|---|
| 47 | defined(CAMERA_ixus75_sd750) || defined(CAMERA_a470) || defined(CAMERA_ixus90_sd790) || \ |
|---|
| 48 | defined(CAMERA_ixus100_sd780) || defined(CAMERA_ixus120_sd940) || defined(CAMERA_a480) || \ |
|---|
| 49 | defined(CAMERA_a495) || defined(CAMERA_a490) || defined(CAMERA_d10) || defined(CAMERA_ixus85_sd770) || \ |
|---|
| 50 | defined(CAMERA_ixus95_sd1200) || defined(CAMERA_a580) || defined(CAMERA_ixus300_sd4000) |
|---|
| 51 | #define ZSTEP_TABLE_SIZE 7 |
|---|
| 52 | static int nTxtbl[]={0,1,2,3,4,5,6}; // remote zoom steps (we need a distinct number of steps, even if the camera zooms smoothly) |
|---|
| 53 | #endif |
|---|
| 54 | |
|---|
| 55 | #if defined(CAMERA_s2is) || defined(CAMERA_s3is) || defined(CAMERA_s5is) || defined(CAMERA_sx10) || defined(CAMERA_sx1) || defined(CAMERA_sx20) |
|---|
| 56 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 57 | static int nTxtbl[]={0,11,25,41,64,86,105,128}; |
|---|
| 58 | #endif |
|---|
| 59 | |
|---|
| 60 | #if defined(CAMERA_sx30) |
|---|
| 61 | #define ZSTEP_TABLE_SIZE 11 |
|---|
| 62 | static int nTxtbl[]={0,20,40,60,80,100,120,140,160,180,200}; |
|---|
| 63 | #endif |
|---|
| 64 | |
|---|
| 65 | #if defined(CAMERA_tx1) |
|---|
| 66 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 67 | static int nTxtbl[]={0,18,43,55,76,93,113,124}; |
|---|
| 68 | #endif |
|---|
| 69 | |
|---|
| 70 | #if defined(CAMERA_a430) || defined(CAMERA_a460) || defined(CAMERA_a530) || defined (CAMERA_a540) || \ |
|---|
| 71 | defined(CAMERA_a550) || defined(CAMERA_a560) || defined(CAMERA_a570) || defined(CAMERA_a590) || \ |
|---|
| 72 | defined(CAMERA_ixus860_sd870) || defined(CAMERA_ixus960_sd950) || defined(CAMERA_ixus80_sd1100) || \ |
|---|
| 73 | defined(CAMERA_ixus970_sd890) || defined(CAMERA_ixus980_sd990) |
|---|
| 74 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 75 | static int nTxtbl[]={0,1,2,3,4,5,6,7}; |
|---|
| 76 | #endif |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | #if defined(CAMERA_a610) || defined(CAMERA_a620) || defined(CAMERA_a630) || defined(CAMERA_a640) || defined(CAMERA_ixus800_sd700) || defined(CAMERA_ixus950_sd850) |
|---|
| 80 | #define ZSTEP_TABLE_SIZE 9 |
|---|
| 81 | static int nTxtbl[]={0,1,2,3,4,5,6,7,8}; |
|---|
| 82 | #endif |
|---|
| 83 | |
|---|
| 84 | #if defined (CAMERA_a700) || defined(CAMERA_a710) || defined (CAMERA_a720) || defined (CAMERA_a2000) |
|---|
| 85 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 86 | static int nTxtbl[]={0,2,4,6,8,10,12,14}; |
|---|
| 87 | #endif |
|---|
| 88 | |
|---|
| 89 | #if defined(CAMERA_a650) || defined(CAMERA_g7) || defined(CAMERA_g9) |
|---|
| 90 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 91 | static int nTxtbl[]={0,2,4,6,8,10,12,13}; |
|---|
| 92 | #endif |
|---|
| 93 | // ------ add by Masuji SUTO (end) -------------- |
|---|
| 94 | #if defined(CAMERA_sx100is) || defined(CAMERA_sx110is) |
|---|
| 95 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 96 | static int nTxtbl[]={0,3,6,9,13,16,20,23}; |
|---|
| 97 | #endif |
|---|
| 98 | |
|---|
| 99 | #if defined(CAMERA_ixus870_sd880) |
|---|
| 100 | #define ZSTEP_TABLE_SIZE 10 |
|---|
| 101 | static int nTxtbl[]={0,1,2,3,4,5,6,7,8,9}; |
|---|
| 102 | #endif |
|---|
| 103 | |
|---|
| 104 | #if defined(CAMERA_sx200is) || defined(CAMERA_sx130is) |
|---|
| 105 | #define ZSTEP_TABLE_SIZE 7 |
|---|
| 106 | static int nTxtbl[]={0,16,32,62,78,102,125}; |
|---|
| 107 | #endif |
|---|
| 108 | |
|---|
| 109 | #if defined(CAMERA_g11) || defined(CAMERA_g12) |
|---|
| 110 | #define ZSTEP_TABLE_SIZE 14 |
|---|
| 111 | static int nTxtbl[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13}; |
|---|
| 112 | #endif |
|---|
| 113 | #if defined(CAMERA_s90) || defined(CAMERA_s95) |
|---|
| 114 | #define ZSTEP_TABLE_SIZE 10 |
|---|
| 115 | static int nTxtbl[]={0,1,2,3,4,5,6,7,8,9}; |
|---|
| 116 | #endif |
|---|
| 117 | |
|---|
| 118 | #ifdef OPT_SCRIPTING |
|---|
| 119 | // remote autostart |
|---|
| 120 | void script_autostart() |
|---|
| 121 | { |
|---|
| 122 | kbd_blocked = 1; |
|---|
| 123 | gui_kbd_enter(); |
|---|
| 124 | console_clear(); |
|---|
| 125 | script_console_add_line("***Autostart***"); //lang_str(LANG_CONSOLE_TEXT_STARTED)); |
|---|
| 126 | script_start_gui( 1 ); |
|---|
| 127 | } |
|---|
| 128 | #endif |
|---|
| 129 | |
|---|
| 130 | void exit_alt() |
|---|
| 131 | { |
|---|
| 132 | kbd_blocked = 0; |
|---|
| 133 | gui_kbd_leave(); |
|---|
| 134 | } |
|---|
| 135 | |
|---|
| 136 | // ------ add by Masuji SUTO (start) -------------- |
|---|
| 137 | void set_key_press(int nSet) |
|---|
| 138 | { |
|---|
| 139 | key_pressed = nSet; |
|---|
| 140 | kbd_blocked = nSet; |
|---|
| 141 | nRmt = nSet; |
|---|
| 142 | } |
|---|
| 143 | // ------ add by Masuji SUTO (end) -------------- |
|---|
| 144 | |
|---|
| 145 | /*------------------- Alex scriptless remote additions start --------------------*/ |
|---|
| 146 | static int remoteHalfShutter=0, remoteFullShutter=0, remoteShooting=0, remoteClickTimer=0; |
|---|
| 147 | #define REMOTE_MAX_CLICK_LENGTH 50 |
|---|
| 148 | /*-------------------- Alex scriptless remote additions end ---------------------*/ |
|---|
| 149 | |
|---|
| 150 | /* |
|---|
| 151 | main kb processing |
|---|
| 152 | this monster needs to be broken up and documented, remote stuff should go in it's own functions |
|---|
| 153 | */ |
|---|
| 154 | long kbd_process() |
|---|
| 155 | { |
|---|
| 156 | /* Alternative keyboard mode stated/exited by pressing print key. |
|---|
| 157 | * While running Alt. mode shoot key will start a script execution. |
|---|
| 158 | */ |
|---|
| 159 | static int nCER=0; |
|---|
| 160 | // ------ modif by Masuji SUTO (start) -------------- |
|---|
| 161 | |
|---|
| 162 | unsigned int mmode; |
|---|
| 163 | unsigned int nCrzpos,i; |
|---|
| 164 | unsigned int drmode = 0; |
|---|
| 165 | |
|---|
| 166 | if(conf.ricoh_ca1_mode && conf.remote_enable) { |
|---|
| 167 | drmode = shooting_get_drive_mode(); |
|---|
| 168 | mmode = mode_get(); |
|---|
| 169 | mplay = (mmode&MODE_MASK)==MODE_PLAY; |
|---|
| 170 | // mvideo= ((mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_STD || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_SPEED || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_COMPACT ||(mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_MY_COLORS || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_COLOR_ACCENT); |
|---|
| 171 | mvideo=MODE_IS_VIDEO(mmode); |
|---|
| 172 | } |
|---|
| 173 | // deals with alt-mode switch and delay emulation |
|---|
| 174 | if (key_pressed) { |
|---|
| 175 | if (kbd_is_key_pressed(conf.alt_mode_button) |
|---|
| 176 | || ((key_pressed >= CAM_EMUL_KEYPRESS_DELAY) |
|---|
| 177 | && (key_pressed < CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION))) { |
|---|
| 178 | if (key_pressed <= CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION) |
|---|
| 179 | key_pressed++; |
|---|
| 180 | if (key_pressed == CAM_EMUL_KEYPRESS_DELAY) |
|---|
| 181 | kbd_key_press(conf.alt_mode_button); |
|---|
| 182 | else if (key_pressed == +CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION) |
|---|
| 183 | kbd_key_release(conf.alt_mode_button); |
|---|
| 184 | return 1; |
|---|
| 185 | } else if (kbd_get_pressed_key() == 0) { |
|---|
| 186 | if (key_pressed != 100 && (key_pressed < CAM_EMUL_KEYPRESS_DELAY)) { |
|---|
| 187 | kbd_blocked = 1-kbd_blocked; |
|---|
| 188 | if (kbd_blocked) |
|---|
| 189 | gui_kbd_enter(); |
|---|
| 190 | else |
|---|
| 191 | gui_kbd_leave(); |
|---|
| 192 | } |
|---|
| 193 | key_pressed = 0; |
|---|
| 194 | return 1; |
|---|
| 195 | } |
|---|
| 196 | return 1; |
|---|
| 197 | } |
|---|
| 198 | |
|---|
| 199 | // auto iso shift |
|---|
| 200 | if (kbd_is_key_pressed(KEY_SHOOT_HALF) && kbd_is_key_pressed(conf.alt_mode_button)) |
|---|
| 201 | return 0; |
|---|
| 202 | |
|---|
| 203 | if (kbd_is_key_pressed(conf.alt_mode_button)) { |
|---|
| 204 | if (conf.ricoh_ca1_mode && conf.remote_enable) |
|---|
| 205 | conf.synch_enable=1; |
|---|
| 206 | key_pressed = 1; |
|---|
| 207 | kbd_key_release_all(); |
|---|
| 208 | return 1; |
|---|
| 209 | } |
|---|
| 210 | |
|---|
| 211 | // deals with the rest |
|---|
| 212 | if (kbd_blocked && nRmt==0) { |
|---|
| 213 | /*------------------- Alex scriptless remote additions start --------------------*/ |
|---|
| 214 | if (remoteShooting) { |
|---|
| 215 | if (remoteHalfShutter) { |
|---|
| 216 | if (get_usb_power(1)) { |
|---|
| 217 | if (remoteClickTimer < REMOTE_MAX_CLICK_LENGTH) { |
|---|
| 218 | remoteHalfShutter=0; |
|---|
| 219 | remoteFullShutter=1; |
|---|
| 220 | kbd_key_press(KEY_SHOOT_FULL); |
|---|
| 221 | } |
|---|
| 222 | return 1; |
|---|
| 223 | } else { |
|---|
| 224 | --remoteClickTimer; |
|---|
| 225 | if ( remoteClickTimer == 0 ) { |
|---|
| 226 | kbd_key_release_all(); |
|---|
| 227 | remoteHalfShutter=0; |
|---|
| 228 | remoteShooting=0; |
|---|
| 229 | kbd_blocked=0; |
|---|
| 230 | return 0; |
|---|
| 231 | } |
|---|
| 232 | } |
|---|
| 233 | } |
|---|
| 234 | |
|---|
| 235 | if (remoteFullShutter) { |
|---|
| 236 | if (get_usb_power(1)) { |
|---|
| 237 | return 1; |
|---|
| 238 | } else { |
|---|
| 239 | kbd_key_release_all(); |
|---|
| 240 | remoteFullShutter=0; |
|---|
| 241 | remoteShooting=0; |
|---|
| 242 | kbd_blocked=0; |
|---|
| 243 | return 0; |
|---|
| 244 | } |
|---|
| 245 | } |
|---|
| 246 | } |
|---|
| 247 | /*-------------------- Alex scriptless remote additions end ---------------------*/ |
|---|
| 248 | #ifdef OPT_SCRIPTING |
|---|
| 249 | if (kbd_is_key_pressed(KEY_SHOOT_FULL)) { |
|---|
| 250 | key_pressed = 100; |
|---|
| 251 | if (!state_kbd_script_run) { |
|---|
| 252 | script_start_gui(0); |
|---|
| 253 | } else if (state_kbd_script_run == 2 || state_kbd_script_run == 3) { |
|---|
| 254 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED)); |
|---|
| 255 | script_end(); |
|---|
| 256 | } |
|---|
| 257 | #ifdef OPT_LUA |
|---|
| 258 | else if (L) { |
|---|
| 259 | state_kbd_script_run = 2; |
|---|
| 260 | lua_run_restore(); |
|---|
| 261 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED)); |
|---|
| 262 | script_end(); |
|---|
| 263 | } |
|---|
| 264 | #endif |
|---|
| 265 | #ifdef OPT_UBASIC |
|---|
| 266 | else { |
|---|
| 267 | state_kbd_script_run = 2; |
|---|
| 268 | if (jump_label("restore") == 0) { |
|---|
| 269 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED)); |
|---|
| 270 | script_end(); |
|---|
| 271 | } |
|---|
| 272 | } |
|---|
| 273 | #endif |
|---|
| 274 | } |
|---|
| 275 | #endif |
|---|
| 276 | |
|---|
| 277 | action_stack_process_all(); |
|---|
| 278 | if (!state_kbd_script_run) |
|---|
| 279 | gui_kbd_process(); |
|---|
| 280 | } else { |
|---|
| 281 | #ifndef SYNCHABLE_REMOTE_NOT_ENABLED |
|---|
| 282 | if(conf.ricoh_ca1_mode && conf.remote_enable) { |
|---|
| 283 | // ------ add by Masuji SUTO (start) -------------- |
|---|
| 284 | if(nWt>0) { |
|---|
| 285 | nWt--; |
|---|
| 286 | return 1; |
|---|
| 287 | } |
|---|
| 288 | #if defined(CAMERA_ixus960) |
|---|
| 289 | if(nFirst==1) { |
|---|
| 290 | if(nSW==0) { |
|---|
| 291 | nSW=1; |
|---|
| 292 | nWt=10; |
|---|
| 293 | kbd_key_release_all(); |
|---|
| 294 | kbd_key_press(KEY_SHOOT_HALF); |
|---|
| 295 | soft_half_press = 1; |
|---|
| 296 | set_key_press(1); |
|---|
| 297 | return 1; |
|---|
| 298 | } else if(nSW==1) { |
|---|
| 299 | nSW=2; |
|---|
| 300 | nWt=10; |
|---|
| 301 | kbd_key_release(KEY_SHOOT_HALF); |
|---|
| 302 | soft_half_press = 0; |
|---|
| 303 | set_key_press(1); |
|---|
| 304 | return 1; |
|---|
| 305 | } else if(nSW==2) { |
|---|
| 306 | set_key_press(0); |
|---|
| 307 | nWt=10; |
|---|
| 308 | nSW=0; |
|---|
| 309 | nFirst=0; |
|---|
| 310 | return 1; |
|---|
| 311 | } |
|---|
| 312 | } |
|---|
| 313 | #endif // CAMERA_ixus960 |
|---|
| 314 | if (kbd_is_key_pressed(KEY_SHOOT_FULL)) |
|---|
| 315 | conf.synch_enable=0; |
|---|
| 316 | if (kbd_is_key_pressed(KEY_SHOOT_HALF) && nTxzoom>0) { |
|---|
| 317 | nCount2=0; |
|---|
| 318 | nTxzoom=0; |
|---|
| 319 | nReczoom=0; |
|---|
| 320 | nTxvideo=0; |
|---|
| 321 | debug_led(0); |
|---|
| 322 | } |
|---|
| 323 | if (mplay && (kbd_is_key_pressed(KEY_LEFT) || kbd_is_key_pressed(KEY_RIGHT))) { |
|---|
| 324 | nPlyname=KEY_LEFT; |
|---|
| 325 | if(kbd_is_key_pressed(KEY_RIGHT)) |
|---|
| 326 | nPlyname=KEY_RIGHT; |
|---|
| 327 | } |
|---|
| 328 | if (kbd_is_key_pressed(KEY_VIDEO)) { |
|---|
| 329 | nCount2=0; |
|---|
| 330 | nTxzoom=0; |
|---|
| 331 | nReczoom=0; |
|---|
| 332 | nTxvideo++; |
|---|
| 333 | if(nTxvideo<50) { |
|---|
| 334 | kbd_key_release_all(); |
|---|
| 335 | debug_led(1); |
|---|
| 336 | } else { |
|---|
| 337 | debug_led(0); |
|---|
| 338 | return 0; |
|---|
| 339 | } |
|---|
| 340 | return 1; |
|---|
| 341 | } |
|---|
| 342 | else if(nTxvideo>49) |
|---|
| 343 | nTxvideo=0; |
|---|
| 344 | if (kbd_is_key_pressed(KEY_ZOOM_IN) || kbd_is_key_pressed(KEY_ZOOM_OUT)) { |
|---|
| 345 | nCount2=0; |
|---|
| 346 | nTxvideo=0; |
|---|
| 347 | if(kbd_is_key_pressed(KEY_ZOOM_IN)) { |
|---|
| 348 | if(nTxzname==KEY_ZOOM_IN) |
|---|
| 349 | nTxzoom++; |
|---|
| 350 | else |
|---|
| 351 | nTxzoom=1; |
|---|
| 352 | nTxzname=KEY_ZOOM_IN; |
|---|
| 353 | } else { |
|---|
| 354 | if(nTxzname==KEY_ZOOM_OUT) |
|---|
| 355 | nTxzoom++; |
|---|
| 356 | else |
|---|
| 357 | nTxzoom=1; |
|---|
| 358 | nTxzname=KEY_ZOOM_OUT; |
|---|
| 359 | } |
|---|
| 360 | if(nTxzoom<50) { |
|---|
| 361 | kbd_key_release_all(); |
|---|
| 362 | debug_led(1); |
|---|
| 363 | } else { |
|---|
| 364 | debug_led(0); |
|---|
| 365 | return 0; |
|---|
| 366 | } |
|---|
| 367 | return 1; |
|---|
| 368 | } |
|---|
| 369 | if(!get_usb_power(1) && nSW<100 && nCount==0 && nTxzoom>0) { |
|---|
| 370 | nCount2++; |
|---|
| 371 | if(nCount2>conf.zoom_timeout*100) { |
|---|
| 372 | if(nTxzoom>0) { |
|---|
| 373 | nTxzoom=0; |
|---|
| 374 | nReczoom=0; |
|---|
| 375 | debug_led(0); |
|---|
| 376 | } |
|---|
| 377 | nCount2=0; |
|---|
| 378 | } |
|---|
| 379 | return 1; |
|---|
| 380 | } |
|---|
| 381 | if(get_usb_power(1) && nSW<100 && nCount==0) { |
|---|
| 382 | nCount2=0; |
|---|
| 383 | kbd_key_release_all(); |
|---|
| 384 | conf.synch_enable=1; |
|---|
| 385 | } |
|---|
| 386 | if(get_usb_power(1) && nSW<100 && nCount==0) { |
|---|
| 387 | kbd_key_release_all(); |
|---|
| 388 | conf.synch_enable=1; |
|---|
| 389 | } |
|---|
| 390 | if(get_usb_power(1) && nSW<100 && nCount<6) { |
|---|
| 391 | nCount++; |
|---|
| 392 | return 1; |
|---|
| 393 | } |
|---|
| 394 | if(nCount>0 && nSW<100) { |
|---|
| 395 | if(mplay) { |
|---|
| 396 | if(get_usb_power(1)) |
|---|
| 397 | return 1; |
|---|
| 398 | kbd_key_release_all(); |
|---|
| 399 | kbd_key_press(nPlyname); |
|---|
| 400 | set_key_press(1); |
|---|
| 401 | nCount=0; |
|---|
| 402 | nCa=2; |
|---|
| 403 | nSW=101; |
|---|
| 404 | nWt=5; |
|---|
| 405 | return 1; |
|---|
| 406 | } |
|---|
| 407 | if(nTxvideo>49) |
|---|
| 408 | nTxvideo=0; |
|---|
| 409 | if(nCount<5) |
|---|
| 410 | nCa=1; //for Richo remote switch CA-1 |
|---|
| 411 | else |
|---|
| 412 | nCa=2; //for hand made remote switch |
|---|
| 413 | |
|---|
| 414 | nCount=0; |
|---|
| 415 | // debug_led(1); |
|---|
| 416 | nSW=109; |
|---|
| 417 | } |
|---|
| 418 | |
|---|
| 419 | // ------------------------------------------------------------- hand made switch -------------- |
|---|
| 420 | |
|---|
| 421 | if(nCa==2) { |
|---|
| 422 | if(nSW==101) { |
|---|
| 423 | kbd_key_release_all(); |
|---|
| 424 | set_key_press(0); |
|---|
| 425 | nWt=50; |
|---|
| 426 | nSW=0; |
|---|
| 427 | nCa=0; |
|---|
| 428 | return 1; |
|---|
| 429 | } |
|---|
| 430 | if(nSW==109) { |
|---|
| 431 | // nSW=110; |
|---|
| 432 | nCER=0; |
|---|
| 433 | if(nTxzoom>0 && conf.remote_zoom_enable) { |
|---|
| 434 | if(nTxzoom<100) { |
|---|
| 435 | nIntzpos=lens_get_zoom_point(); |
|---|
| 436 | for(i=0;i<ZSTEP_TABLE_SIZE;i++) { |
|---|
| 437 | if(nIntzpos<=nTxtbl[i]) { |
|---|
| 438 | if(i>0) { |
|---|
| 439 | if(abs(nTxtbl[i]-nIntzpos)<=abs(nTxtbl[i-1]-nIntzpos)) |
|---|
| 440 | nTxtblcr=i; |
|---|
| 441 | else |
|---|
| 442 | nTxtblcr=i-1; |
|---|
| 443 | } |
|---|
| 444 | else nTxtblcr=i; |
|---|
| 445 | i=ZSTEP_TABLE_SIZE; |
|---|
| 446 | } |
|---|
| 447 | } |
|---|
| 448 | if(nTxzname==KEY_ZOOM_IN) { |
|---|
| 449 | nTxtblcr++; |
|---|
| 450 | if(nTxtblcr>(ZSTEP_TABLE_SIZE-1)) |
|---|
| 451 | nTxtblcr=(ZSTEP_TABLE_SIZE-1); |
|---|
| 452 | } else { |
|---|
| 453 | nTxtblcr--; |
|---|
| 454 | if(nTxtblcr<0) |
|---|
| 455 | nTxtblcr=0; |
|---|
| 456 | } |
|---|
| 457 | nSW=108; |
|---|
| 458 | return 1; |
|---|
| 459 | } |
|---|
| 460 | nTxzoom=0; |
|---|
| 461 | nReczoom=0; |
|---|
| 462 | } |
|---|
| 463 | if(nTxvideo>0 && conf.remote_zoom_enable) { |
|---|
| 464 | nSW=121; |
|---|
| 465 | return 1; |
|---|
| 466 | } |
|---|
| 467 | nSW=110; |
|---|
| 468 | nWt=2; |
|---|
| 469 | kbd_key_release_all(); |
|---|
| 470 | kbd_key_press(KEY_SHOOT_HALF); |
|---|
| 471 | // key_pressed = 1; |
|---|
| 472 | // kbd_blocked = 1; |
|---|
| 473 | // nRmt=1; |
|---|
| 474 | soft_half_press = 1; |
|---|
| 475 | set_key_press(1); |
|---|
| 476 | return 1; |
|---|
| 477 | } |
|---|
| 478 | if(nTxzoom>0 && nSW==108 && conf.remote_zoom_enable) { |
|---|
| 479 | nCrzpos=lens_get_zoom_point(); |
|---|
| 480 | if(nIntzpos!=nCrzpos) { |
|---|
| 481 | nReczoom=0; |
|---|
| 482 | } |
|---|
| 483 | if(nIntzpos==nCrzpos && nCER>50) { |
|---|
| 484 | if(!get_usb_power(1)) { |
|---|
| 485 | kbd_key_release_all(); |
|---|
| 486 | set_key_press(0); |
|---|
| 487 | nTxzoom=1; |
|---|
| 488 | nSW=0; |
|---|
| 489 | nCount=0; |
|---|
| 490 | nWt=10; |
|---|
| 491 | nReczoom=1; |
|---|
| 492 | return 1; |
|---|
| 493 | } |
|---|
| 494 | } |
|---|
| 495 | if(nReczoom==0 && ((nTxzname==KEY_ZOOM_IN && nCrzpos>=nTxtbl[nTxtblcr]) |
|---|
| 496 | || (nTxzname==KEY_ZOOM_OUT && nCrzpos<=nTxtbl[nTxtblcr]))) { |
|---|
| 497 | if(get_usb_power(1)) { |
|---|
| 498 | i=1; |
|---|
| 499 | if(nTxzname==KEY_ZOOM_IN) { |
|---|
| 500 | nTxtblcr++; |
|---|
| 501 | if(nTxtblcr>(ZSTEP_TABLE_SIZE-1)) { |
|---|
| 502 | nTxtblcr=(ZSTEP_TABLE_SIZE-1); |
|---|
| 503 | nTxzname=KEY_ZOOM_OUT; |
|---|
| 504 | } |
|---|
| 505 | } else { |
|---|
| 506 | nTxtblcr--; |
|---|
| 507 | if(nTxtblcr<0){ |
|---|
| 508 | nTxtblcr=0; |
|---|
| 509 | nTxzname=KEY_ZOOM_IN; |
|---|
| 510 | } |
|---|
| 511 | } |
|---|
| 512 | if(i==1) |
|---|
| 513 | return 1; |
|---|
| 514 | } |
|---|
| 515 | kbd_key_release_all(); |
|---|
| 516 | set_key_press(0); |
|---|
| 517 | nTxzoom=1; |
|---|
| 518 | // lens_set_zoom_speed(25); |
|---|
| 519 | nSW=120; |
|---|
| 520 | nWt=5; |
|---|
| 521 | return 1; |
|---|
| 522 | } |
|---|
| 523 | kbd_key_release_all(); |
|---|
| 524 | kbd_key_press(nTxzname); |
|---|
| 525 | set_key_press(1); |
|---|
| 526 | nCER++; |
|---|
| 527 | return 1; |
|---|
| 528 | } |
|---|
| 529 | |
|---|
| 530 | if(nTxvideo>0 && nSW==121) { |
|---|
| 531 | if(!get_usb_power(1)) { |
|---|
| 532 | nWt=10; |
|---|
| 533 | kbd_key_press(KEY_VIDEO); |
|---|
| 534 | set_key_press(1); |
|---|
| 535 | nSW=122; |
|---|
| 536 | } |
|---|
| 537 | return 1; |
|---|
| 538 | } |
|---|
| 539 | if(nTxvideo>0 && nSW==122) { |
|---|
| 540 | nWt=10; |
|---|
| 541 | kbd_key_release(KEY_VIDEO); |
|---|
| 542 | set_key_press(1); |
|---|
| 543 | nSW=123; |
|---|
| 544 | return 1; |
|---|
| 545 | } |
|---|
| 546 | if(nTxvideo>0 && nSW==123) { |
|---|
| 547 | set_key_press(0); |
|---|
| 548 | nWt=50; |
|---|
| 549 | nSW=0; |
|---|
| 550 | nCa=0; |
|---|
| 551 | nTxvideo=0; |
|---|
| 552 | debug_led(0); |
|---|
| 553 | return 1; |
|---|
| 554 | } |
|---|
| 555 | |
|---|
| 556 | if(nSW==110) { |
|---|
| 557 | if (shooting_in_progress() || mvideo || nCER>100) { |
|---|
| 558 | state_expos_recalculated = 0; |
|---|
| 559 | histogram_restart(); |
|---|
| 560 | nCER=0; |
|---|
| 561 | nSW=111; |
|---|
| 562 | } else { |
|---|
| 563 | nCER++;return 1; |
|---|
| 564 | } |
|---|
| 565 | } |
|---|
| 566 | if(nSW==111) { |
|---|
| 567 | if (state_expos_recalculated || nCER>100) { |
|---|
| 568 | state_expos_under = under_exposed; |
|---|
| 569 | state_expos_over = over_exposed; |
|---|
| 570 | nCER=0; |
|---|
| 571 | nSW=112; |
|---|
| 572 | //presynch(); |
|---|
| 573 | } else { |
|---|
| 574 | nCER++; |
|---|
| 575 | return 1; |
|---|
| 576 | } |
|---|
| 577 | } |
|---|
| 578 | if(nSW==112) { |
|---|
| 579 | if (shooting_is_flash_ready() || nCER>10) { |
|---|
| 580 | nCER=0; |
|---|
| 581 | nSW=113; |
|---|
| 582 | } else { |
|---|
| 583 | nCER++; |
|---|
| 584 | return 1; |
|---|
| 585 | } |
|---|
| 586 | } |
|---|
| 587 | if(nSW==113) { |
|---|
| 588 | if(get_usb_power(1) && !mvideo) |
|---|
| 589 | nSW=114; |
|---|
| 590 | else if(!get_usb_power(1) && mvideo) |
|---|
| 591 | nSW=114; |
|---|
| 592 | else |
|---|
| 593 | return 1; |
|---|
| 594 | } |
|---|
| 595 | if(nTxzoom>0 && nSW==120 && conf.remote_zoom_enable) { |
|---|
| 596 | nCrzpos=lens_get_zoom_point(); |
|---|
| 597 | if((nTxzname==KEY_ZOOM_IN && nCrzpos<=nTxtbl[nTxtblcr]) |
|---|
| 598 | || (nTxzname==KEY_ZOOM_OUT && nCrzpos>=nTxtbl[nTxtblcr])) { |
|---|
| 599 | kbd_key_release_all(); |
|---|
| 600 | set_key_press(0); |
|---|
| 601 | nTxzoom=1; |
|---|
| 602 | lens_set_zoom_speed(100); |
|---|
| 603 | nSW=0; |
|---|
| 604 | nCount=0; |
|---|
| 605 | nWt=10; |
|---|
| 606 | return 1; |
|---|
| 607 | } |
|---|
| 608 | lens_set_zoom_speed(5); |
|---|
| 609 | kbd_key_release_all(); |
|---|
| 610 | if(nTxzname==KEY_ZOOM_IN) |
|---|
| 611 | kbd_key_press(KEY_ZOOM_OUT); |
|---|
| 612 | else |
|---|
| 613 | kbd_key_press(KEY_ZOOM_IN); |
|---|
| 614 | set_key_press(1); |
|---|
| 615 | return 1; |
|---|
| 616 | } |
|---|
| 617 | |
|---|
| 618 | if(nSW==114) { |
|---|
| 619 | nSW=115; |
|---|
| 620 | nWt=2; |
|---|
| 621 | shutter_int=0; |
|---|
| 622 | kbd_key_press(KEY_SHOOT_FULL); |
|---|
| 623 | set_key_press(1); |
|---|
| 624 | // kbd_blocked = 1; |
|---|
| 625 | // nRmt=1; |
|---|
| 626 | nCount=0; |
|---|
| 627 | return 1; |
|---|
| 628 | } |
|---|
| 629 | if(nSW==115) { |
|---|
| 630 | // debug_led(0); |
|---|
| 631 | if(drmode==1 && shutter_int==0) { |
|---|
| 632 | return 1; |
|---|
| 633 | } |
|---|
| 634 | nSW=116; |
|---|
| 635 | nWt=2; |
|---|
| 636 | kbd_key_release(KEY_SHOOT_FULL); |
|---|
| 637 | set_key_press(1); |
|---|
| 638 | soft_half_press = 0; |
|---|
| 639 | // kbd_blocked = 1; |
|---|
| 640 | // nRmt=1; |
|---|
| 641 | return 1; |
|---|
| 642 | } |
|---|
| 643 | if(!get_usb_power(1) && nSW==116) { |
|---|
| 644 | set_key_press(0); |
|---|
| 645 | // kbd_blocked = 0; |
|---|
| 646 | // key_pressed = 0; |
|---|
| 647 | nWt=50; |
|---|
| 648 | nSW=0; |
|---|
| 649 | // nRmt=0; |
|---|
| 650 | nCa=0; |
|---|
| 651 | //postsynch(); |
|---|
| 652 | return 1; |
|---|
| 653 | } |
|---|
| 654 | } |
|---|
| 655 | |
|---|
| 656 | // ------------------------------------------------------------- Ricoh remote switch CA-1 -------------- |
|---|
| 657 | if(nCa==1) { |
|---|
| 658 | if(get_usb_power(1) && nSW>108 && nSW<120) { |
|---|
| 659 | nCount++; |
|---|
| 660 | } |
|---|
| 661 | if(nSW==109) { |
|---|
| 662 | // nSW=110; |
|---|
| 663 | nCER=0; |
|---|
| 664 | if(nTxzoom>0 && conf.remote_zoom_enable) { |
|---|
| 665 | if(nTxzoom<100) { |
|---|
| 666 | nIntzpos=lens_get_zoom_point(); |
|---|
| 667 | for(i=0;i<ZSTEP_TABLE_SIZE;i++) { |
|---|
| 668 | if(nIntzpos<=nTxtbl[i]) { |
|---|
| 669 | if(i>0) { |
|---|
| 670 | if(abs(nTxtbl[i]-nIntzpos)<=abs(nTxtbl[i-1]-nIntzpos)) |
|---|
| 671 | nTxtblcr=i; |
|---|
| 672 | else |
|---|
| 673 | nTxtblcr=i-1; |
|---|
| 674 | } |
|---|
| 675 | else |
|---|
| 676 | nTxtblcr=i; |
|---|
| 677 | i=ZSTEP_TABLE_SIZE; |
|---|
| 678 | } |
|---|
| 679 | } |
|---|
| 680 | if(nTxzname==KEY_ZOOM_IN) { |
|---|
| 681 | nTxtblcr++; |
|---|
| 682 | if(nTxtblcr>(ZSTEP_TABLE_SIZE-1)) |
|---|
| 683 | nTxtblcr=(ZSTEP_TABLE_SIZE-1); |
|---|
| 684 | } |
|---|
| 685 | else { |
|---|
| 686 | nTxtblcr--; |
|---|
| 687 | if(nTxtblcr<0) |
|---|
| 688 | nTxtblcr=0; |
|---|
| 689 | } |
|---|
| 690 | nSW=113; |
|---|
| 691 | return 1; |
|---|
| 692 | } |
|---|
| 693 | nTxzoom=0; |
|---|
| 694 | nReczoom=0; |
|---|
| 695 | } |
|---|
| 696 | if(nTxvideo>0 && conf.remote_zoom_enable) { |
|---|
| 697 | nSW=121; |
|---|
| 698 | return 1; |
|---|
| 699 | } |
|---|
| 700 | nSW=110; |
|---|
| 701 | nWt=2; |
|---|
| 702 | kbd_key_release_all(); |
|---|
| 703 | kbd_key_press(KEY_SHOOT_HALF); |
|---|
| 704 | // debug_led(1); |
|---|
| 705 | soft_half_press = 1; |
|---|
| 706 | set_key_press(1); |
|---|
| 707 | // key_pressed = 1; |
|---|
| 708 | // kbd_blocked = 1; |
|---|
| 709 | // nRmt=1; |
|---|
| 710 | return 1; |
|---|
| 711 | } |
|---|
| 712 | if(nTxvideo>0 && nSW==121) { |
|---|
| 713 | if(get_usb_power(1)) { |
|---|
| 714 | nWt=10; |
|---|
| 715 | kbd_key_press(KEY_VIDEO); |
|---|
| 716 | set_key_press(1); |
|---|
| 717 | nSW=122; |
|---|
| 718 | } |
|---|
| 719 | return 1; |
|---|
| 720 | } |
|---|
| 721 | if(nTxvideo>0 && nSW==122) { |
|---|
| 722 | nWt=10; |
|---|
| 723 | kbd_key_release(KEY_VIDEO); |
|---|
| 724 | set_key_press(1); |
|---|
| 725 | nSW=123; |
|---|
| 726 | return 1; |
|---|
| 727 | } |
|---|
| 728 | if(nTxvideo>0 && nSW==123) { |
|---|
| 729 | set_key_press(0); |
|---|
| 730 | nWt=100; |
|---|
| 731 | nCount=0; |
|---|
| 732 | nSW=0; |
|---|
| 733 | nCa=0; |
|---|
| 734 | nTxvideo=0; |
|---|
| 735 | debug_led(0); |
|---|
| 736 | return 1; |
|---|
| 737 | } |
|---|
| 738 | |
|---|
| 739 | if(nSW==110) { |
|---|
| 740 | if (shooting_in_progress() || mvideo || nCER>100) { |
|---|
| 741 | // debug_led(0); |
|---|
| 742 | state_expos_recalculated = 0; |
|---|
| 743 | histogram_restart(); |
|---|
| 744 | nCER=0; |
|---|
| 745 | nSW=111; |
|---|
| 746 | } else { |
|---|
| 747 | nCER++; |
|---|
| 748 | return 1; |
|---|
| 749 | } |
|---|
| 750 | } |
|---|
| 751 | if(nSW==111) { |
|---|
| 752 | if (state_expos_recalculated || nCER>100) { |
|---|
| 753 | state_expos_under = under_exposed; |
|---|
| 754 | state_expos_over = over_exposed; |
|---|
| 755 | nCER=0; |
|---|
| 756 | nSW=112; |
|---|
| 757 | //presynch(); |
|---|
| 758 | } else { |
|---|
| 759 | nCER++; |
|---|
| 760 | return 1; |
|---|
| 761 | } |
|---|
| 762 | } |
|---|
| 763 | if(nSW==112) { |
|---|
| 764 | if (shooting_is_flash_ready() || nCER>10) { |
|---|
| 765 | nCER=0; |
|---|
| 766 | nSW=113; |
|---|
| 767 | } else { |
|---|
| 768 | nCER++; |
|---|
| 769 | return 1; |
|---|
| 770 | } |
|---|
| 771 | } |
|---|
| 772 | if(nTxzoom>0 && nSW==114 && conf.remote_zoom_enable) { |
|---|
| 773 | nCrzpos=lens_get_zoom_point(); |
|---|
| 774 | if(nIntzpos!=nCrzpos) { |
|---|
| 775 | nReczoom=0; |
|---|
| 776 | } |
|---|
| 777 | if(nIntzpos==nCrzpos && nCER>50) { |
|---|
| 778 | if(nCount>0) { |
|---|
| 779 | kbd_key_release_all(); |
|---|
| 780 | set_key_press(0); |
|---|
| 781 | nTxzoom=1; |
|---|
| 782 | nSW=0; |
|---|
| 783 | nCount=0; |
|---|
| 784 | nWt=10; |
|---|
| 785 | nReczoom=1; |
|---|
| 786 | return 1; |
|---|
| 787 | } |
|---|
| 788 | } |
|---|
| 789 | if(nReczoom==0 && ((nTxzname==KEY_ZOOM_IN && nCrzpos>=nTxtbl[nTxtblcr]) |
|---|
| 790 | || (nTxzname==KEY_ZOOM_OUT && nCrzpos<=nTxtbl[nTxtblcr]))) { |
|---|
| 791 | if(nCount==0) { |
|---|
| 792 | i=1; |
|---|
| 793 | if(nTxzname==KEY_ZOOM_IN){ |
|---|
| 794 | nTxtblcr++; |
|---|
| 795 | if(nTxtblcr>(ZSTEP_TABLE_SIZE-1)){ |
|---|
| 796 | nTxtblcr=(ZSTEP_TABLE_SIZE-1); |
|---|
| 797 | nTxzname=KEY_ZOOM_OUT; |
|---|
| 798 | } |
|---|
| 799 | } else { |
|---|
| 800 | nTxtblcr--; |
|---|
| 801 | if(nTxtblcr<0) { |
|---|
| 802 | nTxtblcr=0; |
|---|
| 803 | nTxzname=KEY_ZOOM_IN; |
|---|
| 804 | } |
|---|
| 805 | } |
|---|
| 806 | if(i==1) |
|---|
| 807 | return 1; |
|---|
| 808 | } |
|---|
| 809 | kbd_key_release_all(); |
|---|
| 810 | set_key_press(0); |
|---|
| 811 | nTxzoom=1; |
|---|
| 812 | // lens_set_zoom_speed(25); |
|---|
| 813 | nSW=115; |
|---|
| 814 | nWt=5; |
|---|
| 815 | return 1; |
|---|
| 816 | } |
|---|
| 817 | kbd_key_release_all(); |
|---|
| 818 | kbd_key_press(nTxzname); |
|---|
| 819 | set_key_press(1); |
|---|
| 820 | nCER++; |
|---|
| 821 | return 1; |
|---|
| 822 | } |
|---|
| 823 | if(nTxzoom>0 && nSW==115 && conf.remote_zoom_enable) { |
|---|
| 824 | if(nCount==0) |
|---|
| 825 | return 1; |
|---|
| 826 | nCrzpos=lens_get_zoom_point(); |
|---|
| 827 | if((nTxzname==KEY_ZOOM_IN && nCrzpos<=nTxtbl[nTxtblcr]) |
|---|
| 828 | || (nTxzname==KEY_ZOOM_OUT && nCrzpos>=nTxtbl[nTxtblcr])) { |
|---|
| 829 | kbd_key_release_all(); |
|---|
| 830 | set_key_press(0); |
|---|
| 831 | nTxzoom=1; |
|---|
| 832 | lens_set_zoom_speed(100); |
|---|
| 833 | nSW=0; |
|---|
| 834 | nCount=0; |
|---|
| 835 | nWt=10; |
|---|
| 836 | return 1; |
|---|
| 837 | } |
|---|
| 838 | lens_set_zoom_speed(5); |
|---|
| 839 | kbd_key_release_all(); |
|---|
| 840 | if(nTxzname==KEY_ZOOM_IN) |
|---|
| 841 | kbd_key_press(KEY_ZOOM_OUT); |
|---|
| 842 | else |
|---|
| 843 | kbd_key_press(KEY_ZOOM_IN); |
|---|
| 844 | set_key_press(1); |
|---|
| 845 | return 1; |
|---|
| 846 | } |
|---|
| 847 | |
|---|
| 848 | if(get_usb_power(1)) { |
|---|
| 849 | return 1; |
|---|
| 850 | } |
|---|
| 851 | if(nCount>0 && nSW==113) { |
|---|
| 852 | if(nCount<9) { |
|---|
| 853 | if(nTxzoom>0 && conf.remote_zoom_enable) { |
|---|
| 854 | kbd_key_release_all(); |
|---|
| 855 | set_key_press(0); |
|---|
| 856 | nTxzoom=0; |
|---|
| 857 | nReczoom=0; |
|---|
| 858 | nSW=0; |
|---|
| 859 | nCa=0; |
|---|
| 860 | nCount=0; |
|---|
| 861 | nWt=10; |
|---|
| 862 | // lens_set_zoom_speed(100); |
|---|
| 863 | debug_led(0); |
|---|
| 864 | return 1; |
|---|
| 865 | } |
|---|
| 866 | nSW=125; |
|---|
| 867 | nWt=10; |
|---|
| 868 | kbd_key_release(KEY_SHOOT_HALF); |
|---|
| 869 | soft_half_press = 0; |
|---|
| 870 | set_key_press(1); |
|---|
| 871 | // kbd_blocked = 1; |
|---|
| 872 | // nRmt=1; |
|---|
| 873 | nCount=0; |
|---|
| 874 | return 1; |
|---|
| 875 | } else { |
|---|
| 876 | if(nTxzoom>0 && conf.remote_zoom_enable) { |
|---|
| 877 | nCount=0; |
|---|
| 878 | nSW=114; |
|---|
| 879 | return 1; |
|---|
| 880 | } |
|---|
| 881 | nSW=124; |
|---|
| 882 | nWt=2; |
|---|
| 883 | shutter_int=0; |
|---|
| 884 | // debug_led(0); |
|---|
| 885 | kbd_key_press(KEY_SHOOT_FULL); |
|---|
| 886 | set_key_press(1); |
|---|
| 887 | // kbd_blocked = 1; |
|---|
| 888 | // nRmt=1; |
|---|
| 889 | nCount=0; |
|---|
| 890 | return 1; |
|---|
| 891 | } |
|---|
| 892 | } |
|---|
| 893 | if(nSW==124) { |
|---|
| 894 | // debug_led(0); |
|---|
| 895 | if(drmode==1 && shutter_int==0) { |
|---|
| 896 | return 1; |
|---|
| 897 | } |
|---|
| 898 | nSW=125; |
|---|
| 899 | nWt=2; |
|---|
| 900 | kbd_key_release(KEY_SHOOT_FULL); |
|---|
| 901 | soft_half_press = 0; |
|---|
| 902 | set_key_press(1); |
|---|
| 903 | // kbd_blocked = 1; |
|---|
| 904 | // nRmt=1; |
|---|
| 905 | return 1; |
|---|
| 906 | } |
|---|
| 907 | if(!get_usb_power(1) && nSW==125) { |
|---|
| 908 | set_key_press(0); |
|---|
| 909 | // kbd_blocked = 0; |
|---|
| 910 | // key_pressed = 0; |
|---|
| 911 | nWt=50; |
|---|
| 912 | nSW=0; |
|---|
| 913 | // nRmt=0; |
|---|
| 914 | nCa=0; |
|---|
| 915 | //postsynch(); |
|---|
| 916 | return 1; |
|---|
| 917 | } |
|---|
| 918 | } |
|---|
| 919 | // ------ add by Masuji SUTO (end) -------------- |
|---|
| 920 | } // ricoh_ca1_mode |
|---|
| 921 | #endif // ifndef SYNCHABLE_REMOTE_NOT_ENABLED |
|---|
| 922 | /*------------------- Alex scriptless remote additions start --------------------*/ |
|---|
| 923 | if (conf.remote_enable && !conf.ricoh_ca1_mode && key_pressed != 2 && get_usb_power(1)) { |
|---|
| 924 | remoteShooting = 1; |
|---|
| 925 | kbd_blocked = 1; |
|---|
| 926 | kbd_key_release_all(); |
|---|
| 927 | remoteClickTimer = REMOTE_MAX_CLICK_LENGTH; |
|---|
| 928 | if (shooting_get_focus_mode()) { |
|---|
| 929 | remoteFullShutter = 1; |
|---|
| 930 | kbd_key_press(KEY_SHOOT_FULL); |
|---|
| 931 | } else { |
|---|
| 932 | remoteHalfShutter = 1; |
|---|
| 933 | kbd_key_press(KEY_SHOOT_HALF); |
|---|
| 934 | } |
|---|
| 935 | return 1; |
|---|
| 936 | } |
|---|
| 937 | /*-------------------- Alex scriptless remote additions end ---------------------*/ |
|---|
| 938 | #ifdef CAM_USE_ZOOM_FOR_MF |
|---|
| 939 | if (conf.use_zoom_mf && kbd_use_zoom_as_mf()) { |
|---|
| 940 | return 1; |
|---|
| 941 | } |
|---|
| 942 | #endif // ifdef CAM_USE_ZOOM_FOR_MF |
|---|
| 943 | if ((conf.fast_ev || conf.fast_movie_control || conf.fast_movie_quality_control) |
|---|
| 944 | && kbd_use_up_down_left_right_as_fast_switch()) { |
|---|
| 945 | return 1; |
|---|
| 946 | } |
|---|
| 947 | other_kbd_process(); // processed other keys in not <alt> mode |
|---|
| 948 | } |
|---|
| 949 | |
|---|
| 950 | return kbd_blocked; |
|---|
| 951 | } |
|---|
| 952 | |
|---|
| 953 | int kbd_is_blocked() { |
|---|
| 954 | return kbd_blocked; |
|---|
| 955 | } |
|---|
| 956 | |
|---|
| 957 | void kbd_set_block(int bEnableBlock) { |
|---|
| 958 | kbd_blocked = bEnableBlock ? 1 : 0; |
|---|
| 959 | } |
|---|
| 960 | |
|---|
| 961 | long kbd_use_up_down_left_right_as_fast_switch() { |
|---|
| 962 | static long key_pressed = 0; // ??? static masking a global |
|---|
| 963 | int m=mode_get(); |
|---|
| 964 | int mode_video = MODE_IS_VIDEO(m) || (movie_status > 1); |
|---|
| 965 | int ev_video=0; |
|---|
| 966 | int jogdial; |
|---|
| 967 | |
|---|
| 968 | #if CAM_EV_IN_VIDEO |
|---|
| 969 | ev_video=get_ev_video_avail(); |
|---|
| 970 | #endif |
|---|
| 971 | |
|---|
| 972 | if (!(kbd_is_key_pressed(KEY_UP)) && !(kbd_is_key_pressed(KEY_DOWN))) key_pressed = 0; |
|---|
| 973 | |
|---|
| 974 | if (canon_shoot_menu_active!=0 || (m&MODE_MASK) != MODE_REC) |
|---|
| 975 | return 0; |
|---|
| 976 | |
|---|
| 977 | #if !CAM_HAS_JOGDIAL |
|---|
| 978 | if (kbd_is_key_pressed(KEY_UP) && ((m&MODE_SHOOTING_MASK) != MODE_M) && !mode_video) { |
|---|
| 979 | if (conf.fast_ev && key_pressed == 0) { |
|---|
| 980 | shooting_set_prop(PROPCASE_EV_CORRECTION_1,shooting_get_prop(PROPCASE_EV_CORRECTION_1)+(conf.fast_ev_step+1)*16); |
|---|
| 981 | shooting_set_prop(PROPCASE_EV_CORRECTION_2,shooting_get_prop(PROPCASE_EV_CORRECTION_2)+(conf.fast_ev_step+1)*16); |
|---|
| 982 | EnterToCompensationEVF(); |
|---|
| 983 | key_pressed = KEY_UP; |
|---|
| 984 | |
|---|
| 985 | return 1; |
|---|
| 986 | } |
|---|
| 987 | |
|---|
| 988 | } |
|---|
| 989 | |
|---|
| 990 | if (kbd_is_key_pressed(KEY_DOWN) && ((m&MODE_SHOOTING_MASK) != MODE_M) && !mode_video) { |
|---|
| 991 | if (conf.fast_ev && key_pressed == 0) { |
|---|
| 992 | kbd_key_release_all(); |
|---|
| 993 | shooting_set_prop(PROPCASE_EV_CORRECTION_1,shooting_get_prop(PROPCASE_EV_CORRECTION_1)-(conf.fast_ev_step+1)*16); |
|---|
| 994 | shooting_set_prop(PROPCASE_EV_CORRECTION_2,shooting_get_prop(PROPCASE_EV_CORRECTION_2)-(conf.fast_ev_step+1)*16); |
|---|
| 995 | key_pressed = KEY_DOWN; |
|---|
| 996 | EnterToCompensationEVF(); |
|---|
| 997 | return 1; |
|---|
| 998 | } |
|---|
| 999 | } |
|---|
| 1000 | |
|---|
| 1001 | #else |
|---|
| 1002 | jogdial=get_jogdial_direction(); |
|---|
| 1003 | |
|---|
| 1004 | if (conf.fast_ev &&kbd_is_key_pressed(KEY_SHOOT_HALF) && (jogdial==JOGDIAL_RIGHT) && ((m&MODE_SHOOTING_MASK) != MODE_M) && !mode_video) { |
|---|
| 1005 | shooting_set_prop(PROPCASE_EV_CORRECTION_1,shooting_get_prop(PROPCASE_EV_CORRECTION_1)+(conf.fast_ev_step+1)*16); |
|---|
| 1006 | shooting_set_prop(PROPCASE_EV_CORRECTION_2,shooting_get_prop(PROPCASE_EV_CORRECTION_2)+(conf.fast_ev_step+1)*16); |
|---|
| 1007 | EnterToCompensationEVF(); |
|---|
| 1008 | } |
|---|
| 1009 | |
|---|
| 1010 | if (conf.fast_ev &&kbd_is_key_pressed(KEY_SHOOT_HALF) && (jogdial==JOGDIAL_LEFT) && ((m&MODE_SHOOTING_MASK) != MODE_M) && !mode_video) { |
|---|
| 1011 | shooting_set_prop(PROPCASE_EV_CORRECTION_1,shooting_get_prop(PROPCASE_EV_CORRECTION_1)-(conf.fast_ev_step+1)*16); |
|---|
| 1012 | shooting_set_prop(PROPCASE_EV_CORRECTION_2,shooting_get_prop(PROPCASE_EV_CORRECTION_2)-(conf.fast_ev_step+1)*16); |
|---|
| 1013 | EnterToCompensationEVF(); |
|---|
| 1014 | } |
|---|
| 1015 | |
|---|
| 1016 | |
|---|
| 1017 | #endif |
|---|
| 1018 | |
|---|
| 1019 | if (kbd_is_key_pressed(KEY_UP) && mode_video && movie_status == 4 ) { |
|---|
| 1020 | if (conf.fast_movie_quality_control && key_pressed == 0) { |
|---|
| 1021 | if (conf.video_mode==0) { |
|---|
| 1022 | #if !CAM_VIDEO_QUALITY_ONLY |
|---|
| 1023 | conf.video_bitrate+=1; |
|---|
| 1024 | if (conf.video_bitrate>=VIDEO_BITRATE_STEPS) |
|---|
| 1025 | conf.video_bitrate=VIDEO_BITRATE_STEPS-1; |
|---|
| 1026 | shooting_video_bitrate_change(conf.video_bitrate); |
|---|
| 1027 | movie_reset = 1; |
|---|
| 1028 | #endif |
|---|
| 1029 | } |
|---|
| 1030 | else if (conf.video_mode==1) { |
|---|
| 1031 | conf.video_quality+=1; |
|---|
| 1032 | if (conf.video_quality>VIDEO_MAX_QUALITY) |
|---|
| 1033 | conf.video_quality=VIDEO_MAX_QUALITY; |
|---|
| 1034 | movie_reset = 1; |
|---|
| 1035 | } |
|---|
| 1036 | key_pressed = KEY_UP; |
|---|
| 1037 | return 1; |
|---|
| 1038 | } |
|---|
| 1039 | } |
|---|
| 1040 | |
|---|
| 1041 | if (kbd_is_key_pressed(KEY_DOWN) && mode_video && movie_status == 4) { |
|---|
| 1042 | if (conf.fast_movie_quality_control && key_pressed == 0) { |
|---|
| 1043 | if (conf.video_mode==0) { |
|---|
| 1044 | #if !CAM_VIDEO_QUALITY_ONLY |
|---|
| 1045 | conf.video_bitrate-=1; |
|---|
| 1046 | if (conf.video_bitrate<0) |
|---|
| 1047 | conf.video_bitrate=0; |
|---|
| 1048 | |
|---|
| 1049 | shooting_video_bitrate_change(conf.video_bitrate); |
|---|
| 1050 | movie_reset = 1; |
|---|
| 1051 | #endif |
|---|
| 1052 | } |
|---|
| 1053 | else if (conf.video_mode==1) { |
|---|
| 1054 | conf.video_quality-=1; |
|---|
| 1055 | if (conf.video_quality<1) |
|---|
| 1056 | conf.video_quality=1; |
|---|
| 1057 | movie_reset = 1; |
|---|
| 1058 | } |
|---|
| 1059 | key_pressed = KEY_DOWN; |
|---|
| 1060 | return 1; |
|---|
| 1061 | } |
|---|
| 1062 | } |
|---|
| 1063 | |
|---|
| 1064 | if (kbd_is_key_pressed(KEY_LEFT) && mode_video && (movie_status == 4) && !ev_video) { |
|---|
| 1065 | if (conf.fast_movie_control && key_pressed == 0) { |
|---|
| 1066 | movie_status = VIDEO_RECORD_STOPPED; |
|---|
| 1067 | key_pressed = KEY_LEFT; |
|---|
| 1068 | return 1; |
|---|
| 1069 | } |
|---|
| 1070 | } |
|---|
| 1071 | // reyalp - HACK for cams that can do video in any mode |
|---|
| 1072 | // note that this means this will probably run whenever you press right |
|---|
| 1073 | if (kbd_is_key_pressed(KEY_RIGHT) && |
|---|
| 1074 | #ifndef CAM_HAS_VIDEO_BUTTON |
|---|
| 1075 | mode_video && |
|---|
| 1076 | #endif |
|---|
| 1077 | (movie_status == 1) && !ev_video) { |
|---|
| 1078 | // BUG this doesn't know whether recording was stopped or paused. |
|---|
| 1079 | if (conf.fast_movie_control && key_pressed == 0) { |
|---|
| 1080 | movie_status = VIDEO_RECORD_IN_PROGRESS; |
|---|
| 1081 | movie_reset = 1; |
|---|
| 1082 | key_pressed = KEY_RIGHT; |
|---|
| 1083 | return 1; |
|---|
| 1084 | } |
|---|
| 1085 | } |
|---|
| 1086 | |
|---|
| 1087 | return 0; |
|---|
| 1088 | } |
|---|