|
@@ -63,6 +63,7 @@
|
|
|
|
|
|
#include "menu.h"
|
|
#include "menu.h"
|
|
#include "ultralcd.h"
|
|
#include "ultralcd.h"
|
|
|
|
+#include "backlight.h"
|
|
|
|
|
|
#include "planner.h"
|
|
#include "planner.h"
|
|
#include "stepper.h"
|
|
#include "stepper.h"
|
|
@@ -82,6 +83,9 @@
|
|
#include "Dcodes.h"
|
|
#include "Dcodes.h"
|
|
#include "AutoDeplete.h"
|
|
#include "AutoDeplete.h"
|
|
|
|
|
|
|
|
+#ifndef LA_NOCOMPAT
|
|
|
|
+#include "la10compat.h"
|
|
|
|
+#endif
|
|
|
|
|
|
#ifdef SWSPI
|
|
#ifdef SWSPI
|
|
#include "swspi.h"
|
|
#include "swspi.h"
|
|
@@ -309,6 +313,8 @@ bool no_response = false;
|
|
uint8_t important_status;
|
|
uint8_t important_status;
|
|
uint8_t saved_filament_type;
|
|
uint8_t saved_filament_type;
|
|
|
|
|
|
|
|
+#define SAVED_TARGET_UNSET (X_MIN_POS-1)
|
|
|
|
+float saved_target[NUM_AXIS] = {SAVED_TARGET_UNSET, 0, 0, 0};
|
|
|
|
|
|
|
|
|
|
bool mmu_print_saved = false;
|
|
bool mmu_print_saved = false;
|
|
@@ -329,11 +335,15 @@ float destination[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
|
|
|
|
|
|
|
|
|
|
static float offset[3] = {0.0, 0.0, 0.0};
|
|
static float offset[3] = {0.0, 0.0, 0.0};
|
|
-static float feedrate = 1500.0, next_feedrate, saved_feedrate;
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+float feedrate = 1500.0;
|
|
-static bool relative_mode = false;
|
|
+
|
|
|
|
+
|
|
|
|
+static float next_feedrate;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+static float saved_feedrate;
|
|
|
|
|
|
const int sensitive_pins[] = SENSITIVE_PINS;
|
|
const int sensitive_pins[] = SENSITIVE_PINS;
|
|
|
|
|
|
@@ -350,9 +360,6 @@ unsigned long starttime=0;
|
|
unsigned long stoptime=0;
|
|
unsigned long stoptime=0;
|
|
unsigned long _usb_timer = 0;
|
|
unsigned long _usb_timer = 0;
|
|
|
|
|
|
-bool extruder_under_pressure = true;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
bool Stopped=false;
|
|
bool Stopped=false;
|
|
|
|
|
|
#if NUM_SERVOS > 0
|
|
#if NUM_SERVOS > 0
|
|
@@ -373,11 +380,10 @@ bool saved_printing = false;
|
|
static uint32_t saved_sdpos = 0;
|
|
static uint32_t saved_sdpos = 0;
|
|
uint8_t saved_printing_type = PRINTING_TYPE_SD;
|
|
uint8_t saved_printing_type = PRINTING_TYPE_SD;
|
|
static float saved_pos[4] = { 0, 0, 0, 0 };
|
|
static float saved_pos[4] = { 0, 0, 0, 0 };
|
|
-
|
|
+static uint16_t saved_feedrate2 = 0;
|
|
-static float saved_feedrate2 = 0;
|
|
+static int saved_feedmultiply2 = 0;
|
|
static uint8_t saved_active_extruder = 0;
|
|
static uint8_t saved_active_extruder = 0;
|
|
static float saved_extruder_temperature = 0.0;
|
|
static float saved_extruder_temperature = 0.0;
|
|
-static bool saved_extruder_under_pressure = false;
|
|
|
|
static bool saved_extruder_relative_mode = false;
|
|
static bool saved_extruder_relative_mode = false;
|
|
static int saved_fanSpeed = 0;
|
|
static int saved_fanSpeed = 0;
|
|
|
|
|
|
@@ -989,10 +995,6 @@ void setup()
|
|
|
|
|
|
ultralcd_init();
|
|
ultralcd_init();
|
|
|
|
|
|
-#if (LCD_BL_PIN != -1) && defined (LCD_BL_PIN)
|
|
|
|
- analogWrite(LCD_BL_PIN, 255);
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
spi_init();
|
|
spi_init();
|
|
|
|
|
|
lcd_splash();
|
|
lcd_splash();
|
|
@@ -1242,8 +1244,8 @@ void setup()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ eeprom_update_byte((uint8_t*)EEPROM_SILENT, SILENT_MODE_OFF);
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
- eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0);
|
|
|
|
tmc2130_mode = TMC2130_MODE_NORMAL;
|
|
tmc2130_mode = TMC2130_MODE_NORMAL;
|
|
#endif
|
|
#endif
|
|
eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1);
|
|
eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1);
|
|
@@ -2055,35 +2057,36 @@ static float probe_pt(float x, float y, float z_before) {
|
|
|
|
|
|
#ifdef LIN_ADVANCE
|
|
#ifdef LIN_ADVANCE
|
|
|
|
|
|
- * M900: Set and/or Get advance K factor and WH/D ratio
|
|
+ * M900: Set and/or Get advance K factor
|
|
*
|
|
*
|
|
* K<factor> Set advance K factor
|
|
* K<factor> Set advance K factor
|
|
- * R<ratio> Set ratio directly (overrides WH/D)
|
|
|
|
- * W<width> H<height> D<diam> Set ratio from WH/D
|
|
|
|
*/
|
|
*/
|
|
inline void gcode_M900() {
|
|
inline void gcode_M900() {
|
|
- st_synchronize();
|
|
+ float newK = code_seen('K') ? code_value_float() : -2;
|
|
-
|
|
+#ifdef LA_NOCOMPAT
|
|
- const float newK = code_seen('K') ? code_value_float() : -1;
|
|
+ if (newK >= 0 && newK < 10)
|
|
- if (newK >= 0) extruder_advance_k = newK;
|
|
+ extruder_advance_K = newK;
|
|
-
|
|
+ else
|
|
- float newR = code_seen('R') ? code_value_float() : -1;
|
|
+ SERIAL_ECHOLNPGM("K out of allowed range!");
|
|
- if (newR < 0) {
|
|
+#else
|
|
- const float newD = code_seen('D') ? code_value_float() : -1,
|
|
+ if (newK == 0)
|
|
- newW = code_seen('W') ? code_value_float() : -1,
|
|
+ extruder_advance_K = 0;
|
|
- newH = code_seen('H') ? code_value_float() : -1;
|
|
+ else if (newK == -1)
|
|
- if (newD >= 0 && newW >= 0 && newH >= 0)
|
|
+ la10c_reset();
|
|
- newR = newD ? (newW * newH) / (sq(newD * 0.5) * M_PI) : 0;
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ newK = la10c_value(newK);
|
|
|
|
+ if (newK < 0)
|
|
|
|
+ SERIAL_ECHOLNPGM("K out of allowed range!");
|
|
|
|
+ else
|
|
|
|
+ extruder_advance_K = newK;
|
|
}
|
|
}
|
|
- if (newR >= 0) advance_ed_ratio = newR;
|
|
+#endif
|
|
-
|
|
+
|
|
SERIAL_ECHO_START;
|
|
SERIAL_ECHO_START;
|
|
SERIAL_ECHOPGM("Advance K=");
|
|
SERIAL_ECHOPGM("Advance K=");
|
|
- SERIAL_ECHOLN(extruder_advance_k);
|
|
+ SERIAL_ECHOLN(extruder_advance_K);
|
|
- SERIAL_ECHOPGM(" E/D=");
|
|
+}
|
|
- const float ratio = advance_ed_ratio;
|
|
|
|
- if (ratio) SERIAL_ECHOLN(ratio); else SERIAL_ECHOLNPGM("Auto");
|
|
|
|
- }
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
bool check_commands() {
|
|
bool check_commands() {
|
|
@@ -2100,6 +2103,58 @@ bool check_commands() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void raise_z_above(float target, bool plan)
|
|
|
|
+{
|
|
|
|
+ if (current_position[Z_AXIS] >= target)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ current_position[Z_AXIS] = target;
|
|
|
|
+
|
|
|
|
+#if defined(Z_MIN_PIN) && (Z_MIN_PIN > -1) && !defined(DEBUG_DISABLE_ZMINLIMIT)
|
|
|
|
+ bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
|
|
|
|
+#else
|
|
|
|
+ bool z_min_endstop = false;
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+ if (axis_known_position[Z_AXIS] || z_min_endstop)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ if(plan) plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ enable_z();
|
|
|
|
+ st_synchronize();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bool z_endstop_enabled = enable_z_endstop(true);
|
|
|
|
+#ifdef TMC2130
|
|
|
|
+ tmc2130_home_enter(Z_AXIS_MASK);
|
|
|
|
+#endif
|
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60, active_extruder);
|
|
|
|
+ st_synchronize();
|
|
|
|
+#ifdef TMC2130
|
|
|
|
+ if (endstop_z_hit_on_purpose())
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ current_position[Z_AXIS] = max_pos[Z_AXIS];
|
|
|
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS],
|
|
|
|
+ current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
+ }
|
|
|
|
+ tmc2130_home_exit();
|
|
|
|
+#endif
|
|
|
|
+ enable_z_endstop(z_endstop_enabled);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
bool calibrate_z_auto()
|
|
bool calibrate_z_auto()
|
|
{
|
|
{
|
|
@@ -2434,6 +2489,9 @@ void ramming() {
|
|
|
|
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
void force_high_power_mode(bool start_high_power_section) {
|
|
void force_high_power_mode(bool start_high_power_section) {
|
|
|
|
+#ifdef PSU_Delta
|
|
|
|
+ if (start_high_power_section == true) enable_force_z();
|
|
|
|
+#endif
|
|
uint8_t silent;
|
|
uint8_t silent;
|
|
silent = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
|
|
silent = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
|
|
if (silent == 1) {
|
|
if (silent == 1) {
|
|
@@ -2482,9 +2540,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
|
|
|
|
|
|
|
if (home_all_axes) {
|
|
if (home_all_axes) {
|
|
- current_position[Z_AXIS] += MESH_HOME_Z_SEARCH;
|
|
+ raise_z_above(MESH_HOME_Z_SEARCH);
|
|
- feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
- plan_buffer_line_curposXYZE(feedrate / 60, active_extruder);
|
|
|
|
st_synchronize();
|
|
st_synchronize();
|
|
}
|
|
}
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
@@ -2595,26 +2651,21 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
#ifndef Z_SAFE_HOMING
|
|
#ifndef Z_SAFE_HOMING
|
|
if(home_z) {
|
|
if(home_z) {
|
|
#if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0)
|
|
#if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0)
|
|
- destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);
|
|
+ raise_z_above(Z_RAISE_BEFORE_HOMING);
|
|
- feedrate = max_feedrate[Z_AXIS];
|
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
|
|
|
st_synchronize();
|
|
st_synchronize();
|
|
#endif
|
|
#endif
|
|
#if (defined(MESH_BED_LEVELING) && !defined(MK1BP))
|
|
#if (defined(MESH_BED_LEVELING) && !defined(MK1BP))
|
|
- if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] ))
|
|
+ raise_z_above(MESH_HOME_Z_SEARCH);
|
|
- {
|
|
+ st_synchronize();
|
|
- homeaxis(X_AXIS);
|
|
+ if (!axis_known_position[X_AXIS]) homeaxis(X_AXIS);
|
|
- homeaxis(Y_AXIS);
|
|
+ if (!axis_known_position[Y_AXIS]) homeaxis(Y_AXIS);
|
|
- }
|
|
|
|
|
|
|
|
world2machine_initialize();
|
|
world2machine_initialize();
|
|
world2machine(pgm_read_float(bed_ref_points_4), pgm_read_float(bed_ref_points_4+1), destination[X_AXIS], destination[Y_AXIS]);
|
|
world2machine(pgm_read_float(bed_ref_points_4), pgm_read_float(bed_ref_points_4+1), destination[X_AXIS], destination[Y_AXIS]);
|
|
world2machine_reset();
|
|
world2machine_reset();
|
|
if (destination[Y_AXIS] < Y_MIN_POS)
|
|
if (destination[Y_AXIS] < Y_MIN_POS)
|
|
destination[Y_AXIS] = Y_MIN_POS;
|
|
destination[Y_AXIS] = Y_MIN_POS;
|
|
- destination[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
+ feedrate = homing_feedrate[X_AXIS] / 20;
|
|
- feedrate = homing_feedrate[Z_AXIS]/10;
|
|
|
|
- current_position[Z_AXIS] = 0;
|
|
|
|
enable_endstops(false);
|
|
enable_endstops(false);
|
|
#ifdef DEBUG_BUILD
|
|
#ifdef DEBUG_BUILD
|
|
SERIAL_ECHOLNPGM("plan_set_position()");
|
|
SERIAL_ECHOLNPGM("plan_set_position()");
|
|
@@ -2773,7 +2824,10 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
FORCE_HIGH_POWER_START;
|
|
FORCE_HIGH_POWER_START;
|
|
#endif
|
|
#endif
|
|
-
|
|
+
|
|
|
|
+ FORCE_BL_ON_START;
|
|
|
|
+
|
|
|
|
+
|
|
if (!onlyZ)
|
|
if (!onlyZ)
|
|
{
|
|
{
|
|
setTargetBed(0);
|
|
setTargetBed(0);
|
|
@@ -2961,6 +3015,9 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
FORCE_HIGH_POWER_END;
|
|
FORCE_HIGH_POWER_END;
|
|
#endif
|
|
#endif
|
|
|
|
+
|
|
|
|
+ FORCE_BL_ON_END;
|
|
|
|
+
|
|
return final_result;
|
|
return final_result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3141,15 +3198,6 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
|
|
custom_message_type = CustomMsg::Status;
|
|
custom_message_type = CustomMsg::Status;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-void marlin_rise_z(void)
|
|
|
|
-{
|
|
|
|
- if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void gcode_M701()
|
|
void gcode_M701()
|
|
{
|
|
{
|
|
printf_P(PSTR("gcode_M701 begin\n"));
|
|
printf_P(PSTR("gcode_M701 begin\n"));
|
|
@@ -3178,7 +3226,7 @@ void gcode_M701()
|
|
plan_buffer_line_curposXYZE(400 / 60, active_extruder);
|
|
plan_buffer_line_curposXYZE(400 / 60, active_extruder);
|
|
st_synchronize();
|
|
st_synchronize();
|
|
|
|
|
|
- marlin_rise_z();
|
|
+ raise_z_above(MIN_Z_FOR_LOAD, false);
|
|
current_position[E_AXIS] += 30;
|
|
current_position[E_AXIS] += 30;
|
|
plan_buffer_line_curposXYZE(400 / 60, active_extruder);
|
|
plan_buffer_line_curposXYZE(400 / 60, active_extruder);
|
|
|
|
|
|
@@ -3309,6 +3357,49 @@ static void gcode_PRUSA_BadRAMBoFanTest(){
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+static void gcode_G92()
|
|
|
|
+{
|
|
|
|
+ bool codes[NUM_AXIS];
|
|
|
|
+ float values[NUM_AXIS];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for(uint8_t i = 0; i < NUM_AXIS; ++i)
|
|
|
|
+ {
|
|
|
|
+ codes[i] = code_seen(axis_codes[i]);
|
|
|
|
+ if(codes[i])
|
|
|
|
+ values[i] = code_value();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if((codes[E_AXIS] && values[E_AXIS] == 0) &&
|
|
|
|
+ (!codes[X_AXIS] && !codes[Y_AXIS] && !codes[Z_AXIS]))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ current_position[E_AXIS] = 0;
|
|
|
|
+ plan_reset_next_e();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ st_synchronize();
|
|
|
|
+ for(uint8_t i = 0; i < 3; ++i)
|
|
|
|
+ {
|
|
|
|
+ if(codes[i])
|
|
|
|
+ current_position[i] = values[i] + cs.add_homing[i];
|
|
|
|
+ }
|
|
|
|
+ if(codes[E_AXIS])
|
|
|
|
+ current_position[E_AXIS] = values[E_AXIS];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS],
|
|
|
|
+ current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
#ifdef BACKLASH_X
|
|
#ifdef BACKLASH_X
|
|
extern uint8_t st_backlash_x;
|
|
extern uint8_t st_backlash_x;
|
|
#endif
|
|
#endif
|
|
@@ -3320,8 +3411,7 @@ extern uint8_t st_backlash_y;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -3340,7 +3430,7 @@ extern uint8_t st_backlash_y;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -3457,7 +3547,11 @@ extern uint8_t st_backlash_y;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
|
|
+
|
|
|
|
+They are shown in order of appearance in the code.
|
|
|
|
+There are reasons why some G Codes aren't in numerical order.
|
|
|
|
+*/
|
|
|
|
|
|
|
|
|
|
void process_commands()
|
|
void process_commands()
|
|
@@ -3501,7 +3595,25 @@ void process_commands()
|
|
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
|
|
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
|
|
int8_t SilentMode;
|
|
int8_t SilentMode;
|
|
#endif
|
|
#endif
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ---------------------------------------------------------------------------------
|
|
|
|
+ ### M117 - Display Message <a href="https://reprap.org/wiki/G-code#M117:_Display_Message">M117: Display Message</a>
|
|
|
|
+ This causes the given message to be shown in the status line on an attached LCD.
|
|
|
|
+ It is processed early as to allow printing messages that contain G, M, N or T.
|
|
|
|
|
|
|
|
+ ---------------------------------------------------------------------------------
|
|
|
|
+ ### Special internal commands
|
|
|
|
+ These are used by internal functions to process certain actions in the right order. Some of these are also usable by the user.
|
|
|
|
+ They are processed early as the commands are complex (strings).
|
|
|
|
+ These are only available on the MK3(S) as these require TMC2130 drivers:
|
|
|
|
+ - CRASH DETECTED
|
|
|
|
+ - CRASH RECOVER
|
|
|
|
+ - CRASH_CANCEL
|
|
|
|
+ - TMC_SET_WAVE
|
|
|
|
+ - TMC_SET_STEP
|
|
|
|
+ - TMC_SET_CHOP
|
|
|
|
+ */
|
|
if (code_seen("M117")) {
|
|
if (code_seen("M117")) {
|
|
starpos = (strchr(strchr_pointer + 5, '*'));
|
|
starpos = (strchr(strchr_pointer + 5, '*'));
|
|
if (starpos != NULL)
|
|
if (starpos != NULL)
|
|
@@ -3513,7 +3625,7 @@ void process_commands()
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("CRASH_"), 6) == 0)
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("CRASH_"), 6) == 0)
|
|
{
|
|
{
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
if(code_seen("CRASH_DETECTED"))
|
|
if(code_seen("CRASH_DETECTED"))
|
|
{
|
|
{
|
|
@@ -3523,12 +3635,12 @@ void process_commands()
|
|
crashdet_detected(mask);
|
|
crashdet_detected(mask);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
else if(code_seen("CRASH_RECOVER"))
|
|
else if(code_seen("CRASH_RECOVER"))
|
|
crashdet_recover();
|
|
crashdet_recover();
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
else if(code_seen("CRASH_CANCEL"))
|
|
else if(code_seen("CRASH_CANCEL"))
|
|
crashdet_cancel();
|
|
crashdet_cancel();
|
|
@@ -3536,7 +3648,7 @@ void process_commands()
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("TMC_"), 4) == 0)
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("TMC_"), 4) == 0)
|
|
{
|
|
{
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0)
|
|
if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0)
|
|
{
|
|
{
|
|
@@ -3549,7 +3661,7 @@ void process_commands()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0)
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0)
|
|
{
|
|
{
|
|
@@ -3563,7 +3675,7 @@ void process_commands()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0)
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0)
|
|
{
|
|
{
|
|
@@ -3618,20 +3730,20 @@ void process_commands()
|
|
#endif
|
|
#endif
|
|
else if(code_seen("PRUSA")){
|
|
else if(code_seen("PRUSA")){
|
|
|
|
|
|
- *
|
|
+ ---------------------------------------------------------------------------------
|
|
- ### PRUSA - Internal command set
|
|
+ ### PRUSA - Internal command set <a href="https://reprap.org/wiki/G-code#G98:_Activate_farm_mode">G98: Activate farm mode - Notes</a>
|
|
|
|
|
|
Set of internal PRUSA commands
|
|
Set of internal PRUSA commands
|
|
-
|
|
+ #### Usage
|
|
- PRUSA [ Ping | PRN | FAN | fn | thx | uvlo | fsensor_recover | MMURES | RESET | fv | M28 | SN | Fir | Rev | Lang | Lz | Beat | FR ]
|
|
+ PRUSA [ Ping | PRN | FAN | fn | thx | uvlo | MMURES | RESET | fv | M28 | SN | Fir | Rev | Lang | Lz | Beat | FR ]
|
|
-
|
|
+
|
|
|
|
+ #### Parameters
|
|
- `Ping`
|
|
- `Ping`
|
|
- `PRN` - Prints revision of the printer
|
|
- `PRN` - Prints revision of the printer
|
|
- `FAN` - Prints fan details
|
|
- `FAN` - Prints fan details
|
|
- `fn` - Prints farm no.
|
|
- `fn` - Prints farm no.
|
|
- `thx`
|
|
- `thx`
|
|
- `uvlo`
|
|
- `uvlo`
|
|
- - `fsensor_recover` - Filament sensor recover - restore print and continue
|
|
|
|
- `MMURES` - Reset MMU
|
|
- `MMURES` - Reset MMU
|
|
- `RESET` - (Careful!)
|
|
- `RESET` - (Careful!)
|
|
- `fv` - ?
|
|
- `fv` - ?
|
|
@@ -3646,7 +3758,6 @@ void process_commands()
|
|
- `nozzle set <diameter>` - set nozzle diameter (farm mode only), e.g. `PRUSA nozzle set 0.4`
|
|
- `nozzle set <diameter>` - set nozzle diameter (farm mode only), e.g. `PRUSA nozzle set 0.4`
|
|
- `nozzle D<diameter>` - check the nozzle diameter (farm mode only), works like M862.1 P, e.g. `PRUSA nozzle D0.4`
|
|
- `nozzle D<diameter>` - check the nozzle diameter (farm mode only), works like M862.1 P, e.g. `PRUSA nozzle D0.4`
|
|
- `nozzle` - prints nozzle diameter (farm mode only), works like M862.1 P, e.g. `PRUSA nozzle`
|
|
- `nozzle` - prints nozzle diameter (farm mode only), works like M862.1 P, e.g. `PRUSA nozzle`
|
|
- *
|
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
@@ -3661,7 +3772,7 @@ void process_commands()
|
|
|
|
|
|
} else if( code_seen("FANPINTST") ){
|
|
} else if( code_seen("FANPINTST") ){
|
|
gcode_PRUSA_BadRAMBoFanTest();
|
|
gcode_PRUSA_BadRAMBoFanTest();
|
|
- }else if (code_seen("FAN")) {
|
|
+ }else if (code_seen("FAN")) {
|
|
printf_P(_N("E0:%d RPM\nPRN0:%d RPM\n"), 60*fan_speed[0], 60*fan_speed[1]);
|
|
printf_P(_N("E0:%d RPM\nPRN0:%d RPM\n"), 60*fan_speed[0], 60*fan_speed[1]);
|
|
}else if (code_seen("fn")) {
|
|
}else if (code_seen("fn")) {
|
|
if (farm_mode) {
|
|
if (farm_mode) {
|
|
@@ -3681,12 +3792,6 @@ void process_commands()
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
|
|
enquecommand_P(PSTR("M24"));
|
|
enquecommand_P(PSTR("M24"));
|
|
}
|
|
}
|
|
-#ifdef FILAMENT_SENSOR
|
|
|
|
- else if (code_seen("fsensor_recover"))
|
|
|
|
- {
|
|
|
|
- fsensor_restore_print_and_continue();
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
else if (code_seen("MMURES"))
|
|
else if (code_seen("MMURES"))
|
|
{
|
|
{
|
|
mmu_reset();
|
|
mmu_reset();
|
|
@@ -3836,8 +3941,24 @@ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF);
|
|
switch (gcode_in_progress)
|
|
switch (gcode_in_progress)
|
|
{
|
|
{
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ---------------------------------------------------------------------------------
|
|
|
|
+ # G Codes
|
|
|
|
+ ### G0, G1 - Coordinated movement X Y Z E <a href="https://reprap.org/wiki/G-code#G0_.26_G1:_Move">G0 & G1: Move</a>
|
|
|
|
+ In Prusa Firmware G0 and G1 are the same.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ G0 [ X | Y | Z | E | F | S ]
|
|
|
|
+ G1 [ X | Y | Z | E | F | S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - The position to move to on the X axis
|
|
|
|
+ - `Y` - The position to move to on the Y axis
|
|
|
|
+ - `Z` - The position to move to on the Z axis
|
|
|
|
+ - `E` - The amount to extrude between the starting point and ending point
|
|
|
|
+ - `F` - The feedrate per minute of the move between the starting point and ending point (if supplied)
|
|
|
|
+
|
|
|
|
+ */
|
|
case 0:
|
|
case 0:
|
|
case 1:
|
|
case 1:
|
|
if(Stopped == false) {
|
|
if(Stopped == false) {
|
|
@@ -4011,8 +4132,19 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ get_coordinates();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if ((saved_target[0] != SAVED_TARGET_UNSET) &&
|
|
|
|
+ ((CMDBUFFER_CURRENT_TYPE == CMDBUFFER_CURRENT_TYPE_SDCARD) ||
|
|
|
|
+ (CMDBUFFER_CURRENT_TYPE == CMDBUFFER_CURRENT_TYPE_USB_WITH_LINENR)))
|
|
|
|
+ {
|
|
|
|
+ memcpy(destination, saved_target, sizeof(destination));
|
|
|
|
+ saved_target[0] = SAVED_TARGET_UNSET;
|
|
|
|
+ }
|
|
|
|
|
|
- get_coordinates();
|
|
|
|
if (total_filament_used > ((current_position[E_AXIS] - destination[E_AXIS]) * 100)) {
|
|
if (total_filament_used > ((current_position[E_AXIS] - destination[E_AXIS]) * 100)) {
|
|
total_filament_used = total_filament_used + ((destination[E_AXIS] - current_position[E_AXIS]) * 100);
|
|
total_filament_used = total_filament_used + ((destination[E_AXIS] - current_position[E_AXIS]) * 100);
|
|
}
|
|
}
|
|
@@ -4036,8 +4168,25 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G2, G3 - Controlled Arc Move <a href="https://reprap.org/wiki/G-code#G2_.26_G3:_Controlled_Arc_Move">G2 & G3: Controlled Arc Move</a>
|
|
|
|
+
|
|
|
|
+ These commands don't propperly work with MBL enabled. The compensation only happens at the end of the move, so avoid long arcs.
|
|
|
|
+
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ G2 [ X | Y | I | E | F ] (Clockwise Arc)
|
|
|
|
+ G3 [ X | Y | I | E | F ] (Counter-Clockwise Arc)
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - The position to move to on the X axis
|
|
|
|
+ - `Y` - The position to move to on the Y axis
|
|
|
|
+ - `I` - The point in X space from the current X position to maintain a constant distance from
|
|
|
|
+ - `J` - The point in Y space from the current Y position to maintain a constant distance from
|
|
|
|
+ - `E` - The amount to extrude between the starting point and ending point
|
|
|
|
+ - `F` - The feedrate per minute of the move between the starting point and ending point (if supplied)
|
|
|
|
+
|
|
|
|
+ */
|
|
case 2:
|
|
case 2:
|
|
if(Stopped == false) {
|
|
if(Stopped == false) {
|
|
get_arc_coordinates();
|
|
get_arc_coordinates();
|
|
@@ -4045,8 +4194,6 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
case 3:
|
|
case 3:
|
|
if(Stopped == false) {
|
|
if(Stopped == false) {
|
|
@@ -4056,8 +4203,19 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G4 - Dwell <a href="https://reprap.org/wiki/G-code#G4:_Dwell">G4: Dwell</a>
|
|
|
|
+ Pause the machine for a period of time.
|
|
|
|
+
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ G4 [ P | S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - Time to wait, in milliseconds
|
|
|
|
+ - `S` - Time to wait, in seconds
|
|
|
|
+
|
|
|
|
+ */
|
|
case 4:
|
|
case 4:
|
|
codenum = 0;
|
|
codenum = 0;
|
|
if(code_seen('P')) codenum = code_value();
|
|
if(code_seen('P')) codenum = code_value();
|
|
@@ -4075,8 +4233,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
#ifdef FWRETRACT
|
|
#ifdef FWRETRACT
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G10 - Retract <a href="https://reprap.org/wiki/G-code#G10:_Retract">G10: Retract</a>
|
|
|
|
+ Retracts filament according to settings of `M207`
|
|
|
|
+ */
|
|
case 10:
|
|
case 10:
|
|
#if EXTRUDERS > 1
|
|
#if EXTRUDERS > 1
|
|
retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1);
|
|
retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1);
|
|
@@ -4087,8 +4247,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G11 - Retract recover <a href="https://reprap.org/wiki/G-code#G11:_Unretract">G11: Unretract</a>
|
|
|
|
+ Unretracts/recovers filament according to settings of `M208`
|
|
|
|
+ */
|
|
case 11:
|
|
case 11:
|
|
#if EXTRUDERS > 1
|
|
#if EXTRUDERS > 1
|
|
retract(false,retracted_swap[active_extruder]);
|
|
retract(false,retracted_swap[active_extruder]);
|
|
@@ -4099,8 +4261,20 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G28 - Home all Axes one at a time <a href="https://reprap.org/wiki/G-code#G28:_Move_to_Origin_.28Home.29">G28: Move to Origin (Home)</a>
|
|
|
|
+ Using `G28` without any parameters will perfom homing of all axes AND mesh bed leveling, while `G28 W` will just home all axes (no mesh bed leveling).
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ G28 [ X | Y | Z | W | C ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - Flag to go back to the X axis origin
|
|
|
|
+ - `Y` - Flag to go back to the Y axis origin
|
|
|
|
+ - `Z` - Flag to go back to the Z axis origin
|
|
|
|
+ - `W` - Suppress mesh bed leveling if `X`, `Y` or `Z` are not provided
|
|
|
|
+ - `C` - Calibrate X and Y origin (home) - Only on MK3/s
|
|
|
|
+ */
|
|
case 28:
|
|
case 28:
|
|
{
|
|
{
|
|
long home_x_value = 0;
|
|
long home_x_value = 0;
|
|
@@ -4132,8 +4306,12 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G29 - Detailed Z-Probe <a href="https://reprap.org/wiki/G-code#G29:_Detailed_Z-Probe">G29: Detailed Z-Probe</a>
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+
|
|
|
|
+ See `G81`
|
|
|
|
+ */
|
|
case 29:
|
|
case 29:
|
|
{
|
|
{
|
|
#if Z_MIN_PIN == -1
|
|
#if Z_MIN_PIN == -1
|
|
@@ -4278,8 +4456,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
break;
|
|
break;
|
|
#ifndef Z_PROBE_SLED
|
|
#ifndef Z_PROBE_SLED
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G30 - Single Z Probe <a href="https://reprap.org/wiki/G-code#G30:_Single_Z-Probe">G30: Single Z-Probe</a>
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+ */
|
|
case 30:
|
|
case 30:
|
|
{
|
|
{
|
|
st_synchronize();
|
|
st_synchronize();
|
|
@@ -4303,15 +4483,19 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
break;
|
|
break;
|
|
#else
|
|
#else
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G31 - Dock the sled <a href="https://reprap.org/wiki/G-code#G31:_Dock_Z_Probe_sled">G31: Dock Z Probe sled</a>
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+ */
|
|
case 31:
|
|
case 31:
|
|
dock_sled(true);
|
|
dock_sled(true);
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G32 - Undock the sled <a href="https://reprap.org/wiki/G-code#G32:_Undock_Z_Probe_sled">G32: Undock Z Probe sled</a>
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+ */
|
|
case 32:
|
|
case 32:
|
|
dock_sled(false);
|
|
dock_sled(false);
|
|
break;
|
|
break;
|
|
@@ -4320,8 +4504,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
#ifdef MESH_BED_LEVELING
|
|
#ifdef MESH_BED_LEVELING
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G30 - Single Z Probe <a href="https://reprap.org/wiki/G-code#G30:_Single_Z-Probe">G30: Single Z-Probe</a>
|
|
|
|
+ Sensor must be over the bed.
|
|
|
|
+ The maximum travel distance before an error is triggered is 10mm.
|
|
|
|
+ */
|
|
case 30:
|
|
case 30:
|
|
{
|
|
{
|
|
st_synchronize();
|
|
st_synchronize();
|
|
@@ -4338,8 +4525,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G75 - Print temperature interpolation <a href="https://reprap.org/wiki/G-code#G75:_Print_temperature_interpolation">G75: Print temperature interpolation</a>
|
|
|
|
+ Show/print PINDA temperature interpolating.
|
|
|
|
+ */
|
|
case 75:
|
|
case 75:
|
|
{
|
|
{
|
|
for (int i = 40; i <= 110; i++)
|
|
for (int i = 40; i <= 110; i++)
|
|
@@ -4347,9 +4536,26 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G76 - PINDA probe temperature calibration <a href="https://reprap.org/wiki/G-code#G76:_PINDA_probe_temperature_calibration">G76: PINDA probe temperature calibration</a>
|
|
- case 76:
|
|
+ This G-code is used to calibrate the temperature drift of the PINDA (inductive Sensor).
|
|
|
|
+
|
|
|
|
+ The PINDAv2 sensor has a built-in thermistor which has the advantage that the calibration can be done once for all materials.
|
|
|
|
+
|
|
|
|
+ The Original i3 Prusa MK2/s uses PINDAv1 and this calibration improves the temperature drift, but not as good as the PINDAv2.
|
|
|
|
+
|
|
|
|
+ #### Example
|
|
|
|
+
|
|
|
|
+ ```
|
|
|
|
+ G76
|
|
|
|
+
|
|
|
|
+ echo PINDA probe calibration start
|
|
|
|
+ echo start temperature: 35.0°
|
|
|
|
+ echo ...
|
|
|
|
+ echo PINDA temperature -- Z shift (mm): 0.---
|
|
|
|
+ ```
|
|
|
|
+ */
|
|
|
|
+ case 76:
|
|
{
|
|
{
|
|
#ifdef PINDA_THERMISTOR
|
|
#ifdef PINDA_THERMISTOR
|
|
if (true)
|
|
if (true)
|
|
@@ -4606,11 +4812,28 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G80 - Mesh-based Z probe <a href="https://reprap.org/wiki/G-code#G80:_Mesh-based_Z_probe">G80: Mesh-based Z probe</a>
|
|
|
|
+ Default 3x3 grid can be changed on MK2.5/s and MK3/s to 7x7 grid.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ G80 [ N | R | V | L | R | F | B ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `N` - Number of mesh points on x axis. Default is 3. Valid values are 3 and 7.
|
|
|
|
+ - `R` - Probe retries. Default 3 max. 10
|
|
|
|
+ - `V` - Verbosity level 1=low, 10=mid, 20=high. It only can be used if the firmware has been compiled with SUPPORT_VERBOSITY active.
|
|
|
|
+
|
|
|
|
+ Using the following parameters enables additional "manual" bed leveling correction. Valid values are -100 microns to 100 microns.
|
|
|
|
+ #### Additional Parameters
|
|
|
|
+ - `L` - Left Bed Level correct value in um.
|
|
|
|
+ - `R` - Right Bed Level correct value in um.
|
|
|
|
+ - `F` - Front Bed Level correct value in um.
|
|
|
|
+ - `B` - Back Bed Level correct value in um.
|
|
|
|
+ */
|
|
|
|
|
|
|
|
|
|
- * Probes a grid and produces a mesh to compensate for variable bed height
|
|
+ * Probes a grid and produces a mesh to compensate for variable bed height
|
|
* The S0 report the points as below
|
|
* The S0 report the points as below
|
|
* +----> X-axis
|
|
* +----> X-axis
|
|
* |
|
|
* |
|
|
@@ -4626,6 +4849,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
case_G80:
|
|
case_G80:
|
|
{
|
|
{
|
|
mesh_bed_leveling_flag = true;
|
|
mesh_bed_leveling_flag = true;
|
|
|
|
+#ifndef LA_NOCOMPAT
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ la10c_reset();
|
|
|
|
+#endif
|
|
#ifndef PINDA_THERMISTOR
|
|
#ifndef PINDA_THERMISTOR
|
|
static bool run = false;
|
|
static bool run = false;
|
|
#endif
|
|
#endif
|
|
@@ -4643,13 +4871,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- if (lcd_commands_type != LcdCommands::StopPrint) {
|
|
+ repeatcommand_front();
|
|
- repeatcommand_front();
|
|
+ enquecommand_front_P((PSTR("G28 W0")));
|
|
- enquecommand_front_P((PSTR("G28 W0")));
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- mesh_bed_leveling_flag = false;
|
|
|
|
- }
|
|
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4679,23 +4902,14 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
#ifndef PINDA_THERMISTOR
|
|
#ifndef PINDA_THERMISTOR
|
|
if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50)
|
|
if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50)
|
|
{
|
|
{
|
|
- if (lcd_commands_type != LcdCommands::StopPrint) {
|
|
+ temp_compensation_start();
|
|
- temp_compensation_start();
|
|
+ run = true;
|
|
- run = true;
|
|
+ repeatcommand_front();
|
|
- repeatcommand_front();
|
|
+ enquecommand_front_P((PSTR("G28 W0")));
|
|
- enquecommand_front_P((PSTR("G28 W0")));
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- mesh_bed_leveling_flag = false;
|
|
|
|
- }
|
|
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
run = false;
|
|
run = false;
|
|
#endif
|
|
#endif
|
|
- if (lcd_commands_type == LcdCommands::StopPrint) {
|
|
|
|
- mesh_bed_leveling_flag = false;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
|
|
CustomMsg custom_message_type_old = custom_message_type;
|
|
CustomMsg custom_message_type_old = custom_message_type;
|
|
unsigned int custom_message_state_old = custom_message_state;
|
|
unsigned int custom_message_state_old = custom_message_state;
|
|
@@ -5035,12 +5249,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G81 - Mesh bed leveling status <a href="https://reprap.org/wiki/G-code#G81:_Mesh_bed_leveling_status">G81: Mesh bed leveling status</a>
|
|
-
|
|
+ Prints mesh bed leveling status and bed profile if activated.
|
|
-
|
|
+ */
|
|
- * Prints mesh bed leveling status and bed profile if activated
|
|
|
|
- */
|
|
|
|
case 81:
|
|
case 81:
|
|
if (mbl.active) {
|
|
if (mbl.active) {
|
|
SERIAL_PROTOCOLPGM("Num X,Y: ");
|
|
SERIAL_PROTOCOLPGM("Num X,Y: ");
|
|
@@ -5063,12 +5275,12 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
break;
|
|
break;
|
|
|
|
|
|
#if 0
|
|
#if 0
|
|
-
|
|
+
|
|
- * G82: Single Z probe at current location
|
|
+ ### G82: Single Z probe at current location - Not active <a href="https://reprap.org/wiki/G-code#G82:_Single_Z_probe_at_current_location">G82: Single Z probe at current location</a>
|
|
- *
|
|
+
|
|
- * WARNING! USE WITH CAUTION! If you'll try to probe where is no leveling pad, nasty things can happen!
|
|
+ WARNING! USE WITH CAUTION! If you'll try to probe where is no leveling pad, nasty things can happen!
|
|
- *
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
- */
|
|
+ */
|
|
case 82:
|
|
case 82:
|
|
SERIAL_PROTOCOLLNPGM("Finding bed ");
|
|
SERIAL_PROTOCOLLNPGM("Finding bed ");
|
|
int l_feedmultiply = setup_for_endstop_move();
|
|
int l_feedmultiply = setup_for_endstop_move();
|
|
@@ -5079,9 +5291,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
SERIAL_PROTOCOLPGM("\n");
|
|
SERIAL_PROTOCOLPGM("\n");
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
- * G83: Prusa3D specific: Babystep in Z and store to EEPROM
|
|
+ ### G83: Babystep in Z and store to EEPROM - Not active <a href="https://reprap.org/wiki/G-code#G83:_Babystep_in_Z_and_store_to_EEPROM">G83: Babystep in Z and store to EEPROM</a>
|
|
- */
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+ */
|
|
case 83:
|
|
case 83:
|
|
{
|
|
{
|
|
int babystepz = code_seen('S') ? code_value() : 0;
|
|
int babystepz = code_seen('S') ? code_value() : 0;
|
|
@@ -5104,50 +5317,50 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
-
|
|
+
|
|
- * G84: Prusa3D specific: UNDO Babystep Z (move Z axis back)
|
|
+ ### G84: UNDO Babystep Z (move Z axis back) - Not active <a href="https://reprap.org/wiki/G-code#G84:_UNDO_Babystep_Z_.28move_Z_axis_back.29">G84: UNDO Babystep Z (move Z axis back)</a>
|
|
- */
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+ */
|
|
case 84:
|
|
case 84:
|
|
babystepsTodoZsubtract(babystepLoadZ);
|
|
babystepsTodoZsubtract(babystepLoadZ);
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
- * G85: Prusa3D specific: Pick best babystep
|
|
+ ### G85: Pick best babystep - Not active <a href="https://reprap.org/wiki/G-code#G85:_Pick_best_babystep">G85: Pick best babystep</a>
|
|
- */
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+ */
|
|
case 85:
|
|
case 85:
|
|
lcd_pick_babystep();
|
|
lcd_pick_babystep();
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
- * ### G86 - Disable babystep correction after home
|
|
+ ### G86 - Disable babystep correction after home <a href="https://reprap.org/wiki/G-code#G86:_Disable_babystep_correction_after_home">G86: Disable babystep correction after home</a>
|
|
- *
|
|
+
|
|
- * This G-code will be performed at the start of a calibration script.
|
|
+ This G-code will be performed at the start of a calibration script.
|
|
- * (Prusa3D specific)
|
|
+ (Prusa3D specific)
|
|
- */
|
|
+ */
|
|
case 86:
|
|
case 86:
|
|
calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
|
|
calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
- * ### G87 - Enable babystep correction after home
|
|
+ ### G87 - Enable babystep correction after home <a href="https://reprap.org/wiki/G-code#G87:_Enable_babystep_correction_after_home">G87: Enable babystep correction after home</a>
|
|
- *
|
|
+
|
|
- *
|
|
+ This G-code will be performed at the end of a calibration script.
|
|
- * This G-code will be performed at the end of a calibration script.
|
|
+ (Prusa3D specific)
|
|
- * (Prusa3D specific)
|
|
+ */
|
|
- */
|
|
|
|
case 87:
|
|
case 87:
|
|
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G88 - Reserved <a href="https://reprap.org/wiki/G-code#G88:_Reserved">G88: Reserved</a>
|
|
- * ### G88 - Reserved
|
|
+
|
|
- *
|
|
+ Currently has no effect.
|
|
- * Currently has no effect.
|
|
+ */
|
|
- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -5157,40 +5370,56 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- case 90:
|
|
|
|
- relative_mode = false;
|
|
|
|
- break;
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G90 - Switch off relative mode <a href="https://reprap.org/wiki/G-code#G90:_Set_to_Absolute_Positioning">G90: Set to Absolute Positioning</a>
|
|
- case 91:
|
|
+ All coordinates from now on are absolute relative to the origin of the machine. E axis is also switched to absolute mode.
|
|
- relative_mode = true;
|
|
+ */
|
|
- break;
|
|
+ case 90: {
|
|
|
|
+ for(uint8_t i = 0; i != NUM_AXIS; ++i)
|
|
|
|
+ axis_relative_modes[i] = false;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G91 - Switch on relative mode <a href="https://reprap.org/wiki/G-code#G91:_Set_to_Relative_Positioning">G91: Set to Relative Positioning</a>
|
|
- case 92:
|
|
+ All coordinates from now on are relative to the last position. E axis is also switched to relative mode.
|
|
- if(!code_seen(axis_codes[E_AXIS]))
|
|
+ */
|
|
- st_synchronize();
|
|
+ case 91: {
|
|
- for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
+ for(uint8_t i = 0; i != NUM_AXIS; ++i)
|
|
- if(code_seen(axis_codes[i])) {
|
|
+ axis_relative_modes[i] = true;
|
|
- if(i == E_AXIS) {
|
|
+ }
|
|
- current_position[i] = code_value();
|
|
+ break;
|
|
- plan_set_e_position(current_position[E_AXIS]);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- current_position[i] = code_value()+cs.add_homing[i];
|
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ ### G92 - Set position <a href="https://reprap.org/wiki/G-code#G92:_Set_Position">G92: Set Position</a>
|
|
|
|
+
|
|
|
|
+ It is used for setting the current position of each axis. The parameters are always absolute to the origin.
|
|
|
|
+ If a parameter is omitted, that axis will not be affected.
|
|
|
|
+ If `X`, `Y`, or `Z` axis are specified, the move afterwards might stutter because of Mesh Bed Leveling. `E` axis is not affected if the target position is 0 (`G92 E0`).
|
|
|
|
+ A G92 without coordinates will reset all axes to zero on some firmware. This is not the case for Prusa-Firmware!
|
|
|
|
+
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ G92 [ X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - new X axis position
|
|
|
|
+ - `Y` - new Y axis position
|
|
|
|
+ - `Z` - new Z axis position
|
|
|
|
+ - `E` - new extruder position
|
|
|
|
+
|
|
|
|
+ */
|
|
|
|
+ case 92: {
|
|
|
|
+ gcode_G92();
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### G98 - Activate farm mode <a href="https://reprap.org/wiki/G-code#G98:_Activate_farm_mode">G98: Activate farm mode</a>
|
|
|
|
+ Enable Prusa-specific Farm functions and g-code.
|
|
|
|
+ See Internal Prusa commands.
|
|
|
|
+ */
|
|
case 98:
|
|
case 98:
|
|
farm_mode = 1;
|
|
farm_mode = 1;
|
|
PingTime = _millis();
|
|
PingTime = _millis();
|
|
@@ -5201,8 +5430,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
fCheckModeInit();
|
|
fCheckModeInit();
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ Disables Prusa-specific Farm functions and g-code.
|
|
|
|
+ */
|
|
case 99:
|
|
case 99:
|
|
farm_mode = 0;
|
|
farm_mode = 0;
|
|
lcd_printer_connected();
|
|
lcd_printer_connected();
|
|
@@ -5216,9 +5446,15 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
gcode_in_progress = 0;
|
|
gcode_in_progress = 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ ### End of G-Codes
|
|
|
|
+ */
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ---------------------------------------------------------------------------------
|
|
|
|
+ # M Commands
|
|
|
|
+
|
|
|
|
+ */
|
|
|
|
|
|
else if(code_seen('M'))
|
|
else if(code_seen('M'))
|
|
{
|
|
{
|
|
@@ -5238,8 +5474,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
switch(mcode_in_progress)
|
|
switch(mcode_in_progress)
|
|
{
|
|
{
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M0, M1 - Stop the printer <a href="https://reprap.org/wiki/G-code#M0:_Stop_or_Unconditional_stop">M0: Stop or Unconditional stop</a>
|
|
|
|
+ */
|
|
case 0:
|
|
case 0:
|
|
case 1:
|
|
case 1:
|
|
{
|
|
{
|
|
@@ -5288,8 +5525,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M17 - Enable all axes <a href="https://reprap.org/wiki/G-code#M17:_Enable.2FPower_all_stepper_motors">M17: Enable/Power all stepper motors</a>
|
|
|
|
+ */
|
|
case 17:
|
|
case 17:
|
|
LCD_MESSAGERPGM(_i("No move."));
|
|
LCD_MESSAGERPGM(_i("No move."));
|
|
enable_x();
|
|
enable_x();
|
|
@@ -5302,28 +5540,36 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
#ifdef SDSUPPORT
|
|
#ifdef SDSUPPORT
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M20 - SD Card file list <a href="https://reprap.org/wiki/G-code#M20:_List_SD_card">M20: List SD card</a>
|
|
|
|
+ */
|
|
case 20:
|
|
case 20:
|
|
SERIAL_PROTOCOLLNRPGM(_N("Begin file list"));
|
|
SERIAL_PROTOCOLLNRPGM(_N("Begin file list"));
|
|
card.ls();
|
|
card.ls();
|
|
SERIAL_PROTOCOLLNRPGM(_N("End file list"));
|
|
SERIAL_PROTOCOLLNRPGM(_N("End file list"));
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M21 - Init SD card <a href="https://reprap.org/wiki/G-code#M21:_Initialize_SD_card">M21: Initialize SD card</a>
|
|
|
|
+ */
|
|
case 21:
|
|
case 21:
|
|
card.initsd();
|
|
card.initsd();
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M22 - Release SD card <a href="https://reprap.org/wiki/G-code#M22:_Release_SD_card">M22: Release SD card</a>
|
|
|
|
+ */
|
|
case 22:
|
|
case 22:
|
|
card.release();
|
|
card.release();
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M23 - Select file <a href="https://reprap.org/wiki/G-code#M23:_Select_SD_file">M23: Select SD file</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M23 [filename]
|
|
|
|
+
|
|
|
|
+ */
|
|
case 23:
|
|
case 23:
|
|
starpos = (strchr(strchr_pointer + 4,'*'));
|
|
starpos = (strchr(strchr_pointer + 4,'*'));
|
|
if(starpos!=NULL)
|
|
if(starpos!=NULL)
|
|
@@ -5331,26 +5577,35 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
card.openFile(strchr_pointer + 4,true);
|
|
card.openFile(strchr_pointer + 4,true);
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M24 - Start SD print <a href="https://reprap.org/wiki/G-code#M24:_Start.2Fresume_SD_print">M24: Start/resume SD print</a>
|
|
|
|
+ */
|
|
case 24:
|
|
case 24:
|
|
- if (!card.paused)
|
|
+ if (isPrintPaused)
|
|
- failstats_reset_print();
|
|
+ lcd_resume_print();
|
|
- card.startFileprint();
|
|
+ else
|
|
- starttime=_millis();
|
|
+ {
|
|
|
|
+ failstats_reset_print();
|
|
|
|
+#ifndef LA_NOCOMPAT
|
|
|
|
+ la10c_reset();
|
|
|
|
+#endif
|
|
|
|
+ card.startFileprint();
|
|
|
|
+ starttime=_millis();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M26 - Set SD index <a href="https://reprap.org/wiki/G-code#M26:_Set_SD_position">M26: Set SD position</a>
|
|
- case 25:
|
|
+ Set position in SD card file to index in bytes.
|
|
- card.pauseSDPrint();
|
|
+ This command is expected to be called after M23 and before M24.
|
|
- break;
|
|
+ Otherwise effect of this command is undefined.
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
-
|
|
+ M26 [ S ]
|
|
-
|
|
+
|
|
-
|
|
+ #### Parameters
|
|
-
|
|
+ - `S` - Index in bytes
|
|
|
|
+ */
|
|
case 26:
|
|
case 26:
|
|
if(card.cardOK && code_seen('S')) {
|
|
if(card.cardOK && code_seen('S')) {
|
|
long index = code_value_long();
|
|
long index = code_value_long();
|
|
@@ -5361,14 +5616,16 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M27 - Get SD status <a href="https://reprap.org/wiki/G-code#M27:_Report_SD_print_status">M27: Report SD print status</a>
|
|
|
|
+ */
|
|
case 27:
|
|
case 27:
|
|
card.getStatus();
|
|
card.getStatus();
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M28 - Start SD write <a href="https://reprap.org/wiki/G-code#M28:_Begin_write_to_SD_card">M28: Begin write to SD card</a>
|
|
|
|
+ */
|
|
case 28:
|
|
case 28:
|
|
starpos = (strchr(strchr_pointer + 4,'*'));
|
|
starpos = (strchr(strchr_pointer + 4,'*'));
|
|
if(starpos != NULL){
|
|
if(starpos != NULL){
|
|
@@ -5379,16 +5636,21 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
card.openFile(strchr_pointer+4,false);
|
|
card.openFile(strchr_pointer+4,false);
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ Stops writing to the SD file signaling the end of the uploaded file. It is processed very early and it's not written to the card.
|
|
-
|
|
+ */
|
|
case 29:
|
|
case 29:
|
|
|
|
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M30 - Delete file <a href="https://reprap.org/wiki/G-code#M30:_Delete_a_file_on_the_SD_card">M30: Delete a file on the SD card</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M30 [filename]
|
|
|
|
+
|
|
|
|
+ */
|
|
case 30:
|
|
case 30:
|
|
if (card.cardOK){
|
|
if (card.cardOK){
|
|
card.closefile();
|
|
card.closefile();
|
|
@@ -5402,8 +5664,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M32 - Select file and start SD print <a href="https://reprap.org/wiki/G-code#M32:_Select_file_and_start_SD_print">M32: Select file and start SD print</a>
|
|
|
|
+ @todo What are the parameters P and S for in M32?
|
|
|
|
+ */
|
|
case 32:
|
|
case 32:
|
|
{
|
|
{
|
|
if(card.sdprinting) {
|
|
if(card.sdprinting) {
|
|
@@ -5434,14 +5698,22 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
if(code_seen('S'))
|
|
if(code_seen('S'))
|
|
if(strchr_pointer<namestartpos)
|
|
if(strchr_pointer<namestartpos)
|
|
card.setIndex(code_value_long());
|
|
card.setIndex(code_value_long());
|
|
|
|
+#ifndef LA_NOCOMPAT
|
|
|
|
+ la10c_reset();
|
|
|
|
+#endif
|
|
card.startFileprint();
|
|
card.startFileprint();
|
|
if(!call_procedure)
|
|
if(!call_procedure)
|
|
starttime=_millis();
|
|
starttime=_millis();
|
|
}
|
|
}
|
|
} break;
|
|
} break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M928 - Start SD logging <a href="https://reprap.org/wiki/G-code#M928:_Start_SD_logging">M928: Start SD logging</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M928 [filename]
|
|
|
|
+
|
|
|
|
+ */
|
|
case 928:
|
|
case 928:
|
|
starpos = (strchr(strchr_pointer + 5,'*'));
|
|
starpos = (strchr(strchr_pointer + 5,'*'));
|
|
if(starpos != NULL){
|
|
if(starpos != NULL){
|
|
@@ -5454,8 +5726,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M31 - Report current print time <a href="https://reprap.org/wiki/G-code#M31:_Output_time_since_last_M109_or_SD_card_start_to_serial">M31: Output time since last M109 or SD card start to serial</a>
|
|
|
|
+ */
|
|
case 31:
|
|
case 31:
|
|
{
|
|
{
|
|
stoptime=_millis();
|
|
stoptime=_millis();
|
|
@@ -5472,8 +5745,17 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M42 - Set pin state <a href="https://reprap.org/wiki/G-code#M42:_Switch_I.2FO_pin">M42: Switch I/O pin</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M42 [ P | S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - Pin number.
|
|
|
|
+ - `S` - Pin value. If the pin is analog, values are from 0 to 255. If the pin is digital, values are from 0 to 1.
|
|
|
|
+
|
|
|
|
+ */
|
|
case 42:
|
|
case 42:
|
|
if (code_seen('S'))
|
|
if (code_seen('S'))
|
|
{
|
|
{
|
|
@@ -5503,9 +5785,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M44 - Reset the bed skew and offset calibration <a href="https://reprap.org/wiki/G-code#M44:_Reset_the_bed_skew_and_offset_calibration">M44: Reset the bed skew and offset calibration</a>
|
|
- case 44:
|
|
+ */
|
|
|
|
+ case 44:
|
|
|
|
|
|
|
|
|
|
calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
|
calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
|
@@ -5519,8 +5802,15 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
world2machine_revert_to_uncorrected();
|
|
world2machine_revert_to_uncorrected();
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M45 - Bed skew and offset with manual Z up <a href="https://reprap.org/wiki/G-code#M45:_Bed_skew_and_offset_with_manual_Z_up">M45: Bed skew and offset with manual Z up</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M45 [ V ]
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `V` - Verbosity level 1, 10 and 20 (low, mid, high). Only when SUPPORT_VERBOSITY is defined. Optional.
|
|
|
|
+ - `Z` - If it is provided, only Z calibration will run. Otherwise full calibration is executed.
|
|
|
|
+ */
|
|
case 45:
|
|
case 45:
|
|
{
|
|
{
|
|
int8_t verbosity_level = 0;
|
|
int8_t verbosity_level = 0;
|
|
@@ -5537,8 +5827,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ ### M46 - Show the assigned IP address <a href="https://reprap.org/wiki/G-code#M46:_Show_the_assigned_IP_address">M46: Show the assigned IP address.</a>
|
|
|
|
+ */
|
|
|
|
|
|
- case 46:
|
|
+ case 46:
|
|
{
|
|
{
|
|
|
|
|
|
uint8_t ip[4];
|
|
uint8_t ip[4];
|
|
@@ -5560,8 +5853,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M47 - Show end stops dialog on the display <a href="https://reprap.org/wiki/G-code#M47:_Show_end_stops_dialog_on_the_display">M47: Show end stops dialog on the display</a>
|
|
|
|
+ */
|
|
case 47:
|
|
case 47:
|
|
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
@@ -5609,22 +5903,25 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
#ifdef Z_PROBE_REPEATABILITY_TEST
|
|
#ifdef Z_PROBE_REPEATABILITY_TEST
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M48 - Z-Probe repeatability measurement function <a href="https://reprap.org/wiki/G-code#M48:_Measure_Z-Probe_repeatability">M48: Measure Z-Probe repeatability</a>
|
|
-
|
|
+
|
|
-
|
|
+ This function assumes the bed has been homed. Specifically, that a G28 command as been issued prior to invoking the M48 Z-Probe repeatability measurement function. Any information generated by a prior G29 Bed leveling command will be lost and needs to be regenerated.
|
|
-
|
|
+
|
|
-
|
|
+ The number of samples will default to 10 if not specified. You can use upper or lower case letters for any of the options EXCEPT n. n must be in lower case because Marlin uses a capital N for its communication protocol and will get horribly confused if you send it a capital N.
|
|
-
|
|
+ @todo Why would you check for both uppercase and lowercase? Seems wasteful.
|
|
-
|
|
+
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
-
|
|
+ M48 [ n | X | Y | V | L ]
|
|
-
|
|
+
|
|
-
|
|
+ #### Parameters
|
|
-
|
|
+ - `n` - Number of samples. Valid values 4-50
|
|
-
|
|
+ - `X` - X position for samples
|
|
-
|
|
+ - `Y` - Y position for samples
|
|
|
|
+ - `V` - Verbose level. Valid values 1-4
|
|
|
|
+ - `L` - Legs of movementprior to doing probe. Valid values 1-15
|
|
|
|
+ */
|
|
case 48:
|
|
case 48:
|
|
{
|
|
{
|
|
#if Z_MIN_PIN == -1
|
|
#if Z_MIN_PIN == -1
|
|
@@ -5863,12 +6160,18 @@ Sigma_Exit:
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M73 - Set/get print progress <a href="https://reprap.org/wiki/G-code#M73:_Set.2FGet_build_percentage">M73: Set/Get build percentage</a>
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
-
|
|
+ M73 [ P | R | Q | S ]
|
|
-
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - Percent in normal mode
|
|
|
|
+ - `R` - Time remaining in normal mode
|
|
|
|
+ - `Q` - Percent in silent mode
|
|
|
|
+ - `S` - Time in silent mode
|
|
|
|
+ */
|
|
case 73:
|
|
case 73:
|
|
if(code_seen('P')) print_percent_done_normal = code_value();
|
|
if(code_seen('P')) print_percent_done_normal = code_value();
|
|
if(code_seen('R')) print_time_remaining_normal = code_value();
|
|
if(code_seen('R')) print_time_remaining_normal = code_value();
|
|
@@ -5882,8 +6185,15 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M104 - Set hotend temperature <a href="https://reprap.org/wiki/G-code#M104:_Set_Extruder_Temperature">M104: Set Extruder Temperature</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M104 [ S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - Target temperature
|
|
|
|
+ */
|
|
case 104:
|
|
case 104:
|
|
{
|
|
{
|
|
uint8_t extruder;
|
|
uint8_t extruder;
|
|
@@ -5897,20 +6207,44 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M112 - Emergency stop <a href="https://reprap.org/wiki/G-code#M112:_Full_.28Emergency.29_Stop">M112: Full (Emergency) Stop</a>
|
|
|
|
+ It is processed much earlier as to bypass the cmdqueue.
|
|
|
|
+ */
|
|
case 112:
|
|
case 112:
|
|
- kill(_n(""), 3);
|
|
+ kill(MSG_M112_KILL, 3);
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M140 - Set bed temperature <a href="https://reprap.org/wiki/G-code#M140:_Set_Bed_Temperature_.28Fast.29">M140: Set Bed Temperature (Fast)</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M140 [ S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - Target temperature
|
|
|
|
+ */
|
|
case 140:
|
|
case 140:
|
|
if (code_seen('S')) setTargetBed(code_value());
|
|
if (code_seen('S')) setTargetBed(code_value());
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M105 - Report temperatures <a href="https://reprap.org/wiki/G-code#M105:_Get_Extruder_Temperature">M105: Get Extruder Temperature</a>
|
|
|
|
+ Prints temperatures:
|
|
|
|
+
|
|
|
|
+ - `T:` - Hotend (actual / target)
|
|
|
|
+ - `B:` - Bed (actual / target)
|
|
|
|
+ - `Tx:` - x Tool (actual / target)
|
|
|
|
+ - `@:` - Hotend power
|
|
|
|
+ - `B@:` - Bed power
|
|
|
|
+ - `P:` - PINDAv2 actual (only MK2.5/s and MK3/s)
|
|
|
|
+ - `A:` - Ambient actual (only MK3/s)
|
|
|
|
+
|
|
|
|
+ _Example:_
|
|
|
|
+
|
|
|
|
+ ok T:20.2 /0.0 B:19.1 /0.0 T0:20.2 /0.0 @:0 B@:0 P:19.8 A:26.4
|
|
|
|
+
|
|
|
|
+ */
|
|
case 105:
|
|
case 105:
|
|
{
|
|
{
|
|
uint8_t extruder;
|
|
uint8_t extruder;
|
|
@@ -6006,16 +6340,22 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M109 - Wait for extruder temperature <a href="https://reprap.org/wiki/G-code#M109:_Set_Extruder_Temperature_and_Wait">M109: Set Extruder Temperature and Wait</a>
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
-
|
|
+ M104 [ B | R | S ]
|
|
-
|
|
+
|
|
-
|
|
+ #### Parameters (not mandatory)
|
|
-
|
|
+
|
|
-
|
|
+ - `S` - Set extruder temperature
|
|
-
|
|
+ - `R` - Set extruder temperature
|
|
|
|
+ - `B` - Set max. extruder temperature, while `S` is min. temperature. Not active in default, only if AUTOTEMP is defined in source code.
|
|
|
|
+
|
|
|
|
+ Parameters S and R are treated identically.
|
|
|
|
+ Command always waits for both cool down and heat up.
|
|
|
|
+ If no parameters are supplied waits for previously set extruder temperature.
|
|
|
|
+ */
|
|
case 109:
|
|
case 109:
|
|
{
|
|
{
|
|
uint8_t extruder;
|
|
uint8_t extruder;
|
|
@@ -6065,12 +6405,19 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M190 - Wait for bed temperature <a href="https://reprap.org/wiki/G-code#M190:_Wait_for_bed_temperature_to_reach_target_temp">M190: Wait for bed temperature to reach target temp</a>
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
-
|
|
+ M190 [ R | S ]
|
|
-
|
|
+
|
|
|
|
+ #### Parameters (not mandatory)
|
|
|
|
+
|
|
|
|
+ - `S` - Set extruder temperature and wait for heating
|
|
|
|
+ - `R` - Set extruder temperature and wait for heating or cooling
|
|
|
|
+
|
|
|
|
+ If no parameter is supplied, waits for heating or cooling to previously set temperature.
|
|
|
|
+ */
|
|
case 190:
|
|
case 190:
|
|
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
{
|
|
{
|
|
@@ -6125,8 +6472,15 @@ Sigma_Exit:
|
|
|
|
|
|
#if defined(FAN_PIN) && FAN_PIN > -1
|
|
#if defined(FAN_PIN) && FAN_PIN > -1
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M106 - Set fan speed <a href="https://reprap.org/wiki/G-code#M106:_Fan_On">M106: Fan On</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M106 [ S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - Specifies the duty cycle of the print fan. Allowed values are 0-255. If it's omitted, a value of 255 is used.
|
|
|
|
+ */
|
|
case 106:
|
|
case 106:
|
|
if (code_seen('S')){
|
|
if (code_seen('S')){
|
|
fanSpeed=constrain(code_value(),0,255);
|
|
fanSpeed=constrain(code_value(),0,255);
|
|
@@ -6136,8 +6490,9 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M107 - Fan off <a href="https://reprap.org/wiki/G-code#M107:_Fan_Off">M107: Fan Off</a>
|
|
|
|
+ */
|
|
case 107:
|
|
case 107:
|
|
fanSpeed = 0;
|
|
fanSpeed = 0;
|
|
break;
|
|
break;
|
|
@@ -6145,8 +6500,10 @@ Sigma_Exit:
|
|
|
|
|
|
#if defined(PS_ON_PIN) && PS_ON_PIN > -1
|
|
#if defined(PS_ON_PIN) && PS_ON_PIN > -1
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M80 - Turn on the Power Supply <a href="https://reprap.org/wiki/G-code#M80:_ATX_Power_On">M80: ATX Power On</a>
|
|
|
|
+ Only works if the firmware is compiled with PS_ON_PIN defined.
|
|
|
|
+ */
|
|
case 80:
|
|
case 80:
|
|
SET_OUTPUT(PS_ON_PIN);
|
|
SET_OUTPUT(PS_ON_PIN);
|
|
WRITE(PS_ON_PIN, PS_ON_AWAKE);
|
|
WRITE(PS_ON_PIN, PS_ON_AWAKE);
|
|
@@ -6163,10 +6520,11 @@ Sigma_Exit:
|
|
LCD_MESSAGERPGM(_T(WELCOME_MSG));
|
|
LCD_MESSAGERPGM(_T(WELCOME_MSG));
|
|
lcd_update(0);
|
|
lcd_update(0);
|
|
break;
|
|
break;
|
|
- #endif
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M81 - Turn off Power Supply <a href="https://reprap.org/wiki/G-code#M81:_ATX_Power_Off">M81: ATX Power Off</a>
|
|
|
|
+ Only works if the firmware is compiled with PS_ON_PIN defined.
|
|
|
|
+ */
|
|
case 81:
|
|
case 81:
|
|
disable_heater();
|
|
disable_heater();
|
|
st_synchronize();
|
|
st_synchronize();
|
|
@@ -6187,25 +6545,42 @@ Sigma_Exit:
|
|
LCD_MESSAGERPGM(CAT4(CUSTOM_MENDEL_NAME,PSTR(" "),MSG_OFF,PSTR(".")));
|
|
LCD_MESSAGERPGM(CAT4(CUSTOM_MENDEL_NAME,PSTR(" "),MSG_OFF,PSTR(".")));
|
|
lcd_update(0);
|
|
lcd_update(0);
|
|
break;
|
|
break;
|
|
|
|
+ #endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M82 - Set E axis to absolute mode <a href="https://reprap.org/wiki/G-code#M82:_Set_extruder_to_absolute_mode">M82: Set extruder to absolute mode</a>
|
|
|
|
+ Makes the extruder interpret extrusion as absolute positions.
|
|
|
|
+ */
|
|
case 82:
|
|
case 82:
|
|
- axis_relative_modes[3] = false;
|
|
+ axis_relative_modes[E_AXIS] = false;
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M83 - Set E axis to relative mode <a href="https://reprap.org/wiki/G-code#M83:_Set_extruder_to_relative_mode">M83: Set extruder to relative mode</a>
|
|
|
|
+ Makes the extruder interpret extrusion values as relative positions.
|
|
|
|
+ */
|
|
case 83:
|
|
case 83:
|
|
- axis_relative_modes[3] = true;
|
|
+ axis_relative_modes[E_AXIS] = true;
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M84 - Disable steppers <a href="https://reprap.org/wiki/G-code#M84:_Stop_idle_hold">M84: Stop idle hold</a>
|
|
-
|
|
+ This command can be used to set the stepper inactivity timeout (`S`) or to disable steppers (`X`,`Y`,`Z`,`E`)
|
|
-
|
|
+ This command can be used without any additional parameters. In that case all steppers are disabled.
|
|
-
|
|
+
|
|
-
|
|
+ The file completeness check uses this parameter to detect an incomplete file. It has to be present at the end of a file with no parameters.
|
|
|
|
+
|
|
|
|
+ M84 [ S | X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ - `S` - Seconds
|
|
|
|
+ - `X` - X axis
|
|
|
|
+ - `Y` - Y axis
|
|
|
|
+ - `Z` - Z axis
|
|
|
|
+ - `E` - Exruder
|
|
|
|
+
|
|
|
|
+ ### M18 - Disable steppers <a href="https://reprap.org/wiki/G-code#M18:_Disable_all_stepper_motors">M18: Disable all stepper motors</a>
|
|
|
|
+ Equal to M84 (compatibility)
|
|
|
|
+ */
|
|
case 18:
|
|
case 18:
|
|
case 84:
|
|
case 84:
|
|
if(code_seen('S')){
|
|
if(code_seen('S')){
|
|
@@ -6242,8 +6617,15 @@ Sigma_Exit:
|
|
snmm_filaments_used = 0;
|
|
snmm_filaments_used = 0;
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M85 - Set max inactive time <a href="https://reprap.org/wiki/G-code#M85:_Set_Inactivity_Shutdown_Timer">M85: Set Inactivity Shutdown Timer</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M85 [ S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - specifies the time in seconds. If a value of 0 is specified, the timer is disabled.
|
|
|
|
+ */
|
|
case 85:
|
|
case 85:
|
|
if(code_seen('S')) {
|
|
if(code_seen('S')) {
|
|
max_inactive_time = code_value() * 1000;
|
|
max_inactive_time = code_value() * 1000;
|
|
@@ -6251,13 +6633,16 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#ifdef SAFETYTIMER
|
|
#ifdef SAFETYTIMER
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M86 - Set safety timer expiration time <a href="https://reprap.org/wiki/G-code#M86:_Set_Safety_Timer_expiration_time">M86: Set Safety Timer expiration time</a>
|
|
-
|
|
+ When safety timer expires, heatbed and nozzle target temperatures are set to zero.
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
-
|
|
+ M86 [ S ]
|
|
-
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - specifies the time in seconds. If a value of 0 is specified, the timer is disabled.
|
|
|
|
+ */
|
|
case 86:
|
|
case 86:
|
|
if (code_seen('S')) {
|
|
if (code_seen('S')) {
|
|
safetytimer_inactive_time = code_value() * 1000;
|
|
safetytimer_inactive_time = code_value() * 1000;
|
|
@@ -6266,9 +6651,19 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M92 Set Axis steps-per-unit <a href="https://reprap.org/wiki/G-code#M92:_Set_axis_steps_per_unit">M92: Set axis_steps_per_unit</a>
|
|
-
|
|
+ Allows programming of steps per unit (usually mm) for motor drives. These values are reset to firmware defaults on power on, unless saved to EEPROM if available (M500 in Marlin)
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M92 [ X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - Steps per unit for the X drive
|
|
|
|
+ - `Y` - Steps per unit for the Y drive
|
|
|
|
+ - `Z` - Steps per unit for the Z drive
|
|
|
|
+ - `E` - Steps per unit for the extruder drive
|
|
|
|
+ */
|
|
case 92:
|
|
case 92:
|
|
for(int8_t i=0; i < NUM_AXIS; i++)
|
|
for(int8_t i=0; i < NUM_AXIS; i++)
|
|
{
|
|
{
|
|
@@ -6291,15 +6686,31 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M110 - Set Line number <a href="https://reprap.org/wiki/G-code#M110:_Set_Current_Line_Number">M110: Set Current Line Number</a>
|
|
|
|
+ Sets the line number in G-code
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M110 [ N ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `N` - Line number
|
|
|
|
+ */
|
|
case 110:
|
|
case 110:
|
|
if (code_seen('N'))
|
|
if (code_seen('N'))
|
|
gcode_LastN = code_value_long();
|
|
gcode_LastN = code_value_long();
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M113 - Get or set host keep-alive interval <a href="https://reprap.org/wiki/G-code#M113:_Host_Keepalive">M113: Host Keepalive</a>
|
|
|
|
+ During some lengthy processes, such as G29, Marlin may appear to the host to have “gone away.” The “host keepalive” feature will send messages to the host when Marlin is busy or waiting for user response so the host won’t try to reconnect (or disconnect).
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M113 [ S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - Seconds. Default is 2 seconds between "busy" messages
|
|
|
|
+ */
|
|
case 113:
|
|
case 113:
|
|
if (code_seen('S')) {
|
|
if (code_seen('S')) {
|
|
host_keepalive_interval = (uint8_t)code_value_short();
|
|
host_keepalive_interval = (uint8_t)code_value_short();
|
|
@@ -6312,16 +6723,34 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M115 - Firmware info <a href="https://reprap.org/wiki/G-code#M115:_Get_Firmware_Version_and_Capabilities">M115: Get Firmware Version and Capabilities</a>
|
|
-
|
|
+ Print the firmware info and capabilities
|
|
-
|
|
+ Without any arguments, prints Prusa firmware version number, machine type, extruder count and UUID.
|
|
-
|
|
+ `M115 U` Checks the firmware version provided. If the firmware version provided by the U code is higher than the currently running firmware, it will pause the print for 30s and ask the user to upgrade the firmware.
|
|
-
|
|
+
|
|
-
|
|
+ _Examples:_
|
|
-
|
|
+
|
|
-
|
|
+ `M115` results:
|
|
- case 115:
|
|
+
|
|
|
|
+ `FIRMWARE_NAME:Prusa-Firmware 3.8.1 based on Marlin FIRMWARE_URL:https:
|
|
|
|
+
|
|
|
|
+ `M115 V` results:
|
|
|
|
+
|
|
|
|
+ `3.8.1`
|
|
|
|
+
|
|
|
|
+ `M115 U3.8.2-RC1` results on LCD display for 30s or user interaction:
|
|
|
|
+
|
|
|
|
+ `New firmware version available: 3.8.2-RC1 Please upgrade.`
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M115 [ V | U ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - V - Report current installed firmware version
|
|
|
|
+ - U - Firmware version provided by G-code to be compared to current one.
|
|
|
|
+ */
|
|
|
|
+ case 115:
|
|
if (code_seen('V')) {
|
|
if (code_seen('V')) {
|
|
|
|
|
|
SERIAL_PROTOCOLLNRPGM(FW_VERSION_STR_P());
|
|
SERIAL_PROTOCOLLNRPGM(FW_VERSION_STR_P());
|
|
@@ -6343,16 +6772,13 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M114 - Get current position <a href="https://reprap.org/wiki/G-code#M114:_Get_Current_Position">M114: Get Current Position</a>
|
|
|
|
+ */
|
|
case 114:
|
|
case 114:
|
|
gcode_M114();
|
|
gcode_M114();
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
M117 moved up to get the high priority
|
|
M117 moved up to get the high priority
|
|
@@ -6364,20 +6790,24 @@ Sigma_Exit:
|
|
lcd_setstatus(strchr_pointer + 5);
|
|
lcd_setstatus(strchr_pointer + 5);
|
|
break;*/
|
|
break;*/
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M120 - Enable endstops <a href="https://reprap.org/wiki/G-code#M120:_Enable_endstop_detection">M120: Enable endstop detection</a>
|
|
|
|
+ */
|
|
case 120:
|
|
case 120:
|
|
enable_endstops(false) ;
|
|
enable_endstops(false) ;
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M121 - Disable endstops <a href="https://reprap.org/wiki/G-code#M121:_Disable_endstop_detection">M121: Disable endstop detection</a>
|
|
|
|
+ */
|
|
case 121:
|
|
case 121:
|
|
enable_endstops(true) ;
|
|
enable_endstops(true) ;
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M119 - Get endstop states <a href="https://reprap.org/wiki/G-code#M119:_Get_Endstop_Status">M119: Get Endstop Status</a>
|
|
|
|
+ Returns the current state of the configured X, Y, Z endstops. Takes into account any 'inverted endstop' settings, so one can confirm that the machine is interpreting the endstops correctly.
|
|
|
|
+ */
|
|
case 119:
|
|
case 119:
|
|
SERIAL_PROTOCOLRPGM(_N("Reporting endstop status"));
|
|
SERIAL_PROTOCOLRPGM(_N("Reporting endstop status"));
|
|
SERIAL_PROTOCOLLN("");
|
|
SERIAL_PROTOCOLLN("");
|
|
@@ -6436,12 +6866,22 @@ Sigma_Exit:
|
|
SERIAL_PROTOCOLLN("");
|
|
SERIAL_PROTOCOLLN("");
|
|
#endif
|
|
#endif
|
|
break;
|
|
break;
|
|
-
|
|
+
|
|
|
|
|
|
- #ifdef BLINKM
|
|
|
|
|
|
|
|
-
|
|
+ #ifdef BLINKM
|
|
-
|
|
+
|
|
|
|
+ ### M150 - Set RGB(W) Color <a href="https://reprap.org/wiki/G-code#M150:_Set_LED_color">M150: Set LED color</a>
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code by defining BLINKM and its dependencies.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M150 [ R | U | B ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `R` - Red color value
|
|
|
|
+ - `U` - Green color value. It is NOT `G`!
|
|
|
|
+ - `B` - Blue color value
|
|
|
|
+ */
|
|
case 150:
|
|
case 150:
|
|
{
|
|
{
|
|
byte red;
|
|
byte red;
|
|
@@ -6457,8 +6897,16 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M200 - Set filament diameter <a href="https://reprap.org/wiki/G-code#M200:_Set_filament_diameter">M200: Set filament diameter</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M200 [ D | T ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `D` - Diameter in mm
|
|
|
|
+ - `T` - Number of extruder (MMUs)
|
|
|
|
+ */
|
|
case 200:
|
|
case 200:
|
|
{
|
|
{
|
|
|
|
|
|
@@ -6483,10 +6931,10 @@ Sigma_Exit:
|
|
|
|
|
|
cs.filament_size[0] = (cs.filament_size[0] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[0]);
|
|
cs.filament_size[0] = (cs.filament_size[0] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[0]);
|
|
#if EXTRUDERS > 1
|
|
#if EXTRUDERS > 1
|
|
- cs.filament_size[1] = (cs.filament_size[1] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[1]);
|
|
+ cs.filament_size[1] = (cs.filament_size[1] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[1]);
|
|
- #if EXTRUDERS > 2
|
|
+ #if EXTRUDERS > 2
|
|
- cs.filament_size[2] = (cs.filament_size[2] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[2]);
|
|
+ cs.filament_size[2] = (cs.filament_size[2] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[2]);
|
|
- #endif
|
|
+ #endif
|
|
#endif
|
|
#endif
|
|
cs.volumetric_enabled = true;
|
|
cs.volumetric_enabled = true;
|
|
}
|
|
}
|
|
@@ -6498,8 +6946,10 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M201 - Set Print Max Acceleration <a href="https://reprap.org/wiki/G-code#M201:_Set_max_printing_acceleration">M201: Set max printing acceleration</a>
|
|
|
|
+ For each axis individually.
|
|
|
|
+ */
|
|
case 201:
|
|
case 201:
|
|
for (int8_t i = 0; i < NUM_AXIS; i++)
|
|
for (int8_t i = 0; i < NUM_AXIS; i++)
|
|
{
|
|
{
|
|
@@ -6533,8 +6983,10 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M203 - Set Max Feedrate <a href="https://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate">M203: Set maximum feedrate</a>
|
|
|
|
+ For each axis individually.
|
|
|
|
+ */
|
|
case 203:
|
|
case 203:
|
|
for (int8_t i = 0; i < NUM_AXIS; i++)
|
|
for (int8_t i = 0; i < NUM_AXIS; i++)
|
|
{
|
|
{
|
|
@@ -6559,15 +7011,28 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M204 - Acceleration settings <a href="https://reprap.org/wiki/G-code#M204:_Set_default_acceleration">M204: Set default acceleration</a>
|
|
-
|
|
+
|
|
-
|
|
+ #### Old format:
|
|
-
|
|
+ ##### Usage
|
|
-
|
|
+
|
|
-
|
|
+ M204 [ S | T ]
|
|
-
|
|
+
|
|
-
|
|
+ ##### Parameters
|
|
|
|
+ - `S` - normal moves
|
|
|
|
+ - `T` - filmanent only moves
|
|
|
|
+
|
|
|
|
+ #### New format:
|
|
|
|
+ ##### Usage
|
|
|
|
+
|
|
|
|
+ M204 [ P | R | T ]
|
|
|
|
+
|
|
|
|
+ ##### Parameters
|
|
|
|
+ - `P` - printing moves
|
|
|
|
+ - `R` - filmanent only moves
|
|
|
|
+ - `T` - travel moves (as of now T is ignored)
|
|
|
|
+ */
|
|
case 204:
|
|
case 204:
|
|
{
|
|
{
|
|
if(code_seen('S')) {
|
|
if(code_seen('S')) {
|
|
@@ -6586,23 +7051,30 @@ Sigma_Exit:
|
|
cs.retract_acceleration = code_value();
|
|
cs.retract_acceleration = code_value();
|
|
if(code_seen('T')) {
|
|
if(code_seen('T')) {
|
|
|
|
|
|
-
|
|
+
|
|
|
|
+ @todo Prusa3D firmware currently does not support travel acceleration value independent from the extruding acceleration value.
|
|
|
|
+ */
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
+ ### M205 - Set advanced settings <a href="https://reprap.org/wiki/G-code#M205:_Advanced_settings">M205: Advanced settings</a>
|
|
|
|
+ Set some advanced settings related to movement.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M205 [ S | T | B | X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
- `S` - Minimum feedrate for print moves (unit/s)
|
|
- `S` - Minimum feedrate for print moves (unit/s)
|
|
- `T` - Minimum feedrate for travel moves (units/s)
|
|
- `T` - Minimum feedrate for travel moves (units/s)
|
|
- `B` - Minimum segment time (us)
|
|
- `B` - Minimum segment time (us)
|
|
- - `X` - Maximum X jerk (units/s), similarly for other axes
|
|
+ - `X` - Maximum X jerk (units/s)
|
|
|
|
+ - `Y` - Maximum Y jerk (units/s)
|
|
|
|
+ - `Z` - Maximum Z jerk (units/s)
|
|
|
|
+ - `E` - Maximum E jerk (units/s)
|
|
*/
|
|
*/
|
|
case 205:
|
|
case 205:
|
|
{
|
|
{
|
|
@@ -6618,8 +7090,17 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M206 - Set additional homing offsets <a href="https://reprap.org/wiki/G-code#M206:_Offset_axes">M206: Offset axes</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M206 [ X | Y | Z ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X axis offset
|
|
|
|
+ - `Y` - Y axis offset
|
|
|
|
+ - `Z` - Z axis offset
|
|
|
|
+ */
|
|
case 206:
|
|
case 206:
|
|
for(int8_t i=0; i < 3; i++)
|
|
for(int8_t i=0; i < 3; i++)
|
|
{
|
|
{
|
|
@@ -6628,8 +7109,17 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#ifdef FWRETRACT
|
|
#ifdef FWRETRACT
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M207 - Set firmware retraction <a href="https://reprap.org/wiki/G-code#M207:_Set_retract_length">M207: Set retract length</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M207 [ S | F | Z ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - positive length to retract, in mm
|
|
|
|
+ - `F` - retraction feedrate, in mm/min
|
|
|
|
+ - `Z` - additional zlift/hop
|
|
|
|
+ */
|
|
case 207:
|
|
case 207:
|
|
{
|
|
{
|
|
if(code_seen('S'))
|
|
if(code_seen('S'))
|
|
@@ -6646,8 +7136,16 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
}break;
|
|
}break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M208 - Set retract recover length <a href="https://reprap.org/wiki/G-code#M208:_Set_unretract_length">M208: Set unretract length</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M208 [ S | F ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - positive length surplus to the M207 Snnn, in mm
|
|
|
|
+ - `F` - feedrate, in mm/sec
|
|
|
|
+ */
|
|
case 208:
|
|
case 208:
|
|
{
|
|
{
|
|
if(code_seen('S'))
|
|
if(code_seen('S'))
|
|
@@ -6660,8 +7158,16 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
}break;
|
|
}break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M209 - Enable/disable automatict retract <a href="https://reprap.org/wiki/G-code#M209:_Enable_automatic_retract">M209: Enable automatic retract</a>
|
|
|
|
+ This boolean value S 1=true or 0=false enables automatic retract detect if the slicer did not support G10/G11: every normal extrude-only move will be classified as retract depending on the direction.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M209 [ S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - 1=true or 0=false
|
|
|
|
+ */
|
|
case 209:
|
|
case 209:
|
|
{
|
|
{
|
|
if(code_seen('S'))
|
|
if(code_seen('S'))
|
|
@@ -6703,8 +7209,17 @@ Sigma_Exit:
|
|
#endif
|
|
#endif
|
|
#if EXTRUDERS > 1
|
|
#if EXTRUDERS > 1
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M218 - Set hotend offset <a href="https://reprap.org/wiki/G-code#M218:_Set_Hotend_Offset">M218: Set Hotend Offset</a>
|
|
|
|
+ In Prusa Firmware this G-code is only active if `EXTRUDERS` is higher then 1 in the source code. On Original i3 Prusa MK2/s MK2.5/s MK3/s it is not active.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M218 [ X | Y ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X offset
|
|
|
|
+ - `Y` - Y offset
|
|
|
|
+ */
|
|
case 218:
|
|
case 218:
|
|
{
|
|
{
|
|
uint8_t extruder;
|
|
uint8_t extruder;
|
|
@@ -6732,8 +7247,17 @@ Sigma_Exit:
|
|
}break;
|
|
}break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M220 Set feedrate percentage <a href="https://reprap.org/wiki/G-code#M220:_Set_speed_factor_override_percentage">M220: Set speed factor override percentage</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M220 [ B | S | R ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `B` - Backup current speed factor
|
|
|
|
+ - `S` - Speed factor override percentage (0..100 or higher)
|
|
|
|
+ - `R` - Restore previous speed factor
|
|
|
|
+ */
|
|
case 220:
|
|
case 220:
|
|
{
|
|
{
|
|
if (code_seen('B'))
|
|
if (code_seen('B'))
|
|
@@ -6750,8 +7274,16 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M221 - Set extrude factor override percentage <a href="https://reprap.org/wiki/G-code#M221:_Set_extrude_factor_override_percentage">M221: Set extrude factor override percentage</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M221 [ S | T ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - Extrude factor override percentage (0..100 or higher), default 100%
|
|
|
|
+ - `T` - Extruder drive number (Prusa Firmware only), default 0 if not set.
|
|
|
|
+ */
|
|
case 221:
|
|
case 221:
|
|
{
|
|
{
|
|
if(code_seen('S'))
|
|
if(code_seen('S'))
|
|
@@ -6774,8 +7306,17 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M226 - Wait for Pin state <a href="https://reprap.org/wiki/G-code#M226:_Wait_for_pin_state">M226: Wait for pin state</a>
|
|
|
|
+ Wait until the specified pin reaches the state required
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M226 [ P | S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - pin number
|
|
|
|
+ - `S` - pin state
|
|
|
|
+ */
|
|
case 226:
|
|
case 226:
|
|
{
|
|
{
|
|
if(code_seen('P')){
|
|
if(code_seen('P')){
|
|
@@ -6830,8 +7371,17 @@ Sigma_Exit:
|
|
|
|
|
|
#if NUM_SERVOS > 0
|
|
#if NUM_SERVOS > 0
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M280 - Set/Get servo position <a href="https://reprap.org/wiki/G-code#M280:_Set_servo_position">M280: Set servo position</a>
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M280 [ P | S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - Servo index (id)
|
|
|
|
+ - `S` - Target position
|
|
|
|
+ */
|
|
case 280:
|
|
case 280:
|
|
{
|
|
{
|
|
int servo_index = -1;
|
|
int servo_index = -1;
|
|
@@ -6871,8 +7421,17 @@ Sigma_Exit:
|
|
|
|
|
|
#if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)))
|
|
#if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)))
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M300 - Play tone <a href="https://reprap.org/wiki/G-code#M300:_Play_beep_sound">M300: Play beep sound</a>
|
|
|
|
+ In Prusa Firmware the defaults are `100Hz` and `1000ms`, so that `M300` without parameters will beep for a second.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M300 [ S | P ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - frequency in Hz. Not all firmware versions support this parameter
|
|
|
|
+ - `P` - duration in milliseconds
|
|
|
|
+ */
|
|
case 300:
|
|
case 300:
|
|
{
|
|
{
|
|
int beepS = code_seen('S') ? code_value() : 110;
|
|
int beepS = code_seen('S') ? code_value() : 110;
|
|
@@ -6893,8 +7452,20 @@ Sigma_Exit:
|
|
|
|
|
|
#ifdef PIDTEMP
|
|
#ifdef PIDTEMP
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M301 - Set hotend PID <a href="https://reprap.org/wiki/G-code#M301:_Set_PID_parameters">M301: Set PID parameters</a>
|
|
|
|
+ Sets Proportional (P), Integral (I) and Derivative (D) values for hot end.
|
|
|
|
+ See also <a href="https://reprap.org/wiki/PID_Tuning">PID Tuning.</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M301 [ P | I | D | C ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - proportional (Kp)
|
|
|
|
+ - `I` - integral (Ki)
|
|
|
|
+ - `D` - derivative (Kd)
|
|
|
|
+ - `C` - heating power=Kc*(e_speed0)
|
|
|
|
+ */
|
|
case 301:
|
|
case 301:
|
|
{
|
|
{
|
|
if(code_seen('P')) cs.Kp = code_value();
|
|
if(code_seen('P')) cs.Kp = code_value();
|
|
@@ -6924,8 +7495,19 @@ Sigma_Exit:
|
|
#endif
|
|
#endif
|
|
#ifdef PIDTEMPBED
|
|
#ifdef PIDTEMPBED
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M304 - Set bed PID <a href="https://reprap.org/wiki/G-code#M304:_Set_PID_parameters_-_Bed">M304: Set PID parameters - Bed</a>
|
|
|
|
+ Sets Proportional (P), Integral (I) and Derivative (D) values for bed.
|
|
|
|
+ See also <a href="https://reprap.org/wiki/PID_Tuning">PID Tuning.</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M304 [ P | I | D ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - proportional (Kp)
|
|
|
|
+ - `I` - integral (Ki)
|
|
|
|
+ - `D` - derivative (Kd)
|
|
|
|
+ */
|
|
case 304:
|
|
case 304:
|
|
{
|
|
{
|
|
if(code_seen('P')) cs.bedKp = code_value();
|
|
if(code_seen('P')) cs.bedKp = code_value();
|
|
@@ -6945,8 +7527,13 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M240 - Trigger camera <a href="https://reprap.org/wiki/G-code#M240:_Trigger_camera">M240: Trigger camera</a>
|
|
|
|
+
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
|
|
|
|
+
|
|
|
|
+ You need to (re)define and assign `CHDK` or `PHOTOGRAPH_PIN` the correct pin number to be able to use the feature.
|
|
|
|
+ */
|
|
case 240:
|
|
case 240:
|
|
{
|
|
{
|
|
#ifdef CHDK
|
|
#ifdef CHDK
|
|
@@ -6980,8 +7567,16 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M302 - Allow cold extrude, or set minimum extrude temperature <a href="https://reprap.org/wiki/G-code#M302:_Allow_cold_extrudes">M302: Allow cold extrudes</a>
|
|
|
|
+ This tells the printer to allow movement of the extruder motor above a certain temperature, or if disabled, to allow extruder movement when the hotend is below a safe printing temperature.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M302 [ S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - Cold extrude minimum temperature
|
|
|
|
+ */
|
|
case 302:
|
|
case 302:
|
|
{
|
|
{
|
|
float temp = .0;
|
|
float temp = .0;
|
|
@@ -6991,8 +7586,18 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M303 - PID autotune <a href="https://reprap.org/wiki/G-code#M303:_Run_PID_tuning">M303: Run PID tuning</a>
|
|
|
|
+ PID Tuning refers to a control algorithm used in some repraps to tune heating behavior for hot ends and heated beds. This command generates Proportional (Kp), Integral (Ki), and Derivative (Kd) values for the hotend or bed. Send the appropriate code and wait for the output to update the firmware values.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M303 [ E | S | C ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `E` - Extruder, default `E0`. Use `E-1` to calibrate the bed PID
|
|
|
|
+ - `S` - Target temperature, default `210°C` for hotend, 70 for bed
|
|
|
|
+ - `C` - Cycles, default `5`
|
|
|
|
+ */
|
|
case 303:
|
|
case 303:
|
|
{
|
|
{
|
|
float temp = 150.0;
|
|
float temp = 150.0;
|
|
@@ -7007,17 +7612,30 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M400 - Wait for all moves to finish <a href="https://reprap.org/wiki/G-code#M400:_Wait_for_current_moves_to_finish">M400: Wait for current moves to finish</a>
|
|
|
|
+ Finishes all current moves and and thus clears the buffer.
|
|
|
|
+ Equivalent to `G4` with no parameters.
|
|
|
|
+ */
|
|
case 400:
|
|
case 400:
|
|
{
|
|
{
|
|
st_synchronize();
|
|
st_synchronize();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M403 - Set filament type (material) for particular extruder and notify the MMU <a href="https://reprap.org/wiki/G-code#M403:_Set_filament_type_.28material.29_for_particular_extruder_and_notify_the_MMU.">M403 - Set filament type (material) for particular extruder and notify the MMU</a>
|
|
- case 403:
|
|
+ Currently three different materials are needed (default, flex and PVA).
|
|
|
|
+ And storing this information for different load/unload profiles etc. in the future firmware does not have to wait for "ok" from MMU.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M403 [ E | F ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `E` - Extruder number. 0-indexed.
|
|
|
|
+ - `F` - Filament type
|
|
|
|
+ */
|
|
|
|
+ case 403:
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
@@ -7033,40 +7651,51 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M500 - Store settings in EEPROM <a href="https://reprap.org/wiki/G-code#M500:_Store_parameters_in_non-volatile_storage">M500: Store parameters in non-volatile storage</a>
|
|
|
|
+ Save current parameters to EEPROM.
|
|
|
|
+ */
|
|
case 500:
|
|
case 500:
|
|
{
|
|
{
|
|
Config_StoreSettings();
|
|
Config_StoreSettings();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M501 - Read settings from EEPROM <a href="https://reprap.org/wiki/G-code#M501:_Read_parameters_from_EEPROM">M501: Read parameters from EEPROM</a>
|
|
|
|
+ Set the active parameters to those stored in the EEPROM. This is useful to revert parameters after experimenting with them.
|
|
|
|
+ */
|
|
case 501:
|
|
case 501:
|
|
{
|
|
{
|
|
Config_RetrieveSettings();
|
|
Config_RetrieveSettings();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M502 - Revert all settings to factory default <a href="https://reprap.org/wiki/G-code#M502:_Restore_Default_Settings">M502: Restore Default Settings</a>
|
|
|
|
+ This command resets all tunable parameters to their default values, as set in the firmware's configuration files. This doesn't reset any parameters stored in the EEPROM, so it must be followed by M500 to write the default settings.
|
|
|
|
+ */
|
|
case 502:
|
|
case 502:
|
|
{
|
|
{
|
|
Config_ResetDefault();
|
|
Config_ResetDefault();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M503 - Repport all settings currently in memory <a href="https://reprap.org/wiki/G-code#M503:_Report_Current_Settings">M503: Report Current Settings</a>
|
|
|
|
+ This command asks the firmware to reply with the current print settings as set in memory. Settings will differ from EEPROM contents if changed since the last load / save. The reply output includes the G-Code commands to produce each setting. For example, Steps-Per-Unit values are displayed as an M92 command.
|
|
|
|
+ */
|
|
case 503:
|
|
case 503:
|
|
{
|
|
{
|
|
Config_PrintSettings();
|
|
Config_PrintSettings();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M509 - Force language selection <a href="https://reprap.org/wiki/G-code#M509:_Force_language_selection">M509: Force language selection</a>
|
|
|
|
+ Resets the language to English.
|
|
|
|
+ Only on Original Prusa i3 MK2.5/s and MK3/s with multiple languages.
|
|
|
|
+ */
|
|
case 509:
|
|
case 509:
|
|
{
|
|
{
|
|
lang_reset();
|
|
lang_reset();
|
|
@@ -7076,8 +7705,16 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
|
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M540 - Abort print on endstop hit (enable/disable) <a href="https://reprap.org/wiki/G-code#M540_in_Marlin:_Enable.2FDisable_.22Stop_SD_Print_on_Endstop_Hit.22">M540 in Marlin: Enable/Disable "Stop SD Print on Endstop Hit"</a>
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. You must define `ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED`.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M540 [ S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `S` - disabled=0, enabled=1
|
|
|
|
+ */
|
|
case 540:
|
|
case 540:
|
|
{
|
|
{
|
|
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
|
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
|
@@ -7085,6 +7722,17 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+
|
|
|
|
+ ### M851 - Set Z-Probe Offset <a href="https://reprap.org/wiki/G-code#M851:_Set_Z-Probe_Offset">M851: Set Z-Probe Offset"</a>
|
|
|
|
+ Sets the Z-probe Z offset. This offset is used to determine the actual Z position of the nozzle when using a probe to home Z with G28. This value may also be used by G81 (Prusa) / G29 (Marlin) to apply correction to the Z position.
|
|
|
|
+ This value represents the distance from nozzle to the bed surface at the point where the probe is triggered. This value will be negative for typical switch probes, inductive probes, and setups where the nozzle makes a circuit with a raised metal contact. This setting will be greater than zero on machines where the nozzle itself is used as the probe, pressing down on the bed to press a switch. (This is a common setup on delta machines.)
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M851 [ Z ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `Z` - Z offset probe to nozzle.
|
|
|
|
+ */
|
|
#ifdef CUSTOM_M_CODE_SET_Z_PROBE_OFFSET
|
|
#ifdef CUSTOM_M_CODE_SET_Z_PROBE_OFFSET
|
|
case CUSTOM_M_CODE_SET_Z_PROBE_OFFSET:
|
|
case CUSTOM_M_CODE_SET_Z_PROBE_OFFSET:
|
|
{
|
|
{
|
|
@@ -7123,8 +7771,21 @@ Sigma_Exit:
|
|
|
|
|
|
#ifdef FILAMENTCHANGEENABLE
|
|
#ifdef FILAMENTCHANGEENABLE
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M600 - Initiate Filament change procedure <a href="https://reprap.org/wiki/G-code#M600:_Filament_change_pause">M600: Filament change pause</a>
|
|
|
|
+ Initiates Filament change, it is also used during Filament Runout Sensor process.
|
|
|
|
+ If the `M600` is triggered under 25mm it will do a Z-lift of 25mm to prevent a filament blob.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M600 [ X | Y | Z | E | L | AUTO ]
|
|
|
|
+
|
|
|
|
+ - `X` - X position, default 211
|
|
|
|
+ - `Y` - Y position, default 0
|
|
|
|
+ - `Z` - relative lift Z, default 2.
|
|
|
|
+ - `E` - initial retract, default -2
|
|
|
|
+ - `L` - later retract distance for removal, default -80
|
|
|
|
+ - `AUTO` - Automatically (only with MMU)
|
|
|
|
+ */
|
|
case 600:
|
|
case 600:
|
|
{
|
|
{
|
|
st_synchronize();
|
|
st_synchronize();
|
|
@@ -7200,37 +7861,55 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M601 - Pause print <a href="https://reprap.org/wiki/G-code#M601:_Pause_print">M601: Pause print</a>
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ ### M125 - Pause print (TODO: not implemented)
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ ### M25 - Pause SD print <a href="https://reprap.org/wiki/G-code#M25:_Pause_SD_print">M25: Pause SD print</a>
|
|
|
|
+ */
|
|
|
|
+ case 25:
|
|
case 601:
|
|
case 601:
|
|
{
|
|
{
|
|
- cmdqueue_pop_front();
|
|
+ if (!isPrintPaused)
|
|
- lcd_pause_print();
|
|
+ {
|
|
|
|
+ st_synchronize();
|
|
|
|
+ cmdqueue_pop_front();
|
|
|
|
+ lcd_pause_print();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M602 - Resume print <a href="https://reprap.org/wiki/G-code#M602:_Resume_print">M602: Resume print</a>
|
|
|
|
+ */
|
|
case 602: {
|
|
case 602: {
|
|
- lcd_resume_print();
|
|
+ if (isPrintPaused)
|
|
|
|
+ lcd_resume_print();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M603 - Stop print <a href="https://reprap.org/wiki/G-code#M603:_Stop_print">M603: Stop print</a>
|
|
- case 603: {
|
|
+ */
|
|
|
|
+ case 603: {
|
|
lcd_print_stop();
|
|
lcd_print_stop();
|
|
}
|
|
}
|
|
|
|
+ break;
|
|
|
|
|
|
#ifdef PINDA_THERMISTOR
|
|
#ifdef PINDA_THERMISTOR
|
|
-
|
|
+
|
|
-
|
|
+ ### M860 - Wait for extruder temperature (PINDA) <a href="https://reprap.org/wiki/G-code#M860_Wait_for_Probe_Temperature">M860 Wait for Probe Temperature</a>
|
|
-
|
|
+ Wait for PINDA thermistor to reach target temperature
|
|
- Wait for PINDA thermistor to reach target temperature
|
|
+ #### Usage
|
|
-
|
|
+
|
|
- M860 [S<target_temperature>]
|
|
+ M860 [ S ]
|
|
-
|
|
+
|
|
- */
|
|
+ #### Parameters
|
|
|
|
+ - `S` - Target temperature
|
|
|
|
+ */
|
|
case 860:
|
|
case 860:
|
|
{
|
|
{
|
|
int set_target_pinda = 0;
|
|
int set_target_pinda = 0;
|
|
@@ -7275,17 +7954,20 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M861 - Set/Get PINDA temperature compensation offsets <a href="https://reprap.org/wiki/G-code#M861_Set_Probe_Thermal_Compensation">M861 Set Probe Thermal Compensation</a>
|
|
-
|
|
+ Set compensation ustep value `S` for compensation table index `I`.
|
|
-
|
|
+ #### Usage
|
|
- M861 [ ? | ! | Z | S<microsteps> [I<table_index>] ]
|
|
+
|
|
-
|
|
+ M861 [ ? | ! | Z | S | I ]
|
|
- - `?` - Print current EEPROM offset values
|
|
+
|
|
- - `!` - Set factory default values
|
|
+ #### Parameters
|
|
- - `Z` - Set all values to 0 (effectively disabling PINDA temperature compensation)
|
|
+ - `?` - Print current EEPROM offset values
|
|
- - `S<microsteps>` `I<table_index>` - Set compensation ustep value S for compensation table index I
|
|
+ - `!` - Set factory default values
|
|
- */
|
|
+ - `Z` - Set all values to 0 (effectively disabling PINDA temperature compensation)
|
|
|
|
+ - `S` - Microsteps
|
|
|
|
+ - `I` - Table index
|
|
|
|
+ */
|
|
case 861:
|
|
case 861:
|
|
if (code_seen('?')) {
|
|
if (code_seen('?')) {
|
|
uint8_t cal_status = calibration_status_pinda();
|
|
uint8_t cal_status = calibration_status_pinda();
|
|
@@ -7358,38 +8040,40 @@ Sigma_Exit:
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M862 - Print checking <a href="https://reprap.org/wiki/G-code#M862:_Print_checking">M862: Print checking</a>
|
|
-
|
|
+ Checks the parameters of the printer and gcode and performs compatibility check
|
|
- Checks the parameters of the printer and gcode and performs compatibility check
|
|
+
|
|
- - M862.1 { P<nozzle_diameter> | Q }
|
|
+ - M862.1 { P<nozzle_diameter> | Q } 0.25/0.40/0.60
|
|
- - M862.2 { P<model_code> | Q }
|
|
+ - M862.2 { P<model_code> | Q }
|
|
- - M862.3 { P"<model_name>" | Q }
|
|
+ - M862.3 { P"<model_name>" | Q }
|
|
- - M862.4 { P<fw_version> | Q }
|
|
+ - M862.4 { P<fw_version> | Q }
|
|
- - M862.5 { P<gcode_level> | Q }
|
|
+ - M862.5 { P<gcode_level> | Q }
|
|
-
|
|
+
|
|
- When run with P<> argument, the check is performed against the input value.
|
|
+ When run with P<> argument, the check is performed against the input value.
|
|
- When run with Q argument, the current value is shown.
|
|
+ When run with Q argument, the current value is shown.
|
|
-
|
|
+
|
|
- M862.3 accepts text identifiers of printer types too.
|
|
+ M862.3 accepts text identifiers of printer types too.
|
|
- The syntax of M862.3 is (note the quotes around the type):
|
|
+ The syntax of M862.3 is (note the quotes around the type):
|
|
-
|
|
+
|
|
- M862.3 P "MK3S"
|
|
+ M862.3 P "MK3S"
|
|
-
|
|
+
|
|
- Accepted printer type identifiers and their numeric counterparts:
|
|
+ Accepted printer type identifiers and their numeric counterparts:
|
|
- - MK1 (100)
|
|
+
|
|
- - MK2 (200)
|
|
+ - MK1 (100)
|
|
- - MK2MM (201)
|
|
+ - MK2 (200)
|
|
- - MK2S (202)
|
|
+ - MK2MM (201)
|
|
- - MK2SMM (203)
|
|
+ - MK2S (202)
|
|
- - MK2.5 (250)
|
|
+ - MK2SMM (203)
|
|
- - MK2.5MMU2 (20250)
|
|
+ - MK2.5 (250)
|
|
- - MK2.5S (252)
|
|
+ - MK2.5MMU2 (20250)
|
|
- - MK2.5SMMU2S (20252)
|
|
+ - MK2.5S (252)
|
|
- - MK3 (300)
|
|
+ - MK2.5SMMU2S (20252)
|
|
- - MK3MMU2 (20300)
|
|
+ - MK3 (300)
|
|
- - MK3S (302)
|
|
+ - MK3MMU2 (20300)
|
|
- - MK3SMMU2S (20302)
|
|
+ - MK3S (302)
|
|
|
|
+ - MK3SMMU2S (20302)
|
|
|
|
+
|
|
*/
|
|
*/
|
|
case 862:
|
|
case 862:
|
|
float nDummy;
|
|
float nDummy;
|
|
@@ -7451,19 +8135,44 @@ Sigma_Exit:
|
|
break;
|
|
break;
|
|
|
|
|
|
#ifdef LIN_ADVANCE
|
|
#ifdef LIN_ADVANCE
|
|
-
|
|
+
|
|
-
|
|
+ ### M900 - Set Linear advance options <a href="https://reprap.org/wiki/G-code#M900_Set_Linear_Advance_Scaling_Factors">M900 Set Linear Advance Scaling Factors</a>
|
|
|
|
+ Sets the advance extrusion factors for Linear Advance. If any of the R, W, H, or D parameters are set to zero the ratio will be computed dynamically during printing.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M900 [ K | R | W | H | D]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `K` - Advance K factor
|
|
|
|
+ - `R` - Set ratio directly (overrides WH/D)
|
|
|
|
+ - `W` - Width
|
|
|
|
+ - `H` - Height
|
|
|
|
+ - `D` - Diameter Set ratio from WH/D
|
|
|
|
+ */
|
|
case 900:
|
|
case 900:
|
|
gcode_M900();
|
|
gcode_M900();
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M907 - Set digital trimpot motor current in mA using axis codes <a href="https://reprap.org/wiki/G-code#M907:_Set_digital_trimpot_motor">M907: Set digital trimpot motor</a>
|
|
|
|
+ Set digital trimpot motor current using axis codes (X, Y, Z, E, B, S).
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M907 [ X | Y | Z | E | B | S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X motor driver
|
|
|
|
+ - `Y` - Y motor driver
|
|
|
|
+ - `Z` - Z motor driver
|
|
|
|
+ - `E` - Extruder motor driver
|
|
|
|
+ - `B` - Second Extruder motor driver
|
|
|
|
+ - `S` - All motors
|
|
|
|
+ */
|
|
case 907:
|
|
case 907:
|
|
{
|
|
{
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
-
|
|
+
|
|
for (int i = 0; i < NUM_AXIS; i++)
|
|
for (int i = 0; i < NUM_AXIS; i++)
|
|
if(code_seen(axis_codes[i]))
|
|
if(code_seen(axis_codes[i]))
|
|
{
|
|
{
|
|
@@ -7493,8 +8202,17 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M908 - Control digital trimpot directly <a href="https://reprap.org/wiki/G-code#M908:_Control_digital_trimpot_directly">M908: Control digital trimpot directly</a>
|
|
|
|
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. Not usable on Prusa printers.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M908 [ P | S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - channel
|
|
|
|
+ - `S` - current
|
|
|
|
+ */
|
|
case 908:
|
|
case 908:
|
|
{
|
|
{
|
|
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
|
|
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
|
|
@@ -7508,16 +8226,30 @@ Sigma_Exit:
|
|
|
|
|
|
#ifdef TMC2130_SERVICE_CODES_M910_M918
|
|
#ifdef TMC2130_SERVICE_CODES_M910_M918
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M910 - TMC2130 init <a href="https://reprap.org/wiki/G-code#M910:_TMC2130_init">M910: TMC2130 init</a>
|
|
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+
|
|
|
|
+ */
|
|
case 910:
|
|
case 910:
|
|
{
|
|
{
|
|
tmc2130_init();
|
|
tmc2130_init();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M911 - Set TMC2130 holding currents <a href="https://reprap.org/wiki/G-code#M911:_Set_TMC2130_holding_currents">M911: Set TMC2130 holding currents</a>
|
|
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M911 [ X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X stepper driver holding current value
|
|
|
|
+ - `Y` - Y stepper driver holding current value
|
|
|
|
+ - `Z` - Z stepper driver holding current value
|
|
|
|
+ - `E` - Extruder stepper driver holding current value
|
|
|
|
+ */
|
|
case 911:
|
|
case 911:
|
|
{
|
|
{
|
|
if (code_seen('X')) tmc2130_set_current_h(0, code_value());
|
|
if (code_seen('X')) tmc2130_set_current_h(0, code_value());
|
|
@@ -7527,8 +8259,19 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M912 - Set TMC2130 running currents <a href="https://reprap.org/wiki/G-code#M912:_Set_TMC2130_running_currents">M912: Set TMC2130 running currents</a>
|
|
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M912 [ X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X stepper driver running current value
|
|
|
|
+ - `Y` - Y stepper driver running current value
|
|
|
|
+ - `Z` - Z stepper driver running current value
|
|
|
|
+ - `E` - Extruder stepper driver running current value
|
|
|
|
+ */
|
|
case 912:
|
|
case 912:
|
|
{
|
|
{
|
|
if (code_seen('X')) tmc2130_set_current_r(0, code_value());
|
|
if (code_seen('X')) tmc2130_set_current_r(0, code_value());
|
|
@@ -7538,17 +8281,22 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M913 - Print TMC2130 currents <a href="https://reprap.org/wiki/G-code#M913:_Print_TMC2130_currents">M913: Print TMC2130 currents</a>
|
|
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+ Shows TMC2130 currents.
|
|
|
|
+ */
|
|
case 913:
|
|
case 913:
|
|
{
|
|
{
|
|
tmc2130_print_currents();
|
|
tmc2130_print_currents();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M914 - Set TMC2130 normal mode <a href="https://reprap.org/wiki/G-code#M914:_Set_TMC2130_normal_mode">M914: Set TMC2130 normal mode</a>
|
|
- case 914:
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+ */
|
|
|
|
+ case 914:
|
|
{
|
|
{
|
|
tmc2130_mode = TMC2130_MODE_NORMAL;
|
|
tmc2130_mode = TMC2130_MODE_NORMAL;
|
|
update_mode_profile();
|
|
update_mode_profile();
|
|
@@ -7556,9 +8304,11 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M915 - Set TMC2130 silent mode <a href="https://reprap.org/wiki/G-code#M915:_Set_TMC2130_silent_mode">M915: Set TMC2130 silent mode</a>
|
|
- case 915:
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+ */
|
|
|
|
+ case 915:
|
|
{
|
|
{
|
|
tmc2130_mode = TMC2130_MODE_SILENT;
|
|
tmc2130_mode = TMC2130_MODE_SILENT;
|
|
update_mode_profile();
|
|
update_mode_profile();
|
|
@@ -7566,8 +8316,19 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M916 - Set TMC2130 Stallguard sensitivity threshold <a href="https://reprap.org/wiki/G-code#M916:_Set_TMC2130_Stallguard_sensitivity_threshold">M916: Set TMC2130 Stallguard sensitivity threshold</a>
|
|
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M916 [ X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X stepper driver stallguard sensitivity threshold value
|
|
|
|
+ - `Y` - Y stepper driver stallguard sensitivity threshold value
|
|
|
|
+ - `Z` - Z stepper driver stallguard sensitivity threshold value
|
|
|
|
+ - `E` - Extruder stepper driver stallguard sensitivity threshold value
|
|
|
|
+ */
|
|
case 916:
|
|
case 916:
|
|
{
|
|
{
|
|
if (code_seen('X')) tmc2130_sg_thr[X_AXIS] = code_value();
|
|
if (code_seen('X')) tmc2130_sg_thr[X_AXIS] = code_value();
|
|
@@ -7579,8 +8340,19 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M917 - Set TMC2130 PWM amplitude offset (pwm_ampl) <a href="https://reprap.org/wiki/G-code#M917:_Set_TMC2130_PWM_amplitude_offset_.28pwm_ampl.29">M917: Set TMC2130 PWM amplitude offset (pwm_ampl)</a>
|
|
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M917 [ X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X stepper driver PWM amplitude offset value
|
|
|
|
+ - `Y` - Y stepper driver PWM amplitude offset value
|
|
|
|
+ - `Z` - Z stepper driver PWM amplitude offset value
|
|
|
|
+ - `E` - Extruder stepper driver PWM amplitude offset value
|
|
|
|
+ */
|
|
case 917:
|
|
case 917:
|
|
{
|
|
{
|
|
if (code_seen('X')) tmc2130_set_pwm_ampl(0, code_value());
|
|
if (code_seen('X')) tmc2130_set_pwm_ampl(0, code_value());
|
|
@@ -7590,8 +8362,19 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M918 - Set TMC2130 PWM amplitude gradient (pwm_grad) <a href="https://reprap.org/wiki/G-code#M918:_Set_TMC2130_PWM_amplitude_gradient_.28pwm_grad.29">M918: Set TMC2130 PWM amplitude gradient (pwm_grad)</a>
|
|
|
|
+ Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M918 [ X | Y | Z | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X stepper driver PWM amplitude gradient value
|
|
|
|
+ - `Y` - Y stepper driver PWM amplitude gradient value
|
|
|
|
+ - `Z` - Z stepper driver PWM amplitude gradient value
|
|
|
|
+ - `E` - Extruder stepper driver PWM amplitude gradient value
|
|
|
|
+ */
|
|
case 918:
|
|
case 918:
|
|
{
|
|
{
|
|
if (code_seen('X')) tmc2130_set_pwm_grad(0, code_value());
|
|
if (code_seen('X')) tmc2130_set_pwm_grad(0, code_value());
|
|
@@ -7603,33 +8386,54 @@ Sigma_Exit:
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M350 - Set microstepping mode <a href="https://reprap.org/wiki/G-code#M350:_Set_microstepping_mode">M350: Set microstepping mode</a>
|
|
-
|
|
+ Printers with TMC2130 drivers have `X`, `Y`, `Z` and `E` as options. The steps-per-unit value is updated accordingly. Not all resolutions are valid!
|
|
|
|
+ Printers without TMC2130 drivers also have `B` and `S` options. In this case, the steps-per-unit value in not changed!
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ M350 [ X | Y | Z | E | B | S ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - X new resolution
|
|
|
|
+ - `Y` - Y new resolution
|
|
|
|
+ - `Z` - Z new resolution
|
|
|
|
+ - `E` - E new resolution
|
|
|
|
+
|
|
|
|
+ Only valid for MK2.5(S) or printers without TMC2130 drivers
|
|
|
|
+ - `B` - Second extruder new resolution
|
|
|
|
+ - `S` - All axes new resolution
|
|
|
|
+ */
|
|
case 350:
|
|
case 350:
|
|
{
|
|
{
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
- if(code_seen('E'))
|
|
+ for (int i=0; i<NUM_AXIS; i++)
|
|
{
|
|
{
|
|
- uint16_t res_new = code_value();
|
|
+ if(code_seen(axis_codes[i]))
|
|
- if ((res_new == 8) || (res_new == 16) || (res_new == 32) || (res_new == 64) || (res_new == 128))
|
|
|
|
{
|
|
{
|
|
- st_synchronize();
|
|
+ uint16_t res_new = code_value();
|
|
- uint8_t axis = E_AXIS;
|
|
+ bool res_valid = (res_new == 8) || (res_new == 16) || (res_new == 32);
|
|
- uint16_t res = tmc2130_get_res(axis);
|
|
+ res_valid |= (i != E_AXIS) && ((res_new == 1) || (res_new == 2) || (res_new == 4));
|
|
- tmc2130_set_res(axis, res_new);
|
|
+ res_valid |= (i == E_AXIS) && ((res_new == 64) || (res_new == 128));
|
|
- cs.axis_ustep_resolution[axis] = res_new;
|
|
+ if (res_valid)
|
|
- if (res_new > res)
|
|
|
|
- {
|
|
|
|
- uint16_t fac = (res_new / res);
|
|
|
|
- cs.axis_steps_per_unit[axis] *= fac;
|
|
|
|
- position[E_AXIS] *= fac;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
{
|
|
{
|
|
- uint16_t fac = (res / res_new);
|
|
+
|
|
- cs.axis_steps_per_unit[axis] /= fac;
|
|
+ st_synchronize();
|
|
- position[E_AXIS] /= fac;
|
|
+ uint16_t res = tmc2130_get_res(i);
|
|
|
|
+ tmc2130_set_res(i, res_new);
|
|
|
|
+ cs.axis_ustep_resolution[i] = res_new;
|
|
|
|
+ if (res_new > res)
|
|
|
|
+ {
|
|
|
|
+ uint16_t fac = (res_new / res);
|
|
|
|
+ cs.axis_steps_per_unit[i] *= fac;
|
|
|
|
+ position[i] *= fac;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ uint16_t fac = (res / res_new);
|
|
|
|
+ cs.axis_steps_per_unit[i] /= fac;
|
|
|
|
+ position[i] /= fac;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -7644,11 +8448,21 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M351 - Toggle Microstep Pins <a href="https://reprap.org/wiki/G-code#M351:_Toggle_MS1_MS2_pins_directly">M351: Toggle MS1 MS2 pins directly</a>
|
|
-
|
|
+ Toggle MS1 MS2 pins directly.
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
|
|
+ M351 [B<0|1>] [E<0|1>] S<1|2> [X<0|1>] [Y<0|1>] [Z<0|1>]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `X` - Update X axis
|
|
|
|
+ - `Y` - Update Y axis
|
|
|
|
+ - `Z` - Update Z axis
|
|
|
|
+ - `E` - Update E axis
|
|
|
|
+ - `S` - which MSx pin to toggle
|
|
|
|
+ - `B` - new pin value
|
|
|
|
+ */
|
|
case 351:
|
|
case 351:
|
|
{
|
|
{
|
|
#if defined(X_MS1_PIN) && X_MS1_PIN > -1
|
|
#if defined(X_MS1_PIN) && X_MS1_PIN > -1
|
|
@@ -7668,8 +8482,10 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M701 - Load filament <a href="https://reprap.org/wiki/G-code#M701:_Load_filament">M701: Load filament</a>
|
|
|
|
+
|
|
|
|
+ */
|
|
case 701:
|
|
case 701:
|
|
{
|
|
{
|
|
if (mmu_enabled && code_seen('E'))
|
|
if (mmu_enabled && code_seen('E'))
|
|
@@ -7678,16 +8494,17 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M702 - Unload filament <a href="https://reprap.org/wiki/G-code#M702:_Unload_filament">G32: Undock Z Probe sled</a>
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
- M702 [U C]
|
|
+ M702 [ U | C ]
|
|
-
|
|
+
|
|
- - `U` Unload all filaments used in current print
|
|
+ #### Parameters
|
|
- - `C` Unload just current filament
|
|
+ - `U` - Unload all filaments used in current print
|
|
- - without any parameters unload all filaments
|
|
+ - `C` - Unload just current filament
|
|
- */
|
|
+ - without any parameters unload all filaments
|
|
|
|
+ */
|
|
case 702:
|
|
case 702:
|
|
{
|
|
{
|
|
#ifdef SNMM
|
|
#ifdef SNMM
|
|
@@ -7710,14 +8527,19 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### M999 - Restart after being stopped <a href="https://reprap.org/wiki/G-code#M999:_Restart_after_being_stopped_by_error">M999: Restart after being stopped by error</a>
|
|
|
|
+ @todo Usually doesn't work. Should be fixed or removed. Most of the time, if `Stopped` it set, the print fails and is unrecoverable.
|
|
|
|
+ */
|
|
case 999:
|
|
case 999:
|
|
Stopped = false;
|
|
Stopped = false;
|
|
lcd_reset_alert_level();
|
|
lcd_reset_alert_level();
|
|
gcode_LastN = Stopped_gcode_LastN;
|
|
gcode_LastN = Stopped_gcode_LastN;
|
|
FlushSerialRequestResend();
|
|
FlushSerialRequestResend();
|
|
break;
|
|
break;
|
|
|
|
+
|
|
|
|
+ #### End of M-Commands
|
|
|
|
+ */
|
|
default:
|
|
default:
|
|
printf_P(PSTR("Unknown M code: %s \n"), cmdbuffer + bufindr + CMDHDRSIZE);
|
|
printf_P(PSTR("Unknown M code: %s \n"), cmdbuffer + bufindr + CMDHDRSIZE);
|
|
}
|
|
}
|
|
@@ -7726,19 +8548,16 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ -----------------------------------------------------------------------------------------
|
|
-
|
|
+ # T Codes
|
|
-
|
|
+ T<extruder nr.> - select extruder in case of multi extruder printer. select filament in case of MMU_V2.
|
|
-
|
|
+ #### For MMU_V2:
|
|
-
|
|
+ T<n> Gcode to extrude at least 38.10 mm at feedrate 19.02 mm/s must follow immediately to load to extruder wheels.
|
|
-
|
|
+ @n T? Gcode to extrude shouldn't have to follow, load to extruder wheels is done automatically
|
|
-
|
|
+ @n Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
|
|
-
|
|
+ @n Tc Load to nozzle after filament was prepared by Tc and extruder nozzle is already heated.
|
|
-
|
|
+ */
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
else if(code_seen('T'))
|
|
else if(code_seen('T'))
|
|
{
|
|
{
|
|
int index;
|
|
int index;
|
|
@@ -7827,15 +8646,8 @@ Sigma_Exit:
|
|
else
|
|
else
|
|
{
|
|
{
|
|
#ifdef SNMM
|
|
#ifdef SNMM
|
|
-
|
|
|
|
-#ifdef LIN_ADVANCE
|
|
|
|
- if (mmu_extruder != tmp_extruder)
|
|
|
|
- clear_current_adv_vars();
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
mmu_extruder = tmp_extruder;
|
|
mmu_extruder = tmp_extruder;
|
|
|
|
|
|
-
|
|
|
|
_delay(100);
|
|
_delay(100);
|
|
|
|
|
|
disable_e0();
|
|
disable_e0();
|
|
@@ -7922,95 +8734,197 @@ Sigma_Exit:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ #### End of T-Codes
|
|
|
|
+ */
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ *---------------------------------------------------------------------------------
|
|
|
|
+ *# D codes
|
|
|
|
+ */
|
|
else if (code_seen('D'))
|
|
else if (code_seen('D'))
|
|
{
|
|
{
|
|
switch((int)code_value())
|
|
switch((int)code_value())
|
|
{
|
|
{
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D-1 - Endless Loop <a href="https://reprap.org/wiki/G-code#D-1:_Endless_Loop">D-1: Endless Loop</a>
|
|
|
|
+ */
|
|
case -1:
|
|
case -1:
|
|
dcode__1(); break;
|
|
dcode__1(); break;
|
|
#ifdef DEBUG_DCODES
|
|
#ifdef DEBUG_DCODES
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D0 - Reset <a href="https://reprap.org/wiki/G-code#D0:_Reset">D0: Reset</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D0 [ B ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `B` - Bootloader
|
|
|
|
+ */
|
|
case 0:
|
|
case 0:
|
|
dcode_0(); break;
|
|
dcode_0(); break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ *
|
|
|
|
+ ### D1 - Clear EEPROM and RESET <a href="https://reprap.org/wiki/G-code#D1:_Clear_EEPROM_and_RESET">D1: Clear EEPROM and RESET</a>
|
|
|
|
+
|
|
|
|
+ D1
|
|
|
|
+
|
|
|
|
+ *
|
|
|
|
+ */
|
|
case 1:
|
|
case 1:
|
|
dcode_1(); break;
|
|
dcode_1(); break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D2 - Read/Write RAM <a href="https://reprap.org/wiki/G-code#D2:_Read.2FWrite_RAM">D3: Read/Write RAM</a>
|
|
|
|
+ This command can be used without any additional parameters. It will read the entire RAM.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D3 [ A | C | X ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `A` - Address (0x0000-0x1fff)
|
|
|
|
+ - `C` - Count (0x0001-0x2000)
|
|
|
|
+ - `X` - Data
|
|
|
|
+ */
|
|
case 2:
|
|
case 2:
|
|
dcode_2(); break;
|
|
dcode_2(); break;
|
|
#endif
|
|
#endif
|
|
#ifdef DEBUG_DCODE3
|
|
#ifdef DEBUG_DCODE3
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D3 - Read/Write EEPROM <a href="https://reprap.org/wiki/G-code#D3:_Read.2FWrite_EEPROM">D3: Read/Write EEPROM</a>
|
|
|
|
+ This command can be used without any additional parameters. It will read the entire eeprom.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D3 [ A | C | X ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `A` - Address (0x0000-0x0fff)
|
|
|
|
+ - `C` - Count (0x0001-0x1000)
|
|
|
|
+ - `X` - Data
|
|
|
|
+ */
|
|
case 3:
|
|
case 3:
|
|
dcode_3(); break;
|
|
dcode_3(); break;
|
|
#endif
|
|
#endif
|
|
#ifdef DEBUG_DCODES
|
|
#ifdef DEBUG_DCODES
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+
|
|
|
|
+ ### D4 - Read/Write PIN <a href="https://reprap.org/wiki/G-code#D4:_Read.2FWrite_PIN">D4: Read/Write PIN</a>
|
|
|
|
+ To read the digital value of a pin you need only to define the pin number.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D4 [ P | F | V ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `P` - Pin (0-255)
|
|
|
|
+ - `F` - Function in/out (0/1)
|
|
|
|
+ - `V` - Value (0/1)
|
|
|
|
+ */
|
|
case 4:
|
|
case 4:
|
|
dcode_4(); break;
|
|
dcode_4(); break;
|
|
#endif
|
|
#endif
|
|
#ifdef DEBUG_DCODE5
|
|
#ifdef DEBUG_DCODE5
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D5 - Read/Write FLASH <a href="https://reprap.org/wiki/G-code#D5:_Read.2FWrite_FLASH">D5: Read/Write Flash</a>
|
|
|
|
+ This command can be used without any additional parameters. It will read the 1kb FLASH.
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D3 [ A | C | X | E ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `A` - Address (0x00000-0x3ffff)
|
|
|
|
+ - `C` - Count (0x0001-0x2000)
|
|
|
|
+ - `X` - Data
|
|
|
|
+ - `E` - Erase
|
|
|
|
+ */
|
|
case 5:
|
|
case 5:
|
|
dcode_5(); break;
|
|
dcode_5(); break;
|
|
break;
|
|
break;
|
|
#endif
|
|
#endif
|
|
#ifdef DEBUG_DCODES
|
|
#ifdef DEBUG_DCODES
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D6 - Read/Write external FLASH <a href="https://reprap.org/wiki/G-code#D6:_Read.2FWrite_external_FLASH">D6: Read/Write external Flash</a>
|
|
|
|
+ Reserved
|
|
|
|
+ */
|
|
case 6:
|
|
case 6:
|
|
dcode_6(); break;
|
|
dcode_6(); break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D7 - Read/Write Bootloader <a href="https://reprap.org/wiki/G-code#D7:_Read.2FWrite_Bootloader">D7: Read/Write Bootloader</a>
|
|
|
|
+ Reserved
|
|
|
|
+ */
|
|
case 7:
|
|
case 7:
|
|
dcode_7(); break;
|
|
dcode_7(); break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D8 - Read/Write PINDA <a href="https://reprap.org/wiki/G-code#D8:_Read.2FWrite_PINDA">D8: Read/Write PINDA</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D8 [ ? | ! | P | Z ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `?` - Read PINDA temperature shift values
|
|
|
|
+ - `!` - Reset PINDA temperature shift values to default
|
|
|
|
+ - `P` - Pinda temperature [C]
|
|
|
|
+ - `Z` - Z Offset [mm]
|
|
|
|
+ */
|
|
case 8:
|
|
case 8:
|
|
dcode_8(); break;
|
|
dcode_8(); break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D9 - Read ADC <a href="https://reprap.org/wiki/G-code#D9:_Read.2FWrite_ADC">D9: Read ADC</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D9 [ I | V ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `I` - ADC channel index
|
|
|
|
+ - `0` - Heater 0 temperature
|
|
|
|
+ - `1` - Heater 1 temperature
|
|
|
|
+ - `2` - Bed temperature
|
|
|
|
+ - `3` - PINDA temperature
|
|
|
|
+ - `4` - PWR voltage
|
|
|
|
+ - `5` - Ambient temperature
|
|
|
|
+ - `6` - BED voltage
|
|
|
|
+ - `V` Value to be written as simulated
|
|
|
|
+ */
|
|
case 9:
|
|
case 9:
|
|
dcode_9(); break;
|
|
dcode_9(); break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D10 - Set XYZ calibration = OK <a href="https://reprap.org/wiki/G-code#D10:_Set_XYZ_calibration_.3D_OK">D10: Set XYZ calibration = OK</a>
|
|
|
|
+ */
|
|
case 10:
|
|
case 10:
|
|
dcode_10(); break;
|
|
dcode_10(); break;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ### D12 - Time <a href="https://reprap.org/wiki/G-code#D12:_Time">D12: Time</a>
|
|
|
|
+ Writes the actual time in the log file.
|
|
|
|
+ */
|
|
|
|
+
|
|
#endif
|
|
#endif
|
|
#ifdef HEATBED_ANALYSIS
|
|
#ifdef HEATBED_ANALYSIS
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D80 - Bed check <a href="https://reprap.org/wiki/G-code#D80:_Bed_check">D80: Bed check</a>
|
|
-
|
|
+ This command will log data to SD card file "mesh.txt".
|
|
- - `E` - dimension x
|
|
+ #### Usage
|
|
- - `F` - dimention y
|
|
+
|
|
- - `G` - points_x
|
|
+ D80 [ E | F | G | H | I | J ]
|
|
- - `H` - points_y
|
|
+
|
|
- - `I` - offset_x
|
|
+ #### Parameters
|
|
- - `J` - offset_y
|
|
+ - `E` - Dimension X (default 40)
|
|
|
|
+ - `F` - Dimention Y (default 40)
|
|
|
|
+ - `G` - Points X (default 40)
|
|
|
|
+ - `H` - Points Y (default 40)
|
|
|
|
+ - `I` - Offset X (default 74)
|
|
|
|
+ - `J` - Offset Y (default 34)
|
|
*/
|
|
*/
|
|
case 80:
|
|
case 80:
|
|
{
|
|
{
|
|
@@ -8036,15 +8950,20 @@ Sigma_Exit:
|
|
bed_check(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
|
|
bed_check(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
|
|
}break;
|
|
}break;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D81 - Bed analysis <a href="https://reprap.org/wiki/G-code#D81:_Bed_analysis">D80: Bed analysis</a>
|
|
-
|
|
+ This command will log data to SD card file "wldsd.txt".
|
|
- - `E` - dimension x
|
|
+ #### Usage
|
|
- - `F` - dimention y
|
|
+
|
|
- - `G` - points_x
|
|
+ D81 [ E | F | G | H | I | J ]
|
|
- - `H` - points_y
|
|
+
|
|
- - `I` - offset_x
|
|
+ #### Parameters
|
|
- - `J` - offset_y
|
|
+ - `E` - Dimension X (default 40)
|
|
|
|
+ - `F` - Dimention Y (default 40)
|
|
|
|
+ - `G` - Points X (default 40)
|
|
|
|
+ - `H` - Points Y (default 40)
|
|
|
|
+ - `I` - Offset X (default 74)
|
|
|
|
+ - `J` - Offset Y (default 34)
|
|
*/
|
|
*/
|
|
case 81:
|
|
case 81:
|
|
{
|
|
{
|
|
@@ -8069,8 +8988,9 @@ Sigma_Exit:
|
|
#endif
|
|
#endif
|
|
#ifdef DEBUG_DCODES
|
|
#ifdef DEBUG_DCODES
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D106 - Print measured fan speed for different pwm values <a href="https://reprap.org/wiki/G-code#D106:_Print_measured_fan_speed_for_different_pwm_values">D106: Print measured fan speed for different pwm values</a>
|
|
|
|
+ */
|
|
case 106:
|
|
case 106:
|
|
{
|
|
{
|
|
for (int i = 255; i > 0; i = i - 5) {
|
|
for (int i = 255; i > 0; i = i - 5) {
|
|
@@ -8085,42 +9005,61 @@ Sigma_Exit:
|
|
}break;
|
|
}break;
|
|
|
|
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
-
|
|
+
|
|
-
|
|
+ ### D2130 - Trinamic stepper controller <a href="https://reprap.org/wiki/G-code#D2130:_Trinamic_stepper_controller">D2130: Trinamic stepper controller</a>
|
|
-
|
|
+ @todo Please review by owner of the code. RepRap Wiki Gcode needs to be updated after review of owner as well.
|
|
-
|
|
+
|
|
-
|
|
+ #### Usage
|
|
-
|
|
+
|
|
-
|
|
+ D2130 [ Axis | Command | Subcommand | Value ]
|
|
- D2130<axis><command>[subcommand][value]
|
|
+
|
|
-
|
|
+ #### Parameters
|
|
- - <command>:
|
|
+ - Axis
|
|
- - '0' current off
|
|
+ - `X` - X stepper driver
|
|
- - '1' current on
|
|
+ - `Y` - Y stepper driver
|
|
- - '+' single step
|
|
+ - `Z` - Z stepper driver
|
|
- - * value sereval steps
|
|
+ - `E` - Extruder stepper driver
|
|
- - '-' dtto oposite direction
|
|
+ - Commands
|
|
- - '?' read register
|
|
+ - `0` - Current off
|
|
- - * "mres"
|
|
+ - `1` - Current on
|
|
- - * "step"
|
|
+ - `+` - Single step
|
|
- - * "mscnt"
|
|
+ - `-` - Single step oposite direction
|
|
- - * "mscuract"
|
|
+ - `NNN` - Value sereval steps
|
|
- - * "wave"
|
|
+ - `?` - Read register
|
|
- - '!' set register
|
|
+ - Subcommands for read register
|
|
- - * "mres"
|
|
+ - `mres` - Micro step resolution. More information in datasheet '5.5.2 CHOPCONF – Chopper Configuration'
|
|
- - * "step"
|
|
+ - `step` - Step
|
|
- - * "wave"
|
|
+ - `mscnt` - Microstep counter. More information in datasheet '5.5 Motor Driver Registers'
|
|
- - '@' home calibrate axis
|
|
+ - `mscuract` - Actual microstep current for motor. More information in datasheet '5.5 Motor Driver Registers'
|
|
-
|
|
+ - `wave` - Microstep linearity compensation curve
|
|
- Example:
|
|
+ - `!` - Set register
|
|
-
|
|
+ - Subcommands for set register
|
|
- D2130E?wave ... print extruder microstep linearity compensation curve
|
|
+ - `mres` - Micro step resolution
|
|
-
|
|
+ - `step` - Step
|
|
- D2130E!wave0 ... disable extruder linearity compensation curve, (sine curve is used)
|
|
+ - `wave` - Microstep linearity compensation curve
|
|
-
|
|
+ - Values for set register
|
|
- D2130E!wave220 ... (sin(x))^1.1 extruder microstep compensation curve used
|
|
+ - `0, 180 --> 250` - Off
|
|
- */
|
|
+ - `0.9 --> 1.25` - Valid values (recommended is 1.1)
|
|
-
|
|
+ - `@` - Home calibrate axis
|
|
|
|
+
|
|
|
|
+ Examples:
|
|
|
|
+
|
|
|
|
+ D2130E?wave
|
|
|
|
+
|
|
|
|
+ Print extruder microstep linearity compensation curve
|
|
|
|
+
|
|
|
|
+ D2130E!wave0
|
|
|
|
+
|
|
|
|
+ Disable extruder linearity compensation curve, (sine curve is used)
|
|
|
|
+
|
|
|
|
+ D2130E!wave220
|
|
|
|
+
|
|
|
|
+ (sin(x))^1.1 extruder microstep compensation curve used
|
|
|
|
+
|
|
|
|
+ Notes:
|
|
|
|
+ For more information see https:
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
|
|
case 2130:
|
|
case 2130:
|
|
dcode_2130(); break;
|
|
dcode_2130(); break;
|
|
@@ -8128,8 +9067,20 @@ Sigma_Exit:
|
|
|
|
|
|
#if (defined (FILAMENT_SENSOR) && defined(PAT9125))
|
|
#if (defined (FILAMENT_SENSOR) && defined(PAT9125))
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+ ### D9125 - PAT9125 filament sensor <a href="https://reprap.org/wiki/G-code#D9:_Read.2FWrite_ADC">D9125: PAT9125 filament sensor</a>
|
|
|
|
+ #### Usage
|
|
|
|
+
|
|
|
|
+ D9125 [ ? | ! | R | X | Y | L ]
|
|
|
|
+
|
|
|
|
+ #### Parameters
|
|
|
|
+ - `?` - Print values
|
|
|
|
+ - `!` - Print values
|
|
|
|
+ - `R` - Resolution. Not active in code
|
|
|
|
+ - `X` - X values
|
|
|
|
+ - `Y` - Y values
|
|
|
|
+ - `L` - Activate filament sensor log
|
|
|
|
+ */
|
|
case 9125:
|
|
case 9125:
|
|
dcode_9125(); break;
|
|
dcode_9125(); break;
|
|
#endif
|
|
#endif
|
|
@@ -8149,7 +9100,9 @@ Sigma_Exit:
|
|
ClearToSend();
|
|
ClearToSend();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
|
|
+#### End of D-Codes
|
|
|
|
+*/
|
|
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
@@ -8217,7 +9170,7 @@ void get_coordinates()
|
|
for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
if(code_seen(axis_codes[i]))
|
|
if(code_seen(axis_codes[i]))
|
|
{
|
|
{
|
|
- bool relative = axis_relative_modes[i] || relative_mode;
|
|
+ bool relative = axis_relative_modes[i];
|
|
destination[i] = (float)code_value();
|
|
destination[i] = (float)code_value();
|
|
if (i == E_AXIS) {
|
|
if (i == E_AXIS) {
|
|
float emult = extruder_multiplier[active_extruder];
|
|
float emult = extruder_multiplier[active_extruder];
|
|
@@ -8300,38 +9253,43 @@ void clamp_to_software_endstops(float target[3])
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef MESH_BED_LEVELING
|
|
#ifdef MESH_BED_LEVELING
|
|
- void mesh_plan_buffer_line(const float &x, const float &y, const float &z, const float &e, const float &feed_rate, const uint8_t extruder) {
|
|
+void mesh_plan_buffer_line(const float &x, const float &y, const float &z, const float &e, const float &feed_rate, const uint8_t extruder) {
|
|
float dx = x - current_position[X_AXIS];
|
|
float dx = x - current_position[X_AXIS];
|
|
float dy = y - current_position[Y_AXIS];
|
|
float dy = y - current_position[Y_AXIS];
|
|
- float dz = z - current_position[Z_AXIS];
|
|
|
|
int n_segments = 0;
|
|
int n_segments = 0;
|
|
-
|
|
+
|
|
if (mbl.active) {
|
|
if (mbl.active) {
|
|
float len = abs(dx) + abs(dy);
|
|
float len = abs(dx) + abs(dy);
|
|
if (len > 0)
|
|
if (len > 0)
|
|
|
|
|
|
n_segments = int(ceil(len / 30.f));
|
|
n_segments = int(ceil(len / 30.f));
|
|
}
|
|
}
|
|
-
|
|
+
|
|
if (n_segments > 1) {
|
|
if (n_segments > 1) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ float gcode_target[NUM_AXIS];
|
|
|
|
+ gcode_target[X_AXIS] = x;
|
|
|
|
+ gcode_target[Y_AXIS] = y;
|
|
|
|
+ gcode_target[Z_AXIS] = z;
|
|
|
|
+ gcode_target[E_AXIS] = e;
|
|
|
|
+
|
|
|
|
+ float dz = z - current_position[Z_AXIS];
|
|
float de = e - current_position[E_AXIS];
|
|
float de = e - current_position[E_AXIS];
|
|
|
|
+
|
|
for (int i = 1; i < n_segments; ++ i) {
|
|
for (int i = 1; i < n_segments; ++ i) {
|
|
float t = float(i) / float(n_segments);
|
|
float t = float(i) / float(n_segments);
|
|
- if (saved_printing || (mbl.active == false)) return;
|
|
+ plan_buffer_line(current_position[X_AXIS] + t * dx,
|
|
- plan_buffer_line(
|
|
|
|
- current_position[X_AXIS] + t * dx,
|
|
|
|
current_position[Y_AXIS] + t * dy,
|
|
current_position[Y_AXIS] + t * dy,
|
|
current_position[Z_AXIS] + t * dz,
|
|
current_position[Z_AXIS] + t * dz,
|
|
current_position[E_AXIS] + t * de,
|
|
current_position[E_AXIS] + t * de,
|
|
- feed_rate, extruder);
|
|
+ feed_rate, extruder, gcode_target);
|
|
|
|
+ if (waiting_inside_plan_buffer_line_print_aborted)
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
- current_position[X_AXIS] = x;
|
|
|
|
- current_position[Y_AXIS] = y;
|
|
|
|
- current_position[Z_AXIS] = z;
|
|
|
|
- current_position[E_AXIS] = e;
|
|
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -8352,9 +9310,7 @@ void prepare_move()
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
- for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
+ set_current_to_destination();
|
|
- current_position[i] = destination[i];
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void prepare_arc_move(char isclockwise) {
|
|
void prepare_arc_move(char isclockwise) {
|
|
@@ -8562,7 +9518,7 @@ if(0)
|
|
|
|
|
|
if( (_millis() - previous_millis_cmd) > max_inactive_time )
|
|
if( (_millis() - previous_millis_cmd) > max_inactive_time )
|
|
if(max_inactive_time)
|
|
if(max_inactive_time)
|
|
- kill(_n(""), 4);
|
|
+ kill(_n("Inactivity Shutdown"), 4);
|
|
if(stepper_inactive_time) {
|
|
if(stepper_inactive_time) {
|
|
if( (_millis() - previous_millis_cmd) > stepper_inactive_time )
|
|
if( (_millis() - previous_millis_cmd) > stepper_inactive_time )
|
|
{
|
|
{
|
|
@@ -8603,7 +9559,7 @@ if(0)
|
|
|
|
|
|
if ( killCount >= KILL_DELAY)
|
|
if ( killCount >= KILL_DELAY)
|
|
{
|
|
{
|
|
- kill("", 5);
|
|
+ kill(NULL, 5);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -8681,6 +9637,16 @@ void kill(const char *full_screen_message, unsigned char id)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
void Stop()
|
|
void Stop()
|
|
{
|
|
{
|
|
disable_heater();
|
|
disable_heater();
|
|
@@ -8865,12 +9831,15 @@ void delay_keep_alive(unsigned int ms)
|
|
}
|
|
}
|
|
|
|
|
|
static void wait_for_heater(long codenum, uint8_t extruder) {
|
|
static void wait_for_heater(long codenum, uint8_t extruder) {
|
|
|
|
+ if (!degTargetHotend(extruder))
|
|
|
|
+ return;
|
|
|
|
|
|
#ifdef TEMP_RESIDENCY_TIME
|
|
#ifdef TEMP_RESIDENCY_TIME
|
|
long residencyStart;
|
|
long residencyStart;
|
|
residencyStart = -1;
|
|
residencyStart = -1;
|
|
|
|
|
|
_and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
|
|
_and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
|
|
|
|
+ cancel_heatup = false;
|
|
while ((!cancel_heatup) && ((residencyStart == -1) ||
|
|
while ((!cancel_heatup) && ((residencyStart == -1) ||
|
|
(residencyStart >= 0 && (((unsigned int)(_millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))))) {
|
|
(residencyStart >= 0 && (((unsigned int)(_millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))))) {
|
|
#else
|
|
#else
|
|
@@ -9073,10 +10042,8 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi
|
|
destination[X_AXIS] = ix * (x_dimension / (x_points_num - 1)) + shift_x;
|
|
destination[X_AXIS] = ix * (x_dimension / (x_points_num - 1)) + shift_x;
|
|
destination[Y_AXIS] = iy * (y_dimension / (y_points_num - 1)) + shift_y;
|
|
destination[Y_AXIS] = iy * (y_dimension / (y_points_num - 1)) + shift_y;
|
|
|
|
|
|
- mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], XY_AXIS_FEEDRATE/6, active_extruder);
|
|
+ mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], XY_AXIS_FEEDRATE/6, active_extruder);
|
|
- for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
+ set_current_to_destination();
|
|
- current_position[i] = destination[i];
|
|
|
|
- }
|
|
|
|
st_synchronize();
|
|
st_synchronize();
|
|
|
|
|
|
|
|
|
|
@@ -9491,12 +10458,10 @@ float temp_compensation_pinda_thermistor_offset(float temperature_pinda)
|
|
void long_pause()
|
|
void long_pause()
|
|
{
|
|
{
|
|
st_synchronize();
|
|
st_synchronize();
|
|
-
|
|
|
|
start_pause_print = _millis();
|
|
start_pause_print = _millis();
|
|
|
|
|
|
-
|
|
+
|
|
- current_position[E_AXIS] -= default_retraction;
|
|
+ setAllTargetHotends(0);
|
|
- plan_buffer_line_curposXYZE(400, active_extruder);
|
|
|
|
|
|
|
|
|
|
|
|
current_position[Z_AXIS] += Z_PAUSE_LIFT;
|
|
current_position[Z_AXIS] += Z_PAUSE_LIFT;
|
|
@@ -9510,8 +10475,6 @@ void long_pause()
|
|
|
|
|
|
|
|
|
|
fanSpeed = 0;
|
|
fanSpeed = 0;
|
|
-
|
|
|
|
- st_synchronize();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void serialecho_temperatures() {
|
|
void serialecho_temperatures() {
|
|
@@ -9532,6 +10495,11 @@ void uvlo_()
|
|
unsigned long time_start = _millis();
|
|
unsigned long time_start = _millis();
|
|
bool sd_print = card.sdprinting;
|
|
bool sd_print = card.sdprinting;
|
|
|
|
|
|
|
|
+#ifdef LCD_BL_PIN
|
|
|
|
+ backlightMode = BACKLIGHT_MODE_DIM;
|
|
|
|
+ backlightLevel_LOW = 0;
|
|
|
|
+ backlight_update();
|
|
|
|
+#endif
|
|
disable_x();
|
|
disable_x();
|
|
disable_y();
|
|
disable_y();
|
|
|
|
|
|
@@ -9563,8 +10531,18 @@ void uvlo_()
|
|
if (sd_position < 0) sd_position = 0;
|
|
if (sd_position < 0) sd_position = 0;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
- int feedrate_bckp = blocks_queued() ? (block_buffer[block_buffer_tail].nominal_speed * 60.f) : feedrate;
|
|
+ uint16_t feedrate_bckp;
|
|
|
|
+ if (blocks_queued())
|
|
|
|
+ {
|
|
|
|
+ memcpy(saved_target, current_block->gcode_target, sizeof(saved_target));
|
|
|
|
+ feedrate_bckp = current_block->gcode_feedrate;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ saved_target[0] = SAVED_TARGET_UNSET;
|
|
|
|
+ feedrate_bckp = feedrate;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -9631,7 +10609,8 @@ void uvlo_()
|
|
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4), current_position[Y_AXIS]);
|
|
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4), current_position[Y_AXIS]);
|
|
eeprom_update_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z , current_position[Z_AXIS]);
|
|
eeprom_update_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z , current_position[Z_AXIS]);
|
|
|
|
|
|
- EEPROM_save_B(EEPROM_UVLO_FEEDRATE, &feedrate_bckp);
|
|
+ eeprom_update_word((uint16_t*)EEPROM_UVLO_FEEDRATE, feedrate_bckp);
|
|
|
|
+ EEPROM_save_B(EEPROM_UVLO_FEEDMULTIPLY, &feedmultiply);
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_HOTEND, target_temperature[active_extruder]);
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_HOTEND, target_temperature[active_extruder]);
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_BED, target_temperature_bed);
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_BED, target_temperature_bed);
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO_FAN_SPEED, fanSpeed);
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO_FAN_SPEED, fanSpeed);
|
|
@@ -9644,6 +10623,16 @@ void uvlo_()
|
|
#endif
|
|
#endif
|
|
eeprom_update_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY), (uint16_t)extrudemultiply);
|
|
eeprom_update_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY), (uint16_t)extrudemultiply);
|
|
|
|
|
|
|
|
+
|
|
|
|
+ eeprom_update_float((float*)(EEPROM_UVLO_SAVED_TARGET+0*4), saved_target[X_AXIS]);
|
|
|
|
+ eeprom_update_float((float*)(EEPROM_UVLO_SAVED_TARGET+1*4), saved_target[Y_AXIS]);
|
|
|
|
+ eeprom_update_float((float*)(EEPROM_UVLO_SAVED_TARGET+2*4), saved_target[Z_AXIS]);
|
|
|
|
+ eeprom_update_float((float*)(EEPROM_UVLO_SAVED_TARGET+3*4), saved_target[E_AXIS]);
|
|
|
|
+
|
|
|
|
+#ifdef LIN_ADVANCE
|
|
|
|
+ eeprom_update_float((float*)(EEPROM_UVLO_LA_K), extruder_advance_K);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
|
|
if(sd_print) eeprom_update_byte((uint8_t*)EEPROM_UVLO, 1);
|
|
if(sd_print) eeprom_update_byte((uint8_t*)EEPROM_UVLO, 1);
|
|
|
|
|
|
@@ -9891,10 +10880,21 @@ void recover_machine_state_after_power_panic(bool bTiny)
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#endif
|
|
extrudemultiply = (int)eeprom_read_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY));
|
|
extrudemultiply = (int)eeprom_read_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ saved_target[X_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_SAVED_TARGET+0*4));
|
|
|
|
+ saved_target[Y_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_SAVED_TARGET+1*4));
|
|
|
|
+ saved_target[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_SAVED_TARGET+2*4));
|
|
|
|
+ saved_target[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_SAVED_TARGET+3*4));
|
|
|
|
+
|
|
|
|
+#ifdef LIN_ADVANCE
|
|
|
|
+ extruder_advance_K = eeprom_read_float((float*)EEPROM_UVLO_LA_K);
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
void restore_print_from_eeprom() {
|
|
void restore_print_from_eeprom() {
|
|
int feedrate_rec;
|
|
int feedrate_rec;
|
|
|
|
+ int feedmultiply_rec;
|
|
uint8_t fan_speed_rec;
|
|
uint8_t fan_speed_rec;
|
|
char cmd[30];
|
|
char cmd[30];
|
|
char filename[13];
|
|
char filename[13];
|
|
@@ -9902,9 +10902,12 @@ void restore_print_from_eeprom() {
|
|
char dir_name[9];
|
|
char dir_name[9];
|
|
|
|
|
|
fan_speed_rec = eeprom_read_byte((uint8_t*)EEPROM_UVLO_FAN_SPEED);
|
|
fan_speed_rec = eeprom_read_byte((uint8_t*)EEPROM_UVLO_FAN_SPEED);
|
|
- EEPROM_read_B(EEPROM_UVLO_FEEDRATE, &feedrate_rec);
|
|
+ feedrate_rec = eeprom_read_word((uint16_t*)EEPROM_UVLO_FEEDRATE);
|
|
|
|
+ EEPROM_read_B(EEPROM_UVLO_FEEDMULTIPLY, &feedmultiply_rec);
|
|
SERIAL_ECHOPGM("Feedrate:");
|
|
SERIAL_ECHOPGM("Feedrate:");
|
|
- MYSERIAL.println(feedrate_rec);
|
|
+ MYSERIAL.print(feedrate_rec);
|
|
|
|
+ SERIAL_ECHOPGM(", feedmultiply:");
|
|
|
|
+ MYSERIAL.println(feedmultiply_rec);
|
|
|
|
|
|
depth = eeprom_read_byte((uint8_t*)EEPROM_DIR_DEPTH);
|
|
depth = eeprom_read_byte((uint8_t*)EEPROM_DIR_DEPTH);
|
|
|
|
|
|
@@ -9945,9 +10948,11 @@ void restore_print_from_eeprom() {
|
|
enquecommand(cmd);
|
|
enquecommand(cmd);
|
|
|
|
|
|
enquecommand_P(PSTR("G1 E" STRINGIFY(2*default_retraction)" F480"));
|
|
enquecommand_P(PSTR("G1 E" STRINGIFY(2*default_retraction)" F480"));
|
|
-
|
|
+
|
|
sprintf_P(cmd, PSTR("G1 F%d"), feedrate_rec);
|
|
sprintf_P(cmd, PSTR("G1 F%d"), feedrate_rec);
|
|
enquecommand(cmd);
|
|
enquecommand(cmd);
|
|
|
|
+ sprintf_P(cmd, PSTR("M220 S%d"), feedmultiply_rec);
|
|
|
|
+ enquecommand(cmd);
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS))
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS))
|
|
{
|
|
{
|
|
enquecommand_P(PSTR("M82"));
|
|
enquecommand_P(PSTR("M82"));
|
|
@@ -10099,20 +11104,23 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#if 0
|
|
+
|
|
- saved_feedrate2 = feedrate;
|
|
+ if (blocks_queued())
|
|
-#else
|
|
+ {
|
|
-
|
|
+ memcpy(saved_target, current_block->gcode_target, sizeof(saved_target));
|
|
-
|
|
+ saved_feedrate2 = current_block->gcode_feedrate;
|
|
- saved_feedrate2 = blocks_queued() ? (block_buffer[block_buffer_tail].nominal_speed * 60.f) : feedrate;
|
|
+ }
|
|
-#endif
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ saved_target[0] = SAVED_TARGET_UNSET;
|
|
|
|
+ saved_feedrate2 = feedrate;
|
|
|
|
+ }
|
|
|
|
|
|
planner_abort_hard();
|
|
planner_abort_hard();
|
|
memcpy(saved_pos, current_position, sizeof(saved_pos));
|
|
memcpy(saved_pos, current_position, sizeof(saved_pos));
|
|
|
|
+ saved_feedmultiply2 = feedmultiply;
|
|
saved_active_extruder = active_extruder;
|
|
saved_active_extruder = active_extruder;
|
|
saved_extruder_temperature = degTargetHotend(active_extruder);
|
|
saved_extruder_temperature = degTargetHotend(active_extruder);
|
|
-
|
|
|
|
- saved_extruder_under_pressure = extruder_under_pressure;
|
|
|
|
saved_extruder_relative_mode = axis_relative_modes[E_AXIS];
|
|
saved_extruder_relative_mode = axis_relative_modes[E_AXIS];
|
|
saved_fanSpeed = fanSpeed;
|
|
saved_fanSpeed = fanSpeed;
|
|
cmdqueue_reset();
|
|
cmdqueue_reset();
|
|
@@ -10124,26 +11132,34 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
|
sei();
|
|
sei();
|
|
if ((z_move != 0) || (e_move != 0)) {
|
|
if ((z_move != 0) || (e_move != 0)) {
|
|
#if 1
|
|
#if 1
|
|
-
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
char buf[48];
|
|
char buf[48];
|
|
|
|
|
|
-
|
|
+ if(e_move)
|
|
- if(!saved_extruder_relative_mode){
|
|
+ {
|
|
- enquecommand(PSTR("M83"), true);
|
|
+
|
|
- }
|
|
+ if(!saved_extruder_relative_mode){
|
|
-
|
|
+ enquecommand(PSTR("M83"), true);
|
|
-
|
|
+ }
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- sprintf_P(buf, PSTR("G1 E%-0.3f F2700"), e_move);
|
|
+
|
|
- enquecommand(buf, false);
|
|
+
|
|
-
|
|
+ sprintf_P(buf, PSTR("G1 E%-0.3f F2700"), e_move);
|
|
-
|
|
+ enquecommand(buf, false);
|
|
- sprintf_P(buf, PSTR("G1 Z%-0.3f F%-0.3f"), saved_pos[Z_AXIS] + z_move, homing_feedrate[Z_AXIS]);
|
|
+ }
|
|
-
|
|
+
|
|
- enquecommand(buf, false);
|
|
+ if(z_move)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ sprintf_P(buf, PSTR("G1 Z%-0.3f F%-0.3f"), saved_pos[Z_AXIS] + z_move, homing_feedrate[Z_AXIS]);
|
|
|
|
+ enquecommand(buf, false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
repeatcommand_front();
|
|
repeatcommand_front();
|
|
@@ -10153,6 +11169,7 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
|
memcpy(current_position, saved_pos, sizeof(saved_pos));
|
|
memcpy(current_position, saved_pos, sizeof(saved_pos));
|
|
memcpy(destination, current_position, sizeof(destination));
|
|
memcpy(destination, current_position, sizeof(destination));
|
|
#endif
|
|
#endif
|
|
|
|
+ waiting_inside_plan_buffer_line_print_aborted = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -10186,7 +11203,6 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
wait_for_heater(_millis(), saved_active_extruder);
|
|
wait_for_heater(_millis(), saved_active_extruder);
|
|
heating_status = 2;
|
|
heating_status = 2;
|
|
}
|
|
}
|
|
- feedrate = saved_feedrate2;
|
|
|
|
axis_relative_modes[E_AXIS] = saved_extruder_relative_mode;
|
|
axis_relative_modes[E_AXIS] = saved_extruder_relative_mode;
|
|
float e = saved_pos[E_AXIS] - e_move;
|
|
float e = saved_pos[E_AXIS] - e_move;
|
|
plan_set_e_position(e);
|
|
plan_set_e_position(e);
|
|
@@ -10197,18 +11213,20 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
|
|
|
|
|
|
|
|
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], current_position[Z_AXIS], saved_pos[E_AXIS] - e_move, homing_feedrate[Z_AXIS]/13, active_extruder);
|
|
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], current_position[Z_AXIS], saved_pos[E_AXIS] - e_move, homing_feedrate[Z_AXIS]/13, active_extruder);
|
|
- st_synchronize();
|
|
|
|
|
|
|
|
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], saved_pos[E_AXIS] - e_move, homing_feedrate[Z_AXIS]/13, active_extruder);
|
|
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], saved_pos[E_AXIS] - e_move, homing_feedrate[Z_AXIS]/13, active_extruder);
|
|
- st_synchronize();
|
|
|
|
|
|
|
|
- plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], saved_pos[E_AXIS], 35, active_extruder);
|
|
+ plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], saved_pos[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
|
|
st_synchronize();
|
|
st_synchronize();
|
|
|
|
|
|
#ifdef FANCHECK
|
|
#ifdef FANCHECK
|
|
fans_check_enabled = true;
|
|
fans_check_enabled = true;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+
|
|
|
|
+ feedrate = saved_feedrate2;
|
|
|
|
+ feedmultiply = saved_feedmultiply2;
|
|
|
|
+
|
|
memcpy(current_position, saved_pos, sizeof(saved_pos));
|
|
memcpy(current_position, saved_pos, sizeof(saved_pos));
|
|
memcpy(destination, current_position, sizeof(destination));
|
|
memcpy(destination, current_position, sizeof(destination));
|
|
if (saved_printing_type == PRINTING_TYPE_SD) {
|
|
if (saved_printing_type == PRINTING_TYPE_SD) {
|
|
@@ -10224,10 +11242,20 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
else {
|
|
else {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
SERIAL_PROTOCOLLNRPGM(MSG_OK);
|
|
SERIAL_PROTOCOLLNRPGM(MSG_OK);
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
saved_printing_type = PRINTING_TYPE_NONE;
|
|
saved_printing_type = PRINTING_TYPE_NONE;
|
|
saved_printing = false;
|
|
saved_printing = false;
|
|
|
|
+ waiting_inside_plan_buffer_line_print_aborted = true;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void cancel_saved_printing()
|
|
|
|
+{
|
|
|
|
+ saved_target[0] = SAVED_TARGET_UNSET;
|
|
|
|
+ saved_printing_type = PRINTING_TYPE_NONE;
|
|
|
|
+ saved_printing = false;
|
|
}
|
|
}
|
|
|
|
|
|
void print_world_coordinates()
|
|
void print_world_coordinates()
|