@ -1,30 +1,30 @@
/* -*- c++ -*- */
/*
Reprap firmware b ased on Sprinter and grbl .
Copyright ( C ) 2011 Camiel Gubbels / Erik van der Zalm
This program is free software : you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
/*
This firmware is a mashup between Sprinter and grbl .
( https : //github.com/kliment/Sprinter)
( https : //github.com/simen/grbl/tree)
It has preliminary support for Matthew Roberts advance algorithm
http : //reprap.org/pipermail/reprap-dev/2011-May/003323.html
/**
* Marlin Firmware
*
* B ased on Sprinter and grbl .
* Copyright ( C ) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*
* About Marlin
*
* This firmware is a mashup between Sprinter and grbl .
* - https : //github.com/kliment/Sprinter
* - https : //github.com/simen/grbl/tree
*
* It has preliminary support for Matthew Roberts advance algorithm
* - http : //reprap.org/pipermail/reprap-dev/2011-May/003323.html
*/
# include "Marlin.h"
@ -73,13 +73,12 @@
* - http : //objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
*
* Help us document these G - codes online :
* - http : //www.marlinfirmware.org/index.php/G-Code
* - http : //reprap.org/wiki/G-code
* - https : //github.com/MarlinFirmware/Marlin/wiki/Marlin-G-Code
*/
/**
*
* - - - - - - - - - - - - - - - - -
* Implemented Codes
* - - - - - - - - - - - - - - - - - - -
* - - - - - - - - - - - - - - - - -
*
* " G " Codes
*
@ -163,7 +162,7 @@
* M205 - advanced settings : minimum travel speed S = while printing T = travel only , B = minimum segment time X = maximum xy jerk , Z = maximum Z jerk , E = maximum E jerk
* M206 - Set additional homing offset
* M207 - Set retract length S [ positive mm ] F [ feedrate mm / min ] Z [ additional zlift / hop ] , stays in mm regardless of M200 setting
* M208 - Set recover = unretract length S [ positive mm surplus to the M207 S * ] F [ feedrate mm / sec ]
* M208 - Set recover = unretract length S [ positive mm surplus to the M207 S * ] F [ feedrate mm / min ]
* M209 - S < 1 = true / 0 = false > enable automatic retract detect if the slicer did not support G10 / 11 : every normal extrude - only move will be classified as retract depending on the direction .
* M218 - Set hotend offset ( in mm ) : T < extruder_number > X < offset_on_X > Y < offset_on_Y >
* M220 - Set speed factor override percentage : S < factor in percent >
@ -215,6 +214,11 @@
*
* M928 - Start SD logging ( M928 filename . g ) - ended by M29
* M999 - Restart after being stopped by error
*
* " T " Codes
*
* T0 - T3 - Select a tool by index ( usually an extruder ) [ F < mm / min > ]
*
*/
# ifdef SDSUPPORT
@ -557,9 +561,9 @@ void servo_init() {
// Set position of Servo Endstops that are defined
# ifdef SERVO_ENDSTOPS
for ( int i = 0 ; i < 3 ; i + + )
if ( servo_endstops [ i ] > = 0 )
servo [ servo_endstops [ i ] ] . write ( servo_endstop_angles [ i * 2 + 1 ] ) ;
for ( int i = 0 ; i < 3 ; i + + )
if ( servo_endstops [ i ] > = 0 )
servo [ servo_endstops [ i ] ] . write ( servo_endstop_angles [ i * 2 + 1 ] ) ;
# endif
# if SERVO_LEVELING
@ -993,7 +997,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
# endif //DUAL_X_CARRIAGE
static void axis_is_at_home ( int axis ) {
static void axis_is_at_home ( AxisEnum axis ) {
# ifdef DUAL_X_CARRIAGE
if ( axis = = X_AXIS ) {
@ -1198,12 +1202,12 @@ static void setup_for_endstop_move() {
plan_bed_level_matrix . set_to_identity ( ) ;
feedrate = homing_feedrate [ Z_AXIS ] ;
// move down until you find the b ed
// Move down until the probe (or endstop?) is trigger ed
float zPosition = - 10 ;
line_to_z ( zPosition ) ;
st_synchronize ( ) ;
// we have to let the planner know where we are right now as it is not where we said to go.
// Tell the planner where we ended up - Get this from the stepper handler
zPosition = st_get_position_mm ( Z_AXIS ) ;
plan_set_position ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , zPosition , current_position [ E_AXIS ] ) ;
@ -1313,21 +1317,21 @@ static void setup_for_endstop_move() {
st_synchronize ( ) ;
# ifdef Z_PROBE_ENDSTOP
bool z_probe_endstop = ( READ ( Z_PROBE_PIN ) ! = Z_PROBE_ENDSTOP_INVERTING ) ;
if ( z_probe_endstop )
# else
bool z_min_endstop = ( READ ( Z_MIN_PIN ) ! = Z_MIN_ENDSTOP_INVERTING ) ;
if ( z_min_endstop )
# endif
{
if ( IsRunning ( ) ) {
SERIAL_ERROR_START ;
SERIAL_ERRORLNPGM ( " Z-Probe failed to engage! " ) ;
LCD_ALERTMESSAGEPGM ( " Err: ZPROBE " ) ;
# ifdef Z_PROBE_ENDSTOP
bool z_probe_endstop = ( READ ( Z_PROBE_PIN ) ! = Z_PROBE_ENDSTOP_INVERTING ) ;
if ( z_probe_endstop )
# else
bool z_min_endstop = ( READ ( Z_MIN_PIN ) ! = Z_MIN_ENDSTOP_INVERTING ) ;
if ( z_min_endstop )
# endif
{
if ( IsRunning ( ) ) {
SERIAL_ERROR_START ;
SERIAL_ERRORLNPGM ( " Z-Probe failed to engage! " ) ;
LCD_ALERTMESSAGEPGM ( " Err: ZPROBE " ) ;
}
Stop ( ) ;
}
Stop ( ) ;
}
# endif // Z_PROBE_ALLEN_KEY
@ -1390,23 +1394,23 @@ static void setup_for_endstop_move() {
st_synchronize ( ) ;
# ifdef Z_PROBE_ENDSTOP
bool z_probe_endstop = ( READ ( Z_PROBE_PIN ) ! = Z_PROBE_ENDSTOP_INVERTING ) ;
if ( ! z_probe_endstop )
# else
bool z_min_endstop = ( READ ( Z_MIN_PIN ) ! = Z_MIN_ENDSTOP_INVERTING ) ;
if ( ! z_min_endstop )
# endif
{
if ( IsRunning ( ) ) {
SERIAL_ERROR_START ;
SERIAL_ERRORLNPGM ( " Z-Probe failed to retract! " ) ;
LCD_ALERTMESSAGEPGM ( " Err: ZPROBE " ) ;
# ifdef Z_PROBE_ENDSTOP
bool z_probe_endstop = ( READ ( Z_PROBE_PIN ) ! = Z_PROBE_ENDSTOP_INVERTING ) ;
if ( ! z_probe_endstop )
# else
bool z_min_endstop = ( READ ( Z_MIN_PIN ) ! = Z_MIN_ENDSTOP_INVERTING ) ;
if ( ! z_min_endstop )
# endif
{
if ( IsRunning ( ) ) {
SERIAL_ERROR_START ;
SERIAL_ERRORLNPGM ( " Z-Probe failed to retract! " ) ;
LCD_ALERTMESSAGEPGM ( " Err: ZPROBE " ) ;
}
Stop ( ) ;
}
Stop ( ) ;
}
# endif
# endif // Z_PROBE_ALLEN_KEY
}
@ -1418,32 +1422,31 @@ static void setup_for_endstop_move() {
} ;
// Probe bed height at position (x,y), returns the measured z value
static float probe_pt ( float x , float y , float z_before , ProbeAction retract _action = ProbeDeployAndStow , int verbose_level = 1 ) {
static float probe_pt ( float x , float y , float z_before , ProbeAction p rob e_action= ProbeDeployAndStow , int verbose_level = 1 ) {
// move to right place
do_blocking_move_to ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , z_before ) ; // this also updates current_position
do_blocking_move_to ( x - X_PROBE_OFFSET_FROM_EXTRUDER , y - Y_PROBE_OFFSET_FROM_EXTRUDER , current_position [ Z_AXIS ] ) ; // this also updates current_position
# if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY)
if ( retract _action & ProbeDeploy ) deploy_z_probe ( ) ;
if ( p rob e_action & ProbeDeploy ) deploy_z_probe ( ) ;
# endif
run_z_probe ( ) ;
float measured_z = current_position [ Z_AXIS ] ;
# if Z_RAISE_BETWEEN_PROBINGS > 0
if ( retract _action = = ProbeStay ) {
if ( p rob e_action = = ProbeStay ) {
do_blocking_move_to ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] + Z_RAISE_BETWEEN_PROBINGS ) ; // this also updates current_position
st_synchronize ( ) ;
}
# endif
# if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY)
if ( retract _action & ProbeStow ) stow_z_probe ( ) ;
if ( p rob e_action & ProbeStow ) stow_z_probe ( ) ;
# endif
if ( verbose_level > 2 ) {
SERIAL_PROTOCOLPGM ( " Bed " ) ;
SERIAL_PROTOCOLPGM ( " X: " ) ;
SERIAL_PROTOCOLPGM ( " Bed X: " ) ;
SERIAL_PROTOCOL_F ( x , 3 ) ;
SERIAL_PROTOCOLPGM ( " Y: " ) ;
SERIAL_PROTOCOL_F ( y , 3 ) ;
@ -1593,12 +1596,11 @@ static void homeaxis(AxisEnum axis) {
if ( axis = = Z_AXIS ) {
if ( axis_home_dir < 0 ) deploy_z_probe ( ) ;
}
else
# endif
# ifdef SERVO_ENDSTOPS
{
if ( axis ! = Z_AXIS ) {
// Engage Servo endstop if enabled
if ( servo_endstops [ axis ] > - 1 )
servo [ servo_endstops [ axis ] ] . write ( servo_endstop_angles [ axis * 2 ] ) ;
@ -2763,8 +2765,8 @@ inline void gcode_G28() {
z_tmp = current_position [ Z_AXIS ] ,
real_z = ( float ) st_get_position ( Z_AXIS ) / axis_steps_per_unit [ Z_AXIS ] ; //get the real Z (since the auto bed leveling is already correcting the plane)
apply_rotation_xyz ( plan_bed_level_matrix , x_tmp , y_tmp , z_tmp ) ; //Apply the correction sending the probe offset
current_position [ Z_AXIS ] = z_tmp - real_z + current_position [ Z_AXIS ] ; // The difference is added to current position and sent to planner.
apply_rotation_xyz ( plan_bed_level_matrix , x_tmp , y_tmp , z_tmp ) ; // Apply the correction sending the probe offset
current_position [ Z_AXIS ] + = z_tmp - real_z ; // The difference is added to current position and sent to planner.
sync_plan_position ( ) ;
}
# endif // !DELTA
@ -2792,8 +2794,7 @@ inline void gcode_G28() {
feedrate = homing_feedrate [ Z_AXIS ] ;
run_z_probe ( ) ;
SERIAL_PROTOCOLPGM ( " Bed " ) ;
SERIAL_PROTOCOLPGM ( " X: " ) ;
SERIAL_PROTOCOLPGM ( " Bed X: " ) ;
SERIAL_PROTOCOL ( current_position [ X_AXIS ] + 0.0001 ) ;
SERIAL_PROTOCOLPGM ( " Y: " ) ;
SERIAL_PROTOCOL ( current_position [ Y_AXIS ] + 0.0001 ) ;
@ -4624,7 +4625,7 @@ inline void gcode_M400() { st_synchronize(); }
stow_z_probe ( false ) ;
}
# endif
# endif // ENABLE_AUTO_BED_LEVELING && (SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
# ifdef FILAMENT_SENSOR
@ -4819,7 +4820,7 @@ inline void gcode_M503() {
if ( code_seen ( ' Z ' ) ) {
value = code_value ( ) ;
if ( Z_PROBE_OFFSET_RANGE_MIN < = value & & value < = Z_PROBE_OFFSET_RANGE_MAX ) {
zprobe_zoffset = - value ; // compare w/ line 278 of configuration_store.cpp
zprobe_zoffset = - value ;
SERIAL_ECHO_START ;
SERIAL_ECHOLNPGM ( MSG_ZPROBE_ZOFFSET " " MSG_OK ) ;
SERIAL_EOL ;
@ -5074,9 +5075,11 @@ inline void gcode_M999() {
/**
* T0 - T3 : Switch tool , usually switching extruders
*
* F [ mm / min ] Set the movement feedrate
*/
inline void gcode_T ( ) {
int tmp_extruder = code_value ( ) ;
u int16_ t tmp_extruder = code_value_short ( ) ;
if ( tmp_extruder > = EXTRUDERS ) {
SERIAL_ECHO_START ;
SERIAL_CHAR ( ' T ' ) ;
@ -5589,14 +5592,14 @@ void process_next_command() {
gcode_M400 ( ) ;
break ;
# if defined(ENABLE_AUTO_BED_LEVELING) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY)) && not defined(Z_PROBE_SLED)
# if defined(ENABLE_AUTO_BED_LEVELING) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY)) && ! defined(Z_PROBE_SLED)
case 401 :
gcode_M401 ( ) ;
break ;
case 402 :
gcode_M402 ( ) ;
break ;
# endif
# endif // ENABLE_AUTO_BED_LEVELING && (SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
# ifdef FILAMENT_SENSOR
case 404 : //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
@ -6089,82 +6092,83 @@ void prepare_move() {
# endif // HAS_CONTROLLERFAN
# ifdef SCARA
void calculate_SCARA_forward_Transform ( float f_scara [ 3 ] )
{
// Perform forward kinematics, and place results in delta[3]
// The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
float x_sin , x_cos , y_sin , y_cos ;
void calculate_SCARA_forward_Transform ( float f_scara [ 3 ] ) {
// Perform forward kinematics, and place results in delta[3]
// The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
float x_sin , x_cos , y_sin , y_cos ;
//SERIAL_ECHOPGM("f_delta x="); SERIAL_ECHO(f_scara[X_AXIS]);
//SERIAL_ECHOPGM(" y="); SERIAL_ECHO(f_scara[Y_AXIS]);
x_sin = sin ( f_scara [ X_AXIS ] / SCARA_RAD2DEG ) * Linkage_1 ;
x_cos = cos ( f_scara [ X_AXIS ] / SCARA_RAD2DEG ) * Linkage_1 ;
y_sin = sin ( f_scara [ Y_AXIS ] / SCARA_RAD2DEG ) * Linkage_2 ;
y_cos = cos ( f_scara [ Y_AXIS ] / SCARA_RAD2DEG ) * Linkage_2 ;
// SERIAL_ECHOPGM(" x_sin="); SERIAL_ECHO(x_sin);
// SERIAL_ECHOPGM(" x_cos="); SERIAL_ECHO(x_cos);
// SERIAL_ECHOPGM(" y_sin="); SERIAL_ECHO(y_sin);
// SERIAL_ECHOPGM(" y_cos="); SERIAL_ECHOLN(y_cos);
//SERIAL_ECHOPGM(" x_sin="); SERIAL_ECHO(x_sin);
//SERIAL_ECHOPGM(" x_cos="); SERIAL_ECHO(x_cos);
//SERIAL_ECHOPGM(" y_sin="); SERIAL_ECHO(y_sin);
//SERIAL_ECHOPGM(" y_cos="); SERIAL_ECHOLN(y_cos);
delta [ X_AXIS ] = x_cos + y_cos + SCARA_offset_x ; //theta
delta [ Y_AXIS ] = x_sin + y_sin + SCARA_offset_y ; //theta+phi
//SERIAL_ECHOPGM(" delta[X_AXIS]="); SERIAL_ECHO(delta[X_AXIS]);
//SERIAL_ECHOPGM(" delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
}
}
void calculate_delta ( float cartesian [ 3 ] ) {
//reverse kinematics.
// Perform reversed kinematics, and place results in delta[3]
// The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
float SCARA_pos [ 2 ] ;
static float SCARA_C2 , SCARA_S2 , SCARA_K1 , SCARA_K2 , SCARA_theta , SCARA_psi ;
SCARA_pos [ X_AXIS ] = cartesian [ X_AXIS ] * axis_scaling [ X_AXIS ] - SCARA_offset_x ; //Translate SCARA to standard X Y
SCARA_pos [ Y_AXIS ] = cartesian [ Y_AXIS ] * axis_scaling [ Y_AXIS ] - SCARA_offset_y ; // With scaling factor.
# if (Linkage_1 == Linkage_2)
SCARA_C2 = ( ( sq ( SCARA_pos [ X_AXIS ] ) + sq ( SCARA_pos [ Y_AXIS ] ) ) / ( 2 * ( float ) L1_2 ) ) - 1 ;
# else
SCARA_C2 = ( sq ( SCARA_pos [ X_AXIS ] ) + sq ( SCARA_pos [ Y_AXIS ] ) - ( float ) L1_2 - ( float ) L2_2 ) / 45000 ;
# endif
SCARA_S2 = sqrt ( 1 - sq ( SCARA_C2 ) ) ;
SCARA_K1 = Linkage_1 + Linkage_2 * SCARA_C2 ;
SCARA_K2 = Linkage_2 * SCARA_S2 ;
SCARA_theta = ( atan2 ( SCARA_pos [ X_AXIS ] , SCARA_pos [ Y_AXIS ] ) - atan2 ( SCARA_K1 , SCARA_K2 ) ) * - 1 ;
SCARA_psi = atan2 ( SCARA_S2 , SCARA_C2 ) ;
delta [ X_AXIS ] = SCARA_theta * SCARA_RAD2DEG ; // Multiply by 180/Pi - theta is support arm angle
delta [ Y_AXIS ] = ( SCARA_theta + SCARA_psi ) * SCARA_RAD2DEG ; // - equal to sub arm angle (inverted motor)
delta [ Z_AXIS ] = cartesian [ Z_AXIS ] ;
/*
SERIAL_ECHOPGM ( " cartesian x= " ) ; SERIAL_ECHO ( cartesian [ X_AXIS ] ) ;
SERIAL_ECHOPGM ( " y= " ) ; SERIAL_ECHO ( cartesian [ Y_AXIS ] ) ;
SERIAL_ECHOPGM ( " z= " ) ; SERIAL_ECHOLN ( cartesian [ Z_AXIS ] ) ;
SERIAL_ECHOPGM ( " scara x= " ) ; SERIAL_ECHO ( SCARA_pos [ X_AXIS ] ) ;
SERIAL_ECHOPGM ( " y= " ) ; SERIAL_ECHOLN ( SCARA_pos [ Y_AXIS ] ) ;
SERIAL_ECHOPGM ( " delta x= " ) ; SERIAL_ECHO ( delta [ X_AXIS ] ) ;
SERIAL_ECHOPGM ( " y= " ) ; SERIAL_ECHO ( delta [ Y_AXIS ] ) ;
SERIAL_ECHOPGM ( " z= " ) ; SERIAL_ECHOLN ( delta [ Z_AXIS ] ) ;
SERIAL_ECHOPGM ( " C2= " ) ; SERIAL_ECHO ( SCARA_C2 ) ;
SERIAL_ECHOPGM ( " S2= " ) ; SERIAL_ECHO ( SCARA_S2 ) ;
SERIAL_ECHOPGM ( " Theta= " ) ; SERIAL_ECHO ( SCARA_theta ) ;
SERIAL_ECHOPGM ( " Psi= " ) ; SERIAL_ECHOLN ( SCARA_psi ) ;
SERIAL_ECHOLN ( " " ) ; */
}
void calculate_delta ( float cartesian [ 3 ] ) {
//reverse kinematics.
// Perform reversed kinematics, and place results in delta[3]
// The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
float SCARA_pos [ 2 ] ;
static float SCARA_C2 , SCARA_S2 , SCARA_K1 , SCARA_K2 , SCARA_theta , SCARA_psi ;
SCARA_pos [ X_AXIS ] = cartesian [ X_AXIS ] * axis_scaling [ X_AXIS ] - SCARA_offset_x ; //Translate SCARA to standard X Y
SCARA_pos [ Y_AXIS ] = cartesian [ Y_AXIS ] * axis_scaling [ Y_AXIS ] - SCARA_offset_y ; // With scaling factor.
# if (Linkage_1 == Linkage_2)
SCARA_C2 = ( ( sq ( SCARA_pos [ X_AXIS ] ) + sq ( SCARA_pos [ Y_AXIS ] ) ) / ( 2 * ( float ) L1_2 ) ) - 1 ;
# else
SCARA_C2 = ( sq ( SCARA_pos [ X_AXIS ] ) + sq ( SCARA_pos [ Y_AXIS ] ) - ( float ) L1_2 - ( float ) L2_2 ) / 45000 ;
# endif
SCARA_S2 = sqrt ( 1 - sq ( SCARA_C2 ) ) ;
SCARA_K1 = Linkage_1 + Linkage_2 * SCARA_C2 ;
SCARA_K2 = Linkage_2 * SCARA_S2 ;
SCARA_theta = ( atan2 ( SCARA_pos [ X_AXIS ] , SCARA_pos [ Y_AXIS ] ) - atan2 ( SCARA_K1 , SCARA_K2 ) ) * - 1 ;
SCARA_psi = atan2 ( SCARA_S2 , SCARA_C2 ) ;
delta [ X_AXIS ] = SCARA_theta * SCARA_RAD2DEG ; // Multiply by 180/Pi - theta is support arm angle
delta [ Y_AXIS ] = ( SCARA_theta + SCARA_psi ) * SCARA_RAD2DEG ; // - equal to sub arm angle (inverted motor)
delta [ Z_AXIS ] = cartesian [ Z_AXIS ] ;
/*
SERIAL_ECHOPGM ( " cartesian x= " ) ; SERIAL_ECHO ( cartesian [ X_AXIS ] ) ;
SERIAL_ECHOPGM ( " y= " ) ; SERIAL_ECHO ( cartesian [ Y_AXIS ] ) ;
SERIAL_ECHOPGM ( " z= " ) ; SERIAL_ECHOLN ( cartesian [ Z_AXIS ] ) ;
SERIAL_ECHOPGM ( " scara x= " ) ; SERIAL_ECHO ( SCARA_pos [ X_AXIS ] ) ;
SERIAL_ECHOPGM ( " y= " ) ; SERIAL_ECHOLN ( SCARA_pos [ Y_AXIS ] ) ;
SERIAL_ECHOPGM ( " delta x= " ) ; SERIAL_ECHO ( delta [ X_AXIS ] ) ;
SERIAL_ECHOPGM ( " y= " ) ; SERIAL_ECHO ( delta [ Y_AXIS ] ) ;
SERIAL_ECHOPGM ( " z= " ) ; SERIAL_ECHOLN ( delta [ Z_AXIS ] ) ;
SERIAL_ECHOPGM ( " C2= " ) ; SERIAL_ECHO ( SCARA_C2 ) ;
SERIAL_ECHOPGM ( " S2= " ) ; SERIAL_ECHO ( SCARA_S2 ) ;
SERIAL_ECHOPGM ( " Theta= " ) ; SERIAL_ECHO ( SCARA_theta ) ;
SERIAL_ECHOPGM ( " Psi= " ) ; SERIAL_ECHOLN ( SCARA_psi ) ;
SERIAL_EOL ;
*/
}
# endif
# endif // SCARA
# ifdef TEMP_STAT_LEDS
@ -6395,88 +6399,89 @@ void kill()
st_synchronize ( ) ;
}
}
# endif
void Stop ( ) {
disable_all_heaters ( ) ;
if ( IsRunning ( ) ) {
Running = false ;
Stopped_gcode_LastN = gcode_LastN ; // Save last g_code for restart
SERIAL_ERROR_START ;
SERIAL_ERRORLNPGM ( MSG_ERR_STOPPED ) ;
LCD_MESSAGEPGM ( MSG_STOPPED ) ;
}
}
# endif // FILAMENT_RUNOUT_SENSOR
# ifdef FAST_PWM_FAN
void setPwmFrequency ( uint8_t pin , int val )
{
val & = 0x07 ;
switch ( digitalPinToTimer ( pin ) )
{
# if defined(TCCR0A)
case TIMER0A :
case TIMER0B :
// TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS02));
// TCCR0B |= val;
break ;
# endif
void setPwmFrequency ( uint8_t pin , int val ) {
val & = 0x07 ;
switch ( digitalPinToTimer ( pin ) ) {
# if defined(TCCR1 A)
case TIMER1 A :
case TIMER1 B :
// TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS1 2));
// TCCR1 B |= val;
break ;
# endif
# if defined(TCCR0A)
case TIMER0A :
case TIMER0B :
// TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS0 2));
// TCCR0 B |= val;
break ;
# endif
# if defined(TCCR2 )
case TIMER2 :
case TIMER2 :
TCCR2 & = ~ ( _BV ( CS10 ) | _BV ( CS11 ) | _BV ( CS12 ) ) ;
TCCR2 | = val ;
break ;
# endif
# if defined(TCCR1A )
case TIMER1A :
case TIMER1B :
// TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
// TCCR1B |= val;
break ;
# endif
# if defined(TCCR2A )
case TIMER2A :
case TIMER2B :
TCCR2B & = ~ ( _BV ( CS2 0 ) | _BV ( CS2 1 ) | _BV ( CS2 2 ) ) ;
TCCR2B | = val ;
break ;
# endif
# if defined(TCCR2)
case TIMER2 :
case TIMER2 :
TCCR2 & = ~ ( _BV ( CS1 0 ) | _BV ( CS1 1 ) | _BV ( CS1 2 ) ) ;
TCCR2 | = val ;
break ;
# endif
# if defined(TCCR3A)
case TIMER3A :
case TIMER3B :
case TIMER3C :
TCCR3B & = ~ ( _BV ( CS30 ) | _BV ( CS31 ) | _BV ( CS32 ) ) ;
TCCR3B | = val ;
break ;
# endif
# if defined(TCCR2A)
case TIMER2A :
case TIMER2B :
TCCR2B & = ~ ( _BV ( CS20 ) | _BV ( CS21 ) | _BV ( CS22 ) ) ;
TCCR2B | = val ;
break ;
# endif
# if defined(TCCR4A)
case TIMER4A :
case TIMER4B :
case TIMER4C :
TCCR4B & = ~ ( _BV ( CS40 ) | _BV ( CS41 ) | _BV ( CS42 ) ) ;
TCCR4B | = val ;
break ;
# endif
# if defined(TCCR5A)
case TIMER5A :
case TIMER5B :
case TIMER5C :
TCCR5B & = ~ ( _BV ( CS50 ) | _BV ( CS51 ) | _BV ( CS52 ) ) ;
TCCR5B | = val ;
break ;
# endif
# if defined(TCCR3A)
case TIMER3A :
case TIMER3B :
case TIMER3C :
TCCR3B & = ~ ( _BV ( CS30 ) | _BV ( CS31 ) | _BV ( CS32 ) ) ;
TCCR3B | = val ;
break ;
# endif
# if defined(TCCR4A)
case TIMER4A :
case TIMER4B :
case TIMER4C :
TCCR4B & = ~ ( _BV ( CS40 ) | _BV ( CS41 ) | _BV ( CS42 ) ) ;
TCCR4B | = val ;
break ;
# endif
# if defined(TCCR5A)
case TIMER5A :
case TIMER5B :
case TIMER5C :
TCCR5B & = ~ ( _BV ( CS50 ) | _BV ( CS51 ) | _BV ( CS52 ) ) ;
TCCR5B | = val ;
break ;
# endif
}
}
# endif // FAST_PWM_FAN
void Stop ( ) {
disable_all_heaters ( ) ;
if ( IsRunning ( ) ) {
Running = false ;
Stopped_gcode_LastN = gcode_LastN ; // Save last g_code for restart
SERIAL_ERROR_START ;
SERIAL_ERRORLNPGM ( MSG_ERR_STOPPED ) ;
LCD_MESSAGEPGM ( MSG_STOPPED ) ;
}
}
# endif //FAST_PWM_FAN
bool setTargetedHotend ( int code ) {
target_extruder = active_extruder ;