Commit cb6236ed authored by MagoKimbra's avatar MagoKimbra

Update

parent 4f4b9507
......@@ -174,7 +174,7 @@
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0
#define TEMP_SENSOR_BED 1
#define TEMP_SENSOR_BED 0
// This makes temp sensor 1 a redundant sensor for sensor 0.
// If the temperatures difference between these sensors is to high the print will be aborted.
......@@ -693,4 +693,5 @@ your extruder heater takes 2 minutes to hit the target on heating.
#include "Configuration_adv.h"
#include "thermistortables.h"
#endif //__CONFIGURATION_H
......@@ -41,225 +41,226 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
// wrong data being written to the variables.
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
#define EEPROM_VERSION "V13"
#define EEPROM_VERSION "V16"
#ifdef EEPROM_SETTINGS
void Config_StoreSettings() {
float dummy = 0.0f;
char ver[4] = "000";
int i = EEPROM_OFFSET;
EEPROM_WRITE_VAR(i, ver); // invalidate data first
EEPROM_WRITE_VAR(i, baudrate);
EEPROM_WRITE_VAR(i, axis_steps_per_unit);
EEPROM_WRITE_VAR(i, max_feedrate);
EEPROM_WRITE_VAR(i, max_retraction_feedrate);
EEPROM_WRITE_VAR(i, max_acceleration_units_per_sq_second);
EEPROM_WRITE_VAR(i, acceleration);
EEPROM_WRITE_VAR(i, retract_acceleration);
EEPROM_WRITE_VAR(i, minimumfeedrate);
EEPROM_WRITE_VAR(i, mintravelfeedrate);
EEPROM_WRITE_VAR(i, minsegmenttime);
EEPROM_WRITE_VAR(i, max_xy_jerk);
EEPROM_WRITE_VAR(i, max_z_jerk);
EEPROM_WRITE_VAR(i, max_e_jerk);
EEPROM_WRITE_VAR(i, add_homing);
EEPROM_WRITE_VAR(i, zprobe_zoffset);
void Config_StoreSettings() {
float dummy = 0.0f;
char ver[4] = "000";
int i = EEPROM_OFFSET;
EEPROM_WRITE_VAR(i, ver); // invalidate data first
EEPROM_WRITE_VAR(i, baudrate);
EEPROM_WRITE_VAR(i, axis_steps_per_unit);
EEPROM_WRITE_VAR(i, max_feedrate);
EEPROM_WRITE_VAR(i, max_retraction_feedrate);
EEPROM_WRITE_VAR(i, max_acceleration_units_per_sq_second);
EEPROM_WRITE_VAR(i, acceleration);
EEPROM_WRITE_VAR(i, retract_acceleration);
EEPROM_WRITE_VAR(i, travel_acceleration);
EEPROM_WRITE_VAR(i, minimumfeedrate);
EEPROM_WRITE_VAR(i, mintravelfeedrate);
EEPROM_WRITE_VAR(i, minsegmenttime);
EEPROM_WRITE_VAR(i, max_xy_jerk);
EEPROM_WRITE_VAR(i, max_z_jerk);
EEPROM_WRITE_VAR(i, max_e_jerk);
EEPROM_WRITE_VAR(i, add_homing);
EEPROM_WRITE_VAR(i, zprobe_zoffset);
#if EXTRUDERS > 1 && !defined SINGLENOZZLE
EEPROM_WRITE_VAR(i, hotend_offset);
#endif
#ifdef DELTA
EEPROM_WRITE_VAR(i, endstop_adj);
EEPROM_WRITE_VAR(i, delta_radius);
EEPROM_WRITE_VAR(i, delta_diagonal_rod);
EEPROM_WRITE_VAR(i, max_pos);
EEPROM_WRITE_VAR(i, tower_adj);
EEPROM_WRITE_VAR(i, z_probe_offset);
#endif
#ifndef ULTIPANEL
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
int gumPreheatHotendTemp = GUM_PREHEAT_HOTEND_TEMP, gumPreheatHPBTemp = GUM_PREHEAT_HPB_TEMP, gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
#endif
EEPROM_WRITE_VAR(i, plaPreheatHotendTemp);
EEPROM_WRITE_VAR(i, plaPreheatHPBTemp);
EEPROM_WRITE_VAR(i, plaPreheatFanSpeed);
EEPROM_WRITE_VAR(i, absPreheatHotendTemp);
EEPROM_WRITE_VAR(i, absPreheatHPBTemp);
EEPROM_WRITE_VAR(i, absPreheatFanSpeed);
EEPROM_WRITE_VAR(i, gumPreheatHotendTemp);
EEPROM_WRITE_VAR(i, gumPreheatHPBTemp);
EEPROM_WRITE_VAR(i, gumPreheatFanSpeed);
#ifdef PIDTEMP
EEPROM_WRITE_VAR(i, Kp);
EEPROM_WRITE_VAR(i, Ki);
EEPROM_WRITE_VAR(i, Kd);
#endif //PIDTEMP
#ifndef DOGLCD
int lcd_contrast = 32;
#endif
EEPROM_WRITE_VAR(i, lcd_contrast);
#ifdef SCARA
EEPROM_WRITE_VAR(i, axis_scaling); // Add scaling for SCARA
#endif //SCARA
#ifdef FWRETRACT
EEPROM_WRITE_VAR(i, autoretract_enabled);
EEPROM_WRITE_VAR(i, retract_length);
#if EXTRUDERS > 1
EEPROM_WRITE_VAR(i, retract_length_swap);
#endif //EXTRUDERS > 1
EEPROM_WRITE_VAR(i, retract_feedrate);
EEPROM_WRITE_VAR(i, retract_zlift);
EEPROM_WRITE_VAR(i, retract_recover_length);
#if EXTRUDERS > 1
EEPROM_WRITE_VAR(i, retract_recover_length_swap);
#endif //EXTRUDERS > 1
EEPROM_WRITE_VAR(i, retract_recover_feedrate);
#endif // FWRETRACT
EEPROM_WRITE_VAR(i, volumetric_enabled);
// Save filament sizes
for (int e = 0; e < EXTRUDERS; e++) EEPROM_WRITE_VAR(i, filament_size[e]);
int storageSize = i;
char ver2[4] = EEPROM_VERSION;
int j = EEPROM_OFFSET;
EEPROM_WRITE_VAR(j, ver2); // validate data
// Report storage size
SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Settings Stored (", (unsigned long)i);
SERIAL_ECHOLNPGM(" bytes)");
}
void Config_RetrieveSettings()
{
int i=EEPROM_OFFSET;
char stored_ver[4];
char ver[4]=EEPROM_VERSION;
EEPROM_READ_VAR(i,stored_ver); //read stored version
//SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
if (strncmp(ver,stored_ver,3) == 0)
{
// version number match
EEPROM_READ_VAR(i,baudrate);
if(baudrate!=9600 && baudrate!=14400 && baudrate!=19200 && baudrate!=28800 && baudrate!=38400 && baudrate!=56000 && baudrate!=115200 && baudrate!=250000) baudrate=BAUDRATE;
EEPROM_READ_VAR(i,axis_steps_per_unit);
EEPROM_READ_VAR(i,max_feedrate);
EEPROM_READ_VAR(i,max_retraction_feedrate);
EEPROM_READ_VAR(i,max_acceleration_units_per_sq_second);
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
reset_acceleration_rates();
EEPROM_READ_VAR(i,acceleration);
EEPROM_READ_VAR(i,retract_acceleration);
EEPROM_READ_VAR(i, travel_acceleration);
EEPROM_READ_VAR(i,minimumfeedrate);
EEPROM_READ_VAR(i,mintravelfeedrate);
EEPROM_READ_VAR(i,minsegmenttime);
EEPROM_READ_VAR(i,max_xy_jerk);
EEPROM_READ_VAR(i,max_z_jerk);
EEPROM_READ_VAR(i,max_e_jerk);
EEPROM_READ_VAR(i,add_homing);
EEPROM_READ_VAR(i,zprobe_zoffset);
#if EXTRUDERS > 1 && !defined SINGLENOZZLE
EEPROM_WRITE_VAR(i, hotend_offset);
EEPROM_READ_VAR(i, hotend_offset);
#endif
#ifdef DELTA
EEPROM_WRITE_VAR(i, delta_radius);
EEPROM_WRITE_VAR(i, delta_diagonal_rod);
EEPROM_WRITE_VAR(i, max_pos);
EEPROM_WRITE_VAR(i, endstop_adj);
EEPROM_WRITE_VAR(i, tower_adj);
EEPROM_WRITE_VAR(i, z_probe_offset);
#endif
EEPROM_READ_VAR(i,endstop_adj);
EEPROM_READ_VAR(i,delta_radius);
EEPROM_READ_VAR(i,delta_diagonal_rod);
EEPROM_READ_VAR(i,max_pos);
EEPROM_READ_VAR(i,tower_adj);
EEPROM_READ_VAR(i,z_probe_offset);
// Update delta constants for updated delta_radius & tower_adj values
set_delta_constants();
#endif //DELTA
#ifndef ULTIPANEL
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
int gumPreheatHotendTemp = GUM_PREHEAT_HOTEND_TEMP, gumPreheatHPBTemp = GUM_PREHEAT_HPB_TEMP, gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
int absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
int gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed;
#endif
EEPROM_WRITE_VAR(i, plaPreheatHotendTemp);
EEPROM_WRITE_VAR(i, plaPreheatHPBTemp);
EEPROM_WRITE_VAR(i, plaPreheatFanSpeed);
EEPROM_WRITE_VAR(i, absPreheatHotendTemp);
EEPROM_WRITE_VAR(i, absPreheatHPBTemp);
EEPROM_WRITE_VAR(i, absPreheatFanSpeed);
EEPROM_WRITE_VAR(i, gumPreheatHotendTemp);
EEPROM_WRITE_VAR(i, gumPreheatHPBTemp);
EEPROM_WRITE_VAR(i, gumPreheatFanSpeed);
EEPROM_READ_VAR(i,plaPreheatHotendTemp);
EEPROM_READ_VAR(i,plaPreheatHPBTemp);
EEPROM_READ_VAR(i,plaPreheatFanSpeed);
EEPROM_READ_VAR(i,absPreheatHotendTemp);
EEPROM_READ_VAR(i,absPreheatHPBTemp);
EEPROM_READ_VAR(i,absPreheatFanSpeed);
EEPROM_READ_VAR(i,gumPreheatHotendTemp);
EEPROM_READ_VAR(i,gumPreheatHPBTemp);
EEPROM_READ_VAR(i,gumPreheatFanSpeed);
#ifdef PIDTEMP
EEPROM_WRITE_VAR(i, Kp);
EEPROM_WRITE_VAR(i, Ki);
EEPROM_WRITE_VAR(i, Kd);
#endif //PIDTEMP
// do not need to scale PID values as the values in EEPROM are already scaled
EEPROM_READ_VAR(i,Kp);
EEPROM_READ_VAR(i,Ki);
EEPROM_READ_VAR(i,Kd);
#endif // PIDTEMP
#ifndef DOGLCD
int lcd_contrast = 32;
#endif
EEPROM_WRITE_VAR(i, lcd_contrast);
int lcd_contrast;
#endif //DOGLCD
EEPROM_READ_VAR(i,lcd_contrast);
#ifdef SCARA
EEPROM_WRITE_VAR(i, axis_scaling); // Add scaling for SCARA
EEPROM_READ_VAR(i,axis_scaling);
#endif //SCARA
#ifdef FWRETRACT
EEPROM_WRITE_VAR(i, autoretract_enabled);
EEPROM_WRITE_VAR(i, retract_length);
EEPROM_READ_VAR(i,autoretract_enabled);
EEPROM_READ_VAR(i,retract_length);
#if EXTRUDERS > 1
EEPROM_WRITE_VAR(i, retract_length_swap);
EEPROM_READ_VAR(i,retract_length_swap);
#endif //EXTRUDERS > 1
EEPROM_WRITE_VAR(i, retract_feedrate);
EEPROM_WRITE_VAR(i, retract_zlift);
EEPROM_WRITE_VAR(i, retract_recover_length);
EEPROM_READ_VAR(i,retract_feedrate);
EEPROM_READ_VAR(i,retract_zlift);
EEPROM_READ_VAR(i,retract_recover_length);
#if EXTRUDERS > 1
EEPROM_WRITE_VAR(i, retract_recover_length_swap);
EEPROM_READ_VAR(i,retract_recover_length_swap);
#endif //EXTRUDERS > 1
EEPROM_WRITE_VAR(i, retract_recover_feedrate);
#endif // FWRETRACT
EEPROM_WRITE_VAR(i, volumetric_enabled);
// Save filament sizes
for (int e = 0; e < EXTRUDERS; e++) EEPROM_WRITE_VAR(i, filament_size[e]);
int storageSize = i;
char ver2[4] = EEPROM_VERSION;
int j = EEPROM_OFFSET;
EEPROM_WRITE_VAR(j, ver2); // validate data
EEPROM_READ_VAR(i,retract_recover_feedrate);
#endif //FWRETRACT
// Report storage size
EEPROM_READ_VAR(i, volumetric_enabled);
EEPROM_READ_VAR(i, filament_size[0]);
#if EXTRUDERS > 1
EEPROM_READ_VAR(i, filament_size[1]);
#if EXTRUDERS > 2
EEPROM_READ_VAR(i, filament_size[2]);
#if EXTRUDERS > 3
EEPROM_READ_VAR(i, filament_size[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
calculate_volumetric_multipliers();
// Call updatePID (similar to when we have processed M301)
updatePID();
SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Settings Stored (", (unsigned long)i);
SERIAL_ECHOLNPGM(" bytes)");
SERIAL_ECHOLNPGM("Stored settings retrieved");
}
void Config_RetrieveSettings()
else
{
int i=EEPROM_OFFSET;
char stored_ver[4];
char ver[4]=EEPROM_VERSION;
EEPROM_READ_VAR(i,stored_ver); //read stored version
//SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
if (strncmp(ver,stored_ver,3) == 0)
{
// version number match
EEPROM_READ_VAR(i,baudrate);
if(baudrate!=9600 && baudrate!=14400 && baudrate!=19200 && baudrate!=28800 && baudrate!=38400 && baudrate!=56000 && baudrate!=115200 && baudrate!=250000) baudrate=BAUDRATE;
EEPROM_READ_VAR(i,axis_steps_per_unit);
EEPROM_READ_VAR(i,max_feedrate);
EEPROM_READ_VAR(i,max_retraction_feedrate);
EEPROM_READ_VAR(i,max_acceleration_units_per_sq_second);
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
reset_acceleration_rates();
EEPROM_READ_VAR(i,acceleration);
EEPROM_READ_VAR(i,retract_acceleration);
EEPROM_READ_VAR(i,minimumfeedrate);
EEPROM_READ_VAR(i,mintravelfeedrate);
EEPROM_READ_VAR(i,minsegmenttime);
EEPROM_READ_VAR(i,max_xy_jerk);
EEPROM_READ_VAR(i,max_z_jerk);
EEPROM_READ_VAR(i,max_e_jerk);
EEPROM_READ_VAR(i,add_homing);
EEPROM_READ_VAR(i,zprobe_zoffset);
#if EXTRUDERS > 1 && !defined SINGLENOZZLE
EEPROM_READ_VAR(i, hotend_offset);
#endif
#ifdef DELTA
EEPROM_READ_VAR(i,delta_radius);
EEPROM_READ_VAR(i,delta_diagonal_rod);
EEPROM_READ_VAR(i,max_pos);
EEPROM_READ_VAR(i,endstop_adj);
EEPROM_READ_VAR(i,tower_adj);
EEPROM_READ_VAR(i,z_probe_offset);
// Update delta constants for updated delta_radius & tower_adj values
set_delta_constants();
#endif //DELTA
#ifndef ULTIPANEL
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
int absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
int gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed;
#endif
EEPROM_READ_VAR(i,plaPreheatHotendTemp);
EEPROM_READ_VAR(i,plaPreheatHPBTemp);
EEPROM_READ_VAR(i,plaPreheatFanSpeed);
EEPROM_READ_VAR(i,absPreheatHotendTemp);
EEPROM_READ_VAR(i,absPreheatHPBTemp);
EEPROM_READ_VAR(i,absPreheatFanSpeed);
EEPROM_READ_VAR(i,gumPreheatHotendTemp);
EEPROM_READ_VAR(i,gumPreheatHPBTemp);
EEPROM_READ_VAR(i,gumPreheatFanSpeed);
#ifdef PIDTEMP
// do not need to scale PID values as the values in EEPROM are already scaled
EEPROM_READ_VAR(i,Kp);
EEPROM_READ_VAR(i,Ki);
EEPROM_READ_VAR(i,Kd);
#endif // PIDTEMP
#ifndef DOGLCD
int lcd_contrast;
#endif //DOGLCD
EEPROM_READ_VAR(i,lcd_contrast);
#ifdef SCARA
EEPROM_READ_VAR(i,axis_scaling);
#endif //SCARA
#ifdef FWRETRACT
EEPROM_READ_VAR(i,autoretract_enabled);
EEPROM_READ_VAR(i,retract_length);
#if EXTRUDERS > 1
EEPROM_READ_VAR(i,retract_length_swap);
#endif //EXTRUDERS > 1
EEPROM_READ_VAR(i,retract_feedrate);
EEPROM_READ_VAR(i,retract_zlift);
EEPROM_READ_VAR(i,retract_recover_length);
#if EXTRUDERS > 1
EEPROM_READ_VAR(i,retract_recover_length_swap);
#endif //EXTRUDERS > 1
EEPROM_READ_VAR(i,retract_recover_feedrate);
#endif //FWRETRACT
EEPROM_READ_VAR(i, volumetric_enabled);
EEPROM_READ_VAR(i, filament_size[0]);
#if EXTRUDERS > 1
EEPROM_READ_VAR(i, filament_size[1]);
#if EXTRUDERS > 2
EEPROM_READ_VAR(i, filament_size[2]);
#if EXTRUDERS > 3
EEPROM_READ_VAR(i, filament_size[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
calculate_volumetric_multipliers();
// Call updatePID (similar to when we have processed M301)
updatePID();
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Stored settings retrieved");
}
else
{
Config_ResetDefault();
}
#ifdef EEPROM_CHITCHAT
Config_PrintSettings();
#endif //EEPROM_CHITCHAT
Config_ResetDefault();
}
#ifdef EEPROM_CHITCHAT
Config_PrintSettings();
#endif //EEPROM_CHITCHAT
}
#endif //EEPROM_SETTINGS
void Config_ResetDefault()
......@@ -267,55 +268,55 @@ void Config_ResetDefault()
//Setting default baudrate for serial
baudrate=BAUDRATE;
const static float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
const static float tmp2[] = DEFAULT_MAX_FEEDRATE;
const static float tmp3[] = DEFAULT_RETRACTION_MAX_FEEDRATE;
const static long tmp4[] = DEFAULT_MAX_ACCELERATION;
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE;
float tmp3[] = DEFAULT_RETRACTION_MAX_FEEDRATE;
long tmp4[] = DEFAULT_MAX_ACCELERATION;
#ifdef PIDTEMP
const static float tmp5[] = DEFAULT_Kp;
const static float tmp6[] = DEFAULT_Ki;
const static float tmp7[] = DEFAULT_Kd;
float tmp5[] = DEFAULT_Kp;
float tmp6[] = DEFAULT_Ki;
float tmp7[] = DEFAULT_Kd;
#endif // PIDTEMP
#if defined(EXTRUDER_OFFSET_X) && defined(EXTRUDER_OFFSET_Y)
const static float tmp8[] = EXTRUDER_OFFSET_X;
const static float tmp9[] = EXTRUDER_OFFSET_Y;
float tmp8[] = EXTRUDER_OFFSET_X;
float tmp9[] = EXTRUDER_OFFSET_Y;
#else
const static float tmp8[] = {0,0,0,0};
const static float tmp9[] = {0,0,0,0};
float tmp8[] = {0,0,0,0};
float tmp9[] = {0,0,0,0};
#endif
for (short i=0;i<3+EXTRUDERS;i++)
{
for (int i = 0; i < 3 + EXTRUDERS; i++) {
axis_steps_per_unit[i] = tmp1[i];
max_feedrate[i] = tmp2[i];
max_acceleration_units_per_sq_second[i] = tmp4[i];
}
for (short i=0;i<EXTRUDERS;i++)
{
for (int i = 0; i < EXTRUDERS; i++) {
max_retraction_feedrate[i] = tmp3[i];
#if EXTRUDERS > 1 && !defined SINGLENOZZLE
hotend_offset[X_AXIS][i] = tmp8[i];
hotend_offset[Y_AXIS][i] = tmp9[i];
#endif
#ifdef SCARA
axis_scaling[i] = 1;
#endif //SCARA
if (i < sizeof(axis_scaling) / sizeof(*axis_scaling))
axis_scaling[i] = 1;
#endif
}
// steps per sq second need to be updated to agree with the units per sq second
reset_acceleration_rates();
acceleration=DEFAULT_ACCELERATION;
retract_acceleration=DEFAULT_RETRACT_ACCELERATION;
minimumfeedrate=DEFAULT_MINIMUMFEEDRATE;
minsegmenttime=DEFAULT_MINSEGMENTTIME;
mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE;
max_xy_jerk=DEFAULT_XYJERK;
max_z_jerk=DEFAULT_ZJERK;
max_e_jerk=DEFAULT_EJERK;
add_homing[0] = add_homing[1] = add_homing[2] = 0;
acceleration = DEFAULT_ACCELERATION;
retract_acceleration = DEFAULT_RETRACT_ACCELERATION;
travel_acceleration = DEFAULT_TRAVEL_ACCELERATION;
minimumfeedrate = DEFAULT_MINIMUMFEEDRATE;
minsegmenttime = DEFAULT_MINSEGMENTTIME;
mintravelfeedrate = DEFAULT_MINTRAVELFEEDRATE;
max_xy_jerk = DEFAULT_XYJERK;
max_z_jerk = DEFAULT_ZJERK;
max_e_jerk = DEFAULT_EJERK;
add_homing[X_AXIS] = add_homing[Y_AXIS] = add_homing[Z_AXIS] = 0;
#ifdef ENABLE_AUTO_BED_LEVELING
zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER;
......@@ -324,9 +325,9 @@ void Config_ResetDefault()
#endif //ENABLE_AUTO_BED_LEVELING
#ifdef DELTA
endstop_adj[X_AXIS] = endstop_adj[Y_AXIS] = endstop_adj[Z_AXIS] = 0;
delta_radius = DEFAULT_DELTA_RADIUS;
delta_diagonal_rod = DEFAULT_DELTA_DIAGONAL_ROD;
endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0;
tower_adj[0] = tower_adj[1] = tower_adj[2] = tower_adj[3] = tower_adj[4] = tower_adj[5] = 0;
max_pos[2] = MANUAL_Z_HOME_POS;
set_default_z_probe_offset();
......@@ -351,7 +352,7 @@ void Config_ResetDefault()
#ifdef PIDTEMP
#ifndef SINGLENOZZLE
for (int e=0;e<EXTRUDERS;e++)
for (int e = 0; e < EXTRUDERS; e++)
#else
int e = 0; // only need to write once
#endif //SINGLENOZZLE
......@@ -397,239 +398,240 @@ void Config_ResetDefault()
}
#ifndef DISABLE_M503
void Config_PrintSettings()
{ // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Baudrate: ", baudrate);
SERIAL_EOL;
SERIAL_ECHOLNPGM("Steps per unit:");
void Config_PrintSettings()
{ // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Baudrate: ", baudrate);
SERIAL_EOL;
SERIAL_ECHOLNPGM("Steps per unit:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[X_AXIS]);
SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[Y_AXIS]);
SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[Z_AXIS]);
SERIAL_ECHOPAIR(" E0 S",axis_steps_per_unit[E_AXIS + 0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 S",axis_steps_per_unit[E_AXIS + 1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 S",axis_steps_per_unit[E_AXIS + 2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 S",axis_steps_per_unit[E_AXIS + 3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_EOL;
SERIAL_ECHO_START;
#ifdef SCARA
SERIAL_ECHOLNPGM("Scaling factors:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[X_AXIS]);
SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[Y_AXIS]);
SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[Z_AXIS]);
SERIAL_ECHOPAIR(" E0 S",axis_steps_per_unit[E_AXIS + 0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 S",axis_steps_per_unit[E_AXIS + 1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 S",axis_steps_per_unit[E_AXIS + 2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 S",axis_steps_per_unit[E_AXIS + 3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_ECHOPAIR(" M365 X",axis_scaling[X_AXIS]);
SERIAL_ECHOPAIR(" Y",axis_scaling[Y_AXIS]);
SERIAL_ECHOPAIR(" Z",axis_scaling[Z_AXIS]);
SERIAL_EOL;
SERIAL_ECHO_START;
#endif
#ifdef SCARA
SERIAL_ECHOLNPGM("Scaling factors:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M365 X",axis_scaling[X_AXIS]);
SERIAL_ECHOPAIR(" Y",axis_scaling[Y_AXIS]);
SERIAL_ECHOPAIR(" Z",axis_scaling[Z_AXIS]);
SERIAL_EOL;
SERIAL_ECHO_START;
#endif
SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M203 X ",max_feedrate[X_AXIS]);
SERIAL_ECHOPAIR(" Y ",max_feedrate[Y_AXIS] );
SERIAL_ECHOPAIR(" Z ", max_feedrate[Z_AXIS] );
SERIAL_ECHOPAIR(" E0 ", max_feedrate[E_AXIS + 0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 ", max_feedrate[E_AXIS + 1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 ", max_feedrate[E_AXIS + 2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 ", max_feedrate[E_AXIS + 3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Retraction Steps per unit:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" E0 ",max_retraction_feedrate[0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 ",max_retraction_feedrate[1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 ",max_retraction_feedrate[2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 ",max_retraction_feedrate[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M201 X " ,max_acceleration_units_per_sq_second[X_AXIS] );
SERIAL_ECHOPAIR(" Y " , max_acceleration_units_per_sq_second[Y_AXIS] );
SERIAL_ECHOPAIR(" Z " ,max_acceleration_units_per_sq_second[Z_AXIS] );
SERIAL_ECHOPAIR(" E0 " ,max_acceleration_units_per_sq_second[E_AXIS]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 " ,max_acceleration_units_per_sq_second[E_AXIS+1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 " ,max_acceleration_units_per_sq_second[E_AXIS+2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 " ,max_acceleration_units_per_sq_second[E_AXIS+3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Accelerations: P=printing, R=retract and T=travel");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M204 P",acceleration );
SERIAL_ECHOPAIR(" R", retract_acceleration);
SERIAL_ECHOPAIR(" T", travel_acceleration);
SERIAL_EOL;
SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M205 S",minimumfeedrate );
SERIAL_ECHOPAIR(" T" ,mintravelfeedrate );
SERIAL_ECHOPAIR(" B" ,minsegmenttime );
SERIAL_ECHOPAIR(" X" ,max_xy_jerk );
SERIAL_ECHOPAIR(" Z" ,max_z_jerk);
SERIAL_ECHOPAIR(" E" ,max_e_jerk);
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Home offset (mm):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M206 X",add_homing[X_AXIS] );
SERIAL_ECHOPAIR(" Y" ,add_homing[Y_AXIS] );
SERIAL_ECHOPAIR(" Z" ,add_homing[Z_AXIS] );
SERIAL_EOL;
#if EXTRUDERS > 1 && !defined SINGLENOZZLE
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M203 X ",max_feedrate[X_AXIS]);
SERIAL_ECHOPAIR(" Y ",max_feedrate[Y_AXIS] );
SERIAL_ECHOPAIR(" Z ", max_feedrate[Z_AXIS] );
SERIAL_ECHOPAIR(" E0 ", max_feedrate[E_AXIS + 0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 ", max_feedrate[E_AXIS + 1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 ", max_feedrate[E_AXIS + 2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 ", max_feedrate[E_AXIS + 3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_EOL;
SERIAL_ECHOLNPGM("Hotend offset (mm):");
for (int e = 0; e < EXTRUDERS; e++) {
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M218 T", (long unsigned int)e);
SERIAL_ECHOPAIR(" X", hotend_offset[X_AXIS][e]);
SERIAL_ECHOPAIR(" Y" ,hotend_offset[Y_AXIS][e]);
SERIAL_EOL;
}
#endif //EXTRUDERS > 1 && !defined SINGLENOZZLE
#ifdef DELTA
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Retraction Steps per unit:");
SERIAL_ECHOLNPGM("Endstop adjustment (mm):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" E0 ",max_retraction_feedrate[0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 ",max_retraction_feedrate[1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 ",max_retraction_feedrate[2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 ",max_retraction_feedrate[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_ECHOPAIR(" M666 X",endstop_adj[0]);
SERIAL_ECHOPAIR(" Y" ,endstop_adj[1]);
SERIAL_ECHOPAIR(" Z" ,endstop_adj[2]);
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
SERIAL_ECHOLNPGM("Delta Geometry adjustment:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M201 X " ,max_acceleration_units_per_sq_second[X_AXIS] );
SERIAL_ECHOPAIR(" Y " , max_acceleration_units_per_sq_second[Y_AXIS] );
SERIAL_ECHOPAIR(" Z " ,max_acceleration_units_per_sq_second[Z_AXIS] );
SERIAL_ECHOPAIR(" E0 " ,max_acceleration_units_per_sq_second[E_AXIS]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 " ,max_acceleration_units_per_sq_second[E_AXIS+1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 " ,max_acceleration_units_per_sq_second[E_AXIS+2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 " ,max_acceleration_units_per_sq_second[E_AXIS+3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_ECHOPAIR(" M666 A",tower_adj[0]);
SERIAL_ECHOPAIR(" B" ,tower_adj[1]);
SERIAL_ECHOPAIR(" C" ,tower_adj[2]);
SERIAL_ECHOPAIR(" E" ,tower_adj[3]);
SERIAL_ECHOPAIR(" F" ,tower_adj[4]);
SERIAL_ECHOPAIR(" G" ,tower_adj[5]);
SERIAL_ECHOPAIR(" R" ,delta_radius);
SERIAL_ECHOPAIR(" D" ,delta_diagonal_rod);
SERIAL_ECHOPAIR(" H" ,max_pos[2]);
SERIAL_ECHOPAIR(" P" ,z_probe_offset[3]);
SERIAL_EOL;
SERIAL_ECHOLN("Tower Positions");
SERIAL_ECHOPAIR("Tower1 X:",delta_tower1_x);
SERIAL_ECHOPAIR(" Y:",delta_tower1_y);
SERIAL_EOL;
SERIAL_ECHOPAIR("Tower2 X:",delta_tower2_x);
SERIAL_ECHOPAIR(" Y:",delta_tower2_y);
SERIAL_EOL;
SERIAL_ECHOPAIR("Tower3 X:",delta_tower3_x);
SERIAL_ECHOPAIR(" Y:",delta_tower3_y);
SERIAL_EOL;
#endif // DELTA
#ifdef ENABLE_AUTO_BED_LEVELING
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration");
SERIAL_ECHOLNPGM("Z Probe offset (mm)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M204 S",acceleration );
SERIAL_ECHOPAIR(" T" ,retract_acceleration);
SERIAL_ECHOPAIR(" M666 P",zprobe_zoffset);
SERIAL_EOL;
#endif // ENABLE_AUTO_BED_LEVELING
#ifdef PIDTEMP
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:");
#ifndef SINGLENOZZLE
for (int e = 0; e < EXTRUDERS; e++)
#else
int e = 0;
#endif
{
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M301 E", (long unsigned int)e);
SERIAL_ECHOPAIR(" P", Kp[e]);
SERIAL_ECHOPAIR(" I" ,unscalePID_i(Ki[e]));
SERIAL_ECHOPAIR(" D" ,unscalePID_d(Kd[e]));
SERIAL_EOL;
}
#endif // PIDTEMP
#ifdef FWRETRACT
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)");
SERIAL_ECHOLNPGM("Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M205 S",minimumfeedrate );
SERIAL_ECHOPAIR(" T" ,mintravelfeedrate );
SERIAL_ECHOPAIR(" B" ,minsegmenttime );
SERIAL_ECHOPAIR(" X" ,max_xy_jerk );
SERIAL_ECHOPAIR(" Z" ,max_z_jerk);
SERIAL_ECHOPAIR(" E" ,max_e_jerk);
SERIAL_ECHOPAIR(" M207 S",retract_length);
SERIAL_ECHOPAIR(" F" ,retract_feedrate*60);
SERIAL_ECHOPAIR(" Z" ,retract_zlift);
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Home offset (mm):");
SERIAL_ECHOLNPGM("Recover: S=Extra length (mm) F:Speed (mm/m)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M206 X",add_homing[X_AXIS] );
SERIAL_ECHOPAIR(" Y" ,add_homing[Y_AXIS] );
SERIAL_ECHOPAIR(" Z" ,add_homing[Z_AXIS] );
SERIAL_ECHOPAIR(" M208 S",retract_recover_length);
SERIAL_ECHOPAIR(" F" ,retract_recover_feedrate*60);
SERIAL_EOL;
#if EXTRUDERS > 1 && !defined SINGLENOZZLE
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Hotend offset (mm):");
for (int e = 0; e < EXTRUDERS; e++) {
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M218 T", (long unsigned int)e);
SERIAL_ECHOPAIR(" X", hotend_offset[X_AXIS][e]);
SERIAL_ECHOPAIR(" Y" ,hotend_offset[Y_AXIS][e]);
SERIAL_EOL;
}
#endif //EXTRUDERS > 1 && !defined SINGLENOZZLE
#ifdef DELTA
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Endstop adjustment (mm):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M666 X",endstop_adj[0]);
SERIAL_ECHOPAIR(" Y" ,endstop_adj[1]);
SERIAL_ECHOPAIR(" Z" ,endstop_adj[2]);
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M209 S", (unsigned long)(autoretract_enabled ? 1 : 0));
SERIAL_EOL;
#if EXTRUDERS > 1
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Delta Geometry adjustment:");
SERIAL_ECHOLNPGM("Multi-extruder settings:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M666 A",tower_adj[0]);
SERIAL_ECHOPAIR(" B" ,tower_adj[1]);
SERIAL_ECHOPAIR(" C" ,tower_adj[2]);
SERIAL_ECHOPAIR(" E" ,tower_adj[3]);
SERIAL_ECHOPAIR(" F" ,tower_adj[4]);
SERIAL_ECHOPAIR(" G" ,tower_adj[5]);
SERIAL_ECHOPAIR(" R" ,delta_radius);
SERIAL_ECHOPAIR(" D" ,delta_diagonal_rod);
SERIAL_ECHOPAIR(" H" ,max_pos[2]);
SERIAL_ECHOPAIR(" P" ,z_probe_offset[3]);
SERIAL_ECHOPAIR(" Swap retract length (mm): ", retract_length_swap);
SERIAL_EOL;
SERIAL_ECHOLN("Tower Positions");
SERIAL_ECHOPAIR("Tower1 X:",delta_tower1_x);
SERIAL_ECHOPAIR(" Y:",delta_tower1_y);
SERIAL_EOL;
SERIAL_ECHOPAIR("Tower2 X:",delta_tower2_x);
SERIAL_ECHOPAIR(" Y:",delta_tower2_y);
SERIAL_EOL;
SERIAL_ECHOPAIR("Tower3 X:",delta_tower3_x);
SERIAL_ECHOPAIR(" Y:",delta_tower3_y);
SERIAL_EOL;
#endif // DELTA
#ifdef ENABLE_AUTO_BED_LEVELING
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Z Probe offset (mm)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M666 P",zprobe_zoffset);
SERIAL_ECHOPAIR(" Swap rec. addl. length (mm): ", retract_recover_length_swap);
SERIAL_EOL;
#endif // ENABLE_AUTO_BED_LEVELING
#ifdef PIDTEMP
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:");
#ifndef SINGLENOZZLE
for (int e = 0; e < EXTRUDERS; e++)
#else
int e = 0;
#endif
{
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M301 E", (long unsigned int)e);
SERIAL_ECHOPAIR(" P", Kp[e]);
SERIAL_ECHOPAIR(" I" ,unscalePID_i(Ki[e]));
SERIAL_ECHOPAIR(" D" ,unscalePID_d(Kd[e]));
SERIAL_EOL;
}
#endif // PIDTEMP
#ifdef FWRETRACT
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
#endif //EXTRUDERS > 1
SERIAL_ECHO_START;
if (volumetric_enabled)
{
SERIAL_ECHOLNPGM("Filament settings:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M207 S",retract_length);
SERIAL_ECHOPAIR(" F" ,retract_feedrate*60);
SERIAL_ECHOPAIR(" Z" ,retract_zlift);
SERIAL_ECHOPAIR(" M200 D", filament_size[0]);
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Recover: S=Extra length (mm) F:Speed (mm/m)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M208 S",retract_recover_length);
SERIAL_ECHOPAIR(" F" ,retract_recover_feedrate*60);
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M209 S", (unsigned long)(autoretract_enabled ? 1 : 0));
SERIAL_EOL;
#if EXTRUDERS > 1
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Multi-extruder settings:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" Swap retract length (mm): ", retract_length_swap);
SERIAL_EOL;
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" Swap rec. addl. length (mm): ", retract_recover_length_swap);
SERIAL_EOL;
#endif //EXTRUDERS > 1
SERIAL_ECHO_START;
if (volumetric_enabled)
{
SERIAL_ECHOLNPGM("Filament settings:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M200 D", filament_size[0]);
SERIAL_ECHOPAIR(" M200 T1 D", filament_size[1]);
SERIAL_EOL;
#if EXTRUDERS > 1
#if EXTRUDERS > 2
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M200 T1 D", filament_size[1]);
SERIAL_EOL;
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]);
SERIAL_EOL;
#if EXTRUDERS > 3
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]);
SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]);
SERIAL_EOL;
#if EXTRUDERS > 3
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]);
SERIAL_EOL;
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
} else
{
SERIAL_ECHOLNPGM("Filament settings: Disabled");
}
#endif //FWRETRACT
}
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
} else
{
SERIAL_ECHOLNPGM("Filament settings: Disabled");
}
#endif //FWRETRACT
}
#endif //!DISABLE_M503
......@@ -92,7 +92,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define FRONT_PROBE_BED_POSITION 20
#define BACK_PROBE_BED_POSITION 180
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
#define XY_TRAVEL_SPEED 10000 // X and Y axis travel speed between probes, in mm/min
//If you have enabled the Auto Bed Levelling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!!!
......@@ -123,6 +123,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID
#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
......@@ -136,7 +137,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#endif // AUTO_BED_LEVELING_GRID
// Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets must be integers
// X and Y offsets MUST be INTEGERS
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!)
......@@ -180,6 +181,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define DEFAULT_ACCELERATION 2500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 10000 // E max acceleration in mm/s^2 for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
......
......@@ -92,7 +92,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define FRONT_PROBE_BED_POSITION 20
#define BACK_PROBE_BED_POSITION 180
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
#define XY_TRAVEL_SPEED 10000 // X and Y axis travel speed between probes, in mm/min
//If you have enabled the Auto Bed Levelling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!!!
......@@ -123,6 +123,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID
#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
......@@ -180,6 +181,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define DEFAULT_ACCELERATION 2500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 10000 // E max acceleration in mm/s^2 for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
......
......@@ -130,8 +130,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define DEFAULT_RETRACTION_MAX_FEEDRATE {150,150,150,150} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_MAX_ACCELERATION {2000,2000,2000,1000,1000,1000,1000} // X, Y, Z, E0, E1, E2, E3 maximum start speed for accelerated moves.
#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 2500 // X, Y, Z and E max acceleration in mm/s^2 for retracts
#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 2500 // X, Y, Z and E max acceleration in mm/s^2 for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves
// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
#define DEFAULT_XYJERK 20 // (mm/sec)
......
......@@ -147,6 +147,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID
#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
......@@ -189,8 +190,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the lo
//Manual homing switch locations:
// For SCARA: Offset between HomingPosition and Bed X=0 / Y=0
#define MANUAL_X_HOME_POS -22.
#define MANUAL_Y_HOME_POS -52.
#define MANUAL_X_HOME_POS -22
#define MANUAL_Y_HOME_POS -52
#define MANUAL_Z_HOME_POS 0.1 // Distance between nozzle and print surface after homing.
// MOVEMENT SETTINGS
......@@ -203,8 +204,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define DEFAULT_RETRACTION_MAX_FEEDRATE {80,80,80,80} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_MAX_ACCELERATION {5000,5000,50,5000,5000,5000,5000} // X, Y, Z, E0, E1, E2, E3 maximum start speed for accelerated moves.
#define DEFAULT_ACCELERATION 400 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 2000 // X, Y, Z and E max acceleration in mm/s^2 for retracts
#define DEFAULT_ACCELERATION 400 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 2000 // X, Y, Z and E max acceleration in mm/s^2 for retracts
#define DEFAULT_TRAVEL_ACCELERATION 400 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
......
......@@ -218,6 +218,7 @@
#else
#define Z_HOME_RETRACT_MM 2
#endif
#define HOMING_BUMP_DIVISOR {10, 10, 2} // Re-Bump Speed Divisor (Divides the Homing Feedrate)
//#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
#define AXIS_RELATIVE_MODES {false, false, false, false}
......@@ -468,6 +469,141 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#endif
#endif
/******************************************************************************\
* enable this section if you have TMC26X motor drivers.
* you need to import the TMC26XStepper library into the arduino IDE for this
******************************************************************************/
//#define HAVE_TMCDRIVER
#ifdef HAVE_TMCDRIVER
// #define X_IS_TMC
#define X_MAX_CURRENT 1000 //in mA
#define X_SENSE_RESISTOR 91 //in mOhms
#define X_MICROSTEPS 16 //number of microsteps
// #define X2_IS_TMC
#define X2_MAX_CURRENT 1000 //in mA
#define X2_SENSE_RESISTOR 91 //in mOhms
#define X2_MICROSTEPS 16 //number of microsteps
// #define Y_IS_TMC
#define Y_MAX_CURRENT 1000 //in mA
#define Y_SENSE_RESISTOR 91 //in mOhms
#define Y_MICROSTEPS 16 //number of microsteps
// #define Y2_IS_TMC
#define Y2_MAX_CURRENT 1000 //in mA
#define Y2_SENSE_RESISTOR 91 //in mOhms
#define Y2_MICROSTEPS 16 //number of microsteps
// #define Z_IS_TMC
#define Z_MAX_CURRENT 1000 //in mA
#define Z_SENSE_RESISTOR 91 //in mOhms
#define Z_MICROSTEPS 16 //number of microsteps
// #define Z2_IS_TMC
#define Z2_MAX_CURRENT 1000 //in mA
#define Z2_SENSE_RESISTOR 91 //in mOhms
#define Z2_MICROSTEPS 16 //number of microsteps
// #define E0_IS_TMC
#define E0_MAX_CURRENT 1000 //in mA
#define E0_SENSE_RESISTOR 91 //in mOhms
#define E0_MICROSTEPS 16 //number of microsteps
// #define E1_IS_TMC
#define E1_MAX_CURRENT 1000 //in mA
#define E1_SENSE_RESISTOR 91 //in mOhms
#define E1_MICROSTEPS 16 //number of microsteps
// #define E2_IS_TMC
#define E2_MAX_CURRENT 1000 //in mA
#define E2_SENSE_RESISTOR 91 //in mOhms
#define E2_MICROSTEPS 16 //number of microsteps
// #define E3_IS_TMC
#define E3_MAX_CURRENT 1000 //in mA
#define E3_SENSE_RESISTOR 91 //in mOhms
#define E3_MICROSTEPS 16 //number of microsteps
#endif
/******************************************************************************\
* enable this section if you have L6470 motor drivers.
* you need to import the L6470 library into the arduino IDE for this
******************************************************************************/
//#define HAVE_L6470DRIVER
#ifdef HAVE_L6470DRIVER
// #define X_IS_L6470
#define X_MICROSTEPS 16 //number of microsteps
#define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define X_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define X_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define X2_IS_L6470
#define X2_MICROSTEPS 16 //number of microsteps
#define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Y_IS_L6470
#define Y_MICROSTEPS 16 //number of microsteps
#define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Y2_IS_L6470
#define Y2_MICROSTEPS 16 //number of microsteps
#define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Z_IS_L6470
#define Z_MICROSTEPS 16 //number of microsteps
#define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Z2_IS_L6470
#define Z2_MICROSTEPS 16 //number of microsteps
#define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E0_IS_L6470
#define E0_MICROSTEPS 16 //number of microsteps
#define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E1_IS_L6470
#define E1_MICROSTEPS 16 //number of microsteps
#define E1_MICROSTEPS 16 //number of microsteps
#define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E2_IS_L6470
#define E2_MICROSTEPS 16 //number of microsteps
#define E2_MICROSTEPS 16 //number of microsteps
#define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E3_IS_L6470
#define E3_MICROSTEPS 16 //number of microsteps
#define E3_MICROSTEPS 16 //number of microsteps
#define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall
#endif
//===========================================================================
//============================= Define Defines ============================
//===========================================================================
......
......@@ -112,11 +112,11 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#if defined(DUAL_X_CARRIAGE) && defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1 \
&& defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
#define enable_x() do { WRITE(X_ENABLE_PIN, X_ENABLE_ON); WRITE(X2_ENABLE_PIN, X_ENABLE_ON); } while (0)
#define disable_x() do { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); WRITE(X2_ENABLE_PIN,!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0)
#define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0)
#define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0)
#elif defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
#define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
#define disable_x() { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
#define enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
#else
#define enable_x() ;
#define disable_x() ;
......@@ -124,11 +124,11 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
#ifdef Y_DUAL_STEPPER_DRIVERS
#define enable_y() { WRITE(Y_ENABLE_PIN, Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, Y_ENABLE_ON); }
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, !Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#else
#define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#define enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON)
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#endif
#else
#define enable_y() ;
......@@ -137,11 +137,11 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
#ifdef Z_DUAL_STEPPER_DRIVERS
#define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#define enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON)
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#endif
#else
#define enable_z() ;
......@@ -149,32 +149,32 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif
#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
#define enable_e0() WRITE(E0_ENABLE_PIN, E_ENABLE_ON)
#define disable_e0() WRITE(E0_ENABLE_PIN,!E_ENABLE_ON)
#define enable_e0() E0_ENABLE_WRITE(E_ENABLE_ON)
#define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e0() /* nothing */
#define disable_e0() /* nothing */
#endif
#if (DRIVER_EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
#define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON)
#define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON)
#define enable_e1() E1_ENABLE_WRITE(E_ENABLE_ON)
#define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e1() /* nothing */
#define disable_e1() /* nothing */
#endif
#if (DRIVER_EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
#define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON)
#define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON)
#define enable_e2() E2_ENABLE_WRITE(E_ENABLE_ON)
#define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e2() /* nothing */
#define disable_e2() /* nothing */
#endif
#if (DRIVER_EXTRUDERS > 3) && defined(E3_ENABLE_PIN) && (E3_ENABLE_PIN > -1)
#define enable_e3() WRITE(E3_ENABLE_PIN, E_ENABLE_ON)
#define disable_e3() WRITE(E3_ENABLE_PIN,!E_ENABLE_ON)
#define enable_e3() E3_ENABLE_WRITE(E_ENABLE_ON)
#define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e3() /* nothing */
#define disable_e3() /* nothing */
......
/* -*- c++ -*- */
/*
Reprap firmware based on Marlin
Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
Copyright (C) 2014 MagoKimbra
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -199,8 +202,10 @@ M999 - Restart after being stopped by error
unsigned long baudrate;
float homing_feedrate[] = HOMING_FEEDRATE;
bool axis_known_position[3] = {false, false, false};
float zprobe_zoffset;
#ifdef ENABLE_AUTO_BED_LEVELING
int xy_travel_speed = XY_TRAVEL_SPEED;
#endif
int homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedmultiply = 100; //100->1 200->2
int saved_feedmultiply;
......@@ -285,28 +290,43 @@ bool cancel_heatup = false;
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
bool axis_known_position[3] = { false, false, false };
float zprobe_zoffset;
float lastpos[4];
// Extruder offset
#if EXTRUDERS > 1
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
#if EXTRUDERS > 1
#ifndef DUAL_X_CARRIAGE
#define NUM_EXTRUDER_OFFSETS 2 // only in XY plane
#else
#define NUM_EXTRUDER_OFFSETS 3 // supports offsets in XYZ plane
#endif
float hotend_offset[NUM_EXTRUDER_OFFSETS][EXTRUDERS];
#endif // end SINGLENOZZLE
#endif // end EXTRUDERS
float hotend_offset[NUM_EXTRUDER_OFFSETS][EXTRUDERS] = {
#if defined(EXTRUDER_OFFSET_X)
EXTRUDER_OFFSET_X
#else
0
#endif
,
#if defined(EXTRUDER_OFFSET_Y)
EXTRUDER_OFFSET_Y
#else
0
#endif
};
#endif //EXTRUDERS > 1
#endif //SINGLENOZZLE
uint8_t active_extruder = 0;
uint8_t active_driver = 0;
uint8_t debugLevel = 0;
#ifdef SERVO_ENDSTOPS && (NUM_SERVOS > 0)
#ifdef NUM_SERVOS > 0
int servo_endstops[] = SERVO_ENDSTOPS;
int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES;
#endif //SERVO_ENDSTOPS && (NUM_SERVOS > 0)
#endif //NUM_SERVOS > 0
#ifdef BARICUDA
int ValvePressure = 0;
......@@ -764,9 +784,9 @@ void setup()
#endif // FIRMWARE_TEST
}
void loop()
{
if (buflen < (BUFSIZE-1)) get_command();
void loop() {
if(buflen < (BUFSIZE-1))
get_command();
#ifdef SDSUPPORT
card.checkautostart(false);
#endif
......@@ -814,167 +834,194 @@ void get_command()
{
if(drain_queued_commands_P()) // priority is given to non-serial commands
return;
while( MYSERIAL.available() > 0 && buflen < BUFSIZE) {
serial_char = MYSERIAL.read();
if(serial_char == '\n' ||
serial_char == '\r' ||
(serial_char == ':' && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1)) {
if(!serial_count) { //if empty line
comment_mode = false; //for new command
serial_count >= (MAX_CMD_SIZE - 1) )
{
// end of line == end of comment
comment_mode = false;
if(!serial_count) {
// short cut for empty lines
return;
}
cmdbuffer[bufindw][serial_count] = 0; //terminate string
if(!comment_mode) {
comment_mode = false; //for new command
fromsd[bufindw] = false;
if(strchr(cmdbuffer[bufindw], 'N') != NULL) {
strchr_pointer = strchr(cmdbuffer[bufindw], 'N');
gcode_N = (strtol(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL, 10));
if(gcode_N != gcode_LastN+1 && (strstr_P(cmdbuffer[bufindw], PSTR("M110")) == NULL) ) {
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_LINE_NO);
SERIAL_ERRORLN(gcode_LastN);
//Serial.println(gcode_N);
FlushSerialRequestResend();
serial_count = 0;
return;
}
if(strchr(cmdbuffer[bufindw], '*') != NULL) {
byte checksum = 0;
byte count = 0;
while(cmdbuffer[bufindw][count] != '*') checksum = checksum^cmdbuffer[bufindw][count++];
strchr_pointer = strchr(cmdbuffer[bufindw], '*');
if ((int)(strtod(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL)) != checksum) {
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_CHECKSUM_MISMATCH);
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend();
serial_count = 0;
return;
}
//if no errors, continue parsing
}
else {
fromsd[bufindw] = false;
if(strchr(cmdbuffer[bufindw], 'N') != NULL)
{
strchr_pointer = strchr(cmdbuffer[bufindw], 'N');
gcode_N = (strtol(strchr_pointer + 1, NULL, 10));
if(gcode_N != gcode_LastN+1 && (strstr_P(cmdbuffer[bufindw], PSTR("M110")) == NULL) ) {
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_LINE_NO);
SERIAL_ERRORLN(gcode_LastN);
//Serial.println(gcode_N);
FlushSerialRequestResend();
serial_count = 0;
return;
}
if(strchr(cmdbuffer[bufindw], '*') != NULL)
{
byte checksum = 0;
byte count = 0;
while(cmdbuffer[bufindw][count] != '*') checksum = checksum^cmdbuffer[bufindw][count++];
strchr_pointer = strchr(cmdbuffer[bufindw], '*');
if(strtol(strchr_pointer + 1, NULL, 10) != checksum) {
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_NO_CHECKSUM);
SERIAL_ERRORPGM(MSG_ERR_CHECKSUM_MISMATCH);
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend();
serial_count = 0;
return;
}
gcode_LastN = gcode_N;
//if no errors, continue parsing
}
else { // if we don't receive 'N' but still see '*'
if((strchr(cmdbuffer[bufindw], '*') != NULL)) {
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM);
SERIAL_ERRORLN(gcode_LastN);
serial_count = 0;
return;
}
else
{
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_NO_CHECKSUM);
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend();
serial_count = 0;
return;
}
if((strchr(cmdbuffer[bufindw], 'G') != NULL)) {
strchr_pointer = strchr(cmdbuffer[bufindw], 'G');
switch((int)((strtod(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL)))) {
case 0:
case 1:
case 2:
case 3:
if (Stopped == true) {
SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
}
break;
default:
break;
gcode_LastN = gcode_N;
//if no errors, continue parsing
}
else // if we don't receive 'N' but still see '*'
{
if((strchr(cmdbuffer[bufindw], '*') != NULL))
{
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM);
SERIAL_ERRORLN(gcode_LastN);
serial_count = 0;
return;
}
}
if((strchr(cmdbuffer[bufindw], 'G') != NULL)){
strchr_pointer = strchr(cmdbuffer[bufindw], 'G');
switch(strtol(strchr_pointer + 1, NULL, 10)){
case 0:
case 1:
case 2:
case 3:
if (Stopped == true) {
SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
}
break;
default:
break;
}
//If command was e-stop process now
if(strcmp(cmdbuffer[bufindw], "M112") == 0)
kill();
bufindw = (bufindw + 1)%BUFSIZE;
buflen += 1;
}
//If command was e-stop process now
if(strcmp(cmdbuffer[bufindw], "M112") == 0)
kill();
bufindw = (bufindw + 1)%BUFSIZE;
buflen += 1;
serial_count = 0; //clear buffer
}
else {
if(serial_char == ';') comment_mode = true;
if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char;
else if(serial_char == '\\') { //Handle escapes
if(MYSERIAL.available() > 0 && buflen < BUFSIZE) {
// if we have one more character, copy it over
serial_char = MYSERIAL.read();
cmdbuffer[bufindw][serial_count++] = serial_char;
}
//otherwise do nothing
}
else { // its not a newline, carriage return or escape char
if(serial_char == ';') comment_mode = true;
if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char;
}
}
#ifdef SDSUPPORT
if(!card.sdprinting || serial_count!=0) {
return;
}
if(!card.sdprinting || serial_count!=0){
return;
}
//'#' stops reading from SD to the buffer prematurely, so procedural macro calls are possible
// if it occurs, stop_buffering is triggered and the buffer is ran dry.
// this character _can_ occur in serial com, due to checksums. however, no checksums are used in SD printing
static bool stop_buffering=false;
if(buflen==0) stop_buffering=false;
while( !card.eof() && buflen < BUFSIZE && !stop_buffering) {
int16_t n=card.get();
serial_char = (char)n;
if(serial_char == '\n' ||
serial_char == '\r' ||
(serial_char == '#' && comment_mode == false) ||
(serial_char == ':' && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1)||n==-1)
{
if(card.eof()){
SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
stoptime=millis();
char time[30];
unsigned long t=(stoptime-starttime)/1000;
int hours, minutes;
minutes=(t/60)%60;
hours=t/60/60;
sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes);
SERIAL_ECHO_START;
SERIAL_ECHOLN(time);
lcd_setstatus(time);
card.printingHasFinished();
card.checkautostart(true);
//'#' stops reading from SD to the buffer prematurely, so procedural macro calls are possible
// if it occurs, stop_buffering is triggered and the buffer is ran dry.
// this character _can_ occur in serial com, due to checksums. however, no checksums are used in SD printing
static bool stop_buffering=false;
if(buflen==0) stop_buffering=false;
while (!card.eof() && buflen < BUFSIZE && !stop_buffering) {
int16_t n=card.get();
serial_char = (char)n;
if (serial_char == '\n' ||
serial_char == '\r' ||
(serial_char == '#' && comment_mode == false) ||
(serial_char == ':' && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1)||n==-1) {
if (card.eof()) {
SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
stoptime=millis();
char time[30];
unsigned long t=(stoptime-starttime)/1000;
int hours, minutes;
minutes=(t/60)%60;
hours=t/60/60;
sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes);
SERIAL_ECHO_START;
SERIAL_ECHOLN(time);
lcd_setstatus(time);
card.printingHasFinished();
card.checkautostart(true);
}
if(serial_char=='#')
stop_buffering=true;
if(!serial_count) {
comment_mode = false; //for new command
return; //if empty line
}
cmdbuffer[bufindw][serial_count] = 0; //terminate string
// if(!comment_mode){
fromsd[bufindw] = true;
buflen += 1;
bufindw = (bufindw + 1)%BUFSIZE;
// }
comment_mode = false; //for new command
serial_count = 0; //clear buffer
}
else {
if(serial_char == ';') comment_mode = true;
if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char;
if(serial_char=='#')
stop_buffering=true;
if(!serial_count)
{
comment_mode = false; //for new command
return; //if empty line
}
cmdbuffer[bufindw][serial_count] = 0; //terminate string
// if(!comment_mode){
fromsd[bufindw] = true;
buflen += 1;
bufindw = (bufindw + 1)%BUFSIZE;
// }
comment_mode = false; //for new command
serial_count = 0; //clear buffer
}
else
{
if(serial_char == ';') comment_mode = true;
if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char;
}
}
#endif //SDSUPPORT
}
float code_value()
{
return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL));
return (strtod(strchr_pointer + 1, NULL));
}
long code_value_long()
{
return (strtol(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL, 10));
return (strtol(strchr_pointer + 1, NULL, 10));
}
bool code_seen(char code)
......@@ -1016,39 +1063,33 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#error "Please use canonical x-carriage assignment" // the x-carriages are defined by their homing directions
#endif
#define DXC_FULL_CONTROL_MODE 0
#define DXC_AUTO_PARK_MODE 1
#define DXC_DUPLICATION_MODE 2
static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
#define DXC_FULL_CONTROL_MODE 0
#define DXC_AUTO_PARK_MODE 1
#define DXC_DUPLICATION_MODE 2
static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
static float x_home_pos(int extruder)
{
if (extruder == 0)
{
return base_home_pos(X_AXIS) + add_homing[X_AXIS];
}
else
{
// In dual carriage mode the extruder offset provides an override of the
// second X-carriage offset when homed - otherwise X2_HOME_POS is used.
// This allow soft recalibration of the second extruder offset position without firmware reflash
// (through the M218 command).
return (hotend_offset[X_AXIS][1] > 0) ? hotend_offset[X_AXIS][1] : X2_HOME_POS;
}
}
static float x_home_pos(int extruder) {
if (extruder == 0)
return base_home_pos(X_AXIS) + add_homing[X_AXIS];
else
// In dual carriage mode the extruder offset provides an override of the
// second X-carriage offset when homed - otherwise X2_HOME_POS is used.
// This allow soft recalibration of the second extruder offset position without firmware reflash
// (through the M218 command).
return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
}
static int x_home_dir(int extruder)
{
return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
}
static int x_home_dir(int extruder) {
return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
}
static float inactive_extruder_x_pos = X2_MAX_POS; // used in mode 0 & 1
static bool active_extruder_parked = false; // used in mode 1 & 2
static float raised_parked_position[NUM_AXIS]; // used in mode 1
static unsigned long delayed_move_time = 0; // used in mode 1
static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
static float duplicate_extruder_temp_offset = 0; // used in mode 2
bool extruder_duplication_enabled = false; // used in mode 2
static float inactive_extruder_x_pos = X2_MAX_POS; // used in mode 0 & 1
static bool active_extruder_parked = false; // used in mode 1 & 2
static float raised_parked_position[NUM_AXIS]; // used in mode 1
static unsigned long delayed_move_time = 0; // used in mode 1
static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
static float duplicate_extruder_temp_offset = 0; // used in mode 2
bool extruder_duplication_enabled = false; // used in mode 2
#endif //DUAL_X_CARRIAGE
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA)
......@@ -1194,7 +1235,14 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
st_synchronize();
// move back down slowly to find bed
feedrate = homing_feedrate[Z_AXIS]/4;
if (homing_bump_divisor[Z_AXIS] >= 1) {
feedrate = homing_feedrate[Z_AXIS]/homing_bump_divisor[Z_AXIS];
}
else {
feedrate = homing_feedrate[Z_AXIS]/10;
SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1");
}
zPosition -= home_retract_mm(Z_AXIS) * 2;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
st_synchronize();
......@@ -1212,7 +1260,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
st_synchronize();
feedrate = XY_TRAVEL_SPEED;
feedrate = xy_travel_speed;
current_position[X_AXIS] = x;
current_position[Y_AXIS] = y;
......@@ -1275,29 +1323,35 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#endif //NUM_SERVOS > 0
}
/// Probe bed height at position (x,y), returns the measured z value
static float probe_pt(float x, float y, float z_before, int retract_action=0) {
enum ProbeAction { ProbeStay, ProbeEngage, ProbeRetract, ProbeEngageRetract };
// Probe bed height at position (x,y), returns the measured z value
static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageRetract, int verbose_level=1) {
// move to right place
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
#ifndef Z_PROBE_SLED
if ((retract_action==0) || (retract_action==1)) engage_z_probe(); // Engage Z Servo endstop if available
if (retract_action & ProbeEngage) engage_z_probe();
#endif // Z_PROBE_SLED
run_z_probe();
float measured_z = current_position[Z_AXIS];
#ifndef Z_PROBE_SLED
if ((retract_action==0) || (retract_action==3)) retract_z_probe();
if (retract_action & ProbeRetract) retract_z_probe();
#endif // Z_PROBE_SLED
SERIAL_PROTOCOLPGM(MSG_BED);
SERIAL_PROTOCOLPGM(" X: ");
SERIAL_PROTOCOL(x + 0.0001);
SERIAL_PROTOCOLPGM(" Y: ");
SERIAL_PROTOCOL(y + 0.0001);
SERIAL_PROTOCOLPGM(" Z: ");
SERIAL_PROTOCOL(measured_z + 0.0001);
SERIAL_EOL;
if (verbose_level > 2) {
SERIAL_PROTOCOLPGM(MSG_BED);
SERIAL_PROTOCOLPGM(" X: ");
SERIAL_PROTOCOL(x + 0.0001);
SERIAL_PROTOCOLPGM(" Y: ");
SERIAL_PROTOCOL(y + 0.0001);
SERIAL_PROTOCOLPGM(" Z: ");
SERIAL_PROTOCOL(measured_z + 0.0001);
SERIAL_EOL;
}
return measured_z;
}
#endif //ENABLE_AUTO_BED_LEVELING
......@@ -1344,7 +1398,15 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
st_synchronize();
destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
feedrate = homing_feedrate[axis]/2 ;
if (homing_bump_divisor[axis] >= 1) {
feedrate = homing_feedrate[axis]/homing_bump_divisor[axis];
}
else {
feedrate = homing_feedrate[axis]/10;
SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1");
}
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver);
st_synchronize();
axis_is_at_home(axis);
......@@ -2461,6 +2523,44 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
#ifdef ENABLE_AUTO_BED_LEVELING
// Define the possible boundaries for probing based on set limits
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#ifdef AUTO_BED_LEVELING_GRID
// Make sure probing points are reachable
#if LEFT_PROBE_BED_POSITION < MIN_PROBE_X
#error "The given LEFT_PROBE_BED_POSITION can't be reached by the probe."
#elif RIGHT_PROBE_BED_POSITION > MAX_PROBE_X
#error "The given RIGHT_PROBE_BED_POSITION can't be reached by the probe."
#elif FRONT_PROBE_BED_POSITION < MIN_PROBE_Y
#error "The given FRONT_PROBE_BED_POSITION can't be reached by the probe."
#elif BACK_PROBE_BED_POSITION > MAX_PROBE_Y
#error "The given BACK_PROBE_BED_POSITION can't be reached by the probe."
#endif
#else // !AUTO_BED_LEVELING_GRID
#if ABL_PROBE_PT_1_X < MIN_PROBE_X || ABL_PROBE_PT_1_X > MAX_PROBE_X
#error "The given ABL_PROBE_PT_1_X can't be reached by the probe."
#elif ABL_PROBE_PT_2_X < MIN_PROBE_X || ABL_PROBE_PT_2_X > MAX_PROBE_X
#error "The given ABL_PROBE_PT_2_X can't be reached by the probe."
#elif ABL_PROBE_PT_3_X < MIN_PROBE_X || ABL_PROBE_PT_3_X > MAX_PROBE_X
#error "The given ABL_PROBE_PT_3_X can't be reached by the probe."
#elif ABL_PROBE_PT_1_Y < MIN_PROBE_Y || ABL_PROBE_PT_1_Y > MAX_PROBE_Y
#error "The given ABL_PROBE_PT_1_Y can't be reached by the probe."
#elif ABL_PROBE_PT_2_Y < MIN_PROBE_Y || ABL_PROBE_PT_2_Y > MAX_PROBE_Y
#error "The given ABL_PROBE_PT_2_Y can't be reached by the probe."
#elif ABL_PROBE_PT_3_Y < MIN_PROBE_Y || ABL_PROBE_PT_3_Y > MAX_PROBE_Y
#error "The given ABL_PROBE_PT_3_Y can't be reached by the probe."
#endif
#endif // !AUTO_BED_LEVELING_GRID
/**
* G29: Detailed Z-Probe, probes the bed at 3 or more points.
* Will fail if the printer has not been homed with G28.
......@@ -2472,6 +2572,8 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
* P Set the size of the grid that will be probed (P x P points).
* Example: "G29 P4"
*
* S Set the XY travel speed between probe points (in mm/min)
*
* V Set the verbose level (0-4). Example: "G29 V3"
*
* T Generate a Bed Topology Report. Example: "G29 P5 T" for a detailed report.
......@@ -2492,7 +2594,6 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
*
*/
enum ProbeAction { ProbeStay, ProbeEngage, ProbeRetract, ProbeEngageRetract };
// Use one of these defines to specify the origin
// for a topographical map to be printed for your bed.
enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
......@@ -2500,8 +2601,6 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
inline void gcode_G29() {
float x_tmp, y_tmp, z_tmp, real_z;
// Prevent user from running a G29 without first homing in X and Y
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
......@@ -2510,26 +2609,24 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
return;
}
int verbose_level = 1;
float x_tmp, y_tmp, z_tmp, real_z;
if (code_seen('V') || code_seen('v')) {
verbose_level = code_value_long();
if (verbose_level < 0 || verbose_level > 4) {
SERIAL_PROTOCOLPGM("?(V)erbose Level is implausible (0-4).\n");
return;
}
}
bool enhanced_g29 = code_seen('E') || code_seen('e');
#ifdef AUTO_BED_LEVELING_GRID
// Example Syntax: G29 N4 V2 E T
int verbose_level = 1;
bool topo_flag = code_seen('T') || code_seen('t');
bool topo_flag = verbose_level > 2 || code_seen('T') || code_seen('t');
if (code_seen('V') || code_seen('v')) {
verbose_level = code_value();
if (verbose_level < 0 || verbose_level > 4) {
SERIAL_PROTOCOLPGM("?(V)erbose Level is implausible (0-4).\n");
return;
}
if (verbose_level > 0) {
SERIAL_PROTOCOLPGM("G29 Enhanced Auto Bed Leveling Code:\n");
if (verbose_level > 2) topo_flag = true;
}
}
if (verbose_level > 0) SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling\n");
int auto_bed_leveling_grid_points = code_seen('P') ? code_value_long() : AUTO_BED_LEVELING_GRID_POINTS;
if (auto_bed_leveling_grid_points < 2) {
......@@ -2537,48 +2634,38 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
return;
}
// Define the possible boundaries for probing based on the set limits.
// Code above (in G28) might have these limits wrong, or I am wrong here.
#define MIN_PROBE_EDGE 10 // Edges of the probe square can be no less
const int min_probe_x = max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER),
max_probe_x = min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER),
min_probe_y = max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER),
max_probe_y = min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER);
xy_travel_speed = code_seen('S') ? code_value_long() : XY_TRAVEL_SPEED;
int left_probe_bed_position = code_seen('L') ? code_value_long() : LEFT_PROBE_BED_POSITION,
right_probe_bed_position = code_seen('R') ? code_value_long() : RIGHT_PROBE_BED_POSITION,
front_probe_bed_position = code_seen('F') ? code_value_long() : FRONT_PROBE_BED_POSITION,
back_probe_bed_position = code_seen('B') ? code_value_long() : BACK_PROBE_BED_POSITION;
bool left_out_l = left_probe_bed_position < min_probe_x,
left_out_r = left_probe_bed_position > right_probe_bed_position - MIN_PROBE_EDGE,
left_out = left_out_l || left_out_r,
right_out_r = right_probe_bed_position > max_probe_x,
right_out_l =right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE,
right_out = right_out_l || right_out_r,
front_out_f = front_probe_bed_position < min_probe_y,
front_out_b = front_probe_bed_position > back_probe_bed_position - MIN_PROBE_EDGE,
front_out = front_out_f || front_out_b,
back_out_b = back_probe_bed_position > max_probe_y,
back_out_f = back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE,
back_out = back_out_f || back_out_b;
bool left_out_l = left_probe_bed_position < MIN_PROBE_X,
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - MIN_PROBE_EDGE,
right_out_r = right_probe_bed_position > MAX_PROBE_X,
right_out = right_out_r || right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE,
front_out_f = front_probe_bed_position < MIN_PROBE_Y,
front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - MIN_PROBE_EDGE,
back_out_b = back_probe_bed_position > MAX_PROBE_Y,
back_out = back_out_b || back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE;
if (left_out || right_out || front_out || back_out) {
if (left_out) {
SERIAL_PROTOCOLPGM("?Probe (L)eft position out of range.\n");
left_probe_bed_position = left_out_l ? min_probe_x : right_probe_bed_position - MIN_PROBE_EDGE;
left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - MIN_PROBE_EDGE;
}
if (right_out) {
SERIAL_PROTOCOLPGM("?Probe (R)ight position out of range.\n");
right_probe_bed_position = right_out_r ? max_probe_x : left_probe_bed_position + MIN_PROBE_EDGE;
right_probe_bed_position = right_out_r ? MAX_PROBE_X : left_probe_bed_position + MIN_PROBE_EDGE;
}
if (front_out) {
SERIAL_PROTOCOLPGM("?Probe (F)ront position out of range.\n");
front_probe_bed_position = front_out_f ? min_probe_y : back_probe_bed_position - MIN_PROBE_EDGE;
front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - MIN_PROBE_EDGE;
}
if (back_out) {
SERIAL_PROTOCOLPGM("?Probe (B)ack position out of range.\n");
back_probe_bed_position = back_out_b ? max_probe_y : front_probe_bed_position + MIN_PROBE_EDGE;
back_probe_bed_position = back_out_b ? MAX_PROBE_Y : front_probe_bed_position + MIN_PROBE_EDGE;
}
return;
}
......@@ -2656,7 +2743,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
else
act = ProbeEngageRetract;
measured_z = probe_pt(xProbe, yProbe, z_before, act);
measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level);
mean += measured_z;
......@@ -2732,6 +2819,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
} //topo_flag
set_bed_level_equation_lsq(plane_equation_coefficients);
free(plane_equation_coefficients);
......@@ -2742,14 +2830,14 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
if (enhanced_g29) {
// Basic Enhanced G29
z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngage);
z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeStay);
z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetract);
z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngage, verbose_level);
z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeStay, verbose_level);
z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetract, verbose_level);
}
else {
z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING);
z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level);
z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level);
z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level);
}
clean_up_after_endstop_move();
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
......@@ -3664,6 +3752,33 @@ inline void gcode_G92() {
}
#endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST
/*
* M204: Set Accelerations in mm/sec^2 (M204 P1200 R3000 T3000)
*
* P = Printing moves
* R = Retract only (no X, Y, Z) moves
* T = Travel (non printing) moves
*
* Also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate
*/
inline void gcode_M204() {
if (code_seen('P')) {
acceleration = code_value();
SERIAL_ECHOPAIR("Setting Printing Acceleration: ", acceleration );
SERIAL_EOL;
}
if (code_seen('R')) {
retract_acceleration = code_value();
SERIAL_ECHOPAIR("Setting Retract Acceleration: ", retract_acceleration );
SERIAL_EOL;
}
if (code_seen('T')) {
travel_acceleration = code_value();
SERIAL_ECHOPAIR("Setting Travel Acceleration: ", travel_acceleration );
SERIAL_EOL;
}
}
#ifdef FILAMENTCHANGEENABLE
//M600: Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
inline void gcode_M600() {
......@@ -4817,10 +4932,7 @@ void process_commands()
}
break;
case 204: //M204 acceleration S normal moves T filament only moves
{
if(code_seen('S')) acceleration = code_value() ;
if(code_seen('T')) retract_acceleration = code_value() ;
}
gcode_M204();
break;
case 205: //M205 advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
{
......@@ -5645,12 +5757,9 @@ void process_commands()
(delayed_move_time != 0 || current_position[X_AXIS] != x_home_pos(active_extruder)))
{
// Park old head: 1) raise 2) move to park position 3) lower
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder, active_driver);
plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder, active_driver);
plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder, active_driver);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder, active_driver);
plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder, active_driver);
plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder, active_driver);
st_synchronize();
}
......@@ -5959,7 +6068,6 @@ void prepare_move()
destination[i] = current_position[i] + difference[i] * fraction;
}
calculate_delta(destination);
//SERIAL_ECHOPGM("destination[0]="); SERIAL_ECHOLN(destination[0]);
//SERIAL_ECHOPGM("destination[1]="); SERIAL_ECHOLN(destination[1]);
......@@ -5968,9 +6076,7 @@ void prepare_move()
//SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
//SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
destination[E_AXIS], feedrate*feedmultiply/60/100.0,
active_extruder, active_driver);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder, active_driver);
}
#endif // SCARA
......@@ -6008,9 +6114,7 @@ void prepare_move()
//SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);
adjust_delta(destination);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
destination[E_AXIS], feedrate*feedmultiply/60/100.0,
active_extruder, active_driver);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder, active_driver);
}
#endif // DELTA
......@@ -6022,8 +6126,7 @@ void prepare_move()
{
// move duplicate extruder into correct duplication position.
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], max_feedrate[X_AXIS], 1, active_driver);
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1, active_driver);
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
st_synchronize();
extruder_duplication_enabled = true;
......@@ -6046,12 +6149,9 @@ void prepare_move()
}
delayed_move_time = 0;
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS],
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder, active_driver);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder, active_driver);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder, active_driver);
plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder, active_driver);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder, active_driver);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder, active_driver);
active_extruder_parked = false;
}
}
......
......@@ -159,8 +159,8 @@
#define MSG_PID_TIMEOUT MSG_PID_AUTOTUNE_FAILED " timeout"
#define MSG_BIAS " bias: "
#define MSG_D " d: "
#define MSG_MIN " min: "
#define MSG_MAX " max: "
#define MSG_T_MIN " min: "
#define MSG_T_MAX " max: "
#define MSG_KU " Ku: "
#define MSG_TU " Tu: "
#define MSG_CLASSIC_PID " Classic PID "
......@@ -214,8 +214,7 @@
#define STR_h3 "3"
#define STR_Deg "\271"
#define STR_THERMOMETER "\002"
#endif
#ifdef DISPLAY_CHARSET_HD44780_WESTERN // HD44780 ROM Code: A02 (Western)
#elif defined(DISPLAY_CHARSET_HD44780_WESTERN) // HD44780 ROM Code: A02 (Western)
#define STR_Ae "\216"
#define STR_ae "\204"
#define STR_Oe "\211"
......@@ -227,6 +226,8 @@
#define STR_h3 "\263"
#define STR_Deg "\337"
#define STR_THERMOMETER "\002"
#elif defined(ULTRA_LCD)
#error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN for your LCD controller.
#endif
#endif
/*
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax"
#define MSG_A_RETRACT "A-retrac."
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X trangos/mm"
#define MSG_YSTEPS "Y trangos/mm"
#define MSG_ZSTEPS "Z trangos/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X passos/mm"
#define MSG_YSTEPS "Y passos/mm"
#define MSG_ZSTEPS "Z passos/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-Retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X steps/mm"
#define MSG_YSTEPS "Y steps/mm"
#define MSG_ZSTEPS "Z steps/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X steps/mm"
#define MSG_YSTEPS "Y steps/mm"
#define MSG_ZSTEPS "Z steps/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "Vvacio min"
#define MSG_AMAX "Amax"
#define MSG_A_RETRACT "A-retrac."
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X pasos/mm"
#define MSG_YSTEPS "Y pasos/mm"
#define MSG_ZSTEPS "Z pasos/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-retrakt"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X pausoak/mm"
#define MSG_YSTEPS "Y pausoak/mm"
#define MSG_ZSTEPS "Z pausoak/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "VLiike min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-peruuta"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X steps/mm"
#define MSG_YSTEPS "Y steps/mm"
#define MSG_ZSTEPS "Z steps/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "Vdepl min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X pas/mm"
#define MSG_YSTEPS "Y pas/mm"
#define MSG_ZSTEPS "Z pas/mm"
......
......@@ -62,15 +62,16 @@
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
#define MSG_VE_JERK "Ve-jerk"
#define MSG_VMAX "Vmax "
#define MSG_VMAX "Vmax"
#define MSG_X "x"
#define MSG_Y "y"
#define MSG_Z "z"
#define MSG_E "e"
#define MSG_VMIN "Vmin"
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_AMAX "Amax"
#define MSG_A_RETRACT "A-retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X steps/mm"
#define MSG_YSTEPS "Y steps/mm"
#define MSG_ZSTEPS "Z steps/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X steps/mm"
#define MSG_YSTEPS "Y steps/mm"
#define MSG_ZSTEPS "Z steps/mm"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "Vskok min"
#define MSG_AMAX "Amax"
#define MSG_A_RETRACT "A-wycofanie"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "krokiX/mm"
#define MSG_YSTEPS "krokiY/mm"
#define MSG_ZSTEPS "krokiZ/mm"
......
......@@ -71,13 +71,14 @@
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "Xpasso/mm"
#define MSG_YSTEPS "Ypasso/mm"
#define MSG_ZSTEPS "Zpasso/mm"
#define MSG_E0STEPS "E0 steps/mm"
#define MSG_E1STEPS "E1 steps/mm"
#define MSG_E2STEPS "E2 steps/mm"
#define MSG_E3STEPS "E3 steps/mm"
#define MSG_E0STEPS "E0 passo/mm"
#define MSG_E1STEPS "E1 passo/mm"
#define MSG_E2STEPS "E2 passo/mm"
#define MSG_E3STEPS "E3 passo/mm"
#define MSG_TEMPERATURE "Temperatura"
#define MSG_MOTION "Movimento"
#define MSG_VOLUMETRIC "Filament"
......
......@@ -13,108 +13,109 @@
#define MSG_SD_REMOVED "Cartao removido"
#define MSG_MAIN " Menu principal \003"
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS " Apagar motores"
#define MSG_AUTO_HOME "Ir para origen"
#define MSG_DISABLE_STEPPERS " Desligar motores"
#define MSG_AUTO_HOME "Ir para home"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_HOME_OFFSETS "Def. home offsets"
#define MSG_SET_ORIGIN "Estabelecer orig."
#define MSG_PREHEAT_PLA "Pre-aquecer PLA"
#define MSG_PREHEAT_PLA_ALL " pre-aq. PLA Tudo"
#define MSG_PREHEAT_PLA_BEDONLY " pre-aq. PLA \002Base"
#define MSG_PREHEAT_PLA_SETTINGS "PLA setting"
#define MSG_PREHEAT_PLA_ALL "Pre-aq. PLA Tudo"
#define MSG_PREHEAT_PLA_BEDONLY "Pre-aq. PLA \002Base"
#define MSG_PREHEAT_PLA_SETTINGS "PLA definicoes"
#define MSG_PREHEAT_ABS "Pre-aquecer ABS"
#define MSG_PREHEAT_ABS_ALL " pre-aq. ABS Tudo"
#define MSG_PREHEAT_ABS_BEDONLY " pre-aq. ABS \002Base"
#define MSG_PREHEAT_ABS_SETTINGS "ABS setting"
#define MSG_PREHEAT_GUM "Preheat GUM"
#define MSG_PREHEAT_GUM_ALL "Preheat GUM All"
#define MSG_PREHEAT_GUM_BEDONLY "Preheat GUM Bed"
#define MSG_PREHEAT_GUM_SETTINGS "Preheat GUM conf"
#define MSG_COOLDOWN "Esfriar"
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE "Extrudar"
#define MSG_PREHEAT_ABS_ALL "Pre-aq. ABS Tudo"
#define MSG_PREHEAT_ABS_BEDONLY "Pre-aq. ABS \002Base"
#define MSG_PREHEAT_ABS_SETTINGS "ABS definicoes"
#define MSG_PREHEAT_GUM "Pre-aquecer GUM"
#define MSG_PREHEAT_GUM_ALL "Pre-aquecer GUM Tudo"
#define MSG_PREHEAT_GUM_BEDONLY "Pre-aquecer GUM \002Base"
#define MSG_PREHEAT_GUM_SETTINGS "GUM definicoes"
#define MSG_COOLDOWN "Arrefecer"
#define MSG_SWITCH_PS_ON "Ligar"
#define MSG_SWITCH_PS_OFF "Desligar"
#define MSG_EXTRUDE "Extrudir"
#define MSG_RETRACT "Retrair"
#define MSG_MOVE_AXIS "Mover eixo \x7E"
#define MSG_MOVE_X "Move X"
#define MSG_MOVE_Y "Move Y"
#define MSG_MOVE_Z "Move Z"
#define MSG_MOVE_E "Extruder"
#define MSG_MOVE_01MM "Move 0.1mm"
#define MSG_MOVE_1MM "Move 1mm"
#define MSG_MOVE_10MM "Move 10mm"
#define MSG_SPEED "Velocidade:"
#define MSG_NOZZLE "Nozzle:"
#define MSG_BED "Base:"
#define MSG_FAN_SPEED "Velocidade vento."
#define MSG_MOVE_X "Mover X"
#define MSG_MOVE_Y "Mover Y"
#define MSG_MOVE_Z "Mover Z"
#define MSG_MOVE_E "Extrusor"
#define MSG_MOVE_01MM "Mover 0.1mm"
#define MSG_MOVE_1MM "Mover 1mm"
#define MSG_MOVE_10MM "Mover 10mm"
#define MSG_SPEED "Velocidade"
#define MSG_NOZZLE "\002Bico"
#define MSG_BED "\002Base"
#define MSG_FAN_SPEED "Velocidade do ar."
#define MSG_FLOW "Fluxo"
#define MSG_CONTROL "Controle"
#define MSG_MIN " " STR_THERMOMETER " Min"
#define MSG_MAX " " STR_THERMOMETER " Max"
#define MSG_FACTOR " " STR_THERMOMETER " Fact"
#define MSG_AUTOTEMP "Autotemp:"
#define MSG_CONTROL "Controlo \003"
#define MSG_MIN "\002 Min"
#define MSG_MAX "\002 Max"
#define MSG_FACTOR "\002 Fact"
#define MSG_AUTOTEMP "Autotemp"
#define MSG_ON "On "
#define MSG_OFF "Off"
#define MSG_PID_P "PID-P: "
#define MSG_PID_I "PID-I: "
#define MSG_PID_D "PID-D: "
#define MSG_ACC "Acc:"
#define MSG_VXY_JERK "Vxy-jerk: "
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_ACC "Acc"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
#define MSG_VE_JERK "Ve-jerk"
#define MSG_VMAX " Vmax "
#define MSG_X "x:"
#define MSG_Y "y:"
#define MSG_Z "z:"
#define MSG_E "e:"
#define MSG_VMIN "Vmin:"
#define MSG_VTRAV_MIN "VTrav min:"
#define MSG_X "x"
#define MSG_Y "y"
#define MSG_Z "z"
#define MSG_E "e"
#define MSG_VMIN "Vmin"
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-retract:"
#define MSG_XSTEPS "Xpasso/mm:"
#define MSG_YSTEPS "Ypasso/mm:"
#define MSG_ZSTEPS "Zpasso/mm:"
#define MSG_E0STEPS "E0 steps/mm"
#define MSG_E1STEPS "E1 steps/mm"
#define MSG_E2STEPS "E2 steps/mm"
#define MSG_E3STEPS "E3 steps/mm"
#define MSG_A_RETRACT "A-retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "Xpasso/mm"
#define MSG_YSTEPS "Ypasso/mm"
#define MSG_ZSTEPS "Zpasso/mm"
#define MSG_E0STEPS "E0 passo/mm"
#define MSG_E1STEPS "E1 passo/mm"
#define MSG_E2STEPS "E2 passo/mm"
#define MSG_E3STEPS "E3 passo/mm"
#define MSG_TEMPERATURE "Temperatura"
#define MSG_MOTION "Movimento"
#define MSG_VOLUMETRIC "Filament"
#define MSG_VOLUMETRIC "Filamento"
#define MSG_VOLUMETRIC_ENABLED "E in mm" STR_h3
#define MSG_FILAMENT_SIZE_EXTRUDER "Fil. Dia."
#define MSG_CONTRAST "Contrast"
#define MSG_STORE_EPROM "Guardar memoria"
#define MSG_LOAD_EPROM "Carregar memoria"
#define MSG_FILAMENT_SIZE_EXTRUDER "Fil. Diam."
#define MSG_CONTRAST "Contraste"
#define MSG_STORE_EPROM "Guardar na memoria"
#define MSG_LOAD_EPROM "Carregar da memoria"
#define MSG_RESTORE_FAILSAFE "Rest. de emergen."
#define MSG_REFRESH "Recarregar"
#define MSG_WATCH "Monitorar"
#define MSG_PREPARE "Preparar"
#define MSG_TUNE "Tune"
#define MSG_REFRESH "\004Recarregar"
#define MSG_WATCH "Monitorar \003"
#define MSG_PREPARE "Preparar \x7E"
#define MSG_TUNE "Afinar \x7E"
#define MSG_PAUSE_PRINT "Pausar impressao"
#define MSG_RESUME_PRINT "Resumir impressao"
#define MSG_STOP_PRINT "Parar impressao"
#define MSG_CARD_MENU "Menu cartao SD"
#define MSG_NO_CARD "Sem cartao SD"
#define MSG_DWELL "Repouso..."
#define MSG_USERWAIT "Esperando ordem"
#define MSG_RESUMING "Resuming print"
#define MSG_PRINT_ABORTED "Print aborted"
#define MSG_USERWAIT "A espera de ordem"
#define MSG_RESUMING "Resumir impressao"
#define MSG_PRINT_ABORTED "Impr. Cancelada"
#define MSG_NO_MOVE "Sem movimento"
#define MSG_KILLED "PARADA DE EMERG."
#define MSG_STOPPED "PARADA. "
#define MSG_CONTROL_RETRACT " Retrair mm:"
#define MSG_CONTROL_RETRACT_SWAP "Troca Retrair mm:"
#define MSG_CONTROL_RETRACTF " Retrair V:"
#define MSG_CONTROL_RETRACT_ZLIFT " Levantar mm:"
#define MSG_CONTROL_RETRACT_RECOVER " DesRet +mm:"
#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Troca DesRet +mm:"
#define MSG_CONTROL_RETRACT_RECOVERF " DesRet V:"
#define MSG_AUTORETRACT " AutoRetr.:"
#define MSG_FILAMENTCHANGE "Change filament"
#define MSG_INIT_SDCARD "Init. SD-Card"
#define MSG_CNG_SDCARD "Change SD-Card"
#define MSG_ZPROBE_OUT "Son. fora da mesa"
#define MSG_KILLED "INTRRP. DE EMERG."
#define MSG_STOPPED "PARADO. "
#define MSG_CONTROL_RETRACT " Retrair mm"
#define MSG_CONTROL_RETRACT_SWAP "Troca Retrair mm"
#define MSG_CONTROL_RETRACTF " Retrair V"
#define MSG_CONTROL_RETRACT_ZLIFT " Levantar mm"
#define MSG_CONTROL_RETRACT_RECOVER " DesRet +mm"
#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Troca DesRet +mm"
#define MSG_CONTROL_RETRACT_RECOVERF " DesRet V"
#define MSG_AUTORETRACT " AutoRetr."
#define MSG_FILAMENTCHANGE "Trocar filamento"
#define MSG_INIT_SDCARD "Inic. SD-Card"
#define MSG_CNG_SDCARD "Trocar SD-Card"
#define MSG_ZPROBE_OUT "Sens. fora da Base"
#define MSG_POSITION_UNKNOWN "XY antes de Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
#define MSG_BABYSTEP_X "Babystep X"
......
......@@ -71,6 +71,7 @@
#define MSG_VTRAV_MIN "VTrav min"
#define MSG_AMAX "Amax "
#define MSG_A_RETRACT "A-retract"
#define MSG_A_TRAVEL "A-travel"
#define MSG_XSTEPS "X шаг/mm"
#define MSG_YSTEPS "Y шаг/mm"
#define MSG_ZSTEPS "Z шаг/mm"
......
......@@ -68,8 +68,9 @@ float max_retraction_feedrate[EXTRUDERS]; // set the max speeds for retraction
float axis_steps_per_unit[3 + EXTRUDERS];
unsigned long max_acceleration_units_per_sq_second[3 + EXTRUDERS]; // Use M201 to override by software
float minimumfeedrate;
float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all printing moves. M204 SXXXX
float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
float travel_acceleration; // Travel acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all NON printing moves. M204 MXXXX
float max_xy_jerk; //speed than can be stopped at once, if i understand correctly.
float max_z_jerk;
float max_e_jerk;
......@@ -708,64 +709,82 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
if(block->steps_x != 0) enable_x();
if(block->steps_y != 0) enable_y();
#endif //NOCOREXY
#ifndef Z_LATE_ENABLE
if(block->steps_z != 0) enable_z();
#endif
#ifndef Z_LATE_ENABLE
if(block->steps_z != 0) enable_z();
#endif
// Enable extruder(s)
if(block->steps_e != 0)
{
if (DISABLE_INACTIVE_EXTRUDER) //enable only selected extruder
{
#if !defined(MKR4) && !defined(NPR2)
if (DISABLE_INACTIVE_EXTRUDER) //enable only selected extruder
{
if(g_uc_extruder_last_move[0] > 0) g_uc_extruder_last_move[0]--;
if(g_uc_extruder_last_move[1] > 0) g_uc_extruder_last_move[1]--;
if(g_uc_extruder_last_move[2] > 0) g_uc_extruder_last_move[2]--;
if(g_uc_extruder_last_move[3] > 0) g_uc_extruder_last_move[3]--;
if(g_uc_extruder_last_move[0] > 0) g_uc_extruder_last_move[0]--;
if(g_uc_extruder_last_move[1] > 0) g_uc_extruder_last_move[1]--;
if(g_uc_extruder_last_move[2] > 0) g_uc_extruder_last_move[2]--;
if(g_uc_extruder_last_move[3] > 0) g_uc_extruder_last_move[3]--;
switch(extruder)
{
case 0:
enable_e0();
g_uc_extruder_last_move[0] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[1] == 0) disable_e1();
if(g_uc_extruder_last_move[2] == 0) disable_e2();
if(g_uc_extruder_last_move[3] == 0) disable_e3();
break;
case 1:
enable_e1();
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[0] == 0) disable_e0();
if(g_uc_extruder_last_move[2] == 0) disable_e2();
if(g_uc_extruder_last_move[3] == 0) disable_e3();
break;
case 2:
enable_e2();
g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[0] == 0) disable_e0();
if(g_uc_extruder_last_move[1] == 0) disable_e1();
if(g_uc_extruder_last_move[3] == 0) disable_e3();
break;
case 3:
enable_e3();
g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[0] == 0) disable_e0();
if(g_uc_extruder_last_move[1] == 0) disable_e1();
if(g_uc_extruder_last_move[2] == 0) disable_e2();
break;
}
}
else //enable all
{
enable_e0();
enable_e1();
enable_e2();
enable_e3();
}
#else //MKR4 or NPr2
switch(extruder)
{
case 0:
enable_e0();
g_uc_extruder_last_move[0] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[1] == 0) disable_e1();
if(g_uc_extruder_last_move[2] == 0) disable_e2();
if(g_uc_extruder_last_move[3] == 0) disable_e3();
case 0:
enable_e0();
break;
case 1:
enable_e1();
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[0] == 0) disable_e0();
if(g_uc_extruder_last_move[2] == 0) disable_e2();
if(g_uc_extruder_last_move[3] == 0) disable_e3();
enable_e1();
break;
case 2:
enable_e2();
g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[0] == 0) disable_e0();
if(g_uc_extruder_last_move[1] == 0) disable_e1();
if(g_uc_extruder_last_move[3] == 0) disable_e3();
break;
enable_e0();
break;
case 3:
enable_e3();
g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[0] == 0) disable_e0();
if(g_uc_extruder_last_move[1] == 0) disable_e1();
if(g_uc_extruder_last_move[2] == 0) disable_e2();
break;
enable_e1();
break;
}
}
else //enable all
{
enable_e0();
enable_e1();
enable_e2();
enable_e3();
}
#endif //!MKR4 && !NPR2
}
if (block->steps_e == 0)
......@@ -959,19 +978,24 @@ Having the real displacement of the head, we can calculate the total movement le
{
block->acceleration_st = ceil(retract_acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
}
else if(block->steps_e == 0)
{
block->acceleration_st = ceil(travel_acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
}
else
{
block->acceleration_st = ceil(acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
// Limit acceleration per axis
if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > axis_steps_per_sqr_second[X_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > axis_steps_per_sqr_second[Y_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
if(((float)block->acceleration_st * (float)block->steps_e / (float)block->step_event_count) > axis_steps_per_sqr_second[E_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
}
// Limit acceleration per axis
if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > axis_steps_per_sqr_second[X_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > axis_steps_per_sqr_second[Y_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
if(((float)block->acceleration_st * (float)block->steps_e / (float)block->step_event_count) > axis_steps_per_sqr_second[E_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
block->acceleration = block->acceleration_st / steps_per_mm;
block->acceleration_rate = (long)((float)block->acceleration_st * (16777216.0 / (F_CPU / 8.0)));
......
......@@ -116,6 +116,7 @@ extern unsigned long max_acceleration_units_per_sq_second[3 + EXTRUDERS]; // Use
extern float minimumfeedrate;
extern float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
extern float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
extern float travel_acceleration; // Travel acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all NON printing moves. M204 MXXXX
extern float max_xy_jerk; //speed than can be stopped at once, if i understand correctly.
extern float max_z_jerk;
extern float max_e_jerk;
......
......@@ -406,58 +406,62 @@ ISR(TIMER1_COMPA_vect)
// Set the direction bits (X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY)
if((out_bits & (1<<X_AXIS))!=0) {
#ifdef DUAL_X_CARRIAGE
if (extruder_duplication_enabled) {
WRITE(X_DIR_PIN, INVERT_X_DIR);
WRITE(X2_DIR_PIN, INVERT_X_DIR);
if (extruder_duplication_enabled){
X_DIR_WRITE(INVERT_X_DIR);
X2_DIR_WRITE(INVERT_X_DIR);
}
else {
if (current_block->active_driver != 0)
WRITE(X2_DIR_PIN, INVERT_X_DIR);
else{
if (current_block->active_extruder != 0)
X2_DIR_WRITE(INVERT_X_DIR);
else
WRITE(X_DIR_PIN, INVERT_X_DIR);
X_DIR_WRITE(INVERT_X_DIR);
}
#else
WRITE(X_DIR_PIN, INVERT_X_DIR);
X_DIR_WRITE(INVERT_X_DIR);
#endif
count_direction[X_AXIS]=-1;
}
else {
#ifdef DUAL_X_CARRIAGE
if (extruder_duplication_enabled) {
WRITE(X_DIR_PIN, !INVERT_X_DIR);
WRITE(X2_DIR_PIN, !INVERT_X_DIR);
if (extruder_duplication_enabled){
X_DIR_WRITE(!INVERT_X_DIR);
X2_DIR_WRITE( !INVERT_X_DIR);
}
else {
if (current_block->active_driver != 0)
WRITE(X2_DIR_PIN, !INVERT_X_DIR);
else{
if (current_block->active_extruder != 0)
X2_DIR_WRITE(!INVERT_X_DIR);
else
WRITE(X_DIR_PIN, !INVERT_X_DIR);
X_DIR_WRITE(!INVERT_X_DIR);
}
#else
WRITE(X_DIR_PIN, !INVERT_X_DIR);
X_DIR_WRITE(!INVERT_X_DIR);
#endif
count_direction[X_AXIS]=1;
}
if((out_bits & (1<<Y_AXIS))!=0) {
WRITE(Y_DIR_PIN, INVERT_Y_DIR);
#ifdef Y_DUAL_STEPPER_DRIVERS
WRITE(Y2_DIR_PIN, !(INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
#endif
if((out_bits & (1<<Y_AXIS))!=0){
Y_DIR_WRITE(INVERT_Y_DIR);
#ifdef Y_DUAL_STEPPER_DRIVERS
Y2_DIR_WRITE(!(INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
#endif
count_direction[Y_AXIS]=-1;
}
else {
WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
#ifdef Y_DUAL_STEPPER_DRIVERS
WRITE(Y2_DIR_PIN, (INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
#endif
else{
Y_DIR_WRITE(!INVERT_Y_DIR);
#ifdef Y_DUAL_STEPPER_DRIVERS
Y2_DIR_WRITE((INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
#endif
count_direction[Y_AXIS]=1;
}
CHECK_ENDSTOPS { // check X and Y Endstops
#ifndef COREXY
if ((out_bits & (1<<X_AXIS)) != 0) // stepping along -X axis (regular cartesians bot)
if ((out_bits & (1<<X_AXIS)) != 0)
#else
if (!((current_block->steps_x == current_block->steps_y) && ((out_bits & (1<<X_AXIS))>>X_AXIS != (out_bits & (1<<Y_AXIS))>>Y_AXIS))) // AlexBorro: If DeltaX == -DeltaY, the movement is only in Y axis
if (!((current_block->steps_x == current_block->steps_y) && ((out_bits & (1<<X_AXIS))>>X_AXIS != (out_bits & (1<<Y_AXIS))>>Y_AXIS)))
if ((out_bits & (1<<X_HEAD)) != 0)
#endif
{ // -direction
......@@ -498,7 +502,7 @@ ISR(TIMER1_COMPA_vect)
#ifndef COREXY
if ((out_bits & (1<<Y_AXIS)) != 0) // -direction
#else
if (!((current_block->steps_x == current_block->steps_y) && ((out_bits & (1<<X_AXIS))>>X_AXIS == (out_bits & (1<<Y_AXIS))>>Y_AXIS))) // AlexBorro: If DeltaX == DeltaY, the movement is only in X axis
if (!((current_block->steps_x == current_block->steps_y) && ((out_bits & (1<<X_AXIS))>>X_AXIS == (out_bits & (1<<Y_AXIS))>>Y_AXIS)))
if ((out_bits & (1<<Y_HEAD)) != 0)
#endif
{ // -direction
......@@ -526,9 +530,9 @@ ISR(TIMER1_COMPA_vect)
}
if ((out_bits & (1<<Z_AXIS)) != 0) { // -direction
WRITE(Z_DIR_PIN,INVERT_Z_DIR);
Z_DIR_WRITE(INVERT_Z_DIR);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_DIR_PIN,INVERT_Z_DIR);
Z2_DIR_WRITE(INVERT_Z_DIR);
#endif
count_direction[Z_AXIS]=-1;
......@@ -545,9 +549,9 @@ ISR(TIMER1_COMPA_vect)
}
}
else { // +direction
WRITE(Z_DIR_PIN,!INVERT_Z_DIR);
Z_DIR_WRITE(!INVERT_Z_DIR);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_DIR_PIN,!INVERT_Z_DIR);
Z2_DIR_WRITE(!INVERT_Z_DIR);
#endif
count_direction[Z_AXIS]=1;
......@@ -606,130 +610,129 @@ ISR(TIMER1_COMPA_vect)
}
#endif //ADVANCE
#ifdef CONFIG_STEPPERS_TOSHIBA
/* The toshiba stepper controller require much longer pulses
* tjerfore we 'stage' decompose the pulses between high, and
* low instead of doing each in turn. The extra tests add enough
* lag to allow it work with without needing NOPs
*/
counter_x += current_block->steps_x;
#ifdef CONFIG_STEPPERS_TOSHIBA
/* The toshiba stepper controller require much longer pulses
* tjerfore we 'stage' decompose the pulses between high, and
* low instead of doing each in turn. The extra tests add enough
* lag to allow it work with without needing NOPs */
if (counter_x > 0) {
WRITE(X_STEP_PIN, HIGH);
}
if (counter_x > 0) X_STEP_WRITE(HIGH);
counter_y += current_block->steps_y;
if (counter_y > 0) {
WRITE(Y_STEP_PIN, HIGH);
}
counter_y += current_block->steps_y;
if (counter_y > 0) Y_STEP_WRITE(HIGH);
counter_z += current_block->steps_z;
if (counter_z > 0) {
WRITE(Z_STEP_PIN, HIGH);
}
counter_z += current_block->steps_z;
if (counter_z > 0) Z_STEP_WRITE(HIGH);
#ifndef ADVANCE
counter_e += current_block->steps_e;
if (counter_e > 0) {
WRITE_E_STEP(HIGH);
}
#endif //!ADVANCE
#ifndef ADVANCE
counter_e += current_block->steps_e;
if (counter_e > 0) WRITE_E_STEP(HIGH);
#endif //!ADVANCE
if (counter_x > 0) {
counter_x -= current_block->step_event_count;
count_position[X_AXIS]+=count_direction[X_AXIS];
WRITE(X_STEP_PIN, LOW);
}
if (counter_x > 0) {
counter_x -= current_block->step_event_count;
count_position[X_AXIS] += count_direction[X_AXIS];
X_STEP_WRITE(LOW);
}
if (counter_y > 0) {
counter_y -= current_block->step_event_count;
count_position[Y_AXIS]+=count_direction[Y_AXIS];
WRITE(Y_STEP_PIN, LOW);
}
if (counter_y > 0) {
counter_y -= current_block->step_event_count;
count_position[Y_AXIS] += count_direction[Y_AXIS];
Y_STEP_WRITE( LOW);
}
if (counter_z > 0) {
counter_z -= current_block->step_event_count;
count_position[Z_AXIS]+=count_direction[Z_AXIS];
WRITE(Z_STEP_PIN, LOW);
}
if (counter_z > 0) {
counter_z -= current_block->step_event_count;
count_position[Z_AXIS] += count_direction[Z_AXIS];
Z_STEP_WRITE(LOW);
}
#ifndef ADVANCE
if (counter_e > 0) {
counter_e -= current_block->step_event_count;
count_position[E_AXIS]+=count_direction[E_AXIS];
WRITE_E_STEP(LOW);
}
#endif //!ADVANCE
#else
if (counter_x > 0) {
#ifdef DUAL_X_CARRIAGE
if (extruder_duplication_enabled){
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
WRITE(X2_STEP_PIN, !INVERT_X_STEP_PIN);
}
else {
if (current_block->active_driver != 0)
WRITE(X2_STEP_PIN, !INVERT_X_STEP_PIN);
else
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
}
#else
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
#endif
counter_x -= current_block->step_event_count;
count_position[X_AXIS]+=count_direction[X_AXIS];
#ifdef DUAL_X_CARRIAGE
if (extruder_duplication_enabled) {
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
WRITE(X2_STEP_PIN, INVERT_X_STEP_PIN);
}
else {
if (current_block->active_driver != 0)
WRITE(X2_STEP_PIN, INVERT_X_STEP_PIN);
else
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
}
#else
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
#endif
#ifndef ADVANCE
if (counter_e > 0) {
counter_e -= current_block->step_event_count;
count_position[E_AXIS] += count_direction[E_AXIS];
WRITE_E_STEP(LOW);
}
#endif //!ADVANCE
#else
counter_x += current_block->steps_x;
if (counter_x > 0) {
#ifdef DUAL_X_CARRIAGE
if (extruder_duplication_enabled){
X_STEP_WRITE(!INVERT_X_STEP_PIN);
X2_STEP_WRITE( !INVERT_X_STEP_PIN);
}
else {
if (current_block->active_driver != 0)
X2_STEP_WRITE( !INVERT_X_STEP_PIN);
else
X_STEP_WRITE(!INVERT_X_STEP_PIN);
}
#else
X_STEP_WRITE(!INVERT_X_STEP_PIN);
#endif
counter_x -= current_block->step_event_count;
count_position[X_AXIS] += count_direction[X_AXIS];
#ifdef DUAL_X_CARRIAGE
if (extruder_duplication_enabled){
X_STEP_WRITE(INVERT_X_STEP_PIN);
X2_STEP_WRITE(INVERT_X_STEP_PIN);
}
else {
if (current_block->active_driver != 0)
X2_STEP_WRITE(INVERT_X_STEP_PIN);
else
X_STEP_WRITE(INVERT_X_STEP_PIN);
}
#else
X_STEP_WRITE(INVERT_X_STEP_PIN);
#endif
}
counter_y += current_block->steps_y;
if (counter_y > 0) {
WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
#ifdef Y_DUAL_STEPPER_DRIVERS
WRITE(Y2_STEP_PIN, !INVERT_Y_STEP_PIN);
#endif
counter_y -= current_block->step_event_count;
count_position[Y_AXIS]+=count_direction[Y_AXIS];
WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
#ifdef Y_DUAL_STEPPER_DRIVERS
WRITE(Y2_STEP_PIN, INVERT_Y_STEP_PIN);
#endif
}
counter_y += current_block->steps_y;
if (counter_y > 0) {
Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
#ifdef Y_DUAL_STEPPER_DRIVERS
Y2_STEP_WRITE( !INVERT_Y_STEP_PIN);
#endif
counter_z += current_block->steps_z;
if (counter_z > 0) {
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN);
#endif
counter_z -= current_block->step_event_count;
count_position[Z_AXIS]+=count_direction[Z_AXIS];
WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN);
#endif
}
counter_y -= current_block->step_event_count;
count_position[Y_AXIS] += count_direction[Y_AXIS];
Y_STEP_WRITE(INVERT_Y_STEP_PIN);
#ifndef ADVANCE
counter_e += current_block->steps_e;
if (counter_e > 0) {
WRITE_E_STEP(!INVERT_E_STEP_PIN);
counter_e -= current_block->step_event_count;
count_position[E_AXIS]+=count_direction[E_AXIS];
WRITE_E_STEP(INVERT_E_STEP_PIN);
}
#endif //!ADVANCE
#endif // CONFIG_STEPPERS_TOSHIBA
#ifdef Y_DUAL_STEPPER_DRIVERS
Y2_STEP_WRITE( INVERT_Y_STEP_PIN);
#endif
}
counter_z += current_block->steps_z;
if (counter_z > 0) {
Z_STEP_WRITE( !INVERT_Z_STEP_PIN);
#ifdef Z_DUAL_STEPPER_DRIVERS
Z2_STEP_WRITE(!INVERT_Z_STEP_PIN);
#endif
counter_z -= current_block->step_event_count;
count_position[Z_AXIS] += count_direction[Z_AXIS];
Z_STEP_WRITE( INVERT_Z_STEP_PIN);
#ifdef Z_DUAL_STEPPER_DRIVERS
Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
#endif
}
#ifndef ADVANCE
counter_e += current_block->steps_e;
if (counter_e > 0) {
WRITE_E_STEP(!INVERT_E_STEP_PIN);
counter_e -= current_block->step_event_count;
count_position[E_AXIS] += count_direction[E_AXIS];
WRITE_E_STEP(INVERT_E_STEP_PIN);
}
#endif //!ADVANCE
#endif // CONFIG_STEPPERS_TOSHIBA
step_events_completed += 1;
if(step_events_completed >= current_block->step_event_count) break;
}
......@@ -812,60 +815,60 @@ ISR(TIMER1_COMPA_vect)
// Set E direction (Depends on E direction + advance)
for(unsigned char i=0; i<4;i++) {
if (e_steps[0] != 0) {
WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);
E0_STEP_WRITE( INVERT_E_STEP_PIN);
if (e_steps[0] < 0) {
WRITE(E0_DIR_PIN, INVERT_E0_DIR);
E0_DIR_WRITE(INVERT_E0_DIR);
e_steps[0]++;
WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
E0_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[0] > 0) {
WRITE(E0_DIR_PIN, !INVERT_E0_DIR);
E0_DIR_WRITE(!INVERT_E0_DIR);
e_steps[0]--;
WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
E0_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
#if DRIVER_EXTRUDERS > 1
if (e_steps[1] != 0) {
WRITE(E1_STEP_PIN, INVERT_E_STEP_PIN);
E1_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[1] < 0) {
WRITE(E1_DIR_PIN, INVERT_E1_DIR);
E1_DIR_WRITE(INVERT_E1_DIR);
e_steps[1]++;
WRITE(E1_STEP_PIN, !INVERT_E_STEP_PIN);
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[1] > 0) {
WRITE(E1_DIR_PIN, !INVERT_E1_DIR);
E1_DIR_WRITE(!INVERT_E1_DIR);
e_steps[1]--;
WRITE(E1_STEP_PIN, !INVERT_E_STEP_PIN);
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
#endif
#if DRIVER_EXTRUDERS > 2
if (e_steps[2] != 0) {
WRITE(E2_STEP_PIN, INVERT_E_STEP_PIN);
E2_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[2] < 0) {
WRITE(E2_DIR_PIN, INVERT_E2_DIR);
E2_DIR_WRITE(INVERT_E2_DIR);
e_steps[2]++;
WRITE(E2_STEP_PIN, !INVERT_E_STEP_PIN);
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[2] > 0) {
WRITE(E2_DIR_PIN, !INVERT_E2_DIR);
E2_DIR_WRITE(!INVERT_E2_DIR);
e_steps[2]--;
WRITE(E2_STEP_PIN, !INVERT_E_STEP_PIN);
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
#endif
#if DRIVER_EXTRUDERS > 3
if (e_steps[3] != 0) {
WRITE(E3_STEP_PIN, INVERT_E_STEP_PIN);
E3_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[3] < 0) {
WRITE(E3_DIR_PIN, INVERT_E3_DIR);
E3_DIR_WRITE(INVERT_E3_DIR);
e_steps[3]++;
WRITE(E3_STEP_PIN, !INVERT_E_STEP_PIN);
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[3] > 0) {
WRITE(E3_DIR_PIN, !INVERT_E3_DIR);
E3_DIR_WRITE(!INVERT_E3_DIR);
e_steps[3]--;
WRITE(E3_STEP_PIN, !INVERT_E_STEP_PIN);
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
#endif
......@@ -879,83 +882,91 @@ void st_init()
digipot_init(); //Initialize Digipot Motor Current
microstep_init(); //Initialize Microstepping Pins
// initialise TMC Steppers
#ifdef HAVE_TMCDRIVER
tmc_init();
#endif
// initialise L6470 Steppers
#ifdef HAVE_L6470DRIVER
L6470_init();
#endif
//Initialize Dir Pins
#if defined(X_DIR_PIN) && X_DIR_PIN > -1
SET_OUTPUT(X_DIR_PIN);
X_DIR_INIT;
#endif
#if defined(X2_DIR_PIN) && X2_DIR_PIN > -1
SET_OUTPUT(X2_DIR_PIN);
X2_DIR_INIT;
#endif
#if defined(Y_DIR_PIN) && Y_DIR_PIN > -1
SET_OUTPUT(Y_DIR_PIN);
Y_DIR_INIT;
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_DIR_PIN) && (Y2_DIR_PIN > -1)
SET_OUTPUT(Y2_DIR_PIN);
Y2_DIR_INIT;
#endif
#endif
#if defined(Z_DIR_PIN) && Z_DIR_PIN > -1
SET_OUTPUT(Z_DIR_PIN);
Z_DIR_INIT;
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_DIR_PIN) && (Z2_DIR_PIN > -1)
SET_OUTPUT(Z2_DIR_PIN);
Z2_DIR_INIT;
#endif
#endif
#if defined(E0_DIR_PIN) && E0_DIR_PIN > -1
SET_OUTPUT(E0_DIR_PIN);
E0_DIR_INIT;
#endif
#if defined(E1_DIR_PIN) && (E1_DIR_PIN > -1)
SET_OUTPUT(E1_DIR_PIN);
E1_DIR_INIT;
#endif
#if defined(E2_DIR_PIN) && (E2_DIR_PIN > -1)
SET_OUTPUT(E2_DIR_PIN);
E2_DIR_INIT;
#endif
#if defined(E3_DIR_PIN) && (E3_DIR_PIN > -1)
SET_OUTPUT(E3_DIR_PIN);
E3_DIR_INIT;
#endif
//Initialize Enable Pins - steppers default to disabled.
#if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
SET_OUTPUT(X_ENABLE_PIN);
if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
X_ENABLE_INIT;
if(!X_ENABLE_ON) X_ENABLE_WRITE(HIGH);
#endif
#if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
SET_OUTPUT(X2_ENABLE_PIN);
if(!X_ENABLE_ON) WRITE(X2_ENABLE_PIN,HIGH);
X2_ENABLE_INIT;
if(!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH);
#endif
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
SET_OUTPUT(Y_ENABLE_PIN);
if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
Y_ENABLE_INIT;
if(!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_ENABLE_PIN) && (Y2_ENABLE_PIN > -1)
SET_OUTPUT(Y2_ENABLE_PIN);
if(!Y_ENABLE_ON) WRITE(Y2_ENABLE_PIN,HIGH);
Y2_ENABLE_INIT;
if(!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
#endif
#endif
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
SET_OUTPUT(Z_ENABLE_PIN);
if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
Z_ENABLE_INIT;
if(!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH);
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_ENABLE_PIN) && (Z2_ENABLE_PIN > -1)
SET_OUTPUT(Z2_ENABLE_PIN);
if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
Z2_ENABLE_INIT;
if(!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
#endif
#endif
#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
SET_OUTPUT(E0_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
E0_ENABLE_INIT;
if(!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH);
#endif
#if defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
SET_OUTPUT(E1_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E1_ENABLE_PIN,HIGH);
E1_ENABLE_INIT;
if(!E_ENABLE_ON) E1_ENABLE_WRITE(HIGH);
#endif
#if defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
SET_OUTPUT(E2_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E2_ENABLE_PIN,HIGH);
E2_ENABLE_INIT;
if(!E_ENABLE_ON) E2_ENABLE_WRITE(HIGH);
#endif
#if defined(E3_ENABLE_PIN) && (E3_ENABLE_PIN > -1)
SET_OUTPUT(E3_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E3_ENABLE_PIN,HIGH);
E3_ENABLE_INIT;
if(!E_ENABLE_ON) E3_ENABLE_WRITE(HIGH);
#endif
//Choice E0-E1 or E0-E2 or E1-E3 pin
......@@ -1023,41 +1034,51 @@ void st_init()
//Initialize Step Pins
#if defined(X_STEP_PIN) && (X_STEP_PIN > -1)
OUT_WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
X_STEP_INIT;
X_STEP_WRITE(INVERT_X_STEP_PIN);
disable_x();
#endif
#if defined(X2_STEP_PIN) && (X2_STEP_PIN > -1)
OUT_WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
X2_STEP_INIT;
X2_STEP_WRITE(INVERT_X_STEP_PIN);
disable_x();
#endif
#if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1)
OUT_WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
Y_STEP_INIT;
Y_STEP_WRITE(INVERT_Y_STEP_PIN);
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_STEP_PIN) && (Y2_STEP_PIN > -1)
OUT_WRITE(Y2_STEP_PIN,INVERT_Y_STEP_PIN);
Y2_STEP_INIT;
Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
#endif
disable_y();
#endif
#if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1)
OUT_WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
Z_STEP_INIT;
Z_STEP_WRITE(INVERT_Z_STEP_PIN);
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && (Z2_STEP_PIN > -1)
OUT_WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
Z2_STEP_INIT;
Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
#endif
disable_z();
#endif
#if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1)
OUT_WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
E0_STEP_INIT;
E0_STEP_WRITE(INVERT_E_STEP_PIN);
disable_e0();
#endif
#if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1)
OUT_WRITE(E1_STEP_PIN,INVERT_E_STEP_PIN);
E1_STEP_INIT;
E1_STEP_WRITE(INVERT_E_STEP_PIN);
disable_e1();
#endif
#if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1)
OUT_WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN);
E2_STEP_INIT;
E2_STEP_WRITE(INVERT_E_STEP_PIN);
disable_e2();
#endif
#if defined(E3_STEP_PIN) && (E3_STEP_PIN > -1)
OUT_WRITE(E3_STEP_PIN,INVERT_E_STEP_PIN);
E3_STEP_INIT;
E3_STEP_WRITE(INVERT_E_STEP_PIN);
disable_e3();
#endif
......@@ -1189,31 +1210,31 @@ void babystep(const uint8_t axis,const bool direction)
case X_AXIS:
{
enable_x();
uint8_t old_x_dir_pin= READ(X_DIR_PIN); //if dualzstepper, both point to same direction.
uint8_t old_x_dir_pin= X_DIR_READ; //if dualzstepper, both point to same direction.
//setup new step
WRITE(X_DIR_PIN,(INVERT_X_DIR)^direction);
X_DIR_WRITE((INVERT_X_DIR)^direction);
#ifdef DUAL_X_CARRIAGE
WRITE(X2_DIR_PIN,(INVERT_X_DIR)^direction);
X2_DIR_WRITE((INVERT_X_DIR)^direction);
#endif
//perform step
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
X_STEP_WRITE(!INVERT_X_STEP_PIN);
#ifdef DUAL_X_CARRIAGE
WRITE(X2_STEP_PIN, !INVERT_X_STEP_PIN);
X2_STEP_WRITE(!INVERT_X_STEP_PIN);
#endif
_delay_us(1U); // wait 1 microsecond
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
X_STEP_WRITE(INVERT_X_STEP_PIN);
#ifdef DUAL_X_CARRIAGE
WRITE(X2_STEP_PIN, INVERT_X_STEP_PIN);
X2_STEP_WRITE(INVERT_X_STEP_PIN);
#endif
//get old pin state back.
WRITE(X_DIR_PIN,old_x_dir_pin);
X_DIR_WRITE(old_x_dir_pin);
#ifdef DUAL_X_CARRIAGE
WRITE(X2_DIR_PIN,old_x_dir_pin);
X2_DIR_WRITE(old_x_dir_pin);
#endif
}
......@@ -1221,31 +1242,31 @@ void babystep(const uint8_t axis,const bool direction)
case Y_AXIS:
{
enable_y();
uint8_t old_y_dir_pin= READ(Y_DIR_PIN); //if dualzstepper, both point to same direction.
uint8_t old_y_dir_pin= Y_DIR_READ; //if dualzstepper, both point to same direction.
//setup new step
WRITE(Y_DIR_PIN,(INVERT_Y_DIR)^direction);
Y_DIR_WRITE((INVERT_Y_DIR)^direction);
#ifdef DUAL_Y_CARRIAGE
WRITE(Y2_DIR_PIN,(INVERT_Y_DIR)^direction);
Y2_DIR_WRITE((INVERT_Y_DIR)^direction);
#endif
//perform step
WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
#ifdef DUAL_Y_CARRIAGE
WRITE(Y2_STEP_PIN, !INVERT_Y_STEP_PIN);
Y2_STEP_WRITE( !INVERT_Y_STEP_PIN);
#endif
_delay_us(1U); // wait 1 microsecond
WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
Y_STEP_WRITE(INVERT_Y_STEP_PIN);
#ifdef DUAL_Y_CARRIAGE
WRITE(Y2_STEP_PIN, INVERT_Y_STEP_PIN);
Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
#endif
//get old pin state back.
WRITE(Y_DIR_PIN,old_y_dir_pin);
Y_DIR_WRITE(old_y_dir_pin);
#ifdef DUAL_Y_CARRIAGE
WRITE(Y2_DIR_PIN,old_y_dir_pin);
Y2_DIR_WRITE(old_y_dir_pin);
#endif
}
......@@ -1255,29 +1276,29 @@ void babystep(const uint8_t axis,const bool direction)
case Z_AXIS:
{
enable_z();
uint8_t old_z_dir_pin= READ(Z_DIR_PIN); //if dualzstepper, both point to same direction.
uint8_t old_z_dir_pin= Z_DIR_READ; //if dualzstepper, both point to same direction.
//setup new step
WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
Z_DIR_WRITE((INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
Z2_DIR_WRITE((INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
#endif
//perform step
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
Z_STEP_WRITE(!INVERT_Z_STEP_PIN);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN);
Z2_STEP_WRITE( !INVERT_Z_STEP_PIN);
#endif
_delay_us(1U); // wait 1 microsecond
WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
Z_STEP_WRITE( INVERT_Z_STEP_PIN);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN);
Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
#endif
//get old pin state back.
WRITE(Z_DIR_PIN,old_z_dir_pin);
Z_DIR_WRITE(old_z_dir_pin);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_DIR_PIN,old_z_dir_pin);
Z2_DIR_WRITE(old_z_dir_pin);
#endif
}
......@@ -1288,29 +1309,29 @@ void babystep(const uint8_t axis,const bool direction)
enable_x();
enable_y();
enable_z();
uint8_t old_x_dir_pin= READ(X_DIR_PIN);
uint8_t old_y_dir_pin= READ(Y_DIR_PIN);
uint8_t old_z_dir_pin= READ(Z_DIR_PIN);
uint8_t old_x_dir_pin= X_DIR_READ;
uint8_t old_y_dir_pin= Y_DIR_READ;
uint8_t old_z_dir_pin= Z_DIR_READ;
//setup new step
WRITE(X_DIR_PIN,(INVERT_X_DIR)^direction^BABYSTEP_INVERT_Z);
WRITE(Y_DIR_PIN,(INVERT_Y_DIR)^direction^BABYSTEP_INVERT_Z);
WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
X_DIR_WRITE((INVERT_X_DIR)^direction^BABYSTEP_INVERT_Z);
Y_DIR_WRITE((INVERT_Y_DIR)^direction^BABYSTEP_INVERT_Z);
Z_DIR_WRITE((INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
//perform step
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
X_STEP_WRITE( !INVERT_X_STEP_PIN);
Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
Z_STEP_WRITE(!INVERT_Z_STEP_PIN);
_delay_us(1U); // wait 1 microsecond
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
X_STEP_WRITE(INVERT_X_STEP_PIN);
Y_STEP_WRITE(INVERT_Y_STEP_PIN);
Z_STEP_WRITE(INVERT_Z_STEP_PIN);
//get old pin state back.
WRITE(X_DIR_PIN,old_x_dir_pin);
WRITE(Y_DIR_PIN,old_y_dir_pin);
WRITE(Z_DIR_PIN,old_z_dir_pin);
X_DIR_WRITE(old_x_dir_pin);
Y_DIR_WRITE(old_y_dir_pin);
Z_DIR_WRITE(old_z_dir_pin);
}
break;
......
......@@ -22,30 +22,31 @@
#define stepper_h
#include "planner.h"
#include "stepper_indirection.h"
#if DRIVER_EXTRUDERS > 3
#define WRITE_E_STEP(v) { if(current_block->active_driver == 3) { WRITE(E3_STEP_PIN, v); } else { if(current_block->active_driver == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_driver == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}}}
#define NORM_E_DIR() { if(current_block->active_driver == 3) { WRITE(E3_DIR_PIN, !INVERT_E3_DIR); } else { if(current_block->active_driver == 2) { WRITE(E2_DIR_PIN, !INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}}}
#define REV_E_DIR() { if(current_block->active_driver == 3) { WRITE(E3_DIR_PIN, INVERT_E3_DIR); } else { if(current_block->active_driver == 2) { WRITE(E2_DIR_PIN, INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}}}
#define WRITE_E_STEP(v) { if(current_block->active_driver == 3) { E3_STEP_WRITE(v); } else { if(current_block->active_driver == 2) { E2_STEP_WRITE(v); } else { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}}}
#define NORM_E_DIR() { if(current_block->active_driver == 3) { E3_DIR_WRITE( !INVERT_E3_DIR); } else { if(current_block->active_driver == 2) { E2_DIR_WRITE(!INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}}}
#define REV_E_DIR() { if(current_block->active_driver == 3) { E3_DIR_WRITE(INVERT_E3_DIR); } else { if(current_block->active_driver == 2) { E2_DIR_WRITE(INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}}}
#elif DRIVER_EXTRUDERS > 2
#define WRITE_E_STEP(v) { if(current_block->active_driver == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_driver == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}}
#define NORM_E_DIR() { if(current_block->active_driver == 2) { WRITE(E2_DIR_PIN, !INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}}
#define REV_E_DIR() { if(current_block->active_driver == 2) { WRITE(E2_DIR_PIN, INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}}
#define WRITE_E_STEP(v) { if(current_block->active_driver == 2) { E2_STEP_WRITE(v); } else { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}}
#define NORM_E_DIR() { if(current_block->active_driver == 2) { E2_DIR_WRITE(!INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}}
#define REV_E_DIR() { if(current_block->active_driver == 2) { E2_DIR_WRITE(INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}}
#elif DRIVER_EXTRUDERS > 1
#ifndef DUAL_X_CARRIAGE
#define WRITE_E_STEP(v) { if(current_block->active_driver == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}
#define NORM_E_DIR() { if(current_block->active_driver == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}
#define REV_E_DIR() { if(current_block->active_driver == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}
#define WRITE_E_STEP(v) { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define NORM_E_DIR() { if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
#define REV_E_DIR() { if(current_block->active_driver == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}
#else
extern bool extruder_duplication_enabled;
#define WRITE_E_STEP(v) { if(extruder_duplication_enabled) { WRITE(E0_STEP_PIN, v); WRITE(E1_STEP_PIN, v); } else if(current_block->active_driver == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}
#define NORM_E_DIR() { if(extruder_duplication_enabled) { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else if(current_block->active_driver == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}
#define REV_E_DIR() { if(extruder_duplication_enabled) { WRITE(E0_DIR_PIN, INVERT_E0_DIR); WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else if(current_block->active_driver == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}
#endif //DUAL_X_CARRIAGE
#define WRITE_E_STEP(v) { if(extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define NORM_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
#define REV_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(INVERT_E0_DIR); E1_DIR_WRITE(INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}
#endif
#else
#define WRITE_E_STEP(v) WRITE(E0_STEP_PIN, v)
#define NORM_E_DIR() WRITE(E0_DIR_PIN, !INVERT_E0_DIR)
#define REV_E_DIR() WRITE(E0_DIR_PIN, INVERT_E0_DIR)
#define WRITE_E_STEP(v) E0_STEP_WRITE(v)
#define NORM_E_DIR() E0_DIR_WRITE(!INVERT_E0_DIR)
#define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
#endif //DRIVER_EXTRUDERS
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
......
/*
stepper_indirection.c - stepper motor driver indirection
to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation
Part of Marlin
Copyright (c) 2015 Dominik Wenger
Marlin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Marlin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Marlin. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stepper_indirection.h"
#include "Configuration.h"
#ifdef HAVE_TMCDRIVER
#include <SPI.h>
#include <TMC26XStepper.h>
#endif
// Stepper objects of TMC steppers used
#ifdef X_IS_TMC
TMC26XStepper stepperX(200,X_ENABLE_PIN,X_STEP_PIN,X_DIR_PIN,X_MAX_CURRENT,X_SENSE_RESISTOR);
#endif
#ifdef X2_IS_TMC
TMC26XStepper stepperX2(200,X2_ENABLE_PIN,X2_STEP_PIN,X2_DIR_PIN,X2_MAX_CURRENT,X2_SENSE_RESISTOR);
#endif
#ifdef Y_IS_TMC
TMC26XStepper stepperY(200,Y_ENABLE_PIN,Y_STEP_PIN,Y_DIR_PIN,Y_MAX_CURRENT,Y_SENSE_RESISTOR);
#endif
#ifdef Y2_IS_TMC
TMC26XStepper stepperY2(200,Y2_ENABLE_PIN,Y2_STEP_PIN,Y2_DIR_PIN,Y2_MAX_CURRENT,Y2_SENSE_RESISTOR);
#endif
#ifdef Z_IS_TMC
TMC26XStepper stepperZ(200,Z_ENABLE_PIN,Z_STEP_PIN,Z_DIR_PIN,Z_MAX_CURRENT,Z_SENSE_RESISTOR);
#endif
#ifdef Z2_IS_TMC
TMC26XStepper stepperZ2(200,Z2_ENABLE_PIN,Z2_STEP_PIN,Z2_DIR_PIN,Z2_MAX_CURRENT,Z2_SENSE_RESISTOR);
#endif
#ifdef E0_IS_TMC
TMC26XStepper stepperE0(200,E0_ENABLE_PIN,E0_STEP_PIN,E0_DIR_PIN,E0_MAX_CURRENT,E0_SENSE_RESISTOR);
#endif
#ifdef E1_IS_TMC
TMC26XStepper stepperE1(200,E1_ENABLE_PIN,E1_STEP_PIN,E1_DIR_PIN,E1_MAX_CURRENT,E1_SENSE_RESISTOR);
#endif
#ifdef E2_IS_TMC
TMC26XStepper stepperE2(200,E2_ENABLE_PIN,E2_STEP_PIN,E2_DIR_PIN,E2_MAX_CURRENT,E2_SENSE_RESISTOR);
#endif
#ifdef E3_IS_TMC
TMC26XStepper stepperE3(200,E3_ENABLE_PIN,E3_STEP_PIN,E3_DIR_PIN,E3_MAX_CURRENT,E3_SENSE_RESISTOR);
#endif
#ifdef HAVE_TMCDRIVER
void tmc_init()
{
#ifdef X_IS_TMC
stepperX.setMicrosteps(X_MICROSTEPS);
stepperX.start();
#endif
#ifdef X2_IS_TMC
stepperX2.setMicrosteps(X2_MICROSTEPS);
stepperX2.start();
#endif
#ifdef Y_IS_TMC
stepperY.setMicrosteps(Y_MICROSTEPS);
stepperY.start();
#endif
#ifdef Y2_IS_TMC
stepperY2.setMicrosteps(Y2_MICROSTEPS);
stepperY2.start();
#endif
#ifdef Z_IS_TMC
stepperZ.setMicrosteps(Z_MICROSTEPS);
stepperZ.start();
#endif
#ifdef Z2_IS_TMC
stepperZ2.setMicrosteps(Z2_MICROSTEPS);
stepperZ2.start();
#endif
#ifdef E0_IS_TMC
stepperE0.setMicrosteps(E0_MICROSTEPS);
stepperE0.start();
#endif
#ifdef E1_IS_TMC
stepperE1.setMicrosteps(E1_MICROSTEPS);
stepperE1.start();
#endif
#ifdef E2_IS_TMC
stepperE2.setMicrosteps(E2_MICROSTEPS);
stepperE2.start();
#endif
#ifdef E3_IS_TMC
stepperE3.setMicrosteps(E3_MICROSTEPS);
stepperE3.start();
#endif
}
#endif
// L6470 Driver objects and inits
#ifdef HAVE_L6470DRIVER
#include <SPI.h>
#include <L6470.h>
#endif
// L6470 Stepper objects
#ifdef X_IS_L6470
L6470 stepperX(X_ENABLE_PIN);
#endif
#ifdef X2_IS_L6470
L6470 stepperX2(X2_ENABLE_PIN);
#endif
#ifdef Y_IS_L6470
L6470 stepperY(Y_ENABLE_PIN);
#endif
#ifdef Y2_IS_L6470
L6470 stepperY2(Y2_ENABLE_PIN);
#endif
#ifdef Z_IS_L6470
L6470 stepperZ(Z_ENABLE_PIN);
#endif
#ifdef Z2_IS_L6470
L6470 stepperZ2(Z2_ENABLE_PIN);
#endif
#ifdef E0_IS_L6470
L6470 stepperE0(E0_ENABLE_PIN);
#endif
#ifdef E1_IS_L6470
L6470 stepperE1(E1_ENABLE_PIN);
#endif
#ifdef E2_IS_L6470
L6470 stepperE2(E2_ENABLE_PIN);
#endif
#ifdef E3_IS_L6470
L6470 stepperE3(E3_ENABLE_PIN);
#endif
// init routine
#ifdef HAVE_L6470DRIVER
void L6470_init()
{
#ifdef X_IS_L6470
stepperX.init(X_K_VAL);
stepperX.softFree();
stepperX.setMicroSteps(X_MICROSTEPS);
stepperX.setOverCurrent(X_OVERCURRENT); //set overcurrent protection
stepperX.setStallCurrent(X_STALLCURRENT);
#endif
#ifdef X2_IS_L6470
stepperX2.init(X2_K_VAL);
stepperX2.softFree();
stepperX2.setMicroSteps(X2_MICROSTEPS);
stepperX2.setOverCurrent(X2_OVERCURRENT); //set overcurrent protection
stepperX2.setStallCurrent(X2_STALLCURRENT);
#endif
#ifdef Y_IS_L6470
stepperY.init(Y_K_VAL);
stepperY.softFree();
stepperY.setMicroSteps(Y_MICROSTEPS);
stepperY.setOverCurrent(Y_OVERCURRENT); //set overcurrent protection
stepperY.setStallCurrent(Y_STALLCURRENT);
#endif
#ifdef Y2_IS_L6470
stepperY2.init(Y2_K_VAL);
stepperY2.softFree();
stepperY2.setMicroSteps(Y2_MICROSTEPS);
stepperY2.setOverCurrent(Y2_OVERCURRENT); //set overcurrent protection
stepperY2.setStallCurrent(Y2_STALLCURRENT);
#endif
#ifdef Z_IS_L6470
stepperZ.init(Z_K_VAL);
stepperZ.softFree();
stepperZ.setMicroSteps(Z_MICROSTEPS);
stepperZ.setOverCurrent(Z_OVERCURRENT); //set overcurrent protection
stepperZ.setStallCurrent(Z_STALLCURRENT);
#endif
#ifdef Z2_IS_L6470
stepperZ2.init(Z2_K_VAL);
stepperZ2.softFree();
stepperZ2.setMicroSteps(Z2_MICROSTEPS);
stepperZ2.setOverCurrent(Z2_OVERCURRENT); //set overcurrent protection
stepperZ2.setStallCurrent(Z2_STALLCURRENT);
#endif
#ifdef E0_IS_L6470
stepperE0.init(E0_K_VAL);
stepperE0.softFree();
stepperE0.setMicroSteps(E0_MICROSTEPS);
stepperE0.setOverCurrent(E0_OVERCURRENT); //set overcurrent protection
stepperE0.setStallCurrent(E0_STALLCURRENT);
#endif
#ifdef E1_IS_L6470
stepperE1.init(E1_K_VAL);
stepperE1.softFree();
stepperE1.setMicroSteps(E1_MICROSTEPS);
stepperE1.setOverCurrent(E1_OVERCURRENT); //set overcurrent protection
stepperE1.setStallCurrent(E1_STALLCURRENT);
#endif
#ifdef E2_IS_L6470
stepperE2.init(E2_K_VAL);
stepperE2.softFree();
stepperE2.setMicroSteps(E2_MICROSTEPS);
stepperE2.setOverCurrent(E2_OVERCURRENT); //set overcurrent protection
stepperE2.setStallCurrent(E2_STALLCURRENT);
#endif
#ifdef E3_IS_L6470
stepperE3.init(E3_K_VAL);
stepperE3.softFree();
stepperE3.setMicroSteps(E3_MICROSTEPS);
stepperE3.setOverCurrent(E3_OVERCURRENT); //set overcurrent protection
stepperE3.setStallCurrent(E3_STALLCURRENT);
#endif
}
#endif
/*
stepper_indirection.h - stepper motor driver indirection macros
to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation
Part of Marlin
Copyright (c) 2015 Dominik Wenger
Marlin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Marlin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Marlin. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef STEPPER_INDIRECTION_H
#define STEPPER_INDIRECTION_H
// X motor
#define X_STEP_INIT SET_OUTPUT(X_STEP_PIN)
#define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE)
#define X_STEP_READ READ(X_STEP_PIN)
#define X_DIR_INIT SET_OUTPUT(X_DIR_PIN)
#define X_DIR_WRITE(STATE) WRITE(X_DIR_PIN,STATE)
#define X_DIR_READ READ(X_DIR_PIN)
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
#define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
#define X_ENABLE_READ READ(X_ENABLE_PIN)
// X2 motor
#define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN)
#define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE)
#define X2_STEP_READ READ(X2_STEP_PIN)
#define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN)
#define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
#define X2_DIR_READ READ(X_DIR_PIN)
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
#define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
#define X2_ENABLE_READ READ(X_ENABLE_PIN)
// Y motor
#define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN)
#define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE)
#define Y_STEP_READ READ(Y_STEP_PIN)
#define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN)
#define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
#define Y_DIR_READ READ(Y_DIR_PIN)
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
#define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
#define Y_ENABLE_READ READ(Y_ENABLE_PIN)
// Y2 motor
#define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN)
#define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE)
#define Y2_STEP_READ READ(Y2_STEP_PIN)
#define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN)
#define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
#define Y2_DIR_READ READ(Y2_DIR_PIN)
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
#define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
#define Y2_ENABLE_READ READ(Y2_ENABLE_PIN)
// Z motor
#define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN)
#define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE)
#define Z_STEP_READ READ(Z_STEP_PIN)
#define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN)
#define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
#define Z_DIR_READ READ(Z_DIR_PIN)
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
#define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
#define Z_ENABLE_READ READ(Z_ENABLE_PIN)
// Z2 motor
#define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN)
#define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE)
#define Z2_STEP_READ READ(Z2_STEP_PIN)
#define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN)
#define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
#define Z2_DIR_READ READ(Z2_DIR_PIN)
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
#define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
#define Z2_ENABLE_READ READ(Z2_ENABLE_PIN)
// E0 motor
#define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN)
#define E0_STEP_WRITE(STATE) WRITE(E0_STEP_PIN,STATE)
#define E0_STEP_READ READ(E0_STEP_PIN)
#define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN)
#define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE)
#define E0_DIR_READ READ(E0_DIR_PIN)
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
#define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
#define E0_ENABLE_READ READ(E0_ENABLE_PIN)
// E1 motor
#define E1_STEP_INIT SET_OUTPUT(E1_STEP_PIN)
#define E1_STEP_WRITE(STATE) WRITE(E1_STEP_PIN,STATE)
#define E1_STEP_READ READ(E1_STEP_PIN)
#define E1_DIR_INIT SET_OUTPUT(E1_DIR_PIN)
#define E1_DIR_WRITE(STATE) WRITE(E1_DIR_PIN,STATE)
#define E1_DIR_READ READ(E1_DIR_PIN)
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
#define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
#define E1_ENABLE_READ READ(E1_ENABLE_PIN)
// E2 motor
#define E2_STEP_INIT SET_OUTPUT(E2_STEP_PIN)
#define E2_STEP_WRITE(STATE) WRITE(E2_STEP_PIN,STATE)
#define E2_STEP_READ READ(E2_STEP_PIN)
#define E2_DIR_INIT SET_OUTPUT(E2_DIR_PIN)
#define E2_DIR_WRITE(STATE) WRITE(E2_DIR_PIN,STATE)
#define E2_DIR_READ READ(E2_DIR_PIN)
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
#define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
#define E2_ENABLE_READ READ(E2_ENABLE_PIN)
// E3 motor
#define E3_STEP_INIT SET_OUTPUT(E3_STEP_PIN)
#define E3_STEP_WRITE(STATE) WRITE(E3_STEP_PIN,STATE)
#define E3_STEP_READ READ(E3_STEP_PIN)
#define E3_DIR_INIT SET_OUTPUT(E3_DIR_PIN)
#define E3_DIR_WRITE(STATE) WRITE(E3_DIR_PIN,STATE)
#define E3_DIR_READ READ(E3_DIR_PIN)
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
#define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
#define E3_ENABLE_READ READ(E3_ENABLE_PIN)
//////////////////////////////////
// Pin redefines for TMC drivers.
// TMC26X drivers have step and dir on normal pins, but everything else via SPI
//////////////////////////////////
#ifdef HAVE_TMCDRIVER
#include <SPI.h>
#include <TMC26XStepper.h>
void tmc_init();
#ifdef X_IS_TMC
extern TMC26XStepper stepperX;
#undef X_ENABLE_INIT
#define X_ENABLE_INIT ((void)0)
#undef X_ENABLE_WRITE
#define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
#undef X_ENABLE_READ
#define X_ENABLE_READ stepperX.isEnabled()
#endif
#ifdef X2_IS_TMC
extern TMC26XStepper stepperX2;
#undef X2_ENABLE_INIT
#define X2_ENABLE_INIT ((void)0)
#undef X2_ENABLE_WRITE
#define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
#undef X2_ENABLE_READ
#define X2_ENABLE_READ stepperX2.isEnabled()
#endif
#ifdef Y_IS_TMC
extern TMC26XStepper stepperY;
#undef Y_ENABLE_INIT
#define Y_ENABLE_INIT ((void)0)
#undef Y_ENABLE_WRITE
#define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
#undef Y_ENABLE_READ
#define Y_ENABLE_READ stepperY.isEnabled()
#endif
#ifdef Y2_IS_TMC
extern TMC26XStepper stepperY2;
#undef Y2_ENABLE_INIT
#define Y2_ENABLE_INIT ((void)0)
#undef Y2_ENABLE_WRITE
#define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
#undef Y2_ENABLE_READ
#define Y2_ENABLE_READ stepperY2.isEnabled()
#endif
#ifdef Z_IS_TMC
extern TMC26XStepper stepperZ;
#undef Z_ENABLE_INIT
#define Z_ENABLE_INIT ((void)0)
#undef Z_ENABLE_WRITE
#define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
#undef Z_ENABLE_READ
#define Z_ENABLE_READ stepperZ.isEnabled()
#endif
#ifdef Z2_IS_TMC
extern TMC26XStepper stepperZ2;
#undef Z2_ENABLE_INIT
#define Z2_ENABLE_INIT ((void)0)
#undef Z2_ENABLE_WRITE
#define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
#undef Z2_ENABLE_READ
#define Z2_ENABLE_READ stepperZ2.isEnabled()
#endif
#ifdef E0_IS_TMC
extern TMC26XStepper stepperE0;
#undef E0_ENABLE_INIT
#define E0_ENABLE_INIT ((void)0)
#undef E0_ENABLE_WRITE
#define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
#undef E0_ENABLE_READ
#define E0_ENABLE_READ stepperE0.isEnabled()
#endif
#ifdef E1_IS_TMC
extern TMC26XStepper stepperE1;
#undef E1_ENABLE_INIT
#define E1_ENABLE_INIT ((void)0)
#undef E1_ENABLE_WRITE
#define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
#undef E1_ENABLE_READ
#define E1_ENABLE_READ stepperE1.isEnabled()
#endif
#ifdef E2_IS_TMC
extern TMC26XStepper stepperE2;
#undef E2_ENABLE_INIT
#define E2_ENABLE_INIT ((void)0)
#undef E2_ENABLE_WRITE
#define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
#undef E2_ENABLE_READ
#define E2_ENABLE_READ stepperE2.isEnabled()
#endif
#ifdef E3_IS_TMC
extern TMC26XStepper stepperE3;
#undef E3_ENABLE_INIT
#define E3_ENABLE_INIT ((void)0)
#undef E3_ENABLE_WRITE
#define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
#undef E3_ENABLE_READ
#define E3_ENABLE_READ stepperE3.isEnabled()
#endif
#endif // HAVE_TMCDRIVER
//////////////////////////////////
// Pin redefines for L6470 drivers.
// L640 drivers have step on normal pins, but dir and everything else via SPI
//////////////////////////////////
#ifdef HAVE_L6470DRIVER
#include <SPI.h>
#include <L6470.h>
void L6470_init();
#ifdef X_IS_L6470
extern L6470 stepperX;
#undef X_ENABLE_INIT
#define X_ENABLE_INIT ((void)0)
#undef X_ENABLE_WRITE
#define X_ENABLE_WRITE(STATE) {if(STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree();}
#undef X_ENABLE_READ
#define X_ENABLE_READ (stepperX.getStatus() & STATUS_HIZ)
#undef X_DIR_INIT
#define X_DIR_INIT ((void)0)
#undef X_DIR_WRITE
#define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE)
#undef X_DIR_READ
#define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
#endif
#ifdef X2_IS_L6470
extern L6470 stepperX2;
#undef X2_ENABLE_INIT
#define X2_ENABLE_INIT ((void)0)
#undef X2_ENABLE_WRITE
#define X2_ENABLE_WRITE(STATE) (if(STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree();)
#undef X2_ENABLE_READ
#define X2_ENABLE_READ (stepperX2.getStatus() & STATUS_HIZ)
#undef X2_DIR_INIT
#define X2_DIR_INIT ((void)0)
#undef X2_DIR_WRITE
#define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE)
#undef X2_DIR_READ
#define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
#endif
#ifdef Y_IS_L6470
extern L6470 stepperY;
#undef Y_ENABLE_INIT
#define Y_ENABLE_INIT ((void)0)
#undef Y_ENABLE_WRITE
#define Y_ENABLE_WRITE(STATE) (if(STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree();)
#undef Y_ENABLE_READ
#define Y_ENABLE_READ (stepperY.getStatus() & STATUS_HIZ)
#undef Y_DIR_INIT
#define Y_DIR_INIT ((void)0)
#undef Y_DIR_WRITE
#define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE)
#undef Y_DIR_READ
#define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
#endif
#ifdef Y2_IS_L6470
extern L6470 stepperY2;
#undef Y2_ENABLE_INIT
#define Y2_ENABLE_INIT ((void)0)
#undef Y2_ENABLE_WRITE
#define Y2_ENABLE_WRITE(STATE) (if(STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree();)
#undef Y2_ENABLE_READ
#define Y2_ENABLE_READ (stepperY2.getStatus() & STATUS_HIZ)
#undef Y2_DIR_INIT
#define Y2_DIR_INIT ((void)0)
#undef Y2_DIR_WRITE
#define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE)
#undef Y2_DIR_READ
#define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
#endif
#ifdef Z_IS_L6470
extern L6470 stepperZ;
#undef Z_ENABLE_INIT
#define Z_ENABLE_INIT ((void)0)
#undef Z_ENABLE_WRITE
#define Z_ENABLE_WRITE(STATE) (if(STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree();)
#undef Z_ENABLE_READ
#define Z_ENABLE_READ (stepperZ.getStatus() & STATUS_HIZ)
#undef Z_DIR_INIT
#define Z_DIR_INIT ((void)0)
#undef Z_DIR_WRITE
#define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE)
#undef Y_DIR_READ
#define Y_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
#endif
#ifdef Z2_IS_L6470
extern L6470 stepperZ2;
#undef Z2_ENABLE_INIT
#define Z2_ENABLE_INIT ((void)0)
#undef Z2_ENABLE_WRITE
#define Z2_ENABLE_WRITE(STATE) (if(STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree();)
#undef Z2_ENABLE_READ
#define Z2_ENABLE_READ (stepperZ2.getStatus() & STATUS_HIZ)
#undef Z2_DIR_INIT
#define Z2_DIR_INIT ((void)0)
#undef Z2_DIR_WRITE
#define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE)
#undef Y2_DIR_READ
#define Y2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
#endif
#ifdef E0_IS_L6470
extern L6470 stepperE0;
#undef E0_ENABLE_INIT
#define E0_ENABLE_INIT ((void)0)
#undef E0_ENABLE_WRITE
#define E0_ENABLE_WRITE(STATE) (if(STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree();)
#undef E0_ENABLE_READ
#define E0_ENABLE_READ (stepperE0.getStatus() & STATUS_HIZ)
#undef E0_DIR_INIT
#define E0_DIR_INIT ((void)0)
#undef E0_DIR_WRITE
#define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE)
#undef E0_DIR_READ
#define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
#endif
#ifdef E1_IS_L6470
extern L6470 stepperE1;
#undef E1_ENABLE_INIT
#define E1_ENABLE_INIT ((void)0)
#undef E1_ENABLE_WRITE
#define E1_ENABLE_WRITE(STATE) (if(STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree();)
#undef E1_ENABLE_READ
#define E1_ENABLE_READ (stepperE1.getStatus() & STATUS_HIZ)
#undef E1_DIR_INIT
#define E1_DIR_INIT ((void)0)
#undef E1_DIR_WRITE
#define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE)
#undef E1_DIR_READ
#define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
#endif
#ifdef E2_IS_L6470
extern L6470 stepperE2;
#undef E2_ENABLE_INIT
#define E2_ENABLE_INIT ((void)0)
#undef E2_ENABLE_WRITE
#define E2_ENABLE_WRITE(STATE) (if(STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree();)
#undef E2_ENABLE_READ
#define E2_ENABLE_READ (stepperE2.getStatus() & STATUS_HIZ)
#undef E2_DIR_INIT
#define E2_DIR_INIT ((void)0)
#undef E2_DIR_WRITE
#define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE)
#undef E2_DIR_READ
#define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
#endif
#ifdef E3_IS_L6470
extern L6470 stepperE3;
#undef E3_ENABLE_INIT
#define E3_ENABLE_INIT ((void)0)
#undef E3_ENABLE_WRITE
#define E3_ENABLE_WRITE(STATE) (if(STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree();)
#undef E3_ENABLE_READ
#define E3_ENABLE_READ (stepperE3.getStatus() & STATUS_HIZ)
#undef E3_DIR_INIT
#define E3_DIR_INIT ((void)0)
#undef E3_DIR_WRITE
#define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE)
#undef E3_DIR_READ
#define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR)
#endif
#endif //HAVE_L6470DRIVER
#endif // STEPPER_INDIRECTION_H
\ No newline at end of file
......@@ -33,7 +33,6 @@
#include "ultralcd.h"
#include "temperature.h"
#include "watchdog.h"
#include "thermistortables.h"
#include "language.h"
#include "Sd2PinMap.h"
......@@ -186,11 +185,9 @@ static volatile bool temp_meas_ready = false;
#ifdef FAN_SOFT_PWM
static unsigned char soft_pwm_fan;
#endif
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
#if HAS_AUTO_FAN
static unsigned long extruder_autofan_last_check;
#endif
#endif
// Init min and max temp with extreme values to prevent false errors during startup
#ifndef SINGLENOZZLE
......@@ -329,8 +326,8 @@ void PID_autotune(float temp, int extruder, int ncycles) {
SERIAL_PROTOCOLPGM(MSG_BIAS); SERIAL_PROTOCOL(bias);
SERIAL_PROTOCOLPGM(MSG_D); SERIAL_PROTOCOL(d);
SERIAL_PROTOCOLPGM(MSG_MIN); SERIAL_PROTOCOL(min);
SERIAL_PROTOCOLPGM(MSG_MAX); SERIAL_PROTOCOLLN(max);
SERIAL_PROTOCOLPGM(MSG_T_MIN); SERIAL_PROTOCOL(min);
SERIAL_PROTOCOLPGM(MSG_T_MAX); SERIAL_PROTOCOLLN(max);
if (cycles > 2) {
Ku = (4.0 * d) / (3.14159265 * (max - min) / 2.0);
Tu = ((float)(t_low + t_high) / 1000.0);
......@@ -348,16 +345,16 @@ void PID_autotune(float temp, int extruder, int ncycles) {
Ki = Kp/Tu;
Kd = Kp*Tu/3;
SERIAL_PROTOCOLLNPGM(" Some overshoot ");
SERIAL_PROTOCOLPGM(MSG_KP); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(MSG_KI); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(MSG_KD); SERIAL_PROTOCOLLN(Kd);
SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd);
Kp = 0.2*Ku;
Ki = 2*Kp/Tu;
Kd = Kp*Tu/3;
SERIAL_PROTOCOLLNPGM(" No overshoot ");
SERIAL_PROTOCOLPGM(MSG_KP); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(MSG_KI); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(MSG_KD); SERIAL_PROTOCOLLN(Kd);
SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd);
*/
}
}
......@@ -366,7 +363,7 @@ void PID_autotune(float temp, int extruder, int ncycles) {
else
soft_pwm[extruder] = (bias + d) >> 1;
cycles++;
min=temp;
min = temp;
}
}
}
......@@ -419,7 +416,7 @@ void updatePID() {
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
#endif
}
int getHeaterPower(int heater) {
return heater < 0 ? soft_pwm_bed : soft_pwm[heater];
}
......@@ -441,79 +438,82 @@ int getHeaterPower(int heater) {
#endif
#endif
void setExtruderAutoFanState(int pin, bool state) {
unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
// this idiom allows both digital and PWM fan outputs (see M42 handling).
pinMode(pin, OUTPUT);
digitalWrite(pin, newFanSpeed);
analogWrite(pin, newFanSpeed);
}
void setExtruderAutoFanState(int pin, bool state)
{
unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
// this idiom allows both digital and PWM fan outputs (see M42 handling).
pinMode(pin, OUTPUT);
digitalWrite(pin, newFanSpeed);
analogWrite(pin, newFanSpeed);
}
void checkExtruderAutoFans() {
uint8_t fanState = 0;
void checkExtruderAutoFans()
{
uint8_t fanState = 0;
// which fan pins need to be turned on?
#if HAS_AUTO_FAN_0
if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE)
fanState |= 1;
#endif
// which fan pins need to be turned on?
#if HAS_AUTO_FAN_0
if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE)
fanState |= 1;
#endif
#ifndef SINGLENOZZLE
#if HAS_AUTO_FAN_1
if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE) {
if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
fanState |= 1;
else
fanState |= 2;
}
#endif
#if HAS_AUTO_FAN_2
if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) {
if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
fanState |= 1;
else if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN)
fanState |= 2;
else
fanState |= 4;
}
#endif
#if HAS_AUTO_FAN_3
if (current_temperature[3] > EXTRUDER_AUTO_FAN_TEMPERATURE) {
if (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
fanState |= 1;
else if (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN)
fanState |= 2;
else if (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_2_AUTO_FAN_PIN)
fanState |= 4;
else
fanState |= 8;
}
#endif
#endif // !SINLGENOZZE
#ifndef SINGLENOZZLE
#if HAS_AUTO_FAN_1
if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE)
{
if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
fanState |= 1;
else
fanState |= 2;
}
#endif
#if HAS_AUTO_FAN_2
if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) {
if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
fanState |= 1;
else if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN)
fanState |= 2;
else
fanState |= 4;
}
#endif
#if HAS_AUTO_FAN_3
if (current_temperature[3] > EXTRUDER_AUTO_FAN_TEMPERATURE) {
if (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
fanState |= 1;
else if (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN)
fanState |= 2;
else if (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_2_AUTO_FAN_PIN)
fanState |= 4;
else
fanState |= 8;
}
#endif
#endif // !SINLGENOZZE
// update extruder auto fan states
#if HAS_AUTO_FAN_0
setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
#endif
// update extruder auto fan states
#if HAS_AUTO_FAN_0
setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
#endif
#ifndef SINGLENOZZLE
#if HAS_AUTO_FAN_1
if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0);
#endif
#if HAS_AUTO_FAN_2
if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
&& EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0);
#endif
#if HAS_AUTO_FAN_3
if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
&& EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
&& EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_3_AUTO_FAN_PIN, (fanState & 8) != 0);
#endif
#endif // !SINLGENOZZE
}
#ifndef SINGLENOZZLE
#if HAS_AUTO_FAN_1
if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0);
#endif
#if HAS_AUTO_FAN_2
if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
&& EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0);
#endif
#if HAS_AUTO_FAN_3
if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
&& EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN
&& EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_3_AUTO_FAN_PIN, (fanState & 8) != 0);
#endif
#endif //!SINGLENOZZLE
}
#endif // any extruder auto fan pins set
//
......@@ -557,6 +557,36 @@ int getHeaterPower(int heater) {
#define WRITE_FAN(v) WRITE(FAN_PIN, v)
#endif
inline void _temp_error(int e, const char *msg1, const char *msg2) {
if (!IsStopped()) {
SERIAL_ERROR_START;
if (e >= 0) SERIAL_ERRORLN((int)e);
serialprintPGM(msg1);
MYSERIAL.write('\n');
#ifdef ULTRA_LCD
lcd_setalertstatuspgm(msg2);
#endif
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop();
#endif
}
void max_temp_error(uint8_t e) {
disable_heater();
_temp_error(e, MSG_MAXTEMP_EXTRUDER_OFF, MSG_ERR_MAXTEMP);
}
void min_temp_error(uint8_t e) {
disable_heater();
_temp_error(e, MSG_MINTEMP_EXTRUDER_OFF, MSG_ERR_MINTEMP);
}
void bed_max_temp_error(void) {
#if HAS_HEATER_BED
WRITE_HEATER_BED(0);
#endif
_temp_error(-1, MSG_MAXTEMP_BED_OFF, MSG_ERR_MAXTEMP_BED);
}
void manage_heater() {
if (!temp_meas_ready) return;
......@@ -575,10 +605,10 @@ void manage_heater() {
// Loop through all extruders
#ifndef SINGLENOZZLE
for(int e = 0; e < EXTRUDERS; e++)
for (int e = 0; e < EXTRUDERS; e++)
#else
int e = 0;
#endif // !SINLGENOZZE
#endif // !SINGLENOZZLE
{
#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
......@@ -668,17 +698,10 @@ void manage_heater() {
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
disable_heater();
if (IsStopped() == false) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_EXTRUDER_SWITCHED_OFF);
LCD_ALERTMESSAGEPGM(MSG_ERR_REDUNDANT_TEMP);
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop();
#endif
_temp_error(-1, MSG_EXTRUDER_SWITCHED_OFF, MSG_ERR_REDUNDANT_TEMP);
}
#endif //TEMP_SENSOR_1_AS_REDUNDANT
} //End extruder for loop
} // Extruders Loop
#if HAS_AUTO_FAN
if (ms > extruder_autofan_last_check + 2500) { // only need to check fan state very infrequently
......@@ -802,16 +825,21 @@ static float analog2temp(int raw, uint8_t e) {
}
#ifdef HEATER_0_USES_MAX6675
if (e == 0)
{
return 0.25 * raw;
}
#endif
if(heater_ttbl_map[e] != NULL) {
if(heater_ttbl_map[e] != NULL)
{
float celsius = 0;
uint8_t i;
short (*tt)[][2] = (short (*)[][2])(heater_ttbl_map[e]);
for (i=1; i<heater_ttbllen_map[e]; i++) {
if (PGM_RD_W((*tt)[i][0]) > raw) {
for (i=1; i<heater_ttbllen_map[e]; i++)
{
if (PGM_RD_W((*tt)[i][0]) > raw)
{
celsius = PGM_RD_W((*tt)[i-1][1]) +
(raw - PGM_RD_W((*tt)[i-1][0])) *
(float)(PGM_RD_W((*tt)[i][1]) - PGM_RD_W((*tt)[i-1][1])) /
......@@ -835,8 +863,10 @@ static float analog2tempBed(int raw) {
float celsius = 0;
byte i;
for (i=1; i<BEDTEMPTABLE_LEN; i++) {
if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw) {
for (i=1; i<BEDTEMPTABLE_LEN; i++)
{
if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw)
{
celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) +
(raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) *
(float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i-1][1])) /
......@@ -864,9 +894,9 @@ static void updateTemperaturesFromRawValues() {
#endif
#ifndef SINGLENOZZLE
for(int e=0;e<EXTRUDERS;e++)
for (int e = 0; e < EXTRUDERS; e++)
#else
int e=0;
int e = 0;
#endif // !SINGLENOZZLE
{
current_temperature[e] = analog2temp(current_temperature_raw[e], e);
......@@ -905,7 +935,8 @@ static void updateTemperaturesFromRawValues() {
#endif
void tp_init() {
void tp_init()
{
#if MB(RUMBA) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
//disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
MCUCR=(1<<JTD);
......@@ -936,18 +967,16 @@ void tp_init() {
#endif
#if HAS_HEATER_1
SET_OUTPUT(HEATER_1_PIN);
#endif
#endif
#if HAS_HEATER_2
SET_OUTPUT(HEATER_2_PIN);
#endif
#if HAS_HEATER_3
SET_OUTPUT(HEATER_3_PIN);
#endif
#if HAS_HEATER_BED
SET_OUTPUT(HEATER_BED_PIN);
#endif
#if HAS_FAN
SET_OUTPUT(FAN_PIN);
#ifdef FAST_PWM_FAN
......@@ -961,21 +990,16 @@ void tp_init() {
#ifdef HEATER_0_USES_MAX6675
#ifndef SDSUPPORT
SET_OUTPUT(SCK_PIN);
WRITE(SCK_PIN,0);
SET_OUTPUT(MOSI_PIN);
WRITE(MOSI_PIN,1);
SET_INPUT(MISO_PIN);
WRITE(MISO_PIN,1);
OUT_WRITE(SCK_PIN, LOW);
OUT_WRITE(MOSI_PIN, HIGH);
OUT_WRITE(MISO_PIN, HIGH);
#else
pinMode(SS_PIN, OUTPUT);
digitalWrite(SS_PIN, HIGH);
#endif //SDSUPPORT
SET_OUTPUT(MAX6675_SS);
WRITE(MAX6675_SS,1);
OUT_WRITE(MAX6675_SS,HIGH);
#endif //HEATER_0_USES_MAX6675
#ifdef DIDR2
......@@ -1108,65 +1132,69 @@ void setWatch() {
}
#if defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
/*
SERIAL_ECHO_START;
SERIAL_ECHO("Thermal Thermal Runaway Running. Heater ID:");
SERIAL_ECHO(heater_id);
SERIAL_ECHO(" ; State:");
SERIAL_ECHO(*state);
SERIAL_ECHO(" ; Timer:");
SERIAL_ECHO(*timer);
SERIAL_ECHO(" ; Temperature:");
SERIAL_ECHO(temperature);
SERIAL_ECHO(" ; Target Temp:");
SERIAL_ECHO(target_temperature);
SERIAL_ECHOLN("");
*/
if ((target_temperature == 0) || thermal_runaway)
{
*state = 0;
*timer = 0;
return;
}
switch (*state)
void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc)
{
/*
SERIAL_ECHO_START;
SERIAL_ECHO("Thermal Thermal Runaway Running. Heater ID:");
SERIAL_ECHO(heater_id);
SERIAL_ECHO(" ; State:");
SERIAL_ECHO(*state);
SERIAL_ECHO(" ; Timer:");
SERIAL_ECHO(*timer);
SERIAL_ECHO(" ; Temperature:");
SERIAL_ECHO(temperature);
SERIAL_ECHO(" ; Target Temp:");
SERIAL_ECHO(target_temperature);
SERIAL_ECHOLN("");
*/
if ((target_temperature == 0) || thermal_runaway)
{
*state = 0;
*timer = 0;
return;
}
switch (*state)
{
case 0: // "Heater Inactive" state
if (target_temperature > 0) *state = 1;
break;
case 1: // "First Heating" state
if (temperature >= target_temperature) *state = 2;
break;
case 2: // "Temperature Stable" state
{
case 0: // "Heater Inactive" state
if (target_temperature > 0) *state = 1;
break;
case 1: // "First Heating" state
if (temperature >= target_temperature) *state = 2;
break;
case 2: // "Temperature Stable" state
if (temperature >= (target_temperature - hysteresis_degc))
unsigned long ms = millis();
if (temperature >= (target_temperature - hysteresis_degc))
{
*timer = ms;
}
else if ( (ms - *timer) > ((unsigned long) period_seconds) * 1000)
{
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP);
SERIAL_ERRORLN((int)heater_id);
LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY);
thermal_runaway = true;
while(1)
{
*timer = ms;
}
else if ( (ms - *timer) > ((unsigned long) period_seconds) * 1000)
{
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP);
SERIAL_ERRORLN((int)heater_id);
LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY);
thermal_runaway = true;
while(1)
{
disable_heater();
disable_x();
disable_y();
disable_z();
disable_e0();
disable_e1();
disable_e2();
disable_e3();
manage_heater();
lcd_update();
}
disable_heater();
disable_x();
disable_y();
disable_z();
disable_e0();
disable_e1();
disable_e2();
disable_e3();
manage_heater();
lcd_update();
}
break;
}
}
} break;
}
#endif //defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
}
#endif //THERMAL_RUNAWAY_PROTECTION_PERIOD
void disable_heater() {
#ifndef SINGLENOZZLE
......@@ -1209,46 +1237,6 @@ void disable_heater() {
#endif
}
void max_temp_error(uint8_t e) {
disable_heater();
if(IsStopped() == false) {
SERIAL_ERROR_START;
SERIAL_ERRORLN((int)e);
SERIAL_ERRORLNPGM(MSG_MAXTEMP_EXTRUDER_OFF);
LCD_ALERTMESSAGEPGM(MSG_ERR_MAXTEMP);
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop();
#endif
}
void min_temp_error(uint8_t e) {
disable_heater();
if(IsStopped() == false) {
SERIAL_ERROR_START;
SERIAL_ERRORLN((int)e);
SERIAL_ERRORLNPGM(MSG_MINTEMP_EXTRUDER_OFF);
LCD_ALERTMESSAGEPGM(MSG_ERR_MINTEMP);
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop();
#endif
}
void bed_max_temp_error(void) {
#if HAS_HEATER_BED
WRITE_HEATER_BED(0);
#endif
if (IsStopped() == false) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_MAXTEMP_BED_OFF);
LCD_ALERTMESSAGEPGM(MSG_ERR_MAXTEMP_BED);
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop();
#endif
}
#ifdef HEATER_0_USES_MAX6675
#define MAX6675_HEAT_INTERVAL 250
long max6675_previous_millis = MAX6675_HEAT_INTERVAL;
......
......@@ -697,7 +697,7 @@ static void lcd_prepare_menu() {
if (powersupply) {
MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
}
else{
else {
MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
}
#endif
......@@ -706,16 +706,16 @@ static void lcd_prepare_menu() {
}
#ifdef DELTA
static void lcd_delta_calibrate_menu() {
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_X, PSTR("G0 F8000 X-77.94 Y-45 Z0"));
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Y, PSTR("G0 F8000 X77.94 Y-45 Z0"));
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Z, PSTR("G0 F8000 X0 Y90 Z0"));
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G0 F8000 X0 Y0 Z0"));
END_MENU();
}
static void lcd_delta_calibrate_menu() {
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_X, PSTR("G0 F8000 X-77.94 Y-45 Z0"));
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Y, PSTR("G0 F8000 X77.94 Y-45 Z0"));
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Z, PSTR("G0 F8000 X0 Y90 Z0"));
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G0 F8000 X0 Y0 Z0"));
END_MENU();
}
#endif // DELTA
float move_menu_scale;
......@@ -995,6 +995,7 @@ static void lcd_control_motion_menu() {
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 100, 99000, reset_acceleration_rates);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &max_acceleration_units_per_sq_second[E_AXIS], 100, 99000, reset_acceleration_rates);
MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &retract_acceleration, 100, 99000);
MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &travel_acceleration, 100, 99000);
MENU_ITEM_EDIT(float52, MSG_XSTEPS, &axis_steps_per_unit[X_AXIS], 5, 9999);
MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
......@@ -1018,8 +1019,7 @@ static void lcd_control_motion_menu() {
END_MENU();
}
static void lcd_control_volumetric_menu()
{
static void lcd_control_volumetric_menu() {
START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
......
......@@ -845,32 +845,28 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
static void lcd_implementation_quick_feedback()
{
#ifdef LCD_USE_I2C_BUZZER
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
lcd_buzz(1000/6,100);
#else
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS,LCD_FEEDBACK_FREQUENCY_HZ);
#endif
#elif defined(BEEPER) && BEEPER > -1
#ifdef LCD_USE_I2C_BUZZER
#if defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) && defined(LCD_FEEDBACK_FREQUENCY_HZ)
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#else
lcd_buzz(1000/6, 100);
#endif
#elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER);
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
for(int8_t i=0;i<10;i++)
{
WRITE(BEEPER,HIGH);
delayMicroseconds(100);
WRITE(BEEPER,LOW);
delayMicroseconds(100);
}
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
const unsigned int delay = 100;
uint8_t i = 10;
#else
for(int8_t i=0;i<(LCD_FEEDBACK_FREQUENCY_DURATION_MS / (1000 / LCD_FEEDBACK_FREQUENCY_HZ));i++)
{
const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
int8_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;
#endif
while (i--) {
WRITE(BEEPER,HIGH);
delayMicroseconds(1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2);
delayMicroseconds(delay);
WRITE(BEEPER,LOW);
delayMicroseconds(1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2);
delayMicroseconds(delay);
}
#endif
#endif
#endif
}
#ifdef LCD_HAS_STATUS_INDICATORS
......
......@@ -84,7 +84,7 @@ void vector_3::debug(char* title)
SERIAL_PROTOCOL(y);
SERIAL_PROTOCOLPGM(" z: ");
SERIAL_PROTOCOL(z);
SERIAL_PROTOCOLPGM("\n");
SERIAL_EOL;
}
void apply_rotation_xyz(matrix_3x3 matrix, float &x, float& y, float& z)
......@@ -145,22 +145,17 @@ matrix_3x3 matrix_3x3::transpose(matrix_3x3 original)
return new_matrix;
}
void matrix_3x3::debug(char* title)
{
SERIAL_PROTOCOL(title);
SERIAL_PROTOCOL("\n");
int count = 0;
for(int i=0; i<3; i++)
{
for(int j=0; j<3; j++)
{
SERIAL_PROTOCOL(matrix[count]);
SERIAL_PROTOCOLPGM(" ");
count++;
}
SERIAL_PROTOCOLPGM("\n");
}
void matrix_3x3::debug(char* title) {
SERIAL_PROTOCOLLN(title);
int count = 0;
for(int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
SERIAL_PROTOCOL(matrix[count] + 0.0001);
SERIAL_PROTOCOLPGM(" ");
count++;
}
SERIAL_EOL;
}
}
#endif // #ifdef ENABLE_AUTO_BED_LEVELING
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment