Commit 9c53b44c authored by MagoKimbra's avatar MagoKimbra

Update 4.2.1 dev

parent 92818d98
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
//#define FIRMWARE_TEST // ONLY BAUDRATE 115200 //#define FIRMWARE_TEST // ONLY BAUDRATE 115200
// Some particular clients re-start sending commands only after receiving a 'wait' when there is a bed serial-connection. // Some particular clients re-start sending commands only after receiving a 'wait' when there is a bed serial-connection.
#define NO_TIMEOUTS 1000 // Milliseconds //#define NO_TIMEOUTS 1000 // Milliseconds
//#define ADVANCED_OK // Uncomment to include more info in ok command //#define ADVANCED_OK // Uncomment to include more info in ok command
/***********************************************************************/ /***********************************************************************/
......
...@@ -48,13 +48,13 @@ ...@@ -48,13 +48,13 @@
// and processor overload (too many expensive sqrt calls). // and processor overload (too many expensive sqrt calls).
// The new function do not use segments per second but segments per mm // The new function do not use segments per second but segments per mm
// if you want use new function comment this (using // at the start of the line) // if you want use new function comment this (using // at the start of the line)
#define DELTA_SEGMENTS_PER_SECOND 150 #define DELTA_SEGMENTS_PER_SECOND 200
// Center-to-center distance of the holes in the diagonal push rods. // Center-to-center distance of the holes in the diagonal push rods.
#define DEFAULT_DELTA_DIAGONAL_ROD 217.0 // mm #define DEFAULT_DELTA_DIAGONAL_ROD 220.0 // mm
// Horizontal offset from middle of printer to smooth rod center. // Horizontal offset from middle of printer to smooth rod center.
#define DELTA_SMOOTH_ROD_OFFSET 145.0 // mm #define DELTA_SMOOTH_ROD_OFFSET 150.0 // mm
// Horizontal offset of the universal joints on the end effector. // Horizontal offset of the universal joints on the end effector.
#define DELTA_EFFECTOR_OFFSET 20.0 // mm #define DELTA_EFFECTOR_OFFSET 20.0 // mm
......
...@@ -361,9 +361,9 @@ ...@@ -361,9 +361,9 @@
#define PREVENT_DANGEROUS_EXTRUDE #define PREVENT_DANGEROUS_EXTRUDE
#define EXTRUDE_MINTEMP 170 // degC #define EXTRUDE_MINTEMP 170 // degC
//if PREVENT DANGEROUS EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately. // if PREVENT DANGEROUS EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately.
#define PREVENT_LENGTHY_EXTRUDE //#define PREVENT_LENGTHY_EXTRUDE
#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances. #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH + Y_MAX_LENGTH) // prevent extrusion of very large distances.
/***********************************************************************/ /***********************************************************************/
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// #error "You must specify the following parameters related to your distribution" // #error "You must specify the following parameters related to your distribution"
#if true #if true
#define SHORT_BUILD_VERSION "4.2.0 dev" #define SHORT_BUILD_VERSION "4.2.1 dev"
#define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time #define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time
// It might also be appropriate to define a location where additional information can be found // It might also be appropriate to define a location where additional information can be found
#define SOURCE_CODE_URL "https://github.com/MagoKimbra/MarlinKimbra" #define SOURCE_CODE_URL "https://github.com/MagoKimbra/MarlinKimbra"
......
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
* M300 - Play beep sound S<frequency Hz> P<duration ms> * M300 - Play beep sound S<frequency Hz> P<duration ms>
* M301 - Set PID parameters P I D and C * M301 - Set PID parameters P I D and C
* M302 - Allow cold extrudes, or set the minimum extrude S<temperature>. * M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
* M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C) * M303 - PID relay autotune S<temperature> sets the target temperature (default target temperature = 150C). H<hotend> C<cycles>
* M304 - Set bed PID parameters P I and D * M304 - Set bed PID parameters P I and D
* M350 - Set microstepping mode. * M350 - Set microstepping mode.
* M351 - Toggle MS1 MS2 pins directly. * M351 - Toggle MS1 MS2 pins directly.
...@@ -216,6 +216,7 @@ ...@@ -216,6 +216,7 @@
* M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. * M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
* M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings. * M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings.
* M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) * M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
* M595 - Set hotend AD595 offset and gain
* M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] * M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
* M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ] * M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
* M666 - Set z probe offset or Endstop and delta geometry adjustment * M666 - Set z probe offset or Endstop and delta geometry adjustment
...@@ -323,6 +324,11 @@ unsigned long printer_usage_seconds; ...@@ -323,6 +324,11 @@ unsigned long printer_usage_seconds;
float hotend_offset[3][HOTENDS]; float hotend_offset[3][HOTENDS];
#endif #endif
#if HEATER_USES_AD595
float ad595_offset[HOTENDS] = ARRAY_BY_HOTENDS1(TEMP_SENSOR_AD595_OFFSET);
float ad595_gain[HOTENDS] = ARRAY_BY_HOTENDS1(TEMP_SENSOR_AD595_GAIN);
#endif
#if ENABLED(NPR2) #if ENABLED(NPR2)
int old_color = 99; int old_color = 99;
#endif #endif
...@@ -375,7 +381,6 @@ unsigned long printer_usage_seconds; ...@@ -375,7 +381,6 @@ unsigned long printer_usage_seconds;
float DELTA_DIAGONAL_ROD1_2; float DELTA_DIAGONAL_ROD1_2;
float DELTA_DIAGONAL_ROD2_2; float DELTA_DIAGONAL_ROD2_2;
float DELTA_DIAGONAL_ROD3_2; float DELTA_DIAGONAL_ROD3_2;
float delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
float ac_prec = AUTOCALIBRATION_PRECISION; float ac_prec = AUTOCALIBRATION_PRECISION;
float delta_tower1_x, delta_tower1_y, float delta_tower1_x, delta_tower1_y,
delta_tower2_x, delta_tower2_y, delta_tower2_x, delta_tower2_y,
...@@ -415,7 +420,7 @@ unsigned long printer_usage_seconds; ...@@ -415,7 +420,7 @@ unsigned long printer_usage_seconds;
#endif #endif
#if MECH(SCARA) #if MECH(SCARA)
float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND; #define DELTA_SEGMENTS_PER_SECOND SCARA_SEGMENTS_PER_SECOND
static float delta[3] = { 0 }; static float delta[3] = { 0 };
float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1 float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1
#endif #endif
...@@ -2512,9 +2517,8 @@ static void clean_up_after_endstop_move() { ...@@ -2512,9 +2517,8 @@ static void clean_up_after_endstop_move() {
float probe_bed(float x, float y) { float probe_bed(float x, float y) {
//Probe bed at specified location and return z height of bed //Probe bed at specified location and return z height of bed
float probe_z, probe_bed_array[20]; uint8_t probe_count = 5;
int probe_count; float probe_z, probe_bed_array[probe_count], probe_bed_mean = 0;
boolean probe_done;
destination[X_AXIS] = x - z_probe_offset[X_AXIS]; destination[X_AXIS] = x - z_probe_offset[X_AXIS];
if (destination[X_AXIS] < X_MIN_POS) destination[X_AXIS] = X_MIN_POS; if (destination[X_AXIS] < X_MIN_POS) destination[X_AXIS] = X_MIN_POS;
...@@ -2523,18 +2527,21 @@ static void clean_up_after_endstop_move() { ...@@ -2523,18 +2527,21 @@ static void clean_up_after_endstop_move() {
if (destination[Y_AXIS] < Y_MIN_POS) destination[Y_AXIS] = Y_MIN_POS; if (destination[Y_AXIS] < Y_MIN_POS) destination[Y_AXIS] = Y_MIN_POS;
if (destination[Y_AXIS] > Y_MAX_POS) destination[Y_AXIS] = Y_MAX_POS; if (destination[Y_AXIS] > Y_MAX_POS) destination[Y_AXIS] = Y_MAX_POS;
probe_count = 0; for(int i = 0; i < probe_count; i++) {
do { probe_bed_array[i] = z_probe() + z_probe_offset[Z_AXIS];
probe_z = z_probe() + z_probe_offset[Z_AXIS]; probe_bed_mean += probe_bed_array[i];
probe_bed_array[probe_count] = probe_z; }
probe_done = false;
if (probe_count > 0) { probe_z = probe_bed_mean / probe_count;
for(int xx = 0; xx < probe_count; xx++) {
if (probe_bed_array[xx] == probe_z) probe_done = true; if (debugLevel & DEBUG_INFO) {
} ECHO_SM(DB, "Bed probe heights: ");
for(int i = 0; i < probe_count; i++) {
if (probe_bed_array[i] >= 0) ECHO_M(" ");
ECHO_VM(probe_bed_array[i], " ", 4);
} }
probe_count ++; ECHO_EMV("mean ", probe_z, 4);
} while ((probe_done == false) and (probe_count < 20)); }
bed_safe_z = probe_z + 5; bed_safe_z = probe_z + 5;
return probe_z; return probe_z;
...@@ -2575,13 +2582,17 @@ static void clean_up_after_endstop_move() { ...@@ -2575,13 +2582,17 @@ static void clean_up_after_endstop_move() {
ECHO_SM(DB, "| \t"); ECHO_SM(DB, "| \t");
if (bed_level_z >= 0) ECHO_M(" "); if (bed_level_z >= 0) ECHO_M(" ");
ECHO_MV("", bed_level_z, 4); ECHO_MV("", bed_level_z, 4);
ECHO_MV("\t\t\tX:", endstop_adj[0]); ECHO_MV("\t\t\tX:", endstop_adj[0], 4);
ECHO_MV(" Y:", endstop_adj[1]); ECHO_MV(" Y:", endstop_adj[1], 4);
ECHO_EMV(" Z:", endstop_adj[2]); ECHO_EMV(" Z:", endstop_adj[2], 4);
ECHO_SMV(DB, "| ", bed_level_oy, 4); ECHO_SM(DB, "| ");
ECHO_M("\t\t"); if (bed_level_ox >= 0) ECHO_M(" ");
ECHO_EVM(bed_level_ox, "\t\tTower Offsets", 4); ECHO_MV("", bed_level_ox, 4);
ECHO_M("\t");
if (bed_level_oy >= 0) ECHO_M(" ");
ECHO_MV("", bed_level_oy, 4);
ECHO_EM("\t\tTower Offsets");
ECHO_SM(DB, "| \t"); ECHO_SM(DB, "| \t");
if (bed_level_c >= 0) ECHO_M(" "); if (bed_level_c >= 0) ECHO_M(" ");
...@@ -2590,18 +2601,22 @@ static void clean_up_after_endstop_move() { ...@@ -2590,18 +2601,22 @@ static void clean_up_after_endstop_move() {
ECHO_MV(" B:",tower_adj[1]); ECHO_MV(" B:",tower_adj[1]);
ECHO_EMV(" C:",tower_adj[2]); ECHO_EMV(" C:",tower_adj[2]);
ECHO_SMV(DB, "| ", bed_level_x, 4); ECHO_SM(DB, "| ");
ECHO_MV("\t\t", bed_level_y, 4); if (bed_level_x >= 0) ECHO_M(" ");
ECHO_MV("", bed_level_x, 4);
ECHO_M("\t");
if (bed_level_y >= 0) ECHO_M(" ");
ECHO_MV("", bed_level_y, 4);
ECHO_MV("\t\tI:",tower_adj[3]); ECHO_MV("\t\tI:",tower_adj[3]);
ECHO_MV(" J:",tower_adj[4]); ECHO_MV(" J:",tower_adj[4]);
ECHO_EMV(" K:",tower_adj[5]); ECHO_EMV(" K:",tower_adj[5]);
ECHO_SM(DB, "| \t"); ECHO_SM(DB, "| \t");
if (bed_level_oz >= 0) {ECHO_M(" ");} if (bed_level_oz >= 0) ECHO_M(" ");
ECHO_MV("", bed_level_oz, 4); ECHO_MV("", bed_level_oz, 4);
ECHO_EMV("\t\t\tDelta Radius: ", delta_radius, 4); ECHO_EMV("\t\t\tDelta Radius: ", delta_radius, 4);
ECHO_LMV(DB, "| X-Tower\t\tY-Tower\t\tDiagonal Rod: ", delta_diagonal_rod, 4); ECHO_LMV(DB, "| X-Tower\tY-Tower\t\tDiagonal Rod: ", delta_diagonal_rod, 4);
ECHO_E; ECHO_E;
} }
...@@ -2655,7 +2670,7 @@ static void clean_up_after_endstop_move() { ...@@ -2655,7 +2670,7 @@ static void clean_up_after_endstop_move() {
} }
void prepare_move_raw() { void prepare_move_raw() {
if (debugLevel & DEBUG_INFO) { if (debugLevel & DEBUG_DEBUG) {
ECHO_S(DB); ECHO_S(DB);
print_xyz("prepare_move_raw > destination", destination); print_xyz("prepare_move_raw > destination", destination);
} }
...@@ -2838,8 +2853,63 @@ static void clean_up_after_endstop_move() { ...@@ -2838,8 +2853,63 @@ static void clean_up_after_endstop_move() {
} }
#endif //Z_PROBE_SLED #endif //Z_PROBE_SLED
inline void wait_heater() { #if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
void print_heaterstates() {
#if HAS(TEMP_0) || ENABLED(HEATER_0_USES_MAX6675)
ECHO_MV(MSG_T, degHotend(target_extruder), 1);
ECHO_MV(" /", degTargetHotend(target_extruder), 1);
#endif
#if HAS(TEMP_BED)
ECHO_MV(" " MSG_B, degBed(), 1);
ECHO_MV(" /", degTargetBed(), 1);
#endif
#if HOTENDS > 1
for (int8_t h = 0; h < HOTENDS; ++h) {
ECHO_MV(" T", h);
ECHO_MV(":", degHotend(h), 1);
ECHO_MV(" /", degTargetHotend(h), 1);
}
#endif
#if HAS(TEMP_BED)
ECHO_M(" " MSG_BAT);
#if ENABLED(BED_WATTS)
ECHO_VM((BED_WATTS * getHeaterPower(-1)) / 127, "W");
#else
ECHO_V(getHeaterPower(-1));
#endif
#endif
ECHO_M(" " MSG_AT ":");
#if ENABLED(HOTEND_WATTS)
ECHO_VM((HOTEND_WATTS * getHeaterPower(target_extruder)) / 127, "W");
#else
ECHO_V(getHeaterPower(target_extruder));
#endif
#if HOTENDS > 1
for (int8_t h = 0; h < HOTENDS; ++h) {
ECHO_MV(" " MSG_AT, h);
ECHO_C(':');
#if ENABLED(EXTRUDER_WATTS)
ECHO_VM((EXTRUDER_WATTS * getHeaterPower(h)) / 127. "W");
#else
ECHO_V(getHeaterPower(h));
#endif
}
#endif
#if ENABLED(SHOW_TEMP_ADC_VALUES)
#if HAS(TEMP_BED)
ECHO_MV(" ADC B:", degBed(), 1);
ECHO_MV("C->", rawBedTemp() / OVERSAMPLENR, 0);
#endif
for (int8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend) {
ECHO_MV(" T", cur_hotend);
ECHO_MV(":", degHotend(cur_hotend), 1);
ECHO_MV("C->", rawHotendTemp(cur_hotend) / OVERSAMPLENR, 0);
}
#endif
}
#endif
inline void wait_heater() {
millis_t temp_ms = millis(); millis_t temp_ms = millis();
/* See if we are heating up or cooling down */ /* See if we are heating up or cooling down */
...@@ -2859,8 +2929,9 @@ inline void wait_heater() { ...@@ -2859,8 +2929,9 @@ inline void wait_heater() {
{ // while loop { // while loop
if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting
ECHO_MV(MSG_T, degHotend(target_extruder), 1); #if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
ECHO_MV(" E:", (int)target_extruder); print_heaterstates();
#endif
#if ENABLED(TEMP_RESIDENCY_TIME) #if ENABLED(TEMP_RESIDENCY_TIME)
ECHO_M(" " MSG_W); ECHO_M(" " MSG_W);
if (residency_start_ms > -1) { if (residency_start_ms > -1) {
...@@ -2906,9 +2977,10 @@ inline void wait_bed() { ...@@ -2906,9 +2977,10 @@ inline void wait_bed() {
if (ms > temp_ms + 1000UL) { //Print Temp Reading every 1 second while heating up. if (ms > temp_ms + 1000UL) { //Print Temp Reading every 1 second while heating up.
temp_ms = ms; temp_ms = ms;
float tt = degHotend(active_extruder); float tt = degHotend(active_extruder);
ECHO_MV(MSG_T, tt); #if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
ECHO_MV(" E:", active_extruder); print_heaterstates();
ECHO_EMV(" " MSG_B, degBed(), 1); ECHO_E;
#endif
} }
idle(); idle();
} }
...@@ -2943,6 +3015,13 @@ void gcode_get_destination() { ...@@ -2943,6 +3015,13 @@ void gcode_get_destination() {
float next_feedrate = code_value(); float next_feedrate = code_value();
if (next_feedrate > 0.0) feedrate = next_feedrate; if (next_feedrate > 0.0) feedrate = next_feedrate;
} }
#if ENABLED(NEXTION_GFX)
if((code_seen(axis_codes[X_AXIS]) || code_seen(axis_codes[Y_AXIS])) && code_seen(axis_codes[E_AXIS]))
gfx_line_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]);
else
gfx_cursor_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]);
#endif
} }
void unknown_command_error() { void unknown_command_error() {
...@@ -3505,6 +3584,11 @@ inline void gcode_G28() { ...@@ -3505,6 +3584,11 @@ inline void gcode_G28() {
#endif #endif
} }
#if ENABLED(NEXTION_GFX)
gfx_clear(X_MAX_POS, Y_MAX_POS, Z_MAX_POS);
gfx_cursor_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
#endif
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "<<< gcode_G28"); if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "<<< gcode_G28");
} }
...@@ -3989,11 +4073,11 @@ inline void gcode_G28() { ...@@ -3989,11 +4073,11 @@ inline void gcode_G28() {
deploy_z_probe(); deploy_z_probe();
probe_value = probe_bed(x, y); probe_value = probe_bed(x, y);
if (debugLevel & DEBUG_INFO) { ECHO_SMV(DB, "Bed Z-Height at X:", x);
ECHO_SMV(DB, "Bed Z-Height at X:", x); ECHO_MV(" Y:", y);
ECHO_MV(" Y:", y); ECHO_EMV(" = ", probe_value, 4);
ECHO_EMV(" = ", probe_value, 4);
if (debugLevel & DEBUG_INFO) {
ECHO_SMV(DB, "Carriage Positions: [", saved_position[X_AXIS]); ECHO_SMV(DB, "Carriage Positions: [", saved_position[X_AXIS]);
ECHO_MV(", ", saved_position[Y_AXIS]); ECHO_MV(", ", saved_position[Y_AXIS]);
ECHO_MV(", ", saved_position[Z_AXIS]); ECHO_MV(", ", saved_position[Z_AXIS]);
...@@ -4036,9 +4120,9 @@ inline void gcode_G28() { ...@@ -4036,9 +4120,9 @@ inline void gcode_G28() {
bed_probe_all(); bed_probe_all();
calibration_report(); calibration_report();
} while ((bed_level_x < -ac_prec) or (bed_level_x > ac_prec) } while ((bed_level_x <= -ac_prec) or (bed_level_x >= ac_prec)
or (bed_level_y < -ac_prec) or (bed_level_y > ac_prec) or (bed_level_y <= -ac_prec) or (bed_level_y >= ac_prec)
or (bed_level_z < -ac_prec) or (bed_level_z > ac_prec)); or (bed_level_z <= -ac_prec) or (bed_level_z >= ac_prec));
ECHO_LM(DB, "Endstop adjustment complete"); ECHO_LM(DB, "Endstop adjustment complete");
} }
...@@ -4058,10 +4142,10 @@ inline void gcode_G28() { ...@@ -4058,10 +4142,10 @@ inline void gcode_G28() {
ECHO_LM(DB, "Checking delta radius"); ECHO_LM(DB, "Checking delta radius");
adj_deltaradius(); adj_deltaradius();
} while ((bed_level_c < -ac_prec) or (bed_level_c > ac_prec) } while ((bed_level_c <= -ac_prec) or (bed_level_c >= ac_prec)
or (bed_level_x < -ac_prec) or (bed_level_x > ac_prec) or (bed_level_x <= -ac_prec) or (bed_level_x >= ac_prec)
or (bed_level_y < -ac_prec) or (bed_level_y > ac_prec) or (bed_level_y <= -ac_prec) or (bed_level_y >= ac_prec)
or (bed_level_z < -ac_prec) or (bed_level_z > ac_prec)); or (bed_level_z <= -ac_prec) or (bed_level_z >= ac_prec));
} }
if (code_seen('I')) { if (code_seen('I')) {
...@@ -4097,26 +4181,28 @@ inline void gcode_G28() { ...@@ -4097,26 +4181,28 @@ inline void gcode_G28() {
bed_probe_all(); bed_probe_all();
calibration_report(); calibration_report();
if ((bed_level_c < -ac_prec) or (bed_level_c > ac_prec)) { if ((bed_level_c <= -ac_prec) or (bed_level_c >= ac_prec)) {
ECHO_LM(DB, "Checking delta radius"); ECHO_LM(DB, "Checking delta radius");
dr_adjusted = adj_deltaradius(); dr_adjusted = adj_deltaradius();
} }
else dr_adjusted = 0; else
/* dr_adjusted = 0;
ECHO_EMV("bed_level_c=", bed_level_c, 4);
ECHO_EMV("bed_level_x=", bed_level_x, 4); if (debugLevel & DEBUG_DEBUG) {
ECHO_EMV("bed_level_y=", bed_level_y, 4); ECHO_LMV(DB, "bed_level_c=", bed_level_c, 4);
ECHO_EMV("bed_level_z=", bed_level_z, 4); ECHO_LMV(DB, "bed_level_x=", bed_level_x, 4);
*/ ECHO_LMV(DB, "bed_level_y=", bed_level_y, 4);
} while ((bed_level_c < -ac_prec) or (bed_level_c > ac_prec) ECHO_LMV(DB, "bed_level_z=", bed_level_z, 4);
or (bed_level_x < -ac_prec) or (bed_level_x > ac_prec) }
or (bed_level_y < -ac_prec) or (bed_level_y > ac_prec) } while ((bed_level_c <= -ac_prec) or (bed_level_c >= ac_prec)
or (bed_level_z < -ac_prec) or (bed_level_z > ac_prec) or (bed_level_x <= -ac_prec) or (bed_level_x >= ac_prec)
or (bed_level_y <= -ac_prec) or (bed_level_y >= ac_prec)
or (bed_level_z <= -ac_prec) or (bed_level_z >= ac_prec)
or (dr_adjusted != 0)); or (dr_adjusted != 0));
if ((bed_level_ox < -ac_prec) or (bed_level_ox > ac_prec) or if ((bed_level_ox <= -ac_prec) or (bed_level_ox >= ac_prec) or
(bed_level_oy < -ac_prec) or (bed_level_oy > ac_prec) or (bed_level_oy <= -ac_prec) or (bed_level_oy >= ac_prec) or
(bed_level_oz < -ac_prec) or (bed_level_oz > ac_prec)) { (bed_level_oz <= -ac_prec) or (bed_level_oz >= ac_prec)) {
ECHO_LM(DB, "Checking for tower geometry errors.."); ECHO_LM(DB, "Checking for tower geometry errors..");
if (fix_tower_errors() != 0 ) { if (fix_tower_errors() != 0 ) {
// Tower positions have been changed .. home to endstops // Tower positions have been changed .. home to endstops
...@@ -4133,25 +4219,27 @@ inline void gcode_G28() { ...@@ -4133,25 +4219,27 @@ inline void gcode_G28() {
bed_safe_z = Z_RAISE_BETWEEN_PROBINGS - z_probe_offset[Z_AXIS]; bed_safe_z = Z_RAISE_BETWEEN_PROBINGS - z_probe_offset[Z_AXIS];
} }
} }
bed_safe_z = Z_RAISE_BETWEEN_PROBINGS - z_probe_offset[Z_AXIS];
bed_probe_all(); bed_probe_all();
calibration_report(); calibration_report();
} }
/*
ECHO_EMV("bed_level_c=", bed_level_c, 4); if (debugLevel & DEBUG_DEBUG) {
ECHO_EMV("bed_level_x=", bed_level_x, 4); ECHO_LMV(DB, "bed_level_c=", bed_level_c, 4);
ECHO_EMV("bed_level_y=", bed_level_y, 4); ECHO_LMV(DB, "bed_level_x=", bed_level_x, 4);
ECHO_EMV("bed_level_z=", bed_level_z, 4); ECHO_LMV(DB, "bed_level_y=", bed_level_y, 4);
ECHO_EMV("bed_level_ox=", bed_level_ox, 4); ECHO_LMV(DB, "bed_level_z=", bed_level_z, 4);
ECHO_EMV("bed_level_oy=", bed_level_oy, 4); ECHO_LMV(DB, "bed_level_ox=", bed_level_ox, 4);
ECHO_EMV("bed_level_oz=", bed_level_oz, 4); ECHO_LMV(DB, "bed_level_oy=", bed_level_oy, 4);
*/ ECHO_LMV(DB, "bed_level_oz=", bed_level_oz, 4);
} while((bed_level_c < -ac_prec) or (bed_level_c > ac_prec) }
or (bed_level_x < -ac_prec) or (bed_level_x > ac_prec) } while((bed_level_c <= -ac_prec) or (bed_level_c >= ac_prec)
or (bed_level_y < -ac_prec) or (bed_level_y > ac_prec) or (bed_level_x <= -ac_prec) or (bed_level_x >= ac_prec)
or (bed_level_z < -ac_prec) or (bed_level_z > ac_prec) or (bed_level_y <= -ac_prec) or (bed_level_y >= ac_prec)
or (bed_level_ox < -ac_prec) or (bed_level_ox > ac_prec) or (bed_level_z <= -ac_prec) or (bed_level_z >= ac_prec)
or (bed_level_oy < -ac_prec) or (bed_level_oy > ac_prec) or (bed_level_ox <= -ac_prec) or (bed_level_ox >= ac_prec)
or (bed_level_oz < -ac_prec) or (bed_level_oz > ac_prec)); or (bed_level_oy <= -ac_prec) or (bed_level_oy >= ac_prec)
or (bed_level_oz <= -ac_prec) or (bed_level_oz >= ac_prec));
ECHO_LM(DB, "Autocalibration Complete"); ECHO_LM(DB, "Autocalibration Complete");
} }
...@@ -4162,7 +4250,6 @@ inline void gcode_G28() { ...@@ -4162,7 +4250,6 @@ inline void gcode_G28() {
lcd_reset_alert_level(); lcd_reset_alert_level();
clean_up_after_endstop_move(); clean_up_after_endstop_move();
} }
#endif // DELTA && Z_PROBE_ENDSTOP #endif // DELTA && Z_PROBE_ENDSTOP
...@@ -5122,48 +5209,11 @@ inline void gcode_M105() { ...@@ -5122,48 +5209,11 @@ inline void gcode_M105() {
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675) #if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
ECHO_S(OK); ECHO_S(OK);
#if HAS(TEMP_0) print_heaterstates();
ECHO_MV(MSG_T, degHotend(target_extruder), 1);
ECHO_MV(" /", degTargetHotend(target_extruder), 1);
#endif
#if HAS(TEMP_BED)
ECHO_MV(" " MSG_B, degBed(), 1);
ECHO_MV(" /", degTargetBed(), 1);
#endif
for (int8_t e = 0; e < EXTRUDERS; ++e) {
ECHO_MV(" T", e);
ECHO_MV(":", degHotend(e), 1);
ECHO_MV(" /", degTargetHotend(e), 1);
}
#else // HASNT(TEMP_0) && HASNT(TEMP_BED) #else // HASNT(TEMP_0) && HASNT(TEMP_BED)
ECHO_LM(ER, MSG_ERR_NO_THERMISTORS); ECHO_LM(ER, MSG_ERR_NO_THERMISTORS);
#endif #endif
ECHO_M(" " MSG_AT);
#if ENABLED(HOTEND_WATTS)
ECHO_VM((HOTEND_WATTS * getHeaterPower(target_extruder))/127, "W");
#else
ECHO_V(getHeaterPower(target_extruder));
#endif
ECHO_M(" " MSG_BAT);
#if ENABLED(BED_WATTS)
ECHO_VM((BED_WATTS * getHeaterPower(-1))/127, "W");
#else
ECHO_V(getHeaterPower(-1));
#endif
#if ENABLED(SHOW_TEMP_ADC_VALUES)
#if HAS(TEMP_BED)
ECHO_MV(" ADC B:", degBed(), 1);
ECHO_MV("C->", rawBedTemp()/OVERSAMPLENR, 0);
#endif
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
ECHO_MV(" T", cur_extruder);
ECHO_MV(":", degHotend(cur_extruder),1);
ECHO_MV("C->", rawHotendTemp(cur_extruder)/OVERSAMPLENR,0);
}
#endif
ECHO_E; ECHO_E;
} }
...@@ -5226,11 +5276,7 @@ inline void gcode_M111() { ...@@ -5226,11 +5276,7 @@ inline void gcode_M111() {
ECHO_LM(DB, MSG_DEBUG_DRYRUN); ECHO_LM(DB, MSG_DEBUG_DRYRUN);
disable_all_heaters(); disable_all_heaters();
} }
#if ENABLED(DEBUG_LEVELING_FEATURE) if (debugLevel & DEBUG_DEBUG) ECHO_LM(DB, MSG_DEBUG);
if (debugLevel & DEBUG_LEVELING) {
ECHO_LM(DB, MSG_DEBUG_LEVELING);
}
#endif
} }
/** /**
...@@ -5979,14 +6025,16 @@ inline void gcode_M226() { ...@@ -5979,14 +6025,16 @@ inline void gcode_M226() {
/** /**
* M303: PID relay autotune * M303: PID relay autotune
* S<temperature> sets the target temperature. (default target temperature = 150C) * S<temperature> sets the target temperature. (default target temperature = 150C)
* E<extruder> (-1 for the bed) * H<hotend> (-1 for the bed)
* C<cycles> * C<cycles>
*/ */
inline void gcode_M303() { inline void gcode_M303() {
int e = code_seen('E') ? code_value_short() : 0; int h = code_seen('H') ? code_value_short() : 0;
int c = code_seen('C') ? code_value_short() : 5; int c = code_seen('C') ? code_value_short() : 5;
float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0); float temp = code_seen('S') ? code_value() : (h < 0 ? 70.0 : 150.0);
PID_autotune(temp, e, c);
if (h >= 0 && h < HOTENDS) target_extruder = h;
PID_autotune(temp, h, c);
} }
#endif #endif
...@@ -6334,6 +6382,31 @@ inline void gcode_M503() { ...@@ -6334,6 +6382,31 @@ inline void gcode_M503() {
#endif // ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED #endif // ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
#if HEATER_USES_AD595
/**
* M595 - set Hotennd AD595 offset & Gain T<hotend_number> O<offset> G<gain>
*/
inline void gcode_M595() {
if (setTargetedHotend(595)) return;
if (code_seen('O')) ad595_offset[target_extruder] = code_value();
if (code_seen('G')) ad595_gain[target_extruder] = code_value();
for (int h = 0; h < HOTENDS; h++) {
// if gain == 0 you get MINTEMP!
if (ad595_gain[h] == 0) ad595_gain[h]= 1;
}
ECHO_SM(DB, MSG_HOTEND_AD595);
ECHO_E;
for (int h = 0; h < HOTENDS; h++) {
ECHO_SMV(DB, "T", h);
ECHO_MV(" Offset: ", ad595_offset[h]);
ECHO_EMV(", Gain: ", ad595_gain[h]);
}
}
#endif
#if ENABLED(FILAMENTCHANGEENABLE) #if ENABLED(FILAMENTCHANGEENABLE)
/** /**
* M600: Pause for filament change * M600: Pause for filament change
...@@ -7412,6 +7485,11 @@ void process_next_command() { ...@@ -7412,6 +7485,11 @@ void process_next_command() {
gcode_M540(); break; gcode_M540(); break;
#endif #endif
#if HEATER_USES_AD595
case 595: // M595 set Hotends AD595 offset & gain
gcode_M595(); break;
#endif
#if ENABLED(FILAMENTCHANGEENABLE) #if ENABLED(FILAMENTCHANGEENABLE)
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
gcode_M600(); break; gcode_M600(); break;
...@@ -7537,30 +7615,37 @@ void clamp_to_software_endstops(float target[3]) { ...@@ -7537,30 +7615,37 @@ void clamp_to_software_endstops(float target[3]) {
if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]); if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]);
if (cartesian_mm < 0.000001) return false; if (cartesian_mm < 0.000001) return false;
#if ENABLED(DELTA_SEGMENTS_PER_SECOND) || ENABLED(SCARA_SEGMENTS_PER_SECOND) #if ENABLED(DELTA_SEGMENTS_PER_SECOND)
float seconds = 6000 * cartesian_mm / feedrate / feedrate_multiplier; float seconds = 6000 * cartesian_mm / feedrate / feedrate_multiplier;
int steps = max(1, int(delta_segments_per_second * seconds)); int steps = max(1, int(DELTA_SEGMENTS_PER_SECOND * seconds));
if (debugLevel & DEBUG_DEBUG) {
ECHO_SMV(DB, "mm=", cartesian_mm);
ECHO_MV(" seconds=", seconds);
ECHO_EMV(" steps=", steps);
}
#else #else
float fTemp = cartesian_mm * 5; float fTemp = cartesian_mm * 5;
int steps = (int)fTemp; int steps = (int)fTemp;
if (steps == 0) { if (steps == 0) {
steps = 1; steps = 1;
for (int8_t i=0; i < NUM_AXIS; i++) fractions[i] = difference[i]; for (int8_t i = 0; i < NUM_AXIS; i++) fractions[i] = difference[i];
} }
else { else {
fTemp = 1 / float(steps); fTemp = 1 / float(steps);
for (int8_t i=0; i < NUM_AXIS; i++) fractions[i] = difference[i] * fTemp; for (int8_t i = 0; i < NUM_AXIS; i++) fractions[i] = difference[i] * fTemp;
} }
// For number of steps, for each step add one fraction // For number of steps, for each step add one fraction
// First, set initial target to current position // First, set initial target to current position
for (int8_t i=0; i < NUM_AXIS; i++) addDistance[i] = 0.0; for (int8_t i = 0; i < NUM_AXIS; i++) addDistance[i] = 0.0;
#endif #endif
for (int s = 1; s <= steps; s++) { for (int s = 1; s <= steps; s++) {
#if ENABLED(DELTA_SEGMENTS_PER_SECOND) || ENABLED(SCARA_SEGMENTS_PER_SECOND) #if ENABLED(DELTA_SEGMENTS_PER_SECOND)
float fraction = float(s) / float(steps); float fraction = float(s) / float(steps);
for (int8_t i = 0; i < NUM_AXIS; i++) for (int8_t i = 0; i < NUM_AXIS; i++)
target[i] = current_position[i] + difference[i] * fraction; target[i] = current_position[i] + difference[i] * fraction;
...@@ -7572,9 +7657,17 @@ void clamp_to_software_endstops(float target[3]) { ...@@ -7572,9 +7657,17 @@ void clamp_to_software_endstops(float target[3]) {
#endif #endif
calculate_delta(target); calculate_delta(target);
adjust_delta(target); adjust_delta(target);
if (debugLevel & DEBUG_DEBUG) {
ECHO_LMV(DB, "target[X_AXIS]=", target[X_AXIS]);
ECHO_LMV(DB, "target[Y_AXIS]=", target[Y_AXIS]);
ECHO_LMV(DB, "target[Z_AXIS]=", target[Z_AXIS]);
ECHO_LMV(DB, "delta[X_AXIS]=", delta[X_AXIS]);
ECHO_LMV(DB, "delta[Y_AXIS]=", delta[Y_AXIS]);
ECHO_LMV(DB, "delta[Z_AXIS]=", delta[Z_AXIS]);
}
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], frfm, active_extruder, active_driver); plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], frfm, active_extruder, active_driver);
} }
return true; return true;
...@@ -8261,8 +8354,7 @@ void kill(const char* lcd_msg) { ...@@ -8261,8 +8354,7 @@ void kill(const char* lcd_msg) {
#endif #endif
} }
} }
#endif // FAST_PWM_FAN
#endif //FAST_PWM_FAN
void Stop() { void Stop() {
disable_all_heaters(); disable_all_heaters();
......
...@@ -61,7 +61,8 @@ enum DebugFlags { ...@@ -61,7 +61,8 @@ enum DebugFlags {
DEBUG_INFO = BIT(1), DEBUG_INFO = BIT(1),
DEBUG_ERRORS = BIT(2), DEBUG_ERRORS = BIT(2),
DEBUG_DRYRUN = BIT(3), DEBUG_DRYRUN = BIT(3),
DEBUG_COMMUNICATION = BIT(4) DEBUG_COMMUNICATION = BIT(4),
DEBUG_DEBUG = BIT(5)
}; };
void clamp_to_software_endstops(float target[3]); void clamp_to_software_endstops(float target[3]);
...@@ -101,6 +102,11 @@ extern float home_offset[3]; ...@@ -101,6 +102,11 @@ extern float home_offset[3];
extern float hotend_offset[3][HOTENDS]; extern float hotend_offset[3][HOTENDS];
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HEATER_USES_AD595
extern float ad595_offset[HOTENDS];
extern float ad595_gain[HOTENDS];
#endif
#if ENABLED(NPR2) #if ENABLED(NPR2)
extern int old_color; // old color for system NPR2 extern int old_color; // old color for system NPR2
#endif #endif
...@@ -111,7 +117,6 @@ extern float home_offset[3]; ...@@ -111,7 +117,6 @@ extern float home_offset[3];
extern float tower_adj[6]; extern float tower_adj[6];
extern float delta_radius; extern float delta_radius;
extern float delta_diagonal_rod; extern float delta_diagonal_rod;
extern float delta_segments_per_second;
#elif ENABLED(Z_DUAL_ENDSTOPS) #elif ENABLED(Z_DUAL_ENDSTOPS)
extern float z_endstop_adj; extern float z_endstop_adj;
#endif #endif
...@@ -207,6 +212,10 @@ extern uint8_t active_driver; ...@@ -207,6 +212,10 @@ extern uint8_t active_driver;
extern void digipot_i2c_init(); extern void digipot_i2c_init();
#endif #endif
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
void print_heaterstates();
#endif
#if ENABLED(FIRMWARE_TEST) #if ENABLED(FIRMWARE_TEST)
void FirmwareTest(); void FirmwareTest();
#endif #endif
......
...@@ -146,23 +146,30 @@ ...@@ -146,23 +146,30 @@
#define NEWPANEL #define NEWPANEL
#endif #endif
#if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display
#if DISABLED(LCD_WIDTH)
#define LCD_WIDTH 22
#endif
#if DISABLED(LCD_HEIGHT)
#define LCD_HEIGHT 5
#endif
#endif
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
#define NEWPANEL //enable this if you have a click-encoder panel #define NEWPANEL //enable this if you have a click-encoder panel
#define ULTRA_LCD #define ULTRA_LCD
#if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display #if DISABLED(LCD_WIDTH)
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 20 #define LCD_WIDTH 20
#endif
#if DISABLED(LCD_HEIGHT)
#define LCD_HEIGHT 4 #define LCD_HEIGHT 4
#endif #endif
#else //no panel but just LCD #else //no panel but just LCD
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
#if ENABLED(DOGLCD) // Change number of lines to match the 128x64 graphics display #if DISABLED(LCD_WIDTH)
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 16 #define LCD_WIDTH 16
#endif
#if DISABLED(LCD_HEIGHT)
#define LCD_HEIGHT 2 #define LCD_HEIGHT 2
#endif #endif
#endif #endif
...@@ -502,33 +509,33 @@ ...@@ -502,33 +509,33 @@
#define BED_USES_THERMISTOR #define BED_USES_THERMISTOR
#endif #endif
#define HEATER_USES_AD595 (ENABLED(HEATER_0_USES_AD595) || ENABLED(HEATER_1_USES_AD595) || ENABLED(HEATER_2_USES_AD595) || ENABLED(HEATER_3_USES_AD595))
/** /**
* ARRAY_BY_EXTRUDERS based on EXTRUDERS * ARRAY_BY_EXTRUDERS based on EXTRUDERS
*/ */
#if EXTRUDERS > 9 #if EXTRUDERS > 9
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1, v1, v1, v1, v1, v1, v1, v1, v1 }
#elif EXTRUDERS > 8 #elif EXTRUDERS > 8
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2, v3, v4, v5, v6, v7, v8, v9 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1, v1, v1, v1, v1, v1, v1, v1 }
#elif EXTRUDERS > 7 #elif EXTRUDERS > 7
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2, v3, v4, v5, v6, v7, v8 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1, v1, v1, v1, v1, v1, v1 }
#elif EXTRUDERS > 6 #elif EXTRUDERS > 6
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2, v3, v4, v5, v6, v7 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1, v1, v1, v1, v1, v1 }
#elif EXTRUDERS > 5 #elif EXTRUDERS > 5
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2, v3, v4, v5, v6 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1, v1, v1, v1, v1 }
#elif EXTRUDERS > 4 #elif EXTRUDERS > 4
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2, v3, v4, v5 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1, v1, v1, v1 }
#elif EXTRUDERS > 3 #elif EXTRUDERS > 3
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2, v3, v4 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1, v1, v1 }
#elif EXTRUDERS > 2 #elif EXTRUDERS > 2
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2, v3 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1, v1 }
#elif EXTRUDERS > 1 #elif EXTRUDERS > 1
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2 } #define ARRAY_BY_EXTRUDERS(v1) { v1, v1 }
#else #else
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1 } #define ARRAY_BY_EXTRUDERS(v1) { v1 }
#endif #endif
#define ARRAY_BY_EXTRUDERS(v1) ARRAY_BY_EXTRUDER(v1, v1, v1, v1, v1, v1, v1, v1, v1, v1)
/** /**
* ARRAY_BY_HOTENDS based on HOTENDS * ARRAY_BY_HOTENDS based on HOTENDS
*/ */
......
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
* HOTENDS OFFSET: * HOTENDS OFFSET:
* M218 T XY hotend_offset (x4) (T0..3) * M218 T XY hotend_offset (x4) (T0..3)
* *
* HOTENDS AD595:
* M595 T O G Hotend AD595 Offset & Gain
*
* DELTA: * DELTA:
* M666 XYZ endstop_adj (x3) * M666 XYZ endstop_adj (x3)
* M666 R delta_radius * M666 R delta_radius
...@@ -171,6 +174,11 @@ void Config_StoreSettings() { ...@@ -171,6 +174,11 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, hotend_offset); EEPROM_WRITE_VAR(i, hotend_offset);
#endif #endif
#if HEATER_USES_AD595
EEPROM_WRITE_VAR(i, ad595_offset);
EEPROM_WRITE_VAR(i, ad595_gain);
#endif
#if MECH(DELTA) #if MECH(DELTA)
EEPROM_WRITE_VAR(i, endstop_adj); EEPROM_WRITE_VAR(i, endstop_adj);
EEPROM_WRITE_VAR(i, delta_radius); EEPROM_WRITE_VAR(i, delta_radius);
...@@ -314,6 +322,11 @@ void Config_RetrieveSettings() { ...@@ -314,6 +322,11 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, hotend_offset); EEPROM_READ_VAR(i, hotend_offset);
#endif #endif
#if HEATER_USES_AD595
EEPROM_READ_VAR(i, ad595_offset);
EEPROM_READ_VAR(i, ad595_gain);
#endif
#if MECH(DELTA) #if MECH(DELTA)
EEPROM_READ_VAR(i, endstop_adj); EEPROM_READ_VAR(i, endstop_adj);
EEPROM_READ_VAR(i, delta_radius); EEPROM_READ_VAR(i, delta_radius);
...@@ -591,11 +604,6 @@ void Config_ResetDefault() { ...@@ -591,11 +604,6 @@ void Config_ResetDefault() {
#endif #endif
volumetric_enabled = false; volumetric_enabled = false;
for (short i = 0; i < EXTRUDERS; i++) {
filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
}
calculate_volumetric_multipliers(); calculate_volumetric_multipliers();
#if ENABLED(IDLE_OOZING_PREVENT) #if ENABLED(IDLE_OOZING_PREVENT)
...@@ -710,8 +718,19 @@ void Config_ResetDefault() { ...@@ -710,8 +718,19 @@ void Config_ResetDefault() {
ECHO_MV(" Y", hotend_offset[Y_AXIS][h]); ECHO_MV(" Y", hotend_offset[Y_AXIS][h]);
ECHO_EMV(" Z", hotend_offset[Z_AXIS][h]); ECHO_EMV(" Z", hotend_offset[Z_AXIS][h]);
} }
#endif //HOTENDS > 1 #endif // HOTENDS > 1
#if HEATER_USES_AD595
if (!forReplay) {
ECHO_LM(DB, "Hotend AD595:");
}
for (int h = 0; h < EXTRUDERS; h++) {
ECHO_SMV(DB, " M595 T", h);
ECHO_MV(" Offset", ad595_offset[h]);
ECHO_EMV(", Gain: ", ad595_gain[h]);
}
#endif // HEATER_USES_AD595
#if MECH(DELTA) #if MECH(DELTA)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Delta Geometry adjustment:"); ECHO_LM(DB, "Delta Geometry adjustment:");
......
...@@ -181,13 +181,13 @@ ...@@ -181,13 +181,13 @@
#define MSG_KU " Ku: " #define MSG_KU " Ku: "
#define MSG_TU " Tu: " #define MSG_TU " Tu: "
#define MSG_CLASSIC_PID " Classic PID " #define MSG_CLASSIC_PID " Classic PID "
#define MSG_KP " Kp: " #define MSG_KP "Kp: "
#define MSG_KI " Ki: " #define MSG_KI " Ki: "
#define MSG_KD " Kd: " #define MSG_KD " Kd: "
#define MSG_KC " Kc: " #define MSG_KC " Kc: "
#define MSG_B "B:" #define MSG_B "B:"
#define MSG_T "T:" #define MSG_T "T:"
#define MSG_AT "@:" #define MSG_AT "@"
#define MSG_BAT "B@:" #define MSG_BAT "B@:"
#define MSG_W "W:" #define MSG_W "W:"
#define MSG_PID_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from above into Configuration.h or send command M500 for save in EEPROM the new value!" #define MSG_PID_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from above into Configuration.h or send command M500 for save in EEPROM the new value!"
......
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
#define MSG_HEATING_FAILED_LCD "Heating failed" #define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR" #define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY" #define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_HOTEND_AD595 "HOTEND AD595 Offset & Gain"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP" #define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP" #define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED" #define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
...@@ -166,6 +167,7 @@ ...@@ -166,6 +167,7 @@
#define MSG_DEBUG_INFO "DEBUG INFO ENABLED" #define MSG_DEBUG_INFO "DEBUG INFO ENABLED"
#define MSG_DEBUG_ERRORS "DEBUG ERRORS ENABLED" #define MSG_DEBUG_ERRORS "DEBUG ERRORS ENABLED"
#define MSG_DEBUG_DRYRUN "DEBUG DRYRUN ENABLED" #define MSG_DEBUG_DRYRUN "DEBUG DRYRUN ENABLED"
#define MSG_DEBUG "DEBUG ENABLED"
// Calibrate Delta // Calibrate Delta
#if MECH(DELTA) #if MECH(DELTA)
......
...@@ -157,10 +157,11 @@ ...@@ -157,10 +157,11 @@
#define MSG_END_MINUTE "minuti" #define MSG_END_MINUTE "minuti"
// Debug // Debug
#define MSG_DEBUG_ECHO "DEBUG RIPETI" #define MSG_DEBUG_ECHO "DEBUG RIPETI ABILITATO"
#define MSG_DEBUG_INFO "DEBUG INFO" #define MSG_DEBUG_INFO "DEBUG INFO ABILITATO"
#define MSG_DEBUG_ERRORS "DEBUG ERRORI" #define MSG_DEBUG_ERRORS "DEBUG ERRORI ABILITATO"
#define MSG_DEBUG_DRYRUN "DEBUG STAMPA A VUOTO" #define MSG_DEBUG_DRYRUN "DEBUG STAMPA A VUOTO ABILITATO"
#define MSG_DEBUG "DEBUG ABILITATO"
// Calibrate Delta // Calibrate Delta
#if MECH(DELTA) #if MECH(DELTA)
......
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
void lcd_setalertstatuspgm(const char* message); void lcd_setalertstatuspgm(const char* message);
void lcd_reset_alert_level(); void lcd_reset_alert_level();
#if ENABLED(NEXTION_GFX)
void gfx_clear(float x, float y, float z);
void gfx_cursor_to(float x, float y, float z);
void gfx_line_to(float x, float y, float z);
#endif
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
void sdlistPopCallback(void *ptr); void sdlistPopCallback(void *ptr);
void sdfilePopCallback(void *ptr); void sdfilePopCallback(void *ptr);
......
...@@ -3658,9 +3658,7 @@ ...@@ -3658,9 +3658,7 @@
#define BEEPER_PIN 33 // Beeper on AUX-4 #define BEEPER_PIN 33 // Beeper on AUX-4
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
//arduino pin which triggers an piezzo beeper //arduino pin which triggers an piezzo beeper
...@@ -3696,106 +3694,103 @@ ...@@ -3696,106 +3694,103 @@
****************************************************************************************/ ****************************************************************************************/
#if MB(MEGATRONICS_2) #if MB(MEGATRONICS_2)
#define KNOWN_BOARD 1 #define KNOWN_BOARD 1
#ifndef __AVR_ATmega2560__
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif
#ifndef __AVR_ATmega2560__ #define LARGE_FLASH true
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif
#define LARGE_FLASH true #define ORIG_X_STEP_PIN 26
#define ORIG_X_DIR_PIN 27
#define ORIG_X_ENABLE_PIN 25
#define ORIG_X_MIN_PIN 37
#define ORIG_X_MAX_PIN 40 //2 //Max endstops default to disabled "-1", set to commented value to enable.
#define ORIG_X_STEP_PIN 26 #define ORIG_Y_STEP_PIN 4 // A6
#define ORIG_X_DIR_PIN 27 #define ORIG_Y_DIR_PIN 54 // A0
#define ORIG_X_ENABLE_PIN 25 #define ORIG_Y_ENABLE_PIN 5
#define ORIG_X_MIN_PIN 37 #define ORIG_Y_MIN_PIN 41
#define ORIG_X_MAX_PIN 40 //2 //Max endstops default to disabled "-1", set to commented value to enable. #define ORIG_Y_MAX_PIN 38 //15
#define ORIG_Y_STEP_PIN 4 // A6
#define ORIG_Y_DIR_PIN 54 // A0
#define ORIG_Y_ENABLE_PIN 5
#define ORIG_Y_MIN_PIN 41
#define ORIG_Y_MAX_PIN 38 //15
#define ORIG_Z_STEP_PIN 56 // A2
#define ORIG_Z_DIR_PIN 60 // A6
#define ORIG_Z_ENABLE_PIN 55 // A1
#define ORIG_Z_MIN_PIN 18
#define ORIG_Z_MAX_PIN 19
#define ORIG_E0_STEP_PIN 35
#define ORIG_E0_DIR_PIN 36
#define ORIG_E0_ENABLE_PIN 34
#define ORIG_E1_STEP_PIN 29
#define ORIG_E1_DIR_PIN 39
#define ORIG_E1_ENABLE_PIN 28
#define ORIG_E2_STEP_PIN 23
#define ORIG_E2_DIR_PIN 24
#define ORIG_E2_ENABLE_PIN 22
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define ORIG_FAN_PIN 7
#define FAN2_PIN 6
#define ORIG_PS_ON_PIN 12
#define KILL_PIN -1
#define ORIG_HEATER_0_PIN 9 // EXTRUDER 1
#define ORIG_HEATER_1_PIN 8 // EXTRUDER 2
#define ORIG_HEATER_2_PIN -1
#define SHIFT_CLK 63
#define SHIFT_LD 42
#define SHIFT_OUT 17
#define SHIFT_EN 17
#if TEMP_SENSOR_0 == -1
#define ORIG_TEMP_0_PIN 4 // ANALOG NUMBERING
#else
#define ORIG_TEMP_0_PIN 13 // ANALOG NUMBERING
#endif
#define ORIG_Z_STEP_PIN 56 // A2
#define ORIG_Z_DIR_PIN 60 // A6
#define ORIG_Z_ENABLE_PIN 55 // A1
#define ORIG_Z_MIN_PIN 18
#define ORIG_Z_MAX_PIN 19
#if TEMP_SENSOR_1 == -1 #define ORIG_E0_STEP_PIN 35
#define ORIG_TEMP_1_PIN 8 // ANALOG NUMBERING #define ORIG_E0_DIR_PIN 36
#else #define ORIG_E0_ENABLE_PIN 34
#define ORIG_TEMP_1_PIN 15 // ANALOG NUMBERING
#endif
#define ORIG_TEMP_2_PIN -1 // ANALOG NUMBERING #define ORIG_E1_STEP_PIN 29
#define ORIG_E1_DIR_PIN 39
#define ORIG_E1_ENABLE_PIN 28
#define ORIG_HEATER_BED_PIN 10 // BED #define ORIG_E2_STEP_PIN 23
#define ORIG_E2_DIR_PIN 24
#define ORIG_E2_ENABLE_PIN 22
#if TEMP_SENSOR_BED == -1 #define SDPOWER -1
#define ORIG_TEMP_BED_PIN 8 // ANALOG NUMBERING #define SDSS 53
#else #define LED_PIN 13
#define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING
#endif #define ORIG_FAN_PIN 7
#define FAN2_PIN 6
#define ORIG_PS_ON_PIN 12
#define KILL_PIN -1
#define ORIG_HEATER_0_PIN 9 // EXTRUDER 1
#define ORIG_HEATER_1_PIN 8 // EXTRUDER 2
#define ORIG_HEATER_2_PIN -1
#define SHIFT_CLK 63
#define SHIFT_LD 42
#define SHIFT_OUT 17
#define SHIFT_EN 17
#if TEMP_SENSOR_0 == -1
#define ORIG_TEMP_0_PIN 4 // ANALOG NUMBERING
#else
#define ORIG_TEMP_0_PIN 13 // ANALOG NUMBERING
#endif
#define BEEPER_PIN 64 #if TEMP_SENSOR_1 == -1
#define ORIG_TEMP_1_PIN 8 // ANALOG NUMBERING
#else
#define ORIG_TEMP_1_PIN 15 // ANALOG NUMBERING
#endif
#define ORIG_TEMP_2_PIN -1 // ANALOG NUMBERING
#define LCD_PINS_RS 14 #define ORIG_HEATER_BED_PIN 10 // BED
#define LCD_PINS_ENABLE 15
#define LCD_PINS_D4 30
#define LCD_PINS_D5 31
#define LCD_PINS_D6 32
#define LCD_PINS_D7 33
#if TEMP_SENSOR_BED == -1
#define ORIG_TEMP_BED_PIN 8 // ANALOG NUMBERING
#else
#define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING
#endif
//buttons are directly attached using keypad #define BEEPER_PIN 64
#define BTN_EN1 61
#define BTN_EN2 59
#define BTN_ENC 43 //the click
#define BLEN_C 2 #define LCD_PINS_RS 14
#define BLEN_B 1 #define LCD_PINS_ENABLE 15
#define BLEN_A 0 #define LCD_PINS_D4 30
#define LCD_PINS_D5 31
#define LCD_PINS_D6 32
#define LCD_PINS_D7 33
#define SD_DETECT_PIN -1 // Megatronics does not use this port //buttons are directly attached using keypad
#define BTN_EN1 61
#define BTN_EN2 59
#define BTN_ENC 43 //the click
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#define SD_DETECT_PIN -1 // Megatronics does not use this port
#endif // MEGATRONICS_2 #endif // MEGATRONICS_2
/****************************************************************************************/ /****************************************************************************************/
...@@ -3808,12 +3803,11 @@ ...@@ -3808,12 +3803,11 @@
****************************************************************************************/ ****************************************************************************************/
#if MB(MINITRONICS) #if MB(MINITRONICS)
#define KNOWN_BOARD 1 #define KNOWN_BOARD 1
#ifndef __AVR_ATmega1281__ #ifndef __AVR_ATmega1281__
#error Oops! Make sure you have 'Minitronics ' selected from the 'Tools -> Boards' menu. #error Oops! Make sure you have 'Minitronics ' selected from the 'Tools -> Boards' menu.
#endif #endif
#define LARGE_FLASH true #define LARGE_FLASH true
...@@ -4032,68 +4026,68 @@ ...@@ -4032,68 +4026,68 @@
****************************************************************************************/ ****************************************************************************************/
#if MB(ULTIMAKER_OLD) #if MB(ULTIMAKER_OLD)
#define KNOWN_BOARD #define KNOWN_BOARD
#ifndef __AVR_ATmega1280__
#ifndef __AVR_ATmega2560__
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif
#endif
#define LARGE_FLASH true
#define ORIG_X_STEP_PIN 25
#define ORIG_X_DIR_PIN 23
#define ORIG_X_MIN_PIN 15
#define ORIG_X_MAX_PIN 14
#define ORIG_X_ENABLE_PIN 27
#define ORIG_Y_STEP_PIN 31 #ifndef __AVR_ATmega1280__
#define ORIG_Y_DIR_PIN 33 #ifndef __AVR_ATmega2560__
#define ORIG_Y_MIN_PIN 17 #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#define ORIG_Y_MAX_PIN 16 #endif
#define ORIG_Y_ENABLE_PIN 29 #endif
#define ORIG_Z_STEP_PIN 37 #define LARGE_FLASH true
#define ORIG_Z_DIR_PIN 39
#define ORIG_Z_MIN_PIN 19
#define ORIG_Z_MAX_PIN 18
#define ORIG_Z_ENABLE_PIN 35
#define ORIG_HEATER_BED_PIN -1 #define ORIG_X_STEP_PIN 25
#define ORIG_TEMP_BED_PIN -1 #define ORIG_X_DIR_PIN 23
#define ORIG_X_MIN_PIN 15
#define ORIG_X_MAX_PIN 14
#define ORIG_X_ENABLE_PIN 27
#define ORIG_HEATER_0_PIN 2 #define ORIG_Y_STEP_PIN 31
#define ORIG_TEMP_0_PIN 8 #define ORIG_Y_DIR_PIN 33
#define ORIG_Y_MIN_PIN 17
#define ORIG_Y_MAX_PIN 16
#define ORIG_Y_ENABLE_PIN 29
#define ORIG_HEATER_1_PIN 1 #define ORIG_Z_STEP_PIN 37
#define ORIG_TEMP_1_PIN 1 #define ORIG_Z_DIR_PIN 39
#define ORIG_Z_MIN_PIN 19
#define ORIG_Z_MAX_PIN 18
#define ORIG_Z_ENABLE_PIN 35
#define ORIG_HEATER_2_PIN -1 #define ORIG_HEATER_BED_PIN -1
#define ORIG_TEMP_2_PIN -1 #define ORIG_TEMP_BED_PIN -1
#define ORIG_E0_STEP_PIN 43 #define ORIG_HEATER_0_PIN 2
#define ORIG_E0_DIR_PIN 45 #define ORIG_TEMP_0_PIN 8
#define ORIG_E0_ENABLE_PIN 41
#define ORIG_E1_STEP_PIN -1 #define ORIG_HEATER_1_PIN 1
#define ORIG_E1_DIR_PIN -1 #define ORIG_TEMP_1_PIN 1
#define ORIG_E1_ENABLE_PIN -1
#define SDPOWER -1 #define ORIG_HEATER_2_PIN -1
#define SDSS -1 #define ORIG_TEMP_2_PIN -1
#define LED_PIN -1
#define ORIG_FAN_PIN -1
#define ORIG_PS_ON_PIN -1
#define KILL_PIN -1
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
#define LCD_PINS_RS 24 #define ORIG_E0_STEP_PIN 43
#define LCD_PINS_ENABLE 22 #define ORIG_E0_DIR_PIN 45
#define LCD_PINS_D4 36 #define ORIG_E0_ENABLE_PIN 41
#define LCD_PINS_D5 34
#define LCD_PINS_D6 32 #define ORIG_E1_STEP_PIN -1
#define LCD_PINS_D7 30 #define ORIG_E1_DIR_PIN -1
#define ORIG_E1_ENABLE_PIN -1
#define SDPOWER -1
#define SDSS -1
#define LED_PIN -1
#define ORIG_FAN_PIN -1
#define ORIG_PS_ON_PIN -1
#define KILL_PIN -1
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
#define LCD_PINS_RS 24
#define LCD_PINS_ENABLE 22
#define LCD_PINS_D4 36
#define LCD_PINS_D5 34
#define LCD_PINS_D6 32
#define LCD_PINS_D7 30
#endif // ULTIMAKER_OLD #endif // ULTIMAKER_OLD
/****************************************************************************************/ /****************************************************************************************/
......
...@@ -528,16 +528,16 @@ float junction_deviation = 0.1; ...@@ -528,16 +528,16 @@ float junction_deviation = 0.1;
} }
#endif #endif
float dx = target[X_AXIS] - position[X_AXIS], long dx = target[X_AXIS] - position[X_AXIS],
dy = target[Y_AXIS] - position[Y_AXIS], dy = target[Y_AXIS] - position[Y_AXIS],
dz = target[Z_AXIS] - position[Z_AXIS], dz = target[Z_AXIS] - position[Z_AXIS],
de = target[E_AXIS] - position[E_AXIS]; de = target[E_AXIS] - position[E_AXIS];
#if MECH(COREXY) #if MECH(COREXY)
float da = dx + COREX_YZ_FACTOR * dy; long da = dx + COREX_YZ_FACTOR * dy;
float db = dx - COREX_YZ_FACTOR * dy; long db = dx - COREX_YZ_FACTOR * dy;
#elif MECH(COREXZ) #elif MECH(COREXZ)
float da = dx + COREX_YZ_FACTOR * dz; long da = dx + COREX_YZ_FACTOR * dz;
float dc = dx - COREX_YZ_FACTOR * dz; long dc = dx - COREX_YZ_FACTOR * dz;
#endif #endif
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE) #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
...@@ -1081,7 +1081,7 @@ float junction_deviation = 0.1; ...@@ -1081,7 +1081,7 @@ float junction_deviation = 0.1;
apply_rotation_xyz(plan_bed_level_matrix, x, y, z); apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif #endif
float nx = position[X_AXIS] = lround(x * axis_steps_per_unit[X_AXIS]), long nx = position[X_AXIS] = lround(x * axis_steps_per_unit[X_AXIS]),
ny = position[Y_AXIS] = lround(y * axis_steps_per_unit[Y_AXIS]), ny = position[Y_AXIS] = lround(y * axis_steps_per_unit[Y_AXIS]),
nz = position[Z_AXIS] = lround(z * axis_steps_per_unit[Z_AXIS]), nz = position[Z_AXIS] = lround(z * axis_steps_per_unit[Z_AXIS]),
ne = position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + active_extruder]); ne = position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + active_extruder]);
......
...@@ -304,7 +304,7 @@ void checkHitEndstops() { ...@@ -304,7 +304,7 @@ void checkHitEndstops() {
} }
void enable_endstops(bool check) { void enable_endstops(bool check) {
if (debugLevel & DEBUG_INFO) { if (debugLevel & DEBUG_DEBUG) {
ECHO_SM(DB, "setup_for_endstop_move > enable_endstops"); ECHO_SM(DB, "setup_for_endstop_move > enable_endstops");
if (check) ECHO_EM("(true)"); if (check) ECHO_EM("(true)");
else ECHO_EM("(false)"); else ECHO_EM("(false)");
......
...@@ -350,19 +350,10 @@ void autotempShutdown() { ...@@ -350,19 +350,10 @@ void autotempShutdown() {
// Every 2 seconds... // Every 2 seconds...
if (ms > temp_ms + 2000) { if (ms > temp_ms + 2000) {
int p; #if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
if (hotend < 0) { print_heaterstates();
p = soft_pwm_bed; ECHO_E;
ECHO_MV(MSG_B, input); #endif
ECHO_MV(" /", temp, 1);
ECHO_EMV(" " MSG_AT, p);
}
else {
p = soft_pwm[hotend];
ECHO_MV(MSG_T, input, 1);
ECHO_MV(" /", temp, 1);
ECHO_EMV(" " MSG_AT, p);
}
temp_ms = ms; temp_ms = ms;
} // every 2 seconds } // every 2 seconds
...@@ -775,34 +766,34 @@ void manage_heater() { ...@@ -775,34 +766,34 @@ void manage_heater() {
WRITE_HEATER_BED(LOW); WRITE_HEATER_BED(LOW);
} }
#endif #endif
#endif //TEMP_SENSOR_BED != 0 #endif // TEMP_SENSOR_BED != 0
} }
#define PGM_RD_W(x) (short)pgm_read_word(&x) #define PGM_RD_W(x) (short)pgm_read_word(&x)
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
// For hot end temperature measurement. // For hot end temperature measurement.
static float analog2temp(int raw, uint8_t e) { static float analog2temp(int raw, uint8_t h) {
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
if (e > EXTRUDERS) if (h > HOTENDS)
#else #else
if (e >= EXTRUDERS) if (h >= HOTENDS)
#endif #endif
{ {
ECHO_LVM(ER, (int)e, MSG_INVALID_EXTRUDER_NUM); ECHO_LVM(ER, (int)h, MSG_INVALID_EXTRUDER_NUM);
kill(PSTR(MSG_KILLED)); kill(PSTR(MSG_KILLED));
return 0.0; return 0.0;
} }
#if ENABLED(HEATER_0_USES_MAX6675) #if ENABLED(HEATER_0_USES_MAX6675)
if (e == 0) return 0.25 * raw; if (h == 0) return 0.25 * raw;
#endif #endif
if (heater_ttbl_map[e] != NULL) { if (heater_ttbl_map[h] != NULL) {
float celsius = 0; float celsius = 0;
uint8_t i; uint8_t i;
short(*tt)[][2] = (short(*)[][2])(heater_ttbl_map[e]); short(*tt)[][2] = (short(*)[][2])(heater_ttbl_map[h]);
for (i = 1; i < heater_ttbllen_map[e]; i++) { for (i = 1; i < heater_ttbllen_map[h]; i++) {
if (PGM_RD_W((*tt)[i][0]) > raw) { if (PGM_RD_W((*tt)[i][0]) > raw) {
celsius = PGM_RD_W((*tt)[i - 1][1]) + celsius = PGM_RD_W((*tt)[i - 1][1]) +
(raw - PGM_RD_W((*tt)[i - 1][0])) * (raw - PGM_RD_W((*tt)[i - 1][0])) *
...@@ -813,11 +804,14 @@ static float analog2temp(int raw, uint8_t e) { ...@@ -813,11 +804,14 @@ static float analog2temp(int raw, uint8_t e) {
} }
// Overflow: Set to last value in the table // Overflow: Set to last value in the table
if (i == heater_ttbllen_map[e]) celsius = PGM_RD_W((*tt)[i - 1][1]); if (i == heater_ttbllen_map[h]) celsius = PGM_RD_W((*tt)[i - 1][1]);
return celsius; return celsius;
} }
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#if HEATER_USES_AD595
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * ad595_gain[h]) + ad595_offset[h];
#endif
} }
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
......
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