Added CHDK support

Added CHDK support to take pictures instead of doing an IR command, see more about how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
This commit is contained in:
blddk 2014-03-10 21:57:08 +01:00
parent 765b2da3d4
commit 09af1b90b8

View File

@ -314,6 +314,12 @@ bool Stopped=false;
bool CooldownNoWait = true; bool CooldownNoWait = true;
bool target_direction; bool target_direction;
//Insert variables if CHDK is defined
#ifdef CHDK
unsigned long chdkHigh = 0;
boolean chdkActive = false;
#endif
//=========================================================================== //===========================================================================
//=============================Routines====================================== //=============================Routines======================================
//=========================================================================== //===========================================================================
@ -2588,6 +2594,15 @@ void process_commands()
#endif //PIDTEMP #endif //PIDTEMP
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/ case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
{ {
#ifdef CHDK
SET_OUTPUT(CHDK);
WRITE(CHDK, HIGH);
chdkHigh = millis();
chdkActive = true;
#else
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
const uint8_t NUM_PULSES=16; const uint8_t NUM_PULSES=16;
const float PULSE_LENGTH=0.01524; const float PULSE_LENGTH=0.01524;
@ -2605,6 +2620,7 @@ void process_commands()
_delay_ms(PULSE_LENGTH); _delay_ms(PULSE_LENGTH);
} }
#endif #endif
#endif //chdk end if
} }
break; break;
#ifdef DOGLCD #ifdef DOGLCD
@ -3353,6 +3369,16 @@ void manage_inactivity()
} }
} }
} }
#ifdef CHDK //Check if pin should be set to LOW after M240 set it to HIGH
if (chdkActive)
{
chdkActive = false;
if (millis()-chdkHigh < CHDK_DELAY) return;
WRITE(CHDK, LOW);
}
#endif
#if defined(KILL_PIN) && KILL_PIN > -1 #if defined(KILL_PIN) && KILL_PIN > -1
if( 0 == READ(KILL_PIN) ) if( 0 == READ(KILL_PIN) )
kill(); kill();