Merge branch 'Marlin_v1' of https://github.com/ErikZalm/Marlin into Marlin_v1

This commit is contained in:
neildarlow
2014-03-21 18:27:14 +00:00
5 changed files with 397 additions and 54 deletions

View File

@ -189,6 +189,14 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedmultiply=100; //100->1 200->2
int saved_feedmultiply;
int extrudemultiply=100; //100->1 200->2
int extruder_multiply[EXTRUDERS] = {100
#if EXTRUDERS > 1
, 100
#if EXTRUDERS > 2
, 100
#endif
#endif
};
float volumetric_multiplier[EXTRUDERS] = {1.0
#if EXTRUDERS > 1
, 1.0
@ -314,6 +322,12 @@ bool Stopped=false;
bool CooldownNoWait = true;
bool target_direction;
//Insert variables if CHDK is defined
#ifdef CHDK
unsigned long chdkHigh = 0;
boolean chdkActive = false;
#endif
//===========================================================================
//=============================Routines======================================
//===========================================================================
@ -2422,7 +2436,18 @@ void process_commands()
{
if(code_seen('S'))
{
extrudemultiply = code_value() ;
int tmp_code = code_value();
if (code_seen('T'))
{
if(setTargetedHotend(221)){
break;
}
extruder_multiply[tmp_extruder] = tmp_code;
}
else
{
extrudemultiply = tmp_code ;
}
}
}
break;
@ -2590,23 +2615,33 @@ void process_commands()
#endif //PIDTEMP
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
{
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
const uint8_t NUM_PULSES=16;
const float PULSE_LENGTH=0.01524;
for(int i=0; i < NUM_PULSES; i++) {
WRITE(PHOTOGRAPH_PIN, HIGH);
_delay_ms(PULSE_LENGTH);
WRITE(PHOTOGRAPH_PIN, LOW);
_delay_ms(PULSE_LENGTH);
#ifdef CHDK
SET_OUTPUT(CHDK);
WRITE(CHDK, HIGH);
chdkHigh = millis();
chdkActive = true;
#else
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
const uint8_t NUM_PULSES=16;
const float PULSE_LENGTH=0.01524;
for(int i=0; i < NUM_PULSES; i++) {
WRITE(PHOTOGRAPH_PIN, HIGH);
_delay_ms(PULSE_LENGTH);
WRITE(PHOTOGRAPH_PIN, LOW);
_delay_ms(PULSE_LENGTH);
}
delay(7.33);
for(int i=0; i < NUM_PULSES; i++) {
WRITE(PHOTOGRAPH_PIN, HIGH);
_delay_ms(PULSE_LENGTH);
WRITE(PHOTOGRAPH_PIN, LOW);
_delay_ms(PULSE_LENGTH);
WRITE(PHOTOGRAPH_PIN, HIGH);
_delay_ms(PULSE_LENGTH);
WRITE(PHOTOGRAPH_PIN, LOW);
_delay_ms(PULSE_LENGTH);
}
#endif
#endif
#endif //chdk end if
}
break;
#ifdef DOGLCD
@ -3355,6 +3390,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( 0 == READ(KILL_PIN) )
kill();
@ -3522,6 +3567,9 @@ bool setTargetedHotend(int code){
case 218:
SERIAL_ECHO(MSG_M218_INVALID_EXTRUDER);
break;
case 221:
SERIAL_ECHO(MSG_M221_INVALID_EXTRUDER);
break;
}
SERIAL_ECHOLN(tmp_extruder);
return true;