Add support for M300: Play beep sound

This commit is contained in:
Colin Edwards 2013-03-24 23:35:05 -05:00
parent 590225be25
commit 1a0f889803

View File

@ -117,6 +117,7 @@
// M220 S<factor in percent>- set speed factor override percentage
// M221 S<factor in percent>- set extrude factor override percentage
// M240 - Trigger a camera to take a photograph
// M300 - Play beepsound S<frequency Hz> P<duration ms>
// M301 - Set PID parameters P I and D
// M302 - Allow cold extrudes
// M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
@ -157,12 +158,12 @@ float add_homeing[3]={0,0,0};
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
// Extruder offset, only in XY plane
#if EXTRUDERS > 1
#if EXTRUDERS > 1
float extruder_offset[2][EXTRUDERS] = {
#if defined(EXTRUDER_OFFSET_X) && defined(EXTRUDER_OFFSET_Y)
EXTRUDER_OFFSET_X, EXTRUDER_OFFSET_Y
#endif
};
};
#endif
uint8_t active_extruder = 0;
int fanSpeed=0;
@ -1380,7 +1381,7 @@ void process_commands()
}
}break;
#endif // FWRETRACT
#endif // FWRETRACT
#if EXTRUDERS > 1
case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
{
@ -1405,7 +1406,7 @@ void process_commands()
SERIAL_ECHO(extruder_offset[Y_AXIS][tmp_extruder]);
}
SERIAL_ECHOLN("");
}break;
}break;
#endif
case 220: // M220 S<factor in percent>- set speed factor override percentage
{
@ -1424,6 +1425,20 @@ void process_commands()
}
break;
#ifdef BEEPER
case 300: // M300
{
int beepS = 1;
int beepP = 1000;
if(code_seen('S')) beepS = code_value();
if(code_seen('P')) beepP = code_value();
tone(BEEPER, beepS);
delay(beepP);
noTone(BEEPER);
}
break;
#endif // M300
#ifdef PIDTEMP
case 301: // M301
{
@ -1756,7 +1771,7 @@ void process_commands()
if(make_move && Stopped == false) {
prepare_move();
}
}
}
#endif
SERIAL_ECHO_START;
SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);