Commit 9c53b44c authored by MagoKimbra's avatar MagoKimbra

Update 4.2.1 dev

parent 92818d98
......@@ -44,7 +44,7 @@
//#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.
#define NO_TIMEOUTS 1000 // Milliseconds
//#define NO_TIMEOUTS 1000 // Milliseconds
//#define ADVANCED_OK // Uncomment to include more info in ok command
/***********************************************************************/
......
......@@ -48,13 +48,13 @@
// and processor overload (too many expensive sqrt calls).
// 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)
#define DELTA_SEGMENTS_PER_SECOND 150
#define DELTA_SEGMENTS_PER_SECOND 200
// 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.
#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.
#define DELTA_EFFECTOR_OFFSET 20.0 // mm
......
......@@ -361,9 +361,9 @@
#define PREVENT_DANGEROUS_EXTRUDE
#define EXTRUDE_MINTEMP 170 // degC
//if PREVENT DANGEROUS EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately.
#define PREVENT_LENGTHY_EXTRUDE
#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
// if PREVENT DANGEROUS EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately.
//#define PREVENT_LENGTHY_EXTRUDE
#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH + Y_MAX_LENGTH) // prevent extrusion of very large distances.
/***********************************************************************/
......
......@@ -8,7 +8,7 @@
// #error "You must specify the following parameters related to your distribution"
#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
// It might also be appropriate to define a location where additional information can be found
#define SOURCE_CODE_URL "https://github.com/MagoKimbra/MarlinKimbra"
......
......@@ -196,7 +196,7 @@
* M300 - Play beep sound S<frequency Hz> P<duration ms>
* M301 - Set PID parameters P I D and C
* 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
* M350 - Set microstepping mode.
* M351 - Toggle MS1 MS2 pins directly.
......@@ -216,6 +216,7 @@
* 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.
* 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]
* 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
......@@ -323,6 +324,11 @@ unsigned long printer_usage_seconds;
float hotend_offset[3][HOTENDS];
#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)
int old_color = 99;
#endif
......@@ -375,7 +381,6 @@ unsigned long printer_usage_seconds;
float DELTA_DIAGONAL_ROD1_2;
float DELTA_DIAGONAL_ROD2_2;
float DELTA_DIAGONAL_ROD3_2;
float delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
float ac_prec = AUTOCALIBRATION_PRECISION;
float delta_tower1_x, delta_tower1_y,
delta_tower2_x, delta_tower2_y,
......@@ -415,7 +420,7 @@ unsigned long printer_usage_seconds;
#endif
#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 };
float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1
#endif
......@@ -2512,9 +2517,8 @@ static void clean_up_after_endstop_move() {
float probe_bed(float x, float y) {
//Probe bed at specified location and return z height of bed
float probe_z, probe_bed_array[20];
int probe_count;
boolean probe_done;
uint8_t probe_count = 5;
float probe_z, probe_bed_array[probe_count], probe_bed_mean = 0;
destination[X_AXIS] = x - z_probe_offset[X_AXIS];
if (destination[X_AXIS] < X_MIN_POS) destination[X_AXIS] = X_MIN_POS;
......@@ -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_MAX_POS) destination[Y_AXIS] = Y_MAX_POS;
probe_count = 0;
do {
probe_z = z_probe() + z_probe_offset[Z_AXIS];
probe_bed_array[probe_count] = probe_z;
probe_done = false;
if (probe_count > 0) {
for(int xx = 0; xx < probe_count; xx++) {
if (probe_bed_array[xx] == probe_z) probe_done = true;
}
for(int i = 0; i < probe_count; i++) {
probe_bed_array[i] = z_probe() + z_probe_offset[Z_AXIS];
probe_bed_mean += probe_bed_array[i];
}
probe_z = probe_bed_mean / probe_count;
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 ++;
} while ((probe_done == false) and (probe_count < 20));
ECHO_EMV("mean ", probe_z, 4);
}
bed_safe_z = probe_z + 5;
return probe_z;
......@@ -2575,13 +2582,17 @@ static void clean_up_after_endstop_move() {
ECHO_SM(DB, "| \t");
if (bed_level_z >= 0) ECHO_M(" ");
ECHO_MV("", bed_level_z, 4);
ECHO_MV("\t\t\tX:", endstop_adj[0]);
ECHO_MV(" Y:", endstop_adj[1]);
ECHO_EMV(" Z:", endstop_adj[2]);
ECHO_SMV(DB, "| ", bed_level_oy, 4);
ECHO_M("\t\t");
ECHO_EVM(bed_level_ox, "\t\tTower Offsets", 4);
ECHO_MV("\t\t\tX:", endstop_adj[0], 4);
ECHO_MV(" Y:", endstop_adj[1], 4);
ECHO_EMV(" Z:", endstop_adj[2], 4);
ECHO_SM(DB, "| ");
if (bed_level_ox >= 0) ECHO_M(" ");
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");
if (bed_level_c >= 0) ECHO_M(" ");
......@@ -2590,18 +2601,22 @@ static void clean_up_after_endstop_move() {
ECHO_MV(" B:",tower_adj[1]);
ECHO_EMV(" C:",tower_adj[2]);
ECHO_SMV(DB, "| ", bed_level_x, 4);
ECHO_MV("\t\t", bed_level_y, 4);
ECHO_SM(DB, "| ");
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(" J:",tower_adj[4]);
ECHO_EMV(" K:",tower_adj[5]);
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_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;
}
......@@ -2655,7 +2670,7 @@ static void clean_up_after_endstop_move() {
}
void prepare_move_raw() {
if (debugLevel & DEBUG_INFO) {
if (debugLevel & DEBUG_DEBUG) {
ECHO_S(DB);
print_xyz("prepare_move_raw > destination", destination);
}
......@@ -2838,8 +2853,63 @@ static void clean_up_after_endstop_move() {
}
#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();
/* See if we are heating up or cooling down */
......@@ -2859,8 +2929,9 @@ inline void wait_heater() {
{ // while loop
if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting
ECHO_MV(MSG_T, degHotend(target_extruder), 1);
ECHO_MV(" E:", (int)target_extruder);
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
print_heaterstates();
#endif
#if ENABLED(TEMP_RESIDENCY_TIME)
ECHO_M(" " MSG_W);
if (residency_start_ms > -1) {
......@@ -2906,9 +2977,10 @@ inline void wait_bed() {
if (ms > temp_ms + 1000UL) { //Print Temp Reading every 1 second while heating up.
temp_ms = ms;
float tt = degHotend(active_extruder);
ECHO_MV(MSG_T, tt);
ECHO_MV(" E:", active_extruder);
ECHO_EMV(" " MSG_B, degBed(), 1);
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
print_heaterstates();
ECHO_E;
#endif
}
idle();
}
......@@ -2943,6 +3015,13 @@ void gcode_get_destination() {
float next_feedrate = code_value();
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() {
......@@ -3505,6 +3584,11 @@ inline void gcode_G28() {
#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");
}
......@@ -3989,11 +4073,11 @@ inline void gcode_G28() {
deploy_z_probe();
probe_value = probe_bed(x, y);
if (debugLevel & DEBUG_INFO) {
ECHO_SMV(DB, "Bed Z-Height at X:", x);
ECHO_MV(" Y:", y);
ECHO_EMV(" = ", probe_value, 4);
ECHO_SMV(DB, "Bed Z-Height at X:", x);
ECHO_MV(" Y:", y);
ECHO_EMV(" = ", probe_value, 4);
if (debugLevel & DEBUG_INFO) {
ECHO_SMV(DB, "Carriage Positions: [", saved_position[X_AXIS]);
ECHO_MV(", ", saved_position[Y_AXIS]);
ECHO_MV(", ", saved_position[Z_AXIS]);
......@@ -4036,9 +4120,9 @@ inline void gcode_G28() {
bed_probe_all();
calibration_report();
} 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_z < -ac_prec) or (bed_level_z > 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_z <= -ac_prec) or (bed_level_z >= ac_prec));
ECHO_LM(DB, "Endstop adjustment complete");
}
......@@ -4058,10 +4142,10 @@ inline void gcode_G28() {
ECHO_LM(DB, "Checking delta radius");
adj_deltaradius();
} 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_y < -ac_prec) or (bed_level_y > ac_prec)
or (bed_level_z < -ac_prec) or (bed_level_z > 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_y <= -ac_prec) or (bed_level_y >= ac_prec)
or (bed_level_z <= -ac_prec) or (bed_level_z >= ac_prec));
}
if (code_seen('I')) {
......@@ -4097,26 +4181,28 @@ inline void gcode_G28() {
bed_probe_all();
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");
dr_adjusted = adj_deltaradius();
}
else dr_adjusted = 0;
/*
ECHO_EMV("bed_level_c=", bed_level_c, 4);
ECHO_EMV("bed_level_x=", bed_level_x, 4);
ECHO_EMV("bed_level_y=", bed_level_y, 4);
ECHO_EMV("bed_level_z=", bed_level_z, 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)
or (bed_level_y < -ac_prec) or (bed_level_y > ac_prec)
or (bed_level_z < -ac_prec) or (bed_level_z > ac_prec)
else
dr_adjusted = 0;
if (debugLevel & DEBUG_DEBUG) {
ECHO_LMV(DB, "bed_level_c=", bed_level_c, 4);
ECHO_LMV(DB, "bed_level_x=", bed_level_x, 4);
ECHO_LMV(DB, "bed_level_y=", bed_level_y, 4);
ECHO_LMV(DB, "bed_level_z=", bed_level_z, 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)
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));
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_oz < -ac_prec) or (bed_level_oz > ac_prec)) {
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_oz <= -ac_prec) or (bed_level_oz >= ac_prec)) {
ECHO_LM(DB, "Checking for tower geometry errors..");
if (fix_tower_errors() != 0 ) {
// Tower positions have been changed .. home to endstops
......@@ -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_probe_all();
calibration_report();
}
/*
ECHO_EMV("bed_level_c=", bed_level_c, 4);
ECHO_EMV("bed_level_x=", bed_level_x, 4);
ECHO_EMV("bed_level_y=", bed_level_y, 4);
ECHO_EMV("bed_level_z=", bed_level_z, 4);
ECHO_EMV("bed_level_ox=", bed_level_ox, 4);
ECHO_EMV("bed_level_oy=", bed_level_oy, 4);
ECHO_EMV("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)
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_ox < -ac_prec) or (bed_level_ox > 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));
if (debugLevel & DEBUG_DEBUG) {
ECHO_LMV(DB, "bed_level_c=", bed_level_c, 4);
ECHO_LMV(DB, "bed_level_x=", bed_level_x, 4);
ECHO_LMV(DB, "bed_level_y=", bed_level_y, 4);
ECHO_LMV(DB, "bed_level_z=", bed_level_z, 4);
ECHO_LMV(DB, "bed_level_ox=", bed_level_ox, 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)
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_ox <= -ac_prec) or (bed_level_ox >= 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");
}
......@@ -4162,7 +4250,6 @@ inline void gcode_G28() {
lcd_reset_alert_level();
clean_up_after_endstop_move();
}
#endif // DELTA && Z_PROBE_ENDSTOP
......@@ -5122,48 +5209,11 @@ inline void gcode_M105() {
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
ECHO_S(OK);
#if HAS(TEMP_0)
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);
}
print_heaterstates();
#else // HASNT(TEMP_0) && HASNT(TEMP_BED)
ECHO_LM(ER, MSG_ERR_NO_THERMISTORS);
#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;
}
......@@ -5226,11 +5276,7 @@ inline void gcode_M111() {
ECHO_LM(DB, MSG_DEBUG_DRYRUN);
disable_all_heaters();
}
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (debugLevel & DEBUG_LEVELING) {
ECHO_LM(DB, MSG_DEBUG_LEVELING);
}
#endif
if (debugLevel & DEBUG_DEBUG) ECHO_LM(DB, MSG_DEBUG);
}
/**
......@@ -5979,14 +6025,16 @@ inline void gcode_M226() {
/**
* M303: PID relay autotune
* S<temperature> sets the target temperature. (default target temperature = 150C)
* E<extruder> (-1 for the bed)
* H<hotend> (-1 for the bed)
* C<cycles>
*/
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;
float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0);
PID_autotune(temp, e, c);
float temp = code_seen('S') ? code_value() : (h < 0 ? 70.0 : 150.0);
if (h >= 0 && h < HOTENDS) target_extruder = h;
PID_autotune(temp, h, c);
}
#endif
......@@ -6334,6 +6382,31 @@ inline void gcode_M503() {
#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)
/**
* M600: Pause for filament change
......@@ -7412,6 +7485,11 @@ void process_next_command() {
gcode_M540(); break;
#endif
#if HEATER_USES_AD595
case 595: // M595 set Hotends AD595 offset & gain
gcode_M595(); break;
#endif
#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]
gcode_M600(); break;
......@@ -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) 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;
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
float fTemp = cartesian_mm * 5;
int steps = (int)fTemp;
if (steps == 0) {
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 {
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
// 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
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);
for (int8_t i = 0; i < NUM_AXIS; i++)
target[i] = current_position[i] + difference[i] * fraction;
......@@ -7572,9 +7657,17 @@ void clamp_to_software_endstops(float target[3]) {
#endif
calculate_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);
}
return true;
......@@ -8261,8 +8354,7 @@ void kill(const char* lcd_msg) {
#endif
}
}
#endif //FAST_PWM_FAN
#endif // FAST_PWM_FAN
void Stop() {
disable_all_heaters();
......
......@@ -61,7 +61,8 @@ enum DebugFlags {
DEBUG_INFO = BIT(1),
DEBUG_ERRORS = BIT(2),
DEBUG_DRYRUN = BIT(3),
DEBUG_COMMUNICATION = BIT(4)
DEBUG_COMMUNICATION = BIT(4),
DEBUG_DEBUG = BIT(5)
};
void clamp_to_software_endstops(float target[3]);
......@@ -101,6 +102,11 @@ extern float home_offset[3];
extern float hotend_offset[3][HOTENDS];
#endif // HOTENDS > 1
#if HEATER_USES_AD595
extern float ad595_offset[HOTENDS];
extern float ad595_gain[HOTENDS];
#endif
#if ENABLED(NPR2)
extern int old_color; // old color for system NPR2
#endif
......@@ -111,7 +117,6 @@ extern float home_offset[3];
extern float tower_adj[6];
extern float delta_radius;
extern float delta_diagonal_rod;
extern float delta_segments_per_second;
#elif ENABLED(Z_DUAL_ENDSTOPS)
extern float z_endstop_adj;
#endif
......@@ -207,6 +212,10 @@ extern uint8_t active_driver;
extern void digipot_i2c_init();
#endif
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
void print_heaterstates();
#endif
#if ENABLED(FIRMWARE_TEST)
void FirmwareTest();
#endif
......
......@@ -146,23 +146,30 @@
#define NEWPANEL
#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)
#define NEWPANEL //enable this if you have a click-encoder panel
#define ULTRA_LCD
#if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#if DISABLED(LCD_WIDTH)
#define LCD_WIDTH 20
#endif
#if DISABLED(LCD_HEIGHT)
#define LCD_HEIGHT 4
#endif
#else //no panel but just LCD
#if ENABLED(ULTRA_LCD)
#if ENABLED(DOGLCD) // Change number of lines to match the 128x64 graphics display
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#if DISABLED(LCD_WIDTH)
#define LCD_WIDTH 16
#endif
#if DISABLED(LCD_HEIGHT)
#define LCD_HEIGHT 2
#endif
#endif
......@@ -502,33 +509,33 @@
#define BED_USES_THERMISTOR
#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
*/
#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
#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
#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
#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
#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
#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
#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
#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
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1, v2 }
#define ARRAY_BY_EXTRUDERS(v1) { v1, v1 }
#else
#define ARRAY_BY_EXTRUDER(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) { v1 }
#define ARRAY_BY_EXTRUDERS(v1) { v1 }
#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
*/
......
......@@ -53,6 +53,9 @@
* HOTENDS OFFSET:
* M218 T XY hotend_offset (x4) (T0..3)
*
* HOTENDS AD595:
* M595 T O G Hotend AD595 Offset & Gain
*
* DELTA:
* M666 XYZ endstop_adj (x3)
* M666 R delta_radius
......@@ -171,6 +174,11 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, hotend_offset);
#endif
#if HEATER_USES_AD595
EEPROM_WRITE_VAR(i, ad595_offset);
EEPROM_WRITE_VAR(i, ad595_gain);
#endif
#if MECH(DELTA)
EEPROM_WRITE_VAR(i, endstop_adj);
EEPROM_WRITE_VAR(i, delta_radius);
......@@ -314,6 +322,11 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, hotend_offset);
#endif
#if HEATER_USES_AD595
EEPROM_READ_VAR(i, ad595_offset);
EEPROM_READ_VAR(i, ad595_gain);
#endif
#if MECH(DELTA)
EEPROM_READ_VAR(i, endstop_adj);
EEPROM_READ_VAR(i, delta_radius);
......@@ -591,11 +604,6 @@ void Config_ResetDefault() {
#endif
volumetric_enabled = false;
for (short i = 0; i < EXTRUDERS; i++) {
filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
}
calculate_volumetric_multipliers();
#if ENABLED(IDLE_OOZING_PREVENT)
......@@ -710,8 +718,19 @@ void Config_ResetDefault() {
ECHO_MV(" Y", hotend_offset[Y_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 (!forReplay) {
ECHO_LM(DB, "Delta Geometry adjustment:");
......
......@@ -181,13 +181,13 @@
#define MSG_KU " Ku: "
#define MSG_TU " Tu: "
#define MSG_CLASSIC_PID " Classic PID "
#define MSG_KP " Kp: "
#define MSG_KP "Kp: "
#define MSG_KI " Ki: "
#define MSG_KD " Kd: "
#define MSG_KC " Kc: "
#define MSG_B "B:"
#define MSG_T "T:"
#define MSG_AT "@:"
#define MSG_AT "@"
#define MSG_BAT "B@:"
#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!"
......
......@@ -153,6 +153,7 @@
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_HOTEND_AD595 "HOTEND AD595 Offset & Gain"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
......@@ -166,6 +167,7 @@
#define MSG_DEBUG_INFO "DEBUG INFO ENABLED"
#define MSG_DEBUG_ERRORS "DEBUG ERRORS ENABLED"
#define MSG_DEBUG_DRYRUN "DEBUG DRYRUN ENABLED"
#define MSG_DEBUG "DEBUG ENABLED"
// Calibrate Delta
#if MECH(DELTA)
......
......@@ -157,10 +157,11 @@
#define MSG_END_MINUTE "minuti"
// Debug
#define MSG_DEBUG_ECHO "DEBUG RIPETI"
#define MSG_DEBUG_INFO "DEBUG INFO"
#define MSG_DEBUG_ERRORS "DEBUG ERRORI"
#define MSG_DEBUG_DRYRUN "DEBUG STAMPA A VUOTO"
#define MSG_DEBUG_ECHO "DEBUG RIPETI ABILITATO"
#define MSG_DEBUG_INFO "DEBUG INFO ABILITATO"
#define MSG_DEBUG_ERRORS "DEBUG ERRORI ABILITATO"
#define MSG_DEBUG_DRYRUN "DEBUG STAMPA A VUOTO ABILITATO"
#define MSG_DEBUG "DEBUG ABILITATO"
// Calibrate Delta
#if MECH(DELTA)
......
......@@ -18,6 +18,12 @@
void lcd_setalertstatuspgm(const char* message);
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)
void sdlistPopCallback(void *ptr);
void sdfilePopCallback(void *ptr);
......
......@@ -3658,9 +3658,7 @@
#define BEEPER_PIN 33 // Beeper on AUX-4
#if ENABLED(ULTRA_LCD)
#if ENABLED(NEWPANEL)
//arduino pin which triggers an piezzo beeper
......@@ -3696,106 +3694,103 @@
****************************************************************************************/
#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__
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif
#define LARGE_FLASH true
#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_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_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_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
#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_E0_STEP_PIN 35
#define ORIG_E0_DIR_PIN 36
#define ORIG_E0_ENABLE_PIN 34
#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 ORIG_TEMP_BED_PIN 8 // ANALOG NUMBERING
#else
#define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING
#endif
#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 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 LCD_PINS_ENABLE 15
#define LCD_PINS_D4 30
#define LCD_PINS_D5 31
#define LCD_PINS_D6 32
#define LCD_PINS_D7 33
#define ORIG_HEATER_BED_PIN 10 // BED
#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 BTN_EN1 61
#define BTN_EN2 59
#define BTN_ENC 43 //the click
#define BEEPER_PIN 64
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#define LCD_PINS_RS 14
#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
#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
/****************************************************************************************/
......@@ -3808,12 +3803,11 @@
****************************************************************************************/
#if MB(MINITRONICS)
#define KNOWN_BOARD 1
#define KNOWN_BOARD 1
#ifndef __AVR_ATmega1281__
#error Oops! Make sure you have 'Minitronics ' selected from the 'Tools -> Boards' menu.
#endif
#ifndef __AVR_ATmega1281__
#error Oops! Make sure you have 'Minitronics ' selected from the 'Tools -> Boards' menu.
#endif
#define LARGE_FLASH true
......@@ -4032,68 +4026,68 @@
****************************************************************************************/
#if MB(ULTIMAKER_OLD)
#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 KNOWN_BOARD
#define ORIG_Y_STEP_PIN 31
#define ORIG_Y_DIR_PIN 33
#define ORIG_Y_MIN_PIN 17
#define ORIG_Y_MAX_PIN 16
#define ORIG_Y_ENABLE_PIN 29
#ifndef __AVR_ATmega1280__
#ifndef __AVR_ATmega2560__
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif
#endif
#define ORIG_Z_STEP_PIN 37
#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 LARGE_FLASH true
#define ORIG_HEATER_BED_PIN -1
#define ORIG_TEMP_BED_PIN -1
#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_HEATER_0_PIN 2
#define ORIG_TEMP_0_PIN 8
#define ORIG_Y_STEP_PIN 31
#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_TEMP_1_PIN 1
#define ORIG_Z_STEP_PIN 37
#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_TEMP_2_PIN -1
#define ORIG_HEATER_BED_PIN -1
#define ORIG_TEMP_BED_PIN -1
#define ORIG_E0_STEP_PIN 43
#define ORIG_E0_DIR_PIN 45
#define ORIG_E0_ENABLE_PIN 41
#define ORIG_HEATER_0_PIN 2
#define ORIG_TEMP_0_PIN 8
#define ORIG_E1_STEP_PIN -1
#define ORIG_E1_DIR_PIN -1
#define ORIG_E1_ENABLE_PIN -1
#define ORIG_HEATER_1_PIN 1
#define ORIG_TEMP_1_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 ORIG_HEATER_2_PIN -1
#define ORIG_TEMP_2_PIN -1
#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
#define ORIG_E0_STEP_PIN 43
#define ORIG_E0_DIR_PIN 45
#define ORIG_E0_ENABLE_PIN 41
#define ORIG_E1_STEP_PIN -1
#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
/****************************************************************************************/
......
......@@ -528,16 +528,16 @@ float junction_deviation = 0.1;
}
#endif
float dx = target[X_AXIS] - position[X_AXIS],
long dx = target[X_AXIS] - position[X_AXIS],
dy = target[Y_AXIS] - position[Y_AXIS],
dz = target[Z_AXIS] - position[Z_AXIS],
de = target[E_AXIS] - position[E_AXIS];
#if MECH(COREXY)
float da = dx + COREX_YZ_FACTOR * dy;
float db = dx - COREX_YZ_FACTOR * dy;
long da = dx + COREX_YZ_FACTOR * dy;
long db = dx - COREX_YZ_FACTOR * dy;
#elif MECH(COREXZ)
float da = dx + COREX_YZ_FACTOR * dz;
float dc = dx - COREX_YZ_FACTOR * dz;
long da = dx + COREX_YZ_FACTOR * dz;
long dc = dx - COREX_YZ_FACTOR * dz;
#endif
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
......@@ -1081,7 +1081,7 @@ float junction_deviation = 0.1;
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#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]),
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]);
......
......@@ -304,7 +304,7 @@ void checkHitEndstops() {
}
void enable_endstops(bool check) {
if (debugLevel & DEBUG_INFO) {
if (debugLevel & DEBUG_DEBUG) {
ECHO_SM(DB, "setup_for_endstop_move > enable_endstops");
if (check) ECHO_EM("(true)");
else ECHO_EM("(false)");
......
......@@ -350,19 +350,10 @@ void autotempShutdown() {
// Every 2 seconds...
if (ms > temp_ms + 2000) {
int p;
if (hotend < 0) {
p = soft_pwm_bed;
ECHO_MV(MSG_B, input);
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);
}
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
print_heaterstates();
ECHO_E;
#endif
temp_ms = ms;
} // every 2 seconds
......@@ -775,34 +766,34 @@ void manage_heater() {
WRITE_HEATER_BED(LOW);
}
#endif
#endif //TEMP_SENSOR_BED != 0
#endif // TEMP_SENSOR_BED != 0
}
#define PGM_RD_W(x) (short)pgm_read_word(&x)
// Derived from RepRap FiveD extruder::getTemperature()
// 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 (e > EXTRUDERS)
if (h > HOTENDS)
#else
if (e >= EXTRUDERS)
if (h >= HOTENDS)
#endif
{
ECHO_LVM(ER, (int)e, MSG_INVALID_EXTRUDER_NUM);
ECHO_LVM(ER, (int)h, MSG_INVALID_EXTRUDER_NUM);
kill(PSTR(MSG_KILLED));
return 0.0;
}
#if ENABLED(HEATER_0_USES_MAX6675)
if (e == 0) return 0.25 * raw;
if (h == 0) return 0.25 * raw;
#endif
if (heater_ttbl_map[e] != NULL) {
if (heater_ttbl_map[h] != NULL) {
float celsius = 0;
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) {
celsius = PGM_RD_W((*tt)[i - 1][1]) +
(raw - PGM_RD_W((*tt)[i - 1][0])) *
......@@ -813,11 +804,14 @@ static float analog2temp(int raw, uint8_t e) {
}
// 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 ((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()
......
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