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