Commit 8fd6eaa6 authored by MagoKimbra's avatar MagoKimbra

Fix

parent cf73391b
......@@ -368,11 +368,11 @@
/**
* Shorthand for pin tests, for temperature.cpp
*/
#define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0)
#define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0)
#define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0)
#define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0)
#define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0)
#define HAS_TEMP_0 (defined(TEMP_0_PIN) && (TEMP_0_PIN >= 0) && TEMP_SENSOR_0)
#define HAS_TEMP_1 (defined(TEMP_1_PIN) && (TEMP_1_PIN >= 0) && TEMP_SENSOR_1)
#define HAS_TEMP_2 (defined(TEMP_2_PIN) && (TEMP_2_PIN >= 0) && TEMP_SENSOR_2)
#define HAS_TEMP_3 (defined(TEMP_3_PIN) && (TEMP_3_PIN >= 0) && TEMP_SENSOR_3)
#define HAS_TEMP_BED ((defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0) && TEMP_SENSOR_BED)
#define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
#define HAS_POWER_CONSUMPTION_SENSOR (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0)
#define HAS_HEATER_0 (defined(HEATER_0_PIN) && HEATER_0_PIN >= 0)
......
......@@ -128,48 +128,51 @@
//===========================================================================
//================================ Thermistor ===============================
// Standard 4.7kohm pull up tables
//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
//
//// Temperature sensor settings:
// -2 is thermocouple with MAX6675 (only for sensor 0)
// -1 is thermocouple with AD595
// 0 is not used
// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
// 3 is Mendel-parts thermistor (4.7k pullup)
// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
// 10 is 100k RS thermistor 198-961 (4.7k pullup)
// 11 is 100k beta 3950 1% thermistor (4.7k pullup)
// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
// 20 is the PT100 circuit found in the Ultimainboard V2.x
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
//
// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
// (but gives greater accuracy and more stable PID)
// 51 is 100k thermistor - EPCOS (1k pullup)
// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
//
// -2 is thermocouple with MAX6675 (only for sensor 0)
// -1 is thermocouple with AD595
// 0 is not used
// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
// 3 is Mendel-parts thermistor (4.7k pullup)
// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
// 10 is 100k RS thermistor 198-961 (4.7k pullup)
// 11 is 100k beta 3950 1% thermistor (4.7k pullup)
// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
// 13 is 100k Hisens 3950 1% up to 300 degC for hotend "Simple ONE " & "Hotend "All In ONE"
// 20 is the PT100 circuit found in the Ultimainboard V2.x
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
// 1047 is Pt1000 with 4k7 pullup
// 1010 is Pt1000 with 1k pullup (non standard)
// 147 is Pt100 with 4k7 pullup
// 110 is Pt100 with 1k pullup (non standard)
// 1 kohm pullup tables
// ATTENTION: This is not normal, you would have to have changed out your 4.7k for 1k
// This gives greater accuracy and more stable PID
//
// 51 is 100k thermistor - EPCOS (1k pullup)
// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
// 147 is Pt100 with 4k7 pullup
// 110 is Pt100 with 1k pullup (non standard)
// 998 and 999 are Dummy Tables. They will ALWAYS read 25�C or the temperature defined below.
// Use it for Testing or Development purposes. NEVER for production machine.
// #define DUMMY_THERMISTOR_998_VALUE 25
// #define DUMMY_THERMISTOR_999_VALUE 100
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0
#define TEMP_SENSOR_BED 0
#define TEMP_SENSOR_BED 1
// 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.
// 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.
//#define TEMP_SENSOR_1_AS_REDUNDANT
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 // (degC)
......@@ -196,7 +199,7 @@
#define HEATER_3_MAXTEMP 275 // (degC)
#define BED_MAXTEMP 150 // (degC)
// If your bed has low resistance e.g. 0.6 ohm and throws the fuse you can duty cycle it to reduce the
// If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to reduce the
// average current. The value should be an integer and the heat bed will be turned on for 1 interval of
// HEATER_BED_DUTY_CYCLE_DIVIDER intervals.
//#define HEATER_BED_DUTY_CYCLE_DIVIDER 4
......@@ -237,7 +240,7 @@
// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
//
// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz,
// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
// If your configuration is significantly different than this and you don't understand the issues involved, you probably
......@@ -253,22 +256,25 @@
// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED)
#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
//#define PID_BED_DEBUG // Sends debug data to the serial port.
#ifdef PIDTEMPBED
//#define PID_BED_DEBUG // Sends debug data to the serial port.
// 120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of 0.15 (vs 0.1, 1, 10)
#define DEFAULT_bedKp 10.00
#define DEFAULT_bedKi 0.023
#define DEFAULT_bedKd 305.4
// 120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
// From pidautotune:
//#define DEFAULT_bedKp 97.1
//#define DEFAULT_bedKi 1.41
//#define DEFAULT_bedKd 1675.16
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#define DEFAULT_bedKp 10.00
#define DEFAULT_bedKi .023
#define DEFAULT_bedKd 305.4
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from pidautotune
// #define DEFAULT_bedKp 97.1
// #define DEFAULT_bedKi 1.41
// #define DEFAULT_bedKd 1675.16
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
#endif // PIDTEMPBED
//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
//can be software-disabled for whatever purposes by
#define PREVENT_DANGEROUS_EXTRUDE
......
......@@ -367,7 +367,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
// Add support for experimental filament exchange support M600; requires display
#ifdef ULTIPANEL
#define FILAMENTCHANGEENABLE
//#define FILAMENTCHANGEENABLE
#ifdef FILAMENTCHANGEENABLE
#define FILAMENTCHANGE_XPOS 3
#define FILAMENTCHANGE_YPOS 3
......@@ -377,13 +377,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#endif
#endif
#ifdef FILAMENTCHANGEENABLE
#ifdef EXTRUDER_RUNOUT_PREVENT
#error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
#endif
#endif
/******************************************************************************\
* enable this section if you have TMC26X motor drivers.
* you need to import the TMC26XStepper library into the arduino IDE for this
......
......@@ -22,6 +22,12 @@
#include "Configuration.h"
#include "pins.h"
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define BIT(b) (1<<(b))
#define TEST(n,b) (((n)&BIT(b))!=0)
......@@ -205,8 +211,8 @@ extern float delta_tower2_x,delta_tower2_y;
extern float delta_tower3_x,delta_tower3_y;
#endif
#ifdef SCARA
void calculate_delta(float cartesian[3]);
void calculate_SCARA_forward_Transform(float f_scara[3]);
void calculate_delta(float cartesian[3]);
void calculate_SCARA_forward_Transform(float f_scara[3]);
#endif
void prepare_move();
void kill();
......@@ -283,10 +289,10 @@ extern int fanSpeed;
#endif
#ifdef FAN_SOFT_PWM
extern unsigned char fanSpeedSoftPwm;
extern unsigned char fanSpeedSoftPwm;
#endif
#if defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && (FILWIDTH_PIN >= 0)
#if HAS_FILAMENT_SENSOR
extern float filament_width_nominal; //holds the theoretical filament diameter ie., 3.00 or 1.75
extern bool filament_sensor; //indicates that filament sensor readings should control extrusion
extern float filament_width_meas; //holds the filament diameter as accurately measured
......@@ -296,7 +302,7 @@ extern unsigned char fanSpeedSoftPwm;
extern int meas_delay_cm; //delay distance
#endif
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0)
#if HAS_POWER_CONSUMPTION_SENSOR
extern float power_consumption_meas; //holds the power consumption as accurately measured
extern unsigned long power_consumption_hour; //holds the power consumption per hour as accurately measured
#endif
......
......@@ -76,7 +76,7 @@ G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you ha
G30 - Single Z Probe, probes bed at current XY location. - Bed Probe and Delta geometry Autocalibration
G31 - Dock sled (Z_PROBE_SLED only)
G32 - Undock sled (Z_PROBE_SLED only)
G60 - Memory actual position
G60 - Store in memory actual position
G61 - Move X Y Z to position in memory
G90 - Use Absolute Coordinates
G91 - Use Relative Coordinates
......@@ -314,10 +314,6 @@ float lastpos[4];
#endif
};
#endif //HOTENDS > 1
<<<<<<< HEAD
=======
>>>>>>> origin/master
uint8_t active_extruder = 0;
uint8_t active_driver = 0;
......@@ -402,7 +398,7 @@ uint8_t debugLevel = 0;
static float delta[3] = { 0, 0, 0 };
#endif //SCARA
#if defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && (FILWIDTH_PIN >= 0)
#if HAS_FILAMENT_SENSOR
//Variables for Filament Sensor input
float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404
bool filament_sensor=false; //M405 turns on filament_sensor control, M406 turns it off
......@@ -414,7 +410,7 @@ uint8_t debugLevel = 0;
int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting
#endif
#if defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0
#if HAS_POWER_CONSUMPTION_SENSOR
float power_consumption_meas = 0;
unsigned long power_consumption_hour = 0.0;
#endif
......@@ -1085,27 +1081,9 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#ifdef DUAL_X_CARRIAGE
<<<<<<< HEAD
#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) + home_offset[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;
}
=======
#define DXC_FULL_CONTROL_MODE 0
#define DXC_AUTO_PARK_MODE 1
#define DXC_DUPLICATION_MODE 2
>>>>>>> origin/master
static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
......@@ -1144,18 +1122,10 @@ static float x_home_pos(int extruder) {
max_pos[X_AXIS] = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
return;
}
<<<<<<< HEAD
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0)
{
current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS];
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
=======
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS];
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
>>>>>>> origin/master
max(hotend_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
return;
}
......@@ -2861,14 +2831,8 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
// If topo_flag is set then don't zig-zag. Just scan in one direction.
// This gets the probe points in more readable order.
<<<<<<< HEAD
if (do_topography_map) zig = !zig;
for (int xCount=xStart; xCount != xStop; xCount += xInc)
{
=======
if (!do_topography_map) zig = !zig;
for (int xCount = xStart; xCount != xStop; xCount += xInc) {
>>>>>>> origin/master
double xProbe = left_probe_bed_position + xGridSpacing * xCount;
// raise extruder
......@@ -2933,11 +2897,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
SERIAL_PROTOCOLPGM("+-----------+\n");
for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
<<<<<<< HEAD
for (int xx = auto_bed_leveling_grid_points - 1; xx >= 0; xx--) {
=======
for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
>>>>>>> origin/master
int ind = yy * auto_bed_leveling_grid_points + xx;
float diff = eqnBVector[ind] - mean;
if (diff >= 0.0)
......@@ -2977,12 +2937,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
#endif // !AUTO_BED_LEVELING_GRID
<<<<<<< HEAD
if (verbose_level > 0)
plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
=======
if (verbose_level > 0) plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
>>>>>>> origin/master
// Correct the Z height difference from z-probe position and hotend tip position.
// The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
......@@ -3560,17 +3515,7 @@ inline void gcode_G92() {
current_position[i] = code_value();
if (i == E_AXIS)
plan_set_e_position(current_position[E_AXIS]);
<<<<<<< HEAD
}
else {
#ifdef SCARA
current_position[i] = code_value() + ((i != X_AXIS && i != Y_AXIS) ? home_offset[i] : 0);
#else
current_position[i] = code_value() + home_offset[i];
#endif
=======
else
>>>>>>> origin/master
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
}
}
......@@ -4152,41 +4097,6 @@ inline void gcode_M85() {
if (code_seen('S')) max_inactive_time = code_value() * 1000;
}
<<<<<<< HEAD
//finish moves
st_synchronize();
//disable extruder steppers so filament can be removed
disable_e();
delay(100);
boolean beep = true;
boolean sleep = false;
int cnt = 0;
int old_target_temperature[HOTENDS] = { 0 };
for(int8_t e = 0; e < HOTENDS; e++)
{
old_target_temperature[e] = target_temperature[e];
}
int old_target_temperature_bed = target_temperature_bed;
timer.set_max_delay(60000); // 1 minute
PRESSBUTTON:
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
while (!lcd_clicked()) {
manage_heater();
manage_inactivity(true);
lcd_update();
if (timer.check() && cnt <= 5) beep = true;
if (cnt >= 5 && !sleep) {
disable_heater();
disable_x();
disable_y();
disable_z();
disable_e();
sleep = true;
lcd_reset_alert_level();
LCD_ALERTMESSAGEPGM("Zzzz Zzzz Zzzz");
=======
// M92: Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
inline void gcode_M92() {
for(int8_t i = 0; i < NUM_AXIS; i++) {
......@@ -4200,7 +4110,6 @@ inline void gcode_M92() {
axis_steps_per_sqr_second[i] *= factor;
}
axis_steps_per_unit[i] = value;
>>>>>>> origin/master
}
else {
axis_steps_per_unit[i] = code_value();
......@@ -4224,22 +4133,6 @@ inline void gcode_M104() {
setWatch();
}
<<<<<<< HEAD
if (sleep) {
for(int8_t e = 0; e < HOTENDS; e++)
{
setTargetHotend(old_target_temperature[e], e);
CooldownNoWait = true;
wait_heater();
}
setTargetBed(old_target_temperature_bed);
CooldownNoWait = true;
wait_bed();
sleep = false;
beep = true;
cnt = 0;
goto PRESSBUTTON;
=======
// M105: Read hot end and bed temperature
inline void gcode_M105() {
if (setTargetedHotend(105)) return;
......@@ -4262,7 +4155,6 @@ inline void gcode_M105() {
SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetHotend(cur_extruder),1);
>>>>>>> origin/master
}
#else
SERIAL_ERROR_START;
......@@ -5021,15 +4913,6 @@ inline void gcode_M351() {
if (code_seen(axis_codes[i])) {
axis_scaling[i] = code_value();
}
<<<<<<< HEAD
break;
case 104: //M104
{
if(setTargetedHotend(104)) break;
if(debugDryrun()) break;
#if HOTENDS == 1
if (tmp_extruder != active_extruder) break;
=======
}
}
#endif // SCARA
......@@ -5044,7 +4927,6 @@ inline void gcode_M351() {
case 1:
OUT_WRITE(SOL1_PIN, HIGH);
break;
>>>>>>> origin/master
#endif
#if defined(SOL2_PIN) && SOL2_PIN > -1
case 2:
......@@ -5079,81 +4961,8 @@ inline void gcode_M351() {
inline void gcode_M381() { disable_all_solenoids(); }
#endif // EXT_SOLENOID
<<<<<<< HEAD
case 109: //M109 - Wait for extruder heater to reach target.
{
if(setTargetedHotend(109)) break;
if(debugDryrun()) break;
#if HOTENDS == 1
if (tmp_extruder != active_extruder) break;
#endif
LCD_MESSAGEPGM(MSG_HEATING);
#ifdef AUTOTEMP
autotemp_enabled=false;
#endif
if (code_seen('S'))
{
setTargetHotend(code_value(), tmp_extruder);
#ifdef DUAL_X_CARRIAGE
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
#endif
CooldownNoWait = true;
}
else if (code_seen('R'))
{
setTargetHotend(code_value(), tmp_extruder);
#ifdef DUAL_X_CARRIAGE
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
#endif
CooldownNoWait = false;
}
#ifdef AUTOTEMP
if (code_seen('S')) autotemp_min=code_value();
if (code_seen('B')) autotemp_max=code_value();
if (code_seen('F'))
{
autotemp_factor=code_value();
autotemp_enabled=true;
}
#endif //AUTOTEMP
wait_heater();
}
break;
case 111: //M111 - Debug mode
{
if (code_seen('S')) debugLevel = code_value();
if (debugDryrun())
{
SERIAL_ECHOLN("DEBUG DRYRUN ENABLED");
setTargetBed(0);
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder)
{
setTargetHotend(0, cur_extruder);
}
}
}
break;
case 112: //M112 - Emergency Stop
{
kill();
}
break;
case 114: //M114 - Output current position to serial port
{
SERIAL_PROTOCOLPGM("X:");
SERIAL_PROTOCOL(current_position[X_AXIS]);
SERIAL_PROTOCOLPGM(" Y:");
SERIAL_PROTOCOL(current_position[Y_AXIS]);
SERIAL_PROTOCOLPGM(" Z:");
SERIAL_PROTOCOL(current_position[Z_AXIS]);
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL(current_position[E_AXIS]);
=======
// M400: Finish all moves
inline void gcode_M400() { st_synchronize(); }
>>>>>>> origin/master
#if defined(ENABLE_AUTO_BED_LEVELING) && defined(SERVO_ENDSTOPS) && (NUM_SERVOS > 0) && not defined(Z_PROBE_SLED)
// M401: Engage Z Servo endstop if available
......@@ -5163,13 +4972,6 @@ inline void gcode_M400() { st_synchronize(); }
inline void gcode_M402() { retract_z_probe(); }
#endif
<<<<<<< HEAD
SERIAL_PROTOCOLPGM("SCARA Cal - Theta:");
SERIAL_PROTOCOL(delta[X_AXIS] + home_offset[X_AXIS]);
SERIAL_PROTOCOLPGM(" Psi+Theta (90):");
SERIAL_PROTOCOL(delta[Y_AXIS] - delta[X_AXIS] - 90 + home_offset[Y_AXIS]);
SERIAL_PROTOCOLLN("");
=======
#if defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && (FILWIDTH_PIN >= 0)
// M404: Display or set the nominal filament width (3mm, 1.75mm ) D<3.0>
inline void gcode_M404() {
......@@ -5186,7 +4988,6 @@ inline void gcode_M400() { st_synchronize(); }
inline void gcode_M405() {
if (code_seen('D')) meas_delay_cm = code_value();
if (meas_delay_cm > MAX_MEASUREMENT_DELAY) meas_delay_cm = MAX_MEASUREMENT_DELAY;
>>>>>>> origin/master
if (delay_index2 == -1) { //initialize the ring buffer if it has not been done since startup
int temp_ratio = widthFil_to_size_ratio();
......@@ -5646,20 +5447,6 @@ inline void gcode_T() {
if(tmp_extruder != active_extruder)
#endif // NPR2
{
<<<<<<< HEAD
for(int8_t i=0; i < 3; i++)
{
if(code_seen(axis_codes[i])) home_offset[i] = code_value();
}
#ifdef SCARA
if(code_seen('T')) // Theta
{
home_offset[X_AXIS] = code_value() ;
}
if(code_seen('P')) // Psi
{
home_offset[Y_AXIS] = code_value() ;
=======
// Save current position to return to after applying extruder offset
memcpy(destination, current_position, sizeof(destination));
#ifdef DUAL_X_CARRIAGE
......@@ -5671,7 +5458,6 @@ inline void gcode_T() {
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();
>>>>>>> origin/master
}
// apply Y & Z extruder offset (x offset is already used in determining home pos)
......@@ -5773,91 +5559,6 @@ inline void gcode_T() {
enable_e2();
break;
}
<<<<<<< HEAD
break;
default:
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND);
SERIAL_ECHO(cmdbuffer[bufindr]);
SERIAL_ECHOLNPGM("\"");
}
}
}
break;
#endif // FWRETRACT
#if HOTENDS > 1
case 218: //M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
{
if(setTargetedHotend(218)) break;
if(code_seen('X'))
{
hotend_offset[X_AXIS][tmp_extruder] = code_value();
}
if(code_seen('Y'))
{
hotend_offset[Y_AXIS][tmp_extruder] = code_value();
}
#ifdef DUAL_X_CARRIAGE
if(code_seen('Z'))
{
hotend_offset[Z_AXIS][tmp_extruder] = code_value();
}
#endif
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
for(tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++)
{
SERIAL_ECHO(" ");
SERIAL_ECHO(hotend_offset[X_AXIS][tmp_extruder]);
SERIAL_ECHO(",");
SERIAL_ECHO(hotend_offset[Y_AXIS][tmp_extruder]);
#ifdef DUAL_X_CARRIAGE
SERIAL_ECHO(",");
SERIAL_ECHO(hotend_offset[Z_AXIS][tmp_extruder]);
#endif
}
SERIAL_EOL;
}
break;
#endif //EXTRUDERS > 1
case 220: //M220 S<factor in percent>- set speed factor override percentage
{
if(code_seen('S'))
{
feedmultiply = code_value() ;
}
}
break;
case 221: //M221 S<factor in percent>- set extrude factor override percentage
{
if(code_seen('S'))
{
int tmp_code = code_value();
if (code_seen('T'))
{
if(setTargetedHotend(221)){
break;
}
extruder_multiplier[tmp_extruder] = tmp_code;
}
else
{
extruder_multiplier[active_extruder] = tmp_code;
}
}
}
break;
case 226: //M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
{
if(code_seen('P'))
{
int pin_number = code_value(); // pin number
int pin_state = -1; // required pin state - default is inverted
if(code_seen('S')) pin_state = code_value(); // required pin state
if(pin_state >= -1 && pin_state <= 1)
=======
#elif (EXTRUDERS == 2) && (E0E1_CHOICE_PIN >1)
st_synchronize(); // Finish all movement
disable_e();
......@@ -5887,7 +5588,6 @@ inline void gcode_T() {
#elif defined(NPR2)
st_synchronize(); // Finish all movement
if (old_color == 99)
>>>>>>> origin/master
{
csteps = (color_position[tmp_extruder]) * color_step_moltiplicator;
}
......@@ -6296,148 +5996,8 @@ void process_commands() {
gcode_M997(); break;
#endif // NPR2
<<<<<<< HEAD
if (dual_x_carriage_mode == DXC_FULL_CONTROL_MODE)
{
current_position[X_AXIS] = inactive_extruder_x_pos;
inactive_extruder_x_pos = destination[X_AXIS];
}
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE)
{
active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position
if (active_extruder == 0 || active_extruder_parked)
current_position[X_AXIS] = inactive_extruder_x_pos;
else
current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset;
inactive_extruder_x_pos = destination[X_AXIS];
extruder_duplication_enabled = false;
}
else
{
// record raised toolhead position for use by unpark
memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
active_extruder_parked = true;
delayed_move_time = 0;
}
#else
// Offset hotend (only by XY)
#if HOTENDS > 1
for (int i=X_AXIS; i<=Y_AXIS; i++)
current_position[i] += hotend_offset[i][tmp_extruder] - hotend_offset[i][active_extruder];
#endif // HOTENDS > 1
#if defined(MKR4) && (EXTRUDERS > 1)
#if (EXTRUDERS == 4) && (E0E2_CHOICE_PIN >1) && (E1E3_CHOICE_PIN > 1)
st_synchronize(); // Finish all movement
disable_e();
switch(tmp_extruder)
{
case 0:
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE(E1E3_CHOICE_PIN,LOW);
active_driver=0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
case 1:
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE(E1E3_CHOICE_PIN,LOW);
active_driver=1;
delay(500); // 500 microseconds delay for relay
enable_e1();
break;
case 2:
WRITE(E0E2_CHOICE_PIN,HIGH);
WRITE(E1E3_CHOICE_PIN,LOW);
active_driver=0;
delay(500); // 500 microseconds delay for relay
enable_e2();
break;
case 3:
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE(E1E3_CHOICE_PIN,HIGH);
active_driver=1;
delay(500); // 500 microseconds delay for relay
enable_e3();
break;
}
#elif (EXTRUDERS == 3) && (E0E2_CHOICE_PIN >1)
st_synchronize(); // Finish all movement
disable_e();
switch(tmp_extruder)
{
case 0:
WRITE(E0E2_CHOICE_PIN,LOW);
active_driver=0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
case 1:
WRITE(E0E2_CHOICE_PIN,LOW);
active_driver=1;
delay(500); // 500 microseconds delay for relay
enable_e1();
break;
case 2:
WRITE(E0E2_CHOICE_PIN,HIGH);
active_driver=0;
delay(500); // 500 microseconds delay for relay
enable_e2();
break;
}
#elif (EXTRUDERS == 2) && (E0E1_CHOICE_PIN >1)
st_synchronize(); // Finish all movement
disable_e();
switch(tmp_extruder)
{
case 0:
WRITE(E0E1_CHOICE_PIN,LOW);
active_driver=0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
case 1:
WRITE(E0E1_CHOICE_PIN,HIGH);
active_driver=0;
delay(500); // 500 microseconds delay for relay
enable_e1();
break;
}
#endif // E0E1_CHOICE_PIN E0E2_CHOICE_PIN E1E3_CHOICE_PIN
active_extruder = tmp_extruder;
SERIAL_ECHO_START;
SERIAL_ECHO("Active Driver: ");
SERIAL_PROTOCOLLN((int)active_driver);
SERIAL_ECHO_START;
SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);
SERIAL_PROTOCOLLN((int)active_extruder);
#elif defined(NPR2)
st_synchronize(); // Finish all movement
if (old_color == 99)
{
csteps = (color_position[tmp_extruder]) * color_step_moltiplicator;
}
else
{
csteps = (color_position[tmp_extruder] - color_position[old_color]) * color_step_moltiplicator;
}
if (csteps < 0) colorstep(-csteps,false);
if (csteps > 0) colorstep(csteps,true);
old_color = active_extruder = tmp_extruder;
active_driver = 0;
SERIAL_ECHO_START;
SERIAL_ECHO("Active Color: ");
SERIAL_PROTOCOLLN((int)active_extruder);
#else
active_driver = active_extruder = tmp_extruder;
SERIAL_ECHO_START;
SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);
SERIAL_PROTOCOLLN((int)active_extruder);
=======
case 999: // M999: Restart after being Stopped
gcode_M999(); break;
>>>>>>> origin/master
#ifdef CUSTOM_M_CODE_SET_Z_PROBE_OFFSET
case CUSTOM_M_CODE_SET_Z_PROBE_OFFSET:
......
......@@ -128,13 +128,13 @@
// 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.
#error The given LEFT_PROBE_BED_POSITION can not 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.
#error The given RIGHT_PROBE_BED_POSITION can not 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.
#error The given FRONT_PROBE_BED_POSITION can not 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.
#error The given BACK_PROBE_BED_POSITION can not be reached by the probe.
#endif
#define PROBE_SIZE_X (X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1))
......
#ifndef __CARDREADER_H
#define __CARDREADER_H
#ifndef CARDREADER_H
#define CARDREADER_H
#ifdef SDSUPPORT
......
......@@ -7,7 +7,7 @@
// ==> ALSO TRY ALL AVAILABLE "LANGUAGE_CHOICE" OPTIONS
// Languages
// 1 English
// 1 English // Language base
// 2 Polish
// 3 French
// 4 German
......@@ -109,6 +109,7 @@
#define MSG_UNKNOWN_COMMAND "Unknown command: \""
#define MSG_ACTIVE_EXTRUDER "Active Extruder: "
#define MSG_INVALID_EXTRUDER "Invalid extruder"
#define MSG_INVALID_SOLENOID "Invalid solenoid"
#define MSG_X_MIN "x_min: "
#define MSG_X_MAX "x_max: "
#define MSG_Y_MIN "y_min: "
......@@ -248,9 +249,9 @@
#define TESTSTRING360 "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377"
*/
#if LANGUAGE_CHOICE == 1 // English
#include "language_en.h"
#elif LANGUAGE_CHOICE == 2 // Polish
#include "language_en.h" // English
#if LANGUAGE_CHOICE == 2 // Polish
#include "language_pl.h"
#elif LANGUAGE_CHOICE == 3 // French
#include "language_fr.h"
......
......@@ -524,7 +524,7 @@ float junction_deviation = 0.1;
#ifdef EASY_LOAD
if (!allow_lengthy_extrude_once) {
#endif
position[E_AXIS] = target[E_AXIS]; //behave as if the move really took place, but ignore E part
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
#ifdef EASY_LOAD
......
......@@ -26,10 +26,6 @@
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_LEVELING
#include "vector_3.h"
#endif // ENABLE_AUTO_BED_LEVELING
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
// the source g-code and may never actually be reached if acceleration management is active.
typedef struct {
......@@ -127,6 +123,8 @@ extern unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#endif
extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions
extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed
extern volatile unsigned char block_buffer_tail;
// Returns true if the buffer has a queued block, false otherwise
FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
......
......@@ -33,7 +33,6 @@
#include <SPI.h>
#endif
//===========================================================================
//============================= public variables ============================
//===========================================================================
......@@ -86,6 +85,7 @@ static volatile bool endstop_z_hit = false;
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
bool abort_on_endstop_hit = false;
#endif
#ifdef MOTOR_CURRENT_PWM_XY_PIN
int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT;
#endif
......@@ -145,9 +145,6 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
#ifdef Z_DUAL_STEPPER_DRIVERS
#define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }
<<<<<<< HEAD
#define Z_APPLY_STEP(v,Q) { Z_STEP_WRITE(v); Z2_STEP_WRITE(v); }
=======
#ifdef Z_DUAL_ENDSTOPS
#define Z_APPLY_STEP(v,Q) \
if (performing_homing) { \
......@@ -165,7 +162,6 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
#else
#define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v), Z2_STEP_WRITE(v)
#endif
>>>>>>> origin/master
#else
#define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v)
#define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v)
......@@ -521,7 +517,7 @@ ISR(TIMER1_COMPA_vect) {
else { // +direction
#ifdef DUAL_X_CARRIAGE
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
if ((current_block->active_driver == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
if ((current_block->active_driver == 0 && X_HOME_DIR == 1) || (current_block->active_driver != 0 && X2_HOME_DIR == 1))
#endif
{
#if defined(X_MAX_PIN) && X_MAX_PIN >= 0
......@@ -797,52 +793,51 @@ ISR(TIMER1_COMPA_vect) {
E0_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
#if DRIVER_EXTRUDERS > 1
if (e_steps[1] != 0) {
E1_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[1] < 0) {
E1_DIR_WRITE(INVERT_E1_DIR);
e_steps[1]++;
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[1] > 0) {
E1_DIR_WRITE(!INVERT_E1_DIR);
e_steps[1]--;
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
#endif
#if DRIVER_EXTRUDERS > 2
if (e_steps[2] != 0) {
E2_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[2] < 0) {
E2_DIR_WRITE(INVERT_E2_DIR);
e_steps[2]++;
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[2] > 0) {
E2_DIR_WRITE(!INVERT_E2_DIR);
e_steps[2]--;
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
#if DRIVER_EXTRUDERS > 1
if (e_steps[1] != 0) {
E1_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[1] < 0) {
E1_DIR_WRITE(INVERT_E1_DIR);
e_steps[1]++;
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[1] > 0) {
E1_DIR_WRITE(!INVERT_E1_DIR);
e_steps[1]--;
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
}
#endif
#if DRIVER_EXTRUDERS > 3
if (e_steps[3] != 0) {
E3_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[3] < 0) {
E3_DIR_WRITE(INVERT_E3_DIR);
e_steps[3]++;
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
#endif
#if DRIVER_EXTRUDERS > 2
if (e_steps[2] != 0) {
E2_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[2] < 0) {
E2_DIR_WRITE(INVERT_E2_DIR);
e_steps[2]++;
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[2] > 0) {
E2_DIR_WRITE(!INVERT_E2_DIR);
e_steps[2]--;
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
else if (e_steps[3] > 0) {
E3_DIR_WRITE(!INVERT_E3_DIR);
e_steps[3]--;
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
#endif
#if DRIVER_EXTRUDERS > 3
if (e_steps[3] != 0) {
E3_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[3] < 0) {
E3_DIR_WRITE(INVERT_E3_DIR);
e_steps[3]++;
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[3] > 0) {
E3_DIR_WRITE(!INVERT_E3_DIR);
e_steps[3]--;
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
}
#endif
#endif
}
}
#endif // ADVANCE
......
......@@ -41,38 +41,6 @@
//================================== macros =================================
//===========================================================================
<<<<<<< HEAD
#if HOTENDS > 4
#error Unsupported number of hotends
#elif HOTENDS > 3
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif HOTENDS > 2
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3 }
#elif HOTENDS > 1
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2 }
#else
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1 }
#endif
#define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0)
#define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0)
#define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0)
#define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0)
#define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0)
#define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
#define HAS_POWER_CONSUMPTION_SENSOR (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0)
#define HAS_HEATER_0 (defined(HEATER_0_PIN) && HEATER_0_PIN >= 0)
#define HAS_HEATER_1 (defined(HEATER_1_PIN) && HEATER_1_PIN >= 0)
#define HAS_HEATER_2 (defined(HEATER_2_PIN) && HEATER_2_PIN >= 0)
#define HAS_HEATER_3 (defined(HEATER_3_PIN) && HEATER_3_PIN >= 0)
#define HAS_HEATER_BED (defined(HEATER_BED_PIN) && HEATER_BED_PIN >= 0)
#define HAS_AUTO_FAN_0 (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN >= 0)
#define HAS_AUTO_FAN_1 (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN >= 0)
#define HAS_AUTO_FAN_2 (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN >= 0)
#define HAS_AUTO_FAN_3 (defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN >= 0)
#define HAS_AUTO_FAN HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3
#define HAS_FAN (defined(FAN_PIN) && FAN_PIN >= 0)
=======
#ifdef K1 // Defined in Configuration.h in the PID settings
#define K2 (1.0 - K1)
#endif
......@@ -80,26 +48,12 @@
#if defined(PIDTEMPBED) || defined(PIDTEMP)
#define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0))
#endif
>>>>>>> origin/master
//===========================================================================
//============================= public variables ============================
//===========================================================================
<<<<<<< HEAD
// Sampling period of the temperature routine
#ifdef PID_dT
#undef PID_dT
#endif
#define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0))
int target_temperature[HOTENDS] = { 0 };
int current_temperature_raw[HOTENDS] = { 0 };
float current_temperature[HOTENDS] = { 0.0 };
=======
int target_temperature[HOTENDS] = { 0 };
>>>>>>> origin/master
int target_temperature_bed = 0;
int current_temperature_raw[HOTENDS] = { 0 };
float current_temperature[HOTENDS] = { 0.0 };
......@@ -109,12 +63,6 @@ float current_temperature_bed = 0.0;
int redundant_temperature_raw = 0;
float redundant_temperature = 0.0;
#endif
<<<<<<< HEAD
#ifdef PIDTEMP
float Kp[HOTENDS],Ki[HOTENDS],Kd[HOTENDS];
#endif //PIDTEMP
=======
>>>>>>> origin/master
#ifdef PIDTEMPBED
float bedKp=DEFAULT_bedKp;
......@@ -189,11 +137,7 @@ static unsigned char soft_pwm[HOTENDS];
// Init min and max temp with extreme values to prevent false errors during startup
static int minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS( HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP);
static int maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS( HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP);
<<<<<<< HEAD
static int minttemp[HOTENDS] = ARRAY_BY_HOTENDS( 0, 0, 0, 0 );
=======
static int minttemp[HOTENDS] = { 0 };
>>>>>>> origin/master
static int maxttemp[HOTENDS] = ARRAY_BY_HOTENDS( 16383, 16383, 16383, 16383 );
//static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; /* No bed mintemp error implemented?!? */
......@@ -214,13 +158,8 @@ static float analog2tempBed(int raw);
static void updateTemperaturesFromRawValues();
#ifdef WATCH_TEMP_PERIOD
<<<<<<< HEAD
int watch_start_temp[HOTENDS] = ARRAY_BY_HOTENDS(0,0,0,0);
unsigned long watchmillis[HOTENDS] = ARRAY_BY_HOTENDS(0,0,0,0);
=======
int watch_start_temp[HOTENDS] = { 0 };
unsigned long watchmillis[HOTENDS] = { 0 };
>>>>>>> origin/master
#endif //WATCH_TEMP_PERIOD
#ifndef SOFT_PWM_SCALE
......@@ -250,7 +189,7 @@ void PID_autotune(float temp, int hotend, int ncycles)
long bias, d;
float Ku, Tu;
float Kp, Ki, Kd;
float Kp_temp, Ki_temp, Kd_temp;
float max = 0, min = 10000;
#if HAS_AUTO_FAN
......@@ -280,7 +219,7 @@ void PID_autotune(float temp, int hotend, int ncycles)
unsigned long ms = millis();
if (temp_meas_ready == true) { // temp sample ready
if (temp_meas_ready) { // temp sample ready
updateTemperaturesFromRawValues();
input = (hotend<0)?current_temperature_bed:current_temperature[hotend];
......@@ -327,28 +266,28 @@ void PID_autotune(float temp, int hotend, int ncycles)
Tu = ((float)(t_low + t_high) / 1000.0);
SERIAL_PROTOCOLPGM(MSG_KU); SERIAL_PROTOCOL(Ku);
SERIAL_PROTOCOLPGM(MSG_TU); SERIAL_PROTOCOLLN(Tu);
Kp = 0.6 * Ku;
Ki = 2 * Kp / Tu;
Kd = Kp * Tu / 8;
Kp_temp = 0.6 * Ku;
Ki_temp = 2 * Kp_temp / Tu;
Kd_temp = Kp_temp * Tu / 8;
SERIAL_PROTOCOLLNPGM(MSG_CLASSIC_PID);
SERIAL_PROTOCOLPGM(MSG_KP); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(MSG_KI); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(MSG_KD); SERIAL_PROTOCOLLN(Kd);
SERIAL_PROTOCOLPGM(MSG_KP); SERIAL_PROTOCOLLN(Kp_temp);
SERIAL_PROTOCOLPGM(MSG_KI); SERIAL_PROTOCOLLN(Ki_temp);
SERIAL_PROTOCOLPGM(MSG_KD); SERIAL_PROTOCOLLN(Kd_temp);
/*
Kp = 0.33*Ku;
Ki = Kp/Tu;
Kd = Kp*Tu/3;
Ki = Kp_temp / Tu;
Kd = Kp_temp * Tu / 3;
SERIAL_PROTOCOLLNPGM(" Some overshoot ");
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_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp_temp);
SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki_temp);
SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd_temp);
Kp = 0.2 * Ku;
Ki = 2 * Kp_temp / Tu;
Kd = Kp_temp * Tu / 3;
SERIAL_PROTOCOLLNPGM(" No overshoot ");
SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd);
SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp_temp);
SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki_temp);
SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd_temp);
*/
}
}
......@@ -390,6 +329,9 @@ void PID_autotune(float temp, int hotend, int ncycles)
}
if (cycles > ncycles) {
SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED);
PID_PARAM(Kp, hotend) = Kp_temp;
PID_PARAM(Ki, hotend) = scalePID_i(Ki_temp);
PID_PARAM(Kd, hotend) = scalePID_d(Kd_temp);
return;
}
lcd_update();
......@@ -399,11 +341,7 @@ void PID_autotune(float temp, int hotend, int ncycles)
void updatePID() {
#ifdef PIDTEMP
for (int e = 0; e < HOTENDS; e++) {
<<<<<<< HEAD
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki[e];
=======
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e);
>>>>>>> origin/master
}
#endif
#ifdef PIDTEMPBED
......@@ -416,95 +354,6 @@ int getHeaterPower(int heater) {
}
#if HAS_AUTO_FAN
<<<<<<< HEAD
#if HAS_FAN
#if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN"
#endif
#if EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN"
#endif
#if EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN"
#endif
#if EXTRUDER_3_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set EXTRUDER_3_AUTO_FAN_PIN equal to FAN_PIN"
#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 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
#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
// update extruder auto fan states
#if HAS_AUTO_FAN_0
setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
#endif
#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
}
=======
void setExtruderAutoFanState(int pin, bool state)
{
......@@ -579,53 +428,11 @@ void checkExtruderAutoFans()
#endif
}
>>>>>>> origin/master
#endif // any extruder auto fan pins set
//
// Temperature Error Handlers
//
<<<<<<< HEAD
#if HOTENDS > 0
#if !HAS_HEATER_0
#error HEATER_0_PIN not defined for this board
#endif
#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, v)
#endif
#if HOTENDS > 1 || defined(HEATERS_PARALLEL)
#if !HAS_HEATER_1
#error HEATER_1_PIN not defined for this board
#endif
#define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, v)
#if HOTENDS > 2
#if !HAS_HEATER_2
#error HEATER_2_PIN not defined for this board
#endif
#define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
#if HOTENDS > 3
#if !HAS_HEATER_3
#error HEATER_3_PIN not defined for this board
#endif
#define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
#endif
#endif
#endif
#ifdef HEATERS_PARALLEL
#define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
#else
#define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
#endif
#if HAS_HEATER_BED
#define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, v)
#endif
#if HAS_FAN
#define WRITE_FAN(v) WRITE(FAN_PIN, v)
#endif
=======
>>>>>>> origin/master
inline void _temp_error(int e, const char *msg1, const char *msg2) {
if (!IsStopped()) {
SERIAL_ERROR_START;
......@@ -778,13 +585,8 @@ void manage_heater() {
unsigned long ms = millis();
// Loop through all hotends
<<<<<<< HEAD
for (int e = 0; e < HOTENDS; e++)
{
=======
for (int e = 0; e < HOTENDS; e++) {
>>>>>>> origin/master
#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_RUNAWAY_PROTECTION_PERIOD, THERMAL_RUNAWAY_PROTECTION_HYSTERESIS);
#endif
......@@ -814,10 +616,7 @@ void manage_heater() {
_temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP));
}
#endif //TEMP_SENSOR_1_AS_REDUNDANT
<<<<<<< HEAD
=======
>>>>>>> origin/master
} // Hotends Loop
#if HAS_AUTO_FAN
......@@ -968,13 +767,7 @@ static void updateTemperaturesFromRawValues() {
#ifdef HEATER_0_USES_MAX6675
current_temperature_raw[0] = read_max6675();
#endif
<<<<<<< HEAD
for (int e = 0; e < HOTENDS; e++)
{
=======
for (int e = 0; e < HOTENDS; e++) {
>>>>>>> origin/master
current_temperature[e] = analog2temp(current_temperature_raw[e], e);
}
current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
......@@ -1010,7 +803,7 @@ static void updateTemperaturesFromRawValues() {
// Convert raw Filament Width to millimeters
float analog2widthFil() {
return current_raw_filwidth / (1023 * OVERSAMPLENR) * 5.0;
return current_raw_filwidth / 16383.0 * 5.0;
//return current_raw_filwidth;
}
......@@ -1024,8 +817,6 @@ static void updateTemperaturesFromRawValues() {
#endif
<<<<<<< HEAD
=======
#if HAS_POWER_CONSUMPTION_SENSOR
// Convert raw Power Consumption to watt
float analog2current() {
......@@ -1037,7 +828,6 @@ static void updateTemperaturesFromRawValues() {
return (analog2current() * POWER_VOLTAGE * 100) / POWER_EFFICIENCY;
}
#endif
>>>>>>> origin/master
void tp_init()
{
......@@ -1048,12 +838,7 @@ void tp_init()
#endif
// Finish init of mult hotends arrays
<<<<<<< HEAD
for (int e = 0; e < HOTENDS; e++)
{
=======
for (int e = 0; e < HOTENDS; e++) {
>>>>>>> origin/master
// populate with the first value
maxttemp[e] = maxttemp[0];
#ifdef PIDTEMP
......@@ -1222,12 +1007,7 @@ void tp_init()
void setWatch() {
#ifdef WATCH_TEMP_PERIOD
unsigned long ms = millis();
<<<<<<< HEAD
for (int e = 0; e < HOTENDS; e++)
{
=======
for (int e = 0; e < HOTENDS; e++) {
>>>>>>> origin/master
if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) {
watch_start_temp[e] = degHotend(e);
watchmillis[e] = ms;
......@@ -1302,12 +1082,7 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
void disable_heater() {
<<<<<<< HEAD
for (int e = 0; e < HOTENDS; e++)
setTargetHotend(0, e);
=======
for (int i = 0; i < HOTENDS; i++) setTargetHotend(0, i);
>>>>>>> origin/master
setTargetBed(0);
#define DISABLE_HEATER(NR) { \
......@@ -1323,23 +1098,6 @@ void disable_heater() {
#endif
#if HOTENDS > 1 && HAS_TEMP_1
<<<<<<< HEAD
target_temperature[1] = 0;
soft_pwm[1] = 0;
WRITE_HEATER_1(LOW);
#endif
#if HOTENDS > 2 && HAS_TEMP_2
target_temperature[2] = 0;
soft_pwm[2] = 0;
WRITE_HEATER_2(LOW);
#endif
#if HOTENDS > 3 && HAS_TEMP_3
target_temperature[3] = 0;
soft_pwm[3] = 0;
WRITE_HEATER_3(LOW);
=======
DISABLE_HEATER(1);
#endif
......@@ -1349,7 +1107,6 @@ void disable_heater() {
#if HOTENDS > 3 && HAS_TEMP_3
DISABLE_HEATER(3);
>>>>>>> origin/master
#endif
#if HAS_TEMP_BED
......@@ -1438,37 +1195,32 @@ enum TempState {
StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle
};
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
#define TEMP_SENSOR_COUNT 2
#else
#define TEMP_SENSOR_COUNT HOTENDS
#endif
static unsigned long raw_temp_value[TEMP_SENSOR_COUNT] = { 0 };
static unsigned long raw_temp_value[4] = { 0 };
static unsigned long raw_temp_bed_value = 0;
static void set_current_temp_raw() {
#ifndef HEATER_0_USES_MAX6675
#if HAS_TEMP_0 && !defined(HEATER_0_USES_MAX6675)
current_temperature_raw[0] = raw_temp_value[0];
#endif
#if HOTENDS > 1
#if HAS_TEMP_1
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
redundant_temperature_raw =
#endif
current_temperature_raw[1] = raw_temp_value[1];
#if HOTENDS > 2
#if HAS_TEMP_2
current_temperature_raw[2] = raw_temp_value[2];
#if HOTENDS > 3
#if HAS_TEMP_3
current_temperature_raw[3] = raw_temp_value[3];
#endif
#endif
#endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
redundant_temperature_raw = raw_temp_value[1];
#endif
current_temperature_bed_raw = raw_temp_bed_value;
#if HAS_POWER_CONSUMPTION_SENSOR
float power_zero_raw = (POWER_ZERO * 1023 * OVERSAMPLENR) / 5.0;
current_raw_powconsumption = (raw_powconsumption_value < power_zero_raw) ? (2 * power_zero_raw - raw_powconsumption_value) : (raw_powconsumption_value);
#endif
temp_meas_ready = true;
}
//
......@@ -1477,11 +1229,6 @@ static void set_current_temp_raw() {
ISR(TIMER0_COMPB_vect) {
//these variables are only accessible from the ISR, but static, so they don't lose their value
static unsigned char temp_count = 0;
<<<<<<< HEAD
static unsigned long raw_temp_value[HOTENDS] = { 0 };
static unsigned long raw_temp_bed_value = 0;
=======
>>>>>>> origin/master
static TempState temp_state = StartupDelay;
static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
......@@ -1551,10 +1298,6 @@ ISR(TIMER0_COMPB_vect) {
}
if (soft_pwm_0 < pwm_count) { WRITE_HEATER_0(0); }
<<<<<<< HEAD
=======
>>>>>>> origin/master
#if HOTENDS > 1
if (soft_pwm_1 < pwm_count) WRITE_HEATER_1(0);
#if HOTENDS > 2
......@@ -1805,101 +1548,22 @@ ISR(TIMER0_COMPB_vect) {
} // switch(temp_state)
if (temp_count >= OVERSAMPLENR) { // 14 * 16 * 1/(16000000/64/256)
if (!temp_meas_ready) { //Only update the raw values if they have been read. Else we could be updating them during reading.
<<<<<<< HEAD
#ifndef HEATER_0_USES_MAX6675
current_temperature_raw[0] = raw_temp_value[0];
#endif
#if HOTENDS > 1
current_temperature_raw[1] = raw_temp_value[1];
#if HOTENDS > 2
current_temperature_raw[2] = raw_temp_value[2];
#if HOTENDS > 3
current_temperature_raw[3] = raw_temp_value[3];
#endif
#endif
#endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
redundant_temperature_raw = raw_temp_value[1];
#endif
current_temperature_bed_raw = raw_temp_bed_value;
=======
set_current_temp_raw();
>>>>>>> origin/master
} //!temp_meas_ready
// Update the raw values if they've been read. Else we could be updating them during reading.
if (!temp_meas_ready) set_current_temp_raw();
// Filament Sensor - can be read any time since IIR filtering is used
#if HAS_FILAMENT_SENSOR
current_raw_filwidth = raw_filwidth_value >> 10; // Divide to get to 0-16384 range since we used 1/128 IIR filter approach
#endif
temp_meas_ready = true;
temp_count = 0;
<<<<<<< HEAD
for (int i = 0; i < HOTENDS; i++) raw_temp_value[i] = 0;
raw_temp_bed_value = 0;
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
#define GE0 <=
#define LE0 >=
#else
#define GE0 >=
#define LE0 <=
=======
for (int i = 0; i < TEMP_SENSOR_COUNT; i++) raw_temp_value[i] = 0;
for (int i = 0; i < 4; i++) raw_temp_value[i] = 0;
raw_temp_bed_value = 0;
#if HAS_POWER_CONSUMPTION_SENSOR
raw_powconsumption_value = 0;
>>>>>>> origin/master
#endif
if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0);
if (current_temperature_raw[0] LE0 minttemp_raw[0]) min_temp_error(0);
#if HOTENDS > 1
#if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
#define GE1 <=
#define LE1 >=
#else
#define GE1 >=
#define LE1 <=
#endif
if (current_temperature_raw[1] GE1 maxttemp_raw[1]) max_temp_error(1);
if (current_temperature_raw[1] LE1 minttemp_raw[1]) min_temp_error(1);
#if HOTENDS > 2
#if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
#define GE2 <=
#define LE2 >=
#else
#define GE2 >=
#define LE2 <=
#endif
if (current_temperature_raw[2] GE2 maxttemp_raw[2]) max_temp_error(2);
if (current_temperature_raw[2] LE2 minttemp_raw[2]) min_temp_error(2);
#if HOTENDS > 3
#if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
#define GE3 <=
#define LE3 >=
#else
#define GE3 >=
#define LE3 <=
#endif
if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3);
if (current_temperature_raw[3] LE3 minttemp_raw[3]) min_temp_error(3);
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HOTENDS > 1
<<<<<<< HEAD
#if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
#if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
#define GEBED <=
#define LEBED >=
#else
#define GEBED >=
#define LEBED <=
=======
#ifndef HEATER_0_USES_MAX6675
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
#define GE0 <=
......@@ -1946,7 +1610,6 @@ ISR(TIMER0_COMPB_vect) {
#define GEBED <=
#else
#define GEBED >=
>>>>>>> origin/master
#endif
if (current_temperature_bed_raw GEBED bed_maxttemp_raw) {
target_temperature_bed = 0;
......
......@@ -30,7 +30,7 @@
void tp_init(); //initialize the heating
void manage_heater(); //it is critical that this is called periodically.
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
#if HAS_FILAMENT_SENSOR
// For converting raw Filament Width to milimeters
float analog2widthFil();
......@@ -38,7 +38,7 @@ void manage_heater(); //it is critical that this is called periodically.
int widthFil_to_size_ratio();
#endif
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0)
#if HAS_POWER_CONSUMPTION_SENSOR
// For converting raw Power Consumption to watt
float analog2current();
float analog2power();
......@@ -64,12 +64,8 @@ extern float current_temperature_bed;
#endif
#ifdef PIDTEMP
<<<<<<< HEAD
extern float Kp[HOTENDS],Ki[HOTENDS],Kd[HOTENDS];
=======
extern float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
#define PID_PARAM(param,e) param[e] // use macro to point to array value
>>>>>>> origin/master
float scalePID_i(float i);
float scalePID_d(float d);
float unscalePID_i(float i);
......@@ -150,11 +146,7 @@ FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_tempe
#define setTargetHotend3(_celsius) do{}while(0)
#endif
#if HOTENDS > 4
<<<<<<< HEAD
#error Invalid number of hotend
=======
#error Invalid number of hotends
>>>>>>> origin/master
#endif
int getHeaterPower(int heater);
......
......@@ -214,11 +214,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
#endif //!ENCODER_RATE_MULTIPLIER
#define END_MENU() \
<<<<<<< HEAD
if (encoderLine >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
=======
if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\
>>>>>>> origin/master
if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
} } while(0)
......@@ -1025,41 +1021,6 @@ static void lcd_control_temperature_menu() {
#endif
#ifdef PIDTEMP
// set up temp variables - undo the default scaling
<<<<<<< HEAD
raw_Ki = unscalePID_i(Ki[0]);
raw_Kd = unscalePID_d(Kd[0]);
MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp[0], 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
#if HOTENDS > 1
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki[1]);
raw_Kd = unscalePID_d(Kd[1]);
MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &Kp[1], 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d);
#endif //HOTENDS > 1
#if HOTENDS > 2
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki[2]);
raw_Kd = unscalePID_d(Kd[2]);
MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &Kp[2], 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d);
#endif //HOTENDS > 2
#if HOTENDS > 3
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki[3]);
raw_Kd = unscalePID_d(Kd[3]);
MENU_ITEM_EDIT(float52, MSG_PID_P " E4", &Kp[3], 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E4", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E4", &raw_Kd, 1, 9990, copy_and_scalePID_d);
#endif //HOTENDS > 2
=======
raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990);
......@@ -1093,7 +1054,6 @@ static void lcd_control_temperature_menu() {
#endif //HOTENDS > 3
#endif //HOTENDS > 2
#endif //HOTENDS > 1
>>>>>>> origin/master
#endif //PIDTEMP
MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
......
......@@ -382,7 +382,7 @@ static void lcd_set_custom_characters(
static void lcd_implementation_init (
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
bool progress_bar_set=true
bool progress_bar_set = true
#endif
) {
......@@ -470,24 +470,10 @@ static void lcd_implementation_status_screen()
lcd.print('/');
lcd.print(itostr3left(tTarget));
<<<<<<< HEAD
<<<<<<< HEAD
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(8, 0);
#if HOTENDS > 1
=======
#if (EXTRUDERS > 1 && !defined(SINGLENOZZLE)) || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(8, 0);
#if EXTRUDERS > 1 && !defined(SINGLENOZZLE)
>>>>>>> origin/master
=======
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(8, 0);
#if HOTENDS > 1
>>>>>>> origin/master
tHotend = int(degHotend(1) + 0.5);
tTarget = int(degTargetHotend(1) + 0.5);
lcd.print(LCD_STR_THERMOMETER[0]);
......@@ -499,15 +485,7 @@ static void lcd_implementation_status_screen()
lcd.print(itostr3(tHotend));
lcd.print('/');
lcd.print(itostr3left(tTarget));
<<<<<<< HEAD
<<<<<<< HEAD
#endif //HOTENDS > 1 || TEMP_SENSOR_BED != 0
=======
#endif //(EXTRUDERS > 1 && !defined(SINGLENOZZLE)) || TEMP_SENSOR_BED != 0
>>>>>>> origin/master
=======
#endif //HOTENDS > 1 || TEMP_SENSOR_BED != 0
>>>>>>> origin/master
#else//LCD_WIDTH > 19
lcd.setCursor(0, 0);
......@@ -518,24 +496,10 @@ static void lcd_implementation_status_screen()
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
if (tTarget < 10) lcd.print(' ');
<<<<<<< HEAD
<<<<<<< HEAD
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(10, 0);
#if HOTENDS > 1
=======
#if (EXTRUDERS > 1 && !defined(SINGLENOZZLE)) || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(10, 0);
#if EXTRUDERS > 1 && !defined(SINGLENOZZLE)
>>>>>>> origin/master
=======
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(10, 0);
#if HOTENDS > 1
>>>>>>> origin/master
tHotend = int(degHotend(1) + 0.5);
tTarget = int(degTargetHotend(1) + 0.5);
lcd.print(LCD_STR_THERMOMETER[0]);
......@@ -549,110 +513,6 @@ static void lcd_implementation_status_screen()
lcd.print(itostr3left(tTarget));
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
if (tTarget < 10) lcd.print(' ');
<<<<<<< HEAD
<<<<<<< HEAD
#endif//HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif//LCD_WIDTH > 19
#if LCD_HEIGHT > 2
//Lines 2 for 4 line LCD
#if LCD_WIDTH < 20
#ifdef SDSUPPORT
lcd.setCursor(0, 2);
lcd_printPGM(PSTR("SD"));
if (IS_SD_PRINTING)
lcd.print(itostr3(card.percentDone()));
else
lcd_printPGM(PSTR("---"));
lcd.print('%');
#endif//SDSUPPORT
#else //LCD_WIDTH > 19
#if HOTENDS > 1 && TEMP_SENSOR_BED != 0
//If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
tHotend=int(degBed() + 0.5);
tTarget=int(degTargetBed() + 0.5);
lcd.setCursor(0, 1);
lcd.print(LCD_STR_BEDTEMP[0]);
lcd.print(itostr3(tHotend));
lcd.print('/');
lcd.print(itostr3left(tTarget));
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
if (tTarget < 10) lcd.print(' ');
#else
lcd.setCursor(0,1);
#ifdef DELTA
lcd.print('X');
lcd.print(ftostr30(current_position[X_AXIS]));
lcd_printPGM(PSTR(" Y"));
lcd.print(ftostr30(current_position[Y_AXIS]));
#else
lcd.print('X');
lcd.print(ftostr3(current_position[X_AXIS]));
lcd_printPGM(PSTR(" Y"));
lcd.print(ftostr3(current_position[Y_AXIS]));
#endif // DELTA
#endif //HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif //LCD_WIDTH > 19
lcd.setCursor(LCD_WIDTH - 8, 1);
lcd.print('Z');
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
#endif //LCD_HEIGHT > 2
#if LCD_HEIGHT > 3
=======
#endif//(EXTRUDERS > 1 && !defined(SINGLENOZZLE)) || TEMP_SENSOR_BED != 0
#endif//LCD_WIDTH > 19
#if LCD_HEIGHT > 2
//Lines 2 for 4 line LCD
# if LCD_WIDTH < 20
# ifdef SDSUPPORT
lcd.setCursor(0, 2);
lcd_printPGM(PSTR("SD"));
if (IS_SD_PRINTING)
lcd.print(itostr3(card.percentDone()));
else
lcd_printPGM(PSTR("---"));
lcd.print('%');
# endif//SDSUPPORT
# else//LCD_WIDTH > 19
# if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0 && !defined(SINGLENOZZLE)
//If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
tHotend=int(degBed() + 0.5);
tTarget=int(degTargetBed() + 0.5);
lcd.setCursor(0, 1);
lcd.print(LCD_STR_BEDTEMP[0]);
lcd.print(itostr3(tHotend));
lcd.print('/');
lcd.print(itostr3left(tTarget));
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
if (tTarget < 10)
lcd.print(' ');
# else
lcd.setCursor(0,1);
# ifdef DELTA
lcd.print('X');
lcd.print(ftostr30(current_position[X_AXIS]));
lcd_printPGM(PSTR(" Y"));
lcd.print(ftostr30(current_position[Y_AXIS]));
# else
lcd.print('X');
lcd.print(ftostr3(current_position[X_AXIS]));
lcd_printPGM(PSTR(" Y"));
lcd.print(ftostr3(current_position[Y_AXIS]));
# endif // DELTA
# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
# endif//LCD_WIDTH > 19
lcd.setCursor(LCD_WIDTH - 8, 1);
lcd.print('Z');
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
#endif//LCD_HEIGHT > 2
#if LCD_HEIGHT > 3
>>>>>>> origin/master
=======
#endif//HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif//LCD_WIDTH > 19
......@@ -702,7 +562,6 @@ static void lcd_implementation_status_screen()
#endif //LCD_HEIGHT > 2
#if LCD_HEIGHT > 3
>>>>>>> origin/master
lcd.setCursor(0, 2);
lcd.print(LCD_STR_FEEDRATE[0]);
lcd.print(itostr3(feedmultiply));
......@@ -760,20 +619,9 @@ static void lcd_implementation_status_screen()
#endif //LCD_PROGRESS_BAR
//Display both Status message line and Filament display on the last line
<<<<<<< HEAD
#ifdef FILAMENT_LCD_DISPLAY
if (message_millis + 5000 <= millis()) { //display any status for the first 5 sec after screen is initiated
lcd_printPGM(PSTR("Dia "));
lcd.print(ftostr12ns(filament_width_meas));
lcd_printPGM(PSTR(" V"));
lcd.print(itostr3(100.0*volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
lcd.print('%');
return;
=======
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY)
if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line
lcd.print(lcd_status_message);
>>>>>>> origin/master
}
#if defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && (POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && (FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY)
......
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