|
@@ -47,7 +47,9 @@
|
|
|
#include "Configuration.h"
|
|
|
#include "Marlin.h"
|
|
|
#include "config.h"
|
|
|
-
|
|
|
+
|
|
|
+#include "macros.h"
|
|
|
+
|
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
|
#include "vector_3.h"
|
|
|
#ifdef AUTO_BED_LEVELING_GRID
|
|
@@ -137,12 +139,6 @@
|
|
|
#include "sound.h"
|
|
|
|
|
|
#include "cmdqueue.h"
|
|
|
-#include "io_atmega2560.h"
|
|
|
-
|
|
|
-// Macros for bit masks
|
|
|
-#define BIT(b) (1<<(b))
|
|
|
-#define TEST(n,b) (((n)&BIT(b))!=0)
|
|
|
-#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b))
|
|
|
|
|
|
//Macro for print fan speed
|
|
|
#define FAN_PULSE_WIDTH_LIMIT ((fanSpeed > 100) ? 3 : 4) //time in ms
|
|
@@ -202,8 +198,6 @@ int bowden_length[4] = {385, 385, 385, 385};
|
|
|
bool is_usb_printing = false;
|
|
|
bool homing_flag = false;
|
|
|
|
|
|
-bool temp_cal_active = false;
|
|
|
-
|
|
|
unsigned long kicktime = _millis()+100000;
|
|
|
|
|
|
unsigned int usb_printing_counter;
|
|
@@ -395,6 +389,11 @@ static int saved_fanSpeed = 0; //!< Print fan speed
|
|
|
|
|
|
static int saved_feedmultiply_mm = 100;
|
|
|
|
|
|
+#ifdef AUTO_REPORT_TEMPERATURES
|
|
|
+static LongTimer auto_report_temp_timer;
|
|
|
+static uint8_t auto_report_temp_period = 0;
|
|
|
+#endif //AUTO_REPORT_TEMPERATURES
|
|
|
+
|
|
|
//===========================================================================
|
|
|
//=============================Routines======================================
|
|
|
//===========================================================================
|
|
@@ -404,6 +403,7 @@ static bool setTargetedHotend(int code, uint8_t &extruder);
|
|
|
static void print_time_remaining_init();
|
|
|
static void wait_for_heater(long codenum, uint8_t extruder);
|
|
|
static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis);
|
|
|
+static void gcode_M105(uint8_t extruder);
|
|
|
static void temp_compensation_start();
|
|
|
static void temp_compensation_apply();
|
|
|
|
|
@@ -650,6 +650,12 @@ void failstats_reset_print()
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+void softReset()
|
|
|
+{
|
|
|
+ cli();
|
|
|
+ wdt_enable(WDTO_15MS);
|
|
|
+ while(1);
|
|
|
+}
|
|
|
|
|
|
|
|
|
#ifdef MESH_BED_LEVELING
|
|
@@ -764,6 +770,7 @@ static void factory_reset(char level)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ softReset();
|
|
|
|
|
|
|
|
|
break;
|
|
@@ -869,14 +876,14 @@ static void check_if_fw_is_on_right_printer(){
|
|
|
swi2c_init();
|
|
|
const uint8_t pat9125_detected = swi2c_readByte_A8(PAT9125_I2C_ADDR,0x00,NULL);
|
|
|
if (pat9125_detected){
|
|
|
- lcd_show_fullscreen_message_and_wait_P(_i("MK3S firmware detected on MK3 printer"));}
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("MK3S firmware detected on MK3 printer"));}////c=20 r=3
|
|
|
#endif //IR_SENSOR
|
|
|
|
|
|
#ifdef PAT9125
|
|
|
//will return 1 only if IR can detect filament in bondtech extruder so this may fail even when we have IR sensor
|
|
|
- const uint8_t ir_detected = !(PIN_GET(IR_SENSOR_PIN));
|
|
|
+ const uint8_t ir_detected = !READ(IR_SENSOR_PIN);
|
|
|
if (ir_detected){
|
|
|
- lcd_show_fullscreen_message_and_wait_P(_i("MK3 firmware detected on MK3S printer"));}
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("MK3 firmware detected on MK3S printer"));}////c=20 r=3
|
|
|
#endif //PAT9125
|
|
|
}
|
|
|
#endif //FILAMENT_SENSOR
|
|
@@ -1014,11 +1021,19 @@ void setup()
|
|
|
lcd_splash();
|
|
|
Sound_Init(); // also guarantee "SET_OUTPUT(BEEPER)"
|
|
|
|
|
|
+ selectedSerialPort = eeprom_read_byte((uint8_t *)EEPROM_SECOND_SERIAL_ACTIVE);
|
|
|
+ if (selectedSerialPort == 0xFF) selectedSerialPort = 0;
|
|
|
+ eeprom_update_byte((uint8_t *)EEPROM_SECOND_SERIAL_ACTIVE, selectedSerialPort);
|
|
|
+ MYSERIAL.begin(BAUDRATE);
|
|
|
+ fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream
|
|
|
+ stdout = uartout;
|
|
|
+
|
|
|
#ifdef W25X20CL
|
|
|
bool w25x20cl_success = w25x20cl_init();
|
|
|
+ uint8_t optiboot_status = 1;
|
|
|
if (w25x20cl_success)
|
|
|
{
|
|
|
- optiboot_w25x20cl_enter();
|
|
|
+ optiboot_status = optiboot_w25x20cl_enter();
|
|
|
#if (LANG_MODE != 0) //secondary language support
|
|
|
update_sec_lang_from_external_flash();
|
|
|
#endif //(LANG_MODE != 0)
|
|
@@ -1040,15 +1055,13 @@ void setup()
|
|
|
if ((farm_mode == 0xFF && farm_no == 0) || ((uint16_t)farm_no == 0xFFFF))
|
|
|
farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode
|
|
|
if ((uint16_t)farm_no == 0xFFFF) farm_no = 0;
|
|
|
-
|
|
|
- selectedSerialPort = eeprom_read_byte((uint8_t*)EEPROM_SECOND_SERIAL_ACTIVE);
|
|
|
- if (selectedSerialPort == 0xFF) selectedSerialPort = 0;
|
|
|
if (farm_mode)
|
|
|
{
|
|
|
no_response = true; //we need confirmation by recieving PRUSA thx
|
|
|
important_status = 8;
|
|
|
prusa_statistics(8);
|
|
|
selectedSerialPort = 1;
|
|
|
+ MYSERIAL.begin(BAUDRATE);
|
|
|
#ifdef TMC2130
|
|
|
//increased extruder current (PFW363)
|
|
|
tmc2130_current_h[E_AXIS] = 36;
|
|
@@ -1062,12 +1075,12 @@ void setup()
|
|
|
if(!(eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED)))
|
|
|
eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED,true);
|
|
|
}
|
|
|
- MYSERIAL.begin(BAUDRATE);
|
|
|
- fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream
|
|
|
#ifndef W25X20CL
|
|
|
SERIAL_PROTOCOLLNPGM("start");
|
|
|
-#endif //W25X20CL
|
|
|
- stdout = uartout;
|
|
|
+#else
|
|
|
+ if ((optiboot_status != 0) || (selectedSerialPort != 0))
|
|
|
+ SERIAL_PROTOCOLLNPGM("start");
|
|
|
+#endif
|
|
|
SERIAL_ECHO_START;
|
|
|
printf_P(PSTR(" " FW_VERSION_FULL "\n"));
|
|
|
|
|
@@ -1246,6 +1259,13 @@ void setup()
|
|
|
w25x20cl_err_msg();
|
|
|
printf_P(_n("W25X20CL not responding.\n"));
|
|
|
}
|
|
|
+#ifdef EXTRUDER_ALTFAN_DETECT
|
|
|
+ SERIAL_ECHORPGM(_n("Extruder fan type: "));
|
|
|
+ if (extruder_altfan_detect())
|
|
|
+ SERIAL_ECHOLNRPGM(PSTR("ALTFAN"));
|
|
|
+ else
|
|
|
+ SERIAL_ECHOLNRPGM(PSTR("NOCTUA"));
|
|
|
+#endif //EXTRUDER_ALTFAN_DETECT
|
|
|
|
|
|
plan_init(); // Initialize planner;
|
|
|
|
|
@@ -1332,8 +1352,7 @@ void setup()
|
|
|
// Initialize current_position accounting for software endstops to
|
|
|
// avoid unexpected initial shifts on the first move
|
|
|
clamp_to_software_endstops(current_position);
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS],
|
|
|
- current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
|
|
|
#ifdef FILAMENT_SENSOR
|
|
|
fsensor_init();
|
|
@@ -1453,8 +1472,7 @@ void setup()
|
|
|
|
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE) == 255) {
|
|
|
eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0);
|
|
|
- temp_cal_active = false;
|
|
|
- } else temp_cal_active = eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE);
|
|
|
+ }
|
|
|
|
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA) == 255) {
|
|
|
//eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0);
|
|
@@ -1462,7 +1480,6 @@ void setup()
|
|
|
int16_t z_shift = 0;
|
|
|
for (uint8_t i = 0; i < 5; i++) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
|
|
|
eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0);
|
|
|
- temp_cal_active = false;
|
|
|
}
|
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 255) {
|
|
|
eeprom_write_byte((uint8_t*)EEPROM_UVLO, 0);
|
|
@@ -1515,7 +1532,7 @@ void setup()
|
|
|
}
|
|
|
|
|
|
if (!previous_settings_retrieved) {
|
|
|
- lcd_show_fullscreen_message_and_wait_P(_i("Old settings found. Default PID, Esteps etc. will be set.")); //if EEPROM version or printer type was changed, inform user that default setting were loaded////MSG_DEFAULT_SETTINGS_LOADED c=20 r=4
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("Old settings found. Default PID, Esteps etc. will be set.")); //if EEPROM version or printer type was changed, inform user that default setting were loaded////MSG_DEFAULT_SETTINGS_LOADED c=20 r=5
|
|
|
Config_StoreSettings();
|
|
|
}
|
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
|
|
@@ -1535,7 +1552,7 @@ void setup()
|
|
|
lcd_show_fullscreen_message_and_wait_P(_T(MSG_BABYSTEP_Z_NOT_SET));
|
|
|
lcd_update_enable(true);
|
|
|
}
|
|
|
- else if (calibration_status() == CALIBRATION_STATUS_CALIBRATED && temp_cal_active == true && calibration_status_pinda() == false) {
|
|
|
+ else if (calibration_status() == CALIBRATION_STATUS_CALIBRATED && eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE) && calibration_status_pinda() == false) {
|
|
|
//lcd_show_fullscreen_message_and_wait_P(_i("Temperature calibration has not been run yet"));////MSG_PINDA_NOT_CALIBRATED c=20 r=4
|
|
|
lcd_update_enable(true);
|
|
|
}
|
|
@@ -1712,6 +1729,18 @@ void host_keepalive() {
|
|
|
#endif //HOST_KEEPALIVE_FEATURE
|
|
|
if (farm_mode) return;
|
|
|
long ms = _millis();
|
|
|
+
|
|
|
+#ifdef AUTO_REPORT_TEMPERATURES
|
|
|
+ if (auto_report_temp_timer.running())
|
|
|
+ {
|
|
|
+ if (auto_report_temp_timer.expired(auto_report_temp_period * 1000ul))
|
|
|
+ {
|
|
|
+ gcode_M105(active_extruder);
|
|
|
+ auto_report_temp_timer.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif //AUTO_REPORT_TEMPERATURES
|
|
|
+
|
|
|
if (host_keepalive_interval && busy_state != NOT_BUSY) {
|
|
|
if ((ms - prev_busy_signal_ms) < (long)(1000L * host_keepalive_interval)) return;
|
|
|
switch (busy_state) {
|
|
@@ -1948,7 +1977,7 @@ static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
|
|
|
// put the bed at 0 so we don't go below it.
|
|
|
current_position[Z_AXIS] = cs.zprobe_zoffset; // in the lsq we reach here after raising the extruder due to the loop structure
|
|
|
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
}
|
|
|
|
|
|
#else // not AUTO_BED_LEVELING_GRID
|
|
@@ -1976,7 +2005,7 @@ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float
|
|
|
// put the bed at 0 so we don't go below it.
|
|
|
current_position[Z_AXIS] = cs.zprobe_zoffset;
|
|
|
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -2008,7 +2037,7 @@ static void run_z_probe() {
|
|
|
|
|
|
current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
|
|
|
// make sure the planner knows where we are as it may be a bit different than we last said to move to
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
}
|
|
|
|
|
|
static void do_blocking_move_to(float x, float y, float z) {
|
|
@@ -2066,15 +2095,16 @@ static float probe_pt(float x, float y, float z_before) {
|
|
|
inline void gcode_M900() {
|
|
|
float newK = code_seen('K') ? code_value_float() : -2;
|
|
|
#ifdef LA_NOCOMPAT
|
|
|
- if (newK >= 0 && newK < 10)
|
|
|
+ if (newK >= 0 && newK < LA_K_MAX)
|
|
|
extruder_advance_K = newK;
|
|
|
else
|
|
|
SERIAL_ECHOLNPGM("K out of allowed range!");
|
|
|
#else
|
|
|
if (newK == 0)
|
|
|
+ {
|
|
|
extruder_advance_K = 0;
|
|
|
- else if (newK == -1)
|
|
|
la10c_reset();
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
newK = la10c_value(newK);
|
|
@@ -2128,7 +2158,7 @@ void raise_z_above(float target, bool plan)
|
|
|
if (axis_known_position[Z_AXIS] || z_min_endstop)
|
|
|
{
|
|
|
// current position is known or very low, it's safe to raise Z
|
|
|
- if(plan) plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS], active_extruder);
|
|
|
+ if(plan) plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS]);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -2141,15 +2171,14 @@ void raise_z_above(float target, bool plan)
|
|
|
#ifdef TMC2130
|
|
|
tmc2130_home_enter(Z_AXIS_MASK);
|
|
|
#endif //TMC2130
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60);
|
|
|
st_synchronize();
|
|
|
#ifdef TMC2130
|
|
|
if (endstop_z_hit_on_purpose())
|
|
|
{
|
|
|
// not necessarily exact, but will avoid further vertical moves
|
|
|
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]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
}
|
|
|
tmc2130_home_exit();
|
|
|
#endif //TMC2130
|
|
@@ -2167,22 +2196,22 @@ bool calibrate_z_auto()
|
|
|
int axis_up_dir = -home_dir(Z_AXIS);
|
|
|
tmc2130_home_enter(Z_AXIS_MASK);
|
|
|
current_position[Z_AXIS] = 0;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
set_destination_to_current();
|
|
|
destination[Z_AXIS] += (1.1 * max_length(Z_AXIS) * axis_up_dir);
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate / 60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate / 60);
|
|
|
st_synchronize();
|
|
|
// current_position[axis] = 0;
|
|
|
- // plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ // plan_set_position_curposXYZE();
|
|
|
tmc2130_home_exit();
|
|
|
enable_endstops(false);
|
|
|
current_position[Z_AXIS] = 0;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
set_destination_to_current();
|
|
|
destination[Z_AXIS] += 10 * axis_up_dir; //10mm up
|
|
|
feedrate = homing_feedrate[Z_AXIS] / 2;
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate / 60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate / 60);
|
|
|
st_synchronize();
|
|
|
enable_endstops(endstops_enabled);
|
|
|
if (PRINTER_TYPE == PRINTER_MK3) {
|
|
@@ -2191,15 +2220,30 @@ bool calibrate_z_auto()
|
|
|
else {
|
|
|
current_position[Z_AXIS] = Z_MAX_POS + 9.0;
|
|
|
}
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
return true;
|
|
|
}
|
|
|
#endif //TMC2130
|
|
|
|
|
|
#ifdef TMC2130
|
|
|
-bool homeaxis(int axis, bool doError, uint8_t cnt, uint8_t* pstep)
|
|
|
+static void check_Z_crash(void)
|
|
|
+{
|
|
|
+ if (READ(Z_TMC2130_DIAG) != 0) { //Z crash
|
|
|
+ FORCE_HIGH_POWER_END;
|
|
|
+ current_position[Z_AXIS] = 0;
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
+ current_position[Z_AXIS] += MESH_HOME_Z_SEARCH;
|
|
|
+ plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS]);
|
|
|
+ st_synchronize();
|
|
|
+ kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
|
|
|
+ }
|
|
|
+}
|
|
|
+#endif //TMC2130
|
|
|
+
|
|
|
+#ifdef TMC2130
|
|
|
+void homeaxis(int axis, uint8_t cnt, uint8_t* pstep)
|
|
|
#else
|
|
|
-bool homeaxis(int axis, bool doError, uint8_t cnt)
|
|
|
+void homeaxis(int axis, uint8_t cnt)
|
|
|
#endif //TMC2130
|
|
|
{
|
|
|
bool endstops_enabled = enable_endstops(true); //RP: endstops should be allways enabled durring homing
|
|
@@ -2219,24 +2263,24 @@ bool homeaxis(int axis, bool doError, uint8_t cnt)
|
|
|
// and the following movement to endstop has a chance to achieve the required velocity
|
|
|
// for the stall guard to work.
|
|
|
current_position[axis] = 0;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
set_destination_to_current();
|
|
|
// destination[axis] = 11.f;
|
|
|
destination[axis] = -3.f * axis_home_dir;
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
// Move away from the possible collision with opposite endstop with the collision detection disabled.
|
|
|
endstops_hit_on_purpose();
|
|
|
enable_endstops(false);
|
|
|
current_position[axis] = 0;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
destination[axis] = 1. * axis_home_dir;
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
// Now continue to move up to the left end stop with the collision detection enabled.
|
|
|
enable_endstops(true);
|
|
|
destination[axis] = 1.1 * axis_home_dir * max_length(axis);
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
for (uint8_t i = 0; i < cnt; i++)
|
|
|
{
|
|
@@ -2244,9 +2288,9 @@ bool homeaxis(int axis, bool doError, uint8_t cnt)
|
|
|
endstops_hit_on_purpose();
|
|
|
enable_endstops(false);
|
|
|
current_position[axis] = 0;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
destination[axis] = -10.f * axis_home_dir;
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
endstops_hit_on_purpose();
|
|
|
// Now move left up to the collision, this time with a repeatable velocity.
|
|
@@ -2257,7 +2301,7 @@ bool homeaxis(int axis, bool doError, uint8_t cnt)
|
|
|
#else //TMC2130
|
|
|
feedrate = homing_feedrate[axis] / 2;
|
|
|
#endif //TMC2130
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
#ifdef TMC2130
|
|
|
uint16_t mscnt = tmc2130_rd_MSCNT(axis);
|
|
@@ -2291,10 +2335,10 @@ bool homeaxis(int axis, bool doError, uint8_t cnt)
|
|
|
float dist = - axis_home_dir * 0.01f * 64;
|
|
|
#endif //TMC2130
|
|
|
current_position[axis] -= dist;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
current_position[axis] += dist;
|
|
|
destination[axis] = current_position[axis];
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], 0.5f*feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(0.5f*feedrate/60);
|
|
|
st_synchronize();
|
|
|
|
|
|
feedrate = 0.0;
|
|
@@ -2306,37 +2350,25 @@ bool homeaxis(int axis, bool doError, uint8_t cnt)
|
|
|
#endif
|
|
|
int axis_home_dir = home_dir(axis);
|
|
|
current_position[axis] = 0;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
|
|
feedrate = homing_feedrate[axis];
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
#ifdef TMC2130
|
|
|
- if (READ(Z_TMC2130_DIAG) != 0) { //Z crash
|
|
|
- FORCE_HIGH_POWER_END;
|
|
|
- if (doError) kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
|
|
|
- current_position[axis] = -5; //assume that nozzle crashed into bed
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ check_Z_crash();
|
|
|
#endif //TMC2130
|
|
|
current_position[axis] = 0;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
destination[axis] = -home_retract_mm(axis) * axis_home_dir;
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
|
|
|
feedrate = homing_feedrate[axis]/2 ;
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
#ifdef TMC2130
|
|
|
- if (READ(Z_TMC2130_DIAG) != 0) { //Z crash
|
|
|
- FORCE_HIGH_POWER_END;
|
|
|
- if (doError) kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
|
|
|
- current_position[axis] = -5; //assume that nozzle crashed into bed
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ check_Z_crash();
|
|
|
#endif //TMC2130
|
|
|
axis_is_at_home(axis);
|
|
|
destination[axis] = current_position[axis];
|
|
@@ -2348,7 +2380,6 @@ bool homeaxis(int axis, bool doError, uint8_t cnt)
|
|
|
#endif
|
|
|
}
|
|
|
enable_endstops(endstops_enabled);
|
|
|
- return 1;
|
|
|
}
|
|
|
|
|
|
/**/
|
|
@@ -2357,7 +2388,7 @@ void home_xy()
|
|
|
set_destination_to_current();
|
|
|
homeaxis(X_AXIS);
|
|
|
homeaxis(Y_AXIS);
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
endstops_hit_on_purpose();
|
|
|
}
|
|
|
|
|
@@ -2380,7 +2411,7 @@ void refresh_cmd_timeout(void)
|
|
|
retracted[active_extruder]=true;
|
|
|
prepare_move();
|
|
|
current_position[Z_AXIS]-=cs.retract_zlift;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
prepare_move();
|
|
|
feedrate = oldFeedrate;
|
|
|
} else if(!retracting && retracted[active_extruder]) {
|
|
@@ -2389,7 +2420,7 @@ void refresh_cmd_timeout(void)
|
|
|
destination[Z_AXIS]=current_position[Z_AXIS];
|
|
|
destination[E_AXIS]=current_position[E_AXIS];
|
|
|
current_position[Z_AXIS]+=cs.retract_zlift;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
current_position[E_AXIS]-=(swapretract?(retract_length_swap+retract_recover_length_swap):(cs.retract_length+cs.retract_recover_length))*float(extrudemultiply)*0.01f;
|
|
|
plan_set_e_position(current_position[E_AXIS]);
|
|
|
float oldFeedrate = feedrate;
|
|
@@ -2513,6 +2544,96 @@ void force_high_power_mode(bool start_high_power_section) {
|
|
|
}
|
|
|
#endif //TMC2130
|
|
|
|
|
|
+void gcode_M105(uint8_t extruder)
|
|
|
+{
|
|
|
+#if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
|
|
|
+ SERIAL_PROTOCOLPGM("T:");
|
|
|
+ SERIAL_PROTOCOL_F(degHotend(extruder),1);
|
|
|
+ SERIAL_PROTOCOLPGM(" /");
|
|
|
+ SERIAL_PROTOCOL_F(degTargetHotend(extruder),1);
|
|
|
+#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
|
+ SERIAL_PROTOCOLPGM(" B:");
|
|
|
+ SERIAL_PROTOCOL_F(degBed(),1);
|
|
|
+ SERIAL_PROTOCOLPGM(" /");
|
|
|
+ SERIAL_PROTOCOL_F(degTargetBed(),1);
|
|
|
+#endif //TEMP_BED_PIN
|
|
|
+ for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
|
|
|
+ SERIAL_PROTOCOLPGM(" T");
|
|
|
+ SERIAL_PROTOCOL(cur_extruder);
|
|
|
+ SERIAL_PROTOCOL(':');
|
|
|
+ SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
|
|
|
+ SERIAL_PROTOCOLPGM(" /");
|
|
|
+ SERIAL_PROTOCOL_F(degTargetHotend(cur_extruder),1);
|
|
|
+ }
|
|
|
+#else
|
|
|
+ SERIAL_ERROR_START;
|
|
|
+ SERIAL_ERRORLNRPGM(_i("No thermistors - no temperature"));////MSG_ERR_NO_THERMISTORS
|
|
|
+#endif
|
|
|
+
|
|
|
+ SERIAL_PROTOCOLPGM(" @:");
|
|
|
+#ifdef EXTRUDER_WATTS
|
|
|
+ SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(tmp_extruder))/127);
|
|
|
+ SERIAL_PROTOCOLPGM("W");
|
|
|
+#else
|
|
|
+ SERIAL_PROTOCOL(getHeaterPower(extruder));
|
|
|
+#endif
|
|
|
+
|
|
|
+ SERIAL_PROTOCOLPGM(" B@:");
|
|
|
+#ifdef BED_WATTS
|
|
|
+ SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1))/127);
|
|
|
+ SERIAL_PROTOCOLPGM("W");
|
|
|
+#else
|
|
|
+ SERIAL_PROTOCOL(getHeaterPower(-1));
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifdef PINDA_THERMISTOR
|
|
|
+ SERIAL_PROTOCOLPGM(" P:");
|
|
|
+ SERIAL_PROTOCOL_F(current_temperature_pinda,1);
|
|
|
+#endif //PINDA_THERMISTOR
|
|
|
+
|
|
|
+#ifdef AMBIENT_THERMISTOR
|
|
|
+ SERIAL_PROTOCOLPGM(" A:");
|
|
|
+ SERIAL_PROTOCOL_F(current_temperature_ambient,1);
|
|
|
+#endif //AMBIENT_THERMISTOR
|
|
|
+
|
|
|
+
|
|
|
+#ifdef SHOW_TEMP_ADC_VALUES
|
|
|
+ {
|
|
|
+ float raw = 0.0;
|
|
|
+#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
|
+ SERIAL_PROTOCOLPGM(" ADC B:");
|
|
|
+ SERIAL_PROTOCOL_F(degBed(),1);
|
|
|
+ SERIAL_PROTOCOLPGM("C->");
|
|
|
+ raw = rawBedTemp();
|
|
|
+ SERIAL_PROTOCOL_F(raw/OVERSAMPLENR,5);
|
|
|
+ SERIAL_PROTOCOLPGM(" Rb->");
|
|
|
+ SERIAL_PROTOCOL_F(100 * (1 + (PtA * (raw/OVERSAMPLENR)) + (PtB * sq((raw/OVERSAMPLENR)))), 5);
|
|
|
+ SERIAL_PROTOCOLPGM(" Rxb->");
|
|
|
+ SERIAL_PROTOCOL_F(raw, 5);
|
|
|
+#endif
|
|
|
+ for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
|
|
|
+ SERIAL_PROTOCOLPGM(" T");
|
|
|
+ SERIAL_PROTOCOL(cur_extruder);
|
|
|
+ SERIAL_PROTOCOLPGM(":");
|
|
|
+ SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
|
|
|
+ SERIAL_PROTOCOLPGM("C->");
|
|
|
+ raw = rawHotendTemp(cur_extruder);
|
|
|
+ SERIAL_PROTOCOL_F(raw/OVERSAMPLENR,5);
|
|
|
+ SERIAL_PROTOCOLPGM(" Rt");
|
|
|
+ SERIAL_PROTOCOL(cur_extruder);
|
|
|
+ SERIAL_PROTOCOLPGM("->");
|
|
|
+ SERIAL_PROTOCOL_F(100 * (1 + (PtA * (raw/OVERSAMPLENR)) + (PtB * sq((raw/OVERSAMPLENR)))), 5);
|
|
|
+ SERIAL_PROTOCOLPGM(" Rx");
|
|
|
+ SERIAL_PROTOCOL(cur_extruder);
|
|
|
+ SERIAL_PROTOCOLPGM("->");
|
|
|
+ SERIAL_PROTOCOL_F(raw, 5);
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ SERIAL_PROTOCOLLN("");
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY);
|
|
|
+}
|
|
|
+
|
|
|
#ifdef TMC2130
|
|
|
static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl)
|
|
|
#else
|
|
@@ -2592,7 +2713,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
|
|
|
int x_axis_home_dir = home_dir(X_AXIS);
|
|
|
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS);
|
|
|
feedrate = homing_feedrate[X_AXIS];
|
|
|
if(homing_feedrate[Y_AXIS]<feedrate)
|
|
@@ -2602,15 +2723,15 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
} else {
|
|
|
feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1);
|
|
|
}
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
st_synchronize();
|
|
|
|
|
|
axis_is_at_home(X_AXIS);
|
|
|
axis_is_at_home(Y_AXIS);
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
destination[X_AXIS] = current_position[X_AXIS];
|
|
|
destination[Y_AXIS] = current_position[Y_AXIS];
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
feedrate = 0.0;
|
|
|
st_synchronize();
|
|
|
endstops_hit_on_purpose();
|
|
@@ -2674,14 +2795,14 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
MYSERIAL.println(current_position[X_AXIS]);MYSERIAL.println(current_position[Y_AXIS]);
|
|
|
MYSERIAL.println(current_position[Z_AXIS]);MYSERIAL.println(current_position[E_AXIS]);
|
|
|
#endif
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
#ifdef DEBUG_BUILD
|
|
|
SERIAL_ECHOLNPGM("plan_buffer_line()");
|
|
|
MYSERIAL.println(destination[X_AXIS]);MYSERIAL.println(destination[Y_AXIS]);
|
|
|
MYSERIAL.println(destination[Z_AXIS]);MYSERIAL.println(destination[E_AXIS]);
|
|
|
MYSERIAL.println(feedrate);MYSERIAL.println(active_extruder);
|
|
|
#endif
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate);
|
|
|
st_synchronize();
|
|
|
current_position[X_AXIS] = destination[X_AXIS];
|
|
|
current_position[Y_AXIS] = destination[Y_AXIS];
|
|
@@ -2700,8 +2821,8 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
feedrate = XY_TRAVEL_SPEED/60;
|
|
|
current_position[Z_AXIS] = 0;
|
|
|
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate);
|
|
|
st_synchronize();
|
|
|
current_position[X_AXIS] = destination[X_AXIS];
|
|
|
current_position[Y_AXIS] = destination[Y_AXIS];
|
|
@@ -2717,10 +2838,10 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
&& (current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER <= Y_MAX_POS)) {
|
|
|
|
|
|
current_position[Z_AXIS] = 0;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1); // Set destination away from bed
|
|
|
feedrate = max_feedrate[Z_AXIS];
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate);
|
|
|
st_synchronize();
|
|
|
|
|
|
homeaxis(Z_AXIS);
|
|
@@ -2747,7 +2868,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
|
// Set the planner and stepper routine positions.
|
|
|
// At this point the mesh bed leveling and world2machine corrections are disabled and current_position
|
|
|
// contains the machine coordinates.
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
|
|
|
#ifdef ENDSTOPS_ONLY_FOR_HOMING
|
|
|
enable_endstops(false);
|
|
@@ -2859,7 +2980,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
enable_endstops(false);
|
|
|
current_position[X_AXIS] += 5;
|
|
|
current_position[Y_AXIS] += 5;
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
|
|
|
st_synchronize();
|
|
|
|
|
|
// Let the user move the Z axes up to the end stoppers.
|
|
@@ -2909,7 +3030,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
|
|
|
bool endstops_enabled = enable_endstops(false);
|
|
|
current_position[Z_AXIS] -= 1; //move 1mm down with disabled endstop
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
|
|
|
st_synchronize();
|
|
|
|
|
|
// Move the print head close to the bed.
|
|
@@ -2920,7 +3041,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
tmc2130_home_enter(Z_AXIS_MASK);
|
|
|
#endif //TMC2130
|
|
|
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
|
|
|
|
|
|
st_synchronize();
|
|
|
#ifdef TMC2130
|
|
@@ -2961,7 +3082,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
clean_up_after_endstop_move(l_feedmultiply);
|
|
|
// Print head up.
|
|
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
|
|
|
st_synchronize();
|
|
|
//#ifndef NEW_XYZCAL
|
|
|
if (result >= 0)
|
|
@@ -2981,7 +3102,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
clean_up_after_endstop_move(l_feedmultiply);
|
|
|
// Print head up.
|
|
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
|
|
|
st_synchronize();
|
|
|
// if (result >= 0) babystep_apply();
|
|
|
#endif //HEATBED_V2
|
|
@@ -3094,18 +3215,18 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
|
|
|
|
|
|
//Retract E
|
|
|
current_position[E_AXIS] += e_shift;
|
|
|
- plan_buffer_line_curposXYZE(FILAMENTCHANGE_RFEED, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(FILAMENTCHANGE_RFEED);
|
|
|
st_synchronize();
|
|
|
|
|
|
//Lift Z
|
|
|
current_position[Z_AXIS] += z_shift;
|
|
|
- plan_buffer_line_curposXYZE(FILAMENTCHANGE_ZFEED, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(FILAMENTCHANGE_ZFEED);
|
|
|
st_synchronize();
|
|
|
|
|
|
//Move XY to side
|
|
|
current_position[X_AXIS] = x_position;
|
|
|
current_position[Y_AXIS] = y_position;
|
|
|
- plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED);
|
|
|
st_synchronize();
|
|
|
|
|
|
//Beep, manage nozzle heater and wait for user to start unload filament
|
|
@@ -3130,7 +3251,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_T(MSG_PLEASE_WAIT));
|
|
|
current_position[X_AXIS] -= 100;
|
|
|
- plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED);
|
|
|
st_synchronize();
|
|
|
lcd_show_fullscreen_message_and_wait_P(_i("Please open idler and remove filament manually."));////MSG_CHECK_IDLER c=20 r=4
|
|
|
}
|
|
@@ -3167,7 +3288,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
|
|
|
if (!automatic)
|
|
|
{
|
|
|
current_position[E_AXIS] += FILAMENTCHANGE_RECFEED;
|
|
|
- plan_buffer_line_curposXYZE(FILAMENTCHANGE_EXFEED, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(FILAMENTCHANGE_EXFEED);
|
|
|
}
|
|
|
|
|
|
//Move XY back
|
|
@@ -3225,12 +3346,12 @@ void gcode_M701()
|
|
|
|
|
|
lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT));
|
|
|
current_position[E_AXIS] += 40;
|
|
|
- plan_buffer_line_curposXYZE(400 / 60, active_extruder); //fast sequence
|
|
|
+ plan_buffer_line_curposXYZE(400 / 60); //fast sequence
|
|
|
st_synchronize();
|
|
|
|
|
|
raise_z_above(MIN_Z_FOR_LOAD, false);
|
|
|
current_position[E_AXIS] += 30;
|
|
|
- plan_buffer_line_curposXYZE(400 / 60, active_extruder); //fast sequence
|
|
|
+ plan_buffer_line_curposXYZE(400 / 60); //fast sequence
|
|
|
|
|
|
load_filament_final_feed(); //slow sequence
|
|
|
st_synchronize();
|
|
@@ -3276,37 +3397,24 @@ void gcode_M701()
|
|
|
*/
|
|
|
static void gcode_PRUSA_SN()
|
|
|
{
|
|
|
- if (farm_mode) {
|
|
|
- selectedSerialPort = 0;
|
|
|
- putchar(';');
|
|
|
- putchar('S');
|
|
|
- int numbersRead = 0;
|
|
|
- ShortTimer timeout;
|
|
|
- timeout.start();
|
|
|
-
|
|
|
- while (numbersRead < 19) {
|
|
|
- while (MSerial.available() > 0) {
|
|
|
- uint8_t serial_char = MSerial.read();
|
|
|
- selectedSerialPort = 1;
|
|
|
- putchar(serial_char);
|
|
|
- numbersRead++;
|
|
|
- selectedSerialPort = 0;
|
|
|
- }
|
|
|
- if (timeout.expired(100u)) break;
|
|
|
+ uint8_t selectedSerialPort_bak = selectedSerialPort;
|
|
|
+ char SN[20];
|
|
|
+ selectedSerialPort = 0;
|
|
|
+ SERIAL_ECHOLNRPGM(PSTR(";S"));
|
|
|
+ uint8_t numbersRead = 0;
|
|
|
+ ShortTimer timeout;
|
|
|
+ timeout.start();
|
|
|
+
|
|
|
+ while (numbersRead < (sizeof(SN) - 1)) {
|
|
|
+ if (MSerial.available() > 0) {
|
|
|
+ SN[numbersRead] = MSerial.read();
|
|
|
+ numbersRead++;
|
|
|
}
|
|
|
- selectedSerialPort = 1;
|
|
|
- putchar('\n');
|
|
|
-#if 0
|
|
|
- for (int b = 0; b < 3; b++) {
|
|
|
- _tone(BEEPER, 110);
|
|
|
- _delay(50);
|
|
|
- _noTone(BEEPER);
|
|
|
- _delay(50);
|
|
|
- }
|
|
|
-#endif
|
|
|
- } else {
|
|
|
- puts_P(_N("Not in farm mode."));
|
|
|
+ if (timeout.expired(100u)) break;
|
|
|
}
|
|
|
+ SN[numbersRead] = 0;
|
|
|
+ selectedSerialPort = selectedSerialPort_bak;
|
|
|
+ SERIAL_ECHOLN(SN);
|
|
|
}
|
|
|
//! Detection of faulty RAMBo 1.1b boards equipped with bigger capacitors
|
|
|
//! at the TACH_1 pin, which causes bad detection of print fan speed.
|
|
@@ -3396,11 +3504,22 @@ static void gcode_G92()
|
|
|
current_position[E_AXIS] = values[E_AXIS];
|
|
|
|
|
|
// Set all at once
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS],
|
|
|
- current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#ifdef EXTENDED_CAPABILITIES_REPORT
|
|
|
+
|
|
|
+static void cap_line(const char* name, bool ena = false) {
|
|
|
+ printf_P(PSTR("Cap:%S:%c\n"), name, (char)ena + '0');
|
|
|
+}
|
|
|
+
|
|
|
+static void extended_capabilities_report()
|
|
|
+{
|
|
|
+ cap_line(PSTR("AUTOREPORT_TEMP"), ENABLED(AUTO_REPORT_TEMPERATURES));
|
|
|
+ //@todo
|
|
|
+}
|
|
|
+#endif //EXTENDED_CAPABILITIES_REPORT
|
|
|
|
|
|
#ifdef BACKLASH_X
|
|
|
extern uint8_t st_backlash_x;
|
|
@@ -3494,6 +3613,7 @@ extern uint8_t st_backlash_y;
|
|
|
//!@n M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
|
|
//!@n M140 - Set bed target temp
|
|
|
//!@n M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
|
|
|
+//!@n M155 - Automatically send temperatures
|
|
|
//!@n M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
|
|
|
//! Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
|
|
|
//!@n M200 D<millimeters>- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
|
|
@@ -3804,9 +3924,7 @@ void process_commands()
|
|
|
#if (defined(WATCHDOG) && (MOTHERBOARD == BOARD_EINSY_1_0a))
|
|
|
boot_app_magic = BOOT_APP_MAGIC;
|
|
|
boot_app_flags = BOOT_APP_FLG_RUN;
|
|
|
- wdt_enable(WDTO_15MS);
|
|
|
- cli();
|
|
|
- while(1);
|
|
|
+ softReset();
|
|
|
#else //WATCHDOG
|
|
|
asm volatile("jmp 0x3E000");
|
|
|
#endif //WATCHDOG
|
|
@@ -4274,6 +4392,14 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
#endif //FWRETRACT
|
|
|
|
|
|
|
|
|
+ /*!
|
|
|
+ ### G21 - Sets Units to Millimters <a href="https://reprap.org/wiki/G-code#G21:_Set_Units_to_Millimeters">G21: Set Units to Millimeters</a>
|
|
|
+ Units are in millimeters. Prusa doesn't support inches.
|
|
|
+ */
|
|
|
+ case 21:
|
|
|
+ break; //Doing nothing. This is just to prevent serial UNKOWN warnings.
|
|
|
+
|
|
|
+
|
|
|
/*!
|
|
|
### 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).
|
|
@@ -4350,7 +4476,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
current_position[X_AXIS] = uncorrected_position.x;
|
|
|
current_position[Y_AXIS] = uncorrected_position.y;
|
|
|
current_position[Z_AXIS] = uncorrected_position.z;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
int l_feedmultiply = setup_for_endstop_move();
|
|
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
@@ -4464,7 +4590,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
|
|
|
current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner.
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
}
|
|
|
break;
|
|
|
#ifndef Z_PROBE_SLED
|
|
@@ -4552,11 +4678,15 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
/*!
|
|
|
### G76 - PINDA probe temperature calibration <a href="https://reprap.org/wiki/G-code#G76:_PINDA_probe_temperature_calibration">G76: PINDA probe temperature calibration</a>
|
|
|
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.
|
|
|
|
|
|
+ superPINDA sensor has internal temperature compensation and no thermistor output. There is no point of doing temperature calibration in such case.
|
|
|
+ If PINDA_THERMISTOR and DETECT_SUPERPINDA is defined during compilation, calibration is skipped with serial message "No PINDA thermistor".
|
|
|
+ This can be caused also if PINDA thermistor connection is broken or PINDA temperature is lower than PINDA_MINTEMP.
|
|
|
+
|
|
|
#### Example
|
|
|
|
|
|
```
|
|
@@ -4571,154 +4701,155 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
case 76:
|
|
|
{
|
|
|
#ifdef PINDA_THERMISTOR
|
|
|
- if (true)
|
|
|
- {
|
|
|
+ if (!has_temperature_compensation())
|
|
|
+ {
|
|
|
+ SERIAL_ECHOLNPGM("No PINDA thermistor");
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- if (calibration_status() >= CALIBRATION_STATUS_XYZ_CALIBRATION) {
|
|
|
- //we need to know accurate position of first calibration point
|
|
|
- //if xyz calibration was not performed yet, interrupt temperature calibration and inform user that xyz cal. is needed
|
|
|
- lcd_show_fullscreen_message_and_wait_P(_i("Please run XYZ calibration first."));
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
|
|
|
- {
|
|
|
- // We don't know where we are! HOME!
|
|
|
- // Push the commands to the front of the message queue in the reverse order!
|
|
|
- // There shall be always enough space reserved for these commands.
|
|
|
- repeatcommand_front(); // repeat G76 with all its parameters
|
|
|
- enquecommand_front_P((PSTR("G28 W0")));
|
|
|
- break;
|
|
|
- }
|
|
|
- lcd_show_fullscreen_message_and_wait_P(_i("Stable ambient temperature 21-26C is needed a rigid stand is required."));////MSG_TEMP_CAL_WARNING c=20 r=4
|
|
|
- bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_STEEL_SHEET_CHECK), false, false);
|
|
|
-
|
|
|
- if (result)
|
|
|
- {
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- current_position[Z_AXIS] = 50;
|
|
|
- current_position[Y_AXIS] = 180;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- st_synchronize();
|
|
|
- lcd_show_fullscreen_message_and_wait_P(_T(MSG_REMOVE_STEEL_SHEET));
|
|
|
- current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1);
|
|
|
- current_position[X_AXIS] = pgm_read_float(bed_ref_points_4);
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- st_synchronize();
|
|
|
- gcode_G28(false, false, true);
|
|
|
+ if (calibration_status() >= CALIBRATION_STATUS_XYZ_CALIBRATION) {
|
|
|
+ //we need to know accurate position of first calibration point
|
|
|
+ //if xyz calibration was not performed yet, interrupt temperature calibration and inform user that xyz cal. is needed
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("Please run XYZ calibration first."));
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- if ((current_temperature_pinda > 35) && (farm_mode == false)) {
|
|
|
- //waiting for PIDNA probe to cool down in case that we are not in farm mode
|
|
|
- current_position[Z_AXIS] = 100;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- if (lcd_wait_for_pinda(35) == false) { //waiting for PINDA probe to cool, if this takes more then time expected, temp. cal. fails
|
|
|
- lcd_temp_cal_show_result(false);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- lcd_update_enable(true);
|
|
|
- KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly
|
|
|
- SERIAL_ECHOLNPGM("PINDA probe calibration start");
|
|
|
+ if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
|
|
|
+ {
|
|
|
+ // We don't know where we are! HOME!
|
|
|
+ // Push the commands to the front of the message queue in the reverse order!
|
|
|
+ // There shall be always enough space reserved for these commands.
|
|
|
+ repeatcommand_front(); // repeat G76 with all its parameters
|
|
|
+ enquecommand_front_P((PSTR("G28 W0")));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("Stable ambient temperature 21-26C is needed a rigid stand is required."));////MSG_TEMP_CAL_WARNING c=20 r=4
|
|
|
+ bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_STEEL_SHEET_CHECK), false, false);
|
|
|
|
|
|
- float zero_z;
|
|
|
- int z_shift = 0; //unit: steps
|
|
|
- float start_temp = 5 * (int)(current_temperature_pinda / 5);
|
|
|
- if (start_temp < 35) start_temp = 35;
|
|
|
- if (start_temp < current_temperature_pinda) start_temp += 5;
|
|
|
- printf_P(_N("start temperature: %.1f\n"), start_temp);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ current_position[Z_AXIS] = 50;
|
|
|
+ current_position[Y_AXIS] = 180;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ st_synchronize();
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_T(MSG_REMOVE_STEEL_SHEET));
|
|
|
+ current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1);
|
|
|
+ current_position[X_AXIS] = pgm_read_float(bed_ref_points_4);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ st_synchronize();
|
|
|
+ gcode_G28(false, false, true);
|
|
|
+
|
|
|
+ }
|
|
|
+ if ((current_temperature_pinda > 35) && (farm_mode == false)) {
|
|
|
+ //waiting for PIDNA probe to cool down in case that we are not in farm mode
|
|
|
+ current_position[Z_AXIS] = 100;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ if (lcd_wait_for_pinda(35) == false) { //waiting for PINDA probe to cool, if this takes more then time expected, temp. cal. fails
|
|
|
+ lcd_temp_cal_show_result(false);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lcd_update_enable(true);
|
|
|
+ KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly
|
|
|
+ SERIAL_ECHOLNPGM("PINDA probe calibration start");
|
|
|
+
|
|
|
+ float zero_z;
|
|
|
+ int z_shift = 0; //unit: steps
|
|
|
+ float start_temp = 5 * (int)(current_temperature_pinda / 5);
|
|
|
+ if (start_temp < 35) start_temp = 35;
|
|
|
+ if (start_temp < current_temperature_pinda) start_temp += 5;
|
|
|
+ printf_P(_N("start temperature: %.1f\n"), start_temp);
|
|
|
|
|
|
// setTargetHotend(200, 0);
|
|
|
- setTargetBed(70 + (start_temp - 30));
|
|
|
+ setTargetBed(70 + (start_temp - 30));
|
|
|
|
|
|
- custom_message_type = CustomMsg::TempCal;
|
|
|
- custom_message_state = 1;
|
|
|
- lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION));
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- current_position[X_AXIS] = PINDA_PREHEAT_X;
|
|
|
- current_position[Y_AXIS] = PINDA_PREHEAT_Y;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- current_position[Z_AXIS] = PINDA_PREHEAT_Z;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- st_synchronize();
|
|
|
+ custom_message_type = CustomMsg::TempCal;
|
|
|
+ custom_message_state = 1;
|
|
|
+ lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION));
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ current_position[X_AXIS] = PINDA_PREHEAT_X;
|
|
|
+ current_position[Y_AXIS] = PINDA_PREHEAT_Y;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ current_position[Z_AXIS] = PINDA_PREHEAT_Z;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ st_synchronize();
|
|
|
|
|
|
- while (current_temperature_pinda < start_temp)
|
|
|
- {
|
|
|
- delay_keep_alive(1000);
|
|
|
- serialecho_temperatures();
|
|
|
- }
|
|
|
+ while (current_temperature_pinda < start_temp)
|
|
|
+ {
|
|
|
+ delay_keep_alive(1000);
|
|
|
+ serialecho_temperatures();
|
|
|
+ }
|
|
|
|
|
|
- eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); //invalidate temp. calibration in case that in will be aborted during the calibration process
|
|
|
+ eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); //invalidate temp. calibration in case that in will be aborted during the calibration process
|
|
|
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- current_position[X_AXIS] = pgm_read_float(bed_ref_points_4);
|
|
|
- current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1);
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- st_synchronize();
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ current_position[X_AXIS] = pgm_read_float(bed_ref_points_4);
|
|
|
+ current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ st_synchronize();
|
|
|
|
|
|
- bool find_z_result = find_bed_induction_sensor_point_z(-1.f);
|
|
|
- if (find_z_result == false) {
|
|
|
- lcd_temp_cal_show_result(find_z_result);
|
|
|
- break;
|
|
|
- }
|
|
|
- zero_z = current_position[Z_AXIS];
|
|
|
+ bool find_z_result = find_bed_induction_sensor_point_z(-1.f);
|
|
|
+ if (find_z_result == false) {
|
|
|
+ lcd_temp_cal_show_result(find_z_result);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ zero_z = current_position[Z_AXIS];
|
|
|
|
|
|
- printf_P(_N("\nZERO: %.3f\n"), current_position[Z_AXIS]);
|
|
|
+ printf_P(_N("\nZERO: %.3f\n"), current_position[Z_AXIS]);
|
|
|
|
|
|
- int i = -1; for (; i < 5; i++)
|
|
|
- {
|
|
|
- float temp = (40 + i * 5);
|
|
|
- printf_P(_N("\nStep: %d/6 (skipped)\nPINDA temperature: %d Z shift (mm):0\n"), i + 2, (40 + i*5));
|
|
|
- if (i >= 0) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
|
|
|
- if (start_temp <= temp) break;
|
|
|
- }
|
|
|
+ int i = -1; for (; i < 5; i++)
|
|
|
+ {
|
|
|
+ float temp = (40 + i * 5);
|
|
|
+ printf_P(_N("\nStep: %d/6 (skipped)\nPINDA temperature: %d Z shift (mm):0\n"), i + 2, (40 + i*5));
|
|
|
+ if (i >= 0) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
|
|
|
+ if (start_temp <= temp) break;
|
|
|
+ }
|
|
|
|
|
|
- for (i++; i < 5; i++)
|
|
|
- {
|
|
|
- float temp = (40 + i * 5);
|
|
|
- printf_P(_N("\nStep: %d/6\n"), i + 2);
|
|
|
- custom_message_state = i + 2;
|
|
|
- setTargetBed(50 + 10 * (temp - 30) / 5);
|
|
|
+ for (i++; i < 5; i++)
|
|
|
+ {
|
|
|
+ float temp = (40 + i * 5);
|
|
|
+ printf_P(_N("\nStep: %d/6\n"), i + 2);
|
|
|
+ custom_message_state = i + 2;
|
|
|
+ setTargetBed(50 + 10 * (temp - 30) / 5);
|
|
|
// setTargetHotend(255, 0);
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- current_position[X_AXIS] = PINDA_PREHEAT_X;
|
|
|
- current_position[Y_AXIS] = PINDA_PREHEAT_Y;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- current_position[Z_AXIS] = PINDA_PREHEAT_Z;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- st_synchronize();
|
|
|
- while (current_temperature_pinda < temp)
|
|
|
- {
|
|
|
- delay_keep_alive(1000);
|
|
|
- serialecho_temperatures();
|
|
|
- }
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- current_position[X_AXIS] = pgm_read_float(bed_ref_points_4);
|
|
|
- current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1);
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
- st_synchronize();
|
|
|
- find_z_result = find_bed_induction_sensor_point_z(-1.f);
|
|
|
- if (find_z_result == false) {
|
|
|
- lcd_temp_cal_show_result(find_z_result);
|
|
|
- break;
|
|
|
- }
|
|
|
- z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_unit[Z_AXIS]);
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ current_position[X_AXIS] = PINDA_PREHEAT_X;
|
|
|
+ current_position[Y_AXIS] = PINDA_PREHEAT_Y;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ current_position[Z_AXIS] = PINDA_PREHEAT_Z;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ st_synchronize();
|
|
|
+ while (current_temperature_pinda < temp)
|
|
|
+ {
|
|
|
+ delay_keep_alive(1000);
|
|
|
+ serialecho_temperatures();
|
|
|
+ }
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ current_position[X_AXIS] = pgm_read_float(bed_ref_points_4);
|
|
|
+ current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
+ st_synchronize();
|
|
|
+ find_z_result = find_bed_induction_sensor_point_z(-1.f);
|
|
|
+ if (find_z_result == false) {
|
|
|
+ lcd_temp_cal_show_result(find_z_result);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_unit[Z_AXIS]);
|
|
|
|
|
|
- printf_P(_N("\nPINDA temperature: %.1f Z shift (mm): %.3f"), current_temperature_pinda, current_position[Z_AXIS] - zero_z);
|
|
|
+ printf_P(_N("\nPINDA temperature: %.1f Z shift (mm): %.3f"), current_temperature_pinda, current_position[Z_AXIS] - zero_z);
|
|
|
|
|
|
- EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
|
|
|
+ EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
|
|
|
|
|
|
- }
|
|
|
- lcd_temp_cal_show_result(true);
|
|
|
+ }
|
|
|
+ lcd_temp_cal_show_result(true);
|
|
|
|
|
|
- break;
|
|
|
- }
|
|
|
-#endif //PINDA_THERMISTOR
|
|
|
+#else //PINDA_THERMISTOR
|
|
|
|
|
|
setTargetBed(PINDA_MIN_T);
|
|
|
float zero_z;
|
|
@@ -4740,7 +4871,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
current_position[X_AXIS] = PINDA_PREHEAT_X;
|
|
|
current_position[Y_AXIS] = PINDA_PREHEAT_Y;
|
|
|
current_position[Z_AXIS] = PINDA_PREHEAT_Z;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
st_synchronize();
|
|
|
|
|
|
while (abs(degBed() - PINDA_MIN_T) > 1) {
|
|
@@ -4756,11 +4887,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); //invalidate temp. calibration in case that in will be aborted during the calibration process
|
|
|
|
|
|
current_position[Z_AXIS] = 5;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
|
|
|
current_position[X_AXIS] = BED_X0;
|
|
|
current_position[Y_AXIS] = BED_Y0;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
st_synchronize();
|
|
|
|
|
|
find_bed_induction_sensor_point_z(-1.f);
|
|
@@ -4777,7 +4908,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
current_position[X_AXIS] = PINDA_PREHEAT_X;
|
|
|
current_position[Y_AXIS] = PINDA_PREHEAT_Y;
|
|
|
current_position[Z_AXIS] = PINDA_PREHEAT_Z;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
st_synchronize();
|
|
|
while (degBed() < t_c) {
|
|
|
delay_keep_alive(1000);
|
|
@@ -4788,10 +4919,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
serialecho_temperatures();
|
|
|
}
|
|
|
current_position[Z_AXIS] = 5;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
current_position[X_AXIS] = BED_X0;
|
|
|
current_position[Y_AXIS] = BED_Y0;
|
|
|
- plan_buffer_line_curposXYZE(3000 / 60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(3000 / 60);
|
|
|
st_synchronize();
|
|
|
find_bed_induction_sensor_point_z(-1.f);
|
|
|
z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_unit[Z_AXIS]);
|
|
@@ -4814,13 +4945,12 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
disable_e2();
|
|
|
setTargetBed(0); //set bed target temperature back to 0
|
|
|
lcd_show_fullscreen_message_and_wait_P(_T(MSG_TEMP_CALIBRATION_DONE));
|
|
|
- temp_cal_active = true;
|
|
|
eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1);
|
|
|
lcd_update_enable(true);
|
|
|
lcd_update(2);
|
|
|
|
|
|
|
|
|
-
|
|
|
+#endif //PINDA_THERMISTOR
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -4862,11 +4992,6 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
case_G80:
|
|
|
{
|
|
|
mesh_bed_leveling_flag = true;
|
|
|
-#ifndef LA_NOCOMPAT
|
|
|
- // When printing via USB there's no clear boundary between prints. Abuse MBL to indicate
|
|
|
- // the beginning of a new print, allowing a new autodetected setting just after G80.
|
|
|
- la10c_reset();
|
|
|
-#endif
|
|
|
#ifndef PINDA_THERMISTOR
|
|
|
static bool run = false; // thermistor-less PINDA temperature compensation is running
|
|
|
#endif // ndef PINDA_THERMISTOR
|
|
@@ -4939,7 +5064,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
// Cycle through all points and probe them
|
|
|
// First move up. During this first movement, the babystepping will be reverted.
|
|
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60);
|
|
|
// The move to the first calibration point.
|
|
|
current_position[X_AXIS] = BED_X0;
|
|
|
current_position[Y_AXIS] = BED_Y0;
|
|
@@ -4954,7 +5079,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
|
|
|
#endif //SUPPORT_VERBOSITY
|
|
|
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[X_AXIS] / 30, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[X_AXIS] / 30);
|
|
|
// Wait until the move is finished.
|
|
|
st_synchronize();
|
|
|
|
|
@@ -4969,7 +5094,6 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
}
|
|
|
#endif // SUPPORT_VERBOSITY
|
|
|
int l_feedmultiply = setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100
|
|
|
- const char *kill_message = NULL;
|
|
|
while (mesh_point != nMeasPoints * nMeasPoints) {
|
|
|
// Get coords of a measuring point.
|
|
|
uint8_t ix = mesh_point % nMeasPoints; // from 0 to MESH_NUM_X_POINTS - 1
|
|
@@ -5006,7 +5130,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
if((ix == 0) && (iy == 0)) current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
else current_position[Z_AXIS] += 2.f / nMeasPoints; //use relative movement from Z coordinate where PINDa triggered on previous point. This makes calibration faster.
|
|
|
float init_z_bckp = current_position[Z_AXIS];
|
|
|
- plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE);
|
|
|
st_synchronize();
|
|
|
|
|
|
// Move to XY position of the sensor point.
|
|
@@ -5027,7 +5151,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
#endif // SUPPORT_VERBOSITY
|
|
|
|
|
|
//printf_P(PSTR("after clamping: [%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]);
|
|
|
- plan_buffer_line_curposXYZE(XY_AXIS_FEEDRATE, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(XY_AXIS_FEEDRATE);
|
|
|
st_synchronize();
|
|
|
|
|
|
// Go down until endstop is hit
|
|
@@ -5039,7 +5163,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
if (init_z_bckp - current_position[Z_AXIS] < 0.1f) { //broken cable or initial Z coordinate too low. Go to MESH_HOME_Z_SEARCH and repeat last step (z-probe) again to distinguish between these two cases.
|
|
|
//printf_P(PSTR("Another attempt! Current Z position: %f\n"), current_position[Z_AXIS]);
|
|
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE);
|
|
|
st_synchronize();
|
|
|
|
|
|
if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point
|
|
@@ -5094,7 +5218,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
MYSERIAL.print(current_position[Z_AXIS], 5);
|
|
|
}
|
|
|
#endif // SUPPORT_VERBOSITY
|
|
|
- plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE);
|
|
|
st_synchronize();
|
|
|
if (mesh_point != nMeasPoints * nMeasPoints) {
|
|
|
Sound_MakeSound(e_SOUND_TYPE_StandardAlert);
|
|
@@ -5111,14 +5235,14 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
// ~ Z-homing (can not be used "G28", because X & Y-homing would have been done before (Z-homing))
|
|
|
bState=enable_z_endstop(false);
|
|
|
current_position[Z_AXIS] -= 1;
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
|
|
|
st_synchronize();
|
|
|
enable_z_endstop(true);
|
|
|
#ifdef TMC2130
|
|
|
tmc2130_home_enter(Z_AXIS_MASK);
|
|
|
#endif // TMC2130
|
|
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40);
|
|
|
st_synchronize();
|
|
|
#ifdef TMC2130
|
|
|
tmc2130_home_exit();
|
|
@@ -5246,9 +5370,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
go_home_with_z_lift();
|
|
|
// SERIAL_ECHOLNPGM("Go home finished");
|
|
|
//unretract (after PINDA preheat retraction)
|
|
|
- if (degHotend(active_extruder) > EXTRUDE_MINTEMP && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50) {
|
|
|
+ if ((degHotend(active_extruder) > EXTRUDE_MINTEMP) && eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE) && calibration_status_pinda() && (target_temperature_bed >= 50)) {
|
|
|
current_position[E_AXIS] += default_retraction;
|
|
|
- plan_buffer_line_curposXYZE(400, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(400);
|
|
|
}
|
|
|
KEEPALIVE_STATE(NOT_BUSY);
|
|
|
// Restore custom message state
|
|
@@ -5270,7 +5394,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
if (mbl.active) {
|
|
|
SERIAL_PROTOCOLPGM("Num X,Y: ");
|
|
|
SERIAL_PROTOCOL(MESH_NUM_X_POINTS);
|
|
|
- SERIAL_PROTOCOLPGM(",");
|
|
|
+ SERIAL_PROTOCOL(',');
|
|
|
SERIAL_PROTOCOL(MESH_NUM_Y_POINTS);
|
|
|
SERIAL_PROTOCOLPGM("\nZ search height: ");
|
|
|
SERIAL_PROTOCOL(MESH_HOME_Z_SEARCH);
|
|
@@ -5280,7 +5404,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
SERIAL_PROTOCOLPGM(" ");
|
|
|
SERIAL_PROTOCOL_F(mbl.z_values[y][x], 5);
|
|
|
}
|
|
|
- SERIAL_PROTOCOLPGM("\n");
|
|
|
+ SERIAL_PROTOCOLLN();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -6273,96 +6397,41 @@ Sigma_Exit:
|
|
|
uint8_t extruder;
|
|
|
if(setTargetedHotend(105, extruder)){
|
|
|
break;
|
|
|
- }
|
|
|
- #if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
|
|
|
- SERIAL_PROTOCOLPGM("ok T:");
|
|
|
- SERIAL_PROTOCOL_F(degHotend(extruder),1);
|
|
|
- SERIAL_PROTOCOLPGM(" /");
|
|
|
- SERIAL_PROTOCOL_F(degTargetHotend(extruder),1);
|
|
|
- #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
|
- SERIAL_PROTOCOLPGM(" B:");
|
|
|
- SERIAL_PROTOCOL_F(degBed(),1);
|
|
|
- SERIAL_PROTOCOLPGM(" /");
|
|
|
- SERIAL_PROTOCOL_F(degTargetBed(),1);
|
|
|
- #endif //TEMP_BED_PIN
|
|
|
- for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
|
|
|
- SERIAL_PROTOCOLPGM(" T");
|
|
|
- SERIAL_PROTOCOL(cur_extruder);
|
|
|
- SERIAL_PROTOCOLPGM(":");
|
|
|
- SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
|
|
|
- SERIAL_PROTOCOLPGM(" /");
|
|
|
- SERIAL_PROTOCOL_F(degTargetHotend(cur_extruder),1);
|
|
|
- }
|
|
|
- #else
|
|
|
- SERIAL_ERROR_START;
|
|
|
- SERIAL_ERRORLNRPGM(_i("No thermistors - no temperature"));////MSG_ERR_NO_THERMISTORS
|
|
|
- #endif
|
|
|
-
|
|
|
- SERIAL_PROTOCOLPGM(" @:");
|
|
|
- #ifdef EXTRUDER_WATTS
|
|
|
- SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(tmp_extruder))/127);
|
|
|
- SERIAL_PROTOCOLPGM("W");
|
|
|
- #else
|
|
|
- SERIAL_PROTOCOL(getHeaterPower(extruder));
|
|
|
- #endif
|
|
|
-
|
|
|
- SERIAL_PROTOCOLPGM(" B@:");
|
|
|
- #ifdef BED_WATTS
|
|
|
- SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1))/127);
|
|
|
- SERIAL_PROTOCOLPGM("W");
|
|
|
- #else
|
|
|
- SERIAL_PROTOCOL(getHeaterPower(-1));
|
|
|
- #endif
|
|
|
-
|
|
|
-#ifdef PINDA_THERMISTOR
|
|
|
- SERIAL_PROTOCOLPGM(" P:");
|
|
|
- SERIAL_PROTOCOL_F(current_temperature_pinda,1);
|
|
|
-#endif //PINDA_THERMISTOR
|
|
|
-
|
|
|
-#ifdef AMBIENT_THERMISTOR
|
|
|
- SERIAL_PROTOCOLPGM(" A:");
|
|
|
- SERIAL_PROTOCOL_F(current_temperature_ambient,1);
|
|
|
-#endif //AMBIENT_THERMISTOR
|
|
|
-
|
|
|
-
|
|
|
- #ifdef SHOW_TEMP_ADC_VALUES
|
|
|
- {float raw = 0.0;
|
|
|
-
|
|
|
- #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
|
- SERIAL_PROTOCOLPGM(" ADC B:");
|
|
|
- SERIAL_PROTOCOL_F(degBed(),1);
|
|
|
- SERIAL_PROTOCOLPGM("C->");
|
|
|
- raw = rawBedTemp();
|
|
|
- SERIAL_PROTOCOL_F(raw/OVERSAMPLENR,5);
|
|
|
- SERIAL_PROTOCOLPGM(" Rb->");
|
|
|
- SERIAL_PROTOCOL_F(100 * (1 + (PtA * (raw/OVERSAMPLENR)) + (PtB * sq((raw/OVERSAMPLENR)))), 5);
|
|
|
- SERIAL_PROTOCOLPGM(" Rxb->");
|
|
|
- SERIAL_PROTOCOL_F(raw, 5);
|
|
|
- #endif
|
|
|
- for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
|
|
|
- SERIAL_PROTOCOLPGM(" T");
|
|
|
- SERIAL_PROTOCOL(cur_extruder);
|
|
|
- SERIAL_PROTOCOLPGM(":");
|
|
|
- SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
|
|
|
- SERIAL_PROTOCOLPGM("C->");
|
|
|
- raw = rawHotendTemp(cur_extruder);
|
|
|
- SERIAL_PROTOCOL_F(raw/OVERSAMPLENR,5);
|
|
|
- SERIAL_PROTOCOLPGM(" Rt");
|
|
|
- SERIAL_PROTOCOL(cur_extruder);
|
|
|
- SERIAL_PROTOCOLPGM("->");
|
|
|
- SERIAL_PROTOCOL_F(100 * (1 + (PtA * (raw/OVERSAMPLENR)) + (PtB * sq((raw/OVERSAMPLENR)))), 5);
|
|
|
- SERIAL_PROTOCOLPGM(" Rx");
|
|
|
- SERIAL_PROTOCOL(cur_extruder);
|
|
|
- SERIAL_PROTOCOLPGM("->");
|
|
|
- SERIAL_PROTOCOL_F(raw, 5);
|
|
|
- }}
|
|
|
- #endif
|
|
|
- SERIAL_PROTOCOLLN("");
|
|
|
- KEEPALIVE_STATE(NOT_BUSY);
|
|
|
+ }
|
|
|
+
|
|
|
+ SERIAL_PROTOCOLPGM("ok ");
|
|
|
+ gcode_M105(extruder);
|
|
|
+
|
|
|
return;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
+#ifdef AUTO_REPORT_TEMPERATURES
|
|
|
+ /*!
|
|
|
+ ### M155 - Automatically send temperatures <a href="https://reprap.org/wiki/G-code#M155:_Automatically_send_temperatures">M155: Automatically send temperatures</a>
|
|
|
+ #### Usage
|
|
|
+
|
|
|
+ M155 [ S ]
|
|
|
+
|
|
|
+ #### Parameters
|
|
|
+
|
|
|
+ - `S` - Set temperature autoreporting interval in seconds. 0 to disable. Maximum: 255
|
|
|
+
|
|
|
+ */
|
|
|
+ case 155:
|
|
|
+ {
|
|
|
+ if (code_seen('S'))
|
|
|
+ {
|
|
|
+ auto_report_temp_period = code_value_uint8();
|
|
|
+ if (auto_report_temp_period != 0)
|
|
|
+ auto_report_temp_timer.start();
|
|
|
+ else
|
|
|
+ auto_report_temp_timer.stop();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+#endif //AUTO_REPORT_TEMPERATURES
|
|
|
+
|
|
|
/*!
|
|
|
### 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
|
|
@@ -6796,6 +6865,11 @@ Sigma_Exit:
|
|
|
SERIAL_ECHOPGM(" UUID:");
|
|
|
SERIAL_ECHOLNPGM(MACHINE_UUID);
|
|
|
}
|
|
|
+
|
|
|
+#ifdef EXTENDED_CAPABILITIES_REPORT
|
|
|
+ extended_capabilities_report();
|
|
|
+#endif //EXTENDED_CAPABILITIES_REPORT
|
|
|
+
|
|
|
break;
|
|
|
|
|
|
/*!
|
|
@@ -7114,7 +7188,6 @@ Sigma_Exit:
|
|
|
{
|
|
|
float e = code_value();
|
|
|
#ifndef LA_NOCOMPAT
|
|
|
-
|
|
|
e = la10c_jerk(e);
|
|
|
#endif
|
|
|
cs.max_jerk[E_AXIS] = e;
|
|
@@ -7294,17 +7367,26 @@ Sigma_Exit:
|
|
|
*/
|
|
|
case 220: // M220 S<factor in percent>- set speed factor override percentage
|
|
|
{
|
|
|
- if (code_seen('B')) //backup current speed factor
|
|
|
- {
|
|
|
- saved_feedmultiply_mm = feedmultiply;
|
|
|
- }
|
|
|
- if(code_seen('S'))
|
|
|
- {
|
|
|
- feedmultiply = code_value() ;
|
|
|
- }
|
|
|
- if (code_seen('R')) { //restore previous feedmultiply
|
|
|
- feedmultiply = saved_feedmultiply_mm;
|
|
|
- }
|
|
|
+ bool codesWereSeen = false;
|
|
|
+ if (code_seen('B')) //backup current speed factor
|
|
|
+ {
|
|
|
+ saved_feedmultiply_mm = feedmultiply;
|
|
|
+ codesWereSeen = true;
|
|
|
+ }
|
|
|
+ if (code_seen('S'))
|
|
|
+ {
|
|
|
+ feedmultiply = code_value();
|
|
|
+ codesWereSeen = true;
|
|
|
+ }
|
|
|
+ if (code_seen('R')) //restore previous feedmultiply
|
|
|
+ {
|
|
|
+ feedmultiply = saved_feedmultiply_mm;
|
|
|
+ codesWereSeen = true;
|
|
|
+ }
|
|
|
+ if (!codesWereSeen)
|
|
|
+ {
|
|
|
+ printf_P(PSTR("%i%%\n"), feedmultiply);
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -7320,23 +7402,26 @@ Sigma_Exit:
|
|
|
*/
|
|
|
case 221: // M221 S<factor in percent>- set extrude factor override percentage
|
|
|
{
|
|
|
- if(code_seen('S'))
|
|
|
- {
|
|
|
- int tmp_code = code_value();
|
|
|
- if (code_seen('T'))
|
|
|
+ if (code_seen('S'))
|
|
|
{
|
|
|
- uint8_t extruder;
|
|
|
- if(setTargetedHotend(221, extruder)){
|
|
|
- break;
|
|
|
- }
|
|
|
- extruder_multiply[extruder] = tmp_code;
|
|
|
+ int tmp_code = code_value();
|
|
|
+ if (code_seen('T'))
|
|
|
+ {
|
|
|
+ uint8_t extruder;
|
|
|
+ if (setTargetedHotend(221, extruder))
|
|
|
+ break;
|
|
|
+ extruder_multiply[extruder] = tmp_code;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ extrudemultiply = tmp_code ;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- extrudemultiply = tmp_code ;
|
|
|
+ printf_P(PSTR("%i%%\n"), extrudemultiply);
|
|
|
}
|
|
|
- }
|
|
|
- calculate_extruder_multipliers();
|
|
|
+ calculate_extruder_multipliers();
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -7974,9 +8059,8 @@ Sigma_Exit:
|
|
|
{
|
|
|
SERIAL_PROTOCOLPGM("P:");
|
|
|
SERIAL_PROTOCOL_F(current_temperature_pinda, 1);
|
|
|
- SERIAL_PROTOCOLPGM("/");
|
|
|
- SERIAL_PROTOCOL(set_target_pinda);
|
|
|
- SERIAL_PROTOCOLLN("");
|
|
|
+ SERIAL_PROTOCOL('/');
|
|
|
+ SERIAL_PROTOCOLLN(set_target_pinda);
|
|
|
codenum = _millis();
|
|
|
}
|
|
|
manage_heater();
|
|
@@ -8565,7 +8649,7 @@ Sigma_Exit:
|
|
|
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>
|
|
|
+ ### 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:
|
|
@@ -8725,7 +8809,7 @@ Sigma_Exit:
|
|
|
#else //SNMM
|
|
|
if (tmp_extruder >= EXTRUDERS) {
|
|
|
SERIAL_ECHO_START;
|
|
|
- SERIAL_ECHOPGM("T");
|
|
|
+ SERIAL_ECHO('T');
|
|
|
SERIAL_PROTOCOLLN((int)tmp_extruder);
|
|
|
SERIAL_ECHOLNRPGM(_n("Invalid extruder"));////MSG_INVALID_EXTRUDER
|
|
|
}
|
|
@@ -8755,7 +8839,7 @@ Sigma_Exit:
|
|
|
}
|
|
|
// Set the new active extruder and position
|
|
|
active_extruder = tmp_extruder;
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
// Move to the old position if 'F' was in the parameters
|
|
|
if (make_move && Stopped == false) {
|
|
|
prepare_move();
|
|
@@ -8835,7 +8919,7 @@ Sigma_Exit:
|
|
|
case 2:
|
|
|
dcode_2(); break;
|
|
|
#endif //DEBUG_DCODES
|
|
|
-#ifdef DEBUG_DCODE3
|
|
|
+#if defined DEBUG_DCODE3 || defined DEBUG_DCODES
|
|
|
|
|
|
/*!
|
|
|
### D3 - Read/Write EEPROM <a href="https://reprap.org/wiki/G-code#D3:_Read.2FWrite_EEPROM">D3: Read/Write EEPROM</a>
|
|
@@ -8876,7 +8960,7 @@ Sigma_Exit:
|
|
|
case 4:
|
|
|
dcode_4(); break;
|
|
|
#endif //DEBUG_DCODES
|
|
|
-#ifdef DEBUG_DCODE5
|
|
|
+#if defined DEBUG_DCODE5 || defined DEBUG_DCODES
|
|
|
|
|
|
/*!
|
|
|
### D5 - Read/Write FLASH <a href="https://reprap.org/wiki/G-code#D5:_Read.2FWrite_FLASH">D5: Read/Write Flash</a>
|
|
@@ -8888,7 +8972,7 @@ Sigma_Exit:
|
|
|
#### Parameters
|
|
|
- `A` - Address (x00000-x3ffff)
|
|
|
- `C` - Count (1-8192)
|
|
|
- - `X` - Data
|
|
|
+ - `X` - Data (hex)
|
|
|
- `E` - Erase
|
|
|
|
|
|
#### Notes
|
|
@@ -8899,7 +8983,6 @@ Sigma_Exit:
|
|
|
*/
|
|
|
case 5:
|
|
|
dcode_5(); break;
|
|
|
- break;
|
|
|
#endif //DEBUG_DCODE5
|
|
|
#ifdef DEBUG_DCODES
|
|
|
|
|
@@ -8982,28 +9065,7 @@ Sigma_Exit:
|
|
|
- `J` - Offset Y (default 34)
|
|
|
*/
|
|
|
case 80:
|
|
|
- {
|
|
|
- float dimension_x = 40;
|
|
|
- float dimension_y = 40;
|
|
|
- int points_x = 40;
|
|
|
- int points_y = 40;
|
|
|
- float offset_x = 74;
|
|
|
- float offset_y = 33;
|
|
|
-
|
|
|
- if (code_seen('E')) dimension_x = code_value();
|
|
|
- if (code_seen('F')) dimension_y = code_value();
|
|
|
- if (code_seen('G')) {points_x = code_value(); }
|
|
|
- if (code_seen('H')) {points_y = code_value(); }
|
|
|
- if (code_seen('I')) {offset_x = code_value(); }
|
|
|
- if (code_seen('J')) {offset_y = code_value(); }
|
|
|
- printf_P(PSTR("DIM X: %f\n"), dimension_x);
|
|
|
- printf_P(PSTR("DIM Y: %f\n"), dimension_y);
|
|
|
- printf_P(PSTR("POINTS X: %d\n"), points_x);
|
|
|
- printf_P(PSTR("POINTS Y: %d\n"), points_y);
|
|
|
- printf_P(PSTR("OFFSET X: %f\n"), offset_x);
|
|
|
- printf_P(PSTR("OFFSET Y: %f\n"), offset_y);
|
|
|
- bed_check(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
|
|
|
- }break;
|
|
|
+ dcode_80(); break;
|
|
|
|
|
|
/*!
|
|
|
### D81 - Bed analysis <a href="https://reprap.org/wiki/G-code#D81:_Bed_analysis">D80: Bed analysis</a>
|
|
@@ -9021,24 +9083,7 @@ Sigma_Exit:
|
|
|
- `J` - Offset Y (default 34)
|
|
|
*/
|
|
|
case 81:
|
|
|
- {
|
|
|
- float dimension_x = 40;
|
|
|
- float dimension_y = 40;
|
|
|
- int points_x = 40;
|
|
|
- int points_y = 40;
|
|
|
- float offset_x = 74;
|
|
|
- float offset_y = 33;
|
|
|
-
|
|
|
- if (code_seen('E')) dimension_x = code_value();
|
|
|
- if (code_seen('F')) dimension_y = code_value();
|
|
|
- if (code_seen("G")) { strchr_pointer+=1; points_x = code_value(); }
|
|
|
- if (code_seen("H")) { strchr_pointer+=1; points_y = code_value(); }
|
|
|
- if (code_seen("I")) { strchr_pointer+=1; offset_x = code_value(); }
|
|
|
- if (code_seen("J")) { strchr_pointer+=1; offset_y = code_value(); }
|
|
|
-
|
|
|
- bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
|
|
|
-
|
|
|
- } break;
|
|
|
+ dcode_81(); break;
|
|
|
|
|
|
#endif //HEATBED_ANALYSIS
|
|
|
#ifdef DEBUG_DCODES
|
|
@@ -9047,17 +9092,7 @@ Sigma_Exit:
|
|
|
### 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:
|
|
|
- {
|
|
|
- for (int i = 255; i > 0; i = i - 5) {
|
|
|
- fanSpeed = i;
|
|
|
- //delay_keep_alive(2000);
|
|
|
- for (int j = 0; j < 100; j++) {
|
|
|
- delay_keep_alive(100);
|
|
|
-
|
|
|
- }
|
|
|
- printf_P(_N("%d: %d\n"), i, fan_speed[1]);
|
|
|
- }
|
|
|
- }break;
|
|
|
+ dcode_106(); break;
|
|
|
|
|
|
#ifdef TMC2130
|
|
|
/*!
|
|
@@ -9354,13 +9389,13 @@ void prepare_move()
|
|
|
|
|
|
// Do not use feedmultiply for E or Z only moves
|
|
|
if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate/60);
|
|
|
}
|
|
|
else {
|
|
|
#ifdef MESH_BED_LEVELING
|
|
|
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply*(1./(60.f*100.f)), active_extruder);
|
|
|
#else
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply*(1./(60.f*100.f)), active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(feedrate*feedmultiply*(1./(60.f*100.f)));
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -9494,51 +9529,95 @@ static void handleSafetyTimer()
|
|
|
}
|
|
|
#endif //SAFETYTIMER
|
|
|
|
|
|
-#define FS_CHECK_COUNT 15
|
|
|
+#ifdef IR_SENSOR_ANALOG
|
|
|
+#define FS_CHECK_COUNT 16
|
|
|
+/// Switching mechanism of the fsensor type.
|
|
|
+/// Called from 2 spots which have a very similar behavior
|
|
|
+/// 1: ClFsensorPCB::_Old -> ClFsensorPCB::_Rev04 and print _i("FS v0.4 or newer")
|
|
|
+/// 2: ClFsensorPCB::_Rev04 -> oFsensorPCB=ClFsensorPCB::_Old and print _i("FS v0.3 or older")
|
|
|
+void manage_inactivity_IR_ANALOG_Check(uint16_t &nFSCheckCount, ClFsensorPCB isVersion, ClFsensorPCB switchTo, const char *statusLineTxt_P) {
|
|
|
+ bool bTemp = (!CHECK_ALL_HEATERS);
|
|
|
+ bTemp = bTemp && (menu_menu == lcd_status_screen);
|
|
|
+ bTemp = bTemp && ((oFsensorPCB == isVersion) || (oFsensorPCB == ClFsensorPCB::_Undef));
|
|
|
+ bTemp = bTemp && fsensor_enabled;
|
|
|
+ if (bTemp) {
|
|
|
+ nFSCheckCount++;
|
|
|
+ if (nFSCheckCount > FS_CHECK_COUNT) {
|
|
|
+ nFSCheckCount = 0; // not necessary
|
|
|
+ oFsensorPCB = switchTo;
|
|
|
+ eeprom_update_byte((uint8_t *)EEPROM_FSENSOR_PCB, (uint8_t)oFsensorPCB);
|
|
|
+ printf_IRSensorAnalogBoardChange();
|
|
|
+ lcd_setstatuspgm(statusLineTxt_P);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ nFSCheckCount = 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h
|
|
|
{
|
|
|
#ifdef FILAMENT_SENSOR
|
|
|
bool bInhibitFlag;
|
|
|
#ifdef IR_SENSOR_ANALOG
|
|
|
-static uint8_t nFSCheckCount=0;
|
|
|
+static uint16_t nFSCheckCount=0;
|
|
|
#endif // IR_SENSOR_ANALOG
|
|
|
|
|
|
if (mmu_enabled == false)
|
|
|
{
|
|
|
//-// if (mcode_in_progress != 600) //M600 not in progress
|
|
|
#ifdef PAT9125
|
|
|
- bInhibitFlag=(menu_menu==lcd_menu_extruder_info); // Support::ExtruderInfo menu active
|
|
|
+ bInhibitFlag=(menu_menu==lcd_menu_extruder_info); // Support::ExtruderInfo menu active
|
|
|
#endif // PAT9125
|
|
|
#ifdef IR_SENSOR
|
|
|
- bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active
|
|
|
+ bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active
|
|
|
#ifdef IR_SENSOR_ANALOG
|
|
|
- bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Settings::HWsetup::FSdetect menu active
|
|
|
+ bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Settings::HWsetup::FSdetect menu active
|
|
|
#endif // IR_SENSOR_ANALOG
|
|
|
#endif // IR_SENSOR
|
|
|
- if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active
|
|
|
+ if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active
|
|
|
{
|
|
|
if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE))
|
|
|
{
|
|
|
#ifdef IR_SENSOR_ANALOG
|
|
|
- bool bTemp=current_voltage_raw_IR>IRsensor_Hmin_TRESHOLD;
|
|
|
- bTemp=bTemp&¤t_voltage_raw_IR<IRsensor_Hopen_TRESHOLD;
|
|
|
- bTemp=bTemp&&(!CHECK_ALL_HEATERS);
|
|
|
- bTemp=bTemp&&(menu_menu==lcd_status_screen);
|
|
|
- bTemp=bTemp&&((oFsensorPCB==ClFsensorPCB::_Old)||(oFsensorPCB==ClFsensorPCB::_Undef));
|
|
|
- bTemp=bTemp&&fsensor_enabled;
|
|
|
- if(bTemp)
|
|
|
- {
|
|
|
- nFSCheckCount++;
|
|
|
- if(nFSCheckCount>FS_CHECK_COUNT)
|
|
|
- {
|
|
|
- nFSCheckCount=0; // not necessary
|
|
|
- oFsensorPCB=ClFsensorPCB::_Rev03b;
|
|
|
- eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
|
|
|
- printf_IRSensorAnalogBoardChange(true);
|
|
|
- lcd_setstatuspgm(_i("FS rev. 03b or newer"));
|
|
|
- }
|
|
|
- }
|
|
|
- else nFSCheckCount=0;
|
|
|
+ static uint16_t minVolt = Voltage2Raw(6.F), maxVolt = 0;
|
|
|
+ // detect min-max, some long term sliding window for filtration may be added
|
|
|
+ // avoiding floating point operations, thus computing in raw
|
|
|
+ if( current_voltage_raw_IR > maxVolt )maxVolt = current_voltage_raw_IR;
|
|
|
+ if( current_voltage_raw_IR < minVolt )minVolt = current_voltage_raw_IR;
|
|
|
+
|
|
|
+#if 0 // Start: IR Sensor debug info
|
|
|
+ { // debug print
|
|
|
+ static uint16_t lastVolt = ~0U;
|
|
|
+ if( current_voltage_raw_IR != lastVolt ){
|
|
|
+ printf_P(PSTR("fs volt=%4.2fV (min=%4.2f max=%4.2f)\n"), Raw2Voltage(current_voltage_raw_IR), Raw2Voltage(minVolt), Raw2Voltage(maxVolt) );
|
|
|
+ lastVolt = current_voltage_raw_IR;
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif // End: IR Sensor debug info
|
|
|
+ //! The trouble is, I can hold the filament in the hole in such a way, that it creates the exact voltage
|
|
|
+ //! to be detected as the new fsensor
|
|
|
+ //! We can either fake it by extending the detection window to a looooong time
|
|
|
+ //! or do some other countermeasures
|
|
|
+
|
|
|
+ //! what we want to detect:
|
|
|
+ //! if minvolt gets below ~0.3V, it means there is an old fsensor
|
|
|
+ //! if maxvolt gets above 4.6V, it means we either have an old fsensor or broken cables/fsensor
|
|
|
+ //! So I'm waiting for a situation, when minVolt gets to range <0, 1.5> and maxVolt gets into range <3.0, 5>
|
|
|
+ //! If and only if minVolt is in range <0.3, 1.5> and maxVolt is in range <3.0, 4.6>, I'm considering a situation with the new fsensor
|
|
|
+ if( minVolt >= IRsensor_Ldiode_TRESHOLD && minVolt <= IRsensor_Lmax_TRESHOLD
|
|
|
+ && maxVolt >= IRsensor_Hmin_TRESHOLD && maxVolt <= IRsensor_Hopen_TRESHOLD
|
|
|
+ ){
|
|
|
+ manage_inactivity_IR_ANALOG_Check(nFSCheckCount, ClFsensorPCB::_Old, ClFsensorPCB::_Rev04, _i("FS v0.4 or newer") ); ////c=18
|
|
|
+ }
|
|
|
+ //! If and only if minVolt is in range <0.0, 0.3> and maxVolt is in range <4.6, 5.0V>, I'm considering a situation with the old fsensor
|
|
|
+ //! Note, we are not relying on one voltage here - getting just +5V can mean an old fsensor or a broken new sensor - that's why
|
|
|
+ //! we need to have both voltages detected correctly to allow switching back to the old fsensor.
|
|
|
+ else if( minVolt < IRsensor_Ldiode_TRESHOLD
|
|
|
+ && maxVolt > IRsensor_Hopen_TRESHOLD && maxVolt <= IRsensor_VMax_TRESHOLD
|
|
|
+ ){
|
|
|
+ manage_inactivity_IR_ANALOG_Check(nFSCheckCount, ClFsensorPCB::_Rev04, oFsensorPCB=ClFsensorPCB::_Old, _i("FS v0.3 or older")); ////c=18
|
|
|
+ }
|
|
|
#endif // IR_SENSOR_ANALOG
|
|
|
if (fsensor_check_autoload())
|
|
|
{
|
|
@@ -9548,7 +9627,7 @@ static uint8_t nFSCheckCount=0;
|
|
|
//-// if (degHotend0() > EXTRUDE_MINTEMP)
|
|
|
if(0)
|
|
|
{
|
|
|
- Sound_MakeCustom(50,1000,false);
|
|
|
+ Sound_MakeCustom(50,1000,false);
|
|
|
loading_flag = true;
|
|
|
enquecommand_front_P((PSTR("M701")));
|
|
|
}
|
|
@@ -9559,20 +9638,17 @@ if(0)
|
|
|
show_preheat_nozzle_warning();
|
|
|
lcd_update_enable(true);
|
|
|
*/
|
|
|
- eFilamentAction=FilamentAction::AutoLoad;
|
|
|
- bFilamentFirstRun=false;
|
|
|
- if(target_temperature[0]>=EXTRUDE_MINTEMP)
|
|
|
- {
|
|
|
- bFilamentPreheatState=true;
|
|
|
-// mFilamentItem(target_temperature[0],target_temperature_bed);
|
|
|
- menu_submenu(mFilamentItemForce);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- menu_submenu(lcd_generic_preheat_menu);
|
|
|
- lcd_timeoutToStatus.start();
|
|
|
- }
|
|
|
- }
|
|
|
+ eFilamentAction=FilamentAction::AutoLoad;
|
|
|
+ bFilamentFirstRun=false;
|
|
|
+ if(target_temperature[0]>=EXTRUDE_MINTEMP){
|
|
|
+ bFilamentPreheatState=true;
|
|
|
+// mFilamentItem(target_temperature[0],target_temperature_bed);
|
|
|
+ menu_submenu(mFilamentItemForce);
|
|
|
+ } else {
|
|
|
+ menu_submenu(lcd_generic_preheat_menu);
|
|
|
+ lcd_timeoutToStatus.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -9746,6 +9822,24 @@ void Stop()
|
|
|
|
|
|
bool IsStopped() { return Stopped; };
|
|
|
|
|
|
+void finishAndDisableSteppers()
|
|
|
+{
|
|
|
+ st_synchronize();
|
|
|
+ disable_x();
|
|
|
+ disable_y();
|
|
|
+ disable_z();
|
|
|
+ disable_e0();
|
|
|
+ disable_e1();
|
|
|
+ disable_e2();
|
|
|
+
|
|
|
+#ifndef LA_NOCOMPAT
|
|
|
+ // Steppers are disabled both when a print is stopped and also via M84 (which is additionally
|
|
|
+ // checked-for to indicate a complete file), so abuse this function to reset the LA detection
|
|
|
+ // state for the next print.
|
|
|
+ la10c_reset();
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
#ifdef FAST_PWM_FAN
|
|
|
void setPwmFrequency(uint8_t pin, int val)
|
|
|
{
|
|
@@ -9946,7 +10040,7 @@ static void wait_for_heater(long codenum, uint8_t extruder) {
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SERIAL_PROTOCOLLN("?");
|
|
|
+ SERIAL_PROTOCOLLN('?');
|
|
|
}
|
|
|
}
|
|
|
#else
|
|
@@ -10077,16 +10171,16 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi
|
|
|
card.openFile(filename_wldsd, false);
|
|
|
|
|
|
/*destination[Z_AXIS] = mesh_home_z_search;
|
|
|
- //plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder);
|
|
|
+ //plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE);
|
|
|
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(Z_LIFT_FEEDRATE);
|
|
|
for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
|
current_position[i] = destination[i];
|
|
|
}
|
|
|
st_synchronize();
|
|
|
*/
|
|
|
destination[Z_AXIS] = measure_z_height;
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(Z_LIFT_FEEDRATE);
|
|
|
for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
|
current_position[i] = destination[i];
|
|
|
}
|
|
@@ -10111,9 +10205,9 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi
|
|
|
if (iy & 1) ix = (x_points_num - 1) - ix; // Zig zag
|
|
|
float z0 = 0.f;
|
|
|
/*destination[Z_AXIS] = mesh_home_z_search;
|
|
|
- //plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder);
|
|
|
+ //plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE);
|
|
|
|
|
|
- plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
|
|
|
+ plan_buffer_line_destinationXYZE(Z_LIFT_FEEDRATE);
|
|
|
for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
|
current_position[i] = destination[i];
|
|
|
}
|
|
@@ -10126,8 +10220,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[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);
|
|
|
- set_current_to_destination();
|
|
|
+ mesh_plan_buffer_line_destinationXYZE(XY_AXIS_FEEDRATE/6);
|
|
|
+ set_current_to_destination();
|
|
|
st_synchronize();
|
|
|
|
|
|
// printf_P(PSTR("X = %f; Y= %f \n"), current_position[X_AXIS], current_position[Y_AXIS]);
|
|
@@ -10480,7 +10574,11 @@ float temp_comp_interpolation(float inp_temperature) {
|
|
|
if (i>0) EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + (i-1) * 2, &shift[i]); //read shift in steps from EEPROM
|
|
|
temp_C[i] = 50 + i * 10; //temperature in C
|
|
|
#ifdef PINDA_THERMISTOR
|
|
|
- temp_C[i] = 35 + i * 5; //temperature in C
|
|
|
+ constexpr int start_compensating_temp = 35;
|
|
|
+ temp_C[i] = start_compensating_temp + i * 5; //temperature in degrees C
|
|
|
+#ifdef DETECT_SUPERPINDA
|
|
|
+ static_assert(start_compensating_temp >= PINDA_MINTEMP, "Temperature compensation start point is lower than PINDA_MINTEMP.");
|
|
|
+#endif //DETECT_SUPERPINDA
|
|
|
#else
|
|
|
temp_C[i] = 50 + i * 10; //temperature in C
|
|
|
#endif
|
|
@@ -10533,7 +10631,7 @@ float temp_comp_interpolation(float inp_temperature) {
|
|
|
#ifdef PINDA_THERMISTOR
|
|
|
float temp_compensation_pinda_thermistor_offset(float temperature_pinda)
|
|
|
{
|
|
|
- if (!temp_cal_active) return 0;
|
|
|
+ if (!eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE)) return 0;
|
|
|
if (!calibration_status_pinda()) return 0;
|
|
|
return temp_comp_interpolation(temperature_pinda) / cs.axis_steps_per_unit[Z_AXIS];
|
|
|
}
|
|
@@ -10550,12 +10648,12 @@ void long_pause() //long pause print
|
|
|
//lift z
|
|
|
current_position[Z_AXIS] += Z_PAUSE_LIFT;
|
|
|
if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
|
|
|
- plan_buffer_line_curposXYZE(15, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(15);
|
|
|
|
|
|
//Move XY to side
|
|
|
current_position[X_AXIS] = X_PAUSE_POS;
|
|
|
current_position[Y_AXIS] = Y_PAUSE_POS;
|
|
|
- plan_buffer_line_curposXYZE(50, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(50);
|
|
|
|
|
|
// Turn off the print fan
|
|
|
fanSpeed = 0;
|
|
@@ -10665,7 +10763,7 @@ void uvlo_()
|
|
|
|
|
|
// Retract
|
|
|
current_position[E_AXIS] -= default_retraction;
|
|
|
- plan_buffer_line_curposXYZE(95, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(95);
|
|
|
st_synchronize();
|
|
|
disable_e0();
|
|
|
|
|
@@ -10678,7 +10776,7 @@ void uvlo_()
|
|
|
current_position[Z_AXIS] += float(1024 - z_microsteps)
|
|
|
/ (z_res * cs.axis_steps_per_unit[Z_AXIS])
|
|
|
+ UVLO_Z_AXIS_SHIFT;
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60);
|
|
|
st_synchronize();
|
|
|
poweroff_z();
|
|
|
|
|
@@ -10741,7 +10839,7 @@ void uvlo_()
|
|
|
// All is set: with all the juice left, try to move extruder away to detach the nozzle completely from the print
|
|
|
poweron_z();
|
|
|
current_position[X_AXIS] = (current_position[X_AXIS] < 0.5f * (X_MIN_POS + X_MAX_POS)) ? X_MIN_POS : X_MAX_POS;
|
|
|
- plan_buffer_line_curposXYZE(500, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(500);
|
|
|
st_synchronize();
|
|
|
|
|
|
wdt_enable(WDTO_1S);
|
|
@@ -10792,7 +10890,7 @@ void uvlo_tiny()
|
|
|
current_position[Z_AXIS] += float(1024 - z_microsteps)
|
|
|
/ (z_res * cs.axis_steps_per_unit[Z_AXIS])
|
|
|
+ UVLO_TINY_Z_AXIS_SHIFT;
|
|
|
- plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60);
|
|
|
st_synchronize();
|
|
|
poweroff_z();
|
|
|
|
|
@@ -10886,7 +10984,7 @@ void recover_print(uint8_t automatic) {
|
|
|
char cmd[30];
|
|
|
lcd_update_enable(true);
|
|
|
lcd_update(2);
|
|
|
- lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20 r=1
|
|
|
+ lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20
|
|
|
|
|
|
// Recover position, temperatures and extrude_multipliers
|
|
|
bool mbl_was_active = recover_machine_state_after_power_panic();
|
|
@@ -10971,7 +11069,7 @@ bool recover_machine_state_after_power_panic()
|
|
|
|
|
|
// 5) Set the physical positions from the logical positions using the world2machine transformation
|
|
|
// This is only done to inizialize Z/E axes with physical locations, since X/Y are unknown.
|
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
+ plan_set_position_curposXYZE();
|
|
|
|
|
|
// 6) Power up the Z motors, mark their positions as known.
|
|
|
axis_known_position[Z_AXIS] = true;
|
|
@@ -11395,9 +11493,9 @@ void print_mesh_bed_leveling_table()
|
|
|
for (int8_t y = 0; y < MESH_NUM_Y_POINTS; ++ y)
|
|
|
for (int8_t x = 0; x < MESH_NUM_Y_POINTS; ++ x) {
|
|
|
MYSERIAL.print(mbl.z_values[y][x], 3);
|
|
|
- SERIAL_ECHOPGM(" ");
|
|
|
+ SERIAL_ECHO(' ');
|
|
|
}
|
|
|
- SERIAL_ECHOLNPGM("");
|
|
|
+ SERIAL_ECHOLN();
|
|
|
}
|
|
|
|
|
|
uint16_t print_time_remaining() {
|
|
@@ -11445,7 +11543,7 @@ static void print_time_remaining_init()
|
|
|
void load_filament_final_feed()
|
|
|
{
|
|
|
current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED;
|
|
|
- plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FINAL, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FINAL);
|
|
|
}
|
|
|
|
|
|
//! @brief Wait for user to check the state
|
|
@@ -11590,7 +11688,7 @@ void M600_load_filament_movements()
|
|
|
plan_buffer_line_curposXYZE(50, active_extruder);
|
|
|
#else
|
|
|
current_position[E_AXIS]+= FILAMENTCHANGE_FIRSTFEED ;
|
|
|
- plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FIRST, active_extruder);
|
|
|
+ plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FIRST);
|
|
|
#endif
|
|
|
load_filament_final_feed();
|
|
|
lcd_loading_filament();
|
|
@@ -11697,7 +11795,6 @@ void disable_force_z()
|
|
|
#endif // TMC2130
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void enable_force_z()
|
|
|
{
|
|
|
if(bEnableForce_z)
|