From 26405ee16f709fa8ac43664dd614b40337152426 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 31 Aug 2016 17:12:05 +0200 Subject: [PATCH] Syncing with 3.0.7 public --- Firmware/Configuration.h | 2 +- Firmware/Marlin_main.cpp | 61 ++++++++++++++----- Firmware/language_all.cpp | 4 +- Firmware/language_en.h | 2 +- Firmware/language_it.h | 2 +- Firmware/mesh_bed_calibration.cpp | 31 ++++++---- Firmware/mesh_bed_calibration.h | 1 + Firmware/ultralcd.cpp | 24 ++++++-- Firmware/ultralcd.h | 2 +- .../variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 4 +- .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 4 +- 11 files changed, 95 insertions(+), 42 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index db718603..1bfab998 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,7 +5,7 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.6" +#define FW_version "3.0.7" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index e449d15a..27a4a8d6 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -228,6 +228,8 @@ CardReader card; #endif +unsigned long TimeSent = millis(); +unsigned long TimeNow = millis(); union Data { @@ -1034,7 +1036,11 @@ void setup() // In the future, somewhere here would one compare the current firmware version against the firmware version stored in the EEPROM. // If they differ, an update procedure may need to be performed. At the end of this block, the current firmware version // is being written into the EEPROM, so the update procedure will be triggered only once. - + lang_selected = eeprom_read_byte((uint8_t*)EEPROM_LANG); + if (lang_selected >= LANG_NUM){ + lcd_mylang(); + } + if (eeprom_read_byte((uint8_t*)EEPROM_BABYSTEP_Z_SET) == 0x0ff) { // Reset the babystepping values, so the printer will not move the Z axis up when the babystepping is enabled. // eeprom_update_byte((uint8_t*)EEPROM_BABYSTEP_X, 0x0ff); @@ -1118,6 +1124,9 @@ void get_command() while (MYSERIAL.available() > 0) { char serial_char = MYSERIAL.read(); + TimeSent = millis(); + TimeNow = millis(); + if (serial_char < 0) // Ignore extended ASCII characters. These characters have no meaning in the G-code apart from the file names // and Marlin does not support such file names anyway. @@ -1243,6 +1252,23 @@ void get_command() } } // end of serial line processing loop + if(farm_mode){ + TimeNow = millis(); + if ( ((TimeNow - TimeSent) > 800) && (serial_count > 0) ) { + cmdbuffer[bufindw+serial_count+1] = 0; + + bufindw += strlen(cmdbuffer+bufindw+1) + 2; + if (bufindw == sizeof(cmdbuffer)) + bufindw = 0; + ++ buflen; + + serial_count = 0; + + SERIAL_ECHOPGM("TIMEOUT:"); + //memset(cmdbuffer, 0 , sizeof(cmdbuffer)); + return; + } + } #ifdef SDSUPPORT if(!card.sdprinting || serial_count!=0){ @@ -1363,13 +1389,13 @@ inline void set_current_to_destination() { memcpy(current_position, destination, inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); } -static void setup_for_endstop_move() { +static void setup_for_endstop_move(bool enable_endstops_now = true) { saved_feedrate = feedrate; saved_feedmultiply = feedmultiply; feedmultiply = 100; previous_millis_cmd = millis(); - enable_endstops(true); + enable_endstops(enable_endstops_now); } static void clean_up_after_endstop_move() { @@ -2382,7 +2408,7 @@ void process_commands() int Z_PROBE_FEEDRATE = homing_feedrate[Z_AXIS]/60; int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS]/40; bool has_z = is_bed_z_jitter_data_valid(); - setup_for_endstop_move(); + setup_for_endstop_move(false); const char *kill_message = NULL; while (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) { // Get coords of a measuring point. @@ -2402,16 +2428,15 @@ void process_commands() #endif } - // Move Z to proper distance + // Move Z up to MESH_HOME_Z_SEARCH. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); st_synchronize(); + // Move to XY position of the sensor point. current_position[X_AXIS] = pgm_read_float(bed_ref_points+2*mesh_point); current_position[Y_AXIS] = pgm_read_float(bed_ref_points+2*mesh_point+1); world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); -// mbl.get_meas_xy(ix, iy, current_position[X_AXIS], current_position[Y_AXIS], false); - enable_endstops(false); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], XY_AXIS_FEEDRATE, active_extruder); st_synchronize(); @@ -2438,8 +2463,8 @@ void process_commands() } current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); + st_synchronize(); if (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) { - st_synchronize(); kill(kill_message); } clean_up_after_endstop_move(); @@ -2499,12 +2524,7 @@ void process_commands() mbl.upsample_3x3(); mbl.active = 1; - current_position[X_AXIS] = X_MIN_POS+0.2; - current_position[Y_AXIS] = Y_MIN_POS+0.2; - current_position[Z_AXIS] = Z_MIN_POS; - world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); - plan_buffer_line(current_position[X_AXIS], current_position[X_AXIS], current_position[Z_AXIS], current_position[E_AXIS], XY_AXIS_FEEDRATE, active_extruder); - st_synchronize(); + go_home_with_z_lift(); // Restore custom message state custom_message = custom_message_old; @@ -4338,6 +4358,14 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp { st_synchronize(); + if (farm_mode) + + { + + prusa_statistics(22); + + } + feedmultiplyBckp=feedmultiply; int8_t TooLowZ = 0; float target[4]; @@ -4918,8 +4946,9 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s const int KILL_DELAY = 10000; #endif - if(buflen < (BUFSIZE-1)) - get_command(); + if(buflen < (BUFSIZE-1)){ + get_command(); + } if( (millis() - previous_millis_cmd) > max_inactive_time ) if(max_inactive_time) diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 867e055b..630339e5 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -325,9 +325,9 @@ const char * const MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND_LANG_TABLE[LANG MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND_PL }; -const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME_EN[] PROGMEM = "X/Z skewed severly. Skew will be corrected automatically."; +const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME_EN[] PROGMEM = "X/Y skewed severly. Skew will be corrected automatically."; const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME_CZ[] PROGMEM = "X/Y osy jsou silne zkosene. Zkoseni bude automaticky vyrovnano pri tisku."; -const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME_IT[] PROGMEM = "XYZ fortemente distorto. La distorsione verra' corretta automaticamente."; +const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME_IT[] PROGMEM = "X/Y fortemente distorto. La distorsione verra' corretta automaticamente."; const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME_ES[] PROGMEM = "X/Y muy distorsionado. La distorsion sera corregida automaticamente."; const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME_PL[] PROGMEM = "Osie X/Y sa mocno skosne. Skos bedzie aut. wyrownany przy druku."; const char * const MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME_LANG_TABLE[LANG_NUM] PROGMEM = { diff --git a/Firmware/language_en.h b/Firmware/language_en.h index f19f8c10..09414b92 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -205,7 +205,7 @@ #define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "XYZ calibration failed. Please consult the manual." #define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_PERFECT "XYZ calibration ok. X/Y axes are perpendicular." #define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_SKEW_MILD "XYZ calibration all right. X/Y axes are slightly skewed." -#define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME "X/Z skewed severly. Skew will be corrected automatically." +#define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME "X/Y skewed severly. Skew will be corrected automatically." #define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_LEFT_FAR "XYZ calibration failed. Left front calibration point not reachable." #define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR "XYZ calibration failed. Right front calibration point not reachable." #define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR "XYZ calibration failed. Front calibration points not reachable." diff --git a/Firmware/language_it.h b/Firmware/language_it.h index fefe7b06..6fcb71db 100644 --- a/Firmware/language_it.h +++ b/Firmware/language_it.h @@ -194,7 +194,7 @@ #define MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "Calibrazione XYZ fallita. Si prega di consultare il manuale." #define MSG_BED_SKEW_OFFSET_DETECTION_PERFECT "Calibrazione XYZ OK. Gli assi X/Y sono perpendicolari." #define MSG_BED_SKEW_OFFSET_DETECTION_SKEW_MILD "Calibrazione XYZ compiuta. Gli assi X/Y sono leggermente distorti." -#define MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME "XYZ fortemente distorto. La distorsione verra' corretta automaticamente." +#define MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME "X/Y fortemente distorto. La distorsione verra' corretta automaticamente." #define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_LEFT_FAR "Calibrazione XYZ fallita. Punto anteriore sinistro non raggiungibile." #define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR "Calibrazione XYZ fallita. Punto anteriore destro non raggiungibile." #define MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR "Calibrazione XYZ fallita. Punti anteriori non raggiungibili." diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 4177dc93..a4bc9fc7 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -1932,6 +1932,25 @@ canceled: return result; } +void go_home_with_z_lift() +{ + // Don't let the manage_inactivity() function remove power from the motors. + refresh_cmd_timeout(); + // Go home. + // First move up to a safe height. + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + go_to_current(homing_feedrate[Z_AXIS]/60); + // Second move to XY [0, 0]. + current_position[X_AXIS] = X_MIN_POS+0.2; + current_position[Y_AXIS] = Y_MIN_POS+0.2; + // Clamp to the physical coordinates. + world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); + go_to_current(homing_feedrate[X_AXIS]/60); + // Third move up to a safe height. + current_position[Z_AXIS] = Z_MIN_POS; + go_to_current(homing_feedrate[Z_AXIS]/60); +} + // Sample the 9 points of the bed and store them into the EEPROM as a reference. // When calling this function, the X, Y, Z axes should be already homed, // and the world2machine correction matrix should be active. @@ -2025,17 +2044,7 @@ bool sample_mesh_and_store_reference() mbl.upsample_3x3(); mbl.active = true; - // Don't let the manage_inactivity() function remove power from the motors. - refresh_cmd_timeout(); - - // Go home. - current_position[Z_AXIS] = Z_MIN_POS; - go_to_current(homing_feedrate[Z_AXIS]/60); - current_position[X_AXIS] = X_MIN_POS+0.2; - current_position[Y_AXIS] = Y_MIN_POS+0.2; - // Clamp to the physical coordinates. - world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); - go_to_current(homing_feedrate[X_AXIS]/60); + go_home_with_z_lift(); enable_endstops(endstops_enabled); enable_z_endstop(endstop_z_enabled); diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index f1f8ff7a..102fa48d 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -142,6 +142,7 @@ inline bool world2machine_clamp(float &x, float &y) extern bool find_bed_induction_sensor_point_z(float minimum_z = -10.f, uint8_t n_iter = 3); extern bool find_bed_induction_sensor_point_xy(); +extern void go_home_with_z_lift(); // Positive or zero: ok // Negative: failed diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4326b2a4..8c6375dd 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -10,6 +10,7 @@ #include #include "util.h" +#include "mesh_bed_leveling.h" //#include "Configuration.h" @@ -347,7 +348,7 @@ static void lcd_status_screen() if (langsel) { //strncpy_P(lcd_status_message, PSTR(">>>>>>>>>>>> PRESS v"), LCD_WIDTH); // Entering the language selection screen in a modal mode. - lcd_mylang(); + } } @@ -1811,9 +1812,16 @@ void prusa_statistics(int _message) { prusa_stat_temperatures(); SERIAL_ECHOLN("}"); break; - case 99: // heartbeat - SERIAL_ECHOLN("{[PRN:99]}"); - break; + case 22: // waiting for filament change + SERIAL_ECHOLN("{[PRN:5]}"); + break; + + case 99: // heartbeat + SERIAL_ECHO("{[PRN:99]"); + prusa_stat_temperatures(); + SERIAL_ECHOLN("}"); + + break; } } @@ -2266,7 +2274,7 @@ void lcd_mylang() { enc_dif = encoderDiff; - while ( (lang_selected == 255) && (MYSERIAL.available() < 2) ) { + while ( (lang_selected == 255) ) { manage_heater(); manage_inactivity(true); @@ -2658,8 +2666,14 @@ void lcd_sdcard_stop() if ((int32_t)encoderPosition == 2) { cancel_heatup = true; + #ifdef MESH_BED_LEVELING + mbl.active = false; + #endif // Stop the stoppers, update the position from the stoppers. planner_abort_hard(); + // Because the planner_abort_hard() initialized current_position[Z] from the stepper, + // Z baystep is no more applied. Reset it. + babystep_reset(); // Clean the input command queue. cmdqueue_reset(); lcd_setstatuspgm(MSG_PRINT_ABORTED); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index c24d9f3e..19563849 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -28,7 +28,7 @@ void lcd_sdcard_stop(); void prusa_statistics(int _message); void lcd_confirm_print(); - +void lcd_mylang(); bool lcd_detected(void); static void lcd_selftest(); diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index dd797bde..2c49e68a 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -34,13 +34,13 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Home position #define MANUAL_X_HOME_POS 0 #define MANUAL_Y_HOME_POS -2.2 -#define MANUAL_Z_HOME_POS 0.2 +#define MANUAL_Z_HOME_POS 0.15 // Travel limits after homing #define X_MAX_POS 255 #define X_MIN_POS 0 #define Y_MAX_POS 210 -#define Y_MIN_POS -4 +#define Y_MIN_POS -2.2 #define Z_MAX_POS 210 #define Z_MIN_POS 0.15 diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 4a9c7371..c7e3ecb8 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -34,13 +34,13 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Home position #define MANUAL_X_HOME_POS 0 #define MANUAL_Y_HOME_POS -2.2 -#define MANUAL_Z_HOME_POS 0.2 +#define MANUAL_Z_HOME_POS 0.15 // Travel limits after homing #define X_MAX_POS 255 #define X_MIN_POS 0 #define Y_MAX_POS 210 -#define Y_MIN_POS -4 +#define Y_MIN_POS -2.2 #define Z_MAX_POS 210 #define Z_MIN_POS 0.15