|
@@ -314,6 +314,12 @@ bool Stopped=false;
|
314
|
314
|
bool CooldownNoWait = true;
|
315
|
315
|
bool target_direction;
|
316
|
316
|
|
|
317
|
+//Insert variables if CHDK is defined
|
|
318
|
+#ifdef CHDK
|
|
319
|
+unsigned long chdkHigh = 0;
|
|
320
|
+boolean chdkActive = false;
|
|
321
|
+#endif
|
|
322
|
+
|
317
|
323
|
//===========================================================================
|
318
|
324
|
//=============================Routines======================================
|
319
|
325
|
//===========================================================================
|
|
@@ -2588,23 +2594,33 @@ void process_commands()
|
2588
|
2594
|
#endif //PIDTEMP
|
2589
|
2595
|
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
|
2590
|
2596
|
{
|
2591
|
|
- #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
|
2592
|
|
- const uint8_t NUM_PULSES=16;
|
2593
|
|
- const float PULSE_LENGTH=0.01524;
|
2594
|
|
- for(int i=0; i < NUM_PULSES; i++) {
|
2595
|
|
- WRITE(PHOTOGRAPH_PIN, HIGH);
|
2596
|
|
- _delay_ms(PULSE_LENGTH);
|
2597
|
|
- WRITE(PHOTOGRAPH_PIN, LOW);
|
2598
|
|
- _delay_ms(PULSE_LENGTH);
|
|
2597
|
+ #ifdef CHDK
|
|
2598
|
+
|
|
2599
|
+ SET_OUTPUT(CHDK);
|
|
2600
|
+ WRITE(CHDK, HIGH);
|
|
2601
|
+ chdkHigh = millis();
|
|
2602
|
+ chdkActive = true;
|
|
2603
|
+
|
|
2604
|
+ #else
|
|
2605
|
+
|
|
2606
|
+ #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
|
|
2607
|
+ const uint8_t NUM_PULSES=16;
|
|
2608
|
+ const float PULSE_LENGTH=0.01524;
|
|
2609
|
+ for(int i=0; i < NUM_PULSES; i++) {
|
|
2610
|
+ WRITE(PHOTOGRAPH_PIN, HIGH);
|
|
2611
|
+ _delay_ms(PULSE_LENGTH);
|
|
2612
|
+ WRITE(PHOTOGRAPH_PIN, LOW);
|
|
2613
|
+ _delay_ms(PULSE_LENGTH);
|
2599
|
2614
|
}
|
2600
|
2615
|
delay(7.33);
|
2601
|
2616
|
for(int i=0; i < NUM_PULSES; i++) {
|
2602
|
|
- WRITE(PHOTOGRAPH_PIN, HIGH);
|
2603
|
|
- _delay_ms(PULSE_LENGTH);
|
2604
|
|
- WRITE(PHOTOGRAPH_PIN, LOW);
|
2605
|
|
- _delay_ms(PULSE_LENGTH);
|
|
2617
|
+ WRITE(PHOTOGRAPH_PIN, HIGH);
|
|
2618
|
+ _delay_ms(PULSE_LENGTH);
|
|
2619
|
+ WRITE(PHOTOGRAPH_PIN, LOW);
|
|
2620
|
+ _delay_ms(PULSE_LENGTH);
|
2606
|
2621
|
}
|
2607
|
|
- #endif
|
|
2622
|
+ #endif
|
|
2623
|
+ #endif //chdk end if
|
2608
|
2624
|
}
|
2609
|
2625
|
break;
|
2610
|
2626
|
#ifdef DOGLCD
|
|
@@ -3353,6 +3369,16 @@ void manage_inactivity()
|
3353
|
3369
|
}
|
3354
|
3370
|
}
|
3355
|
3371
|
}
|
|
3372
|
+
|
|
3373
|
+ #ifdef CHDK //Check if pin should be set to LOW after M240 set it to HIGH
|
|
3374
|
+ if (chdkActive)
|
|
3375
|
+ {
|
|
3376
|
+ chdkActive = false;
|
|
3377
|
+ if (millis()-chdkHigh < CHDK_DELAY) return;
|
|
3378
|
+ WRITE(CHDK, LOW);
|
|
3379
|
+ }
|
|
3380
|
+ #endif
|
|
3381
|
+
|
3356
|
3382
|
#if defined(KILL_PIN) && KILL_PIN > -1
|
3357
|
3383
|
if( 0 == READ(KILL_PIN) )
|
3358
|
3384
|
kill();
|