From 3f96dea4f96f52021f81e72d8243c9f211cc2d36 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Mon, 10 Dec 2018 07:09:03 -0700 Subject: [PATCH 001/368] make all shell scripts executable --- Firmware/le.sh | 0 lang/config.sh | 0 lang/fw-clean.sh | 0 lang/lang-add.sh | 0 lang/lang-check.sh | 0 lang/lang-clean.sh | 0 lang/lang-export.sh | 0 lang/lang-import.sh | 0 8 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 Firmware/le.sh mode change 100644 => 100755 lang/config.sh mode change 100644 => 100755 lang/fw-clean.sh mode change 100644 => 100755 lang/lang-add.sh mode change 100644 => 100755 lang/lang-check.sh mode change 100644 => 100755 lang/lang-clean.sh mode change 100644 => 100755 lang/lang-export.sh mode change 100644 => 100755 lang/lang-import.sh diff --git a/Firmware/le.sh b/Firmware/le.sh old mode 100644 new mode 100755 diff --git a/lang/config.sh b/lang/config.sh old mode 100644 new mode 100755 diff --git a/lang/fw-clean.sh b/lang/fw-clean.sh old mode 100644 new mode 100755 diff --git a/lang/lang-add.sh b/lang/lang-add.sh old mode 100644 new mode 100755 diff --git a/lang/lang-check.sh b/lang/lang-check.sh old mode 100644 new mode 100755 diff --git a/lang/lang-clean.sh b/lang/lang-clean.sh old mode 100644 new mode 100755 diff --git a/lang/lang-export.sh b/lang/lang-export.sh old mode 100644 new mode 100755 diff --git a/lang/lang-import.sh b/lang/lang-import.sh old mode 100644 new mode 100755 From 52d81bb4d85c4df99c65348f26db8ab7f361a8a1 Mon Sep 17 00:00:00 2001 From: Craig Link Date: Mon, 31 Dec 2018 17:51:16 -0800 Subject: [PATCH 002/368] set array size correctly to 4 --- Firmware/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 15f3f4c5f..0933d4cd1 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -229,7 +229,7 @@ inline bool parse_version_P(const char *str, uint16_t version[4]) // 1 - yes, 0 - false, -1 - error; inline int8_t is_provided_version_newer(const char *version_string) { - uint16_t ver_gcode[3], ver_current[3]; + uint16_t ver_gcode[4], ver_current[4]; if (! parse_version(version_string, ver_gcode)) return -1; if (! parse_version_P(FW_VERSION_STR, ver_current)) From c1f85e4cc4bfaa42a7ddc5a8669b6e4b38ffd666 Mon Sep 17 00:00:00 2001 From: Eric Schlenz Date: Tue, 22 Jan 2019 08:52:18 -0700 Subject: [PATCH 003/368] Fixes some of the language/typos in the README.md --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b7fc1155e..deb26de0c 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ # Build ## Linux -Run shell script build.sh to build for MK3 and flash with Sli3er. -If you have different printel model, follow step [2.b](#2b) from Windows build first. +Run shell script build.sh to build for MK3 and flash with Slic3er. +If you have a different printer model, follow step [2.b](#2b) from Windows build first. If you wish to flash from Arduino, follow step [2.c](#2c) from Windows build first. The script downloads Arduino with our modifications and Rambo board support installed, unpacks it into folder PF-build-env-\ on the same level, as your Prusa-Firmware folder is located, builds firmware for MK3 using that Arduino in Prusa-Firmware-build folder on the same level as Prusa-Firmware, runs secondary language support scripts. Firmware with secondary language support is generated in lang subfolder. Use firmware.hex for MK3 variant. Use firmware_\.hex for other printers. Don't forget to follow step [2.b](#2b) first for non-MK3 printers. @@ -34,11 +34,11 @@ type location or you can 'manually' modify the item `"boardsmanager.additional.urls=....."` at the file `"preferences.txt"` (this parameter allows you to write a comma-separated list of addresses) -_note: you can find location of this file on your disk by following way: +_note: you can find location of this file on your disk by doing the following: `File->Preferences->Settings` (`"More preferences can be edited in file ..."`)_ -than do it +then choose `Tools->Board->BoardsManager` -from viewed list select an item `"RAMBo"` (will probably be labeled as `"RepRap Arduino-compatible Mother Board (RAMBo) by UltiMachine"` +from viewed list and select the item labeled `"RAMBo"` (will probably be labeled as `"RepRap Arduino-compatible Mother Board (RAMBo) by UltiMachine"` _note: select this item for any variant of board used in printers `'Prusa i3 MKx'`, that is for `RAMBo-mini x.y` and `EINSy x.y` to_ 'clicking' the item will display the installation button; select choice `"1.0.1"` from the list(last known version as of the date of issue of this document) _(after installation, the item is labeled as `"INSTALLED"` and can then be used for target board selection)_ @@ -57,7 +57,7 @@ b. In the subdirectory `"Firmware/variants/"` select the config c. In file `"Firmware/config.h"` set LANG_MODE to 0. -run `"Arduino IDE"`; select the file `"Firmware.ino"` from the subdirectory `"Firmware/"` at the location, where you placed the source codes +run `"Arduino IDE"`; select the file `"Firmware.ino"` from the subdirectory `"Firmware/"` at the location, where you placed the source code `File->Open` make the desired code customizations; **all changes are on your own risk!** @@ -85,7 +85,7 @@ cmake build system - ninja or gnu make ## Building -Create folder where you want to build tests. +Create a folder where you want to build tests. Example: From a220c97f94832de2b71bec5a962df505e788ebdf Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Feb 2019 16:19:30 +0100 Subject: [PATCH 004/368] Revert "variant files" This reverts commit 850d3316b6ab048bfa869383628d5b2fd7f3b75b. --- .../1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 505 ++++++++++++++ .../1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 506 ++++++++++++++ .../variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 631 ++++++++++++++++++ 3 files changed, 1642 insertions(+) create mode 100644 Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h create mode 100644 Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h create mode 100644 Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h new file mode 100644 index 000000000..53b545e8b --- /dev/null +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -0,0 +1,505 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +#include +/*------------------------------------ + GENERAL SETTINGS + *------------------------------------*/ + +// Printer revision +#define PRINTER_TYPE PRINTER_MK25S +#define FILAMENT_SIZE "1_75mm_MK25S" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK2.5S" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_0 + +#define HEATBED_V2 +#define STEEL_SHEET +#define TACH0PULLUP + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ + AXIS SETTINGS + *------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,133} + +// Endstop inverting +#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. + +// Direction inverting +#define INVERT_X_DIR 0 // for Mendel set to 0, for Orca set to 1 +#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0 +#define INVERT_Z_DIR 0 // for Mendel set to 0, for Orca set to 1 +#define INVERT_E0_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E1_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E2_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.2 + +// Travel limits after homing +#define X_MAX_POS 250 +#define X_MIN_POS 0 +#define Y_MAX_POS 210 +#define Y_MIN_POS -4 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000 + +/** + * [0,0] steel sheet print area point X coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_X 0.f +/** + * [0,0] steel sheet print area point Y coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_Y 0.f + +#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203) +#define DEFAULT_MAX_FEEDRATE_SILENT {172, 172, 12, 120} // (mm/sec) max feedrate (M203), silent mode +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201) +#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode + +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S) +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T) + +#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) + +//number of bytes from end of the file to start check +#define END_FILE_SECTION 20000 + +#define Z_AXIS_ALWAYS_ON 1 + +// New XYZ calibration +#define NEW_XYZCAL + +// Fan check +#define FANCHECK + +// Safety timer +#define SAFETYTIMER +#define DEFAULT_SAFETYTIMER_TIME_MINS 30 + +// Filament sensor +#define FILAMENT_SENSOR +#define IR_SENSOR + + +#define DEBUG_DCODE3 + +//#define DEBUG_BUILD +#ifdef DEBUG_BUILD +//#define _NO_ASM +#define DEBUG_DCODES //D codes +#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR +//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial +//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored +//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored +//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored +//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored +//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored +//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored +//#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored +//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored +//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line +//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed +//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) +//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) +//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line +//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. +//#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +//#define CMD_DIAGNOSTICS //Show cmd queue length on printer display +#endif /* DEBUG_BUILD */ + +//#define FSENSOR_QUALITY + + +/*------------------------------------ + EXTRUDER SETTINGS + *------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 30 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_MINTEMP_DELAY 15000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if HEATER_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see HEATER_MINTEMP_DELAY definition)" +#endif +#define BED_MINTEMP 30 +#define BED_MINTEMP_DELAY 50000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if BED_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)" +#endif + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 125 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +//#define DEFAULT_Kp 40.925 +//#define DEFAULT_Ki 4.875 +//#define DEFAULT_Kd 86.085 +#define DEFAULT_Kp 16.13 +#define DEFAULT_Ki 1.1625 +#define DEFAULT_Kd 56.23 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 175 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + +/*------------------------------------ + LOAD/UNLOAD FILAMENT SETTINGS + *------------------------------------*/ + +// Load filament commands +#define LOAD_FILAMENT_0 "M83" +#define LOAD_FILAMENT_1 "G1 E70 F400" +#define LOAD_FILAMENT_2 "G1 E40 F100" + +// Unload filament commands +#define UNLOAD_FILAMENT_0 "M83" +#define UNLOAD_FILAMENT_1 "G1 E-80 F7000" + +/*------------------------------------ + CHANGE FILAMENT SETTINGS + *------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +//#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_RFEED 7000 / 60 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ + ADDITIONAL FEATURES SETTINGS + *------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ + MOTOR CURRENT SETTINGS + *------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == BOARD_RAMBO_MINI_1_0 || MOTHERBOARD == BOARD_RAMBO_MINI_1_3 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#define Z_SILENT 0 +#define Z_HIGH_POWER 200 +#endif + +/*------------------------------------ + BED SETTINGS + *------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +// Maximum bed level correction value +#define BED_ADJUSTMENT_UM_MAX 100 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- + PREHEAT SETTINGS + *------------------------------------*/ + +#define FARM_PREHEAT_HOTEND_TEMP 250 +#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_FAN_SPEED 0 + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 60 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 230 +#define PET_PREHEAT_HPB_TEMP 85 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 240 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ + THERMISTORS SETTINGS + *------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif +#define TEMP_SENSOR_PINDA 1 + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 20 +#define PINDA_PREHEAT_Y 60 +#define PINDA_PREHEAT_Z 0.15 +/* +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1*/ +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring +#define NC_BUTTON_LONG_PRESS 15 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#define MIN_PRINT_FAN_SPEED 75 + + +#define M600_TIMEOUT 600 //seconds + +//#define SUPPORT_VERBOSITY + +#define MMU_REQUIRED_FW_BUILDNR 132 +//#define MMU_DEBUG //print communication between MMU2 and printer on serial + +#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning + +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h new file mode 100644 index 000000000..e786b70ff --- /dev/null +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -0,0 +1,506 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +#include +/*------------------------------------ + GENERAL SETTINGS + *------------------------------------*/ + +// Printer revision +#define PRINTER_TYPE PRINTER_MK25S +#define FILAMENT_SIZE "1_75mm_MK25" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK2.5S" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_3 + +#define HEATBED_V2 +#define STEEL_SHEET +#define TACH0PULLUP + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ + AXIS SETTINGS + *------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,133} + +// Endstop inverting +#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. + +// Direction inverting +#define INVERT_X_DIR 0 // for Mendel set to 0, for Orca set to 1 +#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0 +#define INVERT_Z_DIR 0 // for Mendel set to 0, for Orca set to 1 +#define INVERT_E0_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E1_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E2_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.2 + +// Travel limits after homing +#define X_MAX_POS 250 +#define X_MIN_POS 0 +#define Y_MAX_POS 210 +#define Y_MIN_POS -4 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000 + +/** + * [0,0] steel sheet print area point X coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_X 0.f +/** + * [0,0] steel sheet print area point Y coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_Y 0.f + +#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203) +#define DEFAULT_MAX_FEEDRATE_SILENT {172, 172, 12, 120} // (mm/sec) max feedrate (M203), silent mode +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201) +#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode + + +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S) +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T) + +#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) + +//number of bytes from end of the file to start check +#define END_FILE_SECTION 20000 + +#define Z_AXIS_ALWAYS_ON 1 + +// New XYZ calibration +#define NEW_XYZCAL + +// Fan check +#define FANCHECK + +// Safety timer +#define SAFETYTIMER +#define DEFAULT_SAFETYTIMER_TIME_MINS 30 + +// Filament sensor +#define FILAMENT_SENSOR +#define IR_SENSOR + + +#define DEBUG_DCODE3 + +//#define DEBUG_BUILD +#ifdef DEBUG_BUILD +//#define _NO_ASM +#define DEBUG_DCODES //D codes +#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR +//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial +//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored +//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored +//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored +//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored +//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored +//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored +//#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored +//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored +//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line +//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed +//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) +//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) +//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line +//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. +//#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +//#define CMD_DIAGNOSTICS //Show cmd queue length on printer display +#endif /* DEBUG_BUILD */ + +//#define FSENSOR_QUALITY + + +/*------------------------------------ + EXTRUDER SETTINGS + *------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 30 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_MINTEMP_DELAY 15000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if HEATER_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see HEATER_MINTEMP_DELAY definition)" +#endif +#define BED_MINTEMP 30 +#define BED_MINTEMP_DELAY 50000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if BED_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)" +#endif + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 125 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +//#define DEFAULT_Kp 40.925 +//#define DEFAULT_Ki 4.875 +//#define DEFAULT_Kd 86.085 +#define DEFAULT_Kp 16.13 +#define DEFAULT_Ki 1.1625 +#define DEFAULT_Kd 56.23 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 175 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + +/*------------------------------------ + LOAD/UNLOAD FILAMENT SETTINGS + *------------------------------------*/ + +// Load filament commands +#define LOAD_FILAMENT_0 "M83" +#define LOAD_FILAMENT_1 "G1 E70 F400" +#define LOAD_FILAMENT_2 "G1 E40 F100" + +// Unload filament commands +#define UNLOAD_FILAMENT_0 "M83" +#define UNLOAD_FILAMENT_1 "G1 E-80 F7000" + +/*------------------------------------ + CHANGE FILAMENT SETTINGS + *------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +//#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_RFEED 7000 / 60 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ + ADDITIONAL FEATURES SETTINGS + *------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ + MOTOR CURRENT SETTINGS + *------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == BOARD_RAMBO_MINI_1_0 || MOTHERBOARD == BOARD_RAMBO_MINI_1_3 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#define Z_SILENT 0 +#define Z_HIGH_POWER 200 +#endif + +/*------------------------------------ + BED SETTINGS + *------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +// Maximum bed level correction value +#define BED_ADJUSTMENT_UM_MAX 100 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- + PREHEAT SETTINGS + *------------------------------------*/ + +#define FARM_PREHEAT_HOTEND_TEMP 250 +#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_FAN_SPEED 0 + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 60 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 230 +#define PET_PREHEAT_HPB_TEMP 85 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 240 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ + THERMISTORS SETTINGS + *------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif +#define TEMP_SENSOR_PINDA 1 + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 20 +#define PINDA_PREHEAT_Y 60 +#define PINDA_PREHEAT_Z 0.15 +/* +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1*/ +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring +#define NC_BUTTON_LONG_PRESS 15 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#define MIN_PRINT_FAN_SPEED 75 + + +#define M600_TIMEOUT 600 //seconds + +//#define SUPPORT_VERBOSITY + +#define MMU_REQUIRED_FW_BUILDNR 132 +//#define MMU_DEBUG //print communication between MMU2 and printer on serial + +#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning + +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h new file mode 100644 index 000000000..37512071c --- /dev/null +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -0,0 +1,631 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +#include +/*------------------------------------ + GENERAL SETTINGS + *------------------------------------*/ + +// Printer revision +#define PRINTER_TYPE PRINTER_MK3S +#define FILAMENT_SIZE "1_75mm_MK3" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK3S" + +// Electronics +#define MOTHERBOARD BOARD_EINSY_1_0a +#define STEEL_SHEET +#define HAS_SECOND_SERIAL_PORT + + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ + AXIS SETTINGS + *------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140} +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,280} +//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,560} + +// Endstop inverting +#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. + +// Direction inverting +#define INVERT_X_DIR 1 // for Mendel set to 0, for Orca set to 1 +#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0 +#define INVERT_Z_DIR 1 // for Mendel set to 0, for Orca set to 1 +#define INVERT_E0_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E1_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E2_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.2 + +// Travel limits after homing +#define X_MAX_POS 255 +#define X_MIN_POS 0 +#define Y_MAX_POS 212.5 +#define Y_MIN_POS -4 //orig -4 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000 + +//#define DEFAULT_Y_OFFSET 4.f // Default distance of Y_MIN_POS point from endstop, when the printer is not calibrated. +/** + * [0,0] steel sheet print area point X coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_X 0.f +/** + * [0,0] steel sheet print area point Y coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_Y -2.f + +#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203) +#define DEFAULT_MAX_FEEDRATE_SILENT {100, 100, 12, 120} // (mm/sec) max feedrate (M203), silent mode + +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201) +#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode + + +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S) +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T) + +#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) + +//Silent mode limits +#define SILENT_MAX_ACCEL_XY 960ul // max acceleration in silent mode in mm/s^2 +#define SILENT_MAX_FEEDRATE_XY 100 // max feedrate in mm/s + +//Normal mode limits +#define NORMAL_MAX_ACCEL_XY 2500ul // max acceleration in normal mode in mm/s^2 +#define NORMAL_MAX_FEEDRATE_XY 200 // max feedrate in mm/s + +//number of bytes from end of the file to start check +#define END_FILE_SECTION 20000 + +#define Z_AXIS_ALWAYS_ON 1 + +//Crash detection +#define CRASHDET_TIMER 45 //seconds +#define CRASHDET_COUNTER_MAX 3 + +// New XYZ calibration +#define NEW_XYZCAL + +// Watchdog support +#define WATCHDOG + +// Power panic +#define UVLO_SUPPORT + +// Fan check +#define FANCHECK + +// Safety timer +#define SAFETYTIMER +#define DEFAULT_SAFETYTIMER_TIME_MINS 30 + +// Filament sensor +#define FILAMENT_SENSOR +#define IR_SENSOR + +// Backlash - +//#define BACKLASH_X +//#define BACKLASH_Y + + +// Minimum ambient temperature limit to start triggering MINTEMP errors [C] +// this value is litlebit higher that real limit, because ambient termistor is on the board and is temperated from it, +// temperature inside the case is around 31C for ambient temperature 25C, when the printer is powered on long time and idle +// the real limit is 15C (same as MINTEMP limit), this is because 15C is end of scale for both used thermistors (bed, heater) +#define MINTEMP_MINAMBIENT 25 +#define MINTEMP_MINAMBIENT_RAW 978 + +#define DEBUG_DCODE3 + +//#define DEBUG_BUILD +//#define DEBUG_SEC_LANG //secondary language debug output at startup +//#define DEBUG_W25X20CL //debug external spi flash +#ifdef DEBUG_BUILD +//#define _NO_ASM +#define DEBUG_DCODES //D codes +#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR +//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial +//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored +//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored +//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored +//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored +//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored +//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored +#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored +//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored +//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line +//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed +//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_DISABLE_FORCE_SELFTEST //disable force selftest +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) +//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) +//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled) +#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line +#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. +#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +#define CMD_DIAGNOSTICS //Show cmd queue length on printer display +#endif /* DEBUG_BUILD */ + +//#define FSENSOR_QUALITY + + +#define LINEARITY_CORRECTION +#define TMC2130_LINEARITY_CORRECTION +#define TMC2130_LINEARITY_CORRECTION_XYZ +//#define TMC2130_VARIABLE_RESOLUTION + + + +/*------------------------------------ + TMC2130 default settings + *------------------------------------*/ + +#define TMC2130_FCLK 12000000 // fclk = 12MHz + +#define TMC2130_USTEPS_XY 16 // microstep resolution for XY axes +#define TMC2130_USTEPS_Z 16 // microstep resolution for Z axis +#define TMC2130_USTEPS_E 32 // microstep resolution for E axis +#define TMC2130_INTPOL_XY 1 // extrapolate 256 for XY axes +#define TMC2130_INTPOL_Z 1 // extrapolate 256 for Z axis +#define TMC2130_INTPOL_E 1 // extrapolate 256 for E axis + +#define TMC2130_PWM_GRAD_X 2 // PWMCONF +#define TMC2130_PWM_AMPL_X 230 // PWMCONF +#define TMC2130_PWM_AUTO_X 1 // PWMCONF +#define TMC2130_PWM_FREQ_X 2 // PWMCONF + +#define TMC2130_PWM_GRAD_Y 2 // PWMCONF +#define TMC2130_PWM_AMPL_Y 235 // PWMCONF +#define TMC2130_PWM_AUTO_Y 1 // PWMCONF +#define TMC2130_PWM_FREQ_Y 2 // PWMCONF + +#define TMC2130_PWM_GRAD_Z 4 // PWMCONF +#define TMC2130_PWM_AMPL_Z 200 // PWMCONF +#define TMC2130_PWM_AUTO_Z 1 // PWMCONF +#define TMC2130_PWM_FREQ_Z 2 // PWMCONF + +#define TMC2130_PWM_GRAD_E 4 // PWMCONF +#define TMC2130_PWM_AMPL_E 240 // PWMCONF +#define TMC2130_PWM_AUTO_E 1 // PWMCONF +#define TMC2130_PWM_FREQ_E 2 // PWMCONF + +#define TMC2130_TOFF_XYZ 3 // CHOPCONF // fchop = 27.778kHz +#define TMC2130_TOFF_E 3 // CHOPCONF // fchop = 27.778kHz +//#define TMC2130_TOFF_E 4 // CHOPCONF // fchop = 21.429kHz +//#define TMC2130_TOFF_E 5 // CHOPCONF // fchop = 17.442kHz + +//#define TMC2130_STEALTH_E // Extruder stealthChop mode +//#define TMC2130_CNSTOFF_E // Extruder constant-off-time mode (similar to MK2) + +//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk) + +#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode +#define TMC2130_THIGH 0 // THIGH - unused + +//#define TMC2130_TCOOLTHRS_X 450 // TCOOLTHRS - coolstep treshold +//#define TMC2130_TCOOLTHRS_Y 450 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_X 430 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_Y 430 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_Z 500 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_E 500 // TCOOLTHRS - coolstep treshold + +#define TMC2130_SG_HOMING 1 // stallguard homing +#define TMC2130_SG_THRS_X 3 // stallguard sensitivity for X axis +#define TMC2130_SG_THRS_Y 3 // stallguard sensitivity for Y axis +#define TMC2130_SG_THRS_Z 4 // stallguard sensitivity for Z axis +#define TMC2130_SG_THRS_E 3 // stallguard sensitivity for E axis + +//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only) +#define TMC2130_CURRENTS_H {16, 20, 35, 30} // default holding currents for all axes +#define TMC2130_CURRENTS_R {16, 20, 35, 30} // default running currents for all axes +#define TMC2130_UNLOAD_CURRENT_R 12 // lowe current for M600 to protect filament sensor + +#define TMC2130_STEALTH_Z + +//#define TMC2130_SERVICE_CODES_M910_M918 + +//#define TMC2130_DEBUG +//#define TMC2130_DEBUG_WR +//#define TMC2130_DEBUG_RD + + +/*------------------------------------ + EXTRUDER SETTINGS + *------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 15 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_MINTEMP_DELAY 15000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if HEATER_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see HEATER_MINTEMP_DELAY definition)" +#endif +#define BED_MINTEMP 15 +#define BED_MINTEMP_DELAY 50000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if BED_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)" +#endif + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 125 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +//#define DEFAULT_Kp 40.925 +//#define DEFAULT_Ki 4.875 +//#define DEFAULT_Kd 86.085 +#define DEFAULT_Kp 16.13 +#define DEFAULT_Ki 1.1625 +#define DEFAULT_Kd 56.23 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 175 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + + +/*------------------------------------ + LOAD/UNLOAD FILAMENT SETTINGS + *------------------------------------*/ + +// Load filament commands +#define LOAD_FILAMENT_0 "M83" +#define LOAD_FILAMENT_1 "G1 E70 F400" +#define LOAD_FILAMENT_2 "G1 E40 F100" + +// Unload filament commands +#define UNLOAD_FILAMENT_0 "M83" +#define UNLOAD_FILAMENT_1 "G1 E-80 F7000" + +/*------------------------------------ + CHANGE FILAMENT SETTINGS + *------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +//#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_RFEED 7000 / 60 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ + ADDITIONAL FEATURES SETTINGS + *------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ + MOTOR CURRENT SETTINGS + *------------------------------------*/ + +// Motor Current settings for Einsy/tmc = 0..63 +#define MOTOR_CURRENT_PWM_RANGE 63 + +/*------------------------------------ + BED SETTINGS + *------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +// Maximum bed level correction value +#define BED_ADJUSTMENT_UM_MAX 100 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + +//connect message when communication with monitoring broken +//#define FARM_CONNECT_MESSAGE + +/*----------------------------------- + PREHEAT SETTINGS + *------------------------------------*/ + +#define FARM_PREHEAT_HOTEND_TEMP 250 +#define FARM_PREHEAT_HPB_TEMP 60 +#define FARM_PREHEAT_FAN_SPEED 0 + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 60 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 230 +#define PET_PREHEAT_HPB_TEMP 85 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 240 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ + THERMISTORS SETTINGS + *------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif +#define TEMP_SENSOR_PINDA 1 +#define TEMP_SENSOR_AMBIENT 2000 + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 20 +#define PINDA_PREHEAT_Y 60 +#define PINDA_PREHEAT_Z 0.15 +/* +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1*/ +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring +#define NC_BUTTON_LONG_PRESS 15 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#define MIN_PRINT_FAN_SPEED 75 + + +// How much shall the print head be lifted on power panic? +// Ideally the Z axis will reach a zero phase of the stepper driver on power outage. To simplify this, +// UVLO_Z_AXIS_SHIFT shall be an integer multiply of the stepper driver cycle, that is 4x full step. +// For example, the Prusa i3 MK2 with 16 microsteps per full step has Z stepping of 400 microsteps per mm. +// At 400 microsteps per mm, a full step lifts the Z axis by 0.04mm, and a stepper driver cycle is 0.16mm. +// The following example, 12 * (4 * 16 / 400) = 12 * 0.16mm = 1.92mm. +//#define UVLO_Z_AXIS_SHIFT 1.92 +#define UVLO_Z_AXIS_SHIFT 0.64 +// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 + +#define HEATBED_V2 + +#define M600_TIMEOUT 600 //seconds + +//#define SUPPORT_VERBOSITY + +#define MMU_REQUIRED_FW_BUILDNR 83 +#define MMU_HWRESET +#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning + +#endif //__CONFIGURATION_PRUSA_H From 63c8a361853c45ad98c10dd4faf5fa4b38d632b7 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Feb 2019 16:27:44 +0100 Subject: [PATCH 005/368] typo fixed --- Firmware/ultralcd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 16b077dae..b26b1c96c 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -181,9 +181,9 @@ enum class testScreen static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_scale, bool _clear, int _delay); static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator); static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite); -#ifdef FAN_CHECK +#ifdef FANCHECK static bool lcd_selftest_fan_dialog(int _fan); -#endif //FAN_CHECk +#endif //FANCHECK static bool lcd_selftest_fsensor(); static bool selftest_irsensor(); static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2); From c704a4b7abefe627553f55fd98ececa869ceb8f1 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 6 Feb 2019 18:25:45 +0100 Subject: [PATCH 006/368] Fix menu stack overrun. --- Firmware/menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 89fadb663..b7ae1d5e4 100644 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -120,7 +120,7 @@ void menu_back_if_clicked_fb(void) void menu_submenu(menu_func_t submenu) { - if (menu_depth <= MENU_DEPTH_MAX) + if (menu_depth < MENU_DEPTH_MAX) { menu_stack[menu_depth].menu = menu_menu; menu_stack[menu_depth++].position = lcd_encoder; @@ -130,7 +130,7 @@ void menu_submenu(menu_func_t submenu) static void menu_submenu_no_reset(menu_func_t submenu) { - if (menu_depth <= MENU_DEPTH_MAX) + if (menu_depth < MENU_DEPTH_MAX) { menu_stack[menu_depth].menu = menu_menu; menu_stack[menu_depth++].position = lcd_encoder; From de9c87c5925bf53e3f1f1dab43b0e53489dcf295 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Feb 2019 19:38:52 +0100 Subject: [PATCH 007/368] welcome message changed --- Firmware/messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 4cac4f2d0..7943d2208 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -96,7 +96,7 @@ const char MSG_WIZARD_DONE[] PROGMEM_I1 = ISTR("All is done. Happy printing!"); const char MSG_WIZARD_HEATING[] PROGMEM_I1 = ISTR("Preheating nozzle. Please wait."); ////c=20 r=3 const char MSG_WIZARD_QUIT[] PROGMEM_I1 = ISTR("You can always resume the Wizard from Calibration -> Wizard."); ////c=20 r=8 const char MSG_YES[] PROGMEM_I1 = ISTR("Yes"); ////c=0 r=0 -const char WELCOME_MSG[] PROGMEM_I1 = ISTR(CUSTOM_MENDEL_NAME " ready."); ////c=20 r=0 +const char WELCOME_MSG[] PROGMEM_I1 = ISTR(CUSTOM_MENDEL_NAME " OK."); ////c=20 r=0 //not internationalized messages const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; ////c=0 r=0 const char MSG_BROWNOUT_RESET[] PROGMEM_N1 = " Brown out Reset"; ////c=0 r=0 From a85d8e7f97863c992cec6695998e4861619d7fe7 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Feb 2019 21:36:21 +0100 Subject: [PATCH 008/368] message change --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b26b1c96c..8c2b52813 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2264,7 +2264,7 @@ static void lcd_support_menu() MENU_ITEM_BACK_P(STR_SEPARATOR); MENU_ITEM_SUBMENU_P(_i("XYZ cal. details"), lcd_menu_xyz_y_min);////MSG_XYZ_DETAILS c=19 r=1 MENU_ITEM_SUBMENU_P(_i("Extruder info"), lcd_menu_extruder_info);////MSG_INFO_EXTRUDER c=18 r=1 - MENU_ITEM_SUBMENU_P(_i("Sensors info"), lcd_menu_show_sensors_state);////MSG_INFO_SENSORS c=18 r=1 + MENU_ITEM_SUBMENU_P(_i("Sensor info"), lcd_menu_show_sensors_state);////MSG_INFO_SENSORS c=18 r=1 #ifdef TMC2130 MENU_ITEM_SUBMENU_P(_i("Belt status"), lcd_menu_belt_status);////MSG_MENU_BELT_STATUS c=18 r=1 From ff52499bdc9839936e81fc0ea35b81c466953f9d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Feb 2019 22:56:10 +0100 Subject: [PATCH 009/368] extr fan RPM measuring fix --- Firmware/temperature.cpp | 7 +++++++ Firmware/ultralcd.cpp | 8 +++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 8dcfc9a9c..e156734b8 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -2070,10 +2070,17 @@ else { // ambient temperature is stan #if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1)) void check_fans() { +#ifdef FAN_SOFT_PWM + if (READ(TACH_0) != fan_state[0]) { + if(fan_measuring) fan_edge_counter[0] ++; + fan_state[0] = !fan_state[0]; + } +#else //FAN_SOFT_PWM if (READ(TACH_0) != fan_state[0]) { fan_edge_counter[0] ++; fan_state[0] = !fan_state[0]; } +#endif //if (READ(TACH_1) != fan_state[1]) { // fan_edge_counter[1] ++; // fan_state[1] = !fan_state[1]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8c2b52813..9614c9a4d 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -7352,15 +7352,13 @@ static bool lcd_selftest_fan_dialog(int _fan) setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, 1); //extruder fan #ifdef FAN_SOFT_PWM extruder_autofan_last_check = _millis(); + fan_measuring = true; #endif //FAN_SOFT_PWM _delay(2000); //delay_keep_alive would turn off extruder fan, because temerature is too low -#ifdef FAN_SOFT_PWM - countFanSpeed(); - if (!fan_speed[0]) _result = false; -#else //FAN_SOFT_PWM + manage_heater(); //count average fan speed from 2s delay and turn off fans if (!fan_speed[0]) _result = false; -#endif //FAN_SOFT_PWM + printf_P(PSTR("Test 1:\n")); printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]); From e028db7bf906fbc2707569168d758acf41676066 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Feb 2019 23:30:01 +0100 Subject: [PATCH 010/368] version change --- Firmware/Configuration.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 37b7f6be9..48b99140f 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,13 +7,13 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.5.1" -#define FW_COMMIT_NR 1778 +#define FW_VERSION "3.5.3" +#define FW_COMMIT_NR 1971 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN #define FW_REPOSITORY "Unknown" -#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) +#define FW_VERSION_FULL FW_VERSION //"-" STR(FW_COMMIT_NR) // Debug version has debugging enabled (the symbol DEBUG_BUILD is set). // The debug build may be a bit slower than the non-debug build, therefore the debug build should From 38b0e5439b910c21d45cdd78e9a8ee1b757dea26 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Feb 2019 23:52:24 +0100 Subject: [PATCH 011/368] version change --- Firmware/Configuration.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 48b99140f..ee7c1e93d 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -8,12 +8,12 @@ // Firmware version #define FW_VERSION "3.5.3" -#define FW_COMMIT_NR 1971 +#define FW_COMMIT_NR 1990 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. -#define FW_DEV_VERSION FW_VERSION_UNKNOWN +#define FW_DEV_VERSION FW_VERSION_GOLD #define FW_REPOSITORY "Unknown" -#define FW_VERSION_FULL FW_VERSION //"-" STR(FW_COMMIT_NR) +#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) // Debug version has debugging enabled (the symbol DEBUG_BUILD is set). // The debug build may be a bit slower than the non-debug build, therefore the debug build should From 065d56b2c6404ab2280f83e8b9088f1675e908ff Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Feb 2019 23:58:30 +0100 Subject: [PATCH 012/368] version change --- Firmware/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index ee7c1e93d..9b00b7962 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -13,7 +13,7 @@ // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_GOLD #define FW_REPOSITORY "Unknown" -#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) +#define FW_VERSION_FULL FW_VERSION // "-" STR(FW_COMMIT_NR) // Debug version has debugging enabled (the symbol DEBUG_BUILD is set). // The debug build may be a bit slower than the non-debug build, therefore the debug build should From ccc542d74aa3c0c662e31e14ead796014507255d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 11 Feb 2019 14:32:21 +0100 Subject: [PATCH 013/368] MK2.5 IR_SENSOR_PIN modified --- Firmware/pins_Rambo_1_0.h | 2 +- Firmware/pins_Rambo_1_3.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/pins_Rambo_1_0.h b/Firmware/pins_Rambo_1_0.h index b973fd302..bb6eb026d 100644 --- a/Firmware/pins_Rambo_1_0.h +++ b/Firmware/pins_Rambo_1_0.h @@ -102,7 +102,7 @@ #define SDCARDDETECT 72 -#define IR_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8) +#define IR_SENSOR_PIN 20 //idler sensor // Support for an 8 bit logic analyzer, for example the Saleae. // Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop. diff --git a/Firmware/pins_Rambo_1_3.h b/Firmware/pins_Rambo_1_3.h index d684519e2..c1adf5969 100644 --- a/Firmware/pins_Rambo_1_3.h +++ b/Firmware/pins_Rambo_1_3.h @@ -102,7 +102,7 @@ #define SDCARDDETECT 15 -#define IR_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8) +#define IR_SENSOR_PIN 20 //idler sensor // Support for an 8 bit logic analyzer, for example the Saleae. // Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop. From b85661309feb4b1e0405e95d2598b1a4755771cc Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 11 Feb 2019 16:38:36 +0100 Subject: [PATCH 014/368] configuration change --- Firmware/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 9b00b7962..2a33e9418 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -11,7 +11,7 @@ #define FW_COMMIT_NR 1990 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. -#define FW_DEV_VERSION FW_VERSION_GOLD +#define FW_DEV_VERSION FW_VERSION_UNKNOWN #define FW_REPOSITORY "Unknown" #define FW_VERSION_FULL FW_VERSION // "-" STR(FW_COMMIT_NR) From 62500f0b5538f9d5334c3cb0f94bf6a135b148e6 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 12 Feb 2019 10:39:09 +0100 Subject: [PATCH 015/368] version changed --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index d2732a1da..832a64e6d 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.5.2-RC1" -#define FW_COMMIT_NR 1993 +#define FW_VERSION "3.5.2" +#define FW_COMMIT_NR 1999 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From 4c7639323194f33d606516cf38c3f7a90a41c927 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 12 Feb 2019 13:44:50 +0100 Subject: [PATCH 016/368] version change --- Firmware/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 2a33e9418..14104521e 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -8,7 +8,7 @@ // Firmware version #define FW_VERSION "3.5.3" -#define FW_COMMIT_NR 1990 +#define FW_COMMIT_NR 2007 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From ef1f82627e022b6c9a66193bf1bd7ec0735228b0 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 13 Feb 2019 23:53:00 +0100 Subject: [PATCH 017/368] preHeat @ filament load / unload / autoLoad / MMU MMU options added --- Firmware/Marlin_main.cpp | 5 +- Firmware/mmu.cpp | 8 ++- Firmware/ultralcd.cpp | 115 ++++++++++++++++++++++++++++++--------- Firmware/ultralcd.h | 5 +- 4 files changed, 102 insertions(+), 31 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 4853a4e99..e8cfd8fc1 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7468,7 +7468,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { - if ((mcode_in_progress != 600) && (!bFilamentAutoloadFlag)) //M600 not in progress, preHeat @ autoLoad menu not active + if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { @@ -7486,9 +7486,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s } else { - bFilamentLoad=true; // i.e. filament loading mode + eFilamentAction=e_FILAMENT_ACTION_autoLoad; bFilamentFirstRun=false; - bFilamentAutoloadFlag=true; if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2321b8528..aa6d9d8e0 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1057,7 +1057,13 @@ void extr_unload() } else { - show_preheat_nozzle_warning(); + eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0]); + } + else menu_submenu(mFilamentMenu); } //lcd_return_to_status(); } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f9e5d12c0..12e448eb9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -141,6 +141,9 @@ static void lcd_menu_fails_stats_mmu_print(); static void lcd_menu_fails_stats_mmu_total(); static void lcd_menu_show_sensors_state(); +static void mmu_fil_eject_menu(); +static void mmu_load_to_nozzle_menu(); + #if defined(TMC2130) || defined(FILAMENT_SENSOR) static void lcd_menu_fails_stats(); #endif //TMC2130 or FILAMENT_SENSOR @@ -1781,7 +1784,7 @@ void lcd_return_to_status() lcd_refresh(); // to maybe revive the LCD if static electricity killed it. menu_goto(lcd_status_screen, 0, false, true); menu_depth = 0; - bFilamentAutoloadFlag=false; + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } //! @brief Pause print, disable nozzle heater, move to park position @@ -2297,21 +2300,32 @@ void lcd_set_filament_oq_meass() } +eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized as 'non-autoLoad' bool bFilamentFirstRun; -bool bFilamentLoad; bool bFilamentPreheatState; -bool bFilamentAutoloadFlag; static void mFilamentPrompt() { lcd_set_cursor(0,0); lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); lcd_set_cursor(0,2); -lcd_puts_P(_i("Press the knob")); +lcd_puts_P(_i("Press the knob")); ////MSG_ c=20 r=1 lcd_set_cursor(0,3); -if(bFilamentLoad) - lcd_puts_P(_i("to load filament")); -else lcd_puts_P(_i("to unload filament")); +switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_mmuLoad: + lcd_puts_P(_i("to load filament")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_unLoad: + case e_FILAMENT_ACTION_mmuUnLoad: + lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_mmuEject: + lcd_puts_P(_i("to eject filament")); ////MSG_ c=20 r=1 + break; + } if(lcd_clicked()) { menu_back(); @@ -2321,15 +2335,29 @@ if(lcd_clicked()) menu_back(); setTargetHotend0(0.0); } - if(bFilamentLoad) + switch(eFilamentAction) { - loading_flag = true; - enquecommand_P(PSTR("M701")); // load filament + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + loading_flag = true; + enquecommand_P(PSTR("M701")); // load filament + break; + case e_FILAMENT_ACTION_unLoad: + enquecommand_P(PSTR("M702")); // unload filament + break; + case e_FILAMENT_ACTION_mmuLoad: + menu_submenu(mmu_load_to_nozzle_menu); + break; + case e_FILAMENT_ACTION_mmuUnLoad: + extr_unload(); + break; + case e_FILAMENT_ACTION_mmuEject: + menu_submenu(mmu_fil_eject_menu); + break; } - else enquecommand_P(PSTR("M702")); // unload filament + if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } -if(bFilamentLoad) // i.e. not necessary for preHeat @ unload - bFilamentAutoloadFlag=false; } void mFilamentItem(uint16_t nTemp) @@ -2343,11 +2371,23 @@ lcd_timeoutToStatus.stop(); lcd_set_cursor(0,0); lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); lcd_set_cursor(0,1); -if(bFilamentLoad) - lcd_puts_P(_i("Preheating to load")); -else lcd_puts_P(_i("Preheating to unload")); +switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_mmuLoad: + lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_unLoad: + case e_FILAMENT_ACTION_mmuUnLoad: + lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_mmuEject: + lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 + break; + } lcd_set_cursor(0,3); -lcd_puts_P(_i(">Cancel")); +lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1 if(lcd_clicked()) { if(!bFilamentPreheatState) @@ -2357,8 +2397,8 @@ if(lcd_clicked()) } else setTargetHotend0((float)nTargetOld); menu_back(); - if(bFilamentLoad) // i.e. not necessary for preHeat @ unload - bFilamentAutoloadFlag=false; + if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } else if(!isHeatingHotend0()) { @@ -2407,8 +2447,8 @@ mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP); void mFilamentBack() { menu_back(); -if(bFilamentLoad) // i.e. not necessary for preHeat @ unload - bFilamentAutoloadFlag=false; +if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } void mFilamentMenu() @@ -2433,7 +2473,7 @@ if((degHotend0()>EXTRUDE_MINTEMP)&&bFilamentFirstRun) enquecommand_P(PSTR("M702")); // unload filament } else { - bFilamentLoad=false; // i.e. filament unloading mode + eFilamentAction=e_FILAMENT_ACTION_unLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -2666,7 +2706,7 @@ static void lcd_LoadFilament() } else { - bFilamentLoad=true; // i.e. filament loading mode + eFilamentAction=e_FILAMENT_ACTION_Load; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -5578,6 +5618,8 @@ static void fil_load_menu() } static void mmu_load_to_nozzle_menu() +{ +if (degHotend0() > EXTRUDE_MINTEMP) { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); @@ -5588,8 +5630,21 @@ static void mmu_load_to_nozzle_menu() MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle_4); MENU_END(); } +else { + eFilamentAction=e_FILAMENT_ACTION_mmuLoad; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0]); + } + else mFilamentMenu(); + } +} static void mmu_fil_eject_menu() +{ +if (degHotend0() > EXTRUDE_MINTEMP) { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); @@ -5598,9 +5653,19 @@ static void mmu_fil_eject_menu() MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_fil_2); MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_fil_3); MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_fil_4); - MENU_END(); } +else { + eFilamentAction=e_FILAMENT_ACTION_mmuEject; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0]); + } + else mFilamentMenu(); + } +} #ifdef SNMM static void fil_unload_menu() @@ -6071,7 +6136,7 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); - MENU_ITEM_GCODE_P(_T(MSG_UNLOAD_FILAMENT), PSTR("M702 C")); + MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); } else { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index c692de537..bf3e4697b 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -133,10 +133,11 @@ void extr_unload_used(); #endif //SNMM void extr_unload(); +typedef enum + {e_FILAMENT_ACTION_none,e_FILAMENT_ACTION_Load,e_FILAMENT_ACTION_autoLoad,e_FILAMENT_ACTION_unLoad,e_FILAMENT_ACTION_mmuLoad,e_FILAMENT_ACTION_mmuUnLoad,e_FILAMENT_ACTION_mmuEject} eFILAMENT_ACTION; // 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) +extern eFILAMENT_ACTION eFilamentAction; extern bool bFilamentFirstRun; -extern bool bFilamentLoad; extern bool bFilamentPreheatState; -extern bool bFilamentAutoloadFlag; void mFilamentItem(uint16_t nTemp); void mFilamentMenu(); void unload_filament(); From 4835b9b2206b180e4e4f2781b79843e096d337e1 Mon Sep 17 00:00:00 2001 From: Laurentiu Date: Thu, 14 Feb 2019 10:57:58 +0200 Subject: [PATCH 018/368] 7x7 points mesh bed leveling --- Firmware/Marlin_main.cpp | 113 +++++++++++++++++------------- Firmware/eeprom.h | 2 + Firmware/mesh_bed_calibration.cpp | 62 ++++++---------- Firmware/mesh_bed_calibration.h | 23 +++++- Firmware/mesh_bed_leveling.cpp | 72 ------------------- Firmware/temperature.cpp | 6 +- 6 files changed, 114 insertions(+), 164 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 08df94088..66a54f453 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4230,8 +4230,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) current_position[Z_AXIS] = 5; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); - current_position[X_AXIS] = pgm_read_float(bed_ref_points); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1); + current_position[X_AXIS] = BED_X0; + current_position[Y_AXIS] = BED_Y0; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); st_synchronize(); @@ -4261,8 +4261,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } current_position[Z_AXIS] = 5; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); - current_position[X_AXIS] = pgm_read_float(bed_ref_points); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1); + current_position[X_AXIS] = BED_X0; + current_position[Y_AXIS] = BED_Y0; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); st_synchronize(); find_bed_induction_sensor_point_z(-1.f); @@ -4380,6 +4380,21 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; } + uint8_t nMeasPoints = MESH_MEAS_NUM_X_POINTS; + if (code_seen('N')) { + nMeasPoints = code_value_uint8(); + if (nMeasPoints != 7) { + nMeasPoints = 3; + } + } + + uint8_t nProbeRetry = 3; + if (code_seen('R')) { + nProbeRetry = code_value_uint8(); + if (nProbeRetry > 10) { + nProbeRetry = 3; + } + } bool temp_comp_start = true; #ifdef PINDA_THERMISTOR @@ -4408,7 +4423,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; custom_message_type = CUSTOM_MSG_TYPE_MESHBL; - custom_message_state = (MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) + 10; + custom_message_state = (nMeasPoints * nMeasPoints) + 10; lcd_update(1); mbl.reset(); //reset mesh bed leveling @@ -4422,8 +4437,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) 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], homing_feedrate[Z_AXIS] / 60, active_extruder); // The move to the first calibration point. - current_position[X_AXIS] = pgm_read_float(bed_ref_points); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1); + current_position[X_AXIS] = BED_X0; + current_position[Y_AXIS] = BED_Y0; #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 1) @@ -4431,20 +4446,16 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) bool clamped = world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); clamped ? SERIAL_PROTOCOLPGM("First calibration point clamped.\n") : SERIAL_PROTOCOLPGM("No clamping for first calibration point.\n"); } - #endif //SUPPORT_VERBOSITY - // mbl.get_meas_xy(0, 0, current_position[X_AXIS], current_position[Y_AXIS], false); + #endif //SUPPORT_VERBOSITY plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS] / 30, active_extruder); // Wait until the move is finished. st_synchronize(); - int mesh_point = 0; //index number of calibration point - - int ix = 0; - int iy = 0; + uint8_t mesh_point = 0; //index number of calibration point int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20; int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40; - bool has_z = is_bed_z_jitter_data_valid(); //checks if we have data from Z calibration (offsets of the Z heiths of the 8 calibration points from the first point) + bool has_z = (nMeasPoints == 3) && is_bed_z_jitter_data_valid(); //checks if we have data from Z calibration (offsets of the Z heiths of the 8 calibration points from the first point) #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 1) { has_z ? SERIAL_PROTOCOLPGM("Z jitter data from Z cal. valid.\n") : SERIAL_PROTOCOLPGM("Z jitter data from Z cal. not valid.\n"); @@ -4452,13 +4463,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) #endif // SUPPORT_VERBOSITY int l_feedmultiply = setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100 const char *kill_message = NULL; - while (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) { + while (mesh_point != nMeasPoints * nMeasPoints) { // Get coords of a measuring point. - ix = mesh_point % MESH_MEAS_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 - iy = mesh_point / MESH_MEAS_NUM_X_POINTS; - if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; // Zig zag + uint8_t ix = mesh_point % nMeasPoints; // from 0 to MESH_NUM_X_POINTS - 1 + uint8_t iy = mesh_point / nMeasPoints; + if (iy & 1) ix = (nMeasPoints - 1) - ix; // Zig zag float z0 = 0.f; - if (has_z && mesh_point > 0) { + if (has_z && (mesh_point > 0)) { uint16_t z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1))); z0 = mbl.z_values[0][0] + *reinterpret_cast(&z_offset_u) * 0.01; //#if 0 @@ -4481,8 +4492,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) 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); + current_position[X_AXIS] = BED_X(ix, nMeasPoints); + current_position[Y_AXIS] = BED_Y(iy, nMeasPoints); @@ -4500,7 +4511,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // Go down until endstop is hit const float Z_CALIBRATION_THRESHOLD = 1.f; - if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point + if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point kill_message = _T(MSG_BED_LEVELING_FAILED_POINT_LOW); break; } @@ -4553,7 +4564,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) #endif // SUPPORT_VERBOSITY 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) { + if (mesh_point != nMeasPoints * nMeasPoints) { Sound_MakeSound(e_SOUND_TYPE_StandardAlert); bool bState; do { // repeat until Z-leveling o.k. @@ -4631,34 +4642,40 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) float offset = float(correction) * 0.001f; switch (i) { case 0: - for (uint8_t row = 0; row < 3; ++row) { - mbl.z_values[row][1] += 0.5f * offset; - mbl.z_values[row][0] += offset; + for (uint8_t row = 0; row < nMeasPoints; ++row) { + for (uint8_t col = 0; col < nMeasPoints - 1; ++col) { + mbl.z_values[row][col] += offset * (nMeasPoints - 1 - col) / (nMeasPoints - 1); + } } break; case 1: - for (uint8_t row = 0; row < 3; ++row) { - mbl.z_values[row][1] += 0.5f * offset; - mbl.z_values[row][2] += offset; + for (uint8_t row = 0; row < nMeasPoints; ++row) { + for (uint8_t col = 1; col < nMeasPoints; ++col) { + mbl.z_values[row][col] += offset * col / (nMeasPoints - 1); + } } break; case 2: - for (uint8_t col = 0; col < 3; ++col) { - mbl.z_values[1][col] += 0.5f * offset; - mbl.z_values[0][col] += offset; + for (uint8_t col = 0; col < nMeasPoints; ++col) { + for (uint8_t row = 0; row < nMeasPoints; ++row) { + mbl.z_values[row][col] += offset * (nMeasPoints - 1 - row) / (nMeasPoints - 1); + } } break; case 3: - for (uint8_t col = 0; col < 3; ++col) { - mbl.z_values[1][col] += 0.5f * offset; - mbl.z_values[2][col] += offset; + for (uint8_t col = 0; col < nMeasPoints; ++col) { + for (uint8_t row = 1; row < nMeasPoints; ++row) { + mbl.z_values[row][col] += offset * row / (nMeasPoints - 1); + } } break; } } } // SERIAL_ECHOLNPGM("Bed leveling correction finished"); - mbl.upsample_3x3(); //bilinear interpolation from 3x3 to 7x7 points while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them) + if (nMeasPoints == 3) { + mbl.upsample_3x3(); //bilinear interpolation from 3x3 to 7x7 points while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them) + } // SERIAL_ECHOLNPGM("Upsample finished"); mbl.active = 1; //activate mesh bed leveling // SERIAL_ECHOLNPGM("Mesh bed leveling activated"); @@ -8404,13 +8421,13 @@ void uvlo_() // Move Z up to the next 0th full step. // Write the file position. eeprom_update_dword((uint32_t*)(EEPROM_FILE_POSITION), sd_position); - // Store the mesh bed leveling offsets. This is 2*9=18 bytes, which takes 18*3.4us=52us in worst case. - for (int8_t mesh_point = 0; mesh_point < 9; ++ mesh_point) { - uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 - uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; + // Store the mesh bed leveling offsets. This is 2*7*7=98 bytes, which takes 98*3.4us=333us in worst case. + for (int8_t mesh_point = 0; mesh_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS; ++ mesh_point) { + uint8_t ix = mesh_point % MESH_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 + uint8_t iy = mesh_point / MESH_NUM_X_POINTS; // Scale the z value to 1u resolution. - int16_t v = mbl.active ? int16_t(floor(mbl.z_values[iy*3][ix*3] * 1000.f + 0.5f)) : 0; - eeprom_update_word((uint16_t*)(EEPROM_UVLO_MESH_BED_LEVELING+2*mesh_point), *reinterpret_cast(&v)); + int16_t v = mbl.active ? int16_t(floor(mbl.z_values[iy][ix] * 1000.f + 0.5f)) : 0; + eeprom_update_word((uint16_t*)(EEPROM_UVLO_MESH_BED_LEVELING_FULL +2*mesh_point), *reinterpret_cast(&v)); } // Read out the current Z motor microstep counter. This will be later used // for reaching the zero full step before powering off. @@ -8633,20 +8650,18 @@ void recover_machine_state_after_power_panic(bool bTiny) // 2) Initialize the logical to physical coordinate system transformation. world2machine_initialize(); - // 3) Restore the mesh bed leveling offsets. This is 2*9=18 bytes, which takes 18*3.4us=52us in worst case. + // 3) Restore the mesh bed leveling offsets. This is 2*7*7=98 bytes, which takes 98*3.4us=333us in worst case. mbl.active = false; - for (int8_t mesh_point = 0; mesh_point < 9; ++ mesh_point) { - uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 - uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; + for (int8_t mesh_point = 0; mesh_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS; ++ mesh_point) { + uint8_t ix = mesh_point % MESH_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 + uint8_t iy = mesh_point / MESH_NUM_X_POINTS; // Scale the z value to 10u resolution. int16_t v; - eeprom_read_block(&v, (void*)(EEPROM_UVLO_MESH_BED_LEVELING+2*mesh_point), 2); + eeprom_read_block(&v, (void*)(EEPROM_UVLO_MESH_BED_LEVELING_FULL+2*mesh_point), 2); if (v != 0) mbl.active = true; mbl.z_values[iy][ix] = float(v) * 0.001f; } - if (mbl.active) - mbl.upsample_3x3(); // SERIAL_ECHOPGM("recover_machine_state_after_power_panic, initial "); // print_mesh_bed_leveling_table(); diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 9f878796e..eb99e5bca 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -154,6 +154,8 @@ #define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t #define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t +#define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_LOAD_FAIL - 1000 - 12*12*2) //allow 12 calibration points for future expansion +//-1000 is to be compatible with future updates from prusa if it not merged, real value is 2503 so there is space // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 35798c2e5..2813945ca 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -23,8 +23,7 @@ float world2machine_shift[2]; #define WEIGHT_FIRST_ROW_Y_HIGH (0.3f) #define WEIGHT_FIRST_ROW_Y_LOW (0.0f) -#define BED_ZERO_REF_X (- 22.f + X_PROBE_OFFSET_FROM_EXTRUDER) // -22 + 23 = 1 -#define BED_ZERO_REF_Y (- 0.6f + Y_PROBE_OFFSET_FROM_EXTRUDER + 4.f) // -0.6 + 5 + 4 = 8.4 + // Scaling of the real machine axes against the programmed dimensions in the firmware. // The correction is tiny, here around 0.5mm on 250mm length. @@ -89,19 +88,6 @@ const float bed_ref_points_4[] PROGMEM = { 210.4f - BED_PRINT_ZERO_REF_Y - Y_PROBE_OFFSET_FROM_EXTRUDER - SHEET_PRINT_ZERO_REF_Y }; -const float bed_ref_points[] PROGMEM = { - 13.f - BED_ZERO_REF_X, 10.4f - BED_ZERO_REF_Y, - 115.f - BED_ZERO_REF_X, 10.4f - BED_ZERO_REF_Y, - 216.f - BED_ZERO_REF_X, 10.4f - BED_ZERO_REF_Y, - - 216.f - BED_ZERO_REF_X, 106.4f - BED_ZERO_REF_Y, - 115.f - BED_ZERO_REF_X, 106.4f - BED_ZERO_REF_Y, - 13.f - BED_ZERO_REF_X, 106.4f - BED_ZERO_REF_Y, - - 13.f - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y, - 115.f - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y, - 216.f - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y -}; #else // Positions of the bed reference points in the machine coordinates, referenced to the P.I.N.D.A sensor. @@ -113,22 +99,9 @@ const float bed_ref_points_4[] PROGMEM = { 13.f - BED_ZERO_REF_X, 104.4f - BED_ZERO_REF_Y }; -const float bed_ref_points[] PROGMEM = { - 13.f - BED_ZERO_REF_X, 8.4f - BED_ZERO_REF_Y, - 115.f - BED_ZERO_REF_X, 8.4f - BED_ZERO_REF_Y, - 216.f - BED_ZERO_REF_X, 8.4f - BED_ZERO_REF_Y, - - 216.f - BED_ZERO_REF_X, 104.4f - BED_ZERO_REF_Y, - 115.f - BED_ZERO_REF_X, 104.4f - BED_ZERO_REF_Y, - 13.f - BED_ZERO_REF_X, 104.4f - BED_ZERO_REF_Y, - - 13.f - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y, - 115.f - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y, - 216.f - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y -}; - #endif //not HEATBED_V2 + static inline float sqr(float x) { return x * x; } #ifdef HEATBED_V2 @@ -2428,8 +2401,11 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level refresh_cmd_timeout(); // Go to the measurement point. // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). - current_position[X_AXIS] = pgm_read_float(bed_ref_points + mesh_point * 2); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points + mesh_point * 2 + 1); + uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 + uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; + if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; + current_position[X_AXIS] = BED_X(ix, MESH_MEAS_NUM_X_POINTS); + current_position[Y_AXIS] = BED_Y(iy, MESH_MEAS_NUM_X_POINTS); go_to_current(homing_feedrate[X_AXIS] / 60); delay_keep_alive(3000); } @@ -2806,8 +2782,8 @@ bool sample_mesh_and_store_reference() // The first point defines the reference. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; go_to_current(homing_feedrate[Z_AXIS]/60); - current_position[X_AXIS] = pgm_read_float(bed_ref_points); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points+1); + current_position[X_AXIS] = BED_X0; + current_position[Y_AXIS] = BED_Y0; world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); go_to_current(homing_feedrate[X_AXIS]/60); memcpy(destination, current_position, sizeof(destination)); @@ -2836,8 +2812,11 @@ bool sample_mesh_and_store_reference() // Print the decrasing ID of the measurement point. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; go_to_current(homing_feedrate[Z_AXIS]/60); - 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); + int8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; + int8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; + if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; // Zig zag + current_position[X_AXIS] = BED_X(ix, MESH_MEAS_NUM_X_POINTS); + current_position[Y_AXIS] = BED_Y(iy, MESH_MEAS_NUM_Y_POINTS); world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); go_to_current(homing_feedrate[X_AXIS]/60); #ifdef MESH_BED_CALIBRATION_SHOW_LCD @@ -2852,9 +2831,7 @@ bool sample_mesh_and_store_reference() return false; } // Get cords of measuring point - int8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; - int8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; - if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; // Zig zag + mbl.set_z(ix, iy, current_position[Z_AXIS]); } { @@ -2956,8 +2933,13 @@ bool scan_bed_induction_points(int8_t verbosity_level) go_to_current(homing_feedrate[Z_AXIS]/60); // Go to the measurement point. // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). - current_position[X_AXIS] = vec_x[0] * pgm_read_float(bed_ref_points+mesh_point*2) + vec_y[0] * pgm_read_float(bed_ref_points+mesh_point*2+1) + cntr[0]; - current_position[Y_AXIS] = vec_x[1] * pgm_read_float(bed_ref_points+mesh_point*2) + vec_y[1] * pgm_read_float(bed_ref_points+mesh_point*2+1) + cntr[1]; + uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 + uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; + if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; + float bedX = BED_X(ix, MESH_MEAS_NUM_X_POINTS); + float bedY = BED_Y(iy, MESH_MEAS_NUM_X_POINTS); + current_position[X_AXIS] = vec_x[0] * bedX + vec_y[0] * bedY + cntr[0]; + current_position[Y_AXIS] = vec_x[1] * bedX + vec_y[1] * bedY + cntr[1]; // The calibration points are very close to the min Y. if (current_position[Y_AXIS] < Y_MIN_POS_FOR_BED_CALIBRATION) current_position[Y_AXIS] = Y_MIN_POS_FOR_BED_CALIBRATION; diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index d928f1d11..4990d104b 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -1,10 +1,31 @@ #ifndef MESH_BED_CALIBRATION_H #define MESH_BED_CALIBRATION_H +#define BED_ZERO_REF_X (- 22.f + X_PROBE_OFFSET_FROM_EXTRUDER) // -22 + 23 = 1 +#define BED_ZERO_REF_Y (- 0.6f + Y_PROBE_OFFSET_FROM_EXTRUDER + 4.f) // -0.6 + 5 + 4 = 8.4 + +#ifdef HEATBED_V2 + +#define BED_X0 (13.f - BED_ZERO_REF_X) +#define BED_Y0 (10.4f - BED_ZERO_REF_Y) +#define BED_Xn (216.f - BED_ZERO_REF_X) +#define BED_Yn (202.4f - BED_ZERO_REF_Y) + +#else + +#define BED_X0 (13.f - BED_ZERO_REF_X) +#define BED_Y0 (8.4f - BED_ZERO_REF_Y) +#define BED_Xn (216.f - BED_ZERO_REF_X) +#define BED_Yn (202.4f - BED_ZERO_REF_Y) + +#endif //not HEATBED_V2 + +#define BED_X(i, n) ((float)i * (BED_Xn - BED_X0) / (n - 1) + BED_X0) +#define BED_Y(i, n) ((float)i * (BED_Yn - BED_Y0) / (n - 1) + BED_Y0) + // Exact positions of the print head above the bed reference points, in the world coordinates. // The world coordinates match the machine coordinates only in case, when the machine // is built properly, the end stops are at the correct positions and the axes are perpendicular. -extern const float bed_ref_points[] PROGMEM; extern const float bed_ref_points_4[] PROGMEM; extern const float bed_skew_angle_mild; diff --git a/Firmware/mesh_bed_leveling.cpp b/Firmware/mesh_bed_leveling.cpp index 746458aea..344d41e3f 100644 --- a/Firmware/mesh_bed_leveling.cpp +++ b/Firmware/mesh_bed_leveling.cpp @@ -21,78 +21,6 @@ static inline bool vec_undef(const float v[2]) return vx[0] == 0x0FFFFFFFF || vx[1] == 0x0FFFFFFFF; } -void mesh_bed_leveling::get_meas_xy(int ix, int iy, float &x, float &y, bool /*use_default*/) -{ -#if 0 - float cntr[2] = { - eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+0)), - eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+4)) - }; - float vec_x[2] = { - eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +0)), - eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +4)) - }; - float vec_y[2] = { - eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +0)), - eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +4)) - }; - - if (use_default || vec_undef(cntr) || vec_undef(vec_x) || vec_undef(vec_y)) { - // Default, uncorrected positions of the calibration points. Works well for correctly built printers. - x = float(MESH_MIN_X) + float(MEAS_NUM_X_DIST) * float(ix) - X_PROBE_OFFSET_FROM_EXTRUDER; - //FIXME - //x -= 5.f; - y = float(MESH_MIN_Y) + float(MEAS_NUM_Y_DIST) * float(iy) - Y_PROBE_OFFSET_FROM_EXTRUDER; - } else { -#if 0 - SERIAL_ECHO("Running bed leveling. Calibration data: "); - SERIAL_ECHO(cntr[0]); - SERIAL_ECHO(","); - SERIAL_ECHO(cntr[1]); - SERIAL_ECHO(", x: "); - SERIAL_ECHO(vec_x[0]); - SERIAL_ECHO(","); - SERIAL_ECHO(vec_x[1]); - SERIAL_ECHO(", y: "); - SERIAL_ECHO(vec_y[0]); - SERIAL_ECHO(","); - SERIAL_ECHO(vec_y[1]); - SERIAL_ECHOLN(""); -#endif - - x = cntr[0]; - y = cntr[1]; - if (ix < 1) { - x -= vec_x[0]; - y -= vec_x[1]; - } else if (ix > 1) { - x += vec_x[0]; - y += vec_x[1]; - } - if (iy < 1) { - x -= vec_y[0]; - y -= vec_y[1]; - } else if (iy > 1) { - x += vec_y[0]; - y += vec_y[1]; - } - -#if 0 - SERIAL_ECHO("Calibration point position: "); - SERIAL_ECHO(x); - SERIAL_ECHO(","); - SERIAL_ECHO(y); - SERIAL_ECHOLN(""); -#endif - } -#else - // Default, uncorrected positions of the calibration points. - // This coordinate will be corrected by the planner. - x = pgm_read_float(bed_ref_points + 2 * (iy * 3 + ix)); - y = pgm_read_float(bed_ref_points + 2 * (iy * 3 + ix) + 1); -#endif -} - #if MESH_NUM_X_POINTS>=5 && MESH_NUM_Y_POINTS>=5 && (MESH_NUM_X_POINTS&1)==1 && (MESH_NUM_Y_POINTS&1)==1 // Works for an odd number of MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index e156734b8..c8de4104a 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -55,7 +55,8 @@ int current_temperature_raw[EXTRUDERS] = { 0 }; float current_temperature[EXTRUDERS] = { 0.0 }; #ifdef PINDA_THERMISTOR -int current_temperature_raw_pinda = 0 ; +uint16_t current_temperature_raw_pinda = 0 ; //value with more averaging applied +uint16_t current_temperature_raw_pinda_fast = 0; //value read from adc float current_temperature_pinda = 0.0; #endif //PINDA_THERMISTOR @@ -1031,6 +1032,7 @@ static void updateTemperaturesFromRawValues() } #ifdef PINDA_THERMISTOR + current_temperature_raw_pinda = (uint16_t)((uint32_t)current_temperature_raw_pinda * 3 + current_temperature_raw_pinda_fast) >> 2; current_temperature_pinda = analog2tempBed(current_temperature_raw_pinda); #endif @@ -1596,7 +1598,7 @@ extern "C" { void adc_ready(void) //callback from adc when sampling finished { current_temperature_raw[0] = adc_values[ADC_PIN_IDX(TEMP_0_PIN)]; //heater - current_temperature_raw_pinda = adc_values[ADC_PIN_IDX(TEMP_PINDA_PIN)]; + current_temperature_raw_pinda_fast = adc_values[ADC_PIN_IDX(TEMP_PINDA_PIN)]; current_temperature_bed_raw = adc_values[ADC_PIN_IDX(TEMP_BED_PIN)]; #ifdef VOLT_PWR_PIN current_voltage_raw_pwr = adc_values[ADC_PIN_IDX(VOLT_PWR_PIN)]; From 0c1f9b5100b9daf6a57dae07e71cb54b7bf6f508 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Fri, 15 Feb 2019 02:25:44 +0100 Subject: [PATCH 019/368] preHeat @ filament management target temperature keeping --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2f0a1d8b0..5f63d4e5e 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2336,7 +2336,7 @@ if(lcd_clicked()) if(!bFilamentPreheatState) { menu_back(); - setTargetHotend0(0.0); +//-// setTargetHotend0(0.0); } switch(eFilamentAction) { From 0f791ce47f55f1b5e8fcdd3ca7bb0f011087adfd Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 15 Feb 2019 14:17:47 +0100 Subject: [PATCH 020/368] mmu needs attention: idler error fix --- Firmware/mmu.cpp | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 5d4b9eecd..cd38a81c8 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -22,7 +22,7 @@ #define MMU_TODELAY 100 #define MMU_TIMEOUT 10 -#define MMU_CMD_TIMEOUT 45000ul //5min timeout for mmu commands (except P0) +#define MMU_CMD_TIMEOUT 45000ul //45s timeout for mmu commands (except P0) #define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds #define MMU_MAX_RESEND_ATTEMPTS 2 @@ -41,7 +41,7 @@ uint8_t mmu_cmd = 0; //idler ir sensor uint8_t mmu_idl_sens = 0; bool ir_sensor_detected = false; -bool mmu_loading_flag = false; +bool mmu_loading_flag = false; //when set to true, we assume that mmu2 unload was finished and loading phase is now performed; printer can send 'A' to mmu2 to abort loading process uint8_t mmu_extruder = MMU_FILAMENT_UNKNOWN; @@ -258,7 +258,7 @@ void mmu_loop(void) printf_P(PSTR("MMU <= 'L%d'\n"), filament); #endif //MMU_DEBUG mmu_printf_P(PSTR("L%d\n"), filament); - mmu_state = 3; // wait for response + mmu_state = 3; // wait for response } else if (mmu_cmd == MMU_CMD_C0) { @@ -320,6 +320,20 @@ void mmu_loop(void) } return; case 2: //response to command P0 + if (mmu_idl_sens) + { + if (PIN_GET(IR_SENSOR_PIN) == 0 && mmu_loading_flag) + { +#ifdef MMU_DEBUG + printf_P(PSTR("MMU <= 'A'\n")); +#endif //MMU_DEBUG + mmu_puts_P(PSTR("A\n")); //send 'abort' request + mmu_idl_sens = 0; + //printf_P(PSTR("MMU IDLER_SENSOR = 0 - ABORT\n")); + } + //else + //printf_P(PSTR("MMU IDLER_SENSOR = 1 - WAIT\n")); + } if (mmu_rx_ok() > 0) { fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer @@ -489,11 +503,21 @@ bool can_extrude() return true; } +static void get_response_print_info(uint8_t move) { + printf_P(PSTR("mmu_get_response - begin move: "), move); + switch (move) { + case MMU_LOAD_MOVE: printf_P(PSTR("load\n")); break; + case MMU_UNLOAD_MOVE: printf_P(PSTR("unload\n")); break; + case MMU_TCODE_MOVE: printf_P(PSTR("T-code\n")); break; + case MMU_NO_MOVE: printf_P(PSTR("no move\n")); break; + default: printf_P(PSTR("error: unknown move\n")); break; + } +} + bool mmu_get_response(uint8_t move) { - mmu_loading_flag = false; - printf_P(PSTR("mmu_get_response - begin move:%d\n"), move); + get_response_print_info(move); KEEPALIVE_STATE(IN_PROCESS); while (mmu_cmd != 0) { @@ -547,7 +571,7 @@ bool mmu_get_response(uint8_t move) disable_e0(); //turn off E-stepper to prevent overheating and alow filament pull-out if necessary delay_keep_alive(MMU_LOAD_TIME_MS); move = MMU_LOAD_MOVE; - printf_P(PSTR("mmu_get_response - begin move:%d\n"), move); + get_response_print_info(move); } break; case MMU_NO_MOVE: @@ -586,7 +610,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move) float x_position_bckp = current_position[X_AXIS]; float y_position_bckp = current_position[Y_AXIS]; uint8_t screen = 0; //used for showing multiscreen messages - + mmu_loading_flag = false; while(!response) { response = mmu_get_response(move); //wait for "ok" from mmu @@ -661,6 +685,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move) } else if (mmu_print_saved) { printf_P(PSTR("MMU starts responding\n")); + mmu_loading_flag = false; if (turn_off_nozzle) { lcd_clear(); From 69ff37729ebc9d8f73bd4afe6e966de9ce8731d4 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 15 Feb 2019 14:19:30 +0100 Subject: [PATCH 021/368] whitespace --- Firmware/mmu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index cd38a81c8..e0f960189 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -320,7 +320,7 @@ void mmu_loop(void) } return; case 2: //response to command P0 - if (mmu_idl_sens) + if (mmu_idl_sens) { if (PIN_GET(IR_SENSOR_PIN) == 0 && mmu_loading_flag) { From d0e3e9d2e274a002e94acf5759bd664e0eb585d5 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Fri, 15 Feb 2019 16:26:47 +0100 Subject: [PATCH 022/368] Build firmware under Windows 10 64-bit ... using Linux subsystem Ubuntu or git-bash --- README.md | 49 +++++ build.sh | 496 +++++++++++++++++++++++++++++++++++++++++-- prepare_winbuild.ps1 | 6 + 3 files changed, 533 insertions(+), 18 deletions(-) create mode 100644 prepare_winbuild.ps1 diff --git a/README.md b/README.md index b7fc1155e..0f428980d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,55 @@ If you wish to flash from Arduino, follow step [2.c](#2c) from Windows build fir The script downloads Arduino with our modifications and Rambo board support installed, unpacks it into folder PF-build-env-\ on the same level, as your Prusa-Firmware folder is located, builds firmware for MK3 using that Arduino in Prusa-Firmware-build folder on the same level as Prusa-Firmware, runs secondary language support scripts. Firmware with secondary language support is generated in lang subfolder. Use firmware.hex for MK3 variant. Use firmware_\.hex for other printers. Don't forget to follow step [2.b](#2b) first for non-MK3 printers. ## Windows +### If you want to use the automated `build.sh` you gonna need to install on you Windows a Linux subsystem or Git-bash + +###Steps for Linux subsystem und Windows 10 64-bit: +- follow the Microsoft guide https://docs.microsoft.com/en-us/windows/wsl/install-win10 + You can also use the 'prepare_winbuild.ps1' powershell script with Administrator rights +- Tested versions are at this moment + - Ubuntu other may different + - After the installation and reboot please open your Ubuntu bash and do following steps + - run command `apt-get update` + - to install zip run `apt-get install zip` + - add few lines at the top of `~/.bashrc` by running `sudo nano ~/.bashrc` + + export OS="Linux" + export JAVA_TOOL_OPTIONS="-Djava.net.preferIPv4Stack=true" + export GPG_TTY=$(tty) + + use `CRTL-X` to close nano and confirm to write the new entries + - restart Ubuntu bash +Now your Ubuntu subsystem is ready to use the automatic `build.sh` script and compile your firmware correctly + +####Some Tips for Ubuntu +- Linux is case sensetive so please don't forget to use capital letters where needed, like changing to a directory +- To change the path to your Prusa-Firmware location you downloaded and unzipped + - Example: You files are under `C:\Users\\Downloads\Prusa-Firmware-MK3` + - use under Ubuntu the following command `cd /mnt/c/Users//Downloads/Prusa-Firmware-MK3` + to change to the right folder + +####Compile Prusa-firmware with Ubuntu Linux subsystem installed +- open Ubuntu bash +- change to your source code folder (case sensitive) +- run `./build.sh` +- follow the instructions + +###Steps for Git-bash under Windows 10 64-bit: +- Download and install the 64bit Git version https://git-scm.com/download/win +- Also follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 +- Download and install 7z-zip from its official website https://www.7-zip.org/ + By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 +- Run `Git-Bash` under Administrator privilege +- navigate to the directory /c/Program Files/Git/mingw64/bin +- run `ln -s /c/Program Files/7-Zip/7z.exe zip.exe` + +####Compile Prusa-firmware with Git-bash installed +- open Git-bash +- change to your source code folder +- run `bash build.sh` +- follow the instructions + + ### 1. Development environment preparation a. install `"Arduino Software IDE"` for your preferred operating system diff --git a/build.sh b/build.sh index 051f1352c..97d9d1e26 100755 --- a/build.sh +++ b/build.sh @@ -1,40 +1,500 @@ #!/bin/bash +# This bash script is used to compile automatically the Prusa firmware with a dedecated build enviroment and settings +# +# Supported OS: Windows 10, Linux64 bit +# +# Linux: +# +# Windows: +# To excecute this sciprt you gonna need few things on your Windows machine +# +# Linux Subsystem Ubuntu +# 1. Follow these instructions +# 2. Open Ubuntu bash and get latest updates with 'apt-get upgate' +# 3. Install zip with 'apt-get install zip' +# 4. Add at top of ~/.bashrc following lines by using 'sudo nano ~/.bashrc' +# +# export OS="Linux" +# export JAVA_TOOL_OPTIONS="-Djava.net.preferIPv4Stack=true" +# export GPG_TTY=$(tty) +# +# and confirm them. Restart Ubuntu bash +# +# Or GIT-BASH +# 1. Download and install the correct (64bit or 32bit) Git version https://git-scm.com/download/win +# 2. Also follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 +# 3. Download and install 7z-zip from its official website. +# By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 as my case. +# 4. Run git Bash under Administrator privilege and navigate to the directory /c/Program Files/Git/mingw64/bin, +# you can run the command ln -s /c/Program Files/7-Zip/7z.exe zip.exe +# +# Usefull things to edit and compare your custom Firmware +# 1. Download and install current and correct (64bit or 32bit) Notepad++ version https://notepad-plus-plus.org/download +# 2. Another great tool to compare your custom mod and stock firmware is WinMerge http://winmerge.org/downloads/?lang=en +# +# Example for MK3: open git bash and chage to your Firmware directory +# @ MINGW64 //path +# bash build.sh 1_75mm_MK3-EINSy10a-E3Dv6full +# +# Example for MK25: open git bash and chage to your directory +# gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware/MK3 +# bash build.sh 1_75mm_MK25-RAMBo13a-E3Dv6full +# +# The compiled hex files can be found in the folder above like from the example +# gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware +# FW351-Build1778-1_75mm_MK25-RAMBo13a-E3Dv6full.hex +# +# Version: 1.0.1-Build_8 +# Change log: +# 12 Jan 2019, 3d-gussner, Fixed "compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" in 'platform.txt' +# 16 Jan 2019, 3d-gussner, Build_2, Added development check to modify 'Configuration.h' to prevent unwanted LCD messages that Firmware is uknown +# 17 Jan 2019, 3d-gussner, Build_3, Check for OS Windows or Linux and use the right build enviroment +# 10 Feb 2019, ropaha, Pull Request, Select variant from list while using build.sh +# 10 Feb 2019, ropaha, change FW_DEV_VERSION automatically depending on FW_VERSION RC/BETA/ALPHA +# 10 Feb 2019, 3d-gussner, 1st tests with english only +# 10 Feb 2019, ropaha, added compiling of all variants and english only +# 10 Feb 2019, 3d-gussner, Set OUTPUT_FOLDER for hex files +# 11 Feb 2019, 3d-gussner/ropaha, Minor changes and fixes +# 11 Feb 2019, 3d-gussner, Ready for RC +# 12 Feb 2019, 3d-gussner, Check if wget and zip are installed. Thanks to Bernd to point it out +# 12 Feb 2019, 3d-gussner, Changed OS check to OSTYPE as it is not supported on Ubuntu +# Also added different BUILD_ENV folders depending on OS used so Windows +# Users can use git-bash AND Windows Linux Subsystems at the same time +# Cleanup compiler flags is only depends on OS version. +# 12 Feb 2019, 3d-gussner, Added additional OSTYPE check +# 15 feb 2019, 3d-gussner, Added zip files for miniRAMbo multi language hex files +# 15 Feb 2019, 3d-gussner, Added more checks if +# Compiled Hex-files +# Configuration_prusa.h +# language build files +# multi language firmware files exist and clean them up +# 15 Feb 2019, 3d-gussner, Fixed selction GOLD/UNKNOWN DEV_STATUS for ALL variants builds, so you have to choose only once +# 15 Feb 2019, 3d-gussner, Added some colored output +# 15 Feb 2019, 3d-gussner, troubleshooting and minor fixes + + + +###Check if OSTYPE is supported +if [ $OSTYPE == "msys" ]; then + if [ $(uname -m) == "x86_64" ]; then + echo "$(tput setaf 2)Windows 64-bit found$(tput sgr0)" + fi +elif [ $OSTYPE == "linux-gnu" ]; then + if [ $(uname -m) == "x86_64" ]; then + echo "$(tput setaf 2)Linux 64-bit found$(tput sgr0)" + fi +else + echo "$(tput setaf 1)This script doesn't support your Operating system!" + echo "Please use Linux 64-bit or Windows 10 64-bit with Linux subsystem / git-bash" + echo "Read the notes of build.sh$(tput sgr0)" + exit +fi +sleep 2 +###Prepare bash enviroment and check if wget and zip are availible +if ! type wget > /dev/null; then + echo "$(tput setaf 1)Missing 'wget' which is important to run this script" + echo "Please follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 to install wget$(tput sgr0)" + exit +fi +if ! type zip > /dev/null; then + if [ $OSTYPE == "msys" ]; then + echo "$(tput setaf 1)Missing 'zip' which is important to run this script" + echo "Download and install 7z-zip from its official website https://www.7-zip.org/" + echo "By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 as my case." + echo "Run git Bash under Administrator privilege and" + echo "navigate to the directory /c/Program Files/Git/mingw64/bin," + echo "you can run the command $(tput setaf 2)ln -s /c/Program Files/7-Zip/7z.exe zip.exe$(tput sgr0)" + exit + elif [ $OSTYPE == "linux-gnu" ]; then + echo "$(tput setaf 1)Missing 'zip' which is important to run this script" + echo "install it with the command $(tput setaf 2)'sudo apt-get install zip'$(tput sgr0)" + exit + fi +fi +###End prepare bash enviroment + BUILD_ENV="1.0.1" SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" -if [ ! -d "build-env" ]; then - mkdir build-env || exit 1 -fi -cd build-env || exit 2 +# List few useful data +echo +echo "Script path:" $SCRIPT_PATH +echo "OS :" $OS +echo "OS type :" $OSTYPE +echo "" -if [ ! -f "PF-build-env-Linux64-$BUILD_ENV.zip" ]; then - wget https://github.com/mkbel/PF-build-env/releases/download/$BUILD_ENV/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3 +#### Start prepare building + +#Check if build exists and creates it if not +if [ ! -d "../build-env" ]; then + mkdir ../build-env || exit 2 fi -if [ ! -d "../../PF-build-env-$BUILD_ENV" ]; then - unzip -q PF-build-env-Linux64-$BUILD_ENV.zip -d ../../PF-build-env-$BUILD_ENV || exit 4 +cd ../build-env || exit 3 + +# Check if PF-build-env- exists and downloads + creates it if not +# The build enviroment is based on the Arduino IDE 1.8.5 portal vesion with some changes +if [ ! -d "../PF-build-env-$BUILD_ENV" ]; then + echo "$(tput setaf 6)PF-build-env-$BUILD_ENV is missing ... creating it now for you$(tput sgr 0)" + mkdir ../PF-build-env-$BUILD_ENV + sleep 5 fi -cd ../../PF-build-env-$BUILD_ENV || exit 5 +if [ $OSTYPE == "msys" ]; then + if [ ! -f "PF-build-env-Win-$BUILD_ENV.zip" ]; then + echo "$(tput setaf 6)Downloding Windows build enviroment...$(tput setaf 2)" + sleep 2 + wget https://github.com/3d-gussner/PF-build-env/releases/download/Win-$BUILD_ENV/PF-build-env-Win-$BUILD_ENV.zip || exit 4 + #cp -f ../../PF-build-env/PF-build-env-Win-$BUILD_ENV.zip PF-build-env-Win-$BUILD_ENV.zip || exit4 + echo "$(tput sgr 0)" + fi + if [ ! -d "../PF-build-env-$BUILD_ENV/$OSTYPE" ]; then + echo "$(tput setaf 6)Unzipping Windows build enviroment...$(tput setaf 2)" + sleep 2 + unzip PF-build-env-Win-$BUILD_ENV.zip -d ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 4 + echo "$(tput sgr0)" + fi + +fi + +if [ $OSTYPE == "linux-gnu" ]; then + if [ ! -f "PF-build-env-Linux64-$BUILD_ENV.zip" ]; then + echo "$(tput setaf 6)Downloading Linux 64 build enviroment...$(tput setaf 2)" + sleep 2 + wget https://github.com/mkbel/PF-build-env/releases/download/$BUILD_ENV/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3 + echo "$(tput sgr0)" + fi + + if [ ! -d "../PF-build-env-$BUILD_ENV/$OSTYPE" ]; then + echo "$(tput setaf 6)Unzipping Linux build enviroment...$(tput setaf 2)" + sleep 2 + unzip PF-build-env-Linux64-$BUILD_ENV.zip -d ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 4 + echo "$(tput sgr0)" + fi +fi +cd $SCRIPT_PATH + +# First argument defines which varaint of the Prusa Firmware will be compiled +if [ -z "$1" ] ; then + # Select which varaint of the Prusa Firmware will be compiled, like + PS3="Select a variant: " + while IFS= read -r -d $'\0' f; do + options[i++]="$f" + done < <(find Firmware/variants/ -maxdepth 1 -type f -name "*.h" -print0 ) + select opt in "${options[@]}" "All" "Quit"; do + case $opt in + *.h) + VARIANT=$(basename "$opt" ".h") + VARIANTS[i++]="$opt" + break + ;; + "All") + VARIANT="All" + VARIANTS=${options[*]} + break + ;; + "Quit") + echo "You chose to stop" + exit 1 + ;; + *) + echo "$(tput setaf 1)This is not a valid variant$(tput sgr0)" + ;; + esac + done +else + VARIANT=$1 +fi + +#Second argument defines if it is an english only version. Known values EN_ONLY / ALL +#Check default language mode +MULTI_LANGUAGE_CHECK=$(grep --max-count=1 "^#define LANG_MODE *" $SCRIPT_PATH/Firmware/config.h|sed -e's/ */ /g'|cut -d ' ' -f3) + +if [ -z "$2" ] ; then + PS3="Select a language: " + echo + echo "Which lang-build do you want?" + select yn in "Multi languages" "English only"; do + case $yn in + "Multi languages") + LANGUAGES="ALL" + sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h + break + ;; + "English only") + LANGUAGES="EN_ONLY" + sed -i -- "s/^#define LANG_MODE *1/#define LANG_MODE 0/g" $SCRIPT_PATH/Firmware/config.h + break + ;; + *) + echo "$(tput setaf 1)This is not a valid language$(tput sgr0)" + ;; + esac + done +else + LANGUAGES=$2 +fi + +#Set BUILD_ENV_PATH +cd ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 5 BUILD_ENV_PATH="$( pwd -P )" -cd .. +cd ../.. +#Checkif BUILD_PATH exisits and if not creates it if [ ! -d "Prusa-Firmware-build" ]; then mkdir Prusa-Firmware-build || exit 6 fi +#Set the BUILD_PATH for Arduino IDE cd Prusa-Firmware-build || exit 7 BUILD_PATH="$( pwd -P )" -if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then - cp $SCRIPT_PATH/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 8 -fi +for v in ${VARIANTS[*]} +do + VARIANT=$(basename "$v" ".h") + # Find firmware version in Configuration.h file and use it to generate the hex filename + FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g') + # Find build version in Configuration.h file and use it to generate the hex filename + BUILD=$(grep --max-count=1 "\bFW_COMMIT_NR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3) + # Check if the motherboard is an EINSY and if so the only one hex file will generated + MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3) + # Check development status + DEV_CHECK=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g'|cut -d '-' -f2) + if [ -z "$DEV_STATUS_SELECTED" ] ; then + if [[ "$DEV_CHECK" == "RC1" || "$DEV_CHECK" == "RC2" ]] ; then + DEV_STATUS="RC" + elif [[ "$DEV_CHECK" == "ALPHA" ]]; then + DEV_STATUS="ALPHA" + elif [[ "$DEV_CHECK" == "BETA" ]]; then + DEV_STATUS="BETA" + elif [[ "$DEV_CHECK" == "DEVEL" ]]; then + DEV_STATUS="DEVEL" + elif [[ "$DEV_CHECK" == "DEBUG" ]]; then + DEV_STATUS="DEBUG" + else + DEV_STATUS="UNKNOWN" + echo + echo "$(tput setaf 5)DEV_STATUS is UNKNOWN. Do you wish to set DEV_STATUS to GOLD?$(tput sgr0)" + PS3="Select YES only if source code is tested and trusted: " + select yn in "Yes" "No"; do + case $yn in + Yes) + DEV_STATUS="GOLD" + DEV_STATUS_SELECTED="GOLD" + break + ;; + No) + DEV_STATUS="UNKNOWN" + DEV_STATUS_SELECTED="UNKNOWN" + break + ;; + *) + echo "$(tput setaf 1)This is not a valid DEV_STATUS$(tput sgr0)" + ;; + esac + done + fi + else + DEV_STATUS=$DEV_STATUS_SELECTED + fi + #Prepare hex files folders + if [ ! -d "$SCRIPT_PATH/../Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD" ]; then + mkdir -p $SCRIPT_PATH/../Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD || exit 10 + fi + OUTPUT_FOLDER="Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD" + + #Check if exacly the same hexfile already exsits + if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex" && "$LANGUAGES" == "ALL" ]]; then + echo "" + ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex + echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + elif [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex" && "$LANGUAGES" == "EN_ONLY" ]]; then + echo "" + ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex + echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + fi + if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip" && "$LANGUAGES" == "ALL" ]]; then + echo "" + ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip + echo "$(tput setaf 6)This zip file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + fi + + #List some useful data + echo "$(tput setaf 2)$(tput setab 7) " + echo "Variant :" $VARIANT + echo "Firmware :" $FW + echo "Build # :" $BUILD + echo "Dev Check :" $DEV_CHECK + echo "DEV Status :" $DEV_STATUS + echo "Motherboard:" $MOTHERBOARD + echo "Languages :" $LANGUAGES + echo "Hex-file Folder:" $OUTPUT_FOLDER + echo "$(tput sgr0)" -$BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH || exit 9 + #Prepare Firmware to be compiled by copying variant as Configuration_prusa.h + if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then + cp -f $SCRIPT_PATH/Firmware/variants/$VARIANT.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 11 + else + echo "$(tput setaf 6)Configuration_prusa.h already exist it will be overwritten in 10 seconds by the chosen variant.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + cp -f $SCRIPT_PATH/Firmware/variants/$VARIANT.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 11 + fi -export ARDUINO=$BUILD_ENV_PATH + #Prepare Configuration.h to use the correct FW_DEV_VERSION to prevent LCD messages when connecting with OctoPrint + sed -i -- "s/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/g" $SCRIPT_PATH/Firmware/Configuration.h -cd $SCRIPT_PATH/lang -./lang-build.sh || exit 10 -./fw-build.sh || exit 11 + # set FW_REPOSITORY + sed -i -- 's/#define FW_REPOSITORY "Unknown"/#define FW_REPOSITORY "Prusa3d"/g' $SCRIPT_PATH/Firmware/Configuration.h + + #Prepare english only or multilanguage version to be build + if [ $LANGUAGES == "ALL" ]; then + echo " " + echo "Multi-language firmware will be build" + echo " " + else + echo " " + echo "English only language firmware will be build" + echo " " + fi + + #Check if compiler flags are set to Prusa specific needs for the rambo board. + if [ $OSTYPE == "msys" ]; then + RAMBO_PLATFORM_FILE="rambo/hardware/avr/1.0.1/platform.txt" + COMP_FLAGS="compiler.c.elf.flags={compiler.warning_flags} -Os -g -flto -fuse-linker-plugin -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" + CHECK_FLAGS=$(grep --max-count=1 "$COMP_FLAGS" $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE) + if [ -z "$CHECK_FLAGS" ]; then + echo "Compiler flags not found, adding flags" + if [ ! -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck ]; then + echo "making a backup" + ls $BUILD_ENV_PATH/portable/packages/rambo/hardware/avr/1.0.1/ + cp -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck + fi + echo $COMP_FLAGS >> $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE + else + echo "Compiler flags are set in rambo platform.txt" $CHECK_FLAGS + fi + fi + + #### End of Prepare building + + #### Start building + + export ARDUINO=$BUILD_ENV_PATH + #echo $BUILD_ENV_PATH + export BUILDER=$ARDUINO/arduino-builder + + echo + #read -t 5 -p "Press any key..." + echo + + if [ $OSTYPE == "msys" ]; then + echo "Start to build Prusa Firmware under Windows..." + echo "Using variant $VARIANT$(tput setaf 3)" + sleep 2 + #$BUILDER -dump-prefs -logger=machine -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=none -quiet $SCRIPT_PATH/Firmware/Firmware.ino || exit 12 + #$BUILDER -compile -logger=machine -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=none -quiet $SCRIPT_PATH/Firmware/Firmware.ino || exit 13 + $BUILDER -compile -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=default $SCRIPT_PATH/Firmware/Firmware.ino || exit 14 + echo "$(tput sgr 0)" + fi + if [ $OSTYPE == "linux-gnu" ] ; then + echo "Start to build Prusa Firmware under Linux 64..." + echo "Using variant $VARIANT$(tput setaf 3)" + sleep 2 + $BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH || exit 14 + echo "$(tput sgr 0)" + fi + + if [ $LANGUAGES == "ALL" ]; then + echo "$(tput setaf 2)" + echo "Building mutli language firmware" $MULTI_LANGUAGE_CHECK + echo "$(tput sgr 0)" + sleep 2 + cd $SCRIPT_PATH/lang + echo "$(tput setaf 3)" + ./config.sh || exit 15 + echo "$(tput sgr 0)" + # Check if privious languages and firmware build exist and if so clean them up + if [ -f "lang_en.tmp" ]; then + echo "" + echo "$(tput setaf 6)Previous lang build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + echo "$(tput setaf 3)" + ./lang-clean.sh + echo "$(tput sgr 0)" + fi + if [ -f "progmem.out" ]; then + echo "" + echo "$(tput setaf 6)Previous firmware build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + echo "$(tput setaf 3)" + ./fw-clean.sh + echo "$(tput sgr 0)" + fi + # build languages + echo "$(tput setaf 3)" + ./lang-build.sh || exit 16 + # Combine compiled firmware with languages + ./fw-build.sh || exit 17 + echo "$(tput sgr 0)" + # Check if the motherboard is an EINSY and if so the only one hex file will generated + MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3) + # If the motherboard is an EINSY just copy one hexfile + if [ "$MOTHERBOARD" = "BOARD_EINSY_1_0a" ]; then + echo "$(tput setaf 2)Copying multi language firmware for MK3/Einsy board to Hex-files folder$(tput sgr 0)" + cp -f firmware.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex + else + echo "$(tput setaf 2)Zip multi language firmware for MK2.5/miniRAMbo board to Hex-files folder$(tput sgr 0)" + cp -f firmware_cz.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-cz.hex + cp -f firmware_de.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-de.hex + cp -f firmware_es.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-es.hex + cp -f firmware_fr.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-fr.hex + cp -f firmware_it.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-it.hex + cp -f firmware_pl.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-pl.hex + if [ $OSTYPE == "msys" ]; then + zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex + rm $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex + elif [ $OSTYPE == "linux-gnu" ]; then + zip -m -j ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex + fi + fi + # Cleanup after build + echo "$(tput setaf 3)" + ./fw-clean.sh || exit 18 + ./lang-clean.sh || exit 19 + echo "$(tput sgr 0)" + else + echo "$(tput setaf 2)Copying English only firmware to Hex-files folder$(tput sgr 0)" + cp -f $BUILD_PATH/Firmware.ino.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex || exit 20 + fi + + # Cleanup Firmware + rm $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 17 + sed -i -- "s/^#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/g" $SCRIPT_PATH/Firmware/Configuration.h + sed -i -- 's/^#define FW_REPOSITORY "Prusa3d"/#define FW_REPOSITORY "Unknown"/g' $SCRIPT_PATH/Firmware/Configuration.h + echo $MULTI_LANGUAGE_CHECK + #sed -i -- "s/^#define LANG_MODE * /#define LANG_MODE $MULTI_LANGUAGE_CHECK/g" $SCRIPT_PATH/Firmware/config.h + sed -i -- "s/^#define LANG_MODE *1/#define LANG_MODE ${MULTI_LANGUAGE_CHECK}/g" $SCRIPT_PATH/Firmware/config.h + sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE ${MULTI_LANGUAGE_CHECK}/g" $SCRIPT_PATH/Firmware/config.h + sleep 5 +done + +# Cleanup compiler flags are set to Prusa specific needs for the rambo board. +#if [ $OSTYPE == "msys" ]; then +# echo " " +# echo "Restore Windows platform.txt" +# echo " " +# cp -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE +#fi + +# Switch to hex path and list build files +cd $SCRIPT_PATH +cd .. +echo "$(tput setaf 2) " +echo " " +echo "Build done, please use Slic3rPE > 1.41.0 to upload the firmware" +echo "more information how to flash firmware https://www.prusa3d.com/drivers/ $(tput sgr 0)" +#### End building diff --git a/prepare_winbuild.ps1 b/prepare_winbuild.ps1 new file mode 100644 index 000000000..b3dc09c4c --- /dev/null +++ b/prepare_winbuild.ps1 @@ -0,0 +1,6 @@ +#This powershell script prepares your Windows 10 64-bit computer to be able to compile your +#Prusa Firmware by installing a Linux Subsystem +#Please run it as administrator + +Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux +Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu -OutFile Ubuntu.appx -UseBasicParsing \ No newline at end of file From 038e4d3fdf63a6a2182d380f77b32cb9a596aa77 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sat, 16 Feb 2019 04:32:20 +0100 Subject: [PATCH 023/368] fixed some typos --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0f428980d..af5f8264b 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The script downloads Arduino with our modifications and Rambo board support inst ## Windows ### If you want to use the automated `build.sh` you gonna need to install on you Windows a Linux subsystem or Git-bash -###Steps for Linux subsystem und Windows 10 64-bit: +### Steps for Linux subsystem und Windows 10 64-bit: - follow the Microsoft guide https://docs.microsoft.com/en-us/windows/wsl/install-win10 You can also use the 'prepare_winbuild.ps1' powershell script with Administrator rights - Tested versions are at this moment @@ -36,20 +36,20 @@ The script downloads Arduino with our modifications and Rambo board support inst - restart Ubuntu bash Now your Ubuntu subsystem is ready to use the automatic `build.sh` script and compile your firmware correctly -####Some Tips for Ubuntu +#### Some Tips for Ubuntu - Linux is case sensetive so please don't forget to use capital letters where needed, like changing to a directory - To change the path to your Prusa-Firmware location you downloaded and unzipped - Example: You files are under `C:\Users\\Downloads\Prusa-Firmware-MK3` - use under Ubuntu the following command `cd /mnt/c/Users//Downloads/Prusa-Firmware-MK3` to change to the right folder -####Compile Prusa-firmware with Ubuntu Linux subsystem installed +#### Compile Prusa-firmware with Ubuntu Linux subsystem installed - open Ubuntu bash - change to your source code folder (case sensitive) - run `./build.sh` - follow the instructions -###Steps for Git-bash under Windows 10 64-bit: +### Steps for Git-bash under Windows 10 64-bit: - Download and install the 64bit Git version https://git-scm.com/download/win - Also follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 - Download and install 7z-zip from its official website https://www.7-zip.org/ @@ -58,7 +58,7 @@ Now your Ubuntu subsystem is ready to use the automatic `build.sh` script and co - navigate to the directory /c/Program Files/Git/mingw64/bin - run `ln -s /c/Program Files/7-Zip/7z.exe zip.exe` -####Compile Prusa-firmware with Git-bash installed +#### Compile Prusa-firmware with Git-bash installed - open Git-bash - change to your source code folder - run `bash build.sh` From a608b0d26e573c383dc8d0e3ce39ed13160a0672 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sat, 16 Feb 2019 06:05:43 +0100 Subject: [PATCH 024/368] Fix travis fail --- PF-build.sh | 500 ++++++++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 496 ++------------------------------------------------- 2 files changed, 518 insertions(+), 478 deletions(-) create mode 100644 PF-build.sh diff --git a/PF-build.sh b/PF-build.sh new file mode 100644 index 000000000..97d9d1e26 --- /dev/null +++ b/PF-build.sh @@ -0,0 +1,500 @@ +#!/bin/bash +# This bash script is used to compile automatically the Prusa firmware with a dedecated build enviroment and settings +# +# Supported OS: Windows 10, Linux64 bit +# +# Linux: +# +# Windows: +# To excecute this sciprt you gonna need few things on your Windows machine +# +# Linux Subsystem Ubuntu +# 1. Follow these instructions +# 2. Open Ubuntu bash and get latest updates with 'apt-get upgate' +# 3. Install zip with 'apt-get install zip' +# 4. Add at top of ~/.bashrc following lines by using 'sudo nano ~/.bashrc' +# +# export OS="Linux" +# export JAVA_TOOL_OPTIONS="-Djava.net.preferIPv4Stack=true" +# export GPG_TTY=$(tty) +# +# and confirm them. Restart Ubuntu bash +# +# Or GIT-BASH +# 1. Download and install the correct (64bit or 32bit) Git version https://git-scm.com/download/win +# 2. Also follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 +# 3. Download and install 7z-zip from its official website. +# By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 as my case. +# 4. Run git Bash under Administrator privilege and navigate to the directory /c/Program Files/Git/mingw64/bin, +# you can run the command ln -s /c/Program Files/7-Zip/7z.exe zip.exe +# +# Usefull things to edit and compare your custom Firmware +# 1. Download and install current and correct (64bit or 32bit) Notepad++ version https://notepad-plus-plus.org/download +# 2. Another great tool to compare your custom mod and stock firmware is WinMerge http://winmerge.org/downloads/?lang=en +# +# Example for MK3: open git bash and chage to your Firmware directory +# @ MINGW64 //path +# bash build.sh 1_75mm_MK3-EINSy10a-E3Dv6full +# +# Example for MK25: open git bash and chage to your directory +# gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware/MK3 +# bash build.sh 1_75mm_MK25-RAMBo13a-E3Dv6full +# +# The compiled hex files can be found in the folder above like from the example +# gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware +# FW351-Build1778-1_75mm_MK25-RAMBo13a-E3Dv6full.hex +# +# Version: 1.0.1-Build_8 +# Change log: +# 12 Jan 2019, 3d-gussner, Fixed "compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" in 'platform.txt' +# 16 Jan 2019, 3d-gussner, Build_2, Added development check to modify 'Configuration.h' to prevent unwanted LCD messages that Firmware is uknown +# 17 Jan 2019, 3d-gussner, Build_3, Check for OS Windows or Linux and use the right build enviroment +# 10 Feb 2019, ropaha, Pull Request, Select variant from list while using build.sh +# 10 Feb 2019, ropaha, change FW_DEV_VERSION automatically depending on FW_VERSION RC/BETA/ALPHA +# 10 Feb 2019, 3d-gussner, 1st tests with english only +# 10 Feb 2019, ropaha, added compiling of all variants and english only +# 10 Feb 2019, 3d-gussner, Set OUTPUT_FOLDER for hex files +# 11 Feb 2019, 3d-gussner/ropaha, Minor changes and fixes +# 11 Feb 2019, 3d-gussner, Ready for RC +# 12 Feb 2019, 3d-gussner, Check if wget and zip are installed. Thanks to Bernd to point it out +# 12 Feb 2019, 3d-gussner, Changed OS check to OSTYPE as it is not supported on Ubuntu +# Also added different BUILD_ENV folders depending on OS used so Windows +# Users can use git-bash AND Windows Linux Subsystems at the same time +# Cleanup compiler flags is only depends on OS version. +# 12 Feb 2019, 3d-gussner, Added additional OSTYPE check +# 15 feb 2019, 3d-gussner, Added zip files for miniRAMbo multi language hex files +# 15 Feb 2019, 3d-gussner, Added more checks if +# Compiled Hex-files +# Configuration_prusa.h +# language build files +# multi language firmware files exist and clean them up +# 15 Feb 2019, 3d-gussner, Fixed selction GOLD/UNKNOWN DEV_STATUS for ALL variants builds, so you have to choose only once +# 15 Feb 2019, 3d-gussner, Added some colored output +# 15 Feb 2019, 3d-gussner, troubleshooting and minor fixes + + + +###Check if OSTYPE is supported +if [ $OSTYPE == "msys" ]; then + if [ $(uname -m) == "x86_64" ]; then + echo "$(tput setaf 2)Windows 64-bit found$(tput sgr0)" + fi +elif [ $OSTYPE == "linux-gnu" ]; then + if [ $(uname -m) == "x86_64" ]; then + echo "$(tput setaf 2)Linux 64-bit found$(tput sgr0)" + fi +else + echo "$(tput setaf 1)This script doesn't support your Operating system!" + echo "Please use Linux 64-bit or Windows 10 64-bit with Linux subsystem / git-bash" + echo "Read the notes of build.sh$(tput sgr0)" + exit +fi +sleep 2 +###Prepare bash enviroment and check if wget and zip are availible +if ! type wget > /dev/null; then + echo "$(tput setaf 1)Missing 'wget' which is important to run this script" + echo "Please follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 to install wget$(tput sgr0)" + exit +fi +if ! type zip > /dev/null; then + if [ $OSTYPE == "msys" ]; then + echo "$(tput setaf 1)Missing 'zip' which is important to run this script" + echo "Download and install 7z-zip from its official website https://www.7-zip.org/" + echo "By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 as my case." + echo "Run git Bash under Administrator privilege and" + echo "navigate to the directory /c/Program Files/Git/mingw64/bin," + echo "you can run the command $(tput setaf 2)ln -s /c/Program Files/7-Zip/7z.exe zip.exe$(tput sgr0)" + exit + elif [ $OSTYPE == "linux-gnu" ]; then + echo "$(tput setaf 1)Missing 'zip' which is important to run this script" + echo "install it with the command $(tput setaf 2)'sudo apt-get install zip'$(tput sgr0)" + exit + fi +fi +###End prepare bash enviroment + +BUILD_ENV="1.0.1" +SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" + +# List few useful data +echo +echo "Script path:" $SCRIPT_PATH +echo "OS :" $OS +echo "OS type :" $OSTYPE +echo "" + +#### Start prepare building + +#Check if build exists and creates it if not +if [ ! -d "../build-env" ]; then + mkdir ../build-env || exit 2 +fi + +cd ../build-env || exit 3 + +# Check if PF-build-env- exists and downloads + creates it if not +# The build enviroment is based on the Arduino IDE 1.8.5 portal vesion with some changes +if [ ! -d "../PF-build-env-$BUILD_ENV" ]; then + echo "$(tput setaf 6)PF-build-env-$BUILD_ENV is missing ... creating it now for you$(tput sgr 0)" + mkdir ../PF-build-env-$BUILD_ENV + sleep 5 +fi + +if [ $OSTYPE == "msys" ]; then + if [ ! -f "PF-build-env-Win-$BUILD_ENV.zip" ]; then + echo "$(tput setaf 6)Downloding Windows build enviroment...$(tput setaf 2)" + sleep 2 + wget https://github.com/3d-gussner/PF-build-env/releases/download/Win-$BUILD_ENV/PF-build-env-Win-$BUILD_ENV.zip || exit 4 + #cp -f ../../PF-build-env/PF-build-env-Win-$BUILD_ENV.zip PF-build-env-Win-$BUILD_ENV.zip || exit4 + echo "$(tput sgr 0)" + fi + if [ ! -d "../PF-build-env-$BUILD_ENV/$OSTYPE" ]; then + echo "$(tput setaf 6)Unzipping Windows build enviroment...$(tput setaf 2)" + sleep 2 + unzip PF-build-env-Win-$BUILD_ENV.zip -d ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 4 + echo "$(tput sgr0)" + fi + +fi + +if [ $OSTYPE == "linux-gnu" ]; then + if [ ! -f "PF-build-env-Linux64-$BUILD_ENV.zip" ]; then + echo "$(tput setaf 6)Downloading Linux 64 build enviroment...$(tput setaf 2)" + sleep 2 + wget https://github.com/mkbel/PF-build-env/releases/download/$BUILD_ENV/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3 + echo "$(tput sgr0)" + fi + + if [ ! -d "../PF-build-env-$BUILD_ENV/$OSTYPE" ]; then + echo "$(tput setaf 6)Unzipping Linux build enviroment...$(tput setaf 2)" + sleep 2 + unzip PF-build-env-Linux64-$BUILD_ENV.zip -d ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 4 + echo "$(tput sgr0)" + fi +fi +cd $SCRIPT_PATH + +# First argument defines which varaint of the Prusa Firmware will be compiled +if [ -z "$1" ] ; then + # Select which varaint of the Prusa Firmware will be compiled, like + PS3="Select a variant: " + while IFS= read -r -d $'\0' f; do + options[i++]="$f" + done < <(find Firmware/variants/ -maxdepth 1 -type f -name "*.h" -print0 ) + select opt in "${options[@]}" "All" "Quit"; do + case $opt in + *.h) + VARIANT=$(basename "$opt" ".h") + VARIANTS[i++]="$opt" + break + ;; + "All") + VARIANT="All" + VARIANTS=${options[*]} + break + ;; + "Quit") + echo "You chose to stop" + exit 1 + ;; + *) + echo "$(tput setaf 1)This is not a valid variant$(tput sgr0)" + ;; + esac + done +else + VARIANT=$1 +fi + +#Second argument defines if it is an english only version. Known values EN_ONLY / ALL +#Check default language mode +MULTI_LANGUAGE_CHECK=$(grep --max-count=1 "^#define LANG_MODE *" $SCRIPT_PATH/Firmware/config.h|sed -e's/ */ /g'|cut -d ' ' -f3) + +if [ -z "$2" ] ; then + PS3="Select a language: " + echo + echo "Which lang-build do you want?" + select yn in "Multi languages" "English only"; do + case $yn in + "Multi languages") + LANGUAGES="ALL" + sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h + break + ;; + "English only") + LANGUAGES="EN_ONLY" + sed -i -- "s/^#define LANG_MODE *1/#define LANG_MODE 0/g" $SCRIPT_PATH/Firmware/config.h + break + ;; + *) + echo "$(tput setaf 1)This is not a valid language$(tput sgr0)" + ;; + esac + done +else + LANGUAGES=$2 +fi + +#Set BUILD_ENV_PATH +cd ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 5 +BUILD_ENV_PATH="$( pwd -P )" + +cd ../.. + +#Checkif BUILD_PATH exisits and if not creates it +if [ ! -d "Prusa-Firmware-build" ]; then + mkdir Prusa-Firmware-build || exit 6 +fi + +#Set the BUILD_PATH for Arduino IDE +cd Prusa-Firmware-build || exit 7 +BUILD_PATH="$( pwd -P )" + +for v in ${VARIANTS[*]} +do + VARIANT=$(basename "$v" ".h") + # Find firmware version in Configuration.h file and use it to generate the hex filename + FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g') + # Find build version in Configuration.h file and use it to generate the hex filename + BUILD=$(grep --max-count=1 "\bFW_COMMIT_NR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3) + # Check if the motherboard is an EINSY and if so the only one hex file will generated + MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3) + # Check development status + DEV_CHECK=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g'|cut -d '-' -f2) + if [ -z "$DEV_STATUS_SELECTED" ] ; then + if [[ "$DEV_CHECK" == "RC1" || "$DEV_CHECK" == "RC2" ]] ; then + DEV_STATUS="RC" + elif [[ "$DEV_CHECK" == "ALPHA" ]]; then + DEV_STATUS="ALPHA" + elif [[ "$DEV_CHECK" == "BETA" ]]; then + DEV_STATUS="BETA" + elif [[ "$DEV_CHECK" == "DEVEL" ]]; then + DEV_STATUS="DEVEL" + elif [[ "$DEV_CHECK" == "DEBUG" ]]; then + DEV_STATUS="DEBUG" + else + DEV_STATUS="UNKNOWN" + echo + echo "$(tput setaf 5)DEV_STATUS is UNKNOWN. Do you wish to set DEV_STATUS to GOLD?$(tput sgr0)" + PS3="Select YES only if source code is tested and trusted: " + select yn in "Yes" "No"; do + case $yn in + Yes) + DEV_STATUS="GOLD" + DEV_STATUS_SELECTED="GOLD" + break + ;; + No) + DEV_STATUS="UNKNOWN" + DEV_STATUS_SELECTED="UNKNOWN" + break + ;; + *) + echo "$(tput setaf 1)This is not a valid DEV_STATUS$(tput sgr0)" + ;; + esac + done + fi + else + DEV_STATUS=$DEV_STATUS_SELECTED + fi + #Prepare hex files folders + if [ ! -d "$SCRIPT_PATH/../Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD" ]; then + mkdir -p $SCRIPT_PATH/../Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD || exit 10 + fi + OUTPUT_FOLDER="Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD" + + #Check if exacly the same hexfile already exsits + if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex" && "$LANGUAGES" == "ALL" ]]; then + echo "" + ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex + echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + elif [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex" && "$LANGUAGES" == "EN_ONLY" ]]; then + echo "" + ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex + echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + fi + if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip" && "$LANGUAGES" == "ALL" ]]; then + echo "" + ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip + echo "$(tput setaf 6)This zip file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + fi + + #List some useful data + echo "$(tput setaf 2)$(tput setab 7) " + echo "Variant :" $VARIANT + echo "Firmware :" $FW + echo "Build # :" $BUILD + echo "Dev Check :" $DEV_CHECK + echo "DEV Status :" $DEV_STATUS + echo "Motherboard:" $MOTHERBOARD + echo "Languages :" $LANGUAGES + echo "Hex-file Folder:" $OUTPUT_FOLDER + echo "$(tput sgr0)" + + #Prepare Firmware to be compiled by copying variant as Configuration_prusa.h + if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then + cp -f $SCRIPT_PATH/Firmware/variants/$VARIANT.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 11 + else + echo "$(tput setaf 6)Configuration_prusa.h already exist it will be overwritten in 10 seconds by the chosen variant.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + cp -f $SCRIPT_PATH/Firmware/variants/$VARIANT.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 11 + fi + + #Prepare Configuration.h to use the correct FW_DEV_VERSION to prevent LCD messages when connecting with OctoPrint + sed -i -- "s/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/g" $SCRIPT_PATH/Firmware/Configuration.h + + # set FW_REPOSITORY + sed -i -- 's/#define FW_REPOSITORY "Unknown"/#define FW_REPOSITORY "Prusa3d"/g' $SCRIPT_PATH/Firmware/Configuration.h + + #Prepare english only or multilanguage version to be build + if [ $LANGUAGES == "ALL" ]; then + echo " " + echo "Multi-language firmware will be build" + echo " " + else + echo " " + echo "English only language firmware will be build" + echo " " + fi + + #Check if compiler flags are set to Prusa specific needs for the rambo board. + if [ $OSTYPE == "msys" ]; then + RAMBO_PLATFORM_FILE="rambo/hardware/avr/1.0.1/platform.txt" + COMP_FLAGS="compiler.c.elf.flags={compiler.warning_flags} -Os -g -flto -fuse-linker-plugin -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" + CHECK_FLAGS=$(grep --max-count=1 "$COMP_FLAGS" $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE) + if [ -z "$CHECK_FLAGS" ]; then + echo "Compiler flags not found, adding flags" + if [ ! -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck ]; then + echo "making a backup" + ls $BUILD_ENV_PATH/portable/packages/rambo/hardware/avr/1.0.1/ + cp -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck + fi + echo $COMP_FLAGS >> $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE + else + echo "Compiler flags are set in rambo platform.txt" $CHECK_FLAGS + fi + fi + + #### End of Prepare building + + #### Start building + + export ARDUINO=$BUILD_ENV_PATH + #echo $BUILD_ENV_PATH + export BUILDER=$ARDUINO/arduino-builder + + echo + #read -t 5 -p "Press any key..." + echo + + if [ $OSTYPE == "msys" ]; then + echo "Start to build Prusa Firmware under Windows..." + echo "Using variant $VARIANT$(tput setaf 3)" + sleep 2 + #$BUILDER -dump-prefs -logger=machine -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=none -quiet $SCRIPT_PATH/Firmware/Firmware.ino || exit 12 + #$BUILDER -compile -logger=machine -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=none -quiet $SCRIPT_PATH/Firmware/Firmware.ino || exit 13 + $BUILDER -compile -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=default $SCRIPT_PATH/Firmware/Firmware.ino || exit 14 + echo "$(tput sgr 0)" + fi + if [ $OSTYPE == "linux-gnu" ] ; then + echo "Start to build Prusa Firmware under Linux 64..." + echo "Using variant $VARIANT$(tput setaf 3)" + sleep 2 + $BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH || exit 14 + echo "$(tput sgr 0)" + fi + + if [ $LANGUAGES == "ALL" ]; then + echo "$(tput setaf 2)" + echo "Building mutli language firmware" $MULTI_LANGUAGE_CHECK + echo "$(tput sgr 0)" + sleep 2 + cd $SCRIPT_PATH/lang + echo "$(tput setaf 3)" + ./config.sh || exit 15 + echo "$(tput sgr 0)" + # Check if privious languages and firmware build exist and if so clean them up + if [ -f "lang_en.tmp" ]; then + echo "" + echo "$(tput setaf 6)Previous lang build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + echo "$(tput setaf 3)" + ./lang-clean.sh + echo "$(tput sgr 0)" + fi + if [ -f "progmem.out" ]; then + echo "" + echo "$(tput setaf 6)Previous firmware build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" + read -t 10 -p "Press any key to continue..." + echo "$(tput setaf 3)" + ./fw-clean.sh + echo "$(tput sgr 0)" + fi + # build languages + echo "$(tput setaf 3)" + ./lang-build.sh || exit 16 + # Combine compiled firmware with languages + ./fw-build.sh || exit 17 + echo "$(tput sgr 0)" + # Check if the motherboard is an EINSY and if so the only one hex file will generated + MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3) + # If the motherboard is an EINSY just copy one hexfile + if [ "$MOTHERBOARD" = "BOARD_EINSY_1_0a" ]; then + echo "$(tput setaf 2)Copying multi language firmware for MK3/Einsy board to Hex-files folder$(tput sgr 0)" + cp -f firmware.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex + else + echo "$(tput setaf 2)Zip multi language firmware for MK2.5/miniRAMbo board to Hex-files folder$(tput sgr 0)" + cp -f firmware_cz.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-cz.hex + cp -f firmware_de.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-de.hex + cp -f firmware_es.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-es.hex + cp -f firmware_fr.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-fr.hex + cp -f firmware_it.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-it.hex + cp -f firmware_pl.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-pl.hex + if [ $OSTYPE == "msys" ]; then + zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex + rm $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex + elif [ $OSTYPE == "linux-gnu" ]; then + zip -m -j ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex + fi + fi + # Cleanup after build + echo "$(tput setaf 3)" + ./fw-clean.sh || exit 18 + ./lang-clean.sh || exit 19 + echo "$(tput sgr 0)" + else + echo "$(tput setaf 2)Copying English only firmware to Hex-files folder$(tput sgr 0)" + cp -f $BUILD_PATH/Firmware.ino.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex || exit 20 + fi + + # Cleanup Firmware + rm $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 17 + sed -i -- "s/^#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/g" $SCRIPT_PATH/Firmware/Configuration.h + sed -i -- 's/^#define FW_REPOSITORY "Prusa3d"/#define FW_REPOSITORY "Unknown"/g' $SCRIPT_PATH/Firmware/Configuration.h + echo $MULTI_LANGUAGE_CHECK + #sed -i -- "s/^#define LANG_MODE * /#define LANG_MODE $MULTI_LANGUAGE_CHECK/g" $SCRIPT_PATH/Firmware/config.h + sed -i -- "s/^#define LANG_MODE *1/#define LANG_MODE ${MULTI_LANGUAGE_CHECK}/g" $SCRIPT_PATH/Firmware/config.h + sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE ${MULTI_LANGUAGE_CHECK}/g" $SCRIPT_PATH/Firmware/config.h + sleep 5 +done + +# Cleanup compiler flags are set to Prusa specific needs for the rambo board. +#if [ $OSTYPE == "msys" ]; then +# echo " " +# echo "Restore Windows platform.txt" +# echo " " +# cp -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE +#fi + +# Switch to hex path and list build files +cd $SCRIPT_PATH +cd .. +echo "$(tput setaf 2) " +echo " " +echo "Build done, please use Slic3rPE > 1.41.0 to upload the firmware" +echo "more information how to flash firmware https://www.prusa3d.com/drivers/ $(tput sgr 0)" +#### End building diff --git a/build.sh b/build.sh index 97d9d1e26..051f1352c 100755 --- a/build.sh +++ b/build.sh @@ -1,500 +1,40 @@ #!/bin/bash -# This bash script is used to compile automatically the Prusa firmware with a dedecated build enviroment and settings -# -# Supported OS: Windows 10, Linux64 bit -# -# Linux: -# -# Windows: -# To excecute this sciprt you gonna need few things on your Windows machine -# -# Linux Subsystem Ubuntu -# 1. Follow these instructions -# 2. Open Ubuntu bash and get latest updates with 'apt-get upgate' -# 3. Install zip with 'apt-get install zip' -# 4. Add at top of ~/.bashrc following lines by using 'sudo nano ~/.bashrc' -# -# export OS="Linux" -# export JAVA_TOOL_OPTIONS="-Djava.net.preferIPv4Stack=true" -# export GPG_TTY=$(tty) -# -# and confirm them. Restart Ubuntu bash -# -# Or GIT-BASH -# 1. Download and install the correct (64bit or 32bit) Git version https://git-scm.com/download/win -# 2. Also follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 -# 3. Download and install 7z-zip from its official website. -# By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 as my case. -# 4. Run git Bash under Administrator privilege and navigate to the directory /c/Program Files/Git/mingw64/bin, -# you can run the command ln -s /c/Program Files/7-Zip/7z.exe zip.exe -# -# Usefull things to edit and compare your custom Firmware -# 1. Download and install current and correct (64bit or 32bit) Notepad++ version https://notepad-plus-plus.org/download -# 2. Another great tool to compare your custom mod and stock firmware is WinMerge http://winmerge.org/downloads/?lang=en -# -# Example for MK3: open git bash and chage to your Firmware directory -# @ MINGW64 //path -# bash build.sh 1_75mm_MK3-EINSy10a-E3Dv6full -# -# Example for MK25: open git bash and chage to your directory -# gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware/MK3 -# bash build.sh 1_75mm_MK25-RAMBo13a-E3Dv6full -# -# The compiled hex files can be found in the folder above like from the example -# gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware -# FW351-Build1778-1_75mm_MK25-RAMBo13a-E3Dv6full.hex -# -# Version: 1.0.1-Build_8 -# Change log: -# 12 Jan 2019, 3d-gussner, Fixed "compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" in 'platform.txt' -# 16 Jan 2019, 3d-gussner, Build_2, Added development check to modify 'Configuration.h' to prevent unwanted LCD messages that Firmware is uknown -# 17 Jan 2019, 3d-gussner, Build_3, Check for OS Windows or Linux and use the right build enviroment -# 10 Feb 2019, ropaha, Pull Request, Select variant from list while using build.sh -# 10 Feb 2019, ropaha, change FW_DEV_VERSION automatically depending on FW_VERSION RC/BETA/ALPHA -# 10 Feb 2019, 3d-gussner, 1st tests with english only -# 10 Feb 2019, ropaha, added compiling of all variants and english only -# 10 Feb 2019, 3d-gussner, Set OUTPUT_FOLDER for hex files -# 11 Feb 2019, 3d-gussner/ropaha, Minor changes and fixes -# 11 Feb 2019, 3d-gussner, Ready for RC -# 12 Feb 2019, 3d-gussner, Check if wget and zip are installed. Thanks to Bernd to point it out -# 12 Feb 2019, 3d-gussner, Changed OS check to OSTYPE as it is not supported on Ubuntu -# Also added different BUILD_ENV folders depending on OS used so Windows -# Users can use git-bash AND Windows Linux Subsystems at the same time -# Cleanup compiler flags is only depends on OS version. -# 12 Feb 2019, 3d-gussner, Added additional OSTYPE check -# 15 feb 2019, 3d-gussner, Added zip files for miniRAMbo multi language hex files -# 15 Feb 2019, 3d-gussner, Added more checks if -# Compiled Hex-files -# Configuration_prusa.h -# language build files -# multi language firmware files exist and clean them up -# 15 Feb 2019, 3d-gussner, Fixed selction GOLD/UNKNOWN DEV_STATUS for ALL variants builds, so you have to choose only once -# 15 Feb 2019, 3d-gussner, Added some colored output -# 15 Feb 2019, 3d-gussner, troubleshooting and minor fixes - - - -###Check if OSTYPE is supported -if [ $OSTYPE == "msys" ]; then - if [ $(uname -m) == "x86_64" ]; then - echo "$(tput setaf 2)Windows 64-bit found$(tput sgr0)" - fi -elif [ $OSTYPE == "linux-gnu" ]; then - if [ $(uname -m) == "x86_64" ]; then - echo "$(tput setaf 2)Linux 64-bit found$(tput sgr0)" - fi -else - echo "$(tput setaf 1)This script doesn't support your Operating system!" - echo "Please use Linux 64-bit or Windows 10 64-bit with Linux subsystem / git-bash" - echo "Read the notes of build.sh$(tput sgr0)" - exit -fi -sleep 2 -###Prepare bash enviroment and check if wget and zip are availible -if ! type wget > /dev/null; then - echo "$(tput setaf 1)Missing 'wget' which is important to run this script" - echo "Please follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 to install wget$(tput sgr0)" - exit -fi -if ! type zip > /dev/null; then - if [ $OSTYPE == "msys" ]; then - echo "$(tput setaf 1)Missing 'zip' which is important to run this script" - echo "Download and install 7z-zip from its official website https://www.7-zip.org/" - echo "By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 as my case." - echo "Run git Bash under Administrator privilege and" - echo "navigate to the directory /c/Program Files/Git/mingw64/bin," - echo "you can run the command $(tput setaf 2)ln -s /c/Program Files/7-Zip/7z.exe zip.exe$(tput sgr0)" - exit - elif [ $OSTYPE == "linux-gnu" ]; then - echo "$(tput setaf 1)Missing 'zip' which is important to run this script" - echo "install it with the command $(tput setaf 2)'sudo apt-get install zip'$(tput sgr0)" - exit - fi -fi -###End prepare bash enviroment - BUILD_ENV="1.0.1" SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" -# List few useful data -echo -echo "Script path:" $SCRIPT_PATH -echo "OS :" $OS -echo "OS type :" $OSTYPE -echo "" +if [ ! -d "build-env" ]; then + mkdir build-env || exit 1 +fi +cd build-env || exit 2 -#### Start prepare building - -#Check if build exists and creates it if not -if [ ! -d "../build-env" ]; then - mkdir ../build-env || exit 2 +if [ ! -f "PF-build-env-Linux64-$BUILD_ENV.zip" ]; then + wget https://github.com/mkbel/PF-build-env/releases/download/$BUILD_ENV/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3 fi -cd ../build-env || exit 3 - -# Check if PF-build-env- exists and downloads + creates it if not -# The build enviroment is based on the Arduino IDE 1.8.5 portal vesion with some changes -if [ ! -d "../PF-build-env-$BUILD_ENV" ]; then - echo "$(tput setaf 6)PF-build-env-$BUILD_ENV is missing ... creating it now for you$(tput sgr 0)" - mkdir ../PF-build-env-$BUILD_ENV - sleep 5 +if [ ! -d "../../PF-build-env-$BUILD_ENV" ]; then + unzip -q PF-build-env-Linux64-$BUILD_ENV.zip -d ../../PF-build-env-$BUILD_ENV || exit 4 fi -if [ $OSTYPE == "msys" ]; then - if [ ! -f "PF-build-env-Win-$BUILD_ENV.zip" ]; then - echo "$(tput setaf 6)Downloding Windows build enviroment...$(tput setaf 2)" - sleep 2 - wget https://github.com/3d-gussner/PF-build-env/releases/download/Win-$BUILD_ENV/PF-build-env-Win-$BUILD_ENV.zip || exit 4 - #cp -f ../../PF-build-env/PF-build-env-Win-$BUILD_ENV.zip PF-build-env-Win-$BUILD_ENV.zip || exit4 - echo "$(tput sgr 0)" - fi - if [ ! -d "../PF-build-env-$BUILD_ENV/$OSTYPE" ]; then - echo "$(tput setaf 6)Unzipping Windows build enviroment...$(tput setaf 2)" - sleep 2 - unzip PF-build-env-Win-$BUILD_ENV.zip -d ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 4 - echo "$(tput sgr0)" - fi - -fi - -if [ $OSTYPE == "linux-gnu" ]; then - if [ ! -f "PF-build-env-Linux64-$BUILD_ENV.zip" ]; then - echo "$(tput setaf 6)Downloading Linux 64 build enviroment...$(tput setaf 2)" - sleep 2 - wget https://github.com/mkbel/PF-build-env/releases/download/$BUILD_ENV/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3 - echo "$(tput sgr0)" - fi - - if [ ! -d "../PF-build-env-$BUILD_ENV/$OSTYPE" ]; then - echo "$(tput setaf 6)Unzipping Linux build enviroment...$(tput setaf 2)" - sleep 2 - unzip PF-build-env-Linux64-$BUILD_ENV.zip -d ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 4 - echo "$(tput sgr0)" - fi -fi -cd $SCRIPT_PATH - -# First argument defines which varaint of the Prusa Firmware will be compiled -if [ -z "$1" ] ; then - # Select which varaint of the Prusa Firmware will be compiled, like - PS3="Select a variant: " - while IFS= read -r -d $'\0' f; do - options[i++]="$f" - done < <(find Firmware/variants/ -maxdepth 1 -type f -name "*.h" -print0 ) - select opt in "${options[@]}" "All" "Quit"; do - case $opt in - *.h) - VARIANT=$(basename "$opt" ".h") - VARIANTS[i++]="$opt" - break - ;; - "All") - VARIANT="All" - VARIANTS=${options[*]} - break - ;; - "Quit") - echo "You chose to stop" - exit 1 - ;; - *) - echo "$(tput setaf 1)This is not a valid variant$(tput sgr0)" - ;; - esac - done -else - VARIANT=$1 -fi - -#Second argument defines if it is an english only version. Known values EN_ONLY / ALL -#Check default language mode -MULTI_LANGUAGE_CHECK=$(grep --max-count=1 "^#define LANG_MODE *" $SCRIPT_PATH/Firmware/config.h|sed -e's/ */ /g'|cut -d ' ' -f3) - -if [ -z "$2" ] ; then - PS3="Select a language: " - echo - echo "Which lang-build do you want?" - select yn in "Multi languages" "English only"; do - case $yn in - "Multi languages") - LANGUAGES="ALL" - sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h - break - ;; - "English only") - LANGUAGES="EN_ONLY" - sed -i -- "s/^#define LANG_MODE *1/#define LANG_MODE 0/g" $SCRIPT_PATH/Firmware/config.h - break - ;; - *) - echo "$(tput setaf 1)This is not a valid language$(tput sgr0)" - ;; - esac - done -else - LANGUAGES=$2 -fi - -#Set BUILD_ENV_PATH -cd ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 5 +cd ../../PF-build-env-$BUILD_ENV || exit 5 BUILD_ENV_PATH="$( pwd -P )" -cd ../.. +cd .. -#Checkif BUILD_PATH exisits and if not creates it if [ ! -d "Prusa-Firmware-build" ]; then mkdir Prusa-Firmware-build || exit 6 fi -#Set the BUILD_PATH for Arduino IDE cd Prusa-Firmware-build || exit 7 BUILD_PATH="$( pwd -P )" -for v in ${VARIANTS[*]} -do - VARIANT=$(basename "$v" ".h") - # Find firmware version in Configuration.h file and use it to generate the hex filename - FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g') - # Find build version in Configuration.h file and use it to generate the hex filename - BUILD=$(grep --max-count=1 "\bFW_COMMIT_NR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3) - # Check if the motherboard is an EINSY and if so the only one hex file will generated - MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3) - # Check development status - DEV_CHECK=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g'|cut -d '-' -f2) - if [ -z "$DEV_STATUS_SELECTED" ] ; then - if [[ "$DEV_CHECK" == "RC1" || "$DEV_CHECK" == "RC2" ]] ; then - DEV_STATUS="RC" - elif [[ "$DEV_CHECK" == "ALPHA" ]]; then - DEV_STATUS="ALPHA" - elif [[ "$DEV_CHECK" == "BETA" ]]; then - DEV_STATUS="BETA" - elif [[ "$DEV_CHECK" == "DEVEL" ]]; then - DEV_STATUS="DEVEL" - elif [[ "$DEV_CHECK" == "DEBUG" ]]; then - DEV_STATUS="DEBUG" - else - DEV_STATUS="UNKNOWN" - echo - echo "$(tput setaf 5)DEV_STATUS is UNKNOWN. Do you wish to set DEV_STATUS to GOLD?$(tput sgr0)" - PS3="Select YES only if source code is tested and trusted: " - select yn in "Yes" "No"; do - case $yn in - Yes) - DEV_STATUS="GOLD" - DEV_STATUS_SELECTED="GOLD" - break - ;; - No) - DEV_STATUS="UNKNOWN" - DEV_STATUS_SELECTED="UNKNOWN" - break - ;; - *) - echo "$(tput setaf 1)This is not a valid DEV_STATUS$(tput sgr0)" - ;; - esac - done - fi - else - DEV_STATUS=$DEV_STATUS_SELECTED - fi - #Prepare hex files folders - if [ ! -d "$SCRIPT_PATH/../Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD" ]; then - mkdir -p $SCRIPT_PATH/../Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD || exit 10 - fi - OUTPUT_FOLDER="Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD" - - #Check if exacly the same hexfile already exsits - if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex" && "$LANGUAGES" == "ALL" ]]; then - echo "" - ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex - echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." - elif [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex" && "$LANGUAGES" == "EN_ONLY" ]]; then - echo "" - ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex - echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." - fi - if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip" && "$LANGUAGES" == "ALL" ]]; then - echo "" - ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip - echo "$(tput setaf 6)This zip file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." - fi - - #List some useful data - echo "$(tput setaf 2)$(tput setab 7) " - echo "Variant :" $VARIANT - echo "Firmware :" $FW - echo "Build # :" $BUILD - echo "Dev Check :" $DEV_CHECK - echo "DEV Status :" $DEV_STATUS - echo "Motherboard:" $MOTHERBOARD - echo "Languages :" $LANGUAGES - echo "Hex-file Folder:" $OUTPUT_FOLDER - echo "$(tput sgr0)" +if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then + cp $SCRIPT_PATH/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 8 +fi - #Prepare Firmware to be compiled by copying variant as Configuration_prusa.h - if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then - cp -f $SCRIPT_PATH/Firmware/variants/$VARIANT.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 11 - else - echo "$(tput setaf 6)Configuration_prusa.h already exist it will be overwritten in 10 seconds by the chosen variant.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." - cp -f $SCRIPT_PATH/Firmware/variants/$VARIANT.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 11 - fi +$BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH || exit 9 - #Prepare Configuration.h to use the correct FW_DEV_VERSION to prevent LCD messages when connecting with OctoPrint - sed -i -- "s/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/g" $SCRIPT_PATH/Firmware/Configuration.h +export ARDUINO=$BUILD_ENV_PATH - # set FW_REPOSITORY - sed -i -- 's/#define FW_REPOSITORY "Unknown"/#define FW_REPOSITORY "Prusa3d"/g' $SCRIPT_PATH/Firmware/Configuration.h - - #Prepare english only or multilanguage version to be build - if [ $LANGUAGES == "ALL" ]; then - echo " " - echo "Multi-language firmware will be build" - echo " " - else - echo " " - echo "English only language firmware will be build" - echo " " - fi - - #Check if compiler flags are set to Prusa specific needs for the rambo board. - if [ $OSTYPE == "msys" ]; then - RAMBO_PLATFORM_FILE="rambo/hardware/avr/1.0.1/platform.txt" - COMP_FLAGS="compiler.c.elf.flags={compiler.warning_flags} -Os -g -flto -fuse-linker-plugin -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" - CHECK_FLAGS=$(grep --max-count=1 "$COMP_FLAGS" $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE) - if [ -z "$CHECK_FLAGS" ]; then - echo "Compiler flags not found, adding flags" - if [ ! -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck ]; then - echo "making a backup" - ls $BUILD_ENV_PATH/portable/packages/rambo/hardware/avr/1.0.1/ - cp -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck - fi - echo $COMP_FLAGS >> $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE - else - echo "Compiler flags are set in rambo platform.txt" $CHECK_FLAGS - fi - fi - - #### End of Prepare building - - #### Start building - - export ARDUINO=$BUILD_ENV_PATH - #echo $BUILD_ENV_PATH - export BUILDER=$ARDUINO/arduino-builder - - echo - #read -t 5 -p "Press any key..." - echo - - if [ $OSTYPE == "msys" ]; then - echo "Start to build Prusa Firmware under Windows..." - echo "Using variant $VARIANT$(tput setaf 3)" - sleep 2 - #$BUILDER -dump-prefs -logger=machine -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=none -quiet $SCRIPT_PATH/Firmware/Firmware.ino || exit 12 - #$BUILDER -compile -logger=machine -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=none -quiet $SCRIPT_PATH/Firmware/Firmware.ino || exit 13 - $BUILDER -compile -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=default $SCRIPT_PATH/Firmware/Firmware.ino || exit 14 - echo "$(tput sgr 0)" - fi - if [ $OSTYPE == "linux-gnu" ] ; then - echo "Start to build Prusa Firmware under Linux 64..." - echo "Using variant $VARIANT$(tput setaf 3)" - sleep 2 - $BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH || exit 14 - echo "$(tput sgr 0)" - fi - - if [ $LANGUAGES == "ALL" ]; then - echo "$(tput setaf 2)" - echo "Building mutli language firmware" $MULTI_LANGUAGE_CHECK - echo "$(tput sgr 0)" - sleep 2 - cd $SCRIPT_PATH/lang - echo "$(tput setaf 3)" - ./config.sh || exit 15 - echo "$(tput sgr 0)" - # Check if privious languages and firmware build exist and if so clean them up - if [ -f "lang_en.tmp" ]; then - echo "" - echo "$(tput setaf 6)Previous lang build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." - echo "$(tput setaf 3)" - ./lang-clean.sh - echo "$(tput sgr 0)" - fi - if [ -f "progmem.out" ]; then - echo "" - echo "$(tput setaf 6)Previous firmware build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." - echo "$(tput setaf 3)" - ./fw-clean.sh - echo "$(tput sgr 0)" - fi - # build languages - echo "$(tput setaf 3)" - ./lang-build.sh || exit 16 - # Combine compiled firmware with languages - ./fw-build.sh || exit 17 - echo "$(tput sgr 0)" - # Check if the motherboard is an EINSY and if so the only one hex file will generated - MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3) - # If the motherboard is an EINSY just copy one hexfile - if [ "$MOTHERBOARD" = "BOARD_EINSY_1_0a" ]; then - echo "$(tput setaf 2)Copying multi language firmware for MK3/Einsy board to Hex-files folder$(tput sgr 0)" - cp -f firmware.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex - else - echo "$(tput setaf 2)Zip multi language firmware for MK2.5/miniRAMbo board to Hex-files folder$(tput sgr 0)" - cp -f firmware_cz.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-cz.hex - cp -f firmware_de.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-de.hex - cp -f firmware_es.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-es.hex - cp -f firmware_fr.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-fr.hex - cp -f firmware_it.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-it.hex - cp -f firmware_pl.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-pl.hex - if [ $OSTYPE == "msys" ]; then - zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex - rm $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex - elif [ $OSTYPE == "linux-gnu" ]; then - zip -m -j ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex - fi - fi - # Cleanup after build - echo "$(tput setaf 3)" - ./fw-clean.sh || exit 18 - ./lang-clean.sh || exit 19 - echo "$(tput sgr 0)" - else - echo "$(tput setaf 2)Copying English only firmware to Hex-files folder$(tput sgr 0)" - cp -f $BUILD_PATH/Firmware.ino.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex || exit 20 - fi - - # Cleanup Firmware - rm $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 17 - sed -i -- "s/^#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/g" $SCRIPT_PATH/Firmware/Configuration.h - sed -i -- 's/^#define FW_REPOSITORY "Prusa3d"/#define FW_REPOSITORY "Unknown"/g' $SCRIPT_PATH/Firmware/Configuration.h - echo $MULTI_LANGUAGE_CHECK - #sed -i -- "s/^#define LANG_MODE * /#define LANG_MODE $MULTI_LANGUAGE_CHECK/g" $SCRIPT_PATH/Firmware/config.h - sed -i -- "s/^#define LANG_MODE *1/#define LANG_MODE ${MULTI_LANGUAGE_CHECK}/g" $SCRIPT_PATH/Firmware/config.h - sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE ${MULTI_LANGUAGE_CHECK}/g" $SCRIPT_PATH/Firmware/config.h - sleep 5 -done - -# Cleanup compiler flags are set to Prusa specific needs for the rambo board. -#if [ $OSTYPE == "msys" ]; then -# echo " " -# echo "Restore Windows platform.txt" -# echo " " -# cp -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE -#fi - -# Switch to hex path and list build files -cd $SCRIPT_PATH -cd .. -echo "$(tput setaf 2) " -echo " " -echo "Build done, please use Slic3rPE > 1.41.0 to upload the firmware" -echo "more information how to flash firmware https://www.prusa3d.com/drivers/ $(tput sgr 0)" -#### End building +cd $SCRIPT_PATH/lang +./lang-build.sh || exit 10 +./fw-build.sh || exit 11 From 4ab4e4da4c55317988e674130420f8eccadde0d4 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sat, 16 Feb 2019 06:07:31 +0100 Subject: [PATCH 025/368] Updated README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af5f8264b..0734ff86e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Now your Ubuntu subsystem is ready to use the automatic `build.sh` script and co #### Compile Prusa-firmware with Ubuntu Linux subsystem installed - open Ubuntu bash - change to your source code folder (case sensitive) -- run `./build.sh` +- run `./PF-build.sh` - follow the instructions ### Steps for Git-bash under Windows 10 64-bit: @@ -61,7 +61,7 @@ Now your Ubuntu subsystem is ready to use the automatic `build.sh` script and co #### Compile Prusa-firmware with Git-bash installed - open Git-bash - change to your source code folder -- run `bash build.sh` +- run `bash PF-build.sh` - follow the instructions From 4d556c8bed9541af9ee79a579135f91da2611b94 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sat, 16 Feb 2019 06:39:57 +0100 Subject: [PATCH 026/368] added MK25S and MK3S to travis check --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index cc420ee79..790e5b306 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,18 @@ before_install: - sudo apt-get install -y ninja-build script: - bash -x test.sh + - cp Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h + - bash -x build.sh || { echo "1_75mm_MK3S-EINSy10a-E3Dv6full variant failed" && false; } + - rm Firmware/Configuration_prusa.h - cp Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h - bash -x build.sh || { echo "1_75mm_MK3-EINSy10a-E3Dv6full variant failed" && false; } - rm Firmware/Configuration_prusa.h + - cp Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h + - bash -x build.sh || { echo "1_75mm_MK25S-RAMBo13a-E3Dv6full variant failed" && false; } + - rm Firmware/Configuration_prusa.h + - cp Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h Firmware/Configuration_prusa.h + - bash -x build.sh || { echo "1_75mm_MK25S-RAMBo10a-E3Dv6full variant failed" && false; } + - rm Firmware/Configuration_prusa.h - cp Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h - bash -x build.sh || { echo "1_75mm_MK25-RAMBo13a-E3Dv6full variant failed" && false; } - rm Firmware/Configuration_prusa.h From 3726936b41b667867cfd629c4240f9f71fc7fabd Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sat, 16 Feb 2019 08:04:45 +0100 Subject: [PATCH 027/368] Added arguments to run PF-build.sh without user input maybe an otion to use travis --- PF-build.sh | 55 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/PF-build.sh b/PF-build.sh index 97d9d1e26..1875c689a 100644 --- a/PF-build.sh +++ b/PF-build.sh @@ -71,7 +71,11 @@ # 15 Feb 2019, 3d-gussner, Fixed selction GOLD/UNKNOWN DEV_STATUS for ALL variants builds, so you have to choose only once # 15 Feb 2019, 3d-gussner, Added some colored output # 15 Feb 2019, 3d-gussner, troubleshooting and minor fixes - +# 16 Feb 2019, 3d-gussner, Script can be run using arguments +# $1 = variant, example "1_75mm_MK3-EINSy10a-E3Dv6full.h" at this moment it is not possible to use ALL +# $2 = multi language OR english only [ALL/EN_ONLY] +# $3 = development status [GOLD/RC/BETA/ALPHA/DEVEL/DEBUG] +# If one argument is wrong a list of valid one will be shown ###Check if OSTYPE is supported @@ -203,7 +207,14 @@ if [ -z "$1" ] ; then esac done else - VARIANT=$1 + if [ -f "$SCRIPT_PATH/Firmware/variants/$1" ] ; then + VARIANTS=$1 + else + echo "$(tput setaf 1)$1 could not be found in Firmware/variants please choose a valid one$(tput setaf 2)" + ls -1 $SCRIPT_PATH/Firmware/variants/*.h | xargs -n1 basename + echo "$(tput sgr0)" + exit + fi fi #Second argument defines if it is an english only version. Known values EN_ONLY / ALL @@ -232,7 +243,23 @@ if [ -z "$2" ] ; then esac done else - LANGUAGES=$2 + if [[ "$2" == "ALL" || "$2" == "EN_ONLY" ]] ; then + LANGUAGES=$2 + else + echo "$(tput setaf 1)Language agrument is wrong!$(tput sgr0)" + echo "Only $(tput setaf 2)'ALL'$(tput sgr0) or $(tput setaf 2)'EN_ONLY'$(tput sgr0) are allowed as 2nd argument!" + exit + fi +fi +#Check if DEV_STATUS is selected via argument 3 +if [ ! -z "$3" ] ; then + if [[ "$3" == "GOLD" || "$3" == "RC" || "$3" == "BETA" || "$3" == "ALPHA" || "$3" == "DEVEL" || "$3" == "DEBUG" ]] ; then + DEV_STATUS_SELECTED=$3 + else + echo "$(tput setaf 1)Development argument is wrong!$(tput sgr0)" + echo "Only $(tput setaf 2)'GOLD', 'RC', 'BETA', 'ALPHA', 'DEVEL' or 'DEBUG'$(tput sgr0) are allowed as 3rd argument!$(tput sgr0)" + exit + fi fi #Set BUILD_ENV_PATH @@ -307,20 +334,20 @@ do #Check if exacly the same hexfile already exsits if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex" && "$LANGUAGES" == "ALL" ]]; then echo "" - ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex + ls -1 $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex | xargs -n1 basename echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." + read -t 10 -p "Press Enter to continue..." elif [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex" && "$LANGUAGES" == "EN_ONLY" ]]; then echo "" - ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex + ls -1 $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex | xargs -n1 basename echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." + read -t 10 -p "Press Enter to continue..." fi if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip" && "$LANGUAGES" == "ALL" ]]; then echo "" - ls $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip + ls -1 $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip | xargs -n1 basename echo "$(tput setaf 6)This zip file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." + read -t 10 -p "Press Enter to continue..." fi #List some useful data @@ -340,7 +367,7 @@ do cp -f $SCRIPT_PATH/Firmware/variants/$VARIANT.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 11 else echo "$(tput setaf 6)Configuration_prusa.h already exist it will be overwritten in 10 seconds by the chosen variant.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." + read -t 10 -p "Press Enter to continue..." cp -f $SCRIPT_PATH/Firmware/variants/$VARIANT.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 11 fi @@ -370,7 +397,7 @@ do echo "Compiler flags not found, adding flags" if [ ! -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck ]; then echo "making a backup" - ls $BUILD_ENV_PATH/portable/packages/rambo/hardware/avr/1.0.1/ + ls -1 $BUILD_ENV_PATH/portable/packages/rambo/hardware/avr/1.0.1/ cp -f $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE.bck fi echo $COMP_FLAGS >> $BUILD_ENV_PATH/portable/packages/$RAMBO_PLATFORM_FILE @@ -388,7 +415,7 @@ do export BUILDER=$ARDUINO/arduino-builder echo - #read -t 5 -p "Press any key..." + #read -t 5 -p "Press Enter..." echo if [ $OSTYPE == "msys" ]; then @@ -421,7 +448,7 @@ do if [ -f "lang_en.tmp" ]; then echo "" echo "$(tput setaf 6)Previous lang build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." + read -t 10 -p "Press Enter to continue..." echo "$(tput setaf 3)" ./lang-clean.sh echo "$(tput sgr 0)" @@ -429,7 +456,7 @@ do if [ -f "progmem.out" ]; then echo "" echo "$(tput setaf 6)Previous firmware build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" - read -t 10 -p "Press any key to continue..." + read -t 10 -p "Press Enter to continue..." echo "$(tput setaf 3)" ./fw-clean.sh echo "$(tput sgr 0)" From ce12e022e2888d998b78ea2547efebee9218e555 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sat, 16 Feb 2019 23:02:23 +0100 Subject: [PATCH 028/368] Changes to PF-build.sh --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0734ff86e..5f560fc0a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you wish to flash from Arduino, follow step [2.c](#2c) from Windows build fir The script downloads Arduino with our modifications and Rambo board support installed, unpacks it into folder PF-build-env-\ on the same level, as your Prusa-Firmware folder is located, builds firmware for MK3 using that Arduino in Prusa-Firmware-build folder on the same level as Prusa-Firmware, runs secondary language support scripts. Firmware with secondary language support is generated in lang subfolder. Use firmware.hex for MK3 variant. Use firmware_\.hex for other printers. Don't forget to follow step [2.b](#2b) first for non-MK3 printers. ## Windows -### If you want to use the automated `build.sh` you gonna need to install on you Windows a Linux subsystem or Git-bash +### If you want to use the automated `PF-build.sh` you gonna need to install on you Windows a Linux subsystem or Git-bash ### Steps for Linux subsystem und Windows 10 64-bit: - follow the Microsoft guide https://docs.microsoft.com/en-us/windows/wsl/install-win10 @@ -34,7 +34,7 @@ The script downloads Arduino with our modifications and Rambo board support inst use `CRTL-X` to close nano and confirm to write the new entries - restart Ubuntu bash -Now your Ubuntu subsystem is ready to use the automatic `build.sh` script and compile your firmware correctly +Now your Ubuntu subsystem is ready to use the automatic `PF-build.sh` script and compile your firmware correctly #### Some Tips for Ubuntu - Linux is case sensetive so please don't forget to use capital letters where needed, like changing to a directory From afc86a1363f1f7bd9067ceb96ba3dc5d0ad94542 Mon Sep 17 00:00:00 2001 From: Laurentiu Date: Mon, 18 Feb 2019 05:50:29 +0200 Subject: [PATCH 029/368] missing ; --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 66a54f453..009530e28 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1592,7 +1592,7 @@ void setup() */ manage_heater(); // Update temperatures #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER - printf_P(_N("Power panic detected!\nCurrent bed temp:%d\nSaved bed temp:%d\n"), (int)degBed(), eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED)) + printf_P(_N("Power panic detected!\nCurrent bed temp:%d\nSaved bed temp:%d\n"), (int)degBed(), eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED)); #endif if ( degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET) ){ #ifdef DEBUG_UVLO_AUTOMATIC_RECOVER From a4cf31b104de1dea83b25a844cdc9bcc03f1a777 Mon Sep 17 00:00:00 2001 From: mkbel <35807926+mkbel@users.noreply.github.com> Date: Tue, 19 Feb 2019 23:57:24 +0100 Subject: [PATCH 030/368] Update README.md Reorder sections, update table of content, add notes and issue tracker link for Windows Linux subsystem and Git-bash builds. --- README.md | 109 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 5f560fc0a..798df4fa6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,10 @@ * [Linux build](#linux) - * [Windows build](#windows) + * Windows build + * [Using Arduino](#using-arduino) + * [Using Linux subsystem](#using-linux-subsystem-under-windows-10-64-bit) + * [Using Git-bash](#using-git-bash-under-windows-10-64-bit) * [Automated tests](#3-automated-tests) * [Documentation](#4-documentation) @@ -16,56 +19,9 @@ If you wish to flash from Arduino, follow step [2.c](#2c) from Windows build fir The script downloads Arduino with our modifications and Rambo board support installed, unpacks it into folder PF-build-env-\ on the same level, as your Prusa-Firmware folder is located, builds firmware for MK3 using that Arduino in Prusa-Firmware-build folder on the same level as Prusa-Firmware, runs secondary language support scripts. Firmware with secondary language support is generated in lang subfolder. Use firmware.hex for MK3 variant. Use firmware_\.hex for other printers. Don't forget to follow step [2.b](#2b) first for non-MK3 printers. ## Windows -### If you want to use the automated `PF-build.sh` you gonna need to install on you Windows a Linux subsystem or Git-bash - -### Steps for Linux subsystem und Windows 10 64-bit: -- follow the Microsoft guide https://docs.microsoft.com/en-us/windows/wsl/install-win10 - You can also use the 'prepare_winbuild.ps1' powershell script with Administrator rights -- Tested versions are at this moment - - Ubuntu other may different - - After the installation and reboot please open your Ubuntu bash and do following steps - - run command `apt-get update` - - to install zip run `apt-get install zip` - - add few lines at the top of `~/.bashrc` by running `sudo nano ~/.bashrc` - - export OS="Linux" - export JAVA_TOOL_OPTIONS="-Djava.net.preferIPv4Stack=true" - export GPG_TTY=$(tty) - - use `CRTL-X` to close nano and confirm to write the new entries - - restart Ubuntu bash -Now your Ubuntu subsystem is ready to use the automatic `PF-build.sh` script and compile your firmware correctly - -#### Some Tips for Ubuntu -- Linux is case sensetive so please don't forget to use capital letters where needed, like changing to a directory -- To change the path to your Prusa-Firmware location you downloaded and unzipped - - Example: You files are under `C:\Users\\Downloads\Prusa-Firmware-MK3` - - use under Ubuntu the following command `cd /mnt/c/Users//Downloads/Prusa-Firmware-MK3` - to change to the right folder - -#### Compile Prusa-firmware with Ubuntu Linux subsystem installed -- open Ubuntu bash -- change to your source code folder (case sensitive) -- run `./PF-build.sh` -- follow the instructions - -### Steps for Git-bash under Windows 10 64-bit: -- Download and install the 64bit Git version https://git-scm.com/download/win -- Also follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 -- Download and install 7z-zip from its official website https://www.7-zip.org/ - By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 -- Run `Git-Bash` under Administrator privilege -- navigate to the directory /c/Program Files/Git/mingw64/bin -- run `ln -s /c/Program Files/7-Zip/7z.exe zip.exe` - -#### Compile Prusa-firmware with Git-bash installed -- open Git-bash -- change to your source code folder -- run `bash PF-build.sh` -- follow the instructions - - -### 1. Development environment preparation +### Using Arduino +note: Multi language build is not supported. +#### 1. Development environment preparation a. install `"Arduino Software IDE"` for your preferred operating system `https://www.arduino.cc -> Software->Downloads` @@ -97,7 +53,7 @@ add "-Wl,-u,vfprintf -lprintf_flt -lm" to "compiler.c.elf.flags=" before existin example: `"compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections"` -### 2. Source code compilation +#### 2. Source code compilation a. place the source codes corresponding to your printer model obtained from the repository into the selected directory on your disk `https://github.com/prusa3d/Prusa-Firmware/` @@ -125,6 +81,55 @@ or you can also save the output code to the file (in so called `HEX`-format) `"F and then upload it to the printer using the program `"FirmwareUpdater"` _note: this file is created in the directory `"Firmware/"`_ +### Using Linux subsystem under Windows 10 64-bit +_notes: Script and instructions contributed by 3d-gussner. Use at your own risk. Script downloads Arduino executables outside of Prusa control. Report problems [there.](https://github.com/3d-gussner/Prusa-Firmware/issues) Multi language build is supported._ +- follow the Microsoft guide https://docs.microsoft.com/en-us/windows/wsl/install-win10 + You can also use the 'prepare_winbuild.ps1' powershell script with Administrator rights +- Tested versions are at this moment + - Ubuntu other may different + - After the installation and reboot please open your Ubuntu bash and do following steps + - run command `apt-get update` + - to install zip run `apt-get install zip` + - add few lines at the top of `~/.bashrc` by running `sudo nano ~/.bashrc` + + export OS="Linux" + export JAVA_TOOL_OPTIONS="-Djava.net.preferIPv4Stack=true" + export GPG_TTY=$(tty) + + use `CRTL-X` to close nano and confirm to write the new entries + - restart Ubuntu bash +Now your Ubuntu subsystem is ready to use the automatic `PF-build.sh` script and compile your firmware correctly + +#### Some Tips for Ubuntu +- Linux is case sensetive so please don't forget to use capital letters where needed, like changing to a directory +- To change the path to your Prusa-Firmware location you downloaded and unzipped + - Example: You files are under `C:\Users\\Downloads\Prusa-Firmware-MK3` + - use under Ubuntu the following command `cd /mnt/c/Users//Downloads/Prusa-Firmware-MK3` + to change to the right folder + +#### Compile Prusa-firmware with Ubuntu Linux subsystem installed +- open Ubuntu bash +- change to your source code folder (case sensitive) +- run `./PF-build.sh` +- follow the instructions + +### Using Git-bash under Windows 10 64-bit +_notes: Script and instructions contributed by 3d-gussner. Use at your own risk. Script downloads Arduino executables outside of Prusa control. Report problems [there.](https://github.com/3d-gussner/Prusa-Firmware/issues) Multi language build is supported._ +- Download and install the 64bit Git version https://git-scm.com/download/win +- Also follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 +- Download and install 7z-zip from its official website https://www.7-zip.org/ + By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 +- Run `Git-Bash` under Administrator privilege +- navigate to the directory /c/Program Files/Git/mingw64/bin +- run `ln -s /c/Program Files/7-Zip/7z.exe zip.exe` + +#### Compile Prusa-firmware with Git-bash installed +- open Git-bash +- change to your source code folder +- run `bash PF-build.sh` +- follow the instructions + + # 3. Automated tests ## Prerequisites c++11 compiler e.g. g++ 6.3.1 From da0867cfc5fa80e11ccde7eb67711d4555e8c8ba Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 20 Feb 2019 03:01:33 +0100 Subject: [PATCH 031/368] preHeat @ filament management another funcionality --- Firmware/Marlin_main.cpp | 2 +- Firmware/menu.cpp | 14 ++++++++ Firmware/menu.h | 1 + Firmware/mmu.cpp | 11 ++++-- Firmware/ultralcd.cpp | 78 ++++++++++++++++++++++++++-------------- Firmware/ultralcd.h | 3 +- 6 files changed, 78 insertions(+), 31 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 8511a83f1..fc53b2049 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7507,7 +7507,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; - mFilamentItem(target_temperature[0]); + mFilamentItem(target_temperature[0],target_temperature_bed); } else { diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index eef792952..f6bc6055b 100644 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -85,6 +85,19 @@ void menu_end(void) } } +//-// +void menu_back(uint8_t nLevel) +{ + menu_depth = ((menu_depth > nLevel) ? (menu_depth - nLevel) : 0); + menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, true, true); +} + +void menu_back(void) +{ +menu_back(1); +} + +/* void menu_back(void) { if (menu_depth > 0) @@ -93,6 +106,7 @@ void menu_back(void) menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, true, true); } } +*/ static void menu_back_no_reset(void) { diff --git a/Firmware/menu.h b/Firmware/menu.h index 73e4925a6..efe2220c4 100644 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -54,6 +54,7 @@ void menu_start(void); extern void menu_end(void); extern void menu_back(void); +extern void menu_back(uint8_t nLevel); extern void menu_back_if_clicked(void); diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 8dfef148e..5e1e5471a 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1030,8 +1030,11 @@ void extr_unload() uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); #endif - if (degHotend0() > EXTRUDE_MINTEMP) +//-// if (degHotend0() > EXTRUDE_MINTEMP) +//if(current_temperature[0]>(target_temperature[0]*0.95)) +if(bFilamentAction) { +bFilamentAction=false; #ifndef SNMM st_synchronize(); @@ -1109,7 +1112,7 @@ void extr_unload() bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; - mFilamentItem(target_temperature[0]); + mFilamentItem(target_temperature[0],target_temperature_bed); } else menu_submenu(mFilamentMenu); } @@ -1340,6 +1343,8 @@ void mmu_show_warning() void lcd_mmu_load_to_nozzle(uint8_t filament_nr) { +//-// +bFilamentAction=false; if (degHotend0() > EXTRUDE_MINTEMP) { tmp_extruder = filament_nr; @@ -1371,6 +1376,8 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr) void mmu_eject_filament(uint8_t filament, bool recover) { +//-// +bFilamentAction=false; if (filament < 5) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c7df6b66d..93651434e 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2306,6 +2306,7 @@ void lcd_set_filament_oq_meass() eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized as 'non-autoLoad' bool bFilamentFirstRun; bool bFilamentPreheatState; +bool bFilamentAction=false; static void mFilamentPrompt() { @@ -2331,8 +2332,9 @@ switch(eFilamentAction) } if(lcd_clicked()) { - menu_back(); - menu_back(); +//./ menu_back(); +//./ menu_back(); +menu_back(2); if(!bFilamentPreheatState) { menu_back(); @@ -2349,12 +2351,17 @@ if(lcd_clicked()) enquecommand_P(PSTR("M702")); // unload filament break; case e_FILAMENT_ACTION_mmuLoad: + MYSERIAL.println("mFilamentPrompt - mmuLoad"); +bFilamentAction=true; menu_submenu(mmu_load_to_nozzle_menu); break; case e_FILAMENT_ACTION_mmuUnLoad: +bFilamentAction=true; extr_unload(); break; case e_FILAMENT_ACTION_mmuEject: + MYSERIAL.println("mFilamentPrompt - mmuEject"); +bFilamentAction=true; menu_submenu(mmu_fil_eject_menu); break; } @@ -2363,13 +2370,15 @@ if(lcd_clicked()) } } -void mFilamentItem(uint16_t nTemp) +void mFilamentItem(uint16_t nTemp,uint16_t nTempBed) { -static int nTargetOld; +static int nTargetOld,nTargetBedOld; //if(bPreheatState) // not necessary nTargetOld=target_temperature[0]; + nTargetBedOld=target_temperature_bed; setTargetHotend0((float)nTemp); +setTargetBed((float)nTempBed); lcd_timeoutToStatus.stop(); lcd_set_cursor(0,0); lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); @@ -2396,14 +2405,19 @@ if(lcd_clicked()) if(!bFilamentPreheatState) { setTargetHotend0(0.0); + setTargetBed(0.0); menu_back(); } - else setTargetHotend0((float)nTargetOld); + else { + setTargetHotend0((float)nTargetOld); + setTargetBed((float)nTargetBedOld); + } menu_back(); if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } -else if(!isHeatingHotend0()) +//./else if(!isHeatingHotend0()) +else if(current_temperature[0]>(target_temperature[0]*0.95)) { menu_submenu(mFilamentPrompt); Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); @@ -2413,37 +2427,37 @@ else if(!isHeatingHotend0()) static void mFilamentItem_PLA() { bFilamentPreheatState=false; -mFilamentItem(PLA_PREHEAT_HOTEND_TEMP); +mFilamentItem(PLA_PREHEAT_HOTEND_TEMP,PLA_PREHEAT_HPB_TEMP); } static void mFilamentItem_PET() { bFilamentPreheatState=false; -mFilamentItem(PET_PREHEAT_HOTEND_TEMP); +mFilamentItem(PET_PREHEAT_HOTEND_TEMP,PET_PREHEAT_HPB_TEMP); } static void mFilamentItem_ABS() { bFilamentPreheatState=false; -mFilamentItem(ABS_PREHEAT_HOTEND_TEMP); +mFilamentItem(ABS_PREHEAT_HOTEND_TEMP,ABS_PREHEAT_HPB_TEMP); } static void mFilamentItem_HIPS() { bFilamentPreheatState=false; -mFilamentItem(HIPS_PREHEAT_HOTEND_TEMP); +mFilamentItem(HIPS_PREHEAT_HOTEND_TEMP,HIPS_PREHEAT_HPB_TEMP); } static void mFilamentItem_PP() { bFilamentPreheatState=false; -mFilamentItem(PP_PREHEAT_HOTEND_TEMP); +mFilamentItem(PP_PREHEAT_HOTEND_TEMP,PP_PREHEAT_HPB_TEMP); } static void mFilamentItem_FLEX() { bFilamentPreheatState=false; -mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP); +mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP,FLEX_PREHEAT_HPB_TEMP); } @@ -2458,19 +2472,20 @@ void mFilamentMenu() { MENU_BEGIN(); MENU_ITEM_FUNCTION_P(_T(MSG_MAIN),mFilamentBack); -MENU_ITEM_SUBMENU_P(PSTR("PLA - " STRINGIFY(PLA_PREHEAT_HOTEND_TEMP)),mFilamentItem_PLA); -MENU_ITEM_SUBMENU_P(PSTR("PET - " STRINGIFY(PET_PREHEAT_HOTEND_TEMP)),mFilamentItem_PET); -MENU_ITEM_SUBMENU_P(PSTR("ABS - " STRINGIFY(ABS_PREHEAT_HOTEND_TEMP)),mFilamentItem_ABS); -MENU_ITEM_SUBMENU_P(PSTR("HIPS - " STRINGIFY(HIPS_PREHEAT_HOTEND_TEMP)),mFilamentItem_HIPS); -MENU_ITEM_SUBMENU_P(PSTR("PP - " STRINGIFY(PP_PREHEAT_HOTEND_TEMP)),mFilamentItem_PP); -MENU_ITEM_SUBMENU_P(PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP)),mFilamentItem_FLEX); +MENU_ITEM_SUBMENU_P(PSTR("PLA - " STRINGIFY(PLA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PLA_PREHEAT_HPB_TEMP)),mFilamentItem_PLA); +MENU_ITEM_SUBMENU_P(PSTR("PET - " STRINGIFY(PET_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PET_PREHEAT_HPB_TEMP)),mFilamentItem_PET); +MENU_ITEM_SUBMENU_P(PSTR("ABS - " STRINGIFY(ABS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(ABS_PREHEAT_HPB_TEMP)),mFilamentItem_ABS); +MENU_ITEM_SUBMENU_P(PSTR("HIPS - " STRINGIFY(HIPS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(HIPS_PREHEAT_HPB_TEMP)),mFilamentItem_HIPS); +MENU_ITEM_SUBMENU_P(PSTR("PP - " STRINGIFY(PP_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PP_PREHEAT_HPB_TEMP)),mFilamentItem_PP); +MENU_ITEM_SUBMENU_P(PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(FLEX_PREHEAT_HPB_TEMP)),mFilamentItem_FLEX); MENU_END(); } void lcd_unLoadFilament() { -if((degHotend0()>EXTRUDE_MINTEMP)&&bFilamentFirstRun) +//./if((degHotend0()>EXTRUDE_MINTEMP)&&bFilamentFirstRun) +if(0) { menu_back(); enquecommand_P(PSTR("M702")); // unload filament @@ -2481,7 +2496,7 @@ else { if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; - mFilamentItem(target_temperature[0]); + mFilamentItem(target_temperature[0],target_temperature_bed); } else mFilamentMenu(); } @@ -2699,7 +2714,8 @@ static void lcd_menu_AutoLoadFilament() static void lcd_LoadFilament() { - if (degHotend0() > EXTRUDE_MINTEMP) +//-// if (degHotend0() > EXTRUDE_MINTEMP) +if(0) { // menu_back(); // not necessary (see "lcd_return_to_status()" below) custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; @@ -2715,7 +2731,7 @@ static void lcd_LoadFilament() if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; - mFilamentItem(target_temperature[0]); + mFilamentItem(target_temperature[0],target_temperature_bed); } else mFilamentMenu(); } @@ -5626,8 +5642,11 @@ static void fil_load_menu() static void mmu_load_to_nozzle_menu() { -if (degHotend0() > EXTRUDE_MINTEMP) +//-//if (degHotend0() > EXTRUDE_MINTEMP) +//if(current_temperature[0]>(target_temperature[0]*0.95)) +if(bFilamentAction) { +//../bFilamentAction=false; MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0); @@ -5643,7 +5662,7 @@ else { if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; - mFilamentItem(target_temperature[0]); + mFilamentItem(target_temperature[0],target_temperature_bed); } else mFilamentMenu(); } @@ -5651,8 +5670,11 @@ else { static void mmu_fil_eject_menu() { -if (degHotend0() > EXTRUDE_MINTEMP) +//-//if (degHotend0() > EXTRUDE_MINTEMP) +//if(current_temperature[0]>(target_temperature[0]*0.95)) +if(bFilamentAction) { +//../bFilamentAction=false; MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_fil_0); @@ -5663,12 +5685,13 @@ if (degHotend0() > EXTRUDE_MINTEMP) MENU_END(); } else { + MYSERIAL.println(" eject - else"); eFilamentAction=e_FILAMENT_ACTION_mmuEject; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; - mFilamentItem(target_temperature[0]); + mFilamentItem(target_temperature[0],target_temperature_bed); } else mFilamentMenu(); } @@ -6142,7 +6165,8 @@ static void lcd_main_menu() { MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); - MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); +//-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); } else diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index bf3e4697b..dd1132f86 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -138,7 +138,8 @@ typedef enum extern eFILAMENT_ACTION eFilamentAction; extern bool bFilamentFirstRun; extern bool bFilamentPreheatState; -void mFilamentItem(uint16_t nTemp); +extern bool bFilamentAction; +void mFilamentItem(uint16_t nTemp,uint16_t nTempBed); void mFilamentMenu(); void unload_filament(); From 1e729048dc9ebb921c1f1b6970ac622a17af6fbd Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 21 Feb 2019 00:14:49 +0100 Subject: [PATCH 032/368] cmdqueue_reset fix --- Firmware/cmdqueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index f1cd48f88..2f892c9cf 100644 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -94,7 +94,7 @@ void cmdqueue_reset() bufindr = 0; bufindw = 0; buflen = 0; - cmdbuffer_front_already_processed = false; + cmdbuffer_front_already_processed = true; } // How long a string could be pushed to the front of the command queue? From 326c8492b53cea2bd964f646f43b6fe1170e71e9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 21 Feb 2019 00:38:10 +0100 Subject: [PATCH 033/368] Move extruder forth and back after filament detected by sensor to detect bad load. --- Firmware/mmu.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 5e1e5471a..2cb654085 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1418,11 +1418,16 @@ static void load_more() { for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) { - if (PIN_GET(IR_SENSOR_PIN) == 0) return; + if (PIN_GET(IR_SENSOR_PIN) == 0) break; DEBUG_PRINTF_P(PSTR("Additional load attempt nr. %d\n"), i); mmu_command(MmuCmd::C0); manage_response(true, true, MMU_LOAD_MOVE); } + current_position[E_AXIS] += 60; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + current_position[E_AXIS] -= 58; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + st_synchronize(); } void mmu_continue_loading() From 8b858286ac5a27a90b2ff1eec3e06b5df7c3e7a2 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 21 Feb 2019 02:30:01 +0100 Subject: [PATCH 034/368] Document. --- Firmware/mmu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2cb654085..a51b708f2 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1414,6 +1414,12 @@ bFilamentAction=false; } } +//! @brief load more +//! +//! Try to feed more filament from MMU if it is not detected by filament sensor. +//! Move filament back and forth to nozzle in order to detect jam. +//! If PTFE tube is jammed, this cause filament to be unloaded and no longer +//! detected by pulley IR sensor in next step. static void load_more() { for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) From a54c68b874f7ccb5c21e177879ad21afb6e59bff Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Thu, 21 Feb 2019 04:45:44 +0100 Subject: [PATCH 035/368] preHeat @ filament management another funcionality II --- Firmware/menu.cpp | 19 +--------- Firmware/mmu.cpp | 60 +++++++++++++++++++++++++------- Firmware/mmu.h | 2 ++ Firmware/ultralcd.cpp | 81 ++++++++++++++++++++++++++++++++----------- 4 files changed, 111 insertions(+), 51 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index f6bc6055b..a3fb4d184 100644 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -16,7 +16,7 @@ extern int32_t lcd_encoder; -#define MENU_DEPTH_MAX 4 +#define MENU_DEPTH_MAX 6 static menu_record_t menu_stack[MENU_DEPTH_MAX]; @@ -85,7 +85,6 @@ void menu_end(void) } } -//-// void menu_back(uint8_t nLevel) { menu_depth = ((menu_depth > nLevel) ? (menu_depth - nLevel) : 0); @@ -97,17 +96,6 @@ void menu_back(void) menu_back(1); } -/* -void menu_back(void) -{ - if (menu_depth > 0) - { - menu_depth--; - menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, true, true); - } -} -*/ - static void menu_back_no_reset(void) { if (menu_depth > 0) @@ -394,8 +382,3 @@ template uint8_t menu_item_edit_P(const char* str, int16_t *pval, int1 template uint8_t menu_item_edit_P(const char* str, uint8_t *pval, int16_t min_val, int16_t max_val); #undef _menu_data - - - - - diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 5e1e5471a..e18b0932d 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1022,6 +1022,28 @@ void mmu_filament_ramming() } } +//-// +void extr_unload_() +{ +//if(bFilamentAction) +if(0) + { + bFilamentAction=false; + extr_unload(); + } +else { + eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0],target_temperature_bed); + } +// else menu_submenu(mFilamentMenu); + else mFilamentMenu(); + } +} + void extr_unload() { //unload just current filament for multimaterial printers #ifdef SNMM @@ -1030,11 +1052,8 @@ void extr_unload() uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); #endif -//-// if (degHotend0() > EXTRUDE_MINTEMP) -//if(current_temperature[0]>(target_temperature[0]*0.95)) -if(bFilamentAction) + if (degHotend0() > EXTRUDE_MINTEMP) { -bFilamentAction=false; #ifndef SNMM st_synchronize(); @@ -1108,13 +1127,7 @@ bFilamentAction=false; } else { - eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); - } - else menu_submenu(mFilamentMenu); + show_preheat_nozzle_warning(); } //lcd_return_to_status(); } @@ -1172,51 +1185,71 @@ void extr_adj_4() void mmu_load_to_nozzle_0() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(0); } void mmu_load_to_nozzle_1() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(1); } void mmu_load_to_nozzle_2() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(2); } void mmu_load_to_nozzle_3() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(3); } void mmu_load_to_nozzle_4() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(4); } void mmu_eject_fil_0() { +//-// + menu_back(); mmu_eject_filament(0, true); } void mmu_eject_fil_1() { +//-// + menu_back(); mmu_eject_filament(1, true); } void mmu_eject_fil_2() { +//-// + menu_back(); mmu_eject_filament(2, true); } void mmu_eject_fil_3() { +//-// + menu_back(); mmu_eject_filament(3, true); } void mmu_eject_fil_4() { +//-// + menu_back(); mmu_eject_filament(4, true); } @@ -1344,7 +1377,7 @@ void mmu_show_warning() void lcd_mmu_load_to_nozzle(uint8_t filament_nr) { //-// -bFilamentAction=false; +bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()" if (degHotend0() > EXTRUDE_MINTEMP) { tmp_extruder = filament_nr; @@ -1377,7 +1410,8 @@ bFilamentAction=false; void mmu_eject_filament(uint8_t filament, bool recover) { //-// -bFilamentAction=false; +bFilamentAction=false; // NOT in "mmu_fil_eject_menu()" +return; if (filament < 5) { diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 71930ae7c..446c9aec0 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -101,6 +101,8 @@ extern int get_ext_nr(); extern void display_loading(); extern void extr_adj(int extruder); extern void extr_unload(); +//-// +extern void extr_unload_(); extern void extr_adj_0(); extern void extr_adj_1(); extern void extr_adj_2(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 93651434e..f6502cef9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2310,6 +2310,8 @@ bool bFilamentAction=false; static void mFilamentPrompt() { +uint8_t nLevel; + lcd_set_cursor(0,0); lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); lcd_set_cursor(0,2); @@ -2332,14 +2334,13 @@ switch(eFilamentAction) } if(lcd_clicked()) { -//./ menu_back(); -//./ menu_back(); -menu_back(2); + nLevel=2; if(!bFilamentPreheatState) { - menu_back(); -//-// setTargetHotend0(0.0); + nLevel++; +// setTargetHotend0(0.0); // uncoment if return to base state is required } + menu_back(nLevel); switch(eFilamentAction) { case e_FILAMENT_ACTION_Load: @@ -2350,20 +2351,27 @@ menu_back(2); case e_FILAMENT_ACTION_unLoad: enquecommand_P(PSTR("M702")); // unload filament break; +/* case e_FILAMENT_ACTION_mmuLoad: - MYSERIAL.println("mFilamentPrompt - mmuLoad"); -bFilamentAction=true; +//./ MYSERIAL.println("mFilamentPrompt - mmuLoad"); + bFilamentAction=true; menu_submenu(mmu_load_to_nozzle_menu); break; +*/ +/* case e_FILAMENT_ACTION_mmuUnLoad: -bFilamentAction=true; +//./ MYSERIAL.println("mFilamentPrompt - mmuUnLoad"); + bFilamentAction=true; extr_unload(); break; +*/ +/* case e_FILAMENT_ACTION_mmuEject: MYSERIAL.println("mFilamentPrompt - mmuEject"); -bFilamentAction=true; - menu_submenu(mmu_fil_eject_menu); + bFilamentAction=true; +// menu_submenu(mmu_fil_eject_menu); break; +*/ } if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad @@ -2373,6 +2381,8 @@ bFilamentAction=true; void mFilamentItem(uint16_t nTemp,uint16_t nTempBed) { static int nTargetOld,nTargetBedOld; +uint8_t nLevel; +static bool bBeep=false; //if(bPreheatState) // not necessary nTargetOld=target_temperature[0]; @@ -2416,12 +2426,47 @@ if(lcd_clicked()) if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } -//./else if(!isHeatingHotend0()) -else if(current_temperature[0]>(target_temperature[0]*0.95)) +else { + if(current_temperature[0]>(target_temperature[0]*0.95)) { - menu_submenu(mFilamentPrompt); - Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); + switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_unLoad: + menu_submenu(mFilamentPrompt); + break; + case e_FILAMENT_ACTION_mmuLoad: + nLevel=1; + if(!bFilamentPreheatState) + nLevel++; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_load_to_nozzle_menu); + break; + case e_FILAMENT_ACTION_mmuUnLoad: + nLevel=1; + if(!bFilamentPreheatState) + nLevel++; + bFilamentAction=true; + menu_back(nLevel); + extr_unload(); + break; + case e_FILAMENT_ACTION_mmuEject: + nLevel=1; + if(!bFilamentPreheatState) + nLevel++; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_fil_eject_menu); + break; + } + if(bBeep) + Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); + bBeep=false; } + else bBeep=true; + } } static void mFilamentItem_PLA() @@ -5643,10 +5688,8 @@ static void fil_load_menu() static void mmu_load_to_nozzle_menu() { //-//if (degHotend0() > EXTRUDE_MINTEMP) -//if(current_temperature[0]>(target_temperature[0]*0.95)) if(bFilamentAction) { -//../bFilamentAction=false; MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0); @@ -5671,10 +5714,8 @@ else { static void mmu_fil_eject_menu() { //-//if (degHotend0() > EXTRUDE_MINTEMP) -//if(current_temperature[0]>(target_temperature[0]*0.95)) if(bFilamentAction) { -//../bFilamentAction=false; MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_fil_0); @@ -5685,7 +5726,6 @@ if(bFilamentAction) MENU_END(); } else { - MYSERIAL.println(" eject - else"); eFilamentAction=e_FILAMENT_ACTION_mmuEject; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) @@ -6166,7 +6206,8 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); //-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); +//bFilamentFirstRun=true; + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload_); MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); } else From 323071f50a787722907494ac6e6b22ed51c46301 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Thu, 21 Feb 2019 04:45:44 +0100 Subject: [PATCH 036/368] preHeat @ filament management another funcionality II --- Firmware/menu.cpp | 19 +--------- Firmware/mmu.cpp | 60 +++++++++++++++++++++++++------- Firmware/mmu.h | 2 ++ Firmware/ultralcd.cpp | 81 ++++++++++++++++++++++++++++++++----------- 4 files changed, 111 insertions(+), 51 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index f6bc6055b..a3fb4d184 100644 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -16,7 +16,7 @@ extern int32_t lcd_encoder; -#define MENU_DEPTH_MAX 4 +#define MENU_DEPTH_MAX 6 static menu_record_t menu_stack[MENU_DEPTH_MAX]; @@ -85,7 +85,6 @@ void menu_end(void) } } -//-// void menu_back(uint8_t nLevel) { menu_depth = ((menu_depth > nLevel) ? (menu_depth - nLevel) : 0); @@ -97,17 +96,6 @@ void menu_back(void) menu_back(1); } -/* -void menu_back(void) -{ - if (menu_depth > 0) - { - menu_depth--; - menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position, true, true); - } -} -*/ - static void menu_back_no_reset(void) { if (menu_depth > 0) @@ -394,8 +382,3 @@ template uint8_t menu_item_edit_P(const char* str, int16_t *pval, int1 template uint8_t menu_item_edit_P(const char* str, uint8_t *pval, int16_t min_val, int16_t max_val); #undef _menu_data - - - - - diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 5e1e5471a..e18b0932d 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1022,6 +1022,28 @@ void mmu_filament_ramming() } } +//-// +void extr_unload_() +{ +//if(bFilamentAction) +if(0) + { + bFilamentAction=false; + extr_unload(); + } +else { + eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0],target_temperature_bed); + } +// else menu_submenu(mFilamentMenu); + else mFilamentMenu(); + } +} + void extr_unload() { //unload just current filament for multimaterial printers #ifdef SNMM @@ -1030,11 +1052,8 @@ void extr_unload() uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); #endif -//-// if (degHotend0() > EXTRUDE_MINTEMP) -//if(current_temperature[0]>(target_temperature[0]*0.95)) -if(bFilamentAction) + if (degHotend0() > EXTRUDE_MINTEMP) { -bFilamentAction=false; #ifndef SNMM st_synchronize(); @@ -1108,13 +1127,7 @@ bFilamentAction=false; } else { - eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); - } - else menu_submenu(mFilamentMenu); + show_preheat_nozzle_warning(); } //lcd_return_to_status(); } @@ -1172,51 +1185,71 @@ void extr_adj_4() void mmu_load_to_nozzle_0() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(0); } void mmu_load_to_nozzle_1() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(1); } void mmu_load_to_nozzle_2() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(2); } void mmu_load_to_nozzle_3() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(3); } void mmu_load_to_nozzle_4() { +//-// + menu_back(); lcd_mmu_load_to_nozzle(4); } void mmu_eject_fil_0() { +//-// + menu_back(); mmu_eject_filament(0, true); } void mmu_eject_fil_1() { +//-// + menu_back(); mmu_eject_filament(1, true); } void mmu_eject_fil_2() { +//-// + menu_back(); mmu_eject_filament(2, true); } void mmu_eject_fil_3() { +//-// + menu_back(); mmu_eject_filament(3, true); } void mmu_eject_fil_4() { +//-// + menu_back(); mmu_eject_filament(4, true); } @@ -1344,7 +1377,7 @@ void mmu_show_warning() void lcd_mmu_load_to_nozzle(uint8_t filament_nr) { //-// -bFilamentAction=false; +bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()" if (degHotend0() > EXTRUDE_MINTEMP) { tmp_extruder = filament_nr; @@ -1377,7 +1410,8 @@ bFilamentAction=false; void mmu_eject_filament(uint8_t filament, bool recover) { //-// -bFilamentAction=false; +bFilamentAction=false; // NOT in "mmu_fil_eject_menu()" +return; if (filament < 5) { diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 71930ae7c..446c9aec0 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -101,6 +101,8 @@ extern int get_ext_nr(); extern void display_loading(); extern void extr_adj(int extruder); extern void extr_unload(); +//-// +extern void extr_unload_(); extern void extr_adj_0(); extern void extr_adj_1(); extern void extr_adj_2(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 93651434e..f6502cef9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2310,6 +2310,8 @@ bool bFilamentAction=false; static void mFilamentPrompt() { +uint8_t nLevel; + lcd_set_cursor(0,0); lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); lcd_set_cursor(0,2); @@ -2332,14 +2334,13 @@ switch(eFilamentAction) } if(lcd_clicked()) { -//./ menu_back(); -//./ menu_back(); -menu_back(2); + nLevel=2; if(!bFilamentPreheatState) { - menu_back(); -//-// setTargetHotend0(0.0); + nLevel++; +// setTargetHotend0(0.0); // uncoment if return to base state is required } + menu_back(nLevel); switch(eFilamentAction) { case e_FILAMENT_ACTION_Load: @@ -2350,20 +2351,27 @@ menu_back(2); case e_FILAMENT_ACTION_unLoad: enquecommand_P(PSTR("M702")); // unload filament break; +/* case e_FILAMENT_ACTION_mmuLoad: - MYSERIAL.println("mFilamentPrompt - mmuLoad"); -bFilamentAction=true; +//./ MYSERIAL.println("mFilamentPrompt - mmuLoad"); + bFilamentAction=true; menu_submenu(mmu_load_to_nozzle_menu); break; +*/ +/* case e_FILAMENT_ACTION_mmuUnLoad: -bFilamentAction=true; +//./ MYSERIAL.println("mFilamentPrompt - mmuUnLoad"); + bFilamentAction=true; extr_unload(); break; +*/ +/* case e_FILAMENT_ACTION_mmuEject: MYSERIAL.println("mFilamentPrompt - mmuEject"); -bFilamentAction=true; - menu_submenu(mmu_fil_eject_menu); + bFilamentAction=true; +// menu_submenu(mmu_fil_eject_menu); break; +*/ } if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad @@ -2373,6 +2381,8 @@ bFilamentAction=true; void mFilamentItem(uint16_t nTemp,uint16_t nTempBed) { static int nTargetOld,nTargetBedOld; +uint8_t nLevel; +static bool bBeep=false; //if(bPreheatState) // not necessary nTargetOld=target_temperature[0]; @@ -2416,12 +2426,47 @@ if(lcd_clicked()) if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } -//./else if(!isHeatingHotend0()) -else if(current_temperature[0]>(target_temperature[0]*0.95)) +else { + if(current_temperature[0]>(target_temperature[0]*0.95)) { - menu_submenu(mFilamentPrompt); - Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); + switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_unLoad: + menu_submenu(mFilamentPrompt); + break; + case e_FILAMENT_ACTION_mmuLoad: + nLevel=1; + if(!bFilamentPreheatState) + nLevel++; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_load_to_nozzle_menu); + break; + case e_FILAMENT_ACTION_mmuUnLoad: + nLevel=1; + if(!bFilamentPreheatState) + nLevel++; + bFilamentAction=true; + menu_back(nLevel); + extr_unload(); + break; + case e_FILAMENT_ACTION_mmuEject: + nLevel=1; + if(!bFilamentPreheatState) + nLevel++; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_fil_eject_menu); + break; + } + if(bBeep) + Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); + bBeep=false; } + else bBeep=true; + } } static void mFilamentItem_PLA() @@ -5643,10 +5688,8 @@ static void fil_load_menu() static void mmu_load_to_nozzle_menu() { //-//if (degHotend0() > EXTRUDE_MINTEMP) -//if(current_temperature[0]>(target_temperature[0]*0.95)) if(bFilamentAction) { -//../bFilamentAction=false; MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0); @@ -5671,10 +5714,8 @@ else { static void mmu_fil_eject_menu() { //-//if (degHotend0() > EXTRUDE_MINTEMP) -//if(current_temperature[0]>(target_temperature[0]*0.95)) if(bFilamentAction) { -//../bFilamentAction=false; MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_fil_0); @@ -5685,7 +5726,6 @@ if(bFilamentAction) MENU_END(); } else { - MYSERIAL.println(" eject - else"); eFilamentAction=e_FILAMENT_ACTION_mmuEject; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) @@ -6166,7 +6206,8 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); //-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); +//bFilamentFirstRun=true; + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload_); MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); } else From 6ad5c07e6d4dd438d4b43a9d51bb976a97caeb4a Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 21 Feb 2019 14:28:05 +0100 Subject: [PATCH 037/368] comments --- Firmware/cmdqueue.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index 2f892c9cf..c7035ba13 100644 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -94,7 +94,11 @@ void cmdqueue_reset() bufindr = 0; bufindw = 0; buflen = 0; - cmdbuffer_front_already_processed = true; + + //commands are removed from command queue after process_command() function is finished + //reseting command queue and enqueing new commands during some (usually long running) command processing would cause that new commands are immediately removed from queue (or damaged) + //this will ensure that all new commands which are enqueued after cmdqueue reset, will be always executed + cmdbuffer_front_already_processed = true; } // How long a string could be pushed to the front of the command queue? From ed93f1b7f0127e505f41b5bdadc97dec9076173c Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Thu, 21 Feb 2019 15:27:22 +0100 Subject: [PATCH 038/368] preHeat @ filament management another funcionality IIb --- Firmware/mmu.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index e18b0932d..2f7bf96c3 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1411,7 +1411,6 @@ void mmu_eject_filament(uint8_t filament, bool recover) { //-// bFilamentAction=false; // NOT in "mmu_fil_eject_menu()" -return; if (filament < 5) { From da28773480b013d9f8dcb812e2167152fdad5f35 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 21 Feb 2019 19:16:24 +0100 Subject: [PATCH 039/368] version change --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index d1f67069b..13d2f1a05 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.5.3" -#define FW_COMMIT_NR 2007 +#define FW_VERSION "3.6.0-RC1" +#define FW_COMMIT_NR 2060 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From be0ed46335353542ce8e9da6cc8a8c668d7a90d7 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Fri, 22 Feb 2019 03:09:50 +0100 Subject: [PATCH 040/368] preHeat @ filament management another funcionality III --- Firmware/Marlin_main.cpp | 9 +++- Firmware/ultralcd.cpp | 108 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 113 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index fc53b2049..7cfeec82e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7482,7 +7482,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { - if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active +//-// if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active + if (mcode_in_progress != 600) //M600 not in progress { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { @@ -7491,6 +7492,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef PAT9125 fsensor_autoload_check_stop(); #endif //PAT9125 +//-// if (degHotend0() > EXTRUDE_MINTEMP) { if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE)) @@ -7502,6 +7504,10 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s } else { + lcd_update_enable(false); + show_preheat_nozzle_warning(); + lcd_update_enable(true); +/* eFilamentAction=e_FILAMENT_ACTION_autoLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) @@ -7514,6 +7520,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s menu_submenu(mFilamentMenu); lcd_timeoutToStatus.start(); } +*/ } } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f6502cef9..90b74ec0d 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2307,6 +2307,7 @@ eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized bool bFilamentFirstRun; bool bFilamentPreheatState; bool bFilamentAction=false; +bool bFilamentWaitingFlag=false; static void mFilamentPrompt() { @@ -2338,14 +2339,14 @@ if(lcd_clicked()) if(!bFilamentPreheatState) { nLevel++; -// setTargetHotend0(0.0); // uncoment if return to base state is required +// setTargetHotend0(0.0); // uncoment if return to base-state is required } menu_back(nLevel); switch(eFilamentAction) { case e_FILAMENT_ACTION_Load: case e_FILAMENT_ACTION_autoLoad: - loading_flag = true; + loading_flag=true; enquecommand_P(PSTR("M701")); // load filament break; case e_FILAMENT_ACTION_unLoad: @@ -2378,7 +2379,8 @@ if(lcd_clicked()) } } -void mFilamentItem(uint16_t nTemp,uint16_t nTempBed) +/* +void _mFilamentItem(uint16_t nTemp,uint16_t nTempBed) { static int nTargetOld,nTargetBedOld; uint8_t nLevel; @@ -2468,6 +2470,106 @@ else { else bBeep=true; } } +*/ + +void mFilamentItem(uint16_t nTemp,uint16_t nTempBed) +{ +static int nTargetOld,nTargetBedOld; +uint8_t nLevel; + +//if(bPreheatState) // not necessary + nTargetOld=target_temperature[0]; + nTargetBedOld=target_temperature_bed; +setTargetHotend0((float)nTemp); +setTargetBed((float)nTempBed); +lcd_timeoutToStatus.stop(); +if(current_temperature[0]>(target_temperature[0]*0.95)) + { + switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_unLoad: + if(bFilamentWaitingFlag) + menu_submenu(mFilamentPrompt); + else { + nLevel=bFilamentPreheatState?1:2; + menu_back(nLevel); + if((eFilamentAction==e_FILAMENT_ACTION_Load)||(eFilamentAction==e_FILAMENT_ACTION_autoLoad)) + { + loading_flag=true; + enquecommand_P(PSTR("M701")); // load filament + } + if(eFilamentAction==e_FILAMENT_ACTION_unLoad) + enquecommand_P(PSTR("M702")); // unload filament + } +//./if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) +//./ eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + break; + case e_FILAMENT_ACTION_mmuLoad: + nLevel=bFilamentPreheatState?1:2; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_load_to_nozzle_menu); + break; + case e_FILAMENT_ACTION_mmuUnLoad: + nLevel=bFilamentPreheatState?1:2; + bFilamentAction=true; + menu_back(nLevel); + extr_unload(); + break; + case e_FILAMENT_ACTION_mmuEject: + nLevel=bFilamentPreheatState?1:2; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_fil_eject_menu); + break; + } + if(bFilamentWaitingFlag) + Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); + bFilamentWaitingFlag=false; + } +else { + bFilamentWaitingFlag=true; + lcd_set_cursor(0,0); + lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); + lcd_set_cursor(0,1); + switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_mmuLoad: + lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_unLoad: + case e_FILAMENT_ACTION_mmuUnLoad: + lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_mmuEject: + lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 + break; + } + lcd_set_cursor(0,3); + lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1 + if(lcd_clicked()) + { + bFilamentWaitingFlag=false; + if(!bFilamentPreheatState) + { + setTargetHotend0(0.0); + setTargetBed(0.0); + menu_back(); + } + else { + setTargetHotend0((float)nTargetOld); + setTargetBed((float)nTargetBedOld); + } + menu_back(); + if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + } + } +} static void mFilamentItem_PLA() { From 62875f2e954130146f4eb2146856681857ac36b4 Mon Sep 17 00:00:00 2001 From: Laurentiu Date: Fri, 22 Feb 2019 14:35:48 +0200 Subject: [PATCH 041/368] MESH_MEAS_NUM_X_POINTS constant correction to MESH_MEAS_NUM_Y_POINTS --- Firmware/mesh_bed_calibration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 2813945ca..ec814f056 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -2937,7 +2937,7 @@ bool scan_bed_induction_points(int8_t verbosity_level) uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; float bedX = BED_X(ix, MESH_MEAS_NUM_X_POINTS); - float bedY = BED_Y(iy, MESH_MEAS_NUM_X_POINTS); + float bedY = BED_Y(iy, MESH_MEAS_NUM_Y_POINTS); current_position[X_AXIS] = vec_x[0] * bedX + vec_y[0] * bedY + cntr[0]; current_position[Y_AXIS] = vec_x[1] * bedX + vec_y[1] * bedY + cntr[1]; // The calibration points are very close to the min Y. From 51827c578f5745b5990f5ff4bdbf080bb0faf1ef Mon Sep 17 00:00:00 2001 From: Laurentiu Date: Fri, 22 Feb 2019 15:05:06 +0200 Subject: [PATCH 042/368] MESH_MEAS_NUM_X_POINTS constant correction to MESH_MEAS_NUM_Y_POINTS --- Firmware/mesh_bed_calibration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index ec814f056..0f56d999b 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -2405,7 +2405,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; current_position[X_AXIS] = BED_X(ix, MESH_MEAS_NUM_X_POINTS); - current_position[Y_AXIS] = BED_Y(iy, MESH_MEAS_NUM_X_POINTS); + current_position[Y_AXIS] = BED_Y(iy, MESH_MEAS_NUM_Y_POINTS); go_to_current(homing_feedrate[X_AXIS] / 60); delay_keep_alive(3000); } From 26cab2911f85f86b716cb4e9c7f0db37bc1d332c Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 22 Feb 2019 16:30:54 +0100 Subject: [PATCH 043/368] mmu stealth mode --- Firmware/mmu.cpp | 7 ++++++- Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2f7bf96c3..1c0e0a41e 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -223,7 +223,12 @@ void mmu_loop(void) if (!version_valid) mmu_show_warning(); else puts_P(PSTR("MMU version valid")); - if ((PRINTER_TYPE == PRINTER_MK3) || (PRINTER_TYPE == PRINTER_MK3_SNMM)) + bool activate_stealth_mode = (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); +#ifdef MMU_STEALTH_MODE + activate_stealth_mode = true; +#endif //MMU_STEALTH_MODE + + if (!activate_stealth_mode) { FDEBUG_PUTS_P(PSTR("MMU <= 'P0'")); mmu_puts_P(PSTR("P0\n")); //send 'read finda' request diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index a9dcefe41..dd836b69a 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -498,7 +498,8 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -//#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_STEALTH_MODE +#define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 38d181349..9715aa7d9 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -499,7 +499,8 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -//#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_STEALTH_MODE +#define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index 53b545e8b..b814d1cbb 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -498,7 +498,8 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -//#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_STEALTH_MODE +#define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index e786b70ff..3f38a286f 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -499,7 +499,8 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -//#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_STEALTH_MODE +#define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning From 8e3d52ee6db8f5a1135b32e5cfef8c67a695bf9d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 22 Feb 2019 17:15:40 +0100 Subject: [PATCH 044/368] fix compilation error for MK2.5, make code more readable --- Firmware/mmu.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 1c0e0a41e..d1be76d4c 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -181,6 +181,18 @@ bool check_for_ir_sensor() #endif //IR_SENSOR } +static bool activate_stealth_mode() +{ + bool activate_stealth_mode = false; +#ifdef SILENT_MODE_STEALTH + activate_stealth_mode = (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); +#endif //SILENT_MODE_STEALTH +#ifdef MMU_STEALTH_MODE + activate_stealth_mode = true; +#endif //MMU_STEALTH_MODE + return activate_stealth_mode; +} + //mmu main loop - state machine processing void mmu_loop(void) { @@ -222,13 +234,8 @@ void mmu_loop(void) bool version_valid = mmu_check_version(); if (!version_valid) mmu_show_warning(); else puts_P(PSTR("MMU version valid")); - - bool activate_stealth_mode = (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); -#ifdef MMU_STEALTH_MODE - activate_stealth_mode = true; -#endif //MMU_STEALTH_MODE - - if (!activate_stealth_mode) + + if (!activate_stealth_mode()) { FDEBUG_PUTS_P(PSTR("MMU <= 'P0'")); mmu_puts_P(PSTR("P0\n")); //send 'read finda' request From d5c5ed55eb7de4f66a557655cb7d5b889c733c22 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 25 Feb 2019 11:12:39 +0100 Subject: [PATCH 045/368] Change formatting. --- Firmware/ultralcd.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index dd1132f86..4bf514d9b 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -134,7 +134,15 @@ void extr_unload_used(); void extr_unload(); typedef enum - {e_FILAMENT_ACTION_none,e_FILAMENT_ACTION_Load,e_FILAMENT_ACTION_autoLoad,e_FILAMENT_ACTION_unLoad,e_FILAMENT_ACTION_mmuLoad,e_FILAMENT_ACTION_mmuUnLoad,e_FILAMENT_ACTION_mmuEject} eFILAMENT_ACTION; // 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) +{ + e_FILAMENT_ACTION_none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) + e_FILAMENT_ACTION_Load, + e_FILAMENT_ACTION_autoLoad, + e_FILAMENT_ACTION_unLoad, + e_FILAMENT_ACTION_mmuLoad, + e_FILAMENT_ACTION_mmuUnLoad, + e_FILAMENT_ACTION_mmuEject, +} eFILAMENT_ACTION; extern eFILAMENT_ACTION eFilamentAction; extern bool bFilamentFirstRun; extern bool bFilamentPreheatState; From 34e24954879118201f6a1ef8b199597b7d5f73df Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 26 Feb 2019 10:32:10 +0100 Subject: [PATCH 046/368] Convert mmu_load_to_nozzle_0 to mmu_load_to_nozzle_4 to template. --- Firmware/mmu.cpp | 34 ---------------------------------- Firmware/mmu.h | 5 ----- Firmware/ultralcd.cpp | 18 ++++++++++++------ 3 files changed, 12 insertions(+), 45 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2f7bf96c3..158b3cb77 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1183,40 +1183,6 @@ void extr_adj_4() #endif } -void mmu_load_to_nozzle_0() -{ -//-// - menu_back(); - lcd_mmu_load_to_nozzle(0); -} - -void mmu_load_to_nozzle_1() -{ -//-// - menu_back(); - lcd_mmu_load_to_nozzle(1); -} - -void mmu_load_to_nozzle_2() -{ -//-// - menu_back(); - lcd_mmu_load_to_nozzle(2); -} - -void mmu_load_to_nozzle_3() -{ -//-// - menu_back(); - lcd_mmu_load_to_nozzle(3); -} - -void mmu_load_to_nozzle_4() -{ -//-// - menu_back(); - lcd_mmu_load_to_nozzle(4); -} void mmu_eject_fil_0() { diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 446c9aec0..b2f9cefb8 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -108,11 +108,6 @@ extern void extr_adj_1(); extern void extr_adj_2(); extern void extr_adj_3(); extern void extr_adj_4(); -extern void mmu_load_to_nozzle_0(); -extern void mmu_load_to_nozzle_1(); -extern void mmu_load_to_nozzle_2(); -extern void mmu_load_to_nozzle_3(); -extern void mmu_load_to_nozzle_4(); extern void load_all(); extern void extr_change_0(); extern void extr_change_1(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f6502cef9..339d5195d 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5685,18 +5685,24 @@ static void fil_load_menu() MENU_END(); } +template +static void mmu_load_to_nozzle() +{ + menu_back(); + lcd_mmu_load_to_nozzle(filament); +} + static void mmu_load_to_nozzle_menu() { -//-//if (degHotend0() > EXTRUDE_MINTEMP) if(bFilamentAction) { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0); - MENU_ITEM_FUNCTION_P(_i("Load filament 2"), mmu_load_to_nozzle_1); - MENU_ITEM_FUNCTION_P(_i("Load filament 3"), mmu_load_to_nozzle_2); - MENU_ITEM_FUNCTION_P(_i("Load filament 4"), mmu_load_to_nozzle_3); - MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle_4); + MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle<0>); + MENU_ITEM_FUNCTION_P(_i("Load filament 2"), mmu_load_to_nozzle<1>); + MENU_ITEM_FUNCTION_P(_i("Load filament 3"), mmu_load_to_nozzle<2>); + MENU_ITEM_FUNCTION_P(_i("Load filament 4"), mmu_load_to_nozzle<3>); + MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle<4>); MENU_END(); } else { From 7a1b47c340b357161663be96c6e51d5e580d6972 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 26 Feb 2019 11:11:05 +0100 Subject: [PATCH 047/368] Convert functions mmu_eject_fil_0 to mmu_eject_fil_4 to template function. --- Firmware/mmu.cpp | 36 ----------------------------- Firmware/mmu.h | 5 ---- Firmware/ultralcd.cpp | 53 ++++++++++++++++++++++++------------------- 3 files changed, 30 insertions(+), 64 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 158b3cb77..c77276be1 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1183,42 +1183,6 @@ void extr_adj_4() #endif } - -void mmu_eject_fil_0() -{ -//-// - menu_back(); - mmu_eject_filament(0, true); -} - -void mmu_eject_fil_1() -{ -//-// - menu_back(); - mmu_eject_filament(1, true); -} - -void mmu_eject_fil_2() -{ -//-// - menu_back(); - mmu_eject_filament(2, true); -} - -void mmu_eject_fil_3() -{ -//-// - menu_back(); - mmu_eject_filament(3, true); -} - -void mmu_eject_fil_4() -{ -//-// - menu_back(); - mmu_eject_filament(4, true); -} - void load_all() { #ifndef SNMM diff --git a/Firmware/mmu.h b/Firmware/mmu.h index b2f9cefb8..3b0d41860 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -127,11 +127,6 @@ extern bool mmu_check_version(); extern void mmu_show_warning(); extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr); extern void mmu_eject_filament(uint8_t filament, bool recover); -extern void mmu_eject_fil_0(); -extern void mmu_eject_fil_1(); -extern void mmu_eject_fil_2(); -extern void mmu_eject_fil_3(); -extern void mmu_eject_fil_4(); extern void mmu_continue_loading(); extern void mmu_filament_ramming(); extern void mmu_wait_for_heater_blocking(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 339d5195d..00c939bb6 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4745,7 +4745,7 @@ static void lcd_wizard_unload() } else { - mmu_eject_fil_0(); + mmu_eject_filament(0, true); } } else @@ -5717,30 +5717,37 @@ else { } } +template +static void mmu_eject_filament() +{ + menu_back(); + mmu_eject_filament(filament, true); +} + static void mmu_fil_eject_menu() { -//-//if (degHotend0() > EXTRUDE_MINTEMP) -if(bFilamentAction) -{ - MENU_BEGIN(); - MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_fil_0); - MENU_ITEM_FUNCTION_P(_i("Eject filament 2"), mmu_eject_fil_1); - MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_fil_2); - MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_fil_3); - MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_fil_4); - MENU_END(); -} -else { - eFilamentAction=e_FILAMENT_ACTION_mmuEject; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) - { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); - } - else mFilamentMenu(); - } + if(bFilamentAction) + { + MENU_BEGIN(); + MENU_ITEM_BACK_P(_T(MSG_MAIN)); + MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_filament<0>); + MENU_ITEM_FUNCTION_P(_i("Eject filament 2"), mmu_eject_filament<1>); + MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_filament<2>); + MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_filament<3>); + MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_filament<4>); + MENU_END(); + } + else + { + eFilamentAction=e_FILAMENT_ACTION_mmuEject; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0],target_temperature_bed); + } + else mFilamentMenu(); + } } #ifdef SNMM From 6c9dd4f2725e6aaceb06c058c9d7c4fe65d65ee7 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 26 Feb 2019 13:40:23 +0100 Subject: [PATCH 048/368] Add filament ramming to eject filament. --- Firmware/mmu.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2f7bf96c3..12b6d64b1 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1422,9 +1422,7 @@ bFilamentAction=false; // NOT in "mmu_fil_eject_menu( LcdUpdateDisabler disableLcdUpdate; lcd_clear(); lcd_set_cursor(0, 1); lcd_puts_P(_i("Ejecting filament")); - current_position[E_AXIS] -= 80; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2500 / 60, active_extruder); - st_synchronize(); + mmu_filament_ramming(); mmu_command(MmuCmd::E0 + filament); manage_response(false, false, MMU_UNLOAD_MOVE); if (recover) From 5a5a482a59c2302837e72e7452f0f0263d9cae9b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 26 Feb 2019 13:59:44 +0100 Subject: [PATCH 049/368] Rename preprocessor macro K1 to PID_K1 to avoid future conflict with MMU command. --- Firmware/Configuration.h | 2 +- Firmware/temperature.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 13d2f1a05..db8d54ec2 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -132,7 +132,7 @@ //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term - #define K1 0.95 //smoothing factor within the PID + #define PID_K1 0.95 //smoothing factor within the PID #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index e156734b8..99a0d0c95 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -662,9 +662,9 @@ void manage_heater() iState_sum[e] += pid_error[e]; iState_sum[e] = constrain(iState_sum[e], iState_sum_min[e], iState_sum_max[e]); iTerm[e] = cs.Ki * iState_sum[e]; - // K1 defined in Configuration.h in the PID settings - #define K2 (1.0-K1) - dTerm[e] = (cs.Kd * (pid_input - dState_last[e]))*K2 + (K1 * dTerm[e]); // e.g. digital filtration of derivative term changes + // PID_K1 defined in Configuration.h in the PID settings + #define K2 (1.0-PID_K1) + dTerm[e] = (cs.Kd * (pid_input - dState_last[e]))*K2 + (PID_K1 * dTerm[e]); // e.g. digital filtration of derivative term changes pid_output = pTerm[e] + iTerm[e] - dTerm[e]; // subtraction due to "Derivative on Measurement" method (i.e. derivative of input instead derivative of error is used) if (pid_output > PID_MAX) { if (pid_error[e] > 0 ) iState_sum[e] -= pid_error[e]; // conditional un-integration @@ -811,9 +811,9 @@ void manage_heater() temp_iState_bed = constrain(temp_iState_bed, temp_iState_min_bed, temp_iState_max_bed); iTerm_bed = cs.bedKi * temp_iState_bed; - //K1 defined in Configuration.h in the PID settings - #define K2 (1.0-K1) - dTerm_bed= (cs.bedKd * (pid_input - temp_dState_bed))*K2 + (K1 * dTerm_bed); + //PID_K1 defined in Configuration.h in the PID settings + #define K2 (1.0-PID_K1) + dTerm_bed= (cs.bedKd * (pid_input - temp_dState_bed))*K2 + (PID_K1 * dTerm_bed); temp_dState_bed = pid_input; pid_output = pTerm_bed + iTerm_bed - dTerm_bed; From ff35119ef30f5dc1be813fabf17157b37322d497 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 26 Feb 2019 17:33:37 +0100 Subject: [PATCH 050/368] preHeat @ filament management another funcionality III / autoLoad --- Firmware/Marlin_main.cpp | 15 ++++++++------- Firmware/ultralcd.cpp | 9 +++++++-- Firmware/ultralcd.h | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7cfeec82e..b0f1e633e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7482,8 +7482,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { -//-// if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active - if (mcode_in_progress != 600) //M600 not in progress +//-// if (mcode_in_progress != 600) //M600 not in progress + if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { @@ -7492,8 +7492,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef PAT9125 fsensor_autoload_check_stop(); #endif //PAT9125 -//-// - if (degHotend0() > EXTRUDE_MINTEMP) +//-// if (degHotend0() > EXTRUDE_MINTEMP) +if(0) { if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE)) _tone(BEEPER, 1000); @@ -7504,23 +7504,24 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s } else { +/* lcd_update_enable(false); show_preheat_nozzle_warning(); lcd_update_enable(true); -/* +*/ eFilamentAction=e_FILAMENT_ACTION_autoLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); +// mFilamentItem(target_temperature[0],target_temperature_bed); + menu_submenu(mFilamentItemForce); } else { menu_submenu(mFilamentMenu); lcd_timeoutToStatus.start(); } -*/ } } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 90b74ec0d..5a04796f7 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2499,12 +2499,12 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) { loading_flag=true; enquecommand_P(PSTR("M701")); // load filament + if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } if(eFilamentAction==e_FILAMENT_ACTION_unLoad) enquecommand_P(PSTR("M702")); // unload filament } -//./if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) -//./ eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad break; case e_FILAMENT_ACTION_mmuLoad: nLevel=bFilamentPreheatState?1:2; @@ -2628,6 +2628,11 @@ MENU_ITEM_SUBMENU_P(PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP) "/" STRI MENU_END(); } +void mFilamentItemForce() +{ +mFilamentItem(target_temperature[0],target_temperature_bed); +} + void lcd_unLoadFilament() { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index dd1132f86..c407bbed3 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -140,6 +140,7 @@ extern bool bFilamentFirstRun; extern bool bFilamentPreheatState; extern bool bFilamentAction; void mFilamentItem(uint16_t nTemp,uint16_t nTempBed); +void mFilamentItemForce(); void mFilamentMenu(); void unload_filament(); From 815231bc26ea89c720df0a5bedbfd99d99793df3 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 26 Feb 2019 17:58:00 +0100 Subject: [PATCH 051/368] Add MMU cut filament menu. --- Firmware/mmu.cpp | 28 +++++++++++++++++++++++++++ Firmware/mmu.h | 6 ++++++ Firmware/ultralcd.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++ Firmware/ultralcd.h | 1 + 4 files changed, 80 insertions(+) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index c77276be1..53e7458a6 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -297,6 +297,14 @@ void mmu_loop(void) mmu_fil_loaded = false; mmu_state = S::WaitCmd; } + else if ((mmu_cmd >= MmuCmd::K0) && (mmu_cmd <= MmuCmd::K4)) + { + const uint8_t filament = mmu_cmd - MmuCmd::K0; + DEBUG_PRINTF_P(PSTR("MMU <= 'K%d'\n"), filament); + mmu_printf_P(PSTR("K%d\n"), filament); //send eject filament + mmu_fil_loaded = false; + mmu_state = S::WaitCmd; + } else if (mmu_cmd == MmuCmd::R0) { DEBUG_PRINTF_P(PSTR("MMU <= 'R0'\n")); @@ -1337,6 +1345,26 @@ bFilamentAction=false; // NOT in "mmu_load_to_nozzle_ } } +void mmu_cut_filament(uint8_t filament_nr) +{ +bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()" + if (degHotend0() > EXTRUDE_MINTEMP) + { + LcdUpdateDisabler disableLcdUpdate; + lcd_clear(); + lcd_set_cursor(0, 1); lcd_puts_P(_i("Cutting filament")); //// c=18 r=1 + lcd_print(" "); + lcd_print(filament_nr + 1); + mmu_filament_ramming(); + mmu_command(MmuCmd::K0 + filament_nr); + manage_response(false, false, MMU_UNLOAD_MOVE); + } + else + { + show_preheat_nozzle_warning(); + } +} + void mmu_eject_filament(uint8_t filament, bool recover) { //-// diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 3b0d41860..b498a3749 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -52,6 +52,11 @@ enum class MmuCmd : uint_least8_t E2, E3, E4, + K0, + K1, + K2, + K3, + K4, R0, S3, W0, @@ -127,6 +132,7 @@ extern bool mmu_check_version(); extern void mmu_show_warning(); extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr); extern void mmu_eject_filament(uint8_t filament, bool recover); +extern void mmu_cut_filament(uint8_t filament_nr); extern void mmu_continue_loading(); extern void mmu_filament_ramming(); extern void mmu_wait_for_heater_blocking(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 00c939bb6..46dd1a3ce 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -144,6 +144,7 @@ static void lcd_menu_show_sensors_state(); static void mmu_fil_eject_menu(); static void mmu_load_to_nozzle_menu(); +static void mmu_cut_filament_menu(); #if defined(TMC2130) || defined(FILAMENT_SENSOR) static void lcd_menu_fails_stats(); @@ -2407,6 +2408,9 @@ switch(eFilamentAction) case e_FILAMENT_ACTION_mmuEject: lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 break; + case e_FILAMENT_ACTION_mmuCut: + lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1 + break; } lcd_set_cursor(0,3); lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1 @@ -2460,6 +2464,14 @@ else { menu_back(nLevel); menu_submenu(mmu_fil_eject_menu); break; + case e_FILAMENT_ACTION_mmuCut: + nLevel=1; + if(!bFilamentPreheatState) + nLevel++; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_cut_filament_menu); + break; } if(bBeep) Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); @@ -5750,6 +5762,38 @@ static void mmu_fil_eject_menu() } } +template +static void mmu_cut_filament() +{ + menu_back(); + mmu_cut_filament(filament); +} + +static void mmu_cut_filament_menu() +{ +if(bFilamentAction) +{ + MENU_BEGIN(); + MENU_ITEM_BACK_P(_T(MSG_MAIN)); + MENU_ITEM_FUNCTION_P(_i("Cut filament 1"), mmu_cut_filament<0>); + MENU_ITEM_FUNCTION_P(_i("Cut filament 2"), mmu_cut_filament<1>); + MENU_ITEM_FUNCTION_P(_i("Cut filament 3"), mmu_cut_filament<2>); + MENU_ITEM_FUNCTION_P(_i("Cut filament 4"), mmu_cut_filament<3>); + MENU_ITEM_FUNCTION_P(_i("Cut filament 5"), mmu_cut_filament<4>); + MENU_END(); +} +else { + eFilamentAction=e_FILAMENT_ACTION_mmuCut; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0],target_temperature_bed); + } + else mFilamentMenu(); + } +} + #ifdef SNMM static void fil_unload_menu() { @@ -6222,6 +6266,7 @@ static void lcd_main_menu() //bFilamentFirstRun=true; MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload_); MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); + MENU_ITEM_SUBMENU_P(_i("Cut filament"), mmu_cut_filament_menu); } else { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 4bf514d9b..c947a346d 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -142,6 +142,7 @@ typedef enum e_FILAMENT_ACTION_mmuLoad, e_FILAMENT_ACTION_mmuUnLoad, e_FILAMENT_ACTION_mmuEject, + e_FILAMENT_ACTION_mmuCut, } eFILAMENT_ACTION; extern eFILAMENT_ACTION eFilamentAction; extern bool bFilamentFirstRun; From 49b1d1cb9371c4b4a63218984cb1f2ff0b44a709 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 26 Feb 2019 18:50:15 +0100 Subject: [PATCH 052/368] Move prototype to header file. --- Firmware/Marlin.h | 1 + Firmware/temperature.cpp | 2 -- Firmware/ultralcd.cpp | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 37c2fda15..2d469a764 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -284,6 +284,7 @@ void setPwmFrequency(uint8_t pin, int val); #define CRITICAL_SECTION_END SREG = _sreg; #endif //CRITICAL_SECTION_START +extern bool fans_check_enabled; extern float homing_feedrate[]; extern bool axis_relative_modes[]; extern int feedmultiply; diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 99a0d0c95..f6ad87615 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -483,8 +483,6 @@ void countFanSpeed() fan_edge_counter[1] = 0; } -extern bool fans_check_enabled; - void checkFanSpeed() { uint8_t max_print_fan_errors = 0; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 46dd1a3ce..5dba13840 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -41,8 +41,6 @@ #include "static_assert.h" #include "io_atmega2560.h" -extern bool fans_check_enabled; - int scrollstuff = 0; char longFilenameOLD[LONG_FILENAME_LENGTH]; From 2f1e9685634462714de1244eaf2420be349affad Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 26 Feb 2019 23:17:52 +0100 Subject: [PATCH 053/368] "lcd_update_enable()" replacement --- Firmware/mmu.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2f7bf96c3..08bfd845c 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1044,6 +1044,16 @@ else { } } +//-// +void extr_unload_view() +{ +lcd_clear(); +lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT)); +lcd_print(" "); +if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" "); +else lcd_print(mmu_extruder + 1); +} + void extr_unload() { //unload just current filament for multimaterial printers #ifdef SNMM @@ -1058,12 +1068,15 @@ void extr_unload() st_synchronize(); //show which filament is currently unloaded - lcd_update_enable(false); +//-// lcd_update_enable(false); +menu_submenu(extr_unload_view); +/* lcd_clear(); lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT)); lcd_print(" "); if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" "); else lcd_print(mmu_extruder + 1); +*/ mmu_filament_ramming(); @@ -1071,7 +1084,8 @@ void extr_unload() // get response manage_response(false, true, MMU_UNLOAD_MOVE); - lcd_update_enable(true); +//-// lcd_update_enable(true); +menu_back(); #else //SNMM lcd_clear(); From 4a4eb9962cbd783324879229bf8e7e77ff125cc7 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 27 Feb 2019 10:42:26 +0100 Subject: [PATCH 054/368] Cut filament when cutter is enabled and MMU load fails. --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 1 + Firmware/mmu.cpp | 6 ++++++ Firmware/ultralcd.cpp | 10 ++++++++++ 4 files changed, 18 insertions(+) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2d469a764..ff9335ac5 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -285,6 +285,7 @@ void setPwmFrequency(uint8_t pin, int val); #endif //CRITICAL_SECTION_START extern bool fans_check_enabled; +extern bool cutter_enabled; extern float homing_feedrate[]; extern bool axis_relative_modes[]; extern int feedmultiply; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index fc53b2049..ee00f35b7 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -510,6 +510,7 @@ void servo_init() bool fans_check_enabled = true; +bool cutter_enabled = false; #ifdef TMC2130 diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 07ea844a4..37bd631d4 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1439,6 +1439,12 @@ void mmu_continue_loading() if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1); if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1); + if (cutter_enabled) + { + mmu_command(MmuCmd::K0 + tmp_extruder); + manage_response(true, true, MMU_UNLOAD_MOVE); + } + mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); load_more(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5dba13840..573002412 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -199,6 +199,7 @@ static void fil_unload_menu(); #endif // SNMM || SNMM_V2 static void lcd_disable_farm_mode(); static void lcd_set_fan_check(); +static void lcd_cutter_enabled(); static char snmm_stop_print_menu(); #ifdef SDCARD_SORT_ALPHA static void lcd_sort_type_set(); @@ -2292,6 +2293,10 @@ void lcd_set_fan_check() { eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED, fans_check_enabled); } +void lcd_cutter_enabled() { + cutter_enabled = !cutter_enabled; +} + void lcd_set_filament_autoload() { fsensor_autoload_set(!fsensor_autoload_enabled); } @@ -5207,6 +5212,11 @@ static void lcd_settings_menu() SETTINGS_AUTO_DEPLETE; + if (cutter_enabled == true) + MENU_ITEM_FUNCTION_P(_i("Cutter [on]"), lcd_cutter_enabled);////MSG_FANS_CHECK_ON c=17 r=1 + else + MENU_ITEM_FUNCTION_P(_i("Cutter [off]"), lcd_cutter_enabled);////MSG_FANS_CHECK_OFF c=17 r=1 + if (fans_check_enabled == true) MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1 else From 02a692c5d9dd7cb0cefc5c3bb69f9c25885118b6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 27 Feb 2019 17:34:03 +0100 Subject: [PATCH 055/368] Store cutter enable state in EEPROM. --- Firmware/Marlin.h | 1 - Firmware/Marlin_main.cpp | 2 -- Firmware/eeprom.h | 2 +- Firmware/mmu.cpp | 2 +- Firmware/ultralcd.cpp | 18 +++++++++++++----- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index ff9335ac5..2d469a764 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -285,7 +285,6 @@ void setPwmFrequency(uint8_t pin, int val); #endif //CRITICAL_SECTION_START extern bool fans_check_enabled; -extern bool cutter_enabled; extern float homing_feedrate[]; extern bool axis_relative_modes[]; extern int feedmultiply; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index ee00f35b7..d9766e96a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -510,8 +510,6 @@ void servo_init() bool fans_check_enabled = true; -bool cutter_enabled = false; - #ifdef TMC2130 diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 9f878796e..16c02ed58 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -153,7 +153,7 @@ #define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t #define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t - +#define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1) // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 37bd631d4..cdd85e9bb 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1439,7 +1439,7 @@ void mmu_continue_loading() if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1); if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1); - if (cutter_enabled) + if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) { mmu_command(MmuCmd::K0 + tmp_extruder); manage_response(true, true, MMU_UNLOAD_MOVE); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 573002412..d925ce053 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2293,8 +2293,16 @@ void lcd_set_fan_check() { eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED, fans_check_enabled); } -void lcd_cutter_enabled() { - cutter_enabled = !cutter_enabled; +void lcd_cutter_enabled() +{ + if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + { + eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 0); + } + else + { + eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 1); + } } void lcd_set_filament_autoload() { @@ -5212,10 +5220,10 @@ static void lcd_settings_menu() SETTINGS_AUTO_DEPLETE; - if (cutter_enabled == true) - MENU_ITEM_FUNCTION_P(_i("Cutter [on]"), lcd_cutter_enabled);////MSG_FANS_CHECK_ON c=17 r=1 + if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + MENU_ITEM_FUNCTION_P(_i("Cutter [on]"), lcd_cutter_enabled);//// c=17 r=1 else - MENU_ITEM_FUNCTION_P(_i("Cutter [off]"), lcd_cutter_enabled);////MSG_FANS_CHECK_OFF c=17 r=1 + MENU_ITEM_FUNCTION_P(_i("Cutter [off]"), lcd_cutter_enabled);//// c=17 r=1 if (fans_check_enabled == true) MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1 From 2a005caf42a0724306b699ad46a0c0b9c14cf301 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 27 Feb 2019 17:47:51 +0100 Subject: [PATCH 056/368] Add cutter enable to tune menu. --- Firmware/ultralcd.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d925ce053..f8cbd6b2c 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5097,6 +5097,29 @@ do\ }\ while(0)\ +static bool settingsCutter() +{ + if (mmu_enabled) + { + if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + { + if (menu_item_function_P(_i("Cutter [on]"), lcd_cutter_enabled)) return true;//// c=17 r=1 + } + else + { + if (menu_item_function_P(_i("Cutter [off]"), lcd_cutter_enabled)) return true;//// c=17 r=1 + } + } + return false; +} + +#define SETTINGS_CUTTER \ +do\ +{\ + if(settingsCutter()) return;\ +}\ +while(0)\ + #ifdef TMC2130 #define SETTINGS_SILENT_MODE \ do\ @@ -5220,10 +5243,7 @@ static void lcd_settings_menu() SETTINGS_AUTO_DEPLETE; - if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) - MENU_ITEM_FUNCTION_P(_i("Cutter [on]"), lcd_cutter_enabled);//// c=17 r=1 - else - MENU_ITEM_FUNCTION_P(_i("Cutter [off]"), lcd_cutter_enabled);//// c=17 r=1 + SETTINGS_CUTTER; if (fans_check_enabled == true) MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1 @@ -6422,6 +6442,8 @@ static void lcd_tune_menu() SETTINGS_AUTO_DEPLETE; + SETTINGS_CUTTER; + #ifdef TMC2130 if(!farm_mode) { From e27fdafcec987f872b3cb63dfde484ae912514c2 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 28 Feb 2019 19:42:09 +0100 Subject: [PATCH 057/368] menu switch - initial --- .gitignore | 1 + Firmware/Marlin_main.cpp | 2 +- Firmware/eeprom.h | 5 +++-- Firmware/mesh_bed_calibration.cpp | 17 +++++++++++++++++ Firmware/mesh_bed_calibration.h | 9 +++++++++ Firmware/ultralcd.cpp | 24 ++++++++++++++++++++++++ 6 files changed, 55 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7bae2ff63..bbd9b9ac2 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ Firmware/Doc /lang/textaddr.txt /build-env/ /Firmware/Firmware.vcxproj +/Firmware/Configuration_prusa_bckp.h diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a89aac74a..c89ac3ef8 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1472,7 +1472,7 @@ void setup() if (eeprom_read_byte((uint8_t*)EEPROM_SD_SORT) == 255) { eeprom_write_byte((uint8_t*)EEPROM_SD_SORT, 0); } - + mbl_mode_init(); check_babystep(); //checking if Z babystep is in allowed range #ifdef UVLO_SUPPORT diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index eb99e5bca..907f88781 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -154,8 +154,9 @@ #define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t #define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t -#define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_LOAD_FAIL - 1000 - 12*12*2) //allow 12 calibration points for future expansion -//-1000 is to be compatible with future updates from prusa if it not merged, real value is 2503 so there is space +#define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_LOAD_FAIL - 12*12*2) //allow 12 calibration points for future expansion +#define EEPROM_MBL_TYPE (EEPROM_UVLO_MESH_BED_LEVELING_FULL-1) //uint8_t for mesh bed leveling precision + // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 0f56d999b..1ab22c4f2 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3048,3 +3048,20 @@ void count_xyz_details(float (&distanceMin)[2]) { } } +e_MBL_TYPE e_mbl_type = e_MBL_OPTIMAL; + +void mbl_mode_set() { + switch (e_mbl_type) { + case e_MBL_OPTIMAL: e_mbl_type = e_MBL_PREC; break; + case e_MBL_PREC: e_mbl_type = e_MBL_FAST; break; + case e_MBL_FAST: e_mbl_type = e_MBL_OPTIMAL; break; + default: e_mbl_type = e_MBL_OPTIMAL; break; + } + eeprom_update_byte((uint8_t*)EEPROM_MBL_TYPE,(uint8_t)e_mbl_type); +} + +void mbl_mode_init() { + uint8_t mbl_type = eeprom_read_byte((uint8_t*)EEPROM_MBL_TYPE); + if (mbl_type == 0xFF) e_mbl_type = e_MBL_OPTIMAL; + else e_mbl_type = mbl_type; +} \ No newline at end of file diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index 4990d104b..9c7f45455 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -201,4 +201,13 @@ extern void babystep_reset(); extern void count_xyz_details(float (&distanceMin)[2]); extern bool sample_z(); +typedef enum +{ + e_MBL_FAST, e_MBL_OPTIMAL, e_MBL_PREC +} e_MBL_TYPE; + +extern e_MBL_TYPE e_mbl_type; +extern void mbl_mode_set(); +extern void mbl_mode_init(); + #endif /* MESH_BED_CALIBRATION_H */ diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5a04796f7..37fd4746a 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5265,6 +5265,28 @@ do\ while (0) #endif // SDCARD_SORT_ALPHA +#define SETTINGS_MBL_MODE \ +do\ +{\ + switch(e_mbl_type)\ + {\ + case e_MBL_FAST:\ + MENU_ITEM_FUNCTION_P(_i("MBL mode [Fast]"),mbl_mode_set);\ + break; \ + case e_MBL_OPTIMAL:\ + MENU_ITEM_FUNCTION_P(_i("MBL mode [Optimal]"), mbl_mode_set); \ + break; \ + case e_MBL_PREC:\ + MENU_ITEM_FUNCTION_P(_i("MBL mode [Precise]"), mbl_mode_set); \ + break; \ + default:\ + MENU_ITEM_FUNCTION_P(_i("MBL mode [Optimal]"), mbl_mode_set); \ + break; \ + }\ +}\ +while (0) + + #define SETTINGS_SOUND \ do\ {\ @@ -5311,6 +5333,8 @@ static void lcd_settings_menu() SETTINGS_SILENT_MODE; + SETTINGS_MBL_MODE; + #if defined (TMC2130) && defined (LINEARITY_CORRECTION) MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu); #endif //LINEARITY_CORRECTION && TMC2130 From f14733f2ddb7d7960d8ccc4a2ccc3a51c8b69065 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 1 Mar 2019 13:53:18 +0100 Subject: [PATCH 058/368] version change --- Firmware/Configuration.h | 4 +- Firmware/Configuration_prusa_bckp.h | 631 ++++++++++++++++++++++++++++ 2 files changed, 633 insertions(+), 2 deletions(-) create mode 100644 Firmware/Configuration_prusa_bckp.h diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 13d2f1a05..9d1d8248d 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.6.0-RC1" -#define FW_COMMIT_NR 2060 +#define FW_VERSION "3.6.0" +#define FW_COMMIT_NR 2067 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN diff --git a/Firmware/Configuration_prusa_bckp.h b/Firmware/Configuration_prusa_bckp.h new file mode 100644 index 000000000..c400b016f --- /dev/null +++ b/Firmware/Configuration_prusa_bckp.h @@ -0,0 +1,631 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +#include +/*------------------------------------ + GENERAL SETTINGS + *------------------------------------*/ + +// Printer revision +#define PRINTER_TYPE PRINTER_MK3 +#define FILAMENT_SIZE "1_75mm_MK3" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK3" + +// Electronics +#define MOTHERBOARD BOARD_EINSY_1_0a +#define STEEL_SHEET +#define HAS_SECOND_SERIAL_PORT + + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ + AXIS SETTINGS + *------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140} +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,280} +//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,560} + +// Endstop inverting +#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. + +// Direction inverting +#define INVERT_X_DIR 1 // for Mendel set to 0, for Orca set to 1 +#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0 +#define INVERT_Z_DIR 1 // for Mendel set to 0, for Orca set to 1 +#define INVERT_E0_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E1_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E2_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.2 + +// Travel limits after homing +#define X_MAX_POS 255 +#define X_MIN_POS 0 +#define Y_MAX_POS 212.5 +#define Y_MIN_POS -4 //orig -4 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000 + +//#define DEFAULT_Y_OFFSET 4.f // Default distance of Y_MIN_POS point from endstop, when the printer is not calibrated. +/** + * [0,0] steel sheet print area point X coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_X 0.f +/** + * [0,0] steel sheet print area point Y coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_Y -2.f + +#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203) +#define DEFAULT_MAX_FEEDRATE_SILENT {100, 100, 12, 120} // (mm/sec) max feedrate (M203), silent mode + +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201) +#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode + + +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S) +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T) + +#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) + +//Silent mode limits +#define SILENT_MAX_ACCEL_XY 960ul // max acceleration in silent mode in mm/s^2 +#define SILENT_MAX_FEEDRATE_XY 100 // max feedrate in mm/s + +//Normal mode limits +#define NORMAL_MAX_ACCEL_XY 2500ul // max acceleration in normal mode in mm/s^2 +#define NORMAL_MAX_FEEDRATE_XY 200 // max feedrate in mm/s + +//number of bytes from end of the file to start check +#define END_FILE_SECTION 20000 + +#define Z_AXIS_ALWAYS_ON 1 + +//Crash detection +#define CRASHDET_TIMER 45 //seconds +#define CRASHDET_COUNTER_MAX 3 + +// New XYZ calibration +#define NEW_XYZCAL + +// Watchdog support +#define WATCHDOG + +// Power panic +#define UVLO_SUPPORT + +// Fan check +#define FANCHECK + +// Safety timer +#define SAFETYTIMER +#define DEFAULT_SAFETYTIMER_TIME_MINS 30 + +// Filament sensor +#define FILAMENT_SENSOR +#define PAT9125 + +// Backlash - +//#define BACKLASH_X +//#define BACKLASH_Y + + +// Minimum ambient temperature limit to start triggering MINTEMP errors [C] +// this value is litlebit higher that real limit, because ambient termistor is on the board and is temperated from it, +// temperature inside the case is around 31C for ambient temperature 25C, when the printer is powered on long time and idle +// the real limit is 15C (same as MINTEMP limit), this is because 15C is end of scale for both used thermistors (bed, heater) +#define MINTEMP_MINAMBIENT 25 +#define MINTEMP_MINAMBIENT_RAW 978 + +#define DEBUG_DCODE3 + +//#define DEBUG_BUILD +//#define DEBUG_SEC_LANG //secondary language debug output at startup +//#define DEBUG_W25X20CL //debug external spi flash +#ifdef DEBUG_BUILD +//#define _NO_ASM +#define DEBUG_DCODES //D codes +#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR +//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial +//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored +//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored +//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored +//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored +//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored +//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored +#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored +//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored +//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line +//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed +//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_DISABLE_FORCE_SELFTEST //disable force selftest +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) +//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) +//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled) +#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line +#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. +#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +#define CMD_DIAGNOSTICS //Show cmd queue length on printer display +#endif /* DEBUG_BUILD */ + +//#define FSENSOR_QUALITY + + +#define LINEARITY_CORRECTION +#define TMC2130_LINEARITY_CORRECTION +#define TMC2130_LINEARITY_CORRECTION_XYZ +//#define TMC2130_VARIABLE_RESOLUTION + + + +/*------------------------------------ + TMC2130 default settings + *------------------------------------*/ + +#define TMC2130_FCLK 12000000 // fclk = 12MHz + +#define TMC2130_USTEPS_XY 16 // microstep resolution for XY axes +#define TMC2130_USTEPS_Z 16 // microstep resolution for Z axis +#define TMC2130_USTEPS_E 32 // microstep resolution for E axis +#define TMC2130_INTPOL_XY 1 // extrapolate 256 for XY axes +#define TMC2130_INTPOL_Z 1 // extrapolate 256 for Z axis +#define TMC2130_INTPOL_E 1 // extrapolate 256 for E axis + +#define TMC2130_PWM_GRAD_X 2 // PWMCONF +#define TMC2130_PWM_AMPL_X 230 // PWMCONF +#define TMC2130_PWM_AUTO_X 1 // PWMCONF +#define TMC2130_PWM_FREQ_X 2 // PWMCONF + +#define TMC2130_PWM_GRAD_Y 2 // PWMCONF +#define TMC2130_PWM_AMPL_Y 235 // PWMCONF +#define TMC2130_PWM_AUTO_Y 1 // PWMCONF +#define TMC2130_PWM_FREQ_Y 2 // PWMCONF + +#define TMC2130_PWM_GRAD_Z 4 // PWMCONF +#define TMC2130_PWM_AMPL_Z 200 // PWMCONF +#define TMC2130_PWM_AUTO_Z 1 // PWMCONF +#define TMC2130_PWM_FREQ_Z 2 // PWMCONF + +#define TMC2130_PWM_GRAD_E 4 // PWMCONF +#define TMC2130_PWM_AMPL_E 240 // PWMCONF +#define TMC2130_PWM_AUTO_E 1 // PWMCONF +#define TMC2130_PWM_FREQ_E 2 // PWMCONF + +#define TMC2130_TOFF_XYZ 3 // CHOPCONF // fchop = 27.778kHz +#define TMC2130_TOFF_E 3 // CHOPCONF // fchop = 27.778kHz +//#define TMC2130_TOFF_E 4 // CHOPCONF // fchop = 21.429kHz +//#define TMC2130_TOFF_E 5 // CHOPCONF // fchop = 17.442kHz + +//#define TMC2130_STEALTH_E // Extruder stealthChop mode +//#define TMC2130_CNSTOFF_E // Extruder constant-off-time mode (similar to MK2) + +//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk) + +#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode +#define TMC2130_THIGH 0 // THIGH - unused + +//#define TMC2130_TCOOLTHRS_X 450 // TCOOLTHRS - coolstep treshold +//#define TMC2130_TCOOLTHRS_Y 450 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_X 430 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_Y 430 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_Z 500 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_E 500 // TCOOLTHRS - coolstep treshold + +#define TMC2130_SG_HOMING 1 // stallguard homing +#define TMC2130_SG_THRS_X 3 // stallguard sensitivity for X axis +#define TMC2130_SG_THRS_Y 3 // stallguard sensitivity for Y axis +#define TMC2130_SG_THRS_Z 4 // stallguard sensitivity for Z axis +#define TMC2130_SG_THRS_E 3 // stallguard sensitivity for E axis + +//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only) +#define TMC2130_CURRENTS_H {16, 20, 35, 30} // default holding currents for all axes +#define TMC2130_CURRENTS_R {16, 20, 35, 30} // default running currents for all axes +#define TMC2130_UNLOAD_CURRENT_R 12 // lowe current for M600 to protect filament sensor + +#define TMC2130_STEALTH_Z + +//#define TMC2130_SERVICE_CODES_M910_M918 + +//#define TMC2130_DEBUG +//#define TMC2130_DEBUG_WR +//#define TMC2130_DEBUG_RD + + +/*------------------------------------ + EXTRUDER SETTINGS + *------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 15 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_MINTEMP_DELAY 15000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if HEATER_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see HEATER_MINTEMP_DELAY definition)" +#endif +#define BED_MINTEMP 15 +#define BED_MINTEMP_DELAY 50000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if BED_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)" +#endif + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 125 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +//#define DEFAULT_Kp 40.925 +//#define DEFAULT_Ki 4.875 +//#define DEFAULT_Kd 86.085 +#define DEFAULT_Kp 16.13 +#define DEFAULT_Ki 1.1625 +#define DEFAULT_Kd 56.23 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 175 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + + +/*------------------------------------ + LOAD/UNLOAD FILAMENT SETTINGS + *------------------------------------*/ + +// Load filament commands +#define LOAD_FILAMENT_0 "M83" +#define LOAD_FILAMENT_1 "G1 E70 F400" +#define LOAD_FILAMENT_2 "G1 E40 F100" + +// Unload filament commands +#define UNLOAD_FILAMENT_0 "M83" +#define UNLOAD_FILAMENT_1 "G1 E-80 F7000" + +/*------------------------------------ + CHANGE FILAMENT SETTINGS + *------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +//#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_RFEED 7000 / 60 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ + ADDITIONAL FEATURES SETTINGS + *------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ + MOTOR CURRENT SETTINGS + *------------------------------------*/ + +// Motor Current settings for Einsy/tmc = 0..63 +#define MOTOR_CURRENT_PWM_RANGE 63 + +/*------------------------------------ + BED SETTINGS + *------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +// Maximum bed level correction value +#define BED_ADJUSTMENT_UM_MAX 100 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + +//connect message when communication with monitoring broken +//#define FARM_CONNECT_MESSAGE + +/*----------------------------------- + PREHEAT SETTINGS + *------------------------------------*/ + +#define FARM_PREHEAT_HOTEND_TEMP 250 +#define FARM_PREHEAT_HPB_TEMP 60 +#define FARM_PREHEAT_FAN_SPEED 0 + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 60 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 230 +#define PET_PREHEAT_HPB_TEMP 85 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 240 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ + THERMISTORS SETTINGS + *------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif +#define TEMP_SENSOR_PINDA 1 +#define TEMP_SENSOR_AMBIENT 2000 + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 20 +#define PINDA_PREHEAT_Y 60 +#define PINDA_PREHEAT_Z 0.15 +/* +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1*/ +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring +#define NC_BUTTON_LONG_PRESS 15 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#define MIN_PRINT_FAN_SPEED 75 + + +// How much shall the print head be lifted on power panic? +// Ideally the Z axis will reach a zero phase of the stepper driver on power outage. To simplify this, +// UVLO_Z_AXIS_SHIFT shall be an integer multiply of the stepper driver cycle, that is 4x full step. +// For example, the Prusa i3 MK2 with 16 microsteps per full step has Z stepping of 400 microsteps per mm. +// At 400 microsteps per mm, a full step lifts the Z axis by 0.04mm, and a stepper driver cycle is 0.16mm. +// The following example, 12 * (4 * 16 / 400) = 12 * 0.16mm = 1.92mm. +//#define UVLO_Z_AXIS_SHIFT 1.92 +#define UVLO_Z_AXIS_SHIFT 0.64 +// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 + +#define HEATBED_V2 + +#define M600_TIMEOUT 600 //seconds + +//#define SUPPORT_VERBOSITY + +#define MMU_REQUIRED_FW_BUILDNR 83 +#define MMU_HWRESET +#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning + +#endif //__CONFIGURATION_PRUSA_H From ca880100180fa90c2265ecd4df46deecbfe18366 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 1 Mar 2019 13:54:25 +0100 Subject: [PATCH 059/368] Revert "version change" This reverts commit f14733f2ddb7d7960d8ccc4a2ccc3a51c8b69065. --- Firmware/Configuration.h | 4 +- Firmware/Configuration_prusa_bckp.h | 631 ---------------------------- 2 files changed, 2 insertions(+), 633 deletions(-) delete mode 100644 Firmware/Configuration_prusa_bckp.h diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 9d1d8248d..13d2f1a05 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.6.0" -#define FW_COMMIT_NR 2067 +#define FW_VERSION "3.6.0-RC1" +#define FW_COMMIT_NR 2060 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN diff --git a/Firmware/Configuration_prusa_bckp.h b/Firmware/Configuration_prusa_bckp.h deleted file mode 100644 index c400b016f..000000000 --- a/Firmware/Configuration_prusa_bckp.h +++ /dev/null @@ -1,631 +0,0 @@ -#ifndef CONFIGURATION_PRUSA_H -#define CONFIGURATION_PRUSA_H - -#include -/*------------------------------------ - GENERAL SETTINGS - *------------------------------------*/ - -// Printer revision -#define PRINTER_TYPE PRINTER_MK3 -#define FILAMENT_SIZE "1_75mm_MK3" -#define NOZZLE_TYPE "E3Dv6full" - -// Developer flag -#define DEVELOPER - -// Printer name -#define CUSTOM_MENDEL_NAME "Prusa i3 MK3" - -// Electronics -#define MOTHERBOARD BOARD_EINSY_1_0a -#define STEEL_SHEET -#define HAS_SECOND_SERIAL_PORT - - -// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) -//#define E3D_PT100_EXTRUDER_WITH_AMP -//#define E3D_PT100_EXTRUDER_NO_AMP -//#define E3D_PT100_BED_WITH_AMP -//#define E3D_PT100_BED_NO_AMP - - -/*------------------------------------ - AXIS SETTINGS - *------------------------------------*/ - -// Steps per unit {X,Y,Z,E} -//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140} -#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,280} -//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,560} - -// Endstop inverting -#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. -#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. -#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. - -// Direction inverting -#define INVERT_X_DIR 1 // for Mendel set to 0, for Orca set to 1 -#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0 -#define INVERT_Z_DIR 1 // for Mendel set to 0, for Orca set to 1 -#define INVERT_E0_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 -#define INVERT_E1_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 -#define INVERT_E2_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 - -// Home position -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS -2.2 -#define MANUAL_Z_HOME_POS 0.2 - -// Travel limits after homing -#define X_MAX_POS 255 -#define X_MIN_POS 0 -#define Y_MAX_POS 212.5 -#define Y_MIN_POS -4 //orig -4 -#define Z_MAX_POS 210 -#define Z_MIN_POS 0.15 - -// Canceled home position -#define X_CANCEL_POS 50 -#define Y_CANCEL_POS 190 - -//Pause print position -#define X_PAUSE_POS 50 -#define Y_PAUSE_POS 190 -#define Z_PAUSE_LIFT 20 - -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E -#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000 - -//#define DEFAULT_Y_OFFSET 4.f // Default distance of Y_MIN_POS point from endstop, when the printer is not calibrated. -/** - * [0,0] steel sheet print area point X coordinate in bed print area coordinates - */ -#define SHEET_PRINT_ZERO_REF_X 0.f -/** - * [0,0] steel sheet print area point Y coordinate in bed print area coordinates - */ -#define SHEET_PRINT_ZERO_REF_Y -2.f - -#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203) -#define DEFAULT_MAX_FEEDRATE_SILENT {100, 100, 12, 120} // (mm/sec) max feedrate (M203), silent mode - -#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201) -#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode - - -#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S) -#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T) - -#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) - -//Silent mode limits -#define SILENT_MAX_ACCEL_XY 960ul // max acceleration in silent mode in mm/s^2 -#define SILENT_MAX_FEEDRATE_XY 100 // max feedrate in mm/s - -//Normal mode limits -#define NORMAL_MAX_ACCEL_XY 2500ul // max acceleration in normal mode in mm/s^2 -#define NORMAL_MAX_FEEDRATE_XY 200 // max feedrate in mm/s - -//number of bytes from end of the file to start check -#define END_FILE_SECTION 20000 - -#define Z_AXIS_ALWAYS_ON 1 - -//Crash detection -#define CRASHDET_TIMER 45 //seconds -#define CRASHDET_COUNTER_MAX 3 - -// New XYZ calibration -#define NEW_XYZCAL - -// Watchdog support -#define WATCHDOG - -// Power panic -#define UVLO_SUPPORT - -// Fan check -#define FANCHECK - -// Safety timer -#define SAFETYTIMER -#define DEFAULT_SAFETYTIMER_TIME_MINS 30 - -// Filament sensor -#define FILAMENT_SENSOR -#define PAT9125 - -// Backlash - -//#define BACKLASH_X -//#define BACKLASH_Y - - -// Minimum ambient temperature limit to start triggering MINTEMP errors [C] -// this value is litlebit higher that real limit, because ambient termistor is on the board and is temperated from it, -// temperature inside the case is around 31C for ambient temperature 25C, when the printer is powered on long time and idle -// the real limit is 15C (same as MINTEMP limit), this is because 15C is end of scale for both used thermistors (bed, heater) -#define MINTEMP_MINAMBIENT 25 -#define MINTEMP_MINAMBIENT_RAW 978 - -#define DEBUG_DCODE3 - -//#define DEBUG_BUILD -//#define DEBUG_SEC_LANG //secondary language debug output at startup -//#define DEBUG_W25X20CL //debug external spi flash -#ifdef DEBUG_BUILD -//#define _NO_ASM -#define DEBUG_DCODES //D codes -#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR -//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial -//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD -//#define DEBUG_RESUME_PRINT //Resume/save print debug enable -//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output -//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored -//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored -//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored -//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored -//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored -//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored -#define DEBUG_DISABLE_STARTMSGS //no startup messages -//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored -//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored -//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line -//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed -//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages -//#define DEBUG_DISABLE_FORCE_SELFTEST //disable force selftest -//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) -//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) -//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) -//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled) -#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line -#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. -#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. -#define CMD_DIAGNOSTICS //Show cmd queue length on printer display -#endif /* DEBUG_BUILD */ - -//#define FSENSOR_QUALITY - - -#define LINEARITY_CORRECTION -#define TMC2130_LINEARITY_CORRECTION -#define TMC2130_LINEARITY_CORRECTION_XYZ -//#define TMC2130_VARIABLE_RESOLUTION - - - -/*------------------------------------ - TMC2130 default settings - *------------------------------------*/ - -#define TMC2130_FCLK 12000000 // fclk = 12MHz - -#define TMC2130_USTEPS_XY 16 // microstep resolution for XY axes -#define TMC2130_USTEPS_Z 16 // microstep resolution for Z axis -#define TMC2130_USTEPS_E 32 // microstep resolution for E axis -#define TMC2130_INTPOL_XY 1 // extrapolate 256 for XY axes -#define TMC2130_INTPOL_Z 1 // extrapolate 256 for Z axis -#define TMC2130_INTPOL_E 1 // extrapolate 256 for E axis - -#define TMC2130_PWM_GRAD_X 2 // PWMCONF -#define TMC2130_PWM_AMPL_X 230 // PWMCONF -#define TMC2130_PWM_AUTO_X 1 // PWMCONF -#define TMC2130_PWM_FREQ_X 2 // PWMCONF - -#define TMC2130_PWM_GRAD_Y 2 // PWMCONF -#define TMC2130_PWM_AMPL_Y 235 // PWMCONF -#define TMC2130_PWM_AUTO_Y 1 // PWMCONF -#define TMC2130_PWM_FREQ_Y 2 // PWMCONF - -#define TMC2130_PWM_GRAD_Z 4 // PWMCONF -#define TMC2130_PWM_AMPL_Z 200 // PWMCONF -#define TMC2130_PWM_AUTO_Z 1 // PWMCONF -#define TMC2130_PWM_FREQ_Z 2 // PWMCONF - -#define TMC2130_PWM_GRAD_E 4 // PWMCONF -#define TMC2130_PWM_AMPL_E 240 // PWMCONF -#define TMC2130_PWM_AUTO_E 1 // PWMCONF -#define TMC2130_PWM_FREQ_E 2 // PWMCONF - -#define TMC2130_TOFF_XYZ 3 // CHOPCONF // fchop = 27.778kHz -#define TMC2130_TOFF_E 3 // CHOPCONF // fchop = 27.778kHz -//#define TMC2130_TOFF_E 4 // CHOPCONF // fchop = 21.429kHz -//#define TMC2130_TOFF_E 5 // CHOPCONF // fchop = 17.442kHz - -//#define TMC2130_STEALTH_E // Extruder stealthChop mode -//#define TMC2130_CNSTOFF_E // Extruder constant-off-time mode (similar to MK2) - -//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410) -#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410) -#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk) - -#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode -#define TMC2130_THIGH 0 // THIGH - unused - -//#define TMC2130_TCOOLTHRS_X 450 // TCOOLTHRS - coolstep treshold -//#define TMC2130_TCOOLTHRS_Y 450 // TCOOLTHRS - coolstep treshold -#define TMC2130_TCOOLTHRS_X 430 // TCOOLTHRS - coolstep treshold -#define TMC2130_TCOOLTHRS_Y 430 // TCOOLTHRS - coolstep treshold -#define TMC2130_TCOOLTHRS_Z 500 // TCOOLTHRS - coolstep treshold -#define TMC2130_TCOOLTHRS_E 500 // TCOOLTHRS - coolstep treshold - -#define TMC2130_SG_HOMING 1 // stallguard homing -#define TMC2130_SG_THRS_X 3 // stallguard sensitivity for X axis -#define TMC2130_SG_THRS_Y 3 // stallguard sensitivity for Y axis -#define TMC2130_SG_THRS_Z 4 // stallguard sensitivity for Z axis -#define TMC2130_SG_THRS_E 3 // stallguard sensitivity for E axis - -//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only) -#define TMC2130_CURRENTS_H {16, 20, 35, 30} // default holding currents for all axes -#define TMC2130_CURRENTS_R {16, 20, 35, 30} // default running currents for all axes -#define TMC2130_UNLOAD_CURRENT_R 12 // lowe current for M600 to protect filament sensor - -#define TMC2130_STEALTH_Z - -//#define TMC2130_SERVICE_CODES_M910_M918 - -//#define TMC2130_DEBUG -//#define TMC2130_DEBUG_WR -//#define TMC2130_DEBUG_RD - - -/*------------------------------------ - EXTRUDER SETTINGS - *------------------------------------*/ - -// Mintemps -#define HEATER_0_MINTEMP 15 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_MINTEMP_DELAY 15000 // [ms] ! if changed, check maximal allowed value @ ShortTimer -#if HEATER_MINTEMP_DELAY>USHRT_MAX -#error "Check maximal allowed value @ ShortTimer (see HEATER_MINTEMP_DELAY definition)" -#endif -#define BED_MINTEMP 15 -#define BED_MINTEMP_DELAY 50000 // [ms] ! if changed, check maximal allowed value @ ShortTimer -#if BED_MINTEMP_DELAY>USHRT_MAX -#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)" -#endif - -// Maxtemps -#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) -#define HEATER_0_MAXTEMP 410 -#else -#define HEATER_0_MAXTEMP 305 -#endif -#define HEATER_1_MAXTEMP 305 -#define HEATER_2_MAXTEMP 305 -#define BED_MAXTEMP 125 - -#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) -// Define PID constants for extruder with PT100 -#define DEFAULT_Kp 21.70 -#define DEFAULT_Ki 1.60 -#define DEFAULT_Kd 73.76 -#else -// Define PID constants for extruder -//#define DEFAULT_Kp 40.925 -//#define DEFAULT_Ki 4.875 -//#define DEFAULT_Kd 86.085 -#define DEFAULT_Kp 16.13 -#define DEFAULT_Ki 1.1625 -#define DEFAULT_Kd 56.23 -#endif - -// Extrude mintemp -#define EXTRUDE_MINTEMP 175 - -// Extruder cooling fans -#define EXTRUDER_0_AUTO_FAN_PIN 8 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed - - - -/*------------------------------------ - LOAD/UNLOAD FILAMENT SETTINGS - *------------------------------------*/ - -// Load filament commands -#define LOAD_FILAMENT_0 "M83" -#define LOAD_FILAMENT_1 "G1 E70 F400" -#define LOAD_FILAMENT_2 "G1 E40 F100" - -// Unload filament commands -#define UNLOAD_FILAMENT_0 "M83" -#define UNLOAD_FILAMENT_1 "G1 E-80 F7000" - -/*------------------------------------ - CHANGE FILAMENT SETTINGS - *------------------------------------*/ - -// Filament change configuration -#define FILAMENTCHANGEENABLE -#ifdef FILAMENTCHANGEENABLE -#define FILAMENTCHANGE_XPOS 211 -#define FILAMENTCHANGE_YPOS 0 -#define FILAMENTCHANGE_ZADD 2 -#define FILAMENTCHANGE_FIRSTRETRACT -2 -#define FILAMENTCHANGE_FINALRETRACT -80 - -#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) -#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) -#define FILAMENTCHANGE_RECFEED 5 - -#define FILAMENTCHANGE_XYFEED 50 -#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) -#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) -//#define FILAMENTCHANGE_RFEED 400 -#define FILAMENTCHANGE_RFEED 7000 / 60 -#define FILAMENTCHANGE_EXFEED 2 -#define FILAMENTCHANGE_ZFEED 15 - -#endif - -/*------------------------------------ - ADDITIONAL FEATURES SETTINGS - *------------------------------------*/ - -// Define Prusa filament runout sensor -//#define FILAMENT_RUNOUT_SUPPORT - -#ifdef FILAMENT_RUNOUT_SUPPORT -#define FILAMENT_RUNOUT_SENSOR 1 -#endif - -// temperature runaway -#define TEMP_RUNAWAY_BED_HYSTERESIS 5 -#define TEMP_RUNAWAY_BED_TIMEOUT 360 - -#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 -#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 - -/*------------------------------------ - MOTOR CURRENT SETTINGS - *------------------------------------*/ - -// Motor Current settings for Einsy/tmc = 0..63 -#define MOTOR_CURRENT_PWM_RANGE 63 - -/*------------------------------------ - BED SETTINGS - *------------------------------------*/ - -// Define Mesh Bed Leveling system to enable it -#define MESH_BED_LEVELING -#ifdef MESH_BED_LEVELING - -#define MBL_Z_STEP 0.01 - -// Mesh definitions -#define MESH_MIN_X 35 -#define MESH_MAX_X 238 -#define MESH_MIN_Y 6 -#define MESH_MAX_Y 202 - -// Mesh upsample definition -#define MESH_NUM_X_POINTS 7 -#define MESH_NUM_Y_POINTS 7 -// Mesh measure definition -#define MESH_MEAS_NUM_X_POINTS 3 -#define MESH_MEAS_NUM_Y_POINTS 3 - -// Maximum bed level correction value -#define BED_ADJUSTMENT_UM_MAX 100 - -#define MESH_HOME_Z_CALIB 0.2 -#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. - -#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right -#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind -#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) -#endif - -// Bed Temperature Control -// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis -// -// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, -// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. -// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. -// If your configuration is significantly different than this and you don't understand the issues involved, you probably -// shouldn't use bed PID until someone else verifies your hardware works. -// If this is enabled, find your own PID constants below. -#define PIDTEMPBED -// -//#define BED_LIMIT_SWITCHING - -// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. -// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) -// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, -// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) -#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current - -// Bed temperature compensation settings -#define BED_OFFSET 10 -#define BED_OFFSET_START 40 -#define BED_OFFSET_CENTER 50 - - -#ifdef PIDTEMPBED -//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) -//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) -#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) -// Define PID constants for extruder with PT100 -#define DEFAULT_bedKp 21.70 -#define DEFAULT_bedKi 1.60 -#define DEFAULT_bedKd 73.76 -#else -#define DEFAULT_bedKp 126.13 -#define DEFAULT_bedKi 4.30 -#define DEFAULT_bedKd 924.76 -#endif - -//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) -//from pidautotune -// #define DEFAULT_bedKp 97.1 -// #define DEFAULT_bedKi 1.41 -// #define DEFAULT_bedKd 1675.16 - -// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. -#endif // PIDTEMPBED - -//connect message when communication with monitoring broken -//#define FARM_CONNECT_MESSAGE - -/*----------------------------------- - PREHEAT SETTINGS - *------------------------------------*/ - -#define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 60 -#define FARM_PREHEAT_FAN_SPEED 0 - -#define PLA_PREHEAT_HOTEND_TEMP 215 -#define PLA_PREHEAT_HPB_TEMP 60 -#define PLA_PREHEAT_FAN_SPEED 0 - -#define ABS_PREHEAT_HOTEND_TEMP 255 -#define ABS_PREHEAT_HPB_TEMP 100 -#define ABS_PREHEAT_FAN_SPEED 0 - -#define HIPS_PREHEAT_HOTEND_TEMP 220 -#define HIPS_PREHEAT_HPB_TEMP 100 -#define HIPS_PREHEAT_FAN_SPEED 0 - -#define PP_PREHEAT_HOTEND_TEMP 254 -#define PP_PREHEAT_HPB_TEMP 100 -#define PP_PREHEAT_FAN_SPEED 0 - -#define PET_PREHEAT_HOTEND_TEMP 230 -#define PET_PREHEAT_HPB_TEMP 85 -#define PET_PREHEAT_FAN_SPEED 0 - -#define FLEX_PREHEAT_HOTEND_TEMP 240 -#define FLEX_PREHEAT_HPB_TEMP 50 -#define FLEX_PREHEAT_FAN_SPEED 0 - -/*------------------------------------ - THERMISTORS SETTINGS - *------------------------------------*/ - -// -//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table -// -//// Temperature sensor settings: -// -2 is thermocouple with MAX6675 (only for sensor 0) -// -1 is thermocouple with AD595 -// 0 is not used -// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) -// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) -// 3 is Mendel-parts thermistor (4.7k pullup) -// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! -// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) -// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) -// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) -// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) -// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) -// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) -// 10 is 100k RS thermistor 198-961 (4.7k pullup) -// 11 is 100k beta 3950 1% thermistor (4.7k pullup) -// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" -// 20 is the PT100 circuit found in the Ultimainboard V2.x -// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 -// -// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k -// (but gives greater accuracy and more stable PID) -// 51 is 100k thermistor - EPCOS (1k pullup) -// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) -// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) -// -// 1047 is Pt1000 with 4k7 pullup -// 1010 is Pt1000 with 1k pullup (non standard) -// 147 is Pt100 with 4k7 pullup -// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a -// 247 is Pt100 with 4k7 pullup and PT100 Amplifier -// 110 is Pt100 with 1k pullup (non standard) - -#if defined(E3D_PT100_EXTRUDER_WITH_AMP) -#define TEMP_SENSOR_0 247 -#elif defined(E3D_PT100_EXTRUDER_NO_AMP) -#define TEMP_SENSOR_0 148 -#else -#define TEMP_SENSOR_0 5 -#endif -#define TEMP_SENSOR_1 0 -#define TEMP_SENSOR_2 0 -#if defined(E3D_PT100_BED_WITH_AMP) -#define TEMP_SENSOR_BED 247 -#elif defined(E3D_PT100_BED_NO_AMP) -#define TEMP_SENSOR_BED 148 -#else -#define TEMP_SENSOR_BED 1 -#endif -#define TEMP_SENSOR_PINDA 1 -#define TEMP_SENSOR_AMBIENT 2000 - -#define STACK_GUARD_TEST_VALUE 0xA2A2 - -#define MAX_BED_TEMP_CALIBRATION 50 -#define MAX_HOTEND_TEMP_CALIBRATION 50 - -#define MAX_E_STEPS_PER_UNIT 250 -#define MIN_E_STEPS_PER_UNIT 100 - -#define Z_BABYSTEP_MIN -3999 -#define Z_BABYSTEP_MAX 0 - -#define PINDA_PREHEAT_X 20 -#define PINDA_PREHEAT_Y 60 -#define PINDA_PREHEAT_Z 0.15 -/* -#define PINDA_PREHEAT_X 70 -#define PINDA_PREHEAT_Y -3 -#define PINDA_PREHEAT_Z 1*/ -#define PINDA_HEAT_T 120 //time in s - -#define PINDA_MIN_T 50 -#define PINDA_STEP_T 10 -#define PINDA_MAX_T 100 - -#define PING_TIME 60 //time in s -#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes -#define PING_ALLERT_PERIOD 60 //time in s - -#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring -#define NC_BUTTON_LONG_PRESS 15 //time in s - -#define LONG_PRESS_TIME 1000 //time in ms for button long press -#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release - -#define DEFAULT_PID_TEMP 210 - -#define MIN_PRINT_FAN_SPEED 75 - - -// How much shall the print head be lifted on power panic? -// Ideally the Z axis will reach a zero phase of the stepper driver on power outage. To simplify this, -// UVLO_Z_AXIS_SHIFT shall be an integer multiply of the stepper driver cycle, that is 4x full step. -// For example, the Prusa i3 MK2 with 16 microsteps per full step has Z stepping of 400 microsteps per mm. -// At 400 microsteps per mm, a full step lifts the Z axis by 0.04mm, and a stepper driver cycle is 0.16mm. -// The following example, 12 * (4 * 16 / 400) = 12 * 0.16mm = 1.92mm. -//#define UVLO_Z_AXIS_SHIFT 1.92 -#define UVLO_Z_AXIS_SHIFT 0.64 -// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. -#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 - -#define HEATBED_V2 - -#define M600_TIMEOUT 600 //seconds - -//#define SUPPORT_VERBOSITY - -#define MMU_REQUIRED_FW_BUILDNR 83 -#define MMU_HWRESET -#define MMU_DEBUG //print communication between MMU2 and printer on serial -#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning - -#endif //__CONFIGURATION_PRUSA_H From 488497df2c489a1a36a880dd068e690a7dd09e4f Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 1 Mar 2019 13:56:03 +0100 Subject: [PATCH 060/368] version change --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 13d2f1a05..f14f05d85 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.6.0-RC1" -#define FW_COMMIT_NR 2060 +#define FW_VERSION "3.6.0" +#define FW_COMMIT_NR 2069 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From 22500970bacb0c35ae204ac80810925114925139 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 16:18:16 +0100 Subject: [PATCH 061/368] Remove commented out code, fix formatting. --- Firmware/mmu.cpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2e3fca914..54ccbb13a 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1052,14 +1052,14 @@ else { } } -//-// +//! @brief show which filament is currently unloaded void extr_unload_view() { -lcd_clear(); -lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT)); -lcd_print(" "); -if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" "); -else lcd_print(mmu_extruder + 1); + lcd_clear(); + lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT)); + lcd_print(" "); + if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" "); + else lcd_print(mmu_extruder + 1); } void extr_unload() @@ -1074,17 +1074,8 @@ void extr_unload() { #ifndef SNMM st_synchronize(); - - //show which filament is currently unloaded -//-// lcd_update_enable(false); -menu_submenu(extr_unload_view); -/* - lcd_clear(); - lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT)); - lcd_print(" "); - if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" "); - else lcd_print(mmu_extruder + 1); -*/ + + menu_submenu(extr_unload_view); mmu_filament_ramming(); @@ -1092,8 +1083,7 @@ menu_submenu(extr_unload_view); // get response manage_response(false, true, MMU_UNLOAD_MOVE); -//-// lcd_update_enable(true); -menu_back(); + menu_back(); #else //SNMM lcd_clear(); @@ -1151,7 +1141,6 @@ menu_back(); { show_preheat_nozzle_warning(); } - //lcd_return_to_status(); } //wrapper functions for loading filament From 8e51b37d91418e565f2de5da883c9338e827796a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 16:57:20 +0100 Subject: [PATCH 062/368] Suppress warning: unused parameter. --- Firmware/timer02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/timer02.c b/Firmware/timer02.c index 827299be1..8309f9401 100644 --- a/Firmware/timer02.c +++ b/Firmware/timer02.c @@ -157,12 +157,12 @@ void delay2(unsigned long ms) } } -void tone2(uint8_t _pin, unsigned int frequency/*, unsigned long duration*/) +void tone2(__attribute__((unused)) uint8_t _pin, __attribute__((unused)) unsigned int frequency/*, unsigned long duration*/) { PIN_SET(BEEPER); } -void noTone2(uint8_t _pin) +void noTone2(__attribute__((unused)) uint8_t _pin) { PIN_CLR(BEEPER); } From a964f996fa895cfb41274daa54555235efe58a55 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 17:08:36 +0100 Subject: [PATCH 063/368] Fix compiler warning: variable 'kill_message' set but not used kill_message is unused since: Author: MRprusa3d Date: 4 months ago (11/2/2018 11:03:14 PM) Commit hash: 73794b56cf532cb4193a6c80082652351509677a MeshBed Leveling Fail Z-leveling after MeshBed leveling failing --- Firmware/Marlin_main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 68292d90c..1fc5a1692 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4461,7 +4461,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } #endif // SUPPORT_VERBOSITY int l_feedmultiply = setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100 - const char *kill_message = NULL; + while (mesh_point != nMeasPoints * nMeasPoints) { // Get coords of a measuring point. uint8_t ix = mesh_point % nMeasPoints; // from 0 to MESH_NUM_X_POINTS - 1 @@ -4511,15 +4511,15 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // Go down until endstop is hit const float Z_CALIBRATION_THRESHOLD = 1.f; if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point - kill_message = _T(MSG_BED_LEVELING_FAILED_POINT_LOW); + //Bed leveling failed. Sensor didnt trigger. Debris on nozzle? break; } if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { - kill_message = _i("Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset.");////MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 + //Bed leveling failed. Sensor disconnected or cable broken. break; } if (has_z && fabs(z0 - current_position[Z_AXIS]) > Z_CALIBRATION_THRESHOLD) { //if we have data from z calibration, max. allowed difference is 1mm for each point - kill_message = _i("Bed leveling failed. Sensor triggered too high. Waiting for reset.");////MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 + //Bed leveling failed. Sensor triggered too high. break; } #ifdef SUPPORT_VERBOSITY From 4c2d4fcf773db0eda897e88c597546a5d1bfde13 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 17:18:05 +0100 Subject: [PATCH 064/368] Fix compiler warning ultralcd.cpp:4038:10: warning: unused variable 'chars --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2f0cb7852..d9b6677c9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4035,7 +4035,6 @@ static void lcd_print_state(uint8_t state) static void lcd_show_sensors_state() { //0: N/A; 1: OFF; 2: ON - uint8_t chars = 0; uint8_t pinda_state = STATE_NA; uint8_t finda_state = STATE_NA; uint8_t idler_state = STATE_NA; From 57cf7ee171fb7f1bc8471c3a7f6fc64c42d21c65 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 17:21:13 +0100 Subject: [PATCH 065/368] Fix compiler warning: 'lcd_selftest_fsensor' defined but not used --- Firmware/ultralcd.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d9b6677c9..c54a7af90 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -186,7 +186,9 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite); #ifdef FANCHECK static bool lcd_selftest_fan_dialog(int _fan); #endif //FANCHECK +#ifdef PAT9125 static bool lcd_selftest_fsensor(); +#endif //PAT9125 static bool selftest_irsensor(); static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2); static void lcd_colorprint_change(); @@ -7494,6 +7496,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * } #ifdef FILAMENT_SENSOR +#ifdef PAT9125 static bool lcd_selftest_fsensor(void) { fsensor_init(); @@ -7503,6 +7506,7 @@ static bool lcd_selftest_fsensor(void) } return (!fsensor_not_responding); } +#endif //PAT9125 //! @brief Self-test of infrared barrier filament sensor mounted on MK3S with MMUv2 printer //! From 824d11e4b0432b6900f40e4dfdf9bb88d2b4c867 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 17:43:28 +0100 Subject: [PATCH 066/368] Remove "Press the knob to eject filament" message, as it is never shown. --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c54a7af90..2024bb029 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2344,7 +2344,6 @@ switch(eFilamentAction) lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1 break; case e_FILAMENT_ACTION_mmuEject: - lcd_puts_P(_i("to eject filament")); ////MSG_ c=20 r=1 break; } if(lcd_clicked()) From 83e07b5cdf4dd8ea705fe4a882ab31c9029b058a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 18:07:19 +0100 Subject: [PATCH 067/368] Fix compiler warnings: sketch/ultralcd.cpp: In function 'void mFilamentPrompt()': sketch/ultralcd.cpp:2335:7: warning: enumeration value 'e_FILAMENT_ACTION_none' not handled in switch [-Wswitch] switch(eFilamentAction) ^ sketch/ultralcd.cpp:2335:7: warning: enumeration value 'e_FILAMENT_ACTION_mmuCut' not handled in switch [-Wswitch] sketch/ultralcd.cpp:2359:12: warning: enumeration value 'e_FILAMENT_ACTION_none' not handled in switch [-Wswitch] switch(eFilamentAction) ^ sketch/ultralcd.cpp:2359:12: warning: enumeration value 'e_FILAMENT_ACTION_mmuLoad' not handled in switch [-Wswitch] sketch/ultralcd.cpp:2359:12: warning: enumeration value 'e_FILAMENT_ACTION_mmuUnLoad' not handled in switch [-Wswitch] sketch/ultralcd.cpp:2359:12: warning: enumeration value 'e_FILAMENT_ACTION_mmuEject' not handled in switch [-Wswitch] sketch/ultralcd.cpp:2359:12: warning: enumeration value 'e_FILAMENT_ACTION_mmuCut' not handled in switch [-Wswitch] sketch/ultralcd.cpp: In function 'void mFilamentItem(uint16_t, uint16_t)': sketch/ultralcd.cpp:2513:12: warning: enumeration value 'e_FILAMENT_ACTION_none' not handled in switch [-Wswitch] switch(eFilamentAction) ^ sketch/ultralcd.cpp:2513:12: warning: enumeration value 'e_FILAMENT_ACTION_mmuCut' not handled in switch [-Wswitch] sketch/ultralcd.cpp:2562:12: warning: enumeration value 'e_FILAMENT_ACTION_none' not handled in switch [-Wswitch] switch(eFilamentAction) ^ sketch/ultralcd.cpp:2562:12: warning: enumeration value 'e_FILAMENT_ACTION_mmuCut' not handled in switch [-Wswitch] --- Firmware/ultralcd.cpp | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2024bb029..9fd7d6528 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2344,6 +2344,8 @@ switch(eFilamentAction) lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1 break; case e_FILAMENT_ACTION_mmuEject: + case e_FILAMENT_ACTION_mmuCut: + case e_FILAMENT_ACTION_none: break; } if(lcd_clicked()) @@ -2357,38 +2359,23 @@ if(lcd_clicked()) menu_back(nLevel); switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: case e_FILAMENT_ACTION_autoLoad: + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + // no break + case e_FILAMENT_ACTION_Load: loading_flag=true; enquecommand_P(PSTR("M701")); // load filament break; case e_FILAMENT_ACTION_unLoad: enquecommand_P(PSTR("M702")); // unload filament break; -/* case e_FILAMENT_ACTION_mmuLoad: -//./ MYSERIAL.println("mFilamentPrompt - mmuLoad"); - bFilamentAction=true; - menu_submenu(mmu_load_to_nozzle_menu); - break; -*/ -/* case e_FILAMENT_ACTION_mmuUnLoad: -//./ MYSERIAL.println("mFilamentPrompt - mmuUnLoad"); - bFilamentAction=true; - extr_unload(); - break; -*/ -/* case e_FILAMENT_ACTION_mmuEject: - MYSERIAL.println("mFilamentPrompt - mmuEject"); - bFilamentAction=true; -// menu_submenu(mmu_fil_eject_menu); + case e_FILAMENT_ACTION_mmuCut: + case e_FILAMENT_ACTION_none: break; -*/ } - if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } } From 6437d449910965437fe7e69aac8499f3fdff9161 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 18:10:06 +0100 Subject: [PATCH 068/368] Fix unable to cut filament, if nozzle is already preheated. --- Firmware/ultralcd.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2f0cb7852..ee98dc51d 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2547,6 +2547,14 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) menu_back(nLevel); menu_submenu(mmu_fil_eject_menu); break; + case e_FILAMENT_ACTION_mmuCut: + nLevel=bFilamentPreheatState?1:2; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_cut_filament_menu); + break; + case e_FILAMENT_ACTION_none: + break; } if(bFilamentWaitingFlag) Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); From 9e38b1e101f0da37469c4374cc3f6e7bb22aee73 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 1 Mar 2019 18:17:08 +0100 Subject: [PATCH 069/368] Add missing message "Preheating to cut". --- Firmware/ultralcd.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ee98dc51d..da1fc11e3 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2579,6 +2579,11 @@ else { case e_FILAMENT_ACTION_mmuEject: lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 break; + case e_FILAMENT_ACTION_mmuCut: + lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_none: + break; } lcd_set_cursor(0,3); lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1 From b02ca18c93c4fbf0e9387cffd8b0e943d276b0b4 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 4 Mar 2019 12:52:35 +0100 Subject: [PATCH 070/368] better autoLoad autoLoad inhibit if Support::ExtruderInfo-menu is selected --- Firmware/Marlin_main.cpp | 2 +- Firmware/ultralcd.cpp | 4 ++-- Firmware/ultralcd.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b0f1e633e..612b1795f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7483,7 +7483,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s if (mmu_enabled == false) { //-// if (mcode_in_progress != 600) //M600 not in progress - if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active + if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad) && (menu_menu!=lcd_menu_extruder_info)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5a04796f7..c6e1d8e23 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -133,7 +133,7 @@ static void prusa_stat_farm_number(); static void prusa_stat_temperatures(); static void prusa_stat_printinfo(); static void lcd_farm_no(); -static void lcd_menu_extruder_info(); +void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") static void lcd_menu_xyz_y_min(); static void lcd_menu_xyz_skew(); static void lcd_menu_xyz_offset(); @@ -1899,7 +1899,7 @@ void lcd_cooldown() } -static void lcd_menu_extruder_info() +void lcd_menu_extruder_info() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") { //|01234567890123456789| //|Nozzle FAN: RPM| diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index c407bbed3..affd7b0b5 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -45,6 +45,8 @@ extern bool lcd_selftest(); void lcd_menu_statistics(); +void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") + extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines); extern const char* lcd_display_message_fullscreen_P(const char *msg); From 8812d405462258fe27bd262b7901b8fbebfe68d8 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 4 Mar 2019 15:05:14 +0100 Subject: [PATCH 071/368] Revert "Fix compiler warning: variable 'kill_message' set but not used" This reverts commit a964f996fa895cfb41274daa54555235efe58a55. --- Firmware/Marlin_main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 1fc5a1692..68292d90c 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4461,7 +4461,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } #endif // SUPPORT_VERBOSITY int l_feedmultiply = setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100 - + const char *kill_message = NULL; while (mesh_point != nMeasPoints * nMeasPoints) { // Get coords of a measuring point. uint8_t ix = mesh_point % nMeasPoints; // from 0 to MESH_NUM_X_POINTS - 1 @@ -4511,15 +4511,15 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // Go down until endstop is hit const float Z_CALIBRATION_THRESHOLD = 1.f; if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point - //Bed leveling failed. Sensor didnt trigger. Debris on nozzle? + kill_message = _T(MSG_BED_LEVELING_FAILED_POINT_LOW); break; } if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { - //Bed leveling failed. Sensor disconnected or cable broken. + kill_message = _i("Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset.");////MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 break; } if (has_z && fabs(z0 - current_position[Z_AXIS]) > Z_CALIBRATION_THRESHOLD) { //if we have data from z calibration, max. allowed difference is 1mm for each point - //Bed leveling failed. Sensor triggered too high. + kill_message = _i("Bed leveling failed. Sensor triggered too high. Waiting for reset.");////MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 break; } #ifdef SUPPORT_VERBOSITY From 7f92d73a40152d2c6907ba004e04a61316aca1ad Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 4 Mar 2019 17:04:22 +0100 Subject: [PATCH 072/368] MMU_STEALTH_MODE -> MMU_FORCE_STEALTH_MODE; activate_stealth_mode() function update --- Firmware/mmu.cpp | 15 +++++++-------- .../variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index d1be76d4c..522322650 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -183,14 +183,13 @@ bool check_for_ir_sensor() static bool activate_stealth_mode() { - bool activate_stealth_mode = false; -#ifdef SILENT_MODE_STEALTH - activate_stealth_mode = (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); -#endif //SILENT_MODE_STEALTH -#ifdef MMU_STEALTH_MODE - activate_stealth_mode = true; -#endif //MMU_STEALTH_MODE - return activate_stealth_mode; +#if defined (MMU_FORCE_STEALTH_MODE) + return true; +#elif defined (SILENT_MODE_STEALTH) + return (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); +#else + return false; +#endif } //mmu main loop - state machine processing diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index dd836b69a..40a3a229b 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -498,7 +498,7 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -#define MMU_STEALTH_MODE +#define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 9715aa7d9..e316c4f02 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -499,7 +499,7 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -#define MMU_STEALTH_MODE +#define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index b814d1cbb..d3badf6aa 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -498,7 +498,7 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -#define MMU_STEALTH_MODE +#define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 3f38a286f..2563f848a 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -499,7 +499,7 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -#define MMU_STEALTH_MODE +#define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning From 17f095b9572990964ce096c318b0b5d5b9b34560 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 4 Mar 2019 20:32:56 +0100 Subject: [PATCH 073/368] shorter Z movements (makes calibration faster) --- Firmware/Marlin_main.cpp | 20 ++++++++++++++++---- Firmware/mesh_bed_calibration.cpp | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c89ac3ef8..d65241214 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4487,7 +4487,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } // Move Z up to MESH_HOME_Z_SEARCH. - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + if((ix == 0) && (iy == 0)) current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + else current_position[Z_AXIS] += 2.f / nMeasPoints; //use relative movement from Z coordinate where PINDa triggered on previous point. This makes calibration faster. 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(); @@ -4515,9 +4516,20 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) kill_message = _T(MSG_BED_LEVELING_FAILED_POINT_LOW); break; } - if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { - kill_message = _i("Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset.");////MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 - break; + if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { //broken cable or initial Z coordinate too low. Go to MESH_HOME_Z_SEARCH and repeat last step (z-probe) again to distinguish between these two cases. + + 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 (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point + kill_message = _T(MSG_BED_LEVELING_FAILED_POINT_LOW); + break; + } + if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { + kill_message = _i("Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset.");////MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 + break; + } } if (has_z && fabs(z0 - current_position[Z_AXIS]) > Z_CALIBRATION_THRESHOLD) { //if we have data from z calibration, max. allowed difference is 1mm for each point kill_message = _i("Bed leveling failed. Sensor triggered too high. Waiting for reset.");////MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 1ab22c4f2..c05c868f9 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -936,6 +936,7 @@ static inline void update_current_position_z() } // At the current position, find the Z stop. + inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int #ifdef SUPPORT_VERBOSITY verbosity_level From 7e48d633cbce9985daa8bc5d299c6d8bf3e7c5ea Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 4 Mar 2019 21:30:36 +0100 Subject: [PATCH 074/368] mode switching info-message viewing during mode switching --- Firmware/ultralcd.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2f0cb7852..8f93d3216 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4515,6 +4515,7 @@ static void lcd_silent_mode_set() { } eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu); #ifdef TMC2130 + lcd_display_message_fullscreen_P(_i("Mode change in progress ...")); // Wait until the planner queue is drained and the stepper routine achieves // an idle state. st_synchronize(); @@ -4535,6 +4536,7 @@ static void lcd_silent_mode_set() { #ifdef TMC2130 if (CrashDetectMenu && (SilentModeMenu != SILENT_MODE_NORMAL)) menu_submenu(lcd_crash_mode_info2); + lcd_encoder_diff=0; // reset 'encoder buffer' #endif //TMC2130 } From b2255c8be9e2274a5ba0cd9e03e7ca8e1c6d83d7 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 4 Mar 2019 22:00:24 +0100 Subject: [PATCH 075/368] Preheat nozzle before loading filament in M600 (change filament) gcode. This fixes problem of not heating the nozzle when retrying load after MMU load failed. --- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 9 +++++---- Firmware/mmu.cpp | 8 ++++++-- Firmware/mmu.h | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2d469a764..0664a7f4f 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -493,5 +493,5 @@ void proc_commands(); void M600_load_filament(); void M600_load_filament_movements(); void M600_wait_for_user(float HotendTempBckp); -void M600_check_state(); +void M600_check_state(float nozzle_temp); void load_filament_final_feed(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d14226f36..899ec8338 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3040,12 +3040,12 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float manage_response(false, false); } } - mmu_M600_load_filament(automatic); + mmu_M600_load_filament(automatic, HotendTempBckp); } else M600_load_filament(); - if (!automatic) M600_check_state(); + if (!automatic) M600_check_state(HotendTempBckp); lcd_update_enable(true); @@ -9090,7 +9090,8 @@ void load_filament_final_feed() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EFEED_FINAL, active_extruder); } -void M600_check_state() +//! @par nozzle_temp nozzle temperature to load filament +void M600_check_state(float nozzle_temp) { //Wait for user to check the state lcd_change_fil_state = 0; @@ -9103,7 +9104,7 @@ void M600_check_state() // Filament failed to load so load it again case 2: if (mmu_enabled) - mmu_M600_load_filament(false); //nonautomatic load; change to "wrong filament loaded" option? + mmu_M600_load_filament(false, nozzle_temp); //nonautomatic load; change to "wrong filament loaded" option? else M600_load_filament_movements(); break; diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 449efabd0..0f92128be 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -830,9 +830,10 @@ void mmu_M600_wait_and_beep() { WRITE(BEEPER, LOW); } -void mmu_M600_load_filament(bool automatic) +//! @brief load filament for mmu v2 +//! @par nozzle_temp nozzle temperature to load filament +void mmu_M600_load_filament(bool automatic, float nozzle_temp) { - //load filament for mmu v2 tmp_extruder = mmu_extruder; if (!automatic) { #ifdef MMU_M600_SWITCH_EXTRUDER @@ -852,6 +853,9 @@ void mmu_M600_load_filament(bool automatic) // printf_P(PSTR("T code: %d \n"), tmp_extruder); // mmu_printf_P(PSTR("T%d\n"), tmp_extruder); + setTargetHotend(nozzle_temp,active_extruder); + mmu_wait_for_heater_blocking(); + mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(false, true, MMU_LOAD_MOVE); diff --git a/Firmware/mmu.h b/Firmware/mmu.h index b498a3749..c2e8b7139 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -97,7 +97,7 @@ extern void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move = extern void mmu_load_to_nozzle(); -extern void mmu_M600_load_filament(bool automatic); +extern void mmu_M600_load_filament(bool automatic, float nozzle_temp); extern void mmu_M600_wait_and_beep(); extern void extr_mov(float shift, float feed_rate); From f161d3ade484cb29ea475c59627c9dd228905c28 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 4 Mar 2019 22:17:43 +0100 Subject: [PATCH 076/368] Change formatting. --- Firmware/Marlin_main.cpp | 60 +++++++++++++++++++++------------------- Firmware/mmu.cpp | 58 +++++++++++++++++++------------------- 2 files changed, 61 insertions(+), 57 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 899ec8338..4442c47ab 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9090,39 +9090,41 @@ void load_filament_final_feed() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EFEED_FINAL, active_extruder); } +//! @brief Wait for user to check the state //! @par nozzle_temp nozzle temperature to load filament void M600_check_state(float nozzle_temp) { - //Wait for user to check the state - lcd_change_fil_state = 0; - while (lcd_change_fil_state != 1){ - lcd_change_fil_state = 0; - KEEPALIVE_STATE(PAUSED_FOR_USER); - lcd_alright(); - KEEPALIVE_STATE(IN_HANDLER); - switch(lcd_change_fil_state){ - // Filament failed to load so load it again - case 2: - if (mmu_enabled) - mmu_M600_load_filament(false, nozzle_temp); //nonautomatic load; change to "wrong filament loaded" option? - else - M600_load_filament_movements(); - break; + lcd_change_fil_state = 0; + while (lcd_change_fil_state != 1) + { + lcd_change_fil_state = 0; + KEEPALIVE_STATE(PAUSED_FOR_USER); + lcd_alright(); + KEEPALIVE_STATE(IN_HANDLER); + switch(lcd_change_fil_state) + { + // Filament failed to load so load it again + case 2: + if (mmu_enabled) + mmu_M600_load_filament(false, nozzle_temp); //nonautomatic load; change to "wrong filament loaded" option? + else + M600_load_filament_movements(); + break; - // Filament loaded properly but color is not clear - case 3: - st_synchronize(); - load_filament_final_feed(); - lcd_loading_color(); - st_synchronize(); - break; - - // Everything good - default: - lcd_change_success(); - break; - } - } + // Filament loaded properly but color is not clear + case 3: + st_synchronize(); + load_filament_final_feed(); + lcd_loading_color(); + st_synchronize(); + break; + + // Everything good + default: + lcd_change_success(); + break; + } + } } //! @brief Wait for user action diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 0f92128be..45a3c421d 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -834,37 +834,39 @@ void mmu_M600_wait_and_beep() { //! @par nozzle_temp nozzle temperature to load filament void mmu_M600_load_filament(bool automatic, float nozzle_temp) { - tmp_extruder = mmu_extruder; - if (!automatic) { -#ifdef MMU_M600_SWITCH_EXTRUDER - bool yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false); - if(yes) tmp_extruder = choose_extruder_menu(); -#endif //MMU_M600_SWITCH_EXTRUDER - } - else { - tmp_extruder = ad_getAlternative(tmp_extruder); - } - lcd_update_enable(false); - lcd_clear(); - lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT)); - lcd_print(" "); - lcd_print(tmp_extruder + 1); - snmm_filaments_used |= (1 << tmp_extruder); //for stop print + tmp_extruder = mmu_extruder; + if (!automatic) + { + #ifdef MMU_M600_SWITCH_EXTRUDER + bool yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false); + if(yes) tmp_extruder = choose_extruder_menu(); + #endif //MMU_M600_SWITCH_EXTRUDER + } + else + { + tmp_extruder = ad_getAlternative(tmp_extruder); + } + lcd_update_enable(false); + lcd_clear(); + lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT)); + lcd_print(" "); + lcd_print(tmp_extruder + 1); + snmm_filaments_used |= (1 << tmp_extruder); //for stop print -// printf_P(PSTR("T code: %d \n"), tmp_extruder); -// mmu_printf_P(PSTR("T%d\n"), tmp_extruder); - setTargetHotend(nozzle_temp,active_extruder); - mmu_wait_for_heater_blocking(); + //printf_P(PSTR("T code: %d \n"), tmp_extruder); + //mmu_printf_P(PSTR("T%d\n"), tmp_extruder); + setTargetHotend(nozzle_temp,active_extruder); + mmu_wait_for_heater_blocking(); - mmu_command(MmuCmd::T0 + tmp_extruder); + mmu_command(MmuCmd::T0 + tmp_extruder); - manage_response(false, true, MMU_LOAD_MOVE); - mmu_continue_loading(); - mmu_extruder = tmp_extruder; //filament change is finished - - mmu_load_to_nozzle(); - load_filament_final_feed(); - st_synchronize(); + manage_response(false, true, MMU_LOAD_MOVE); + mmu_continue_loading(); + mmu_extruder = tmp_extruder; //filament change is finished + + mmu_load_to_nozzle(); + load_filament_final_feed(); + st_synchronize(); } From 20a03d703d2cd802a02b49cd733bf80f7f05074c Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 5 Mar 2019 13:36:13 +0100 Subject: [PATCH 077/368] G-code unification "FSENSOR_RECOVER" ->-> "PRUSA fsensor_recover" --- Firmware/Marlin_main.cpp | 11 ++++++----- Firmware/fsensor.cpp | 4 ++-- Firmware/mmu.cpp | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 68292d90c..8c021ab73 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3463,11 +3463,6 @@ void process_commands() } #endif //BACKLASH_Y #endif //TMC2130 -#ifdef FILAMENT_SENSOR - else if (code_seen("FSENSOR_RECOVER")) { //! FSENSOR_RECOVER - fsensor_restore_print_and_continue(); - } -#endif //FILAMENT_SENSOR else if(code_seen("PRUSA")){ if (code_seen("Ping")) { //! PRUSA Ping if (farm_mode) { @@ -3498,6 +3493,12 @@ void process_commands() eeprom_update_byte((uint8_t*)EEPROM_UVLO,0); enquecommand_P(PSTR("M24")); } +#ifdef FILAMENT_SENSOR + else if (code_seen("fsensor_recover")) //! PRUSA fsensor_recover + { + fsensor_restore_print_and_continue(); + } +#endif //FILAMENT_SENSOR else if (code_seen("MMURES")) //! PRUSA MMURES { mmu_reset(); diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index ead770766..d520ba533 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -567,7 +567,7 @@ void fsensor_update(void) printf_P(PSTR("fsensor_update - M600\n")); eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); - enquecommand_front_P(PSTR("FSENSOR_RECOVER")); + enquecommand_front_P(PSTR("PRUSA fsensor_recover")); enquecommand_front_P((PSTR("M600"))); fsensor_watch_runout = false; } @@ -581,7 +581,7 @@ void fsensor_update(void) printf_P(PSTR("fsensor_update - M600\n")); eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); - enquecommand_front_P(PSTR("FSENSOR_RECOVER")); + enquecommand_front_P(PSTR("PRUSA fsensor_recover")); enquecommand_front_P((PSTR("M600"))); } #endif //PAT9125 diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2e3fca914..e299b3aa6 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -358,7 +358,7 @@ void mmu_loop(void) //printf_P(PSTR("Eact: %d\n"), int(e_active())); if (!mmu_finda && CHECK_FSENSOR && fsensor_enabled) { fsensor_stop_and_save_print(); - enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover + enquecommand_front_P(PSTR("PRUSA fsensor_recover")); //then recover ad_markDepleted(mmu_extruder); if (lcd_autoDepleteEnabled() && !ad_allDepleted()) { From 23859921b9b52d7afedf1e697833644d9155abc8 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 15:56:20 +0100 Subject: [PATCH 078/368] Fix compiler warnings macro redefined. --- Firmware/pins.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Firmware/pins.h b/Firmware/pins.h index a0b6f462f..5d3b4f832 100644 --- a/Firmware/pins.h +++ b/Firmware/pins.h @@ -3,20 +3,6 @@ #include "boards.h" -#if !MB(5DPRINT) -#define X_MS1_PIN -1 -#define X_MS2_PIN -1 -#define Y_MS1_PIN -1 -#define Y_MS2_PIN -1 -#define Z_MS1_PIN -1 -#define Z_MS2_PIN -1 -#define E0_MS1_PIN -1 -#define E0_MS2_PIN -1 -#define E1_MS1_PIN -1 -#define E1_MS2_PIN -1 -#define DIGIPOTSS_PIN -1 -#endif - #define LARGE_FLASH true /***************************************************************** From f1031d23024af2edce948c0d1a5265b914be54da Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 5 Mar 2019 16:00:50 +0100 Subject: [PATCH 079/368] new farm statuses for pause (14) and wait for user (15) --- Firmware/ultralcd.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ccf037f57..d7b9b1b4b 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4080,7 +4080,25 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { { case 0: // default message - if (IS_SD_PRINTING) + if (busy_state == PAUSED_FOR_USER) + { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(15); + prusa_stat_farm_number(); + prusa_stat_printinfo(); + SERIAL_ECHOLN("}"); + status_number = 15; + } + else if (isPrintPaused || card.paused) + { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(14); + prusa_stat_farm_number(); + prusa_stat_printinfo(); + SERIAL_ECHOLN("}"); + status_number = 14; + } + else if (IS_SD_PRINTING) { SERIAL_ECHO("{"); prusa_stat_printerstatus(4); From 5b9e7c4fe7359c6eeb173e232ef19e040056fd69 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 16:27:47 +0100 Subject: [PATCH 080/368] Fix warning: assignment makes pointer from integer without a cast. --- Firmware/language.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/language.c b/Firmware/language.c index 3c168638e..c4b501b97 100644 --- a/Firmware/language.c +++ b/Firmware/language.c @@ -77,7 +77,7 @@ uint8_t lang_select(uint8_t lang) if (lang_check(table)) if (pgm_read_dword(((uint32_t*)(table + 12))) == pgm_read_dword(((uint32_t*)(_PRI_LANG_SIGNATURE)))) //signature valid { - lang_table = table; // set table pointer + lang_table = (lang_table_t*)table; // set table pointer lang_selected = lang; // set language id } } @@ -157,7 +157,7 @@ uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* off if (lang == LANG_ID_SEC) { uint16_t ui = _SEC_LANG_TABLE; //table pointer - memcpy_P(header, ui, sizeof(lang_table_header_t)); //read table header from progmem + memcpy_P(header, (lang_table_header_t*)ui, sizeof(lang_table_header_t)); //read table header from progmem if (offset) *offset = ui; return (header->magic == LANG_MAGIC)?1:0; //return 1 if magic valid } From 790ae9f0cec7cfed2e730f9a66afe45c3810d03e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 16:41:41 +0100 Subject: [PATCH 081/368] Fix compiler warning: unused parameter 'pstep'. --- Firmware/Marlin.h | 7 ++++++- Firmware/Marlin_main.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2d469a764..df64338df 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -297,9 +297,14 @@ extern float min_pos[3]; extern float max_pos[3]; extern bool axis_known_position[3]; extern int fanSpeed; -extern void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0); extern int8_t lcd_change_fil_state; +#ifdef TMC2130 +void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0); +#else +void homeaxis(int axis, uint8_t cnt = 1); +#endif //TMC2130 + #ifdef FAN_SOFT_PWM extern unsigned char fanSpeedSoftPwm; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d14226f36..671afe21f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2126,7 +2126,11 @@ bool calibrate_z_auto() } #endif //TMC2130 +#ifdef TMC2130 void homeaxis(int axis, uint8_t cnt, uint8_t* pstep) +#else +void homeaxis(int axis, uint8_t cnt) +#endif //TMC2130 { bool endstops_enabled = enable_endstops(true); //RP: endstops should be allways enabled durring homing #define HOMEAXIS_DO(LETTER) \ From ebfd4b2f4712b4e1be6e094fe86fe294f559fc36 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 17:02:57 +0100 Subject: [PATCH 082/368] Fix compiler warning: unused parameter 'calib' --- Firmware/Marlin.h | 2 -- Firmware/Marlin_main.cpp | 24 +++++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index df64338df..9706cfbb9 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -483,8 +483,6 @@ void force_high_power_mode(bool start_high_power_section); #endif //TMC2130 // G-codes -void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl); -void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis); bool gcode_M45(bool onlyZ, int8_t verbosity_level); void gcode_M114(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 671afe21f..73e5aa610 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2439,11 +2439,12 @@ void force_high_power_mode(bool start_high_power_section) { } #endif //TMC2130 -void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis) { - gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, false, true); -} - -void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl) { +#ifdef TMC2130 +static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl) +#else +static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool without_mbl) +#endif //TMC2130 +{ st_synchronize(); #if 0 @@ -2728,6 +2729,15 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_ #endif } +static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis) +{ +#ifdef TMC2130 + gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, false, true); +#else + gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, true); +#endif //TMC2130 +} + void adjust_bed_reset() { eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1); @@ -3834,8 +3844,12 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) home_z_value = code_value_long(); bool without_mbl = code_seen('W'); // calibrate? +#ifdef TMC2130 bool calib = code_seen('C'); gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, calib, without_mbl); +#else + gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, without_mbl); +#endif //TMC2130 if ((home_x || home_y || without_mbl || home_z) == false) { // Push the commands to the front of the message queue in the reverse order! // There shall be always enough space reserved for these commands. From 7bcd54f8badf1faad5cb7bf91afbd72dc8324912 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 17:30:27 +0100 Subject: [PATCH 083/368] Add missing function prototype. --- Firmware/Marlin_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 73e5aa610..52e1e3567 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -407,6 +407,7 @@ static void get_arc_coordinates(); static bool setTargetedHotend(int code, uint8_t &extruder); static void print_time_remaining_init(); static void wait_for_heater(long codenum, uint8_t extruder); +static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis); uint16_t gcode_in_progress = 0; uint16_t mcode_in_progress = 0; From 28f1e309a240e0433a6ebb002b2ccbe1f6150cf4 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 17:44:47 +0100 Subject: [PATCH 084/368] Fix compiler warning: 'old_x_max_endstop' defined but not used Fix compiler warning: 'old_y_max_endstop' defined but not used --- Firmware/stepper.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index bb5d22f75..c21a4e9f1 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -92,10 +92,15 @@ bool abort_on_endstop_hit = false; int motor_current_setting_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; #endif -static bool old_x_min_endstop=false; +#if ( (defined(X_MAX_PIN) && (X_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_XMAXLIMIT) static bool old_x_max_endstop=false; -static bool old_y_min_endstop=false; +#endif +#if ( (defined(Y_MAX_PIN) && (Y_MAX_PIN > -1)) || defined(TMC2130_SG_HOMING) ) && !defined(DEBUG_DISABLE_YMAXLIMIT) static bool old_y_max_endstop=false; +#endif + +static bool old_x_min_endstop=false; +static bool old_y_min_endstop=false; static bool old_z_min_endstop=false; static bool old_z_max_endstop=false; From 484259cbb2447f4fd82e07f62984c0e5ff23c520 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 18:00:16 +0100 Subject: [PATCH 085/368] Fix compiler warning: 'lcd_settings_linearity_correction_menu_save' defined but not used --- Firmware/ultralcd.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ccf037f57..5c7e96932 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5404,10 +5404,9 @@ static void lcd_ustep_linearity_menu_save() } #endif //TMC2130 - +#ifdef TMC2130 static void lcd_settings_linearity_correction_menu_save() { -#ifdef TMC2130 bool changed = false; if (tmc2130_wave_fac[X_AXIS] < TMC2130_WAVE_FAC1000_MIN) tmc2130_wave_fac[X_AXIS] = 0; if (tmc2130_wave_fac[Y_AXIS] < TMC2130_WAVE_FAC1000_MIN) tmc2130_wave_fac[Y_AXIS] = 0; @@ -5419,9 +5418,8 @@ static void lcd_settings_linearity_correction_menu_save() changed |= (eeprom_read_byte((uint8_t*)EEPROM_TMC2130_WAVE_E_FAC) != tmc2130_wave_fac[E_AXIS]); lcd_ustep_linearity_menu_save(); if (changed) tmc2130_init(); -#endif //TMC2130 } - +#endif //TMC2130 static void lcd_calibration_menu() { From 7fcecabd5fdfea446fea7f880586d2b717642382 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 18:04:58 +0100 Subject: [PATCH 086/368] Fix compiler warning: variable 'previous_millis_cmd' set but not used --- Firmware/ultralcd.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5c7e96932..7c122c0f5 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3518,7 +3518,6 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z) // Until confirmed by the confirmation dialog. for (;;) { - unsigned long previous_millis_cmd = _millis(); const char *msg = only_z ? _i("Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done.") : _i("Calibrating XYZ. Rotate the knob to move the Z carriage up to the end stoppers. Click when done.");////MSG_MOVE_CARRIAGE_TO_THE_TOP c=20 r=8////MSG_MOVE_CARRIAGE_TO_THE_TOP_Z c=20 r=8 const char *msg_next = lcd_display_message_fullscreen_P(msg); const bool multi_screen = msg_next != NULL; @@ -3527,13 +3526,10 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z) lcd_encoder_diff = 0; lcd_encoder = 0; for (;;) { -// if (_millis() - previous_millis_cmd > LCD_TIMEOUT_TO_STATUS) -// goto canceled; manage_heater(); manage_inactivity(true); if (abs(lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP) { _delay(50); - previous_millis_cmd = _millis(); lcd_encoder += abs(lcd_encoder_diff / ENCODER_PULSES_PER_STEP); lcd_encoder_diff = 0; if (! planner_queue_full()) { From 1eab058ad46ae9e4943a49f326bf259f756b2dab Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 5 Mar 2019 18:08:35 +0100 Subject: [PATCH 087/368] Fix uninitialized variable used. --- Firmware/ultralcd.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7c122c0f5..9b25d0b49 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6802,8 +6802,7 @@ bool lcd_selftest() _result = lcd_selftest_manual_fan_check(1, false); if (!_result) { - const char *_err; - lcd_selftest_error(6, _err, _err); //print fan not spinning + lcd_selftest_error(6, 0, 0); //print fan not spinning } #endif //defined(TACH_1) From d9e93e8a77bea4adf39e963d603d45a28fbe8781 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 5 Mar 2019 20:40:08 +0100 Subject: [PATCH 088/368] measurements points moved 10mm to the left; measure only chosen points (e.g. not points affected by magnets proximity) --- Firmware/Marlin_main.cpp | 8 +++++++- Firmware/mesh_bed_calibration.cpp | 24 ++++++++++++++++++++++++ Firmware/mesh_bed_calibration.h | 6 ++++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d65241214..4b089fed6 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4467,6 +4467,12 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // Get coords of a measuring point. uint8_t ix = mesh_point % nMeasPoints; // from 0 to MESH_NUM_X_POINTS - 1 uint8_t iy = mesh_point / nMeasPoints; + if (!mbl_point_measurement_valid(ix, iy, nMeasPoints)) { + printf_P(PSTR("Skipping point [%d;%d] \n"), ix, iy); + custom_message_state--; + mesh_point++; + continue; //skip + } if (iy & 1) ix = (nMeasPoints - 1) - ix; // Zig zag float z0 = 0.f; if (has_z && (mesh_point > 0)) { @@ -4686,7 +4692,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } // SERIAL_ECHOLNPGM("Bed leveling correction finished"); if (nMeasPoints == 3) { - mbl.upsample_3x3(); //bilinear interpolation from 3x3 to 7x7 points while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them) + mbl.upsample_3x3(); //interpolation from 3x3 to 7x7 points using largrangian polynomials while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them) } // SERIAL_ECHOLNPGM("Upsample finished"); mbl.active = 1; //activate mesh bed leveling diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index c05c868f9..85ed05544 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3065,4 +3065,28 @@ void mbl_mode_init() { uint8_t mbl_type = eeprom_read_byte((uint8_t*)EEPROM_MBL_TYPE); if (mbl_type == 0xFF) e_mbl_type = e_MBL_OPTIMAL; else e_mbl_type = mbl_type; +} + +bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points) { + //"human readable" heatbed plan + //magnet proximity influence Z coordinate measurements significantly (40 - 100 um) + //0 - measurement point is above magnet and Z coordinate can be influenced negatively + //1 - we should be in safe distance from magnets, measurement should be accurate + uint8_t valid_points_mask[7] = { + //[X_MAX,Y_MAX] + 0b1111101, + 0b1110111, + 0b1111111, + 0b0111011, + 0b1110111, + 0b1111111, + 0b1110111, + //[0,0] + }; + if (meas_points == 3) { + ix *= 3; + iy *= 3; + } + if((iy%2) == 0) return (valid_points_mask[6 - iy] & (1 << (6 - ix))); + else return (valid_points_mask[6 - iy] & (1 << ix)); } \ No newline at end of file diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index 9c7f45455..0d5772718 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -6,9 +6,9 @@ #ifdef HEATBED_V2 -#define BED_X0 (13.f - BED_ZERO_REF_X) +#define BED_X0 (3.f - BED_ZERO_REF_X) #define BED_Y0 (10.4f - BED_ZERO_REF_Y) -#define BED_Xn (216.f - BED_ZERO_REF_X) +#define BED_Xn (206.f - BED_ZERO_REF_X) #define BED_Yn (202.4f - BED_ZERO_REF_Y) #else @@ -210,4 +210,6 @@ extern e_MBL_TYPE e_mbl_type; extern void mbl_mode_set(); extern void mbl_mode_init(); +extern bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points); + #endif /* MESH_BED_CALIBRATION_H */ From 7c187541e14f90ca54eded535c1bd379a360645d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 5 Mar 2019 22:36:30 +0100 Subject: [PATCH 089/368] function for valid points determination improved; simple Z-coordinate estimation; measure all points and use inaccurate Z-coordinate in case that we don't have enought information for counting Z-coordinate estimation --- Firmware/Marlin_main.cpp | 7 +++++-- Firmware/mesh_bed_calibration.cpp | 24 +++++++++++++++++++++++- Firmware/mesh_bed_calibration.h | 4 ++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 4b089fed6..ceefa39d5 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4467,12 +4467,12 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // Get coords of a measuring point. uint8_t ix = mesh_point % nMeasPoints; // from 0 to MESH_NUM_X_POINTS - 1 uint8_t iy = mesh_point / nMeasPoints; - if (!mbl_point_measurement_valid(ix, iy, nMeasPoints)) { + /*if (!mbl_point_measurement_valid(ix, iy, nMeasPoints, true)) { printf_P(PSTR("Skipping point [%d;%d] \n"), ix, iy); custom_message_state--; mesh_point++; continue; //skip - } + }*/ if (iy & 1) ix = (nMeasPoints - 1) - ix; // Zig zag float z0 = 0.f; if (has_z && (mesh_point > 0)) { @@ -4694,6 +4694,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (nMeasPoints == 3) { mbl.upsample_3x3(); //interpolation from 3x3 to 7x7 points using largrangian polynomials while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them) } + if (nMeasPoints == 7) { + mbl_interpolation(nMeasPoints); + } // SERIAL_ECHOLNPGM("Upsample finished"); mbl.active = 1; //activate mesh bed leveling // SERIAL_ECHOLNPGM("Mesh bed leveling activated"); diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 85ed05544..c5fc58290 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3067,11 +3067,13 @@ void mbl_mode_init() { else e_mbl_type = mbl_type; } -bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points) { +bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag) { //"human readable" heatbed plan //magnet proximity influence Z coordinate measurements significantly (40 - 100 um) //0 - measurement point is above magnet and Z coordinate can be influenced negatively //1 - we should be in safe distance from magnets, measurement should be accurate + if ((ix >= meas_points) || (iy >= meas_points)) return false; + uint8_t valid_points_mask[7] = { //[X_MAX,Y_MAX] 0b1111101, @@ -3089,4 +3091,24 @@ bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points) { } if((iy%2) == 0) return (valid_points_mask[6 - iy] & (1 << (6 - ix))); else return (valid_points_mask[6 - iy] & (1 << ix)); +} + +void mbl_single_point_interpolation(uint8_t x, uint8_t y, uint8_t meas_points) { + uint8_t count = 0; + float z = 0; + if(mbl_point_measurement_valid(x, y+1, meas_points, false)) { z += mbl.z_values[x][y+1]; count++; } + if(mbl_point_measurement_valid(x, y-1, meas_points, false)) { z += mbl.z_values[x][y-1]; count++; } + if(mbl_point_measurement_valid(x+1, y, meas_points, false)) { z += mbl.z_values[x+1][y]; count++; } + if(mbl_point_measurement_valid(x-1, y, meas_points, false)) { z += mbl.z_values[x+1][y]; count++; } + if(count != 0) mbl.z_values[x][y] = z / count; //if we have at least one valid point in surrounding area use average value, otherwise use inaccurately measured Z-coordinate +} + +void mbl_interpolation(uint8_t meas_points) { + for (uint8_t x = 0; x < meas_points; x++) { + for (uint8_t y = 0; y < meas_points; y++) { + if (!mbl_point_measurement_valid(x, y, meas_points, false)) { + mbl_single_point_interpolation(x, y, meas_points); + } + } + } } \ No newline at end of file diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index 0d5772718..7fd8011c7 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -210,6 +210,6 @@ extern e_MBL_TYPE e_mbl_type; extern void mbl_mode_set(); extern void mbl_mode_init(); -extern bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points); - +extern bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag); +extern void mbl_interpolation(uint8_t meas_points); #endif /* MESH_BED_CALIBRATION_H */ From 5766a5537e128cd1a9d60c72e87230b0605bdb46 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 5 Mar 2019 22:43:44 +0100 Subject: [PATCH 090/368] limit number of probes --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index ceefa39d5..0453b00ad 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4392,7 +4392,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (code_seen('R')) { nProbeRetry = code_value_uint8(); if (nProbeRetry > 10) { - nProbeRetry = 3; + nProbeRetry = 10; } } From 101453b674a179f7fd104ba08f4e58fa432bc275 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Mar 2019 13:27:31 +0100 Subject: [PATCH 091/368] mbl submenu --- Firmware/ultralcd.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 37fd4746a..cf93397b2 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5271,16 +5271,16 @@ do\ switch(e_mbl_type)\ {\ case e_MBL_FAST:\ - MENU_ITEM_FUNCTION_P(_i("MBL mode [Fast]"),mbl_mode_set);\ + MENU_ITEM_FUNCTION_P(_i("Mode [Fast]"),mbl_mode_set);\ break; \ case e_MBL_OPTIMAL:\ - MENU_ITEM_FUNCTION_P(_i("MBL mode [Optimal]"), mbl_mode_set); \ + MENU_ITEM_FUNCTION_P(_i("Mode [Optimal]"), mbl_mode_set); \ break; \ case e_MBL_PREC:\ - MENU_ITEM_FUNCTION_P(_i("MBL mode [Precise]"), mbl_mode_set); \ + MENU_ITEM_FUNCTION_P(_i("Mode [Precise]"), mbl_mode_set); \ break; \ default:\ - MENU_ITEM_FUNCTION_P(_i("MBL mode [Optimal]"), mbl_mode_set); \ + MENU_ITEM_FUNCTION_P(_i("Mode [Optimal]"), mbl_mode_set); \ break; \ }\ }\ @@ -5333,7 +5333,7 @@ static void lcd_settings_menu() SETTINGS_SILENT_MODE; - SETTINGS_MBL_MODE; + MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_TEMPERATURE c=0 r=0 #if defined (TMC2130) && defined (LINEARITY_CORRECTION) MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu); @@ -6524,6 +6524,12 @@ static void lcd_tune_menu() MENU_END(); } +static void mesh_bed_leveling_menu() +{ + + SETTINGS_MBL_MODE; +} + static void lcd_control_temperature_menu() { #ifdef PIDTEMP From 6217329d509c57a7f3b3ea526e903f4efdf385fc Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 6 Mar 2019 19:51:26 +0100 Subject: [PATCH 092/368] SD card menu enhancement --- Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/ultralcd.cpp | 14 ++++++-------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 7943d2208..029cf0c6f 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -52,6 +52,7 @@ const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); ////c=17 r=0 const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////c=20 r=0 const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1 const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); ////c=0 r=0 +const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); ////c=0 r=0 const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[] PROGMEM_I1 = ISTR("Measuring reference height of calibration point"); ////c=60 r=0 const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[] PROGMEM_I1 = ISTR(" of 9"); ////c=14 r=0 const char MSG_MENU_CALIBRATION[] PROGMEM_I1 = ISTR("Calibration"); ////c=0 r=0 diff --git a/Firmware/messages.h b/Firmware/messages.h index ce6ecdd74..5083b26d5 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -53,6 +53,7 @@ extern const char MSG_LOAD_FILAMENT[]; extern const char MSG_LOADING_FILAMENT[]; extern const char MSG_M117_V2_CALIBRATION[]; extern const char MSG_MAIN[]; +extern const char MSG_BACK[]; extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[]; extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[]; extern const char MSG_MENU_CALIBRATION[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2f0cb7852..5dae20907 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5292,9 +5292,9 @@ do\ EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));\ switch (sdSort)\ {\ - case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort: [time]"), lcd_sort_type_set); break;/*////MSG_SORT_TIME c=17 r=1*/\ - case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort: [alphabet]"), lcd_sort_type_set); break;/*////MSG_SORT_ALPHA c=17 r=1*/\ - default: MENU_ITEM_FUNCTION_P(_i("Sort: [none]"), lcd_sort_type_set);/*////MSG_SORT_NONE c=17 r=1*/\ + case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort [time]"), lcd_sort_type_set); break;/*////MSG_SORT_TIME c=17 r=1*/\ + case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort [alphabet]"), lcd_sort_type_set); break;/*////MSG_SORT_ALPHA c=17 r=1*/\ + default: MENU_ITEM_FUNCTION_P(_i("Sort [none]"), lcd_sort_type_set);/*////MSG_SORT_NONE c=17 r=1*/\ }\ }\ }\ @@ -6725,10 +6725,7 @@ void lcd_sdcard_menu() MENU_BEGIN(); - if(bMain) // i.e. default menu-item - MENU_ITEM_BACK_P(_T(MSG_MAIN)); - else // i.e. menu-item after card insertion - MENU_ITEM_FUNCTION_P(_T(MSG_WATCH),lcd_return_to_status); + MENU_ITEM_BACK_P(_T(bMain?MSG_MAIN:MSG_BACK)); // i.e. default menu-item / menu-item after card insertion card.getWorkDirName(); if (card.filename[0] == '/') { @@ -8148,6 +8145,8 @@ void menu_lcd_lcdupdate_func(void) } else { + if(menu_menu==lcd_sdcard_menu) + menu_back(); card.release(); LCD_MESSAGERPGM(_i("Card removed"));////MSG_SD_REMOVED c=0 r=0 } @@ -8192,4 +8191,3 @@ void menu_lcd_lcdupdate_func(void) lcd_send_status(); if (lcd_commands_type == LCD_COMMAND_V2_CAL) lcd_commands(); } - From f0cc313fede4c15233fa90a0be6c8d07dc521c26 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 6 Mar 2019 19:56:48 +0100 Subject: [PATCH 093/368] debug gcodes (fans, bed analysis) moved to Dcodes, HOST_KEEPALIVE_FEATURE simplified --- Firmware/Configuration.h | 2 + Firmware/Marlin.h | 14 +- Firmware/Marlin_main.cpp | 316 +++++++++++++++--- Firmware/pins_Rambo_1_3.h | 6 + Firmware/temperature.cpp | 2 - .../variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 3 + 6 files changed, 279 insertions(+), 64 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index c21325c77..a64e90a14 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -446,7 +446,9 @@ your extruder heater takes 2 minutes to hit the target on heating. // When enabled Marlin will send a busy status message to the host // every couple of seconds when it can't accept commands. // +#ifndef HEATBED_ANALYSIS #define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages +#endif //HEATBED_ANALYSIS #define HOST_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. //LCD and SD support diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2d469a764..ef342b0cb 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -311,9 +311,9 @@ extern float retract_length_swap; extern float retract_recover_length_swap; #endif -#ifdef HOST_KEEPALIVE_FEATURE + extern uint8_t host_keepalive_interval; -#endif + extern unsigned long starttime; extern unsigned long stoptime; @@ -397,13 +397,12 @@ extern void check_babystep(); extern void long_pause(); extern void crashdet_stop_and_save_print(); -#ifdef DIS - +#ifdef HEATBED_ANALYSIS void d_setup(); float d_ReadData(); void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y); - -#endif +void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y); +#endif //HEATBED_ANALYSIS float temp_comp_interpolation(float temperature); void temp_compensation_apply(); void temp_compensation_start(); @@ -443,7 +442,7 @@ extern void restore_print_from_ram_and_continue(float e_move); extern uint16_t print_time_remaining(); extern uint8_t calc_percent_done(); -#ifdef HOST_KEEPALIVE_FEATURE + // States for managing Marlin and host communication // Marlin sends messages if blocked or busy @@ -466,7 +465,6 @@ extern void host_keepalive(); //extern MarlinBusyState busy_state; extern int busy_state; -#endif //HOST_KEEPALIVE_FEATURE #ifdef TMC2130 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d14226f36..53e842887 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -302,16 +302,9 @@ int fanSpeed=0; bool cancel_heatup = false ; -#ifdef HOST_KEEPALIVE_FEATURE - - int busy_state = NOT_BUSY; - static long prev_busy_signal_ms = -1; - uint8_t host_keepalive_interval = HOST_KEEPALIVE_INTERVAL; -#else - #define host_keepalive(); - #define KEEPALIVE_STATE(n); -#endif - +int busy_state = NOT_BUSY; +static long prev_busy_signal_ms = -1; +uint8_t host_keepalive_interval = HOST_KEEPALIVE_INTERVAL; const char errormagic[] PROGMEM = "Error:"; const char echomagic[] PROGMEM = "echo:"; @@ -1696,12 +1689,14 @@ void serial_read_stream() { } } -#ifdef HOST_KEEPALIVE_FEATURE /** * Output a "busy" message at regular intervals * while the machine is not accepting commands. */ void host_keepalive() { +#ifndef HOST_KEEPALIVE_FEATURE + return; +#endif //HOST_KEEPALIVE_FEATURE if (farm_mode) return; long ms = _millis(); if (host_keepalive_interval && busy_state != NOT_BUSY) { @@ -1726,7 +1721,7 @@ void host_keepalive() { } prev_busy_signal_ms = ms; } -#endif + // The loop() function is called in an endless loop by the Arduino framework from the default main() routine. // Before loop(), the setup() function is called by the main() routine. @@ -4295,44 +4290,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } break; -#ifdef DIS - case 77: - { - //! G77 X200 Y150 XP100 YP15 XO10 Y015 - //! for 9 point mesh bed leveling G77 X203 Y196 XP3 YP3 XO0 YO0 - //! G77 X232 Y218 XP116 YP109 XO-11 YO0 - float dimension_x = 40; - float dimension_y = 40; - int points_x = 40; - int points_y = 40; - float offset_x = 74; - float offset_y = 33; - - if (code_seen('X')) dimension_x = code_value(); - if (code_seen('Y')) dimension_y = code_value(); - if (code_seen("XP")) { strchr_pointer+=1; points_x = code_value(); } - if (code_seen("YP")) { strchr_pointer+=1; points_y = code_value(); } - if (code_seen("XO")) { strchr_pointer+=1; offset_x = code_value(); } - if (code_seen("YO")) { strchr_pointer+=1; offset_y = code_value(); } - - bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y); - - } break; - -#endif - - case 79: { - for (int i = 255; i > 0; i = i - 5) { - fanSpeed = i; - //delay_keep_alive(2000); - for (int j = 0; j < 100; j++) { - delay_keep_alive(100); - - } - printf_P(_N("%d: %d\n"), i, fan_speed[1]); - } - }break; /** * G80: Mesh-based Z probe, probes a grid and produces a @@ -5792,7 +5750,6 @@ Sigma_Exit: if (code_seen('N')) gcode_LastN = code_value_long(); break; -#ifdef HOST_KEEPALIVE_FEATURE case 113: // M113 - Get or set Host Keepalive interval if (code_seen('S')) { host_keepalive_interval = (uint8_t)code_value_short(); @@ -5804,7 +5761,6 @@ Sigma_Exit: SERIAL_PROTOCOLLN(""); } break; -#endif case 115: // M115 if (code_seen('V')) { // Report the Prusa version number. @@ -7138,7 +7094,66 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) dcode_9(); break; case 10: //! D10 - XYZ calibration = OK dcode_10(); break; - +#endif //DEBUG_DCODES +#ifdef HEATBED_ANALYSIS + case 80: + { + float dimension_x = 40; + float dimension_y = 40; + int points_x = 40; + int points_y = 40; + float offset_x = 74; + float offset_y = 33; + + if (code_seen('E')) dimension_x = code_value(); + if (code_seen('F')) dimension_y = code_value(); + if (code_seen('G')) {points_x = code_value(); } + if (code_seen('H')) {points_y = code_value(); } + if (code_seen('I')) {offset_x = code_value(); } + if (code_seen('J')) {offset_y = code_value(); } + printf_P(PSTR("DIM X: %f\n"), dimension_x); + printf_P(PSTR("DIM Y: %f\n"), dimension_y); + printf_P(PSTR("POINTS X: %d\n"), points_x); + printf_P(PSTR("POINTS Y: %d\n"), points_y); + printf_P(PSTR("OFFSET X: %f\n"), offset_x); + printf_P(PSTR("OFFSET Y: %f\n"), offset_y); + bed_check(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y); + }break; + + case 81: + { + float dimension_x = 40; + float dimension_y = 40; + int points_x = 40; + int points_y = 40; + float offset_x = 74; + float offset_y = 33; + + if (code_seen('E')) dimension_x = code_value(); + if (code_seen('F')) dimension_y = code_value(); + if (code_seen("G")) { strchr_pointer+=1; points_x = code_value(); } + if (code_seen("H")) { strchr_pointer+=1; points_y = code_value(); } + if (code_seen("I")) { strchr_pointer+=1; offset_x = code_value(); } + if (code_seen("J")) { strchr_pointer+=1; offset_y = code_value(); } + + bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y); + + } break; + +#endif //HEATBED_ANALYSIS +#ifdef DEBUG_DCODES + case 106: //D106 print measured fan speed for different pwm values + { + for (int i = 255; i > 0; i = i - 5) { + fanSpeed = i; + //delay_keep_alive(2000); + for (int j = 0; j < 100; j++) { + delay_keep_alive(100); + + } + printf_P(_N("%d: %d\n"), i, fan_speed[1]); + } + }break; #ifdef TMC2130 case 2130: //! D2130 - TMC2130 @@ -7934,7 +7949,7 @@ void check_babystep() lcd_update_enable(true); } } -#ifdef DIS +#ifdef HEATBED_ANALYSIS void d_setup() { pinMode(D_DATACLOCK, INPUT_PULLUP); @@ -7984,6 +7999,199 @@ float d_ReadData() } +void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y) { + int t1 = 0; + int t_delay = 0; + int digit[13]; + int m; + char str[3]; + //String mergeOutput; + char mergeOutput[15]; + float output; + + int mesh_point = 0; //index number of calibration point + float bed_zero_ref_x = (-22.f + X_PROBE_OFFSET_FROM_EXTRUDER); //shift between zero point on bed and target and between probe and nozzle + float bed_zero_ref_y = (-0.6f + Y_PROBE_OFFSET_FROM_EXTRUDER); + + float mesh_home_z_search = 4; + float measure_z_heigth = 0.2f; + float row[x_points_num]; + int ix = 0; + int iy = 0; + + const char* filename_wldsd = "mesh.txt"; + char data_wldsd[x_points_num * 7 + 1]; //6 chars(" -A.BCD")for each measurement + null + char numb_wldsd[8]; // (" -A.BCD" + null) +#ifdef MICROMETER_LOGGING + d_setup(); +#endif //MICROMETER_LOGGING + + int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20; + int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40; + + unsigned int custom_message_type_old = custom_message_type; + unsigned int custom_message_state_old = custom_message_state; + custom_message_type = CUSTOM_MSG_TYPE_MESHBL; + custom_message_state = (x_points_num * y_points_num) + 10; + lcd_update(1); + + //mbl.reset(); + babystep_undo(); + + card.openFile(filename_wldsd, false); + + /*destination[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); + + plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); + for(int8_t i=0; i < NUM_AXIS; i++) { + current_position[i] = destination[i]; + } + st_synchronize(); + */ + destination[Z_AXIS] = measure_z_heigth; + plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); + for(int8_t i=0; i < NUM_AXIS; i++) { + current_position[i] = destination[i]; + } + st_synchronize(); + /*int l_feedmultiply = */setup_for_endstop_move(false); + + SERIAL_PROTOCOLPGM("Num X,Y: "); + SERIAL_PROTOCOL(x_points_num); + SERIAL_PROTOCOLPGM(","); + SERIAL_PROTOCOL(y_points_num); + SERIAL_PROTOCOLPGM("\nZ search height: "); + SERIAL_PROTOCOL(mesh_home_z_search); + SERIAL_PROTOCOLPGM("\nDimension X,Y: "); + SERIAL_PROTOCOL(x_dimension); + SERIAL_PROTOCOLPGM(","); + SERIAL_PROTOCOL(y_dimension); + SERIAL_PROTOCOLLNPGM("\nMeasured points:"); + + while (mesh_point != x_points_num * y_points_num) { + ix = mesh_point % x_points_num; // from 0 to MESH_NUM_X_POINTS - 1 + iy = mesh_point / x_points_num; + if (iy & 1) ix = (x_points_num - 1) - ix; // Zig zag + float z0 = 0.f; + /*destination[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); + + plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); + for(int8_t i=0; i < NUM_AXIS; i++) { + current_position[i] = destination[i]; + } + st_synchronize();*/ + + + //current_position[X_AXIS] = 13.f + ix * (x_dimension / (x_points_num - 1)) - bed_zero_ref_x + shift_x; + //current_position[Y_AXIS] = 6.4f + iy * (y_dimension / (y_points_num - 1)) - bed_zero_ref_y + shift_y; + + destination[X_AXIS] = ix * (x_dimension / (x_points_num - 1)) + shift_x; + destination[Y_AXIS] = iy * (y_dimension / (y_points_num - 1)) + shift_y; + + mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], XY_AXIS_FEEDRATE/6, active_extruder); + for(int8_t i=0; i < NUM_AXIS; i++) { + current_position[i] = destination[i]; + } + st_synchronize(); + + // printf_P(PSTR("X = %f; Y= %f \n"), current_position[X_AXIS], current_position[Y_AXIS]); + + delay_keep_alive(1000); +#ifdef MICROMETER_LOGGING + + //memset(numb_wldsd, 0, sizeof(numb_wldsd)); + //dtostrf(d_ReadData(), 8, 5, numb_wldsd); + //strcat(data_wldsd, numb_wldsd); + + + + //MYSERIAL.println(data_wldsd); + //delay(1000); + //delay(3000); + //t1 = millis(); + + //while (digitalRead(D_DATACLOCK) == LOW) {} + //while (digitalRead(D_DATACLOCK) == HIGH) {} + memset(digit, 0, sizeof(digit)); + //cli(); + digitalWrite(D_REQUIRE, LOW); + + for (int i = 0; i<13; i++) + { + //t1 = millis(); + for (int j = 0; j < 4; j++) + { + while (digitalRead(D_DATACLOCK) == LOW) {} + while (digitalRead(D_DATACLOCK) == HIGH) {} + //printf_P(PSTR("Done %d\n"), j); + bitWrite(digit[i], j, digitalRead(D_DATA)); + } + //t_delay = (millis() - t1); + //SERIAL_PROTOCOLPGM(" "); + //SERIAL_PROTOCOL_F(t_delay, 5); + //SERIAL_PROTOCOLPGM(" "); + + } + //sei(); + digitalWrite(D_REQUIRE, HIGH); + mergeOutput[0] = '\0'; + output = 0; + for (int r = 5; r <= 10; r++) //Merge digits + { + sprintf(str, "%d", digit[r]); + strcat(mergeOutput, str); + } + + output = atof(mergeOutput); + + if (digit[4] == 8) //Handle sign + { + output *= -1; + } + + for (int i = digit[11]; i > 0; i--) //Handle floating point + { + output *= 0.1; + } + + + //output = d_ReadData(); + + //row[ix] = current_position[Z_AXIS]; + + + + //row[ix] = d_ReadData(); + + row[ix] = output; + + if (iy % 2 == 1 ? ix == 0 : ix == x_points_num - 1) { + memset(data_wldsd, 0, sizeof(data_wldsd)); + for (int i = 0; i < x_points_num; i++) { + SERIAL_PROTOCOLPGM(" "); + SERIAL_PROTOCOL_F(row[i], 5); + memset(numb_wldsd, 0, sizeof(numb_wldsd)); + dtostrf(row[i], 7, 3, numb_wldsd); + strcat(data_wldsd, numb_wldsd); + } + card.write_command(data_wldsd); + SERIAL_PROTOCOLPGM("\n"); + + } + + custom_message_state--; + mesh_point++; + lcd_update(1); + + } + #endif //MICROMETER_LOGGING + card.closefile(); + //clean_up_after_endstop_move(l_feedmultiply); + +} + void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y) { int t1 = 0; int t_delay = 0; @@ -8167,7 +8375,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ card.closefile(); clean_up_after_endstop_move(l_feedmultiply); } -#endif +#endif //HEATBED_ANALYSIS void temp_compensation_start() { diff --git a/Firmware/pins_Rambo_1_3.h b/Firmware/pins_Rambo_1_3.h index c1adf5969..538fb4f35 100644 --- a/Firmware/pins_Rambo_1_3.h +++ b/Firmware/pins_Rambo_1_3.h @@ -14,6 +14,12 @@ #define SWI2C_SDA 20 //SDA on P3 #define SWI2C_SCL 21 //SCL on P3 +#ifdef MICROMETER_LOGGING +#define D_DATACLOCK 24 //Y_MAX (green) +#define D_DATA 30 //X_MAX (blue) +#define D_REQUIRE 23 //Z_MAX (white) +#endif //MICROMETER_LOGGING + #define X_STEP_PIN 37 diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 4ce13bd60..d6019eebc 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -888,9 +888,7 @@ void manage_heater() } #endif -#ifdef HOST_KEEPALIVE_FEATURE host_keepalive(); -#endif } #define PGM_RD_W(x) (short)pgm_read_word(&x) diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index e316c4f02..99dd1e65a 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -504,4 +504,7 @@ #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning +//#define HEATBED_ANALYSIS //for meash bed leveling and heatbed analysis D-codes D80 and D81 +//#define MICROMETER_LOGGING //related to D-codes D80 and D81, currently works on MK2.5 only (MK3 board pin definitions missing) + #endif //__CONFIGURATION_PRUSA_H From 6a864ffbab45d28fbf3f4680e2696a625a70786b Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Mar 2019 15:43:37 +0100 Subject: [PATCH 094/368] G80 parameters configurable via settings menu --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 14 +++++++-- Firmware/eeprom.h | 3 ++ Firmware/mesh_bed_calibration.cpp | 22 ++++++++++++-- Firmware/mesh_bed_calibration.h | 11 +++---- Firmware/ultralcd.cpp | 48 +++++++++++++++++++++++++++---- 6 files changed, 85 insertions(+), 14 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 78929e9fc..d91f74fb7 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -21,6 +21,7 @@ #include "Configuration.h" #include "pins.h" #include "Timer.h" +extern int mbl_z_probe_nr; #ifndef AT90USB #define HardwareSerial_h // trick to disable the standard HWserial diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d70e66ea6..084241c55 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -167,6 +167,7 @@ CardReader card; unsigned long PingTime = _millis(); unsigned long NcTime; +int mbl_z_probe_nr = 4; //numer of Z measurements for each point in mesh bed leveling calibration //used for PINDA temp calibration and pause print #define DEFAULT_RETRACTION 1 @@ -1465,7 +1466,8 @@ void setup() if (eeprom_read_byte((uint8_t*)EEPROM_SD_SORT) == 255) { eeprom_write_byte((uint8_t*)EEPROM_SD_SORT, 0); } - mbl_mode_init(); + //mbl_mode_init(); + mbl_settings_init(); check_babystep(); //checking if Z babystep is in allowed range #ifdef UVLO_SUPPORT @@ -4325,6 +4327,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) */ case 80: + #ifdef MK1BP break; #endif //MK1BP @@ -4363,6 +4366,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) nMeasPoints = 3; } } + else { + nMeasPoints = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); + } uint8_t nProbeRetry = 3; if (code_seen('R')) { @@ -4371,6 +4377,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) nProbeRetry = 10; } } + else { + nProbeRetry = eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR) - 1; + } + bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); bool temp_comp_start = true; #ifdef PINDA_THERMISTOR @@ -4670,7 +4680,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (nMeasPoints == 3) { mbl.upsample_3x3(); //interpolation from 3x3 to 7x7 points using largrangian polynomials while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them) } - if (nMeasPoints == 7) { + if (nMeasPoints == 7 && magnet_elimination) { mbl_interpolation(nMeasPoints); } // SERIAL_ECHOLNPGM("Upsample finished"); diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 3dc0a0929..8a15248e9 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -156,6 +156,9 @@ #define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1) #define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_CUTTER_ENABLED - 12*12*2) //allow 12 calibration points for future expansion #define EEPROM_MBL_TYPE (EEPROM_UVLO_MESH_BED_LEVELING_FULL-1) //uint8_t for mesh bed leveling precision +#define EEPROM_MBL_MAGNET_ELIMINATION (EEPROM_MBL_TYPE -1) +#define EEPROM_MBL_POINTS_NR (EEPROM_MBL_MAGNET_ELIMINATION -1) //uint8_t number of points in one exis for mesh bed leveling +#define EEPROM_MBL_PROBE_NR (EEPROM_MBL_POINTS_NR-1) // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index c5fc58290..9b3c78f1d 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -985,7 +985,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i // SERIAL_ECHOLNPGM(""); float dz = i?abs(current_position[Z_AXIS] - (z / i)):0; z += current_position[Z_AXIS]; -// printf_P(PSTR(" Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000)); + printf_P(PSTR("Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000)); if (dz > 0.05) goto error;//deviation > 50um } current_position[Z_AXIS] = z; @@ -3048,7 +3048,7 @@ void count_xyz_details(float (&distanceMin)[2]) { distanceMin[mesh_point] = (y - Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH); } } - +/* e_MBL_TYPE e_mbl_type = e_MBL_OPTIMAL; void mbl_mode_set() { @@ -3066,6 +3066,24 @@ void mbl_mode_init() { if (mbl_type == 0xFF) e_mbl_type = e_MBL_OPTIMAL; else e_mbl_type = mbl_type; } +*/ + +void mbl_settings_init() { +//3x3 mesh; 3 Z-probes on each point, magnet elimination on +//magnet elimination: use aaproximate Z-coordinate instead of measured values for points which are near magnets + if (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) == 0xFF) { + eeprom_update_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION, 1); + } + if (eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR) == 0xFF) { + eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, 3); + } + mbl_z_probe_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); + if (mbl_z_probe_nr == 0xFF) { + mbl_z_probe_nr = 4; + eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mbl_z_probe_nr); + } + +} bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag) { //"human readable" heatbed plan diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index 7fd8011c7..954db9c30 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -200,15 +200,16 @@ extern void babystep_reset(); extern void count_xyz_details(float (&distanceMin)[2]); extern bool sample_z(); - +/* typedef enum { e_MBL_FAST, e_MBL_OPTIMAL, e_MBL_PREC } e_MBL_TYPE; - -extern e_MBL_TYPE e_mbl_type; -extern void mbl_mode_set(); -extern void mbl_mode_init(); +*/ +//extern e_MBL_TYPE e_mbl_type; +//extern void mbl_mode_set(); +//extern void mbl_mode_init(); +extern void mbl_settings_init(); extern bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag); extern void mbl_interpolation(uint8_t meas_points); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4e3d76b47..77492ac08 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -47,6 +47,7 @@ char longFilenameOLD[LONG_FILENAME_LENGTH]; static void lcd_sd_updir(); +static void lcd_mesh_bed_leveling_settings(); int8_t ReInitLCD = 0; @@ -5325,6 +5326,7 @@ do\ while (0) #endif // SDCARD_SORT_ALPHA +/* #define SETTINGS_MBL_MODE \ do\ {\ @@ -5345,7 +5347,7 @@ do\ }\ }\ while (0) - +*/ #define SETTINGS_SOUND \ do\ @@ -5395,7 +5397,7 @@ static void lcd_settings_menu() SETTINGS_SILENT_MODE; - MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_TEMPERATURE c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_MBL_SETTINGS c=18 r=1 #if defined (TMC2130) && defined (LINEARITY_CORRECTION) MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu); @@ -6632,10 +6634,46 @@ static void lcd_tune_menu() MENU_END(); } -static void mesh_bed_leveling_menu() -{ +static void mbl_magnets_elimination_set() { + bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); + magnet_elimination = !magnet_elimination; + eeprom_update_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION, (uint8_t)magnet_elimination); +} - SETTINGS_MBL_MODE; +static void mbl_mesh_set() { + uint8_t mesh_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); + if(mesh_nr == 3) mesh_nr = 7; + else mesh_nr = 3; + eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mesh_nr); +} + +static void lcd_mesh_bed_leveling_settings() +{ + + bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); + uint8_t points_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); + + MENU_BEGIN(); + // leaving menu - this condition must be immediately before MENU_ITEM_BACK_P + if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving) + { + eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, (uint8_t)mbl_z_probe_nr); + } + MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); + if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); + else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); + MENU_ITEM_EDIT_int3_P(_i("Probe nr."), &mbl_z_probe_nr, 1, 5); + if (points_nr == 7) { + if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets eli [On]"), mbl_magnets_elimination_set); + else MENU_ITEM_FUNCTION_P(_i("Magnets eli [Off]"), mbl_magnets_elimination_set); + } + else menu_item_text_P(_i("MAgnets eli [N/A]")); + MENU_END(); + /*if(menu_leaving) + { + eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mbl_z_probe_nr); + }*/ + //SETTINGS_MBL_MODE; } static void lcd_control_temperature_menu() From f293d61d3d26bb529c856b0283c5887f89900aa6 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Mar 2019 18:52:14 +0100 Subject: [PATCH 095/368] faster Z probe: move Z 150um relatively to last measurement. If PINDA is triggered at the beginning of measurement, move Z 500um higher and repeat measurement --- Firmware/mesh_bed_calibration.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 9b3c78f1d..7b53e2859 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -967,15 +967,29 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i #endif //TMC2130 for (uint8_t i = 0; i < n_iter; ++ i) { - // Move up the retract distance. - current_position[Z_AXIS] += .5f; - go_to_current(homing_feedrate[Z_AXIS]/60); - // Move back down slowly to find bed. + + current_position[Z_AXIS] += 0.15; + float z_bckp = current_position[Z_AXIS]; + go_to_current(homing_feedrate[Z_AXIS]/60); + // Move back down slowly to find bed. current_position[Z_AXIS] = minimum_z; go_to_current(homing_feedrate[Z_AXIS]/(4*60)); // we have to let the planner know where we are right now as it is not where we said to go. update_current_position_z(); - if (! endstop_z_hit_on_purpose()) + //printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS])); + if (abs(current_position[Z_AXIS] - z_bckp) < 0.025) { + printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); + current_position[Z_AXIS] += 0.5; + go_to_current(homing_feedrate[Z_AXIS]/60); + current_position[Z_AXIS] = minimum_z; + go_to_current(homing_feedrate[Z_AXIS]/(4*60)); + // we have to let the planner know where we are right now as it is not where we said to go. + update_current_position_z(); + } + + + + if (! endstop_z_hit_on_purpose()) goto error; #ifdef TMC2130 if (READ(Z_TMC2130_DIAG) != 0) goto error; //crash Z detected @@ -2748,7 +2762,7 @@ void go_home_with_z_lift() 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_to_current(homing_feedrate[X_AXIS]/20); // Third move up to a safe height. current_position[Z_AXIS] = Z_MIN_POS; go_to_current(homing_feedrate[Z_AXIS]/60); From 952e0e1e772135f389d1ae19cbf6c903fb14c40d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Mar 2019 19:49:10 +0100 Subject: [PATCH 096/368] change min. nProbeRetry to 1 --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 084241c55..fe88c8cae 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4378,7 +4378,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } } else { - nProbeRetry = eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR) - 1; + nProbeRetry = eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR); } bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); From 315959c13aab15abc9fce571201f5d4453256417 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Mar 2019 20:03:23 +0100 Subject: [PATCH 097/368] menu update --- Firmware/ultralcd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 77492ac08..ce38a35d6 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6660,14 +6660,14 @@ static void lcd_mesh_bed_leveling_settings() eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, (uint8_t)mbl_z_probe_nr); } MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); - if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); - else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); - MENU_ITEM_EDIT_int3_P(_i("Probe nr."), &mbl_z_probe_nr, 1, 5); + if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); + else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); + MENU_ITEM_EDIT_int3_P(_i("Z-probe nr."), &mbl_z_probe_nr, 1, 5); if (points_nr == 7) { - if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets eli [On]"), mbl_magnets_elimination_set); - else MENU_ITEM_FUNCTION_P(_i("Magnets eli [Off]"), mbl_magnets_elimination_set); + if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets eli [On]"), mbl_magnets_elimination_set); + else MENU_ITEM_FUNCTION_P(_i("Magnets comp. [Off]"), mbl_magnets_elimination_set); } - else menu_item_text_P(_i("MAgnets eli [N/A]")); + else menu_item_text_P(_i("Magnets comp. [N/A]")); MENU_END(); /*if(menu_leaving) { From 091934462d09f52c61f7b68c04cb23fe1c090e9f Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Mar 2019 20:06:30 +0100 Subject: [PATCH 098/368] menu correction --- Firmware/ultralcd.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ce38a35d6..5cdf6b8a5 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6660,14 +6660,14 @@ static void lcd_mesh_bed_leveling_settings() eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, (uint8_t)mbl_z_probe_nr); } MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); - if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); - else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); + if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); + else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); MENU_ITEM_EDIT_int3_P(_i("Z-probe nr."), &mbl_z_probe_nr, 1, 5); if (points_nr == 7) { - if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets eli [On]"), mbl_magnets_elimination_set); - else MENU_ITEM_FUNCTION_P(_i("Magnets comp. [Off]"), mbl_magnets_elimination_set); + if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets eli [On]"), mbl_magnets_elimination_set); + else MENU_ITEM_FUNCTION_P(_i("Magnets comp. [Off]"), mbl_magnets_elimination_set); } - else menu_item_text_P(_i("Magnets comp. [N/A]")); + else menu_item_text_P(_i("Magnets comp. [N/A]")); MENU_END(); /*if(menu_leaving) { From 141b78c048c76cff09866c68036d5ff7f9e10d27 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Sun, 10 Mar 2019 16:03:46 +0100 Subject: [PATCH 099/368] number of Z-probes defualt value changed from 4 to 3, mmu stealth mode switch in settings menu --- Firmware/Marlin_main.cpp | 7 ++++++- Firmware/eeprom.h | 1 + Firmware/mesh_bed_calibration.cpp | 2 +- Firmware/mmu.cpp | 6 ++---- Firmware/ultralcd.cpp | 14 ++++++++++++++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index fe88c8cae..22fb576b9 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -167,7 +167,7 @@ CardReader card; unsigned long PingTime = _millis(); unsigned long NcTime; -int mbl_z_probe_nr = 4; //numer of Z measurements for each point in mesh bed leveling calibration +int mbl_z_probe_nr = 3; //numer of Z measurements for each point in mesh bed leveling calibration //used for PINDA temp calibration and pause print #define DEFAULT_RETRACTION 1 @@ -1468,6 +1468,11 @@ void setup() } //mbl_mode_init(); mbl_settings_init(); + SilentModeMenu_MMU = eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH); + if (SilentModeMenu_MMU == 255) { + SilentModeMenu_MMU = 1; + eeprom_write_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU); + } check_babystep(); //checking if Z babystep is in allowed range #ifdef UVLO_SUPPORT diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 8a15248e9..56ee5f77d 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -159,6 +159,7 @@ #define EEPROM_MBL_MAGNET_ELIMINATION (EEPROM_MBL_TYPE -1) #define EEPROM_MBL_POINTS_NR (EEPROM_MBL_MAGNET_ELIMINATION -1) //uint8_t number of points in one exis for mesh bed leveling #define EEPROM_MBL_PROBE_NR (EEPROM_MBL_POINTS_NR-1) +#define EEPROM_MMU_STEALTH (EEPROM_MBL_PROBE_NR-1) // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 7b53e2859..8de8fe81b 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3093,7 +3093,7 @@ void mbl_settings_init() { } mbl_z_probe_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); if (mbl_z_probe_nr == 0xFF) { - mbl_z_probe_nr = 4; + mbl_z_probe_nr = 3; eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mbl_z_probe_nr); } diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 449efabd0..6d5cc5144 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -185,10 +185,8 @@ static bool activate_stealth_mode() { #if defined (MMU_FORCE_STEALTH_MODE) return true; -#elif defined (SILENT_MODE_STEALTH) - return (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); -#else - return false; +#elif + return (eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH) == 1); #endif } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5cdf6b8a5..169ae1434 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -53,6 +53,7 @@ int8_t ReInitLCD = 0; int8_t SilentModeMenu = SILENT_MODE_OFF; +uint8_t SilentModeMenu_MMU = 1; //activate mmu unit stealth mode int8_t FSensorStateMenu = 1; @@ -4515,6 +4516,12 @@ static void lcd_sound_state_set(void) Sound_CycleState(); } +static void lcd_silent_mode_mmu_set() { + if (SilentModeMenu_MMU == 1) SilentModeMenu_MMU = 0; + else SilentModeMenu_MMU = 1; + eeprom_update_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU); +} + static void lcd_silent_mode_set() { switch (SilentModeMenu) { #ifdef TMC2130 @@ -5288,6 +5295,13 @@ do\ break; /* (probably) not needed*/\ }\ }\ +#ifndef MMU_FORCE_STEALTH_MODE + if(mmu_enabled)\ + {\ + if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Fast]"), lcd_silent_mode_mmu_set);\ + else MENU_ITEM_FUNCTION_P(_i("MMU Mode [Stealth]"), lcd_silent_mode_mmu_set);\ + }\ +#endif //MMU_FORCE_STEALTH_MODE }\ while (0) #endif //TMC2130 From 819a91ab1e88d96e7eaae630bc6c9a29a4471007 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 11 Mar 2019 12:33:22 +0100 Subject: [PATCH 100/368] switching stealth/normal mode for mmu in settings menu and tune menu --- Firmware/mmu.cpp | 27 ++++++++++++++++++++++++--- Firmware/ultralcd.cpp | 30 +++++++++++++++++++++--------- Firmware/ultralcd.h | 1 + 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 6d5cc5144..3e587ce90 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -45,6 +45,7 @@ namespace WaitCmd, //!< wait for command response Pause, GetDrvError, //!< get power failures count + SwitchMode //switch mmu between stealth and normal mode }; } @@ -183,9 +184,9 @@ bool check_for_ir_sensor() static bool activate_stealth_mode() { -#if defined (MMU_FORCE_STEALTH_MODE) +#ifdef MMU_FORCE_STEALTH_MODE return true; -#elif +#else return (eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH) == 1); #endif } @@ -335,6 +336,12 @@ void mmu_loop(void) mmu_last_cmd = mmu_cmd; mmu_cmd = MmuCmd::None; } + else if ((eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH) != SilentModeMenu_MMU) && mmu_ready) { + DEBUG_PRINTF_P(PSTR("MMU <= 'M%d'\n"), SilentModeMenu_MMU); + mmu_printf_P(PSTR("M%d\n"), SilentModeMenu_MMU); + mmu_ready = false; + mmu_state = S::SwitchMode; + } else if ((mmu_last_response + 300) < _millis()) //request every 300ms { #ifndef IR_SENSOR @@ -450,9 +457,23 @@ void mmu_loop(void) mmu_state = S::Idle; } else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis()) - { //resend request after timeout (5 min) + { //timeout 45 s mmu_state = S::Idle; } + return; + case S::SwitchMode: + if (mmu_rx_ok() > 0) + { + DEBUG_PRINTF_P(PSTR("MMU => 'ok'\n")); + eeprom_update_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU); + mmu_ready = true; + mmu_state = S::Idle; + } + else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis()) + { //timeout 45 s + mmu_state = S::Idle; + } + return; } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 169ae1434..2627a8aaa 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4516,11 +4516,13 @@ static void lcd_sound_state_set(void) Sound_CycleState(); } +#ifndef MMU_FORCE_STEALTH_MODE static void lcd_silent_mode_mmu_set() { if (SilentModeMenu_MMU == 1) SilentModeMenu_MMU = 0; else SilentModeMenu_MMU = 1; - eeprom_update_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU); + //saving to eeprom is done in mmu_loop() after mmu actually switches state and confirms with "ok" } +#endif //MMU_FORCE_STEALTH_MODE static void lcd_silent_mode_set() { switch (SilentModeMenu) { @@ -5295,17 +5297,26 @@ do\ break; /* (probably) not needed*/\ }\ }\ -#ifndef MMU_FORCE_STEALTH_MODE - if(mmu_enabled)\ - {\ - if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Fast]"), lcd_silent_mode_mmu_set);\ - else MENU_ITEM_FUNCTION_P(_i("MMU Mode [Stealth]"), lcd_silent_mode_mmu_set);\ - }\ -#endif //MMU_FORCE_STEALTH_MODE + }\ while (0) #endif //TMC2130 +#ifndef MMU_FORCE_STEALTH_MODE +#define SETTINGS_MMU_MODE \ +do\ +{\ + if (mmu_enabled)\ + {\ + if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Fast]"), lcd_silent_mode_mmu_set); \ + else MENU_ITEM_FUNCTION_P(_i("MMU Mode[Stealth]"), lcd_silent_mode_mmu_set); \ + }\ +}\ +while (0) +#else //MMU_FORCE_STEALTH_MODE +#define SETTINGS_MMU_MODE +#endif //MMU_FORCE_STEALTH_MODE + #ifdef SDCARD_SORT_ALPHA #define SETTINGS_SD \ do\ @@ -5410,6 +5421,7 @@ static void lcd_settings_menu() MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1 SETTINGS_SILENT_MODE; + SETTINGS_MMU_MODE; MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_MBL_SETTINGS c=18 r=1 @@ -6626,7 +6638,7 @@ static void lcd_tune_menu() } } #endif //TMC2130 - + SETTINGS_MMU_MODE; switch(eSoundMode) { case e_SOUND_MODE_LOUD: diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 0b286181b..8ed424427 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -117,6 +117,7 @@ extern int farm_status; #endif extern int8_t SilentModeMenu; +extern uint8_t SilentModeMenu_MMU; extern bool cancel_heatup; extern bool isPrintPaused; From 698f81abe00e2462e2020f177c8f156607bdcbf4 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 11 Mar 2019 15:55:48 +0100 Subject: [PATCH 101/368] fix compile error --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2627a8aaa..c1372f0e5 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5297,7 +5297,6 @@ do\ break; /* (probably) not needed*/\ }\ }\ - }\ while (0) #endif //TMC2130 From 3388444b6c5e92e85cf1a9feb48dd8adc3af91f8 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 11 Mar 2019 20:43:07 +0100 Subject: [PATCH 102/368] better autoLoad II autoLoad inhibit if Support::ExtruderInfo(@MKx)/SensorInfo(@MKxS)-menu is selected --- Firmware/Marlin_main.cpp | 9 ++++++++- Firmware/ultralcd.cpp | 6 +++--- Firmware/ultralcd.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 612b1795f..cfa0efa6a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7479,11 +7479,18 @@ static void handleSafetyTimer() void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h { +bool bInhibitFlag; #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { //-// if (mcode_in_progress != 600) //M600 not in progress - if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad) && (menu_menu!=lcd_menu_extruder_info)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo menu not active +#ifdef PAT9125 + bInhibitFlag=(menu_menu==lcd_menu_extruder_info); // Support::ExtruderInfo menu active +#endif // PAT9125 +#ifdef IR_SENSOR + bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active +#endif // IR_SENSOR + if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c6e1d8e23..f08cb89c6 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -133,14 +133,14 @@ static void prusa_stat_farm_number(); static void prusa_stat_temperatures(); static void prusa_stat_printinfo(); static void lcd_farm_no(); -void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") +//static void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") static void lcd_menu_xyz_y_min(); static void lcd_menu_xyz_skew(); static void lcd_menu_xyz_offset(); static void lcd_menu_fails_stats_mmu(); static void lcd_menu_fails_stats_mmu_print(); static void lcd_menu_fails_stats_mmu_total(); -static void lcd_menu_show_sensors_state(); +//static void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") static void mmu_fil_eject_menu(); static void mmu_load_to_nozzle_menu(); @@ -4038,7 +4038,7 @@ static void lcd_show_sensors_state() lcd_print_state(idler_state); } -static void lcd_menu_show_sensors_state() +void lcd_menu_show_sensors_state() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") { lcd_timeoutToStatus.stop(); lcd_show_sensors_state(); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index affd7b0b5..1641e4ce7 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -46,6 +46,7 @@ extern bool lcd_selftest(); void lcd_menu_statistics(); void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") +void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines); extern const char* lcd_display_message_fullscreen_P(const char *msg); From 9a83925a97eeb26c9260aace19e2a5ab41a9b0ba Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 11 Mar 2019 23:13:55 +0100 Subject: [PATCH 103/368] fixed bug in counting approximate Z coordinate --- Firmware/Marlin_main.cpp | 32 +++++++++++++++++++++++++++++++ Firmware/mesh_bed_calibration.cpp | 21 +++++++++++++------- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 22fb576b9..6aadd69c1 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4685,9 +4685,41 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (nMeasPoints == 3) { mbl.upsample_3x3(); //interpolation from 3x3 to 7x7 points using largrangian polynomials while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them) } +/* + SERIAL_PROTOCOLPGM("Num X,Y: "); + SERIAL_PROTOCOL(MESH_NUM_X_POINTS); + SERIAL_PROTOCOLPGM(","); + SERIAL_PROTOCOL(MESH_NUM_Y_POINTS); + SERIAL_PROTOCOLPGM("\nZ search height: "); + SERIAL_PROTOCOL(MESH_HOME_Z_SEARCH); + SERIAL_PROTOCOLLNPGM("\nMeasured points:"); + for (int y = MESH_NUM_Y_POINTS-1; y >= 0; y--) { + for (int x = 0; x < MESH_NUM_X_POINTS; x++) { + SERIAL_PROTOCOLPGM(" "); + SERIAL_PROTOCOL_F(mbl.z_values[y][x], 5); + } + SERIAL_PROTOCOLPGM("\n"); + } +*/ if (nMeasPoints == 7 && magnet_elimination) { mbl_interpolation(nMeasPoints); } +/* + SERIAL_PROTOCOLPGM("Num X,Y: "); + SERIAL_PROTOCOL(MESH_NUM_X_POINTS); + SERIAL_PROTOCOLPGM(","); + SERIAL_PROTOCOL(MESH_NUM_Y_POINTS); + SERIAL_PROTOCOLPGM("\nZ search height: "); + SERIAL_PROTOCOL(MESH_HOME_Z_SEARCH); + SERIAL_PROTOCOLLNPGM("\nMeasured points:"); + for (int y = MESH_NUM_Y_POINTS-1; y >= 0; y--) { + for (int x = 0; x < MESH_NUM_X_POINTS; x++) { + SERIAL_PROTOCOLPGM(" "); + SERIAL_PROTOCOL_F(mbl.z_values[y][x], 5); + } + SERIAL_PROTOCOLPGM("\n"); + } +*/ // SERIAL_ECHOLNPGM("Upsample finished"); mbl.active = 1; //activate mesh bed leveling // SERIAL_ECHOLNPGM("Mesh bed leveling activated"); diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 8de8fe81b..f9c21c006 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3121,18 +3121,25 @@ bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bo ix *= 3; iy *= 3; } - if((iy%2) == 0) return (valid_points_mask[6 - iy] & (1 << (6 - ix))); - else return (valid_points_mask[6 - iy] & (1 << ix)); + if (zigzag) { + if ((iy % 2) == 0) return (valid_points_mask[6 - iy] & (1 << (6 - ix))); + else return (valid_points_mask[6 - iy] & (1 << ix)); + } + else { + return (valid_points_mask[6 - iy] & (1 << (6 - ix))); + } } void mbl_single_point_interpolation(uint8_t x, uint8_t y, uint8_t meas_points) { + printf_P(PSTR("x = %d; y = %d \n"), x, y); uint8_t count = 0; float z = 0; - if(mbl_point_measurement_valid(x, y+1, meas_points, false)) { z += mbl.z_values[x][y+1]; count++; } - if(mbl_point_measurement_valid(x, y-1, meas_points, false)) { z += mbl.z_values[x][y-1]; count++; } - if(mbl_point_measurement_valid(x+1, y, meas_points, false)) { z += mbl.z_values[x+1][y]; count++; } - if(mbl_point_measurement_valid(x-1, y, meas_points, false)) { z += mbl.z_values[x+1][y]; count++; } - if(count != 0) mbl.z_values[x][y] = z / count; //if we have at least one valid point in surrounding area use average value, otherwise use inaccurately measured Z-coordinate + if (mbl_point_measurement_valid(x, y + 1, meas_points, false)) { z += mbl.z_values[y + 1][x]; /*printf_P(PSTR("x; y+1: Z = %f \n")*/, mbl.z_values[y + 1][x]); count++; } + if (mbl_point_measurement_valid(x, y - 1, meas_points, false)) { z += mbl.z_values[y - 1][x]; /*printf_P(PSTR("x; y-1: Z = %f \n")*/, mbl.z_values[y - 1][x]); count++; } + if (mbl_point_measurement_valid(x + 1, y, meas_points, false)) { z += mbl.z_values[y][x + 1]; /*printf_P(PSTR("x+1; y: Z = %f \n")*/, mbl.z_values[y][x + 1]); count++; } + if (mbl_point_measurement_valid(x - 1, y, meas_points, false)) { z += mbl.z_values[y][x - 1]; /*printf_P(PSTR("x-1; y: Z = %f \n")*/, mbl.z_values[y][x - 1]); count++; } + if(count != 0) mbl.z_values[y][x] = z / count; //if we have at least one valid point in surrounding area use average value, otherwise use inaccurately measured Z-coordinate + //printf_P(PSTR("result: Z = %f \n\n"), mbl.z_values[y][x]); } void mbl_interpolation(uint8_t meas_points) { From 0aa21c362ef25db5ed8abeb992d60c4c207b37be Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 11 Mar 2019 23:37:30 +0100 Subject: [PATCH 104/368] compile error fix --- Firmware/mesh_bed_calibration.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index f9c21c006..0a6755506 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3134,10 +3134,10 @@ void mbl_single_point_interpolation(uint8_t x, uint8_t y, uint8_t meas_points) { printf_P(PSTR("x = %d; y = %d \n"), x, y); uint8_t count = 0; float z = 0; - if (mbl_point_measurement_valid(x, y + 1, meas_points, false)) { z += mbl.z_values[y + 1][x]; /*printf_P(PSTR("x; y+1: Z = %f \n")*/, mbl.z_values[y + 1][x]); count++; } - if (mbl_point_measurement_valid(x, y - 1, meas_points, false)) { z += mbl.z_values[y - 1][x]; /*printf_P(PSTR("x; y-1: Z = %f \n")*/, mbl.z_values[y - 1][x]); count++; } - if (mbl_point_measurement_valid(x + 1, y, meas_points, false)) { z += mbl.z_values[y][x + 1]; /*printf_P(PSTR("x+1; y: Z = %f \n")*/, mbl.z_values[y][x + 1]); count++; } - if (mbl_point_measurement_valid(x - 1, y, meas_points, false)) { z += mbl.z_values[y][x - 1]; /*printf_P(PSTR("x-1; y: Z = %f \n")*/, mbl.z_values[y][x - 1]); count++; } + if (mbl_point_measurement_valid(x, y + 1, meas_points, false)) { z += mbl.z_values[y + 1][x]; /*printf_P(PSTR("x; y+1: Z = %f \n"), mbl.z_values[y + 1][x]);*/ count++; } + if (mbl_point_measurement_valid(x, y - 1, meas_points, false)) { z += mbl.z_values[y - 1][x]; /*printf_P(PSTR("x; y-1: Z = %f \n"), mbl.z_values[y - 1][x]);*/ count++; } + if (mbl_point_measurement_valid(x + 1, y, meas_points, false)) { z += mbl.z_values[y][x + 1]; /*printf_P(PSTR("x+1; y: Z = %f \n"), mbl.z_values[y][x + 1]);*/ count++; } + if (mbl_point_measurement_valid(x - 1, y, meas_points, false)) { z += mbl.z_values[y][x - 1]; /*printf_P(PSTR("x-1; y: Z = %f \n"), mbl.z_values[y][x - 1]);*/ count++; } if(count != 0) mbl.z_values[y][x] = z / count; //if we have at least one valid point in surrounding area use average value, otherwise use inaccurately measured Z-coordinate //printf_P(PSTR("result: Z = %f \n\n"), mbl.z_values[y][x]); } From c3a95ab79baa4dfebd346fb7f99308b0affc39f5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 12 Mar 2019 11:57:35 +0100 Subject: [PATCH 105/368] variants update --- Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 3b9f76987..a036a11a6 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -438,7 +438,7 @@ THERMISTORS SETTINGS #define M600_TIMEOUT 600 //seconds -#define MMU_REQUIRED_FW_BUILDNR 132 +#define MMU_REQUIRED_FW_BUILDNR 310 #ifndef SNMM //#define SUPPORT_VERBOSITY diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 2d00929f3..d2ada705a 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -438,7 +438,7 @@ THERMISTORS SETTINGS #define M600_TIMEOUT 600 //seconds -#define MMU_REQUIRED_FW_BUILDNR 132 +#define MMU_REQUIRED_FW_BUILDNR 310 #ifndef SNMM //#define SUPPORT_VERBOSITY diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index 40a3a229b..424d2a7e1 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -497,7 +497,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 132 +#define MMU_REQUIRED_FW_BUILDNR 310 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 99dd1e65a..0912748af 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -498,7 +498,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 132 +#define MMU_REQUIRED_FW_BUILDNR 310 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index d3badf6aa..c02868c9f 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -497,7 +497,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 132 +#define MMU_REQUIRED_FW_BUILDNR 310 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 2563f848a..008f1b178 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -498,7 +498,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 132 +#define MMU_REQUIRED_FW_BUILDNR 310 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index c400b016f..baebd0ecb 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -623,7 +623,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 83 +#define MMU_REQUIRED_FW_BUILDNR 310 #define MMU_HWRESET #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 37512071c..a99d38f71 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -623,7 +623,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 83 +#define MMU_REQUIRED_FW_BUILDNR 310 #define MMU_HWRESET #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning From 6c70d598100a6801e70e1020e0efa64671c164a1 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 13 Mar 2019 15:05:10 +0100 Subject: [PATCH 106/368] mbl settings initialization fix --- Firmware/eeprom.h | 2 +- Firmware/mesh_bed_calibration.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 56ee5f77d..c96e1d8db 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -158,7 +158,7 @@ #define EEPROM_MBL_TYPE (EEPROM_UVLO_MESH_BED_LEVELING_FULL-1) //uint8_t for mesh bed leveling precision #define EEPROM_MBL_MAGNET_ELIMINATION (EEPROM_MBL_TYPE -1) #define EEPROM_MBL_POINTS_NR (EEPROM_MBL_MAGNET_ELIMINATION -1) //uint8_t number of points in one exis for mesh bed leveling -#define EEPROM_MBL_PROBE_NR (EEPROM_MBL_POINTS_NR-1) +#define EEPROM_MBL_PROBE_NR (EEPROM_MBL_POINTS_NR-1) //number of measurements for each point #define EEPROM_MMU_STEALTH (EEPROM_MBL_PROBE_NR-1) // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 0a6755506..e50fb435e 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3088,15 +3088,14 @@ void mbl_settings_init() { if (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) == 0xFF) { eeprom_update_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION, 1); } - if (eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR) == 0xFF) { - eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, 3); + if (eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR) == 0xFF) { + eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, 3); } - mbl_z_probe_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); + mbl_z_probe_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR); if (mbl_z_probe_nr == 0xFF) { mbl_z_probe_nr = 3; - eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mbl_z_probe_nr); + eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, mbl_z_probe_nr); } - } bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag) { From 32138ea09af8f3a1700d55d0c9e54eed49ce542d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 13 Mar 2019 15:08:09 +0100 Subject: [PATCH 107/368] menu item alignment --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index cae2f2748..655b15907 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5309,7 +5309,7 @@ do\ {\ if (mmu_enabled)\ {\ - if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Fast]"), lcd_silent_mode_mmu_set); \ + if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Fast]"), lcd_silent_mode_mmu_set); \ else MENU_ITEM_FUNCTION_P(_i("MMU Mode[Stealth]"), lcd_silent_mode_mmu_set); \ }\ }\ From 900ee0c5efb8c60ff4fba889c2291de486f7d78f Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 13 Mar 2019 19:10:43 +0100 Subject: [PATCH 108/368] Update build environment to fix maximum flash size check. --- PF-build.sh | 2 +- build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PF-build.sh b/PF-build.sh index 1875c689a..f4f300850 100644 --- a/PF-build.sh +++ b/PF-build.sh @@ -117,7 +117,7 @@ if ! type zip > /dev/null; then fi ###End prepare bash enviroment -BUILD_ENV="1.0.1" +BUILD_ENV="1.0.2" SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" # List few useful data diff --git a/build.sh b/build.sh index 051f1352c..3f81cd788 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -BUILD_ENV="1.0.1" +BUILD_ENV="1.0.2" SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" if [ ! -d "build-env" ]; then From 72f51989fa7b3df34da645548a3c2227c58a0757 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 13 Mar 2019 19:41:09 +0100 Subject: [PATCH 109/368] compare measured Z-value during mesh bed leveling with Z-calibration value even for 7x7 mesh --- Firmware/Marlin_main.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2b22383b5..140c680b3 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4447,7 +4447,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20; int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40; - bool has_z = (nMeasPoints == 3) && is_bed_z_jitter_data_valid(); //checks if we have data from Z calibration (offsets of the Z heiths of the 8 calibration points from the first point) + bool has_z = is_bed_z_jitter_data_valid(); //checks if we have data from Z calibration (offsets of the Z heiths of the 8 calibration points from the first point) #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 1) { has_z ? SERIAL_PROTOCOLPGM("Z jitter data from Z cal. valid.\n") : SERIAL_PROTOCOLPGM("Z jitter data from Z cal. not valid.\n"); @@ -4466,11 +4466,14 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) continue; //skip }*/ if (iy & 1) ix = (nMeasPoints - 1) - ix; // Zig zag + if (nMeasPoints == 7) //if we have 7x7 mesh, compare with Z-calibration for points which are in 3x3 mesh + { + has_z = ((ix % 3 == 0) && (iy % 3 == 0)) && is_bed_z_jitter_data_valid(); + } float z0 = 0.f; if (has_z && (mesh_point > 0)) { uint16_t z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1))); z0 = mbl.z_values[0][0] + *reinterpret_cast(&z_offset_u) * 0.01; - //#if 0 #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 1) { SERIAL_ECHOLNPGM(""); @@ -4481,7 +4484,6 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) SERIAL_ECHOLNPGM(""); } #endif // SUPPORT_VERBOSITY - //#endif } // Move Z up to MESH_HOME_Z_SEARCH. @@ -4511,7 +4513,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // Go down until endstop is hit const float Z_CALIBRATION_THRESHOLD = 1.f; if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point - kill_message = _T(MSG_BED_LEVELING_FAILED_POINT_LOW); + printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); break; } if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { //broken cable or initial Z coordinate too low. Go to MESH_HOME_Z_SEARCH and repeat last step (z-probe) again to distinguish between these two cases. @@ -4521,16 +4523,16 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) st_synchronize(); if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point - kill_message = _T(MSG_BED_LEVELING_FAILED_POINT_LOW); + printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); break; } if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { - kill_message = _i("Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset.");////MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 + printf_P(PSTR("Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset.\n")); break; } } if (has_z && fabs(z0 - current_position[Z_AXIS]) > Z_CALIBRATION_THRESHOLD) { //if we have data from z calibration, max. allowed difference is 1mm for each point - kill_message = _i("Bed leveling failed. Sensor triggered too high. Waiting for reset.");////MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 + printf_P(PSTR("Bed leveling failed. Sensor triggered too high. Waiting for reset.\n")); break; } #ifdef SUPPORT_VERBOSITY From 3b78e61b6836af27727ef5c77b00cf41851e413b Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 13 Mar 2019 21:01:56 +0100 Subject: [PATCH 110/368] Fix flash size check --- PF-build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PF-build.sh b/PF-build.sh index f4f300850..7c1e26d42 100644 --- a/PF-build.sh +++ b/PF-build.sh @@ -76,6 +76,8 @@ # $2 = multi language OR english only [ALL/EN_ONLY] # $3 = development status [GOLD/RC/BETA/ALPHA/DEVEL/DEBUG] # If one argument is wrong a list of valid one will be shown +# 13 Mar 2019, 3d-gussner, MKbel updated the linux build enviromentto version 1.0.2 with an Fix maximum firmware flash size. +# So did I ###Check if OSTYPE is supported From 1f131f66e096a73bb5718bd1cac006adcca8c20f Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Thu, 14 Mar 2019 00:36:56 +0100 Subject: [PATCH 111/368] print parameters checking nozzle diameter --- Firmware/Marlin_main.cpp | 39 +++++++++++++-- Firmware/eeprom.h | 4 ++ Firmware/ultralcd.cpp | 104 +++++++++++++++++++++++++++++++++++++++ Firmware/ultralcd.h | 4 +- Firmware/util.cpp | 43 ++++++++++++++++ Firmware/util.h | 25 ++++++++++ 6 files changed, 214 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2c083b0ae..bf967812d 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -214,8 +214,6 @@ static LongTimer crashDetTimer; bool mesh_bed_leveling_flag = false; bool mesh_bed_run_from_menu = false; -int8_t FarmMode = 0; - bool prusa_sd_card_upload = false; unsigned int status_number = 0; @@ -1617,6 +1615,7 @@ void setup() } #endif //UVLO_SUPPORT + fCheckModeInit(); KEEPALIVE_STATE(NOT_BUSY); #ifdef WATCHDOG wdt_enable(WDTO_4S); @@ -3578,7 +3577,39 @@ void process_commands() } else if(code_seen("FR")) { //! PRUSA FR // Factory full reset factory_reset(0); - } + +//-// +/* + } else if(code_seen("qqq")) { +MYSERIAL.println("=== checking ==="); +MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODE),DEC); +MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER),DEC); +MYSERIAL.println(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM),DEC); +MYSERIAL.println(farm_mode,DEC); +MYSERIAL.println(eCheckMode,DEC); + } else if(code_seen("www")) { +MYSERIAL.println("=== @ FF ==="); +eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,0xFF); +eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,0xFF); +eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF); +*/ + } else if (code_seen("nozzle")) { //! PRUSA nozzle + uint16_t nDiameter; + if(code_seen('D')) + { + nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um] + nozzle_diameter_check(nDiameter); + } + else if(code_seen("set") && farm_mode) + { + strchr_pointer++; // skip 2nd char (~ 'e') + strchr_pointer++; // skip 3rd char (~ 't') + nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um] + eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)e_NOZZLE_DIAMETER_NULL); // for correct synchronization after farm-mode exiting + eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); + } + else SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0); + } //else if (code_seen('Cal')) { // lcd_calibration(); // } @@ -4854,6 +4885,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no); SilentModeMenu = SILENT_MODE_OFF; eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu); + fCheckModeInit(); // alternatively invoke printer reset break; case 99: //! G99 (deactivate farm mode) @@ -4861,6 +4893,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) lcd_printer_connected(); eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode); lcd_update(2); + fCheckModeInit(); // alternatively invoke printer reset break; default: printf_P(PSTR("Unknown G code: %s \n"), cmdbuffer + bufindr + CMDHDRSIZE); diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index a9274d4a4..9927ea3b2 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -156,6 +156,10 @@ #define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1) #define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_CUTTER_ENABLED - 12*12*2) //allow 12 calibration points for future expansion +#define EEPROM_CHECK_MODE (EEPROM_UVLO_MESH_BED_LEVELING_FULL-1) // uint8 +#define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 +#define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 + // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6bd946428..92370dbb0 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5350,6 +5350,101 @@ do\ }\ while (0) +//-// +static void lcd_check_mode_set(void) +{ +switch(eCheckMode) + { + case e_CHECK_MODE_none: + eCheckMode=e_CHECK_MODE_warn; + break; + case e_CHECK_MODE_warn: + eCheckMode=e_CHECK_MODE_strict; + break; + case e_CHECK_MODE_strict: + eCheckMode=e_CHECK_MODE_none; + break; + default: + eCheckMode=e_CHECK_MODE_none; + } +eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)eCheckMode); +} + +static void lcd_nozzle_diameter_set(void) +{ +uint16_t nDiameter; + +switch(eNozzleDiameter) + { + case e_NOZZLE_DIAMETER_250: + eNozzleDiameter=e_NOZZLE_DIAMETER_400; + nDiameter=400; + break; + case e_NOZZLE_DIAMETER_400: + eNozzleDiameter=e_NOZZLE_DIAMETER_600; + nDiameter=600; + break; + case e_NOZZLE_DIAMETER_600: + eNozzleDiameter=e_NOZZLE_DIAMETER_250; + nDiameter=250; + break; + default: + eNozzleDiameter=e_NOZZLE_DIAMETER_400; + nDiameter=400; + } +eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)eNozzleDiameter); +eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); +} + +#define SETTINGS_MODE \ +do\ +{\ + switch(eCheckMode)\ + {\ + case e_CHECK_MODE_none:\ + MENU_ITEM_FUNCTION_P(_i("Action [none]"),lcd_check_mode_set);\ + break;\ + case e_CHECK_MODE_warn:\ + MENU_ITEM_FUNCTION_P(_i("Action [warn]"),lcd_check_mode_set);\ + break;\ + case e_CHECK_MODE_strict:\ + MENU_ITEM_FUNCTION_P(_i("Action [strict]"),lcd_check_mode_set);\ + break;\ + default:\ + MENU_ITEM_FUNCTION_P(_i("Action [none]"),lcd_check_mode_set);\ + }\ +}\ +while (0) + +#define SETTINGS_NOZZLE \ +do\ +{\ + switch(eNozzleDiameter)\ + {\ + case e_NOZZLE_DIAMETER_250:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle [0.25]"),lcd_nozzle_diameter_set);\ + break;\ + case e_NOZZLE_DIAMETER_400:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle [0.40]"),lcd_nozzle_diameter_set);\ + break;\ + case e_NOZZLE_DIAMETER_600:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle [0.60]"),lcd_nozzle_diameter_set);\ + break;\ + default:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle [0.40]"),lcd_nozzle_diameter_set);\ + }\ +}\ +while (0) + +static void lcd_checking_menu() +{ +MENU_BEGIN(); +MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); +SETTINGS_MODE; +SETTINGS_NOZZLE; +MENU_END(); +} + static void lcd_settings_menu() { EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu)); @@ -5398,6 +5493,9 @@ static void lcd_settings_menu() MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT c=0 r=0 #endif //(LANG_MODE != 0) + if (!farm_mode) + MENU_ITEM_SUBMENU_P(_i("Print checking"), lcd_checking_menu); + SETTINGS_SD; SETTINGS_SOUND; @@ -6660,6 +6758,12 @@ static void lcd_sd_updir() void lcd_print_stop() { +//-// + if(!card.sdprinting) + { + SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint + return; + } saved_printing = false; cancel_heatup = true; #ifdef MESH_BED_LEVELING diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index b7f65d9a5..668c9103d 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -138,14 +138,14 @@ void extr_unload(); typedef enum { - e_FILAMENT_ACTION_none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) + e_FILAMENT_ACTION_none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) e_FILAMENT_ACTION_Load, e_FILAMENT_ACTION_autoLoad, e_FILAMENT_ACTION_unLoad, e_FILAMENT_ACTION_mmuLoad, e_FILAMENT_ACTION_mmuUnLoad, e_FILAMENT_ACTION_mmuEject, - e_FILAMENT_ACTION_mmuCut, + e_FILAMENT_ACTION_mmuCut } eFILAMENT_ACTION; extern eFILAMENT_ACTION eFilamentAction; extern bool bFilamentFirstRun; diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 2499b513f..a493ba914 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -327,3 +327,46 @@ void update_current_firmware_version_to_eeprom() eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR, ver_current[3]); } } + + +//-// +eNOZZLE_DIAMETER eNozzleDiameter=e_NOZZLE_DIAMETER_400; +eCHECK_MODE eCheckMode=e_CHECK_MODE_none; + +void fCheckModeInit() +{ +eCheckMode=(eCHECK_MODE)eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODE); +if(eCheckMode==e_CHECK_MODE_NULL) + { + eCheckMode=e_CHECK_MODE_warn; + eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)eCheckMode); + } +if(farm_mode) + eCheckMode=e_CHECK_MODE_strict; +eNozzleDiameter=(eNOZZLE_DIAMETER)eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER); +if((eNozzleDiameter==e_NOZZLE_DIAMETER_NULL)&& !farm_mode) + { + eNozzleDiameter=e_NOZZLE_DIAMETER_400; + eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)eNozzleDiameter); + eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,400); + } +} + +void nozzle_diameter_check(uint16_t nDiameter) +{ +uint16_t nDiameter_um; + +nDiameter_um=eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM); +if(nDiameter==nDiameter_um) + return; +switch(eCheckMode) + { + case e_CHECK_MODE_warn: + lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Press the knob to continue.")); + break; + case e_CHECK_MODE_strict: + lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Print is aborted, press the knob.")); + lcd_print_stop(); + break; + } +} diff --git a/Firmware/util.h b/Firmware/util.h index 7cbcb027b..d3b7e7d16 100644 --- a/Firmware/util.h +++ b/Firmware/util.h @@ -33,4 +33,29 @@ inline void eeprom_update_int8(unsigned char* addr, int8_t v) { eeprom_update_byte(addr, *reinterpret_cast(&v)); } + +//-// +#define e_CHECK_MODE_NULL 0xFF +#define e_NOZZLE_DIAMETER_NULL 0xFF + +typedef enum +{ + e_NOZZLE_DIAMETER_250, + e_NOZZLE_DIAMETER_400, + e_NOZZLE_DIAMETER_600 +} eNOZZLE_DIAMETER; + +typedef enum +{ + e_CHECK_MODE_none, + e_CHECK_MODE_warn, + e_CHECK_MODE_strict +} eCHECK_MODE; + +extern eNOZZLE_DIAMETER eNozzleDiameter; +extern eCHECK_MODE eCheckMode; + +void fCheckModeInit(); +void nozzle_diameter_check(uint16_t nDiameter); + #endif /* UTIL_H */ From 9e0e4198c5b2f9f30df4cba839d020793699dcdc Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 14 Mar 2019 01:52:44 +0100 Subject: [PATCH 112/368] Mesh by 3d-gussner, fixed difference between mbl points coordinates and coordinates used in planner for corrections, mbl settings menu update --- Firmware/Marlin_main.cpp | 2 +- Firmware/mesh_bed_calibration.cpp | 14 +++++++------- Firmware/mesh_bed_calibration.h | 8 ++++---- Firmware/ultralcd.cpp | 10 +++++----- Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 6 +++--- Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 6 +++--- .../variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 6 +++--- .../variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 6 +++--- Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 6 +++--- Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 6 +++--- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 140c680b3..437af16fe 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4496,7 +4496,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) current_position[X_AXIS] = BED_X(ix, nMeasPoints); current_position[Y_AXIS] = BED_Y(iy, nMeasPoints); - + //printf_P(PSTR("[%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); #ifdef SUPPORT_VERBOSITY diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index e50fb435e..acbe34081 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -978,7 +978,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i update_current_position_z(); //printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS])); if (abs(current_position[Z_AXIS] - z_bckp) < 0.025) { - printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); + //printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); current_position[Z_AXIS] += 0.5; go_to_current(homing_feedrate[Z_AXIS]/60); current_position[Z_AXIS] = minimum_z; @@ -999,7 +999,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i // SERIAL_ECHOLNPGM(""); float dz = i?abs(current_position[Z_AXIS] - (z / i)):0; z += current_position[Z_AXIS]; - printf_P(PSTR("Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000)); + //printf_P(PSTR("Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000)); if (dz > 0.05) goto error;//deviation > 50um } current_position[Z_AXIS] = z; @@ -3107,13 +3107,13 @@ bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bo uint8_t valid_points_mask[7] = { //[X_MAX,Y_MAX] - 0b1111101, - 0b1110111, 0b1111111, - 0b0111011, - 0b1110111, 0b1111111, 0b1110111, + 0b1111011, + 0b1110111, + 0b1111111, + 0b1111111, //[0,0] }; if (meas_points == 3) { @@ -3130,7 +3130,7 @@ bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bo } void mbl_single_point_interpolation(uint8_t x, uint8_t y, uint8_t meas_points) { - printf_P(PSTR("x = %d; y = %d \n"), x, y); + //printf_P(PSTR("x = %d; y = %d \n"), x, y); uint8_t count = 0; float z = 0; if (mbl_point_measurement_valid(x, y + 1, meas_points, false)) { z += mbl.z_values[y + 1][x]; /*printf_P(PSTR("x; y+1: Z = %f \n"), mbl.z_values[y + 1][x]);*/ count++; } diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index 954db9c30..8adc1c119 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -6,10 +6,10 @@ #ifdef HEATBED_V2 -#define BED_X0 (3.f - BED_ZERO_REF_X) -#define BED_Y0 (10.4f - BED_ZERO_REF_Y) -#define BED_Xn (206.f - BED_ZERO_REF_X) -#define BED_Yn (202.4f - BED_ZERO_REF_Y) +#define BED_X0 (2.f - BED_ZERO_REF_X) //1 +#define BED_Y0 (9.4f - BED_ZERO_REF_Y) //1 +#define BED_Xn (206.f - BED_ZERO_REF_X) //205 +#define BED_Yn (213.4f - BED_ZERO_REF_Y) //205 #else diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 655b15907..d907e2c7d 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6687,14 +6687,14 @@ static void lcd_mesh_bed_leveling_settings() eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, (uint8_t)mbl_z_probe_nr); } MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); - if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); - else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); + if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); + else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); MENU_ITEM_EDIT_int3_P(_i("Z-probe nr."), &mbl_z_probe_nr, 1, 5); if (points_nr == 7) { - if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets eli [On]"), mbl_magnets_elimination_set); - else MENU_ITEM_FUNCTION_P(_i("Magnets comp. [Off]"), mbl_magnets_elimination_set); + if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_set); + else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_set); } - else menu_item_text_P(_i("Magnets comp. [N/A]")); + else menu_item_text_P(_i("Magnets comp.[N/A]")); MENU_END(); /*if(menu_leaving) { diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index 424d2a7e1..a6ca8c61e 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -290,10 +290,10 @@ #define MBL_Z_STEP 0.01 // Mesh definitions -#define MESH_MIN_X 35 -#define MESH_MAX_X 238 +#define MESH_MIN_X 24 +#define MESH_MAX_X 228 #define MESH_MIN_Y 6 -#define MESH_MAX_Y 202 +#define MESH_MAX_Y 210 // Mesh upsample definition #define MESH_NUM_X_POINTS 7 diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 0912748af..4cd2e9777 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -291,10 +291,10 @@ #define MBL_Z_STEP 0.01 // Mesh definitions -#define MESH_MIN_X 35 -#define MESH_MAX_X 238 +#define MESH_MIN_X 24 +#define MESH_MAX_X 228 #define MESH_MIN_Y 6 -#define MESH_MAX_Y 202 +#define MESH_MAX_Y 210 // Mesh upsample definition #define MESH_NUM_X_POINTS 7 diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index c02868c9f..603274eb8 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -290,10 +290,10 @@ #define MBL_Z_STEP 0.01 // Mesh definitions -#define MESH_MIN_X 35 -#define MESH_MAX_X 238 +#define MESH_MIN_X 24 +#define MESH_MAX_X 228 #define MESH_MIN_Y 6 -#define MESH_MAX_Y 202 +#define MESH_MAX_Y 210 // Mesh upsample definition #define MESH_NUM_X_POINTS 7 diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 008f1b178..a45d23c21 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -291,10 +291,10 @@ #define MBL_Z_STEP 0.01 // Mesh definitions -#define MESH_MIN_X 35 -#define MESH_MAX_X 238 +#define MESH_MIN_X 24 +#define MESH_MAX_X 228 #define MESH_MIN_Y 6 -#define MESH_MAX_Y 202 +#define MESH_MAX_Y 210 // Mesh upsample definition #define MESH_NUM_X_POINTS 7 diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index baebd0ecb..d3e168550 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -400,10 +400,10 @@ #define MBL_Z_STEP 0.01 // Mesh definitions -#define MESH_MIN_X 35 -#define MESH_MAX_X 238 +#define MESH_MIN_X 24 +#define MESH_MAX_X 228 #define MESH_MIN_Y 6 -#define MESH_MAX_Y 202 +#define MESH_MAX_Y 210 // Mesh upsample definition #define MESH_NUM_X_POINTS 7 diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index a99d38f71..fed7863bf 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -400,10 +400,10 @@ #define MBL_Z_STEP 0.01 // Mesh definitions -#define MESH_MIN_X 35 -#define MESH_MAX_X 238 +#define MESH_MIN_X 24 +#define MESH_MAX_X 228 #define MESH_MIN_Y 6 -#define MESH_MAX_Y 202 +#define MESH_MAX_Y 210 // Mesh upsample definition #define MESH_NUM_X_POINTS 7 From ef198856a470e471d81d90958291098e84045cea Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 14 Mar 2019 14:10:52 +0100 Subject: [PATCH 113/368] increase relative movement in Z to work better with higher hysteresis PINDAs --- Firmware/mesh_bed_calibration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index acbe34081..0aca64a5f 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -968,7 +968,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i for (uint8_t i = 0; i < n_iter; ++ i) { - current_position[Z_AXIS] += 0.15; + current_position[Z_AXIS] += 0.2; float z_bckp = current_position[Z_AXIS]; go_to_current(homing_feedrate[Z_AXIS]/60); // Move back down slowly to find bed. From 6e26f61726330051cf122f8b5ac03145fa0507c8 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 14 Mar 2019 14:48:01 +0100 Subject: [PATCH 114/368] fixed 7x7 mesh bed leveling vs. Z calibration check --- Firmware/Marlin_main.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 437af16fe..7be151f9f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4472,16 +4472,17 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } float z0 = 0.f; if (has_z && (mesh_point > 0)) { - uint16_t z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1))); + uint16_t z_offset_u = 0; + if (nMeasPoints == 7) { + z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * ((ix/3) + iy - 1))); + } + else { + z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1))); + } z0 = mbl.z_values[0][0] + *reinterpret_cast(&z_offset_u) * 0.01; #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 1) { - SERIAL_ECHOLNPGM(""); - SERIAL_ECHOPGM("Bed leveling, point: "); - MYSERIAL.print(mesh_point); - SERIAL_ECHOPGM(", calibration z: "); - MYSERIAL.print(z0, 5); - SERIAL_ECHOLNPGM(""); + printf_P(PSTR("Bed leveling, point: %d, calibration Z stored in eeprom: %d, calibration z: %f \n"), mesh_point, z_offset_u, z0); } #endif // SUPPORT_VERBOSITY } From 80ef2686aec783b378db5771caf6b3377e0b3573 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 14 Mar 2019 18:17:40 +0100 Subject: [PATCH 115/368] mmu mode switching fix --- Firmware/mmu.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 087753a6b..f82ea05af 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -339,7 +339,6 @@ void mmu_loop(void) else if ((eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH) != SilentModeMenu_MMU) && mmu_ready) { DEBUG_PRINTF_P(PSTR("MMU <= 'M%d'\n"), SilentModeMenu_MMU); mmu_printf_P(PSTR("M%d\n"), SilentModeMenu_MMU); - mmu_ready = false; mmu_state = S::SwitchMode; } else if ((mmu_last_response + 300) < _millis()) //request every 300ms @@ -466,7 +465,6 @@ void mmu_loop(void) { DEBUG_PRINTF_P(PSTR("MMU => 'ok'\n")); eeprom_update_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU); - mmu_ready = true; mmu_state = S::Idle; } else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis()) From ffe45bdef33a4a16d06fa5e5a966218eb3f2755b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 15 Mar 2019 03:38:37 +0100 Subject: [PATCH 116/368] Disable mmu filament cutter feature. --- Firmware/mmu.cpp | 36 ++++++++++--------- Firmware/mmu.h | 2 ++ Firmware/ultralcd.cpp | 16 ++++++++- .../variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 1 + .../variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 1 + .../1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 1 + .../1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 1 + .../variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 1 + .../variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 1 + 9 files changed, 43 insertions(+), 17 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 65c73ca3d..8cdfc6c64 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1365,25 +1365,27 @@ bFilamentAction=false; // NOT in "mmu_load_to_nozzle_ } } +#ifdef MMU_HAS_CUTTER void mmu_cut_filament(uint8_t filament_nr) { -bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()" - if (degHotend0() > EXTRUDE_MINTEMP) - { - LcdUpdateDisabler disableLcdUpdate; - lcd_clear(); - lcd_set_cursor(0, 1); lcd_puts_P(_i("Cutting filament")); //// c=18 r=1 - lcd_print(" "); - lcd_print(filament_nr + 1); - mmu_filament_ramming(); - mmu_command(MmuCmd::K0 + filament_nr); - manage_response(false, false, MMU_UNLOAD_MOVE); - } - else - { - show_preheat_nozzle_warning(); - } + bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()" + if (degHotend0() > EXTRUDE_MINTEMP) + { + LcdUpdateDisabler disableLcdUpdate; + lcd_clear(); + lcd_set_cursor(0, 1); lcd_puts_P(_i("Cutting filament")); //// c=18 r=1 + lcd_print(" "); + lcd_print(filament_nr + 1); + mmu_filament_ramming(); + mmu_command(MmuCmd::K0 + filament_nr); + manage_response(false, false, MMU_UNLOAD_MOVE); + } + else + { + show_preheat_nozzle_warning(); + } } +#endif //MMU_HAS_CUTTER void mmu_eject_filament(uint8_t filament, bool recover) { @@ -1457,11 +1459,13 @@ void mmu_continue_loading() if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1); if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1); +#ifdef MMU_HAS_CUTTER if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) { mmu_command(MmuCmd::K0 + tmp_extruder); manage_response(true, true, MMU_UNLOAD_MOVE); } +#endif //MMU_HAS_CUTTER mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); diff --git a/Firmware/mmu.h b/Firmware/mmu.h index c2e8b7139..9c233d05f 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -132,7 +132,9 @@ extern bool mmu_check_version(); extern void mmu_show_warning(); extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr); extern void mmu_eject_filament(uint8_t filament, bool recover); +#ifdef MMU_HAS_CUTTER extern void mmu_cut_filament(uint8_t filament_nr); +#endif //MMU_HAS_CUTTER extern void mmu_continue_loading(); extern void mmu_filament_ramming(); extern void mmu_wait_for_heater_blocking(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6bd946428..15ca11218 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -142,7 +142,9 @@ static void lcd_menu_fails_stats_mmu_total(); static void mmu_fil_eject_menu(); static void mmu_load_to_nozzle_menu(); +#ifdef MMU_HAS_CUTTER static void mmu_cut_filament_menu(); +#endif //MMU_HAS_CUTTER #if defined(TMC2130) || defined(FILAMENT_SENSOR) static void lcd_menu_fails_stats(); @@ -2295,6 +2297,7 @@ void lcd_set_fan_check() { eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED, fans_check_enabled); } +#ifdef MMU_HAS_CUTTER void lcd_cutter_enabled() { if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) @@ -2306,6 +2309,7 @@ void lcd_cutter_enabled() eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 1); } } +#endif //MMU_HAS_CUTTER void lcd_set_filament_autoload() { fsensor_autoload_set(!fsensor_autoload_enabled); @@ -2536,10 +2540,12 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) menu_submenu(mmu_fil_eject_menu); break; case e_FILAMENT_ACTION_mmuCut: +#ifdef MMU_HAS_CUTTER nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); menu_submenu(mmu_cut_filament_menu); +#endif //MMU_HAS_CUTTER break; case e_FILAMENT_ACTION_none: break; @@ -5220,6 +5226,7 @@ do\ }\ while(0)\ +#ifdef MMU_HAS_CUTTER static bool settingsCutter() { if (mmu_enabled) @@ -5241,7 +5248,10 @@ do\ {\ if(settingsCutter()) return;\ }\ -while(0)\ +while(0) +#else +#define SETTINGS_CUTTER +#endif //MMU_HAS_CUTTER #ifdef TMC2130 #define SETTINGS_SILENT_MODE \ @@ -5919,6 +5929,7 @@ static void mmu_fil_eject_menu() } } +#ifdef MMU_HAS_CUTTER template static void mmu_cut_filament() { @@ -5950,6 +5961,7 @@ else { else mFilamentMenu(); } } +#endif //MMU_HAS_CUTTER #ifdef SNMM static void fil_unload_menu() @@ -6423,7 +6435,9 @@ static void lcd_main_menu() //bFilamentFirstRun=true; MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload_); MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); +#ifdef MMU_HAS_CUTTER MENU_ITEM_SUBMENU_P(_i("Cut filament"), mmu_cut_filament_menu); +#endif //MMU_HAS_CUTTER } else { diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index 40a3a229b..18007e066 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -500,6 +500,7 @@ #define MMU_REQUIRED_FW_BUILDNR 132 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial +//#define MMU_HAS_CUTTER #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index e316c4f02..b79147ae4 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -501,6 +501,7 @@ #define MMU_REQUIRED_FW_BUILDNR 132 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial +//#define MMU_HAS_CUTTER #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index d3badf6aa..196cba007 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -500,6 +500,7 @@ #define MMU_REQUIRED_FW_BUILDNR 132 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial +//#define MMU_HAS_CUTTER #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 2563f848a..68310625b 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -501,6 +501,7 @@ #define MMU_REQUIRED_FW_BUILDNR 132 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial +//#define MMU_HAS_CUTTER #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index c400b016f..04b732230 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -626,6 +626,7 @@ #define MMU_REQUIRED_FW_BUILDNR 83 #define MMU_HWRESET #define MMU_DEBUG //print communication between MMU2 and printer on serial +//#define MMU_HAS_CUTTER #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning #endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 37512071c..edac6c0ec 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -626,6 +626,7 @@ #define MMU_REQUIRED_FW_BUILDNR 83 #define MMU_HWRESET #define MMU_DEBUG //print communication between MMU2 and printer on serial +//#define MMU_HAS_CUTTER #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning #endif //__CONFIGURATION_PRUSA_H From 0ca52216f3d0c8e94b831addb1f4118bef23dec5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 15 Mar 2019 13:14:32 +0100 Subject: [PATCH 117/368] Revert "variants update" This reverts commit c3a95ab79baa4dfebd346fb7f99308b0affc39f5. --- Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index a036a11a6..3b9f76987 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -438,7 +438,7 @@ THERMISTORS SETTINGS #define M600_TIMEOUT 600 //seconds -#define MMU_REQUIRED_FW_BUILDNR 310 +#define MMU_REQUIRED_FW_BUILDNR 132 #ifndef SNMM //#define SUPPORT_VERBOSITY diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index d2ada705a..2d00929f3 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -438,7 +438,7 @@ THERMISTORS SETTINGS #define M600_TIMEOUT 600 //seconds -#define MMU_REQUIRED_FW_BUILDNR 310 +#define MMU_REQUIRED_FW_BUILDNR 132 #ifndef SNMM //#define SUPPORT_VERBOSITY diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index a6ca8c61e..63d03dfe6 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -497,7 +497,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 310 +#define MMU_REQUIRED_FW_BUILDNR 132 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 4cd2e9777..262ec865e 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -498,7 +498,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 310 +#define MMU_REQUIRED_FW_BUILDNR 132 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index 603274eb8..bf91b7322 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -497,7 +497,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 310 +#define MMU_REQUIRED_FW_BUILDNR 132 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index a45d23c21..ff7e1f588 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -498,7 +498,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 310 +#define MMU_REQUIRED_FW_BUILDNR 132 #define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index d3e168550..4a430d7dc 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -623,7 +623,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 310 +#define MMU_REQUIRED_FW_BUILDNR 83 #define MMU_HWRESET #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index fed7863bf..9ddb71e58 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -623,7 +623,7 @@ //#define SUPPORT_VERBOSITY -#define MMU_REQUIRED_FW_BUILDNR 310 +#define MMU_REQUIRED_FW_BUILDNR 83 #define MMU_HWRESET #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning From 7c5e9500a8ed69f5f459856c1c517848d4f27a4f Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 15 Mar 2019 20:00:07 +0100 Subject: [PATCH 118/368] version change --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index a64e90a14..b20db88ce 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.6.0" -#define FW_COMMIT_NR 2069 +#define FW_VERSION "3.7.0" +#define FW_COMMIT_NR 2174 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From e37c2e0b2e4dad710660a75374a4be92124284d5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 15 Mar 2019 20:01:02 +0100 Subject: [PATCH 119/368] version change --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index b20db88ce..e086a16c8 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.7.0" -#define FW_COMMIT_NR 2174 +#define FW_VERSION "3.7.0-RC1" +#define FW_COMMIT_NR 2175 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From 4100bd33a798c6b805b740967a1a2129d24b9697 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 19 Mar 2019 13:53:58 +0100 Subject: [PATCH 120/368] Fix Dcodes compilation errors and warnings. --- Firmware/Dcodes.cpp | 24 ++++++++++++------------ Firmware/Marlin_main.cpp | 2 +- Firmware/temperature.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Firmware/Dcodes.cpp b/Firmware/Dcodes.cpp index a21e32200..44dfc4654 100644 --- a/Firmware/Dcodes.cpp +++ b/Firmware/Dcodes.cpp @@ -5,6 +5,9 @@ #include #include +#define SHOW_TEMP_ADC_VALUES +#include "temperature.h" + #define DBG(args...) printf_P(args) @@ -150,7 +153,7 @@ void dcode_3() #include #include "bootapp.h" -/* +#if 0 #define FLASHSIZE 0x40000 #define RAMSIZE 0x2000 @@ -169,9 +172,10 @@ extern float current_temperature_pinda; extern float axis_steps_per_unit[NUM_AXIS]; -//#define LOG(args...) printf(args) +#define LOG(args...) printf(args) +#endif //0 #define LOG(args...) -*/ + #ifdef DEBUG_DCODES void dcode__1() @@ -227,7 +231,7 @@ void dcode_2() count = parse_hex(strchr_pointer + 1, data, 16); if (count > 0) { - for (int i = 0; i < count; i++) + for (uint16_t i = 0; i < count; i++) *((uint8_t*)(address + i)) = data[i]; LOG("%d bytes written to RAM at address %04x", count, address); } @@ -380,7 +384,7 @@ void dcode_8() { uint16_t offs = 0; if (i > 0) offs = eeprom_read_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + (i - 1)); - float foffs = ((float)offs) / axis_steps_per_unit[Z_AXIS]; + float foffs = ((float)offs) / cs.axis_steps_per_unit[Z_AXIS]; offs = 1000 * foffs; printf_P(PSTR("temp_pinda=%dC temp_shift=%dum\n"), 35 + i * 5, offs); } @@ -423,10 +427,6 @@ const char* dcode_9_ADC_name(uint8_t i) return 0; } -extern int current_temperature_raw[EXTRUDERS]; -extern int current_temperature_bed_raw; -extern int current_temperature_raw_pinda; - #ifdef AMBIENT_THERMISTOR extern int current_temperature_raw_ambient; #endif //AMBIENT_THERMISTOR @@ -606,16 +606,16 @@ void dcode_2130() else if (strncmp(strchr_pointer + 7, "mres", 4) == 0) { uint8_t mres = strchr_pointer[11] - '0'; - if ((mres >= 0) && (mres <= 8)) + if (mres <= 8) { st_synchronize(); uint16_t res = tmc2130_get_res(axis); uint16_t res_new = tmc2130_mres2usteps(mres); tmc2130_set_res(axis, res_new); if (res_new > res) - axis_steps_per_unit[axis] *= (res_new / res); + cs.axis_steps_per_unit[axis] *= (res_new / res); else - axis_steps_per_unit[axis] /= (res / res_new); + cs.axis_steps_per_unit[axis] /= (res / res_new); } } else if (strncmp(strchr_pointer + 7, "wave", 4) == 0) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7be151f9f..669008bd6 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7251,7 +7251,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) dcode_2130(); break; #endif //TMC2130 -#ifdef FILAMENT_SENSOR +#if (defined (FILAMENT_SENSOR) && defined(PAT9125)) case 9125: //! D9125 - FILAMENT_SENSOR dcode_9125(); break; #endif //FILAMENT_SENSOR diff --git a/Firmware/temperature.h b/Firmware/temperature.h index daee5c080..ba9632cf6 100644 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -57,7 +57,7 @@ extern int target_temperature_bed; extern float current_temperature_bed; #ifdef PINDA_THERMISTOR -//extern int current_temperature_raw_pinda; +extern uint16_t current_temperature_raw_pinda; extern float current_temperature_pinda; #endif From cfd185f31598136958ad0ffe4b6a6d3ce2e25bb5 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 19 Mar 2019 14:50:57 +0100 Subject: [PATCH 121/368] Phase correct PWM for bed, frequency 40KHz. --- Firmware/timer02.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/Firmware/timer02.c b/Firmware/timer02.c index 8309f9401..113c72463 100644 --- a/Firmware/timer02.c +++ b/Firmware/timer02.c @@ -11,19 +11,11 @@ uint8_t timer02_pwm0 = 0; + void timer02_set_pwm0(uint8_t pwm0) { - if (timer02_pwm0 == pwm0) return; - if (pwm0) - { - TCCR0A |= (2 << COM0B0); - OCR0B = pwm0 - 1; - } - else - { - TCCR0A &= ~(2 << COM0B0); - OCR0B = 0; - } + TCCR0A |= (2 << COM0B0); //switch OC0B to OCR mode + OCR0B = (uint16_t)OCR0A * pwm0 / 255; timer02_pwm0 = pwm0; } @@ -39,13 +31,12 @@ void timer02_init(void) TIMSK0 &= ~(1< Date: Tue, 19 Mar 2019 19:48:40 +0100 Subject: [PATCH 122/368] farmMode updates --- Firmware/Marlin.h | 3 +++ Firmware/Marlin_main.cpp | 5 ++++- Firmware/ultralcd.cpp | 14 +++++++++++--- Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 3 ++- .../variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 3 ++- .../variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 3 ++- 11 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 83e587d98..d45c68702 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -213,6 +213,9 @@ void manage_inactivity(bool ignore_stepper_queue=false); #endif +#define FARM_FILAMENT_COLOR_NONE 99; + + enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5}; #define X_AXIS_MASK 1 #define Y_AXIS_MASK 2 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index bf967812d..e5c48cd56 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1039,6 +1039,9 @@ void setup() //disabled filament autoload (PFW360) fsensor_autoload_set(false); #endif //FILAMENT_SENSOR + // ~ FanCheck -> on + if(!(eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED))) + eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED,true); } MYSERIAL.begin(BAUDRATE); fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream @@ -7537,7 +7540,7 @@ static void handleSafetyTimer() { safetyTimer.start(); } - else if (safetyTimer.expired(safetytimer_inactive_time)) + else if (safetyTimer.expired(farm_mode?FARM_DEFAULT_SAFETYTIMER_TIME_ms:safetytimer_inactive_time)) { setTargetBed(0); setAllTargetHotends(0); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 92370dbb0..22e68aa2a 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2167,7 +2167,6 @@ static void lcd_preheat_menu() MENU_ITEM_FUNCTION_P(PSTR("farm - " STRINGIFY(FARM_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(FARM_PREHEAT_HPB_TEMP)), lcd_preheat_farm); MENU_ITEM_FUNCTION_P(PSTR("nozzle - " STRINGIFY(FARM_PREHEAT_HOTEND_TEMP) "/0"), lcd_preheat_farm_nozzle); MENU_ITEM_FUNCTION_P(_T(MSG_COOLDOWN), lcd_cooldown); - MENU_ITEM_FUNCTION_P(PSTR("ABS - " STRINGIFY(ABS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(ABS_PREHEAT_HPB_TEMP)), lcd_preheat_abs); } else { MENU_ITEM_FUNCTION_P(PSTR("PLA - " STRINGIFY(PLA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PLA_PREHEAT_HPB_TEMP)), lcd_preheat_pla); MENU_ITEM_FUNCTION_P(PSTR("PET - " STRINGIFY(PET_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PET_PREHEAT_HPB_TEMP)), lcd_preheat_pet); @@ -6317,10 +6316,11 @@ void lcd_confirm_print() } if (lcd_clicked()) { + filament_type = FARM_FILAMENT_COLOR_NONE; if (cursor_pos == 1) { _ret = 1; - filament_type = lcd_choose_color(); +// filament_type = lcd_choose_color(); prusa_statistics(4, filament_type); no_response = true; //we need confirmation by recieving PRUSA thx important_status = 4; @@ -6330,7 +6330,7 @@ void lcd_confirm_print() if (cursor_pos == 2) { _ret = 2; - filament_type = lcd_choose_color(); +// filament_type = lcd_choose_color(); prusa_statistics(5, filament_type); no_response = true; //we need confirmation by recieving PRUSA thx important_status = 5; @@ -6663,6 +6663,14 @@ static void lcd_tune_menu() SETTINGS_CUTTER; + if(farm_mode) + { + if (fans_check_enabled == true) + MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1 + else + MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1 + } + #ifdef TMC2130 if(!farm_mode) { diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 3b9f76987..e9449a6fb 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -312,7 +312,7 @@ PREHEAT SETTINGS *------------------------------------*/ #define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_HPB_TEMP 80 #define FARM_PREHEAT_FAN_SPEED 0 #define PLA_PREHEAT_HOTEND_TEMP 215 @@ -435,6 +435,7 @@ THERMISTORS SETTINGS // Safety timer #define SAFETYTIMER #define DEFAULT_SAFETYTIMER_TIME_MINS 30 +#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) #define M600_TIMEOUT 600 //seconds diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 2d00929f3..fda7126ef 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -312,7 +312,7 @@ PREHEAT SETTINGS *------------------------------------*/ #define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_HPB_TEMP 80 #define FARM_PREHEAT_FAN_SPEED 0 #define PLA_PREHEAT_HOTEND_TEMP 215 @@ -435,6 +435,7 @@ THERMISTORS SETTINGS // Safety timer #define SAFETYTIMER #define DEFAULT_SAFETYTIMER_TIME_MINS 30 +#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) #define M600_TIMEOUT 600 //seconds diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index 40a3a229b..47cd81dfe 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -109,6 +109,7 @@ // Safety timer #define SAFETYTIMER #define DEFAULT_SAFETYTIMER_TIME_MINS 30 +#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) // Filament sensor #define FILAMENT_SENSOR @@ -368,7 +369,7 @@ *------------------------------------*/ #define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_HPB_TEMP 80 #define FARM_PREHEAT_FAN_SPEED 0 #define PLA_PREHEAT_HOTEND_TEMP 215 diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index e316c4f02..fef1dfae3 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -110,6 +110,7 @@ // Safety timer #define SAFETYTIMER #define DEFAULT_SAFETYTIMER_TIME_MINS 30 +#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) // Filament sensor #define FILAMENT_SENSOR @@ -369,7 +370,7 @@ *------------------------------------*/ #define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_HPB_TEMP 80 #define FARM_PREHEAT_FAN_SPEED 0 #define PLA_PREHEAT_HOTEND_TEMP 215 diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index d3badf6aa..0f8f89bab 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -109,6 +109,7 @@ // Safety timer #define SAFETYTIMER #define DEFAULT_SAFETYTIMER_TIME_MINS 30 +#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) // Filament sensor #define FILAMENT_SENSOR @@ -368,7 +369,7 @@ *------------------------------------*/ #define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_HPB_TEMP 80 #define FARM_PREHEAT_FAN_SPEED 0 #define PLA_PREHEAT_HOTEND_TEMP 215 diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 2563f848a..46ad5aa0a 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -110,6 +110,7 @@ // Safety timer #define SAFETYTIMER #define DEFAULT_SAFETYTIMER_TIME_MINS 30 +#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) // Filament sensor #define FILAMENT_SENSOR @@ -369,7 +370,7 @@ *------------------------------------*/ #define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_HPB_TEMP 80 #define FARM_PREHEAT_FAN_SPEED 0 #define PLA_PREHEAT_HOTEND_TEMP 215 diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index c400b016f..aca735e89 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -131,6 +131,7 @@ // Safety timer #define SAFETYTIMER #define DEFAULT_SAFETYTIMER_TIME_MINS 30 +#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) // Filament sensor #define FILAMENT_SENSOR @@ -480,7 +481,7 @@ *------------------------------------*/ #define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 60 +#define FARM_PREHEAT_HPB_TEMP 80 #define FARM_PREHEAT_FAN_SPEED 0 #define PLA_PREHEAT_HOTEND_TEMP 215 diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 37512071c..5ca0c0b84 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -131,6 +131,7 @@ // Safety timer #define SAFETYTIMER #define DEFAULT_SAFETYTIMER_TIME_MINS 30 +#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) // Filament sensor #define FILAMENT_SENSOR @@ -480,7 +481,7 @@ *------------------------------------*/ #define FARM_PREHEAT_HOTEND_TEMP 250 -#define FARM_PREHEAT_HPB_TEMP 60 +#define FARM_PREHEAT_HPB_TEMP 80 #define FARM_PREHEAT_FAN_SPEED 0 #define PLA_PREHEAT_HOTEND_TEMP 215 From 0f21ccee3c776b66b5a753371df3905f1d92571d Mon Sep 17 00:00:00 2001 From: Harpalyke <33022534+Harpalyke@users.noreply.github.com> Date: Tue, 19 Mar 2019 20:28:31 +0000 Subject: [PATCH 123/368] Adding the microstepping resolution for all axis to the eprom config which is persisted during M500 for Mk3 and Mk3S --- Firmware/ConfigurationStore.cpp | 24 ++++++++++++++++++- Firmware/ConfigurationStore.h | 1 + Firmware/Marlin_main.cpp | 17 ++++--------- .../variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 2 +- 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 39a744305..f2df8fc6c 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -11,6 +11,11 @@ #include "mesh_bed_leveling.h" #endif +#ifdef TMC2130 +#include "tmc2130.h" +#endif + + M500_conf cs; //! @brief Write data to EEPROM @@ -86,6 +91,7 @@ void Config_PrintSettings(uint8_t level) #ifdef TMC2130 printf_P(PSTR( "%SSteps per unit:\n%S M92 X%.2f Y%.2f Z%.2f E%.2f\n" + "%SUStep resolution: \n%S M350 X%d Y%d Z%d E%d\n" "%SMaximum feedrates - normal (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n" "%SMaximum feedrates - stealth (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n" "%SMaximum acceleration - normal (mm/s2):\n%S M201 X%lu Y%lu Z%lu E%lu\n" @@ -95,6 +101,7 @@ void Config_PrintSettings(uint8_t level) "%SHome offset (mm):\n%S M206 X%.2f Y%.2f Z%.2f\n" ), echomagic, echomagic, cs.axis_steps_per_unit[X_AXIS], cs.axis_steps_per_unit[Y_AXIS], cs.axis_steps_per_unit[Z_AXIS], cs.axis_steps_per_unit[E_AXIS], + echomagic, echomagic, cs.axis_ustep_resolution[X_AXIS], cs.axis_ustep_resolution[Y_AXIS], cs.axis_ustep_resolution[Z_AXIS], cs.axis_ustep_resolution[E_AXIS], echomagic, echomagic, cs.max_feedrate_normal[X_AXIS], cs.max_feedrate_normal[Y_AXIS], cs.max_feedrate_normal[Z_AXIS], cs.max_feedrate_normal[E_AXIS], echomagic, echomagic, cs.max_feedrate_silent[X_AXIS], cs.max_feedrate_silent[Y_AXIS], cs.max_feedrate_silent[Z_AXIS], cs.max_feedrate_silent[E_AXIS], echomagic, echomagic, cs.max_acceleration_units_per_sq_second_normal[X_AXIS], cs.max_acceleration_units_per_sq_second_normal[Y_AXIS], cs.max_acceleration_units_per_sq_second_normal[Z_AXIS], cs.max_acceleration_units_per_sq_second_normal[E_AXIS], @@ -177,7 +184,7 @@ static_assert (false, "zprobe_zoffset was not initialized in printers in field t "0.0, if this is not acceptable, increment EEPROM_VERSION to force use default_conf"); #endif -static_assert (sizeof(M500_conf) == 188, "sizeof(M500_conf) has changed, ensure that EEPROM_VERSION has been incremented, " +static_assert (sizeof(M500_conf) == 192, "sizeof(M500_conf) has changed, ensure that EEPROM_VERSION has been incremented, " "or if you added members in the end of struct, ensure that historically uninitialized values will be initialized." "If this is caused by change to more then 8bit processor, decide whether make this struct packed to save EEPROM," "leave as it is to keep fast code, or reorder struct members to pack more tightly."); @@ -220,6 +227,11 @@ static const M500_conf default_conf PROGMEM = }, DEFAULT_MAX_FEEDRATE_SILENT, DEFAULT_MAX_ACCELERATION_SILENT, +#ifdef TMC2130 + { TMC2130_USTEPS_XY, TMC2130_USTEPS_XY, TMC2130_USTEPS_Z, TMC2130_USTEPS_E }, +#else // TMC2130 + {16,16,16,16}, +#endif }; //! @brief Read M500 configuration @@ -269,6 +281,16 @@ bool Config_RetrieveSettings() if (cs.max_acceleration_units_per_sq_second_silent[j] > SILENT_MAX_ACCEL_XY) cs.max_acceleration_units_per_sq_second_silent[j] = SILENT_MAX_ACCEL_XY; } + + if(cs.axis_ustep_resolution[X_AXIS] == 0xff){ cs.axis_ustep_resolution[X_AXIS] = TMC2130_USTEPS_XY; } + if(cs.axis_ustep_resolution[Y_AXIS] == 0xff){ cs.axis_ustep_resolution[Y_AXIS] = TMC2130_USTEPS_XY; } + if(cs.axis_ustep_resolution[Z_AXIS] == 0xff){ cs.axis_ustep_resolution[Z_AXIS] = TMC2130_USTEPS_Z; } + if(cs.axis_ustep_resolution[E_AXIS] == 0xff){ cs.axis_ustep_resolution[E_AXIS] = TMC2130_USTEPS_E; } + + tmc2130_set_res(X_AXIS, cs.axis_ustep_resolution[X_AXIS]); + tmc2130_set_res(Y_AXIS, cs.axis_ustep_resolution[Y_AXIS]); + tmc2130_set_res(Z_AXIS, cs.axis_ustep_resolution[Z_AXIS]); + tmc2130_set_res(E_AXIS, cs.axis_ustep_resolution[E_AXIS]); #endif //TMC2130 reset_acceleration_rates(); diff --git a/Firmware/ConfigurationStore.h b/Firmware/ConfigurationStore.h index aa2013695..b9dca3685 100644 --- a/Firmware/ConfigurationStore.h +++ b/Firmware/ConfigurationStore.h @@ -37,6 +37,7 @@ typedef struct float filament_size[1]; //!< cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder. float max_feedrate_silent[4]; //!< max speeds for silent mode unsigned long max_acceleration_units_per_sq_second_silent[4]; + unsigned char axis_ustep_resolution[4]; } M500_conf; extern M500_conf cs; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7be151f9f..deb601826 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1250,18 +1250,10 @@ void setup() #endif //TMC2130_LINEARITY_CORRECTION #ifdef TMC2130_VARIABLE_RESOLUTION - tmc2130_mres[X_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_X_MRES); - tmc2130_mres[Y_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_Y_MRES); - tmc2130_mres[Z_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_Z_MRES); - tmc2130_mres[E_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_E_MRES); - if (tmc2130_mres[X_AXIS] == 0xff) tmc2130_mres[X_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY); - if (tmc2130_mres[Y_AXIS] == 0xff) tmc2130_mres[Y_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY); - if (tmc2130_mres[Z_AXIS] == 0xff) tmc2130_mres[Z_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_Z); - if (tmc2130_mres[E_AXIS] == 0xff) tmc2130_mres[E_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_E); - eeprom_update_byte((uint8_t*)EEPROM_TMC2130_X_MRES, tmc2130_mres[X_AXIS]); - eeprom_update_byte((uint8_t*)EEPROM_TMC2130_Y_MRES, tmc2130_mres[Y_AXIS]); - eeprom_update_byte((uint8_t*)EEPROM_TMC2130_Z_MRES, tmc2130_mres[Z_AXIS]); - eeprom_update_byte((uint8_t*)EEPROM_TMC2130_E_MRES, tmc2130_mres[E_AXIS]); + tmc2130_mres[X_AXIS] = tmc2130_usteps2mres(cs.axis_ustep_resolution[X_AXIS]); + tmc2130_mres[Y_AXIS] = tmc2130_usteps2mres(cs.axis_ustep_resolution[Y_AXIS]); + tmc2130_mres[Z_AXIS] = tmc2130_usteps2mres(cs.axis_ustep_resolution[Z_AXIS]); + tmc2130_mres[E_AXIS] = tmc2130_usteps2mres(cs.axis_ustep_resolution[E_AXIS]); #else //TMC2130_VARIABLE_RESOLUTION tmc2130_mres[X_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY); tmc2130_mres[Y_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY); @@ -6882,6 +6874,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) uint8_t axis = E_AXIS; uint16_t res = tmc2130_get_res(axis); tmc2130_set_res(axis, res_new); + cs.axis_ustep_resolution[axis] = res_new; if (res_new > res) { uint16_t fac = (res_new / res); diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index 4a1fe53cf..7ddc76b3e 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -190,7 +190,7 @@ #define LINEARITY_CORRECTION #define TMC2130_LINEARITY_CORRECTION #define TMC2130_LINEARITY_CORRECTION_XYZ -//#define TMC2130_VARIABLE_RESOLUTION +#define TMC2130_VARIABLE_RESOLUTION diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 1c0c6d28e..2cf180a18 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -190,7 +190,7 @@ #define LINEARITY_CORRECTION #define TMC2130_LINEARITY_CORRECTION #define TMC2130_LINEARITY_CORRECTION_XYZ -//#define TMC2130_VARIABLE_RESOLUTION +#define TMC2130_VARIABLE_RESOLUTION From 632781c4a2a5b8f33eb652324259dccaed73452a Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Thu, 21 Mar 2019 00:45:15 +0100 Subject: [PATCH 124/368] "disable_z()" for Delta PSU --- Firmware/Marlin.h | 6 +++ Firmware/Marlin_main.cpp | 43 +++++++++++++++++++ .../variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 3 ++ 3 files changed, 52 insertions(+) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2477d1c21..9ccb81c6f 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -172,6 +172,12 @@ void manage_inactivity(bool ignore_stepper_queue=false); #define disable_z() {} #endif +#ifdef PSU_Delta +#undef disable_z() +#define disable_z() disable_force_z() +void disable_force_z(); +#endif // PSU_Delta + diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7be151f9f..303d46934 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9602,3 +9602,46 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } #define FIL_LOAD_LENGTH 60 + +#ifdef PSU_Delta +void disable_force_z() +{ +uint16_t z_microsteps=0; + +#ifdef TMC2130 +z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); +#endif //TMC2130 +/* +//planner_abort_hard(); +//sei(); +plan_buffer_line( + current_position[X_AXIS]+10, + current_position[Y_AXIS]+20, +// current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/axis_steps_per_unit[Z_AXIS], +current_position[Z_AXIS]+0.026, //0.025, + current_position[E_AXIS], + 40, active_extruder); +st_synchronize(); + z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); + MYSERIAL.println(z_microsteps,DEC); + + MYSERIAL.println(current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC); + MYSERIAL.println(current_position[Z_AXIS],DEC); + MYSERIAL.println(z_microsteps,DEC); + MYSERIAL.println(cs.axis_steps_per_unit[Z_AXIS],DEC); + MYSERIAL.println(float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC); +*/ +planner_abort_hard(); +sei(); +plan_buffer_line( + current_position[X_AXIS], + current_position[Y_AXIS], + current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS], + current_position[E_AXIS], + 40, active_extruder); +st_synchronize(); + +WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); +axis_known_position[Z_AXIS]=false; +} +#endif // PSU_Delta diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 1c0c6d28e..9f82e79d8 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -22,6 +22,9 @@ #define STEEL_SHEET #define HAS_SECOND_SERIAL_PORT +// PSU +#define PSU_Delta // uncomment if DeltaElectronics PSU installed + // Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) //#define E3D_PT100_EXTRUDER_WITH_AMP From 175f840d16790ea6030fe516fe7f6568ef7145f2 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 21 Mar 2019 18:46:07 +0100 Subject: [PATCH 125/368] return statement not used (fixes Pronterface issues) --- Firmware/Marlin_main.cpp | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 669008bd6..19b0d868a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6991,13 +6991,16 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (mmu_enabled) { tmp_extruder = choose_menu_P(_T(MSG_CHOOSE_FILAMENT), _T(MSG_FILAMENT)); - if ((tmp_extruder == mmu_extruder) && mmu_fil_loaded) { - printf_P(PSTR("Duplicit T-code ignored.\n")); - return; //dont execute the same T-code twice in a row + if ((tmp_extruder == mmu_extruder) && mmu_fil_loaded) //dont execute the same T-code twice in a row + { + printf_P(PSTR("Duplicate T-code ignored.\n")); + } + else + { + st_synchronize(); + mmu_command(MmuCmd::T0 + tmp_extruder); + manage_response(true, true, MMU_TCODE_MOVE); } - st_synchronize(); - mmu_command(MmuCmd::T0 + tmp_extruder); - manage_response(true, true, MMU_TCODE_MOVE); } } else if (*(strchr_pointer + index) == 'c') { //load to from bondtech gears to nozzle (nozzle should be preheated) @@ -7033,20 +7036,23 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (mmu_enabled) { - if ((tmp_extruder == mmu_extruder) && mmu_fil_loaded) { - printf_P(PSTR("Duplicit T-code ignored.\n")); - return; //dont execute the same T-code twice in a row + if ((tmp_extruder == mmu_extruder) && mmu_fil_loaded) //dont execute the same T-code twice in a row + { + printf_P(PSTR("Duplicate T-code ignored.\n")); } - mmu_command(MmuCmd::T0 + tmp_extruder); + else + { + mmu_command(MmuCmd::T0 + tmp_extruder); - manage_response(true, true, MMU_TCODE_MOVE); - mmu_continue_loading(); - mmu_extruder = tmp_extruder; //filament change is finished + manage_response(true, true, MMU_TCODE_MOVE); + mmu_continue_loading(); + mmu_extruder = tmp_extruder; //filament change is finished - if (load_to_nozzle)// for single material usage with mmu - { - mmu_load_to_nozzle(); - } + if (load_to_nozzle)// for single material usage with mmu + { + mmu_load_to_nozzle(); + } + } } else { From 576bfb17c738bd2ba5f4024bcfc7842bb71ad9f5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 21 Mar 2019 18:51:54 +0100 Subject: [PATCH 126/368] whitespace --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 19b0d868a..caf23b5ec 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7037,7 +7037,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (mmu_enabled) { if ((tmp_extruder == mmu_extruder) && mmu_fil_loaded) //dont execute the same T-code twice in a row - { + { printf_P(PSTR("Duplicate T-code ignored.\n")); } else From fbe68cb287370927fb9811bb9df0594eccc4b147 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 21 Mar 2019 19:37:34 +0100 Subject: [PATCH 127/368] variables scope changed --- Firmware/mmu.cpp | 4 ++-- Firmware/mmu.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 5cf650c98..dad00f8ee 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -58,9 +58,9 @@ static S mmu_state = S::Disabled; MmuCmd mmu_cmd = MmuCmd::None; //idler ir sensor -uint8_t mmu_idl_sens = 0; +static uint8_t mmu_idl_sens = 0; bool ir_sensor_detected = false; -bool mmu_loading_flag = false; //when set to true, we assume that mmu2 unload was finished and loading phase is now performed; printer can send 'A' to mmu2 to abort loading process +static bool mmu_loading_flag = false; //when set to true, we assume that mmu2 unload was finished and loading phase is now performed; printer can send 'A' to mmu2 to abort loading process uint8_t mmu_extruder = MMU_FILAMENT_UNKNOWN; diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 9c233d05f..41e0ba1f4 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -15,7 +15,6 @@ extern uint8_t tmp_extruder; extern int8_t mmu_finda; extern bool ir_sensor_detected; -extern bool mmu_loading_flag; extern int16_t mmu_version; extern int16_t mmu_buildnr; From 6c28ed6349692f4b35ea358ff7253ef13a621da4 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 21 Mar 2019 22:48:57 +0100 Subject: [PATCH 128/368] Convert lcd_selftest_error() first parameter to enum class. --- Firmware/ultralcd.cpp | 68 ++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index bee46ca21..79f56b705 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -165,7 +165,7 @@ static bool lcd_selfcheck_pulleys(int axis); #endif //TMC2130 static bool lcd_selfcheck_check_heater(bool _isbed); -enum class testScreen +enum class testScreen : uint_least8_t { extruderFan, printFan, @@ -184,6 +184,22 @@ enum class testScreen home, }; +enum class TestError : uint_least8_t +{ + unused, + heater, + bed, + endstops, + motor, + endstop, + printFan, + extruderFan, + pulley, + axis, + swappedFan, + wiringFsensor, +}; + static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_scale, bool _clear, int _delay); static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator); static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite); @@ -194,7 +210,7 @@ static bool lcd_selftest_fan_dialog(int _fan); static bool lcd_selftest_fsensor(); #endif //PAT9125 static bool selftest_irsensor(); -static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2); +static void lcd_selftest_error(TestError error, const char *_error_1, const char *_error_2); static void lcd_colorprint_change(); #ifdef SNMM static int get_ext_nr(); @@ -7184,7 +7200,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { if (axis == Y_AXIS) _error_1 = "Y"; if (axis == Z_AXIS) _error_1 = "Z"; - lcd_selftest_error(9, _error_1, NULL); + lcd_selftest_error(TestError::axis, _error_1, NULL); current_position[axis] = 0; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); reset_crash_det(axis); @@ -7202,7 +7218,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { if (axis == Y_AXIS) _error_1 = "Y"; if (axis == Z_AXIS) _error_1 = "Z"; - lcd_selftest_error(8, _error_1, NULL); + lcd_selftest_error(TestError::pulley, _error_1, NULL); current_position[axis] = 0; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); reset_crash_det(axis); @@ -7309,11 +7325,11 @@ static bool lcd_selfcheck_axis(int _axis, int _travel) if (_travel_done >= _travel) { - lcd_selftest_error(5, _error_1, _error_2); + lcd_selftest_error(TestError::endstop, _error_1, _error_2); } else { - lcd_selftest_error(4, _error_1, _error_2); + lcd_selftest_error(TestError::motor, _error_1, _error_2); } } @@ -7479,12 +7495,12 @@ static bool lcd_selfcheck_check_heater(bool _isbed) } else { - lcd_selftest_error(1, "", ""); + lcd_selftest_error(TestError::heater, "", ""); } } else { - lcd_selftest_error(2, "", ""); + lcd_selftest_error(TestError::bed, "", ""); } manage_heater(); @@ -7493,7 +7509,7 @@ static bool lcd_selfcheck_check_heater(bool _isbed) return _stepresult; } -static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2) +static void lcd_selftest_error(TestError testError, const char *_error_1, const char *_error_2) { lcd_beeper_quick_feedback(); @@ -7509,21 +7525,21 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(0, 1); lcd_puts_P(_i("Please check :"));////MSG_SELFTEST_PLEASECHECK c=0 r=0 - switch (_error_no) + switch (testError) { - case 1: + case TestError::heater: lcd_set_cursor(0, 2); lcd_puts_P(_i("Heater/Thermistor"));////MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 lcd_set_cursor(0, 3); lcd_puts_P(_i("Not connected"));////MSG_SELFTEST_NOTCONNECTED c=0 r=0 break; - case 2: + case TestError::bed: lcd_set_cursor(0, 2); lcd_puts_P(_i("Bed / Heater"));////MSG_SELFTEST_BEDHEATER c=0 r=0 lcd_set_cursor(0, 3); lcd_puts_P(_T(MSG_SELFTEST_WIRINGERROR)); break; - case 3: + case TestError::endstops: lcd_set_cursor(0, 2); lcd_puts_P(_i("Endstops"));////MSG_SELFTEST_ENDSTOPS c=0 r=0 lcd_set_cursor(0, 3); @@ -7531,7 +7547,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(17, 3); lcd_print(_error_1); break; - case 4: + case TestError::motor: lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_MOTOR)); lcd_set_cursor(18, 2); @@ -7541,7 +7557,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(18, 3); lcd_print(_error_2); break; - case 5: + case TestError::endstop: lcd_set_cursor(0, 2); lcd_puts_P(_i("Endstop not hit"));////MSG_SELFTEST_ENDSTOP_NOTHIT c=20 r=1 lcd_set_cursor(0, 3); @@ -7549,7 +7565,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case 6: + case TestError::printFan: lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_COOLING_FAN)); lcd_set_cursor(0, 3); @@ -7557,7 +7573,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case 7: + case TestError::extruderFan: lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_EXTRUDER_FAN)); lcd_set_cursor(0, 3); @@ -7565,7 +7581,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case 8: + case TestError::pulley: lcd_set_cursor(0, 2); lcd_puts_P(_i("Loose pulley"));////MSG_LOOSE_PULLEY c=20 r=1 lcd_set_cursor(0, 3); @@ -7573,7 +7589,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case 9: + case TestError::axis: lcd_set_cursor(0, 2); lcd_puts_P(_i("Axis length"));////MSG_SELFTEST_AXIS_LENGTH c=0 r=0 lcd_set_cursor(0, 3); @@ -7581,7 +7597,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case 10: + case TestError::swappedFan: lcd_set_cursor(0, 2); lcd_puts_P(_i("Front/left fans"));////MSG_SELFTEST_FANS c=0 r=0 lcd_set_cursor(0, 3); @@ -7589,7 +7605,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char * lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case 11: + case TestError::wiringFsensor: lcd_set_cursor(0, 2); lcd_puts_P(_i("Filament sensor"));////MSG_FILAMENT_SENSOR c=20 r=0 lcd_set_cursor(0, 3); @@ -7796,7 +7812,7 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite) static bool lcd_selftest_fan_dialog(int _fan) { bool _result = true; - int _errno = 7; + TestError testError = TestError::extruderFan; switch (_fan) { case 0: fanSpeed = 0; @@ -7851,7 +7867,7 @@ static bool lcd_selftest_fan_dialog(int _fan) printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]); printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]); if (!fan_speed[1]) { - _result = false; _errno = 6; //print fan not spinning + _result = false; testError = TestError::printFan; } #ifdef FAN_SOFT_PWM else { @@ -7862,10 +7878,10 @@ static bool lcd_selftest_fan_dialog(int _fan) _result = lcd_selftest_manual_fan_check(1, true); //turn on print fan and check that left extruder fan is not spinning if (_result) { _result = lcd_selftest_manual_fan_check(1, false); //print fan is stil turned on; check that it is spinning - if (!_result) _errno = 6; //print fan not spinning + if (!_result) testError = TestError::printFan; } else { - _errno = 10; //swapped fans + testError = TestError::swappedFan; } } @@ -7877,7 +7893,7 @@ static bool lcd_selftest_fan_dialog(int _fan) } if (!_result) { - lcd_selftest_error(_errno, NULL, NULL); + lcd_selftest_error(testError, NULL, NULL); } return _result; } From ba23b1b2c580d6f86e4f138daeb10820c76021a6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 21 Mar 2019 22:50:46 +0100 Subject: [PATCH 129/368] Remove unused. --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 79f56b705..1729ec583 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -186,7 +186,6 @@ enum class testScreen : uint_least8_t enum class TestError : uint_least8_t { - unused, heater, bed, endstops, From 91779a5d04d6ae1cc6cba582187a116ca30627b6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 21 Mar 2019 23:36:59 +0100 Subject: [PATCH 130/368] Add filament sensor false triggering message. --- Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/ultralcd.cpp | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 029cf0c6f..faa5283d9 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -78,6 +78,7 @@ const char MSG_SELFTEST_FAN_YES[] PROGMEM_I1 = ISTR("Spinning"); ////c=19 r=0 const char MSG_SELFTEST_CHECK_BED[] PROGMEM_I1 = ISTR("Checking bed "); ////c=20 r=0 const char MSG_SELFTEST_CHECK_FSENSOR[] PROGMEM_I1 = ISTR("Checking sensors "); ////c=20 r=0 const char MSG_SELFTEST_MOTOR[] PROGMEM_I1 = ISTR("Motor"); ////c=0 r=0 +const char MSG_SELFTEST_FILAMENT_SENSOR[] PROGMEM_I1 = ISTR("Filament sensor"); ////c=17 r=0 const char MSG_SELFTEST_WIRINGERROR[] PROGMEM_I1 = ISTR("Wiring error"); ////c=0 r=0 const char MSG_SETTINGS[] PROGMEM_I1 = ISTR("Settings"); ////c=0 r=0 const char MSG_SILENT_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [high power]"); ////c=0 r=0 diff --git a/Firmware/messages.h b/Firmware/messages.h index 5083b26d5..752195e96 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -80,6 +80,7 @@ extern const char MSG_SELFTEST_FAN_YES[]; extern const char MSG_SELFTEST_CHECK_BED[]; extern const char MSG_SELFTEST_CHECK_FSENSOR[]; extern const char MSG_SELFTEST_MOTOR[]; +extern const char MSG_SELFTEST_FILAMENT_SENSOR[]; extern const char MSG_SELFTEST_WIRINGERROR[]; extern const char MSG_SETTINGS[]; extern const char MSG_SILENT_MODE_OFF[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1729ec583..f5c44db67 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -197,6 +197,7 @@ enum class TestError : uint_least8_t axis, swappedFan, wiringFsensor, + triggeringFsensor, }; static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_scale, bool _clear, int _delay); @@ -7606,10 +7607,16 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const break; case TestError::wiringFsensor: lcd_set_cursor(0, 2); - lcd_puts_P(_i("Filament sensor"));////MSG_FILAMENT_SENSOR c=20 r=0 + lcd_puts_P(_T(MSG_SELFTEST_FILAMENT_SENSOR)); lcd_set_cursor(0, 3); lcd_puts_P(_T(MSG_SELFTEST_WIRINGERROR)); break; + case TestError::triggeringFsensor: + lcd_set_cursor(0, 2); + lcd_puts_P(_T(MSG_SELFTEST_FILAMENT_SENSOR)); + lcd_set_cursor(0, 3); + lcd_puts_P(_i("False triggering"));////c=20 r=0 + break; } _delay(1000); @@ -7685,7 +7692,11 @@ static bool selftest_irsensor() mmu_load_step(false); while (blocks_queued()) { - if (PIN_GET(IR_SENSOR_PIN) == 0) return false; + if (PIN_GET(IR_SENSOR_PIN) == 0) + { + lcd_selftest_error(TestError::triggeringFsensor, "", ""); + return false; + } #ifdef TMC2130 manage_heater(); // Vojtech: Don't disable motors inside the planner! @@ -7941,7 +7952,8 @@ static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_s } else if (screen >= testScreen::fsensor && screen <= testScreen::fsensorOk) { - lcd_puts_at_P(0, 2, _i("Filament sensor:"));////MSG_SELFTEST_FILAMENT_SENSOR c=18 r=0 + lcd_puts_at_P(0, 2, _T(MSG_SELFTEST_FILAMENT_SENSOR)); + lcd_putc(':'); lcd_set_cursor(18, 2); (screen == testScreen::fsensor) ? lcd_print(_indicator) : lcd_print("OK"); } From c45a7f86410b62da7f37976da643a190ea9c3e2c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 21 Mar 2019 23:50:01 +0100 Subject: [PATCH 131/368] Fix 1_75mm_MK3-EINSy10a-E3Dv6full variant build error. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f5c44db67..8bdb00c26 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -7640,7 +7640,7 @@ static bool lcd_selftest_fsensor(void) fsensor_init(); if (fsensor_not_responding) { - lcd_selftest_error(11, NULL, NULL); + lcd_selftest_error(TestError::wiringFsensor, NULL, NULL); } return (!fsensor_not_responding); } From d1c5c0390718f4cfd1a9f95a2ae12f870698c379 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 22 Mar 2019 00:03:14 +0100 Subject: [PATCH 132/368] Fix compile error for manual fan check. --- Firmware/ultralcd.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8bdb00c26..0513356fd 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6921,14 +6921,13 @@ bool lcd_selftest() KEEPALIVE_STATE(IN_HANDLER); _progress = lcd_selftest_screen(testScreen::extruderFan, _progress, 3, true, 2000); -#if (defined(FANCHECK) && defined(TACH_0)) +#if (defined(FANCHECK) && defined(TACH_0)) _result = lcd_selftest_fan_dialog(0); #else //defined(TACH_0) _result = lcd_selftest_manual_fan_check(0, false); if (!_result) { - const char *_err; - lcd_selftest_error(7, _err, _err); //extruder fan not spinning + lcd_selftest_error(TestError::extruderFan, "", ""); } #endif //defined(TACH_0) From 8582babddb2b3d16485b484070d28d2d79628882 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 22 Mar 2019 00:08:44 +0100 Subject: [PATCH 133/368] Fix compile error for manual fan check. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0513356fd..b42eacf23 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6941,7 +6941,7 @@ bool lcd_selftest() _result = lcd_selftest_manual_fan_check(1, false); if (!_result) { - lcd_selftest_error(6, 0, 0); //print fan not spinning + lcd_selftest_error(TestError::printFan, "", ""); //print fan not spinning } #endif //defined(TACH_1) From 89f1a3bacfb7e70f35775ba43e5fa8a47e2809b6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 22 Mar 2019 00:11:02 +0100 Subject: [PATCH 134/368] Fix compile error for non TMC2130 pulley check. --- Firmware/ultralcd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b42eacf23..192cc8f13 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -7368,7 +7368,7 @@ static bool lcd_selfcheck_pulleys(int axis) st_synchronize(); if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) { - lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); + lcd_selftest_error(TestError::pulley, (axis == 0) ? "X" : "Y", ""); return(false); } } @@ -7386,7 +7386,7 @@ static bool lcd_selfcheck_pulleys(int axis) return(true); } else { - lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); + lcd_selftest_error(TestError::pulley, (axis == 0) ? "X" : "Y", ""); return(false); } } @@ -7395,7 +7395,7 @@ static bool lcd_selfcheck_pulleys(int axis) plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); st_synchronize(); if (_millis() > timeout_counter) { - lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); + lcd_selftest_error(TestError::pulley, (axis == 0) ? "X" : "Y", ""); return(false); } } From 966e772702c5ad634d1cc76660eb0022043ef7aa Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 22 Mar 2019 00:14:29 +0100 Subject: [PATCH 135/368] Fix compile error for non TMC2130 endstops check. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 192cc8f13..e07dd4b76 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -7428,7 +7428,7 @@ static bool lcd_selfcheck_endstops() if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "X"); if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Y"); if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Z"); - lcd_selftest_error(3, _error, ""); + lcd_selftest_error(TestError::endstops, _error, ""); } manage_heater(); manage_inactivity(true); From baeee5817e50ed9f0e4e96ac164ce75694e37213 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 22 Mar 2019 00:24:22 +0100 Subject: [PATCH 136/368] Make lcd_selftest_error() calls safer, as nullptr parameter is not handled. It is hard to believe, but it actually saves 4B flash. --- Firmware/ultralcd.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e07dd4b76..13058569f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -7199,7 +7199,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { if (axis == Y_AXIS) _error_1 = "Y"; if (axis == Z_AXIS) _error_1 = "Z"; - lcd_selftest_error(TestError::axis, _error_1, NULL); + lcd_selftest_error(TestError::axis, _error_1, ""); current_position[axis] = 0; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); reset_crash_det(axis); @@ -7217,7 +7217,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { if (axis == Y_AXIS) _error_1 = "Y"; if (axis == Z_AXIS) _error_1 = "Z"; - lcd_selftest_error(TestError::pulley, _error_1, NULL); + lcd_selftest_error(TestError::pulley, _error_1, ""); current_position[axis] = 0; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); reset_crash_det(axis); @@ -7639,7 +7639,7 @@ static bool lcd_selftest_fsensor(void) fsensor_init(); if (fsensor_not_responding) { - lcd_selftest_error(TestError::wiringFsensor, NULL, NULL); + lcd_selftest_error(TestError::wiringFsensor, "", ""); } return (!fsensor_not_responding); } @@ -7902,7 +7902,7 @@ static bool lcd_selftest_fan_dialog(int _fan) } if (!_result) { - lcd_selftest_error(testError, NULL, NULL); + lcd_selftest_error(testError, "", ""); } return _result; } From 17a534e42b91b54673164305faeabb8f8c089f75 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 25 Mar 2019 23:28:25 +0100 Subject: [PATCH 137/368] "disable_z()" for Delta PSU II --- Firmware/Marlin_main.cpp | 4 +++- Firmware/io_atmega2560.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 303d46934..d119fbe43 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1316,7 +1316,7 @@ void setup() } #endif //TMC2130 -#if defined(Z_AXIS_ALWAYS_ON) +#if defined(Z_AXIS_ALWAYS_ON) && !defined(PSU_Delta) enable_z(); #endif farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE); @@ -9608,6 +9608,8 @@ void disable_force_z() { uint16_t z_microsteps=0; +if(PIN_INQ(Z_ENABLE_PIN)!=Z_ENABLE_ON) + return; // motor already disabled (may be ;-p ) #ifdef TMC2130 z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); #endif //TMC2130 diff --git a/Firmware/io_atmega2560.h b/Firmware/io_atmega2560.h index e8c756ffb..e353eb05e 100644 --- a/Firmware/io_atmega2560.h +++ b/Firmware/io_atmega2560.h @@ -368,6 +368,7 @@ #define PIN_SET(pin) PORT(pin) |= __MSK(pin) #define PIN_VAL(pin, val) if (val) PIN_SET(pin); else PIN_CLR(pin); #define PIN_GET(pin) (PIN(pin) & __MSK(pin)) +#define PIN_INQ(pin) (PORT(pin) & __MSK(pin)) #endif //_IO_ATMEGA2560 From a9ce38df711485778ae1090c81df69f46f24e724 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 26 Mar 2019 17:14:05 +0100 Subject: [PATCH 138/368] Function for decision if we have valid Z-calibration data in eeprom fixed, mesh bed leveling: possible crash fix, temporaty debug info on serial line. --- Firmware/Marlin_main.cpp | 39 ++++++++++++++++---------- Firmware/mesh_bed_calibration.cpp | 46 ++++++++++++++++++++++--------- 2 files changed, 58 insertions(+), 27 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 669008bd6..76d269895 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4438,7 +4438,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) bool clamped = world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); clamped ? SERIAL_PROTOCOLPGM("First calibration point clamped.\n") : SERIAL_PROTOCOLPGM("No clamping for first calibration point.\n"); } - #endif //SUPPORT_VERBOSITY + #else //SUPPORT_VERBOSITY + world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); + #endif //SUPPORT_VERBOSITY + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS] / 30, active_extruder); // Wait until the move is finished. st_synchronize(); @@ -4475,21 +4478,24 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) uint16_t z_offset_u = 0; if (nMeasPoints == 7) { z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * ((ix/3) + iy - 1))); + printf_P(PSTR("[%d;%d]: Z_offset = %d \n"), ix, iy, z_offset_u); } else { z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1))); + printf_P(PSTR("[%d;%d]: Z_offset = %d \n"), ix, iy, z_offset_u); } z0 = mbl.z_values[0][0] + *reinterpret_cast(&z_offset_u) * 0.01; - #ifdef SUPPORT_VERBOSITY - if (verbosity_level >= 1) { + //#ifdef SUPPORT_VERBOSITY + //if (verbosity_level >= 1) { printf_P(PSTR("Bed leveling, point: %d, calibration Z stored in eeprom: %d, calibration z: %f \n"), mesh_point, z_offset_u, z0); - } - #endif // SUPPORT_VERBOSITY + //} + //#endif // SUPPORT_VERBOSITY } // Move Z up to MESH_HOME_Z_SEARCH. if((ix == 0) && (iy == 0)) current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; else current_position[Z_AXIS] += 2.f / nMeasPoints; //use relative movement from Z coordinate where PINDa triggered on previous point. This makes calibration faster. + float init_z_bckp = current_position[Z_AXIS]; 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(); @@ -4497,43 +4503,48 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) current_position[X_AXIS] = BED_X(ix, nMeasPoints); current_position[Y_AXIS] = BED_Y(iy, nMeasPoints); - //printf_P(PSTR("[%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); + printf_P(PSTR("[%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); - world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); + #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 1) { - + clamped = world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); SERIAL_PROTOCOL(mesh_point); clamped ? SERIAL_PROTOCOLPGM(": xy clamped.\n") : SERIAL_PROTOCOLPGM(": no xy clamping\n"); } + #else //SUPPORT_VERBOSITY + world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); #endif // SUPPORT_VERBOSITY + printf_P(PSTR("after clamping: [%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); 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(); // Go down until endstop is hit const float Z_CALIBRATION_THRESHOLD = 1.f; if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point - printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); + //printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); + printf_P("Point too low 1 \n"); break; } - if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { //broken cable or initial Z coordinate too low. Go to MESH_HOME_Z_SEARCH and repeat last step (z-probe) again to distinguish between these two cases. - + if (init_z_bckp - current_position[Z_AXIS] < 0.1f) { //broken cable or initial Z coordinate too low. Go to MESH_HOME_Z_SEARCH and repeat last step (z-probe) again to distinguish between these two cases. + printf_P(PSTR("Another attempt! Current Z position: %f\n"), current_position[Z_AXIS]); 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 (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point - printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); + //printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); + printf_P("Point too low 2 \n"); break; } if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { - printf_P(PSTR("Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset.\n")); + printf_P(PSTR("Bed leveling failed. Sensor disconnected or cable broken.\n")); break; } } if (has_z && fabs(z0 - current_position[Z_AXIS]) > Z_CALIBRATION_THRESHOLD) { //if we have data from z calibration, max. allowed difference is 1mm for each point - printf_P(PSTR("Bed leveling failed. Sensor triggered too high. Waiting for reset.\n")); + printf_P(PSTR("Bed leveling failed. Sensor triggered too high.\n")); break; } #ifdef SUPPORT_VERBOSITY diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 0aca64a5f..e1cd51a9d 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -678,11 +678,13 @@ void reset_bed_offset_and_skew() bool is_bed_z_jitter_data_valid() // offsets of the Z heiths of the calibration points from the first point are saved as 16bit signed int, scaled to tenths of microns -{ - for (int8_t i = 0; i < 8; ++ i) - if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER+i*2)) == 0x0FFFF) - return false; - return true; +// if at least one 16bit integer has different value then -1 (0x0FFFF), data are considered valid and function returns true, otherwise it returns false +{ + bool data_valid = false; + for (int8_t i = 0; i < 8; ++i) { + if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + i * 2)) != 0x0FFFF) data_valid = true; + } + return data_valid; } static void world2machine_update(const float vec_x[2], const float vec_y[2], const float cntr[2]) @@ -946,7 +948,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i #ifdef TMC2130 FORCE_HIGH_POWER_START; #endif - + printf_P(PSTR("Min. Z: %f\n"), minimum_z); #ifdef SUPPORT_VERBOSITY if(verbosity_level >= 10) SERIAL_ECHOLNPGM("find bed induction sensor point z"); #endif // SUPPORT_VERBOSITY @@ -961,9 +963,16 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i // we have to let the planner know where we are right now as it is not where we said to go. update_current_position_z(); if (! endstop_z_hit_on_purpose()) - goto error; + { + printf_P(PSTR("endstop not hit 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]); + goto error; + } #ifdef TMC2130 - if (READ(Z_TMC2130_DIAG) != 0) goto error; //crash Z detected + if (READ(Z_TMC2130_DIAG) != 0) + { + printf_P(PSTR("crash detected 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]); + goto error; //crash Z detected + } #endif //TMC2130 for (uint8_t i = 0; i < n_iter; ++ i) { @@ -973,12 +982,13 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i go_to_current(homing_feedrate[Z_AXIS]/60); // Move back down slowly to find bed. current_position[Z_AXIS] = minimum_z; + printf_P(PSTR("init Z = %f, min_z = %f\n"), z_bckp, minimum_z); go_to_current(homing_feedrate[Z_AXIS]/(4*60)); // we have to let the planner know where we are right now as it is not where we said to go. update_current_position_z(); //printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS])); if (abs(current_position[Z_AXIS] - z_bckp) < 0.025) { - //printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); + printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); current_position[Z_AXIS] += 0.5; go_to_current(homing_feedrate[Z_AXIS]/60); current_position[Z_AXIS] = minimum_z; @@ -989,10 +999,16 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i - if (! endstop_z_hit_on_purpose()) - goto error; + if (!endstop_z_hit_on_purpose()) + { + printf_P(PSTR("i = %d, endstop not hit 2, current_pos[Z]: %f \n"), i, current_position[Z_AXIS]); + goto error; + } #ifdef TMC2130 - if (READ(Z_TMC2130_DIAG) != 0) goto error; //crash Z detected + if (READ(Z_TMC2130_DIAG) != 0) { + printf_P(PSTR("crash detected 2, current_pos[Z]: %f \n"), current_position[Z_AXIS]); + goto error; //crash Z detected + } #endif //TMC2130 // SERIAL_ECHOPGM("Bed find_bed_induction_sensor_point_z low, height: "); // MYSERIAL.print(current_position[Z_AXIS], 5); @@ -1000,7 +1016,11 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i float dz = i?abs(current_position[Z_AXIS] - (z / i)):0; z += current_position[Z_AXIS]; //printf_P(PSTR("Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000)); - if (dz > 0.05) goto error;//deviation > 50um + if (dz > 0.05) { + printf_P(PSTR("big deviation \n")); + goto error;//deviation > 50um + } + printf_P(PSTR("PINDA triggered at %f\n"), current_position[Z_AXIS]); } current_position[Z_AXIS] = z; if (n_iter > 1) From 58632975384acdc727dd95f9d60b3df294f0ac5d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 27 Mar 2019 20:25:00 +0100 Subject: [PATCH 139/368] if deviation between current Z-probe and avg, value > 50um, enlarge Z-probe movements and repeat measurement --- Firmware/mesh_bed_calibration.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index e1cd51a9d..3ff92a427 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -945,6 +945,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i #endif //SUPPORT_VERBOSITY ) { + bool high_deviation_occured = false; #ifdef TMC2130 FORCE_HIGH_POWER_START; #endif @@ -977,12 +978,12 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i for (uint8_t i = 0; i < n_iter; ++ i) { - current_position[Z_AXIS] += 0.2; + current_position[Z_AXIS] += high_deviation_occured ? 0.5 : 0.2; float z_bckp = current_position[Z_AXIS]; go_to_current(homing_feedrate[Z_AXIS]/60); // Move back down slowly to find bed. current_position[Z_AXIS] = minimum_z; - printf_P(PSTR("init Z = %f, min_z = %f\n"), z_bckp, minimum_z); + printf_P(PSTR("init Z = %f, min_z = %f, i = %d\n"), z_bckp, minimum_z, i); go_to_current(homing_feedrate[Z_AXIS]/(4*60)); // we have to let the planner know where we are right now as it is not where we said to go. update_current_position_z(); @@ -1016,9 +1017,19 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i float dz = i?abs(current_position[Z_AXIS] - (z / i)):0; z += current_position[Z_AXIS]; //printf_P(PSTR("Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000)); - if (dz > 0.05) { - printf_P(PSTR("big deviation \n")); - goto error;//deviation > 50um + printf_P(PSTR("Z- measurement deviation from avg value %f um\n"), dz); + if (dz > 0.05) { //deviation > 50um + if (high_deviation_occured == false) { //first occurence may be caused in some cases by mechanic resonance probably especially if printer is placed on unstable surface + printf_P(PSTR("high dev. first occurence\n")); + delay_keep_alive(500); //damping + //start measurement from the begining, but this time with higher movements in Z axis which should help to reduce mechanical resonance + high_deviation_occured = true; + i = -1; + z = 0; + } + else { + goto error; + } } printf_P(PSTR("PINDA triggered at %f\n"), current_position[Z_AXIS]); } From e259967991c5dbb9bdb29220569b4dcce83de59b Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 27 Mar 2019 20:41:45 +0100 Subject: [PATCH 140/368] remove / comment debug code --- Firmware/Marlin_main.cpp | 22 +++++++++------------- Firmware/mesh_bed_calibration.cpp | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 76d269895..63f4f298e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4478,18 +4478,16 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) uint16_t z_offset_u = 0; if (nMeasPoints == 7) { z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * ((ix/3) + iy - 1))); - printf_P(PSTR("[%d;%d]: Z_offset = %d \n"), ix, iy, z_offset_u); } else { z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1))); - printf_P(PSTR("[%d;%d]: Z_offset = %d \n"), ix, iy, z_offset_u); } z0 = mbl.z_values[0][0] + *reinterpret_cast(&z_offset_u) * 0.01; - //#ifdef SUPPORT_VERBOSITY - //if (verbosity_level >= 1) { + #ifdef SUPPORT_VERBOSITY + if (verbosity_level >= 1) { printf_P(PSTR("Bed leveling, point: %d, calibration Z stored in eeprom: %d, calibration z: %f \n"), mesh_point, z_offset_u, z0); - //} - //#endif // SUPPORT_VERBOSITY + } + #endif // SUPPORT_VERBOSITY } // Move Z up to MESH_HOME_Z_SEARCH. @@ -4503,7 +4501,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) current_position[X_AXIS] = BED_X(ix, nMeasPoints); current_position[Y_AXIS] = BED_Y(iy, nMeasPoints); - printf_P(PSTR("[%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); + //printf_P(PSTR("[%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); #ifdef SUPPORT_VERBOSITY @@ -4516,26 +4514,24 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); #endif // SUPPORT_VERBOSITY - printf_P(PSTR("after clamping: [%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); + //printf_P(PSTR("after clamping: [%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); 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(); // Go down until endstop is hit const float Z_CALIBRATION_THRESHOLD = 1.f; if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point - //printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); - printf_P("Point too low 1 \n"); + printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); break; } if (init_z_bckp - current_position[Z_AXIS] < 0.1f) { //broken cable or initial Z coordinate too low. Go to MESH_HOME_Z_SEARCH and repeat last step (z-probe) again to distinguish between these two cases. - printf_P(PSTR("Another attempt! Current Z position: %f\n"), current_position[Z_AXIS]); + //printf_P(PSTR("Another attempt! Current Z position: %f\n"), current_position[Z_AXIS]); 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 (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point - //printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); - printf_P("Point too low 2 \n"); + printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); break; } if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 3ff92a427..62bcca3c5 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -949,7 +949,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i #ifdef TMC2130 FORCE_HIGH_POWER_START; #endif - printf_P(PSTR("Min. Z: %f\n"), minimum_z); + //printf_P(PSTR("Min. Z: %f\n"), minimum_z); #ifdef SUPPORT_VERBOSITY if(verbosity_level >= 10) SERIAL_ECHOLNPGM("find bed induction sensor point z"); #endif // SUPPORT_VERBOSITY @@ -965,13 +965,13 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i update_current_position_z(); if (! endstop_z_hit_on_purpose()) { - printf_P(PSTR("endstop not hit 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]); + //printf_P(PSTR("endstop not hit 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]); goto error; } #ifdef TMC2130 if (READ(Z_TMC2130_DIAG) != 0) { - printf_P(PSTR("crash detected 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]); + //printf_P(PSTR("crash detected 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]); goto error; //crash Z detected } #endif //TMC2130 @@ -983,13 +983,13 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i go_to_current(homing_feedrate[Z_AXIS]/60); // Move back down slowly to find bed. current_position[Z_AXIS] = minimum_z; - printf_P(PSTR("init Z = %f, min_z = %f, i = %d\n"), z_bckp, minimum_z, i); + //printf_P(PSTR("init Z = %f, min_z = %f, i = %d\n"), z_bckp, minimum_z, i); go_to_current(homing_feedrate[Z_AXIS]/(4*60)); // we have to let the planner know where we are right now as it is not where we said to go. update_current_position_z(); //printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS])); if (abs(current_position[Z_AXIS] - z_bckp) < 0.025) { - printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); + //printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); current_position[Z_AXIS] += 0.5; go_to_current(homing_feedrate[Z_AXIS]/60); current_position[Z_AXIS] = minimum_z; @@ -1002,12 +1002,12 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i if (!endstop_z_hit_on_purpose()) { - printf_P(PSTR("i = %d, endstop not hit 2, current_pos[Z]: %f \n"), i, current_position[Z_AXIS]); + //printf_P(PSTR("i = %d, endstop not hit 2, current_pos[Z]: %f \n"), i, current_position[Z_AXIS]); goto error; } #ifdef TMC2130 if (READ(Z_TMC2130_DIAG) != 0) { - printf_P(PSTR("crash detected 2, current_pos[Z]: %f \n"), current_position[Z_AXIS]); + //printf_P(PSTR("crash detected 2, current_pos[Z]: %f \n"), current_position[Z_AXIS]); goto error; //crash Z detected } #endif //TMC2130 @@ -1017,10 +1017,10 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i float dz = i?abs(current_position[Z_AXIS] - (z / i)):0; z += current_position[Z_AXIS]; //printf_P(PSTR("Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000)); - printf_P(PSTR("Z- measurement deviation from avg value %f um\n"), dz); + //printf_P(PSTR("Z- measurement deviation from avg value %f um\n"), dz); if (dz > 0.05) { //deviation > 50um if (high_deviation_occured == false) { //first occurence may be caused in some cases by mechanic resonance probably especially if printer is placed on unstable surface - printf_P(PSTR("high dev. first occurence\n")); + //printf_P(PSTR("high dev. first occurence\n")); delay_keep_alive(500); //damping //start measurement from the begining, but this time with higher movements in Z axis which should help to reduce mechanical resonance high_deviation_occured = true; @@ -1031,7 +1031,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i goto error; } } - printf_P(PSTR("PINDA triggered at %f\n"), current_position[Z_AXIS]); + //printf_P(PSTR("PINDA triggered at %f\n"), current_position[Z_AXIS]); } current_position[Z_AXIS] = z; if (n_iter > 1) From 02faadf0b9fe50c991a6a2c29fee906d4bea8384 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 28 Mar 2019 09:49:08 +0100 Subject: [PATCH 141/368] MMU mode renamed --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index bee46ca21..04f4d7639 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5319,7 +5319,7 @@ do\ {\ if (mmu_enabled)\ {\ - if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Fast]"), lcd_silent_mode_mmu_set); \ + if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Normal]"), lcd_silent_mode_mmu_set); \ else MENU_ITEM_FUNCTION_P(_i("MMU Mode[Stealth]"), lcd_silent_mode_mmu_set); \ }\ }\ From d22793f2766a14d1c07609336baa843e9557f4cd Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 28 Mar 2019 12:02:46 +0100 Subject: [PATCH 142/368] Z-probe nr. states reduced to 1; 3; 5 --- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 2 +- Firmware/ultralcd.cpp | 30 ++++++++++++++++++------------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2477d1c21..1a278013b 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -21,7 +21,7 @@ #include "Configuration.h" #include "pins.h" #include "Timer.h" -extern int mbl_z_probe_nr; +extern uint8_t mbl_z_probe_nr; #ifndef AT90USB #define HardwareSerial_h // trick to disable the standard HWserial diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 67601fb1a..45a1d4012 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -167,7 +167,7 @@ CardReader card; unsigned long PingTime = _millis(); unsigned long NcTime; -int mbl_z_probe_nr = 3; //numer of Z measurements for each point in mesh bed leveling calibration +uint8_t mbl_z_probe_nr = 3; //numer of Z measurements for each point in mesh bed leveling calibration //used for PINDA temp calibration and pause print #define DEFAULT_RETRACTION 1 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 04f4d7639..7a6581f86 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6688,6 +6688,17 @@ static void mbl_mesh_set() { eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mesh_nr); } +static void mbl_probe_nr_set() { + mbl_z_probe_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR); + switch (mbl_z_probe_nr) { + case 1: mbl_z_probe_nr = 3; break; + case 3: mbl_z_probe_nr = 5; break; + case 5: mbl_z_probe_nr = 1; break; + default: mbl_z_probe_nr = 3; break; + } + eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, mbl_z_probe_nr); +} + static void lcd_mesh_bed_leveling_settings() { @@ -6695,25 +6706,20 @@ static void lcd_mesh_bed_leveling_settings() uint8_t points_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); MENU_BEGIN(); - // leaving menu - this condition must be immediately before MENU_ITEM_BACK_P - if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving) - { - eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, (uint8_t)mbl_z_probe_nr); - } MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); - if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); - else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); - MENU_ITEM_EDIT_int3_P(_i("Z-probe nr."), &mbl_z_probe_nr, 1, 5); + if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); ////MSG_MESH_3x3 c=18 r=0 + else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); ////MSG_MESH_7x7 c=18 r=0 + switch (mbl_z_probe_nr) { + case 1: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [1]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + case 5: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [5]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + } if (points_nr == 7) { if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_set); else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_set); } else menu_item_text_P(_i("Magnets comp.[N/A]")); MENU_END(); - /*if(menu_leaving) - { - eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mbl_z_probe_nr); - }*/ //SETTINGS_MBL_MODE; } From 1dd486d86d4b35e49c51d146f56c1e72233cf891 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 28 Mar 2019 13:18:28 +0100 Subject: [PATCH 143/368] max length of menu item strings added --- Firmware/ultralcd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7a6581f86..5128c77ab 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6715,10 +6715,10 @@ static void lcd_mesh_bed_leveling_settings() default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 } if (points_nr == 7) { - if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_set); - else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_set); + if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_set); ////MSG_MAGNETS_COMP_ON c=18 r=0 + else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_set); ////MSG_MAGNETS_COMP_OFF c=18 r=0 } - else menu_item_text_P(_i("Magnets comp.[N/A]")); + else menu_item_text_P(_i("Magnets comp.[N/A]")); ////MSG_MAGNETS_COMP_NA c=18 r=0 MENU_END(); //SETTINGS_MBL_MODE; } From 8f69d5a501619b84a929d6499e14ca870894dfa5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 28 Mar 2019 14:48:35 +0100 Subject: [PATCH 144/368] document --- Firmware/mesh_bed_calibration.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 62bcca3c5..8ac050af1 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3129,6 +3129,11 @@ void mbl_settings_init() { } } +//parameter ix: index of mesh bed leveling point in X-axis +//parameter iy: index of mesh bed leveling point in Y-axis +//parameter meas_points: number of mesh bed leveling points in one axis; currently designed and tested for values 3 and 7 +//parameter zigzag: false if ix is considered 0 on left side of bed and ix rises with rising X coordinate; true if ix is considered 0 on the right side of heatbed for odd iy values (zig zag mesh bed leveling movements) +//function returns true if point is considered valid (typicaly in safe distance from magnet or another object which inflences PINDA measurements) bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag) { //"human readable" heatbed plan //magnet proximity influence Z coordinate measurements significantly (40 - 100 um) From 96a111119b874da4e999e39c9c5fba1104dc9c71 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 28 Mar 2019 14:52:50 +0100 Subject: [PATCH 145/368] document --- Firmware/mesh_bed_calibration.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 8ac050af1..006cc4874 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3129,8 +3129,8 @@ void mbl_settings_init() { } } -//parameter ix: index of mesh bed leveling point in X-axis -//parameter iy: index of mesh bed leveling point in Y-axis +//parameter ix: index of mesh bed leveling point in X-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 ) +//parameter iy: index of mesh bed leveling point in Y-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 ) //parameter meas_points: number of mesh bed leveling points in one axis; currently designed and tested for values 3 and 7 //parameter zigzag: false if ix is considered 0 on left side of bed and ix rises with rising X coordinate; true if ix is considered 0 on the right side of heatbed for odd iy values (zig zag mesh bed leveling movements) //function returns true if point is considered valid (typicaly in safe distance from magnet or another object which inflences PINDA measurements) @@ -3143,13 +3143,14 @@ bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bo uint8_t valid_points_mask[7] = { //[X_MAX,Y_MAX] - 0b1111111, - 0b1111111, - 0b1110111, - 0b1111011, - 0b1110111, - 0b1111111, - 0b1111111, + //0123456 + 0b1111111,//6 + 0b1111111,//5 + 0b1110111,//4 + 0b1111011,//3 + 0b1110111,//2 + 0b1111111,//1 + 0b1111111,//0 //[0,0] }; if (meas_points == 3) { From 97594c83bb9946a4ff8277ed4d57109db55c3f11 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 28 Mar 2019 14:58:58 +0100 Subject: [PATCH 146/368] function misleading names changed --- Firmware/ultralcd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5128c77ab..f5edc5ff9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6675,13 +6675,13 @@ static void lcd_tune_menu() MENU_END(); } -static void mbl_magnets_elimination_set() { +static void mbl_magnets_elimination_toggle() { bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); magnet_elimination = !magnet_elimination; eeprom_update_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION, (uint8_t)magnet_elimination); } -static void mbl_mesh_set() { +static void mbl_mesh_toggle() { uint8_t mesh_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); if(mesh_nr == 3) mesh_nr = 7; else mesh_nr = 3; @@ -6707,16 +6707,16 @@ static void lcd_mesh_bed_leveling_settings() MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); - if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); ////MSG_MESH_3x3 c=18 r=0 - else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); ////MSG_MESH_7x7 c=18 r=0 + if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_toggle); ////MSG_MESH_3x3 c=18 r=0 + else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_toggle); ////MSG_MESH_7x7 c=18 r=0 switch (mbl_z_probe_nr) { case 1: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [1]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 case 5: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [5]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 } if (points_nr == 7) { - if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_set); ////MSG_MAGNETS_COMP_ON c=18 r=0 - else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_set); ////MSG_MAGNETS_COMP_OFF c=18 r=0 + if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_ON c=18 r=0 + else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_OFF c=18 r=0 } else menu_item_text_P(_i("Magnets comp.[N/A]")); ////MSG_MAGNETS_COMP_NA c=18 r=0 MENU_END(); From ae11c1e26f1bf8ecd4f45d99869ef58c5584a6aa Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 28 Mar 2019 16:39:56 +0100 Subject: [PATCH 147/368] rename function --- Firmware/ultralcd.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f5edc5ff9..017df6a9f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6688,7 +6688,7 @@ static void mbl_mesh_toggle() { eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mesh_nr); } -static void mbl_probe_nr_set() { +static void mbl_probe_nr_toggle() { mbl_z_probe_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR); switch (mbl_z_probe_nr) { case 1: mbl_z_probe_nr = 3; break; @@ -6710,9 +6710,9 @@ static void lcd_mesh_bed_leveling_settings() if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_toggle); ////MSG_MESH_3x3 c=18 r=0 else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_toggle); ////MSG_MESH_7x7 c=18 r=0 switch (mbl_z_probe_nr) { - case 1: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [1]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 - case 5: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [5]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 - default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + case 1: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [1]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + case 5: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [5]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 } if (points_nr == 7) { if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_ON c=18 r=0 From c440ca7369ce4bde939c51de03c0117b1b642ccc Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 1 Apr 2019 18:44:13 +0200 Subject: [PATCH 148/368] Revert "Phase correct PWM for bed, frequency 40KHz." --- Firmware/timer02.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Firmware/timer02.c b/Firmware/timer02.c index 113c72463..8309f9401 100644 --- a/Firmware/timer02.c +++ b/Firmware/timer02.c @@ -11,11 +11,19 @@ uint8_t timer02_pwm0 = 0; - void timer02_set_pwm0(uint8_t pwm0) { - TCCR0A |= (2 << COM0B0); //switch OC0B to OCR mode - OCR0B = (uint16_t)OCR0A * pwm0 / 255; + if (timer02_pwm0 == pwm0) return; + if (pwm0) + { + TCCR0A |= (2 << COM0B0); + OCR0B = pwm0 - 1; + } + else + { + TCCR0A &= ~(2 << COM0B0); + OCR0B = 0; + } timer02_pwm0 = pwm0; } @@ -31,12 +39,13 @@ void timer02_init(void) TIMSK0 &= ~(1< Date: Mon, 1 Apr 2019 20:52:24 +0200 Subject: [PATCH 149/368] version change --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index e086a16c8..acdd2d6f8 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.7.0-RC1" -#define FW_COMMIT_NR 2175 +#define FW_VERSION "3.7.0" +#define FW_COMMIT_NR 2201 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From 4b1fc690888c52ddf4edf3cefaeb41231b423bf2 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 2 Apr 2019 20:04:44 +0200 Subject: [PATCH 150/368] "disable_z()" for Delta PSU III stealthChop set if motor-disable (@ Z) required --- Firmware/Marlin.h | 4 +++ Firmware/Marlin_main.cpp | 61 +++++++++++++++++++++++++--------------- Firmware/stepper.cpp | 5 +++- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 9ccb81c6f..1516941b9 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -173,9 +173,13 @@ void manage_inactivity(bool ignore_stepper_queue=false); #endif #ifdef PSU_Delta +void init_force_z(); #undef disable_z() #define disable_z() disable_force_z() void disable_force_z(); +#undef enable_disable_z() +#define enable_z() enable_force_z() +void enable_force_z(); #endif // PSU_Delta diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d119fbe43..8aa2c6c8d 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9604,35 +9604,27 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) #define FIL_LOAD_LENGTH 60 #ifdef PSU_Delta +bool bEnableForce_z; + +void init_force_z() +{ +WRITE(Z_ENABLE_PIN,Z_ENABLE_ON); +bEnableForce_z=true; // "true"-value enforce "disable_force_z()" executing +disable_force_z(); +} + void disable_force_z() { uint16_t z_microsteps=0; -if(PIN_INQ(Z_ENABLE_PIN)!=Z_ENABLE_ON) +if(!bEnableForce_z) return; // motor already disabled (may be ;-p ) +bEnableForce_z=false; + +// alignment to full-step #ifdef TMC2130 z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); -#endif //TMC2130 -/* -//planner_abort_hard(); -//sei(); -plan_buffer_line( - current_position[X_AXIS]+10, - current_position[Y_AXIS]+20, -// current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/axis_steps_per_unit[Z_AXIS], -current_position[Z_AXIS]+0.026, //0.025, - current_position[E_AXIS], - 40, active_extruder); -st_synchronize(); - z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); - MYSERIAL.println(z_microsteps,DEC); - - MYSERIAL.println(current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC); - MYSERIAL.println(current_position[Z_AXIS],DEC); - MYSERIAL.println(z_microsteps,DEC); - MYSERIAL.println(cs.axis_steps_per_unit[Z_AXIS],DEC); - MYSERIAL.println(float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC); -*/ +#endif // TMC2130 planner_abort_hard(); sei(); plan_buffer_line( @@ -9643,7 +9635,30 @@ plan_buffer_line( 40, active_extruder); st_synchronize(); -WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); +// switching to silent mode +#ifdef TMC2130 +tmc2130_mode=TMC2130_MODE_SILENT; +update_mode_profile(); +tmc2130_init(); +#endif // TMC2130 + axis_known_position[Z_AXIS]=false; } + + +void enable_force_z() +{ +if(bEnableForce_z) + return; // motor already enabled (may be ;-p ) +bEnableForce_z=true; + +// mode recovering +#ifdef TMC2130 +tmc2130_mode=eeprom_read_byte((uint8_t*)EEPROM_SILENT)?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; +update_mode_profile(); +tmc2130_init(); +#endif // TMC2130 + +WRITE(Z_ENABLE_PIN,Z_ENABLE_ON); // slightly redundant ;-p +} #endif // PSU_Delta diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index c21a4e9f1..dfb2dbe27 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -1122,7 +1122,7 @@ void clear_current_adv_vars() { } #endif // LIN_ADVANCE - + void st_init() { #ifdef TMC2130 @@ -1306,6 +1306,9 @@ void st_init() SET_OUTPUT(Z2_STEP_PIN); WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN); #endif + #ifdef PSU_Delta + init_force_z(); + #endif // PSU_Delta disable_z(); #endif #if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1) From b0566b2bc9f66d5424aa6bf885a3c78fac7d0b02 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 3 Apr 2019 16:45:34 +0200 Subject: [PATCH 151/368] Translation fix for https://github.com/prusa3d/Prusa-Firmware/pull/1601 --- lang/lang_en.txt | 6 +++--- lang/lang_en_cz.txt | 8 ++++---- lang/lang_en_de.txt | 12 ++++++------ lang/lang_en_es.txt | 12 ++++++------ lang/lang_en_fr.txt | 10 +++++----- lang/lang_en_it.txt | 12 ++++++------ lang/lang_en_pl.txt | 12 ++++++------ 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lang/lang_en.txt b/lang/lang_en.txt index b26968d71..cea52bd33 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -812,16 +812,16 @@ "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100." #MSG_SORT_NONE c=17 r=1 -"Sort: [none]" +"Sort [none]" #MSG_SORT_TIME c=17 r=1 -"Sort: [time]" +"Sort [time]" # "Severe skew" #MSG_SORT_ALPHA c=17 r=1 -"Sort: [alphabet]" +"Sort [alphabet]" #MSG_SORTING c=20 r=1 "Sorting files" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index c4e1b7d83..85f8ffab7 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -1083,19 +1083,19 @@ "Nektere soubory nebudou setrideny. Maximalni pocet souboru ve slozce pro setrideni je 100." #MSG_SORT_NONE c=17 r=1 -"Sort: [none]" +"Sort [none]" "Trideni [Zadne]" #MSG_SORT_TIME c=17 r=1 -"Sort: [time]" -"Trideni: [cas]" +"Sort [time]" +"Trideni [cas]" # "Severe skew" "Tezke zkoseni" #MSG_SORT_ALPHA c=17 r=1 -"Sort: [alphabet]" +"Sort [alphabet]" "Trideni [Abeceda]" #MSG_SORTING c=20 r=1 diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 5e2198c74..144dfc706 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -1083,20 +1083,20 @@ "Einige Dateien wur- den nicht sortiert. Max. Dateien pro Verzeichnis = 100." #MSG_SORT_NONE c=17 r=1 -"Sort: [none]" -"Sort.: [Keine]" +"Sort [none]" +"Sort. [Keine]" #MSG_SORT_TIME c=17 r=1 -"Sort: [time]" -"Sort.: [Zeit]" +"Sort [time]" +"Sort. [Zeit]" # "Severe skew" "Schwerer Schraeglauf" #MSG_SORT_ALPHA c=17 r=1 -"Sort: [alphabet]" -"Sort.: [Alphabet]" +"Sort [alphabet]" +"Sort. [Alphabet]" #MSG_SORTING c=20 r=1 "Sorting files" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index c62a3578a..86e4268b5 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -1083,20 +1083,20 @@ "Algunos archivos no se ordenaran. Maximo 100 archivos por carpeta para ordenar. " #MSG_SORT_NONE c=17 r=1 -"Sort: [none]" -"Ordenar: [nada]" +"Sort [none]" +"Ordenar [nada]" #MSG_SORT_TIME c=17 r=1 -"Sort: [time]" -"Orden: [Fecha]" +"Sort [time]" +"Ordenar [Fecha]" # "Severe skew" "Inclinacion severa" #MSG_SORT_ALPHA c=17 r=1 -"Sort: [alphabet]" -"Ordenar:[alfabet]" +"Sort [alphabet]" +"Ordenar [alfabet]" #MSG_SORTING c=20 r=1 "Sorting files" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index d3fd4f7b6..930fbb57e 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -1083,20 +1083,20 @@ "Certains fichiers ne seront pas tries. Max 100 fichiers tries par dossier." #MSG_SORT_NONE c=17 r=1 -"Sort: [none]" +"Sort [none]" "Tri : [aucun]" #MSG_SORT_TIME c=17 r=1 -"Sort: [time]" -"Tri : [heure]" +"Sort [time]" +"Tri [heure]" # "Severe skew" "Deviation severe" #MSG_SORT_ALPHA c=17 r=1 -"Sort: [alphabet]" -"Tri : [alphabet]" +"Sort [alphabet]" +"Tri [alphabet]" #MSG_SORTING c=20 r=1 "Sorting files" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 919a542aa..0b47c7240 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -1083,20 +1083,20 @@ "Alcuni file non saranno ordinati. Il numero massimo di file in una cartella e 100 perche siano ordinati." #MSG_SORT_NONE c=17 r=1 -"Sort: [none]" -"Ordina: [none]" +"Sort [none]" +"Ordina [none]" #MSG_SORT_TIME c=17 r=1 -"Sort: [time]" -"Ordina: [time]" +"Sort [time]" +"Ordina [time]" # "Severe skew" "Disassamento grave" #MSG_SORT_ALPHA c=17 r=1 -"Sort: [alphabet]" -"Ordine: [alfabet]" +"Sort [alphabet]" +"Ordine [alfabet]" #MSG_SORTING c=20 r=1 "Sorting files" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index a23f89e39..26be40bd6 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -1083,20 +1083,20 @@ "Niektore pliki nie zostana posortowane. Max. liczba plikow w 1 folderze = 100." #MSG_SORT_NONE c=17 r=1 -"Sort: [none]" -"Sortuj: [brak]" +"Sort [none]" +"Sortuj [brak]" #MSG_SORT_TIME c=17 r=1 -"Sort: [time]" -"Sortuj: [czas]" +"Sort [time]" +"Sortuj [czas]" # "Severe skew" "Znaczny skos" #MSG_SORT_ALPHA c=17 r=1 -"Sort: [alphabet]" -"Sortuj: [alfabet]" +"Sort [alphabet]" +"Sortuj [alfabet]" #MSG_SORTING c=20 r=1 "Sorting files" From aa0edd09f57b3b1d96ceaa05ab29f7e3add841b0 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 3 Apr 2019 22:48:58 +0200 Subject: [PATCH 152/368] (preliminary) fix @ (bed) preHeatError --- Firmware/temperature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index d6019eebc..197237f46 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1301,7 +1301,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren SERIAL_ECHOPGM(" Tstart:"); MYSERIAL.print(__preheat_start[_heater_id]);*/ - if (_current_temperature - __preheat_start[_heater_id] < 2) { + if (_current_temperature - __preheat_start[_heater_id] < ((_isbed &&(_current_temperature>105.0))?0.6:2.0)) { __preheat_errors[_heater_id]++; /*SERIAL_ECHOPGM(" Preheat errors:"); MYSERIAL.println(__preheat_errors[_heater_id]);*/ @@ -1311,7 +1311,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren __preheat_errors[_heater_id] = 0; } - if (__preheat_errors[_heater_id] > ((_isbed) ? 2 : 5)) + if (__preheat_errors[_heater_id] > ((_isbed) ? 3 : 5)) { if (farm_mode) { prusa_statistics(0); } temp_runaway_stop(true, _isbed); From bf1a55ab02b7e6f7e516f91c1850461313398263 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 4 Apr 2019 18:15:37 +0200 Subject: [PATCH 153/368] Add mmu_continue_loading blocking variant and use it for usb printing, so that "ok" is not returned to the controller in case MMU load failed. Known limitation: MMU load failed is not handled properly if it happens again after user clicked printer button to continue print. --- Firmware/Marlin_main.cpp | 5 +++-- Firmware/mmu.cpp | 34 ++++++++++++++++++++++++++++------ Firmware/mmu.h | 2 +- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 45a1d4012..f199df2ae 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7014,7 +7014,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (mmu_enabled) { st_synchronize(); - mmu_continue_loading(); + mmu_continue_loading(is_usb_printing); mmu_extruder = tmp_extruder; //filament change is finished mmu_load_to_nozzle(); } @@ -7052,7 +7052,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); - mmu_continue_loading(); + mmu_continue_loading(is_usb_printing); + mmu_extruder = tmp_extruder; //filament change is finished if (load_to_nozzle)// for single material usage with mmu diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index dad00f8ee..1c671cfa3 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -878,7 +878,7 @@ void mmu_M600_load_filament(bool automatic, float nozzle_temp) mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(false, true, MMU_LOAD_MOVE); - mmu_continue_loading(); + mmu_continue_loading(is_usb_printing); mmu_extruder = tmp_extruder; //filament change is finished mmu_load_to_nozzle(); @@ -1363,7 +1363,7 @@ bFilamentAction=false; // NOT in "mmu_load_to_nozzle_ lcd_print(tmp_extruder + 1); mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); - mmu_continue_loading(); + mmu_continue_loading(false); mmu_extruder = tmp_extruder; //filament change is finished mmu_load_to_nozzle(); load_filament_final_feed(); @@ -1464,7 +1464,10 @@ static void load_more() st_synchronize(); } -void mmu_continue_loading() +//! @par blocking +//! * true blocking +//! * false non-blocking +void mmu_continue_loading(bool blocking) { if (ir_sensor_detected) { @@ -1510,9 +1513,28 @@ void mmu_continue_loading() setAllTargetHotends(0); lcd_setstatuspgm(_i("MMU load failed "));////MSG_RECOVERING_PRINT c=20 r=1 - mmu_fil_loaded = false; //so we can retry same T-code again - isPrintPaused = true; - mmu_command(MmuCmd::W0); + + if (blocking) + { + KEEPALIVE_STATE(PAUSED_FOR_USER); + lcd_consume_click(); + while(!lcd_clicked()){ + manage_heater(); + manage_inactivity(true); + lcd_update(0); + } + KEEPALIVE_STATE(IN_HANDLER); + restore_print_from_ram_and_continue(0); + mmu_command(MmuCmd::T0 + tmp_extruder); + manage_response(true, true, MMU_TCODE_MOVE); + load_more(); + } + else + { + mmu_fil_loaded = false; //so we can retry same T-code again + isPrintPaused = true; + mmu_command(MmuCmd::W0); + } } } } diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 41e0ba1f4..f0fc0deb0 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -134,7 +134,7 @@ extern void mmu_eject_filament(uint8_t filament, bool recover); #ifdef MMU_HAS_CUTTER extern void mmu_cut_filament(uint8_t filament_nr); #endif //MMU_HAS_CUTTER -extern void mmu_continue_loading(); +extern void mmu_continue_loading(bool blocking); extern void mmu_filament_ramming(); extern void mmu_wait_for_heater_blocking(); extern void mmu_load_step(bool synchronize = true); From 4bfa3d7e0bb05aa54564baa242205f6c492595c3 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 4 Apr 2019 19:04:15 +0200 Subject: [PATCH 154/368] Reporty busy: paused for user in case MMU is not responding. --- Firmware/mmu.cpp | 2 ++ Firmware/tmc2130.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 1c671cfa3..c7d1f2c93 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -679,6 +679,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move) st_synchronize(); mmu_print_saved = true; printf_P(PSTR("MMU not responding\n")); + KEEPALIVE_STATE(PAUSED_FOR_USER); hotend_temp_bckp = degTargetHotend(active_extruder); if (move_axes) { z_position_bckp = current_position[Z_AXIS]; @@ -735,6 +736,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move) } else if (mmu_print_saved) { printf_P(PSTR("MMU starts responding\n")); + KEEPALIVE_STATE(IN_HANDLER); mmu_loading_flag = false; if (turn_off_nozzle) { diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 8cd3422a9..05ea2ab6a 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -715,6 +715,9 @@ uint8_t tmc2130_get_pwr(uint8_t axis) return 0; } +//! @par pwr motor power +//! * 0 disabled +//! * non-zero enabled void tmc2130_set_pwr(uint8_t axis, uint8_t pwr) { switch (axis) From bf57a59147f18e9d5485b6dfa808bac6786f6e51 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 5 Apr 2019 13:47:17 +0200 Subject: [PATCH 155/368] Extract duplicate code into function. Saves 106B flash. --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 26 +++++++++++++++++++------- Firmware/mmu.cpp | 9 +-------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 1a278013b..fd6121a06 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -497,3 +497,4 @@ void M600_load_filament_movements(); void M600_wait_for_user(float HotendTempBckp); void M600_check_state(float nozzle_temp); void load_filament_final_feed(); +void marlin_wait_for_click(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index f199df2ae..b4aeef150 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4962,13 +4962,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) KEEPALIVE_STATE(IN_HANDLER); lcd_ignore_click(false); }else{ - KEEPALIVE_STATE(PAUSED_FOR_USER); - while(!lcd_clicked()){ - manage_heater(); - manage_inactivity(true); - lcd_update(0); - } - KEEPALIVE_STATE(IN_HANDLER); + marlin_wait_for_click(); } if (IS_SD_PRINTING) LCD_MESSAGERPGM(_T(MSG_RESUMING_PRINT)); @@ -9615,4 +9609,22 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) lcd_update_enable(false); } + +//! @brief Wait for click +//! +//! Set +void marlin_wait_for_click() +{ + int busy_state_backup = busy_state; + KEEPALIVE_STATE(PAUSED_FOR_USER); + lcd_consume_click(); + while(!lcd_clicked()) + { + manage_heater(); + manage_inactivity(true); + lcd_update(0); + } + KEEPALIVE_STATE(busy_state); +} + #define FIL_LOAD_LENGTH 60 diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index c7d1f2c93..754ad3f74 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1518,14 +1518,7 @@ void mmu_continue_loading(bool blocking) if (blocking) { - KEEPALIVE_STATE(PAUSED_FOR_USER); - lcd_consume_click(); - while(!lcd_clicked()){ - manage_heater(); - manage_inactivity(true); - lcd_update(0); - } - KEEPALIVE_STATE(IN_HANDLER); + marlin_wait_for_click(); restore_print_from_ram_and_continue(0); mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); From 84cabd38366c610e7bfded2395f87cbc3d290752 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 5 Apr 2019 15:19:53 +0200 Subject: [PATCH 156/368] Change busy_state type, save 340B of flash --- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index fd6121a06..08f7b4f22 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -469,7 +469,7 @@ extern uint8_t calc_percent_done(); #define KEEPALIVE_STATE(n) do { busy_state = n;} while (0) extern void host_keepalive(); //extern MarlinBusyState busy_state; -extern int busy_state; +extern int8_t busy_state; #ifdef TMC2130 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b4aeef150..4ca05d182 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -303,7 +303,7 @@ int fanSpeed=0; bool cancel_heatup = false ; -int busy_state = NOT_BUSY; +int8_t busy_state = NOT_BUSY; static long prev_busy_signal_ms = -1; uint8_t host_keepalive_interval = HOST_KEEPALIVE_INTERVAL; @@ -9615,7 +9615,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) //! Set void marlin_wait_for_click() { - int busy_state_backup = busy_state; + int8_t busy_state_backup = busy_state; KEEPALIVE_STATE(PAUSED_FOR_USER); lcd_consume_click(); while(!lcd_clicked()) From 99d6c74999cacd4952aafc3b0390e4dfd20537fc Mon Sep 17 00:00:00 2001 From: Andrew Luebke Date: Fri, 5 Apr 2019 14:53:33 -0700 Subject: [PATCH 157/368] Fixed spelling errors in PF-build.sh --- PF-build.sh | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/PF-build.sh b/PF-build.sh index 7c1e26d42..faa5d9164 100644 --- a/PF-build.sh +++ b/PF-build.sh @@ -1,12 +1,12 @@ #!/bin/bash -# This bash script is used to compile automatically the Prusa firmware with a dedecated build enviroment and settings +# This bash script is used to compile automatically the Prusa firmware with a dedicated build environment and settings # # Supported OS: Windows 10, Linux64 bit # # Linux: # # Windows: -# To excecute this sciprt you gonna need few things on your Windows machine +# To execute this script you gonna need few things on your Windows machine # # Linux Subsystem Ubuntu # 1. Follow these instructions @@ -28,15 +28,15 @@ # 4. Run git Bash under Administrator privilege and navigate to the directory /c/Program Files/Git/mingw64/bin, # you can run the command ln -s /c/Program Files/7-Zip/7z.exe zip.exe # -# Usefull things to edit and compare your custom Firmware +# Useful things to edit and compare your custom Firmware # 1. Download and install current and correct (64bit or 32bit) Notepad++ version https://notepad-plus-plus.org/download # 2. Another great tool to compare your custom mod and stock firmware is WinMerge http://winmerge.org/downloads/?lang=en # -# Example for MK3: open git bash and chage to your Firmware directory +# Example for MK3: open git bash and change to your Firmware directory # @ MINGW64 //path # bash build.sh 1_75mm_MK3-EINSy10a-E3Dv6full # -# Example for MK25: open git bash and chage to your directory +# Example for MK25: open git bash and change to your directory # gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware/MK3 # bash build.sh 1_75mm_MK25-RAMBo13a-E3Dv6full # @@ -47,7 +47,7 @@ # Version: 1.0.1-Build_8 # Change log: # 12 Jan 2019, 3d-gussner, Fixed "compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" in 'platform.txt' -# 16 Jan 2019, 3d-gussner, Build_2, Added development check to modify 'Configuration.h' to prevent unwanted LCD messages that Firmware is uknown +# 16 Jan 2019, 3d-gussner, Build_2, Added development check to modify 'Configuration.h' to prevent unwanted LCD messages that Firmware is unknown # 17 Jan 2019, 3d-gussner, Build_3, Check for OS Windows or Linux and use the right build enviroment # 10 Feb 2019, ropaha, Pull Request, Select variant from list while using build.sh # 10 Feb 2019, ropaha, change FW_DEV_VERSION automatically depending on FW_VERSION RC/BETA/ALPHA @@ -96,7 +96,7 @@ else exit fi sleep 2 -###Prepare bash enviroment and check if wget and zip are availible +###Prepare bash enviroment and check if wget and zip are available if ! type wget > /dev/null; then echo "$(tput setaf 1)Missing 'wget' which is important to run this script" echo "Please follow these instructions https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058 to install wget$(tput sgr0)" @@ -139,7 +139,7 @@ fi cd ../build-env || exit 3 # Check if PF-build-env- exists and downloads + creates it if not -# The build enviroment is based on the Arduino IDE 1.8.5 portal vesion with some changes +# The build enviroment is based on the Arduino IDE 1.8.5 portal version with some changes if [ ! -d "../PF-build-env-$BUILD_ENV" ]; then echo "$(tput setaf 6)PF-build-env-$BUILD_ENV is missing ... creating it now for you$(tput sgr 0)" mkdir ../PF-build-env-$BUILD_ENV @@ -148,14 +148,14 @@ fi if [ $OSTYPE == "msys" ]; then if [ ! -f "PF-build-env-Win-$BUILD_ENV.zip" ]; then - echo "$(tput setaf 6)Downloding Windows build enviroment...$(tput setaf 2)" + echo "$(tput setaf 6)Downlaoding Windows build environment...$(tput setaf 2)" sleep 2 wget https://github.com/3d-gussner/PF-build-env/releases/download/Win-$BUILD_ENV/PF-build-env-Win-$BUILD_ENV.zip || exit 4 #cp -f ../../PF-build-env/PF-build-env-Win-$BUILD_ENV.zip PF-build-env-Win-$BUILD_ENV.zip || exit4 echo "$(tput sgr 0)" fi if [ ! -d "../PF-build-env-$BUILD_ENV/$OSTYPE" ]; then - echo "$(tput setaf 6)Unzipping Windows build enviroment...$(tput setaf 2)" + echo "$(tput setaf 6)Unzipping Windows build environment...$(tput setaf 2)" sleep 2 unzip PF-build-env-Win-$BUILD_ENV.zip -d ../PF-build-env-$BUILD_ENV/$OSTYPE || exit 4 echo "$(tput sgr0)" @@ -165,7 +165,7 @@ fi if [ $OSTYPE == "linux-gnu" ]; then if [ ! -f "PF-build-env-Linux64-$BUILD_ENV.zip" ]; then - echo "$(tput setaf 6)Downloading Linux 64 build enviroment...$(tput setaf 2)" + echo "$(tput setaf 6)Downloading Linux 64 build environment...$(tput setaf 2)" sleep 2 wget https://github.com/mkbel/PF-build-env/releases/download/$BUILD_ENV/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3 echo "$(tput sgr0)" @@ -180,9 +180,9 @@ if [ $OSTYPE == "linux-gnu" ]; then fi cd $SCRIPT_PATH -# First argument defines which varaint of the Prusa Firmware will be compiled +# First argument defines which variant of the Prusa Firmware will be compiled if [ -z "$1" ] ; then - # Select which varaint of the Prusa Firmware will be compiled, like + # Select which variant of the Prusa Firmware will be compiled, like PS3="Select a variant: " while IFS= read -r -d $'\0' f; do options[i++]="$f" @@ -248,7 +248,7 @@ else if [[ "$2" == "ALL" || "$2" == "EN_ONLY" ]] ; then LANGUAGES=$2 else - echo "$(tput setaf 1)Language agrument is wrong!$(tput sgr0)" + echo "$(tput setaf 1)Language argument is wrong!$(tput sgr0)" echo "Only $(tput setaf 2)'ALL'$(tput sgr0) or $(tput setaf 2)'EN_ONLY'$(tput sgr0) are allowed as 2nd argument!" exit fi @@ -270,7 +270,7 @@ BUILD_ENV_PATH="$( pwd -P )" cd ../.. -#Checkif BUILD_PATH exisits and if not creates it +#Checkif BUILD_PATH exists and if not creates it if [ ! -d "Prusa-Firmware-build" ]; then mkdir Prusa-Firmware-build || exit 6 fi @@ -286,7 +286,7 @@ do FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g') # Find build version in Configuration.h file and use it to generate the hex filename BUILD=$(grep --max-count=1 "\bFW_COMMIT_NR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3) - # Check if the motherboard is an EINSY and if so the only one hex file will generated + # Check if the motherboard is an EINSY and if so only one hex file will generated MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3) # Check development status DEV_CHECK=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g'|cut -d '-' -f2) @@ -333,22 +333,22 @@ do fi OUTPUT_FOLDER="Hex-files/FW$FW-Build$BUILD/$MOTHERBOARD" - #Check if exacly the same hexfile already exsits + #Check if exactly the same hexfile already exists if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex" && "$LANGUAGES" == "ALL" ]]; then echo "" ls -1 $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex | xargs -n1 basename - echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + echo "$(tput setaf 6)This hex file to be compiled already exists! To cancel this process press CRTL+C and rename existing hex file.$(tput sgr 0)" read -t 10 -p "Press Enter to continue..." elif [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex" && "$LANGUAGES" == "EN_ONLY" ]]; then echo "" ls -1 $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex | xargs -n1 basename - echo "$(tput setaf 6)This hex file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + echo "$(tput setaf 6)This hex file to be compiled already exists! To cancel this process press CRTL+C and rename existing hex file.$(tput sgr 0)" read -t 10 -p "Press Enter to continue..." fi if [[ -f "$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip" && "$LANGUAGES" == "ALL" ]]; then echo "" ls -1 $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip | xargs -n1 basename - echo "$(tput setaf 6)This zip file to be comiled already exsits! To cancle this process press CRTL+C and rename existing hex file.$(tput sgr 0)" + echo "$(tput setaf 6)This zip file to be compiled already exists! To cancel this process press CRTL+C and rename existing hex file.$(tput sgr 0)" read -t 10 -p "Press Enter to continue..." fi @@ -382,11 +382,11 @@ do #Prepare english only or multilanguage version to be build if [ $LANGUAGES == "ALL" ]; then echo " " - echo "Multi-language firmware will be build" + echo "Multi-language firmware will be built" echo " " else echo " " - echo "English only language firmware will be build" + echo "English only language firmware will be built" echo " " fi @@ -439,14 +439,14 @@ do if [ $LANGUAGES == "ALL" ]; then echo "$(tput setaf 2)" - echo "Building mutli language firmware" $MULTI_LANGUAGE_CHECK + echo "Building multi language firmware" $MULTI_LANGUAGE_CHECK echo "$(tput sgr 0)" sleep 2 cd $SCRIPT_PATH/lang echo "$(tput setaf 3)" ./config.sh || exit 15 echo "$(tput sgr 0)" - # Check if privious languages and firmware build exist and if so clean them up + # Check if previous languages and firmware build exist and if so clean them up if [ -f "lang_en.tmp" ]; then echo "" echo "$(tput setaf 6)Previous lang build files already exist these will be cleaned up in 10 seconds.$(tput sgr 0)" @@ -469,7 +469,7 @@ do # Combine compiled firmware with languages ./fw-build.sh || exit 17 echo "$(tput sgr 0)" - # Check if the motherboard is an EINSY and if so the only one hex file will generated + # Check if the motherboard is an EINSY and if so only one hex file will generated MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3) # If the motherboard is an EINSY just copy one hexfile if [ "$MOTHERBOARD" = "BOARD_EINSY_1_0a" ]; then From a6f10625c570dcabb01530a414c5f10e9bfd4ca7 Mon Sep 17 00:00:00 2001 From: Andrew Luebke Date: Fri, 5 Apr 2019 15:44:52 -0700 Subject: [PATCH 158/368] Found another mistake --- PF-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 PF-build.sh diff --git a/PF-build.sh b/PF-build.sh old mode 100644 new mode 100755 index faa5d9164..a7cc25a9e --- a/PF-build.sh +++ b/PF-build.sh @@ -148,7 +148,7 @@ fi if [ $OSTYPE == "msys" ]; then if [ ! -f "PF-build-env-Win-$BUILD_ENV.zip" ]; then - echo "$(tput setaf 6)Downlaoding Windows build environment...$(tput setaf 2)" + echo "$(tput setaf 6)Downloading Windows build environment...$(tput setaf 2)" sleep 2 wget https://github.com/3d-gussner/PF-build-env/releases/download/Win-$BUILD_ENV/PF-build-env-Win-$BUILD_ENV.zip || exit 4 #cp -f ../../PF-build-env/PF-build-env-Win-$BUILD_ENV.zip PF-build-env-Win-$BUILD_ENV.zip || exit4 From 32f34718624fc2bbed4412aa4f2b3d343a2a7ac6 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 9 Apr 2019 15:22:08 +0200 Subject: [PATCH 159/368] print parameters checking prusa_stat_diameter() --- Firmware/ultralcd.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 22e68aa2a..8e8c246e4 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -128,6 +128,7 @@ static void lcd_control_volumetric_menu(); static void lcd_settings_linearity_correction_menu_save(); static void prusa_stat_printerstatus(int _status); static void prusa_stat_farm_number(); +static void prusa_stat_diameter(); static void prusa_stat_temperatures(); static void prusa_stat_printinfo(); static void lcd_farm_no(); @@ -4107,6 +4108,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { SERIAL_ECHO("{"); prusa_stat_printerstatus(1); prusa_stat_farm_number(); + prusa_stat_diameter(); SERIAL_ECHOLN("}"); status_number = 1; } @@ -4261,6 +4263,12 @@ static void prusa_stat_farm_number() { SERIAL_ECHO("]"); } +static void prusa_stat_diameter() { + SERIAL_ECHO("[DIA:"); + SERIAL_ECHO(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)); + SERIAL_ECHO("]"); +} + static void prusa_stat_temperatures() { SERIAL_ECHO("[ST0:"); @@ -4296,6 +4304,7 @@ static void prusa_stat_printinfo() SERIAL_ECHO("][FWR:"); SERIAL_ECHO(FW_VERSION); SERIAL_ECHO("]"); + prusa_stat_diameter(); } /* From c7d403733a726ada83343e2dda23eb14b38a633b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 9 Apr 2019 20:50:29 +0200 Subject: [PATCH 160/368] Allow load filament retry after button push unlimited times in case mmu_continue_loading() is in blocking mode. --- Firmware/mmu.cpp | 147 +++++++++++++++++++++++++++++------------------ Firmware/mmu.h | 2 +- 2 files changed, 92 insertions(+), 57 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 754ad3f74..ef5b021c9 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1466,74 +1466,109 @@ static void load_more() st_synchronize(); } +static void increment_load_fail() +{ + uint8_t mmu_load_fail = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL); + uint16_t mmu_load_fail_tot = eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT); + if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1); + if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1); +} + +//! @brief continue loading filament //! @par blocking -//! * true blocking -//! * false non-blocking +//! * true blocking - do not return until successful load +//! * false non-blocking - pause print and return on load failure +//! +//! @startuml +//! [*] --> [*] : !ir_sensor_detected /\n send MmuCmd::C0 +//! [*] --> LoadMore +//! LoadMore --> [*] : filament \ndetected +//! LoadMore --> Retry : !filament detected /\n increment load fail +//! Retry --> [*] : filament \ndetected +//! Retry --> Unload : !filament \ndetected +//! Unload --> [*] : non-blocking +//! Unload --> Retry : button \nclicked +//! +//! Retry : Cut filament if enabled +//! Retry : repeat last T-code +//! Unload : unload filament +//! Unload : pause print +//! Unload : show error message +//! +//! @enduml void mmu_continue_loading(bool blocking) { - if (ir_sensor_detected) + if (!ir_sensor_detected) { - load_more(); + mmu_command(MmuCmd::C0); + return; + } - if (PIN_GET(IR_SENSOR_PIN) != 0) { - uint8_t mmu_load_fail = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL); - uint16_t mmu_load_fail_tot = eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT); - if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1); - if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1); + load_more(); + enum class Ls : uint_least8_t + { + enter, + retry, + unload, + }; + Ls state = Ls::enter; + + while (PIN_GET(IR_SENSOR_PIN) != 0) + { + switch (state) + { + case Ls::enter: + increment_load_fail(); + // no break + case Ls::retry: #ifdef MMU_HAS_CUTTER - if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) - { - mmu_command(MmuCmd::K0 + tmp_extruder); - manage_response(true, true, MMU_UNLOAD_MOVE); - } + if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + { + mmu_command(MmuCmd::K0 + tmp_extruder); + manage_response(true, true, MMU_UNLOAD_MOVE); + } #endif //MMU_HAS_CUTTER - mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); load_more(); + state = Ls::unload; + break; + case Ls::unload: + stop_and_save_print_to_ram(0, 0); - if (PIN_GET(IR_SENSOR_PIN) != 0) + //lift z + current_position[Z_AXIS] += Z_PAUSE_LIFT; + if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder); + st_synchronize(); + + //Move XY to side + current_position[X_AXIS] = X_PAUSE_POS; + current_position[Y_AXIS] = Y_PAUSE_POS; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder); + st_synchronize(); + + mmu_command(MmuCmd::U0); + manage_response(false, true, MMU_UNLOAD_MOVE); + + setAllTargetHotends(0); + lcd_setstatuspgm(_i("MMU load failed "));////c=20 r=1 + + if (blocking) { - //pause print, show error message and then repeat last T-code - stop_and_save_print_to_ram(0, 0); - - //lift z - current_position[Z_AXIS] += Z_PAUSE_LIFT; - if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder); - st_synchronize(); - - //Move XY to side - current_position[X_AXIS] = X_PAUSE_POS; - current_position[Y_AXIS] = Y_PAUSE_POS; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder); - st_synchronize(); - - mmu_command(MmuCmd::U0); - manage_response(false, true, MMU_UNLOAD_MOVE); - - setAllTargetHotends(0); - lcd_setstatuspgm(_i("MMU load failed "));////MSG_RECOVERING_PRINT c=20 r=1 - - if (blocking) - { - marlin_wait_for_click(); - restore_print_from_ram_and_continue(0); - mmu_command(MmuCmd::T0 + tmp_extruder); - manage_response(true, true, MMU_TCODE_MOVE); - load_more(); - } - else - { - mmu_fil_loaded = false; //so we can retry same T-code again - isPrintPaused = true; - mmu_command(MmuCmd::W0); - } + marlin_wait_for_click(); + restore_print_from_ram_and_continue(0); + state = Ls::retry; } - } - } - else { //mmu_ir_sensor_detected == false - mmu_command(MmuCmd::C0); - } + else + { + mmu_fil_loaded = false; //so we can retry same T-code again + isPrintPaused = true; + mmu_command(MmuCmd::W0); + return; + } + break; + } + } } diff --git a/Firmware/mmu.h b/Firmware/mmu.h index f0fc0deb0..a7da0c2d9 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -58,7 +58,7 @@ enum class MmuCmd : uint_least8_t K4, R0, S3, - W0, + W0, //!< Wait and signal load error }; inline MmuCmd operator+ (MmuCmd cmd, uint8_t filament) From b5f196406e344c8ef2148a105a5f3171abb4dc69 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 10 Apr 2019 00:29:58 +0200 Subject: [PATCH 161/368] (preliminary) fix @ preHeatError II --- Firmware/temperature.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 197237f46..e432d028a 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1240,6 +1240,7 @@ void setWatch() #if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0) void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed) { + float __delta; float __hysteresis = 0; int __timeout = 0; bool temp_runaway_check_active = false; @@ -1299,9 +1300,20 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren SERIAL_ECHOPGM(" T:"); MYSERIAL.print(_current_temperature); SERIAL_ECHOPGM(" Tstart:"); - MYSERIAL.print(__preheat_start[_heater_id]);*/ + MYSERIAL.print(__preheat_start[_heater_id]); + SERIAL_ECHOPGM(" delta:"); + MYSERIAL.print(_current_temperature-__preheat_start[_heater_id]);*/ - if (_current_temperature - __preheat_start[_heater_id] < ((_isbed &&(_current_temperature>105.0))?0.6:2.0)) { +//-// if (_current_temperature - __preheat_start[_heater_id] < 2) { +//-// if (_current_temperature - __preheat_start[_heater_id] < ((_isbed && (_current_temperature>105.0))?0.6:2.0)) { + __delta=2.0; + if(_isbed) + { + __delta=3.0; + if(_current_temperature>90.0) __delta=2.0; + if(_current_temperature>105.0) __delta=0.6; + } + if (_current_temperature - __preheat_start[_heater_id] < __delta) { __preheat_errors[_heater_id]++; /*SERIAL_ECHOPGM(" Preheat errors:"); MYSERIAL.println(__preheat_errors[_heater_id]);*/ @@ -1322,10 +1334,15 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren } } - if (_current_temperature >= _target_temperature && temp_runaway_status[_heater_id] == TempRunaway_PREHEAT) +//-// if (_current_temperature >= _target_temperature && temp_runaway_status[_heater_id] == TempRunaway_PREHEAT) + if ((_current_temperature > (_target_temperature - __hysteresis)) && temp_runaway_status[_heater_id] == TempRunaway_PREHEAT) { + /*SERIAL_ECHOPGM("Heater:"); + MYSERIAL.print(_heater_id); + MYSERIAL.println(" ->tempRunaway");*/ temp_runaway_status[_heater_id] = TempRunaway_ACTIVE; temp_runaway_check_active = false; + temp_runaway_error_counter[_heater_id] = 0; } if (_output > 0) From 8a33663f64cf45b844c16a7418a3f7a126e17468 Mon Sep 17 00:00:00 2001 From: mkbel <35807926+mkbel@users.noreply.github.com> Date: Mon, 15 Apr 2019 02:47:25 +0200 Subject: [PATCH 162/368] Update README.md --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 798df4fa6..f8575e3a6 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ * [Using Git-bash](#using-git-bash-under-windows-10-64-bit) * [Automated tests](#3-automated-tests) * [Documentation](#4-documentation) + * [FAQ](#5-faq) @@ -170,3 +171,20 @@ Example: # 4. Documentation run [doxygen](http://www.doxygen.nl/) in Firmware folder + +# 5. FAQ +Q:I built firmware using Arduino and I see "?" instead of numbers in printer user interface. + +A:Step 1.c was ommited or you updated Arduino and now platform.txt located somewhere in your user profile is used. + +Q:I built firmware using Arduino and printer now speaks Klingon (nonsense characters and symbols are displayed @^#$&*°;~ÿ) + +A:Step 2.c was omitted. + +Q:What environment does Prusa use to build the firmware in the first place? + +A:Our production builds are 99.9% equivalent to https://github.com/prusa3d/Prusa-Firmware#linux this is also easiest way to build as only one step is needed - run single script, which downloads patched Arduino from github, builds using it, then extracts translated strings and creates language variants (for MK2x) or language hex file for external SPI flash (MK3x). But you need Linux or Linux in virtual machine. This is also what happens when you open pull request to our repository - all variants are built by Travis http://travis-ci.org/ (to check for compilation errors). You can see, what is happening in .travis.yml. It would be also possible to get hex built by travis, only deploy step is missing in .travis.yml. You can get inspiration how to deploy hex by travis and how to setup travis in https://github.com/prusa3d/MM-control-01/ repository. Final hex is located in ./lang/firmware.hex Community reproduced this for Windows in https://github.com/prusa3d/Prusa-Firmware#using-linux-subsystem-under-windows-10-64-bit or https://github.com/prusa3d/Prusa-Firmware#using-git-bash-under-windows-10-64-bit . + +Q:Why are build instructions for Arduino mess. + +Y:We are too lazy to ship proper board definition for Arduino. We plan to swich to cmake + ninja to be inherently multiplatform, easily integrate build tools, suport more IDEs, get 10 times shorter build times and be able to update compiler whenewer we want. From 1f9737b4a676db6474fdcfd0cd1b0565010fc0ef Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 16 Apr 2019 16:48:01 +0200 Subject: [PATCH 163/368] Bed high frequency PWM disabled --- Firmware/system_timer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/system_timer.h b/Firmware/system_timer.h index 98647660d..d4fbfc39b 100644 --- a/Firmware/system_timer.h +++ b/Firmware/system_timer.h @@ -4,7 +4,7 @@ #define FIRMWARE_SYSTEM_TIMER_H_ #include "Arduino.h" -#define SYSTEM_TIMER_2 +//#define SYSTEM_TIMER_2 #ifdef SYSTEM_TIMER_2 #include "timer02.h" From 75fac9dab2c365f6ac1f722c47c68381d708981d Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Apr 2019 22:20:53 +0200 Subject: [PATCH 164/368] Do not kill printer if External SPI flash W25X20CL is not responding. Remove internationalization macro for this message. It has no sense to be translated as internationalization in most cases doesn't work if it is not responding. Show this message instead of splash screen if the error is encountered. There is no additional delay or wait for click, as such functions doesn't work in setup function. --- Firmware/Marlin_main.cpp | 41 +++++++++++++++++++++++----------- Firmware/lcd.h | 14 ++++-------- Firmware/optiboot_w25x20cl.cpp | 2 ++ 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 4ca05d182..e23ca37e8 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -977,6 +977,12 @@ void list_sec_lang_from_external_flash() #endif //(LANG_MODE != 0) +static void w25x20cl_err_msg() +{ + lcd_puts_P(_n(ESC_2J ESC_H(0,0) "External SPI flash" ESC_H(0,1) "W25X20CL is not res-" + ESC_H(0,2) "ponding. Language" ESC_H(0,3) "switch unavailable.")); +} + // "Setup" function is called by the Arduino framework on startup. // Before startup, the Timers-functions (PWM)/Analog RW and HardwareSerial provided by the Arduino-code // are initialized by the main() routine provided by the Arduino framework. @@ -993,21 +999,25 @@ void setup() spi_init(); lcd_splash(); - Sound_Init(); // also guarantee "SET_OUTPUT(BEEPER)" + Sound_Init(); // also guarantee "SET_OUTPUT(BEEPER)" #ifdef W25X20CL - if (!w25x20cl_init()) - kill(_i("External SPI flash W25X20CL not responding.")); - // Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory. - optiboot_w25x20cl_enter(); -#endif - + bool w25x20cl_success = w25x20cl_init(); + if (w25x20cl_success) + { + optiboot_w25x20cl_enter(); #if (LANG_MODE != 0) //secondary language support -#ifdef W25X20CL - if (w25x20cl_init()) - update_sec_lang_from_external_flash(); -#endif //W25X20CL + update_sec_lang_from_external_flash(); #endif //(LANG_MODE != 0) + } + else + { + w25x20cl_err_msg(); + } +#else + const bool w25x20cl_success = true; +#endif //W25X20CL + setup_killpin(); setup_powerhold(); @@ -1213,12 +1223,17 @@ void setup() tp_init(); // Initialize temperature loop - lcd_splash(); // we need to do this again, because tp_init() kills lcd + if (w25x20cl_success) lcd_splash(); // we need to do this again, because tp_init() kills lcd + else + { + w25x20cl_err_msg(); + printf_P(_n("W25X20CL not responding.\n")); + } plan_init(); // Initialize planner; factory_reset(); - lcd_encoder_diff=0; + lcd_encoder_diff=0; #ifdef TMC2130 uint8_t silentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); diff --git a/Firmware/lcd.h b/Firmware/lcd.h index 12935188a..9f3eb5c13 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -64,23 +64,17 @@ extern void lcd_print(long, int = 10); extern void lcd_print(unsigned long, int = 10); extern void lcd_print(double, int = 2); +//! @brief Clear screen #define ESC_2J "\x1b[2J" #define ESC_25h "\x1b[?25h" #define ESC_25l "\x1b[?25l" +//! @brief Set cursor to +//! @param c column +//! @param r row #define ESC_H(c,r) "\x1b["#r";"#c"H" - - - - - - - - - - #define LCD_UPDATE_INTERVAL 100 #define LCD_TIMEOUT_TO_STATUS 30000ul //!< Generic timeout to status screen in ms, when no user action. #define LCD_TIMEOUT_TO_STATUS_BABYSTEP_Z 90000ul //!< Specific timeout for lcd_babystep_z screen in ms. diff --git a/Firmware/optiboot_w25x20cl.cpp b/Firmware/optiboot_w25x20cl.cpp index dad697ea2..e84bf639c 100644 --- a/Firmware/optiboot_w25x20cl.cpp +++ b/Firmware/optiboot_w25x20cl.cpp @@ -1,3 +1,4 @@ +//! @file // Based on the OptiBoot project // https://github.com/Optiboot/optiboot // Licence GLP 2 or later. @@ -97,6 +98,7 @@ static const char entry_magic_cfm [] PROGMEM = "w25x20cl_cfm\n"; struct block_t; extern struct block_t *block_buffer; +//! @brief Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory. void optiboot_w25x20cl_enter() { if (boot_app_flags & BOOT_APP_FLG_USER0) return; From f25f8f1b71071d4e17210b7e2e25c5a6e956ffdd Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 23 Apr 2019 19:39:49 +0200 Subject: [PATCH 165/368] Do not compile timer02.c if not used. Saves 148B flash. --- Firmware/timer02.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Firmware/timer02.c b/Firmware/timer02.c index 8309f9401..792f3aef1 100644 --- a/Firmware/timer02.c +++ b/Firmware/timer02.c @@ -2,6 +2,9 @@ // use atmega timer2 as main system timer instead of timer0 // timer0 is used for fast pwm (OC0B output) // original OVF handler is disabled + +#ifdef SYSTEM_TIMER_2 + #include #include #include "Arduino.h" @@ -166,3 +169,5 @@ void noTone2(__attribute__((unused)) uint8_t _pin) { PIN_CLR(BEEPER); } + +#endif //SYSTEM_TIMER_2 From 1d8b2b3e183a88c20ac59dea0f8bdbd87fe1a233 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Wed, 24 Apr 2019 15:22:17 +0200 Subject: [PATCH 166/368] Secondary language reserved space resized --- Firmware/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/config.h b/Firmware/config.h index 7c4341dc0..e606e1de4 100644 --- a/Firmware/config.h +++ b/Firmware/config.h @@ -45,7 +45,7 @@ //LANG - Multi-language support //#define LANG_MODE 0 // primary language only #define LANG_MODE 1 // sec. language support -#define LANG_SIZE_RESERVED 0x2f00 // reserved space for secondary language (12032 bytes) +#define LANG_SIZE_RESERVED 0x2b00 // reserved space for secondary language (12032 bytes) #endif //_CONFIG_H From e8e7fa907fd6337f32bcc3cb6d34ec5d516f27c0 Mon Sep 17 00:00:00 2001 From: mkbel <35807926+mkbel@users.noreply.github.com> Date: Wed, 24 Apr 2019 15:52:24 +0200 Subject: [PATCH 167/368] Change comment --- Firmware/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/config.h b/Firmware/config.h index e606e1de4..24a77dc49 100644 --- a/Firmware/config.h +++ b/Firmware/config.h @@ -45,7 +45,7 @@ //LANG - Multi-language support //#define LANG_MODE 0 // primary language only #define LANG_MODE 1 // sec. language support -#define LANG_SIZE_RESERVED 0x2b00 // reserved space for secondary language (12032 bytes) +#define LANG_SIZE_RESERVED 0x2b00 // reserved space for secondary language (11008 bytes) #endif //_CONFIG_H From 3274794908d8ad4238079c9e2f251ea18a728a42 Mon Sep 17 00:00:00 2001 From: cimoalpacino <41801135+cimoalpacino@users.noreply.github.com> Date: Sun, 21 Apr 2019 21:40:09 +0200 Subject: [PATCH 168/368] Add filepath to platform.txt for windows users --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f8575e3a6..f2176a544 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,9 @@ _(after installation, the item is labeled as `"INSTALLED"` and can then be used c. modify platform.txt to enable float printf support: add "-Wl,-u,vfprintf -lprintf_flt -lm" to "compiler.c.elf.flags=" before existing flag "-Wl,--gc-sections" example: -`"compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections"` +`"compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections"` +For Windows users, the file can be found at: +"C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\avr\(version)" #### 2. Source code compilation From a8e62007ca29b67980b916f730156a4daeb766f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20B=C4=9Bl?= <35807926+mkbel@users.noreply.github.com> Date: Thu, 25 Apr 2019 07:25:11 +0200 Subject: [PATCH 169/368] Make platform.txt location more clear. Do not mention Windows, as it is already in Windows section. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f2176a544..8c37ff7c2 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,9 @@ _(after installation, the item is labeled as `"INSTALLED"` and can then be used add "-Wl,-u,vfprintf -lprintf_flt -lm" to "compiler.c.elf.flags=" before existing flag "-Wl,--gc-sections" example: `"compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections"` -For Windows users, the file can be found at: +The file can be found in Arduino instalation directory, or after Arduino has been updated at: "C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\avr\(version)" +If you can locate the file in both places, file from user profile is probably used. #### 2. Source code compilation From f17af8c7bfb0ca0065a04a5d134dcf2e88321797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20B=C4=9Bl?= <35807926+mkbel@users.noreply.github.com> Date: Thu, 25 Apr 2019 07:48:24 +0200 Subject: [PATCH 170/368] Update README.md Remove spaces in the end of line. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c37ff7c2..ea649fe42 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ _(after installation, the item is labeled as `"INSTALLED"` and can then be used c. modify platform.txt to enable float printf support: add "-Wl,-u,vfprintf -lprintf_flt -lm" to "compiler.c.elf.flags=" before existing flag "-Wl,--gc-sections" example: -`"compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections"` +`"compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections"` The file can be found in Arduino instalation directory, or after Arduino has been updated at: "C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\avr\(version)" If you can locate the file in both places, file from user profile is probably used. From f16bea26e5cc360086194d152af6ccf027731c07 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Thu, 25 Apr 2019 17:34:52 +0200 Subject: [PATCH 171/368] raise the Z axis before filament loading to nozzle on MMU2S --- Firmware/mmu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index ef5b021c9..b7746f2d5 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1367,6 +1367,7 @@ bFilamentAction=false; // NOT in "mmu_load_to_nozzle_ manage_response(true, true, MMU_TCODE_MOVE); mmu_continue_loading(false); mmu_extruder = tmp_extruder; //filament change is finished + if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; mmu_load_to_nozzle(); load_filament_final_feed(); st_synchronize(); From 18dec75b560f78b91388d61c0fe67d94e41e5c00 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Mon, 29 Apr 2019 13:19:59 +0200 Subject: [PATCH 172/368] MK2.5 - watchdog enabled + test (command "D-1") --- Firmware/Dcodes.cpp | 8 ++++---- Firmware/Marlin_main.cpp | 4 ++-- Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 3 +++ Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 3 +++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Firmware/Dcodes.cpp b/Firmware/Dcodes.cpp index 44dfc4654..d2016ded5 100644 --- a/Firmware/Dcodes.cpp +++ b/Firmware/Dcodes.cpp @@ -176,15 +176,15 @@ extern float axis_steps_per_unit[NUM_AXIS]; #endif //0 #define LOG(args...) -#ifdef DEBUG_DCODES - void dcode__1() { - printf("D-1 - Endless loop\n"); - cli(); + printf_P(PSTR("D-1 - Endless loop\n")); +// cli(); while (1); } +#ifdef DEBUG_DCODES + void dcode_0() { if (*(strchr_pointer + 1) == 0) return; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index e23ca37e8..bb13f673a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3538,7 +3538,7 @@ void process_commands() else if (code_seen("RESET")) { //! PRUSA RESET // careful! if (farm_mode) { -#ifdef WATCHDOG +#if (defined(WATCHDOG) && (MOTHERBOARD == BOARD_EINSY_1_0a)) boot_app_magic = BOOT_APP_MAGIC; boot_app_flags = BOOT_APP_FLG_RUN; wdt_enable(WDTO_15MS); @@ -7174,9 +7174,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) { switch((int)code_value()) { -#ifdef DEBUG_DCODES case -1: //! D-1 - Endless loop dcode__1(); break; +#ifdef DEBUG_DCODES case 0: //! D0 - Reset dcode_0(); break; case 1: //! D1 - Clear EEPROM diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index b5e9c1af0..f1d2c785c 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -103,6 +103,9 @@ // New XYZ calibration #define NEW_XYZCAL +// Watchdog support +#define WATCHDOG + // Fan check #define FANCHECK diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 05b5e0923..ac21da414 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -104,6 +104,9 @@ // New XYZ calibration #define NEW_XYZCAL +// Watchdog support +#define WATCHDOG + // Fan check #define FANCHECK From b93f37ee02e87f8255787acf0dee8e8c3410f3e3 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 29 Apr 2019 14:39:19 +0200 Subject: [PATCH 173/368] "stop" immediately after "pause" patch --- Firmware/ultralcd.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e06824f13..7645ec8f0 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1046,8 +1046,11 @@ void lcd_commands() { lcd_setstatuspgm(_i("Print paused"));////MSG_PRINT_PAUSED c=20 r=1 long_pause(); - lcd_commands_type = 0; - lcd_commands_step = 0; + if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) // !!! because "lcd_commands_type" can be changed during/inside "long_pause()" + { + lcd_commands_type = 0; + lcd_commands_step = 0; + } } } From 8fadbf1b4407c556f006807946865409016a4126 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 29 Apr 2019 16:41:38 +0200 Subject: [PATCH 174/368] Do not call watchdog reset from updateTemperaturesFromRawValues(). --- Firmware/temperature.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index e432d028a..45256bf42 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1046,11 +1046,6 @@ static void updateTemperaturesFromRawValues() redundant_temperature = analog2temp(redundant_temperature_raw, 1); #endif - //Reset the watchdog after we know we have a temperature measurement. -#ifdef WATCHDOG - wdt_reset(); -#endif //WATCHDOG - CRITICAL_SECTION_START; temp_meas_ready = false; CRITICAL_SECTION_END; From 3852aa427536a9abe8944bca85567edf2ac03138 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 30 Apr 2019 12:42:18 +0200 Subject: [PATCH 175/368] Different secondary language reserved space for MK3 and MK25 --- Firmware/config.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Firmware/config.h b/Firmware/config.h index 24a77dc49..ca70dbccc 100644 --- a/Firmware/config.h +++ b/Firmware/config.h @@ -42,10 +42,18 @@ #define W25X20CL_SPCR SPI_SPCR(W25X20CL_SPI_RATE, 1, 1, 1, 0) #define W25X20CL_SPSR SPI_SPSR(W25X20CL_SPI_RATE) +#include "boards.h" +#include "Configuration_prusa.h" + //LANG - Multi-language support //#define LANG_MODE 0 // primary language only #define LANG_MODE 1 // sec. language support + +#if (MOTHERBOARD == BOARD_EINSY_1_0a) #define LANG_SIZE_RESERVED 0x2b00 // reserved space for secondary language (11008 bytes) +#else //MOTHERBOARD == BOARD_EINSY_1_0a +#define LANG_SIZE_RESERVED 0x2d00 // reserved space for secondary language (11520 bytes) +#endif //MOTHERBOARD == BOARD_EINSY_1_0a #endif //_CONFIG_H From e5911c42da8c313c83c29d99b0cfbb9e57a76f09 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 6 May 2019 12:44:36 +0200 Subject: [PATCH 176/368] limit printed menu text to max 18 characters --- Firmware/menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 Firmware/menu.cpp diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp old mode 100644 new mode 100755 index fd11a370d..a07438389 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -171,7 +171,7 @@ int menu_draw_item_printf_P(char type_char, const char* format, ...) static int menu_draw_item_puts_P(char type_char, const char* str) { lcd_set_cursor(0, menu_row); - int cnt = lcd_printf_P(PSTR("%c%-18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); + int cnt = lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); return cnt; } From 1c9d134c620642f310202ca133a3e9e0eeed0cee Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Mon, 6 May 2019 15:29:57 +0200 Subject: [PATCH 177/368] return with exitcode 1 if any language not generated properly fix - include system_timer.h --- Firmware/timer02.c | 2 ++ lang/fw-build.sh | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Firmware/timer02.c b/Firmware/timer02.c index 792f3aef1..e0a0a5a67 100644 --- a/Firmware/timer02.c +++ b/Firmware/timer02.c @@ -3,6 +3,8 @@ // timer0 is used for fast pwm (OC0B output) // original OVF handler is disabled +#include "system_timer.h" + #ifdef SYSTEM_TIMER_2 #include diff --git a/lang/fw-build.sh b/lang/fw-build.sh index 5f93e8c66..a6ac58792 100755 --- a/lang/fw-build.sh +++ b/lang/fw-build.sh @@ -136,32 +136,32 @@ else if [ -e lang_cz.bin ]; then echo -n " Czech : " >&2 ./update_lang.sh cz 2>./update_lang_cz.out 1>/dev/null - if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; fi + if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; finish 1; fi fi if [ -e lang_de.bin ]; then echo -n " German : " >&2 ./update_lang.sh de 2>./update_lang_de.out 1>/dev/null - if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; fi + if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; finish 1; fi fi if [ -e lang_it.bin ]; then echo -n " Italian: " >&2 ./update_lang.sh it 2>./update_lang_it.out 1>/dev/null - if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; fi + if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; finish 1; fi fi if [ -e lang_es.bin ]; then echo -n " Spanish: " >&2 ./update_lang.sh es 2>./update_lang_es.out 1>/dev/null - if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; fi + if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; finish 1; fi fi if [ -e lang_fr.bin ]; then echo -n " French : " >&2 ./update_lang.sh fr 2>./update_lang_fr.out 1>/dev/null - if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; fi + if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; finish 1; fi fi if [ -e lang_pl.bin ]; then echo -n " Polish : " >&2 ./update_lang.sh pl 2>./update_lang_pl.out 1>/dev/null - if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; fi + if [ $? -eq 0 ]; then echo 'OK' >&2; else echo 'NG!' >&2; finish 1; fi fi # echo "skipped" >&2 fi From 079443020801a10f12633c5aae31c6af088dd912 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 6 May 2019 15:33:13 +0200 Subject: [PATCH 178/368] Fix for linearity correction not being stored to EEPROM when doing MENU- UP --- Firmware/menu.h | 3 +++ Firmware/ultralcd.cpp | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) mode change 100644 => 100755 Firmware/menu.h mode change 100644 => 100755 Firmware/ultralcd.cpp diff --git a/Firmware/menu.h b/Firmware/menu.h old mode 100644 new mode 100755 index efe2220c4..fe183d220 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -81,6 +81,9 @@ extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu); #define MENU_ITEM_BACK_P(str) do { if (menu_item_back_P(str)) return; } while (0) extern uint8_t menu_item_back_P(const char* str); +// leaving menu - this condition must be immediately before MENU_ITEM_BACK_P +#define ON_MENU_LEAVE(func) if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving){ func } + #define MENU_ITEM_FUNCTION_P(str, func) do { if (menu_item_function_P(str, func)) return; } while (0) extern uint8_t menu_item_function_P(const char* str, menu_func_t func); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp old mode 100644 new mode 100755 index 7645ec8f0..1511e87cb --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3346,15 +3346,14 @@ void lcd_adjust_bed(void) } MENU_BEGIN(); // leaving menu - this condition must be immediately before MENU_ITEM_BACK_P - if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving) - { + ON_MENU_LEAVE( eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_LEFT, _md->left); eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_RIGHT, _md->right); eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_FRONT, _md->front); eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_REAR, _md->rear); eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1); - } - MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); + ) + MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); MENU_ITEM_EDIT_int3_P(_i("Left side [um]"), &_md->left, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_LEFT c=14 r=1 MENU_ITEM_EDIT_int3_P(_i("Right side[um]"), &_md->right, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_RIGHT c=14 r=1 MENU_ITEM_EDIT_int3_P(_i("Front side[um]"), &_md->front, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_FRONT c=14 r=1 @@ -5160,6 +5159,9 @@ void lcd_wizard(WizState state) void lcd_settings_linearity_correction_menu(void) { MENU_BEGIN(); + ON_MENU_LEAVE( + lcd_settings_linearity_correction_menu_save(); + ) MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); #ifdef TMC2130_LINEARITY_CORRECTION_XYZ //tmc2130_wave_fac[X_AXIS] @@ -5170,10 +5172,10 @@ void lcd_settings_linearity_correction_menu(void) #endif //TMC2130_LINEARITY_CORRECTION_XYZ MENU_ITEM_EDIT_int3_P(_i("E-correct"), &tmc2130_wave_fac[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 r=0 MENU_END(); - if(menu_leaving) - { - lcd_settings_linearity_correction_menu_save(); - } +// if(menu_leaving) +// { +// lcd_settings_linearity_correction_menu_save(); +// } } #endif // TMC2130 From 41a827fa00314d9dd4e54eb8ab70656d285bf561 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Mon, 6 May 2019 17:24:06 +0200 Subject: [PATCH 179/368] Removed unused texts, increased reserved space to 0x2e00 (11776 bytes) --- Firmware/config.h | 4 +- lang/lang_en.txt | 78 --------------------------------- lang/lang_en_cz.txt | 104 -------------------------------------------- lang/lang_en_de.txt | 104 -------------------------------------------- lang/lang_en_es.txt | 104 -------------------------------------------- lang/lang_en_fr.txt | 104 -------------------------------------------- lang/lang_en_it.txt | 104 -------------------------------------------- lang/lang_en_pl.txt | 104 -------------------------------------------- 8 files changed, 2 insertions(+), 704 deletions(-) diff --git a/Firmware/config.h b/Firmware/config.h index ca70dbccc..e8ce4d324 100644 --- a/Firmware/config.h +++ b/Firmware/config.h @@ -50,9 +50,9 @@ #define LANG_MODE 1 // sec. language support #if (MOTHERBOARD == BOARD_EINSY_1_0a) -#define LANG_SIZE_RESERVED 0x2b00 // reserved space for secondary language (11008 bytes) +#define LANG_SIZE_RESERVED 0x2e00 // reserved space for secondary language (11776 bytes) #else //MOTHERBOARD == BOARD_EINSY_1_0a -#define LANG_SIZE_RESERVED 0x2d00 // reserved space for secondary language (11520 bytes) +#define LANG_SIZE_RESERVED 0x2e00 // reserved space for secondary language (11776 bytes) #endif //MOTHERBOARD == BOARD_EINSY_1_0a diff --git a/lang/lang_en.txt b/lang/lang_en.txt index cea52bd33..012e4f752 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -76,12 +76,6 @@ #MSG_BED_LEVELING_FAILED_POINT_LOW c=20 r=4 "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." -#MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 -"Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset." - -#MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 -"Bed leveling failed. Sensor triggered too high. Waiting for reset." - #MSG_BED c=0 r=0 "Bed" @@ -121,9 +115,6 @@ # "Cancel" -#MSG_SD_INSERTED c=0 r=0 -"Card inserted" - #MSG_SD_REMOVED c=0 r=0 "Card removed" @@ -214,21 +205,6 @@ #MSG_ERROR c=0 r=0 "ERROR:" -# -"External SPI flash W25X20CL not responding." - -# -"Extruder 1" - -# -"Extruder 2" - -# -"Extruder 3" - -# -"Extruder 4" - #MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 "Extruder fan:" @@ -268,9 +244,6 @@ #MSG_FSENSOR_ON c=0 r=0 "Fil. sensor [on]" -#MSG_RESPONSE_POOR c=20 r=2 -"Fil. sensor response is poor, disable it?" - #MSG_FSENSOR_NA c=0 r=0 "Fil. sensor [N/A]" @@ -289,9 +262,6 @@ #MSG_FILAMENT_SENSOR c=20 r=0 "Filament sensor" -#MSG_SELFTEST_FILAMENT_SENSOR c=18 r=0 -"Filament sensor:" - #MSG_FILAMENT_USED c=19 r=1 "Filament used" @@ -346,9 +316,6 @@ #MSG_PRUSA3D_HOWTO c=0 r=0 "howto.prusa3d.com" -# -"Change extruder" - #MSG_FILAMENTCHANGE c=0 r=0 "Change filament" @@ -397,24 +364,9 @@ #MSG_WIZARD_V2_CAL_2 c=20 r=12 "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 -"Improving bed calibration point" - #MSG_WATCH c=0 r=0 "Info screen" -#MSG_FILAMENT_LOADING_T0 c=20 r=4 -"Insert filament into extruder 1. Click when done." - -#MSG_FILAMENT_LOADING_T1 c=20 r=4 -"Insert filament into extruder 2. Click when done." - -#MSG_FILAMENT_LOADING_T2 c=20 r=4 -"Insert filament into extruder 3. Click when done." - -#MSG_FILAMENT_LOADING_T3 c=20 r=4 -"Insert filament into extruder 4. Click when done." - # "Is filament 1 loaded?" @@ -433,9 +385,6 @@ #MSG_STEEL_SHEET_CHECK c=20 r=2 "Is steel sheet on heatbed?" -#MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 r=0 -"Iteration " - # "Last print failures" @@ -562,9 +511,6 @@ # "New firmware version available:" -# -"No " - #MSG_SELFTEST_FAN_NO c=19 r=0 "Not spinning" @@ -703,12 +649,6 @@ # "Print FAN" -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK2.5 ready." - -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK3 ready." - #MSG_PRUSA3D c=0 r=0 "prusa3d.com" @@ -724,9 +664,6 @@ # "Prusa i3 MK3S OK." -# -"Prusa i3 MK2 ready." - #MSG_CALIBRATE_BED_RESET c=0 r=0 "Reset XYZ calibr." @@ -802,12 +739,6 @@ # "Sensor state" -# -"Sensors info" - -# -"Show pinda state" - #MSG_FILE_CNT c=20 r=4 "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100." @@ -907,9 +838,6 @@ # "Unload" -# -"Unload all" - # "Total failures" @@ -997,9 +925,6 @@ #MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR c=20 r=8 "XYZ calibration compromised. Right front calibration point not reachable." -#MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR c=20 r=8 -"XYZ calibration compromised. Left front calibration point not reachable." - #MSG_LOAD_ALL c=17 r=0 "Load all" @@ -1012,9 +937,6 @@ # "XYZ calibration failed. Front calibration points not reachable." -# -"XYZ calibration failed. Left front calibration point not reachable." - #MSG_LOAD_FILAMENT_2 c=17 r=0 "Load filament 2" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 85f8ffab7..8f295f9eb 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -102,14 +102,6 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Kalibrace Z selhala. Sensor nesepnul. Znecistena tryska? Cekam na reset." -#MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 -"Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset." -"Kalibrace Z selhala. Sensor je odpojeny nebo preruseny kabel. Cekam na reset." - -#MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 -"Bed leveling failed. Sensor triggered too high. Waiting for reset." -"Kalibrace Z selhala. Sensor sepnul prilis vysoko. Cekam na reset." - #MSG_BED c=0 r=0 "Bed" "Podlozka" @@ -162,10 +154,6 @@ "Cancel" "Zrusit" -#MSG_SD_INSERTED c=0 r=0 -"Card inserted" -"Karta vlozena" - #MSG_SD_REMOVED c=0 r=0 "Card removed" "Karta vyjmuta" @@ -286,26 +274,6 @@ "ERROR:" "CHYBA:" -# -"External SPI flash W25X20CL not responding." -"Externi SPI flash W25X20CL neodpovida." - -# -"Extruder 1" -"\x00" - -# -"Extruder 2" -"\x00" - -# -"Extruder 3" -"\x00" - -# -"Extruder 4" -"\x00" - #MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 "Extruder fan:" "Levy vent.:" @@ -358,10 +326,6 @@ "Fil. sensor [on]" "Fil. senzor [zap]" -#MSG_RESPONSE_POOR c=20 r=2 -"Fil. sensor response is poor, disable it?" -"Senzor nerozpoznal filament, vypnout?" - #MSG_FSENSOR_NA c=0 r=0 "Fil. sensor [N/A]" "Fil. senzor [N/A]" @@ -386,10 +350,6 @@ "Filament sensor" "Senzor filamentu" -#MSG_SELFTEST_FILAMENT_SENSOR c=18 r=0 -"Filament sensor:" -"Senzor filamentu:" - #MSG_FILAMENT_USED c=19 r=1 "Filament used" "Spotrebovano filamentu" @@ -462,10 +422,6 @@ "howto.prusa3d.com" "\x00" -# -"Change extruder" -"Zmenit extruder" - #MSG_FILAMENTCHANGE c=0 r=0 "Change filament" "Vymenit filament" @@ -530,30 +486,10 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Zacnu tisknout linku a Vy budete postupne snizovat trysku otacenim tlacitka dokud nedosahnete optimalni vysky. Prohlednete si obrazky v nasi prirucce v kapitole Kalibrace." -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 -"Improving bed calibration point" -"Zlepsuji presnost kalibracniho bodu" - #MSG_WATCH c=0 r=0 "Info screen" "Informace" -#MSG_FILAMENT_LOADING_T0 c=20 r=4 -"Insert filament into extruder 1. Click when done." -"Vlozte filament do extruderu 1. Potvrdte tlacitkem." - -#MSG_FILAMENT_LOADING_T1 c=20 r=4 -"Insert filament into extruder 2. Click when done." -"Vlozte filament do extruderu 2. Potvrdte tlacitkem." - -#MSG_FILAMENT_LOADING_T2 c=20 r=4 -"Insert filament into extruder 3. Click when done." -"Vlozte filament do extruderu 3. Potvrdte tlacitkem." - -#MSG_FILAMENT_LOADING_T3 c=20 r=4 -"Insert filament into extruder 4. Click when done." -"Vlozte filament do extruderu 4. Potvrdte tlacitkem." - # "Is filament 1 loaded?" "Je filament 1 zaveden?" @@ -578,10 +514,6 @@ "Is steel sheet on heatbed?" "Je tiskovy plat na podlozce?" -#MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 r=0 -"Iteration " -"Iterace " - # "Last print failures" "Selhani posl. tisku" @@ -750,10 +682,6 @@ "New firmware version available:" "Vysla nova verze firmware:" -# -"No " -"Ne" - #MSG_SELFTEST_FAN_NO c=19 r=0 "Not spinning" "Netoci se" @@ -938,14 +866,6 @@ "Print FAN" "Tiskovy vent." -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK2.5 ready." -"Prusa i3 MK2.5 ok." - -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK3 ready." -"Prusa i3 MK3 ok." - #MSG_PRUSA3D c=0 r=0 "prusa3d.com" "\x00" @@ -966,10 +886,6 @@ "Prusa i3 MK3S OK." "\x00" -# -"Prusa i3 MK2 ready." -"Prusa i3 MK2 ok." - #MSG_CALIBRATE_BED_RESET c=0 r=0 "Reset XYZ calibr." "Reset XYZ kalibr." @@ -1070,14 +986,6 @@ "Sensor state" "Stav senzoru" -# -"Sensors info" -"Senzor info" - -# -"Show pinda state" -"Zobrazit stav PINDA" - #MSG_FILE_CNT c=20 r=4 "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100." "Nektere soubory nebudou setrideny. Maximalni pocet souboru ve slozce pro setrideni je 100." @@ -1210,10 +1118,6 @@ "Unload" "Vysunout" -# -"Unload all" -"Vyjmout vse" - # "Total failures" "Celkem selhani" @@ -1330,10 +1234,6 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Kalibrace XYZ nepresna. Pravy predni bod moc vpredu." -#MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR c=20 r=8 -"XYZ calibration compromised. Left front calibration point not reachable." -"Kalibrace XYZ nepresna. Levy predni bod moc vpredu." - #MSG_LOAD_ALL c=17 r=0 "Load all" "Zavest vse" @@ -1350,10 +1250,6 @@ "XYZ calibration failed. Front calibration points not reachable." "Kalibrace XYZ selhala. Predni kalibracni body moc vpredu. Srovnejte tiskarnu." -# -"XYZ calibration failed. Left front calibration point not reachable." -"Kalibrace XYZ selhala. Levy predni bod moc vpredu. Srovnejte tiskarnu." - #MSG_LOAD_FILAMENT_2 c=17 r=0 "Load filament 2" "Zavest filament 2" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 144dfc706..49957f9b7 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -102,14 +102,6 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Z-Kal. fehlgeschlg. Sensor nicht ausgeloest. Schmutzige Duese? Warte auf Reset." -#MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 -"Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset." -"Z-Kalibrierung fehl- geschlagen. Sensor getrennt/Kabelbruch? Warte auf Reset." - -#MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 -"Bed leveling failed. Sensor triggered too high. Waiting for reset." -"Z-Kalibrierung fehl- geschlagen. Sensor zu hoch ausgeloest. Warte auf Reset." - #MSG_BED c=0 r=0 "Bed" "Bett" @@ -162,10 +154,6 @@ "Cancel" "Abbruch" -#MSG_SD_INSERTED c=0 r=0 -"Card inserted" -"SD Karte eingesetzt" - #MSG_SD_REMOVED c=0 r=0 "Card removed" "SD Karte entfernt" @@ -286,26 +274,6 @@ "ERROR:" "FEHLER:" -# -"External SPI flash W25X20CL not responding." -"Der externe SPI Flash W25X20CL antwortet nicht." - -# -"Extruder 1" -"\x00" - -# -"Extruder 2" -"\x00" - -# -"Extruder 3" -"\x00" - -# -"Extruder 4" -"\x00" - #MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 "Extruder fan:" "Extruder Luefter:" @@ -358,10 +326,6 @@ "Fil. sensor [on]" "Fil. Sensor [an]" -#MSG_RESPONSE_POOR c=20 r=2 -"Fil. sensor response is poor, disable it?" -"Fil. Sensorsignal ist schlecht, ausschalten?" - #MSG_FSENSOR_NA c=0 r=0 "Fil. sensor [N/A]" "Fil. Sensor [nv]" @@ -386,10 +350,6 @@ "Filament sensor" "Filamentsensor" -#MSG_SELFTEST_FILAMENT_SENSOR c=18 r=0 -"Filament sensor:" -"Filamentsensor:" - #MSG_FILAMENT_USED c=19 r=1 "Filament used" "Filament benutzt" @@ -462,10 +422,6 @@ "howto.prusa3d.com" "\x00" -# -"Change extruder" -"Wechsel Extruder" - #MSG_FILAMENTCHANGE c=0 r=0 "Change filament" "Filament-Wechsel" @@ -530,30 +486,10 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Ich werde jetzt eine Linie drucken. Waehrend des Druckes koennen Sie die Duese allmaehlich senken, indem Sie den Knopf drehen, bis Sie die optimale Hoehe erreichen. Sehen Sie sich die Bilder in unserem Handbuch im Kapitel Kalibrierung an." -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 -"Improving bed calibration point" -"Verbessere Bett Kalibrierpunkt" - #MSG_WATCH c=0 r=0 "Info screen" "Infoanzeige" -#MSG_FILAMENT_LOADING_T0 c=20 r=4 -"Insert filament into extruder 1. Click when done." -"Filament in Extruder 1 einlegen. Klicken wenn fertig." - -#MSG_FILAMENT_LOADING_T1 c=20 r=4 -"Insert filament into extruder 2. Click when done." -"Filament in Extruder 2 einlegen. Klicken wenn fertig." - -#MSG_FILAMENT_LOADING_T2 c=20 r=4 -"Insert filament into extruder 3. Click when done." -"Filament in Extruder 3 einlegen. Klicken wenn fertig." - -#MSG_FILAMENT_LOADING_T3 c=20 r=4 -"Insert filament into extruder 4. Click when done." -"Filament in Extruder 4 einlegen. Klicken wenn fertig." - # "Is filament 1 loaded?" "Wurde Filament 1 geladen?" @@ -578,10 +514,6 @@ "Is steel sheet on heatbed?" "Liegt das Stahlblech auf dem Heizbett?" -#MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 r=0 -"Iteration " -"\x00" - # "Last print failures" "Letzte Druckfehler" @@ -750,10 +682,6 @@ "New firmware version available:" "Neue Firmware- Version verfuegbar:" -# -"No " -"Nein" - #MSG_SELFTEST_FAN_NO c=19 r=0 "Not spinning" "Dreht sich nicht" @@ -938,14 +866,6 @@ "Print FAN" "Druckluefter" -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK2.5 ready." -"Prusa i3 MK2.5 bereit." - -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK3 ready." -"Prusa i3 MK3 bereit." - #MSG_PRUSA3D c=0 r=0 "prusa3d.com" "\x00" @@ -966,10 +886,6 @@ "Prusa i3 MK3S OK." "\x00" -# -"Prusa i3 MK2 ready." -"Prusa i3 MK2 bereit." - #MSG_CALIBRATE_BED_RESET c=0 r=0 "Reset XYZ calibr." "XYZ Kalibr. zuruecksetzen." @@ -1070,14 +986,6 @@ "Sensor state" "Sensorstatus" -# -"Sensors info" -"Sensoren Info" - -# -"Show pinda state" -"Pinda-Status anzeigen" - #MSG_FILE_CNT c=20 r=4 "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100." "Einige Dateien wur- den nicht sortiert. Max. Dateien pro Verzeichnis = 100." @@ -1210,10 +1118,6 @@ "Unload" "Entladen" -# -"Unload all" -"Alles entladen" - # "Total failures" "Gesamte Fehler" @@ -1330,10 +1234,6 @@ "XYZ calibration compromised. Right front calibration point not reachable." "XYZ-Kalibrierung beeintraechtigt. Rechter vorderer Kalibrierpunkt nicht erreichbar." -#MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR c=20 r=8 -"XYZ calibration compromised. Left front calibration point not reachable." -"XYZ-Kalibrierung beeintraechtigt. Linker vorderer Kalibrierpunkt nicht erreichbar." - #MSG_LOAD_ALL c=17 r=0 "Load all" "Alle laden" @@ -1350,10 +1250,6 @@ "XYZ calibration failed. Front calibration points not reachable." "XYZ-Kalibrierung fehlgeschlagen. Vordere Kalibrierpunkte nicht erreichbar." -# -"XYZ calibration failed. Left front calibration point not reachable." -"XYZ-Kalibrierung fehlgeschlagen. Linker vorderer Kalibrierpunkt nicht erreichbar." - #MSG_LOAD_FILAMENT_2 c=17 r=0 "Load filament 2" "Filament 2 laden" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 86e4268b5..a7df26a1f 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -102,14 +102,6 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Nivelacion fallada. Sensor no funciona. Restos en boquilla? Esperando reset." -#MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 -"Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset." -"Nivelacion fallada. Sensor desconectado o cables danados. Esperando reset." - -#MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 -"Bed leveling failed. Sensor triggered too high. Waiting for reset." -"Nivelacion fallada. Sensor funciona demasiado pronto. Esperando reset." - #MSG_BED c=0 r=0 "Bed" "Base calefactable " @@ -162,10 +154,6 @@ "Cancel" "Cancelar" -#MSG_SD_INSERTED c=0 r=0 -"Card inserted" -"Tarjeta insertada" - #MSG_SD_REMOVED c=0 r=0 "Card removed" "Tarjeta retirada" @@ -286,26 +274,6 @@ "ERROR:" "\x00" -# -"External SPI flash W25X20CL not responding." -"No responde el flasheo externo SPI W25X20CL" - -# -"Extruder 1" -"Extrusor 1" - -# -"Extruder 2" -"Extrusor 2" - -# -"Extruder 3" -"Extrusor 3" - -# -"Extruder 4" -"Extrusor 4" - #MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 "Extruder fan:" "Ventilador del extrusor:" @@ -358,10 +326,6 @@ "Fil. sensor [on]" "Sensor Fil. [act]" -#MSG_RESPONSE_POOR c=20 r=2 -"Fil. sensor response is poor, disable it?" -"La respuesta del sensor de fil es deficiente, ?desactivarlo?" - #MSG_FSENSOR_NA c=0 r=0 "Fil. sensor [N/A]" "Sensor Fil. [N/D]" @@ -386,10 +350,6 @@ "Filament sensor" "Sensor de filamento" -#MSG_SELFTEST_FILAMENT_SENSOR c=18 r=0 -"Filament sensor:" -"Sensor de filamento:" - #MSG_FILAMENT_USED c=19 r=1 "Filament used" "Filamento usado" @@ -462,10 +422,6 @@ "howto.prusa3d.com" "\x00" -# -"Change extruder" -"Cambiar extrusor." - #MSG_FILAMENTCHANGE c=0 r=0 "Change filament" "Cambiar filamento" @@ -530,30 +486,10 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Voy a comenzar a imprimir la linea y tu bajaras el nozzle gradualmente al rotar el dial, hasta que llegues a la altura optima. Mira las imagenes del capitulo Calibracion en el manual." -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 -"Improving bed calibration point" -"Mejorando punto de calibracion base" - #MSG_WATCH c=0 r=0 "Info screen" "Monitorizar" -#MSG_FILAMENT_LOADING_T0 c=20 r=4 -"Insert filament into extruder 1. Click when done." -"Insertar filamento en el extrusor 1. Haz clic una vez terminado." - -#MSG_FILAMENT_LOADING_T1 c=20 r=4 -"Insert filament into extruder 2. Click when done." -"Insertar filamento en el extrusor 2. Haz clic una vez terminado." - -#MSG_FILAMENT_LOADING_T2 c=20 r=4 -"Insert filament into extruder 3. Click when done." -"Insertar filamento en el extrusor 3. Haz clic una vez terminado." - -#MSG_FILAMENT_LOADING_T3 c=20 r=4 -"Insert filament into extruder 4. Click when done." -"Insertar filamento en el extrusor 4. Haz clic una vez terminado." - # "Is filament 1 loaded?" "?Esta cargado el filamento 1?" @@ -578,10 +514,6 @@ "Is steel sheet on heatbed?" "?Esta colocada la lamina de acero sobre la base?" -#MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 r=0 -"Iteration " -"Reiteracion " - # "Last print failures" "Ultimas impresiones fallidas" @@ -750,10 +682,6 @@ "New firmware version available:" "Nuevo firmware disponible:" -# -"No " -"No" - #MSG_SELFTEST_FAN_NO c=19 r=0 "Not spinning" "Ventilador no gira" @@ -938,14 +866,6 @@ "Print FAN" "Ventilador del extrusor" -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK2.5 ready." -"Preparado para Prusa i3 MK2.5." - -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK3 ready." -"Prusa i3 MK3 prep." - #MSG_PRUSA3D c=0 r=0 "prusa3d.com" "prusa3d.es" @@ -966,10 +886,6 @@ "Prusa i3 MK3S OK." "\x00" -# -"Prusa i3 MK2 ready." -"Preparado para i3 MK2." - #MSG_CALIBRATE_BED_RESET c=0 r=0 "Reset XYZ calibr." "\x00" @@ -1070,14 +986,6 @@ "Sensor state" "Estado del sensor" -# -"Sensors info" -"Informacion sensores" - -# -"Show pinda state" -"Mostrar estado pinda" - #MSG_FILE_CNT c=20 r=4 "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100." "Algunos archivos no se ordenaran. Maximo 100 archivos por carpeta para ordenar. " @@ -1210,10 +1118,6 @@ "Unload" "Descargar" -# -"Unload all" -"Soltar todos fil." - # "Total failures" "Fallos totales" @@ -1330,10 +1234,6 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Calibrazion XYZ comprometida. Punto frontal derecho no alcanzable." -#MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR c=20 r=8 -"XYZ calibration compromised. Left front calibration point not reachable." -"Calibrazion XYZ comprometida. Punto frontal izquierdo no alcanzable." - #MSG_LOAD_ALL c=17 r=0 "Load all" "Intr. todos fil." @@ -1350,10 +1250,6 @@ "XYZ calibration failed. Front calibration points not reachable." "Calibracion XYZ fallada. Puntos frontales no alcanzables." -# -"XYZ calibration failed. Left front calibration point not reachable." -"Calibracion XYZ fallada. Punto frontal izquierdo no alcanzable." - #MSG_LOAD_FILAMENT_2 c=17 r=0 "Load filament 2" "Introducir fil. 2" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 930fbb57e..582835b74 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -102,14 +102,6 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Echec bed leveling. Capt. non declenche. Debris sur buse ? En attente d'un reset." -#MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 -"Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset." -"Echec du nivellement Capteur deconnecte ou cable casse. En attente d'un reset." - -#MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 -"Bed leveling failed. Sensor triggered too high. Waiting for reset." -"Echec bed leveling. Capt. declenche trop trop haut. En attente d'un reset." - #MSG_BED c=0 r=0 "Bed" "Lit" @@ -162,10 +154,6 @@ "Cancel" "Annuler" -#MSG_SD_INSERTED c=0 r=0 -"Card inserted" -"Carte inseree" - #MSG_SD_REMOVED c=0 r=0 "Card removed" "Carte retiree" @@ -286,26 +274,6 @@ "ERROR:" "ERREUR :" -# -"External SPI flash W25X20CL not responding." -"La Flash SPI externe W25X20CL ne repond pas." - -# -"Extruder 1" -"Extrudeur 1" - -# -"Extruder 2" -"Extrudeur 2" - -# -"Extruder 3" -"Extrudeur 3" - -# -"Extruder 4" -"Extrudeur 4" - #MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 "Extruder fan:" "Ventilo extrudeur:" @@ -358,10 +326,6 @@ "Fil. sensor [on]" "Capteur Fil. [on]" -#MSG_RESPONSE_POOR c=20 r=2 -"Fil. sensor response is poor, disable it?" -"Capteur de fil. non precis, desactiver ?" - #MSG_FSENSOR_NA c=0 r=0 "Fil. sensor [N/A]" "Capteur Fil. [N/A]" @@ -386,10 +350,6 @@ "Filament sensor" "Capteur de filament" -#MSG_SELFTEST_FILAMENT_SENSOR c=18 r=0 -"Filament sensor:" -"Capteur filament :" - #MSG_FILAMENT_USED c=19 r=1 "Filament used" "Filament utilise" @@ -462,10 +422,6 @@ "howto.prusa3d.com" "\x00" -# -"Change extruder" -"Changer extrudeur" - #MSG_FILAMENTCHANGE c=0 r=0 "Change filament" "Changer filament" @@ -530,30 +486,10 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Je vais commencer a imprimer une ligne et vous baisserez au fur et a mesure la buse en tournant le bouton jusqu'a atteindre la hauteur optimale. Regardez les photos dans notre manuel au chapitre Calibration" -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 -"Improving bed calibration point" -"Amelioration du point de calibration du lit" - #MSG_WATCH c=0 r=0 "Info screen" "Ecran d'info" -#MSG_FILAMENT_LOADING_T0 c=20 r=4 -"Insert filament into extruder 1. Click when done." -"Inserez le filament dans l'extrudeur 1. Cliquez une fois pret." - -#MSG_FILAMENT_LOADING_T1 c=20 r=4 -"Insert filament into extruder 2. Click when done." -"Inserez le filament dans l'extrudeur 2. Cliquez une fois pret." - -#MSG_FILAMENT_LOADING_T2 c=20 r=4 -"Insert filament into extruder 3. Click when done." -"Inserez le filament dans l'extrudeur 3. Cliquez une fois pret." - -#MSG_FILAMENT_LOADING_T3 c=20 r=4 -"Insert filament into extruder 4. Click when done." -"Inserez le filament dans l'extrudeur 4. Cliquez une fois pret." - # "Is filament 1 loaded?" "Le filament 1 est-il charge ?" @@ -578,10 +514,6 @@ "Is steel sheet on heatbed?" "Feuille d'acier sur plateau chauffant ?" -#MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 r=0 -"Iteration " -"\x00" - # "Last print failures" "Echecs derniere impr" @@ -750,10 +682,6 @@ "New firmware version available:" "Nouvelle version de firmware disponible:" -# -"No " -"Non" - #MSG_SELFTEST_FAN_NO c=19 r=0 "Not spinning" "Ne tourne pas" @@ -938,14 +866,6 @@ "Print FAN" "Ventilo impression" -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK2.5 ready." -"Prusa i3 MK2.5 prete." - -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK3 ready." -"Prusa i3 MK3 prete." - #MSG_PRUSA3D c=0 r=0 "prusa3d.com" "\x00" @@ -966,10 +886,6 @@ "Prusa i3 MK3S OK." "\x00" -# -"Prusa i3 MK2 ready." -"Prusa i3 MK2 prete." - #MSG_CALIBRATE_BED_RESET c=0 r=0 "Reset XYZ calibr." "Reinit. calibr. XYZ" @@ -1070,14 +986,6 @@ "Sensor state" "Etat capteur" -# -"Sensors info" -"Infos capteurs" - -# -"Show pinda state" -"Etat de la PINDA" - #MSG_FILE_CNT c=20 r=4 "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100." "Certains fichiers ne seront pas tries. Max 100 fichiers tries par dossier." @@ -1210,10 +1118,6 @@ "Unload" "Decharger" -# -"Unload all" -"Decharger tout" - # "Total failures" "Total des echecs" @@ -1330,10 +1234,6 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Calibration XYZ compromise. Le point de calibration avant droit n'est pas atteignable." -#MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR c=20 r=8 -"XYZ calibration compromised. Left front calibration point not reachable." -"Calibration XYZ compromise. Le point de calibration avant gauche n'est pas atteignable." - #MSG_LOAD_ALL c=17 r=0 "Load all" "Tout charger" @@ -1350,10 +1250,6 @@ "XYZ calibration failed. Front calibration points not reachable." "Echec calibration XYZ. Les points de calibration avant ne sont pas atteignables." -# -"XYZ calibration failed. Left front calibration point not reachable." -"Echec calibration XYZ. Le point de calibration avant gauche n'est pas atteignable." - #MSG_LOAD_FILAMENT_2 c=17 r=0 "Load filament 2" "Charger fil. 2" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 0b47c7240..8467e4577 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -102,14 +102,6 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Livellamento letto fallito.NoRispSensore.Residui su ugello? In attesa di reset." -#MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 -"Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset." -"Livellamento piano fallito. Sensore disconnesso o Cavo Danneggiato. In attesa di reset." - -#MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 -"Bed leveling failed. Sensor triggered too high. Waiting for reset." -"Livellamento piano fallito. Risposta sensore troppo presto. In attesa di reset." - #MSG_BED c=0 r=0 "Bed" "Letto" @@ -162,10 +154,6 @@ "Cancel" "Annulla" -#MSG_SD_INSERTED c=0 r=0 -"Card inserted" -"SD inserita" - #MSG_SD_REMOVED c=0 r=0 "Card removed" "SD rimossa" @@ -286,26 +274,6 @@ "ERROR:" "ERRORE:" -# -"External SPI flash W25X20CL not responding." -"Flash SPI W25X20CL esterno non risponde." - -# -"Extruder 1" -"Estrusore 1" - -# -"Extruder 2" -"Estrusore 2" - -# -"Extruder 3" -"Estrusore 3" - -# -"Extruder 4" -"Estrusore 4" - #MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 "Extruder fan:" "Ventola estrusore:" @@ -358,10 +326,6 @@ "Fil. sensor [on]" "Sensor filam.[On]" -#MSG_RESPONSE_POOR c=20 r=2 -"Fil. sensor response is poor, disable it?" -"Risposta Sens. Fil. debole, disattivare? " - #MSG_FSENSOR_NA c=0 r=0 "Fil. sensor [N/A]" "Sensor filam[N/A]" @@ -386,10 +350,6 @@ "Filament sensor" "Sensore filam." -#MSG_SELFTEST_FILAMENT_SENSOR c=18 r=0 -"Filament sensor:" -"Sensore filam.:" - #MSG_FILAMENT_USED c=19 r=1 "Filament used" "Filamento utilizzato" @@ -462,10 +422,6 @@ "howto.prusa3d.com" "\x00" -# -"Change extruder" -"Cambio estrusore" - #MSG_FILAMENTCHANGE c=0 r=0 "Change filament" "Cambia filamento" @@ -530,30 +486,10 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Adesso iniziero a stampare una linea e tu dovrai abbassare l'ugello poco per volta ruotando la manopola sino a raggiungere una altezza ottimale. Per favore dai uno sguardo all'immagine del nostro manuale, cap.Calibrazione." -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 -"Improving bed calibration point" -"Perfezion. punto di calibraz. letto" - #MSG_WATCH c=0 r=0 "Info screen" "Schermata info" -#MSG_FILAMENT_LOADING_T0 c=20 r=4 -"Insert filament into extruder 1. Click when done." -"Inserire filamento nell'estrusore 1. Click per continuare" - -#MSG_FILAMENT_LOADING_T1 c=20 r=4 -"Insert filament into extruder 2. Click when done." -"Inserire filamento nell'estrusore 2. Click per continuare" - -#MSG_FILAMENT_LOADING_T2 c=20 r=4 -"Insert filament into extruder 3. Click when done." -"Inserire filamento nell'estrusore 3. Click per continuare" - -#MSG_FILAMENT_LOADING_T3 c=20 r=4 -"Insert filament into extruder 4. Click when done." -"Inserire filamento nell'estrusore 4. Click per continuare" - # "Is filament 1 loaded?" "Il filamento 1 e caricato?" @@ -578,10 +514,6 @@ "Is steel sheet on heatbed?" "La piastra d'acciaio e sul piano riscaldato?" -#MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 r=0 -"Iteration " -"Iterazione" - # "Last print failures" "Fallimenti ultima stampa" @@ -750,10 +682,6 @@ "New firmware version available:" "Nuova versione firmware disponibile:" -# -"No " -"No" - #MSG_SELFTEST_FAN_NO c=19 r=0 "Not spinning" "Non gira" @@ -938,14 +866,6 @@ "Print FAN" "Ventola di stampa" -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK2.5 ready." -"\x00" - -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK3 ready." -"Prusa i3 MK3 pronta." - #MSG_PRUSA3D c=0 r=0 "prusa3d.com" "\x00" @@ -966,10 +886,6 @@ "Prusa i3 MK3S OK." "\x00" -# -"Prusa i3 MK2 ready." -"Prusa i3 MK2 pronta." - #MSG_CALIBRATE_BED_RESET c=0 r=0 "Reset XYZ calibr." "Reset calibrazione XYZ." @@ -1070,14 +986,6 @@ "Sensor state" "Stato sensore" -# -"Sensors info" -"Info Sensori" - -# -"Show pinda state" -"Mostra stato pinda" - #MSG_FILE_CNT c=20 r=4 "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100." "Alcuni file non saranno ordinati. Il numero massimo di file in una cartella e 100 perche siano ordinati." @@ -1210,10 +1118,6 @@ "Unload" "Scarica" -# -"Unload all" -"Rilasciare tutti" - # "Total failures" "Totale fallimenti" @@ -1330,10 +1234,6 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Calibrazione XYZ compromessa. Punto anteriore destro non raggiungibile." -#MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR c=20 r=8 -"XYZ calibration compromised. Left front calibration point not reachable." -"Calibrazione XYZ compromessa. Punto anteriore sinistro non raggiungibile." - #MSG_LOAD_ALL c=17 r=0 "Load all" "Caricare tutti" @@ -1350,10 +1250,6 @@ "XYZ calibration failed. Front calibration points not reachable." "Calibrazione XYZ fallita. Punti anteriori non raggiungibili." -# -"XYZ calibration failed. Left front calibration point not reachable." -"Calibrazione XYZ fallita. Punto anteriore sinistro non raggiungibile." - #MSG_LOAD_FILAMENT_2 c=17 r=0 "Load filament 2" "Caricare fil. 2" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 26be40bd6..dc7df52d5 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -102,14 +102,6 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Kalibracja nieudana. Sensor nie aktywowal sie. Zanieczysz. dysza? Czekam na reset." -#MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED c=20 r=4 -"Bed leveling failed. Sensor disconnected or cable broken. Waiting for reset." -"Poziomowanie stolu nieudane. Sensor odlacz. lub uszkodz. przewod. Czekam na reset." - -#MSG_BED_LEVELING_FAILED_POINT_HIGH c=20 r=4 -"Bed leveling failed. Sensor triggered too high. Waiting for reset." -"Kalibracja Z nieudana. Sensor aktywowal za wysoko. Czekam na reset." - #MSG_BED c=0 r=0 "Bed" "Stol" @@ -162,10 +154,6 @@ "Cancel" "Anuluj" -#MSG_SD_INSERTED c=0 r=0 -"Card inserted" -"Karta wlozona" - #MSG_SD_REMOVED c=0 r=0 "Card removed" "Karta wyjeta" @@ -286,26 +274,6 @@ "ERROR:" "BLAD:" -# -"External SPI flash W25X20CL not responding." -"Zewnetrzna pamiec flash SPI W25X20CL nie odpowiada." - -# -"Extruder 1" -"Ekstruder 1" - -# -"Extruder 2" -"Ekstruder 2" - -# -"Extruder 3" -"Ekstruder 3" - -# -"Extruder 4" -"Ekstruder 4" - #MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 "Extruder fan:" "Went. ekstrudera:" @@ -358,10 +326,6 @@ "Fil. sensor [on]" "Czuj. filam. [wl]" -#MSG_RESPONSE_POOR c=20 r=2 -"Fil. sensor response is poor, disable it?" -"Reakcja czujnika slaba, wylaczyc?" - #MSG_FSENSOR_NA c=0 r=0 "Fil. sensor [N/A]" "Czuj. filam.[N/D]" @@ -386,10 +350,6 @@ "Filament sensor" "Czujnik filamentu" -#MSG_SELFTEST_FILAMENT_SENSOR c=18 r=0 -"Filament sensor:" -"Czujnik filamentu:" - #MSG_FILAMENT_USED c=19 r=1 "Filament used" "Uzyty filament" @@ -462,10 +422,6 @@ "howto.prusa3d.com" "\x00" -# -"Change extruder" -"Zmiana ekstrudera" - #MSG_FILAMENTCHANGE c=0 r=0 "Change filament" "Wymiana filamentu" @@ -530,30 +486,10 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Zaczne drukowac linie. Stopniowo opuszczaj dysze przekrecajac pokretlo, poki nie uzyskasz optymalnej wysokosci. Sprawdz obrazki w naszym Podreczniku w rozdz. Kalibracja" -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 -"Improving bed calibration point" -"Poprawiam precyzje punktu kalibracyjnego" - #MSG_WATCH c=0 r=0 "Info screen" "Ekran informacyjny" -#MSG_FILAMENT_LOADING_T0 c=20 r=4 -"Insert filament into extruder 1. Click when done." -"Wloz filament do ekstrudera 1. Potwierdz naciskajac pokretlo." - -#MSG_FILAMENT_LOADING_T1 c=20 r=4 -"Insert filament into extruder 2. Click when done." -"Wloz filament do ekstrudera 2. Potwierdz naciskajac pokretlo." - -#MSG_FILAMENT_LOADING_T2 c=20 r=4 -"Insert filament into extruder 3. Click when done." -"Wloz filament do ekstrudera 3. Potwierdz naciskajac pokretlo." - -#MSG_FILAMENT_LOADING_T3 c=20 r=4 -"Insert filament into extruder 4. Click when done." -"Wloz filament do ekstrudera 4. Potwierdz naciskajac pokretlo." - # "Is filament 1 loaded?" "Filament 1 zaladowany?" @@ -578,10 +514,6 @@ "Is steel sheet on heatbed?" "Czy plyta stal. jest na podgrzew. stole?" -#MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 r=0 -"Iteration " -"Iteracja " - # "Last print failures" "Ostatnie bledy druku" @@ -750,10 +682,6 @@ "New firmware version available:" "Dostepna nowa wersja firmware:" -# -"No " -"Nie" - #MSG_SELFTEST_FAN_NO c=19 r=0 "Not spinning" "Nie kreci sie" @@ -938,14 +866,6 @@ "Print FAN" "Went. wydruku" -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK2.5 ready." -"Prusa i3 MK2.5 gotowa" - -#WELCOME_MSG c=20 r=0 -"Prusa i3 MK3 ready." -"Prusa i3 MK3 gotowa" - #MSG_PRUSA3D c=0 r=0 "prusa3d.com" "\x00" @@ -966,10 +886,6 @@ "Prusa i3 MK3S OK." "Prusa i3 MK3S OK" -# -"Prusa i3 MK2 ready." -"Prusa i3 MK2 gotowa" - #MSG_CALIBRATE_BED_RESET c=0 r=0 "Reset XYZ calibr." "Reset kalibr. XYZ" @@ -1070,14 +986,6 @@ "Sensor state" "Stan czujnikow" -# -"Sensors info" -"Info o czujnikach" - -# -"Show pinda state" -"Stan sondy PINDA" - #MSG_FILE_CNT c=20 r=4 "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100." "Niektore pliki nie zostana posortowane. Max. liczba plikow w 1 folderze = 100." @@ -1210,10 +1118,6 @@ "Unload" "Rozladuj" -# -"Unload all" -"Rozladuj wszystkie" - # "Total failures" "Suma bledow" @@ -1330,10 +1234,6 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Kalibracja XYZ niedokladna. Prawy przedni punkt nieosiagalny." -#MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_LEFT_FAR c=20 r=8 -"XYZ calibration compromised. Left front calibration point not reachable." -"Kalibracja XYZ niedokladna. Lewy przedni punkt nieosiagalny." - #MSG_LOAD_ALL c=17 r=0 "Load all" "Zalad. wszystkie" @@ -1350,10 +1250,6 @@ "XYZ calibration failed. Front calibration points not reachable." "Kalibr. XYZ nieudana. Przednie punkty kalibr. nieosiagalne. Nalezy poprawic montaz drukarki." -# -"XYZ calibration failed. Left front calibration point not reachable." -"Kalibr. XYZ nieudana. Lewy przedni punkt nieosiagalny. Nalezy poprawic montaz drukarki." - #MSG_LOAD_FILAMENT_2 c=17 r=0 "Load filament 2" "Zaladuj fil. 2" From ffbdb43881209e8641e85f866861bb74728a5d41 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 6 May 2019 17:26:42 +0200 Subject: [PATCH 180/368] Remove commented code --- Firmware/ultralcd.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1511e87cb..d099d9229 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5172,10 +5172,6 @@ void lcd_settings_linearity_correction_menu(void) #endif //TMC2130_LINEARITY_CORRECTION_XYZ MENU_ITEM_EDIT_int3_P(_i("E-correct"), &tmc2130_wave_fac[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 r=0 MENU_END(); -// if(menu_leaving) -// { -// lcd_settings_linearity_correction_menu_save(); -// } } #endif // TMC2130 From fa1bdd6ab129e68ebef65eb316ed2515c123e5d4 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Mon, 6 May 2019 17:29:47 +0200 Subject: [PATCH 181/368] Lang - decreased reserved space for secondary language (10496 bytes) --- Firmware/config.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Firmware/config.h b/Firmware/config.h index e8ce4d324..faf4b7b0e 100644 --- a/Firmware/config.h +++ b/Firmware/config.h @@ -49,11 +49,7 @@ //#define LANG_MODE 0 // primary language only #define LANG_MODE 1 // sec. language support -#if (MOTHERBOARD == BOARD_EINSY_1_0a) -#define LANG_SIZE_RESERVED 0x2e00 // reserved space for secondary language (11776 bytes) -#else //MOTHERBOARD == BOARD_EINSY_1_0a -#define LANG_SIZE_RESERVED 0x2e00 // reserved space for secondary language (11776 bytes) -#endif //MOTHERBOARD == BOARD_EINSY_1_0a +#define LANG_SIZE_RESERVED 0x2900 // reserved space for secondary language (10496 bytes) #endif //_CONFIG_H From 1a0370e1c73a7e9dd187f88274daf9104a43990c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 6 May 2019 17:39:00 +0200 Subject: [PATCH 182/368] Make macro ON_MENU_LEAVE() usage similar to macros MENU_ITEM_BACK_P() and MENU_ITEM_FUNCTION_P(). --- Firmware/menu.h | 2 +- Firmware/ultralcd.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/menu.h b/Firmware/menu.h index fe183d220..667f86752 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -82,7 +82,7 @@ extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu); extern uint8_t menu_item_back_P(const char* str); // leaving menu - this condition must be immediately before MENU_ITEM_BACK_P -#define ON_MENU_LEAVE(func) if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving){ func } +#define ON_MENU_LEAVE(func) do { if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving){ func } } while (0) #define MENU_ITEM_FUNCTION_P(str, func) do { if (menu_item_function_P(str, func)) return; } while (0) extern uint8_t menu_item_function_P(const char* str, menu_func_t func); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d099d9229..8b923858f 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3352,7 +3352,7 @@ void lcd_adjust_bed(void) eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_FRONT, _md->front); eeprom_update_int8((unsigned char*)EEPROM_BED_CORRECTION_REAR, _md->rear); eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1); - ) + ); MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); MENU_ITEM_EDIT_int3_P(_i("Left side [um]"), &_md->left, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_LEFT c=14 r=1 MENU_ITEM_EDIT_int3_P(_i("Right side[um]"), &_md->right, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_RIGHT c=14 r=1 @@ -5161,7 +5161,7 @@ void lcd_settings_linearity_correction_menu(void) MENU_BEGIN(); ON_MENU_LEAVE( lcd_settings_linearity_correction_menu_save(); - ) + ); MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); #ifdef TMC2130_LINEARITY_CORRECTION_XYZ //tmc2130_wave_fac[X_AXIS] From 58683da2fb971570cc56224c6277a99d5cacff82 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Mon, 6 May 2019 18:07:42 +0200 Subject: [PATCH 183/368] Variable bed PWM resolution/frequency (adjusted to 5bits/32Hz) --- Firmware/Configuration.h | 3 +++ Firmware/temperature.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index acdd2d6f8..faf71f2d6 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -480,6 +480,9 @@ your extruder heater takes 2 minutes to hit the target on heating. #define FAN_SOFT_PWM #define FAN_SOFT_PWM_BITS 4 //PWM bit resolution = 4bits, freq = 62.5Hz +// Bed soft pwm +#define HEATER_BED_SOFT_PWM_BITS 5 //PWM bit resolution = 5bits, freq = 32Hz + // Incrementing this by 1 will double the software PWM frequency, // affecting heaters, and the fan if FAN_SOFT_PWM is enabled. // However, control resolution will be halved for each increment; diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 45256bf42..ca885f441 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1693,13 +1693,16 @@ ISR(TIMER0_COMPB_vect) soft_pwm_2 = soft_pwm[2]; if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1); else WRITE(HEATER_2_PIN,0); #endif + } #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 - soft_pwm_b = soft_pwm_bed; + if ((pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1)) == 0) + { + soft_pwm_b = soft_pwm_bed / (1 << (8 - HEATER_BED_SOFT_PWM_BITS)); #ifndef SYSTEM_TIMER_2 if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); else WRITE(HEATER_BED_PIN,0); #endif //SYSTEM_TIMER_2 -#endif } +#endif #ifdef FAN_SOFT_PWM if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0) { @@ -1722,7 +1725,7 @@ ISR(TIMER0_COMPB_vect) if(soft_pwm_2 < pwm_count) WRITE(HEATER_2_PIN,0); #endif #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 - if(soft_pwm_b < pwm_count) WRITE(HEATER_BED_PIN,0); + if (soft_pwm_b < (pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1))) WRITE(HEATER_BED_PIN,0); #endif #ifdef FAN_SOFT_PWM if (soft_pwm_fan < (pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1))) WRITE(FAN_PIN,0); From b7fe43bf68905fb5218956d4a5a9e00f28e9cf1f Mon Sep 17 00:00:00 2001 From: Ondrej Tuma Date: Tue, 7 May 2019 12:23:09 +0200 Subject: [PATCH 184/368] Deleted bad cols/rows definitions for translation. --- Firmware/Marlin_main.cpp | 54 +++---- Firmware/cardreader.cpp | 22 +-- Firmware/cmdqueue.cpp | 10 +- Firmware/mesh_bed_calibration.cpp | 6 +- Firmware/messages.c | 162 +++++++++---------- Firmware/planner.cpp | 4 +- Firmware/stepper.cpp | 2 +- Firmware/ultralcd.cpp | 188 +++++++++++----------- Firmware/util.cpp | 2 +- lang/lang_en.txt | 250 +++++++++++++++--------------- lang/lang_en_cz.txt | 250 +++++++++++++++--------------- lang/lang_en_de.txt | 250 +++++++++++++++--------------- lang/lang_en_es.txt | 250 +++++++++++++++--------------- lang/lang_en_fr.txt | 250 +++++++++++++++--------------- lang/lang_en_it.txt | 250 +++++++++++++++--------------- lang/lang_en_pl.txt | 250 +++++++++++++++--------------- 16 files changed, 1100 insertions(+), 1100 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index bb13f673a..949380555 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1194,9 +1194,9 @@ void setup() #ifdef STRING_VERSION_CONFIG_H #ifdef STRING_CONFIG_H_AUTHOR SERIAL_ECHO_START; - SERIAL_ECHORPGM(_n(" Last Updated: "));////MSG_CONFIGURATION_VER c=0 r=0 + SERIAL_ECHORPGM(_n(" Last Updated: "));////MSG_CONFIGURATION_VER SERIAL_ECHOPGM(STRING_VERSION_CONFIG_H); - SERIAL_ECHORPGM(_n(" | Author: "));////MSG_AUTHOR c=0 r=0 + SERIAL_ECHORPGM(_n(" | Author: "));////MSG_AUTHOR SERIAL_ECHOLNPGM(STRING_CONFIG_H_AUTHOR); SERIAL_ECHOPGM("Compiled: "); SERIAL_ECHOLNPGM(__DATE__); @@ -1204,9 +1204,9 @@ void setup() #endif SERIAL_ECHO_START; - SERIAL_ECHORPGM(_n(" Free Memory: "));////MSG_FREE_MEMORY c=0 r=0 + SERIAL_ECHORPGM(_n(" Free Memory: "));////MSG_FREE_MEMORY SERIAL_ECHO(freeMemory()); - SERIAL_ECHORPGM(_n(" PlannerBufferBytes: "));////MSG_PLANNER_BUFFER_BYTES c=0 r=0 + SERIAL_ECHORPGM(_n(" PlannerBufferBytes: "));////MSG_PLANNER_BUFFER_BYTES SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE); //lcd_update_enable(false); // why do we need this?? - andre // loads data from EEPROM if available else uses defaults (and resets step acceleration rate) @@ -2977,7 +2977,7 @@ void gcode_M114() SERIAL_PROTOCOLPGM(" E:"); SERIAL_PROTOCOL(current_position[E_AXIS]); - SERIAL_PROTOCOLRPGM(_n(" Count X: "));////MSG_COUNT_X c=0 r=0 + SERIAL_PROTOCOLRPGM(_n(" Count X: "));////MSG_COUNT_X SERIAL_PROTOCOL(float(st_get_position(X_AXIS)) / cs.axis_steps_per_unit[X_AXIS]); SERIAL_PROTOCOLPGM(" Y:"); SERIAL_PROTOCOL(float(st_get_position(Y_AXIS)) / cs.axis_steps_per_unit[Y_AXIS]); @@ -3822,7 +3822,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) codenum = 0; if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait - if(codenum != 0) LCD_MESSAGERPGM(_n("Sleep..."));////MSG_DWELL c=0 r=0 + if(codenum != 0) LCD_MESSAGERPGM(_n("Sleep..."));////MSG_DWELL st_synchronize(); codenum += _millis(); // keep track of when we started waiting previous_millis_cmd = _millis(); @@ -4960,7 +4960,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (!hasP && !hasS && *src != '\0') { lcd_setstatus(src); } else { - LCD_MESSAGERPGM(_i("Wait for user..."));////MSG_USERWAIT c=0 r=0 + LCD_MESSAGERPGM(_i("Wait for user..."));////MSG_USERWAIT } lcd_ignore_click(); //call lcd_ignore_click aslo for else ??? @@ -4986,7 +4986,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } break; case 17: - LCD_MESSAGERPGM(_i("No move."));////MSG_NO_MOVE c=0 r=0 + LCD_MESSAGERPGM(_i("No move."));////MSG_NO_MOVE enable_x(); enable_y(); enable_z(); @@ -4997,9 +4997,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) #ifdef SDSUPPORT case 20: // M20 - list SD card - SERIAL_PROTOCOLLNRPGM(_N("Begin file list"));////MSG_BEGIN_FILE_LIST c=0 r=0 + SERIAL_PROTOCOLLNRPGM(_N("Begin file list"));////MSG_BEGIN_FILE_LIST card.ls(); - SERIAL_PROTOCOLLNRPGM(_N("End file list"));////MSG_END_FILE_LIST c=0 r=0 + SERIAL_PROTOCOLLNRPGM(_N("End file list"));////MSG_END_FILE_LIST break; case 21: // M21 - init SD card @@ -5555,7 +5555,7 @@ Sigma_Exit: } #else SERIAL_ERROR_START; - SERIAL_ERRORLNRPGM(_i("No thermistors - no temperature"));////MSG_ERR_NO_THERMISTORS c=0 r=0 + SERIAL_ERRORLNRPGM(_i("No thermistors - no temperature"));////MSG_ERR_NO_THERMISTORS #endif SERIAL_PROTOCOLPGM(" @:"); @@ -5905,10 +5905,10 @@ Sigma_Exit: enable_endstops(true) ; break; case 119: // M119 - SERIAL_PROTOCOLRPGM(_N("Reporting endstop status"));////MSG_M119_REPORT c=0 r=0 + SERIAL_PROTOCOLRPGM(_N("Reporting endstop status"));////MSG_M119_REPORT SERIAL_PROTOCOLLN(""); #if defined(X_MIN_PIN) && X_MIN_PIN > -1 - SERIAL_PROTOCOLRPGM(_n("x_min: "));////MSG_X_MIN c=0 r=0 + SERIAL_PROTOCOLRPGM(_n("x_min: "));////MSG_X_MIN if(READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING){ SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); }else{ @@ -5917,7 +5917,7 @@ Sigma_Exit: SERIAL_PROTOCOLLN(""); #endif #if defined(X_MAX_PIN) && X_MAX_PIN > -1 - SERIAL_PROTOCOLRPGM(_n("x_max: "));////MSG_X_MAX c=0 r=0 + SERIAL_PROTOCOLRPGM(_n("x_max: "));////MSG_X_MAX if(READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING){ SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); }else{ @@ -5926,7 +5926,7 @@ Sigma_Exit: SERIAL_PROTOCOLLN(""); #endif #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1 - SERIAL_PROTOCOLRPGM(_n("y_min: "));////MSG_Y_MIN c=0 r=0 + SERIAL_PROTOCOLRPGM(_n("y_min: "));////MSG_Y_MIN if(READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING){ SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); }else{ @@ -5935,7 +5935,7 @@ Sigma_Exit: SERIAL_PROTOCOLLN(""); #endif #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1 - SERIAL_PROTOCOLRPGM(_n("y_max: "));////MSG_Y_MAX c=0 r=0 + SERIAL_PROTOCOLRPGM(_n("y_max: "));////MSG_Y_MAX if(READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING){ SERIAL_PROTOCOLRPGM(MSG_ENDSTOP_HIT); }else{ @@ -5986,7 +5986,7 @@ Sigma_Exit: extruder = code_value(); if(extruder >= EXTRUDERS) { SERIAL_ECHO_START; - SERIAL_ECHO(_n("M200 Invalid extruder "));////MSG_M200_INVALID_EXTRUDER c=0 r=0 + SERIAL_ECHO(_n("M200 Invalid extruder "));////MSG_M200_INVALID_EXTRUDER break; } } @@ -7125,7 +7125,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) SERIAL_ECHO_START; SERIAL_ECHOPGM("T"); SERIAL_PROTOCOLLN((int)tmp_extruder); - SERIAL_ECHOLNRPGM(_n("Invalid extruder"));////MSG_INVALID_EXTRUDER c=0 r=0 + SERIAL_ECHOLNRPGM(_n("Invalid extruder"));////MSG_INVALID_EXTRUDER } else { #if EXTRUDERS > 1 @@ -7161,7 +7161,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } #endif SERIAL_ECHO_START; - SERIAL_ECHORPGM(_n("Active Extruder: "));////MSG_ACTIVE_EXTRUDER c=0 r=0 + SERIAL_ECHORPGM(_n("Active Extruder: "));////MSG_ACTIVE_EXTRUDER SERIAL_PROTOCOLLN((int)active_extruder); } @@ -7617,7 +7617,7 @@ static void handleSafetyTimer() { setTargetBed(0); setAllTargetHotends(0); - lcd_show_fullscreen_message_and_wait_P(_i("Heating disabled by safety timer."));////MSG_BED_HEATING_SAFETY_DISABLED c=0 r=0 + lcd_show_fullscreen_message_and_wait_P(_i("Heating disabled by safety timer."));////MSG_BED_HEATING_SAFETY_DISABLED } } #endif //SAFETYTIMER @@ -7796,12 +7796,12 @@ void kill(const char *full_screen_message, unsigned char id) pinMode(PS_ON_PIN,INPUT); #endif SERIAL_ERROR_START; - SERIAL_ERRORLNRPGM(_n("Printer halted. kill() called!"));////MSG_ERR_KILLED c=0 r=0 + SERIAL_ERRORLNRPGM(_n("Printer halted. kill() called!"));////MSG_ERR_KILLED if (full_screen_message != NULL) { SERIAL_ERRORLNRPGM(full_screen_message); lcd_display_message_fullscreen_P(full_screen_message); } else { - LCD_ALERTMESSAGERPGM(_n("KILLED. "));////MSG_KILLED c=0 r=0 + LCD_ALERTMESSAGERPGM(_n("KILLED. "));////MSG_KILLED } // FMC small patch to update the LCD before ending @@ -7925,19 +7925,19 @@ bool setTargetedHotend(int code, uint8_t &extruder) SERIAL_ECHO_START; switch(code){ case 104: - SERIAL_ECHORPGM(_n("M104 Invalid extruder "));////MSG_M104_INVALID_EXTRUDER c=0 r=0 + SERIAL_ECHORPGM(_n("M104 Invalid extruder "));////MSG_M104_INVALID_EXTRUDER break; case 105: - SERIAL_ECHO(_n("M105 Invalid extruder "));////MSG_M105_INVALID_EXTRUDER c=0 r=0 + SERIAL_ECHO(_n("M105 Invalid extruder "));////MSG_M105_INVALID_EXTRUDER break; case 109: - SERIAL_ECHO(_n("M109 Invalid extruder "));////MSG_M109_INVALID_EXTRUDER c=0 r=0 + SERIAL_ECHO(_n("M109 Invalid extruder "));////MSG_M109_INVALID_EXTRUDER break; case 218: - SERIAL_ECHO(_n("M218 Invalid extruder "));////MSG_M218_INVALID_EXTRUDER c=0 r=0 + SERIAL_ECHO(_n("M218 Invalid extruder "));////MSG_M218_INVALID_EXTRUDER break; case 221: - SERIAL_ECHO(_n("M221 Invalid extruder "));////MSG_M221_INVALID_EXTRUDER c=0 r=0 + SERIAL_ECHO(_n("M221 Invalid extruder "));////MSG_M221_INVALID_EXTRUDER break; } SERIAL_PROTOCOLLN((int)extruder); diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index 7aa8ed7e0..b57d5c0c5 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -94,7 +94,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m if (!dir.open(parent, lfilename, O_READ)) { if (lsAction == LS_SerialPrint) { //SERIAL_ECHO_START(); - //SERIAL_ECHOPGM(_i("Cannot open subdir"));////MSG_SD_CANT_OPEN_SUBDIR c=0 r=0 + //SERIAL_ECHOPGM(_i("Cannot open subdir"));////MSG_SD_CANT_OPEN_SUBDIR //SERIAL_ECHOLN(lfilename); } } @@ -183,23 +183,23 @@ void CardReader::initsd() { //if (!card.init(SPI_HALF_SPEED,SDSS)) SERIAL_ECHO_START; - SERIAL_ECHOLNRPGM(_n("SD init fail"));////MSG_SD_INIT_FAIL c=0 r=0 + SERIAL_ECHOLNRPGM(_n("SD init fail"));////MSG_SD_INIT_FAIL } else if (!volume.init(&card)) { SERIAL_ERROR_START; - SERIAL_ERRORLNRPGM(_n("volume.init failed"));////MSG_SD_VOL_INIT_FAIL c=0 r=0 + SERIAL_ERRORLNRPGM(_n("volume.init failed"));////MSG_SD_VOL_INIT_FAIL } else if (!root.openRoot(&volume)) { SERIAL_ERROR_START; - SERIAL_ERRORLNRPGM(_n("openRoot failed"));////MSG_SD_OPENROOT_FAIL c=0 r=0 + SERIAL_ERRORLNRPGM(_n("openRoot failed"));////MSG_SD_OPENROOT_FAIL } else { cardOK = true; SERIAL_ECHO_START; - SERIAL_ECHOLNRPGM(_n("SD card ok"));////MSG_SD_CARD_OK c=0 r=0 + SERIAL_ECHOLNRPGM(_n("SD card ok"));////MSG_SD_CARD_OK } workDir=root; curDir=&root; @@ -418,13 +418,13 @@ void CardReader::openFile(const char* name,bool read, bool replace_current/*=tru if (file.open(curDir, fname, O_READ)) { filesize = file.fileSize(); - SERIAL_PROTOCOLRPGM(_N("File opened: "));////MSG_SD_FILE_OPENED c=0 r=0 + SERIAL_PROTOCOLRPGM(_N("File opened: "));////MSG_SD_FILE_OPENED SERIAL_PROTOCOL(fname); - SERIAL_PROTOCOLRPGM(_n(" Size: "));////MSG_SD_SIZE c=0 r=0 + SERIAL_PROTOCOLRPGM(_n(" Size: "));////MSG_SD_SIZE SERIAL_PROTOCOLLN(filesize); sdpos = 0; - SERIAL_PROTOCOLLNRPGM(_N("File selected"));////MSG_SD_FILE_SELECTED c=0 r=0 + SERIAL_PROTOCOLLNRPGM(_N("File selected"));////MSG_SD_FILE_SELECTED getfilename(0, fname); lcd_setstatus(longFilename[0] ? longFilename : fname); lcd_setstatus("SD-PRINTING "); @@ -447,7 +447,7 @@ void CardReader::openFile(const char* name,bool read, bool replace_current/*=tru else { saving = true; - SERIAL_PROTOCOLRPGM(_N("Writing to file: "));////MSG_SD_WRITE_TO_FILE c=0 r=0 + SERIAL_PROTOCOLRPGM(_N("Writing to file: "));////MSG_SD_WRITE_TO_FILE SERIAL_PROTOCOLLN(name); lcd_setstatus(fname); } @@ -493,7 +493,7 @@ void CardReader::getStatus() if(sdprinting){ SERIAL_PROTOCOL(longFilename); SERIAL_PROTOCOLPGM("\n"); - SERIAL_PROTOCOLRPGM(_N("SD printing byte "));////MSG_SD_PRINTING_BYTE c=0 r=0 + SERIAL_PROTOCOLRPGM(_N("SD printing byte "));////MSG_SD_PRINTING_BYTE SERIAL_PROTOCOL(sdpos); SERIAL_PROTOCOLPGM("/"); SERIAL_PROTOCOLLN(filesize); @@ -659,7 +659,7 @@ void CardReader::chdir(const char * relpath) if(!newfile.open(*parent,relpath, O_READ)) { SERIAL_ECHO_START; - SERIAL_ECHORPGM(_n("Cannot enter subdir: "));////MSG_SD_CANT_ENTER_SUBDIR c=0 r=0 + SERIAL_ECHORPGM(_n("Cannot enter subdir: "));////MSG_SD_CANT_ENTER_SUBDIR SERIAL_ECHOLN(relpath); } else diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index c7035ba13..2e29ad5f9 100644 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -429,7 +429,7 @@ void get_command() // M110 - set current line number. // Line numbers not sent in succession. SERIAL_ERROR_START; - SERIAL_ERRORRPGM(_n("Line Number is not Last Line Number+1, Last Line: "));////MSG_ERR_LINE_NO c=0 r=0 + SERIAL_ERRORRPGM(_n("Line Number is not Last Line Number+1, Last Line: "));////MSG_ERR_LINE_NO SERIAL_ERRORLN(gcode_LastN); //Serial.println(gcode_N); FlushSerialRequestResend(); @@ -445,7 +445,7 @@ void get_command() checksum = checksum^(*p++); if (int(strtol(strchr_pointer+1, NULL, 10)) != int(checksum)) { SERIAL_ERROR_START; - SERIAL_ERRORRPGM(_n("checksum mismatch, Last Line: "));////MSG_ERR_CHECKSUM_MISMATCH c=0 r=0 + SERIAL_ERRORRPGM(_n("checksum mismatch, Last Line: "));////MSG_ERR_CHECKSUM_MISMATCH SERIAL_ERRORLN(gcode_LastN); FlushSerialRequestResend(); serial_count = 0; @@ -457,7 +457,7 @@ void get_command() else { SERIAL_ERROR_START; - SERIAL_ERRORRPGM(_n("No Checksum with line number, Last Line: "));////MSG_ERR_NO_CHECKSUM c=0 r=0 + SERIAL_ERRORRPGM(_n("No Checksum with line number, Last Line: "));////MSG_ERR_NO_CHECKSUM SERIAL_ERRORLN(gcode_LastN); FlushSerialRequestResend(); serial_count = 0; @@ -474,7 +474,7 @@ void get_command() { SERIAL_ERROR_START; - SERIAL_ERRORRPGM(_n("No Line Number with checksum, Last Line: "));////MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM c=0 r=0 + SERIAL_ERRORRPGM(_n("No Line Number with checksum, Last Line: "));////MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM SERIAL_ERRORLN(gcode_LastN); FlushSerialRequestResend(); serial_count = 0; @@ -579,7 +579,7 @@ void get_command() serial_count >= (MAX_CMD_SIZE - 1) || n==-1) { if(card.eof()){ - SERIAL_PROTOCOLLNRPGM(_n("Done printing file"));////MSG_FILE_PRINTED c=0 r=0 + SERIAL_PROTOCOLLNRPGM(_n("Done printing file"));////MSG_FILE_PRINTED stoptime=_millis(); char time[30]; unsigned long t=(stoptime-starttime-pause_time)/1000; diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 006cc4874..91dadaefa 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -2239,7 +2239,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2)); if (iteration > 0) { - lcd_puts_at_P(0, next_line + 1, _i("Iteration "));////MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 r=0 + lcd_puts_at_P(0, next_line + 1, _i("Iteration "));////MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION c=20 lcd_print(int(iteration + 1)); } #endif /* MESH_BED_CALIBRATION_SHOW_LCD */ @@ -2500,7 +2500,7 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 #ifdef MESH_BED_CALIBRATION_SHOW_LCD uint8_t next_line; - lcd_display_message_fullscreen_P(_i("Improving bed calibration point"), next_line);////MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 + lcd_display_message_fullscreen_P(_i("Improving bed calibration point"), next_line);////MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=60 if (next_line > 3) next_line = 3; #endif /* MESH_BED_CALIBRATION_SHOW_LCD */ @@ -2514,7 +2514,7 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 #ifdef MESH_BED_CALIBRATION_SHOW_LCD lcd_set_cursor(0, next_line); lcd_print(mesh_point+1); - lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2));////MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 r=0 + lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2));////MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 #endif /* MESH_BED_CALIBRATION_SHOW_LCD */ // Move up. diff --git a/Firmware/messages.c b/Firmware/messages.c index faa5283d9..e4a24ce18 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -8,119 +8,119 @@ #include "Configuration_prusa.h" //internationalized messages -const char MSG_AUTO_HOME[] PROGMEM_I1 = ISTR("Auto home"); ////c=0 r=0 -const char MSG_AUTO_MODE_ON[] PROGMEM_I1 = ISTR("Mode [auto power]"); ////c=0 r=0 -const char MSG_BABYSTEP_Z[] PROGMEM_I1 = ISTR("Live adjust Z"); ////c=0 r=0 +const char MSG_AUTO_HOME[] PROGMEM_I1 = ISTR("Auto home"); //// +const char MSG_AUTO_MODE_ON[] PROGMEM_I1 = ISTR("Mode [auto power]"); //// +const char MSG_BABYSTEP_Z[] PROGMEM_I1 = ISTR("Live adjust Z"); //// const char MSG_BABYSTEP_Z_NOT_SET[] PROGMEM_I1 = ISTR("Distance between tip of the nozzle and the bed surface has not been set yet. Please follow the manual, chapter First steps, section First layer calibration."); ////c=20 r=12 -const char MSG_BED[] PROGMEM_I1 = ISTR("Bed"); ////c=0 r=0 -const char MSG_BED_DONE[] PROGMEM_I1 = ISTR("Bed done"); ////c=0 r=0 -const char MSG_BED_HEATING[] PROGMEM_I1 = ISTR("Bed Heating"); ////c=0 r=0 +const char MSG_BED[] PROGMEM_I1 = ISTR("Bed"); //// +const char MSG_BED_DONE[] PROGMEM_I1 = ISTR("Bed done"); //// +const char MSG_BED_HEATING[] PROGMEM_I1 = ISTR("Bed Heating"); //// const char MSG_BED_LEVELING_FAILED_POINT_LOW[] PROGMEM_I1 = ISTR("Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset."); ////c=20 r=4 const char MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED[] PROGMEM_I1 = ISTR("XYZ calibration failed. Please consult the manual."); ////c=20 r=8 const char MSG_CALIBRATE_Z_AUTO[] PROGMEM_I1 = ISTR("Calibrating Z"); ////c=20 r=2 -const char MSG_CARD_MENU[] PROGMEM_I1 = ISTR("Print from SD"); ////c=0 r=0 +const char MSG_CARD_MENU[] PROGMEM_I1 = ISTR("Print from SD"); //// const char MSG_CONFIRM_NOZZLE_CLEAN[] PROGMEM_I1 = ISTR("Please clean the nozzle for calibration. Click when done."); ////c=20 r=8 -const char MSG_COOLDOWN[] PROGMEM_I1 = ISTR("Cooldown"); ////c=0 r=0 +const char MSG_COOLDOWN[] PROGMEM_I1 = ISTR("Cooldown"); //// const char MSG_CRASH_DETECTED[] PROGMEM_I1 = ISTR("Crash detected."); ////c=20 r=1 -const char MSG_CRASHDETECT_NA[] PROGMEM_I1 = ISTR("Crash det. [N/A]"); ////c=0 r=0 -const char MSG_CRASHDETECT_OFF[] PROGMEM_I1 = ISTR("Crash det. [off]"); ////c=0 r=0 -const char MSG_CRASHDETECT_ON[] PROGMEM_I1 = ISTR("Crash det. [on]"); ////c=0 r=0 -const char MSG_ERROR[] PROGMEM_I1 = ISTR("ERROR:"); ////c=0 r=0 +const char MSG_CRASHDETECT_NA[] PROGMEM_I1 = ISTR("Crash det. [N/A]"); //// +const char MSG_CRASHDETECT_OFF[] PROGMEM_I1 = ISTR("Crash det. [off]"); //// +const char MSG_CRASHDETECT_ON[] PROGMEM_I1 = ISTR("Crash det. [on]"); //// +const char MSG_ERROR[] PROGMEM_I1 = ISTR("ERROR:"); //// const char MSG_EXTRUDER[] PROGMEM_I1 = ISTR("Extruder"); ////c=17 r=1 const char MSG_FILAMENT[] PROGMEM_I1 = ISTR("Filament"); ////c=17 r=1 -const char MSG_FAN_SPEED[] PROGMEM_I1 = ISTR("Fan speed"); ////c=14 r=0 +const char MSG_FAN_SPEED[] PROGMEM_I1 = ISTR("Fan speed"); ////c=14 const char MSG_FILAMENT_CLEAN[] PROGMEM_I1 = ISTR("Filament extruding & with correct color?"); ////c=20 r=2 const char MSG_FILAMENT_LOADING_T0[] PROGMEM_I1 = ISTR("Insert filament into extruder 1. Click when done."); ////c=20 r=4 const char MSG_FILAMENT_LOADING_T1[] PROGMEM_I1 = ISTR("Insert filament into extruder 2. Click when done."); ////c=20 r=4 const char MSG_FILAMENT_LOADING_T2[] PROGMEM_I1 = ISTR("Insert filament into extruder 3. Click when done."); ////c=20 r=4 const char MSG_FILAMENT_LOADING_T3[] PROGMEM_I1 = ISTR("Insert filament into extruder 4. Click when done."); ////c=20 r=4 -const char MSG_FILAMENTCHANGE[] PROGMEM_I1 = ISTR("Change filament"); ////c=0 r=0 -const char MSG_FIND_BED_OFFSET_AND_SKEW_LINE1[] PROGMEM_I1 = ISTR("Searching bed calibration point"); ////c=60 r=0 -const char MSG_FIND_BED_OFFSET_AND_SKEW_LINE2[] PROGMEM_I1 = ISTR(" of 4"); ////c=14 r=0 +const char MSG_FILAMENTCHANGE[] PROGMEM_I1 = ISTR("Change filament"); //// +const char MSG_FIND_BED_OFFSET_AND_SKEW_LINE1[] PROGMEM_I1 = ISTR("Searching bed calibration point"); ////c=60 +const char MSG_FIND_BED_OFFSET_AND_SKEW_LINE2[] PROGMEM_I1 = ISTR(" of 4"); ////c=14 const char MSG_FINISHING_MOVEMENTS[] PROGMEM_I1 = ISTR("Finishing movements"); ////c=20 r=1 const char MSG_FOLLOW_CALIBRATION_FLOW[] PROGMEM_I1 = ISTR("Printer has not been calibrated yet. Please follow the manual, chapter First steps, section Calibration flow."); ////c=20 r=8 const char MSG_FOLLOW_Z_CALIBRATION_FLOW[] PROGMEM_I1 = ISTR("There is still a need to make Z calibration. Please follow the manual, chapter First steps, section Calibration flow."); ////c=20 r=8 const char MSG_FSENS_AUTOLOAD_NA[] PROGMEM_I1 = ISTR("F. autoload [N/A]"); ////c=17 r=1 -const char MSG_FSENSOR_OFF[] PROGMEM_I1 = ISTR("Fil. sensor [off]"); ////c=0 r=0 -const char MSG_FSENSOR_ON[] PROGMEM_I1 = ISTR("Fil. sensor [on]"); ////c=0 r=0 -const char MSG_HEATING[] PROGMEM_I1 = ISTR("Heating"); ////c=0 r=0 -const char MSG_HEATING_COMPLETE[] PROGMEM_I1 = ISTR("Heating done."); ////c=20 r=0 -const char MSG_HOMEYZ[] PROGMEM_I1 = ISTR("Calibrate Z"); ////c=0 r=0 +const char MSG_FSENSOR_OFF[] PROGMEM_I1 = ISTR("Fil. sensor [off]"); //// +const char MSG_FSENSOR_ON[] PROGMEM_I1 = ISTR("Fil. sensor [on]"); //// +const char MSG_HEATING[] PROGMEM_I1 = ISTR("Heating"); //// +const char MSG_HEATING_COMPLETE[] PROGMEM_I1 = ISTR("Heating done."); ////c=20 +const char MSG_HOMEYZ[] PROGMEM_I1 = ISTR("Calibrate Z"); //// const char MSG_CHOOSE_EXTRUDER[] PROGMEM_I1 = ISTR("Choose extruder:"); ////c=20 r=1 const char MSG_CHOOSE_FILAMENT[] PROGMEM_I1 = ISTR("Choose filament:"); ////c=20 r=1 -const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); ////c=17 r=0 -const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////c=20 r=0 +const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); ////c=17 +const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////c=20 const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1 -const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); ////c=0 r=0 -const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); ////c=0 r=0 -const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[] PROGMEM_I1 = ISTR("Measuring reference height of calibration point"); ////c=60 r=0 -const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[] PROGMEM_I1 = ISTR(" of 9"); ////c=14 r=0 -const char MSG_MENU_CALIBRATION[] PROGMEM_I1 = ISTR("Calibration"); ////c=0 r=0 -const char MSG_NO[] PROGMEM_I1 = ISTR("No"); ////c=0 r=0 -const char MSG_NOZZLE[] PROGMEM_I1 = ISTR("Nozzle"); ////c=0 r=0 +const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); //// +const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); //// +const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[] PROGMEM_I1 = ISTR("Measuring reference height of calibration point"); ////c=60 +const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[] PROGMEM_I1 = ISTR(" of 9"); ////c=14 +const char MSG_MENU_CALIBRATION[] PROGMEM_I1 = ISTR("Calibration"); //// +const char MSG_NO[] PROGMEM_I1 = ISTR("No"); //// +const char MSG_NOZZLE[] PROGMEM_I1 = ISTR("Nozzle"); //// const char MSG_PAPER[] PROGMEM_I1 = ISTR("Place a sheet of paper under the nozzle during the calibration of first 4 points. If the nozzle catches the paper, power off the printer immediately."); ////c=20 r=8 const char MSG_PLACE_STEEL_SHEET[] PROGMEM_I1 = ISTR("Please place steel sheet on heatbed."); ////c=20 r=4 -const char MSG_PLEASE_WAIT[] PROGMEM_I1 = ISTR("Please wait"); ////c=20 r=0 -const char MSG_PREHEAT_NOZZLE[] PROGMEM_I1 = ISTR("Preheat the nozzle!"); ////c=20 r=0 +const char MSG_PLEASE_WAIT[] PROGMEM_I1 = ISTR("Please wait"); ////c=20 +const char MSG_PREHEAT_NOZZLE[] PROGMEM_I1 = ISTR("Preheat the nozzle!"); ////c=20 const char MSG_PRESS_TO_UNLOAD[] PROGMEM_I1 = ISTR("Please press the knob to unload filament"); ////c=20 r=4 -const char MSG_PRINT_ABORTED[] PROGMEM_I1 = ISTR("Print aborted"); ////c=20 r=0 +const char MSG_PRINT_ABORTED[] PROGMEM_I1 = ISTR("Print aborted"); ////c=20 const char MSG_PULL_OUT_FILAMENT[] PROGMEM_I1 = ISTR("Please pull out filament immediately"); ////c=20 r=4 const char MSG_RECOVER_PRINT[] PROGMEM_I1 = ISTR("Blackout occurred. Recover print?"); ////c=20 r=2 -const char MSG_REFRESH[] PROGMEM_I1 = ISTR("\xF8" "Refresh"); ////c=0 r=0 -const char MSG_RESUMING_PRINT[] PROGMEM_I1 = ISTR("Resuming print"); ////c=0 r=0 +const char MSG_REFRESH[] PROGMEM_I1 = ISTR("\xF8" "Refresh"); //// +const char MSG_RESUMING_PRINT[] PROGMEM_I1 = ISTR("Resuming print"); //// const char MSG_REMOVE_STEEL_SHEET[] PROGMEM_I1 = ISTR("Please remove steel sheet from heatbed."); ////c=20 r=4 -const char MSG_SELFTEST_COOLING_FAN[] PROGMEM_I1 = ISTR("Front print fan?"); ////c=20 r=0 -const char MSG_SELFTEST_EXTRUDER_FAN[] PROGMEM_I1 = ISTR("Left hotend fan?"); ////c=20 r=0 -const char MSG_SELFTEST_FAILED[] PROGMEM_I1 = ISTR("Selftest failed "); ////c=20 r=0 -const char MSG_SELFTEST_FAN[] PROGMEM_I1 = ISTR("Fan test"); ////c=20 r=0 -const char MSG_SELFTEST_FAN_NO[] PROGMEM_I1 = ISTR("Not spinning"); ////c=19 r=0 -const char MSG_SELFTEST_FAN_YES[] PROGMEM_I1 = ISTR("Spinning"); ////c=19 r=0 -const char MSG_SELFTEST_CHECK_BED[] PROGMEM_I1 = ISTR("Checking bed "); ////c=20 r=0 -const char MSG_SELFTEST_CHECK_FSENSOR[] PROGMEM_I1 = ISTR("Checking sensors "); ////c=20 r=0 -const char MSG_SELFTEST_MOTOR[] PROGMEM_I1 = ISTR("Motor"); ////c=0 r=0 -const char MSG_SELFTEST_FILAMENT_SENSOR[] PROGMEM_I1 = ISTR("Filament sensor"); ////c=17 r=0 -const char MSG_SELFTEST_WIRINGERROR[] PROGMEM_I1 = ISTR("Wiring error"); ////c=0 r=0 -const char MSG_SETTINGS[] PROGMEM_I1 = ISTR("Settings"); ////c=0 r=0 -const char MSG_SILENT_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [high power]"); ////c=0 r=0 -const char MSG_SILENT_MODE_ON[] PROGMEM_I1 = ISTR("Mode [silent]"); ////c=0 r=0 -const char MSG_STEALTH_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [Normal]"); ////c=0 r=0 -const char MSG_STEALTH_MODE_ON[] PROGMEM_I1 = ISTR("Mode [Stealth]"); ////c=0 r=0 +const char MSG_SELFTEST_COOLING_FAN[] PROGMEM_I1 = ISTR("Front print fan?"); ////c=20 +const char MSG_SELFTEST_EXTRUDER_FAN[] PROGMEM_I1 = ISTR("Left hotend fan?"); ////c=20 +const char MSG_SELFTEST_FAILED[] PROGMEM_I1 = ISTR("Selftest failed "); ////c=20 +const char MSG_SELFTEST_FAN[] PROGMEM_I1 = ISTR("Fan test"); ////c=20 +const char MSG_SELFTEST_FAN_NO[] PROGMEM_I1 = ISTR("Not spinning"); ////c=19 +const char MSG_SELFTEST_FAN_YES[] PROGMEM_I1 = ISTR("Spinning"); ////c=19 +const char MSG_SELFTEST_CHECK_BED[] PROGMEM_I1 = ISTR("Checking bed "); ////c=20 +const char MSG_SELFTEST_CHECK_FSENSOR[] PROGMEM_I1 = ISTR("Checking sensors "); ////c=20 +const char MSG_SELFTEST_MOTOR[] PROGMEM_I1 = ISTR("Motor"); //// +const char MSG_SELFTEST_FILAMENT_SENSOR[] PROGMEM_I1 = ISTR("Filament sensor"); ////c=17 +const char MSG_SELFTEST_WIRINGERROR[] PROGMEM_I1 = ISTR("Wiring error"); //// +const char MSG_SETTINGS[] PROGMEM_I1 = ISTR("Settings"); //// +const char MSG_SILENT_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [high power]"); //// +const char MSG_SILENT_MODE_ON[] PROGMEM_I1 = ISTR("Mode [silent]"); //// +const char MSG_STEALTH_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [Normal]"); //// +const char MSG_STEALTH_MODE_ON[] PROGMEM_I1 = ISTR("Mode [Stealth]"); //// const char MSG_STEEL_SHEET_CHECK[] PROGMEM_I1 = ISTR("Is steel sheet on heatbed?"); ////c=20 r=2 -const char MSG_STOP_PRINT[] PROGMEM_I1 = ISTR("Stop print"); ////c=0 r=0 -const char MSG_STOPPED[] PROGMEM_I1 = ISTR("STOPPED. "); ////c=0 r=0 +const char MSG_STOP_PRINT[] PROGMEM_I1 = ISTR("Stop print"); //// +const char MSG_STOPPED[] PROGMEM_I1 = ISTR("STOPPED. "); //// const char MSG_TEMP_CALIBRATION[] PROGMEM_I1 = ISTR("Temp. cal. "); ////c=20 r=1 const char MSG_TEMP_CALIBRATION_DONE[] PROGMEM_I1 = ISTR("Temperature calibration is finished and active. Temp. calibration can be disabled in menu Settings->Temp. cal."); ////c=20 r=12 -const char MSG_UNLOAD_FILAMENT[] PROGMEM_I1 = ISTR("Unload filament"); ////c=17 r=0 +const char MSG_UNLOAD_FILAMENT[] PROGMEM_I1 = ISTR("Unload filament"); ////c=17 const char MSG_UNLOADING_FILAMENT[] PROGMEM_I1 = ISTR("Unloading filament"); ////c=20 r=1 -const char MSG_WATCH[] PROGMEM_I1 = ISTR("Info screen"); ////c=0 r=0 +const char MSG_WATCH[] PROGMEM_I1 = ISTR("Info screen"); //// const char MSG_WIZARD_CALIBRATION_FAILED[] PROGMEM_I1 = ISTR("Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer."); ////c=20 r=8 const char MSG_WIZARD_DONE[] PROGMEM_I1 = ISTR("All is done. Happy printing!"); ////c=20 r=8 const char MSG_WIZARD_HEATING[] PROGMEM_I1 = ISTR("Preheating nozzle. Please wait."); ////c=20 r=3 const char MSG_WIZARD_QUIT[] PROGMEM_I1 = ISTR("You can always resume the Wizard from Calibration -> Wizard."); ////c=20 r=8 -const char MSG_YES[] PROGMEM_I1 = ISTR("Yes"); ////c=0 r=0 -const char WELCOME_MSG[] PROGMEM_I1 = ISTR(CUSTOM_MENDEL_NAME " OK."); ////c=20 r=0 +const char MSG_YES[] PROGMEM_I1 = ISTR("Yes"); //// +const char WELCOME_MSG[] PROGMEM_I1 = ISTR(CUSTOM_MENDEL_NAME " OK."); ////c=20 //not internationalized messages -const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; ////c=0 r=0 -const char MSG_BROWNOUT_RESET[] PROGMEM_N1 = " Brown out Reset"; ////c=0 r=0 -const char MSG_EXTERNAL_RESET[] PROGMEM_N1 = " External Reset"; ////c=0 r=0 -const char MSG_FILE_SAVED[] PROGMEM_N1 = "Done saving file."; ////c=0 r=0 -const char MSG_OFF[] PROGMEM_N1 = "Off"; ////c=0 r=0 -const char MSG_ON[] PROGMEM_N1 = "On "; ////c=0 r=0 -const char MSG_POSITION_UNKNOWN[] PROGMEM_N1 = "Home X/Y before Z"; ////c=0 r=0 -const char MSG_SOFTWARE_RESET[] PROGMEM_N1 = " Software Reset"; ////c=0 r=0 -const char MSG_UNKNOWN_COMMAND[] PROGMEM_N1 = "Unknown command: \""; ////c=0 r=0 -const char MSG_WATCHDOG_RESET[] PROGMEM_N1 = " Watchdog Reset"; ////c=0 r=0 -const char MSG_Z_MAX[] PROGMEM_N1 = "z_max: "; ////c=0 r=0 -const char MSG_Z_MIN[] PROGMEM_N1 = "z_min: "; ////c=0 r=0 -const char MSG_ZPROBE_OUT[] PROGMEM_N1 = "Z probe out. bed"; ////c=0 r=0 -const char MSG_ZPROBE_ZOFFSET[] PROGMEM_N1 = "Z Offset"; ////c=0 r=0 -const char MSG_TMC_OVERTEMP[] PROGMEM_N1 = "TMC DRIVER OVERTEMP"; ////c=0 r=0 -const char MSG_Enqueing[] PROGMEM_N1 = "enqueing \""; ////c=0 r=0 -const char MSG_ENDSTOPS_HIT[] PROGMEM_N1 = "endstops hit: "; ////c=0 r=0 -const char MSG_SD_ERR_WRITE_TO_FILE[] PROGMEM_N1 = "error writing to file"; ////c=0 r=0 -const char MSG_OK[] PROGMEM_N1 = "ok"; ////c=0 r=0 -const char MSG_SD_OPEN_FILE_FAIL[] PROGMEM_N1 = "open failed, File: "; ////c=0 r=0 -const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; ////c=0 r=0 -const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; ////c=0 r=0 -const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; ////c=0 r=0 -const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; ////c=0 r=0 +const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; //// +const char MSG_BROWNOUT_RESET[] PROGMEM_N1 = " Brown out Reset"; //// +const char MSG_EXTERNAL_RESET[] PROGMEM_N1 = " External Reset"; //// +const char MSG_FILE_SAVED[] PROGMEM_N1 = "Done saving file."; //// +const char MSG_OFF[] PROGMEM_N1 = "Off"; //// +const char MSG_ON[] PROGMEM_N1 = "On "; //// +const char MSG_POSITION_UNKNOWN[] PROGMEM_N1 = "Home X/Y before Z"; //// +const char MSG_SOFTWARE_RESET[] PROGMEM_N1 = " Software Reset"; //// +const char MSG_UNKNOWN_COMMAND[] PROGMEM_N1 = "Unknown command: \""; //// +const char MSG_WATCHDOG_RESET[] PROGMEM_N1 = " Watchdog Reset"; //// +const char MSG_Z_MAX[] PROGMEM_N1 = "z_max: "; //// +const char MSG_Z_MIN[] PROGMEM_N1 = "z_min: "; //// +const char MSG_ZPROBE_OUT[] PROGMEM_N1 = "Z probe out. bed"; //// +const char MSG_ZPROBE_ZOFFSET[] PROGMEM_N1 = "Z Offset"; //// +const char MSG_TMC_OVERTEMP[] PROGMEM_N1 = "TMC DRIVER OVERTEMP"; //// +const char MSG_Enqueing[] PROGMEM_N1 = "enqueing \""; //// +const char MSG_ENDSTOPS_HIT[] PROGMEM_N1 = "endstops hit: "; //// +const char MSG_SD_ERR_WRITE_TO_FILE[] PROGMEM_N1 = "error writing to file"; //// +const char MSG_OK[] PROGMEM_N1 = "ok"; //// +const char MSG_SD_OPEN_FILE_FAIL[] PROGMEM_N1 = "open failed, File: "; //// +const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// +const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// +const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// +const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index 5008288a6..4a8d6659a 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -764,7 +764,7 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate de_float = 0; #endif SERIAL_ECHO_START; - SERIAL_ECHOLNRPGM(_n(" cold extrusion prevented"));////MSG_ERR_COLD_EXTRUDE_STOP c=0 r=0 + SERIAL_ECHOLNRPGM(_n(" cold extrusion prevented"));////MSG_ERR_COLD_EXTRUDE_STOP } #ifdef PREVENT_LENGTHY_EXTRUDE @@ -776,7 +776,7 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate de_float = 0; #endif SERIAL_ECHO_START; - SERIAL_ECHOLNRPGM(_n(" too long extrusion prevented"));////MSG_ERR_LONG_EXTRUDE_STOP c=0 r=0 + SERIAL_ECHOLNRPGM(_n(" too long extrusion prevented"));////MSG_ERR_LONG_EXTRUDE_STOP } #endif } diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index c21a4e9f1..74d25777c 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -348,7 +348,7 @@ FORCE_INLINE unsigned short calc_timer(uint16_t step_rate) { timer = (unsigned short)pgm_read_word_near(table_address); timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3); } - if(timer < 100) { timer = 100; MYSERIAL.print(_N("Steprate too high: ")); MYSERIAL.println(step_rate); }//(20kHz this should never happen)////MSG_STEPPER_TOO_HIGH c=0 r=0 + if(timer < 100) { timer = 100; MYSERIAL.print(_N("Steprate too high: ")); MYSERIAL.println(step_rate); }//(20kHz this should never happen)////MSG_STEPPER_TOO_HIGH return timer; } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8b923858f..6f8594724 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -800,7 +800,7 @@ void lcdui_print_status_line(void) lcd_set_cursor(0, 3); lcd_puts_P(PSTR(" ")); lcd_set_cursor(0, 3); - lcd_puts_P(_i("Calibration done"));////MSG_HOMEYZ_DONE c=0 r=0 + lcd_puts_P(_i("Calibration done"));////MSG_HOMEYZ_DONE custom_message_state--; } } @@ -2252,9 +2252,9 @@ static void lcd_support_menu() MENU_ITEM_BACK_P(PSTR("FW - " FW_version)); }*/ - MENU_ITEM_BACK_P(_i("prusa3d.com"));////MSG_PRUSA3D c=0 r=0 - MENU_ITEM_BACK_P(_i("forum.prusa3d.com"));////MSG_PRUSA3D_FORUM c=0 r=0 - MENU_ITEM_BACK_P(_i("howto.prusa3d.com"));////MSG_PRUSA3D_HOWTO c=0 r=0 + MENU_ITEM_BACK_P(_i("prusa3d.com"));////MSG_PRUSA3D + MENU_ITEM_BACK_P(_i("forum.prusa3d.com"));////MSG_PRUSA3D_FORUM + MENU_ITEM_BACK_P(_i("howto.prusa3d.com"));////MSG_PRUSA3D_HOWTO MENU_ITEM_BACK_P(STR_SEPARATOR); MENU_ITEM_BACK_P(PSTR(FILAMENT_SIZE)); MENU_ITEM_BACK_P(PSTR(ELECTRONICS)); @@ -2714,11 +2714,11 @@ void lcd_wait_interact() { #ifdef SNMM lcd_puts_P(_i("Prepare new filament"));////MSG_PREPARE_FILAMENT c=20 r=1 #else - lcd_puts_P(_i("Insert filament"));////MSG_INSERT_FILAMENT c=20 r=0 + lcd_puts_P(_i("Insert filament"));////MSG_INSERT_FILAMENT c=20 #endif if (!fsensor_autoload_enabled) { lcd_set_cursor(0, 2); - lcd_puts_P(_i("and press the knob"));////MSG_PRESS c=20 r=0 + lcd_puts_P(_i("and press the knob"));////MSG_PRESS c=20 } } @@ -2729,7 +2729,7 @@ void lcd_change_success() { lcd_set_cursor(0, 2); - lcd_puts_P(_i("Change success!"));////MSG_CHANGE_SUCCESS c=0 r=0 + lcd_puts_P(_i("Change success!"));////MSG_CHANGE_SUCCESS } @@ -2754,7 +2754,7 @@ void lcd_loading_color() { lcd_set_cursor(0, 0); - lcd_puts_P(_i("Loading color"));////MSG_LOADING_COLOR c=0 r=0 + lcd_puts_P(_i("Loading color"));////MSG_LOADING_COLOR lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_PLEASE_WAIT)); lcd_loading_progress_bar((FILAMENTCHANGE_FINALFEED * 1000ul) / FILAMENTCHANGE_EFEED_FINAL); //show progress bar during filament loading slow sequence @@ -2806,7 +2806,7 @@ void lcd_alright() { lcd_set_cursor(0, 0); - lcd_puts_P(_i("Changed correctly?"));////MSG_CORRECTLY c=20 r=0 + lcd_puts_P(_i("Changed correctly?"));////MSG_CORRECTLY c=20 lcd_set_cursor(1, 1); @@ -2814,11 +2814,11 @@ void lcd_alright() { lcd_set_cursor(1, 2); - lcd_puts_P(_i("Filament not loaded"));////MSG_NOT_LOADED c=19 r=0 + lcd_puts_P(_i("Filament not loaded"));////MSG_NOT_LOADED c=19 lcd_set_cursor(1, 3); - lcd_puts_P(_i("Color not correct"));////MSG_NOT_COLOR c=0 r=0 + lcd_puts_P(_i("Color not correct"));////MSG_NOT_COLOR lcd_set_cursor(0, 1); @@ -3170,7 +3170,7 @@ static void lcd_menu_xyz_skew() static void lcd_menu_xyz_offset() { lcd_set_cursor(0,0); - lcd_puts_P(_i("[0;0] point offset"));////MSG_MEASURED_OFFSET c=0 r=0 + lcd_puts_P(_i("[0;0] point offset"));////MSG_MEASURED_OFFSET lcd_puts_at_P(0, 1, separator); lcd_puts_at_P(0, 2, PSTR("X")); lcd_puts_at_P(0, 3, PSTR("Y")); @@ -3299,7 +3299,7 @@ static void _lcd_babystep(int axis, const char *msg) static void lcd_babystep_z() { - _lcd_babystep(Z_AXIS, (_i("Adjusting Z")));////MSG_BABYSTEPPING_Z c=20 r=0 + _lcd_babystep(Z_AXIS, (_i("Adjusting Z")));////MSG_BABYSTEPPING_Z c=20 } @@ -3358,7 +3358,7 @@ void lcd_adjust_bed(void) MENU_ITEM_EDIT_int3_P(_i("Right side[um]"), &_md->right, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_RIGHT c=14 r=1 MENU_ITEM_EDIT_int3_P(_i("Front side[um]"), &_md->front, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_FRONT c=14 r=1 MENU_ITEM_EDIT_int3_P(_i("Rear side [um]"), &_md->rear, -BED_ADJUSTMENT_UM_MAX, BED_ADJUSTMENT_UM_MAX);////MSG_BED_CORRECTION_REAR c=14 r=1 - MENU_ITEM_FUNCTION_P(_i("Reset"), lcd_adjust_bed_reset);////MSG_BED_CORRECTION_RESET c=0 r=0 + MENU_ITEM_FUNCTION_P(_i("Reset"), lcd_adjust_bed_reset);////MSG_BED_CORRECTION_RESET MENU_END(); } @@ -3391,7 +3391,7 @@ void lcd_adjust_z() { lcd_clear(); lcd_set_cursor(0, 0); - lcd_puts_P(_i("Auto adjust Z?"));////MSG_ADJUSTZ c=0 r=0 + lcd_puts_P(_i("Auto adjust Z?"));////MSG_ADJUSTZ lcd_set_cursor(1, 1); lcd_puts_P(_T(MSG_YES)); @@ -4338,7 +4338,7 @@ void lcd_pick_babystep(){ lcd_set_cursor(0, 0); - lcd_puts_P(_i("Pick print"));////MSG_PICK_Z c=0 r=0 + lcd_puts_P(_i("Pick print"));////MSG_PICK_Z lcd_set_cursor(3, 2); @@ -4432,10 +4432,10 @@ void lcd_move_menu_axis() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); - MENU_ITEM_SUBMENU_P(_i("Move X"), lcd_move_x);////MSG_MOVE_X c=0 r=0 - MENU_ITEM_SUBMENU_P(_i("Move Y"), lcd_move_y);////MSG_MOVE_Y c=0 r=0 - MENU_ITEM_SUBMENU_P(_i("Move Z"), lcd_move_z);////MSG_MOVE_Z c=0 r=0 - MENU_ITEM_SUBMENU_P(_i("Extruder"), lcd_move_e);////MSG_MOVE_E c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Move X"), lcd_move_x);////MSG_MOVE_X + MENU_ITEM_SUBMENU_P(_i("Move Y"), lcd_move_y);////MSG_MOVE_Y + MENU_ITEM_SUBMENU_P(_i("Move Z"), lcd_move_z);////MSG_MOVE_Z + MENU_ITEM_SUBMENU_P(_i("Extruder"), lcd_move_e);////MSG_MOVE_E MENU_END(); } @@ -5166,11 +5166,11 @@ void lcd_settings_linearity_correction_menu(void) #ifdef TMC2130_LINEARITY_CORRECTION_XYZ //tmc2130_wave_fac[X_AXIS] - MENU_ITEM_EDIT_int3_P(_i("X-correct"), &tmc2130_wave_fac[X_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 r=0 - MENU_ITEM_EDIT_int3_P(_i("Y-correct"), &tmc2130_wave_fac[Y_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 r=0 - MENU_ITEM_EDIT_int3_P(_i("Z-correct"), &tmc2130_wave_fac[Z_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 r=0 + MENU_ITEM_EDIT_int3_P(_i("X-correct"), &tmc2130_wave_fac[X_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 + MENU_ITEM_EDIT_int3_P(_i("Y-correct"), &tmc2130_wave_fac[Y_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 + MENU_ITEM_EDIT_int3_P(_i("Z-correct"), &tmc2130_wave_fac[Z_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 #endif //TMC2130_LINEARITY_CORRECTION_XYZ - MENU_ITEM_EDIT_int3_P(_i("E-correct"), &tmc2130_wave_fac[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 r=0 + MENU_ITEM_EDIT_int3_P(_i("E-correct"), &tmc2130_wave_fac[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 MENU_END(); } #endif // TMC2130 @@ -5184,7 +5184,7 @@ do\ if (fsensor_not_responding && (mmu_enabled == false))\ {\ /* Filament sensor not working*/\ - MENU_ITEM_FUNCTION_P(_i("Fil. sensor [N/A]"), lcd_fsensor_state_set);/*////MSG_FSENSOR_NA c=0 r=0*/\ + MENU_ITEM_FUNCTION_P(_i("Fil. sensor [N/A]"), lcd_fsensor_state_set);/*////MSG_FSENSOR_NA*/\ MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_fsensor_fail);\ }\ else\ @@ -5431,11 +5431,11 @@ static void lcd_settings_menu() MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_SUBMENU_P(_i("Temperature"), lcd_control_temperature_menu);////MSG_TEMPERATURE c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Temperature"), lcd_control_temperature_menu);////MSG_TEMPERATURE if (!homing_flag) - MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_1mm);////MSG_MOVE_AXIS c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_1mm);////MSG_MOVE_AXIS if (!isPrintPaused) - MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS c=0 r=0 + MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS SETTINGS_FILAMENT_SENSOR; @@ -5473,7 +5473,7 @@ static void lcd_settings_menu() MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z); #if (LANG_MODE != 0) - MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT #endif //(LANG_MODE != 0) SETTINGS_SD; @@ -5524,31 +5524,31 @@ static void lcd_calibration_menu() MENU_ITEM_FUNCTION_P(_i("Wizard"), lcd_wizard);////MSG_WIZARD c=17 r=1 MENU_ITEM_SUBMENU_P(_i("First layer cal."), lcd_v2_calibration);////MSG_V2_CALIBRATION c=17 r=1 MENU_ITEM_GCODE_P(_T(MSG_AUTO_HOME), PSTR("G28 W")); - MENU_ITEM_FUNCTION_P(_i("Selftest "), lcd_selftest_v);////MSG_SELFTEST c=0 r=0 + MENU_ITEM_FUNCTION_P(_i("Selftest "), lcd_selftest_v);////MSG_SELFTEST #ifdef MK1BP // MK1 // "Calibrate Z" MENU_ITEM_GCODE_P(_T(MSG_HOMEYZ), PSTR("G28 Z")); #else //MK1BP // MK2 - MENU_ITEM_FUNCTION_P(_i("Calibrate XYZ"), lcd_mesh_calibration);////MSG_CALIBRATE_BED c=0 r=0 + MENU_ITEM_FUNCTION_P(_i("Calibrate XYZ"), lcd_mesh_calibration);////MSG_CALIBRATE_BED // "Calibrate Z" with storing the reference values to EEPROM. MENU_ITEM_SUBMENU_P(_T(MSG_HOMEYZ), lcd_mesh_calibration_z); #ifndef SNMM //MENU_ITEM_FUNCTION_P(_i("Calibrate E"), lcd_calibrate_extruder);////MSG_CALIBRATE_E c=20 r=1 #endif // "Mesh Bed Leveling" - MENU_ITEM_SUBMENU_P(_i("Mesh Bed Leveling"), lcd_mesh_bedleveling);////MSG_MESH_BED_LEVELING c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Mesh Bed Leveling"), lcd_mesh_bedleveling);////MSG_MESH_BED_LEVELING #endif //MK1BP - MENU_ITEM_SUBMENU_P(_i("Bed level correct"), lcd_adjust_bed);////MSG_BED_CORRECTION_MENU c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Bed level correct"), lcd_adjust_bed);////MSG_BED_CORRECTION_MENU MENU_ITEM_SUBMENU_P(_i("PID calibration"), pid_extruder);////MSG_PID_EXTRUDER c=17 r=1 #ifndef TMC2130 MENU_ITEM_SUBMENU_P(_i("Show end stops"), menu_show_end_stops);////MSG_SHOW_END_STOPS c=17 r=1 #endif #ifndef MK1BP - MENU_ITEM_GCODE_P(_i("Reset XYZ calibr."), PSTR("M44"));////MSG_CALIBRATE_BED_RESET c=0 r=0 + MENU_ITEM_GCODE_P(_i("Reset XYZ calibr."), PSTR("M44"));////MSG_CALIBRATE_BED_RESET #endif //MK1BP #ifndef SNMM //MENU_ITEM_FUNCTION_P(MSG_RESET_CALIBRATE_E, lcd_extr_cal_reset); @@ -5920,11 +5920,11 @@ static void fil_load_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_P(_i("Load all"), load_all);////MSG_LOAD_ALL c=17 r=0 - MENU_ITEM_FUNCTION_P(_i("Load filament 1"), extr_adj_0);////MSG_LOAD_FILAMENT_1 c=17 r=0 - MENU_ITEM_FUNCTION_P(_i("Load filament 2"), extr_adj_1);////MSG_LOAD_FILAMENT_2 c=17 r=0 - MENU_ITEM_FUNCTION_P(_i("Load filament 3"), extr_adj_2);////MSG_LOAD_FILAMENT_3 c=17 r=0 - MENU_ITEM_FUNCTION_P(_i("Load filament 4"), extr_adj_3);////MSG_LOAD_FILAMENT_4 c=17 r=0 + MENU_ITEM_FUNCTION_P(_i("Load all"), load_all);////MSG_LOAD_ALL c=17 + MENU_ITEM_FUNCTION_P(_i("Load filament 1"), extr_adj_0);////MSG_LOAD_FILAMENT_1 c=17 + MENU_ITEM_FUNCTION_P(_i("Load filament 2"), extr_adj_1);////MSG_LOAD_FILAMENT_2 c=17 + MENU_ITEM_FUNCTION_P(_i("Load filament 3"), extr_adj_2);////MSG_LOAD_FILAMENT_3 c=17 + MENU_ITEM_FUNCTION_P(_i("Load filament 4"), extr_adj_3);////MSG_LOAD_FILAMENT_4 c=17 if (mmu_enabled) MENU_ITEM_FUNCTION_P(_i("Load filament 5"), extr_adj_4); @@ -6036,14 +6036,14 @@ static void fil_unload_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_P(_i("Unload all"), extr_unload_all);////MSG_UNLOAD_ALL c=17 r=0 - MENU_ITEM_FUNCTION_P(_i("Unload filament 1"), extr_unload_0);////MSG_UNLOAD_FILAMENT_1 c=17 r=0 - MENU_ITEM_FUNCTION_P(_i("Unload filament 2"), extr_unload_1);////MSG_UNLOAD_FILAMENT_2 c=17 r=0 - MENU_ITEM_FUNCTION_P(_i("Unload filament 3"), extr_unload_2);////MSG_UNLOAD_FILAMENT_3 c=17 r=0 - MENU_ITEM_FUNCTION_P(_i("Unload filament 4"), extr_unload_3);////MSG_UNLOAD_FILAMENT_4 c=17 r=0 + MENU_ITEM_FUNCTION_P(_i("Unload all"), extr_unload_all);////MSG_UNLOAD_ALL c=17 + MENU_ITEM_FUNCTION_P(_i("Unload filament 1"), extr_unload_0);////MSG_UNLOAD_FILAMENT_1 c=17 + MENU_ITEM_FUNCTION_P(_i("Unload filament 2"), extr_unload_1);////MSG_UNLOAD_FILAMENT_2 c=17 + MENU_ITEM_FUNCTION_P(_i("Unload filament 3"), extr_unload_2);////MSG_UNLOAD_FILAMENT_3 c=17 + MENU_ITEM_FUNCTION_P(_i("Unload filament 4"), extr_unload_3);////MSG_UNLOAD_FILAMENT_4 c=17 if (mmu_enabled) - MENU_ITEM_FUNCTION_P(_i("Unload filament 5"), extr_unload_4);////MSG_UNLOAD_FILAMENT_5 c=17 r=0 + MENU_ITEM_FUNCTION_P(_i("Unload filament 5"), extr_unload_4);////MSG_UNLOAD_FILAMENT_5 c=17 MENU_END(); } @@ -6434,10 +6434,10 @@ static void lcd_main_menu() if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) { - MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE } else { - MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT } #ifdef SDSUPPORT @@ -6448,11 +6448,11 @@ static void lcd_main_menu() if (mesh_bed_leveling_flag == false && homing_flag == false) { if (card.sdprinting) { - MENU_ITEM_FUNCTION_P(_i("Pause print"), lcd_pause_print);////MSG_PAUSE_PRINT c=0 r=0 + MENU_ITEM_FUNCTION_P(_i("Pause print"), lcd_pause_print);////MSG_PAUSE_PRINT } else { - MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT } MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } @@ -6471,16 +6471,16 @@ static void lcd_main_menu() } } #if SDCARDDETECT < 1 - MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD c=0 r=0 + MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD #endif } } else { bMain=true; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function - MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD #if SDCARDDETECT < 1 - MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface////MSG_INIT_SDCARD c=0 r=0 + MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface////MSG_INIT_SDCARD #endif } #endif @@ -6515,7 +6515,7 @@ static void lcd_main_menu() #endif #ifdef FILAMENT_SENSOR if ((fsensor_autoload_enabled == true) && (fsensor_enabled == true) && (mmu_enabled == false)) - MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=17 r=0 + MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=17 else #endif //FILAMENT_SENSOR { @@ -6532,7 +6532,7 @@ static void lcd_main_menu() if (!is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) { - MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS } #if defined(TMC2130) || defined(FILAMENT_SENSOR) @@ -6541,9 +6541,9 @@ static void lcd_main_menu() if (mmu_enabled) { MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu); } - MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT #ifdef LCD_TEST - MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT #endif //LCD_TEST MENU_END(); @@ -6623,13 +6623,13 @@ static void lcd_tune_menu() MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); //1 - MENU_ITEM_EDIT_int3_P(_i("Speed"), &feedmultiply, 10, 999);//2////MSG_SPEED c=0 r=0 + MENU_ITEM_EDIT_int3_P(_i("Speed"), &feedmultiply, 10, 999);//2////MSG_SPEED MENU_ITEM_EDIT_int3_P(_T(MSG_NOZZLE), &target_temperature[0], 0, HEATER_0_MAXTEMP - 10);//3 MENU_ITEM_EDIT_int3_P(_T(MSG_BED), &target_temperature_bed, 0, BED_MAXTEMP - 10);//4 MENU_ITEM_EDIT_int3_P(_T(MSG_FAN_SPEED), &fanSpeed, 0, 255);//5 - MENU_ITEM_EDIT_int3_P(_i("Flow"), &extrudemultiply, 10, 999);//6////MSG_FLOW c=0 r=0 + MENU_ITEM_EDIT_int3_P(_i("Flow"), &extrudemultiply, 10, 999);//6////MSG_FLOW #ifdef FILAMENTCHANGEENABLE MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//7 #endif @@ -6724,18 +6724,18 @@ static void lcd_mesh_bed_leveling_settings() MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); - if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_toggle); ////MSG_MESH_3x3 c=18 r=0 - else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_toggle); ////MSG_MESH_7x7 c=18 r=0 + if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_toggle); ////MSG_MESH_3x3 c=18 + else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_toggle); ////MSG_MESH_7x7 c=18 switch (mbl_z_probe_nr) { - case 1: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [1]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 - case 5: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [5]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 - default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + case 1: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [1]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 + case 5: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [5]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 + default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 } if (points_nr == 7) { - if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_ON c=18 r=0 - else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_OFF c=18 r=0 + if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_ON c=18 + else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_OFF c=18 } - else menu_item_text_P(_i("Magnets comp.[N/A]")); ////MSG_MAGNETS_COMP_NA c=18 r=0 + else menu_item_text_P(_i("Magnets comp.[N/A]")); ////MSG_MAGNETS_COMP_NA c=18 MENU_END(); //SETTINGS_MBL_MODE; } @@ -6754,10 +6754,10 @@ static void lcd_control_temperature_menu() MENU_ITEM_EDIT_int3_P(_T(MSG_NOZZLE), &target_temperature[0], 0, HEATER_0_MAXTEMP - 10); #endif #if TEMP_SENSOR_1 != 0 - MENU_ITEM_EDIT_int3_P(_i("Nozzle2"), &target_temperature[1], 0, HEATER_1_MAXTEMP - 10);////MSG_NOZZLE1 c=0 r=0 + MENU_ITEM_EDIT_int3_P(_i("Nozzle2"), &target_temperature[1], 0, HEATER_1_MAXTEMP - 10);////MSG_NOZZLE1 #endif #if TEMP_SENSOR_2 != 0 - MENU_ITEM_EDIT_int3_P(_i("Nozzle3"), &target_temperature[2], 0, HEATER_2_MAXTEMP - 10);////MSG_NOZZLE2 c=0 r=0 + MENU_ITEM_EDIT_int3_P(_i("Nozzle3"), &target_temperature[2], 0, HEATER_2_MAXTEMP - 10);////MSG_NOZZLE2 #endif #if TEMP_SENSOR_BED != 0 MENU_ITEM_EDIT_int3_P(_T(MSG_BED), &target_temperature_bed, 0, BED_MAXTEMP - 3); @@ -6766,9 +6766,9 @@ static void lcd_control_temperature_menu() #if defined AUTOTEMP && (TEMP_SENSOR_0 != 0) //MENU_ITEM_EDIT removed, following code must be redesigned if AUTOTEMP enabled MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled); - MENU_ITEM_EDIT(float3, _i(" \002 Min"), &autotemp_min, 0, HEATER_0_MAXTEMP - 10);////MSG_MIN c=0 r=0 - MENU_ITEM_EDIT(float3, _i(" \002 Max"), &autotemp_max, 0, HEATER_0_MAXTEMP - 10);////MSG_MAX c=0 r=0 - MENU_ITEM_EDIT(float32, _i(" \002 Fact"), &autotemp_factor, 0.0, 1.0);////MSG_FACTOR c=0 r=0 + MENU_ITEM_EDIT(float3, _i(" \002 Min"), &autotemp_min, 0, HEATER_0_MAXTEMP - 10);////MSG_MIN + MENU_ITEM_EDIT(float3, _i(" \002 Max"), &autotemp_max, 0, HEATER_0_MAXTEMP - 10);////MSG_MAX + MENU_ITEM_EDIT(float32, _i(" \002 Fact"), &autotemp_factor, 0.0, 1.0);////MSG_FACTOR #endif MENU_END(); @@ -6920,7 +6920,7 @@ bool lcd_selftest() bool _result = true; lcd_wait_for_cool_down(); lcd_clear(); - lcd_set_cursor(0, 0); lcd_puts_P(_i("Self test start "));////MSG_SELFTEST_START c=20 r=0 + lcd_set_cursor(0, 0); lcd_puts_P(_i("Self test start "));////MSG_SELFTEST_START c=20 #ifdef TMC2130 FORCE_HIGH_POWER_START; #endif // TMC2130 @@ -7100,7 +7100,7 @@ bool lcd_selftest() if (_result) { - LCD_ALERTMESSAGERPGM(_i("Self test OK"));////MSG_SELFTEST_OK c=0 r=0 + LCD_ALERTMESSAGERPGM(_i("Self test OK"));////MSG_SELFTEST_OK } else { @@ -7527,27 +7527,27 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_clear(); lcd_set_cursor(0, 0); - lcd_puts_P(_i("Selftest error !"));////MSG_SELFTEST_ERROR c=0 r=0 + lcd_puts_P(_i("Selftest error !"));////MSG_SELFTEST_ERROR lcd_set_cursor(0, 1); - lcd_puts_P(_i("Please check :"));////MSG_SELFTEST_PLEASECHECK c=0 r=0 + lcd_puts_P(_i("Please check :"));////MSG_SELFTEST_PLEASECHECK switch (testError) { case TestError::heater: lcd_set_cursor(0, 2); - lcd_puts_P(_i("Heater/Thermistor"));////MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 + lcd_puts_P(_i("Heater/Thermistor"));////MSG_SELFTEST_HEATERTHERMISTOR lcd_set_cursor(0, 3); - lcd_puts_P(_i("Not connected"));////MSG_SELFTEST_NOTCONNECTED c=0 r=0 + lcd_puts_P(_i("Not connected"));////MSG_SELFTEST_NOTCONNECTED break; case TestError::bed: lcd_set_cursor(0, 2); - lcd_puts_P(_i("Bed / Heater"));////MSG_SELFTEST_BEDHEATER c=0 r=0 + lcd_puts_P(_i("Bed / Heater"));////MSG_SELFTEST_BEDHEATER lcd_set_cursor(0, 3); lcd_puts_P(_T(MSG_SELFTEST_WIRINGERROR)); break; case TestError::endstops: lcd_set_cursor(0, 2); - lcd_puts_P(_i("Endstops"));////MSG_SELFTEST_ENDSTOPS c=0 r=0 + lcd_puts_P(_i("Endstops"));////MSG_SELFTEST_ENDSTOPS lcd_set_cursor(0, 3); lcd_puts_P(_T(MSG_SELFTEST_WIRINGERROR)); lcd_set_cursor(17, 3); @@ -7559,7 +7559,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(18, 2); lcd_print(_error_1); lcd_set_cursor(0, 3); - lcd_puts_P(_i("Endstop"));////MSG_SELFTEST_ENDSTOP c=0 r=0 + lcd_puts_P(_i("Endstop"));////MSG_SELFTEST_ENDSTOP lcd_set_cursor(18, 3); lcd_print(_error_2); break; @@ -7597,17 +7597,17 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const break; case TestError::axis: lcd_set_cursor(0, 2); - lcd_puts_P(_i("Axis length"));////MSG_SELFTEST_AXIS_LENGTH c=0 r=0 + lcd_puts_P(_i("Axis length"));////MSG_SELFTEST_AXIS_LENGTH lcd_set_cursor(0, 3); - lcd_puts_P(_i("Axis"));////MSG_SELFTEST_AXIS c=0 r=0 + lcd_puts_P(_i("Axis"));////MSG_SELFTEST_AXIS lcd_set_cursor(18, 3); lcd_print(_error_1); break; case TestError::swappedFan: lcd_set_cursor(0, 2); - lcd_puts_P(_i("Front/left fans"));////MSG_SELFTEST_FANS c=0 r=0 + lcd_puts_P(_i("Front/left fans"));////MSG_SELFTEST_FANS lcd_set_cursor(0, 3); - lcd_puts_P(_i("Swapped"));////MSG_SELFTEST_SWAPPED c=0 r=0 + lcd_puts_P(_i("Swapped"));////MSG_SELFTEST_SWAPPED lcd_set_cursor(18, 3); lcd_print(_error_1); break; @@ -7621,7 +7621,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_FILAMENT_SENSOR)); lcd_set_cursor(0, 3); - lcd_puts_P(_i("False triggering"));////c=20 r=0 + lcd_puts_P(_i("False triggering"));////c=20 break; } @@ -7931,16 +7931,16 @@ static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_s if (screen == testScreen::extruderFan) lcd_puts_P(_T(MSG_SELFTEST_FAN)); if (screen == testScreen::printFan) lcd_puts_P(_T(MSG_SELFTEST_FAN)); if (screen == testScreen::fansOk) lcd_puts_P(_T(MSG_SELFTEST_FAN)); - if (screen == testScreen::endStops) lcd_puts_P(_i("Checking endstops"));////MSG_SELFTEST_CHECK_ENDSTOPS c=20 r=0 - if (screen == testScreen::axisX) lcd_puts_P(_i("Checking X axis "));////MSG_SELFTEST_CHECK_X c=20 r=0 - if (screen == testScreen::axisY) lcd_puts_P(_i("Checking Y axis "));////MSG_SELFTEST_CHECK_Y c=20 r=0 - if (screen == testScreen::axisZ) lcd_puts_P(_i("Checking Z axis "));////MSG_SELFTEST_CHECK_Z c=20 r=0 + if (screen == testScreen::endStops) lcd_puts_P(_i("Checking endstops"));////MSG_SELFTEST_CHECK_ENDSTOPS c=20 + if (screen == testScreen::axisX) lcd_puts_P(_i("Checking X axis "));////MSG_SELFTEST_CHECK_X c=20 + if (screen == testScreen::axisY) lcd_puts_P(_i("Checking Y axis "));////MSG_SELFTEST_CHECK_Y c=20 + if (screen == testScreen::axisZ) lcd_puts_P(_i("Checking Z axis "));////MSG_SELFTEST_CHECK_Z c=20 if (screen == testScreen::bed) lcd_puts_P(_T(MSG_SELFTEST_CHECK_BED)); if (screen == testScreen::hotend - || screen == testScreen::hotendOk) lcd_puts_P(_i("Checking hotend "));////MSG_SELFTEST_CHECK_HOTEND c=20 r=0 + || screen == testScreen::hotendOk) lcd_puts_P(_i("Checking hotend "));////MSG_SELFTEST_CHECK_HOTEND c=20 if (screen == testScreen::fsensor) lcd_puts_P(_T(MSG_SELFTEST_CHECK_FSENSOR)); if (screen == testScreen::fsensorOk) lcd_puts_P(_T(MSG_SELFTEST_CHECK_FSENSOR)); - if (screen == testScreen::allCorrect) lcd_puts_P(_i("All correct "));////MSG_SELFTEST_CHECK_ALLCORRECT c=20 r=0 + if (screen == testScreen::allCorrect) lcd_puts_P(_i("All correct "));////MSG_SELFTEST_CHECK_ALLCORRECT c=20 if (screen == testScreen::failed) lcd_puts_P(_T(MSG_SELFTEST_FAILED)); if (screen == testScreen::home) lcd_puts_P(_i("Calibrating home"));////c=20 r=1 @@ -7949,10 +7949,10 @@ static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_s if ((screen >= testScreen::extruderFan) && (screen <= testScreen::fansOk)) { //SERIAL_ECHOLNPGM("Fan test"); - lcd_puts_at_P(0, 2, _i("Extruder fan:"));////MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 + lcd_puts_at_P(0, 2, _i("Extruder fan:"));////MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 lcd_set_cursor(18, 2); (screen < testScreen::printFan) ? lcd_print(_indicator) : lcd_print("OK"); - lcd_puts_at_P(0, 3, _i("Print fan:"));////MSG_SELFTEST_PRINT_FAN_SPEED c=18 r=0 + lcd_puts_at_P(0, 3, _i("Print fan:"));////MSG_SELFTEST_PRINT_FAN_SPEED c=18 lcd_set_cursor(18, 3); (screen < testScreen::fansOk) ? lcd_print(_indicator) : lcd_print("OK"); } @@ -8303,7 +8303,7 @@ void menu_lcd_lcdupdate_func(void) if(menu_menu==lcd_sdcard_menu) menu_back(); card.release(); - LCD_MESSAGERPGM(_i("Card removed"));////MSG_SD_REMOVED c=0 r=0 + LCD_MESSAGERPGM(_i("Card removed"));////MSG_SD_REMOVED } } #endif//CARDINSERTED diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 2499b513f..b859731ab 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -294,7 +294,7 @@ bool show_upgrade_dialog_if_version_newer(const char *version_string) lcd_puts_at_P(0, 2, PSTR("")); for (const char *c = version_string; ! is_whitespace_or_nl_or_eol(*c); ++ c) lcd_putc(*c); - lcd_puts_at_P(0, 3, _i("Please upgrade."));////MSG_NEW_FIRMWARE_PLEASE_UPGRADE c=20 r=0 + lcd_puts_at_P(0, 3, _i("Please upgrade."));////MSG_NEW_FIRMWARE_PLEASE_UPGRADE c=20 if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) _tone(BEEPER, 1000); delay_keep_alive(50); diff --git a/lang/lang_en.txt b/lang/lang_en.txt index 012e4f752..dedc258d6 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -1,10 +1,10 @@ -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 r=0 +#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 " of 4" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 " of 9" -#MSG_MEASURED_OFFSET c=0 r=0 +#MSG_MEASURED_OFFSET "[0;0] point offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 @@ -16,10 +16,10 @@ # ">Cancel" -#MSG_BABYSTEPPING_Z c=20 r=0 +#MSG_BABYSTEPPING_Z c=20 "Adjusting Z" -#MSG_SELFTEST_CHECK_ALLCORRECT c=20 r=0 +#MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " #MSG_WIZARD_DONE c=20 r=8 @@ -28,7 +28,7 @@ # "Ambient" -#MSG_PRESS c=20 r=0 +#MSG_PRESS c=20 "and press the knob" #MSG_CONFIRM_CARRIAGE_AT_THE_TOP c=20 r=2 @@ -40,13 +40,13 @@ # "SpoolJoin [N/A]" -# MSG_AUTO_DEPLETE_OFF c=17 r=1 +#MSG_AUTO_DEPLETE_OFF c=17 r=1 "SpoolJoin [off]" -#MSG_AUTO_HOME c=0 r=0 +#MSG_AUTO_HOME "Auto home" -#MSG_AUTOLOAD_FILAMENT c=17 r=0 +#MSG_AUTOLOAD_FILAMENT c=17 "AutoLoad filament" #MSG_AUTOLOADING_ONLY_IF_FSENS_ON c=20 r=4 @@ -55,28 +55,28 @@ #MSG_AUTOLOADING_ENABLED c=20 r=4 "Autoloading filament is active, just press the knob and insert filament..." -#MSG_SELFTEST_AXIS_LENGTH c=0 r=0 +#MSG_SELFTEST_AXIS_LENGTH "Axis length" -#MSG_SELFTEST_AXIS c=0 r=0 +#MSG_SELFTEST_AXIS "Axis" -#MSG_SELFTEST_BEDHEATER c=0 r=0 +#MSG_SELFTEST_BEDHEATER "Bed / Heater" -#MSG_BED_DONE c=0 r=0 +#MSG_BED_DONE "Bed done" -#MSG_BED_HEATING c=0 r=0 +#MSG_BED_HEATING "Bed Heating" -#MSG_BED_CORRECTION_MENU c=0 r=0 +#MSG_BED_CORRECTION_MENU "Bed level correct" #MSG_BED_LEVELING_FAILED_POINT_LOW c=20 r=4 "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." -#MSG_BED c=0 r=0 +#MSG_BED "Bed" #MSG_MENU_BELT_STATUS c=15 r=1 @@ -88,10 +88,10 @@ # "Calibrating home" -#MSG_CALIBRATE_BED c=0 r=0 +#MSG_CALIBRATE_BED "Calibrate XYZ" -#MSG_HOMEYZ c=0 r=0 +#MSG_HOMEYZ "Calibrate Z" #MSG_CALIBRATE_PINDA c=17 r=1 @@ -106,34 +106,34 @@ #MSG_MOVE_CARRIAGE_TO_THE_TOP_Z c=20 r=8 "Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done." -#MSG_HOMEYZ_DONE c=0 r=0 +#MSG_HOMEYZ_DONE "Calibration done" -#MSG_MENU_CALIBRATION c=0 r=0 +#MSG_MENU_CALIBRATION "Calibration" # "Cancel" -#MSG_SD_REMOVED c=0 r=0 +#MSG_SD_REMOVED "Card removed" -#MSG_NOT_COLOR c=0 r=0 +#MSG_NOT_COLOR "Color not correct" -#MSG_COOLDOWN c=0 r=0 +#MSG_COOLDOWN "Cooldown" # "Copy selected language?" -#MSG_CRASHDETECT_ON c=0 r=0 +#MSG_CRASHDETECT_ON "Crash det. [on]" -#MSG_CRASHDETECT_NA c=0 r=0 +#MSG_CRASHDETECT_NA "Crash det. [N/A]" -#MSG_CRASHDETECT_OFF c=0 r=0 +#MSG_CRASHDETECT_OFF "Crash det. [off]" #MSG_CRASH_DETECTED c=20 r=1 @@ -151,7 +151,7 @@ #MSG_DATE c=17 r=1 "Date:" -#MSG_DISABLE_STEPPERS c=0 r=0 +#MSG_DISABLE_STEPPERS "Disable steppers" #MSG_BABYSTEP_Z_NOT_SET c=20 r=12 @@ -160,7 +160,7 @@ #MSG_WIZARD_REPEAT_V2_CAL c=20 r=7 "Do you want to repeat last step to readjust distance between nozzle and heatbed?" -#MSG_EXTRUDER_CORRECTION c=9 r=0 +#MSG_EXTRUDER_CORRECTION c=9 "E-correct" #MSG_EJECT_FILAMENT c=17 r=1 @@ -190,10 +190,10 @@ #MSG_SELFTEST_ENDSTOP_NOTHIT c=20 r=1 "Endstop not hit" -#MSG_SELFTEST_ENDSTOP c=0 r=0 +#MSG_SELFTEST_ENDSTOP "Endstop" -#MSG_SELFTEST_ENDSTOPS c=0 r=0 +#MSG_SELFTEST_ENDSTOPS "Endstops" #MSG_STACK_ERROR c=20 r=4 @@ -202,16 +202,16 @@ #MSG_FSENS_NOT_RESPONDING c=20 r=4 "ERROR: Filament sensor is not responding, please check connection." -#MSG_ERROR c=0 r=0 +#MSG_ERROR "ERROR:" -#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 "Extruder fan:" #MSG_INFO_EXTRUDER c=15 r=1 "Extruder info" -#MSG_MOVE_E c=0 r=0 +#MSG_MOVE_E "Extruder" # @@ -229,10 +229,10 @@ # "Fail stats" -#MSG_FAN_SPEED c=14 r=0 +#MSG_FAN_SPEED c=14 "Fan speed" -#MSG_SELFTEST_FAN c=20 r=0 +#MSG_SELFTEST_FAN c=20 "Fan test" #MSG_FANS_CHECK_ON c=17 r=1 @@ -241,13 +241,13 @@ #MSG_FANS_CHECK_OFF c=17 r=1 "Fans check [off]" -#MSG_FSENSOR_ON c=0 r=0 +#MSG_FSENSOR_ON "Fil. sensor [on]" -#MSG_FSENSOR_NA c=0 r=0 +#MSG_FSENSOR_NA "Fil. sensor [N/A]" -#MSG_FSENSOR_OFF c=0 r=0 +#MSG_FSENSOR_OFF "Fil. sensor [off]" # @@ -256,10 +256,10 @@ #MSG_FILAMENT_CLEAN c=20 r=2 "Filament extruding & with correct color?" -#MSG_NOT_LOADED c=19 r=0 +#MSG_NOT_LOADED c=19 "Filament not loaded" -#MSG_FILAMENT_SENSOR c=20 r=0 +#MSG_FILAMENT_SENSOR c=20 "Filament sensor" #MSG_FILAMENT_USED c=19 r=1 @@ -283,67 +283,67 @@ # "Fix the issue and then press button on MMU unit." -#MSG_FLOW c=0 r=0 +#MSG_FLOW "Flow" -#MSG_PRUSA3D_FORUM c=0 r=0 +#MSG_PRUSA3D_FORUM "forum.prusa3d.com" -#MSG_SELFTEST_COOLING_FAN c=20 r=0 +#MSG_SELFTEST_COOLING_FAN c=20 "Front print fan?" #MSG_BED_CORRECTION_FRONT c=14 r=1 "Front side[um]" -#MSG_SELFTEST_FANS c=0 r=0 +#MSG_SELFTEST_FANS "Front/left fans" -#MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 +#MSG_SELFTEST_HEATERTHERMISTOR "Heater/Thermistor" -#MSG_BED_HEATING_SAFETY_DISABLED c=0 r=0 +#MSG_BED_HEATING_SAFETY_DISABLED "Heating disabled by safety timer." -#MSG_HEATING_COMPLETE c=20 r=0 +#MSG_HEATING_COMPLETE c=20 "Heating done." -#MSG_HEATING c=0 r=0 +#MSG_HEATING "Heating" #MSG_WIZARD_WELCOME c=20 r=7 "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?" -#MSG_PRUSA3D_HOWTO c=0 r=0 +#MSG_PRUSA3D_HOWTO "howto.prusa3d.com" -#MSG_FILAMENTCHANGE c=0 r=0 +#MSG_FILAMENTCHANGE "Change filament" -#MSG_CHANGE_SUCCESS c=0 r=0 +#MSG_CHANGE_SUCCESS "Change success!" -#MSG_CORRECTLY c=20 r=0 +#MSG_CORRECTLY c=20 "Changed correctly?" -#MSG_SELFTEST_CHECK_BED c=20 r=0 +#MSG_SELFTEST_CHECK_BED c=20 "Checking bed " -#MSG_SELFTEST_CHECK_ENDSTOPS c=20 r=0 +#MSG_SELFTEST_CHECK_ENDSTOPS c=20 "Checking endstops" -#MSG_SELFTEST_CHECK_HOTEND c=20 r=0 +#MSG_SELFTEST_CHECK_HOTEND c=20 "Checking hotend " -#MSG_SELFTEST_CHECK_FSENSOR c=20 r=0 +#MSG_SELFTEST_CHECK_FSENSOR c=20 "Checking sensors " -#MSG_SELFTEST_CHECK_X c=20 r=0 +#MSG_SELFTEST_CHECK_X c=20 "Checking X axis " -#MSG_SELFTEST_CHECK_Y c=20 r=0 +#MSG_SELFTEST_CHECK_Y c=20 "Checking Y axis " -#MSG_SELFTEST_CHECK_Z c=20 r=0 +#MSG_SELFTEST_CHECK_Z c=20 "Checking Z axis " #MSG_CHOOSE_EXTRUDER c=20 r=1 @@ -364,13 +364,13 @@ #MSG_WIZARD_V2_CAL_2 c=20 r=12 "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." -#MSG_WATCH c=0 r=0 +#MSG_WATCH "Info screen" # "Is filament 1 loaded?" -#MSG_INSERT_FILAMENT c=20 r=0 +#MSG_INSERT_FILAMENT c=20 "Insert filament" #MSG_WIZARD_FILAMENT_LOADED c=20 r=2 @@ -391,7 +391,7 @@ # "Last print" -#MSG_SELFTEST_EXTRUDER_FAN c=20 r=0 +#MSG_SELFTEST_EXTRUDER_FAN c=20 "Left hotend fan?" # @@ -403,16 +403,16 @@ # "Lin. correction" -#MSG_BABYSTEP_Z c=0 r=0 +#MSG_BABYSTEP_Z "Live adjust Z" -#MSG_LOAD_FILAMENT c=17 r=0 +#MSG_LOAD_FILAMENT c=17 "Load filament" -#MSG_LOADING_COLOR c=0 r=0 +#MSG_LOADING_COLOR "Loading color" -#MSG_LOADING_FILAMENT c=20 r=0 +#MSG_LOADING_FILAMENT c=20 "Loading filament" #MSG_LOOSE_PULLEY c=20 r=1 @@ -424,13 +424,13 @@ #MSG_M117_V2_CALIBRATION c=25 r=1 "M117 First layer cal." -#MSG_MAIN c=0 r=0 +#MSG_MAIN "Main" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 "Measuring reference height of calibration point" -#MSG_MESH_BED_LEVELING c=0 r=0 +#MSG_MESH_BED_LEVELING "Mesh Bed Leveling" #MSG_MMU_OK_RESUMING_POSITION c=20 r=4 @@ -454,10 +454,10 @@ #MSG_MMU_OK_RESUMING c=20 r=4 "MMU OK. Resuming..." -#MSG_STEALTH_MODE_OFF c=0 r=0 +#MSG_STEALTH_MODE_OFF "Mode [Normal]" -#MSG_SILENT_MODE_ON c=0 r=0 +#MSG_SILENT_MODE_ON "Mode [silent]" # @@ -466,52 +466,52 @@ # "MMU power fails" -#MSG_STEALTH_MODE_ON c=0 r=0 +#MSG_STEALTH_MODE_ON "Mode [Stealth]" -#MSG_AUTO_MODE_ON c=0 r=0 +#MSG_AUTO_MODE_ON "Mode [auto power]" -#MSG_SILENT_MODE_OFF c=0 r=0 +#MSG_SILENT_MODE_OFF "Mode [high power]" # "MMU2 connected" -#MSG_SELFTEST_MOTOR c=0 r=0 +#MSG_SELFTEST_MOTOR "Motor" -#MSG_MOVE_AXIS c=0 r=0 +#MSG_MOVE_AXIS "Move axis" -#MSG_MOVE_X c=0 r=0 +#MSG_MOVE_X "Move X" -#MSG_MOVE_Y c=0 r=0 +#MSG_MOVE_Y "Move Y" -#MSG_MOVE_Z c=0 r=0 +#MSG_MOVE_Z "Move Z" -#MSG_NO_MOVE c=0 r=0 +#MSG_NO_MOVE "No move." -#MSG_NO_CARD c=0 r=0 +#MSG_NO_CARD "No SD card" # "N/A" -#MSG_NO c=0 r=0 +#MSG_NO "No" -#MSG_SELFTEST_NOTCONNECTED c=0 r=0 +#MSG_SELFTEST_NOTCONNECTED "Not connected" # "New firmware version available:" -#MSG_SELFTEST_FAN_NO c=19 r=0 +#MSG_SELFTEST_FAN_NO c=19 "Not spinning" #MSG_WIZARD_V2_CAL c=20 r=8 @@ -520,7 +520,7 @@ #MSG_WIZARD_WILL_PREHEAT c=20 r=4 "Now I will preheat nozzle for PLA." -#MSG_NOZZLE c=0 r=0 +#MSG_NOZZLE "Nozzle" #MSG_DEFAULT_SETTINGS_LOADED c=20 r=4 @@ -532,7 +532,7 @@ # "Nozzle FAN" -#MSG_PAUSE_PRINT c=0 r=0 +#MSG_PAUSE_PRINT "Pause print" #MSG_PID_RUNNING c=20 r=1 @@ -556,7 +556,7 @@ #MSG_CONFIRM_NOZZLE_CLEAN c=20 r=8 "Please clean the nozzle for calibration. Click when done." -#MSG_SELFTEST_PLEASECHECK c=0 r=0 +#MSG_SELFTEST_PLEASECHECK "Please check :" #MSG_WIZARD_CALIBRATION_FAILED c=20 r=8 @@ -595,16 +595,16 @@ #MSG_UPDATE_MMU2_FW c=20 r=4 "Please update firmware in your MMU2. Waiting for reset." -#MSG_PLEASE_WAIT c=20 r=0 +#MSG_PLEASE_WAIT c=20 "Please wait" # "Please remove shipping helpers first." -#MSG_PREHEAT_NOZZLE c=20 r=0 +#MSG_PREHEAT_NOZZLE c=20 "Preheat the nozzle!" -#MSG_PREHEAT c=0 r=0 +#MSG_PREHEAT "Preheat" #MSG_WIZARD_HEATING c=20 r=3 @@ -619,7 +619,7 @@ # "Power failures" -#MSG_PRINT_ABORTED c=20 r=0 +#MSG_PRINT_ABORTED c=20 "Print aborted" # @@ -628,10 +628,10 @@ # "Preheating to unload" -#MSG_SELFTEST_PRINT_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_PRINT_FAN_SPEED c=18 "Print fan:" -#MSG_CARD_MENU c=0 r=0 +#MSG_CARD_MENU "Print from SD" # @@ -649,7 +649,7 @@ # "Print FAN" -#MSG_PRUSA3D c=0 r=0 +#MSG_PRUSA3D "prusa3d.com" #MSG_BED_CORRECTION_REAR c=14 r=1 @@ -664,13 +664,13 @@ # "Prusa i3 MK3S OK." -#MSG_CALIBRATE_BED_RESET c=0 r=0 +#MSG_CALIBRATE_BED_RESET "Reset XYZ calibr." -#MSG_BED_CORRECTION_RESET c=0 r=0 +#MSG_BED_CORRECTION_RESET "Reset" -#MSG_RESUME_PRINT c=0 r=0 +#MSG_RESUME_PRINT "Resume print" #MSG_RESUMING_PRINT c=20 r=1 @@ -697,25 +697,25 @@ # "Right" -#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 +#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 "Searching bed calibration point" -#MSG_LANGUAGE_SELECT c=0 r=0 +#MSG_LANGUAGE_SELECT "Select language" -#MSG_SELFTEST_OK c=0 r=0 +#MSG_SELFTEST_OK "Self test OK" -#MSG_SELFTEST_START c=20 r=0 +#MSG_SELFTEST_START c=20 "Self test start " -#MSG_SELFTEST c=0 r=0 +#MSG_SELFTEST "Selftest " -#MSG_SELFTEST_ERROR c=0 r=0 +#MSG_SELFTEST_ERROR "Selftest error !" -#MSG_SELFTEST_FAILED c=20 r=0 +#MSG_SELFTEST_FAILED c=20 "Selftest failed " #MSG_FORCE_SELFTEST c=20 r=8 @@ -730,7 +730,7 @@ #MSG_SET_TEMPERATURE c=19 r=1 "Set temperature:" -#MSG_SETTINGS c=0 r=0 +#MSG_SETTINGS "Settings" #MSG_SHOW_END_STOPS c=17 r=1 @@ -775,28 +775,28 @@ #MSG_SOUND_SILENT c=17 r=1 "Sound [silent]" -#MSG_SPEED c=0 r=0 +#MSG_SPEED "Speed" -#MSG_SELFTEST_FAN_YES c=19 r=0 +#MSG_SELFTEST_FAN_YES c=19 "Spinning" #MSG_TEMP_CAL_WARNING c=20 r=4 "Stable ambient temperature 21-26C is needed a rigid stand is required." -#MSG_STATISTICS c=0 r=0 +#MSG_STATISTICS "Statistics " -#MSG_STOP_PRINT c=0 r=0 +#MSG_STOP_PRINT "Stop print" -#MSG_STOPPED c=0 r=0 +#MSG_STOPPED "STOPPED. " -#MSG_SUPPORT c=0 r=0 +#MSG_SUPPORT "Support" -#MSG_SELFTEST_SWAPPED c=0 r=0 +#MSG_SELFTEST_SWAPPED "Swapped" #MSG_TEMP_CALIBRATION c=20 r=1 @@ -817,7 +817,7 @@ #MSG_TEMP_CALIBRATION_DONE c=20 r=12 "Temperature calibration is finished and active. Temp. calibration can be disabled in menu Settings->Temp. cal." -#MSG_TEMPERATURE c=0 r=0 +#MSG_TEMPERATURE "Temperature" #MSG_MENU_TEMPERATURES c=15 r=1 @@ -832,7 +832,7 @@ # "Total print time" -#MSG_TUNE c=0 r=0 +#MSG_TUNE "Tune" # @@ -847,7 +847,7 @@ # "to unload filament" -#MSG_UNLOAD_FILAMENT c=17 r=0 +#MSG_UNLOAD_FILAMENT c=17 "Unload filament" #MSG_UNLOADING_FILAMENT c=20 r=1 @@ -865,7 +865,7 @@ # "unknown" -#MSG_USERWAIT c=0 r=0 +#MSG_USERWAIT "Wait for user..." #MSG_WAITING_TEMP c=20 r=3 @@ -889,7 +889,7 @@ #MSG_UNLOAD_SUCCESSFUL c=20 r=2 "Was filament unload successful?" -#MSG_SELFTEST_WIRINGERROR c=0 r=0 +#MSG_SELFTEST_WIRINGERROR "Wiring error" #MSG_WIZARD c=17 r=1 @@ -901,7 +901,7 @@ #MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED c=20 r=8 "XYZ calibration failed. Please consult the manual." -#MSG_YES c=0 r=0 +#MSG_YES "Yes" #MSG_WIZARD_QUIT c=20 r=8 @@ -925,10 +925,10 @@ #MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR c=20 r=8 "XYZ calibration compromised. Right front calibration point not reachable." -#MSG_LOAD_ALL c=17 r=0 +#MSG_LOAD_ALL c=17 "Load all" -#MSG_LOAD_FILAMENT_1 c=17 r=0 +#MSG_LOAD_FILAMENT_1 c=17 "Load filament 1" # @@ -937,13 +937,13 @@ # "XYZ calibration failed. Front calibration points not reachable." -#MSG_LOAD_FILAMENT_2 c=17 r=0 +#MSG_LOAD_FILAMENT_2 c=17 "Load filament 2" # "XYZ calibration failed. Right front calibration point not reachable." -#MSG_LOAD_FILAMENT_3 c=17 r=0 +#MSG_LOAD_FILAMENT_3 c=17 "Load filament 3" # @@ -952,11 +952,11 @@ # "Y-correct" -#MSG_LOAD_FILAMENT_4 c=17 r=0 +#MSG_LOAD_FILAMENT_4 c=17 "Load filament 4" -#MSG_LOAD_FILAMENT_5 c=17 r=0 +#MSG_LOAD_FILAMENT_5 c=17 "Load filament 5" -#MSG_OFF c=0 r=0 +#MSG_OFF " [off]" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 8f295f9eb..51d16f56c 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -1,12 +1,12 @@ -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 r=0 +#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 " of 4" " z 4" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 " of 9" " z 9" -#MSG_MEASURED_OFFSET c=0 r=0 +#MSG_MEASURED_OFFSET "[0;0] point offset" "[0;0] odsazeni bodu" @@ -22,11 +22,11 @@ ">Cancel" ">Zrusit" -#MSG_BABYSTEPPING_Z c=20 r=0 +#MSG_BABYSTEPPING_Z c=20 "Adjusting Z" "Dostavovani Z" -#MSG_SELFTEST_CHECK_ALLCORRECT c=20 r=0 +#MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " "Vse OK " @@ -38,7 +38,7 @@ "Ambient" "Okoli" -#MSG_PRESS c=20 r=0 +#MSG_PRESS c=20 "and press the knob" "a stisknete tlacitko" @@ -54,15 +54,15 @@ "SpoolJoin [N/A]" "\x00" -# MSG_AUTO_DEPLETE_OFF c=17 r=1 +#MSG_AUTO_DEPLETE_OFF c=17 r=1 "SpoolJoin [off]" "SpoolJoin [vyp]" -#MSG_AUTO_HOME c=0 r=0 +#MSG_AUTO_HOME "Auto home" "\x00" -#MSG_AUTOLOAD_FILAMENT c=17 r=0 +#MSG_AUTOLOAD_FILAMENT c=17 "AutoLoad filament" "AutoZavedeni fil." @@ -74,27 +74,27 @@ "Autoloading filament is active, just press the knob and insert filament..." "Automaticke zavadeni filamentu aktivni, stisknete tlacitko a vlozte filament..." -#MSG_SELFTEST_AXIS_LENGTH c=0 r=0 +#MSG_SELFTEST_AXIS_LENGTH "Axis length" "Delka osy" -#MSG_SELFTEST_AXIS c=0 r=0 +#MSG_SELFTEST_AXIS "Axis" "Osa" -#MSG_SELFTEST_BEDHEATER c=0 r=0 +#MSG_SELFTEST_BEDHEATER "Bed / Heater" "Podlozka / Topeni" -#MSG_BED_DONE c=0 r=0 +#MSG_BED_DONE "Bed done" "Bed OK." -#MSG_BED_HEATING c=0 r=0 +#MSG_BED_HEATING "Bed Heating" "Zahrivani bed" -#MSG_BED_CORRECTION_MENU c=0 r=0 +#MSG_BED_CORRECTION_MENU "Bed level correct" "Korekce podlozky" @@ -102,7 +102,7 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Kalibrace Z selhala. Sensor nesepnul. Znecistena tryska? Cekam na reset." -#MSG_BED c=0 r=0 +#MSG_BED "Bed" "Podlozka" @@ -118,11 +118,11 @@ "Calibrating home" "Kalibruji vychozi poz." -#MSG_CALIBRATE_BED c=0 r=0 +#MSG_CALIBRATE_BED "Calibrate XYZ" "Kalibrace XYZ" -#MSG_HOMEYZ c=0 r=0 +#MSG_HOMEYZ "Calibrate Z" "Kalibrovat Z" @@ -142,11 +142,11 @@ "Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done." "Kalibrace Z. Otacenim tlacitka posunte Z osu az k~hornimu dorazu. Potvrdte tlacitkem." -#MSG_HOMEYZ_DONE c=0 r=0 +#MSG_HOMEYZ_DONE "Calibration done" "Kalibrace OK" -#MSG_MENU_CALIBRATION c=0 r=0 +#MSG_MENU_CALIBRATION "Calibration" "Kalibrace" @@ -154,15 +154,15 @@ "Cancel" "Zrusit" -#MSG_SD_REMOVED c=0 r=0 +#MSG_SD_REMOVED "Card removed" "Karta vyjmuta" -#MSG_NOT_COLOR c=0 r=0 +#MSG_NOT_COLOR "Color not correct" "Barva neni cista" -#MSG_COOLDOWN c=0 r=0 +#MSG_COOLDOWN "Cooldown" "Zchladit" @@ -170,15 +170,15 @@ "Copy selected language?" "Kopirovat vybrany jazyk?" -#MSG_CRASHDETECT_ON c=0 r=0 +#MSG_CRASHDETECT_ON "Crash det. [on]" "Crash det. [zap]" -#MSG_CRASHDETECT_NA c=0 r=0 +#MSG_CRASHDETECT_NA "Crash det. [N/A]" "\x00" -#MSG_CRASHDETECT_OFF c=0 r=0 +#MSG_CRASHDETECT_OFF "Crash det. [off]" "Crash det. [vyp]" @@ -202,7 +202,7 @@ "Date:" "Datum:" -#MSG_DISABLE_STEPPERS c=0 r=0 +#MSG_DISABLE_STEPPERS "Disable steppers" "Vypnout motory" @@ -214,7 +214,7 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Chcete opakovat posledni krok a pozmenit vzdalenost mezi tryskou a podlozkou?" -#MSG_EXTRUDER_CORRECTION c=9 r=0 +#MSG_EXTRUDER_CORRECTION c=9 "E-correct" "Korekce E" @@ -254,11 +254,11 @@ "Endstop not hit" "Kon. spinac nesepnut" -#MSG_SELFTEST_ENDSTOP c=0 r=0 +#MSG_SELFTEST_ENDSTOP "Endstop" "Koncovy spinac" -#MSG_SELFTEST_ENDSTOPS c=0 r=0 +#MSG_SELFTEST_ENDSTOPS "Endstops" "Konc. spinace" @@ -270,11 +270,11 @@ "ERROR: Filament sensor is not responding, please check connection." "CHYBA: Filament senzor nereaguje, zkontrolujte zapojeni." -#MSG_ERROR c=0 r=0 +#MSG_ERROR "ERROR:" "CHYBA:" -#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 "Extruder fan:" "Levy vent.:" @@ -282,7 +282,7 @@ "Extruder info" "\x00" -#MSG_MOVE_E c=0 r=0 +#MSG_MOVE_E "Extruder" "\x00" @@ -306,11 +306,11 @@ "Fail stats" "Selhani" -#MSG_FAN_SPEED c=14 r=0 +#MSG_FAN_SPEED c=14 "Fan speed" "Rychlost vent." -#MSG_SELFTEST_FAN c=20 r=0 +#MSG_SELFTEST_FAN c=20 "Fan test" "Test ventilatoru" @@ -322,15 +322,15 @@ "Fans check [off]" "Kontr. vent.[vyp]" -#MSG_FSENSOR_ON c=0 r=0 +#MSG_FSENSOR_ON "Fil. sensor [on]" "Fil. senzor [zap]" -#MSG_FSENSOR_NA c=0 r=0 +#MSG_FSENSOR_NA "Fil. sensor [N/A]" "Fil. senzor [N/A]" -#MSG_FSENSOR_OFF c=0 r=0 +#MSG_FSENSOR_OFF "Fil. sensor [off]" "Fil. senzor [vyp]" @@ -342,11 +342,11 @@ "Filament extruding & with correct color?" "Filament vytlacen a spravne barvy?" -#MSG_NOT_LOADED c=19 r=0 +#MSG_NOT_LOADED c=19 "Filament not loaded" "Filament nezaveden" -#MSG_FILAMENT_SENSOR c=20 r=0 +#MSG_FILAMENT_SENSOR c=20 "Filament sensor" "Senzor filamentu" @@ -378,15 +378,15 @@ "Fix the issue and then press button on MMU unit." "Opravte chybu a pote stisknete tlacitko na jednotce MMU." -#MSG_FLOW c=0 r=0 +#MSG_FLOW "Flow" "Prutok" -#MSG_PRUSA3D_FORUM c=0 r=0 +#MSG_PRUSA3D_FORUM "forum.prusa3d.com" "\x00" -#MSG_SELFTEST_COOLING_FAN c=20 r=0 +#MSG_SELFTEST_COOLING_FAN c=20 "Front print fan?" "Predni tiskovy vent?" @@ -394,23 +394,23 @@ "Front side[um]" "Vpredu [um]" -#MSG_SELFTEST_FANS c=0 r=0 +#MSG_SELFTEST_FANS "Front/left fans" "Predni/levy vent." -#MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 +#MSG_SELFTEST_HEATERTHERMISTOR "Heater/Thermistor" "Topeni/Termistor" -#MSG_BED_HEATING_SAFETY_DISABLED c=0 r=0 +#MSG_BED_HEATING_SAFETY_DISABLED "Heating disabled by safety timer." "Zahrivani preruseno bezpecnostnim casovacem." -#MSG_HEATING_COMPLETE c=20 r=0 +#MSG_HEATING_COMPLETE c=20 "Heating done." "Zahrivani OK." -#MSG_HEATING c=0 r=0 +#MSG_HEATING "Heating" "Zahrivani" @@ -418,47 +418,47 @@ "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?" "Dobry den, jsem vase tiskarna Original Prusa i3. Chcete abych Vas provedla kalibracnim procesem?" -#MSG_PRUSA3D_HOWTO c=0 r=0 +#MSG_PRUSA3D_HOWTO "howto.prusa3d.com" "\x00" -#MSG_FILAMENTCHANGE c=0 r=0 +#MSG_FILAMENTCHANGE "Change filament" "Vymenit filament" -#MSG_CHANGE_SUCCESS c=0 r=0 +#MSG_CHANGE_SUCCESS "Change success!" "Zmena uspesna!" -#MSG_CORRECTLY c=20 r=0 +#MSG_CORRECTLY c=20 "Changed correctly?" "Vymena ok?" -#MSG_SELFTEST_CHECK_BED c=20 r=0 +#MSG_SELFTEST_CHECK_BED c=20 "Checking bed " "Kontrola podlozky" -#MSG_SELFTEST_CHECK_ENDSTOPS c=20 r=0 +#MSG_SELFTEST_CHECK_ENDSTOPS c=20 "Checking endstops" "Kontrola endstopu" -#MSG_SELFTEST_CHECK_HOTEND c=20 r=0 +#MSG_SELFTEST_CHECK_HOTEND c=20 "Checking hotend " "Kontrola hotend " -#MSG_SELFTEST_CHECK_FSENSOR c=20 r=0 +#MSG_SELFTEST_CHECK_FSENSOR c=20 "Checking sensors " "Kontrola senzoru" -#MSG_SELFTEST_CHECK_X c=20 r=0 +#MSG_SELFTEST_CHECK_X c=20 "Checking X axis " "Kontrola osy X" -#MSG_SELFTEST_CHECK_Y c=20 r=0 +#MSG_SELFTEST_CHECK_Y c=20 "Checking Y axis " "Kontrola osy Y" -#MSG_SELFTEST_CHECK_Z c=20 r=0 +#MSG_SELFTEST_CHECK_Z c=20 "Checking Z axis " "Kontrola osy Z" @@ -486,7 +486,7 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Zacnu tisknout linku a Vy budete postupne snizovat trysku otacenim tlacitka dokud nedosahnete optimalni vysky. Prohlednete si obrazky v nasi prirucce v kapitole Kalibrace." -#MSG_WATCH c=0 r=0 +#MSG_WATCH "Info screen" "Informace" @@ -494,7 +494,7 @@ "Is filament 1 loaded?" "Je filament 1 zaveden?" -#MSG_INSERT_FILAMENT c=20 r=0 +#MSG_INSERT_FILAMENT c=20 "Insert filament" "Vlozte filament" @@ -522,7 +522,7 @@ "Last print" "Posledni tisk" -#MSG_SELFTEST_EXTRUDER_FAN c=20 r=0 +#MSG_SELFTEST_EXTRUDER_FAN c=20 "Left hotend fan?" "Levy vent na trysce?" @@ -538,19 +538,19 @@ "Lin. correction" "Korekce lin." -#MSG_BABYSTEP_Z c=0 r=0 +#MSG_BABYSTEP_Z "Live adjust Z" "Doladeni osy Z" -#MSG_LOAD_FILAMENT c=17 r=0 +#MSG_LOAD_FILAMENT c=17 "Load filament" "Zavest filament" -#MSG_LOADING_COLOR c=0 r=0 +#MSG_LOADING_COLOR "Loading color" "Cisteni barvy" -#MSG_LOADING_FILAMENT c=20 r=0 +#MSG_LOADING_FILAMENT c=20 "Loading filament" "Zavadeni filamentu" @@ -566,15 +566,15 @@ "M117 First layer cal." "M117 Kal. prvni vrstvy" -#MSG_MAIN c=0 r=0 +#MSG_MAIN "Main" "Hlavni nabidka" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 "Measuring reference height of calibration point" "Merim referencni vysku kalibracniho bodu" -#MSG_MESH_BED_LEVELING c=0 r=0 +#MSG_MESH_BED_LEVELING "Mesh Bed Leveling" "\x00" @@ -606,11 +606,11 @@ "MMU OK. Resuming..." "MMU OK. Pokracuji..." -#MSG_STEALTH_MODE_OFF c=0 r=0 +#MSG_STEALTH_MODE_OFF "Mode [Normal]" "Mod [Normal]" -#MSG_SILENT_MODE_ON c=0 r=0 +#MSG_SILENT_MODE_ON "Mode [silent]" "Mod [tichy]" @@ -622,15 +622,15 @@ "MMU power fails" "MMU vypadky proudu" -#MSG_STEALTH_MODE_ON c=0 r=0 +#MSG_STEALTH_MODE_ON "Mode [Stealth]" "Mod [tichy]" -#MSG_AUTO_MODE_ON c=0 r=0 +#MSG_AUTO_MODE_ON "Mode [auto power]" "Mod [automaticky]" -#MSG_SILENT_MODE_OFF c=0 r=0 +#MSG_SILENT_MODE_OFF "Mode [high power]" "Mod [vys. vykon]" @@ -638,31 +638,31 @@ "MMU2 connected" "MMU2 pripojeno" -#MSG_SELFTEST_MOTOR c=0 r=0 +#MSG_SELFTEST_MOTOR "Motor" "\x00" -#MSG_MOVE_AXIS c=0 r=0 +#MSG_MOVE_AXIS "Move axis" "Posunout osu" -#MSG_MOVE_X c=0 r=0 +#MSG_MOVE_X "Move X" "Posunout X" -#MSG_MOVE_Y c=0 r=0 +#MSG_MOVE_Y "Move Y" "Posunout Y" -#MSG_MOVE_Z c=0 r=0 +#MSG_MOVE_Z "Move Z" "Posunout Z" -#MSG_NO_MOVE c=0 r=0 +#MSG_NO_MOVE "No move." "Bez pohybu." -#MSG_NO_CARD c=0 r=0 +#MSG_NO_CARD "No SD card" "Zadna SD karta" @@ -670,11 +670,11 @@ "N/A" "\x00" -#MSG_NO c=0 r=0 +#MSG_NO "No" "Ne" -#MSG_SELFTEST_NOTCONNECTED c=0 r=0 +#MSG_SELFTEST_NOTCONNECTED "Not connected" "Nezapojeno " @@ -682,7 +682,7 @@ "New firmware version available:" "Vysla nova verze firmware:" -#MSG_SELFTEST_FAN_NO c=19 r=0 +#MSG_SELFTEST_FAN_NO c=19 "Not spinning" "Netoci se" @@ -694,7 +694,7 @@ "Now I will preheat nozzle for PLA." "Nyni predehreji trysku pro PLA." -#MSG_NOZZLE c=0 r=0 +#MSG_NOZZLE "Nozzle" "Tryska" @@ -710,7 +710,7 @@ "Nozzle FAN" "Trysk. vent." -#MSG_PAUSE_PRINT c=0 r=0 +#MSG_PAUSE_PRINT "Pause print" "Pozastavit tisk" @@ -742,7 +742,7 @@ "Please clean the nozzle for calibration. Click when done." "Pro uspesnou kalibraci ocistete prosim tiskovou trysku. Potvrdte tlacitkem." -#MSG_SELFTEST_PLEASECHECK c=0 r=0 +#MSG_SELFTEST_PLEASECHECK "Please check :" "Zkontrolujte :" @@ -794,7 +794,7 @@ "Please update firmware in your MMU2. Waiting for reset." "Prosim aktualizujte firmware ve vasi MMU2 jednotce. Cekam na reset." -#MSG_PLEASE_WAIT c=20 r=0 +#MSG_PLEASE_WAIT c=20 "Please wait" "Prosim cekejte" @@ -802,11 +802,11 @@ "Please remove shipping helpers first." "Nejprve prosim sundejte transportni soucastky." -#MSG_PREHEAT_NOZZLE c=20 r=0 +#MSG_PREHEAT_NOZZLE c=20 "Preheat the nozzle!" "Predehrejte trysku!" -#MSG_PREHEAT c=0 r=0 +#MSG_PREHEAT "Preheat" "Predehrev" @@ -826,7 +826,7 @@ "Power failures" "Vypadky proudu" -#MSG_PRINT_ABORTED c=20 r=0 +#MSG_PRINT_ABORTED c=20 "Print aborted" "Tisk prerusen" @@ -838,11 +838,11 @@ "Preheating to unload" "Predehrivam k vyjmuti" -#MSG_SELFTEST_PRINT_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_PRINT_FAN_SPEED c=18 "Print fan:" "Tiskovy vent.:" -#MSG_CARD_MENU c=0 r=0 +#MSG_CARD_MENU "Print from SD" "Tisk z SD" @@ -866,7 +866,7 @@ "Print FAN" "Tiskovy vent." -#MSG_PRUSA3D c=0 r=0 +#MSG_PRUSA3D "prusa3d.com" "\x00" @@ -886,15 +886,15 @@ "Prusa i3 MK3S OK." "\x00" -#MSG_CALIBRATE_BED_RESET c=0 r=0 +#MSG_CALIBRATE_BED_RESET "Reset XYZ calibr." "Reset XYZ kalibr." -#MSG_BED_CORRECTION_RESET c=0 r=0 +#MSG_BED_CORRECTION_RESET "Reset" "\x00" -#MSG_RESUME_PRINT c=0 r=0 +#MSG_RESUME_PRINT "Resume print" "Pokracovat" @@ -930,31 +930,31 @@ "Right" "Vpravo" -#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 +#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 "Searching bed calibration point" "Hledam kalibracni bod podlozky" -#MSG_LANGUAGE_SELECT c=0 r=0 +#MSG_LANGUAGE_SELECT "Select language" "Vyber jazyka" -#MSG_SELFTEST_OK c=0 r=0 +#MSG_SELFTEST_OK "Self test OK" "\x00" -#MSG_SELFTEST_START c=20 r=0 +#MSG_SELFTEST_START c=20 "Self test start " "Self test start " -#MSG_SELFTEST c=0 r=0 +#MSG_SELFTEST "Selftest " "Selftest " -#MSG_SELFTEST_ERROR c=0 r=0 +#MSG_SELFTEST_ERROR "Selftest error !" "Chyba Selftestu!" -#MSG_SELFTEST_FAILED c=20 r=0 +#MSG_SELFTEST_FAILED c=20 "Selftest failed " "Selftest selhal " @@ -974,7 +974,7 @@ "Set temperature:" "Nastavte teplotu:" -#MSG_SETTINGS c=0 r=0 +#MSG_SETTINGS "Settings" "Nastaveni" @@ -1034,11 +1034,11 @@ "Sound [silent]" "Zvuk [tichy]" -#MSG_SPEED c=0 r=0 +#MSG_SPEED "Speed" "Rychlost" -#MSG_SELFTEST_FAN_YES c=19 r=0 +#MSG_SELFTEST_FAN_YES c=19 "Spinning" "Toci se" @@ -1046,23 +1046,23 @@ "Stable ambient temperature 21-26C is needed a rigid stand is required." "Je vyzadovana stabilni pokojova teplota 21-26C a pevna podlozka." -#MSG_STATISTICS c=0 r=0 +#MSG_STATISTICS "Statistics " "Statistika " -#MSG_STOP_PRINT c=0 r=0 +#MSG_STOP_PRINT "Stop print" "Zastavit tisk" -#MSG_STOPPED c=0 r=0 +#MSG_STOPPED "STOPPED. " "ZASTAVENO." -#MSG_SUPPORT c=0 r=0 +#MSG_SUPPORT "Support" "Podpora" -#MSG_SELFTEST_SWAPPED c=0 r=0 +#MSG_SELFTEST_SWAPPED "Swapped" "Prohozene" @@ -1090,7 +1090,7 @@ "Temperature calibration is finished and active. Temp. calibration can be disabled in menu Settings->Temp. cal." "Teplotni kalibrace dokoncena a je nyni aktivni. Teplotni kalibraci je mozno deaktivovat v menu Nastaveni->Tepl. kal." -#MSG_TEMPERATURE c=0 r=0 +#MSG_TEMPERATURE "Temperature" "Teplota" @@ -1110,7 +1110,7 @@ "Total print time" "Celkovy cas tisku" -#MSG_TUNE c=0 r=0 +#MSG_TUNE "Tune" "Ladit" @@ -1130,7 +1130,7 @@ "to unload filament" "k vyjmuti filamentu" -#MSG_UNLOAD_FILAMENT c=17 r=0 +#MSG_UNLOAD_FILAMENT c=17 "Unload filament" "Vyjmout filament" @@ -1154,7 +1154,7 @@ "unknown" "neznamy" -#MSG_USERWAIT c=0 r=0 +#MSG_USERWAIT "Wait for user..." "Ceka se na uzivatele..." @@ -1186,7 +1186,7 @@ "Was filament unload successful?" "Bylo vysunuti filamentu uspesne?" -#MSG_SELFTEST_WIRINGERROR c=0 r=0 +#MSG_SELFTEST_WIRINGERROR "Wiring error" "Chyba zapojeni" @@ -1202,7 +1202,7 @@ "XYZ calibration failed. Please consult the manual." "Kalibrace XYZ selhala. Nahlednete do manualu." -#MSG_YES c=0 r=0 +#MSG_YES "Yes" "Ano" @@ -1234,11 +1234,11 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Kalibrace XYZ nepresna. Pravy predni bod moc vpredu." -#MSG_LOAD_ALL c=17 r=0 +#MSG_LOAD_ALL c=17 "Load all" "Zavest vse" -#MSG_LOAD_FILAMENT_1 c=17 r=0 +#MSG_LOAD_FILAMENT_1 c=17 "Load filament 1" "Zavest filament 1" @@ -1250,7 +1250,7 @@ "XYZ calibration failed. Front calibration points not reachable." "Kalibrace XYZ selhala. Predni kalibracni body moc vpredu. Srovnejte tiskarnu." -#MSG_LOAD_FILAMENT_2 c=17 r=0 +#MSG_LOAD_FILAMENT_2 c=17 "Load filament 2" "Zavest filament 2" @@ -1258,7 +1258,7 @@ "XYZ calibration failed. Right front calibration point not reachable." "Kalibrace XYZ selhala. Pravy predni bod moc vpredu. Srovnejte tiskarnu." -#MSG_LOAD_FILAMENT_3 c=17 r=0 +#MSG_LOAD_FILAMENT_3 c=17 "Load filament 3" "Zavest filament 3" @@ -1270,14 +1270,14 @@ "Y-correct" "Korekce Y" -#MSG_LOAD_FILAMENT_4 c=17 r=0 +#MSG_LOAD_FILAMENT_4 c=17 "Load filament 4" "Zavest filament 4" -#MSG_LOAD_FILAMENT_5 c=17 r=0 +#MSG_LOAD_FILAMENT_5 c=17 "Load filament 5" "Zavest filament 5" -#MSG_OFF c=0 r=0 +#MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 49957f9b7..48da055ff 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -1,12 +1,12 @@ -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 r=0 +#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 " of 4" " von 4" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 " of 9" " von 9" -#MSG_MEASURED_OFFSET c=0 r=0 +#MSG_MEASURED_OFFSET "[0;0] point offset" "[0;0] Punktversatz" @@ -22,11 +22,11 @@ ">Cancel" ">Abbruch" -#MSG_BABYSTEPPING_Z c=20 r=0 +#MSG_BABYSTEPPING_Z c=20 "Adjusting Z" "Z wurde eingestellt" -#MSG_SELFTEST_CHECK_ALLCORRECT c=20 r=0 +#MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " "Alles richtig " @@ -38,7 +38,7 @@ "Ambient" "Raumtemp." -#MSG_PRESS c=20 r=0 +#MSG_PRESS c=20 "and press the knob" "und Knopf druecken" @@ -54,15 +54,15 @@ "SpoolJoin [N/A]" "SpoolJoin [N/V]" -# MSG_AUTO_DEPLETE_OFF c=17 r=1 +#MSG_AUTO_DEPLETE_OFF c=17 r=1 "SpoolJoin [off]" "SpoolJoin [aus]" -#MSG_AUTO_HOME c=0 r=0 +#MSG_AUTO_HOME "Auto home" "Startposition" -#MSG_AUTOLOAD_FILAMENT c=17 r=0 +#MSG_AUTOLOAD_FILAMENT c=17 "AutoLoad filament" "Auto-Laden Filament" @@ -74,27 +74,27 @@ "Autoloading filament is active, just press the knob and insert filament..." "Automatisches Laden Filament ist aktiv, Knopf druecken und Filament einlegen..." -#MSG_SELFTEST_AXIS_LENGTH c=0 r=0 +#MSG_SELFTEST_AXIS_LENGTH "Axis length" "Achsenlaenge" -#MSG_SELFTEST_AXIS c=0 r=0 +#MSG_SELFTEST_AXIS "Axis" "Achse" -#MSG_SELFTEST_BEDHEATER c=0 r=0 +#MSG_SELFTEST_BEDHEATER "Bed / Heater" "Bett / Heizung" -#MSG_BED_DONE c=0 r=0 +#MSG_BED_DONE "Bed done" "Bett OK" -#MSG_BED_HEATING c=0 r=0 +#MSG_BED_HEATING "Bed Heating" "Bett aufwaermen" -#MSG_BED_CORRECTION_MENU c=0 r=0 +#MSG_BED_CORRECTION_MENU "Bed level correct" "Ausgleich Bett ok" @@ -102,7 +102,7 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Z-Kal. fehlgeschlg. Sensor nicht ausgeloest. Schmutzige Duese? Warte auf Reset." -#MSG_BED c=0 r=0 +#MSG_BED "Bed" "Bett" @@ -118,11 +118,11 @@ "Calibrating home" "Kalibriere Start" -#MSG_CALIBRATE_BED c=0 r=0 +#MSG_CALIBRATE_BED "Calibrate XYZ" "Kalibrierung XYZ" -#MSG_HOMEYZ c=0 r=0 +#MSG_HOMEYZ "Calibrate Z" "Kalibrierung Z" @@ -142,11 +142,11 @@ "Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done." "Z Kalibrieren: Drehen Sie den Knopf bis der obere Anschlag erreicht wird. Anschliessend den Knopf druecken." -#MSG_HOMEYZ_DONE c=0 r=0 +#MSG_HOMEYZ_DONE "Calibration done" "Kalibrierung OK" -#MSG_MENU_CALIBRATION c=0 r=0 +#MSG_MENU_CALIBRATION "Calibration" "Kalibrierung" @@ -154,15 +154,15 @@ "Cancel" "Abbruch" -#MSG_SD_REMOVED c=0 r=0 +#MSG_SD_REMOVED "Card removed" "SD Karte entfernt" -#MSG_NOT_COLOR c=0 r=0 +#MSG_NOT_COLOR "Color not correct" "Falsche Farbe" -#MSG_COOLDOWN c=0 r=0 +#MSG_COOLDOWN "Cooldown" "Abkuehlen" @@ -170,15 +170,15 @@ "Copy selected language?" "Gewaehlte Sprache kopieren?" -#MSG_CRASHDETECT_ON c=0 r=0 +#MSG_CRASHDETECT_ON "Crash det. [on]" "Crash Erk. [an]" -#MSG_CRASHDETECT_NA c=0 r=0 +#MSG_CRASHDETECT_NA "Crash det. [N/A]" "Crash Erk. [nv]" -#MSG_CRASHDETECT_OFF c=0 r=0 +#MSG_CRASHDETECT_OFF "Crash det. [off]" "Crash Erk. [aus]" @@ -202,7 +202,7 @@ "Date:" "Datum:" -#MSG_DISABLE_STEPPERS c=0 r=0 +#MSG_DISABLE_STEPPERS "Disable steppers" "Motoren aus" @@ -214,7 +214,7 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Moechten Sie den letzten Schritt wiederholen, um den Abstand zwischen Duese und Druckbett neu einzustellen?" -#MSG_EXTRUDER_CORRECTION c=9 r=0 +#MSG_EXTRUDER_CORRECTION c=9 "E-correct" "E-Korrektur" @@ -254,11 +254,11 @@ "Endstop not hit" "Ende nicht getroffen" -#MSG_SELFTEST_ENDSTOP c=0 r=0 +#MSG_SELFTEST_ENDSTOP "Endstop" "Endanschlag" -#MSG_SELFTEST_ENDSTOPS c=0 r=0 +#MSG_SELFTEST_ENDSTOPS "Endstops" "Endschalter" @@ -270,11 +270,11 @@ "ERROR: Filament sensor is not responding, please check connection." "FEHLER: Filament- sensor reagiert nicht, bitte Verbindung pruefen." -#MSG_ERROR c=0 r=0 +#MSG_ERROR "ERROR:" "FEHLER:" -#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 "Extruder fan:" "Extruder Luefter:" @@ -282,7 +282,7 @@ "Extruder info" "Extruder Info" -#MSG_MOVE_E c=0 r=0 +#MSG_MOVE_E "Extruder" "\x00" @@ -306,11 +306,11 @@ "Fail stats" "Fehlerstatistik" -#MSG_FAN_SPEED c=14 r=0 +#MSG_FAN_SPEED c=14 "Fan speed" "Luefter-Tempo" -#MSG_SELFTEST_FAN c=20 r=0 +#MSG_SELFTEST_FAN c=20 "Fan test" "Lueftertest" @@ -322,15 +322,15 @@ "Fans check [off]" "Luefter Chk.[aus]" -#MSG_FSENSOR_ON c=0 r=0 +#MSG_FSENSOR_ON "Fil. sensor [on]" "Fil. Sensor [an]" -#MSG_FSENSOR_NA c=0 r=0 +#MSG_FSENSOR_NA "Fil. sensor [N/A]" "Fil. Sensor [nv]" -#MSG_FSENSOR_OFF c=0 r=0 +#MSG_FSENSOR_OFF "Fil. sensor [off]" "Fil. Sensor [aus]" @@ -342,11 +342,11 @@ "Filament extruding & with correct color?" "Filament extrudiert + richtige Farbe?" -#MSG_NOT_LOADED c=19 r=0 +#MSG_NOT_LOADED c=19 "Filament not loaded" "Fil. nicht geladen" -#MSG_FILAMENT_SENSOR c=20 r=0 +#MSG_FILAMENT_SENSOR c=20 "Filament sensor" "Filamentsensor" @@ -378,15 +378,15 @@ "Fix the issue and then press button on MMU unit." "Beseitigen Sie das Problem und druecken Sie dann den Knopf am MMU." -#MSG_FLOW c=0 r=0 +#MSG_FLOW "Flow" "Durchfluss" -#MSG_PRUSA3D_FORUM c=0 r=0 +#MSG_PRUSA3D_FORUM "forum.prusa3d.com" "\x00" -#MSG_SELFTEST_COOLING_FAN c=20 r=0 +#MSG_SELFTEST_COOLING_FAN c=20 "Front print fan?" "Vorderer Luefter?" @@ -394,23 +394,23 @@ "Front side[um]" "Vorne [um]" -#MSG_SELFTEST_FANS c=0 r=0 +#MSG_SELFTEST_FANS "Front/left fans" "Vorderer/linke Luefter" -#MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 +#MSG_SELFTEST_HEATERTHERMISTOR "Heater/Thermistor" "Heizung/Thermistor" -#MSG_BED_HEATING_SAFETY_DISABLED c=0 r=0 +#MSG_BED_HEATING_SAFETY_DISABLED "Heating disabled by safety timer." "Heizung durch Sicherheitstimer deaktiviert." -#MSG_HEATING_COMPLETE c=20 r=0 +#MSG_HEATING_COMPLETE c=20 "Heating done." "Aufwaermen OK." -#MSG_HEATING c=0 r=0 +#MSG_HEATING "Heating" "Aufwaermen" @@ -418,47 +418,47 @@ "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?" "Hallo, ich bin Ihr Original Prusa i3 Drucker. Moechten Sie, dass ich Sie durch den Einrich- tungsablauf fuehre?" -#MSG_PRUSA3D_HOWTO c=0 r=0 +#MSG_PRUSA3D_HOWTO "howto.prusa3d.com" "\x00" -#MSG_FILAMENTCHANGE c=0 r=0 +#MSG_FILAMENTCHANGE "Change filament" "Filament-Wechsel" -#MSG_CHANGE_SUCCESS c=0 r=0 +#MSG_CHANGE_SUCCESS "Change success!" "Wechsel erfolgr.!" -#MSG_CORRECTLY c=20 r=0 +#MSG_CORRECTLY c=20 "Changed correctly?" "Wechsel ok?" -#MSG_SELFTEST_CHECK_BED c=20 r=0 +#MSG_SELFTEST_CHECK_BED c=20 "Checking bed " "Pruefe Bett " -#MSG_SELFTEST_CHECK_ENDSTOPS c=20 r=0 +#MSG_SELFTEST_CHECK_ENDSTOPS c=20 "Checking endstops" "Pruefe Endschalter" -#MSG_SELFTEST_CHECK_HOTEND c=20 r=0 +#MSG_SELFTEST_CHECK_HOTEND c=20 "Checking hotend " "Pruefe Duese " -#MSG_SELFTEST_CHECK_FSENSOR c=20 r=0 +#MSG_SELFTEST_CHECK_FSENSOR c=20 "Checking sensors " "Pruefe Sensoren " -#MSG_SELFTEST_CHECK_X c=20 r=0 +#MSG_SELFTEST_CHECK_X c=20 "Checking X axis " "Pruefe X Achse " -#MSG_SELFTEST_CHECK_Y c=20 r=0 +#MSG_SELFTEST_CHECK_Y c=20 "Checking Y axis " "Pruefe Y Achse " -#MSG_SELFTEST_CHECK_Z c=20 r=0 +#MSG_SELFTEST_CHECK_Z c=20 "Checking Z axis " "Pruefe Z Achse " @@ -486,7 +486,7 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Ich werde jetzt eine Linie drucken. Waehrend des Druckes koennen Sie die Duese allmaehlich senken, indem Sie den Knopf drehen, bis Sie die optimale Hoehe erreichen. Sehen Sie sich die Bilder in unserem Handbuch im Kapitel Kalibrierung an." -#MSG_WATCH c=0 r=0 +#MSG_WATCH "Info screen" "Infoanzeige" @@ -494,7 +494,7 @@ "Is filament 1 loaded?" "Wurde Filament 1 geladen?" -#MSG_INSERT_FILAMENT c=20 r=0 +#MSG_INSERT_FILAMENT c=20 "Insert filament" "Filament einlegen" @@ -522,7 +522,7 @@ "Last print" "Letzter Druck" -#MSG_SELFTEST_EXTRUDER_FAN c=20 r=0 +#MSG_SELFTEST_EXTRUDER_FAN c=20 "Left hotend fan?" "Linker Luefter?" @@ -538,19 +538,19 @@ "Lin. correction" "Lineare Korrektur" -#MSG_BABYSTEP_Z c=0 r=0 +#MSG_BABYSTEP_Z "Live adjust Z" "Z einstellen" -#MSG_LOAD_FILAMENT c=17 r=0 +#MSG_LOAD_FILAMENT c=17 "Load filament" "Filament laden" -#MSG_LOADING_COLOR c=0 r=0 +#MSG_LOADING_COLOR "Loading color" "Lade Farbe" -#MSG_LOADING_FILAMENT c=20 r=0 +#MSG_LOADING_FILAMENT c=20 "Loading filament" "Filament laedt" @@ -566,15 +566,15 @@ "M117 First layer cal." "M117 Erste-Schicht Kal." -#MSG_MAIN c=0 r=0 +#MSG_MAIN "Main" "Hauptmenue" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 "Measuring reference height of calibration point" "Messen der Referenzhoehe des Kalibrierpunktes" -#MSG_MESH_BED_LEVELING c=0 r=0 +#MSG_MESH_BED_LEVELING "Mesh Bed Leveling" "Mesh Bett Ausgleich" @@ -606,11 +606,11 @@ "MMU OK. Resuming..." "MMU OK. Weiterdrucken..." -#MSG_STEALTH_MODE_OFF c=0 r=0 +#MSG_STEALTH_MODE_OFF "Mode [Normal]" "Modus [Normal]" -#MSG_SILENT_MODE_ON c=0 r=0 +#MSG_SILENT_MODE_ON "Mode [silent]" "Modus [leise]" @@ -622,15 +622,15 @@ "MMU power fails" "MMU Netzfehler" -#MSG_STEALTH_MODE_ON c=0 r=0 +#MSG_STEALTH_MODE_ON "Mode [Stealth]" "Modus [Stealth]" -#MSG_AUTO_MODE_ON c=0 r=0 +#MSG_AUTO_MODE_ON "Mode [auto power]" "Modus[Auto Power]" -#MSG_SILENT_MODE_OFF c=0 r=0 +#MSG_SILENT_MODE_OFF "Mode [high power]" "Modus[Hohe Leist]" @@ -638,31 +638,31 @@ "MMU2 connected" "MMU2 verbunden" -#MSG_SELFTEST_MOTOR c=0 r=0 +#MSG_SELFTEST_MOTOR "Motor" "\x00" -#MSG_MOVE_AXIS c=0 r=0 +#MSG_MOVE_AXIS "Move axis" "Achse bewegen" -#MSG_MOVE_X c=0 r=0 +#MSG_MOVE_X "Move X" "Bewege X" -#MSG_MOVE_Y c=0 r=0 +#MSG_MOVE_Y "Move Y" "Bewege Y" -#MSG_MOVE_Z c=0 r=0 +#MSG_MOVE_Z "Move Z" "Bewege Z" -#MSG_NO_MOVE c=0 r=0 +#MSG_NO_MOVE "No move." "Keine Bewegung." -#MSG_NO_CARD c=0 r=0 +#MSG_NO_CARD "No SD card" "Keine SD Karte" @@ -670,11 +670,11 @@ "N/A" "N.V." -#MSG_NO c=0 r=0 +#MSG_NO "No" "Nein" -#MSG_SELFTEST_NOTCONNECTED c=0 r=0 +#MSG_SELFTEST_NOTCONNECTED "Not connected" "Nicht angeschlossen" @@ -682,7 +682,7 @@ "New firmware version available:" "Neue Firmware- Version verfuegbar:" -#MSG_SELFTEST_FAN_NO c=19 r=0 +#MSG_SELFTEST_FAN_NO c=19 "Not spinning" "Dreht sich nicht" @@ -694,7 +694,7 @@ "Now I will preheat nozzle for PLA." "Jetzt werde ich die Duese fuer PLA vorheizen." -#MSG_NOZZLE c=0 r=0 +#MSG_NOZZLE "Nozzle" "Duese" @@ -710,7 +710,7 @@ "Nozzle FAN" "Duesen Luefter" -#MSG_PAUSE_PRINT c=0 r=0 +#MSG_PAUSE_PRINT "Pause print" "Druck pausieren" @@ -742,7 +742,7 @@ "Please clean the nozzle for calibration. Click when done." "Bitte entfernen Sie ueberstehendes Filament von der Duese. Klicken wenn sauber." -#MSG_SELFTEST_PLEASECHECK c=0 r=0 +#MSG_SELFTEST_PLEASECHECK "Please check :" "Bitte pruefe:" @@ -794,7 +794,7 @@ "Please update firmware in your MMU2. Waiting for reset." "Bitte aktualisieren Sie die Firmware in der MMU2. Warte auf Reset." -#MSG_PLEASE_WAIT c=20 r=0 +#MSG_PLEASE_WAIT c=20 "Please wait" "Bitte warten" @@ -802,11 +802,11 @@ "Please remove shipping helpers first." "Bitte zuerst Transportsicherungen entfernen." -#MSG_PREHEAT_NOZZLE c=20 r=0 +#MSG_PREHEAT_NOZZLE c=20 "Preheat the nozzle!" "Duese vorheizen!" -#MSG_PREHEAT c=0 r=0 +#MSG_PREHEAT "Preheat" "Vorheizen" @@ -826,7 +826,7 @@ "Power failures" "Netzfehler" -#MSG_PRINT_ABORTED c=20 r=0 +#MSG_PRINT_ABORTED c=20 "Print aborted" "Druck abgebrochen" @@ -838,11 +838,11 @@ "Preheating to unload" "Heizen zum Entladen" -#MSG_SELFTEST_PRINT_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_PRINT_FAN_SPEED c=18 "Print fan:" "Druckvent.:" -#MSG_CARD_MENU c=0 r=0 +#MSG_CARD_MENU "Print from SD" "Drucken von SD" @@ -866,7 +866,7 @@ "Print FAN" "Druckluefter" -#MSG_PRUSA3D c=0 r=0 +#MSG_PRUSA3D "prusa3d.com" "\x00" @@ -886,15 +886,15 @@ "Prusa i3 MK3S OK." "\x00" -#MSG_CALIBRATE_BED_RESET c=0 r=0 +#MSG_CALIBRATE_BED_RESET "Reset XYZ calibr." "XYZ Kalibr. zuruecksetzen." -#MSG_BED_CORRECTION_RESET c=0 r=0 +#MSG_BED_CORRECTION_RESET "Reset" "Ruecksetzen" -#MSG_RESUME_PRINT c=0 r=0 +#MSG_RESUME_PRINT "Resume print" "Druck fortsetzen" @@ -930,31 +930,31 @@ "Right" "Rechts" -#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 +#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 "Searching bed calibration point" "Suche Bett Kalibrierpunkt" -#MSG_LANGUAGE_SELECT c=0 r=0 +#MSG_LANGUAGE_SELECT "Select language" "Waehle Sprache" -#MSG_SELFTEST_OK c=0 r=0 +#MSG_SELFTEST_OK "Self test OK" "Selbsttest OK" -#MSG_SELFTEST_START c=20 r=0 +#MSG_SELFTEST_START c=20 "Self test start " "Selbsttest start " -#MSG_SELFTEST c=0 r=0 +#MSG_SELFTEST "Selftest " "Selbsttest " -#MSG_SELFTEST_ERROR c=0 r=0 +#MSG_SELFTEST_ERROR "Selftest error !" "Selbsttest Fehler!" -#MSG_SELFTEST_FAILED c=20 r=0 +#MSG_SELFTEST_FAILED c=20 "Selftest failed " "Selbsttest misslung " @@ -974,7 +974,7 @@ "Set temperature:" "Temp. einstellen:" -#MSG_SETTINGS c=0 r=0 +#MSG_SETTINGS "Settings" "Einstellungen" @@ -1034,11 +1034,11 @@ "Sound [silent]" "Sound [leise]" -#MSG_SPEED c=0 r=0 +#MSG_SPEED "Speed" "Geschwindigkeit" -#MSG_SELFTEST_FAN_YES c=19 r=0 +#MSG_SELFTEST_FAN_YES c=19 "Spinning" "Dreht sich" @@ -1046,23 +1046,23 @@ "Stable ambient temperature 21-26C is needed a rigid stand is required." "Stabile Umgebungs- temperatur 21-26C und feste Stand- flaeche erforderlich" -#MSG_STATISTICS c=0 r=0 +#MSG_STATISTICS "Statistics " "Statistiken " -#MSG_STOP_PRINT c=0 r=0 +#MSG_STOP_PRINT "Stop print" "Druck abbrechen" -#MSG_STOPPED c=0 r=0 +#MSG_STOPPED "STOPPED. " "GESTOPPT. " -#MSG_SUPPORT c=0 r=0 +#MSG_SUPPORT "Support" "\x00" -#MSG_SELFTEST_SWAPPED c=0 r=0 +#MSG_SELFTEST_SWAPPED "Swapped" "Ausgetauscht" @@ -1090,7 +1090,7 @@ "Temperature calibration is finished and active. Temp. calibration can be disabled in menu Settings->Temp. cal." "Temp.kalibrierung ist fertig + aktiv. Temp.kalibrierung kann ausgeschaltet werden im Menu Einstellungen -> Temp.kal." -#MSG_TEMPERATURE c=0 r=0 +#MSG_TEMPERATURE "Temperature" "Temperatur" @@ -1110,7 +1110,7 @@ "Total print time" "Gesamte Druckzeit" -#MSG_TUNE c=0 r=0 +#MSG_TUNE "Tune" "Feineinstellung" @@ -1130,7 +1130,7 @@ "to unload filament" "zum Filament entladen" -#MSG_UNLOAD_FILAMENT c=17 r=0 +#MSG_UNLOAD_FILAMENT c=17 "Unload filament" "Filament entladen" @@ -1154,7 +1154,7 @@ "unknown" "unbekannt" -#MSG_USERWAIT c=0 r=0 +#MSG_USERWAIT "Wait for user..." "Warte auf Benutzer.." @@ -1186,7 +1186,7 @@ "Was filament unload successful?" "Konnten Sie das Filament entnehmen?" -#MSG_SELFTEST_WIRINGERROR c=0 r=0 +#MSG_SELFTEST_WIRINGERROR "Wiring error" "Verdrahtungsfehler" @@ -1202,7 +1202,7 @@ "XYZ calibration failed. Please consult the manual." "XYZ-Kalibrierung fehlgeschlagen. Bitte schauen Sie in das Handbuch." -#MSG_YES c=0 r=0 +#MSG_YES "Yes" "Ja" @@ -1234,11 +1234,11 @@ "XYZ calibration compromised. Right front calibration point not reachable." "XYZ-Kalibrierung beeintraechtigt. Rechter vorderer Kalibrierpunkt nicht erreichbar." -#MSG_LOAD_ALL c=17 r=0 +#MSG_LOAD_ALL c=17 "Load all" "Alle laden" -#MSG_LOAD_FILAMENT_1 c=17 r=0 +#MSG_LOAD_FILAMENT_1 c=17 "Load filament 1" "Filament 1 laden" @@ -1250,7 +1250,7 @@ "XYZ calibration failed. Front calibration points not reachable." "XYZ-Kalibrierung fehlgeschlagen. Vordere Kalibrierpunkte nicht erreichbar." -#MSG_LOAD_FILAMENT_2 c=17 r=0 +#MSG_LOAD_FILAMENT_2 c=17 "Load filament 2" "Filament 2 laden" @@ -1258,7 +1258,7 @@ "XYZ calibration failed. Right front calibration point not reachable." "XYZ-Kalibrierung fehlgeschlagen. Rechter vorderer Kalibrierpunkt ist nicht erreichbar." -#MSG_LOAD_FILAMENT_3 c=17 r=0 +#MSG_LOAD_FILAMENT_3 c=17 "Load filament 3" "Filament 3 laden" @@ -1270,14 +1270,14 @@ "Y-correct" "Y-Korrektur" -#MSG_LOAD_FILAMENT_4 c=17 r=0 +#MSG_LOAD_FILAMENT_4 c=17 "Load filament 4" "Filament 4 laden" -#MSG_LOAD_FILAMENT_5 c=17 r=0 +#MSG_LOAD_FILAMENT_5 c=17 "Load filament 5" "Filament 5 laden" -#MSG_OFF c=0 r=0 +#MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index a7df26a1f..3d8b17dc8 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -1,12 +1,12 @@ -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 r=0 +#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 " of 4" " de 4" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 " of 9" " de 9" -#MSG_MEASURED_OFFSET c=0 r=0 +#MSG_MEASURED_OFFSET "[0;0] point offset" "[0;0] punto offset" @@ -22,11 +22,11 @@ ">Cancel" ">Cancelar" -#MSG_BABYSTEPPING_Z c=20 r=0 +#MSG_BABYSTEPPING_Z c=20 "Adjusting Z" "Ajustar Z" -#MSG_SELFTEST_CHECK_ALLCORRECT c=20 r=0 +#MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " "Todo bien" @@ -38,7 +38,7 @@ "Ambient" "Ambiente" -#MSG_PRESS c=20 r=0 +#MSG_PRESS c=20 "and press the knob" "Haz clic" @@ -54,15 +54,15 @@ "SpoolJoin [N/A]" "\x00" -# MSG_AUTO_DEPLETE_OFF c=17 r=1 +#MSG_AUTO_DEPLETE_OFF c=17 r=1 "SpoolJoin [off]" "\x00" -#MSG_AUTO_HOME c=0 r=0 +#MSG_AUTO_HOME "Auto home" "Llevar al origen" -#MSG_AUTOLOAD_FILAMENT c=17 r=0 +#MSG_AUTOLOAD_FILAMENT c=17 "AutoLoad filament" "Carga automatica de filamento" @@ -74,27 +74,27 @@ "Autoloading filament is active, just press the knob and insert filament..." "La carga automatica de filamento esta activada, pulse el dial e inserte el filamento..." -#MSG_SELFTEST_AXIS_LENGTH c=0 r=0 +#MSG_SELFTEST_AXIS_LENGTH "Axis length" "Longitud del eje" -#MSG_SELFTEST_AXIS c=0 r=0 +#MSG_SELFTEST_AXIS "Axis" "Eje" -#MSG_SELFTEST_BEDHEATER c=0 r=0 +#MSG_SELFTEST_BEDHEATER "Bed / Heater" "Base / Calentador" -#MSG_BED_DONE c=0 r=0 +#MSG_BED_DONE "Bed done" "Base preparada" -#MSG_BED_HEATING c=0 r=0 +#MSG_BED_HEATING "Bed Heating" "Calentando Base" -#MSG_BED_CORRECTION_MENU c=0 r=0 +#MSG_BED_CORRECTION_MENU "Bed level correct" "Corr. de la cama" @@ -102,7 +102,7 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Nivelacion fallada. Sensor no funciona. Restos en boquilla? Esperando reset." -#MSG_BED c=0 r=0 +#MSG_BED "Bed" "Base calefactable " @@ -118,11 +118,11 @@ "Calibrating home" "Calibrando posicion inicial" -#MSG_CALIBRATE_BED c=0 r=0 +#MSG_CALIBRATE_BED "Calibrate XYZ" "Calibrar XYZ" -#MSG_HOMEYZ c=0 r=0 +#MSG_HOMEYZ "Calibrate Z" "Calibrar Z" @@ -142,11 +142,11 @@ "Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done." "Calibrando Z. Gira el dial para subir el extrusor hasta tocar los topes superiores. Despues haz clic." -#MSG_HOMEYZ_DONE c=0 r=0 +#MSG_HOMEYZ_DONE "Calibration done" "Calibracion OK" -#MSG_MENU_CALIBRATION c=0 r=0 +#MSG_MENU_CALIBRATION "Calibration" "Calibracion" @@ -154,15 +154,15 @@ "Cancel" "Cancelar" -#MSG_SD_REMOVED c=0 r=0 +#MSG_SD_REMOVED "Card removed" "Tarjeta retirada" -#MSG_NOT_COLOR c=0 r=0 +#MSG_NOT_COLOR "Color not correct" "Color no homogeneo" -#MSG_COOLDOWN c=0 r=0 +#MSG_COOLDOWN "Cooldown" "Enfriar" @@ -170,15 +170,15 @@ "Copy selected language?" "Copiar idioma seleccionado?" -#MSG_CRASHDETECT_ON c=0 r=0 +#MSG_CRASHDETECT_ON "Crash det. [on]" "Det. choque [act]" -#MSG_CRASHDETECT_NA c=0 r=0 +#MSG_CRASHDETECT_NA "Crash det. [N/A]" "Dec. choque [N/D]" -#MSG_CRASHDETECT_OFF c=0 r=0 +#MSG_CRASHDETECT_OFF "Crash det. [off]" "Det. choque [ina]" @@ -202,7 +202,7 @@ "Date:" "Fecha:" -#MSG_DISABLE_STEPPERS c=0 r=0 +#MSG_DISABLE_STEPPERS "Disable steppers" "Apagar motores" @@ -214,7 +214,7 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Quieres repetir el ultimo paso para reajustar la distancia boquilla-base?" -#MSG_EXTRUDER_CORRECTION c=9 r=0 +#MSG_EXTRUDER_CORRECTION c=9 "E-correct" "E-correcion" @@ -254,11 +254,11 @@ "Endstop not hit" "Endstop no alcanzado" -#MSG_SELFTEST_ENDSTOP c=0 r=0 +#MSG_SELFTEST_ENDSTOP "Endstop" "\x00" -#MSG_SELFTEST_ENDSTOPS c=0 r=0 +#MSG_SELFTEST_ENDSTOPS "Endstops" "\x00" @@ -270,11 +270,11 @@ "ERROR: Filament sensor is not responding, please check connection." "ERROR: El sensor de filamento no responde, por favor comprueba la conexion." -#MSG_ERROR c=0 r=0 +#MSG_ERROR "ERROR:" "\x00" -#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 "Extruder fan:" "Ventilador del extrusor:" @@ -282,7 +282,7 @@ "Extruder info" "Informacion del extrusor" -#MSG_MOVE_E c=0 r=0 +#MSG_MOVE_E "Extruder" "Extruir" @@ -306,11 +306,11 @@ "Fail stats" "Estadistica de fallos" -#MSG_FAN_SPEED c=14 r=0 +#MSG_FAN_SPEED c=14 "Fan speed" "Velocidad Vent." -#MSG_SELFTEST_FAN c=20 r=0 +#MSG_SELFTEST_FAN c=20 "Fan test" "Test ventiladores" @@ -322,15 +322,15 @@ "Fans check [off]" "Comprob.vent[ina]" -#MSG_FSENSOR_ON c=0 r=0 +#MSG_FSENSOR_ON "Fil. sensor [on]" "Sensor Fil. [act]" -#MSG_FSENSOR_NA c=0 r=0 +#MSG_FSENSOR_NA "Fil. sensor [N/A]" "Sensor Fil. [N/D]" -#MSG_FSENSOR_OFF c=0 r=0 +#MSG_FSENSOR_OFF "Fil. sensor [off]" "Sensor Fil. [ina]" @@ -342,11 +342,11 @@ "Filament extruding & with correct color?" "Es nitido el color nuevo?" -#MSG_NOT_LOADED c=19 r=0 +#MSG_NOT_LOADED c=19 "Filament not loaded" "Fil. no introducido" -#MSG_FILAMENT_SENSOR c=20 r=0 +#MSG_FILAMENT_SENSOR c=20 "Filament sensor" "Sensor de filamento" @@ -378,15 +378,15 @@ "Fix the issue and then press button on MMU unit." "Corrige el problema y pulsa el boton en la unidad MMU." -#MSG_FLOW c=0 r=0 +#MSG_FLOW "Flow" "Flujo" -#MSG_PRUSA3D_FORUM c=0 r=0 +#MSG_PRUSA3D_FORUM "forum.prusa3d.com" "\x00" -#MSG_SELFTEST_COOLING_FAN c=20 r=0 +#MSG_SELFTEST_COOLING_FAN c=20 "Front print fan?" "Vent. frontal?" @@ -394,23 +394,23 @@ "Front side[um]" "Frontal [um]" -#MSG_SELFTEST_FANS c=0 r=0 +#MSG_SELFTEST_FANS "Front/left fans" "Ventiladores frontal/izquierdo" -#MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 +#MSG_SELFTEST_HEATERTHERMISTOR "Heater/Thermistor" "Calentador/Termistor" -#MSG_BED_HEATING_SAFETY_DISABLED c=0 r=0 +#MSG_BED_HEATING_SAFETY_DISABLED "Heating disabled by safety timer." "Calentadores desactivados por el temporizador de seguridad." -#MSG_HEATING_COMPLETE c=20 r=0 +#MSG_HEATING_COMPLETE c=20 "Heating done." "Calentamiento acabado." -#MSG_HEATING c=0 r=0 +#MSG_HEATING "Heating" "Calentando..." @@ -418,47 +418,47 @@ "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?" "Hola, soy tu impresora Original Prusa i3. Quieres que te guie a traves de la configuracion?" -#MSG_PRUSA3D_HOWTO c=0 r=0 +#MSG_PRUSA3D_HOWTO "howto.prusa3d.com" "\x00" -#MSG_FILAMENTCHANGE c=0 r=0 +#MSG_FILAMENTCHANGE "Change filament" "Cambiar filamento" -#MSG_CHANGE_SUCCESS c=0 r=0 +#MSG_CHANGE_SUCCESS "Change success!" "Cambio correcto" -#MSG_CORRECTLY c=20 r=0 +#MSG_CORRECTLY c=20 "Changed correctly?" "Cambio correcto?" -#MSG_SELFTEST_CHECK_BED c=20 r=0 +#MSG_SELFTEST_CHECK_BED c=20 "Checking bed " "Control base cal." -#MSG_SELFTEST_CHECK_ENDSTOPS c=20 r=0 +#MSG_SELFTEST_CHECK_ENDSTOPS c=20 "Checking endstops" "Control endstops" -#MSG_SELFTEST_CHECK_HOTEND c=20 r=0 +#MSG_SELFTEST_CHECK_HOTEND c=20 "Checking hotend " "Control fusor" -#MSG_SELFTEST_CHECK_FSENSOR c=20 r=0 +#MSG_SELFTEST_CHECK_FSENSOR c=20 "Checking sensors " "Comprobando los sensores" -#MSG_SELFTEST_CHECK_X c=20 r=0 +#MSG_SELFTEST_CHECK_X c=20 "Checking X axis " "Control sensor X" -#MSG_SELFTEST_CHECK_Y c=20 r=0 +#MSG_SELFTEST_CHECK_Y c=20 "Checking Y axis " "Control sensor Y" -#MSG_SELFTEST_CHECK_Z c=20 r=0 +#MSG_SELFTEST_CHECK_Z c=20 "Checking Z axis " "Control sensor Z" @@ -486,7 +486,7 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Voy a comenzar a imprimir la linea y tu bajaras el nozzle gradualmente al rotar el dial, hasta que llegues a la altura optima. Mira las imagenes del capitulo Calibracion en el manual." -#MSG_WATCH c=0 r=0 +#MSG_WATCH "Info screen" "Monitorizar" @@ -494,7 +494,7 @@ "Is filament 1 loaded?" "?Esta cargado el filamento 1?" -#MSG_INSERT_FILAMENT c=20 r=0 +#MSG_INSERT_FILAMENT c=20 "Insert filament" "Introducir filamento" @@ -522,7 +522,7 @@ "Last print" "Ultima impresion" -#MSG_SELFTEST_EXTRUDER_FAN c=20 r=0 +#MSG_SELFTEST_EXTRUDER_FAN c=20 "Left hotend fan?" "Vent. izquierdo?" @@ -538,19 +538,19 @@ "Lin. correction" "Correccion de Linealidad" -#MSG_BABYSTEP_Z c=0 r=0 +#MSG_BABYSTEP_Z "Live adjust Z" "Micropaso Eje Z" -#MSG_LOAD_FILAMENT c=17 r=0 +#MSG_LOAD_FILAMENT c=17 "Load filament" "Introducir filam." -#MSG_LOADING_COLOR c=0 r=0 +#MSG_LOADING_COLOR "Loading color" "Cambiando color" -#MSG_LOADING_FILAMENT c=20 r=0 +#MSG_LOADING_FILAMENT c=20 "Loading filament" "Introduciendo filam." @@ -566,15 +566,15 @@ "M117 First layer cal." "M117 Cal. primera cap." -#MSG_MAIN c=0 r=0 +#MSG_MAIN "Main" "Menu principal" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 "Measuring reference height of calibration point" "Midiendo altura del punto de calibracion" -#MSG_MESH_BED_LEVELING c=0 r=0 +#MSG_MESH_BED_LEVELING "Mesh Bed Leveling" "Nivelacion Mesh Level" @@ -606,11 +606,11 @@ "MMU OK. Resuming..." "MMU OK. Resumiendo..." -#MSG_STEALTH_MODE_OFF c=0 r=0 +#MSG_STEALTH_MODE_OFF "Mode [Normal]" "Modo [Normal]" -#MSG_SILENT_MODE_ON c=0 r=0 +#MSG_SILENT_MODE_ON "Mode [silent]" "Modo [silencio]" @@ -622,15 +622,15 @@ "MMU power fails" "Fallo de energia en MMU" -#MSG_STEALTH_MODE_ON c=0 r=0 +#MSG_STEALTH_MODE_ON "Mode [Stealth]" "Modo [Silencio]" -#MSG_AUTO_MODE_ON c=0 r=0 +#MSG_AUTO_MODE_ON "Mode [auto power]" "Modo[fuerza auto]" -#MSG_SILENT_MODE_OFF c=0 r=0 +#MSG_SILENT_MODE_OFF "Mode [high power]" "Modo [rend.pleno]" @@ -638,31 +638,31 @@ "MMU2 connected" "MMU2 conectado" -#MSG_SELFTEST_MOTOR c=0 r=0 +#MSG_SELFTEST_MOTOR "Motor" "\x00" -#MSG_MOVE_AXIS c=0 r=0 +#MSG_MOVE_AXIS "Move axis" "Mover ejes" -#MSG_MOVE_X c=0 r=0 +#MSG_MOVE_X "Move X" "Mover X" -#MSG_MOVE_Y c=0 r=0 +#MSG_MOVE_Y "Move Y" "Mover Y" -#MSG_MOVE_Z c=0 r=0 +#MSG_MOVE_Z "Move Z" "Mover Z" -#MSG_NO_MOVE c=0 r=0 +#MSG_NO_MOVE "No move." "Sin movimiento" -#MSG_NO_CARD c=0 r=0 +#MSG_NO_CARD "No SD card" "No hay tarjeta SD" @@ -670,11 +670,11 @@ "N/A" "No disponible" -#MSG_NO c=0 r=0 +#MSG_NO "No" "\x00" -#MSG_SELFTEST_NOTCONNECTED c=0 r=0 +#MSG_SELFTEST_NOTCONNECTED "Not connected" "No hay conexion " @@ -682,7 +682,7 @@ "New firmware version available:" "Nuevo firmware disponible:" -#MSG_SELFTEST_FAN_NO c=19 r=0 +#MSG_SELFTEST_FAN_NO c=19 "Not spinning" "Ventilador no gira" @@ -694,7 +694,7 @@ "Now I will preheat nozzle for PLA." "Voy a precalentar la boquilla para PLA ahora." -#MSG_NOZZLE c=0 r=0 +#MSG_NOZZLE "Nozzle" "Boquilla" @@ -710,7 +710,7 @@ "Nozzle FAN" "Ventilador de capa" -#MSG_PAUSE_PRINT c=0 r=0 +#MSG_PAUSE_PRINT "Pause print" "Pausar impresion" @@ -742,7 +742,7 @@ "Please clean the nozzle for calibration. Click when done." "Limpia boquilla para calibracion. Click cuando acabes." -#MSG_SELFTEST_PLEASECHECK c=0 r=0 +#MSG_SELFTEST_PLEASECHECK "Please check :" "Controla :" @@ -794,7 +794,7 @@ "Please update firmware in your MMU2. Waiting for reset." "Por favor actualice el firmware en tu MMU2. Esperando el reseteo." -#MSG_PLEASE_WAIT c=20 r=0 +#MSG_PLEASE_WAIT c=20 "Please wait" "Por Favor Espere" @@ -802,11 +802,11 @@ "Please remove shipping helpers first." "Por favor retira los soportes de envio primero." -#MSG_PREHEAT_NOZZLE c=20 r=0 +#MSG_PREHEAT_NOZZLE c=20 "Preheat the nozzle!" "Precalienta extrusor!" -#MSG_PREHEAT c=0 r=0 +#MSG_PREHEAT "Preheat" "Precalentar" @@ -826,7 +826,7 @@ "Power failures" "Cortes de energia" -#MSG_PRINT_ABORTED c=20 r=0 +#MSG_PRINT_ABORTED c=20 "Print aborted" "Impresion cancelada" @@ -838,11 +838,11 @@ "Preheating to unload" "Precalentar para descargar" -#MSG_SELFTEST_PRINT_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_PRINT_FAN_SPEED c=18 "Print fan:" "Ventilador del fusor:" -#MSG_CARD_MENU c=0 r=0 +#MSG_CARD_MENU "Print from SD" "Menu tarjeta SD" @@ -866,7 +866,7 @@ "Print FAN" "Ventilador del extrusor" -#MSG_PRUSA3D c=0 r=0 +#MSG_PRUSA3D "prusa3d.com" "prusa3d.es" @@ -886,15 +886,15 @@ "Prusa i3 MK3S OK." "\x00" -#MSG_CALIBRATE_BED_RESET c=0 r=0 +#MSG_CALIBRATE_BED_RESET "Reset XYZ calibr." "\x00" -#MSG_BED_CORRECTION_RESET c=0 r=0 +#MSG_BED_CORRECTION_RESET "Reset" "\x00" -#MSG_RESUME_PRINT c=0 r=0 +#MSG_RESUME_PRINT "Resume print" "Reanudar impres." @@ -930,31 +930,31 @@ "Right" "Derecha" -#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 +#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 "Searching bed calibration point" "Buscando punto de calibracion base" -#MSG_LANGUAGE_SELECT c=0 r=0 +#MSG_LANGUAGE_SELECT "Select language" "Cambiar el idioma" -#MSG_SELFTEST_OK c=0 r=0 +#MSG_SELFTEST_OK "Self test OK" "\x00" -#MSG_SELFTEST_START c=20 r=0 +#MSG_SELFTEST_START c=20 "Self test start " "Iniciar Selftest" -#MSG_SELFTEST c=0 r=0 +#MSG_SELFTEST "Selftest " "Selftest" -#MSG_SELFTEST_ERROR c=0 r=0 +#MSG_SELFTEST_ERROR "Selftest error !" "Error Selftest !" -#MSG_SELFTEST_FAILED c=20 r=0 +#MSG_SELFTEST_FAILED c=20 "Selftest failed " "Fallo Selftest" @@ -974,7 +974,7 @@ "Set temperature:" "Establecer temp.:" -#MSG_SETTINGS c=0 r=0 +#MSG_SETTINGS "Settings" "Configuracion" @@ -1034,11 +1034,11 @@ "Sound [silent]" "Sonido[silencios]" -#MSG_SPEED c=0 r=0 +#MSG_SPEED "Speed" "Velocidad" -#MSG_SELFTEST_FAN_YES c=19 r=0 +#MSG_SELFTEST_FAN_YES c=19 "Spinning" "Ventilador girando" @@ -1046,23 +1046,23 @@ "Stable ambient temperature 21-26C is needed a rigid stand is required." "Se necesita una temperatura ambiente ente 21 y 26C y un soporte rigido." -#MSG_STATISTICS c=0 r=0 +#MSG_STATISTICS "Statistics " "Estadisticas " -#MSG_STOP_PRINT c=0 r=0 +#MSG_STOP_PRINT "Stop print" "Detener impresion" -#MSG_STOPPED c=0 r=0 +#MSG_STOPPED "STOPPED. " "PARADA" -#MSG_SUPPORT c=0 r=0 +#MSG_SUPPORT "Support" "Soporte" -#MSG_SELFTEST_SWAPPED c=0 r=0 +#MSG_SELFTEST_SWAPPED "Swapped" "Intercambiado" @@ -1090,7 +1090,7 @@ "Temperature calibration is finished and active. Temp. calibration can be disabled in menu Settings->Temp. cal." "Calibracion temperatura terminada. Haz clic para continuar." -#MSG_TEMPERATURE c=0 r=0 +#MSG_TEMPERATURE "Temperature" "Temperatura" @@ -1110,7 +1110,7 @@ "Total print time" "Tiempo total :" -#MSG_TUNE c=0 r=0 +#MSG_TUNE "Tune" "Ajustar" @@ -1130,7 +1130,7 @@ "to unload filament" "para descargar el filamento" -#MSG_UNLOAD_FILAMENT c=17 r=0 +#MSG_UNLOAD_FILAMENT c=17 "Unload filament" "Soltar filamento" @@ -1154,7 +1154,7 @@ "unknown" "desconocido" -#MSG_USERWAIT c=0 r=0 +#MSG_USERWAIT "Wait for user..." "Esperando ordenes" @@ -1186,7 +1186,7 @@ "Was filament unload successful?" "?Se cargocon exito el filamento?" -#MSG_SELFTEST_WIRINGERROR c=0 r=0 +#MSG_SELFTEST_WIRINGERROR "Wiring error" "Error de conexion" @@ -1202,7 +1202,7 @@ "XYZ calibration failed. Please consult the manual." "Calibracion XYZ fallada. Consulta el manual por favor." -#MSG_YES c=0 r=0 +#MSG_YES "Yes" "Si" @@ -1234,11 +1234,11 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Calibrazion XYZ comprometida. Punto frontal derecho no alcanzable." -#MSG_LOAD_ALL c=17 r=0 +#MSG_LOAD_ALL c=17 "Load all" "Intr. todos fil." -#MSG_LOAD_FILAMENT_1 c=17 r=0 +#MSG_LOAD_FILAMENT_1 c=17 "Load filament 1" "Introducir fil. 1" @@ -1250,7 +1250,7 @@ "XYZ calibration failed. Front calibration points not reachable." "Calibracion XYZ fallada. Puntos frontales no alcanzables." -#MSG_LOAD_FILAMENT_2 c=17 r=0 +#MSG_LOAD_FILAMENT_2 c=17 "Load filament 2" "Introducir fil. 2" @@ -1258,7 +1258,7 @@ "XYZ calibration failed. Right front calibration point not reachable." "Calibracion XYZ fallad. Punto frontal derecho no alcanzable." -#MSG_LOAD_FILAMENT_3 c=17 r=0 +#MSG_LOAD_FILAMENT_3 c=17 "Load filament 3" "Introducir fil. 3" @@ -1270,14 +1270,14 @@ "Y-correct" "Y-correcion" -#MSG_LOAD_FILAMENT_4 c=17 r=0 +#MSG_LOAD_FILAMENT_4 c=17 "Load filament 4" "Introducir fil. 4" -#MSG_LOAD_FILAMENT_5 c=17 r=0 +#MSG_LOAD_FILAMENT_5 c=17 "Load filament 5" "Cargar filamento 5" -#MSG_OFF c=0 r=0 +#MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 582835b74..7e91c029a 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -1,12 +1,12 @@ -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 r=0 +#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 " of 4" "de 4" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 " of 9" "de 9" -#MSG_MEASURED_OFFSET c=0 r=0 +#MSG_MEASURED_OFFSET "[0;0] point offset" "Offset point [0;0]" @@ -22,11 +22,11 @@ ">Cancel" ">Annuler" -#MSG_BABYSTEPPING_Z c=20 r=0 +#MSG_BABYSTEPPING_Z c=20 "Adjusting Z" "Ajustement de Z" -#MSG_SELFTEST_CHECK_ALLCORRECT c=20 r=0 +#MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " "Tout est correct" @@ -38,7 +38,7 @@ "Ambient" "Ambiant" -#MSG_PRESS c=20 r=0 +#MSG_PRESS c=20 "and press the knob" "et pressez le bouton" @@ -54,15 +54,15 @@ "SpoolJoin [N/A]" "\x00" -# MSG_AUTO_DEPLETE_OFF c=17 r=1 +#MSG_AUTO_DEPLETE_OFF c=17 r=1 "SpoolJoin [off]" "\x00" -#MSG_AUTO_HOME c=0 r=0 +#MSG_AUTO_HOME "Auto home" "Mise a 0 des axes" -#MSG_AUTOLOAD_FILAMENT c=17 r=0 +#MSG_AUTOLOAD_FILAMENT c=17 "AutoLoad filament" "AutoCharge du filament" @@ -74,27 +74,27 @@ "Autoloading filament is active, just press the knob and insert filament..." "Chargement auto du filament actif, appuyez sur le btn et inserez le fil." -#MSG_SELFTEST_AXIS_LENGTH c=0 r=0 +#MSG_SELFTEST_AXIS_LENGTH "Axis length" "Longueur de l'axe" -#MSG_SELFTEST_AXIS c=0 r=0 +#MSG_SELFTEST_AXIS "Axis" "Axe" -#MSG_SELFTEST_BEDHEATER c=0 r=0 +#MSG_SELFTEST_BEDHEATER "Bed / Heater" "Lit / Chauffage" -#MSG_BED_DONE c=0 r=0 +#MSG_BED_DONE "Bed done" "Plateau termine" -#MSG_BED_HEATING c=0 r=0 +#MSG_BED_HEATING "Bed Heating" "Chauffe du lit" -#MSG_BED_CORRECTION_MENU c=0 r=0 +#MSG_BED_CORRECTION_MENU "Bed level correct" "Corr. niveau plateau" @@ -102,7 +102,7 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Echec bed leveling. Capt. non declenche. Debris sur buse ? En attente d'un reset." -#MSG_BED c=0 r=0 +#MSG_BED "Bed" "Lit" @@ -118,11 +118,11 @@ "Calibrating home" "Calib. mise a 0" -#MSG_CALIBRATE_BED c=0 r=0 +#MSG_CALIBRATE_BED "Calibrate XYZ" "Calibrer XYZ" -#MSG_HOMEYZ c=0 r=0 +#MSG_HOMEYZ "Calibrate Z" "Calibrer Z" @@ -142,11 +142,11 @@ "Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done." "Calibration de Z. Tournez le bouton pour monter le chariot de l'axe Z jusqu'aux butees. Cliquez une fois fait." -#MSG_HOMEYZ_DONE c=0 r=0 +#MSG_HOMEYZ_DONE "Calibration done" "Calibration terminee" -#MSG_MENU_CALIBRATION c=0 r=0 +#MSG_MENU_CALIBRATION "Calibration" "\x00" @@ -154,15 +154,15 @@ "Cancel" "Annuler" -#MSG_SD_REMOVED c=0 r=0 +#MSG_SD_REMOVED "Card removed" "Carte retiree" -#MSG_NOT_COLOR c=0 r=0 +#MSG_NOT_COLOR "Color not correct" "Couleur incorrecte" -#MSG_COOLDOWN c=0 r=0 +#MSG_COOLDOWN "Cooldown" "Refroidissement" @@ -170,15 +170,15 @@ "Copy selected language?" "Copier la langue selectionne ?" -#MSG_CRASHDETECT_ON c=0 r=0 +#MSG_CRASHDETECT_ON "Crash det. [on]" "Detect. crash[on]" -#MSG_CRASHDETECT_NA c=0 r=0 +#MSG_CRASHDETECT_NA "Crash det. [N/A]" "Detect. crash [N/A]" -#MSG_CRASHDETECT_OFF c=0 r=0 +#MSG_CRASHDETECT_OFF "Crash det. [off]" "Detect. crash[off]" @@ -202,7 +202,7 @@ "Date:" "Date :" -#MSG_DISABLE_STEPPERS c=0 r=0 +#MSG_DISABLE_STEPPERS "Disable steppers" "Desactiver moteurs" @@ -214,7 +214,7 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Voulez-vous repeter la derniere etape pour reajuster la distance entre la buse et le plateau chauffant ?" -#MSG_EXTRUDER_CORRECTION c=9 r=0 +#MSG_EXTRUDER_CORRECTION c=9 "E-correct" "Correct-E" @@ -254,11 +254,11 @@ "Endstop not hit" "Butee non atteinte" -#MSG_SELFTEST_ENDSTOP c=0 r=0 +#MSG_SELFTEST_ENDSTOP "Endstop" "Butee" -#MSG_SELFTEST_ENDSTOPS c=0 r=0 +#MSG_SELFTEST_ENDSTOPS "Endstops" "Butees" @@ -270,11 +270,11 @@ "ERROR: Filament sensor is not responding, please check connection." "ERREUR : Le capteur de filament ne repond pas, verifiez le branchement." -#MSG_ERROR c=0 r=0 +#MSG_ERROR "ERROR:" "ERREUR :" -#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 "Extruder fan:" "Ventilo extrudeur:" @@ -282,7 +282,7 @@ "Extruder info" "Infos extrudeur" -#MSG_MOVE_E c=0 r=0 +#MSG_MOVE_E "Extruder" "Extrudeur" @@ -306,11 +306,11 @@ "Fail stats" "Statist. d'echec" -#MSG_FAN_SPEED c=14 r=0 +#MSG_FAN_SPEED c=14 "Fan speed" "Vitesse ventil" -#MSG_SELFTEST_FAN c=20 r=0 +#MSG_SELFTEST_FAN c=20 "Fan test" "Test ventilateur" @@ -322,15 +322,15 @@ "Fans check [off]" "Verif venti [off]" -#MSG_FSENSOR_ON c=0 r=0 +#MSG_FSENSOR_ON "Fil. sensor [on]" "Capteur Fil. [on]" -#MSG_FSENSOR_NA c=0 r=0 +#MSG_FSENSOR_NA "Fil. sensor [N/A]" "Capteur Fil. [N/A]" -#MSG_FSENSOR_OFF c=0 r=0 +#MSG_FSENSOR_OFF "Fil. sensor [off]" "Capteur Fil.[off]" @@ -342,11 +342,11 @@ "Filament extruding & with correct color?" "Filament extrude et avec bonne couleur ?" -#MSG_NOT_LOADED c=19 r=0 +#MSG_NOT_LOADED c=19 "Filament not loaded" "Filament non charge" -#MSG_FILAMENT_SENSOR c=20 r=0 +#MSG_FILAMENT_SENSOR c=20 "Filament sensor" "Capteur de filament" @@ -378,15 +378,15 @@ "Fix the issue and then press button on MMU unit." "Corrigez le probleme et appuyez sur le bouton de l'unite MMU." -#MSG_FLOW c=0 r=0 +#MSG_FLOW "Flow" "Flux" -#MSG_PRUSA3D_FORUM c=0 r=0 +#MSG_PRUSA3D_FORUM "forum.prusa3d.com" "\x00" -#MSG_SELFTEST_COOLING_FAN c=20 r=0 +#MSG_SELFTEST_COOLING_FAN c=20 "Front print fan?" "Ventilo impr avant ?" @@ -394,23 +394,23 @@ "Front side[um]" "Avant [um]" -#MSG_SELFTEST_FANS c=0 r=0 +#MSG_SELFTEST_FANS "Front/left fans" "Ventilos avt/gauche" -#MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 +#MSG_SELFTEST_HEATERTHERMISTOR "Heater/Thermistor" "Chauffage/Thermistor" -#MSG_BED_HEATING_SAFETY_DISABLED c=0 r=0 +#MSG_BED_HEATING_SAFETY_DISABLED "Heating disabled by safety timer." "Chauffe desactivee par le compteur de securite." -#MSG_HEATING_COMPLETE c=20 r=0 +#MSG_HEATING_COMPLETE c=20 "Heating done." "Chauffe terminee." -#MSG_HEATING c=0 r=0 +#MSG_HEATING "Heating" "Chauffe" @@ -418,47 +418,47 @@ "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?" "Bonjour, je suis votre imprimante Original Prusa i3. Voulez-vous que je vous guide a travers le processus d'installation ?" -#MSG_PRUSA3D_HOWTO c=0 r=0 +#MSG_PRUSA3D_HOWTO "howto.prusa3d.com" "\x00" -#MSG_FILAMENTCHANGE c=0 r=0 +#MSG_FILAMENTCHANGE "Change filament" "Changer filament" -#MSG_CHANGE_SUCCESS c=0 r=0 +#MSG_CHANGE_SUCCESS "Change success!" "Changement reussi!" -#MSG_CORRECTLY c=20 r=0 +#MSG_CORRECTLY c=20 "Changed correctly?" "Change correctement?" -#MSG_SELFTEST_CHECK_BED c=20 r=0 +#MSG_SELFTEST_CHECK_BED c=20 "Checking bed " "Verification du lit" -#MSG_SELFTEST_CHECK_ENDSTOPS c=20 r=0 +#MSG_SELFTEST_CHECK_ENDSTOPS c=20 "Checking endstops" "Verifications butees" -#MSG_SELFTEST_CHECK_HOTEND c=20 r=0 +#MSG_SELFTEST_CHECK_HOTEND c=20 "Checking hotend " "Verif. tete impr." -#MSG_SELFTEST_CHECK_FSENSOR c=20 r=0 +#MSG_SELFTEST_CHECK_FSENSOR c=20 "Checking sensors " "Verif. des capteurs" -#MSG_SELFTEST_CHECK_X c=20 r=0 +#MSG_SELFTEST_CHECK_X c=20 "Checking X axis " "Verification axe X" -#MSG_SELFTEST_CHECK_Y c=20 r=0 +#MSG_SELFTEST_CHECK_Y c=20 "Checking Y axis " "Verification axe Y" -#MSG_SELFTEST_CHECK_Z c=20 r=0 +#MSG_SELFTEST_CHECK_Z c=20 "Checking Z axis " "Verification axe Z" @@ -486,7 +486,7 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Je vais commencer a imprimer une ligne et vous baisserez au fur et a mesure la buse en tournant le bouton jusqu'a atteindre la hauteur optimale. Regardez les photos dans notre manuel au chapitre Calibration" -#MSG_WATCH c=0 r=0 +#MSG_WATCH "Info screen" "Ecran d'info" @@ -494,7 +494,7 @@ "Is filament 1 loaded?" "Le filament 1 est-il charge ?" -#MSG_INSERT_FILAMENT c=20 r=0 +#MSG_INSERT_FILAMENT c=20 "Insert filament" "Inserez le filament" @@ -522,7 +522,7 @@ "Last print" "Derniere impression" -#MSG_SELFTEST_EXTRUDER_FAN c=20 r=0 +#MSG_SELFTEST_EXTRUDER_FAN c=20 "Left hotend fan?" "Ventilo tete gauche?" @@ -538,19 +538,19 @@ "Lin. correction" "Correction lin." -#MSG_BABYSTEP_Z c=0 r=0 +#MSG_BABYSTEP_Z "Live adjust Z" "Ajuster Z en direct" -#MSG_LOAD_FILAMENT c=17 r=0 +#MSG_LOAD_FILAMENT c=17 "Load filament" "Charger filament" -#MSG_LOADING_COLOR c=0 r=0 +#MSG_LOADING_COLOR "Loading color" "Chargement couleur" -#MSG_LOADING_FILAMENT c=20 r=0 +#MSG_LOADING_FILAMENT c=20 "Loading filament" "Chargement filament" @@ -566,15 +566,15 @@ "M117 First layer cal." "M117 Cal. 1ere couche" -#MSG_MAIN c=0 r=0 +#MSG_MAIN "Main" "Principal" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 "Measuring reference height of calibration point" "Mesure de la hauteur de reference du point de calibration" -#MSG_MESH_BED_LEVELING c=0 r=0 +#MSG_MESH_BED_LEVELING "Mesh Bed Leveling" "\x00" @@ -606,11 +606,11 @@ "MMU OK. Resuming..." "MMU OK. Reprise ..." -#MSG_STEALTH_MODE_OFF c=0 r=0 +#MSG_STEALTH_MODE_OFF "Mode [Normal]" "\x00" -#MSG_SILENT_MODE_ON c=0 r=0 +#MSG_SILENT_MODE_ON "Mode [silent]" "Mode [silencieux]" @@ -622,15 +622,15 @@ "MMU power fails" "Echecs alim. MMU" -#MSG_STEALTH_MODE_ON c=0 r=0 +#MSG_STEALTH_MODE_ON "Mode [Stealth]" "Mode [Furtif]" -#MSG_AUTO_MODE_ON c=0 r=0 +#MSG_AUTO_MODE_ON "Mode [auto power]" "Mode [puiss.auto]" -#MSG_SILENT_MODE_OFF c=0 r=0 +#MSG_SILENT_MODE_OFF "Mode [high power]" "Mode [haute puiss]" @@ -638,31 +638,31 @@ "MMU2 connected" "MMU2 connecte" -#MSG_SELFTEST_MOTOR c=0 r=0 +#MSG_SELFTEST_MOTOR "Motor" "Moteur" -#MSG_MOVE_AXIS c=0 r=0 +#MSG_MOVE_AXIS "Move axis" "Deplacer l'axe" -#MSG_MOVE_X c=0 r=0 +#MSG_MOVE_X "Move X" "Deplacer X" -#MSG_MOVE_Y c=0 r=0 +#MSG_MOVE_Y "Move Y" "Deplacer Y" -#MSG_MOVE_Z c=0 r=0 +#MSG_MOVE_Z "Move Z" "Deplacer Z" -#MSG_NO_MOVE c=0 r=0 +#MSG_NO_MOVE "No move." "Pas de mouvement." -#MSG_NO_CARD c=0 r=0 +#MSG_NO_CARD "No SD card" "Pas de carte SD" @@ -670,11 +670,11 @@ "N/A" "\x00" -#MSG_NO c=0 r=0 +#MSG_NO "No" "Non" -#MSG_SELFTEST_NOTCONNECTED c=0 r=0 +#MSG_SELFTEST_NOTCONNECTED "Not connected" "Non connecte" @@ -682,7 +682,7 @@ "New firmware version available:" "Nouvelle version de firmware disponible:" -#MSG_SELFTEST_FAN_NO c=19 r=0 +#MSG_SELFTEST_FAN_NO c=19 "Not spinning" "Ne tourne pas" @@ -694,7 +694,7 @@ "Now I will preheat nozzle for PLA." "Maintenant je vais prechauffer la buse pour du PLA." -#MSG_NOZZLE c=0 r=0 +#MSG_NOZZLE "Nozzle" "Buse" @@ -710,7 +710,7 @@ "Nozzle FAN" "Ventilateur buse" -#MSG_PAUSE_PRINT c=0 r=0 +#MSG_PAUSE_PRINT "Pause print" "Pause de l'impr." @@ -742,7 +742,7 @@ "Please clean the nozzle for calibration. Click when done." "Nettoyez la buse pour la calibration. Cliquez une fois fait." -#MSG_SELFTEST_PLEASECHECK c=0 r=0 +#MSG_SELFTEST_PLEASECHECK "Please check :" "Verifiez :" @@ -794,7 +794,7 @@ "Please update firmware in your MMU2. Waiting for reset." "Veuillez mettre a jour le firmware de votre MMU2. En attente d'un reset." -#MSG_PLEASE_WAIT c=20 r=0 +#MSG_PLEASE_WAIT c=20 "Please wait" "Merci de patienter" @@ -802,11 +802,11 @@ "Please remove shipping helpers first." "Veuillez retirer d'abord les protections d'envoi." -#MSG_PREHEAT_NOZZLE c=20 r=0 +#MSG_PREHEAT_NOZZLE c=20 "Preheat the nozzle!" "Prechauffez la buse!" -#MSG_PREHEAT c=0 r=0 +#MSG_PREHEAT "Preheat" "Prechauffage" @@ -826,7 +826,7 @@ "Power failures" "Coupures de courant" -#MSG_PRINT_ABORTED c=20 r=0 +#MSG_PRINT_ABORTED c=20 "Print aborted" "Impression annulee" @@ -838,11 +838,11 @@ "Preheating to unload" "Chauffe pr decharger" -#MSG_SELFTEST_PRINT_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_PRINT_FAN_SPEED c=18 "Print fan:" "Ventilo impr. :" -#MSG_CARD_MENU c=0 r=0 +#MSG_CARD_MENU "Print from SD" "Impr depuis la SD" @@ -866,7 +866,7 @@ "Print FAN" "Ventilo impression" -#MSG_PRUSA3D c=0 r=0 +#MSG_PRUSA3D "prusa3d.com" "\x00" @@ -886,15 +886,15 @@ "Prusa i3 MK3S OK." "\x00" -#MSG_CALIBRATE_BED_RESET c=0 r=0 +#MSG_CALIBRATE_BED_RESET "Reset XYZ calibr." "Reinit. calibr. XYZ" -#MSG_BED_CORRECTION_RESET c=0 r=0 +#MSG_BED_CORRECTION_RESET "Reset" "Reinitialiser" -#MSG_RESUME_PRINT c=0 r=0 +#MSG_RESUME_PRINT "Resume print" "Reprendre impression" @@ -930,31 +930,31 @@ "Right" "Droite" -#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 +#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 "Searching bed calibration point" "Recherche du point de calibration du lit" -#MSG_LANGUAGE_SELECT c=0 r=0 +#MSG_LANGUAGE_SELECT "Select language" "Choisir langue" -#MSG_SELFTEST_OK c=0 r=0 +#MSG_SELFTEST_OK "Self test OK" "Auto-test OK" -#MSG_SELFTEST_START c=20 r=0 +#MSG_SELFTEST_START c=20 "Self test start " "Debut auto-test" -#MSG_SELFTEST c=0 r=0 +#MSG_SELFTEST "Selftest " "Auto-test" -#MSG_SELFTEST_ERROR c=0 r=0 +#MSG_SELFTEST_ERROR "Selftest error !" "Erreur auto-test !" -#MSG_SELFTEST_FAILED c=20 r=0 +#MSG_SELFTEST_FAILED c=20 "Selftest failed " "Echec de l'auto-test" @@ -974,7 +974,7 @@ "Set temperature:" "Regler temp. :" -#MSG_SETTINGS c=0 r=0 +#MSG_SETTINGS "Settings" "Reglages" @@ -1034,11 +1034,11 @@ "Sound [silent]" "Son [silencieux]" -#MSG_SPEED c=0 r=0 +#MSG_SPEED "Speed" "Vitesse" -#MSG_SELFTEST_FAN_YES c=19 r=0 +#MSG_SELFTEST_FAN_YES c=19 "Spinning" "Tourne" @@ -1046,23 +1046,23 @@ "Stable ambient temperature 21-26C is needed a rigid stand is required." "Une temperature ambiante stable de 21-26C et un support stable sont requis." -#MSG_STATISTICS c=0 r=0 +#MSG_STATISTICS "Statistics " "Statistiques" -#MSG_STOP_PRINT c=0 r=0 +#MSG_STOP_PRINT "Stop print" "Arreter impression" -#MSG_STOPPED c=0 r=0 +#MSG_STOPPED "STOPPED. " "ARRETE." -#MSG_SUPPORT c=0 r=0 +#MSG_SUPPORT "Support" "\x00" -#MSG_SELFTEST_SWAPPED c=0 r=0 +#MSG_SELFTEST_SWAPPED "Swapped" "Echange" @@ -1090,7 +1090,7 @@ "Temperature calibration is finished and active. Temp. calibration can be disabled in menu Settings->Temp. cal." "La calibration en temperature est terminee et activee. La calibration en temperature peut etre desactivee dans le menu Reglages-> Cal. Temp." -#MSG_TEMPERATURE c=0 r=0 +#MSG_TEMPERATURE "Temperature" "\x00" @@ -1110,7 +1110,7 @@ "Total print time" "Temps total impr." -#MSG_TUNE c=0 r=0 +#MSG_TUNE "Tune" "Regler" @@ -1130,7 +1130,7 @@ "to unload filament" "pour decharger fil." -#MSG_UNLOAD_FILAMENT c=17 r=0 +#MSG_UNLOAD_FILAMENT c=17 "Unload filament" "Decharger fil." @@ -1154,7 +1154,7 @@ "unknown" "inconnu" -#MSG_USERWAIT c=0 r=0 +#MSG_USERWAIT "Wait for user..." "Attente utilisateur..." @@ -1186,7 +1186,7 @@ "Was filament unload successful?" "Dechargement du filament reussi ?" -#MSG_SELFTEST_WIRINGERROR c=0 r=0 +#MSG_SELFTEST_WIRINGERROR "Wiring error" "Erreur de cablage" @@ -1202,7 +1202,7 @@ "XYZ calibration failed. Please consult the manual." "Echec calibration XYZ. Consultez le manuel." -#MSG_YES c=0 r=0 +#MSG_YES "Yes" "Oui" @@ -1234,11 +1234,11 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Calibration XYZ compromise. Le point de calibration avant droit n'est pas atteignable." -#MSG_LOAD_ALL c=17 r=0 +#MSG_LOAD_ALL c=17 "Load all" "Tout charger" -#MSG_LOAD_FILAMENT_1 c=17 r=0 +#MSG_LOAD_FILAMENT_1 c=17 "Load filament 1" "Charger fil. 1" @@ -1250,7 +1250,7 @@ "XYZ calibration failed. Front calibration points not reachable." "Echec calibration XYZ. Les points de calibration avant ne sont pas atteignables." -#MSG_LOAD_FILAMENT_2 c=17 r=0 +#MSG_LOAD_FILAMENT_2 c=17 "Load filament 2" "Charger fil. 2" @@ -1258,7 +1258,7 @@ "XYZ calibration failed. Right front calibration point not reachable." "Echec calibration XYZ. Le point de calibration avant droit n'est pas atteignable." -#MSG_LOAD_FILAMENT_3 c=17 r=0 +#MSG_LOAD_FILAMENT_3 c=17 "Load filament 3" "Charger fil. 3" @@ -1270,14 +1270,14 @@ "Y-correct" "Correction-Y" -#MSG_LOAD_FILAMENT_4 c=17 r=0 +#MSG_LOAD_FILAMENT_4 c=17 "Load filament 4" "Charger fil. 4" -#MSG_LOAD_FILAMENT_5 c=17 r=0 +#MSG_LOAD_FILAMENT_5 c=17 "Load filament 5" "Charger fil. 5" -#MSG_OFF c=0 r=0 +#MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 8467e4577..12a12fa91 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -1,12 +1,12 @@ -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 r=0 +#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 " of 4" " su 4" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 " of 9" "su 9" -#MSG_MEASURED_OFFSET c=0 r=0 +#MSG_MEASURED_OFFSET "[0;0] point offset" "[0;0] punto offset" @@ -22,11 +22,11 @@ ">Cancel" ">Annulla" -#MSG_BABYSTEPPING_Z c=20 r=0 +#MSG_BABYSTEPPING_Z c=20 "Adjusting Z" "Compensazione Z" -#MSG_SELFTEST_CHECK_ALLCORRECT c=20 r=0 +#MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " "Nessun errore" @@ -38,7 +38,7 @@ "Ambient" "Ambiente" -#MSG_PRESS c=20 r=0 +#MSG_PRESS c=20 "and press the knob" "e cliccare manopola" @@ -54,15 +54,15 @@ "SpoolJoin [N/A]" "\x00" -# MSG_AUTO_DEPLETE_OFF c=17 r=1 +#MSG_AUTO_DEPLETE_OFF c=17 r=1 "SpoolJoin [off]" "\x00" -#MSG_AUTO_HOME c=0 r=0 +#MSG_AUTO_HOME "Auto home" "Trova origine" -#MSG_AUTOLOAD_FILAMENT c=17 r=0 +#MSG_AUTOLOAD_FILAMENT c=17 "AutoLoad filament" "Autocaric. filam." @@ -74,27 +74,27 @@ "Autoloading filament is active, just press the knob and insert filament..." "Il caricamento automatico e attivo, premete la manopola e inserite il filamento..." -#MSG_SELFTEST_AXIS_LENGTH c=0 r=0 +#MSG_SELFTEST_AXIS_LENGTH "Axis length" "Lunghezza dell'asse" -#MSG_SELFTEST_AXIS c=0 r=0 +#MSG_SELFTEST_AXIS "Axis" "Assi" -#MSG_SELFTEST_BEDHEATER c=0 r=0 +#MSG_SELFTEST_BEDHEATER "Bed / Heater" "Letto/Riscald." -#MSG_BED_DONE c=0 r=0 +#MSG_BED_DONE "Bed done" "Piano fatto." -#MSG_BED_HEATING c=0 r=0 +#MSG_BED_HEATING "Bed Heating" "Riscald. letto" -#MSG_BED_CORRECTION_MENU c=0 r=0 +#MSG_BED_CORRECTION_MENU "Bed level correct" "Correz. liv.letto" @@ -102,7 +102,7 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Livellamento letto fallito.NoRispSensore.Residui su ugello? In attesa di reset." -#MSG_BED c=0 r=0 +#MSG_BED "Bed" "Letto" @@ -118,11 +118,11 @@ "Calibrating home" "Calibrazione Home" -#MSG_CALIBRATE_BED c=0 r=0 +#MSG_CALIBRATE_BED "Calibrate XYZ" "Calibra XYZ" -#MSG_HOMEYZ c=0 r=0 +#MSG_HOMEYZ "Calibrate Z" "Calibra Z" @@ -142,11 +142,11 @@ "Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done." "Calibrazione Z. Ruotare la manopola per alzare il carrello Z fino all'altezza massima. Click per terminare." -#MSG_HOMEYZ_DONE c=0 r=0 +#MSG_HOMEYZ_DONE "Calibration done" "Calibrazione completa" -#MSG_MENU_CALIBRATION c=0 r=0 +#MSG_MENU_CALIBRATION "Calibration" "Calibrazione" @@ -154,15 +154,15 @@ "Cancel" "Annulla" -#MSG_SD_REMOVED c=0 r=0 +#MSG_SD_REMOVED "Card removed" "SD rimossa" -#MSG_NOT_COLOR c=0 r=0 +#MSG_NOT_COLOR "Color not correct" "Colore non puro" -#MSG_COOLDOWN c=0 r=0 +#MSG_COOLDOWN "Cooldown" "Raffredda" @@ -170,15 +170,15 @@ "Copy selected language?" "Copiare la lingua selezionata?" -#MSG_CRASHDETECT_ON c=0 r=0 +#MSG_CRASHDETECT_ON "Crash det. [on]" "Rilevam.imp. [on]" -#MSG_CRASHDETECT_NA c=0 r=0 +#MSG_CRASHDETECT_NA "Crash det. [N/A]" "Rilevam.imp.[N/A]" -#MSG_CRASHDETECT_OFF c=0 r=0 +#MSG_CRASHDETECT_OFF "Crash det. [off]" "Rilevam.imp.[off]" @@ -202,7 +202,7 @@ "Date:" "Data:" -#MSG_DISABLE_STEPPERS c=0 r=0 +#MSG_DISABLE_STEPPERS "Disable steppers" "Disabilita motori" @@ -214,7 +214,7 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Desideri ripetere l'ultimo passaggio per migliorare la distanza fra ugello e piatto?" -#MSG_EXTRUDER_CORRECTION c=9 r=0 +#MSG_EXTRUDER_CORRECTION c=9 "E-correct" "Correzione-E" @@ -254,11 +254,11 @@ "Endstop not hit" "Finecorsa fuori portata" -#MSG_SELFTEST_ENDSTOP c=0 r=0 +#MSG_SELFTEST_ENDSTOP "Endstop" "Finecorsa" -#MSG_SELFTEST_ENDSTOPS c=0 r=0 +#MSG_SELFTEST_ENDSTOPS "Endstops" "Finecorsa" @@ -270,11 +270,11 @@ "ERROR: Filament sensor is not responding, please check connection." "ERRORE: il sensore filam. non risponde,Controllare conness." -#MSG_ERROR c=0 r=0 +#MSG_ERROR "ERROR:" "ERRORE:" -#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 "Extruder fan:" "Ventola estrusore:" @@ -282,7 +282,7 @@ "Extruder info" "Info estrusore" -#MSG_MOVE_E c=0 r=0 +#MSG_MOVE_E "Extruder" "Estrusore" @@ -306,11 +306,11 @@ "Fail stats" "Statistiche fallimenti" -#MSG_FAN_SPEED c=14 r=0 +#MSG_FAN_SPEED c=14 "Fan speed" "Velocita ventola" -#MSG_SELFTEST_FAN c=20 r=0 +#MSG_SELFTEST_FAN c=20 "Fan test" "Test ventola" @@ -322,15 +322,15 @@ "Fans check [off]" "Control.vent[off]" -#MSG_FSENSOR_ON c=0 r=0 +#MSG_FSENSOR_ON "Fil. sensor [on]" "Sensor filam.[On]" -#MSG_FSENSOR_NA c=0 r=0 +#MSG_FSENSOR_NA "Fil. sensor [N/A]" "Sensor filam[N/A]" -#MSG_FSENSOR_OFF c=0 r=0 +#MSG_FSENSOR_OFF "Fil. sensor [off]" "Sensor filam[off]" @@ -342,11 +342,11 @@ "Filament extruding & with correct color?" "Filamento estruso & con il giusto colore?" -#MSG_NOT_LOADED c=19 r=0 +#MSG_NOT_LOADED c=19 "Filament not loaded" "Fil. non caricato" -#MSG_FILAMENT_SENSOR c=20 r=0 +#MSG_FILAMENT_SENSOR c=20 "Filament sensor" "Sensore filam." @@ -378,15 +378,15 @@ "Fix the issue and then press button on MMU unit." "Risolvi il problema e quindi premi il bottone sull'unita MMU. " -#MSG_FLOW c=0 r=0 +#MSG_FLOW "Flow" "Flusso" -#MSG_PRUSA3D_FORUM c=0 r=0 +#MSG_PRUSA3D_FORUM "forum.prusa3d.com" "\x00" -#MSG_SELFTEST_COOLING_FAN c=20 r=0 +#MSG_SELFTEST_COOLING_FAN c=20 "Front print fan?" "Ventola frontale?" @@ -394,23 +394,23 @@ "Front side[um]" "Fronte [um]" -#MSG_SELFTEST_FANS c=0 r=0 +#MSG_SELFTEST_FANS "Front/left fans" "Ventola frontale/sinistra" -#MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 +#MSG_SELFTEST_HEATERTHERMISTOR "Heater/Thermistor" "Riscald./Termist." -#MSG_BED_HEATING_SAFETY_DISABLED c=0 r=0 +#MSG_BED_HEATING_SAFETY_DISABLED "Heating disabled by safety timer." "Riscaldamento fermato dal timer di sicurezza." -#MSG_HEATING_COMPLETE c=20 r=0 +#MSG_HEATING_COMPLETE c=20 "Heating done." "Riscald. completo" -#MSG_HEATING c=0 r=0 +#MSG_HEATING "Heating" "Riscaldamento..." @@ -418,47 +418,47 @@ "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?" "Ciao, sono la tua stampante Original Prusa i3. Gradiresti un aiuto nel processo di configurazione?" -#MSG_PRUSA3D_HOWTO c=0 r=0 +#MSG_PRUSA3D_HOWTO "howto.prusa3d.com" "\x00" -#MSG_FILAMENTCHANGE c=0 r=0 +#MSG_FILAMENTCHANGE "Change filament" "Cambia filamento" -#MSG_CHANGE_SUCCESS c=0 r=0 +#MSG_CHANGE_SUCCESS "Change success!" "Cambio riuscito!" -#MSG_CORRECTLY c=20 r=0 +#MSG_CORRECTLY c=20 "Changed correctly?" "Cambiato correttamente?" -#MSG_SELFTEST_CHECK_BED c=20 r=0 +#MSG_SELFTEST_CHECK_BED c=20 "Checking bed " "Verifica piano" -#MSG_SELFTEST_CHECK_ENDSTOPS c=20 r=0 +#MSG_SELFTEST_CHECK_ENDSTOPS c=20 "Checking endstops" "Verifica finecorsa" -#MSG_SELFTEST_CHECK_HOTEND c=20 r=0 +#MSG_SELFTEST_CHECK_HOTEND c=20 "Checking hotend " "Verifica ugello" -#MSG_SELFTEST_CHECK_FSENSOR c=20 r=0 +#MSG_SELFTEST_CHECK_FSENSOR c=20 "Checking sensors " "Controllo sensori" -#MSG_SELFTEST_CHECK_X c=20 r=0 +#MSG_SELFTEST_CHECK_X c=20 "Checking X axis " "Verifica asse X" -#MSG_SELFTEST_CHECK_Y c=20 r=0 +#MSG_SELFTEST_CHECK_Y c=20 "Checking Y axis " "Verifica asse Y" -#MSG_SELFTEST_CHECK_Z c=20 r=0 +#MSG_SELFTEST_CHECK_Z c=20 "Checking Z axis " "Verifica asse Z" @@ -486,7 +486,7 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Adesso iniziero a stampare una linea e tu dovrai abbassare l'ugello poco per volta ruotando la manopola sino a raggiungere una altezza ottimale. Per favore dai uno sguardo all'immagine del nostro manuale, cap.Calibrazione." -#MSG_WATCH c=0 r=0 +#MSG_WATCH "Info screen" "Schermata info" @@ -494,7 +494,7 @@ "Is filament 1 loaded?" "Il filamento 1 e caricato?" -#MSG_INSERT_FILAMENT c=20 r=0 +#MSG_INSERT_FILAMENT c=20 "Insert filament" "Inserire filamento" @@ -522,7 +522,7 @@ "Last print" "Ultima stampa" -#MSG_SELFTEST_EXTRUDER_FAN c=20 r=0 +#MSG_SELFTEST_EXTRUDER_FAN c=20 "Left hotend fan?" "Vent SX hotend?" @@ -538,19 +538,19 @@ "Lin. correction" "Correzione lin." -#MSG_BABYSTEP_Z c=0 r=0 +#MSG_BABYSTEP_Z "Live adjust Z" "Compensazione Z" -#MSG_LOAD_FILAMENT c=17 r=0 +#MSG_LOAD_FILAMENT c=17 "Load filament" "Carica filamento" -#MSG_LOADING_COLOR c=0 r=0 +#MSG_LOADING_COLOR "Loading color" "Caricando colore" -#MSG_LOADING_FILAMENT c=20 r=0 +#MSG_LOADING_FILAMENT c=20 "Loading filament" "Caricando filamento" @@ -566,15 +566,15 @@ "M117 First layer cal." "M117 Calibrazione primo layer." -#MSG_MAIN c=0 r=0 +#MSG_MAIN "Main" "Menu principale" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 "Measuring reference height of calibration point" "Misura altezza di rif. del punto di calib." -#MSG_MESH_BED_LEVELING c=0 r=0 +#MSG_MESH_BED_LEVELING "Mesh Bed Leveling" "Mesh livel. letto" @@ -606,11 +606,11 @@ "MMU OK. Resuming..." "MMU OK. Riprendendo... " -#MSG_STEALTH_MODE_OFF c=0 r=0 +#MSG_STEALTH_MODE_OFF "Mode [Normal]" "Modo [normale]" -#MSG_SILENT_MODE_ON c=0 r=0 +#MSG_SILENT_MODE_ON "Mode [silent]" "Modo [silenzioso]" @@ -622,15 +622,15 @@ "MMU power fails" "Mancanza corrente MMU" -#MSG_STEALTH_MODE_ON c=0 r=0 +#MSG_STEALTH_MODE_ON "Mode [Stealth]" "Modo [Silenziosa]" -#MSG_AUTO_MODE_ON c=0 r=0 +#MSG_AUTO_MODE_ON "Mode [auto power]" "Modo [auto]" -#MSG_SILENT_MODE_OFF c=0 r=0 +#MSG_SILENT_MODE_OFF "Mode [high power]" "Mode [forte]" @@ -638,31 +638,31 @@ "MMU2 connected" "MMU2 connessa" -#MSG_SELFTEST_MOTOR c=0 r=0 +#MSG_SELFTEST_MOTOR "Motor" "Motore" -#MSG_MOVE_AXIS c=0 r=0 +#MSG_MOVE_AXIS "Move axis" "Muovi asse" -#MSG_MOVE_X c=0 r=0 +#MSG_MOVE_X "Move X" "Muovi X" -#MSG_MOVE_Y c=0 r=0 +#MSG_MOVE_Y "Move Y" "Muovi Y" -#MSG_MOVE_Z c=0 r=0 +#MSG_MOVE_Z "Move Z" "Muovi Z" -#MSG_NO_MOVE c=0 r=0 +#MSG_NO_MOVE "No move." "Nessun movimento." -#MSG_NO_CARD c=0 r=0 +#MSG_NO_CARD "No SD card" "Nessuna SD" @@ -670,11 +670,11 @@ "N/A" "\x00" -#MSG_NO c=0 r=0 +#MSG_NO "No" "\x00" -#MSG_SELFTEST_NOTCONNECTED c=0 r=0 +#MSG_SELFTEST_NOTCONNECTED "Not connected" "Non connesso" @@ -682,7 +682,7 @@ "New firmware version available:" "Nuova versione firmware disponibile:" -#MSG_SELFTEST_FAN_NO c=19 r=0 +#MSG_SELFTEST_FAN_NO c=19 "Not spinning" "Non gira" @@ -694,7 +694,7 @@ "Now I will preheat nozzle for PLA." "Adesso preriscaldero l'ugello per PLA." -#MSG_NOZZLE c=0 r=0 +#MSG_NOZZLE "Nozzle" "Ugello" @@ -710,7 +710,7 @@ "Nozzle FAN" "Ventola estrusore" -#MSG_PAUSE_PRINT c=0 r=0 +#MSG_PAUSE_PRINT "Pause print" "Metti in pausa" @@ -742,7 +742,7 @@ "Please clean the nozzle for calibration. Click when done." "Pulire l'ugello per la calibrazione, poi fare click." -#MSG_SELFTEST_PLEASECHECK c=0 r=0 +#MSG_SELFTEST_PLEASECHECK "Please check :" "Verifica:" @@ -794,7 +794,7 @@ "Please update firmware in your MMU2. Waiting for reset." "Aggiorna il firmware sul tuo MMU2. In attesa di reset. " -#MSG_PLEASE_WAIT c=20 r=0 +#MSG_PLEASE_WAIT c=20 "Please wait" "Attendere" @@ -802,11 +802,11 @@ "Please remove shipping helpers first." "Per favore rimuovete i materiali da spedizione" -#MSG_PREHEAT_NOZZLE c=20 r=0 +#MSG_PREHEAT_NOZZLE c=20 "Preheat the nozzle!" "Prerisc. ugello!" -#MSG_PREHEAT c=0 r=0 +#MSG_PREHEAT "Preheat" "Preriscalda" @@ -826,7 +826,7 @@ "Power failures" "Mancanza corrente" -#MSG_PRINT_ABORTED c=20 r=0 +#MSG_PRINT_ABORTED c=20 "Print aborted" "Stampa interrotta" @@ -838,11 +838,11 @@ "Preheating to unload" "Preriscaldamento per scaricare" -#MSG_SELFTEST_PRINT_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_PRINT_FAN_SPEED c=18 "Print fan:" "Ventola di stampa:" -#MSG_CARD_MENU c=0 r=0 +#MSG_CARD_MENU "Print from SD" "Stampa da SD" @@ -866,7 +866,7 @@ "Print FAN" "Ventola di stampa" -#MSG_PRUSA3D c=0 r=0 +#MSG_PRUSA3D "prusa3d.com" "\x00" @@ -886,15 +886,15 @@ "Prusa i3 MK3S OK." "\x00" -#MSG_CALIBRATE_BED_RESET c=0 r=0 +#MSG_CALIBRATE_BED_RESET "Reset XYZ calibr." "Reset calibrazione XYZ." -#MSG_BED_CORRECTION_RESET c=0 r=0 +#MSG_BED_CORRECTION_RESET "Reset" "\x00" -#MSG_RESUME_PRINT c=0 r=0 +#MSG_RESUME_PRINT "Resume print" "Riprendi stampa" @@ -930,31 +930,31 @@ "Right" "Destra" -#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 +#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 "Searching bed calibration point" "Ricerca dei punti di calibrazione del piano" -#MSG_LANGUAGE_SELECT c=0 r=0 +#MSG_LANGUAGE_SELECT "Select language" "Seleziona lingua" -#MSG_SELFTEST_OK c=0 r=0 +#MSG_SELFTEST_OK "Self test OK" "Autotest OK" -#MSG_SELFTEST_START c=20 r=0 +#MSG_SELFTEST_START c=20 "Self test start " "Avvia autotest" -#MSG_SELFTEST c=0 r=0 +#MSG_SELFTEST "Selftest " "Autotest" -#MSG_SELFTEST_ERROR c=0 r=0 +#MSG_SELFTEST_ERROR "Selftest error !" "Errore Autotest !" -#MSG_SELFTEST_FAILED c=20 r=0 +#MSG_SELFTEST_FAILED c=20 "Selftest failed " "Autotest fallito" @@ -974,7 +974,7 @@ "Set temperature:" "Imposta temperatura:" -#MSG_SETTINGS c=0 r=0 +#MSG_SETTINGS "Settings" "Impostazioni" @@ -1034,11 +1034,11 @@ "Sound [silent]" "Suono[silenzioso]" -#MSG_SPEED c=0 r=0 +#MSG_SPEED "Speed" "Velocita" -#MSG_SELFTEST_FAN_YES c=19 r=0 +#MSG_SELFTEST_FAN_YES c=19 "Spinning" "Gira" @@ -1046,23 +1046,23 @@ "Stable ambient temperature 21-26C is needed a rigid stand is required." "Sono necessari una temperatura ambiente di 21-26C e una superficie rigida " -#MSG_STATISTICS c=0 r=0 +#MSG_STATISTICS "Statistics " "Statistiche" -#MSG_STOP_PRINT c=0 r=0 +#MSG_STOP_PRINT "Stop print" "Arresta stampa" -#MSG_STOPPED c=0 r=0 +#MSG_STOPPED "STOPPED. " "ARRESTATO." -#MSG_SUPPORT c=0 r=0 +#MSG_SUPPORT "Support" "Supporto" -#MSG_SELFTEST_SWAPPED c=0 r=0 +#MSG_SELFTEST_SWAPPED "Swapped" "Scambiato" @@ -1090,7 +1090,7 @@ "Temperature calibration is finished and active. Temp. calibration can be disabled in menu Settings->Temp. cal." "Calibrazione temperatura completata e attiva. Puo essere disattivata dal menu Impostazioni ->Cal. Temp." -#MSG_TEMPERATURE c=0 r=0 +#MSG_TEMPERATURE "Temperature" "\x00" @@ -1110,7 +1110,7 @@ "Total print time" "Tempo di stampa totale" -#MSG_TUNE c=0 r=0 +#MSG_TUNE "Tune" "Regola" @@ -1130,7 +1130,7 @@ "to unload filament" "per scaricare il filamento" -#MSG_UNLOAD_FILAMENT c=17 r=0 +#MSG_UNLOAD_FILAMENT c=17 "Unload filament" "Scarica filam." @@ -1154,7 +1154,7 @@ "unknown" "sconosciuto" -#MSG_USERWAIT c=0 r=0 +#MSG_USERWAIT "Wait for user..." "Attendendo utente..." @@ -1186,7 +1186,7 @@ "Was filament unload successful?" "Filamento scaricato con successo?" -#MSG_SELFTEST_WIRINGERROR c=0 r=0 +#MSG_SELFTEST_WIRINGERROR "Wiring error" "Errore cablaggio" @@ -1202,7 +1202,7 @@ "XYZ calibration failed. Please consult the manual." "Calibrazione XYZ fallita. Si prega di consultare il manuale." -#MSG_YES c=0 r=0 +#MSG_YES "Yes" "Si" @@ -1234,11 +1234,11 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Calibrazione XYZ compromessa. Punto anteriore destro non raggiungibile." -#MSG_LOAD_ALL c=17 r=0 +#MSG_LOAD_ALL c=17 "Load all" "Caricare tutti" -#MSG_LOAD_FILAMENT_1 c=17 r=0 +#MSG_LOAD_FILAMENT_1 c=17 "Load filament 1" "Caricare fil. 1" @@ -1250,7 +1250,7 @@ "XYZ calibration failed. Front calibration points not reachable." "Calibrazione XYZ fallita. Punti anteriori non raggiungibili." -#MSG_LOAD_FILAMENT_2 c=17 r=0 +#MSG_LOAD_FILAMENT_2 c=17 "Load filament 2" "Caricare fil. 2" @@ -1258,7 +1258,7 @@ "XYZ calibration failed. Right front calibration point not reachable." "Calibrazione XYZ fallita. Punto anteriore destro non raggiungibile." -#MSG_LOAD_FILAMENT_3 c=17 r=0 +#MSG_LOAD_FILAMENT_3 c=17 "Load filament 3" "Carica fil. 3" @@ -1270,14 +1270,14 @@ "Y-correct" "Correzione-Y" -#MSG_LOAD_FILAMENT_4 c=17 r=0 +#MSG_LOAD_FILAMENT_4 c=17 "Load filament 4" "Caricare fil. 4" -#MSG_LOAD_FILAMENT_5 c=17 r=0 +#MSG_LOAD_FILAMENT_5 c=17 "Load filament 5" "Caricare fil. 5" -#MSG_OFF c=0 r=0 +#MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index dc7df52d5..bdac8819e 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -1,12 +1,12 @@ -#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 r=0 +#MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 c=14 " of 4" " z 4" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 c=14 " of 9" " z 9" -#MSG_MEASURED_OFFSET c=0 r=0 +#MSG_MEASURED_OFFSET "[0;0] point offset" "[0;0] przesuniecie punktu" @@ -22,11 +22,11 @@ ">Cancel" ">Anuluj" -#MSG_BABYSTEPPING_Z c=20 r=0 +#MSG_BABYSTEPPING_Z c=20 "Adjusting Z" "Dostrajanie Z" -#MSG_SELFTEST_CHECK_ALLCORRECT c=20 r=0 +#MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " "Wszystko OK " @@ -38,7 +38,7 @@ "Ambient" "Otoczenie" -#MSG_PRESS c=20 r=0 +#MSG_PRESS c=20 "and press the knob" "i nacisnij pokretlo" @@ -54,15 +54,15 @@ "SpoolJoin [N/A]" "SpoolJoin [nd]" -# MSG_AUTO_DEPLETE_OFF c=17 r=1 +#MSG_AUTO_DEPLETE_OFF c=17 r=1 "SpoolJoin [off]" "SpoolJoin [wyl]" -#MSG_AUTO_HOME c=0 r=0 +#MSG_AUTO_HOME "Auto home" "Auto zerowanie" -#MSG_AUTOLOAD_FILAMENT c=17 r=0 +#MSG_AUTOLOAD_FILAMENT c=17 "AutoLoad filament" "AutoLadowanie fil." @@ -74,27 +74,27 @@ "Autoloading filament is active, just press the knob and insert filament..." "Autoladowanie filamentu wlaczone, nacisnij pokretlo i wsun filament..." -#MSG_SELFTEST_AXIS_LENGTH c=0 r=0 +#MSG_SELFTEST_AXIS_LENGTH "Axis length" "Dlugosc osi" -#MSG_SELFTEST_AXIS c=0 r=0 +#MSG_SELFTEST_AXIS "Axis" "Os" -#MSG_SELFTEST_BEDHEATER c=0 r=0 +#MSG_SELFTEST_BEDHEATER "Bed / Heater" "Stol / Grzanie" -#MSG_BED_DONE c=0 r=0 +#MSG_BED_DONE "Bed done" "Stol OK" -#MSG_BED_HEATING c=0 r=0 +#MSG_BED_HEATING "Bed Heating" "Grzanie stolu.." -#MSG_BED_CORRECTION_MENU c=0 r=0 +#MSG_BED_CORRECTION_MENU "Bed level correct" "Korekta poziomowania stolu" @@ -102,7 +102,7 @@ "Bed leveling failed. Sensor didnt trigger. Debris on nozzle? Waiting for reset." "Kalibracja nieudana. Sensor nie aktywowal sie. Zanieczysz. dysza? Czekam na reset." -#MSG_BED c=0 r=0 +#MSG_BED "Bed" "Stol" @@ -118,11 +118,11 @@ "Calibrating home" "Zerowanie osi" -#MSG_CALIBRATE_BED c=0 r=0 +#MSG_CALIBRATE_BED "Calibrate XYZ" "Kalibracja XYZ" -#MSG_HOMEYZ c=0 r=0 +#MSG_HOMEYZ "Calibrate Z" "Kalibruj Z" @@ -142,11 +142,11 @@ "Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done." "Kalibracja XYZ. Przekrec pokretlo, aby przesunac os Z do gornych ogranicznikow. Nacisnij, by potwierdzic." -#MSG_HOMEYZ_DONE c=0 r=0 +#MSG_HOMEYZ_DONE "Calibration done" "Kalibracja OK" -#MSG_MENU_CALIBRATION c=0 r=0 +#MSG_MENU_CALIBRATION "Calibration" "Kalibracja" @@ -154,15 +154,15 @@ "Cancel" "Anuluj" -#MSG_SD_REMOVED c=0 r=0 +#MSG_SD_REMOVED "Card removed" "Karta wyjeta" -#MSG_NOT_COLOR c=0 r=0 +#MSG_NOT_COLOR "Color not correct" "Kolor zanieczysz." -#MSG_COOLDOWN c=0 r=0 +#MSG_COOLDOWN "Cooldown" "Chlodzenie" @@ -170,15 +170,15 @@ "Copy selected language?" "Skopiowac wybrany jezyk?" -#MSG_CRASHDETECT_ON c=0 r=0 +#MSG_CRASHDETECT_ON "Crash det. [on]" "Wykr.zderzen [wl]" -#MSG_CRASHDETECT_NA c=0 r=0 +#MSG_CRASHDETECT_NA "Crash det. [N/A]" "Wykr.zderzen[n/d]" -#MSG_CRASHDETECT_OFF c=0 r=0 +#MSG_CRASHDETECT_OFF "Crash det. [off]" "Wykr.zderzen[wyl]" @@ -202,7 +202,7 @@ "Date:" "Data:" -#MSG_DISABLE_STEPPERS c=0 r=0 +#MSG_DISABLE_STEPPERS "Disable steppers" "Wylaczenie silnikow" @@ -214,7 +214,7 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Chcesz powtorzyc ostatni krok i ponownie ustawic odleglosc miedzy dysza a stolikiem?" -#MSG_EXTRUDER_CORRECTION c=9 r=0 +#MSG_EXTRUDER_CORRECTION c=9 "E-correct" "Korekcja E" @@ -254,11 +254,11 @@ "Endstop not hit" "Krancowka nie aktyw." -#MSG_SELFTEST_ENDSTOP c=0 r=0 +#MSG_SELFTEST_ENDSTOP "Endstop" "Krancowka" -#MSG_SELFTEST_ENDSTOPS c=0 r=0 +#MSG_SELFTEST_ENDSTOPS "Endstops" "Krancowki" @@ -270,11 +270,11 @@ "ERROR: Filament sensor is not responding, please check connection." "BLAD: Czujnik filamentu nie odpowiada, sprawdz polaczenie." -#MSG_ERROR c=0 r=0 +#MSG_ERROR "ERROR:" "BLAD:" -#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 "Extruder fan:" "Went. ekstrudera:" @@ -282,7 +282,7 @@ "Extruder info" "Informacje o ekstruderze" -#MSG_MOVE_E c=0 r=0 +#MSG_MOVE_E "Extruder" "Ekstruder" @@ -306,11 +306,11 @@ "Fail stats" "Statystyki bledow" -#MSG_FAN_SPEED c=14 r=0 +#MSG_FAN_SPEED c=14 "Fan speed" "Predkosc went." -#MSG_SELFTEST_FAN c=20 r=0 +#MSG_SELFTEST_FAN c=20 "Fan test" "Test wentylatora" @@ -322,15 +322,15 @@ "Fans check [off]" "Sprawd.went.[wyl]" -#MSG_FSENSOR_ON c=0 r=0 +#MSG_FSENSOR_ON "Fil. sensor [on]" "Czuj. filam. [wl]" -#MSG_FSENSOR_NA c=0 r=0 +#MSG_FSENSOR_NA "Fil. sensor [N/A]" "Czuj. filam.[N/D]" -#MSG_FSENSOR_OFF c=0 r=0 +#MSG_FSENSOR_OFF "Fil. sensor [off]" "Czuj. filam.[wyl]" @@ -342,11 +342,11 @@ "Filament extruding & with correct color?" "Filament wychodzi z dyszy a kolor jest czysty?" -#MSG_NOT_LOADED c=19 r=0 +#MSG_NOT_LOADED c=19 "Filament not loaded" "Fil. nie zaladowany" -#MSG_FILAMENT_SENSOR c=20 r=0 +#MSG_FILAMENT_SENSOR c=20 "Filament sensor" "Czujnik filamentu" @@ -378,15 +378,15 @@ "Fix the issue and then press button on MMU unit." "Rozwiaz problem i wcisnij przycisk na MMU." -#MSG_FLOW c=0 r=0 +#MSG_FLOW "Flow" "Przeplyw" -#MSG_PRUSA3D_FORUM c=0 r=0 +#MSG_PRUSA3D_FORUM "forum.prusa3d.com" "\x00" -#MSG_SELFTEST_COOLING_FAN c=20 r=0 +#MSG_SELFTEST_COOLING_FAN c=20 "Front print fan?" "Przedni went. druku?" @@ -394,23 +394,23 @@ "Front side[um]" "Przod [um]" -#MSG_SELFTEST_FANS c=0 r=0 +#MSG_SELFTEST_FANS "Front/left fans" "Przedni/lewy wentylator" -#MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0 +#MSG_SELFTEST_HEATERTHERMISTOR "Heater/Thermistor" "Grzalka/Termistor" -#MSG_BED_HEATING_SAFETY_DISABLED c=0 r=0 +#MSG_BED_HEATING_SAFETY_DISABLED "Heating disabled by safety timer." "Grzanie wylaczone przez wyl. czasowy" -#MSG_HEATING_COMPLETE c=20 r=0 +#MSG_HEATING_COMPLETE c=20 "Heating done." "Grzanie zakonczone" -#MSG_HEATING c=0 r=0 +#MSG_HEATING "Heating" "Grzanie..." @@ -418,47 +418,47 @@ "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?" "Czesc, jestem Twoja drukarka Original Prusa i3. Czy potrzebujesz pomocy z ustawieniem?" -#MSG_PRUSA3D_HOWTO c=0 r=0 +#MSG_PRUSA3D_HOWTO "howto.prusa3d.com" "\x00" -#MSG_FILAMENTCHANGE c=0 r=0 +#MSG_FILAMENTCHANGE "Change filament" "Wymiana filamentu" -#MSG_CHANGE_SUCCESS c=0 r=0 +#MSG_CHANGE_SUCCESS "Change success!" "Wymiana ok!" -#MSG_CORRECTLY c=20 r=0 +#MSG_CORRECTLY c=20 "Changed correctly?" "Wymiana ok?" -#MSG_SELFTEST_CHECK_BED c=20 r=0 +#MSG_SELFTEST_CHECK_BED c=20 "Checking bed " "Kontrola stolu" -#MSG_SELFTEST_CHECK_ENDSTOPS c=20 r=0 +#MSG_SELFTEST_CHECK_ENDSTOPS c=20 "Checking endstops" "Kontrola krancowek" -#MSG_SELFTEST_CHECK_HOTEND c=20 r=0 +#MSG_SELFTEST_CHECK_HOTEND c=20 "Checking hotend " "Kontrola hotendu" -#MSG_SELFTEST_CHECK_FSENSOR c=20 r=0 +#MSG_SELFTEST_CHECK_FSENSOR c=20 "Checking sensors " "Sprawdzanie czujnikow" -#MSG_SELFTEST_CHECK_X c=20 r=0 +#MSG_SELFTEST_CHECK_X c=20 "Checking X axis " "Kontrola osi X" -#MSG_SELFTEST_CHECK_Y c=20 r=0 +#MSG_SELFTEST_CHECK_Y c=20 "Checking Y axis " "Kontrola osi Y" -#MSG_SELFTEST_CHECK_Z c=20 r=0 +#MSG_SELFTEST_CHECK_Z c=20 "Checking Z axis " "Kontrola osi Z" @@ -486,7 +486,7 @@ "I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." "Zaczne drukowac linie. Stopniowo opuszczaj dysze przekrecajac pokretlo, poki nie uzyskasz optymalnej wysokosci. Sprawdz obrazki w naszym Podreczniku w rozdz. Kalibracja" -#MSG_WATCH c=0 r=0 +#MSG_WATCH "Info screen" "Ekran informacyjny" @@ -494,7 +494,7 @@ "Is filament 1 loaded?" "Filament 1 zaladowany?" -#MSG_INSERT_FILAMENT c=20 r=0 +#MSG_INSERT_FILAMENT c=20 "Insert filament" "Wprowadz filament" @@ -522,7 +522,7 @@ "Last print" "Ost. wydruk" -#MSG_SELFTEST_EXTRUDER_FAN c=20 r=0 +#MSG_SELFTEST_EXTRUDER_FAN c=20 "Left hotend fan?" "Lewy went hotendu?" @@ -538,19 +538,19 @@ "Lin. correction" "Korekcja lin." -#MSG_BABYSTEP_Z c=0 r=0 +#MSG_BABYSTEP_Z "Live adjust Z" "Ustaw. Live Z" -#MSG_LOAD_FILAMENT c=17 r=0 +#MSG_LOAD_FILAMENT c=17 "Load filament" "Ladowanie fil." -#MSG_LOADING_COLOR c=0 r=0 +#MSG_LOADING_COLOR "Loading color" "Czyszcz. koloru" -#MSG_LOADING_FILAMENT c=20 r=0 +#MSG_LOADING_FILAMENT c=20 "Loading filament" "Laduje filament" @@ -566,15 +566,15 @@ "M117 First layer cal." "M117 Kal. 1. warstwy" -#MSG_MAIN c=0 r=0 +#MSG_MAIN "Main" "Menu glowne" -#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 r=0 +#MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=60 "Measuring reference height of calibration point" "Okreslam wysokosc odniesienia punktu kalibracyjnego" -#MSG_MESH_BED_LEVELING c=0 r=0 +#MSG_MESH_BED_LEVELING "Mesh Bed Leveling" "Poziomowanie stolu wg siatki" @@ -606,11 +606,11 @@ "MMU OK. Resuming..." "MMU OK. Wznawianie..." -#MSG_STEALTH_MODE_OFF c=0 r=0 +#MSG_STEALTH_MODE_OFF "Mode [Normal]" "Tryb [normalny]" -#MSG_SILENT_MODE_ON c=0 r=0 +#MSG_SILENT_MODE_ON "Mode [silent]" "Tryb [cichy]" @@ -622,15 +622,15 @@ "MMU power fails" "Zaniki zasil. MMU" -#MSG_STEALTH_MODE_ON c=0 r=0 +#MSG_STEALTH_MODE_ON "Mode [Stealth]" "Tryb [Stealth]" -#MSG_AUTO_MODE_ON c=0 r=0 +#MSG_AUTO_MODE_ON "Mode [auto power]" "Tryb [automatycz]" -#MSG_SILENT_MODE_OFF c=0 r=0 +#MSG_SILENT_MODE_OFF "Mode [high power]" "Tryb[wysoka wyd.]" @@ -638,31 +638,31 @@ "MMU2 connected" "MMU podlaczone" -#MSG_SELFTEST_MOTOR c=0 r=0 +#MSG_SELFTEST_MOTOR "Motor" "Silnik" -#MSG_MOVE_AXIS c=0 r=0 +#MSG_MOVE_AXIS "Move axis" "Ruch osi" -#MSG_MOVE_X c=0 r=0 +#MSG_MOVE_X "Move X" "Ruch osi X" -#MSG_MOVE_Y c=0 r=0 +#MSG_MOVE_Y "Move Y" "Ruch osi Y" -#MSG_MOVE_Z c=0 r=0 +#MSG_MOVE_Z "Move Z" "Ruch osi Z" -#MSG_NO_MOVE c=0 r=0 +#MSG_NO_MOVE "No move." "Brak ruchu." -#MSG_NO_CARD c=0 r=0 +#MSG_NO_CARD "No SD card" "Brak karty SD" @@ -670,11 +670,11 @@ "N/A" "N/D" -#MSG_NO c=0 r=0 +#MSG_NO "No" "Nie" -#MSG_SELFTEST_NOTCONNECTED c=0 r=0 +#MSG_SELFTEST_NOTCONNECTED "Not connected" "Nie podlaczono " @@ -682,7 +682,7 @@ "New firmware version available:" "Dostepna nowa wersja firmware:" -#MSG_SELFTEST_FAN_NO c=19 r=0 +#MSG_SELFTEST_FAN_NO c=19 "Not spinning" "Nie kreci sie" @@ -694,7 +694,7 @@ "Now I will preheat nozzle for PLA." "Nagrzewam dysze dla PLA." -#MSG_NOZZLE c=0 r=0 +#MSG_NOZZLE "Nozzle" "Dysza" @@ -710,7 +710,7 @@ "Nozzle FAN" "Went. hotendu" -#MSG_PAUSE_PRINT c=0 r=0 +#MSG_PAUSE_PRINT "Pause print" "Wstrzymanie wydruku" @@ -742,7 +742,7 @@ "Please clean the nozzle for calibration. Click when done." "Dla prawidl. kalibracji nalezy oczyscic dysze. Potw. guzikiem." -#MSG_SELFTEST_PLEASECHECK c=0 r=0 +#MSG_SELFTEST_PLEASECHECK "Please check :" "Sprawdz :" @@ -794,7 +794,7 @@ "Please update firmware in your MMU2. Waiting for reset." "Prosze zaktualizowac Firmware MMU2. Czekam na reset." -#MSG_PLEASE_WAIT c=20 r=0 +#MSG_PLEASE_WAIT c=20 "Please wait" "Prosze czekac" @@ -802,11 +802,11 @@ "Please remove shipping helpers first." "Najpierw usun zabezpieczenia transportowe" -#MSG_PREHEAT_NOZZLE c=20 r=0 +#MSG_PREHEAT_NOZZLE c=20 "Preheat the nozzle!" "Nagrzej dysze!" -#MSG_PREHEAT c=0 r=0 +#MSG_PREHEAT "Preheat" "Grzanie" @@ -826,7 +826,7 @@ "Power failures" "Zaniki zasilania" -#MSG_PRINT_ABORTED c=20 r=0 +#MSG_PRINT_ABORTED c=20 "Print aborted" "Druk przerwany" @@ -838,11 +838,11 @@ "Preheating to unload" "Nagrzew. do rozlad." -#MSG_SELFTEST_PRINT_FAN_SPEED c=18 r=0 +#MSG_SELFTEST_PRINT_FAN_SPEED c=18 "Print fan:" "Went. wydruku:" -#MSG_CARD_MENU c=0 r=0 +#MSG_CARD_MENU "Print from SD" "Druk z karty SD" @@ -866,7 +866,7 @@ "Print FAN" "Went. wydruku" -#MSG_PRUSA3D c=0 r=0 +#MSG_PRUSA3D "prusa3d.com" "\x00" @@ -886,15 +886,15 @@ "Prusa i3 MK3S OK." "Prusa i3 MK3S OK" -#MSG_CALIBRATE_BED_RESET c=0 r=0 +#MSG_CALIBRATE_BED_RESET "Reset XYZ calibr." "Reset kalibr. XYZ" -#MSG_BED_CORRECTION_RESET c=0 r=0 +#MSG_BED_CORRECTION_RESET "Reset" "\x00" -#MSG_RESUME_PRINT c=0 r=0 +#MSG_RESUME_PRINT "Resume print" "Wznowic wydruk" @@ -930,31 +930,31 @@ "Right" "Prawa" -#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 r=0 +#MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=60 "Searching bed calibration point" "Szukam punktu kalibracyjnego na stole" -#MSG_LANGUAGE_SELECT c=0 r=0 +#MSG_LANGUAGE_SELECT "Select language" "Wybor jezyka" -#MSG_SELFTEST_OK c=0 r=0 +#MSG_SELFTEST_OK "Self test OK" "Selftest OK" -#MSG_SELFTEST_START c=20 r=0 +#MSG_SELFTEST_START c=20 "Self test start " "Rozpoczynanie Selftestu" -#MSG_SELFTEST c=0 r=0 +#MSG_SELFTEST "Selftest " "Selftest " -#MSG_SELFTEST_ERROR c=0 r=0 +#MSG_SELFTEST_ERROR "Selftest error !" "Blad selftest !" -#MSG_SELFTEST_FAILED c=20 r=0 +#MSG_SELFTEST_FAILED c=20 "Selftest failed " "Selftest nieudany" @@ -974,7 +974,7 @@ "Set temperature:" "Ustaw. temperatury:" -#MSG_SETTINGS c=0 r=0 +#MSG_SETTINGS "Settings" "Ustawienia" @@ -1034,11 +1034,11 @@ "Sound [silent]" "Dzwiek [Cichy]" -#MSG_SPEED c=0 r=0 +#MSG_SPEED "Speed" "Predkosc" -#MSG_SELFTEST_FAN_YES c=19 r=0 +#MSG_SELFTEST_FAN_YES c=19 "Spinning" "Kreci sie" @@ -1046,23 +1046,23 @@ "Stable ambient temperature 21-26C is needed a rigid stand is required." "Potrzebna jest stabilna temperatura otoczenia 21-26C i stabilne podloze." -#MSG_STATISTICS c=0 r=0 +#MSG_STATISTICS "Statistics " "Statystyki" -#MSG_STOP_PRINT c=0 r=0 +#MSG_STOP_PRINT "Stop print" "Zatrzymac druk" -#MSG_STOPPED c=0 r=0 +#MSG_STOPPED "STOPPED. " "ZATRZYMANO." -#MSG_SUPPORT c=0 r=0 +#MSG_SUPPORT "Support" "Wsparcie" -#MSG_SELFTEST_SWAPPED c=0 r=0 +#MSG_SELFTEST_SWAPPED "Swapped" "Zamieniono" @@ -1090,7 +1090,7 @@ "Temperature calibration is finished and active. Temp. calibration can be disabled in menu Settings->Temp. cal." "Kalibracja temperaturowa zakonczona i wlaczona. Moze byc wylaczona z menu Ustawienia -> Kalibracja temp." -#MSG_TEMPERATURE c=0 r=0 +#MSG_TEMPERATURE "Temperature" "Temperatura" @@ -1110,7 +1110,7 @@ "Total print time" "Calkowity czas druku" -#MSG_TUNE c=0 r=0 +#MSG_TUNE "Tune" "Strojenie" @@ -1130,7 +1130,7 @@ "to unload filament" "aby rozlad. filament" -#MSG_UNLOAD_FILAMENT c=17 r=0 +#MSG_UNLOAD_FILAMENT c=17 "Unload filament" "Rozladowanie fil." @@ -1154,7 +1154,7 @@ "unknown" "nieznane" -#MSG_USERWAIT c=0 r=0 +#MSG_USERWAIT "Wait for user..." "Czekam na uzytkownika..." @@ -1186,7 +1186,7 @@ "Was filament unload successful?" "Rozladowanie fil. ok?" -#MSG_SELFTEST_WIRINGERROR c=0 r=0 +#MSG_SELFTEST_WIRINGERROR "Wiring error" "Blad polaczenia" @@ -1202,7 +1202,7 @@ "XYZ calibration failed. Please consult the manual." "Kalibracja XYZ nieudana. Sprawdz przyczyny i rozwiazania w instrukcji." -#MSG_YES c=0 r=0 +#MSG_YES "Yes" "Tak" @@ -1234,11 +1234,11 @@ "XYZ calibration compromised. Right front calibration point not reachable." "Kalibracja XYZ niedokladna. Prawy przedni punkt nieosiagalny." -#MSG_LOAD_ALL c=17 r=0 +#MSG_LOAD_ALL c=17 "Load all" "Zalad. wszystkie" -#MSG_LOAD_FILAMENT_1 c=17 r=0 +#MSG_LOAD_FILAMENT_1 c=17 "Load filament 1" "Zaladuj fil. 1" @@ -1250,7 +1250,7 @@ "XYZ calibration failed. Front calibration points not reachable." "Kalibr. XYZ nieudana. Przednie punkty kalibr. nieosiagalne. Nalezy poprawic montaz drukarki." -#MSG_LOAD_FILAMENT_2 c=17 r=0 +#MSG_LOAD_FILAMENT_2 c=17 "Load filament 2" "Zaladuj fil. 2" @@ -1258,7 +1258,7 @@ "XYZ calibration failed. Right front calibration point not reachable." "Kalibr. XYZ nieudana. Prawy przedni punkt nieosiagalny. Nalezy poprawic montaz drukarki." -#MSG_LOAD_FILAMENT_3 c=17 r=0 +#MSG_LOAD_FILAMENT_3 c=17 "Load filament 3" "Zaladuj fil. 3" @@ -1270,14 +1270,14 @@ "Y-correct" "Korekcja Y" -#MSG_LOAD_FILAMENT_4 c=17 r=0 +#MSG_LOAD_FILAMENT_4 c=17 "Load filament 4" "Zaladuj fil. 4" -#MSG_LOAD_FILAMENT_5 c=17 r=0 +#MSG_LOAD_FILAMENT_5 c=17 "Load filament 5" "Laduj filament 5" -#MSG_OFF c=0 r=0 +#MSG_OFF " [off]" "\x00" From 0ba2f3921679d021a075246b036b98c27f18b353 Mon Sep 17 00:00:00 2001 From: Ondrej Tuma Date: Tue, 7 May 2019 12:57:31 +0200 Subject: [PATCH 185/368] Check translation dictionary files to display definition --- lang/lang-build.sh | 2 ++ lang/lang-check.py | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 lang/lang-check.py diff --git a/lang/lang-build.sh b/lang/lang-build.sh index c8ad6ff4b..e528ff94d 100755 --- a/lang/lang-build.sh +++ b/lang/lang-build.sh @@ -81,6 +81,8 @@ generate_binary() rm -f lang_$1.tmp rm -f lang_$1.dat LNG=$1 + #check lang dictionary + /usr/bin/env python lang-check.py $1 #create lang_xx.tmp - different processing for 'en' language if [ "$1" = "en" ]; then #remove comments and empty lines diff --git a/lang/lang-check.py b/lang/lang-check.py new file mode 100644 index 000000000..6b918df81 --- /dev/null +++ b/lang/lang-check.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Check lang files.""" +from argparse import ArgumentParser +from traceback import print_exc +from sys import stderr + + +def parse_txt(lang, no_warning): + """Parse txt file and check strings to display definition.""" + if lang == "en": + file_path = "lang_en.txt" + else: + file_path = "lang_en_%s.txt" % lang + + lines = 1 + with open(file_path) as src: + while True: + comment = src.readline().split(' ') + src.readline() # source + translation = src.readline()[:-1] + + cols = None + rows = None + for item in comment[1:]: + key, val = item.split('=') + if key == 'c': + cols = int(val) + elif key == 'r': + rows = int(val) + else: + raise RuntimeError( + "Unknown display definition %s on line %d" % + (' '.join(comment), lines)) + if cols is None and rows is None: + if not no_warning: + print("[W]: No display definition on line %d" % lines) + cols = len(translation) # propably fullscreen + if rows is None: + rows = 1 + + if len(translation) > cols*rows: + stderr.write( + "[E]: Text %s is longer then definiton on line %d\n" % + (translation, lines)) + stderr.flush() + + if len(src.readline()) != 1: # empty line + break + lines += 4 + + +def main(): + """Main function.""" + parser = ArgumentParser( + description=__doc__, + usage="$(prog)s lang") + parser.add_argument( + "lang", nargs='?', default="en", type=str, + help="Check lang file (en|cs|de|es|fr|it)") + parser.add_argument( + "--no-warning", action="store_true", + help="Disable warnings") + + args = parser.parse_args() + try: + parse_txt(args.lang, args.no_warning) + return 0 + except Exception as exc: + print_exc() + parser.error("%s" % exc) + return 1 + + +if __name__ == "__main__": + exit(main()) From 85806a0f38d266932ff885b96e55f8636f4190f4 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 7 May 2019 15:35:34 +0200 Subject: [PATCH 186/368] variable bed pwm frequency fix (input value is 7bit, not 8bit) --- Firmware/Configuration.h | 2 +- Firmware/temperature.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index faf71f2d6..3cc7994a7 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -481,7 +481,7 @@ your extruder heater takes 2 minutes to hit the target on heating. #define FAN_SOFT_PWM_BITS 4 //PWM bit resolution = 4bits, freq = 62.5Hz // Bed soft pwm -#define HEATER_BED_SOFT_PWM_BITS 5 //PWM bit resolution = 5bits, freq = 32Hz +#define HEATER_BED_SOFT_PWM_BITS 5 //PWM bit resolution = 5bits, freq = 31.25Hz // Incrementing this by 1 will double the software PWM frequency, // affecting heaters, and the fan if FAN_SOFT_PWM is enabled. diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index ca885f441..ef15c66b5 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1697,7 +1697,7 @@ ISR(TIMER0_COMPB_vect) #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 if ((pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1)) == 0) { - soft_pwm_b = soft_pwm_bed / (1 << (8 - HEATER_BED_SOFT_PWM_BITS)); + soft_pwm_b = soft_pwm_bed >> (7 - HEATER_BED_SOFT_PWM_BITS); #ifndef SYSTEM_TIMER_2 if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); else WRITE(HEATER_BED_PIN,0); #endif //SYSTEM_TIMER_2 From 0124fbf9ee2a703bbd50b68e2fe0aab4c4c0ff1c Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 7 May 2019 16:15:42 +0200 Subject: [PATCH 187/368] Fix: display target extruder temperature on the main screen when doing PID calibration --- Firmware/temperature.cpp | 2 ++ Firmware/ultralcd.cpp | 2 ++ 2 files changed, 4 insertions(+) mode change 100644 => 100755 Firmware/temperature.cpp diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp old mode 100644 new mode 100755 index 45256bf42..bf99b526d --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -264,11 +264,13 @@ static void temp_runaway_stop(bool isPreheat, bool isBed); soft_pwm_bed = (MAX_BED_POWER)/2; timer02_set_pwm0(soft_pwm_bed << 1); bias = d = (MAX_BED_POWER)/2; + target_temperature_bed = (int)temp; // to display the requested target bed temperature properly on the main screen } else { soft_pwm[extruder] = (PID_MAX)/2; bias = d = (PID_MAX)/2; + target_temperature[extruder] = (int)temp; // to display the requested target extruder temperature properly on the main screen } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d099d9229..4754bc272 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1765,6 +1765,7 @@ void lcd_commands() if (lcd_commands_step == 3 && !blocks_queued()) { //PID calibration strcpy(cmd1, "M303 E0 S"); strcat(cmd1, ftostr3(pid_temp)); + // setting the correct target temperature (for visualization) is done in PID_autotune enquecommand(cmd1); lcd_setstatuspgm(_i("PID cal. "));////MSG_PID_RUNNING c=20 r=1 lcd_commands_step = 2; @@ -1773,6 +1774,7 @@ void lcd_commands() pid_tuning_finished = false; custom_message_state = 0; lcd_setstatuspgm(_i("PID cal. finished"));////MSG_PID_FINISHED c=20 r=1 + setTargetHotend(0, 0); // reset the target hotend temperature including the number displayed on the main screen if (_Kp != 0 || _Ki != 0 || _Kd != 0) { strcpy(cmd1, "M301 P"); strcat(cmd1, ftostr32(_Kp)); From e7dd5c60d33c6179f892e4e2b9568e23ef4b2ce7 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 7 May 2019 18:10:44 +0200 Subject: [PATCH 188/368] check if firmware is on right type of printer --- Firmware/Marlin_main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index e23ca37e8..1da02c504 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -865,6 +865,25 @@ void show_fw_version_warnings() { lcd_update_enable(true); } +//try to check if firmware is on right type of printer +void check_if_fw_is_on_right_printer(){ + #ifdef FILAMENT_SENSOR + swi2c_init(); + uint8_t pat9125_detected = swi2c_readByte_A8(PAT9125_I2C_ADDR,0x00,NULL); + uint8_t ir_detected = !(PIN_GET(IR_SENSOR_PIN)); //will return 1 only if IR can detect filament in bondtech extruder so this may fail even when we have IR sensor + + #ifdef IR_SENSOR + if (pat9125_detected){ + lcd_show_fullscreen_message_and_wait_P(_i("MK3S firmware detected on MK3 printer"));} + #endif + + #ifdef PAT9125 + if (ir_detected){ + lcd_show_fullscreen_message_and_wait_P(_i("MK3 firmware detected on MK3S printer"));} + #endif + #endif +} + uint8_t check_printer_version() { uint8_t version_changed = 0; @@ -1506,6 +1525,7 @@ void setup() #ifndef DEBUG_DISABLE_STARTMSGS KEEPALIVE_STATE(PAUSED_FOR_USER); + check_if_fw_is_on_right_printer(); show_fw_version_warnings(); switch (hw_changed) { From dc4f30530dc58abdbf318ad6a0b5e30968b857e3 Mon Sep 17 00:00:00 2001 From: DRracer Date: Thu, 9 May 2019 13:44:35 +0200 Subject: [PATCH 189/368] Fix a number overflow to last line of LCD when doing large extruder in menu Settings -> Move axis -> Extruder --- Firmware/menu.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index a07438389..6467cb412 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -270,7 +270,7 @@ const char menu_20x_space[] PROGMEM = " "; const char menu_fmt_int3[] PROGMEM = "%c%.15S:%s%3d"; -const char menu_fmt_float31[] PROGMEM = "%c%.12S:%s%+06.1f"; +const char menu_fmt_float31[] PROGMEM = "%-12.12s%+8.1f"; const char menu_fmt_float13[] PROGMEM = "%c%.12S:%s%+06.3f"; @@ -312,15 +312,28 @@ void menu_draw_P(char chr, const char* str, int16_t val) } } -//draw up to 12 chars of text, ':' and float number in format +123.0 +//! Draw up to 10 chars of text, ':' and float number in format from +0.0 to +12345.0. The increased range is necessary +//! for displaying large values of extruder positions, which caused text overflow in the previous implementation. +//! @param chr first character to print on the line +//! @param str string label to print, will be appended with ':' automatically inside the function +//! @param val value to print aligned to the right side of the display +//! +//! Implementation comments: +//! The text needs to be prerendered into the prerendered[] to enable left alignment of text str including the colon behind it. +//! If we didn't want the colon behind it, the whole operation would have been solved with a single vsprintf call, +//! but such line would look different compared to every other similar menu item +//! So it is almost the same amount of code like before, but with added string prerendering void menu_draw_float31(char chr, const char* str, float val) { - int text_len = strlen_P(str); - if (text_len > 12) text_len = 12; - char spaces[21]; - strcpy_P(spaces, menu_20x_space); - spaces[12 - text_len] = 0; - lcd_printf_P(menu_fmt_float31, chr, str, spaces, val); + uint8_t txtlen = strlen_P(str); + if( txtlen > 10 )txtlen = 10; + char prerendered[21]; + strcpy_P(prerendered, menu_20x_space); + prerendered[0] = chr; // start with the initial byte/space for menu navigation + strncpy_P(prerendered+1, str, 10); // render the text and limit it to max 10 characters + prerendered[txtlen+1] = ':'; // put the colon behind it + prerendered[txtlen+2] = 0; // terminate the string to be used inside the printf + lcd_printf_P(menu_fmt_float31, prerendered, val); } //draw up to 12 chars of text, ':' and float number in format +1.234 From 5707d4b85cc9476e13eae3c652a3f7219f88983f Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 10 May 2019 15:27:25 +0200 Subject: [PATCH 190/368] Set all target hot ends to 0 deg. Celsius instead of just hotend nr. 0 to be more safe with custom modifications. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3bdf54597..24c820237 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1774,7 +1774,7 @@ void lcd_commands() pid_tuning_finished = false; custom_message_state = 0; lcd_setstatuspgm(_i("PID cal. finished"));////MSG_PID_FINISHED c=20 r=1 - setTargetHotend(0, 0); // reset the target hotend temperature including the number displayed on the main screen + setAllTargetHotends(0); // reset all hotends temperature including the number displayed on the main screen if (_Kp != 0 || _Ki != 0 || _Kd != 0) { strcpy(cmd1, "M301 P"); strcat(cmd1, ftostr32(_Kp)); From a9d6ae296bf50c9eaec4f1809b54cca879751d73 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 10 May 2019 16:30:08 +0200 Subject: [PATCH 191/368] Enable watchdog for all variants. --- Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 3 +++ Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 2 ++ Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 3 +++ Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 3 +++ 4 files changed, 11 insertions(+) diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 3b9f76987..7021d1077 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -97,6 +97,9 @@ AXIS SETTINGS // New XYZ calibration //#define NEW_XYZCAL +// Watchdog support +#define WATCHDOG + /*------------------------------------ EXTRUDER SETTINGS diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 2d00929f3..b7a66903a 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -97,6 +97,8 @@ AXIS SETTINGS // New XYZ calibration //#define NEW_XYZCAL +// Watchdog support +#define WATCHDOG /*------------------------------------ EXTRUDER SETTINGS diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index a1822970c..a0f53fad2 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -103,6 +103,9 @@ // New XYZ calibration #define NEW_XYZCAL +// Watchdog support +#define WATCHDOG + // Fan check #define FANCHECK diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 92773807c..5946bc801 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -104,6 +104,9 @@ // New XYZ calibration #define NEW_XYZCAL +// Watchdog support +#define WATCHDOG + // Fan check #define FANCHECK From e93f043feefc389c9fa8cbd214b51efd79dfdb62 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 13 May 2019 15:09:58 +0200 Subject: [PATCH 192/368] Increase version 3.7.1 final. --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 3cc7994a7..bfa44a735 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.7.0" -#define FW_COMMIT_NR 2201 +#define FW_VERSION "3.7.1" +#define FW_COMMIT_NR 2266 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From 7c4f66181fa5c7e6277edfd684a333ef256611b0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 15:47:25 +0200 Subject: [PATCH 193/368] Generate menu item texts Load filament and Eject filament during runtime to conserve flash. --- Firmware/menu.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- Firmware/menu.h | 3 +++ Firmware/messages.c | 3 ++- Firmware/messages.h | 1 + Firmware/mmu.cpp | 2 +- Firmware/ultralcd.cpp | 40 ++++++++++++++++------------------------ lang/lang_en.txt | 30 ------------------------------ lang/lang_en_cz.txt | 40 ---------------------------------------- lang/lang_en_de.txt | 39 --------------------------------------- lang/lang_en_es.txt | 40 ---------------------------------------- lang/lang_en_fr.txt | 40 ---------------------------------------- lang/lang_en_it.txt | 40 ---------------------------------------- lang/lang_en_pl.txt | 40 ---------------------------------------- 13 files changed, 62 insertions(+), 298 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 6467cb412..e84043540 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -168,11 +168,19 @@ int menu_draw_item_printf_P(char type_char, const char* format, ...) } */ -static int menu_draw_item_puts_P(char type_char, const char* str) +static void menu_draw_item_puts_P(char type_char, const char* str) { lcd_set_cursor(0, menu_row); - int cnt = lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); - return cnt; + lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); +} + +static int menu_draw_item_puts_P(char type_char, const char* str, char num) +{ + lcd_set_cursor(0, menu_row); + lcd_printf_P(PSTR("%c%-.16S "), (lcd_encoder == menu_item)?'>':' ', str); + lcd_putc(num); + lcd_set_cursor(19, menu_row); + lcd_putc(type_char); } /* @@ -250,6 +258,34 @@ uint8_t menu_item_function_P(const char* str, menu_func_t func) return 0; } +//! @brief Menu item function taking single parameter +//! +//! Ideal for numbered lists calling functions with number parameter. +//! @param str Item caption +//! @param number aditional character to be added after str, e.g. number +//! @param func pointer to function taking uint8_t with no return value +//! @param fn_par value to be passed to function +//! @retval 0 +//! @retval 1 Item was clicked +uint8_t menu_item_function_P(const char* str, char number, void (*func)(uint8_t), uint8_t fn_par) +{ + if (menu_item == menu_line) + { + if (lcd_draw_update) menu_draw_item_puts_P(' ', str, number); + if (menu_clicked && (lcd_encoder == menu_item)) + { + menu_clicked = false; + lcd_consume_click(); + lcd_update_enabled = 0; + if (func) func(fn_par); + lcd_update_enabled = 1; + return menu_item_ret(); + } + } + menu_item++; + return 0; +} + uint8_t menu_item_gcode_P(const char* str, const char* str_gcode) { if (menu_item == menu_line) diff --git a/Firmware/menu.h b/Firmware/menu.h index 667f86752..7ddfe3f24 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -87,6 +87,9 @@ extern uint8_t menu_item_back_P(const char* str); #define MENU_ITEM_FUNCTION_P(str, func) do { if (menu_item_function_P(str, func)) return; } while (0) extern uint8_t menu_item_function_P(const char* str, menu_func_t func); +#define MENU_ITEM_FUNCTION_NR_P(str, number, func, fn_par) do { if (menu_item_function_P(str, number, func, fn_par)) return; } while (0) +extern uint8_t menu_item_function_P(const char* str, char number, void (*func)(uint8_t), uint8_t fn_par); + #define MENU_ITEM_GCODE_P(str, str_gcode) do { if (menu_item_gcode_P(str, str_gcode)) return; } while (0) extern uint8_t menu_item_gcode_P(const char* str, const char* str_gcode); diff --git a/Firmware/messages.c b/Firmware/messages.c index e4a24ce18..d5a10b483 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -48,8 +48,9 @@ const char MSG_HEATING_COMPLETE[] PROGMEM_I1 = ISTR("Heating done."); ////c=20 const char MSG_HOMEYZ[] PROGMEM_I1 = ISTR("Calibrate Z"); //// const char MSG_CHOOSE_EXTRUDER[] PROGMEM_I1 = ISTR("Choose extruder:"); ////c=20 r=1 const char MSG_CHOOSE_FILAMENT[] PROGMEM_I1 = ISTR("Choose filament:"); ////c=20 r=1 -const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); ////c=17 +const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); //// Number 1 to 5 is added behind text e.g. "Load filament 1" c=16 const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////c=20 +const char MSG_EJECT_FILAMENT[] PROGMEM_I1 = ISTR("Eject filament"); //// Number 1 to 5 is added behind text e.g. "Eject filament 1" c=16 const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1 const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); //// const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); //// diff --git a/Firmware/messages.h b/Firmware/messages.h index 752195e96..dd6062bec 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -125,6 +125,7 @@ extern const char MSG_ENDSTOP_OPEN[]; extern const char MSG_POWERUP[]; extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; +extern const char MSG_EJECT_FILAMENT[]; #if defined(__cplusplus) } diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index ef5b021c9..79bcb1b46 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1353,7 +1353,7 @@ void mmu_show_warning() void lcd_mmu_load_to_nozzle(uint8_t filament_nr) { -//-// +menu_back(); bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()" if (degHotend0() > EXTRUDE_MINTEMP) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a82c347c5..8f9e705f6 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5923,35 +5923,28 @@ static void fil_load_menu() MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_P(_i("Load all"), load_all);////MSG_LOAD_ALL c=17 - MENU_ITEM_FUNCTION_P(_i("Load filament 1"), extr_adj_0);////MSG_LOAD_FILAMENT_1 c=17 - MENU_ITEM_FUNCTION_P(_i("Load filament 2"), extr_adj_1);////MSG_LOAD_FILAMENT_2 c=17 - MENU_ITEM_FUNCTION_P(_i("Load filament 3"), extr_adj_2);////MSG_LOAD_FILAMENT_3 c=17 - MENU_ITEM_FUNCTION_P(_i("Load filament 4"), extr_adj_3);////MSG_LOAD_FILAMENT_4 c=17 + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', extr_adj, 0);////MSG_LOAD_FILAMENT_1 c=16 + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '2', extr_adj, 1);////MSG_LOAD_FILAMENT_2 c=17 + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '3', extr_adj, 2);////MSG_LOAD_FILAMENT_3 c=17 + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '4', extr_adj, 3);////MSG_LOAD_FILAMENT_4 c=17 if (mmu_enabled) - MENU_ITEM_FUNCTION_P(_i("Load filament 5"), extr_adj_4); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', extr_adj, 3); MENU_END(); } -template -static void mmu_load_to_nozzle() -{ - menu_back(); - lcd_mmu_load_to_nozzle(filament); -} - static void mmu_load_to_nozzle_menu() { if(bFilamentAction) { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle<0>); - MENU_ITEM_FUNCTION_P(_i("Load filament 2"), mmu_load_to_nozzle<1>); - MENU_ITEM_FUNCTION_P(_i("Load filament 3"), mmu_load_to_nozzle<2>); - MENU_ITEM_FUNCTION_P(_i("Load filament 4"), mmu_load_to_nozzle<3>); - MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle<4>); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', lcd_mmu_load_to_nozzle, 0); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '2', lcd_mmu_load_to_nozzle, 1); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '3', lcd_mmu_load_to_nozzle, 2); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '4', lcd_mmu_load_to_nozzle, 3); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', lcd_mmu_load_to_nozzle, 4); MENU_END(); } else { @@ -5966,8 +5959,7 @@ else { } } -template -static void mmu_eject_filament() +static void mmu_eject_filament(uint8_t filament) { menu_back(); mmu_eject_filament(filament, true); @@ -5979,11 +5971,11 @@ static void mmu_fil_eject_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_P(_i("Eject filament 1"), mmu_eject_filament<0>); - MENU_ITEM_FUNCTION_P(_i("Eject filament 2"), mmu_eject_filament<1>); - MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_filament<2>); - MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_filament<3>); - MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_filament<4>); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '1', mmu_eject_filament, 0); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '2', mmu_eject_filament, 1); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '3', mmu_eject_filament, 2); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '4', mmu_eject_filament, 3); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '5', mmu_eject_filament, 4); MENU_END(); } else diff --git a/lang/lang_en.txt b/lang/lang_en.txt index dedc258d6..3de507cb9 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -166,21 +166,6 @@ #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" -#MSG_EJECT_FILAMENT1 c=17 r=1 -"Eject filament 1" - -#MSG_EJECT_FILAMENT2 c=17 r=1 -"Eject filament 2" - -#MSG_EJECT_FILAMENT3 c=17 r=1 -"Eject filament 3" - -#MSG_EJECT_FILAMENT4 c=17 r=1 -"Eject filament 4" - -#MSG_EJECT_FILAMENT5 c=17 r=1 -"Eject filament 5" - # "Eject" @@ -928,35 +913,20 @@ #MSG_LOAD_ALL c=17 "Load all" -#MSG_LOAD_FILAMENT_1 c=17 -"Load filament 1" - # "XYZ calibration failed. Bed calibration point was not found." # "XYZ calibration failed. Front calibration points not reachable." -#MSG_LOAD_FILAMENT_2 c=17 -"Load filament 2" - # "XYZ calibration failed. Right front calibration point not reachable." -#MSG_LOAD_FILAMENT_3 c=17 -"Load filament 3" - # "Y distance from min" # "Y-correct" -#MSG_LOAD_FILAMENT_4 c=17 -"Load filament 4" - -#MSG_LOAD_FILAMENT_5 c=17 -"Load filament 5" - #MSG_OFF " [off]" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 51d16f56c..9db15b026 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -222,26 +222,6 @@ "Eject filament" "Vysunout filament" -#MSG_EJECT_FILAMENT1 c=17 r=1 -"Eject filament 1" -"Vysunout filament 1" - -#MSG_EJECT_FILAMENT2 c=17 r=1 -"Eject filament 2" -"Vysunout filament 2" - -#MSG_EJECT_FILAMENT3 c=17 r=1 -"Eject filament 3" -"Vysunout filament 3" - -#MSG_EJECT_FILAMENT4 c=17 r=1 -"Eject filament 4" -"Vysunout filament 4" - -#MSG_EJECT_FILAMENT5 c=17 r=1 -"Eject filament 5" -"Vysunout filament 5" - # "Eject" "Vysunout" @@ -1238,10 +1218,6 @@ "Load all" "Zavest vse" -#MSG_LOAD_FILAMENT_1 c=17 -"Load filament 1" -"Zavest filament 1" - # "XYZ calibration failed. Bed calibration point was not found." "Kalibrace XYZ selhala. Kalibracni bod podlozky nenalezen." @@ -1250,18 +1226,10 @@ "XYZ calibration failed. Front calibration points not reachable." "Kalibrace XYZ selhala. Predni kalibracni body moc vpredu. Srovnejte tiskarnu." -#MSG_LOAD_FILAMENT_2 c=17 -"Load filament 2" -"Zavest filament 2" - # "XYZ calibration failed. Right front calibration point not reachable." "Kalibrace XYZ selhala. Pravy predni bod moc vpredu. Srovnejte tiskarnu." -#MSG_LOAD_FILAMENT_3 c=17 -"Load filament 3" -"Zavest filament 3" - # "Y distance from min" "Y vzdalenost od min" @@ -1270,14 +1238,6 @@ "Y-correct" "Korekce Y" -#MSG_LOAD_FILAMENT_4 c=17 -"Load filament 4" -"Zavest filament 4" - -#MSG_LOAD_FILAMENT_5 c=17 -"Load filament 5" -"Zavest filament 5" - #MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 48da055ff..66995f4e4 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -222,26 +222,6 @@ "Eject filament" "Filamentauswurf" -#MSG_EJECT_FILAMENT1 c=17 r=1 -"Eject filament 1" -"Filamentauswurf 1" - -#MSG_EJECT_FILAMENT2 c=17 r=1 -"Eject filament 2" -"Fil.2 auswerfen" - -#MSG_EJECT_FILAMENT3 c=17 r=1 -"Eject filament 3" -"Fil.3 auswerfen" - -#MSG_EJECT_FILAMENT4 c=17 r=1 -"Eject filament 4" -"Fil.4 auswerfen" - -#MSG_EJECT_FILAMENT5 c=17 r=1 -"Eject filament 5" -"Fil.5 auswerfen" - # "Eject" "Auswurf" @@ -1238,10 +1218,6 @@ "Load all" "Alle laden" -#MSG_LOAD_FILAMENT_1 c=17 -"Load filament 1" -"Filament 1 laden" - # "XYZ calibration failed. Bed calibration point was not found." "XYZ-Kalibrierung fehlgeschlagen. Bett-Kalibrierpunkt nicht gefunden." @@ -1250,17 +1226,10 @@ "XYZ calibration failed. Front calibration points not reachable." "XYZ-Kalibrierung fehlgeschlagen. Vordere Kalibrierpunkte nicht erreichbar." -#MSG_LOAD_FILAMENT_2 c=17 -"Load filament 2" -"Filament 2 laden" - # "XYZ calibration failed. Right front calibration point not reachable." "XYZ-Kalibrierung fehlgeschlagen. Rechter vorderer Kalibrierpunkt ist nicht erreichbar." -#MSG_LOAD_FILAMENT_3 c=17 -"Load filament 3" -"Filament 3 laden" # "Y distance from min" @@ -1270,14 +1239,6 @@ "Y-correct" "Y-Korrektur" -#MSG_LOAD_FILAMENT_4 c=17 -"Load filament 4" -"Filament 4 laden" - -#MSG_LOAD_FILAMENT_5 c=17 -"Load filament 5" -"Filament 5 laden" - #MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 3d8b17dc8..05757313c 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -222,26 +222,6 @@ "Eject filament" "Expulsar filamento" -#MSG_EJECT_FILAMENT1 c=17 r=1 -"Eject filament 1" -"Expulsar filamento 1" - -#MSG_EJECT_FILAMENT2 c=17 r=1 -"Eject filament 2" -"Expulsar filamento 2" - -#MSG_EJECT_FILAMENT3 c=17 r=1 -"Eject filament 3" -"Expulsar filamento 3" - -#MSG_EJECT_FILAMENT4 c=17 r=1 -"Eject filament 4" -"Expulsar filamento 4" - -#MSG_EJECT_FILAMENT5 c=17 r=1 -"Eject filament 5" -"Expulsar filamento 5" - # "Eject" "Expulsar" @@ -1238,10 +1218,6 @@ "Load all" "Intr. todos fil." -#MSG_LOAD_FILAMENT_1 c=17 -"Load filament 1" -"Introducir fil. 1" - # "XYZ calibration failed. Bed calibration point was not found." "Calibracion XYZ fallada. Puntos de calibracion en la base no encontrados." @@ -1250,18 +1226,10 @@ "XYZ calibration failed. Front calibration points not reachable." "Calibracion XYZ fallada. Puntos frontales no alcanzables." -#MSG_LOAD_FILAMENT_2 c=17 -"Load filament 2" -"Introducir fil. 2" - # "XYZ calibration failed. Right front calibration point not reachable." "Calibracion XYZ fallad. Punto frontal derecho no alcanzable." -#MSG_LOAD_FILAMENT_3 c=17 -"Load filament 3" -"Introducir fil. 3" - # "Y distance from min" "Distancia en Y desde el min" @@ -1270,14 +1238,6 @@ "Y-correct" "Y-correcion" -#MSG_LOAD_FILAMENT_4 c=17 -"Load filament 4" -"Introducir fil. 4" - -#MSG_LOAD_FILAMENT_5 c=17 -"Load filament 5" -"Cargar filamento 5" - #MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 7e91c029a..9dd3d489f 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -222,26 +222,6 @@ "Eject filament" "Ejecter le fil." -#MSG_EJECT_FILAMENT1 c=17 r=1 -"Eject filament 1" -"Ejecter fil. 1" - -#MSG_EJECT_FILAMENT2 c=17 r=1 -"Eject filament 2" -"Ejecter fil. 2" - -#MSG_EJECT_FILAMENT3 c=17 r=1 -"Eject filament 3" -"Ejecter fil. 3" - -#MSG_EJECT_FILAMENT4 c=17 r=1 -"Eject filament 4" -"Ejecter fil. 4" - -#MSG_EJECT_FILAMENT5 c=17 r=1 -"Eject filament 5" -"Ejecter fil. 5" - # "Eject" "Ejecter" @@ -1238,10 +1218,6 @@ "Load all" "Tout charger" -#MSG_LOAD_FILAMENT_1 c=17 -"Load filament 1" -"Charger fil. 1" - # "XYZ calibration failed. Bed calibration point was not found." "Echec calibration XYZ. Le point de calibration du plateau n'a pas ete trouve." @@ -1250,18 +1226,10 @@ "XYZ calibration failed. Front calibration points not reachable." "Echec calibration XYZ. Les points de calibration avant ne sont pas atteignables." -#MSG_LOAD_FILAMENT_2 c=17 -"Load filament 2" -"Charger fil. 2" - # "XYZ calibration failed. Right front calibration point not reachable." "Echec calibration XYZ. Le point de calibration avant droit n'est pas atteignable." -#MSG_LOAD_FILAMENT_3 c=17 -"Load filament 3" -"Charger fil. 3" - # "Y distance from min" "Distance Y du min" @@ -1270,14 +1238,6 @@ "Y-correct" "Correction-Y" -#MSG_LOAD_FILAMENT_4 c=17 -"Load filament 4" -"Charger fil. 4" - -#MSG_LOAD_FILAMENT_5 c=17 -"Load filament 5" -"Charger fil. 5" - #MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 12a12fa91..45bddac73 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -222,26 +222,6 @@ "Eject filament" "Espelli filamento " -#MSG_EJECT_FILAMENT1 c=17 r=1 -"Eject filament 1" -"Espelli filamento 1" - -#MSG_EJECT_FILAMENT2 c=17 r=1 -"Eject filament 2" -"Espellere filamento 2" - -#MSG_EJECT_FILAMENT3 c=17 r=1 -"Eject filament 3" -"Espelli filamento 3" - -#MSG_EJECT_FILAMENT4 c=17 r=1 -"Eject filament 4" -"Espellere filamento 4" - -#MSG_EJECT_FILAMENT5 c=17 r=1 -"Eject filament 5" -"Espelli filamento 5" - # "Eject" "Espellere" @@ -1238,10 +1218,6 @@ "Load all" "Caricare tutti" -#MSG_LOAD_FILAMENT_1 c=17 -"Load filament 1" -"Caricare fil. 1" - # "XYZ calibration failed. Bed calibration point was not found." "Calibrazione XYZ fallita. Il punto di calibrazione sul letto non e' stato trovato." @@ -1250,18 +1226,10 @@ "XYZ calibration failed. Front calibration points not reachable." "Calibrazione XYZ fallita. Punti anteriori non raggiungibili." -#MSG_LOAD_FILAMENT_2 c=17 -"Load filament 2" -"Caricare fil. 2" - # "XYZ calibration failed. Right front calibration point not reachable." "Calibrazione XYZ fallita. Punto anteriore destro non raggiungibile." -#MSG_LOAD_FILAMENT_3 c=17 -"Load filament 3" -"Carica fil. 3" - # "Y distance from min" "Distanza Y dal min" @@ -1270,14 +1238,6 @@ "Y-correct" "Correzione-Y" -#MSG_LOAD_FILAMENT_4 c=17 -"Load filament 4" -"Caricare fil. 4" - -#MSG_LOAD_FILAMENT_5 c=17 -"Load filament 5" -"Caricare fil. 5" - #MSG_OFF " [off]" "\x00" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index bdac8819e..d0937dd86 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -222,26 +222,6 @@ "Eject filament" "Wysun filament" -#MSG_EJECT_FILAMENT1 c=17 r=1 -"Eject filament 1" -"Wysun filament 1" - -#MSG_EJECT_FILAMENT2 c=17 r=1 -"Eject filament 2" -"Wysun filament 2" - -#MSG_EJECT_FILAMENT3 c=17 r=1 -"Eject filament 3" -"Wysun filament 3" - -#MSG_EJECT_FILAMENT4 c=17 r=1 -"Eject filament 4" -"Wysun filament 4" - -#MSG_EJECT_FILAMENT5 c=17 r=1 -"Eject filament 5" -"Wysun filament 5" - # "Eject" "Wysun" @@ -1238,10 +1218,6 @@ "Load all" "Zalad. wszystkie" -#MSG_LOAD_FILAMENT_1 c=17 -"Load filament 1" -"Zaladuj fil. 1" - # "XYZ calibration failed. Bed calibration point was not found." "Kalibracja XYZ nieudana. Nie znaleziono punktow kalibracyjnych." @@ -1250,18 +1226,10 @@ "XYZ calibration failed. Front calibration points not reachable." "Kalibr. XYZ nieudana. Przednie punkty kalibr. nieosiagalne. Nalezy poprawic montaz drukarki." -#MSG_LOAD_FILAMENT_2 c=17 -"Load filament 2" -"Zaladuj fil. 2" - # "XYZ calibration failed. Right front calibration point not reachable." "Kalibr. XYZ nieudana. Prawy przedni punkt nieosiagalny. Nalezy poprawic montaz drukarki." -#MSG_LOAD_FILAMENT_3 c=17 -"Load filament 3" -"Zaladuj fil. 3" - # "Y distance from min" "Dystans od 0 w osi Y" @@ -1270,14 +1238,6 @@ "Y-correct" "Korekcja Y" -#MSG_LOAD_FILAMENT_4 c=17 -"Load filament 4" -"Zaladuj fil. 4" - -#MSG_LOAD_FILAMENT_5 c=17 -"Load filament 5" -"Laduj filament 5" - #MSG_OFF " [off]" "\x00" From 6495a8fa5874f4166c505c93e47032275115954b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 16:10:04 +0200 Subject: [PATCH 194/368] Decrease flash reserved for secondary language. --- Firmware/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/config.h b/Firmware/config.h index faf4b7b0e..a712839b7 100644 --- a/Firmware/config.h +++ b/Firmware/config.h @@ -49,7 +49,7 @@ //#define LANG_MODE 0 // primary language only #define LANG_MODE 1 // sec. language support -#define LANG_SIZE_RESERVED 0x2900 // reserved space for secondary language (10496 bytes) +#define LANG_SIZE_RESERVED 0x2800 // reserved space for secondary language (10240 bytes) #endif //_CONFIG_H From 150787efbd7b0f470425521b272efd1bce1d5aca Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 16:25:29 +0200 Subject: [PATCH 195/368] Generate menu item texts Cut filament during runtime to conserve flash. --- Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/mmu.cpp | 1 + Firmware/ultralcd.cpp | 16 +++++----------- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index d5a10b483..53ec20e86 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -51,6 +51,7 @@ const char MSG_CHOOSE_FILAMENT[] PROGMEM_I1 = ISTR("Choose filament:"); ////c=20 const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); //// Number 1 to 5 is added behind text e.g. "Load filament 1" c=16 const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////c=20 const char MSG_EJECT_FILAMENT[] PROGMEM_I1 = ISTR("Eject filament"); //// Number 1 to 5 is added behind text e.g. "Eject filament 1" c=16 +const char MSG_CUT_FILAMENT[] PROGMEM_I1 = ISTR("Cut filament"); //// Number 1 to 5 is added behind text e.g. "Cut filament 1" c=16 const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1 const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); //// const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); //// diff --git a/Firmware/messages.h b/Firmware/messages.h index dd6062bec..d74412fca 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -126,6 +126,7 @@ extern const char MSG_POWERUP[]; extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; +extern const char MSG_CUT_FILAMENT[]; #if defined(__cplusplus) } diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 79bcb1b46..68e36cbc1 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1387,6 +1387,7 @@ bFilamentAction=false; // NOT in "mmu_load_to_nozzle_ #ifdef MMU_HAS_CUTTER void mmu_cut_filament(uint8_t filament_nr) { + menu_back(); bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()" if (degHotend0() > EXTRUDE_MINTEMP) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8f9e705f6..632a77988 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5992,12 +5992,6 @@ static void mmu_fil_eject_menu() } #ifdef MMU_HAS_CUTTER -template -static void mmu_cut_filament() -{ - menu_back(); - mmu_cut_filament(filament); -} static void mmu_cut_filament_menu() { @@ -6005,11 +5999,11 @@ if(bFilamentAction) { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_P(_i("Cut filament 1"), mmu_cut_filament<0>); - MENU_ITEM_FUNCTION_P(_i("Cut filament 2"), mmu_cut_filament<1>); - MENU_ITEM_FUNCTION_P(_i("Cut filament 3"), mmu_cut_filament<2>); - MENU_ITEM_FUNCTION_P(_i("Cut filament 4"), mmu_cut_filament<3>); - MENU_ITEM_FUNCTION_P(_i("Cut filament 5"), mmu_cut_filament<4>); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 1, mmu_cut_filament, 0); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 2, mmu_cut_filament, 1); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 3, mmu_cut_filament, 2); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 4, mmu_cut_filament, 3); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 5, mmu_cut_filament, 4); MENU_END(); } else { From 4de93ca19ce5afd83f3cd3c0d224d56791338390 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 16:43:33 +0200 Subject: [PATCH 196/368] Fix eject filament menu items numbering. --- Firmware/ultralcd.cpp | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 632a77988..d793c7ee6 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5920,43 +5920,43 @@ static void lcd_disable_farm_mode() static void fil_load_menu() { - MENU_BEGIN(); - MENU_ITEM_BACK_P(_T(MSG_MAIN)); + MENU_BEGIN(); + MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_P(_i("Load all"), load_all);////MSG_LOAD_ALL c=17 MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', extr_adj, 0);////MSG_LOAD_FILAMENT_1 c=16 MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '2', extr_adj, 1);////MSG_LOAD_FILAMENT_2 c=17 MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '3', extr_adj, 2);////MSG_LOAD_FILAMENT_3 c=17 MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '4', extr_adj, 3);////MSG_LOAD_FILAMENT_4 c=17 - if (mmu_enabled) - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', extr_adj, 3); + if (mmu_enabled) + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', extr_adj, 3); - MENU_END(); + MENU_END(); } static void mmu_load_to_nozzle_menu() { if(bFilamentAction) { - MENU_BEGIN(); - MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', lcd_mmu_load_to_nozzle, 0); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '2', lcd_mmu_load_to_nozzle, 1); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '3', lcd_mmu_load_to_nozzle, 2); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '4', lcd_mmu_load_to_nozzle, 3); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', lcd_mmu_load_to_nozzle, 4); - MENU_END(); + MENU_BEGIN(); + MENU_ITEM_BACK_P(_T(MSG_MAIN)); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', lcd_mmu_load_to_nozzle, 0); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '2', lcd_mmu_load_to_nozzle, 1); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '3', lcd_mmu_load_to_nozzle, 2); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '4', lcd_mmu_load_to_nozzle, 3); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', lcd_mmu_load_to_nozzle, 4); + MENU_END(); } else { eFilamentAction=e_FILAMENT_ACTION_mmuLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) - { + { bFilamentPreheatState=true; mFilamentItem(target_temperature[0],target_temperature_bed); - } - else mFilamentMenu(); - } + } + else mFilamentMenu(); + } } static void mmu_eject_filament(uint8_t filament) @@ -5997,25 +5997,25 @@ static void mmu_cut_filament_menu() { if(bFilamentAction) { - MENU_BEGIN(); - MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 1, mmu_cut_filament, 0); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 2, mmu_cut_filament, 1); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 3, mmu_cut_filament, 2); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 4, mmu_cut_filament, 3); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 5, mmu_cut_filament, 4); - MENU_END(); + MENU_BEGIN(); + MENU_ITEM_BACK_P(_T(MSG_MAIN)); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '1', mmu_cut_filament, 0); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '2', mmu_cut_filament, 1); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '3', mmu_cut_filament, 2); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '4', mmu_cut_filament, 3); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '5', mmu_cut_filament, 4); + MENU_END(); } else { - eFilamentAction=e_FILAMENT_ACTION_mmuCut; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) - { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); - } - else mFilamentMenu(); - } + eFilamentAction=e_FILAMENT_ACTION_mmuCut; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0],target_temperature_bed); + } + else mFilamentMenu(); + } } #endif //MMU_HAS_CUTTER From 66d20f0297112066a1eff074d311208d2bf99509 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 16:45:15 +0200 Subject: [PATCH 197/368] Fix code formatting (indentation). --- Firmware/mmu.cpp | 59 ++++++++++++++++++++++--------------------- Firmware/ultralcd.cpp | 53 ++++++++++++++++++++------------------ 2 files changed, 58 insertions(+), 54 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 68e36cbc1..783564329 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1353,35 +1353,36 @@ void mmu_show_warning() void lcd_mmu_load_to_nozzle(uint8_t filament_nr) { -menu_back(); -bFilamentAction=false; // NOT in "mmu_load_to_nozzle_menu()" - if (degHotend0() > EXTRUDE_MINTEMP) - { - tmp_extruder = filament_nr; - lcd_update_enable(false); - lcd_clear(); - lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT)); - lcd_print(" "); - lcd_print(tmp_extruder + 1); - mmu_command(MmuCmd::T0 + tmp_extruder); - manage_response(true, true, MMU_TCODE_MOVE); - mmu_continue_loading(false); - mmu_extruder = tmp_extruder; //filament change is finished - mmu_load_to_nozzle(); - load_filament_final_feed(); - st_synchronize(); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; - lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); - lcd_return_to_status(); - lcd_update_enable(true); - lcd_load_filament_color_check(); - lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; - } - else - { - show_preheat_nozzle_warning(); - } + menu_back(); + bFilamentAction = false; // NOT in "mmu_load_to_nozzle_menu()" + if (degHotend0() > EXTRUDE_MINTEMP) + { + tmp_extruder = filament_nr; + lcd_update_enable(false); + lcd_clear(); + lcd_set_cursor(0, 1); + lcd_puts_P(_T(MSG_LOADING_FILAMENT)); + lcd_print(" "); + lcd_print(tmp_extruder + 1); + mmu_command(MmuCmd::T0 + tmp_extruder); + manage_response(true, true, MMU_TCODE_MOVE); + mmu_continue_loading(false); + mmu_extruder = tmp_extruder; //filament change is finished + mmu_load_to_nozzle(); + load_filament_final_feed(); + st_synchronize(); + custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); + lcd_return_to_status(); + lcd_update_enable(true); + lcd_load_filament_color_check(); + lcd_setstatuspgm(_T(WELCOME_MSG)); + custom_message_type = CUSTOM_MSG_TYPE_STATUS; + } + else + { + show_preheat_nozzle_warning(); + } } #ifdef MMU_HAS_CUTTER diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d793c7ee6..5fc74c389 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5922,22 +5922,23 @@ static void fil_load_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_P(_i("Load all"), load_all);////MSG_LOAD_ALL c=17 - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', extr_adj, 0);////MSG_LOAD_FILAMENT_1 c=16 - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '2', extr_adj, 1);////MSG_LOAD_FILAMENT_2 c=17 - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '3', extr_adj, 2);////MSG_LOAD_FILAMENT_3 c=17 - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '4', extr_adj, 3);////MSG_LOAD_FILAMENT_4 c=17 + MENU_ITEM_FUNCTION_P(_i("Load all"), load_all); ////MSG_LOAD_ALL c=17 + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', extr_adj, 0); ////MSG_LOAD_FILAMENT_1 c=16 + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '2', extr_adj, 1); ////MSG_LOAD_FILAMENT_2 c=17 + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '3', extr_adj, 2); ////MSG_LOAD_FILAMENT_3 c=17 + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '4', extr_adj, 3); ////MSG_LOAD_FILAMENT_4 c=17 if (mmu_enabled) + { MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', extr_adj, 3); - + } MENU_END(); } static void mmu_load_to_nozzle_menu() { -if(bFilamentAction) -{ + if (bFilamentAction) + { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', lcd_mmu_load_to_nozzle, 0); @@ -5946,14 +5947,15 @@ if(bFilamentAction) MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '4', lcd_mmu_load_to_nozzle, 3); MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', lcd_mmu_load_to_nozzle, 4); MENU_END(); -} -else { - eFilamentAction=e_FILAMENT_ACTION_mmuLoad; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) + } + else { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); + eFilamentAction = e_FILAMENT_ACTION_mmuLoad; + bFilamentFirstRun = false; + if (target_temperature[0] >= EXTRUDE_MINTEMP) + { + bFilamentPreheatState = true; + mFilamentItem(target_temperature[0], target_temperature_bed); } else mFilamentMenu(); } @@ -5967,7 +5969,7 @@ static void mmu_eject_filament(uint8_t filament) static void mmu_fil_eject_menu() { - if(bFilamentAction) + if (bFilamentAction) { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); @@ -5980,12 +5982,12 @@ static void mmu_fil_eject_menu() } else { - eFilamentAction=e_FILAMENT_ACTION_mmuEject; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) + eFilamentAction = e_FILAMENT_ACTION_mmuEject; + bFilamentFirstRun = false; + if (target_temperature[0] >= EXTRUDE_MINTEMP) { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); + bFilamentPreheatState = true; + mFilamentItem(target_temperature[0], target_temperature_bed); } else mFilamentMenu(); } @@ -5995,8 +5997,8 @@ static void mmu_fil_eject_menu() static void mmu_cut_filament_menu() { -if(bFilamentAction) -{ + if(bFilamentAction) + { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '1', mmu_cut_filament, 0); @@ -6005,8 +6007,9 @@ if(bFilamentAction) MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '4', mmu_cut_filament, 3); MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '5', mmu_cut_filament, 4); MENU_END(); -} -else { + } + else + { eFilamentAction=e_FILAMENT_ACTION_mmuCut; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) From ec1a979656ba7780a912a9601529881c57f9bb26 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 18:16:53 +0200 Subject: [PATCH 198/368] Enable compiler warnings. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 3f81cd788..12005a247 100755 --- a/build.sh +++ b/build.sh @@ -31,7 +31,7 @@ if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then cp $SCRIPT_PATH/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 8 fi -$BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH || exit 9 +$BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH --pref compiler.warning_level=all || exit 9 export ARDUINO=$BUILD_ENV_PATH From 89fc9e7f924d8c2a899d4ad876a3bbc48ce3686a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 18:25:43 +0200 Subject: [PATCH 199/368] sketch/menu.h:90:115: warning: invalid conversion from 'void (*)(int)' to 'void (*)(uint8_t) {aka void (*)(unsigned char)}' [-fpermissive] #define MENU_ITEM_FUNCTION_NR_P(str, number, func, fn_par) do { if (menu_item_function_P(str, number, func, fn_par)) return; } while (0) ^ sketch/ultralcd.cpp:5926:5: note: in expansion of macro 'MENU_ITEM_FUNCTION_NR_P' MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '1', extr_adj, 0); ////MSG_LOAD_FILAMENT_1 c=16 --- Firmware/mmu.cpp | 2 +- Firmware/mmu.h | 2 +- Firmware/ultralcd.h | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 783564329..0c1279964 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -965,7 +965,7 @@ void display_loading() } } -void extr_adj(int extruder) //loading filament for SNMM +void extr_adj(uint8_t extruder) //loading filament for SNMM { #ifndef SNMM MmuCmd cmd = MmuCmd::L0 + extruder; diff --git a/Firmware/mmu.h b/Firmware/mmu.h index a7da0c2d9..0f8784ba7 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -103,7 +103,7 @@ extern void extr_mov(float shift, float feed_rate); extern void change_extr(int extr); extern int get_ext_nr(); extern void display_loading(); -extern void extr_adj(int extruder); +extern void extr_adj(uint8_t extruder); extern void extr_unload(); //-// extern void extr_unload_(); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 84988c588..365f17977 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -129,7 +129,6 @@ void lcd_commands(); void change_extr(int extr); -void extr_adj(int extruder); #ifdef SNMM void extr_unload_all(); From acfcd59369cd5a64b06008cadf539e5a40a8cc4c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 18:32:40 +0200 Subject: [PATCH 200/368] Fix compiler warning: sketch/menu.cpp: In function 'int menu_draw_item_puts_P(char, const char*, char)': sketch/menu.cpp:184:1: warning: no return statement in function returning non-void [-Wreturn-type] --- Firmware/menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index e84043540..2534b43a2 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -174,7 +174,7 @@ static void menu_draw_item_puts_P(char type_char, const char* str) lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); } -static int menu_draw_item_puts_P(char type_char, const char* str, char num) +static void menu_draw_item_puts_P(char type_char, const char* str, char num) { lcd_set_cursor(0, menu_row); lcd_printf_P(PSTR("%c%-.16S "), (lcd_encoder == menu_item)?'>':' ', str); From 719af3293e22764d580e2f8c919f72facaad859e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 18:50:05 +0200 Subject: [PATCH 201/368] Enable compiler warnings in community build script. --- PF-build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PF-build.sh b/PF-build.sh index a7cc25a9e..3c0c31ddc 100755 --- a/PF-build.sh +++ b/PF-build.sh @@ -426,14 +426,14 @@ do sleep 2 #$BUILDER -dump-prefs -logger=machine -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=none -quiet $SCRIPT_PATH/Firmware/Firmware.ino || exit 12 #$BUILDER -compile -logger=machine -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=none -quiet $SCRIPT_PATH/Firmware/Firmware.ino || exit 13 - $BUILDER -compile -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=default $SCRIPT_PATH/Firmware/Firmware.ino || exit 14 + $BUILDER -compile -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=rambo:avr:rambo -ide-version=10805 -build-path=$BUILD_PATH -warnings=all $SCRIPT_PATH/Firmware/Firmware.ino || exit 14 echo "$(tput sgr 0)" fi if [ $OSTYPE == "linux-gnu" ] ; then echo "Start to build Prusa Firmware under Linux 64..." echo "Using variant $VARIANT$(tput setaf 3)" sleep 2 - $BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH || exit 14 + $BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH --pref compiler.warning_level=all || exit 14 echo "$(tput sgr 0)" fi From 91e72a79f0d1112a897741224560488e8278e8bc Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 19:07:50 +0200 Subject: [PATCH 202/368] Fix compiler warning sketch/Marlin_main.cpp:871:13: warning: unused variable 'ir_detected' [-Wunused-variable] --- Firmware/Marlin_main.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index f2b190670..c6d323a0b 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -865,23 +865,23 @@ void show_fw_version_warnings() { lcd_update_enable(true); } -//try to check if firmware is on right type of printer -void check_if_fw_is_on_right_printer(){ - #ifdef FILAMENT_SENSOR - swi2c_init(); - uint8_t pat9125_detected = swi2c_readByte_A8(PAT9125_I2C_ADDR,0x00,NULL); - uint8_t ir_detected = !(PIN_GET(IR_SENSOR_PIN)); //will return 1 only if IR can detect filament in bondtech extruder so this may fail even when we have IR sensor - +//! @brief try to check if firmware is on right type of printer +static void check_if_fw_is_on_right_printer(){ +#ifdef FILAMENT_SENSOR #ifdef IR_SENSOR + swi2c_init(); + const uint8_t pat9125_detected = swi2c_readByte_A8(PAT9125_I2C_ADDR,0x00,NULL); if (pat9125_detected){ lcd_show_fullscreen_message_and_wait_P(_i("MK3S firmware detected on MK3 printer"));} - #endif + #endif //IR_SENSOR #ifdef PAT9125 + //will return 1 only if IR can detect filament in bondtech extruder so this may fail even when we have IR sensor + const uint8_t ir_detected = !(PIN_GET(IR_SENSOR_PIN)); if (ir_detected){ lcd_show_fullscreen_message_and_wait_P(_i("MK3 firmware detected on MK3S printer"));} - #endif - #endif + #endif //PAT9125 +#endif //FILAMENT_SENSOR } uint8_t check_printer_version() From 1a78bd53baf3ab77e63369c3e7f01eaed78102d9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 14 May 2019 19:11:46 +0200 Subject: [PATCH 203/368] Fix compiler warning sketch/Marlin_main.cpp: In function 'void marlin_wait_for_click()': sketch/Marlin_main.cpp:9646:12: warning: unused variable 'busy_state_backup' [-Wunused-variable] --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c6d323a0b..4f5a931b6 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9652,7 +9652,7 @@ void marlin_wait_for_click() manage_inactivity(true); lcd_update(0); } - KEEPALIVE_STATE(busy_state); + KEEPALIVE_STATE(busy_state_backup); } #define FIL_LOAD_LENGTH 60 From c851e158cc5036dd69397f69993e479c3380d432 Mon Sep 17 00:00:00 2001 From: Ondrej Tuma Date: Fri, 10 May 2019 08:52:24 +0200 Subject: [PATCH 204/368] Manual fan check menu have default (selected) option --- Firmware/ultralcd.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) mode change 100755 => 100644 Firmware/ultralcd.cpp diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp old mode 100755 new mode 100644 index 5fc74c389..f3e87faca --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -202,7 +202,9 @@ enum class TestError : uint_least8_t static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_scale, bool _clear, int _delay); static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator); -static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite); +static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite, + bool _default=false); + #ifdef FANCHECK static bool lcd_selftest_fan_dialog(int _fan); #endif //FANCHECK @@ -6928,7 +6930,7 @@ bool lcd_selftest() lcd_selftest_error(TestError::extruderFan, "", ""); } #endif //defined(TACH_0) - + if (_result) { @@ -7712,19 +7714,20 @@ static bool selftest_irsensor() } #endif //FILAMENT_SENSOR -static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite) +static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite, + bool _default) { bool _result = check_opposite; lcd_clear(); lcd_set_cursor(0, 0); lcd_puts_P(_T(MSG_SELFTEST_FAN)); - + switch (_fan) { case 0: // extruder cooling fan - lcd_set_cursor(0, 1); + lcd_set_cursor(0, 1); if(check_opposite == true) lcd_puts_P(_T(MSG_SELFTEST_COOLING_FAN)); else lcd_puts_P(_T(MSG_SELFTEST_EXTRUDER_FAN)); SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); @@ -7750,10 +7753,11 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite) lcd_set_cursor(0, 3); lcd_print(">"); lcd_set_cursor(1, 3); lcd_puts_P(_T(MSG_SELFTEST_FAN_NO)); - int8_t enc_dif = 0; + int8_t enc_dif = int(_default)*3; + KEEPALIVE_STATE(PAUSED_FOR_USER); - lcd_button_pressed = false; + lcd_button_pressed = false; do { switch (_fan) @@ -7773,7 +7777,6 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite) #endif //FAN_SOFT_PWM break; } - if (abs((enc_dif - lcd_encoder_diff)) > 2) { if (enc_dif > lcd_encoder_diff) { _result = !check_opposite; @@ -7812,7 +7815,6 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite) manage_heater(); return _result; - } #ifdef FANCHECK @@ -7834,7 +7836,6 @@ static bool lcd_selftest_fan_dialog(int _fan) manage_heater(); //count average fan speed from 2s delay and turn off fans if (!fan_speed[0]) _result = false; - printf_P(PSTR("Test 1:\n")); printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]); printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]); @@ -7846,9 +7847,9 @@ static bool lcd_selftest_fan_dialog(int _fan) case 1: //will it work with Thotend > 50 C ? -#ifdef FAN_SOFT_PWM - fanSpeed = 255; - fanSpeedSoftPwm = 255; +#ifdef FAN_SOFT_PWM + fanSpeed = 255; + fanSpeedSoftPwm = 255; extruder_autofan_last_check = _millis(); //store time when measurement starts fan_measuring = true; //start fan measuring, rest is on manage_heater #else //FAN_SOFT_PWM @@ -7884,7 +7885,8 @@ static bool lcd_selftest_fan_dialog(int _fan) //check fans manually _result = lcd_selftest_manual_fan_check(1, true); //turn on print fan and check that left extruder fan is not spinning if (_result) { - _result = lcd_selftest_manual_fan_check(1, false); //print fan is stil turned on; check that it is spinning + //print fan is stil turned on; check that it is spinning + _result = lcd_selftest_manual_fan_check(1, false, true); if (!_result) testError = TestError::printFan; } else { From ebfc8c1c79f15129478bbef1a20621b35456bc24 Mon Sep 17 00:00:00 2001 From: Ondrej Tuma Date: Mon, 13 May 2019 16:25:47 +0200 Subject: [PATCH 205/368] Fan autotest for swapping in Selftest --- Firmware/ultralcd.cpp | 145 +++++++++++++++++++++++++++++------------- 1 file changed, 100 insertions(+), 45 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f3e87faca..205c562d5 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -206,8 +206,25 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite, bool _default=false); #ifdef FANCHECK -static bool lcd_selftest_fan_dialog(int _fan); +/** Enumerate for lcd_selftest_fan_auto function. + */ +enum class FanCheck : uint_least8_t { + success, + printFan = TestError::printFan, + extruderFan = TestError::extruderFan, + swappedFan = TestError::swappedFan, +}; + +/** + * Try to check fan working and wiring. + * + * @param _fan i fan number 0 means extruder fan, 1 means print fan. + * + * @returns a TestError noerror, extruderFan, printFan or swappedFan. + */ +static FanCheck lcd_selftest_fan_auto(int _fan); #endif //FANCHECK + #ifdef PAT9125 static bool lcd_selftest_fsensor(); #endif //PAT9125 @@ -6911,6 +6928,7 @@ bool lcd_selftest() { int _progress = 0; bool _result = true; + bool _swapped_fan = false; lcd_wait_for_cool_down(); lcd_clear(); lcd_set_cursor(0, 0); lcd_puts_P(_i("Self test start "));////MSG_SELFTEST_START c=20 @@ -6922,29 +6940,63 @@ bool lcd_selftest() _progress = lcd_selftest_screen(testScreen::extruderFan, _progress, 3, true, 2000); #if (defined(FANCHECK) && defined(TACH_0)) - _result = lcd_selftest_fan_dialog(0); + switch (lcd_selftest_fan_auto(0)){ // check extruder Fan + case FanCheck::extruderFan: + _result = false; + break; + case FanCheck::swappedFan: + _swapped_fan = true; + // no break + default: + _result = true; + break; + } #else //defined(TACH_0) _result = lcd_selftest_manual_fan_check(0, false); +#endif //defined(TACH_0) if (!_result) { lcd_selftest_error(TestError::extruderFan, "", ""); } -#endif //defined(TACH_0) - if (_result) { _progress = lcd_selftest_screen(testScreen::printFan, _progress, 3, true, 2000); -#if (defined(FANCHECK) && defined(TACH_1)) - _result = lcd_selftest_fan_dialog(1); +#if (defined(FANCHECK) && defined(TACH_1)) + switch (lcd_selftest_fan_auto(1)){ // check print fan + case FanCheck::printFan: + _result = false; + break; + case FanCheck::swappedFan: + _swapped_fan = true; + // no break + default: + _result = true; + break; + } #else //defined(TACH_1) _result = lcd_selftest_manual_fan_check(1, false); +#endif //defined(TACH_1) if (!_result) - { + { lcd_selftest_error(TestError::printFan, "", ""); //print fan not spinning } + } -#endif //defined(TACH_1) + if (_swapped_fan) { + //turn on print fan and check that left extruder fan is not spinning + _result = lcd_selftest_manual_fan_check(1, true); + if (_result) { + //print fan is stil turned on; check that it is spinning + _result = lcd_selftest_manual_fan_check(1, false, true); + if (!_result){ + lcd_selftest_error(TestError::printFan, "", ""); + } + } + else { + // fans are swapped + lcd_selftest_error(TestError::swappedFan, "", ""); + } } if (_result) @@ -7818,10 +7870,8 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite, } #ifdef FANCHECK -static bool lcd_selftest_fan_dialog(int _fan) +static FanCheck lcd_selftest_fan_auto(int _fan) { - bool _result = true; - TestError testError = TestError::extruderFan; switch (_fan) { case 0: fanSpeed = 0; @@ -7834,16 +7884,20 @@ static bool lcd_selftest_fan_dialog(int _fan) _delay(2000); //delay_keep_alive would turn off extruder fan, because temerature is too low manage_heater(); //count average fan speed from 2s delay and turn off fans - if (!fan_speed[0]) _result = false; printf_P(PSTR("Test 1:\n")); printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]); printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]); - //SERIAL_ECHOPGM("Extruder fan speed: "); - //MYSERIAL.println(fan_speed[0]); - //SERIAL_ECHOPGM("Print fan speed: "); - //MYSERIAL.print(fan_speed[1]); + + if (!fan_speed[0]) { + return FanCheck::extruderFan; + } +#ifdef FAN_SOFT_PWM + else if (fan_speed[0] > 50 ) { // printerFan is faster + return FanCheck::swappedFan; + } break; +#endif case 1: //will it work with Thotend > 50 C ? @@ -7863,11 +7917,11 @@ static bool lcd_selftest_fan_dialog(int _fan) lcd_set_cursor(18, 3); lcd_print("|"); } + fanSpeed = 0; + #ifdef FAN_SOFT_PWM - fanSpeed = 0; - fanSpeedSoftPwm = 0; + fanSpeedSoftPwm = 0; #else //FAN_SOFT_PWM - fanSpeed = 0; manage_heater(); //turn off fan manage_inactivity(true); //to turn off print fan #endif //FAN_SOFT_PWM @@ -7875,36 +7929,37 @@ static bool lcd_selftest_fan_dialog(int _fan) printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]); printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]); if (!fan_speed[1]) { - _result = false; testError = TestError::printFan; - } -#ifdef FAN_SOFT_PWM - else { -#else //FAN_SOFT_PWM - else if (fan_speed[1] < 34) { //fan is spinning, but measured RPM are too low for print fan, it must be left extruder fan -#endif //FAN_SOFT_PWM - //check fans manually - _result = lcd_selftest_manual_fan_check(1, true); //turn on print fan and check that left extruder fan is not spinning - if (_result) { - //print fan is stil turned on; check that it is spinning - _result = lcd_selftest_manual_fan_check(1, false, true); - if (!_result) testError = TestError::printFan; - } - else { - testError = TestError::swappedFan; - } + return FanCheck::printFan; } - //SERIAL_ECHOPGM("Extruder fan speed: "); - //MYSERIAL.println(fan_speed[0]); - //SERIAL_ECHOPGM("Print fan speed: "); - //MYSERIAL.println(fan_speed[1]); +#ifdef FAN_SOFT_PWM + fanSpeed = 80; + fanSpeedSoftPwm = 80; + + for (uint8_t i = 0; i < 5; i++) { + delay_keep_alive(1000); + lcd_set_cursor(18, 3); + lcd_print("-"); + delay_keep_alive(1000); + lcd_set_cursor(18, 3); + lcd_print("|"); + } + fanSpeed = 0; + + // noctua speed is between 17 and 24, turbine more then 30 + if (fan_speed[1] < 30) { + return FanCheck::swappedFan; + } +#else + // fan is spinning, but measured RPM are too low for print fan, it must + // be left extruder fan + else if (fan_speed[1] < 34) { + return FanCheck::swappedFan; + } +#endif //FAN_SOFT_PWM break; } - if (!_result) - { - lcd_selftest_error(testError, "", ""); - } - return _result; + return FanCheck::success; } #endif //FANCHECK From 464d33fa9a84dc4493e70b81a0be4ac461aa6491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Leirv=C3=A5g?= Date: Wed, 15 May 2019 16:00:16 +0200 Subject: [PATCH 206/368] Windows subsystem CRLF issues fix Add extra tip to linux sbsystem, where users get the error "$'\r': command not found" where windows uses CRLF and linux uses only LF --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ea649fe42..f86389613 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,9 @@ Now your Ubuntu subsystem is ready to use the automatic `PF-build.sh` script and - Example: You files are under `C:\Users\\Downloads\Prusa-Firmware-MK3` - use under Ubuntu the following command `cd /mnt/c/Users//Downloads/Prusa-Firmware-MK3` to change to the right folder +- Unix and windows have different line endings (LF vs CRLF), try dos2unix to convert + - This should fix the `"$'\r': command not found"` error + - to install run `apt-get install dos2unix` #### Compile Prusa-firmware with Ubuntu Linux subsystem installed - open Ubuntu bash From 1f3877b221628c0db8383f0a28549554112630b0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 15 May 2019 16:27:24 +0200 Subject: [PATCH 207/368] Extract duplicate code into function. Saves 4B of flash. --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 11 +++++++++-- Firmware/mmu.cpp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 08f7b4f22..b82856f8d 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -498,3 +498,4 @@ void M600_wait_for_user(float HotendTempBckp); void M600_check_state(float nozzle_temp); void load_filament_final_feed(); void marlin_wait_for_click(); +void marlin_rise_z(void); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index e23ca37e8..44489085c 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3123,7 +3123,14 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float } - +//! @brief Rise Z if too low to avoid blob/jam before filament loading +//! +//! It doesn't plan_buffer_line(), as it expects plan_buffer_line() to be called after +//! during extruding (loading) filament. +void marlin_rise_z(void) +{ + if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; +} void gcode_M701() { @@ -3148,7 +3155,7 @@ void gcode_M701() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence st_synchronize(); - if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; + marlin_rise_z(); current_position[E_AXIS] += 30; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index b7746f2d5..5a8ef817d 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1367,7 +1367,7 @@ bFilamentAction=false; // NOT in "mmu_load_to_nozzle_ manage_response(true, true, MMU_TCODE_MOVE); mmu_continue_loading(false); mmu_extruder = tmp_extruder; //filament change is finished - if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; + marlin_rise_z(); mmu_load_to_nozzle(); load_filament_final_feed(); st_synchronize(); From a453c6fc9df21d613e8ba6a666c1609f6d9f74cf Mon Sep 17 00:00:00 2001 From: DRracer Date: Thu, 16 May 2019 16:43:44 +0200 Subject: [PATCH 208/368] Save 236B by improving functions in menu.cpp. Beware - the label now has to come with a ':' as its last character. Changed language files along with this commit too. --- Firmware/menu.cpp | 49 ++++++++++++++++++++----------------------- Firmware/menu.h | 5 +++-- Firmware/ultralcd.cpp | 18 +++++++++------- lang/lang_en.txt | 2 +- lang/lang_en_cz.txt | 4 ++-- lang/lang_en_de.txt | 4 ++-- lang/lang_en_es.txt | 4 ++-- lang/lang_en_fr.txt | 4 ++-- lang/lang_en_it.txt | 4 ++-- lang/lang_en_pl.txt | 4 ++-- 10 files changed, 50 insertions(+), 48 deletions(-) mode change 100644 => 100755 Firmware/ultralcd.cpp mode change 100644 => 100755 lang/lang_en.txt mode change 100644 => 100755 lang/lang_en_cz.txt mode change 100644 => 100755 lang/lang_en_de.txt mode change 100644 => 100755 lang/lang_en_es.txt mode change 100644 => 100755 lang/lang_en_fr.txt mode change 100644 => 100755 lang/lang_en_it.txt mode change 100644 => 100755 lang/lang_en_pl.txt diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 2534b43a2..cf0c368b2 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -306,9 +306,9 @@ const char menu_20x_space[] PROGMEM = " "; const char menu_fmt_int3[] PROGMEM = "%c%.15S:%s%3d"; -const char menu_fmt_float31[] PROGMEM = "%-12.12s%+8.1f"; +const char menu_fmt_float31[] PROGMEM = "%-12.12S%+8.1f"; -const char menu_fmt_float13[] PROGMEM = "%c%.12S:%s%+06.3f"; +const char menu_fmt_float13[] PROGMEM = "%-15.15S%+5.3f"; const char menu_fmt_float13off[] PROGMEM = "%c%.12S:%s%"; @@ -348,39 +348,36 @@ void menu_draw_P(char chr, const char* str, int16_t val) } } -//! Draw up to 10 chars of text, ':' and float number in format from +0.0 to +12345.0. The increased range is necessary +//! @brief Draw up to 10 chars of text and a float number in format from +0.0 to +12345.0. The increased range is necessary //! for displaying large values of extruder positions, which caused text overflow in the previous implementation. +//! //! @param chr first character to print on the line -//! @param str string label to print, will be appended with ':' automatically inside the function +//! @param str string label to print //! @param val value to print aligned to the right side of the display //! //! Implementation comments: -//! The text needs to be prerendered into the prerendered[] to enable left alignment of text str including the colon behind it. -//! If we didn't want the colon behind it, the whole operation would have been solved with a single vsprintf call, -//! but such line would look different compared to every other similar menu item -//! So it is almost the same amount of code like before, but with added string prerendering -void menu_draw_float31(char chr, const char* str, float val) +//! The text needs to come with a colon ":", this function does not append it anymore. +//! That resulted in a much shorter implementation (234628B -> 234476B) +//! There are similar functions around which may be shortened in a similar way +void menu_draw_float31(const char* str, float val) { - uint8_t txtlen = strlen_P(str); - if( txtlen > 10 )txtlen = 10; - char prerendered[21]; - strcpy_P(prerendered, menu_20x_space); - prerendered[0] = chr; // start with the initial byte/space for menu navigation - strncpy_P(prerendered+1, str, 10); // render the text and limit it to max 10 characters - prerendered[txtlen+1] = ':'; // put the colon behind it - prerendered[txtlen+2] = 0; // terminate the string to be used inside the printf - lcd_printf_P(menu_fmt_float31, prerendered, val); + lcd_printf_P(menu_fmt_float31, str, val); } -//draw up to 12 chars of text, ':' and float number in format +1.234 -void menu_draw_float13(char chr, const char* str, float val) +//! @brief Draw up to 12 chars of text and a float number in format +1.234 +//! +//! @param chr first character to print on the line +//! @param str string label to print +//! @param val value to print aligned to the right side of the display +//! +//! Implementation comments: +//! This function uses similar optimization principles as menu_draw_float31 +//! (i.e. str must include a ':' at its end) +//! FLASH usage dropped 234476B -> 234392B +//! Moreover, this function gets inlined in the final code, so removing it doesn't really help ;) +void menu_draw_float13(const char* str, float val) { - int text_len = strlen_P(str); - if (text_len > 12) text_len = 12; - char spaces[21]; - strcpy_P(spaces, menu_20x_space); - spaces[12 - text_len] = 0; - lcd_printf_P(menu_fmt_float13, chr, str, spaces, val); + lcd_printf_P(menu_fmt_float13, str, val); } template diff --git a/Firmware/menu.h b/Firmware/menu.h index 7ddfe3f24..9800550b9 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -97,11 +97,12 @@ extern uint8_t menu_item_gcode_P(const char* str, const char* str_gcode); extern const char menu_fmt_int3[]; extern const char menu_fmt_float31[]; +extern const char menu_fmt_float13[]; -extern void menu_draw_float31(char chr, const char* str, float val); +extern void menu_draw_float31(const char* str, float val); -extern void menu_draw_float13(char chr, const char* str, float val); +extern void menu_draw_float13(const char* str, float val); #define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { if (menu_item_edit_P(str, pval, minval, maxval)) return; } while (0) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp old mode 100644 new mode 100755 index 205c562d5..47d97d9de --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3079,7 +3079,7 @@ static void _lcd_move(const char *name, int axis, int min, int max) if (lcd_draw_update) { lcd_set_cursor(0, 1); - menu_draw_float31(' ', name, current_position[axis]); + menu_draw_float31(name, current_position[axis]); } if (menu_leaving || LCD_CLICKED) (void)enable_endstops(_md->endstopsEnabledPrevious); if (LCD_CLICKED) menu_back(); @@ -3104,7 +3104,9 @@ static void lcd_move_e() if (lcd_draw_update) { lcd_set_cursor(0, 1); - menu_draw_float31(' ', PSTR("Extruder"), current_position[E_AXIS]); + // Note: the colon behind the text is necessary to greatly shorten + // the implementation of menu_draw_float31 + menu_draw_float31(PSTR("Extruder:"), current_position[E_AXIS]); } if (LCD_CLICKED) menu_back(); } @@ -3224,14 +3226,16 @@ void EEPROM_read_B(int pos, int* value) } +// Note: the colon behind the text (X, Y, Z) is necessary to greatly shorten +// the implementation of menu_draw_float31 static void lcd_move_x() { - _lcd_move(PSTR("X"), X_AXIS, X_MIN_POS, X_MAX_POS); + _lcd_move(PSTR("X:"), X_AXIS, X_MIN_POS, X_MAX_POS); } static void lcd_move_y() { - _lcd_move(PSTR("Y"), Y_AXIS, Y_MIN_POS, Y_MAX_POS); + _lcd_move(PSTR("Y:"), Y_AXIS, Y_MIN_POS, Y_MAX_POS); } static void lcd_move_z() { - _lcd_move(PSTR("Z"), Z_AXIS, Z_MIN_POS, Z_MAX_POS); + _lcd_move(PSTR("Z:"), Z_AXIS, Z_MIN_POS, Z_MAX_POS); } @@ -3304,7 +3308,7 @@ static void _lcd_babystep(int axis, const char *msg) if (lcd_draw_update) { lcd_set_cursor(0, 1); - menu_draw_float13(' ', msg, _md->babystepMemMM[axis]); + menu_draw_float13(msg, _md->babystepMemMM[axis]); } if (LCD_CLICKED || menu_leaving) { @@ -3320,7 +3324,7 @@ static void _lcd_babystep(int axis, const char *msg) static void lcd_babystep_z() { - _lcd_babystep(Z_AXIS, (_i("Adjusting Z")));////MSG_BABYSTEPPING_Z c=20 + _lcd_babystep(Z_AXIS, (_i("Adjusting Z:")));////MSG_BABYSTEPPING_Z c=20 Beware: must include the ':' as its last character } diff --git a/lang/lang_en.txt b/lang/lang_en.txt old mode 100644 new mode 100755 index 3de507cb9..73a67ce72 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -17,7 +17,7 @@ ">Cancel" #MSG_BABYSTEPPING_Z c=20 -"Adjusting Z" +"Adjusting Z:" #MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt old mode 100644 new mode 100755 index 9db15b026..66b5e4eb5 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -23,8 +23,8 @@ ">Zrusit" #MSG_BABYSTEPPING_Z c=20 -"Adjusting Z" -"Dostavovani Z" +"Adjusting Z:" +"Dostavovani Z:" #MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt old mode 100644 new mode 100755 index 66995f4e4..9f11328f1 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -23,8 +23,8 @@ ">Abbruch" #MSG_BABYSTEPPING_Z c=20 -"Adjusting Z" -"Z wurde eingestellt" +"Adjusting Z:" +"Z Einstellung:" #MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt old mode 100644 new mode 100755 index 05757313c..10bdbdd30 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -23,8 +23,8 @@ ">Cancelar" #MSG_BABYSTEPPING_Z c=20 -"Adjusting Z" -"Ajustar Z" +"Adjusting Z:" +"Ajustar Z:" #MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt old mode 100644 new mode 100755 index 9dd3d489f..5136e4605 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -23,8 +23,8 @@ ">Annuler" #MSG_BABYSTEPPING_Z c=20 -"Adjusting Z" -"Ajustement de Z" +"Adjusting Z:" +"Ajust. de Z:" #MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt old mode 100644 new mode 100755 index 45bddac73..2adc45c23 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -23,8 +23,8 @@ ">Annulla" #MSG_BABYSTEPPING_Z c=20 -"Adjusting Z" -"Compensazione Z" +"Adjusting Z:" +"Compensaz. Z:" #MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt old mode 100644 new mode 100755 index d0937dd86..e4fadbc81 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -23,8 +23,8 @@ ">Anuluj" #MSG_BABYSTEPPING_Z c=20 -"Adjusting Z" -"Dostrajanie Z" +"Adjusting Z:" +"Dostrajanie Z:" #MSG_SELFTEST_CHECK_ALLCORRECT c=20 "All correct " From dcfc6348ed1dd72f43a7ca734d570aac71c26e17 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 16 May 2019 17:22:47 +0200 Subject: [PATCH 209/368] Fix documentation. --- Firmware/menu.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index cf0c368b2..6c4fd7bee 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -351,7 +351,6 @@ void menu_draw_P(char chr, const char* str, int16_t val) //! @brief Draw up to 10 chars of text and a float number in format from +0.0 to +12345.0. The increased range is necessary //! for displaying large values of extruder positions, which caused text overflow in the previous implementation. //! -//! @param chr first character to print on the line //! @param str string label to print //! @param val value to print aligned to the right side of the display //! From 74d8c15b4f4082d2e830be305b4320187ab5c724 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 16 May 2019 17:23:54 +0200 Subject: [PATCH 210/368] Fix documentation. --- Firmware/menu.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 6c4fd7bee..3bd9d25fd 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -365,7 +365,6 @@ void menu_draw_float31(const char* str, float val) //! @brief Draw up to 12 chars of text and a float number in format +1.234 //! -//! @param chr first character to print on the line //! @param str string label to print //! @param val value to print aligned to the right side of the display //! From 15ba17f110e6787477bdb800ac7ca6683822b526 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 16 May 2019 17:30:15 +0200 Subject: [PATCH 211/368] Fix translator columns hint for Adjusting Z: --- Firmware/ultralcd.cpp | 2 +- lang/lang_en.txt | 2 +- lang/lang_en_cz.txt | 2 +- lang/lang_en_de.txt | 2 +- lang/lang_en_es.txt | 2 +- lang/lang_en_fr.txt | 2 +- lang/lang_en_it.txt | 2 +- lang/lang_en_pl.txt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 47d97d9de..0345f1ebf 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3324,7 +3324,7 @@ static void _lcd_babystep(int axis, const char *msg) static void lcd_babystep_z() { - _lcd_babystep(Z_AXIS, (_i("Adjusting Z:")));////MSG_BABYSTEPPING_Z c=20 Beware: must include the ':' as its last character + _lcd_babystep(Z_AXIS, (_i("Adjusting Z:")));////MSG_BABYSTEPPING_Z c=15 Beware: must include the ':' as its last character } diff --git a/lang/lang_en.txt b/lang/lang_en.txt index 73a67ce72..685680404 100755 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -16,7 +16,7 @@ # ">Cancel" -#MSG_BABYSTEPPING_Z c=20 +#MSG_BABYSTEPPING_Z c=15 "Adjusting Z:" #MSG_SELFTEST_CHECK_ALLCORRECT c=20 diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 66b5e4eb5..3ec3dde21 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -22,7 +22,7 @@ ">Cancel" ">Zrusit" -#MSG_BABYSTEPPING_Z c=20 +#MSG_BABYSTEPPING_Z c=15 "Adjusting Z:" "Dostavovani Z:" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 9f11328f1..1080e0508 100755 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -22,7 +22,7 @@ ">Cancel" ">Abbruch" -#MSG_BABYSTEPPING_Z c=20 +#MSG_BABYSTEPPING_Z c=15 "Adjusting Z:" "Z Einstellung:" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 10bdbdd30..3cdf4d630 100755 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -22,7 +22,7 @@ ">Cancel" ">Cancelar" -#MSG_BABYSTEPPING_Z c=20 +#MSG_BABYSTEPPING_Z c=15 "Adjusting Z:" "Ajustar Z:" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 5136e4605..4b8ba79d3 100755 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -22,7 +22,7 @@ ">Cancel" ">Annuler" -#MSG_BABYSTEPPING_Z c=20 +#MSG_BABYSTEPPING_Z c=15 "Adjusting Z:" "Ajust. de Z:" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 2adc45c23..1fb4aebe0 100755 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -22,7 +22,7 @@ ">Cancel" ">Annulla" -#MSG_BABYSTEPPING_Z c=20 +#MSG_BABYSTEPPING_Z c=15 "Adjusting Z:" "Compensaz. Z:" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index e4fadbc81..31b700e93 100755 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -22,7 +22,7 @@ ">Cancel" ">Anuluj" -#MSG_BABYSTEPPING_Z c=20 +#MSG_BABYSTEPPING_Z c=15 "Adjusting Z:" "Dostrajanie Z:" From a408f906593db70b8dbbc0c44e961f43176ec1f1 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Sat, 18 May 2019 21:28:59 +0200 Subject: [PATCH 212/368] recovery from "Stop()" --- Firmware/cardreader.cpp | 1 + Firmware/cardreader.h | 1 + 2 files changed, 2 insertions(+) diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index b57d5c0c5..a9cea244f 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -242,6 +242,7 @@ void CardReader::startFileprint() { sdprinting = true; paused = false; + Stopped = false; #ifdef SDCARD_SORT_ALPHA //flush_presort(); #endif diff --git a/Firmware/cardreader.h b/Firmware/cardreader.h index f287a44f4..26981ef0a 100644 --- a/Firmware/cardreader.h +++ b/Firmware/cardreader.h @@ -161,6 +161,7 @@ private: void flush_presort(); #endif }; +extern bool Stopped; extern CardReader card; #define IS_SD_PRINTING (card.sdprinting) From da98977de3e0046e5c190cf137e74c2b14ebba00 Mon Sep 17 00:00:00 2001 From: DRracer Date: Thu, 23 May 2019 10:45:55 +0200 Subject: [PATCH 213/368] Fix. menu texts and formatting - issues PFW-877 and PFW-879 --- Firmware/menu.cpp | 20 +++++++------------- Firmware/ultralcd.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 3bd9d25fd..847e63c80 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -308,9 +308,9 @@ const char menu_fmt_int3[] PROGMEM = "%c%.15S:%s%3d"; const char menu_fmt_float31[] PROGMEM = "%-12.12S%+8.1f"; -const char menu_fmt_float13[] PROGMEM = "%-15.15S%+5.3f"; +const char menu_fmt_float13[] PROGMEM = "%c%-13.13S%+5.3f"; -const char menu_fmt_float13off[] PROGMEM = "%c%.12S:%s%"; +const char menu_fmt_float13off[] PROGMEM = "%c%-13.13S%6.6s"; template static void menu_draw_P(char chr, const char* str, int16_t val); @@ -331,20 +331,14 @@ template<> void menu_draw_P(char chr, const char* str, int16_t val) { menu_data_edit_t* _md = (menu_data_edit_t*)&(menu_data[0]); - int text_len = strlen_P(str); - if (text_len > 15) text_len = 15; - char spaces[21]; - strcpy_P(spaces, menu_20x_space); - spaces[12 - text_len] = 0; - float factor = 1.0 + static_cast(val) / 1000.0; + float factor = 1.0f + static_cast(val) / 1000.0f; if (val <= _md->minEditValue) { - lcd_printf_P(menu_fmt_float13off, chr, str, spaces); - lcd_puts_P(_i(" [off]")); + lcd_printf_P(menu_fmt_float13off, chr, str, " [off]"); } else { - lcd_printf_P(menu_fmt_float13, chr, str, spaces, factor); + lcd_printf_P(menu_fmt_float13, chr, str, factor); } } @@ -363,7 +357,7 @@ void menu_draw_float31(const char* str, float val) lcd_printf_P(menu_fmt_float31, str, val); } -//! @brief Draw up to 12 chars of text and a float number in format +1.234 +//! @brief Draw up to 14 chars of text and a float number in format +1.234 //! //! @param str string label to print //! @param val value to print aligned to the right side of the display @@ -375,7 +369,7 @@ void menu_draw_float31(const char* str, float val) //! Moreover, this function gets inlined in the final code, so removing it doesn't really help ;) void menu_draw_float13(const char* str, float val) { - lcd_printf_P(menu_fmt_float13, str, val); + lcd_printf_P(menu_fmt_float13, ' ', str, val); } template diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0345f1ebf..5948d3761 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5191,11 +5191,11 @@ void lcd_settings_linearity_correction_menu(void) #ifdef TMC2130_LINEARITY_CORRECTION_XYZ //tmc2130_wave_fac[X_AXIS] - MENU_ITEM_EDIT_int3_P(_i("X-correct"), &tmc2130_wave_fac[X_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 - MENU_ITEM_EDIT_int3_P(_i("Y-correct"), &tmc2130_wave_fac[Y_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 - MENU_ITEM_EDIT_int3_P(_i("Z-correct"), &tmc2130_wave_fac[Z_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 + MENU_ITEM_EDIT_int3_P(_i("X-correct:"), &tmc2130_wave_fac[X_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 + MENU_ITEM_EDIT_int3_P(_i("Y-correct:"), &tmc2130_wave_fac[Y_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 + MENU_ITEM_EDIT_int3_P(_i("Z-correct:"), &tmc2130_wave_fac[Z_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 #endif //TMC2130_LINEARITY_CORRECTION_XYZ - MENU_ITEM_EDIT_int3_P(_i("E-correct"), &tmc2130_wave_fac[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 + MENU_ITEM_EDIT_int3_P(_i("E-correct:"), &tmc2130_wave_fac[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 MENU_END(); } #endif // TMC2130 From e17f3f84054f2fd0fa39a5981c5e9a3fa151d263 Mon Sep 17 00:00:00 2001 From: DRracer Date: Thu, 23 May 2019 11:14:26 +0200 Subject: [PATCH 214/368] change language files accordingly --- Firmware/ultralcd.cpp | 8 ++++---- lang/lang_en.txt | 8 ++++---- lang/lang_en_cz.txt | 14 +++++++------- lang/lang_en_de.txt | 14 +++++++------- lang/lang_en_es.txt | 14 +++++++------- lang/lang_en_fr.txt | 14 +++++++------- lang/lang_en_it.txt | 14 +++++++------- lang/lang_en_pl.txt | 14 +++++++------- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5948d3761..97304adb2 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5191,11 +5191,11 @@ void lcd_settings_linearity_correction_menu(void) #ifdef TMC2130_LINEARITY_CORRECTION_XYZ //tmc2130_wave_fac[X_AXIS] - MENU_ITEM_EDIT_int3_P(_i("X-correct:"), &tmc2130_wave_fac[X_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 - MENU_ITEM_EDIT_int3_P(_i("Y-correct:"), &tmc2130_wave_fac[Y_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 - MENU_ITEM_EDIT_int3_P(_i("Z-correct:"), &tmc2130_wave_fac[Z_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 + MENU_ITEM_EDIT_int3_P(_i("X-correct:"), &tmc2130_wave_fac[X_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=10 + MENU_ITEM_EDIT_int3_P(_i("Y-correct:"), &tmc2130_wave_fac[Y_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=10 + MENU_ITEM_EDIT_int3_P(_i("Z-correct:"), &tmc2130_wave_fac[Z_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=10 #endif //TMC2130_LINEARITY_CORRECTION_XYZ - MENU_ITEM_EDIT_int3_P(_i("E-correct:"), &tmc2130_wave_fac[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 + MENU_ITEM_EDIT_int3_P(_i("E-correct:"), &tmc2130_wave_fac[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=10 MENU_END(); } #endif // TMC2130 diff --git a/lang/lang_en.txt b/lang/lang_en.txt index 685680404..b8ea25d0c 100755 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -160,8 +160,8 @@ #MSG_WIZARD_REPEAT_V2_CAL c=20 r=7 "Do you want to repeat last step to readjust distance between nozzle and heatbed?" -#MSG_EXTRUDER_CORRECTION c=9 -"E-correct" +#MSG_EXTRUDER_CORRECTION c=10 +"E-correct:" #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" @@ -899,7 +899,7 @@ "XYZ calibration all right. X/Y axes are slightly skewed. Good job!" # -"X-correct" +"X-correct:" #MSG_BED_SKEW_OFFSET_DETECTION_PERFECT c=20 r=8 "XYZ calibration ok. X/Y axes are perpendicular. Congratulations!" @@ -926,7 +926,7 @@ "Y distance from min" # -"Y-correct" +"Y-correct:" #MSG_OFF " [off]" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 3ec3dde21..027d04097 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -214,9 +214,9 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Chcete opakovat posledni krok a pozmenit vzdalenost mezi tryskou a podlozkou?" -#MSG_EXTRUDER_CORRECTION c=9 -"E-correct" -"Korekce E" +#MSG_EXTRUDER_CORRECTION c=10 +"E-correct:" +"Korekce E:" #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" @@ -1199,8 +1199,8 @@ "Kalibrace XYZ v poradku. X/Y osy mirne zkosene. Dobra prace!" # -"X-correct" -"Korekce X" +"X-correct:" +"Korekce X:" #MSG_BED_SKEW_OFFSET_DETECTION_PERFECT c=20 r=8 "XYZ calibration ok. X/Y axes are perpendicular. Congratulations!" @@ -1235,8 +1235,8 @@ "Y vzdalenost od min" # -"Y-correct" -"Korekce Y" +"Y-correct:" +"Korekce Y:" #MSG_OFF " [off]" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 1080e0508..c4c80d937 100755 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -214,9 +214,9 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Moechten Sie den letzten Schritt wiederholen, um den Abstand zwischen Duese und Druckbett neu einzustellen?" -#MSG_EXTRUDER_CORRECTION c=9 -"E-correct" -"E-Korrektur" +#MSG_EXTRUDER_CORRECTION c=10 +"E-correct:" +"E-Korrektur:" #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" @@ -1199,8 +1199,8 @@ "XYZ Kalibrierung in Ordnung. X/Y Achsen sind etwas schraeg." # -"X-correct" -"X-Korrektur" +"X-correct:" +"X-Korrektur:" #MSG_BED_SKEW_OFFSET_DETECTION_PERFECT c=20 r=8 "XYZ calibration ok. X/Y axes are perpendicular. Congratulations!" @@ -1236,8 +1236,8 @@ "Y Entfernung vom Min" # -"Y-correct" -"Y-Korrektur" +"Y-correct:" +"Y-Korrektur:" #MSG_OFF " [off]" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 3cdf4d630..2f4dc2516 100755 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -214,9 +214,9 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Quieres repetir el ultimo paso para reajustar la distancia boquilla-base?" -#MSG_EXTRUDER_CORRECTION c=9 -"E-correct" -"E-correcion" +#MSG_EXTRUDER_CORRECTION c=10 +"E-correct:" +"E-correcion:" #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" @@ -1199,8 +1199,8 @@ "Calibracion XYZ correcta. Los ejes X / Y estan ligeramente inclinados. Buen trabajo!" # -"X-correct" -"X-correcion" +"X-correct:" +"X-correcion:" #MSG_BED_SKEW_OFFSET_DETECTION_PERFECT c=20 r=8 "XYZ calibration ok. X/Y axes are perpendicular. Congratulations!" @@ -1235,8 +1235,8 @@ "Distancia en Y desde el min" # -"Y-correct" -"Y-correcion" +"Y-correct:" +"Y-correcion:" #MSG_OFF " [off]" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 4b8ba79d3..dfb0dd851 100755 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -214,9 +214,9 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Voulez-vous repeter la derniere etape pour reajuster la distance entre la buse et le plateau chauffant ?" -#MSG_EXTRUDER_CORRECTION c=9 -"E-correct" -"Correct-E" +#MSG_EXTRUDER_CORRECTION c=10 +"E-correct:" +"Correct-E:" #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" @@ -1199,8 +1199,8 @@ "Calibration XYZ OK. Les axes X/Y sont legerement non perpendiculaires. Bon boulot !" # -"X-correct" -"Correction-X" +"X-correct:" +"Correct-X:" #MSG_BED_SKEW_OFFSET_DETECTION_PERFECT c=20 r=8 "XYZ calibration ok. X/Y axes are perpendicular. Congratulations!" @@ -1235,8 +1235,8 @@ "Distance Y du min" # -"Y-correct" -"Correction-Y" +"Y-correct:" +"Correct-Y:" #MSG_OFF " [off]" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 1fb4aebe0..9637777f0 100755 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -214,9 +214,9 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Desideri ripetere l'ultimo passaggio per migliorare la distanza fra ugello e piatto?" -#MSG_EXTRUDER_CORRECTION c=9 -"E-correct" -"Correzione-E" +#MSG_EXTRUDER_CORRECTION c=10 +"E-correct:" +"Correzione-E:" #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" @@ -1199,8 +1199,8 @@ "Calibrazion XYZ corretta. Assi X/Y leggermente storti. Ben fatto!" # -"X-correct" -"Correzione-X" +"X-correct:" +"Correzione-X:" #MSG_BED_SKEW_OFFSET_DETECTION_PERFECT c=20 r=8 "XYZ calibration ok. X/Y axes are perpendicular. Congratulations!" @@ -1235,8 +1235,8 @@ "Distanza Y dal min" # -"Y-correct" -"Correzione-Y" +"Y-correct:" +"Correzione-Y:" #MSG_OFF " [off]" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 31b700e93..fe422cc37 100755 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -214,9 +214,9 @@ "Do you want to repeat last step to readjust distance between nozzle and heatbed?" "Chcesz powtorzyc ostatni krok i ponownie ustawic odleglosc miedzy dysza a stolikiem?" -#MSG_EXTRUDER_CORRECTION c=9 -"E-correct" -"Korekcja E" +#MSG_EXTRUDER_CORRECTION c=10 +"E-correct:" +"Korekcja E:" #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" @@ -1199,8 +1199,8 @@ "Kalibracja XYZ prawidlowa. Osie X/Y lekko skosne. Dobra robota!" # -"X-correct" -"Korekcja X" +"X-correct:" +"Korekcja X:" #MSG_BED_SKEW_OFFSET_DETECTION_PERFECT c=20 r=8 "XYZ calibration ok. X/Y axes are perpendicular. Congratulations!" @@ -1235,8 +1235,8 @@ "Dystans od 0 w osi Y" # -"Y-correct" -"Korekcja Y" +"Y-correct:" +"Korekcja Y:" #MSG_OFF " [off]" From 63235625aba1e4bc7b68e6152cdb9170d6cf9d62 Mon Sep 17 00:00:00 2001 From: Ondrej Tuma Date: Mon, 20 May 2019 14:52:48 +0200 Subject: [PATCH 215/368] pause printer by flag --- Firmware/Marlin_main.cpp | 9 ++++++++- Firmware/temperature.cpp | 5 ++++- Firmware/temperature.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2cd0abe8c..a1740b240 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -156,7 +156,6 @@ //=============================imported variables============================ //=========================================================================== - //=========================================================================== //=============================public variables============================= //=========================================================================== @@ -3389,6 +3388,14 @@ extern uint8_t st_backlash_y; //!@n M999 - Restart after being stopped by error void process_commands() { + #ifdef FANCHECK + if (fan_check_error){ + fan_check_error = false; + lcd_pause_print(); + return; + } + #endif + if (!buflen) return; //empty command #ifdef FILAMENT_RUNOUT_SUPPORT SET_INPUT(FR_SENS); diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index f64c5d9de..668b857fd 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -94,6 +94,9 @@ float current_temperature_bed = 0.0; unsigned char fanSpeedSoftPwm; #endif +#ifdef FANCHECK + volatile bool fan_check_error = false; +#endif unsigned char soft_pwm_bed; @@ -527,7 +530,7 @@ void fanSpeedError(unsigned char _fan) { lcd_print_stop(); } else { - lcd_pause_print(); + fan_check_error = true; } } else { diff --git a/Firmware/temperature.h b/Firmware/temperature.h index ba9632cf6..31ab8d9f5 100644 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -238,6 +238,8 @@ void checkExtruderAutoFans(); #if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1)) +extern volatile bool fan_check_error; + void countFanSpeed(); void checkFanSpeed(); void fanSpeedError(unsigned char _fan); From 1399d7dcc837393f5b3b19deab5c6b76d548a4a8 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Thu, 23 May 2019 15:22:31 +0200 Subject: [PATCH 216/368] support only for MK3/MK3S --- Firmware/Marlin_main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a1740b240..d37fbb38e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -867,6 +867,7 @@ void show_fw_version_warnings() { //! @brief try to check if firmware is on right type of printer static void check_if_fw_is_on_right_printer(){ #ifdef FILAMENT_SENSOR + if((PRINTER_TYPE == PRINTER_MK3) || (PRINTER_TYPE == PRINTER_MK3S)){ #ifdef IR_SENSOR swi2c_init(); const uint8_t pat9125_detected = swi2c_readByte_A8(PAT9125_I2C_ADDR,0x00,NULL); @@ -880,6 +881,7 @@ static void check_if_fw_is_on_right_printer(){ if (ir_detected){ lcd_show_fullscreen_message_and_wait_P(_i("MK3 firmware detected on MK3S printer"));} #endif //PAT9125 + } #endif //FILAMENT_SENSOR } From 9cb0bc7bcf35f3408353a2b67c407293657d5792 Mon Sep 17 00:00:00 2001 From: DRracer Date: Fri, 24 May 2019 08:46:44 +0200 Subject: [PATCH 217/368] Fix MINTEMP errors and fsensor runout --- Firmware/Marlin.h | 7 ++++ Firmware/Marlin_main.cpp | 4 ++ Firmware/fsensor.cpp | 32 ++++++++++----- Firmware/fsensor.h | 3 ++ Firmware/menu.cpp | 2 +- Firmware/menu.h | 21 ++++++++++ Firmware/temperature.cpp | 89 +++++++++++++++++++++++++++++++++++++++- Firmware/ultralcd.cpp | 18 ++++++-- Firmware/ultralcd.h | 9 ++++ 9 files changed, 168 insertions(+), 17 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index b82856f8d..2e60597dc 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -390,6 +390,13 @@ extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff #define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CUSTOM_MSG_TYPE_TEMCAL) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused || mmu_print_saved) +//! Beware - mcode_in_progress is set as soon as the command gets really processed, +//! which is not the same as posting the M600 command into the command queue +//! There can be a considerable lag between posting M600 and its real processing which might result +//! in posting multiple M600's into the command queue +//! Instead, the fsensor uses another state variable :( , which is set to true, when the M600 command is enqued +//! and is reset to false when the fsensor returns into its filament runout finished handler +//! I'd normally change this macro, but who knows what would happen in the MMU :) #define CHECK_FSENSOR ((IS_SD_PRINTING || is_usb_printing) && (mcode_in_progress != 600) && !saved_printing && e_active()) extern void calculate_extruder_multipliers(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a1740b240..8e216ae0d 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3552,6 +3552,10 @@ void process_commands() enquecommand_P(PSTR("M24")); } #ifdef FILAMENT_SENSOR + else if (code_seen("fsensor_recover_IR")) //! PRUSA fsensor_recover_IR + { + fsensor_restore_print_and_continue_IR(); + } else if (code_seen("fsensor_recover")) //! PRUSA fsensor_recover { fsensor_restore_print_and_continue(); diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index d520ba533..f9ca89099 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -57,6 +57,11 @@ bool fsensor_not_responding = false; bool fsensor_printing_saved = false; //! enable/disable quality meassurement bool fsensor_oq_meassure_enabled = false; +//! as explained in the CHECK_FSENSOR macro: this flag is set to true when fsensor posts +//! the M600 into the command queue, which elliminates the hazard of having posted multiple M600's +//! before the first one gets read and started processing. +//! Btw., the IR fsensor could do up to 6 posts before the command queue managed to start processing the first M600 ;) +static bool fsensor_m600_enqueued = false; //! number of errors, updated in ISR uint8_t fsensor_err_cnt = 0; @@ -118,11 +123,17 @@ void fsensor_stop_and_save_print(void) stop_and_save_print_to_ram(0, 0); //XYZE - no change } +void fsensor_restore_print_and_continue_IR(void) +{ + fsensor_watch_runout = true; + fsensor_err_cnt = 0; + fsensor_m600_enqueued = false; +} + void fsensor_restore_print_and_continue(void) { printf_P(PSTR("fsensor_restore_print_and_continue\n")); - fsensor_watch_runout = true; - fsensor_err_cnt = 0; + fsensor_restore_print_and_continue_IR(); restore_print_from_ram_and_continue(0); //XYZ = orig, E - no change } @@ -575,14 +586,15 @@ void fsensor_update(void) fsensor_oq_meassure_enabled = oq_meassure_enabled_tmp; } #else //PAT9125 - if ((digitalRead(IR_SENSOR_PIN) == 1) && CHECK_FSENSOR && fsensor_enabled && ir_sensor_detected) - { - fsensor_stop_and_save_print(); - printf_P(PSTR("fsensor_update - M600\n")); - eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); - eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); - enquecommand_front_P(PSTR("PRUSA fsensor_recover")); - enquecommand_front_P((PSTR("M600"))); + if ((digitalRead(IR_SENSOR_PIN) == 1) && CHECK_FSENSOR && fsensor_enabled && ir_sensor_detected && ( ! fsensor_m600_enqueued) ) + { // just plan a simple M600 without any additional position save/restore, + // which caused weird heating issues standing directly over the print + printf_P(PSTR("fsensor_update - M600\n")); + eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); + eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); + enquecommand_front_P(PSTR("PRUSA fsensor_recover_IR")); + fsensor_m600_enqueued = true; + enquecommand_front_P((PSTR("M600"))); } #endif //PAT9125 } diff --git a/Firmware/fsensor.h b/Firmware/fsensor.h index 71922fbfc..421eee439 100644 --- a/Firmware/fsensor.h +++ b/Firmware/fsensor.h @@ -18,6 +18,9 @@ extern bool fsensor_oq_meassure_enabled; //! @name save restore printing //! @{ extern void fsensor_stop_and_save_print(void); +//! special handling for the IR sensor (no restore position and heating, since this is already correctly handled in the M600 itself) +extern void fsensor_restore_print_and_continue_IR(void); +//! legacy restore print - restore position and heatup to original temperature - for the MMU and the optical fsensor extern void fsensor_restore_print_and_continue(void); //! @} diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 847e63c80..e0364056e 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -26,7 +26,7 @@ uint8_t menu_data[MENU_DATA_SIZE]; #endif uint8_t menu_depth = 0; - +uint8_t menu_block_entering_on_serious_errors = SERIOUS_ERR_NONE; uint8_t menu_line = 0; uint8_t menu_item = 0; uint8_t menu_row = 0; diff --git a/Firmware/menu.h b/Firmware/menu.h index 9800550b9..5f73e18b0 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -28,6 +28,27 @@ extern uint8_t menu_data[MENU_DATA_SIZE]; extern uint8_t menu_depth; +//! definition of serious errors possibly blocking the main menu +//! Use them as bit mask, so that the code may set various errors at the same time +enum ESeriousErrors { + SERIOUS_ERR_NONE = 0, + SERIOUS_ERR_MINTEMP_HEATER = 0x01, + SERIOUS_ERR_MINTEMP_BED = 0x02 +}; // and possibly others in the future. + +//! this is a flag for disabling entering the main menu. If this is set +//! to anything != 0, the only the main status screen will be shown on the +//! LCD and the user will be prevented from entering the menu. +//! Now used only to block doing anything with the printer when there is +//! the infamous MINTEMP error (SERIOUS_ERR_MINTEMP). +extern uint8_t menu_block_entering_on_serious_errors; + +//! a pair of macros for manipulating the serious errors +//! a c++ class would have been better +#define menu_set_serious_error(x) menu_block_entering_on_serious_errors |= x; +#define menu_unset_serious_error(x) menu_block_entering_on_serious_errors &= ~x; +#define menu_is_serious_error(x) (menu_block_entering_on_serious_errors & x) != 0 + extern uint8_t menu_line; extern uint8_t menu_item; extern uint8_t menu_row; diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 668b857fd..5a81c630d 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1469,6 +1469,15 @@ void disable_heater() #endif #endif } +//! codes of alert messages for the LCD - it is shorter to compare an uin8_t +//! than raw const char * of the messages themselves. +//! Could be used for MAXTEMP situations too - after reaching MAXTEMP and turning off the heater automagically +//! the heater/bed may cool down and a similar alert message like "MAXTERM fixed..." may be displayed. +enum { LCDALERT_NONE = 0, LCDALERT_HEATERMINTEMP, LCDALERT_BEDMINTEMP, LCDALERT_MINTEMPFIXED, LCDALERT_PLEASERESTART }; + +//! remember the last alert message sent to the LCD +//! to prevent flicker and improve speed +uint8_t last_alert_sent_to_lcd = LCDALERT_NONE; void max_temp_error(uint8_t e) { disable_heater(); @@ -1502,13 +1511,23 @@ void min_temp_error(uint8_t e) { #endif //if (current_temperature_ambient < MINTEMP_MINAMBIENT) return; disable_heater(); + static const char err[] PROGMEM = "Err: MINTEMP"; if(IsStopped() == false) { SERIAL_ERROR_START; SERIAL_ERRORLN((int)e); SERIAL_ERRORLNPGM(": Extruder switched off. MINTEMP triggered !"); - LCD_ALERTMESSAGEPGM("Err: MINTEMP"); + lcd_setalertstatuspgm(err); + last_alert_sent_to_lcd = LCDALERT_HEATERMINTEMP; + } else if( last_alert_sent_to_lcd != LCDALERT_HEATERMINTEMP ){ // only update, if the lcd message is to be changed (i.e. not the same as last time) + // we are already stopped due to some error, only update the status message without flickering + lcd_updatestatuspgm(err); + last_alert_sent_to_lcd = LCDALERT_HEATERMINTEMP; } #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE +// if( last_alert_sent_to_lcd != LCDALERT_HEATERMINTEMP ){ +// last_alert_sent_to_lcd = LCDALERT_HEATERMINTEMP; +// lcd_print_stop(); +// } Stop(); #endif if (farm_mode) { prusa_statistics(92); } @@ -1538,10 +1557,16 @@ void bed_min_temp_error(void) { #if HEATER_BED_PIN > -1 WRITE(HEATER_BED_PIN, 0); #endif + static const char err[] PROGMEM = "Err: MINTEMP BED"; if(IsStopped() == false) { SERIAL_ERROR_START; SERIAL_ERRORLNPGM("Temperature heated bed switched off. MINTEMP triggered !"); - LCD_ALERTMESSAGEPGM("Err: MINTEMP BED"); + lcd_setalertstatuspgm(err); + last_alert_sent_to_lcd = LCDALERT_BEDMINTEMP; + } else if( last_alert_sent_to_lcd != LCDALERT_BEDMINTEMP ){ // only update, if the lcd message is to be changed (i.e. not the same as last time) + // we are already stopped due to some error, only update the status message without flickering + lcd_updatestatuspgm(err); + last_alert_sent_to_lcd = LCDALERT_BEDMINTEMP; } #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE Stop(); @@ -2015,6 +2040,52 @@ void check_max_temp() #endif } +//! number of repeating the same state with consecutive step() calls +//! used to slow down text switching +struct alert_automaton_mintemp { + enum { ALERT_AUTOMATON_SPEED_DIV = 5 }; + uint8_t state, repeat = ALERT_AUTOMATON_SPEED_DIV; + + void substep(uint8_t next_state){ + if( repeat == 0 ){ + state = next_state; // advance to the next state + repeat = ALERT_AUTOMATON_SPEED_DIV; // and prepare repeating for it too + } else { + --repeat; + } + } + + void step(float current_temp, float mintemp){ + static const char m2[] PROGMEM = "MINTEMP fixed"; + static const char m1[] PROGMEM = "Please restart"; + switch(state){ + case 0: // initial state - check hysteresis + if( current_temp > mintemp ){ + state = 1; + } + // otherwise keep the Err MINTEMP alert message on the display, + // i.e. do not transfer to state 1 + break; + case 1: // the temperature has risen above the hysteresis check + lcd_setalertstatuspgm(m2); + substep(3); + last_alert_sent_to_lcd = LCDALERT_MINTEMPFIXED; + break; + case 2: // displaying "Please restart" + lcd_updatestatuspgm(m1); + substep(3); + last_alert_sent_to_lcd = LCDALERT_PLEASERESTART; + break; + case 3: // displaying "MINTEMP fixed" + lcd_updatestatuspgm(m2); + substep(2); + last_alert_sent_to_lcd = LCDALERT_MINTEMPFIXED; + break; + } + } +}; + +static alert_automaton_mintemp aam[2]; void check_min_temp_heater0() { @@ -2024,7 +2095,16 @@ void check_min_temp_heater0() #else if (current_temperature_raw[0] <= minttemp_raw[0]) { #endif + menu_set_serious_error(SERIOUS_ERR_MINTEMP_HEATER); min_temp_error(0); + } else if( menu_is_serious_error(SERIOUS_ERR_MINTEMP_HEATER) ) { + // no recovery, just force the user to restart the printer + // which is a safer variant than just continuing printing + // The automaton also checks for hysteresis - the temperature must have reached a few degrees above the MINTEMP, before + // we shall signalize, that MINTEMP has been fixed + // Code notice: normally the aam instance would have been placed here as static alert_automaton_mintemp aam, but + // due to stupid compiler that takes 16 more bytes. + aam[0].step(current_temperature[0], minttemp[0] + TEMP_HYSTERESIS); } } @@ -2035,7 +2115,12 @@ void check_min_temp_bed() #else if (current_temperature_bed_raw <= bed_minttemp_raw) { #endif + menu_set_serious_error(SERIOUS_ERR_MINTEMP_BED); bed_min_temp_error(); + } else if( menu_is_serious_error(SERIOUS_ERR_MINTEMP_BED) ){ + // no recovery, just force the user to restart the printer + // which is a safer variant than just continuing printing + aam[1].step(current_temperature_bed, BED_MINTEMP + TEMP_HYSTERESIS); } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 97304adb2..23571eed2 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -252,6 +252,7 @@ static void lcd_send_status(); static void lcd_connect_printer(); #endif //FARM_CONNECT_MESSAGE +//! Beware: has side effects - forces lcd_draw_update to 2, which means clear the display void lcd_finishstatus(); static void lcd_sdcard_menu(); @@ -1018,7 +1019,10 @@ static void lcd_status_screen() } } - if (current_click && (lcd_commands_type != LCD_COMMAND_STOP_PRINT)) //click is aborted unless stop print finishes + if (current_click + && (lcd_commands_type != LCD_COMMAND_STOP_PRINT) //click is aborted unless stop print finishes + && ( menu_block_entering_on_serious_errors == SERIOUS_ERR_NONE ) // or a serious error blocks entering the menu + ) { menu_depth = 0; //redundant, as already done in lcd_return_to_status(), just to be sure menu_submenu(lcd_main_menu); @@ -8276,13 +8280,19 @@ void lcd_setstatus(const char* message) strncpy(lcd_status_message, message, LCD_WIDTH); lcd_finishstatus(); } +void lcd_updatestatuspgm(const char *message){ + strncpy_P(lcd_status_message, message, LCD_WIDTH); + lcd_status_message[LCD_WIDTH] = 0; + lcd_finishstatus(); + // hack lcd_draw_update to 1, i.e. without clear + lcd_draw_update = 1; +} + void lcd_setstatuspgm(const char* message) { if (lcd_status_message_level > 0) return; - strncpy_P(lcd_status_message, message, LCD_WIDTH); - lcd_status_message[LCD_WIDTH] = 0; - lcd_finishstatus(); + lcd_updatestatuspgm(message); } void lcd_setalertstatuspgm(const char* message) { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 365f17977..665c1233f 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -18,7 +18,16 @@ extern void menu_lcd_lcdupdate_func(void); void ultralcd_init(); void lcd_setstatus(const char* message); void lcd_setstatuspgm(const char* message); +//! return to the main status screen and display the alert message +//! Beware - it has sideeffects: +//! - always returns the display to the main status screen +//! - always makes lcd_reset (which is slow and causes flicker) +//! - does not update the message if there is already one (i.e. lcd_status_message_level > 0) void lcd_setalertstatuspgm(const char* message); +//! only update the alert message on the main status screen +//! has no sideeffects, may be called multiple times +void lcd_updatestatuspgm(const char *message); + void lcd_reset_alert_level(); uint8_t get_message_level(); void lcd_adjust_z(); From 69455bfc75c8ea074e01db21efdea506d86ba212 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Fri, 24 May 2019 18:28:16 +0200 Subject: [PATCH 218/368] PFW-828 fix printing in the air after power panic --- Firmware/Marlin_main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a1740b240..4769d59cf 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8823,7 +8823,6 @@ void uvlo_() // Increment power failure counter eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1); eeprom_update_word((uint16_t*)EEPROM_POWER_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) + 1); - printf_P(_N("UVLO - end %d\n"), _millis() - time_start); #if 0 From 55a2d588f174fd88a353c7d23f872c53cf03cdb8 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Fri, 24 May 2019 18:28:38 +0200 Subject: [PATCH 219/368] PFW-828 printing in the air after power panic --- Firmware/Marlin_main.cpp | 69 ++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 46 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 4769d59cf..0b9b26725 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1296,9 +1296,12 @@ void setup() #endif //TMC2130 + #ifdef UVLO_SUPPORT + setup_uvlo_interrupt(); + #endif //UVLO_SUPPORT st_init(); // Initialize stepper, this enables interrupts! - + #ifdef TMC2130 tmc2130_mode = silentMode?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; update_mode_profile(); @@ -1500,10 +1503,6 @@ void setup() } check_babystep(); //checking if Z babystep is in allowed range -#ifdef UVLO_SUPPORT - setup_uvlo_interrupt(); -#endif //UVLO_SUPPORT - #if !defined(DEBUG_DISABLE_FANCHECK) && defined(FANCHECK) && defined(TACH_1) && TACH_1 >-1 setup_fan_interrupt(); #endif //DEBUG_DISABLE_FANCHECK @@ -8689,7 +8688,6 @@ void serialecho_temperatures() { } extern uint32_t sdpos_atomic; - #ifdef UVLO_SUPPORT void uvlo_() @@ -8760,26 +8758,15 @@ void uvlo_() st_synchronize(); disable_e0(); - plan_buffer_line( - current_position[X_AXIS], - current_position[Y_AXIS], - current_position[Z_AXIS] + UVLO_Z_AXIS_SHIFT + float((1024 - z_microsteps + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS], + plan_buffer_line( + current_position[X_AXIS], + current_position[Y_AXIS], + current_position[Z_AXIS] + UVLO_Z_AXIS_SHIFT + float((1024 - z_microsteps + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS], current_position[E_AXIS] - default_retraction, 40, active_extruder); - - st_synchronize(); - disable_e0(); - - plan_buffer_line( - current_position[X_AXIS], - current_position[Y_AXIS], - current_position[Z_AXIS] + UVLO_Z_AXIS_SHIFT + float((1024 - z_microsteps + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS], - current_position[E_AXIS] - default_retraction, - 40, active_extruder); st_synchronize(); disable_e0(); disable_z(); - // Move Z up to the next 0th full step. // Write the file position. eeprom_update_dword((uint32_t*)(EEPROM_FILE_POSITION), sd_position); @@ -8823,8 +8810,8 @@ void uvlo_() // Increment power failure counter eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1); eeprom_update_word((uint16_t*)EEPROM_POWER_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) + 1); - printf_P(_N("UVLO - end %d\n"), _millis() - time_start); - + printf_P(_N("UVLO - end %d\n"), _millis() - time_start); + #if 0 // Move the print head to the side of the print until all the power stored in the power supply capacitors is depleted. current_position[X_AXIS] = (current_position[X_AXIS] < 0.5f * (X_MIN_POS + X_MAX_POS)) ? X_MIN_POS : X_MAX_POS; @@ -8859,23 +8846,13 @@ z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); #endif //TMC2130 planner_abort_hard(); -sei(); -plan_buffer_line( - current_position[X_AXIS], - current_position[Y_AXIS], -// current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/axis_steps_per_unit[Z_AXIS], - current_position[Z_AXIS]+UVLO_Z_AXIS_SHIFT+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS], - current_position[E_AXIS], - 40, active_extruder); -st_synchronize(); disable_z(); // Finaly store the "power outage" flag. //if(sd_print) eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); -eeprom_update_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS),z_microsteps); -eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]); +eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS),z_microsteps); // Increment power failure counter eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1); @@ -8946,15 +8923,13 @@ ISR(INT4_vect) { if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny(); } -void recover_print(uint8_t automatic) { +void recover_print(uint8_t automatic) { char cmd[30]; lcd_update_enable(true); lcd_update(2); - lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20 r=1 - + printf_P(_N("UVLO - end %d\n"), _millis() - time_start); bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2); recover_machine_state_after_power_panic(bTiny); //recover position, temperatures and extrude_multipliers - // Lift the print head, so one may remove the excess priming material. if(!bTiny&&(current_position[Z_AXIS]<25)) enquecommand_P(PSTR("G1 Z25 F800")); @@ -8977,8 +8952,7 @@ void recover_print(uint8_t automatic) { // Restart the print. restore_print_from_eeprom(); - - printf_P(_N("Current pos Z_AXIS:%.3f\nCurrent pos E_AXIS:%.3f\n"), current_position[Z_AXIS], current_position[E_AXIS]); + printf_P(_N("Current pos Z_AXIS:%.3f\nCurrent pos E_AXIS:%.3f\n"), current_position[Z_AXIS], current_position[E_AXIS]); } void recover_machine_state_after_power_panic(bool bTiny) @@ -8990,12 +8964,14 @@ void recover_machine_state_after_power_panic(bool bTiny) current_position[Y_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4)); // Recover the logical coordinate of the Z axis at the time of the power panic. // The current position after power panic is moved to the next closest 0th full step. - if(bTiny) - current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) + - UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; - else + if(bTiny){ current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; + } + else{ + current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + + UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; + } if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS)) { current_position[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E)); sprintf_P(cmd, PSTR("G92 E")); @@ -9038,7 +9014,7 @@ void recover_machine_state_after_power_panic(bool bTiny) axis_known_position[X_AXIS] = true; enable_x(); axis_known_position[Y_AXIS] = true; enable_y(); axis_known_position[Z_AXIS] = true; enable_z(); - + SERIAL_ECHOPGM("recover_machine_state_after_power_panic, initial "); print_physical_coordinates(); @@ -9103,7 +9079,8 @@ void restore_print_from_eeprom() { strcat_P(cmd, PSTR(" F2000")); enquecommand(cmd); // Move the Z axis down to the print, in logical coordinates. - strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)))); + strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(current_position[Z_AXIS] - (UVLO_Z_AXIS_SHIFT + + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]))); enquecommand(cmd); // Unretract. enquecommand_P(PSTR("G1 E" STRINGIFY(2*default_retraction)" F480")); From f070a1090461ef4c8890fd671704d79ad5589168 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 27 May 2019 10:10:24 +0200 Subject: [PATCH 220/368] edit --- Firmware/Marlin_main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0b9b26725..982e21305 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8927,7 +8927,6 @@ void recover_print(uint8_t automatic) { char cmd[30]; lcd_update_enable(true); lcd_update(2); - printf_P(_N("UVLO - end %d\n"), _millis() - time_start); bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2); recover_machine_state_after_power_panic(bTiny); //recover position, temperatures and extrude_multipliers // Lift the print head, so one may remove the excess priming material. From 4d020d99f6eefecba90afbc8dec867ce25868c30 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 27 May 2019 14:57:02 +0200 Subject: [PATCH 221/368] Code cleanup --- Firmware/temperature.cpp | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 5a81c630d..20ba8871f 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -2043,10 +2043,13 @@ void check_max_temp() //! number of repeating the same state with consecutive step() calls //! used to slow down text switching struct alert_automaton_mintemp { +private: enum { ALERT_AUTOMATON_SPEED_DIV = 5 }; - uint8_t state, repeat = ALERT_AUTOMATON_SPEED_DIV; + enum class STATES : uint8_t { INIT = 0, TEMP_ABOVE_MINTEMP, SHOW_PLEASE_RESTART, SHOW_MINTEMP }; + STATES state = STATES::INIT; + uint8_t repeat = ALERT_AUTOMATON_SPEED_DIV; - void substep(uint8_t next_state){ + void substep(STATES next_state){ if( repeat == 0 ){ state = next_state; // advance to the next state repeat = ALERT_AUTOMATON_SPEED_DIV; // and prepare repeating for it too @@ -2054,38 +2057,41 @@ struct alert_automaton_mintemp { --repeat; } } - +public: + //! brief state automaton step routine + //! @param current_temp current hotend/bed temperature (for computing simple hysteresis) + //! @param mintemp minimal temperature including hysteresis to check current_temp against void step(float current_temp, float mintemp){ static const char m2[] PROGMEM = "MINTEMP fixed"; static const char m1[] PROGMEM = "Please restart"; switch(state){ - case 0: // initial state - check hysteresis + case STATES::INIT: // initial state - check hysteresis if( current_temp > mintemp ){ - state = 1; + state = STATES::TEMP_ABOVE_MINTEMP; } // otherwise keep the Err MINTEMP alert message on the display, // i.e. do not transfer to state 1 break; - case 1: // the temperature has risen above the hysteresis check + case STATES::TEMP_ABOVE_MINTEMP: // the temperature has risen above the hysteresis check lcd_setalertstatuspgm(m2); - substep(3); + substep(STATES::SHOW_MINTEMP); last_alert_sent_to_lcd = LCDALERT_MINTEMPFIXED; break; - case 2: // displaying "Please restart" + case STATES::SHOW_PLEASE_RESTART: // displaying "Please restart" lcd_updatestatuspgm(m1); - substep(3); + substep(STATES::SHOW_MINTEMP); last_alert_sent_to_lcd = LCDALERT_PLEASERESTART; break; - case 3: // displaying "MINTEMP fixed" + case STATES::SHOW_MINTEMP: // displaying "MINTEMP fixed" lcd_updatestatuspgm(m2); - substep(2); + substep(STATES::SHOW_PLEASE_RESTART); last_alert_sent_to_lcd = LCDALERT_MINTEMPFIXED; break; } } }; -static alert_automaton_mintemp aam[2]; +static alert_automaton_mintemp alert_automaton_hotend, alert_automaton_bed; void check_min_temp_heater0() { @@ -2102,9 +2108,10 @@ void check_min_temp_heater0() // which is a safer variant than just continuing printing // The automaton also checks for hysteresis - the temperature must have reached a few degrees above the MINTEMP, before // we shall signalize, that MINTEMP has been fixed - // Code notice: normally the aam instance would have been placed here as static alert_automaton_mintemp aam, but + // Code notice: normally the alert_automaton instance would have been placed here + // as static alert_automaton_mintemp alert_automaton_hotend, but // due to stupid compiler that takes 16 more bytes. - aam[0].step(current_temperature[0], minttemp[0] + TEMP_HYSTERESIS); + alert_automaton_hotend.step(current_temperature[0], minttemp[0] + TEMP_HYSTERESIS); } } @@ -2120,7 +2127,7 @@ void check_min_temp_bed() } else if( menu_is_serious_error(SERIOUS_ERR_MINTEMP_BED) ){ // no recovery, just force the user to restart the printer // which is a safer variant than just continuing printing - aam[1].step(current_temperature_bed, BED_MINTEMP + TEMP_HYSTERESIS); + alert_automaton_bed.step(current_temperature_bed, BED_MINTEMP + TEMP_HYSTERESIS); } } From 253087a4c5a2ebbfe45d2dd7fda8d53ec59be958 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 27 May 2019 16:18:21 +0200 Subject: [PATCH 222/368] Code cleanup --- Firmware/temperature.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 20ba8871f..b245b23ba 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -2045,11 +2045,11 @@ void check_max_temp() struct alert_automaton_mintemp { private: enum { ALERT_AUTOMATON_SPEED_DIV = 5 }; - enum class STATES : uint8_t { INIT = 0, TEMP_ABOVE_MINTEMP, SHOW_PLEASE_RESTART, SHOW_MINTEMP }; - STATES state = STATES::INIT; + enum class States : uint8_t { INIT = 0, TEMP_ABOVE_MINTEMP, SHOW_PLEASE_RESTART, SHOW_MINTEMP }; + States state = States::INIT; uint8_t repeat = ALERT_AUTOMATON_SPEED_DIV; - void substep(STATES next_state){ + void substep(States next_state){ if( repeat == 0 ){ state = next_state; // advance to the next state repeat = ALERT_AUTOMATON_SPEED_DIV; // and prepare repeating for it too @@ -2065,26 +2065,26 @@ public: static const char m2[] PROGMEM = "MINTEMP fixed"; static const char m1[] PROGMEM = "Please restart"; switch(state){ - case STATES::INIT: // initial state - check hysteresis + case States::INIT: // initial state - check hysteresis if( current_temp > mintemp ){ - state = STATES::TEMP_ABOVE_MINTEMP; + state = States::TEMP_ABOVE_MINTEMP; } // otherwise keep the Err MINTEMP alert message on the display, // i.e. do not transfer to state 1 break; - case STATES::TEMP_ABOVE_MINTEMP: // the temperature has risen above the hysteresis check + case States::TEMP_ABOVE_MINTEMP: // the temperature has risen above the hysteresis check lcd_setalertstatuspgm(m2); - substep(STATES::SHOW_MINTEMP); + substep(States::SHOW_MINTEMP); last_alert_sent_to_lcd = LCDALERT_MINTEMPFIXED; break; - case STATES::SHOW_PLEASE_RESTART: // displaying "Please restart" + case States::SHOW_PLEASE_RESTART: // displaying "Please restart" lcd_updatestatuspgm(m1); - substep(STATES::SHOW_MINTEMP); + substep(States::SHOW_MINTEMP); last_alert_sent_to_lcd = LCDALERT_PLEASERESTART; break; - case STATES::SHOW_MINTEMP: // displaying "MINTEMP fixed" + case States::SHOW_MINTEMP: // displaying "MINTEMP fixed" lcd_updatestatuspgm(m2); - substep(STATES::SHOW_PLEASE_RESTART); + substep(States::SHOW_PLEASE_RESTART); last_alert_sent_to_lcd = LCDALERT_MINTEMPFIXED; break; } From 326c061d8c0018e8be5b8c434998d5ecdc887cb9 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 27 May 2019 18:27:24 +0200 Subject: [PATCH 223/368] testing pin 5 --- Firmware/pins_Einsy_1_0.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 Firmware/pins_Einsy_1_0.h diff --git a/Firmware/pins_Einsy_1_0.h b/Firmware/pins_Einsy_1_0.h old mode 100644 new mode 100755 index 33363388a..2e05d3263 --- a/Firmware/pins_Einsy_1_0.h +++ b/Firmware/pins_Einsy_1_0.h @@ -99,7 +99,8 @@ //#define KILL_PIN 32 -//#define LCD_BL_PIN 5 //backlight control pin +// LCD backlight pin may interfere with something, this is yet to be found out correctly +#define LCD_BL_PIN 5 //backlight control pin #define BEEPER 84 // Beeper on AUX-4 #define LCD_PINS_RS 82 #define LCD_PINS_ENABLE 61 // !!! changed from 18 (EINY03) From 8842d168321c9cce088a4114a3c6b1b83fba6bfe Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 28 May 2019 13:50:21 +0200 Subject: [PATCH 224/368] add back uvlo tiny z positio --- Firmware/Marlin_main.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 982e21305..7352dae9b 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1008,6 +1008,10 @@ void setup() { mmu_init(); + #ifdef UVLO_SUPPORT + setup_uvlo_interrupt(); + #endif //UVLO_SUPPORT + ultralcd_init(); #if (LCD_BL_PIN != -1) && defined (LCD_BL_PIN) @@ -1296,10 +1300,6 @@ void setup() #endif //TMC2130 - #ifdef UVLO_SUPPORT - setup_uvlo_interrupt(); - #endif //UVLO_SUPPORT - st_init(); // Initialize stepper, this enables interrupts! #ifdef TMC2130 @@ -8686,7 +8686,6 @@ void serialecho_temperatures() { SERIAL_PROTOCOL_F(degBed(), 1); SERIAL_PROTOCOLLN(""); } - extern uint32_t sdpos_atomic; #ifdef UVLO_SUPPORT @@ -8850,9 +8849,11 @@ disable_z(); // Finaly store the "power outage" flag. //if(sd_print) - eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); - -eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS),z_microsteps); +if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==1){ + eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]); + eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS),z_microsteps); +} +eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); // Increment power failure counter eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1); @@ -8923,10 +8924,11 @@ ISR(INT4_vect) { if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny(); } -void recover_print(uint8_t automatic) { +void recover_print(uint8_t automatic) { char cmd[30]; lcd_update_enable(true); lcd_update(2); + lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20 r=1 bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2); recover_machine_state_after_power_panic(bTiny); //recover position, temperatures and extrude_multipliers // Lift the print head, so one may remove the excess priming material. @@ -8964,8 +8966,7 @@ void recover_machine_state_after_power_panic(bool bTiny) // Recover the logical coordinate of the Z axis at the time of the power panic. // The current position after power panic is moved to the next closest 0th full step. if(bTiny){ - current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + - UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; + current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; } else{ current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + @@ -9078,7 +9079,7 @@ void restore_print_from_eeprom() { strcat_P(cmd, PSTR(" F2000")); enquecommand(cmd); // Move the Z axis down to the print, in logical coordinates. - strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(current_position[Z_AXIS] - (UVLO_Z_AXIS_SHIFT + + strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32( eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) - (UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]))); enquecommand(cmd); // Unretract. @@ -9570,7 +9571,7 @@ void M600_load_filament_movements() st_synchronize(); } -void M600_load_filament() { +void M600_load_filament() { //TODO: ----- //load filament for single material and SNMM lcd_wait_interact(); From bcb6129c29e89b7f1c0752ee98f4396d35f1bd33 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 28 May 2019 14:11:38 +0200 Subject: [PATCH 225/368] delete comment --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7352dae9b..0bbe6a4e1 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9571,7 +9571,7 @@ void M600_load_filament_movements() st_synchronize(); } -void M600_load_filament() { //TODO: ----- +void M600_load_filament() { //load filament for single material and SNMM lcd_wait_interact(); From 3b2cbc68d825053e8fed1b81cc42ea1d084f58d6 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 28 May 2019 18:22:34 +0200 Subject: [PATCH 226/368] PFW-571 send PRN:4 instead PRN:1 while changing filament --- Firmware/Marlin_main.cpp | 4 ++++ Firmware/ultralcd.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 982e21305..b61897c79 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3146,6 +3146,10 @@ void gcode_M701() { printf_P(PSTR("gcode_M701 begin\n")); + if (farm_mode){ + prusa_statistics(22); + } + if (mmu_enabled) { extr_adj(tmp_extruder);//loads current extruder diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 97304adb2..ee8522bd9 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -986,6 +986,8 @@ static void lcd_status_screen() { case 8: prusa_statistics(21); + if(loading_flag) + prusa_statistics(22); break; case 5: if (IS_SD_PRINTING) @@ -4145,7 +4147,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { SERIAL_ECHOLN("}"); status_number = 14; } - else if (IS_SD_PRINTING) + else if (IS_SD_PRINTING || loading_flag) { SERIAL_ECHO("{"); prusa_stat_printerstatus(4); @@ -4183,7 +4185,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { status_number = 3; farm_timer = 1; - if (IS_SD_PRINTING) + if (IS_SD_PRINTING || loading_flag) { farm_status = 4; SERIAL_ECHO("{"); From e9c870e7a069ca22964d828853f64a2ea59fba08 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 29 May 2019 20:33:22 +0200 Subject: [PATCH 227/368] fix of fixof power panic --- Firmware/Marlin_main.cpp | 49 +++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0bbe6a4e1..9f25fdb61 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1007,10 +1007,6 @@ static void w25x20cl_err_msg() void setup() { mmu_init(); - - #ifdef UVLO_SUPPORT - setup_uvlo_interrupt(); - #endif //UVLO_SUPPORT ultralcd_init(); @@ -1300,6 +1296,10 @@ void setup() #endif //TMC2130 + #ifdef UVLO_SUPPORT + setup_uvlo_interrupt(); + #endif //UVLO_SUPPORT + st_init(); // Initialize stepper, this enables interrupts! #ifdef TMC2130 @@ -3132,7 +3132,6 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float custom_message_type = CUSTOM_MSG_TYPE_STATUS; } - //! @brief Rise Z if too low to avoid blob/jam before filament loading //! //! It doesn't plan_buffer_line(), as it expects plan_buffer_line() to be called after @@ -8689,7 +8688,7 @@ void serialecho_temperatures() { extern uint32_t sdpos_atomic; #ifdef UVLO_SUPPORT -void uvlo_() +void uvlo_() { unsigned long time_start = _millis(); bool sd_print = card.sdprinting; @@ -8740,8 +8739,7 @@ void uvlo_() // Clean the input command queue. cmdqueue_reset(); card.sdprinting = false; -// card.closefile(); - +// card.closefile(); // Enable stepper driver interrupt to move Z axis. // This should be fine as the planner and command queues are empty and the SD card printing is disabled. //FIXME one may want to disable serial lines at this point of time to avoid interfering with the command queue, @@ -8764,6 +8762,15 @@ void uvlo_() current_position[E_AXIS] - default_retraction, 40, active_extruder); st_synchronize(); + + plan_buffer_line( + current_position[X_AXIS], + current_position[Y_AXIS], + current_position[Z_AXIS] + UVLO_Z_AXIS_SHIFT + float((1024 - z_microsteps + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS], + current_position[E_AXIS] - default_retraction, + 40, active_extruder); + st_synchronize(); + disable_e0(); disable_z(); // Move Z up to the next 0th full step. @@ -8781,9 +8788,10 @@ void uvlo_() // for reaching the zero full step before powering off. eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS), z_microsteps); // Store the current position. + eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0), current_position[X_AXIS]); eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4), current_position[Y_AXIS]); - eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z), current_position[Z_AXIS]); + eeprom_update_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z , current_position[Z_AXIS] + UVLO_Z_AXIS_SHIFT + float((1024 - z_microsteps + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]); // Store the current feed rate, temperatures, fan speed and extruder multipliers (flow rates) EEPROM_save_B(EEPROM_UVLO_FEEDRATE, &feedrate_bckp); eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_HOTEND, target_temperature[active_extruder]); @@ -8817,7 +8825,6 @@ void uvlo_() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder); st_synchronize(); #endif - wdt_enable(WDTO_500MS); WRITE(BEEPER,HIGH); while(1) @@ -8851,8 +8858,13 @@ disable_z(); //if(sd_print) if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==1){ eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]); - eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS),z_microsteps); + eeprom_update_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS),z_microsteps); } + +if(eeprom_read_float((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z) < 0.001f){ + eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), eeprom_read_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z)); +} + eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); // Increment power failure counter @@ -8920,7 +8932,7 @@ void setup_uvlo_interrupt() { ISR(INT4_vect) { EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once SERIAL_ECHOLNPGM("INT4"); - if(IS_SD_PRINTING && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO))) ) uvlo_(); + if((IS_SD_PRINTING || (eeprom_read_byte((uint8_t*)EEPROM_UVLO)!=2)) && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_(); if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny(); } @@ -8966,11 +8978,13 @@ void recover_machine_state_after_power_panic(bool bTiny) // Recover the logical coordinate of the Z axis at the time of the power panic. // The current position after power panic is moved to the next closest 0th full step. if(bTiny){ - current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; + current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)); + + float tinyDelta = 1.25*(mbl.get_z(0, 0) - mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS])); + current_position[Z_AXIS] += tinyDelta; // compensate z-level } else{ - current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + - UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; + current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)); } if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS)) { current_position[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E)); @@ -8986,7 +9000,6 @@ void recover_machine_state_after_power_panic(bool bTiny) // 2) Initialize the logical to physical coordinate system transformation. world2machine_initialize(); - // 3) Restore the mesh bed leveling offsets. This is 2*7*7=98 bytes, which takes 98*3.4us=333us in worst case. mbl.active = false; for (int8_t mesh_point = 0; mesh_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS; ++ mesh_point) { @@ -9079,8 +9092,8 @@ void restore_print_from_eeprom() { strcat_P(cmd, PSTR(" F2000")); enquecommand(cmd); // Move the Z axis down to the print, in logical coordinates. - strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32( eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) - (UVLO_Z_AXIS_SHIFT + - float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]))); + strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32( eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + - (UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]))); enquecommand(cmd); // Unretract. enquecommand_P(PSTR("G1 E" STRINGIFY(2*default_retraction)" F480")); From 878e8664016c8541579d35fd366d631a9854873e Mon Sep 17 00:00:00 2001 From: Voinea Date: Thu, 30 May 2019 17:28:02 +0300 Subject: [PATCH 228/368] Fix Load Filament 5 for MMU2 --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 23571eed2..3d2c2bd22 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5957,7 +5957,7 @@ static void fil_load_menu() if (mmu_enabled) { - MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', extr_adj, 3); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), '5', extr_adj, 4); } MENU_END(); } From 18122049a63690db252bc3ec051cb87a01ce463d Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 30 May 2019 19:36:10 +0200 Subject: [PATCH 229/368] Fix cut filament menu item labels. --- Firmware/ultralcd.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 23571eed2..bfbfd1f99 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6028,11 +6028,11 @@ static void mmu_cut_filament_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '1', mmu_cut_filament, 0); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '2', mmu_cut_filament, 1); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '3', mmu_cut_filament, 2); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '4', mmu_cut_filament, 3); - MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), '5', mmu_cut_filament, 4); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_CUT_FILAMENT), '1', mmu_cut_filament, 0); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_CUT_FILAMENT), '2', mmu_cut_filament, 1); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_CUT_FILAMENT), '3', mmu_cut_filament, 2); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_CUT_FILAMENT), '4', mmu_cut_filament, 3); + MENU_ITEM_FUNCTION_NR_P(_T(MSG_CUT_FILAMENT), '5', mmu_cut_filament, 4); MENU_END(); } else From ccb649b1f6f445bcea735a4a213f2ebd5898a195 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 30 May 2019 20:46:41 +0200 Subject: [PATCH 230/368] Add always cut experimental / for testing feature. --- Firmware/Marlin_main.cpp | 5 ++++- Firmware/eeprom.h | 6 ++++++ Firmware/ultralcd.cpp | 21 ++++++++++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 249147482..82d01e6fe 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7090,8 +7090,11 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } else { +#if defined(MMU_HAS_CUTTER) && defined(MMU_ALWAYS_CUT) + mmu_command(MmuCmd::K0 + tmp_extruder); + manage_response(true, true, MMU_UNLOAD_MOVE); +#endif //defined(MMU_HAS_CUTTER) && defined(MMU_ALWAYS_CUT) mmu_command(MmuCmd::T0 + tmp_extruder); - manage_response(true, true, MMU_TCODE_MOVE); mmu_continue_loading(is_usb_printing); diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index c96e1d8db..899d52359 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -201,5 +201,11 @@ static M500_conf * const EEPROM_M500_base = reinterpret_cast(20); //offset for storing settings using M500 #endif +enum +{ + EEPROM_MMU_CUTTER_ENABLED_enabled = 1, + EEPROM_MMU_CUTTER_ENABLED_always = 2, +}; + #endif // EEPROM_H diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 23571eed2..68b6f7989 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2346,13 +2346,22 @@ void lcd_set_fan_check() { #ifdef MMU_HAS_CUTTER void lcd_cutter_enabled() { - if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + if (EEPROM_MMU_CUTTER_ENABLED_enabled == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + { +#ifndef MMU_ALWAYS_CUT + eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 0); + } +#else //MMU_ALWAYS_CUT + eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, EEPROM_MMU_CUTTER_ENABLED_always); + } + else if (EEPROM_MMU_CUTTER_ENABLED_always == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) { eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 0); } +#endif //MMU_ALWAYS_CUT else { - eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 1); + eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, EEPROM_MMU_CUTTER_ENABLED_enabled); } } #endif //MMU_HAS_CUTTER @@ -5287,10 +5296,16 @@ static bool settingsCutter() { if (mmu_enabled) { - if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + if (EEPROM_MMU_CUTTER_ENABLED_enabled == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) { if (menu_item_function_P(_i("Cutter [on]"), lcd_cutter_enabled)) return true;//// c=17 r=1 } +#ifdef MMU_ALWAYS_CUT + else if (EEPROM_MMU_CUTTER_ENABLED_always == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + { + if (menu_item_function_P(_i("Cutter [always]"), lcd_cutter_enabled)) return true;//// c=17 r=1 + } +#endif else { if (menu_item_function_P(_i("Cutter [off]"), lcd_cutter_enabled)) return true;//// c=17 r=1 From e79c203c965656a4b6fe8bdc2dbf9c0e7c7207d6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 30 May 2019 22:14:13 +0200 Subject: [PATCH 231/368] Do not always cut if it is not enabled from menu. --- Firmware/Marlin_main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 82d01e6fe..557ca34ad 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7091,8 +7091,11 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) else { #if defined(MMU_HAS_CUTTER) && defined(MMU_ALWAYS_CUT) - mmu_command(MmuCmd::K0 + tmp_extruder); - manage_response(true, true, MMU_UNLOAD_MOVE); + if (EEPROM_MMU_CUTTER_ENABLED_always == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) + { + mmu_command(MmuCmd::K0 + tmp_extruder); + manage_response(true, true, MMU_UNLOAD_MOVE); + } #endif //defined(MMU_HAS_CUTTER) && defined(MMU_ALWAYS_CUT) mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); From 00da4640e2c021e09831d0df61c61b63af2008bb Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 30 May 2019 23:29:33 +0200 Subject: [PATCH 232/368] Document. --- Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 7 +++++++ Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 7 +++++++ Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index a0f53fad2..c6fa56e95 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -505,6 +505,13 @@ #define MMU_DEBUG //print communication between MMU2 and printer on serial //#define MMU_HAS_CUTTER +// This is experimental feature requested by our test department. +// There is no known use for ordinary user. If enabled by this macro +// and enabled from printer menu (not enabled by default). It cuts filament +// every time when switching filament from gcode. MMU_HAS_CUTTER needs to be +// defined. + +//#define MMU_ALWAYS_CUT #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning #endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 5946bc801..24f624cd6 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -506,6 +506,13 @@ #define MMU_DEBUG //print communication between MMU2 and printer on serial //#define MMU_HAS_CUTTER +// This is experimental feature requested by our test department. +// There is no known use for ordinary user. If enabled by this macro +// and enabled from printer menu (not enabled by default). It cuts filament +// every time when switching filament from gcode. MMU_HAS_CUTTER needs to be +// defined. + +//#define MMU_ALWAYS_CUT #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning #endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 2cf180a18..81c8788ca 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -627,6 +627,14 @@ #define MMU_HWRESET #define MMU_DEBUG //print communication between MMU2 and printer on serial //#define MMU_HAS_CUTTER + +// This is experimental feature requested by our test department. +// There is no known use for ordinary user. If enabled by this macro +// and enabled from printer menu (not enabled by default). It cuts filament +// every time when switching filament from gcode. MMU_HAS_CUTTER needs to be +// defined. + +//#define MMU_ALWAYS_CUT #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning #endif //__CONFIGURATION_PRUSA_H From 675579177887beb40d2084278e68a90b01f5f690 Mon Sep 17 00:00:00 2001 From: DRracer Date: Fri, 31 May 2019 11:29:11 +0200 Subject: [PATCH 233/368] Fix repeated fan error checking --- Firmware/Marlin_main.cpp | 6 ++- Firmware/temperature.cpp | 82 ++++++++++++++++++++++++++++++---------- Firmware/temperature.h | 3 +- 3 files changed, 67 insertions(+), 24 deletions(-) mode change 100644 => 100755 Firmware/Marlin_main.cpp diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp old mode 100644 new mode 100755 index 557ca34ad..fd1d34ebb --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3391,8 +3391,10 @@ void process_commands() { #ifdef FANCHECK if (fan_check_error){ - fan_check_error = false; - lcd_pause_print(); + if( fan_check_error == EFCE_DETECTED ){ + fan_check_error = EFCE_REPORTED; + lcd_pause_print(); + } // otherwise it has already been reported, so just ignore further processing return; } #endif diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index b245b23ba..1b60a0230 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -95,7 +95,7 @@ float current_temperature_bed = 0.0; #endif #ifdef FANCHECK - volatile bool fan_check_error = false; + volatile uint8_t fan_check_error = EFCE_OK; #endif unsigned char soft_pwm_bed; @@ -489,6 +489,38 @@ void countFanSpeed() fan_edge_counter[1] = 0; } +//#define SIMULATE_FAN_ERRORS +#ifdef SIMULATE_FAN_ERRORS +struct FanSpeedErrorSimulator { + unsigned long lastMillis = 0; + bool state = false; // zatim mam 0 - klid, 1 reportuju chybu + //! @return pocet simulovanych chyb + inline uint8_t step(){ + unsigned long ms = _millis(); + switch(state){ + case false: + if( (ms - lastMillis) > 120000UL ){ // funkcni ventilator chci 2 minuty + state = true; + lastMillis = ms; + SERIAL_ECHOLNPGM("SIM Fan error"); + } + break; + case true: + if( (ms - lastMillis) > 20000UL ){ // vypadek ventilatoru chci uz 20s, + //abych stihl udelat pokusnej resume print, kdyz jeste jsou rozbity vetraky + state = false; + lastMillis = ms; + SERIAL_ECHOLNPGM("SIM Fan ok"); + } + break; + } + return state ? 20 : 0; + } +}; + +static FanSpeedErrorSimulator fanSpeedErrorSimulator; +#endif + void checkFanSpeed() { uint8_t max_print_fan_errors = 0; @@ -512,6 +544,16 @@ void checkFanSpeed() else fan_speed_errors[1] = 0; #endif +#ifdef SIMULATE_FAN_ERRORS + fan_speed_errors[0] = fanSpeedErrorSimulator.step(); +#endif + + // drop the fan_check_error flag when both fans are ok + if( fan_speed_errors[0] == 0 && fan_speed_errors[1] == 0 && fan_check_error == EFCE_REPORTED){ + // we may even send some info to the LCD from here + fan_check_error = EFCE_OK; + } + if ((fan_speed_errors[0] > max_extruder_fan_errors) && fans_check_enabled) { fan_speed_errors[0] = 0; fanSpeedError(0); //extruder fan @@ -522,6 +564,19 @@ void checkFanSpeed() } } +void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){ + SERIAL_ECHOLNRPGM(serialMsg); + if (get_message_level() == 0) { + if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)){ + WRITE(BEEPER, HIGH); + delayMicroseconds(200); + WRITE(BEEPER, LOW); + delayMicroseconds(100); // what is this wait for? + } + LCD_ALERTMESSAGERPGM(lcdMsg); + } +} + void fanSpeedError(unsigned char _fan) { if (get_message_level() != 0 && isPrintPaused) return; //to ensure that target temp. is not set to zero in case taht we are resuming print @@ -530,7 +585,8 @@ void fanSpeedError(unsigned char _fan) { lcd_print_stop(); } else { - fan_check_error = true; + fan_check_error = EFCE_DETECTED; + } } else { @@ -538,27 +594,11 @@ void fanSpeedError(unsigned char _fan) { SERIAL_ECHOLNPGM("// action:pause"); //for octoprint } switch (_fan) { - case 0: - SERIAL_ECHOLNPGM("Extruder fan speed is lower then expected"); - if (get_message_level() == 0) { -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - delayMicroseconds(200); - WRITE(BEEPER, LOW); - delayMicroseconds(100); - LCD_ALERTMESSAGEPGM("Err: EXTR. FAN ERROR"); - } + case 0: // extracting the same code from case 0 and case 1 into a function saves 72B + fanSpeedErrorBeep(PSTR("Extruder fan speed is lower than expected"), PSTR("Err: EXTR. FAN ERROR") ); break; case 1: - SERIAL_ECHOLNPGM("Print fan speed is lower then expected"); - if (get_message_level() == 0) { -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - delayMicroseconds(200); - WRITE(BEEPER, LOW); - delayMicroseconds(100); - LCD_ALERTMESSAGEPGM("Err: PRINT FAN ERROR"); - } + fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") ); break; } } diff --git a/Firmware/temperature.h b/Firmware/temperature.h index 31ab8d9f5..5b22e3a5a 100644 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -238,7 +238,8 @@ void checkExtruderAutoFans(); #if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1)) -extern volatile bool fan_check_error; +enum { EFCE_OK = 0, EFCE_DETECTED, EFCE_REPORTED }; +extern volatile uint8_t fan_check_error; void countFanSpeed(); void checkFanSpeed(); From 09fee4e64de07bcb1b785afc3e0fd4a6d8f92286 Mon Sep 17 00:00:00 2001 From: DRracer Date: Fri, 31 May 2019 11:30:30 +0200 Subject: [PATCH 234/368] remove fan error simulation automaton --- Firmware/temperature.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 1b60a0230..08ff40dbe 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -489,38 +489,6 @@ void countFanSpeed() fan_edge_counter[1] = 0; } -//#define SIMULATE_FAN_ERRORS -#ifdef SIMULATE_FAN_ERRORS -struct FanSpeedErrorSimulator { - unsigned long lastMillis = 0; - bool state = false; // zatim mam 0 - klid, 1 reportuju chybu - //! @return pocet simulovanych chyb - inline uint8_t step(){ - unsigned long ms = _millis(); - switch(state){ - case false: - if( (ms - lastMillis) > 120000UL ){ // funkcni ventilator chci 2 minuty - state = true; - lastMillis = ms; - SERIAL_ECHOLNPGM("SIM Fan error"); - } - break; - case true: - if( (ms - lastMillis) > 20000UL ){ // vypadek ventilatoru chci uz 20s, - //abych stihl udelat pokusnej resume print, kdyz jeste jsou rozbity vetraky - state = false; - lastMillis = ms; - SERIAL_ECHOLNPGM("SIM Fan ok"); - } - break; - } - return state ? 20 : 0; - } -}; - -static FanSpeedErrorSimulator fanSpeedErrorSimulator; -#endif - void checkFanSpeed() { uint8_t max_print_fan_errors = 0; @@ -544,10 +512,6 @@ void checkFanSpeed() else fan_speed_errors[1] = 0; #endif -#ifdef SIMULATE_FAN_ERRORS - fan_speed_errors[0] = fanSpeedErrorSimulator.step(); -#endif - // drop the fan_check_error flag when both fans are ok if( fan_speed_errors[0] == 0 && fan_speed_errors[1] == 0 && fan_check_error == EFCE_REPORTED){ // we may even send some info to the LCD from here From 5985c0608ef0778be6856042a36f17807d2e0cab Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 3 Jun 2019 09:02:27 +0200 Subject: [PATCH 235/368] Revert changes to pins_Einsy_1_0.h not related to the fan check error fix --- Firmware/pins_Einsy_1_0.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Firmware/pins_Einsy_1_0.h b/Firmware/pins_Einsy_1_0.h index 2e05d3263..33363388a 100755 --- a/Firmware/pins_Einsy_1_0.h +++ b/Firmware/pins_Einsy_1_0.h @@ -99,8 +99,7 @@ //#define KILL_PIN 32 -// LCD backlight pin may interfere with something, this is yet to be found out correctly -#define LCD_BL_PIN 5 //backlight control pin +//#define LCD_BL_PIN 5 //backlight control pin #define BEEPER 84 // Beeper on AUX-4 #define LCD_PINS_RS 82 #define LCD_PINS_ENABLE 61 // !!! changed from 18 (EINY03) From 2c4e98dc272a86f8269f7e3168653f2db461b886 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 5 Jun 2019 13:12:08 +0200 Subject: [PATCH 236/368] power panic improvement --- Firmware/Marlin_main.cpp | 76 ++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 9f25fdb61..676b67135 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1296,12 +1296,12 @@ void setup() #endif //TMC2130 - #ifdef UVLO_SUPPORT - setup_uvlo_interrupt(); - #endif //UVLO_SUPPORT - st_init(); // Initialize stepper, this enables interrupts! +#ifdef UVLO_SUPPORT + setup_uvlo_interrupt(); +#endif //UVLO_SUPPORT + #ifdef TMC2130 tmc2130_mode = silentMode?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; update_mode_profile(); @@ -8690,6 +8690,7 @@ extern uint32_t sdpos_atomic; void uvlo_() { + printf_P(_N("******* UVLo 0 Current pos Z_AXIS:%.3f\nCurrent pos Z_AXIS:%.3f\n pos Z_AXIS:%.3f\n"), current_position[Z_AXIS], eeprom_read_float((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z),eeprom_read_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z)); unsigned long time_start = _millis(); bool sd_print = card.sdprinting; // Conserve power as soon as possible. @@ -8735,7 +8736,6 @@ void uvlo_() // Store the current extruder position. eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E), st_get_position_mm(E_AXIS)); eeprom_update_byte((uint8_t*)EEPROM_UVLO_E_ABS, axis_relative_modes[3]?0:1); - // Clean the input command queue. cmdqueue_reset(); card.sdprinting = false; @@ -8762,7 +8762,8 @@ void uvlo_() current_position[E_AXIS] - default_retraction, 40, active_extruder); st_synchronize(); - + disable_e0(); + plan_buffer_line( current_position[X_AXIS], current_position[Y_AXIS], @@ -8791,7 +8792,7 @@ void uvlo_() eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0), current_position[X_AXIS]); eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4), current_position[Y_AXIS]); - eeprom_update_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z , current_position[Z_AXIS] + UVLO_Z_AXIS_SHIFT + float((1024 - z_microsteps + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]); + eeprom_update_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z , current_position[Z_AXIS]); // Store the current feed rate, temperatures, fan speed and extruder multipliers (flow rates) EEPROM_save_B(EEPROM_UVLO_FEEDRATE, &feedrate_bckp); eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_HOTEND, target_temperature[active_extruder]); @@ -8850,19 +8851,19 @@ tmc2130_set_current_r(Z_AXIS, 20); #ifdef TMC2130 z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); #endif //TMC2130 - planner_abort_hard(); disable_z(); // Finaly store the "power outage" flag. //if(sd_print) -if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==1){ +if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)!=2){ eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]); eeprom_update_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS),z_microsteps); } if(eeprom_read_float((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z) < 0.001f){ eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), eeprom_read_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z)); + eeprom_update_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS), eeprom_read_word((uint16_t*)EEPROM_UVLO_Z_MICROSTEPS)); } eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); @@ -8870,7 +8871,6 @@ eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); // Increment power failure counter eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1); eeprom_update_word((uint16_t*)EEPROM_POWER_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) + 1); - wdt_enable(WDTO_500MS); WRITE(BEEPER,HIGH); while(1) @@ -8932,7 +8932,7 @@ void setup_uvlo_interrupt() { ISR(INT4_vect) { EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once SERIAL_ECHOLNPGM("INT4"); - if((IS_SD_PRINTING || (eeprom_read_byte((uint8_t*)EEPROM_UVLO)!=2)) && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_(); + if((IS_SD_PRINTING ) || (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_(); if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny(); } @@ -8941,11 +8941,13 @@ void recover_print(uint8_t automatic) { lcd_update_enable(true); lcd_update(2); lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20 r=1 - bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2); - recover_machine_state_after_power_panic(bTiny); //recover position, temperatures and extrude_multipliers + + bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2); + recover_machine_state_after_power_panic(bTiny); //recover position, temperatures and extrude_multipliers // Lift the print head, so one may remove the excess priming material. - if(!bTiny&&(current_position[Z_AXIS]<25)) + if(!bTiny&&(current_position[Z_AXIS]<25)) enquecommand_P(PSTR("G1 Z25 F800")); + // Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine transformation status. enquecommand_P(PSTR("G28 X Y")); // Set the target bed and nozzle temperatures and wait. @@ -8975,16 +8977,32 @@ void recover_machine_state_after_power_panic(bool bTiny) // The logical XY coordinates are needed to recover the machine Z coordinate corrected by the mesh bed leveling. current_position[X_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0)); current_position[Y_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4)); + + // 2) Restore the mesh bed leveling offsets. This is 2*7*7=98 bytes, which takes 98*3.4us=333us in worst case. + mbl.active = false; + for (int8_t mesh_point = 0; mesh_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS; ++ mesh_point) { + uint8_t ix = mesh_point % MESH_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 + uint8_t iy = mesh_point / MESH_NUM_X_POINTS; + // Scale the z value to 10u resolution. + int16_t v; + eeprom_read_block(&v, (void*)(EEPROM_UVLO_MESH_BED_LEVELING_FULL+2*mesh_point), 2); + if (v != 0) + mbl.active = true; + mbl.z_values[iy][ix] = float(v) * 0.001f; + } + // Recover the logical coordinate of the Z axis at the time of the power panic. // The current position after power panic is moved to the next closest 0th full step. - if(bTiny){ - current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)); - - float tinyDelta = 1.25*(mbl.get_z(0, 0) - mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS])); - current_position[Z_AXIS] += tinyDelta; // compensate z-level + if(bTiny){ + current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) + + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS)) + + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; + current_position[Z_AXIS] -= 0.4*mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS]); } else{ - current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)); + current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) + + UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; } if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS)) { current_position[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E)); @@ -8998,20 +9016,8 @@ void recover_machine_state_after_power_panic(bool bTiny) SERIAL_ECHOPGM("recover_machine_state_after_power_panic, initial "); print_world_coordinates(); - // 2) Initialize the logical to physical coordinate system transformation. + // 3) Initialize the logical to physical coordinate system transformation. world2machine_initialize(); - // 3) Restore the mesh bed leveling offsets. This is 2*7*7=98 bytes, which takes 98*3.4us=333us in worst case. - mbl.active = false; - for (int8_t mesh_point = 0; mesh_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS; ++ mesh_point) { - uint8_t ix = mesh_point % MESH_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 - uint8_t iy = mesh_point / MESH_NUM_X_POINTS; - // Scale the z value to 10u resolution. - int16_t v; - eeprom_read_block(&v, (void*)(EEPROM_UVLO_MESH_BED_LEVELING_FULL+2*mesh_point), 2); - if (v != 0) - mbl.active = true; - mbl.z_values[iy][ix] = float(v) * 0.001f; - } // SERIAL_ECHOPGM("recover_machine_state_after_power_panic, initial "); // print_mesh_bed_leveling_table(); @@ -9092,8 +9098,8 @@ void restore_print_from_eeprom() { strcat_P(cmd, PSTR(" F2000")); enquecommand(cmd); // Move the Z axis down to the print, in logical coordinates. - strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32( eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) - - (UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]))); + eeprom_update_byte((uint8_t*)EEPROM_UVLO,1); + strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)))); enquecommand(cmd); // Unretract. enquecommand_P(PSTR("G1 E" STRINGIFY(2*default_retraction)" F480")); From d263728c37033c577a2309397e5226f2a8aaff28 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 5 Jun 2019 14:55:59 +0200 Subject: [PATCH 237/368] documentation --- Firmware/Marlin_main.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 676b67135..c7b87f1b4 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8690,7 +8690,6 @@ extern uint32_t sdpos_atomic; void uvlo_() { - printf_P(_N("******* UVLo 0 Current pos Z_AXIS:%.3f\nCurrent pos Z_AXIS:%.3f\n pos Z_AXIS:%.3f\n"), current_position[Z_AXIS], eeprom_read_float((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z),eeprom_read_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z)); unsigned long time_start = _millis(); bool sd_print = card.sdprinting; // Conserve power as soon as possible. @@ -8854,18 +8853,21 @@ z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); planner_abort_hard(); disable_z(); -// Finaly store the "power outage" flag. -//if(sd_print) +//save current position only in case, where the printer is moving on Z axis, which is only when EEPROM_UVLO is 1 +//EEPROM_UVLO is 1 after normal uvlo or after recover_print(), when the extruder is moving on Z axis after rehome if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)!=2){ eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]); eeprom_update_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS),z_microsteps); } +//after multiples power panics current Z axis is unknow +//in this case we set EEPROM_UVLO_TINY_CURRENT_POSITION_Z to last know position which is EEPROM_UVLO_CURRENT_POSITION_Z if(eeprom_read_float((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z) < 0.001f){ eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), eeprom_read_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z)); eeprom_update_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS), eeprom_read_word((uint16_t*)EEPROM_UVLO_Z_MICROSTEPS)); } +// Finaly store the "power outage" flag. eeprom_update_byte((uint8_t*)EEPROM_UVLO,2); // Increment power failure counter @@ -8932,6 +8934,8 @@ void setup_uvlo_interrupt() { ISR(INT4_vect) { EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once SERIAL_ECHOLNPGM("INT4"); + //fire normal uvlo only in case where EEPROM_UVLO is 0 or if IS_SD_PRINTING is 1. + //Don't change || to && because in some case the printer can be moving although IS_SD_PRINTING is zero if((IS_SD_PRINTING ) || (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_(); if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny(); } @@ -8997,6 +9001,9 @@ void recover_machine_state_after_power_panic(bool bTiny) current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; + + //after multiples power panics the print is slightly in the air so get it little bit down. + //Not exactly sure why is this happening, but it has something to do with bed leveling and world2machine coordinates current_position[Z_AXIS] -= 0.4*mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS]); } else{ @@ -9097,8 +9104,9 @@ void restore_print_from_eeprom() { strcat_P(cmd, PSTR(" Y")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4)))); strcat_P(cmd, PSTR(" F2000")); enquecommand(cmd); - // Move the Z axis down to the print, in logical coordinates. + //moving on Z axis ahed, set EEPROM_UVLO to 1, so normal uvlo can fire eeprom_update_byte((uint8_t*)EEPROM_UVLO,1); + // Move the Z axis down to the print, in logical coordinates. strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)))); enquecommand(cmd); // Unretract. From 14270ac1f66dc19751a1ed37870647edc4e0a8ba Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 5 Jun 2019 15:10:51 +0200 Subject: [PATCH 238/368] power panic documentation --- Firmware/Marlin_main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c7b87f1b4..3d9ac383d 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8860,7 +8860,7 @@ if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)!=2){ eeprom_update_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS),z_microsteps); } -//after multiples power panics current Z axis is unknow +//after multiple power panics current Z axis is unknow //in this case we set EEPROM_UVLO_TINY_CURRENT_POSITION_Z to last know position which is EEPROM_UVLO_CURRENT_POSITION_Z if(eeprom_read_float((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z) < 0.001f){ eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), eeprom_read_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z)); @@ -9002,7 +9002,7 @@ void recover_machine_state_after_power_panic(bool bTiny) + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS]; - //after multiples power panics the print is slightly in the air so get it little bit down. + //after multiple power panics the print is slightly in the air so get it little bit down. //Not exactly sure why is this happening, but it has something to do with bed leveling and world2machine coordinates current_position[Z_AXIS] -= 0.4*mbl.get_z(current_position[X_AXIS], current_position[Y_AXIS]); } @@ -9104,7 +9104,7 @@ void restore_print_from_eeprom() { strcat_P(cmd, PSTR(" Y")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4)))); strcat_P(cmd, PSTR(" F2000")); enquecommand(cmd); - //moving on Z axis ahed, set EEPROM_UVLO to 1, so normal uvlo can fire + //moving on Z axis ahead, set EEPROM_UVLO to 1, so normal uvlo can fire eeprom_update_byte((uint8_t*)EEPROM_UVLO,1); // Move the Z axis down to the print, in logical coordinates. strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)))); From 0cab2284eaf78ad6841467cc4efacb0a9462a464 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 5 Jun 2019 15:48:10 +0200 Subject: [PATCH 239/368] PFW-874 new firmware alert timeout --- Firmware/Marlin_main.cpp | 2 +- Firmware/util.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b61897c79..cb262e128 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5903,7 +5903,7 @@ Sigma_Exit: SERIAL_PROTOCOLLNRPGM(FW_VERSION_STR_P()); } else if (code_seen('U')) { // Check the firmware version provided. If the firmware version provided by the U code is higher than the currently running firmware, - // pause the print and ask the user to upgrade the firmware. + // pause the print for 30s and ask the user to upgrade the firmware. show_upgrade_dialog_if_version_newer(++ strchr_pointer); } else { SERIAL_ECHOPGM("FIRMWARE_NAME:Prusa-Firmware "); diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 18df92f62..e6a6963e2 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -304,7 +304,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) _tone(BEEPER, 1000); delay_keep_alive(50); _noTone(BEEPER); - lcd_wait_for_click(); + lcd_wait_for_click_delay(30); lcd_update_enable(true); lcd_clear(); lcd_update(0); From aeed49a80e4b409be8406f5c0472a12ebd54b8f9 Mon Sep 17 00:00:00 2001 From: DRracer Date: Wed, 5 Jun 2019 12:19:18 +0200 Subject: [PATCH 240/368] Fix filament runout on optical filament sensors Reworked the IR variant accordingly Some code-size optimization in related functions --- Firmware/Marlin_main.cpp | 33 +++++++++---------- Firmware/fsensor.cpp | 71 +++++++++++++++++++++++++++------------- 2 files changed, 65 insertions(+), 39 deletions(-) mode change 100644 => 100755 Firmware/Marlin_main.cpp mode change 100644 => 100755 Firmware/fsensor.cpp diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp old mode 100644 new mode 100755 index b431d6bb0..02a420be0 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3553,10 +3553,6 @@ void process_commands() enquecommand_P(PSTR("M24")); } #ifdef FILAMENT_SENSOR - else if (code_seen("fsensor_recover_IR")) //! PRUSA fsensor_recover_IR - { - fsensor_restore_print_and_continue_IR(); - } else if (code_seen("fsensor_recover")) //! PRUSA fsensor_recover { fsensor_restore_print_and_continue(); @@ -6591,7 +6587,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) float x_position = current_position[X_AXIS]; float y_position = current_position[Y_AXIS]; - float z_shift = 0; + float z_shift = 0; // is it necessary to be a float? float e_shift_init = 0; float e_shift_late = 0; bool automatic = false; @@ -6628,8 +6624,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) else { #ifdef FILAMENTCHANGE_ZADD - z_shift= FILAMENTCHANGE_ZADD ; - if(current_position[Z_AXIS] < 25) z_shift+= 25 ; + static_assert(Z_MAX_POS < (255 - FILAMENTCHANGE_ZADD), "Z-range too high, change the following code from uint8_t to uint16_t"); + // avoid floating point arithmetics when not necessary - results in shorter code + uint8_t ztmp = uint8_t( current_position[Z_AXIS] ); + if(ztmp < uint8_t(25)){ + z_shift = uint8_t(25) - ztmp; // make sure to be at least 25mm above the heat bed + } + z_shift += FILAMENTCHANGE_ZADD ; // always move above printout #endif } //Move XY to side @@ -9273,22 +9274,20 @@ void stop_and_save_print_to_ram(float z_move, float e_move) // First unretract (relative extrusion) if(!saved_extruder_relative_mode){ - strcpy_P(buf, PSTR("M83")); - enquecommand(buf, false); + enquecommand(PSTR("M83"), true); } //retract 45mm/s - strcpy_P(buf, PSTR("G1 E")); - dtostrf(e_move, 6, 3, buf + strlen(buf)); - strcat_P(buf, PSTR(" F")); - dtostrf(2700, 8, 3, buf + strlen(buf)); + // A single sprintf may not be faster, but is definitely 20B shorter + // than a sequence of commands building the string piece by piece + // A snprintf would have been a safer call, but since it is not used + // in the whole program, its implementation would bring more bytes to the total size + // The behavior of dtostrf 8,3 should be roughly the same as %-0.3 + sprintf_P(buf, PSTR("G1 E%-0.3f F2700"), e_move); enquecommand(buf, false); // Then lift Z axis - strcpy_P(buf, PSTR("G1 Z")); - dtostrf(saved_pos[Z_AXIS] + z_move, 8, 3, buf + strlen(buf)); - strcat_P(buf, PSTR(" F")); - dtostrf(homing_feedrate[Z_AXIS], 8, 3, buf + strlen(buf)); + sprintf_P(buf, PSTR("G1 Z%-0.3f F%-0.3f"), saved_pos[Z_AXIS] + z_move, homing_feedrate[Z_AXIS]); // At this point the command queue is empty. enquecommand(buf, false); // If this call is invoked from the main Arduino loop() function, let the caller know that the command diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp old mode 100644 new mode 100755 index f9ca89099..fd7936ee9 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -123,17 +123,12 @@ void fsensor_stop_and_save_print(void) stop_and_save_print_to_ram(0, 0); //XYZE - no change } -void fsensor_restore_print_and_continue_IR(void) -{ - fsensor_watch_runout = true; - fsensor_err_cnt = 0; - fsensor_m600_enqueued = false; -} - void fsensor_restore_print_and_continue(void) { printf_P(PSTR("fsensor_restore_print_and_continue\n")); - fsensor_restore_print_and_continue_IR(); + fsensor_watch_runout = true; + fsensor_err_cnt = 0; + fsensor_m600_enqueued = false; restore_print_from_ram_and_continue(0); //XYZ = orig, E - no change } @@ -527,6 +522,47 @@ void fsensor_st_block_chunk(block_t* bl, int cnt) } } +//! This ensures generating z-position at least 25mm above the heat bed. +//! Making this a template enables changing the computation data type easily at all spots where necessary. +//! @param current_z current z-position +//! @return z-position at least 25mm above the heat bed plus FILAMENTCHANGE_ZADD +template +inline T fsensor_clamp_z(float current_z){ + T z( current_z ); + if(z < T(25)){ // make sure the compiler understands, that the constant 25 is of correct type + // - necessary for uint8_t -> results in shorter code + z = T(25); // move to at least 25mm above heat bed + } + return z + T(FILAMENTCHANGE_ZADD); // always move above the printout by FILAMENTCHANGE_ZADD (default 2mm) +} + +//! Common code for enqueing M600 and supplemental codes into the command queue. +//! Used both for the IR sensor and the PAT9125 +void fsensor_enque_M600(){ + printf_P(PSTR("fsensor_update - M600\n")); + eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); + eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); + enquecommand_front_P(PSTR("PRUSA fsensor_recover")); + fsensor_m600_enqueued = true; + enquecommand_front_P((PSTR("M600"))); +#define xstr(a) str(a) +#define str(a) #a + static const char gcodeMove[] PROGMEM = + "G1 X" xstr(FILAMENTCHANGE_XPOS) + " Y" xstr(FILAMENTCHANGE_YPOS) + " Z%u"; +#undef str +#undef xstr + char buf[32]; + // integer arithmetics is far shorter, I don't need a precise float position here, just move a bit above + // 8bit arithmetics in fsensor_clamp_z is 10B shorter than 16bit (not talking about float ;) ) + // The compile-time static_assert here ensures, that the computation gets enough bits in case of Z-range too high, + // i.e. makes the user change the data type, which also results in larger code + static_assert(Z_MAX_POS < (255 - FILAMENTCHANGE_ZADD), "Z-range too high, change fsensor_clamp_z to "); + sprintf_P(buf, gcodeMove, fsensor_clamp_z(current_position[Z_AXIS]) ); + enquecommand_front(buf, false); +} + //! @brief filament sensor update (perform M600 on filament runout) //! //! Works only if filament sensor is enabled. @@ -535,7 +571,7 @@ void fsensor_st_block_chunk(block_t* bl, int cnt) void fsensor_update(void) { #ifdef PAT9125 - if (fsensor_enabled && fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX)) + if (fsensor_enabled && fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX) && ( ! fsensor_m600_enqueued) ) { bool autoload_enabled_tmp = fsensor_autoload_enabled; fsensor_autoload_enabled = false; @@ -575,11 +611,7 @@ void fsensor_update(void) } else { - printf_P(PSTR("fsensor_update - M600\n")); - eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); - eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); - enquecommand_front_P(PSTR("PRUSA fsensor_recover")); - enquecommand_front_P((PSTR("M600"))); + fsensor_enque_M600(); fsensor_watch_runout = false; } fsensor_autoload_enabled = autoload_enabled_tmp; @@ -587,14 +619,9 @@ void fsensor_update(void) } #else //PAT9125 if ((digitalRead(IR_SENSOR_PIN) == 1) && CHECK_FSENSOR && fsensor_enabled && ir_sensor_detected && ( ! fsensor_m600_enqueued) ) - { // just plan a simple M600 without any additional position save/restore, - // which caused weird heating issues standing directly over the print - printf_P(PSTR("fsensor_update - M600\n")); - eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); - eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); - enquecommand_front_P(PSTR("PRUSA fsensor_recover_IR")); - fsensor_m600_enqueued = true; - enquecommand_front_P((PSTR("M600"))); + { + fsensor_stop_and_save_print(); + fsensor_enque_M600(); } #endif //PAT9125 } From 9c3bb14baeb87eb4adac28d20aa050428726c51d Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 5 Jun 2019 18:34:10 +0200 Subject: [PATCH 241/368] remove function forward decl: fsensor_restore_print_and_continue_IR revert LCD_BL_PIN change --- Firmware/fsensor.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) mode change 100644 => 100755 Firmware/fsensor.h diff --git a/Firmware/fsensor.h b/Firmware/fsensor.h old mode 100644 new mode 100755 index 421eee439..fa7ab5854 --- a/Firmware/fsensor.h +++ b/Firmware/fsensor.h @@ -18,9 +18,7 @@ extern bool fsensor_oq_meassure_enabled; //! @name save restore printing //! @{ extern void fsensor_stop_and_save_print(void); -//! special handling for the IR sensor (no restore position and heating, since this is already correctly handled in the M600 itself) -extern void fsensor_restore_print_and_continue_IR(void); -//! legacy restore print - restore position and heatup to original temperature - for the MMU and the optical fsensor +//! restore print - restore position and heatup to original temperature extern void fsensor_restore_print_and_continue(void); //! @} From 19351df8a72c9344ae984e42e432689a69c287d3 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 5 Jun 2019 18:34:26 +0200 Subject: [PATCH 242/368] Extracted computation of z_shift for M600 into a separate function to improve readability. Surprisingly, also the code got shorter. --- Firmware/Marlin_main.cpp | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 02a420be0..c4683da26 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3001,6 +3001,32 @@ void gcode_M114() SERIAL_PROTOCOLLN(""); } +//! extracted code to compute z_shift for M600 in case of filament change operation +//! requested from fsensors. +//! The function ensures, that the printhead lifts to at least 25mm above the heat bed +//! unlike the previous implementation, which was adding 25mm even when the head was +//! printing at e.g. 24mm height. +//! A safety margin of FILAMENTCHANGE_ZADD is added in all cases to avoid touching +//! the printout. +//! This function is templated to enable fast change of computation data type. +//! @return new z_shift value +template +static T gcode_M600_filament_change_z_shift() +{ +#ifdef FILAMENTCHANGE_ZADD + static_assert(Z_MAX_POS < (255 - FILAMENTCHANGE_ZADD), "Z-range too high, change the T type from uint8_t to uint16_t"); + // avoid floating point arithmetics when not necessary - results in shorter code + T ztmp = T( current_position[Z_AXIS] ); + T z_shift = 0; + if(ztmp < T(25)){ + z_shift = T(25) - ztmp; // make sure to be at least 25mm above the heat bed + } + return z_shift + T(FILAMENTCHANGE_ZADD); // always move above printout +#else + return T(0); +#endif +} + static void gcode_M600(bool automatic, float x_position, float y_position, float z_shift, float e_shift, float /*e_shift_late*/) { st_synchronize(); @@ -6623,15 +6649,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } else { - #ifdef FILAMENTCHANGE_ZADD - static_assert(Z_MAX_POS < (255 - FILAMENTCHANGE_ZADD), "Z-range too high, change the following code from uint8_t to uint16_t"); - // avoid floating point arithmetics when not necessary - results in shorter code - uint8_t ztmp = uint8_t( current_position[Z_AXIS] ); - if(ztmp < uint8_t(25)){ - z_shift = uint8_t(25) - ztmp; // make sure to be at least 25mm above the heat bed - } - z_shift += FILAMENTCHANGE_ZADD ; // always move above printout - #endif + z_shift = gcode_M600_filament_change_z_shift(); } //Move XY to side if(code_seen('X')) From 1d8c24e8a9877eaf97240b73f53d69650f1093af Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 5 Jun 2019 19:22:04 +0200 Subject: [PATCH 243/368] "disable_z()" for Delta PSU IV correction for (motor) mode switching --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 13 +++++++++++-- Firmware/tmc2130.cpp | 7 ++++++- Firmware/tmc2130.h | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 1516941b9..149d32981 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -174,6 +174,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); #ifdef PSU_Delta void init_force_z(); +void check_force_z(); #undef disable_z() #define disable_z() disable_force_z() void disable_force_z(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 8aa2c6c8d..2b873354f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1279,6 +1279,9 @@ void setup() update_mode_profile(); tmc2130_init(); #endif //TMC2130 +#ifdef PSU_Delta + init_force_z(); // ! important for correct Z-axis initialization +#endif // PSU_Delta setup_photpin(); @@ -9613,6 +9616,12 @@ bEnableForce_z=true; // "true"-value enforce "disab disable_force_z(); } +void check_force_z() +{ +if(!(bEnableForce_z||eeprom_read_byte((uint8_t*)EEPROM_SILENT))) + init_force_z(); // causes enforced switching into disable-state +} + void disable_force_z() { uint16_t z_microsteps=0; @@ -9639,7 +9648,7 @@ st_synchronize(); #ifdef TMC2130 tmc2130_mode=TMC2130_MODE_SILENT; update_mode_profile(); -tmc2130_init(); +tmc2130_init(true); #endif // TMC2130 axis_known_position[Z_AXIS]=false; @@ -9656,7 +9665,7 @@ bEnableForce_z=true; #ifdef TMC2130 tmc2130_mode=eeprom_read_byte((uint8_t*)EEPROM_SILENT)?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; update_mode_profile(); -tmc2130_init(); +tmc2130_init(true); #endif // TMC2130 WRITE(Z_ENABLE_PIN,Z_ENABLE_ON); // slightly redundant ;-p diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 8cd3422a9..7c35815cf 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -143,7 +143,7 @@ uint16_t __tcoolthrs(uint8_t axis) return 0; } -void tmc2130_init() +void tmc2130_init(bool bSupressFlag=false) { // DBG(_n("tmc2130_init(), mode=%S\n"), tmc2130_mode?_n("STEALTH"):_n("NORMAL")); WRITE(X_TMC2130_CS, HIGH); @@ -216,6 +216,11 @@ void tmc2130_init() tmc2130_set_wave(E_AXIS, 247, tmc2130_wave_fac[E_AXIS]); #endif //TMC2130_LINEARITY_CORRECTION +#ifdef PSU_Delta + if(!bSupressFlag) + check_force_z(); +#endif // PSU_Delta + } uint8_t tmc2130_sample_diag() diff --git a/Firmware/tmc2130.h b/Firmware/tmc2130.h index 1c854f79c..a1d160f05 100644 --- a/Firmware/tmc2130.h +++ b/Firmware/tmc2130.h @@ -51,7 +51,7 @@ typedef struct extern tmc2130_chopper_config_t tmc2130_chopper_config[4]; //initialize tmc2130 -extern void tmc2130_init(); +extern void tmc2130_init(bool bSupressFlag=false); //check diag pins (called from stepper isr) extern void tmc2130_st_isr(); //update stall guard (called from st_synchronize inside the loop) From 83578c3389352a9ef7b7358b00b75be4213d257e Mon Sep 17 00:00:00 2001 From: DRracer Date: Thu, 6 Jun 2019 15:50:13 +0200 Subject: [PATCH 244/368] documentation + minor code cleanup based on code review --- Firmware/temperature.cpp | 6 +++++- Firmware/temperature.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) mode change 100644 => 100755 Firmware/temperature.h diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 08ff40dbe..9c49cf79c 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -528,7 +528,11 @@ void checkFanSpeed() } } -void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){ +//! Prints serialMsg to serial port, displays lcdMsg onto the LCD and beeps. +//! Extracted from fanSpeedError to save some space. +//! @param serialMsg pointer into PROGMEM, this text will be printed to the serial port +//! @param lcdMsg pointer into PROGMEM, this text will be printed onto the LCD +static void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){ SERIAL_ECHOLNRPGM(serialMsg); if (get_message_level() == 0) { if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)){ diff --git a/Firmware/temperature.h b/Firmware/temperature.h old mode 100644 new mode 100755 index 5b22e3a5a..27a7e713d --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -238,7 +238,11 @@ void checkExtruderAutoFans(); #if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1)) -enum { EFCE_OK = 0, EFCE_DETECTED, EFCE_REPORTED }; +enum { + EFCE_OK = 0, //!< normal operation, both fans are ok + EFCE_DETECTED, //!< fan error detected, but not reported yet + EFCE_REPORTED //!< fan error detected and reported to LCD and serial +}; extern volatile uint8_t fan_check_error; void countFanSpeed(); From bb980e2fca7619932857890013dd03595cf2a227 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 10 Jun 2019 15:03:52 +0200 Subject: [PATCH 245/368] sound edit, delete mute mode, add blind mode --- Firmware/Marlin_main.cpp | 58 +++++++------------------------ Firmware/lcd.cpp | 5 +-- Firmware/menu.cpp | 12 +++++-- Firmware/mmu.cpp | 2 +- Firmware/sound.cpp | 73 ++++++++++++++++++++++++++++++++++++---- Firmware/sound.h | 8 +++-- Firmware/temperature.cpp | 23 +++---------- Firmware/ultralcd.cpp | 63 +++++++++++++++++++++++++--------- Firmware/util.cpp | 10 ++---- 9 files changed, 150 insertions(+), 104 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a1740b240..1887c5535 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -659,19 +659,13 @@ static void factory_reset(char level) // Level 0: Language reset case 0: -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); + Sound_MakeCustom(100,0,false); lang_reset(); break; //Level 1: Reset statistics case 1: -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); + Sound_MakeCustom(100,0,false); eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0); eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0); @@ -726,11 +720,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) fsensor_enable(); fsensor_autoload_set(true); #endif //FILAMENT_SENSOR - -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); + Sound_MakeCustom(100,0,false); //_delay_ms(2000); break; @@ -740,11 +730,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) lcd_puts_P(PSTR("Factory RESET")); lcd_puts_at_P(1, 2, PSTR("ERASING all data")); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); - + Sound_MakeCustom(100,0,false); er_progress = 0; lcd_puts_at_P(3, 3, PSTR(" ")); lcd_set_cursor(3, 3); @@ -814,7 +800,7 @@ void factory_reset() SET_OUTPUT(BEEPER); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) + if(eSoundMode!=e_SOUND_MODE_SILENT) WRITE(BEEPER, HIGH); while (!READ(BTN_ENC)); @@ -2356,11 +2342,7 @@ void refresh_cmd_timeout(void) #endif //FWRETRACT void trace() { -//if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 440); - _delay(25); - _noTone(BEEPER); - _delay(20); + Sound_MakeCustom(25,440,true); } /* void ramming() { @@ -3173,9 +3155,7 @@ void gcode_M701() load_filament_final_feed(); //slow sequence st_synchronize(); - if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) _tone(BEEPER, 500); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,500,false); if (!farm_mode && loading_flag) { lcd_load_filament_color_check(); @@ -3706,7 +3686,7 @@ void process_commands() SET_OUTPUT(BEEPER); if (counterBeep== 0){ -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) +if(eSoundMode!=e_SOUND_MODE_SILENT) WRITE(BEEPER,HIGH); } @@ -6372,10 +6352,7 @@ Sigma_Exit: if (beepS > 0) { #if BEEPER > 0 -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, beepS); - _delay(beepP); - _noTone(BEEPER); + Sound_MakeCustom(beepP,beepS,false); #endif } else @@ -7674,10 +7651,7 @@ bool bInhibitFlag; //-// if (degHotend0() > EXTRUDE_MINTEMP) if(0) { - if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE)) - _tone(BEEPER, 1000); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); loading_flag = true; enquecommand_front_P((PSTR("M701"))); } @@ -9509,7 +9483,7 @@ void M600_wait_for_user(float HotendTempBckp) { } SET_OUTPUT(BEEPER); if (counterBeep == 0) { - if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) + if((eSoundMode==e_SOUND_MODE_BLIND)|| (eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) { bFirst=false; WRITE(BEEPER, HIGH); @@ -9612,10 +9586,7 @@ void M600_load_filament() { #ifdef FILAMENT_SENSOR if (fsensor_check_autoload()) { -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 1000); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); break; } #endif //FILAMENT_SENSOR @@ -9631,10 +9602,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) M600_load_filament_movements(); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 500); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); #ifdef FSENSOR_QUALITY fsensor_oq_meassure_stop(); diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index e5d020c0b..5bd7cad67 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -704,15 +704,12 @@ uint8_t lcd_clicked(void) void lcd_beeper_quick_feedback(void) { - SET_OUTPUT(BEEPER); //-// Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); /* for(int8_t i = 0; i < 10; i++) { - WRITE(BEEPER,HIGH); - delayMicroseconds(100); - WRITE(BEEPER,LOW); + Sound_MakeCustom(100,0,false); delayMicroseconds(100); } */ diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 847e63c80..347f34a96 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -11,8 +11,7 @@ #include "ultralcd.h" #include "language.h" #include "static_assert.h" - - +#include "sound.h" extern int32_t lcd_encoder; @@ -65,7 +64,11 @@ void menu_goto(menu_func_t menu, const uint32_t encoder, const bool feedback, bo void menu_start(void) { if (lcd_encoder > 0x8000) lcd_encoder = 0; - if (lcd_encoder < 0) lcd_encoder = 0; + if (lcd_encoder < 0) + { + lcd_encoder = 0; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); + } if (lcd_encoder < menu_top) menu_top = lcd_encoder; menu_line = menu_top; @@ -75,7 +78,10 @@ void menu_start(void) void menu_end(void) { if (lcd_encoder >= menu_item) + { lcd_encoder = menu_item - 1; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); + } if (((uint8_t)lcd_encoder) >= menu_top + LCD_HEIGHT) { menu_top = lcd_encoder - LCD_HEIGHT + 1; diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 916b3d0fd..adf5da4c5 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -831,7 +831,7 @@ void mmu_M600_wait_and_beep() { } SET_OUTPUT(BEEPER); if (counterBeep == 0) { - if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) + if((eSoundMode==e_SOUND_MODE_BLIND)|| (eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) { bFirst=false; WRITE(BEEPER, HIGH); diff --git a/Firmware/sound.cpp b/Firmware/sound.cpp index ba6ea726a..b84c6e60b 100644 --- a/Firmware/sound.cpp +++ b/Firmware/sound.cpp @@ -17,7 +17,8 @@ static void Sound_SaveMode(void); static void Sound_DoSound_Echo(void); static void Sound_DoSound_Prompt(void); static void Sound_DoSound_Alert(bool bOnce); - +static void Sound_DoSound_Encoder_Move(void); +static void Sound_DoSound_Blind_Alert(void); void Sound_Init(void) { @@ -49,9 +50,9 @@ switch(eSoundMode) eSoundMode=e_SOUND_MODE_SILENT; break; case e_SOUND_MODE_SILENT: - eSoundMode=e_SOUND_MODE_MUTE; + eSoundMode=e_SOUND_MODE_BLIND; break; - case e_SOUND_MODE_MUTE: + case e_SOUND_MODE_BLIND: eSoundMode=e_SOUND_MODE_LOUD; break; default: @@ -60,6 +61,36 @@ switch(eSoundMode) Sound_SaveMode(); } +void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ + if (!critical){ + if (eSoundMode != e_SOUND_MODE_SILENT){ + if(!tone_){ + WRITE(BEEPER, HIGH); + delayMicroseconds(ms); + WRITE(BEEPER, LOW); + } + else{ + _tone(BEEPER, tone_); + delay_keep_alive(ms); + _noTone(BEEPER); + } + } + } + else{ + if(!tone_){ + WRITE(BEEPER, HIGH); + delayMicroseconds(ms); + WRITE(BEEPER, LOW); + delayMicroseconds(100); + } + else{ + _tone(BEEPER, tone_); + delay_keep_alive(ms); + _noTone(BEEPER); + } + } +} + void Sound_MakeSound(eSOUND_TYPE eSoundType) { switch(eSoundMode) @@ -84,13 +115,43 @@ switch(eSoundMode) if(eSoundType==e_SOUND_TYPE_StandardAlert) Sound_DoSound_Alert(true); break; - case e_SOUND_MODE_MUTE: - break; + case e_SOUND_MODE_BLIND: + if(eSoundType==e_SOUND_TYPE_ButtonEcho) + Sound_DoSound_Echo(); + if(eSoundType==e_SOUND_TYPE_StandardPrompt) + Sound_DoSound_Prompt(); + if(eSoundType==e_SOUND_TYPE_StandardAlert) + Sound_DoSound_Alert(false); + if(eSoundType==e_SOUND_TYPE_EncoderMove) + Sound_DoSound_Encoder_Move(); + if(eSoundType==e_SOUND_TYPE_BlindAlert) + Sound_DoSound_Blind_Alert(); + break; default: - ; + break; } } +static void Sound_DoSound_Blind_Alert(void) +{ + _tone(BEEPER,100); + delay_keep_alive(50); + _noTone(BEEPER); + delay_keep_alive(200); +} + + static void Sound_DoSound_Encoder_Move(void) +{ +uint8_t nI; + + for(nI=0;nI<5;nI++) + { + WRITE(BEEPER,HIGH); + delayMicroseconds(75); + WRITE(BEEPER,LOW); + delayMicroseconds(75); + } +} static void Sound_DoSound_Echo(void) { diff --git a/Firmware/sound.h b/Firmware/sound.h index 479f113e9..2c14dfee6 100644 --- a/Firmware/sound.h +++ b/Firmware/sound.h @@ -1,3 +1,4 @@ +#include #ifndef SOUND_H #define SOUND_H @@ -5,16 +6,16 @@ #define MSG_SOUND_MODE_LOUD "Sound [loud]" #define MSG_SOUND_MODE_ONCE "Sound [once]" #define MSG_SOUND_MODE_SILENT "Sound [silent]" -#define MSG_SOUND_MODE_MUTE "Sound [mute]" +#define MSG_SOUND_MODE_BLIND "Sound [blind]" #define e_SOUND_MODE_NULL 0xFF typedef enum - {e_SOUND_MODE_LOUD,e_SOUND_MODE_ONCE,e_SOUND_MODE_SILENT,e_SOUND_MODE_MUTE} eSOUND_MODE; + {e_SOUND_MODE_LOUD,e_SOUND_MODE_ONCE,e_SOUND_MODE_SILENT,e_SOUND_MODE_BLIND} eSOUND_MODE; #define e_SOUND_MODE_DEFAULT e_SOUND_MODE_LOUD typedef enum - {e_SOUND_TYPE_ButtonEcho,e_SOUND_TYPE_EncoderEcho,e_SOUND_TYPE_StandardPrompt,e_SOUND_TYPE_StandardConfirm,e_SOUND_TYPE_StandardWarning,e_SOUND_TYPE_StandardAlert} eSOUND_TYPE; + {e_SOUND_TYPE_ButtonEcho,e_SOUND_TYPE_EncoderEcho,e_SOUND_TYPE_StandardPrompt,e_SOUND_TYPE_StandardConfirm,e_SOUND_TYPE_StandardWarning,e_SOUND_TYPE_StandardAlert,e_SOUND_TYPE_EncoderMove,e_SOUND_TYPE_BlindAlert} eSOUND_TYPE; typedef enum {e_SOUND_CLASS_Echo,e_SOUND_CLASS_Prompt,e_SOUND_CLASS_Confirm,e_SOUND_CLASS_Warning,e_SOUND_CLASS_Alert} eSOUND_CLASS; @@ -27,6 +28,7 @@ extern void Sound_Default(void); extern void Sound_Save(void); extern void Sound_CycleState(void); extern void Sound_MakeSound(eSOUND_TYPE eSoundType); +extern void Sound_MakeCustom(uint16_t ms,uint16_t tone_ ,bool critical); //static void Sound_DoSound_Echo(void); //static void Sound_DoSound_Prompt(void); diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 668b857fd..6796f8d23 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -541,22 +541,14 @@ void fanSpeedError(unsigned char _fan) { case 0: SERIAL_ECHOLNPGM("Extruder fan speed is lower then expected"); if (get_message_level() == 0) { -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - delayMicroseconds(200); - WRITE(BEEPER, LOW); - delayMicroseconds(100); + Sound_MakeCustom(200,0,true); LCD_ALERTMESSAGEPGM("Err: EXTR. FAN ERROR"); } break; case 1: SERIAL_ECHOLNPGM("Print fan speed is lower then expected"); if (get_message_level() == 0) { -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - delayMicroseconds(200); - WRITE(BEEPER, LOW); - delayMicroseconds(100); + Sound_MakeCustom(200,0,true); LCD_ALERTMESSAGEPGM("Err: PRINT FAN ERROR"); } break; @@ -1398,13 +1390,9 @@ void temp_runaway_stop(bool isPreheat, bool isBed) disable_e2(); manage_heater(); lcd_update(0); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - delayMicroseconds(500); - WRITE(BEEPER, LOW); - delayMicroseconds(100); - - if (isPreheat) + Sound_MakeCustom(200,0,true); + + if (isPreheat) { Stop(); isBed ? LCD_ALERTMESSAGEPGM("BED PREHEAT ERROR") : LCD_ALERTMESSAGEPGM("PREHEAT ERROR"); @@ -1489,7 +1477,6 @@ void max_temp_error(uint8_t e) { SET_OUTPUT(BEEPER); WRITE(FAN_PIN, 1); WRITE(EXTRUDER_0_AUTO_FAN_PIN, 1); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) WRITE(BEEPER, 1); // fanSpeed will consumed by the check_axes_activity() routine. fanSpeed=255; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 97304adb2..a9957c259 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2867,10 +2867,12 @@ void lcd_alright() { if (cursor_pos > 3) { cursor_pos = 3; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); } if (cursor_pos < 1) { cursor_pos = 1; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); } lcd_set_cursor(0, 1); lcd_print(" "); @@ -2881,6 +2883,7 @@ void lcd_alright() { lcd_set_cursor(0, cursor_pos); lcd_print(">"); enc_dif = lcd_encoder_diff; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); _delay(100); } @@ -2888,7 +2891,7 @@ void lcd_alright() { if (lcd_clicked()) { - + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); lcd_change_fil_state = cursor_pos; _delay(500); @@ -3845,20 +3848,24 @@ int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool lcd_set_cursor(7, 3); lcd_puts_P((PSTR(">"))); yes = false; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); } else if (enc_dif > lcd_encoder_diff && !yes) { lcd_puts_P((PSTR(">"))); lcd_set_cursor(7, 3); lcd_puts_P((PSTR(" "))); yes = true; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); } enc_dif = lcd_encoder_diff; } else { + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); break; //turning knob skips waiting loop } } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); if (msg_next == NULL) { //KEEPALIVE_STATE(IN_HANDLER); lcd_set_custom_characters(); @@ -3931,16 +3938,20 @@ int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow lcd_set_cursor(0, 3); lcd_puts_P((PSTR(">"))); yes = false; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); + } else if (enc_dif > lcd_encoder_diff && !yes) { lcd_puts_P((PSTR(">"))); lcd_set_cursor(0, 3); lcd_puts_P((PSTR(" "))); yes = true; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); } enc_dif = lcd_encoder_diff; } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); KEEPALIVE_STATE(IN_HANDLER); return yes; } @@ -5441,8 +5452,8 @@ do\ case e_SOUND_MODE_SILENT:\ MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set);\ break;\ - case e_SOUND_MODE_MUTE:\ - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_MUTE),lcd_sound_state_set);\ + case e_SOUND_MODE_BLIND:\ + MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_BLIND),lcd_sound_state_set);\ break;\ default:\ MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);\ @@ -5620,10 +5631,12 @@ void bowden_menu() { if (cursor_pos > 3) { cursor_pos = 3; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); } if (cursor_pos < 0) { cursor_pos = 0; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); } lcd_set_cursor(0, 0); @@ -5636,13 +5649,13 @@ void bowden_menu() { lcd_print(" "); lcd_set_cursor(0, cursor_pos); lcd_print(">"); - + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); enc_dif = lcd_encoder_diff; _delay(100); } if (lcd_clicked()) { - + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); lcd_clear(); while (1) { @@ -5673,6 +5686,7 @@ void bowden_menu() { } _delay(100); if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); EEPROM_save_B(EEPROM_BOWDEN_LENGTH + cursor_pos * 2, &bowden_length[cursor_pos]); if (lcd_show_fullscreen_message_yes_no_and_wait_P(PSTR("Continue with another bowden?"))) { lcd_update_enable(true); @@ -5718,8 +5732,14 @@ static char snmm_stop_print_menu() { //menu for choosing which filaments will be if ((abs(enc_dif - lcd_encoder_diff)) > 1) { if (enc_dif > lcd_encoder_diff) cursor_pos--; if (enc_dif < lcd_encoder_diff) cursor_pos++; - if (cursor_pos > 3) cursor_pos = 3; - if (cursor_pos < 1) cursor_pos = 1; + if (cursor_pos > 3) { + cursor_pos = 3; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); + } + if (cursor_pos < 1){ + cursor_pos = 1; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); + } lcd_set_cursor(0, 1); lcd_print(" "); @@ -5730,10 +5750,12 @@ static char snmm_stop_print_menu() { //menu for choosing which filaments will be lcd_set_cursor(0, cursor_pos); lcd_print(">"); enc_dif = lcd_encoder_diff; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); _delay(100); } } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); KEEPALIVE_STATE(IN_HANDLER); return(cursor_pos - 1); } @@ -5785,7 +5807,8 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite } if (cursor_pos > 3) - { + { + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); cursor_pos = 3; if (first < items_no - 3) { @@ -5796,6 +5819,7 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite if (cursor_pos < 1) { + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); cursor_pos = 1; if (first > 0) { @@ -5830,11 +5854,12 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite lcd_print(" "); lcd_set_cursor(0, cursor_pos); lcd_print(">"); - + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); _delay(100); if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); KEEPALIVE_STATE(IN_HANDLER); lcd_encoder_diff = 0; return(cursor_pos + first - 1); @@ -5889,6 +5914,7 @@ char reset_menu() { if (cursor_pos > 3) { cursor_pos = 3; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); if (first < items_no - 4) { first++; lcd_clear(); @@ -5897,6 +5923,7 @@ char reset_menu() { if (cursor_pos < 0) { cursor_pos = 0; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); if (first > 0) { first--; lcd_clear(); @@ -5912,6 +5939,7 @@ char reset_menu() { lcd_print(" "); lcd_set_cursor(0, cursor_pos); lcd_print(">"); + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); enc_dif = lcd_encoder_diff; _delay(100); } @@ -5919,6 +5947,7 @@ char reset_menu() { } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); return(cursor_pos + first); } @@ -6227,6 +6256,7 @@ unsigned char lcd_choose_color() { if (cursor_pos > active_rows) { cursor_pos = active_rows; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); if (first < items_no - active_rows) { first++; lcd_clear(); @@ -6235,6 +6265,7 @@ unsigned char lcd_choose_color() { if (cursor_pos < 1) { cursor_pos = 1; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); if (first > 0) { first--; lcd_clear(); @@ -6248,12 +6279,14 @@ unsigned char lcd_choose_color() { lcd_print(" "); lcd_set_cursor(0, cursor_pos); lcd_print(">"); + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); enc_dif = lcd_encoder_diff; _delay(100); } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); switch(cursor_pos + first - 1) { case 0: return 1; break; case 1: return 0; break; @@ -6565,11 +6598,7 @@ static void lcd_main_menu() } void stack_error() { - SET_OUTPUT(BEEPER); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - _delay(1000); - WRITE(BEEPER, LOW); + Sound_MakeCustom(1000,0,true); lcd_display_message_fullscreen_P(_i("Error - static memory has been overwritten"));////MSG_STACK_ERROR c=20 r=4 //err_triggered = 1; while (1) delay_keep_alive(1000); @@ -6696,8 +6725,8 @@ static void lcd_tune_menu() case e_SOUND_MODE_SILENT: MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set); break; - case e_SOUND_MODE_MUTE: - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_MUTE),lcd_sound_state_set); + case e_SOUND_MODE_BLIND: + MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_BLIND),lcd_sound_state_set); break; default: MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set); @@ -6856,6 +6885,7 @@ void lcd_sdcard_stop() if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); if ((int32_t)lcd_encoder == 1) { lcd_return_to_status(); @@ -8366,6 +8396,7 @@ void menu_lcd_lcdupdate_func(void) if (lcd_draw_update == 0) lcd_draw_update = 1; lcd_encoder += lcd_encoder_diff / ENCODER_PULSES_PER_STEP; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); lcd_encoder_diff = 0; lcd_timeoutToStatus.start(); } diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 18df92f62..80a55acc2 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -295,15 +295,9 @@ bool show_upgrade_dialog_if_version_newer(const char *version_string) for (const char *c = version_string; ! is_whitespace_or_nl_or_eol(*c); ++ c) lcd_putc(*c); lcd_puts_at_P(0, 3, _i("Please upgrade."));////MSG_NEW_FIRMWARE_PLEASE_UPGRADE c=20 -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 1000); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); delay_keep_alive(500); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 1000); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); lcd_wait_for_click(); lcd_update_enable(true); lcd_clear(); From 4be8fa701ed60240025d2414452917a4496e44ca Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 10 Jun 2019 20:41:18 +0200 Subject: [PATCH 246/368] Use loop to enquecommand_P() in first layer calibration. --- Firmware/first_lay_cal.cpp | 30 ++++++++++++++++++++++++++++++ Firmware/first_lay_cal.h | 16 ++++++++++++++++ Firmware/ultralcd.cpp | 14 +++++--------- 3 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 Firmware/first_lay_cal.cpp create mode 100644 Firmware/first_lay_cal.h diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp new file mode 100644 index 000000000..fb0e79894 --- /dev/null +++ b/Firmware/first_lay_cal.cpp @@ -0,0 +1,30 @@ +/* + * first_lay_cal.cpp + * + * Created on: Jun 10, 2019 + * Author: marek + */ +#include "first_lay_cal.h" +#include "Configuration_prusa.h" +#include "language.h" + +static const char cmd_0[] PROGMEM = "M107"; +static const char cmd_1[] PROGMEM = "M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); +static const char cmd_2[] PROGMEM = "M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); +static const char cmd_3[] PROGMEM = "M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); +static const char cmd_4[] PROGMEM = "M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); +static const char cmd_6[] PROGMEM = "G28"; +static const char cmd_7[] PROGMEM = "G92 E0.0"; + + +const char * const layer1_cal[8] PROGMEM = +{ + cmd_0, + cmd_1, + cmd_2, + cmd_3, + cmd_4, + MSG_M117_V2_CALIBRATION, //TODO missing internationalization + cmd_6, + cmd_7, +}; diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h new file mode 100644 index 000000000..e22a742b1 --- /dev/null +++ b/Firmware/first_lay_cal.h @@ -0,0 +1,16 @@ +/* + * first_lay_cal.h + * + * Created on: Jun 10, 2019 + * Author: marek + */ + +#ifndef FIRMWARE_FIRST_LAY_CAL_H_ +#define FIRMWARE_FIRST_LAY_CAL_H_ +#include + + +extern const char * const layer1_cal[8] PROGMEM; + + +#endif /* FIRMWARE_FIRST_LAY_CAL_H_ */ diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f69efbbc3..a1be6eab4 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -40,6 +40,7 @@ #include "static_assert.h" #include "io_atmega2560.h" +#include "first_lay_cal.h" int scrollstuff = 0; @@ -1386,15 +1387,10 @@ void lcd_commands() if (lcd_commands_step == 10) { - enquecommand_P(PSTR("M107")); - enquecommand_P(PSTR("M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP))); - enquecommand_P(PSTR("M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP))); - enquecommand_P(PSTR("M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP))); - enquecommand_P(PSTR("M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP))); - enquecommand_P(_T(MSG_M117_V2_CALIBRATION)); - enquecommand_P(PSTR("G28")); - enquecommand_P(PSTR("G92 E0.0")); - + for (uint8_t i = 0; i < (sizeof(layer1_cal)/sizeof(layer1_cal[0])); ++i) + { + enquecommand_P(static_cast(pgm_read_ptr(&layer1_cal[i]))); + } lcd_commands_step = 9; } if (lcd_commands_step == 9 && !blocks_queued() && cmd_buffer_empty()) From 27145204ed9c4e8c47ebaf938ac844d7b75cd128 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 10 Jun 2019 21:40:12 +0200 Subject: [PATCH 247/368] Use internationalized M117, but anyway the text is not shown. --- Firmware/first_lay_cal.cpp | 22 +++++++++++++++++----- Firmware/first_lay_cal.h | 3 +-- Firmware/ultralcd.cpp | 5 +---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index fb0e79894..8f12bb965 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -7,24 +7,36 @@ #include "first_lay_cal.h" #include "Configuration_prusa.h" #include "language.h" +#include "Marlin.h" +#include + static const char cmd_0[] PROGMEM = "M107"; static const char cmd_1[] PROGMEM = "M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); static const char cmd_2[] PROGMEM = "M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); static const char cmd_3[] PROGMEM = "M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); static const char cmd_4[] PROGMEM = "M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); -static const char cmd_6[] PROGMEM = "G28"; -static const char cmd_7[] PROGMEM = "G92 E0.0"; +static const char cmd_5[] PROGMEM = "G28"; +static const char cmd_6[] PROGMEM = "G92 E0.0"; -const char * const layer1_cal[8] PROGMEM = +static const char * const preheat_cmd[] PROGMEM = { cmd_0, cmd_1, cmd_2, cmd_3, cmd_4, - MSG_M117_V2_CALIBRATION, //TODO missing internationalization + cmd_5, //call MSG_M117_V2_CALIBRATION before cmd_6, - cmd_7, }; + +void lay1cal_preheat() +{ + for (uint8_t i = 0; i < (sizeof(preheat_cmd)/sizeof(preheat_cmd[0])); ++i) + { + if (5 == i) enquecommand_P(_T(MSG_M117_V2_CALIBRATION)); + enquecommand_P(static_cast(pgm_read_ptr(&preheat_cmd[i]))); + } + +} diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h index e22a742b1..5068e3379 100644 --- a/Firmware/first_lay_cal.h +++ b/Firmware/first_lay_cal.h @@ -7,10 +7,9 @@ #ifndef FIRMWARE_FIRST_LAY_CAL_H_ #define FIRMWARE_FIRST_LAY_CAL_H_ -#include +void lay1cal_preheat(); -extern const char * const layer1_cal[8] PROGMEM; #endif /* FIRMWARE_FIRST_LAY_CAL_H_ */ diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a1be6eab4..66bc453ab 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1387,10 +1387,7 @@ void lcd_commands() if (lcd_commands_step == 10) { - for (uint8_t i = 0; i < (sizeof(layer1_cal)/sizeof(layer1_cal[0])); ++i) - { - enquecommand_P(static_cast(pgm_read_ptr(&layer1_cal[i]))); - } + lay1cal_preheat(); lcd_commands_step = 9; } if (lcd_commands_step == 9 && !blocks_queued() && cmd_buffer_empty()) From 3e3715055292f68b5ab538d422def6251855eb0e Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 11 Jun 2019 14:53:10 +0200 Subject: [PATCH 248/368] Do not allow resume printing if fans are still not ok --- Firmware/Marlin_main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index fd1d34ebb..7adc13ab3 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9323,6 +9323,10 @@ void stop_and_save_print_to_ram(float z_move, float e_move) void restore_print_from_ram_and_continue(float e_move) { if (!saved_printing) return; + + // Do not allow resume printing if fans are still not ok + if( fan_check_error != EFCE_OK )return; + // for (int axis = X_AXIS; axis <= E_AXIS; axis++) // current_position[axis] = st_get_position_mm(axis); active_extruder = saved_active_extruder; //restore active_extruder From 13c3ab14fabe18558c741bda8a62ec641b5800e1 Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 11 Jun 2019 15:05:40 +0200 Subject: [PATCH 249/368] test fan check error only when enabled by #ifdef --- Firmware/Marlin_main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7adc13ab3..54c21379a 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9324,8 +9324,10 @@ void restore_print_from_ram_and_continue(float e_move) { if (!saved_printing) return; +#ifdef FANCHECK // Do not allow resume printing if fans are still not ok if( fan_check_error != EFCE_OK )return; +#endif // for (int axis = X_AXIS; axis <= E_AXIS; axis++) // current_position[axis] = st_get_position_mm(axis); From f20125a3e2453bda994be8fb2ed62c6d189955ce Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 11 Jun 2019 16:24:40 +0200 Subject: [PATCH 250/368] Code size reduction - saved almost 2KB --- Firmware/ultralcd.cpp | 114 ++++++++++-------------------------------- Firmware/ultralcd.h | 2 +- 2 files changed, 27 insertions(+), 89 deletions(-) mode change 100644 => 100755 Firmware/ultralcd.h diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f69efbbc3..b7f7e68d1 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -73,8 +73,8 @@ extern void crashdet_disable(); bool presort_flag = false; #endif -int lcd_commands_type = LCD_COMMAND_IDLE; -int lcd_commands_step = 0; +uint8_t lcd_commands_type = LCD_COMMAND_IDLE; +uint8_t lcd_commands_step = 0; unsigned int custom_message_type = CUSTOM_MSG_TYPE_STATUS; unsigned int custom_message_state = 0; @@ -1060,6 +1060,20 @@ static void lcd_status_screen() feedmultiply = 999; } +//! extracted common code from lcd_commands into a separate function +//! along with the sprintf_P optimization this change gained more than 1.6KB +static void lcd_commands_func1(char *cmd1, uint8_t i, float width, float extr, float extr_short_segment){ + static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f"; + static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f"; + sprintf_P(cmd1, fmt1, 70, (35 - i*width * 2), extr); + enquecommand(cmd1); + sprintf_P(cmd1, fmt2, (35 - (2 * i + 1)*width), extr_short_segment); + enquecommand(cmd1); + sprintf_P(cmd1, fmt1, 50, (35 - (2 * i + 1)*width), extr); + enquecommand(cmd1); + sprintf_P(cmd1, fmt2, (35 - (i + 1)*width * 2), extr_short_segment); + enquecommand(cmd1); +} void lcd_commands() { @@ -1496,27 +1510,8 @@ void lcd_commands() lcd_timeoutToStatus.start(); - for (int i = 0; i < 4; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 0; i < 4; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 5; @@ -1525,56 +1520,18 @@ void lcd_commands() if (lcd_commands_step == 5 && !blocks_queued() && cmd_buffer_empty()) { lcd_timeoutToStatus.start(); - for (int i = 4; i < 8; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 4; i < 8; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 4; } - + if (lcd_commands_step == 4 && !blocks_queued() && cmd_buffer_empty()) { - lcd_timeoutToStatus.start(); - for (int i = 8; i < 12; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + lcd_timeoutToStatus.start(); + for (uint8_t i = 8; i < 12; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 3; @@ -1583,27 +1540,8 @@ void lcd_commands() if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty()) { lcd_timeoutToStatus.start(); - for (int i = 12; i < 16; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 12; i < 16; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 2; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h old mode 100644 new mode 100755 index 665c1233f..f8cf83652 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -97,7 +97,7 @@ extern void lcd_diag_show_end_stops(); #define LCD_COMMAND_PID_EXTRUDER 7 #define LCD_COMMAND_V2_CAL 8 -extern int lcd_commands_type; +extern uint8_t lcd_commands_type; extern int8_t FSensorStateMenu; #define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable From 0c9121e99e1cc5bc94df8e585a879b6da4b67df0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Jun 2019 17:08:56 +0200 Subject: [PATCH 251/368] Use loop to enquecommand_P() in first layer calibration. --- Firmware/first_lay_cal.cpp | 81 +++++++++++++++++++++++++++++++------- Firmware/first_lay_cal.h | 2 + Firmware/ultralcd.cpp | 25 +----------- 3 files changed, 70 insertions(+), 38 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 8f12bb965..60bb5440a 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -8,27 +8,28 @@ #include "Configuration_prusa.h" #include "language.h" #include "Marlin.h" +#include "mmu.h" #include -static const char cmd_0[] PROGMEM = "M107"; -static const char cmd_1[] PROGMEM = "M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); -static const char cmd_2[] PROGMEM = "M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); -static const char cmd_3[] PROGMEM = "M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); -static const char cmd_4[] PROGMEM = "M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); -static const char cmd_5[] PROGMEM = "G28"; -static const char cmd_6[] PROGMEM = "G92 E0.0"; +static const char cmd_preheat_0[] PROGMEM = "M107"; +static const char cmd_preheat_1[] PROGMEM = "M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); +static const char cmd_preheat_2[] PROGMEM = "M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); +static const char cmd_preheat_3[] PROGMEM = "M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); +static const char cmd_preheat_4[] PROGMEM = "M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); +static const char cmd_preheat_5[] PROGMEM = "G28"; +static const char cmd_preheat_6[] PROGMEM = "G92 E0.0"; static const char * const preheat_cmd[] PROGMEM = { - cmd_0, - cmd_1, - cmd_2, - cmd_3, - cmd_4, - cmd_5, //call MSG_M117_V2_CALIBRATION before - cmd_6, + cmd_preheat_0, + cmd_preheat_1, + cmd_preheat_2, + cmd_preheat_3, + cmd_preheat_4, + cmd_preheat_5, //call MSG_M117_V2_CALIBRATION before + cmd_preheat_6, }; void lay1cal_preheat() @@ -40,3 +41,55 @@ void lay1cal_preheat() } } + +static const char cmd_intro_mmu_0[] PROGMEM = "M83"; +static const char cmd_intro_mmu_1[] PROGMEM = "G1 Y-3.0 F1000.0"; +static const char cmd_intro_mmu_2[] PROGMEM = "G1 Z0.4 F1000.0"; +static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55.0 E32.0 F1073.0"; // call T code before +static const char cmd_intro_mmu_4[] PROGMEM = "G1 X5.0 E32.0 F1800.0"; +static const char cmd_intro_mmu_5[] PROGMEM = "G1 X55.0 E8.0 F2000.0"; +static const char cmd_intro_mmu_6[] PROGMEM = "G1 Z0.3 F1000.0"; +static const char cmd_intro_mmu_7[] PROGMEM = "G92 E0.0"; +static const char cmd_intro_mmu_8[] PROGMEM = "G1 X240.0 E25.0 F2200.0"; +static const char cmd_intro_mmu_9[] PROGMEM = "G1 Y-2.0 F1000.0"; +static const char cmd_intro_mmu_10[] PROGMEM = "G1 X55.0 E25 F1400.0"; +static const char cmd_intro_mmu_11[] PROGMEM = "G1 Z0.20 F1000.0"; +static const char cmd_intro_mmu_12[] PROGMEM = "G1 X5.0 E4.0 F1000.0"; + +static const char * const intro_mmu_cmd[] PROGMEM = +{ + cmd_intro_mmu_0, + cmd_intro_mmu_1, + cmd_intro_mmu_2, + cmd_intro_mmu_3, // call T code before + cmd_intro_mmu_4, + cmd_intro_mmu_5, + cmd_intro_mmu_6, + cmd_intro_mmu_7, + cmd_intro_mmu_8, + cmd_intro_mmu_9, + cmd_intro_mmu_10, + cmd_intro_mmu_11, + cmd_intro_mmu_12, +}; + +void lay1cal_intro_line(char *cmd_buffer, uint8_t filament) +{ + if (mmu_enabled) + { + for (uint8_t i = 0; i < (sizeof(intro_mmu_cmd)/sizeof(intro_mmu_cmd[0])); ++i) + { + if (3 == i) + { + sprintf_P(cmd_buffer, PSTR("T%d"), filament); + enquecommand(cmd_buffer); + } + enquecommand_P(static_cast(pgm_read_ptr(&intro_mmu_cmd[i]))); + } + } + else + { + enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0")); + enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); + } +} diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h index 5068e3379..12f1a3d96 100644 --- a/Firmware/first_lay_cal.h +++ b/Firmware/first_lay_cal.h @@ -7,8 +7,10 @@ #ifndef FIRMWARE_FIRST_LAY_CAL_H_ #define FIRMWARE_FIRST_LAY_CAL_H_ +#include void lay1cal_preheat(); +void lay1cal_intro_line(char *cmd_buffer, uint8_t filament); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 66bc453ab..4ce79dc38 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1396,30 +1396,7 @@ void lcd_commands() menu_depth = 0; menu_submenu(lcd_babystep_z); - if (mmu_enabled) - { - enquecommand_P(PSTR("M83")); //intro line - enquecommand_P(PSTR("G1 Y-3.0 F1000.0")); //intro line - enquecommand_P(PSTR("G1 Z0.4 F1000.0")); //intro line - strcpy(cmd1, "T"); - strcat(cmd1, itostr3left(filament)); - enquecommand(cmd1); - enquecommand_P(PSTR("G1 X55.0 E32.0 F1073.0")); //intro line - enquecommand_P(PSTR("G1 X5.0 E32.0 F1800.0")); //intro line - enquecommand_P(PSTR("G1 X55.0 E8.0 F2000.0")); //intro line - enquecommand_P(PSTR("G1 Z0.3 F1000.0")); //intro line - enquecommand_P(PSTR("G92 E0.0")); //intro line - enquecommand_P(PSTR("G1 X240.0 E25.0 F2200.0")); //intro line - enquecommand_P(PSTR("G1 Y-2.0 F1000.0")); //intro line - enquecommand_P(PSTR("G1 X55.0 E25 F1400.0")); //intro line - enquecommand_P(PSTR("G1 Z0.20 F1000.0")); //intro line - enquecommand_P(PSTR("G1 X5.0 E4.0 F1000.0")); //intro line - - } else - { - enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0")); //intro line - enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); //intro line - } + lay1cal_intro_line(cmd1, filament); lcd_commands_step = 8; } From 58948cffcd6d2e5ccaea6e5508f0144e34619eec Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 11 Jun 2019 16:24:40 +0200 Subject: [PATCH 252/368] Code size reduction - saved almost 2KB --- Firmware/ultralcd.cpp | 114 ++++++++++-------------------------------- Firmware/ultralcd.h | 2 +- 2 files changed, 27 insertions(+), 89 deletions(-) mode change 100644 => 100755 Firmware/ultralcd.h diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4ce79dc38..8a226b4b9 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -74,8 +74,8 @@ extern void crashdet_disable(); bool presort_flag = false; #endif -int lcd_commands_type = LCD_COMMAND_IDLE; -int lcd_commands_step = 0; +uint8_t lcd_commands_type = LCD_COMMAND_IDLE; +uint8_t lcd_commands_step = 0; unsigned int custom_message_type = CUSTOM_MSG_TYPE_STATUS; unsigned int custom_message_state = 0; @@ -1061,6 +1061,20 @@ static void lcd_status_screen() feedmultiply = 999; } +//! extracted common code from lcd_commands into a separate function +//! along with the sprintf_P optimization this change gained more than 1.6KB +static void lcd_commands_func1(char *cmd1, uint8_t i, float width, float extr, float extr_short_segment){ + static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f"; + static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f"; + sprintf_P(cmd1, fmt1, 70, (35 - i*width * 2), extr); + enquecommand(cmd1); + sprintf_P(cmd1, fmt2, (35 - (2 * i + 1)*width), extr_short_segment); + enquecommand(cmd1); + sprintf_P(cmd1, fmt1, 50, (35 - (2 * i + 1)*width), extr); + enquecommand(cmd1); + sprintf_P(cmd1, fmt2, (35 - (i + 1)*width * 2), extr_short_segment); + enquecommand(cmd1); +} void lcd_commands() { @@ -1466,27 +1480,8 @@ void lcd_commands() lcd_timeoutToStatus.start(); - for (int i = 0; i < 4; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 0; i < 4; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 5; @@ -1495,56 +1490,18 @@ void lcd_commands() if (lcd_commands_step == 5 && !blocks_queued() && cmd_buffer_empty()) { lcd_timeoutToStatus.start(); - for (int i = 4; i < 8; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 4; i < 8; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 4; } - + if (lcd_commands_step == 4 && !blocks_queued() && cmd_buffer_empty()) { - lcd_timeoutToStatus.start(); - for (int i = 8; i < 12; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + lcd_timeoutToStatus.start(); + for (uint8_t i = 8; i < 12; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 3; @@ -1553,27 +1510,8 @@ void lcd_commands() if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty()) { lcd_timeoutToStatus.start(); - for (int i = 12; i < 16; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 12; i < 16; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 2; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h old mode 100644 new mode 100755 index 665c1233f..f8cf83652 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -97,7 +97,7 @@ extern void lcd_diag_show_end_stops(); #define LCD_COMMAND_PID_EXTRUDER 7 #define LCD_COMMAND_V2_CAL 8 -extern int lcd_commands_type; +extern uint8_t lcd_commands_type; extern int8_t FSensorStateMenu; #define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable From 9b1e3213ae35e2c66d41020e04c9c391f82902c1 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Jun 2019 17:25:52 +0200 Subject: [PATCH 253/368] Variable lcd_commands_step doesn't need to be global. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8a226b4b9..6edca9bfb 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -75,7 +75,7 @@ bool presort_flag = false; #endif uint8_t lcd_commands_type = LCD_COMMAND_IDLE; -uint8_t lcd_commands_step = 0; +static uint8_t lcd_commands_step = 0; unsigned int custom_message_type = CUSTOM_MSG_TYPE_STATUS; unsigned int custom_message_state = 0; From 97a5d6b5f4037b863ffe6e31cd0160bf5760ac0a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Jun 2019 17:30:37 +0200 Subject: [PATCH 254/368] Make constants const. --- Firmware/ultralcd.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6edca9bfb..a6d31450d 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1363,10 +1363,10 @@ void lcd_commands() { char cmd1[30]; static uint8_t filament = 0; - float width = 0.4; - float length = 20 - width; - float extr = count_e(0.2, width, length); - float extr_short_segment = count_e(0.2, width, width); + const float width = 0.4; + const float length = 20 - width; + const float extr = count_e(0.2, width, length); + const float extr_short_segment = count_e(0.2, width, width); if(lcd_commands_step>1) lcd_timeoutToStatus.start(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen if (lcd_commands_step == 0 && !blocks_queued() && cmd_buffer_empty()) From d21f256cd06699a774306ea6f94026a09ff6adec Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Jun 2019 18:26:59 +0200 Subject: [PATCH 255/368] Remove duplicate calls of lcd_timeoutToStatus.start(), move !blocks_queued() && cmd_buffer_empty() condition to outer if, rewrite using switch statement. Save 487B of FLASH memory. --- Firmware/ultralcd.cpp | 293 ++++++++++++++++++------------------------ 1 file changed, 123 insertions(+), 170 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a6d31450d..b57196aed 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1367,180 +1367,133 @@ void lcd_commands() const float length = 20 - width; const float extr = count_e(0.2, width, length); const float extr_short_segment = count_e(0.2, width, width); + if(lcd_commands_step>1) lcd_timeoutToStatus.start(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen - if (lcd_commands_step == 0 && !blocks_queued() && cmd_buffer_empty()) - { - lcd_commands_step = 10; - } - if (lcd_commands_step == 20 && !blocks_queued() && cmd_buffer_empty()) - { - filament = 0; - lcd_commands_step = 10; - } - if (lcd_commands_step == 21 && !blocks_queued() && cmd_buffer_empty()) + if (!blocks_queued() && cmd_buffer_empty()) { - filament = 1; - lcd_commands_step = 10; + switch(lcd_commands_step) + { + case 0: + lcd_commands_step = 10; + break; + case 20: + filament = 0; + lcd_commands_step = 10; + break; + case 21: + filament = 1; + lcd_commands_step = 10; + break; + case 22: + filament = 2; + lcd_commands_step = 10; + break; + case 23: + filament = 3; + lcd_commands_step = 10; + break; + case 24: + filament = 4; + lcd_commands_step = 10; + break; + case 10: + lay1cal_preheat(); + lcd_commands_step = 9; + break; + case 9: + lcd_clear(); + menu_depth = 0; + menu_submenu(lcd_babystep_z); + lay1cal_intro_line(cmd1, filament); + lcd_commands_step = 8; + break; + case 8: + enquecommand_P(PSTR("G92 E0.0")); + enquecommand_P(PSTR("G21")); //set units to millimeters + enquecommand_P(PSTR("G90")); //use absolute coordinates + enquecommand_P(PSTR("M83")); //use relative distances for extrusion + enquecommand_P(PSTR("G1 E-1.50000 F2100.00000")); + enquecommand_P(PSTR("G1 Z5 F7200.000")); + enquecommand_P(PSTR("M204 S1000")); //set acceleration + enquecommand_P(PSTR("G1 F4000")); + lcd_commands_step = 7; + break; + case 7: + enquecommand_P(PSTR("G1 X50 Y155")); + enquecommand_P(PSTR("G1 Z0.150 F7200.000")); + enquecommand_P(PSTR("G1 F1080")); + enquecommand_P(PSTR("G1 X75 Y155 E2.5")); + enquecommand_P(PSTR("G1 X100 Y155 E2")); + enquecommand_P(PSTR("G1 X200 Y155 E2.62773")); + enquecommand_P(PSTR("G1 X200 Y135 E0.66174")); + enquecommand_P(PSTR("G1 X50 Y135 E3.62773")); + enquecommand_P(PSTR("G1 X50 Y115 E0.49386")); + enquecommand_P(PSTR("G1 X200 Y115 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y95 E0.49386")); + enquecommand_P(PSTR("G1 X50 Y95 E3.62773")); + enquecommand_P(PSTR("G1 X50 Y75 E0.49386")); + enquecommand_P(PSTR("G1 X200 Y75 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y55 E0.49386")); + enquecommand_P(PSTR("G1 X50 Y55 E3.62773")); + + strcpy(cmd1, "G1 X50 Y35 E"); + strcat(cmd1, ftostr43(extr)); + enquecommand(cmd1); + + lcd_commands_step = 6; + break; + case 6: + for (uint8_t i = 0; i < 4; i++) + { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); + } + lcd_commands_step = 5; + break; + case 5: + for (uint8_t i = 4; i < 8; i++) + { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); + } + lcd_commands_step = 4; + break; + case 4: + for (uint8_t i = 8; i < 12; i++) + { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); + } + lcd_commands_step = 3; + break; + case 3: + for (uint8_t i = 12; i < 16; i++) + { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); + } + lcd_commands_step = 2; + break; + case 2: + enquecommand_P(PSTR("M107")); //turn off printer fan + enquecommand_P(PSTR("G1 E-0.07500 F2100.00000")); //retract + enquecommand_P(PSTR("M104 S0")); // turn off temperature + enquecommand_P(PSTR("M140 S0")); // turn off heatbed + enquecommand_P(PSTR("G1 Z10 F1300.000")); //lift Z + enquecommand_P(PSTR("G1 X10 Y180 F4000")); //Go to parking position + if (mmu_enabled) enquecommand_P(PSTR("M702 C")); //unload from nozzle + enquecommand_P(PSTR("M84"));// disable motors + forceMenuExpire = true; //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen + lcd_commands_step = 1; + break; + case 1: + lcd_setstatuspgm(_T(WELCOME_MSG)); + lcd_commands_step = 0; + lcd_commands_type = 0; + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) + { + lcd_wizard(WizState::RepeatLay1Cal); + } + break; + } } - if (lcd_commands_step == 22 && !blocks_queued() && cmd_buffer_empty()) - { - filament = 2; - lcd_commands_step = 10; - } - if (lcd_commands_step == 23 && !blocks_queued() && cmd_buffer_empty()) - { - filament = 3; - lcd_commands_step = 10; - } - if (lcd_commands_step == 24 && !blocks_queued() && cmd_buffer_empty()) - { - filament = 4; - lcd_commands_step = 10; - } - - if (lcd_commands_step == 10) - { - lay1cal_preheat(); - lcd_commands_step = 9; - } - if (lcd_commands_step == 9 && !blocks_queued() && cmd_buffer_empty()) - { - lcd_clear(); - menu_depth = 0; - menu_submenu(lcd_babystep_z); - - lay1cal_intro_line(cmd1, filament); - - lcd_commands_step = 8; - } - if (lcd_commands_step == 8 && !blocks_queued() && cmd_buffer_empty()) - { - - enquecommand_P(PSTR("G92 E0.0")); - enquecommand_P(PSTR("G21")); //set units to millimeters - enquecommand_P(PSTR("G90")); //use absolute coordinates - enquecommand_P(PSTR("M83")); //use relative distances for extrusion - enquecommand_P(PSTR("G1 E-1.50000 F2100.00000")); - enquecommand_P(PSTR("G1 Z5 F7200.000")); - enquecommand_P(PSTR("M204 S1000")); //set acceleration - enquecommand_P(PSTR("G1 F4000")); - lcd_commands_step = 7; - } - if (lcd_commands_step == 7 && !blocks_queued() && cmd_buffer_empty()) //draw meander - { - lcd_timeoutToStatus.start(); - - - //just opposite direction - /*enquecommand_P(PSTR("G1 X50 Y55")); - enquecommand_P(PSTR("G1 F1080")); - enquecommand_P(PSTR("G1 X200 Y55 E3.62773")); - enquecommand_P(PSTR("G1 X200 Y75 E0.49386")); - enquecommand_P(PSTR("G1 X50 Y75 E3.62773")); - enquecommand_P(PSTR("G1 X50 Y95 E0.49386")); - enquecommand_P(PSTR("G1 X200 Y95 E3.62773")); - enquecommand_P(PSTR("G1 X200 Y115 E0.49386")); - enquecommand_P(PSTR("G1 X50 Y115 E3.62773")); - enquecommand_P(PSTR("G1 X50 Y135 E0.49386")); - enquecommand_P(PSTR("G1 X200 Y135 E3.62773")); - enquecommand_P(PSTR("G1 X200 Y155 E0.66174")); - enquecommand_P(PSTR("G1 X100 Y155 E2.62773")); - enquecommand_P(PSTR("G1 X75 Y155 E2")); - enquecommand_P(PSTR("G1 X50 Y155 E2.5")); - enquecommand_P(PSTR("G1 E - 0.07500 F2100.00000"));*/ - - - enquecommand_P(PSTR("G1 X50 Y155")); - enquecommand_P(PSTR("G1 Z0.150 F7200.000")); - enquecommand_P(PSTR("G1 F1080")); - enquecommand_P(PSTR("G1 X75 Y155 E2.5")); - enquecommand_P(PSTR("G1 X100 Y155 E2")); - enquecommand_P(PSTR("G1 X200 Y155 E2.62773")); - enquecommand_P(PSTR("G1 X200 Y135 E0.66174")); - enquecommand_P(PSTR("G1 X50 Y135 E3.62773")); - enquecommand_P(PSTR("G1 X50 Y115 E0.49386")); - enquecommand_P(PSTR("G1 X200 Y115 E3.62773")); - enquecommand_P(PSTR("G1 X200 Y95 E0.49386")); - enquecommand_P(PSTR("G1 X50 Y95 E3.62773")); - enquecommand_P(PSTR("G1 X50 Y75 E0.49386")); - enquecommand_P(PSTR("G1 X200 Y75 E3.62773")); - enquecommand_P(PSTR("G1 X200 Y55 E0.49386")); - enquecommand_P(PSTR("G1 X50 Y55 E3.62773")); - - strcpy(cmd1, "G1 X50 Y35 E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - - lcd_commands_step = 6; - } - - if (lcd_commands_step == 6 && !blocks_queued() && cmd_buffer_empty()) - { - - lcd_timeoutToStatus.start(); - - for (uint8_t i = 0; i < 4; i++) { - lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); - } - - lcd_commands_step = 5; - } - - if (lcd_commands_step == 5 && !blocks_queued() && cmd_buffer_empty()) - { - lcd_timeoutToStatus.start(); - for (uint8_t i = 4; i < 8; i++) { - lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); - } - - lcd_commands_step = 4; - } - - if (lcd_commands_step == 4 && !blocks_queued() && cmd_buffer_empty()) - { - lcd_timeoutToStatus.start(); - for (uint8_t i = 8; i < 12; i++) { - lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); - } - - lcd_commands_step = 3; - } - - if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty()) - { - lcd_timeoutToStatus.start(); - for (uint8_t i = 12; i < 16; i++) { - lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); - } - - lcd_commands_step = 2; - } - - if (lcd_commands_step == 2 && !blocks_queued() && cmd_buffer_empty()) - { - lcd_timeoutToStatus.start(); - enquecommand_P(PSTR("M107")); //turn off printer fan - enquecommand_P(PSTR("G1 E-0.07500 F2100.00000")); //retract - enquecommand_P(PSTR("M104 S0")); // turn off temperature - enquecommand_P(PSTR("M140 S0")); // turn off heatbed - enquecommand_P(PSTR("G1 Z10 F1300.000")); //lift Z - enquecommand_P(PSTR("G1 X10 Y180 F4000")); //Go to parking position - if (mmu_enabled) enquecommand_P(PSTR("M702 C")); //unload from nozzle - enquecommand_P(PSTR("M84"));// disable motors - forceMenuExpire = true; //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen - lcd_commands_step = 1; - } - if (lcd_commands_step == 1 && !blocks_queued() && cmd_buffer_empty()) - { - lcd_setstatuspgm(_T(WELCOME_MSG)); - lcd_commands_step = 0; - lcd_commands_type = 0; - if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { - lcd_wizard(WizState::RepeatLay1Cal); - } - } - } #endif // not SNMM From 4effff9e9991a56a14fb246ba5d503faa231b18a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Jun 2019 18:56:29 +0200 Subject: [PATCH 256/368] Use loop to enquecommand_P() in first layer calibration. Save 10B FLASH memory. --- Firmware/first_lay_cal.cpp | 29 +++++++++++++++++++++++++++++ Firmware/first_lay_cal.h | 1 + Firmware/ultralcd.cpp | 9 +-------- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 60bb5440a..0958faaaf 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -93,3 +93,32 @@ void lay1cal_intro_line(char *cmd_buffer, uint8_t filament) enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); } } + +static const char cmd_pre_meander_0[] PROGMEM = "G92 E0.0"; +static const char cmd_pre_meander_1[] PROGMEM = "G21"; //set units to millimeters TODO unsupported command +static const char cmd_pre_meander_2[] PROGMEM = "G90"; //use absolute coordinates +static const char cmd_pre_meander_3[] PROGMEM = "M83"; //use relative distances for extrusion TODO: duplicate +static const char cmd_pre_meander_4[] PROGMEM = "G1 E-1.50000 F2100.00000"; +static const char cmd_pre_meander_5[] PROGMEM = "G1 Z5 F7200.000"; +static const char cmd_pre_meander_6[] PROGMEM = "M204 S1000"; //set acceleration +static const char cmd_pre_meander_7[] PROGMEM = "G1 F4000"; + +static const char * const cmd_pre_meander[] PROGMEM = +{ + cmd_pre_meander_0, + cmd_pre_meander_1, + cmd_pre_meander_2, + cmd_pre_meander_3, + cmd_pre_meander_4, + cmd_pre_meander_5, + cmd_pre_meander_6, + cmd_pre_meander_7, +}; + +void lay1cal_before_meander() +{ + for (uint8_t i = 0; i < (sizeof(cmd_pre_meander)/sizeof(cmd_pre_meander[0])); ++i) + { + enquecommand_P(static_cast(pgm_read_ptr(&cmd_pre_meander[i]))); + } +} diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h index 12f1a3d96..b99d691b5 100644 --- a/Firmware/first_lay_cal.h +++ b/Firmware/first_lay_cal.h @@ -11,6 +11,7 @@ void lay1cal_preheat(); void lay1cal_intro_line(char *cmd_buffer, uint8_t filament); +void lay1cal_before_meander(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b57196aed..efb58b867 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1409,14 +1409,7 @@ void lcd_commands() lcd_commands_step = 8; break; case 8: - enquecommand_P(PSTR("G92 E0.0")); - enquecommand_P(PSTR("G21")); //set units to millimeters - enquecommand_P(PSTR("G90")); //use absolute coordinates - enquecommand_P(PSTR("M83")); //use relative distances for extrusion - enquecommand_P(PSTR("G1 E-1.50000 F2100.00000")); - enquecommand_P(PSTR("G1 Z5 F7200.000")); - enquecommand_P(PSTR("M204 S1000")); //set acceleration - enquecommand_P(PSTR("G1 F4000")); + lay1cal_before_meander(); lcd_commands_step = 7; break; case 7: From 21f466960043aace1f2a1ac1476f612151f4d225 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Jun 2019 19:22:08 +0200 Subject: [PATCH 257/368] Make count_e() constexpr. --- Firmware/ultralcd.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index efb58b867..23ab61cd0 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -246,7 +246,7 @@ static char snmm_stop_print_menu(); #ifdef SDCARD_SORT_ALPHA static void lcd_sort_type_set(); #endif -static float count_e(float layer_heigth, float extrusion_width, float extrusion_length); +static constexpr float count_e(float layer_heigth, float extrusion_width, float extrusion_length); static void lcd_babystep_z(); static void lcd_send_status(); #ifdef FARM_CONNECT_MESSAGE @@ -1680,10 +1680,9 @@ void lcd_commands() } -static float count_e(float layer_heigth, float extrusion_width, float extrusion_length) { +static constexpr float count_e(float layer_heigth, float extrusion_width, float extrusion_length) { //returns filament length in mm which needs to be extrude to form line with extrusion_length * extrusion_width * layer heigth dimensions - float extr = extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4); - return extr; + return (extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4)); } void lcd_return_to_status() From 47a183e96e5bc6ecb2e049520a4fa805f52ed090 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Jun 2019 19:49:56 +0200 Subject: [PATCH 258/368] Use loop to enquecommand_P() in first layer calibration. Save 126B of FLASH memory. --- Firmware/first_lay_cal.cpp | 45 ++++++++++++++++++++++++++++++++++++++ Firmware/first_lay_cal.h | 1 + Firmware/ultralcd.cpp | 17 +------------- 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 0958faaaf..446b82015 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -122,3 +122,48 @@ void lay1cal_before_meander() enquecommand_P(static_cast(pgm_read_ptr(&cmd_pre_meander[i]))); } } + +static const char cmd_meander_0[] PROGMEM = "G1 X50 Y155"; +static const char cmd_meander_1[] PROGMEM = "G1 Z0.150 F7200.000"; +static const char cmd_meander_2[] PROGMEM = "G1 F1080"; +static const char cmd_meander_3[] PROGMEM = "G1 X75 Y155 E2.5"; +static const char cmd_meander_4[] PROGMEM = "G1 X100 Y155 E2"; +static const char cmd_meander_5[] PROGMEM = "G1 X200 Y155 E2.62773"; +static const char cmd_meander_6[] PROGMEM = "G1 X200 Y135 E0.66174"; +static const char cmd_meander_7[] PROGMEM = "G1 X50 Y135 E3.62773"; +static const char cmd_meander_8[] PROGMEM = "G1 X50 Y115 E0.49386"; +static const char cmd_meander_9[] PROGMEM = "G1 X200 Y115 E3.62773"; +static const char cmd_meander_10[] PROGMEM = "G1 X200 Y95 E0.49386"; +static const char cmd_meander_11[] PROGMEM = "G1 X50 Y95 E3.62773"; +static const char cmd_meander_12[] PROGMEM = "G1 X50 Y75 E0.49386"; +static const char cmd_meander_13[] PROGMEM = "G1 X200 Y75 E3.62773"; +static const char cmd_meander_14[] PROGMEM = "G1 X200 Y55 E0.49386"; +static const char cmd_meander_15[] PROGMEM = "G1 X50 Y55 E3.62773"; + +static const char * const cmd_meander[] PROGMEM = +{ + cmd_meander_0, + cmd_meander_1, + cmd_meander_2, + cmd_meander_3, + cmd_meander_4, + cmd_meander_5, + cmd_meander_6, + cmd_meander_7, + cmd_meander_8, + cmd_meander_9, + cmd_meander_10, + cmd_meander_11, + cmd_meander_12, + cmd_meander_13, + cmd_meander_14, + cmd_meander_15, +}; + +void lay1cal_meander() +{ + for (uint8_t i = 0; i < (sizeof(cmd_meander)/sizeof(cmd_meander[0])); ++i) + { + enquecommand_P(static_cast(pgm_read_ptr(&cmd_meander[i]))); + } +} diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h index b99d691b5..7ebed5e89 100644 --- a/Firmware/first_lay_cal.h +++ b/Firmware/first_lay_cal.h @@ -12,6 +12,7 @@ void lay1cal_preheat(); void lay1cal_intro_line(char *cmd_buffer, uint8_t filament); void lay1cal_before_meander(); +void lay1cal_meander(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 23ab61cd0..1cac19a9f 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1413,22 +1413,7 @@ void lcd_commands() lcd_commands_step = 7; break; case 7: - enquecommand_P(PSTR("G1 X50 Y155")); - enquecommand_P(PSTR("G1 Z0.150 F7200.000")); - enquecommand_P(PSTR("G1 F1080")); - enquecommand_P(PSTR("G1 X75 Y155 E2.5")); - enquecommand_P(PSTR("G1 X100 Y155 E2")); - enquecommand_P(PSTR("G1 X200 Y155 E2.62773")); - enquecommand_P(PSTR("G1 X200 Y135 E0.66174")); - enquecommand_P(PSTR("G1 X50 Y135 E3.62773")); - enquecommand_P(PSTR("G1 X50 Y115 E0.49386")); - enquecommand_P(PSTR("G1 X200 Y115 E3.62773")); - enquecommand_P(PSTR("G1 X200 Y95 E0.49386")); - enquecommand_P(PSTR("G1 X50 Y95 E3.62773")); - enquecommand_P(PSTR("G1 X50 Y75 E0.49386")); - enquecommand_P(PSTR("G1 X200 Y75 E3.62773")); - enquecommand_P(PSTR("G1 X200 Y55 E0.49386")); - enquecommand_P(PSTR("G1 X50 Y55 E3.62773")); + lay1cal_meander(); strcpy(cmd1, "G1 X50 Y35 E"); strcat(cmd1, ftostr43(extr)); From 60cc3d58ece82fd52f886e819bde1a33146a137a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Jun 2019 20:00:49 +0200 Subject: [PATCH 259/368] Use sprintf_P in first layer calibration. Save 30B of FLASH memory. --- Firmware/ultralcd.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1cac19a9f..c1295f4df 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1414,9 +1414,7 @@ void lcd_commands() break; case 7: lay1cal_meander(); - - strcpy(cmd1, "G1 X50 Y35 E"); - strcat(cmd1, ftostr43(extr)); + sprintf_P(cmd1, PSTR("G1 X50 Y35 E%-.3f"), extr); enquecommand(cmd1); lcd_commands_step = 6; From d528a53526b7d4e241d9943c295fbef035193bb8 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 01:36:48 +0200 Subject: [PATCH 260/368] Refactor. Move lcd_commands_func1() to first_lay_cal.cpp and rename it to lay1cal_square(). Remove its constant parameters. Move remaining G1 code to lay1cal_meander(). Saves 6B of FLASH memory. --- Firmware/first_lay_cal.cpp | 41 +++++++++++++++++++++++++++++++++++++- Firmware/first_lay_cal.h | 5 ++--- Firmware/ultralcd.cpp | 38 +++++------------------------------ 3 files changed, 47 insertions(+), 37 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 446b82015..c539ebda5 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -160,10 +160,49 @@ static const char * const cmd_meander[] PROGMEM = cmd_meander_15, }; -void lay1cal_meander() +//! @brief Count extrude length +//! +//! @param layer_heigth layer heigth in mm +//! @param extrusion_width extrusion width in mm +//! @param extrusion_length extrusion length in mm +//! @return filament length in mm which needs to be extruded to form line +static constexpr float count_e(float layer_heigth, float extrusion_width, float extrusion_length) +{ + return (extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4)); +} + +static const float width = 0.4; +static const float length = 20 - width; +static const float extr = count_e(0.2, width, length); + +void lay1cal_meander(char *cmd_buffer) { for (uint8_t i = 0; i < (sizeof(cmd_meander)/sizeof(cmd_meander[0])); ++i) { enquecommand_P(static_cast(pgm_read_ptr(&cmd_meander[i]))); } + sprintf_P(cmd_buffer, PSTR("G1 X50 Y35 E%-.3f"), extr); + enquecommand(cmd_buffer); +} + +//! @brief Print square +//! +//! This function needs to be called 16 times for i from 0 to 15. +//! +//! @par cmd_buffer character buffer needed to format gcodes +//! @par i iteration +void lay1cal_square(char *cmd_buffer, uint8_t i) +{ + const float extr_short_segment = count_e(0.2, width, width); + + static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f"; + static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f"; + sprintf_P(cmd_buffer, fmt1, 70, (35 - i*width * 2), extr); + enquecommand(cmd_buffer); + sprintf_P(cmd_buffer, fmt2, (35 - (2 * i + 1)*width), extr_short_segment); + enquecommand(cmd_buffer); + sprintf_P(cmd_buffer, fmt1, 50, (35 - (2 * i + 1)*width), extr); + enquecommand(cmd_buffer); + sprintf_P(cmd_buffer, fmt2, (35 - (i + 1)*width * 2), extr_short_segment); + enquecommand(cmd_buffer); } diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h index 7ebed5e89..4da415fd2 100644 --- a/Firmware/first_lay_cal.h +++ b/Firmware/first_lay_cal.h @@ -12,8 +12,7 @@ void lay1cal_preheat(); void lay1cal_intro_line(char *cmd_buffer, uint8_t filament); void lay1cal_before_meander(); -void lay1cal_meander(); - - +void lay1cal_meander(char *cmd_buffer); +void lay1cal_square(char *cmd_buffer, uint8_t i); #endif /* FIRMWARE_FIRST_LAY_CAL_H_ */ diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c1295f4df..be4b15377 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -246,7 +246,6 @@ static char snmm_stop_print_menu(); #ifdef SDCARD_SORT_ALPHA static void lcd_sort_type_set(); #endif -static constexpr float count_e(float layer_heigth, float extrusion_width, float extrusion_length); static void lcd_babystep_z(); static void lcd_send_status(); #ifdef FARM_CONNECT_MESSAGE @@ -1061,21 +1060,6 @@ static void lcd_status_screen() feedmultiply = 999; } -//! extracted common code from lcd_commands into a separate function -//! along with the sprintf_P optimization this change gained more than 1.6KB -static void lcd_commands_func1(char *cmd1, uint8_t i, float width, float extr, float extr_short_segment){ - static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f"; - static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f"; - sprintf_P(cmd1, fmt1, 70, (35 - i*width * 2), extr); - enquecommand(cmd1); - sprintf_P(cmd1, fmt2, (35 - (2 * i + 1)*width), extr_short_segment); - enquecommand(cmd1); - sprintf_P(cmd1, fmt1, 50, (35 - (2 * i + 1)*width), extr); - enquecommand(cmd1); - sprintf_P(cmd1, fmt2, (35 - (i + 1)*width * 2), extr_short_segment); - enquecommand(cmd1); -} - void lcd_commands() { if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) @@ -1363,10 +1347,6 @@ void lcd_commands() { char cmd1[30]; static uint8_t filament = 0; - const float width = 0.4; - const float length = 20 - width; - const float extr = count_e(0.2, width, length); - const float extr_short_segment = count_e(0.2, width, width); if(lcd_commands_step>1) lcd_timeoutToStatus.start(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen @@ -1413,37 +1393,34 @@ void lcd_commands() lcd_commands_step = 7; break; case 7: - lay1cal_meander(); - sprintf_P(cmd1, PSTR("G1 X50 Y35 E%-.3f"), extr); - enquecommand(cmd1); - + lay1cal_meander(cmd1); lcd_commands_step = 6; break; case 6: for (uint8_t i = 0; i < 4; i++) { - lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); + lay1cal_square(cmd1, i); } lcd_commands_step = 5; break; case 5: for (uint8_t i = 4; i < 8; i++) { - lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); + lay1cal_square(cmd1, i); } lcd_commands_step = 4; break; case 4: for (uint8_t i = 8; i < 12; i++) { - lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); + lay1cal_square(cmd1, i); } lcd_commands_step = 3; break; case 3: for (uint8_t i = 12; i < 16; i++) { - lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); + lay1cal_square(cmd1, i); } lcd_commands_step = 2; break; @@ -1663,11 +1640,6 @@ void lcd_commands() } -static constexpr float count_e(float layer_heigth, float extrusion_width, float extrusion_length) { - //returns filament length in mm which needs to be extrude to form line with extrusion_length * extrusion_width * layer heigth dimensions - return (extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4)); -} - void lcd_return_to_status() { lcd_refresh(); // to maybe revive the LCD if static electricity killed it. From baa36ce740ab6113cbb1aef795b3cadc64c602cf Mon Sep 17 00:00:00 2001 From: DRracer Date: Wed, 12 Jun 2019 09:58:42 +0200 Subject: [PATCH 261/368] another almost 200B down by proper usage of smaller data types and enum classes --- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 38 +++---- Firmware/cmdqueue.cpp | 2 +- Firmware/mmu.cpp | 6 +- Firmware/ultralcd.cpp | 236 +++++++++++++++++++-------------------- Firmware/ultralcd.h | 59 +++++----- 6 files changed, 174 insertions(+), 169 deletions(-) mode change 100644 => 100755 Firmware/Marlin.h mode change 100644 => 100755 Firmware/cmdqueue.cpp mode change 100644 => 100755 Firmware/mmu.cpp diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h old mode 100644 new mode 100755 index 2e60597dc..f53e55cc9 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -389,7 +389,7 @@ extern bool wizard_active; //autoload temporarily disabled during wizard extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff -#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CUSTOM_MSG_TYPE_TEMCAL) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused || mmu_print_saved) +#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsgTypes::TEMCAL) || saved_printing || (lcd_commands_type == LcdCommands::V2_CAL) || card.paused || mmu_print_saved) //! Beware - mcode_in_progress is set as soon as the command gets really processed, //! which is not the same as posting the M600 command into the command queue //! There can be a considerable lag between posting M600 and its real processing which might result diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 711c428b9..e08462288 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3157,7 +3157,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float #endif //IR_SENSOR lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; } //! @brief Rise Z if too low to avoid blob/jam before filament loading @@ -3181,7 +3181,7 @@ void gcode_M701() else { enable_z(); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; #ifdef FSENSOR_QUALITY fsensor_oq_meassure_start(40); @@ -3211,7 +3211,7 @@ void gcode_M701() lcd_setstatuspgm(_T(WELCOME_MSG)); disable_z(); loading_flag = false; - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; #ifdef FSENSOR_QUALITY fsensor_oq_meassure_stop(); @@ -4194,7 +4194,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // setTargetHotend(200, 0); setTargetBed(70 + (start_temp - 30)); - custom_message_type = CUSTOM_MSG_TYPE_TEMCAL; + custom_message_type = CustomMsgTypes::TEMCAL; custom_message_state = 1; lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION)); current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; @@ -4296,7 +4296,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; } puts_P(_N("PINDA probe calibration start")); - custom_message_type = CUSTOM_MSG_TYPE_TEMCAL; + custom_message_type = CustomMsgTypes::TEMCAL; custom_message_state = 1; lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION)); current_position[X_AXIS] = PINDA_PREHEAT_X; @@ -4364,7 +4364,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1); puts_P(_N("Temperature calibration done.")); @@ -4424,7 +4424,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // We don't know where we are! HOME! // Push the commands to the front of the message queue in the reverse order! // There shall be always enough space reserved for these commands. - if (lcd_commands_type != LCD_COMMAND_STOP_PRINT) { + if (lcd_commands_type != LcdCommands::STOP_PRINT) { repeatcommand_front(); // repeat G80 with all its parameters enquecommand_front_P((PSTR("G28 W0"))); } @@ -4464,7 +4464,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (temp_comp_start) if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50) { - if (lcd_commands_type != LCD_COMMAND_STOP_PRINT) { + if (lcd_commands_type != LcdCommands::STOP_PRINT) { temp_compensation_start(); run = true; repeatcommand_front(); // repeat G80 with all its parameters @@ -4476,14 +4476,14 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; } run = false; - if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) { + if (lcd_commands_type == LcdCommands::STOP_PRINT) { mesh_bed_leveling_flag = false; break; } // Save custom message state, set a new custom message state to display: Calibrating point 9. - unsigned int custom_message_type_old = custom_message_type; + CustomMsgTypes custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CUSTOM_MSG_TYPE_MESHBL; + custom_message_type = CustomMsgTypes::MESHBL; custom_message_state = (nMeasPoints * nMeasPoints) + 10; lcd_update(1); @@ -4683,7 +4683,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) enable_z_endstop(bState); } while (st_get_position_mm(Z_AXIS) > MESH_HOME_Z_SEARCH); // i.e. Z-leveling not o.k. // plan_set_z_position(MESH_HOME_Z_SEARCH); // is not necessary ('do-while' loop always ends at the expected Z-position) - custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery + custom_message_type=CustomMsgTypes::STATUS; // display / status-line recovery lcd_update_enable(true); // display / status-line recovery gcode_G28(true, true, true); // X & Y & Z-homing (must be after individual Z-homing (problem with spool-holder)!) repeatcommand_front(); // re-run (i.e. of "G80") @@ -7693,9 +7693,9 @@ bool bInhibitFlag; #ifdef IR_SENSOR bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active #endif // IR_SENSOR - if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active + if ((mcode_in_progress != 600) && (eFilamentAction != eFILAMENT_ACTION::autoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active { - if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL) && !wizard_active) { if (fsensor_check_autoload()) { @@ -7719,7 +7719,7 @@ if(0) show_preheat_nozzle_warning(); lcd_update_enable(true); */ - eFilamentAction=e_FILAMENT_ACTION_autoLoad; + eFilamentAction=eFILAMENT_ACTION::autoLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -8210,7 +8210,7 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CUSTOM_MSG_TYPE_MESHBL; + custom_message_type = CustomMsgTypes::MESHBL; custom_message_state = (x_points_num * y_points_num) + 10; lcd_update(1); @@ -8408,7 +8408,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CUSTOM_MSG_TYPE_MESHBL; + custom_message_type = CustomMsgTypes::MESHBL; custom_message_state = (x_points_num * y_points_num) + 10; lcd_update(1); @@ -8558,7 +8558,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ void temp_compensation_start() { - custom_message_type = CUSTOM_MSG_TYPE_TEMPRE; + custom_message_type = CustomMsgTypes::TEMPRE; custom_message_state = PINDA_HEAT_T + 1; lcd_update(2); if (degHotend(active_extruder) > EXTRUDE_MINTEMP) { @@ -8579,7 +8579,7 @@ void temp_compensation_start() { if (custom_message_state == 99 || custom_message_state == 9) lcd_update(2); //force whole display redraw if number of digits changed else lcd_update(1); } - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; custom_message_state = 0; } diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp old mode 100644 new mode 100755 index 2e29ad5f9..1e1167c49 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -598,7 +598,7 @@ void get_command() if (farm_mode) { prusa_statistics(6); - lcd_commands_type = LCD_COMMAND_FARM_MODE_CONFIRM; + lcd_commands_type = LcdCommands::FARM_MODE_CONFIRM; } } diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp old mode 100644 new mode 100755 index 916b3d0fd..c289f31d5 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1076,7 +1076,7 @@ if(0) extr_unload(); } else { - eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad; + eFilamentAction=eFILAMENT_ACTION::mmuUnLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -1372,13 +1372,13 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr) mmu_load_to_nozzle(); load_filament_final_feed(); st_synchronize(); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); lcd_return_to_status(); lcd_update_enable(true); lcd_load_filament_color_check(); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b7f7e68d1..19601df3f 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -73,10 +73,10 @@ extern void crashdet_disable(); bool presort_flag = false; #endif -uint8_t lcd_commands_type = LCD_COMMAND_IDLE; +LcdCommands lcd_commands_type = LcdCommands::IDLE; uint8_t lcd_commands_step = 0; -unsigned int custom_message_type = CUSTOM_MSG_TYPE_STATUS; +CustomMsgTypes custom_message_type = CustomMsgTypes::STATUS; unsigned int custom_message_state = 0; @@ -84,7 +84,7 @@ bool isPrintPaused = false; uint8_t farm_mode = 0; int farm_no = 0; int farm_timer = 8; -int farm_status = 0; +uint8_t farm_status = 0; bool printer_connected = true; unsigned long display_time; //just timer for showing pid finished message on lcd; @@ -565,7 +565,7 @@ void lcdui_print_temp(char type, int val_current, int val_target) // Print Z-coordinate (8 chars total) void lcdui_print_Z_coord(void) { - if (custom_message_type == CUSTOM_MSG_TYPE_MESHBL) + if (custom_message_type == CustomMsgTypes::MESHBL) lcd_puts_P(_N("Z --- ")); else lcd_printf_P(_N("Z%6.2f "), current_position[Z_AXIS]); @@ -760,7 +760,7 @@ void lcdui_print_status_line(void) break; } } - else if ((IS_SD_PRINTING) && (custom_message_type == CUSTOM_MSG_TYPE_STATUS)) + else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsgTypes::STATUS)) { // If printing from SD, show what we are printing if(strlen(card.longFilename) > LCD_WIDTH) { @@ -794,10 +794,10 @@ void lcdui_print_status_line(void) { // Otherwise check for other special events switch (custom_message_type) { - case CUSTOM_MSG_TYPE_STATUS: // Nothing special, print status message normally + case CustomMsgTypes::STATUS: // Nothing special, print status message normally lcd_print(lcd_status_message); break; - case CUSTOM_MSG_TYPE_MESHBL: // If mesh bed leveling in progress, show the status + case CustomMsgTypes::MESHBL: // If mesh bed leveling in progress, show the status if (custom_message_state > 10) { lcd_set_cursor(0, 3); @@ -813,7 +813,7 @@ void lcdui_print_status_line(void) { lcd_puts_P(_T(WELCOME_MSG)); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; } if (custom_message_state > 3 && custom_message_state <= 10 ) { @@ -825,10 +825,10 @@ void lcdui_print_status_line(void) } } break; - case CUSTOM_MSG_TYPE_F_LOAD: // If loading filament, print status + case CustomMsgTypes::F_LOAD: // If loading filament, print status lcd_print(lcd_status_message); break; - case CUSTOM_MSG_TYPE_PIDCAL: // PID tuning in progress + case CustomMsgTypes::PIDCAL: // PID tuning in progress lcd_print(lcd_status_message); if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) { @@ -838,7 +838,7 @@ void lcdui_print_status_line(void) lcd_print(itostr3left(pid_number_of_cycles)); } break; - case CUSTOM_MSG_TYPE_TEMCAL: // PINDA temp calibration in progress + case CustomMsgTypes::TEMCAL: // PINDA temp calibration in progress { char progress[4]; lcd_set_cursor(0, 3); @@ -848,7 +848,7 @@ void lcdui_print_status_line(void) lcd_print(progress); } break; - case CUSTOM_MSG_TYPE_TEMPRE: // temp compensation preheat + case CustomMsgTypes::TEMPRE: // temp compensation preheat lcd_set_cursor(0, 3); lcd_puts_P(_i("PINDA Heating"));////MSG_PINDA_PREHEAT c=20 r=1 if (custom_message_state <= PINDA_HEAT_T) @@ -996,7 +996,7 @@ static void lcd_status_screen() } // end of farm_mode lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */ - if (lcd_commands_type != LCD_COMMAND_IDLE) + if (lcd_commands_type != LcdCommands::IDLE) lcd_commands(); } // end of lcd_draw_update @@ -1020,7 +1020,7 @@ static void lcd_status_screen() } if (current_click - && (lcd_commands_type != LCD_COMMAND_STOP_PRINT) //click is aborted unless stop print finishes + && (lcd_commands_type != LcdCommands::STOP_PRINT) //click is aborted unless stop print finishes && ( menu_block_entering_on_serious_errors == SERIOUS_ERR_NONE ) // or a serious error blocks entering the menu ) { @@ -1077,15 +1077,15 @@ static void lcd_commands_func1(char *cmd1, uint8_t i, float width, float extr, f void lcd_commands() { - if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) + if (lcd_commands_type == LcdCommands::LONG_PAUSE) { if (!blocks_queued() && !homing_flag) { lcd_setstatuspgm(_i("Print paused"));////MSG_PRINT_PAUSED c=20 r=1 long_pause(); - if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) // !!! because "lcd_commands_type" can be changed during/inside "long_pause()" + if (lcd_commands_type == LcdCommands::LONG_PAUSE) // !!! because "lcd_commands_type" can be changed during/inside "long_pause()" { - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; lcd_commands_step = 0; } } @@ -1093,7 +1093,7 @@ void lcd_commands() #ifdef SNMM - if (lcd_commands_type == LCD_COMMAND_V2_CAL) + if (lcd_commands_type == LcdCommands::V2_CAL) { char cmd1[30]; float width = 0.4; @@ -1358,7 +1358,7 @@ void lcd_commands() #else //if not SNMM - if (lcd_commands_type == LCD_COMMAND_V2_CAL) + if (lcd_commands_type == LcdCommands::V2_CAL) { char cmd1[30]; static uint8_t filament = 0; @@ -1565,7 +1565,7 @@ void lcd_commands() { lcd_setstatuspgm(_T(WELCOME_MSG)); lcd_commands_step = 0; - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { lcd_wizard(WizState::RepeatLay1Cal); } @@ -1575,7 +1575,7 @@ void lcd_commands() #endif // not SNMM - if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print + if (lcd_commands_type == LcdCommands::STOP_PRINT) /// stop print { @@ -1587,9 +1587,9 @@ void lcd_commands() if (lcd_commands_step == 1 && !blocks_queued()) { lcd_commands_step = 0; - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; isPrintPaused = false; } if (lcd_commands_step == 2 && !blocks_queued()) @@ -1645,7 +1645,7 @@ void lcd_commands() if (mmu_enabled) setAllTargetHotends(0); manage_heater(); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; lcd_commands_step = 5; } if (lcd_commands_step == 7 && !blocks_queued()) @@ -1667,12 +1667,12 @@ void lcd_commands() } } - if (lcd_commands_type == 3) + if (lcd_commands_type == LcdCommands::UNKNOWN3) { - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; } - if (lcd_commands_type == LCD_COMMAND_FARM_MODE_CONFIRM) /// farm mode confirm + if (lcd_commands_type == LcdCommands::FARM_MODE_CONFIRM) /// farm mode confirm { if (lcd_commands_step == 0) { lcd_commands_step = 6; } @@ -1681,7 +1681,7 @@ void lcd_commands() { lcd_confirm_print(); lcd_commands_step = 0; - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; } if (lcd_commands_step == 2 && !blocks_queued()) { @@ -1714,11 +1714,11 @@ void lcd_commands() } } - if (lcd_commands_type == LCD_COMMAND_PID_EXTRUDER) { + if (lcd_commands_type == LcdCommands::PID_EXTRUDER) { char cmd1[30]; if (lcd_commands_step == 0) { - custom_message_type = CUSTOM_MSG_TYPE_PIDCAL; + custom_message_type = CustomMsgTypes::PIDCAL; custom_message_state = 1; lcd_draw_update = 3; lcd_commands_step = 3; @@ -1754,10 +1754,10 @@ void lcd_commands() } if ((lcd_commands_step == 1) && ((_millis()- display_time)>2000)) { //calibration finished message lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; pid_temp = DEFAULT_PID_TEMP; lcd_commands_step = 0; - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; } } @@ -1775,7 +1775,7 @@ void lcd_return_to_status() lcd_refresh(); // to maybe revive the LCD if static electricity killed it. menu_goto(lcd_status_screen, 0, false, true); menu_depth = 0; - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } //! @brief Pause print, disable nozzle heater, move to park position @@ -1785,9 +1785,9 @@ void lcd_pause_print() stop_and_save_print_to_ram(0.0,0.0); setAllTargetHotends(0); isPrintPaused = true; - if (LCD_COMMAND_IDLE == lcd_commands_type) + if (LcdCommands::IDLE == lcd_commands_type) { - lcd_commands_type = LCD_COMMAND_LONG_PAUSE; + lcd_commands_type = LcdCommands::LONG_PAUSE; } } @@ -1928,7 +1928,7 @@ void lcd_menu_extruder_info() // NOT static due to using ins lcd_puts_P(_N("Filament sensor\n" "is disabled.")); else { - if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) pat9125_update(); lcd_printf_P(_N( "Fil. Xd:%3d Yd:%3d\n" @@ -2314,7 +2314,7 @@ void lcd_set_filament_oq_meass() } -eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized as 'non-autoLoad' +eFILAMENT_ACTION eFilamentAction=eFILAMENT_ACTION::none; // must be initialized as 'non-autoLoad' bool bFilamentFirstRun; bool bFilamentPreheatState; bool bFilamentAction=false; @@ -2331,18 +2331,18 @@ lcd_puts_P(_i("Press the knob")); ////MSG_ c=20 r=1 lcd_set_cursor(0,3); switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::mmuLoad: lcd_puts_P(_i("to load filament")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_unLoad: - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::unLoad: + case eFILAMENT_ACTION::mmuUnLoad: lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuEject: - case e_FILAMENT_ACTION_mmuCut: - case e_FILAMENT_ACTION_none: + case eFILAMENT_ACTION::mmuEject: + case eFILAMENT_ACTION::mmuCut: + case eFILAMENT_ACTION::none: break; } if(lcd_clicked()) @@ -2356,21 +2356,21 @@ if(lcd_clicked()) menu_back(nLevel); switch(eFilamentAction) { - case e_FILAMENT_ACTION_autoLoad: - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + case eFILAMENT_ACTION::autoLoad: + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad // no break - case e_FILAMENT_ACTION_Load: + case eFILAMENT_ACTION::load: loading_flag=true; enquecommand_P(PSTR("M701")); // load filament break; - case e_FILAMENT_ACTION_unLoad: + case eFILAMENT_ACTION::unLoad: enquecommand_P(PSTR("M702")); // unload filament break; - case e_FILAMENT_ACTION_mmuLoad: - case e_FILAMENT_ACTION_mmuUnLoad: - case e_FILAMENT_ACTION_mmuEject: - case e_FILAMENT_ACTION_mmuCut: - case e_FILAMENT_ACTION_none: + case eFILAMENT_ACTION::mmuLoad: + case eFILAMENT_ACTION::mmuUnLoad: + case eFILAMENT_ACTION::mmuEject: + case eFILAMENT_ACTION::mmuCut: + case eFILAMENT_ACTION::none: break; } } @@ -2394,19 +2394,19 @@ lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0 lcd_set_cursor(0,1); switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::mmuLoad: lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_unLoad: - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::unLoad: + case eFILAMENT_ACTION::mmuUnLoad: lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuEject: + case eFILAMENT_ACTION::mmuEject: lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuCut: + case eFILAMENT_ACTION::mmuCut: lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1 break; } @@ -2425,20 +2425,20 @@ if(lcd_clicked()) setTargetBed((float)nTargetBedOld); } menu_back(); - if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + if(eFilamentAction==eFILAMENT_ACTION::autoLoad) + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } else { if(current_temperature[0]>(target_temperature[0]*0.95)) { switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_unLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::unLoad: menu_submenu(mFilamentPrompt); break; - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::mmuLoad: nLevel=1; if(!bFilamentPreheatState) nLevel++; @@ -2446,7 +2446,7 @@ else { menu_back(nLevel); menu_submenu(mmu_load_to_nozzle_menu); break; - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::mmuUnLoad: nLevel=1; if(!bFilamentPreheatState) nLevel++; @@ -2454,7 +2454,7 @@ else { menu_back(nLevel); extr_unload(); break; - case e_FILAMENT_ACTION_mmuEject: + case eFILAMENT_ACTION::mmuEject: nLevel=1; if(!bFilamentPreheatState) nLevel++; @@ -2462,7 +2462,7 @@ else { menu_back(nLevel); menu_submenu(mmu_fil_eject_menu); break; - case e_FILAMENT_ACTION_mmuCut: + case eFILAMENT_ACTION::mmuCut: nLevel=1; if(!bFilamentPreheatState) nLevel++; @@ -2495,44 +2495,44 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) { switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_unLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::unLoad: if(bFilamentWaitingFlag) menu_submenu(mFilamentPrompt); else { nLevel=bFilamentPreheatState?1:2; menu_back(nLevel); - if((eFilamentAction==e_FILAMENT_ACTION_Load)||(eFilamentAction==e_FILAMENT_ACTION_autoLoad)) + if((eFilamentAction==eFILAMENT_ACTION::load)||(eFilamentAction==eFILAMENT_ACTION::autoLoad)) { loading_flag=true; enquecommand_P(PSTR("M701")); // load filament - if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + if(eFilamentAction==eFILAMENT_ACTION::autoLoad) + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } - if(eFilamentAction==e_FILAMENT_ACTION_unLoad) + if(eFilamentAction==eFILAMENT_ACTION::unLoad) enquecommand_P(PSTR("M702")); // unload filament } break; - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::mmuLoad: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); menu_submenu(mmu_load_to_nozzle_menu); break; - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::mmuUnLoad: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); extr_unload(); break; - case e_FILAMENT_ACTION_mmuEject: + case eFILAMENT_ACTION::mmuEject: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); menu_submenu(mmu_fil_eject_menu); break; - case e_FILAMENT_ACTION_mmuCut: + case eFILAMENT_ACTION::mmuCut: #ifdef MMU_HAS_CUTTER nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; @@ -2540,7 +2540,7 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) menu_submenu(mmu_cut_filament_menu); #endif //MMU_HAS_CUTTER break; - case e_FILAMENT_ACTION_none: + case eFILAMENT_ACTION::none: break; } if(bFilamentWaitingFlag) @@ -2554,22 +2554,22 @@ else { lcd_set_cursor(0,1); switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::mmuLoad: lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_unLoad: - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::unLoad: + case eFILAMENT_ACTION::mmuUnLoad: lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuEject: + case eFILAMENT_ACTION::mmuEject: lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuCut: + case eFILAMENT_ACTION::mmuCut: lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_none: + case eFILAMENT_ACTION::none: break; } lcd_set_cursor(0,3); @@ -2588,8 +2588,8 @@ else { setTargetBed((float)nTargetBedOld); } menu_back(); - if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + if(eFilamentAction==eFILAMENT_ACTION::autoLoad) + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } } } @@ -2634,8 +2634,8 @@ mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP,FLEX_PREHEAT_HPB_TEMP); void mFilamentBack() { menu_back(); -if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad +if(eFilamentAction==eFILAMENT_ACTION::autoLoad) + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } void mFilamentMenu() @@ -2666,7 +2666,7 @@ if(0) enquecommand_P(PSTR("M702")); // unload filament } else { - eFilamentAction=e_FILAMENT_ACTION_unLoad; + eFilamentAction=eFILAMENT_ACTION::unLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -2893,7 +2893,7 @@ static void lcd_LoadFilament() if(0) { // menu_back(); // not necessary (see "lcd_return_to_status()" below) - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; loading_flag = true; enquecommand_P(PSTR("M701")); //load filament SERIAL_ECHOLN("Loading filament"); @@ -2901,7 +2901,7 @@ if(0) } else { - eFilamentAction=e_FILAMENT_ACTION_Load; + eFilamentAction=eFILAMENT_ACTION::load; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -3350,7 +3350,7 @@ void pid_extruder() lcd_set_cursor(1, 2); lcd_print(ftostr3(pid_temp)); if (lcd_clicked()) { - lcd_commands_type = LCD_COMMAND_PID_EXTRUDER; + lcd_commands_type = LcdCommands::PID_EXTRUDER; lcd_return_to_status(); lcd_update(2); } @@ -3952,7 +3952,7 @@ void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, ui void lcd_temp_cal_show_result(bool result) { - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; disable_x(); disable_y(); disable_z(); @@ -4573,7 +4573,7 @@ static void lcd_crash_mode_set() }else{ crashdet_enable(); } - if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) menu_goto(lcd_tune_menu, 9, true, true); + if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) menu_goto(lcd_tune_menu, 9, true, true); else menu_goto(lcd_settings_menu, 9, true, true); } @@ -4810,14 +4810,14 @@ void lcd_v2_calibration() if (filament < 5) { lcd_commands_step = 20 + filament; - lcd_commands_type = LCD_COMMAND_V2_CAL; + lcd_commands_type = LcdCommands::V2_CAL; } } else { bool loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is PLA filament loaded?"), false, true);////MSG_PLA_FILAMENT_LOADED c=20 r=2 if (loaded) { - lcd_commands_type = LCD_COMMAND_V2_CAL; + lcd_commands_type = LcdCommands::V2_CAL; } else { lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 @@ -5077,7 +5077,7 @@ void lcd_wizard(WizState state) case S::Lay1Cal: lcd_show_fullscreen_message_and_wait_P(_i("Now I will calibrate distance between tip of the nozzle and heatbed surface."));////MSG_WIZARD_V2_CAL c=20 r=8 lcd_show_fullscreen_message_and_wait_P(_i("I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration."));////MSG_WIZARD_V2_CAL_2 c=20 r=12 - lcd_commands_type = LCD_COMMAND_V2_CAL; + lcd_commands_type = LcdCommands::V2_CAL; lcd_return_to_status(); end = true; break; @@ -5930,7 +5930,7 @@ static void mmu_load_to_nozzle_menu() } else { - eFilamentAction = e_FILAMENT_ACTION_mmuLoad; + eFilamentAction = eFILAMENT_ACTION::mmuLoad; bFilamentFirstRun = false; if (target_temperature[0] >= EXTRUDE_MINTEMP) { @@ -5962,7 +5962,7 @@ static void mmu_fil_eject_menu() } else { - eFilamentAction = e_FILAMENT_ACTION_mmuEject; + eFilamentAction = eFILAMENT_ACTION::mmuEject; bFilamentFirstRun = false; if (target_temperature[0] >= EXTRUDE_MINTEMP) { @@ -5990,7 +5990,7 @@ static void mmu_cut_filament_menu() } else { - eFilamentAction=e_FILAMENT_ACTION_mmuCut; + eFilamentAction=eFILAMENT_ACTION::mmuCut; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -6035,7 +6035,7 @@ static void change_extr_menu(){ //unload filament for single material printer (used in M702 gcode) void unload_filament() { - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT)); // extr_unload2(); @@ -6070,7 +6070,7 @@ void unload_filament() lcd_update_enable(true); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; } @@ -6397,13 +6397,13 @@ static void lcd_main_menu() }*/ - if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) + if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 } - if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) + if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) { MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE } else @@ -6412,7 +6412,7 @@ static void lcd_main_menu() } #ifdef SDSUPPORT - if (card.cardOK || lcd_commands_type == LCD_COMMAND_V2_CAL) + if (card.cardOK || lcd_commands_type == LcdCommands::V2_CAL) { if (card.isFileOpen()) { @@ -6428,12 +6428,12 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } } - else if (lcd_commands_type == LCD_COMMAND_V2_CAL && mesh_bed_leveling_flag == false && homing_flag == false) { + else if (lcd_commands_type == LcdCommands::V2_CAL && mesh_bed_leveling_flag == false && homing_flag == false) { //MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } else { - if (!is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) + if (!is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) { //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); /*else*/ { @@ -6457,7 +6457,7 @@ static void lcd_main_menu() #endif - if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) + if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) { if (farm_mode) { @@ -6501,7 +6501,7 @@ static void lcd_main_menu() } - if (!is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) + if (!is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) { MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS } @@ -6557,7 +6557,7 @@ static void lcd_colorprint_change() { enquecommand_P(PSTR("M600")); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; //just print status message + custom_message_type = CustomMsgTypes::F_LOAD; //just print status message lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); lcd_return_to_status(); lcd_draw_update = 3; @@ -6786,7 +6786,7 @@ void lcd_print_stop() lcd_return_to_status(); lcd_ignore_click(true); lcd_commands_step = 0; - lcd_commands_type = LCD_COMMAND_STOP_PRINT; + lcd_commands_type = LcdCommands::STOP_PRINT; // Turn off the print fan SET_OUTPUT(FAN_PIN); WRITE(FAN_PIN, 0); @@ -8359,5 +8359,5 @@ void menu_lcd_lcdupdate_func(void) if (!SdFatUtil::test_stack_integrity()) stack_error(); lcd_ping(); //check that we have received ping command if we are in farm mode lcd_send_status(); - if (lcd_commands_type == LCD_COMMAND_V2_CAL) lcd_commands(); + if (lcd_commands_type == LcdCommands::V2_CAL) lcd_commands(); } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index f8cf83652..26e282a0f 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -89,31 +89,36 @@ extern void lcd_diag_show_end_stops(); // To be used in lcd_commands_type. -#define LCD_COMMAND_IDLE 0 -#define LCD_COMMAND_LOAD_FILAMENT 1 -#define LCD_COMMAND_STOP_PRINT 2 -#define LCD_COMMAND_FARM_MODE_CONFIRM 4 -#define LCD_COMMAND_LONG_PAUSE 5 -#define LCD_COMMAND_PID_EXTRUDER 7 -#define LCD_COMMAND_V2_CAL 8 +enum class LcdCommands : uint8_t { + IDLE = 0, + LOAD_FILAMENT = 1, + STOP_PRINT = 2, + UNKNOWN3 = 3, + FARM_MODE_CONFIRM = 4, + LONG_PAUSE = 5, + PID_EXTRUDER = 7, + V2_CAL = 8, +}; -extern uint8_t lcd_commands_type; +extern LcdCommands lcd_commands_type; extern int8_t FSensorStateMenu; -#define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable -#define CUSTOM_MSG_TYPE_MESHBL 1 // Mesh bed leveling in progress -#define CUSTOM_MSG_TYPE_F_LOAD 2 // Loading filament in progress -#define CUSTOM_MSG_TYPE_PIDCAL 3 // PID tuning in progress -#define CUSTOM_MSG_TYPE_TEMCAL 4 // PINDA temp calibration -#define CUSTOM_MSG_TYPE_TEMPRE 5 // Temp compensation preheat +enum class CustomMsgTypes : uint8_t { + STATUS = 0, //!< status message from lcd_status_message variable + MESHBL = 1, //!< Mesh bed leveling in progress + F_LOAD = 2, //!< Loading filament in progress + PIDCAL = 3, //!< PID tuning in progress + TEMCAL = 4, //!< PINDA temp calibration + TEMPRE = 5, //!< Temp compensation preheat +}; -extern unsigned int custom_message_type; +extern CustomMsgTypes custom_message_type; extern unsigned int custom_message_state; extern uint8_t farm_mode; extern int farm_no; extern int farm_timer; -extern int farm_status; +extern uint8_t farm_status; #ifdef TMC2130 #define SILENT_MODE_NORMAL 0 @@ -145,17 +150,17 @@ void extr_unload_used(); #endif //SNMM void extr_unload(); -typedef enum -{ - e_FILAMENT_ACTION_none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) - e_FILAMENT_ACTION_Load, - e_FILAMENT_ACTION_autoLoad, - e_FILAMENT_ACTION_unLoad, - e_FILAMENT_ACTION_mmuLoad, - e_FILAMENT_ACTION_mmuUnLoad, - e_FILAMENT_ACTION_mmuEject, - e_FILAMENT_ACTION_mmuCut, -} eFILAMENT_ACTION; +enum class eFILAMENT_ACTION : uint8_t { + none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) + load, + autoLoad, + unLoad, + mmuLoad, + mmuUnLoad, + mmuEject, + mmuCut, +}; + extern eFILAMENT_ACTION eFilamentAction; extern bool bFilamentFirstRun; extern bool bFilamentPreheatState; From 4f8ed7f1234274f563b8fa613b27f2060a311779 Mon Sep 17 00:00:00 2001 From: DRracer Date: Wed, 12 Jun 2019 10:31:09 +0200 Subject: [PATCH 262/368] for cycles' variables: int -> uint8_t where appropriate, part1 --- Firmware/temperature.cpp | 2 +- Firmware/tmc2130.cpp | 10 +++++----- Firmware/ultralcd.cpp | 32 ++++++++++++++++---------------- 3 files changed, 22 insertions(+), 22 deletions(-) mode change 100644 => 100755 Firmware/tmc2130.cpp diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 9c49cf79c..03845b120 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -434,7 +434,7 @@ static void temp_runaway_stop(bool isPreheat, bool isBed); void updatePID() { #ifdef PIDTEMP - for(int e = 0; e < EXTRUDERS; e++) { + for(uint8_t e = 0; e < EXTRUDERS; e++) { iState_sum_max[e] = PID_INTEGRAL_DRIVE_MAX / cs.Ki; } #endif diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp old mode 100644 new mode 100755 index 05ea2ab6a..fe04e8dab --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -158,7 +158,7 @@ void tmc2130_init() SET_INPUT(Y_TMC2130_DIAG); SET_INPUT(Z_TMC2130_DIAG); SET_INPUT(E0_TMC2130_DIAG); - for (int axis = 0; axis < 2; axis++) // X Y axes + for (uint8_t axis = 0; axis < 2; axis++) // X Y axes { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -169,7 +169,7 @@ void tmc2130_init() tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS); //tmc2130_wr_THIGH(axis, TMC2130_THIGH); } - for (int axis = 2; axis < 3; axis++) // Z axis + for (uint8_t axis = 2; axis < 3; axis++) // Z axis { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -183,7 +183,7 @@ void tmc2130_init() tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS); #endif //TMC2130_STEALTH_Z } - for (int axis = 3; axis < 4; axis++) // E axis + for (uint8_t axis = 3; axis < 4; axis++) // E axis { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -383,7 +383,7 @@ void tmc2130_check_overtemp() static uint32_t checktime = 0; if (_millis() - checktime > 1000 ) { - for (int i = 0; i < 4; i++) + for (uint8_t i = 0; i < 4; i++) { uint32_t drv_status = 0; skip_debug_msg = true; @@ -392,7 +392,7 @@ void tmc2130_check_overtemp() { // BIT 26 - over temp prewarning ~120C (+-20C) SERIAL_ERRORRPGM(MSG_TMC_OVERTEMP); SERIAL_ECHOLN(i); - for (int j = 0; j < 4; j++) + for (uint8_t j = 0; j < 4; j++) tmc2130_wr(j, TMC2130_REG_CHOPCONF, 0x00010000); kill(MSG_TMC_OVERTEMP); } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 19601df3f..5efa9bf2a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -317,7 +317,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, char* longF char c; int enc_dif = lcd_encoder_diff; uint8_t n = LCD_WIDTH - 1; - for(int g = 0; g<4;g++){ + for(uint8_t g = 0; g<4;g++){ lcd_set_cursor(0, g); lcd_print(' '); } @@ -2708,11 +2708,11 @@ void lcd_change_success() { static void lcd_loading_progress_bar(uint16_t loading_time_ms) { - for (int i = 0; i < 20; i++) { + for (uint8_t i = 0; i < 20; i++) { lcd_set_cursor(i, 3); lcd_print("."); //loading_time_ms/20 delay - for (int j = 0; j < 5; j++) { + for (uint8_t j = 0; j < 5; j++) { delay_keep_alive(loading_time_ms / 100); } } @@ -3154,7 +3154,7 @@ static void lcd_menu_xyz_offset() float cntr[2]; world2machine_read_valid(vec_x, vec_y, cntr); - for (int i = 0; i < 2; i++) + for (uint8_t i = 0; i < 2; i++) { lcd_puts_at_P(11, i + 2, PSTR("")); lcd_print(cntr[i]); @@ -4822,7 +4822,7 @@ void lcd_v2_calibration() else { lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 lcd_consume_click(); - for (int i = 0; i < 20; i++) { //wait max. 2s + for (uint8_t i = 0; i < 20; i++) { //wait max. 2s delay_keep_alive(100); if (lcd_clicked()) { break; @@ -5549,7 +5549,7 @@ void bowden_menu() { lcd_clear(); lcd_set_cursor(0, 0); lcd_print(">"); - for (int i = 0; i < 4; i++) { + for (uint8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print("Extruder "); lcd_print(i); @@ -5637,7 +5637,7 @@ void bowden_menu() { enc_dif = lcd_encoder_diff; lcd_set_cursor(0, cursor_pos); lcd_print(">"); - for (int i = 0; i < 4; i++) { + for (uint8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print("Extruder "); lcd_print(i); @@ -5764,14 +5764,14 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite if (header) lcd_puts_at_P(0,0,header); const bool last_visible = (first == items_no - 3); - const int8_t ordinary_items = (last_item&&last_visible)?2:3; + const uint8_t ordinary_items = (last_item&&last_visible)?2:3; - for (int i = 0; i < ordinary_items; i++) + for (uint8_t i = 0; i < ordinary_items; i++) { if (item) lcd_puts_at_P(1, i + 1, item); } - for (int i = 0; i < ordinary_items; i++) + for (uint8_t i = 0; i < ordinary_items; i++) { lcd_set_cursor(2 + item_len, i+1); lcd_print(first + i + 1); @@ -5825,7 +5825,7 @@ char reset_menu() { lcd_consume_click(); while (1) { - for (int i = 0; i < 4; i++) { + for (uint8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print(item[first + i]); } @@ -6151,7 +6151,7 @@ unsigned char lcd_choose_color() { item[0] = "Orange"; item[1] = "Black"; //----------------------------------------------------- - unsigned char active_rows; + uint8_t active_rows; static int first = 0; int enc_dif = 0; unsigned char cursor_pos = 1; @@ -6164,7 +6164,7 @@ unsigned char lcd_choose_color() { lcd_consume_click(); while (1) { lcd_puts_at_P(0, 0, PSTR("Choose color:")); - for (int i = 0; i < active_rows; i++) { + for (uint8_t i = 0; i < active_rows; i++) { lcd_set_cursor(1, i+1); lcd_print(item[first + i]); } @@ -7201,7 +7201,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { //end of second measurement, now check for possible errors: - for(int i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length + for(uint8_t i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length printf_P(_N("Measured axis length:%.3f\n"), measured_axis_length[i]); if (abs(measured_axis_length[i] - axis_length) > max_error_mm) { enable_endstops(false); @@ -8065,7 +8065,7 @@ static void menu_action_sdfile(const char* filename) const char end[5] = ".gco"; //we are storing just first 8 characters of 8.3 filename assuming that extension is always ".gco" - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { if (strcmp((cmd + i + 4), end) == 0) { //filename is shorter then 8.3, store '\0' character on position where ".gco" string was found to terminate stored string properly eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, '\0'); @@ -8080,7 +8080,7 @@ static void menu_action_sdfile(const char* filename) eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth); for (uint8_t i = 0; i < depth; i++) { - for (int j = 0; j < 8; j++) { + for (uint8_t j = 0; j < 8; j++) { eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]); } } From 342954b88ce5f95f1a04d1b9a720ffecf71cbfb0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 13:31:17 +0200 Subject: [PATCH 263/368] Refactor. Make constants producing first layer calibration square more clear. Note layer height discrepancy. --- Firmware/first_lay_cal.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index c539ebda5..32eb4370a 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -173,7 +173,8 @@ static constexpr float count_e(float layer_heigth, float extrusion_width, float static const float width = 0.4; static const float length = 20 - width; -static const float extr = count_e(0.2, width, length); +static const float heigth = 0.2; //!< TODO This is wrong, as current Z height is 0.15 mm +static const float extr = count_e(heigth, width, length); void lay1cal_meander(char *cmd_buffer) { @@ -193,7 +194,7 @@ void lay1cal_meander(char *cmd_buffer) //! @par i iteration void lay1cal_square(char *cmd_buffer, uint8_t i) { - const float extr_short_segment = count_e(0.2, width, width); + const float extr_short_segment = count_e(heigth, width, width); static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f"; static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f"; From 2755a3733d70401523ce30e9466d60586e09179c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 14:15:58 +0200 Subject: [PATCH 264/368] Document. --- Firmware/first_lay_cal.cpp | 30 ++++++++++++++++++------------ Firmware/first_lay_cal.h | 9 +++------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 32eb4370a..5910873e6 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -1,9 +1,8 @@ -/* - * first_lay_cal.cpp - * - * Created on: Jun 10, 2019 - * Author: marek - */ +//! @file +//! @date Jun 10, 2019 +//! @author Marek Bel +//! @brief First layer (Z offset) calibration + #include "first_lay_cal.h" #include "Configuration_prusa.h" #include "language.h" @@ -32,6 +31,7 @@ static const char * const preheat_cmd[] PROGMEM = cmd_preheat_6, }; +//! @brief Preheat void lay1cal_preheat() { for (uint8_t i = 0; i < (sizeof(preheat_cmd)/sizeof(preheat_cmd[0])); ++i) @@ -73,6 +73,9 @@ static const char * const intro_mmu_cmd[] PROGMEM = cmd_intro_mmu_12, }; +//! @brief Print intro line +//! @param cmd_buffer character buffer needed to format gcodes +//! @param filament filament to use (applies for MMU only) void lay1cal_intro_line(char *cmd_buffer, uint8_t filament) { if (mmu_enabled) @@ -115,6 +118,7 @@ static const char * const cmd_pre_meander[] PROGMEM = cmd_pre_meander_7, }; +//! @brief Setup for printing meander void lay1cal_before_meander() { for (uint8_t i = 0; i < (sizeof(cmd_pre_meander)/sizeof(cmd_pre_meander[0])); ++i) @@ -171,11 +175,13 @@ static constexpr float count_e(float layer_heigth, float extrusion_width, float return (extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4)); } -static const float width = 0.4; -static const float length = 20 - width; -static const float heigth = 0.2; //!< TODO This is wrong, as current Z height is 0.15 mm -static const float extr = count_e(heigth, width, length); +static const float width = 0.4; //!< line width +static const float length = 20 - width; //!< line length +static const float heigth = 0.2; //!< layer height TODO This is wrong, as current Z height is 0.15 mm +static const float extr = count_e(heigth, width, length); //!< E axis movement needed to print line +//! @brief Print meander +//! @param cmd_buffer character buffer needed to format gcodes void lay1cal_meander(char *cmd_buffer) { for (uint8_t i = 0; i < (sizeof(cmd_meander)/sizeof(cmd_meander[0])); ++i) @@ -190,8 +196,8 @@ void lay1cal_meander(char *cmd_buffer) //! //! This function needs to be called 16 times for i from 0 to 15. //! -//! @par cmd_buffer character buffer needed to format gcodes -//! @par i iteration +//! @param cmd_buffer character buffer needed to format gcodes +//! @param i iteration void lay1cal_square(char *cmd_buffer, uint8_t i) { const float extr_short_segment = count_e(heigth, width, width); diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h index 4da415fd2..1f338cc51 100644 --- a/Firmware/first_lay_cal.h +++ b/Firmware/first_lay_cal.h @@ -1,9 +1,6 @@ -/* - * first_lay_cal.h - * - * Created on: Jun 10, 2019 - * Author: marek - */ +//! @file +//! @date Jun 10, 2019 +//! @author Marek Bel #ifndef FIRMWARE_FIRST_LAY_CAL_H_ #define FIRMWARE_FIRST_LAY_CAL_H_ From 7ac098a135463334cbf4d08440ecc30e5d33c1e6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 14:20:20 +0200 Subject: [PATCH 265/368] Refactor. Put constants needed in functions inside fuctions to limit its scope. --- Firmware/first_lay_cal.cpp | 217 ++++++++++++++++++------------------- 1 file changed, 108 insertions(+), 109 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 5910873e6..50f08c5e3 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -10,30 +10,28 @@ #include "mmu.h" #include - -static const char cmd_preheat_0[] PROGMEM = "M107"; -static const char cmd_preheat_1[] PROGMEM = "M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); -static const char cmd_preheat_2[] PROGMEM = "M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); -static const char cmd_preheat_3[] PROGMEM = "M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); -static const char cmd_preheat_4[] PROGMEM = "M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); -static const char cmd_preheat_5[] PROGMEM = "G28"; -static const char cmd_preheat_6[] PROGMEM = "G92 E0.0"; - - -static const char * const preheat_cmd[] PROGMEM = -{ - cmd_preheat_0, - cmd_preheat_1, - cmd_preheat_2, - cmd_preheat_3, - cmd_preheat_4, - cmd_preheat_5, //call MSG_M117_V2_CALIBRATION before - cmd_preheat_6, -}; - //! @brief Preheat void lay1cal_preheat() { + static const char cmd_preheat_0[] PROGMEM = "M107"; + static const char cmd_preheat_1[] PROGMEM = "M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); + static const char cmd_preheat_2[] PROGMEM = "M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); + static const char cmd_preheat_3[] PROGMEM = "M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); + static const char cmd_preheat_4[] PROGMEM = "M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); + static const char cmd_preheat_5[] PROGMEM = "G28"; + static const char cmd_preheat_6[] PROGMEM = "G92 E0.0"; + + static const char * const preheat_cmd[] PROGMEM = + { + cmd_preheat_0, + cmd_preheat_1, + cmd_preheat_2, + cmd_preheat_3, + cmd_preheat_4, + cmd_preheat_5, //call MSG_M117_V2_CALIBRATION before + cmd_preheat_6, + }; + for (uint8_t i = 0; i < (sizeof(preheat_cmd)/sizeof(preheat_cmd[0])); ++i) { if (5 == i) enquecommand_P(_T(MSG_M117_V2_CALIBRATION)); @@ -42,42 +40,42 @@ void lay1cal_preheat() } -static const char cmd_intro_mmu_0[] PROGMEM = "M83"; -static const char cmd_intro_mmu_1[] PROGMEM = "G1 Y-3.0 F1000.0"; -static const char cmd_intro_mmu_2[] PROGMEM = "G1 Z0.4 F1000.0"; -static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55.0 E32.0 F1073.0"; // call T code before -static const char cmd_intro_mmu_4[] PROGMEM = "G1 X5.0 E32.0 F1800.0"; -static const char cmd_intro_mmu_5[] PROGMEM = "G1 X55.0 E8.0 F2000.0"; -static const char cmd_intro_mmu_6[] PROGMEM = "G1 Z0.3 F1000.0"; -static const char cmd_intro_mmu_7[] PROGMEM = "G92 E0.0"; -static const char cmd_intro_mmu_8[] PROGMEM = "G1 X240.0 E25.0 F2200.0"; -static const char cmd_intro_mmu_9[] PROGMEM = "G1 Y-2.0 F1000.0"; -static const char cmd_intro_mmu_10[] PROGMEM = "G1 X55.0 E25 F1400.0"; -static const char cmd_intro_mmu_11[] PROGMEM = "G1 Z0.20 F1000.0"; -static const char cmd_intro_mmu_12[] PROGMEM = "G1 X5.0 E4.0 F1000.0"; - -static const char * const intro_mmu_cmd[] PROGMEM = -{ - cmd_intro_mmu_0, - cmd_intro_mmu_1, - cmd_intro_mmu_2, - cmd_intro_mmu_3, // call T code before - cmd_intro_mmu_4, - cmd_intro_mmu_5, - cmd_intro_mmu_6, - cmd_intro_mmu_7, - cmd_intro_mmu_8, - cmd_intro_mmu_9, - cmd_intro_mmu_10, - cmd_intro_mmu_11, - cmd_intro_mmu_12, -}; - //! @brief Print intro line //! @param cmd_buffer character buffer needed to format gcodes //! @param filament filament to use (applies for MMU only) void lay1cal_intro_line(char *cmd_buffer, uint8_t filament) { + static const char cmd_intro_mmu_0[] PROGMEM = "M83"; + static const char cmd_intro_mmu_1[] PROGMEM = "G1 Y-3.0 F1000.0"; + static const char cmd_intro_mmu_2[] PROGMEM = "G1 Z0.4 F1000.0"; + static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55.0 E32.0 F1073.0"; // call T code before + static const char cmd_intro_mmu_4[] PROGMEM = "G1 X5.0 E32.0 F1800.0"; + static const char cmd_intro_mmu_5[] PROGMEM = "G1 X55.0 E8.0 F2000.0"; + static const char cmd_intro_mmu_6[] PROGMEM = "G1 Z0.3 F1000.0"; + static const char cmd_intro_mmu_7[] PROGMEM = "G92 E0.0"; + static const char cmd_intro_mmu_8[] PROGMEM = "G1 X240.0 E25.0 F2200.0"; + static const char cmd_intro_mmu_9[] PROGMEM = "G1 Y-2.0 F1000.0"; + static const char cmd_intro_mmu_10[] PROGMEM = "G1 X55.0 E25 F1400.0"; + static const char cmd_intro_mmu_11[] PROGMEM = "G1 Z0.20 F1000.0"; + static const char cmd_intro_mmu_12[] PROGMEM = "G1 X5.0 E4.0 F1000.0"; + + static const char * const intro_mmu_cmd[] PROGMEM = + { + cmd_intro_mmu_0, + cmd_intro_mmu_1, + cmd_intro_mmu_2, + cmd_intro_mmu_3, // call T code before + cmd_intro_mmu_4, + cmd_intro_mmu_5, + cmd_intro_mmu_6, + cmd_intro_mmu_7, + cmd_intro_mmu_8, + cmd_intro_mmu_9, + cmd_intro_mmu_10, + cmd_intro_mmu_11, + cmd_intro_mmu_12, + }; + if (mmu_enabled) { for (uint8_t i = 0; i < (sizeof(intro_mmu_cmd)/sizeof(intro_mmu_cmd[0])); ++i) @@ -97,72 +95,36 @@ void lay1cal_intro_line(char *cmd_buffer, uint8_t filament) } } -static const char cmd_pre_meander_0[] PROGMEM = "G92 E0.0"; -static const char cmd_pre_meander_1[] PROGMEM = "G21"; //set units to millimeters TODO unsupported command -static const char cmd_pre_meander_2[] PROGMEM = "G90"; //use absolute coordinates -static const char cmd_pre_meander_3[] PROGMEM = "M83"; //use relative distances for extrusion TODO: duplicate -static const char cmd_pre_meander_4[] PROGMEM = "G1 E-1.50000 F2100.00000"; -static const char cmd_pre_meander_5[] PROGMEM = "G1 Z5 F7200.000"; -static const char cmd_pre_meander_6[] PROGMEM = "M204 S1000"; //set acceleration -static const char cmd_pre_meander_7[] PROGMEM = "G1 F4000"; - -static const char * const cmd_pre_meander[] PROGMEM = -{ - cmd_pre_meander_0, - cmd_pre_meander_1, - cmd_pre_meander_2, - cmd_pre_meander_3, - cmd_pre_meander_4, - cmd_pre_meander_5, - cmd_pre_meander_6, - cmd_pre_meander_7, -}; - //! @brief Setup for printing meander void lay1cal_before_meander() { + static const char cmd_pre_meander_0[] PROGMEM = "G92 E0.0"; + static const char cmd_pre_meander_1[] PROGMEM = "G21"; //set units to millimeters TODO unsupported command + static const char cmd_pre_meander_2[] PROGMEM = "G90"; //use absolute coordinates + static const char cmd_pre_meander_3[] PROGMEM = "M83"; //use relative distances for extrusion TODO: duplicate + static const char cmd_pre_meander_4[] PROGMEM = "G1 E-1.50000 F2100.00000"; + static const char cmd_pre_meander_5[] PROGMEM = "G1 Z5 F7200.000"; + static const char cmd_pre_meander_6[] PROGMEM = "M204 S1000"; //set acceleration + static const char cmd_pre_meander_7[] PROGMEM = "G1 F4000"; + + static const char * const cmd_pre_meander[] PROGMEM = + { + cmd_pre_meander_0, + cmd_pre_meander_1, + cmd_pre_meander_2, + cmd_pre_meander_3, + cmd_pre_meander_4, + cmd_pre_meander_5, + cmd_pre_meander_6, + cmd_pre_meander_7, + }; + for (uint8_t i = 0; i < (sizeof(cmd_pre_meander)/sizeof(cmd_pre_meander[0])); ++i) { enquecommand_P(static_cast(pgm_read_ptr(&cmd_pre_meander[i]))); } } -static const char cmd_meander_0[] PROGMEM = "G1 X50 Y155"; -static const char cmd_meander_1[] PROGMEM = "G1 Z0.150 F7200.000"; -static const char cmd_meander_2[] PROGMEM = "G1 F1080"; -static const char cmd_meander_3[] PROGMEM = "G1 X75 Y155 E2.5"; -static const char cmd_meander_4[] PROGMEM = "G1 X100 Y155 E2"; -static const char cmd_meander_5[] PROGMEM = "G1 X200 Y155 E2.62773"; -static const char cmd_meander_6[] PROGMEM = "G1 X200 Y135 E0.66174"; -static const char cmd_meander_7[] PROGMEM = "G1 X50 Y135 E3.62773"; -static const char cmd_meander_8[] PROGMEM = "G1 X50 Y115 E0.49386"; -static const char cmd_meander_9[] PROGMEM = "G1 X200 Y115 E3.62773"; -static const char cmd_meander_10[] PROGMEM = "G1 X200 Y95 E0.49386"; -static const char cmd_meander_11[] PROGMEM = "G1 X50 Y95 E3.62773"; -static const char cmd_meander_12[] PROGMEM = "G1 X50 Y75 E0.49386"; -static const char cmd_meander_13[] PROGMEM = "G1 X200 Y75 E3.62773"; -static const char cmd_meander_14[] PROGMEM = "G1 X200 Y55 E0.49386"; -static const char cmd_meander_15[] PROGMEM = "G1 X50 Y55 E3.62773"; - -static const char * const cmd_meander[] PROGMEM = -{ - cmd_meander_0, - cmd_meander_1, - cmd_meander_2, - cmd_meander_3, - cmd_meander_4, - cmd_meander_5, - cmd_meander_6, - cmd_meander_7, - cmd_meander_8, - cmd_meander_9, - cmd_meander_10, - cmd_meander_11, - cmd_meander_12, - cmd_meander_13, - cmd_meander_14, - cmd_meander_15, -}; //! @brief Count extrude length //! @@ -184,6 +146,43 @@ static const float extr = count_e(heigth, width, length); //!< E axis movement n //! @param cmd_buffer character buffer needed to format gcodes void lay1cal_meander(char *cmd_buffer) { + static const char cmd_meander_0[] PROGMEM = "G1 X50 Y155"; + static const char cmd_meander_1[] PROGMEM = "G1 Z0.150 F7200.000"; + static const char cmd_meander_2[] PROGMEM = "G1 F1080"; + static const char cmd_meander_3[] PROGMEM = "G1 X75 Y155 E2.5"; + static const char cmd_meander_4[] PROGMEM = "G1 X100 Y155 E2"; + static const char cmd_meander_5[] PROGMEM = "G1 X200 Y155 E2.62773"; + static const char cmd_meander_6[] PROGMEM = "G1 X200 Y135 E0.66174"; + static const char cmd_meander_7[] PROGMEM = "G1 X50 Y135 E3.62773"; + static const char cmd_meander_8[] PROGMEM = "G1 X50 Y115 E0.49386"; + static const char cmd_meander_9[] PROGMEM = "G1 X200 Y115 E3.62773"; + static const char cmd_meander_10[] PROGMEM = "G1 X200 Y95 E0.49386"; + static const char cmd_meander_11[] PROGMEM = "G1 X50 Y95 E3.62773"; + static const char cmd_meander_12[] PROGMEM = "G1 X50 Y75 E0.49386"; + static const char cmd_meander_13[] PROGMEM = "G1 X200 Y75 E3.62773"; + static const char cmd_meander_14[] PROGMEM = "G1 X200 Y55 E0.49386"; + static const char cmd_meander_15[] PROGMEM = "G1 X50 Y55 E3.62773"; + + static const char * const cmd_meander[] PROGMEM = + { + cmd_meander_0, + cmd_meander_1, + cmd_meander_2, + cmd_meander_3, + cmd_meander_4, + cmd_meander_5, + cmd_meander_6, + cmd_meander_7, + cmd_meander_8, + cmd_meander_9, + cmd_meander_10, + cmd_meander_11, + cmd_meander_12, + cmd_meander_13, + cmd_meander_14, + cmd_meander_15, + }; + for (uint8_t i = 0; i < (sizeof(cmd_meander)/sizeof(cmd_meander[0])); ++i) { enquecommand_P(static_cast(pgm_read_ptr(&cmd_meander[i]))); From b15bbaf1779acdea717c34274e957f5f9b21b9bf Mon Sep 17 00:00:00 2001 From: DRracer Date: Wed, 12 Jun 2019 10:31:09 +0200 Subject: [PATCH 266/368] for cycles' variables: int -> uint8_t where appropriate, part1 --- Firmware/temperature.cpp | 2 +- Firmware/tmc2130.cpp | 10 +++++----- Firmware/ultralcd.cpp | 32 ++++++++++++++++---------------- 3 files changed, 22 insertions(+), 22 deletions(-) mode change 100644 => 100755 Firmware/tmc2130.cpp diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 9c49cf79c..03845b120 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -434,7 +434,7 @@ static void temp_runaway_stop(bool isPreheat, bool isBed); void updatePID() { #ifdef PIDTEMP - for(int e = 0; e < EXTRUDERS; e++) { + for(uint8_t e = 0; e < EXTRUDERS; e++) { iState_sum_max[e] = PID_INTEGRAL_DRIVE_MAX / cs.Ki; } #endif diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp old mode 100644 new mode 100755 index 05ea2ab6a..fe04e8dab --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -158,7 +158,7 @@ void tmc2130_init() SET_INPUT(Y_TMC2130_DIAG); SET_INPUT(Z_TMC2130_DIAG); SET_INPUT(E0_TMC2130_DIAG); - for (int axis = 0; axis < 2; axis++) // X Y axes + for (uint8_t axis = 0; axis < 2; axis++) // X Y axes { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -169,7 +169,7 @@ void tmc2130_init() tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS); //tmc2130_wr_THIGH(axis, TMC2130_THIGH); } - for (int axis = 2; axis < 3; axis++) // Z axis + for (uint8_t axis = 2; axis < 3; axis++) // Z axis { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -183,7 +183,7 @@ void tmc2130_init() tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS); #endif //TMC2130_STEALTH_Z } - for (int axis = 3; axis < 4; axis++) // E axis + for (uint8_t axis = 3; axis < 4; axis++) // E axis { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -383,7 +383,7 @@ void tmc2130_check_overtemp() static uint32_t checktime = 0; if (_millis() - checktime > 1000 ) { - for (int i = 0; i < 4; i++) + for (uint8_t i = 0; i < 4; i++) { uint32_t drv_status = 0; skip_debug_msg = true; @@ -392,7 +392,7 @@ void tmc2130_check_overtemp() { // BIT 26 - over temp prewarning ~120C (+-20C) SERIAL_ERRORRPGM(MSG_TMC_OVERTEMP); SERIAL_ECHOLN(i); - for (int j = 0; j < 4; j++) + for (uint8_t j = 0; j < 4; j++) tmc2130_wr(j, TMC2130_REG_CHOPCONF, 0x00010000); kill(MSG_TMC_OVERTEMP); } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index be4b15377..c19555d54 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -317,7 +317,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, char* longF char c; int enc_dif = lcd_encoder_diff; uint8_t n = LCD_WIDTH - 1; - for(int g = 0; g<4;g++){ + for(uint8_t g = 0; g<4;g++){ lcd_set_cursor(0, g); lcd_print(' '); } @@ -2578,11 +2578,11 @@ void lcd_change_success() { static void lcd_loading_progress_bar(uint16_t loading_time_ms) { - for (int i = 0; i < 20; i++) { + for (uint8_t i = 0; i < 20; i++) { lcd_set_cursor(i, 3); lcd_print("."); //loading_time_ms/20 delay - for (int j = 0; j < 5; j++) { + for (uint8_t j = 0; j < 5; j++) { delay_keep_alive(loading_time_ms / 100); } } @@ -3024,7 +3024,7 @@ static void lcd_menu_xyz_offset() float cntr[2]; world2machine_read_valid(vec_x, vec_y, cntr); - for (int i = 0; i < 2; i++) + for (uint8_t i = 0; i < 2; i++) { lcd_puts_at_P(11, i + 2, PSTR("")); lcd_print(cntr[i]); @@ -4692,7 +4692,7 @@ void lcd_v2_calibration() else { lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 lcd_consume_click(); - for (int i = 0; i < 20; i++) { //wait max. 2s + for (uint8_t i = 0; i < 20; i++) { //wait max. 2s delay_keep_alive(100); if (lcd_clicked()) { break; @@ -5419,7 +5419,7 @@ void bowden_menu() { lcd_clear(); lcd_set_cursor(0, 0); lcd_print(">"); - for (int i = 0; i < 4; i++) { + for (uint8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print("Extruder "); lcd_print(i); @@ -5507,7 +5507,7 @@ void bowden_menu() { enc_dif = lcd_encoder_diff; lcd_set_cursor(0, cursor_pos); lcd_print(">"); - for (int i = 0; i < 4; i++) { + for (uint8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print("Extruder "); lcd_print(i); @@ -5634,14 +5634,14 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite if (header) lcd_puts_at_P(0,0,header); const bool last_visible = (first == items_no - 3); - const int8_t ordinary_items = (last_item&&last_visible)?2:3; + const uint8_t ordinary_items = (last_item&&last_visible)?2:3; - for (int i = 0; i < ordinary_items; i++) + for (uint8_t i = 0; i < ordinary_items; i++) { if (item) lcd_puts_at_P(1, i + 1, item); } - for (int i = 0; i < ordinary_items; i++) + for (uint8_t i = 0; i < ordinary_items; i++) { lcd_set_cursor(2 + item_len, i+1); lcd_print(first + i + 1); @@ -5695,7 +5695,7 @@ char reset_menu() { lcd_consume_click(); while (1) { - for (int i = 0; i < 4; i++) { + for (uint8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print(item[first + i]); } @@ -6021,7 +6021,7 @@ unsigned char lcd_choose_color() { item[0] = "Orange"; item[1] = "Black"; //----------------------------------------------------- - unsigned char active_rows; + uint8_t active_rows; static int first = 0; int enc_dif = 0; unsigned char cursor_pos = 1; @@ -6034,7 +6034,7 @@ unsigned char lcd_choose_color() { lcd_consume_click(); while (1) { lcd_puts_at_P(0, 0, PSTR("Choose color:")); - for (int i = 0; i < active_rows; i++) { + for (uint8_t i = 0; i < active_rows; i++) { lcd_set_cursor(1, i+1); lcd_print(item[first + i]); } @@ -7071,7 +7071,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { //end of second measurement, now check for possible errors: - for(int i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length + for(uint8_t i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length printf_P(_N("Measured axis length:%.3f\n"), measured_axis_length[i]); if (abs(measured_axis_length[i] - axis_length) > max_error_mm) { enable_endstops(false); @@ -7935,7 +7935,7 @@ static void menu_action_sdfile(const char* filename) const char end[5] = ".gco"; //we are storing just first 8 characters of 8.3 filename assuming that extension is always ".gco" - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { if (strcmp((cmd + i + 4), end) == 0) { //filename is shorter then 8.3, store '\0' character on position where ".gco" string was found to terminate stored string properly eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, '\0'); @@ -7950,7 +7950,7 @@ static void menu_action_sdfile(const char* filename) eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth); for (uint8_t i = 0; i < depth; i++) { - for (int j = 0; j < 8; j++) { + for (uint8_t j = 0; j < 8; j++) { eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]); } } From 49f172a7b9fd2ea71425122b5acf2df4679e1ec9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 15:01:57 +0200 Subject: [PATCH 267/368] Convert uint8_t cycle control varibles changed in previous commit to uint_least8_t to be potentially more portable. --- Firmware/temperature.cpp | 2 +- Firmware/tmc2130.cpp | 10 +++++----- Firmware/ultralcd.cpp | 34 +++++++++++++++++----------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 03845b120..08d1a55b1 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -434,7 +434,7 @@ static void temp_runaway_stop(bool isPreheat, bool isBed); void updatePID() { #ifdef PIDTEMP - for(uint8_t e = 0; e < EXTRUDERS; e++) { + for(uint_least8_t e = 0; e < EXTRUDERS; e++) { iState_sum_max[e] = PID_INTEGRAL_DRIVE_MAX / cs.Ki; } #endif diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index fe04e8dab..7bfd9708b 100755 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -158,7 +158,7 @@ void tmc2130_init() SET_INPUT(Y_TMC2130_DIAG); SET_INPUT(Z_TMC2130_DIAG); SET_INPUT(E0_TMC2130_DIAG); - for (uint8_t axis = 0; axis < 2; axis++) // X Y axes + for (uint_least8_t axis = 0; axis < 2; axis++) // X Y axes { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -169,7 +169,7 @@ void tmc2130_init() tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS); //tmc2130_wr_THIGH(axis, TMC2130_THIGH); } - for (uint8_t axis = 2; axis < 3; axis++) // Z axis + for (uint_least8_t axis = 2; axis < 3; axis++) // Z axis { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -183,7 +183,7 @@ void tmc2130_init() tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS); #endif //TMC2130_STEALTH_Z } - for (uint8_t axis = 3; axis < 4; axis++) // E axis + for (uint_least8_t axis = 3; axis < 4; axis++) // E axis { tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000); @@ -383,7 +383,7 @@ void tmc2130_check_overtemp() static uint32_t checktime = 0; if (_millis() - checktime > 1000 ) { - for (uint8_t i = 0; i < 4; i++) + for (uint_least8_t i = 0; i < 4; i++) { uint32_t drv_status = 0; skip_debug_msg = true; @@ -392,7 +392,7 @@ void tmc2130_check_overtemp() { // BIT 26 - over temp prewarning ~120C (+-20C) SERIAL_ERRORRPGM(MSG_TMC_OVERTEMP); SERIAL_ECHOLN(i); - for (uint8_t j = 0; j < 4; j++) + for (uint_least8_t j = 0; j < 4; j++) tmc2130_wr(j, TMC2130_REG_CHOPCONF, 0x00010000); kill(MSG_TMC_OVERTEMP); } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c19555d54..c22b95811 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -317,7 +317,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, char* longF char c; int enc_dif = lcd_encoder_diff; uint8_t n = LCD_WIDTH - 1; - for(uint8_t g = 0; g<4;g++){ + for(uint_least8_t g = 0; g<4;g++){ lcd_set_cursor(0, g); lcd_print(' '); } @@ -2578,11 +2578,11 @@ void lcd_change_success() { static void lcd_loading_progress_bar(uint16_t loading_time_ms) { - for (uint8_t i = 0; i < 20; i++) { + for (uint_least8_t i = 0; i < 20; i++) { lcd_set_cursor(i, 3); lcd_print("."); //loading_time_ms/20 delay - for (uint8_t j = 0; j < 5; j++) { + for (uint_least8_t j = 0; j < 5; j++) { delay_keep_alive(loading_time_ms / 100); } } @@ -3024,7 +3024,7 @@ static void lcd_menu_xyz_offset() float cntr[2]; world2machine_read_valid(vec_x, vec_y, cntr); - for (uint8_t i = 0; i < 2; i++) + for (uint_least8_t i = 0; i < 2; i++) { lcd_puts_at_P(11, i + 2, PSTR("")); lcd_print(cntr[i]); @@ -4692,7 +4692,7 @@ void lcd_v2_calibration() else { lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 lcd_consume_click(); - for (uint8_t i = 0; i < 20; i++) { //wait max. 2s + for (uint_least8_t i = 0; i < 20; i++) { //wait max. 2s delay_keep_alive(100); if (lcd_clicked()) { break; @@ -5419,7 +5419,7 @@ void bowden_menu() { lcd_clear(); lcd_set_cursor(0, 0); lcd_print(">"); - for (uint8_t i = 0; i < 4; i++) { + for (uint_least8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print("Extruder "); lcd_print(i); @@ -5507,7 +5507,7 @@ void bowden_menu() { enc_dif = lcd_encoder_diff; lcd_set_cursor(0, cursor_pos); lcd_print(">"); - for (uint8_t i = 0; i < 4; i++) { + for (uint_least8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print("Extruder "); lcd_print(i); @@ -5634,14 +5634,14 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite if (header) lcd_puts_at_P(0,0,header); const bool last_visible = (first == items_no - 3); - const uint8_t ordinary_items = (last_item&&last_visible)?2:3; + const uint_least8_t ordinary_items = (last_item&&last_visible)?2:3; - for (uint8_t i = 0; i < ordinary_items; i++) + for (uint_least8_t i = 0; i < ordinary_items; i++) { if (item) lcd_puts_at_P(1, i + 1, item); } - for (uint8_t i = 0; i < ordinary_items; i++) + for (uint_least8_t i = 0; i < ordinary_items; i++) { lcd_set_cursor(2 + item_len, i+1); lcd_print(first + i + 1); @@ -5695,7 +5695,7 @@ char reset_menu() { lcd_consume_click(); while (1) { - for (uint8_t i = 0; i < 4; i++) { + for (uint_least8_t i = 0; i < 4; i++) { lcd_set_cursor(1, i); lcd_print(item[first + i]); } @@ -6021,7 +6021,7 @@ unsigned char lcd_choose_color() { item[0] = "Orange"; item[1] = "Black"; //----------------------------------------------------- - uint8_t active_rows; + uint_least8_t active_rows; static int first = 0; int enc_dif = 0; unsigned char cursor_pos = 1; @@ -6034,7 +6034,7 @@ unsigned char lcd_choose_color() { lcd_consume_click(); while (1) { lcd_puts_at_P(0, 0, PSTR("Choose color:")); - for (uint8_t i = 0; i < active_rows; i++) { + for (uint_least8_t i = 0; i < active_rows; i++) { lcd_set_cursor(1, i+1); lcd_print(item[first + i]); } @@ -7071,7 +7071,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { //end of second measurement, now check for possible errors: - for(uint8_t i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length + for(uint_least8_t i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length printf_P(_N("Measured axis length:%.3f\n"), measured_axis_length[i]); if (abs(measured_axis_length[i] - axis_length) > max_error_mm) { enable_endstops(false); @@ -7935,7 +7935,7 @@ static void menu_action_sdfile(const char* filename) const char end[5] = ".gco"; //we are storing just first 8 characters of 8.3 filename assuming that extension is always ".gco" - for (uint8_t i = 0; i < 8; i++) { + for (uint_least8_t i = 0; i < 8; i++) { if (strcmp((cmd + i + 4), end) == 0) { //filename is shorter then 8.3, store '\0' character on position where ".gco" string was found to terminate stored string properly eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, '\0'); @@ -7949,8 +7949,8 @@ static void menu_action_sdfile(const char* filename) uint8_t depth = (uint8_t)card.getWorkDirDepth(); eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth); - for (uint8_t i = 0; i < depth; i++) { - for (uint8_t j = 0; j < 8; j++) { + for (uint_least8_t i = 0; i < depth; i++) { + for (uint_least8_t j = 0; j < 8; j++) { eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]); } } From 94a51759802837b73cb1220dd90433a6b1c094d7 Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 11 Jun 2019 16:24:40 +0200 Subject: [PATCH 268/368] Code size reduction - saved almost 2KB --- Firmware/ultralcd.cpp | 114 ++++++++++-------------------------------- Firmware/ultralcd.h | 2 +- 2 files changed, 27 insertions(+), 89 deletions(-) mode change 100644 => 100755 Firmware/ultralcd.h diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f69efbbc3..b7f7e68d1 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -73,8 +73,8 @@ extern void crashdet_disable(); bool presort_flag = false; #endif -int lcd_commands_type = LCD_COMMAND_IDLE; -int lcd_commands_step = 0; +uint8_t lcd_commands_type = LCD_COMMAND_IDLE; +uint8_t lcd_commands_step = 0; unsigned int custom_message_type = CUSTOM_MSG_TYPE_STATUS; unsigned int custom_message_state = 0; @@ -1060,6 +1060,20 @@ static void lcd_status_screen() feedmultiply = 999; } +//! extracted common code from lcd_commands into a separate function +//! along with the sprintf_P optimization this change gained more than 1.6KB +static void lcd_commands_func1(char *cmd1, uint8_t i, float width, float extr, float extr_short_segment){ + static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f"; + static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f"; + sprintf_P(cmd1, fmt1, 70, (35 - i*width * 2), extr); + enquecommand(cmd1); + sprintf_P(cmd1, fmt2, (35 - (2 * i + 1)*width), extr_short_segment); + enquecommand(cmd1); + sprintf_P(cmd1, fmt1, 50, (35 - (2 * i + 1)*width), extr); + enquecommand(cmd1); + sprintf_P(cmd1, fmt2, (35 - (i + 1)*width * 2), extr_short_segment); + enquecommand(cmd1); +} void lcd_commands() { @@ -1496,27 +1510,8 @@ void lcd_commands() lcd_timeoutToStatus.start(); - for (int i = 0; i < 4; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 0; i < 4; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 5; @@ -1525,56 +1520,18 @@ void lcd_commands() if (lcd_commands_step == 5 && !blocks_queued() && cmd_buffer_empty()) { lcd_timeoutToStatus.start(); - for (int i = 4; i < 8; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 4; i < 8; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 4; } - + if (lcd_commands_step == 4 && !blocks_queued() && cmd_buffer_empty()) { - lcd_timeoutToStatus.start(); - for (int i = 8; i < 12; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + lcd_timeoutToStatus.start(); + for (uint8_t i = 8; i < 12; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 3; @@ -1583,27 +1540,8 @@ void lcd_commands() if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty()) { lcd_timeoutToStatus.start(); - for (int i = 12; i < 16; i++) { - strcpy(cmd1, "G1 X70 Y"); - strcat(cmd1, ftostr32(35 - i*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); - strcpy(cmd1, "G1 X50 Y"); - strcat(cmd1, ftostr32(35 - (2 * i + 1)*width)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr)); - enquecommand(cmd1); - strcpy(cmd1, "G1 Y"); - strcat(cmd1, ftostr32(35 - (i + 1)*width * 2)); - strcat(cmd1, " E"); - strcat(cmd1, ftostr43(extr_short_segment)); - enquecommand(cmd1); + for (uint8_t i = 12; i < 16; i++) { + lcd_commands_func1(cmd1, i, width, extr, extr_short_segment ); } lcd_commands_step = 2; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h old mode 100644 new mode 100755 index 665c1233f..f8cf83652 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -97,7 +97,7 @@ extern void lcd_diag_show_end_stops(); #define LCD_COMMAND_PID_EXTRUDER 7 #define LCD_COMMAND_V2_CAL 8 -extern int lcd_commands_type; +extern uint8_t lcd_commands_type; extern int8_t FSensorStateMenu; #define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable From c7e1e738808d82d533d43e9bea09a228245262ad Mon Sep 17 00:00:00 2001 From: DRracer Date: Wed, 12 Jun 2019 09:58:42 +0200 Subject: [PATCH 269/368] another almost 200B down by proper usage of smaller data types and enum classes --- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 38 +++---- Firmware/cmdqueue.cpp | 2 +- Firmware/mmu.cpp | 6 +- Firmware/ultralcd.cpp | 236 +++++++++++++++++++-------------------- Firmware/ultralcd.h | 59 +++++----- 6 files changed, 174 insertions(+), 169 deletions(-) mode change 100644 => 100755 Firmware/Marlin.h mode change 100644 => 100755 Firmware/cmdqueue.cpp mode change 100644 => 100755 Firmware/mmu.cpp diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h old mode 100644 new mode 100755 index 2e60597dc..f53e55cc9 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -389,7 +389,7 @@ extern bool wizard_active; //autoload temporarily disabled during wizard extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff -#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CUSTOM_MSG_TYPE_TEMCAL) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused || mmu_print_saved) +#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsgTypes::TEMCAL) || saved_printing || (lcd_commands_type == LcdCommands::V2_CAL) || card.paused || mmu_print_saved) //! Beware - mcode_in_progress is set as soon as the command gets really processed, //! which is not the same as posting the M600 command into the command queue //! There can be a considerable lag between posting M600 and its real processing which might result diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 711c428b9..e08462288 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3157,7 +3157,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float #endif //IR_SENSOR lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; } //! @brief Rise Z if too low to avoid blob/jam before filament loading @@ -3181,7 +3181,7 @@ void gcode_M701() else { enable_z(); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; #ifdef FSENSOR_QUALITY fsensor_oq_meassure_start(40); @@ -3211,7 +3211,7 @@ void gcode_M701() lcd_setstatuspgm(_T(WELCOME_MSG)); disable_z(); loading_flag = false; - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; #ifdef FSENSOR_QUALITY fsensor_oq_meassure_stop(); @@ -4194,7 +4194,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // setTargetHotend(200, 0); setTargetBed(70 + (start_temp - 30)); - custom_message_type = CUSTOM_MSG_TYPE_TEMCAL; + custom_message_type = CustomMsgTypes::TEMCAL; custom_message_state = 1; lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION)); current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; @@ -4296,7 +4296,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; } puts_P(_N("PINDA probe calibration start")); - custom_message_type = CUSTOM_MSG_TYPE_TEMCAL; + custom_message_type = CustomMsgTypes::TEMCAL; custom_message_state = 1; lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION)); current_position[X_AXIS] = PINDA_PREHEAT_X; @@ -4364,7 +4364,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1); puts_P(_N("Temperature calibration done.")); @@ -4424,7 +4424,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // We don't know where we are! HOME! // Push the commands to the front of the message queue in the reverse order! // There shall be always enough space reserved for these commands. - if (lcd_commands_type != LCD_COMMAND_STOP_PRINT) { + if (lcd_commands_type != LcdCommands::STOP_PRINT) { repeatcommand_front(); // repeat G80 with all its parameters enquecommand_front_P((PSTR("G28 W0"))); } @@ -4464,7 +4464,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (temp_comp_start) if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50) { - if (lcd_commands_type != LCD_COMMAND_STOP_PRINT) { + if (lcd_commands_type != LcdCommands::STOP_PRINT) { temp_compensation_start(); run = true; repeatcommand_front(); // repeat G80 with all its parameters @@ -4476,14 +4476,14 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; } run = false; - if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) { + if (lcd_commands_type == LcdCommands::STOP_PRINT) { mesh_bed_leveling_flag = false; break; } // Save custom message state, set a new custom message state to display: Calibrating point 9. - unsigned int custom_message_type_old = custom_message_type; + CustomMsgTypes custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CUSTOM_MSG_TYPE_MESHBL; + custom_message_type = CustomMsgTypes::MESHBL; custom_message_state = (nMeasPoints * nMeasPoints) + 10; lcd_update(1); @@ -4683,7 +4683,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) enable_z_endstop(bState); } while (st_get_position_mm(Z_AXIS) > MESH_HOME_Z_SEARCH); // i.e. Z-leveling not o.k. // plan_set_z_position(MESH_HOME_Z_SEARCH); // is not necessary ('do-while' loop always ends at the expected Z-position) - custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery + custom_message_type=CustomMsgTypes::STATUS; // display / status-line recovery lcd_update_enable(true); // display / status-line recovery gcode_G28(true, true, true); // X & Y & Z-homing (must be after individual Z-homing (problem with spool-holder)!) repeatcommand_front(); // re-run (i.e. of "G80") @@ -7693,9 +7693,9 @@ bool bInhibitFlag; #ifdef IR_SENSOR bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active #endif // IR_SENSOR - if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active + if ((mcode_in_progress != 600) && (eFilamentAction != eFILAMENT_ACTION::autoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active { - if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL) && !wizard_active) { if (fsensor_check_autoload()) { @@ -7719,7 +7719,7 @@ if(0) show_preheat_nozzle_warning(); lcd_update_enable(true); */ - eFilamentAction=e_FILAMENT_ACTION_autoLoad; + eFilamentAction=eFILAMENT_ACTION::autoLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -8210,7 +8210,7 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CUSTOM_MSG_TYPE_MESHBL; + custom_message_type = CustomMsgTypes::MESHBL; custom_message_state = (x_points_num * y_points_num) + 10; lcd_update(1); @@ -8408,7 +8408,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CUSTOM_MSG_TYPE_MESHBL; + custom_message_type = CustomMsgTypes::MESHBL; custom_message_state = (x_points_num * y_points_num) + 10; lcd_update(1); @@ -8558,7 +8558,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ void temp_compensation_start() { - custom_message_type = CUSTOM_MSG_TYPE_TEMPRE; + custom_message_type = CustomMsgTypes::TEMPRE; custom_message_state = PINDA_HEAT_T + 1; lcd_update(2); if (degHotend(active_extruder) > EXTRUDE_MINTEMP) { @@ -8579,7 +8579,7 @@ void temp_compensation_start() { if (custom_message_state == 99 || custom_message_state == 9) lcd_update(2); //force whole display redraw if number of digits changed else lcd_update(1); } - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; custom_message_state = 0; } diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp old mode 100644 new mode 100755 index 2e29ad5f9..1e1167c49 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -598,7 +598,7 @@ void get_command() if (farm_mode) { prusa_statistics(6); - lcd_commands_type = LCD_COMMAND_FARM_MODE_CONFIRM; + lcd_commands_type = LcdCommands::FARM_MODE_CONFIRM; } } diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp old mode 100644 new mode 100755 index 916b3d0fd..c289f31d5 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1076,7 +1076,7 @@ if(0) extr_unload(); } else { - eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad; + eFilamentAction=eFILAMENT_ACTION::mmuUnLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -1372,13 +1372,13 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr) mmu_load_to_nozzle(); load_filament_final_feed(); st_synchronize(); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); lcd_return_to_status(); lcd_update_enable(true); lcd_load_filament_color_check(); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b7f7e68d1..19601df3f 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -73,10 +73,10 @@ extern void crashdet_disable(); bool presort_flag = false; #endif -uint8_t lcd_commands_type = LCD_COMMAND_IDLE; +LcdCommands lcd_commands_type = LcdCommands::IDLE; uint8_t lcd_commands_step = 0; -unsigned int custom_message_type = CUSTOM_MSG_TYPE_STATUS; +CustomMsgTypes custom_message_type = CustomMsgTypes::STATUS; unsigned int custom_message_state = 0; @@ -84,7 +84,7 @@ bool isPrintPaused = false; uint8_t farm_mode = 0; int farm_no = 0; int farm_timer = 8; -int farm_status = 0; +uint8_t farm_status = 0; bool printer_connected = true; unsigned long display_time; //just timer for showing pid finished message on lcd; @@ -565,7 +565,7 @@ void lcdui_print_temp(char type, int val_current, int val_target) // Print Z-coordinate (8 chars total) void lcdui_print_Z_coord(void) { - if (custom_message_type == CUSTOM_MSG_TYPE_MESHBL) + if (custom_message_type == CustomMsgTypes::MESHBL) lcd_puts_P(_N("Z --- ")); else lcd_printf_P(_N("Z%6.2f "), current_position[Z_AXIS]); @@ -760,7 +760,7 @@ void lcdui_print_status_line(void) break; } } - else if ((IS_SD_PRINTING) && (custom_message_type == CUSTOM_MSG_TYPE_STATUS)) + else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsgTypes::STATUS)) { // If printing from SD, show what we are printing if(strlen(card.longFilename) > LCD_WIDTH) { @@ -794,10 +794,10 @@ void lcdui_print_status_line(void) { // Otherwise check for other special events switch (custom_message_type) { - case CUSTOM_MSG_TYPE_STATUS: // Nothing special, print status message normally + case CustomMsgTypes::STATUS: // Nothing special, print status message normally lcd_print(lcd_status_message); break; - case CUSTOM_MSG_TYPE_MESHBL: // If mesh bed leveling in progress, show the status + case CustomMsgTypes::MESHBL: // If mesh bed leveling in progress, show the status if (custom_message_state > 10) { lcd_set_cursor(0, 3); @@ -813,7 +813,7 @@ void lcdui_print_status_line(void) { lcd_puts_P(_T(WELCOME_MSG)); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; } if (custom_message_state > 3 && custom_message_state <= 10 ) { @@ -825,10 +825,10 @@ void lcdui_print_status_line(void) } } break; - case CUSTOM_MSG_TYPE_F_LOAD: // If loading filament, print status + case CustomMsgTypes::F_LOAD: // If loading filament, print status lcd_print(lcd_status_message); break; - case CUSTOM_MSG_TYPE_PIDCAL: // PID tuning in progress + case CustomMsgTypes::PIDCAL: // PID tuning in progress lcd_print(lcd_status_message); if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) { @@ -838,7 +838,7 @@ void lcdui_print_status_line(void) lcd_print(itostr3left(pid_number_of_cycles)); } break; - case CUSTOM_MSG_TYPE_TEMCAL: // PINDA temp calibration in progress + case CustomMsgTypes::TEMCAL: // PINDA temp calibration in progress { char progress[4]; lcd_set_cursor(0, 3); @@ -848,7 +848,7 @@ void lcdui_print_status_line(void) lcd_print(progress); } break; - case CUSTOM_MSG_TYPE_TEMPRE: // temp compensation preheat + case CustomMsgTypes::TEMPRE: // temp compensation preheat lcd_set_cursor(0, 3); lcd_puts_P(_i("PINDA Heating"));////MSG_PINDA_PREHEAT c=20 r=1 if (custom_message_state <= PINDA_HEAT_T) @@ -996,7 +996,7 @@ static void lcd_status_screen() } // end of farm_mode lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */ - if (lcd_commands_type != LCD_COMMAND_IDLE) + if (lcd_commands_type != LcdCommands::IDLE) lcd_commands(); } // end of lcd_draw_update @@ -1020,7 +1020,7 @@ static void lcd_status_screen() } if (current_click - && (lcd_commands_type != LCD_COMMAND_STOP_PRINT) //click is aborted unless stop print finishes + && (lcd_commands_type != LcdCommands::STOP_PRINT) //click is aborted unless stop print finishes && ( menu_block_entering_on_serious_errors == SERIOUS_ERR_NONE ) // or a serious error blocks entering the menu ) { @@ -1077,15 +1077,15 @@ static void lcd_commands_func1(char *cmd1, uint8_t i, float width, float extr, f void lcd_commands() { - if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) + if (lcd_commands_type == LcdCommands::LONG_PAUSE) { if (!blocks_queued() && !homing_flag) { lcd_setstatuspgm(_i("Print paused"));////MSG_PRINT_PAUSED c=20 r=1 long_pause(); - if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) // !!! because "lcd_commands_type" can be changed during/inside "long_pause()" + if (lcd_commands_type == LcdCommands::LONG_PAUSE) // !!! because "lcd_commands_type" can be changed during/inside "long_pause()" { - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; lcd_commands_step = 0; } } @@ -1093,7 +1093,7 @@ void lcd_commands() #ifdef SNMM - if (lcd_commands_type == LCD_COMMAND_V2_CAL) + if (lcd_commands_type == LcdCommands::V2_CAL) { char cmd1[30]; float width = 0.4; @@ -1358,7 +1358,7 @@ void lcd_commands() #else //if not SNMM - if (lcd_commands_type == LCD_COMMAND_V2_CAL) + if (lcd_commands_type == LcdCommands::V2_CAL) { char cmd1[30]; static uint8_t filament = 0; @@ -1565,7 +1565,7 @@ void lcd_commands() { lcd_setstatuspgm(_T(WELCOME_MSG)); lcd_commands_step = 0; - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { lcd_wizard(WizState::RepeatLay1Cal); } @@ -1575,7 +1575,7 @@ void lcd_commands() #endif // not SNMM - if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print + if (lcd_commands_type == LcdCommands::STOP_PRINT) /// stop print { @@ -1587,9 +1587,9 @@ void lcd_commands() if (lcd_commands_step == 1 && !blocks_queued()) { lcd_commands_step = 0; - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; isPrintPaused = false; } if (lcd_commands_step == 2 && !blocks_queued()) @@ -1645,7 +1645,7 @@ void lcd_commands() if (mmu_enabled) setAllTargetHotends(0); manage_heater(); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; lcd_commands_step = 5; } if (lcd_commands_step == 7 && !blocks_queued()) @@ -1667,12 +1667,12 @@ void lcd_commands() } } - if (lcd_commands_type == 3) + if (lcd_commands_type == LcdCommands::UNKNOWN3) { - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; } - if (lcd_commands_type == LCD_COMMAND_FARM_MODE_CONFIRM) /// farm mode confirm + if (lcd_commands_type == LcdCommands::FARM_MODE_CONFIRM) /// farm mode confirm { if (lcd_commands_step == 0) { lcd_commands_step = 6; } @@ -1681,7 +1681,7 @@ void lcd_commands() { lcd_confirm_print(); lcd_commands_step = 0; - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; } if (lcd_commands_step == 2 && !blocks_queued()) { @@ -1714,11 +1714,11 @@ void lcd_commands() } } - if (lcd_commands_type == LCD_COMMAND_PID_EXTRUDER) { + if (lcd_commands_type == LcdCommands::PID_EXTRUDER) { char cmd1[30]; if (lcd_commands_step == 0) { - custom_message_type = CUSTOM_MSG_TYPE_PIDCAL; + custom_message_type = CustomMsgTypes::PIDCAL; custom_message_state = 1; lcd_draw_update = 3; lcd_commands_step = 3; @@ -1754,10 +1754,10 @@ void lcd_commands() } if ((lcd_commands_step == 1) && ((_millis()- display_time)>2000)) { //calibration finished message lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; pid_temp = DEFAULT_PID_TEMP; lcd_commands_step = 0; - lcd_commands_type = 0; + lcd_commands_type = LcdCommands::IDLE; } } @@ -1775,7 +1775,7 @@ void lcd_return_to_status() lcd_refresh(); // to maybe revive the LCD if static electricity killed it. menu_goto(lcd_status_screen, 0, false, true); menu_depth = 0; - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } //! @brief Pause print, disable nozzle heater, move to park position @@ -1785,9 +1785,9 @@ void lcd_pause_print() stop_and_save_print_to_ram(0.0,0.0); setAllTargetHotends(0); isPrintPaused = true; - if (LCD_COMMAND_IDLE == lcd_commands_type) + if (LcdCommands::IDLE == lcd_commands_type) { - lcd_commands_type = LCD_COMMAND_LONG_PAUSE; + lcd_commands_type = LcdCommands::LONG_PAUSE; } } @@ -1928,7 +1928,7 @@ void lcd_menu_extruder_info() // NOT static due to using ins lcd_puts_P(_N("Filament sensor\n" "is disabled.")); else { - if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) pat9125_update(); lcd_printf_P(_N( "Fil. Xd:%3d Yd:%3d\n" @@ -2314,7 +2314,7 @@ void lcd_set_filament_oq_meass() } -eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized as 'non-autoLoad' +eFILAMENT_ACTION eFilamentAction=eFILAMENT_ACTION::none; // must be initialized as 'non-autoLoad' bool bFilamentFirstRun; bool bFilamentPreheatState; bool bFilamentAction=false; @@ -2331,18 +2331,18 @@ lcd_puts_P(_i("Press the knob")); ////MSG_ c=20 r=1 lcd_set_cursor(0,3); switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::mmuLoad: lcd_puts_P(_i("to load filament")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_unLoad: - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::unLoad: + case eFILAMENT_ACTION::mmuUnLoad: lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuEject: - case e_FILAMENT_ACTION_mmuCut: - case e_FILAMENT_ACTION_none: + case eFILAMENT_ACTION::mmuEject: + case eFILAMENT_ACTION::mmuCut: + case eFILAMENT_ACTION::none: break; } if(lcd_clicked()) @@ -2356,21 +2356,21 @@ if(lcd_clicked()) menu_back(nLevel); switch(eFilamentAction) { - case e_FILAMENT_ACTION_autoLoad: - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + case eFILAMENT_ACTION::autoLoad: + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad // no break - case e_FILAMENT_ACTION_Load: + case eFILAMENT_ACTION::load: loading_flag=true; enquecommand_P(PSTR("M701")); // load filament break; - case e_FILAMENT_ACTION_unLoad: + case eFILAMENT_ACTION::unLoad: enquecommand_P(PSTR("M702")); // unload filament break; - case e_FILAMENT_ACTION_mmuLoad: - case e_FILAMENT_ACTION_mmuUnLoad: - case e_FILAMENT_ACTION_mmuEject: - case e_FILAMENT_ACTION_mmuCut: - case e_FILAMENT_ACTION_none: + case eFILAMENT_ACTION::mmuLoad: + case eFILAMENT_ACTION::mmuUnLoad: + case eFILAMENT_ACTION::mmuEject: + case eFILAMENT_ACTION::mmuCut: + case eFILAMENT_ACTION::none: break; } } @@ -2394,19 +2394,19 @@ lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0 lcd_set_cursor(0,1); switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::mmuLoad: lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_unLoad: - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::unLoad: + case eFILAMENT_ACTION::mmuUnLoad: lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuEject: + case eFILAMENT_ACTION::mmuEject: lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuCut: + case eFILAMENT_ACTION::mmuCut: lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1 break; } @@ -2425,20 +2425,20 @@ if(lcd_clicked()) setTargetBed((float)nTargetBedOld); } menu_back(); - if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + if(eFilamentAction==eFILAMENT_ACTION::autoLoad) + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } else { if(current_temperature[0]>(target_temperature[0]*0.95)) { switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_unLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::unLoad: menu_submenu(mFilamentPrompt); break; - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::mmuLoad: nLevel=1; if(!bFilamentPreheatState) nLevel++; @@ -2446,7 +2446,7 @@ else { menu_back(nLevel); menu_submenu(mmu_load_to_nozzle_menu); break; - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::mmuUnLoad: nLevel=1; if(!bFilamentPreheatState) nLevel++; @@ -2454,7 +2454,7 @@ else { menu_back(nLevel); extr_unload(); break; - case e_FILAMENT_ACTION_mmuEject: + case eFILAMENT_ACTION::mmuEject: nLevel=1; if(!bFilamentPreheatState) nLevel++; @@ -2462,7 +2462,7 @@ else { menu_back(nLevel); menu_submenu(mmu_fil_eject_menu); break; - case e_FILAMENT_ACTION_mmuCut: + case eFILAMENT_ACTION::mmuCut: nLevel=1; if(!bFilamentPreheatState) nLevel++; @@ -2495,44 +2495,44 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) { switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_unLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::unLoad: if(bFilamentWaitingFlag) menu_submenu(mFilamentPrompt); else { nLevel=bFilamentPreheatState?1:2; menu_back(nLevel); - if((eFilamentAction==e_FILAMENT_ACTION_Load)||(eFilamentAction==e_FILAMENT_ACTION_autoLoad)) + if((eFilamentAction==eFILAMENT_ACTION::load)||(eFilamentAction==eFILAMENT_ACTION::autoLoad)) { loading_flag=true; enquecommand_P(PSTR("M701")); // load filament - if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + if(eFilamentAction==eFILAMENT_ACTION::autoLoad) + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } - if(eFilamentAction==e_FILAMENT_ACTION_unLoad) + if(eFilamentAction==eFILAMENT_ACTION::unLoad) enquecommand_P(PSTR("M702")); // unload filament } break; - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::mmuLoad: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); menu_submenu(mmu_load_to_nozzle_menu); break; - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::mmuUnLoad: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); extr_unload(); break; - case e_FILAMENT_ACTION_mmuEject: + case eFILAMENT_ACTION::mmuEject: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); menu_submenu(mmu_fil_eject_menu); break; - case e_FILAMENT_ACTION_mmuCut: + case eFILAMENT_ACTION::mmuCut: #ifdef MMU_HAS_CUTTER nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; @@ -2540,7 +2540,7 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) menu_submenu(mmu_cut_filament_menu); #endif //MMU_HAS_CUTTER break; - case e_FILAMENT_ACTION_none: + case eFILAMENT_ACTION::none: break; } if(bFilamentWaitingFlag) @@ -2554,22 +2554,22 @@ else { lcd_set_cursor(0,1); switch(eFilamentAction) { - case e_FILAMENT_ACTION_Load: - case e_FILAMENT_ACTION_autoLoad: - case e_FILAMENT_ACTION_mmuLoad: + case eFILAMENT_ACTION::load: + case eFILAMENT_ACTION::autoLoad: + case eFILAMENT_ACTION::mmuLoad: lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_unLoad: - case e_FILAMENT_ACTION_mmuUnLoad: + case eFILAMENT_ACTION::unLoad: + case eFILAMENT_ACTION::mmuUnLoad: lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuEject: + case eFILAMENT_ACTION::mmuEject: lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_mmuCut: + case eFILAMENT_ACTION::mmuCut: lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1 break; - case e_FILAMENT_ACTION_none: + case eFILAMENT_ACTION::none: break; } lcd_set_cursor(0,3); @@ -2588,8 +2588,8 @@ else { setTargetBed((float)nTargetBedOld); } menu_back(); - if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + if(eFilamentAction==eFILAMENT_ACTION::autoLoad) + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } } } @@ -2634,8 +2634,8 @@ mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP,FLEX_PREHEAT_HPB_TEMP); void mFilamentBack() { menu_back(); -if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) - eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad +if(eFilamentAction==eFILAMENT_ACTION::autoLoad) + eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad } void mFilamentMenu() @@ -2666,7 +2666,7 @@ if(0) enquecommand_P(PSTR("M702")); // unload filament } else { - eFilamentAction=e_FILAMENT_ACTION_unLoad; + eFilamentAction=eFILAMENT_ACTION::unLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -2893,7 +2893,7 @@ static void lcd_LoadFilament() if(0) { // menu_back(); // not necessary (see "lcd_return_to_status()" below) - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; loading_flag = true; enquecommand_P(PSTR("M701")); //load filament SERIAL_ECHOLN("Loading filament"); @@ -2901,7 +2901,7 @@ if(0) } else { - eFilamentAction=e_FILAMENT_ACTION_Load; + eFilamentAction=eFILAMENT_ACTION::load; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -3350,7 +3350,7 @@ void pid_extruder() lcd_set_cursor(1, 2); lcd_print(ftostr3(pid_temp)); if (lcd_clicked()) { - lcd_commands_type = LCD_COMMAND_PID_EXTRUDER; + lcd_commands_type = LcdCommands::PID_EXTRUDER; lcd_return_to_status(); lcd_update(2); } @@ -3952,7 +3952,7 @@ void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, ui void lcd_temp_cal_show_result(bool result) { - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; disable_x(); disable_y(); disable_z(); @@ -4573,7 +4573,7 @@ static void lcd_crash_mode_set() }else{ crashdet_enable(); } - if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) menu_goto(lcd_tune_menu, 9, true, true); + if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) menu_goto(lcd_tune_menu, 9, true, true); else menu_goto(lcd_settings_menu, 9, true, true); } @@ -4810,14 +4810,14 @@ void lcd_v2_calibration() if (filament < 5) { lcd_commands_step = 20 + filament; - lcd_commands_type = LCD_COMMAND_V2_CAL; + lcd_commands_type = LcdCommands::V2_CAL; } } else { bool loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is PLA filament loaded?"), false, true);////MSG_PLA_FILAMENT_LOADED c=20 r=2 if (loaded) { - lcd_commands_type = LCD_COMMAND_V2_CAL; + lcd_commands_type = LcdCommands::V2_CAL; } else { lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 @@ -5077,7 +5077,7 @@ void lcd_wizard(WizState state) case S::Lay1Cal: lcd_show_fullscreen_message_and_wait_P(_i("Now I will calibrate distance between tip of the nozzle and heatbed surface."));////MSG_WIZARD_V2_CAL c=20 r=8 lcd_show_fullscreen_message_and_wait_P(_i("I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration."));////MSG_WIZARD_V2_CAL_2 c=20 r=12 - lcd_commands_type = LCD_COMMAND_V2_CAL; + lcd_commands_type = LcdCommands::V2_CAL; lcd_return_to_status(); end = true; break; @@ -5930,7 +5930,7 @@ static void mmu_load_to_nozzle_menu() } else { - eFilamentAction = e_FILAMENT_ACTION_mmuLoad; + eFilamentAction = eFILAMENT_ACTION::mmuLoad; bFilamentFirstRun = false; if (target_temperature[0] >= EXTRUDE_MINTEMP) { @@ -5962,7 +5962,7 @@ static void mmu_fil_eject_menu() } else { - eFilamentAction = e_FILAMENT_ACTION_mmuEject; + eFilamentAction = eFILAMENT_ACTION::mmuEject; bFilamentFirstRun = false; if (target_temperature[0] >= EXTRUDE_MINTEMP) { @@ -5990,7 +5990,7 @@ static void mmu_cut_filament_menu() } else { - eFilamentAction=e_FILAMENT_ACTION_mmuCut; + eFilamentAction=eFILAMENT_ACTION::mmuCut; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -6035,7 +6035,7 @@ static void change_extr_menu(){ //unload filament for single material printer (used in M702 gcode) void unload_filament() { - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + custom_message_type = CustomMsgTypes::F_LOAD; lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT)); // extr_unload2(); @@ -6070,7 +6070,7 @@ void unload_filament() lcd_update_enable(true); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CUSTOM_MSG_TYPE_STATUS; + custom_message_type = CustomMsgTypes::STATUS; } @@ -6397,13 +6397,13 @@ static void lcd_main_menu() }*/ - if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) + if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 } - if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) + if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) { MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE } else @@ -6412,7 +6412,7 @@ static void lcd_main_menu() } #ifdef SDSUPPORT - if (card.cardOK || lcd_commands_type == LCD_COMMAND_V2_CAL) + if (card.cardOK || lcd_commands_type == LcdCommands::V2_CAL) { if (card.isFileOpen()) { @@ -6428,12 +6428,12 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } } - else if (lcd_commands_type == LCD_COMMAND_V2_CAL && mesh_bed_leveling_flag == false && homing_flag == false) { + else if (lcd_commands_type == LcdCommands::V2_CAL && mesh_bed_leveling_flag == false && homing_flag == false) { //MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } else { - if (!is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) + if (!is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) { //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); /*else*/ { @@ -6457,7 +6457,7 @@ static void lcd_main_menu() #endif - if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) + if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) { if (farm_mode) { @@ -6501,7 +6501,7 @@ static void lcd_main_menu() } - if (!is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) + if (!is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) { MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS } @@ -6557,7 +6557,7 @@ static void lcd_colorprint_change() { enquecommand_P(PSTR("M600")); - custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; //just print status message + custom_message_type = CustomMsgTypes::F_LOAD; //just print status message lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); lcd_return_to_status(); lcd_draw_update = 3; @@ -6786,7 +6786,7 @@ void lcd_print_stop() lcd_return_to_status(); lcd_ignore_click(true); lcd_commands_step = 0; - lcd_commands_type = LCD_COMMAND_STOP_PRINT; + lcd_commands_type = LcdCommands::STOP_PRINT; // Turn off the print fan SET_OUTPUT(FAN_PIN); WRITE(FAN_PIN, 0); @@ -8359,5 +8359,5 @@ void menu_lcd_lcdupdate_func(void) if (!SdFatUtil::test_stack_integrity()) stack_error(); lcd_ping(); //check that we have received ping command if we are in farm mode lcd_send_status(); - if (lcd_commands_type == LCD_COMMAND_V2_CAL) lcd_commands(); + if (lcd_commands_type == LcdCommands::V2_CAL) lcd_commands(); } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index f8cf83652..26e282a0f 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -89,31 +89,36 @@ extern void lcd_diag_show_end_stops(); // To be used in lcd_commands_type. -#define LCD_COMMAND_IDLE 0 -#define LCD_COMMAND_LOAD_FILAMENT 1 -#define LCD_COMMAND_STOP_PRINT 2 -#define LCD_COMMAND_FARM_MODE_CONFIRM 4 -#define LCD_COMMAND_LONG_PAUSE 5 -#define LCD_COMMAND_PID_EXTRUDER 7 -#define LCD_COMMAND_V2_CAL 8 +enum class LcdCommands : uint8_t { + IDLE = 0, + LOAD_FILAMENT = 1, + STOP_PRINT = 2, + UNKNOWN3 = 3, + FARM_MODE_CONFIRM = 4, + LONG_PAUSE = 5, + PID_EXTRUDER = 7, + V2_CAL = 8, +}; -extern uint8_t lcd_commands_type; +extern LcdCommands lcd_commands_type; extern int8_t FSensorStateMenu; -#define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable -#define CUSTOM_MSG_TYPE_MESHBL 1 // Mesh bed leveling in progress -#define CUSTOM_MSG_TYPE_F_LOAD 2 // Loading filament in progress -#define CUSTOM_MSG_TYPE_PIDCAL 3 // PID tuning in progress -#define CUSTOM_MSG_TYPE_TEMCAL 4 // PINDA temp calibration -#define CUSTOM_MSG_TYPE_TEMPRE 5 // Temp compensation preheat +enum class CustomMsgTypes : uint8_t { + STATUS = 0, //!< status message from lcd_status_message variable + MESHBL = 1, //!< Mesh bed leveling in progress + F_LOAD = 2, //!< Loading filament in progress + PIDCAL = 3, //!< PID tuning in progress + TEMCAL = 4, //!< PINDA temp calibration + TEMPRE = 5, //!< Temp compensation preheat +}; -extern unsigned int custom_message_type; +extern CustomMsgTypes custom_message_type; extern unsigned int custom_message_state; extern uint8_t farm_mode; extern int farm_no; extern int farm_timer; -extern int farm_status; +extern uint8_t farm_status; #ifdef TMC2130 #define SILENT_MODE_NORMAL 0 @@ -145,17 +150,17 @@ void extr_unload_used(); #endif //SNMM void extr_unload(); -typedef enum -{ - e_FILAMENT_ACTION_none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) - e_FILAMENT_ACTION_Load, - e_FILAMENT_ACTION_autoLoad, - e_FILAMENT_ACTION_unLoad, - e_FILAMENT_ACTION_mmuLoad, - e_FILAMENT_ACTION_mmuUnLoad, - e_FILAMENT_ACTION_mmuEject, - e_FILAMENT_ACTION_mmuCut, -} eFILAMENT_ACTION; +enum class eFILAMENT_ACTION : uint8_t { + none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) + load, + autoLoad, + unLoad, + mmuLoad, + mmuUnLoad, + mmuEject, + mmuCut, +}; + extern eFILAMENT_ACTION eFilamentAction; extern bool bFilamentFirstRun; extern bool bFilamentPreheatState; From e393d91b1241894ae8f55e2b2816f799a62c34e9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 16:20:21 +0200 Subject: [PATCH 270/368] Use first letter capital camel case for enum class members. --- Firmware/mmu.cpp | 18 +++++++++--------- Firmware/temperature.cpp | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index c289f31d5..912305d2a 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1511,20 +1511,20 @@ void mmu_continue_loading(bool blocking) enum class Ls : uint_least8_t { - enter, - retry, - unload, + Enter, + Retry, + Unload, }; - Ls state = Ls::enter; + Ls state = Ls::Enter; while (PIN_GET(IR_SENSOR_PIN) != 0) { switch (state) { - case Ls::enter: + case Ls::Enter: increment_load_fail(); // no break - case Ls::retry: + case Ls::Retry: #ifdef MMU_HAS_CUTTER if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED)) { @@ -1535,9 +1535,9 @@ void mmu_continue_loading(bool blocking) mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); load_more(); - state = Ls::unload; + state = Ls::Unload; break; - case Ls::unload: + case Ls::Unload: stop_and_save_print_to_ram(0, 0); //lift z @@ -1562,7 +1562,7 @@ void mmu_continue_loading(bool blocking) { marlin_wait_for_click(); restore_print_from_ram_and_continue(0); - state = Ls::retry; + state = Ls::Retry; } else { diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 08d1a55b1..db0b8628a 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -2053,8 +2053,8 @@ void check_max_temp() struct alert_automaton_mintemp { private: enum { ALERT_AUTOMATON_SPEED_DIV = 5 }; - enum class States : uint8_t { INIT = 0, TEMP_ABOVE_MINTEMP, SHOW_PLEASE_RESTART, SHOW_MINTEMP }; - States state = States::INIT; + enum class States : uint8_t { Init = 0, TempAboveMintemp, ShowPleaseRestart, ShowMintemp }; + States state = States::Init; uint8_t repeat = ALERT_AUTOMATON_SPEED_DIV; void substep(States next_state){ @@ -2073,26 +2073,26 @@ public: static const char m2[] PROGMEM = "MINTEMP fixed"; static const char m1[] PROGMEM = "Please restart"; switch(state){ - case States::INIT: // initial state - check hysteresis + case States::Init: // initial state - check hysteresis if( current_temp > mintemp ){ - state = States::TEMP_ABOVE_MINTEMP; + state = States::TempAboveMintemp; } // otherwise keep the Err MINTEMP alert message on the display, // i.e. do not transfer to state 1 break; - case States::TEMP_ABOVE_MINTEMP: // the temperature has risen above the hysteresis check + case States::TempAboveMintemp: // the temperature has risen above the hysteresis check lcd_setalertstatuspgm(m2); - substep(States::SHOW_MINTEMP); + substep(States::ShowMintemp); last_alert_sent_to_lcd = LCDALERT_MINTEMPFIXED; break; - case States::SHOW_PLEASE_RESTART: // displaying "Please restart" + case States::ShowPleaseRestart: // displaying "Please restart" lcd_updatestatuspgm(m1); - substep(States::SHOW_MINTEMP); + substep(States::ShowMintemp); last_alert_sent_to_lcd = LCDALERT_PLEASERESTART; break; - case States::SHOW_MINTEMP: // displaying "MINTEMP fixed" + case States::ShowMintemp: // displaying "MINTEMP fixed" lcd_updatestatuspgm(m2); - substep(States::SHOW_PLEASE_RESTART); + substep(States::ShowPleaseRestart); last_alert_sent_to_lcd = LCDALERT_MINTEMPFIXED; break; } From 6dd085bcc5e4639d26ac5283852c99ceb0e5c214 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 16:44:07 +0200 Subject: [PATCH 271/368] Use first letter capital camel case for enum class members. --- Firmware/ultralcd.cpp | 138 +++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d60fd67f9..3ce74e124 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -166,23 +166,23 @@ static bool lcd_selfcheck_pulleys(int axis); #endif //TMC2130 static bool lcd_selfcheck_check_heater(bool _isbed); -enum class testScreen : uint_least8_t +enum class TestScreen : uint_least8_t { - extruderFan, - printFan, - fansOk, - endStops, - axisX, - axisY, - axisZ, - bed, - hotend, - hotendOk, - fsensor, - fsensorOk, - allCorrect, - failed, - home, + ExtruderFan, + PrintFan, + FansOk, + EndStops, + AxisX, + AxisY, + AxisZ, + Bed, + Hotend, + HotendOk, + Fsensor, + FsensorOk, + AllCorrect, + Failed, + Home, }; enum class TestError : uint_least8_t @@ -201,7 +201,7 @@ enum class TestError : uint_least8_t triggeringFsensor, }; -static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_scale, bool _clear, int _delay); +static int lcd_selftest_screen(TestScreen screen, int _progress, int _progress_scale, bool _clear, int _delay); static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator); static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite, bool _default=false); @@ -6769,7 +6769,7 @@ bool lcd_selftest() _delay(2000); KEEPALIVE_STATE(IN_HANDLER); - _progress = lcd_selftest_screen(testScreen::extruderFan, _progress, 3, true, 2000); + _progress = lcd_selftest_screen(TestScreen::ExtruderFan, _progress, 3, true, 2000); #if (defined(FANCHECK) && defined(TACH_0)) switch (lcd_selftest_fan_auto(0)){ // check extruder Fan case FanCheck::extruderFan: @@ -6792,7 +6792,7 @@ bool lcd_selftest() if (_result) { - _progress = lcd_selftest_screen(testScreen::printFan, _progress, 3, true, 2000); + _progress = lcd_selftest_screen(TestScreen::PrintFan, _progress, 3, true, 2000); #if (defined(FANCHECK) && defined(TACH_1)) switch (lcd_selftest_fan_auto(1)){ // check print fan case FanCheck::printFan: @@ -6832,7 +6832,7 @@ bool lcd_selftest() if (_result) { - _progress = lcd_selftest_screen(testScreen::fansOk, _progress, 3, true, 2000); + _progress = lcd_selftest_screen(TestScreen::FansOk, _progress, 3, true, 2000); #ifndef TMC2130 _result = lcd_selfcheck_endstops(); #else @@ -6843,7 +6843,7 @@ bool lcd_selftest() if (_result) { //current_position[Z_AXIS] += 15; //move Z axis higher to avoid false triggering of Z end stop in case that we are very low - just above heatbed - _progress = lcd_selftest_screen(testScreen::axisX, _progress, 3, true, 2000); + _progress = lcd_selftest_screen(TestScreen::AxisX, _progress, 3, true, 2000); #ifdef TMC2130 _result = lcd_selfcheck_axis_sg(X_AXIS); #else @@ -6856,7 +6856,7 @@ bool lcd_selftest() if (_result) { - _progress = lcd_selftest_screen(testScreen::axisX, _progress, 3, true, 0); + _progress = lcd_selftest_screen(TestScreen::AxisX, _progress, 3, true, 0); #ifndef TMC2130 _result = lcd_selfcheck_pulleys(X_AXIS); @@ -6866,7 +6866,7 @@ bool lcd_selftest() if (_result) { - _progress = lcd_selftest_screen(testScreen::axisY, _progress, 3, true, 1500); + _progress = lcd_selftest_screen(TestScreen::AxisY, _progress, 3, true, 1500); #ifdef TMC2130 _result = lcd_selfcheck_axis_sg(Y_AXIS); #else @@ -6876,7 +6876,7 @@ bool lcd_selftest() if (_result) { - _progress = lcd_selftest_screen(testScreen::axisZ, _progress, 3, true, 0); + _progress = lcd_selftest_screen(TestScreen::AxisZ, _progress, 3, true, 0); #ifndef TMC2130 _result = lcd_selfcheck_pulleys(Y_AXIS); #endif // TMC2130 @@ -6897,7 +6897,7 @@ bool lcd_selftest() current_position[Z_AXIS] = current_position[Z_AXIS] + 10; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); st_synchronize(); - _progress = lcd_selftest_screen(testScreen::axisZ, _progress, 3, true, 1500); + _progress = lcd_selftest_screen(TestScreen::AxisZ, _progress, 3, true, 1500); _result = lcd_selfcheck_axis(2, Z_MAX_POS); if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) { enquecommand_P(PSTR("G28 W")); @@ -6911,11 +6911,11 @@ bool lcd_selftest() current_position[Z_AXIS] = current_position[Z_AXIS] + 10; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); st_synchronize(); - _progress = lcd_selftest_screen(testScreen::home, 0, 2, true, 0); + _progress = lcd_selftest_screen(TestScreen::Home, 0, 2, true, 0); bool bres = tmc2130_home_calibrate(X_AXIS); - _progress = lcd_selftest_screen(testScreen::home, 1, 2, true, 0); + _progress = lcd_selftest_screen(TestScreen::Home, 1, 2, true, 0); bres &= tmc2130_home_calibrate(Y_AXIS); - _progress = lcd_selftest_screen(testScreen::home, 2, 2, true, 0); + _progress = lcd_selftest_screen(TestScreen::Home, 2, 2, true, 0); if (bres) eeprom_update_byte((uint8_t*)EEPROM_TMC2130_HOME_ENABLED, 1); _result = bres; @@ -6924,18 +6924,18 @@ bool lcd_selftest() if (_result) { - _progress = lcd_selftest_screen(testScreen::bed, _progress, 3, true, 2000); + _progress = lcd_selftest_screen(TestScreen::Bed, _progress, 3, true, 2000); _result = lcd_selfcheck_check_heater(true); } if (_result) { - _progress = lcd_selftest_screen(testScreen::hotend, _progress, 3, true, 1000); + _progress = lcd_selftest_screen(TestScreen::Hotend, _progress, 3, true, 1000); _result = lcd_selfcheck_check_heater(false); } if (_result) { - _progress = lcd_selftest_screen(testScreen::hotendOk, _progress, 3, true, 2000); //nozzle ok + _progress = lcd_selftest_screen(TestScreen::HotendOk, _progress, 3, true, 2000); //nozzle ok } #ifdef FILAMENT_SENSOR if (_result) @@ -6943,20 +6943,20 @@ bool lcd_selftest() if (mmu_enabled) { - _progress = lcd_selftest_screen(testScreen::fsensor, _progress, 3, true, 2000); //check filaments sensor + _progress = lcd_selftest_screen(TestScreen::Fsensor, _progress, 3, true, 2000); //check filaments sensor _result = selftest_irsensor(); if (_result) { - _progress = lcd_selftest_screen(testScreen::fsensorOk, _progress, 3, true, 2000); //fil sensor OK + _progress = lcd_selftest_screen(TestScreen::FsensorOk, _progress, 3, true, 2000); //fil sensor OK } } else { #ifdef PAT9125 - _progress = lcd_selftest_screen(testScreen::fsensor, _progress, 3, true, 2000); //check filaments sensor + _progress = lcd_selftest_screen(TestScreen::Fsensor, _progress, 3, true, 2000); //check filaments sensor _result = lcd_selftest_fsensor(); if (_result) { - _progress = lcd_selftest_screen(testScreen::fsensorOk, _progress, 3, true, 2000); //fil sensor OK + _progress = lcd_selftest_screen(TestScreen::FsensorOk, _progress, 3, true, 2000); //fil sensor OK } #endif //PAT9125 } @@ -6964,11 +6964,11 @@ bool lcd_selftest() #endif //FILAMENT_SENSOR if (_result) { - _progress = lcd_selftest_screen(testScreen::allCorrect, _progress, 3, true, 5000); //all correct + _progress = lcd_selftest_screen(TestScreen::AllCorrect, _progress, 3, true, 5000); //all correct } else { - _progress = lcd_selftest_screen(testScreen::failed, _progress, 3, true, 5000); + _progress = lcd_selftest_screen(TestScreen::Failed, _progress, 3, true, 5000); } lcd_reset_alert_level(); enquecommand_P(PSTR("M84")); @@ -7175,7 +7175,7 @@ static bool lcd_selfcheck_axis(int _axis, int _travel) } else { - _progress = lcd_selftest_screen(static_cast(static_cast(testScreen::axisX) + _axis), _progress, 3, false, 0); + _progress = lcd_selftest_screen(static_cast(static_cast(TestScreen::AxisX) + _axis), _progress, 3, false, 0); _lcd_refresh = 0; } @@ -7342,7 +7342,7 @@ static bool lcd_selfcheck_check_heater(bool _isbed) manage_heater(); manage_inactivity(true); - _progress = (_isbed) ? lcd_selftest_screen(testScreen::bed, _progress, 2, false, 400) : lcd_selftest_screen(testScreen::hotend, _progress, 2, false, 400); + _progress = (_isbed) ? lcd_selftest_screen(TestScreen::Bed, _progress, 2, false, 400) : lcd_selftest_screen(TestScreen::Hotend, _progress, 2, false, 400); /*if (_isbed) { MYSERIAL.print("Bed temp:"); MYSERIAL.println(degBed()); @@ -7560,16 +7560,16 @@ static bool selftest_irsensor() TempBackup tempBackup; setTargetHotend(ABS_PREHEAT_HOTEND_TEMP,active_extruder); mmu_wait_for_heater_blocking(); - progress = lcd_selftest_screen(testScreen::fsensor, 0, 1, true, 0); + progress = lcd_selftest_screen(TestScreen::Fsensor, 0, 1, true, 0); mmu_filament_ramming(); } - progress = lcd_selftest_screen(testScreen::fsensor, progress, 1, true, 0); + progress = lcd_selftest_screen(TestScreen::Fsensor, progress, 1, true, 0); mmu_command(MmuCmd::U0); manage_response(false, false); for(uint_least8_t i = 0; i < 200; ++i) { - if (0 == (i % 32)) progress = lcd_selftest_screen(testScreen::fsensor, progress, 1, true, 0); + if (0 == (i % 32)) progress = lcd_selftest_screen(TestScreen::Fsensor, progress, 1, true, 0); mmu_load_step(false); while (blocks_queued()) @@ -7795,7 +7795,7 @@ static FanCheck lcd_selftest_fan_auto(int _fan) #endif //FANCHECK -static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_scale, bool _clear, int _delay) +static int lcd_selftest_screen(TestScreen screen, int _progress, int _progress_scale, bool _clear, int _delay) { lcd_update_enable(false); @@ -7807,58 +7807,58 @@ static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_s lcd_set_cursor(0, 0); - if (screen == testScreen::extruderFan) lcd_puts_P(_T(MSG_SELFTEST_FAN)); - if (screen == testScreen::printFan) lcd_puts_P(_T(MSG_SELFTEST_FAN)); - if (screen == testScreen::fansOk) lcd_puts_P(_T(MSG_SELFTEST_FAN)); - if (screen == testScreen::endStops) lcd_puts_P(_i("Checking endstops"));////MSG_SELFTEST_CHECK_ENDSTOPS c=20 - if (screen == testScreen::axisX) lcd_puts_P(_i("Checking X axis "));////MSG_SELFTEST_CHECK_X c=20 - if (screen == testScreen::axisY) lcd_puts_P(_i("Checking Y axis "));////MSG_SELFTEST_CHECK_Y c=20 - if (screen == testScreen::axisZ) lcd_puts_P(_i("Checking Z axis "));////MSG_SELFTEST_CHECK_Z c=20 - if (screen == testScreen::bed) lcd_puts_P(_T(MSG_SELFTEST_CHECK_BED)); - if (screen == testScreen::hotend - || screen == testScreen::hotendOk) lcd_puts_P(_i("Checking hotend "));////MSG_SELFTEST_CHECK_HOTEND c=20 - if (screen == testScreen::fsensor) lcd_puts_P(_T(MSG_SELFTEST_CHECK_FSENSOR)); - if (screen == testScreen::fsensorOk) lcd_puts_P(_T(MSG_SELFTEST_CHECK_FSENSOR)); - if (screen == testScreen::allCorrect) lcd_puts_P(_i("All correct "));////MSG_SELFTEST_CHECK_ALLCORRECT c=20 - if (screen == testScreen::failed) lcd_puts_P(_T(MSG_SELFTEST_FAILED)); - if (screen == testScreen::home) lcd_puts_P(_i("Calibrating home"));////c=20 r=1 + if (screen == TestScreen::ExtruderFan) lcd_puts_P(_T(MSG_SELFTEST_FAN)); + if (screen == TestScreen::PrintFan) lcd_puts_P(_T(MSG_SELFTEST_FAN)); + if (screen == TestScreen::FansOk) lcd_puts_P(_T(MSG_SELFTEST_FAN)); + if (screen == TestScreen::EndStops) lcd_puts_P(_i("Checking endstops"));////MSG_SELFTEST_CHECK_ENDSTOPS c=20 + if (screen == TestScreen::AxisX) lcd_puts_P(_i("Checking X axis "));////MSG_SELFTEST_CHECK_X c=20 + if (screen == TestScreen::AxisY) lcd_puts_P(_i("Checking Y axis "));////MSG_SELFTEST_CHECK_Y c=20 + if (screen == TestScreen::AxisZ) lcd_puts_P(_i("Checking Z axis "));////MSG_SELFTEST_CHECK_Z c=20 + if (screen == TestScreen::Bed) lcd_puts_P(_T(MSG_SELFTEST_CHECK_BED)); + if (screen == TestScreen::Hotend + || screen == TestScreen::HotendOk) lcd_puts_P(_i("Checking hotend "));////MSG_SELFTEST_CHECK_HOTEND c=20 + if (screen == TestScreen::Fsensor) lcd_puts_P(_T(MSG_SELFTEST_CHECK_FSENSOR)); + if (screen == TestScreen::FsensorOk) lcd_puts_P(_T(MSG_SELFTEST_CHECK_FSENSOR)); + if (screen == TestScreen::AllCorrect) lcd_puts_P(_i("All correct "));////MSG_SELFTEST_CHECK_ALLCORRECT c=20 + if (screen == TestScreen::Failed) lcd_puts_P(_T(MSG_SELFTEST_FAILED)); + if (screen == TestScreen::Home) lcd_puts_P(_i("Calibrating home"));////c=20 r=1 lcd_set_cursor(0, 1); lcd_puts_P(separator); - if ((screen >= testScreen::extruderFan) && (screen <= testScreen::fansOk)) + if ((screen >= TestScreen::ExtruderFan) && (screen <= TestScreen::FansOk)) { //SERIAL_ECHOLNPGM("Fan test"); lcd_puts_at_P(0, 2, _i("Extruder fan:"));////MSG_SELFTEST_EXTRUDER_FAN_SPEED c=18 lcd_set_cursor(18, 2); - (screen < testScreen::printFan) ? lcd_print(_indicator) : lcd_print("OK"); + (screen < TestScreen::PrintFan) ? lcd_print(_indicator) : lcd_print("OK"); lcd_puts_at_P(0, 3, _i("Print fan:"));////MSG_SELFTEST_PRINT_FAN_SPEED c=18 lcd_set_cursor(18, 3); - (screen < testScreen::fansOk) ? lcd_print(_indicator) : lcd_print("OK"); + (screen < TestScreen::FansOk) ? lcd_print(_indicator) : lcd_print("OK"); } - else if (screen >= testScreen::fsensor && screen <= testScreen::fsensorOk) + else if (screen >= TestScreen::Fsensor && screen <= TestScreen::FsensorOk) { lcd_puts_at_P(0, 2, _T(MSG_SELFTEST_FILAMENT_SENSOR)); lcd_putc(':'); lcd_set_cursor(18, 2); - (screen == testScreen::fsensor) ? lcd_print(_indicator) : lcd_print("OK"); + (screen == TestScreen::Fsensor) ? lcd_print(_indicator) : lcd_print("OK"); } - else if (screen < testScreen::fsensor) + else if (screen < TestScreen::Fsensor) { //SERIAL_ECHOLNPGM("Other tests"); - testScreen _step_block = testScreen::axisX; + TestScreen _step_block = TestScreen::AxisX; lcd_selftest_screen_step(2, 2, ((screen == _step_block) ? 1 : (screen < _step_block) ? 0 : 2), "X", _indicator); - _step_block = testScreen::axisY; + _step_block = TestScreen::AxisY; lcd_selftest_screen_step(2, 8, ((screen == _step_block) ? 1 : (screen < _step_block) ? 0 : 2), "Y", _indicator); - _step_block = testScreen::axisZ; + _step_block = TestScreen::AxisZ; lcd_selftest_screen_step(2, 14, ((screen == _step_block) ? 1 : (screen < _step_block) ? 0 : 2), "Z", _indicator); - _step_block = testScreen::bed; + _step_block = TestScreen::Bed; lcd_selftest_screen_step(3, 0, ((screen == _step_block) ? 1 : (screen < _step_block) ? 0 : 2), "Bed", _indicator); - _step_block = testScreen::hotend; + _step_block = TestScreen::Hotend; lcd_selftest_screen_step(3, 9, ((screen == _step_block) ? 1 : (screen < _step_block) ? 0 : 2), "Hotend", _indicator); } From 9ceba004267df35b3c2c12a91fd28ee57f0face9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 18:53:09 +0200 Subject: [PATCH 272/368] Use first letter capital camel case for enum class members. Remove dependency of FanCheck values on TestError values as it is not used. --- Firmware/ultralcd.cpp | 86 +++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3ce74e124..01bcb85b2 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -187,18 +187,18 @@ enum class TestScreen : uint_least8_t enum class TestError : uint_least8_t { - heater, - bed, - endstops, - motor, - endstop, - printFan, - extruderFan, - pulley, - axis, - swappedFan, - wiringFsensor, - triggeringFsensor, + Heater, + Bed, + Endstops, + Motor, + Endstop, + PrintFan, + ExtruderFan, + Pulley, + Axis, + SwappedFan, + WiringFsensor, + TriggeringFsensor, }; static int lcd_selftest_screen(TestScreen screen, int _progress, int _progress_scale, bool _clear, int _delay); @@ -211,9 +211,9 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite, */ enum class FanCheck : uint_least8_t { success, - printFan = TestError::printFan, - extruderFan = TestError::extruderFan, - swappedFan = TestError::swappedFan, + printFan, + extruderFan, + swappedFan, }; /** @@ -6787,7 +6787,7 @@ bool lcd_selftest() #endif //defined(TACH_0) if (!_result) { - lcd_selftest_error(TestError::extruderFan, "", ""); + lcd_selftest_error(TestError::ExtruderFan, "", ""); } if (_result) @@ -6810,7 +6810,7 @@ bool lcd_selftest() #endif //defined(TACH_1) if (!_result) { - lcd_selftest_error(TestError::printFan, "", ""); //print fan not spinning + lcd_selftest_error(TestError::PrintFan, "", ""); //print fan not spinning } } @@ -6821,12 +6821,12 @@ bool lcd_selftest() //print fan is stil turned on; check that it is spinning _result = lcd_selftest_manual_fan_check(1, false, true); if (!_result){ - lcd_selftest_error(TestError::printFan, "", ""); + lcd_selftest_error(TestError::PrintFan, "", ""); } } else { // fans are swapped - lcd_selftest_error(TestError::swappedFan, "", ""); + lcd_selftest_error(TestError::SwappedFan, "", ""); } } @@ -7082,7 +7082,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { if (axis == Y_AXIS) _error_1 = "Y"; if (axis == Z_AXIS) _error_1 = "Z"; - lcd_selftest_error(TestError::axis, _error_1, ""); + lcd_selftest_error(TestError::Axis, _error_1, ""); current_position[axis] = 0; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); reset_crash_det(axis); @@ -7100,7 +7100,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) { if (axis == Y_AXIS) _error_1 = "Y"; if (axis == Z_AXIS) _error_1 = "Z"; - lcd_selftest_error(TestError::pulley, _error_1, ""); + lcd_selftest_error(TestError::Pulley, _error_1, ""); current_position[axis] = 0; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); reset_crash_det(axis); @@ -7207,11 +7207,11 @@ static bool lcd_selfcheck_axis(int _axis, int _travel) if (_travel_done >= _travel) { - lcd_selftest_error(TestError::endstop, _error_1, _error_2); + lcd_selftest_error(TestError::Endstop, _error_1, _error_2); } else { - lcd_selftest_error(TestError::motor, _error_1, _error_2); + lcd_selftest_error(TestError::Motor, _error_1, _error_2); } } @@ -7251,7 +7251,7 @@ static bool lcd_selfcheck_pulleys(int axis) st_synchronize(); if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) { - lcd_selftest_error(TestError::pulley, (axis == 0) ? "X" : "Y", ""); + lcd_selftest_error(TestError::Pulley, (axis == 0) ? "X" : "Y", ""); return(false); } } @@ -7269,7 +7269,7 @@ static bool lcd_selfcheck_pulleys(int axis) return(true); } else { - lcd_selftest_error(TestError::pulley, (axis == 0) ? "X" : "Y", ""); + lcd_selftest_error(TestError::Pulley, (axis == 0) ? "X" : "Y", ""); return(false); } } @@ -7278,7 +7278,7 @@ static bool lcd_selfcheck_pulleys(int axis) plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); st_synchronize(); if (_millis() > timeout_counter) { - lcd_selftest_error(TestError::pulley, (axis == 0) ? "X" : "Y", ""); + lcd_selftest_error(TestError::Pulley, (axis == 0) ? "X" : "Y", ""); return(false); } } @@ -7311,7 +7311,7 @@ static bool lcd_selfcheck_endstops() if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "X"); if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Y"); if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Z"); - lcd_selftest_error(TestError::endstops, _error, ""); + lcd_selftest_error(TestError::Endstops, _error, ""); } manage_heater(); manage_inactivity(true); @@ -7377,12 +7377,12 @@ static bool lcd_selfcheck_check_heater(bool _isbed) } else { - lcd_selftest_error(TestError::heater, "", ""); + lcd_selftest_error(TestError::Heater, "", ""); } } else { - lcd_selftest_error(TestError::bed, "", ""); + lcd_selftest_error(TestError::Bed, "", ""); } manage_heater(); @@ -7409,19 +7409,19 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const switch (testError) { - case TestError::heater: + case TestError::Heater: lcd_set_cursor(0, 2); lcd_puts_P(_i("Heater/Thermistor"));////MSG_SELFTEST_HEATERTHERMISTOR lcd_set_cursor(0, 3); lcd_puts_P(_i("Not connected"));////MSG_SELFTEST_NOTCONNECTED break; - case TestError::bed: + case TestError::Bed: lcd_set_cursor(0, 2); lcd_puts_P(_i("Bed / Heater"));////MSG_SELFTEST_BEDHEATER lcd_set_cursor(0, 3); lcd_puts_P(_T(MSG_SELFTEST_WIRINGERROR)); break; - case TestError::endstops: + case TestError::Endstops: lcd_set_cursor(0, 2); lcd_puts_P(_i("Endstops"));////MSG_SELFTEST_ENDSTOPS lcd_set_cursor(0, 3); @@ -7429,7 +7429,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(17, 3); lcd_print(_error_1); break; - case TestError::motor: + case TestError::Motor: lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_MOTOR)); lcd_set_cursor(18, 2); @@ -7439,7 +7439,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(18, 3); lcd_print(_error_2); break; - case TestError::endstop: + case TestError::Endstop: lcd_set_cursor(0, 2); lcd_puts_P(_i("Endstop not hit"));////MSG_SELFTEST_ENDSTOP_NOTHIT c=20 r=1 lcd_set_cursor(0, 3); @@ -7447,7 +7447,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case TestError::printFan: + case TestError::PrintFan: lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_COOLING_FAN)); lcd_set_cursor(0, 3); @@ -7455,7 +7455,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case TestError::extruderFan: + case TestError::ExtruderFan: lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_EXTRUDER_FAN)); lcd_set_cursor(0, 3); @@ -7463,7 +7463,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case TestError::pulley: + case TestError::Pulley: lcd_set_cursor(0, 2); lcd_puts_P(_i("Loose pulley"));////MSG_LOOSE_PULLEY c=20 r=1 lcd_set_cursor(0, 3); @@ -7471,7 +7471,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case TestError::axis: + case TestError::Axis: lcd_set_cursor(0, 2); lcd_puts_P(_i("Axis length"));////MSG_SELFTEST_AXIS_LENGTH lcd_set_cursor(0, 3); @@ -7479,7 +7479,7 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case TestError::swappedFan: + case TestError::SwappedFan: lcd_set_cursor(0, 2); lcd_puts_P(_i("Front/left fans"));////MSG_SELFTEST_FANS lcd_set_cursor(0, 3); @@ -7487,13 +7487,13 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const lcd_set_cursor(18, 3); lcd_print(_error_1); break; - case TestError::wiringFsensor: + case TestError::WiringFsensor: lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_FILAMENT_SENSOR)); lcd_set_cursor(0, 3); lcd_puts_P(_T(MSG_SELFTEST_WIRINGERROR)); break; - case TestError::triggeringFsensor: + case TestError::TriggeringFsensor: lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_SELFTEST_FILAMENT_SENSOR)); lcd_set_cursor(0, 3); @@ -7522,7 +7522,7 @@ static bool lcd_selftest_fsensor(void) fsensor_init(); if (fsensor_not_responding) { - lcd_selftest_error(TestError::wiringFsensor, "", ""); + lcd_selftest_error(TestError::WiringFsensor, "", ""); } return (!fsensor_not_responding); } @@ -7576,7 +7576,7 @@ static bool selftest_irsensor() { if (PIN_GET(IR_SENSOR_PIN) == 0) { - lcd_selftest_error(TestError::triggeringFsensor, "", ""); + lcd_selftest_error(TestError::TriggeringFsensor, "", ""); return false; } #ifdef TMC2130 From 0401490cc16826895e94ec712f969c3360344ba3 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 17:19:19 +0200 Subject: [PATCH 273/368] Use first letter capital camel case for enum class members. --- Firmware/ultralcd.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 01bcb85b2..169e5ed83 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -210,10 +210,10 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite, /** Enumerate for lcd_selftest_fan_auto function. */ enum class FanCheck : uint_least8_t { - success, - printFan, - extruderFan, - swappedFan, + Success, + PrintFan, + ExtruderFan, + SwappedFan, }; /** @@ -6772,10 +6772,10 @@ bool lcd_selftest() _progress = lcd_selftest_screen(TestScreen::ExtruderFan, _progress, 3, true, 2000); #if (defined(FANCHECK) && defined(TACH_0)) switch (lcd_selftest_fan_auto(0)){ // check extruder Fan - case FanCheck::extruderFan: + case FanCheck::ExtruderFan: _result = false; break; - case FanCheck::swappedFan: + case FanCheck::SwappedFan: _swapped_fan = true; // no break default: @@ -6795,10 +6795,10 @@ bool lcd_selftest() _progress = lcd_selftest_screen(TestScreen::PrintFan, _progress, 3, true, 2000); #if (defined(FANCHECK) && defined(TACH_1)) switch (lcd_selftest_fan_auto(1)){ // check print fan - case FanCheck::printFan: + case FanCheck::PrintFan: _result = false; break; - case FanCheck::swappedFan: + case FanCheck::SwappedFan: _swapped_fan = true; // no break default: @@ -7721,11 +7721,11 @@ static FanCheck lcd_selftest_fan_auto(int _fan) printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]); if (!fan_speed[0]) { - return FanCheck::extruderFan; + return FanCheck::ExtruderFan; } #ifdef FAN_SOFT_PWM else if (fan_speed[0] > 50 ) { // printerFan is faster - return FanCheck::swappedFan; + return FanCheck::SwappedFan; } break; #endif @@ -7760,7 +7760,7 @@ static FanCheck lcd_selftest_fan_auto(int _fan) printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]); printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]); if (!fan_speed[1]) { - return FanCheck::printFan; + return FanCheck::PrintFan; } #ifdef FAN_SOFT_PWM @@ -7779,18 +7779,18 @@ static FanCheck lcd_selftest_fan_auto(int _fan) // noctua speed is between 17 and 24, turbine more then 30 if (fan_speed[1] < 30) { - return FanCheck::swappedFan; + return FanCheck::SwappedFan; } #else // fan is spinning, but measured RPM are too low for print fan, it must // be left extruder fan else if (fan_speed[1] < 34) { - return FanCheck::swappedFan; + return FanCheck::SwappedFan; } #endif //FAN_SOFT_PWM break; } - return FanCheck::success; + return FanCheck::Success; } #endif //FANCHECK From cbb92860d06ea19eafaf3e65a135a36b2ae7ead5 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 18:19:41 +0200 Subject: [PATCH 274/368] Use first letter capital camel case for enum class members. --- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 8 ++--- Firmware/cmdqueue.cpp | 2 +- Firmware/ultralcd.cpp | 68 ++++++++++++++++++++-------------------- Firmware/ultralcd.h | 16 +++++----- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index f53e55cc9..e896b8383 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -389,7 +389,7 @@ extern bool wizard_active; //autoload temporarily disabled during wizard extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff -#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsgTypes::TEMCAL) || saved_printing || (lcd_commands_type == LcdCommands::V2_CAL) || card.paused || mmu_print_saved) +#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsgTypes::TEMCAL) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || card.paused || mmu_print_saved) //! Beware - mcode_in_progress is set as soon as the command gets really processed, //! which is not the same as posting the M600 command into the command queue //! There can be a considerable lag between posting M600 and its real processing which might result diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index e08462288..374d0b68c 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4424,7 +4424,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // We don't know where we are! HOME! // Push the commands to the front of the message queue in the reverse order! // There shall be always enough space reserved for these commands. - if (lcd_commands_type != LcdCommands::STOP_PRINT) { + if (lcd_commands_type != LcdCommands::StopPrint) { repeatcommand_front(); // repeat G80 with all its parameters enquecommand_front_P((PSTR("G28 W0"))); } @@ -4464,7 +4464,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) if (temp_comp_start) if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50) { - if (lcd_commands_type != LcdCommands::STOP_PRINT) { + if (lcd_commands_type != LcdCommands::StopPrint) { temp_compensation_start(); run = true; repeatcommand_front(); // repeat G80 with all its parameters @@ -4476,7 +4476,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; } run = false; - if (lcd_commands_type == LcdCommands::STOP_PRINT) { + if (lcd_commands_type == LcdCommands::StopPrint) { mesh_bed_leveling_flag = false; break; } @@ -7695,7 +7695,7 @@ bool bInhibitFlag; #endif // IR_SENSOR if ((mcode_in_progress != 600) && (eFilamentAction != eFILAMENT_ACTION::autoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active { - if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL) && !wizard_active) + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && !wizard_active) { if (fsensor_check_autoload()) { diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index 1e1167c49..37b6388d0 100755 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -598,7 +598,7 @@ void get_command() if (farm_mode) { prusa_statistics(6); - lcd_commands_type = LcdCommands::FARM_MODE_CONFIRM; + lcd_commands_type = LcdCommands::FarmModeConfirm; } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 169e5ed83..808cbfea4 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -74,7 +74,7 @@ extern void crashdet_disable(); bool presort_flag = false; #endif -LcdCommands lcd_commands_type = LcdCommands::IDLE; +LcdCommands lcd_commands_type = LcdCommands::Idle; static uint8_t lcd_commands_step = 0; CustomMsgTypes custom_message_type = CustomMsgTypes::STATUS; @@ -996,7 +996,7 @@ static void lcd_status_screen() } // end of farm_mode lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */ - if (lcd_commands_type != LcdCommands::IDLE) + if (lcd_commands_type != LcdCommands::Idle) lcd_commands(); } // end of lcd_draw_update @@ -1020,7 +1020,7 @@ static void lcd_status_screen() } if (current_click - && (lcd_commands_type != LcdCommands::STOP_PRINT) //click is aborted unless stop print finishes + && (lcd_commands_type != LcdCommands::StopPrint) //click is aborted unless stop print finishes && ( menu_block_entering_on_serious_errors == SERIOUS_ERR_NONE ) // or a serious error blocks entering the menu ) { @@ -1062,15 +1062,15 @@ static void lcd_status_screen() void lcd_commands() { - if (lcd_commands_type == LcdCommands::LONG_PAUSE) + if (lcd_commands_type == LcdCommands::LongPause) { if (!blocks_queued() && !homing_flag) { lcd_setstatuspgm(_i("Print paused"));////MSG_PRINT_PAUSED c=20 r=1 long_pause(); - if (lcd_commands_type == LcdCommands::LONG_PAUSE) // !!! because "lcd_commands_type" can be changed during/inside "long_pause()" + if (lcd_commands_type == LcdCommands::LongPause) // !!! because "lcd_commands_type" can be changed during/inside "long_pause()" { - lcd_commands_type = LcdCommands::IDLE; + lcd_commands_type = LcdCommands::Idle; lcd_commands_step = 0; } } @@ -1078,7 +1078,7 @@ void lcd_commands() #ifdef SNMM - if (lcd_commands_type == LcdCommands::V2_CAL) + if (lcd_commands_type == LcdCommands::Layer1Cal) { char cmd1[30]; float width = 0.4; @@ -1343,7 +1343,7 @@ void lcd_commands() #else //if not SNMM - if (lcd_commands_type == LcdCommands::V2_CAL) + if (lcd_commands_type == LcdCommands::Layer1Cal) { char cmd1[30]; static uint8_t filament = 0; @@ -1439,7 +1439,7 @@ void lcd_commands() case 1: lcd_setstatuspgm(_T(WELCOME_MSG)); lcd_commands_step = 0; - lcd_commands_type = LcdCommands::IDLE; + lcd_commands_type = LcdCommands::Idle; if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { lcd_wizard(WizState::RepeatLay1Cal); @@ -1451,7 +1451,7 @@ void lcd_commands() #endif // not SNMM - if (lcd_commands_type == LcdCommands::STOP_PRINT) /// stop print + if (lcd_commands_type == LcdCommands::StopPrint) /// stop print { @@ -1463,7 +1463,7 @@ void lcd_commands() if (lcd_commands_step == 1 && !blocks_queued()) { lcd_commands_step = 0; - lcd_commands_type = LcdCommands::IDLE; + lcd_commands_type = LcdCommands::Idle; lcd_setstatuspgm(_T(WELCOME_MSG)); custom_message_type = CustomMsgTypes::STATUS; isPrintPaused = false; @@ -1543,12 +1543,12 @@ void lcd_commands() } } - if (lcd_commands_type == LcdCommands::UNKNOWN3) + if (lcd_commands_type == LcdCommands::Unknown3) { - lcd_commands_type = LcdCommands::IDLE; + lcd_commands_type = LcdCommands::Idle; } - if (lcd_commands_type == LcdCommands::FARM_MODE_CONFIRM) /// farm mode confirm + if (lcd_commands_type == LcdCommands::FarmModeConfirm) /// farm mode confirm { if (lcd_commands_step == 0) { lcd_commands_step = 6; } @@ -1557,7 +1557,7 @@ void lcd_commands() { lcd_confirm_print(); lcd_commands_step = 0; - lcd_commands_type = LcdCommands::IDLE; + lcd_commands_type = LcdCommands::Idle; } if (lcd_commands_step == 2 && !blocks_queued()) { @@ -1590,7 +1590,7 @@ void lcd_commands() } } - if (lcd_commands_type == LcdCommands::PID_EXTRUDER) { + if (lcd_commands_type == LcdCommands::PidExtruder) { char cmd1[30]; if (lcd_commands_step == 0) { @@ -1633,7 +1633,7 @@ void lcd_commands() custom_message_type = CustomMsgTypes::STATUS; pid_temp = DEFAULT_PID_TEMP; lcd_commands_step = 0; - lcd_commands_type = LcdCommands::IDLE; + lcd_commands_type = LcdCommands::Idle; } } @@ -1655,9 +1655,9 @@ void lcd_pause_print() stop_and_save_print_to_ram(0.0,0.0); setAllTargetHotends(0); isPrintPaused = true; - if (LcdCommands::IDLE == lcd_commands_type) + if (LcdCommands::Idle == lcd_commands_type) { - lcd_commands_type = LcdCommands::LONG_PAUSE; + lcd_commands_type = LcdCommands::LongPause; } } @@ -1798,7 +1798,7 @@ void lcd_menu_extruder_info() // NOT static due to using ins lcd_puts_P(_N("Filament sensor\n" "is disabled.")); else { - if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) pat9125_update(); lcd_printf_P(_N( "Fil. Xd:%3d Yd:%3d\n" @@ -3220,7 +3220,7 @@ void pid_extruder() lcd_set_cursor(1, 2); lcd_print(ftostr3(pid_temp)); if (lcd_clicked()) { - lcd_commands_type = LcdCommands::PID_EXTRUDER; + lcd_commands_type = LcdCommands::PidExtruder; lcd_return_to_status(); lcd_update(2); } @@ -4443,7 +4443,7 @@ static void lcd_crash_mode_set() }else{ crashdet_enable(); } - if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) menu_goto(lcd_tune_menu, 9, true, true); + if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) menu_goto(lcd_tune_menu, 9, true, true); else menu_goto(lcd_settings_menu, 9, true, true); } @@ -4680,14 +4680,14 @@ void lcd_v2_calibration() if (filament < 5) { lcd_commands_step = 20 + filament; - lcd_commands_type = LcdCommands::V2_CAL; + lcd_commands_type = LcdCommands::Layer1Cal; } } else { bool loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is PLA filament loaded?"), false, true);////MSG_PLA_FILAMENT_LOADED c=20 r=2 if (loaded) { - lcd_commands_type = LcdCommands::V2_CAL; + lcd_commands_type = LcdCommands::Layer1Cal; } else { lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 @@ -4947,7 +4947,7 @@ void lcd_wizard(WizState state) case S::Lay1Cal: lcd_show_fullscreen_message_and_wait_P(_i("Now I will calibrate distance between tip of the nozzle and heatbed surface."));////MSG_WIZARD_V2_CAL c=20 r=8 lcd_show_fullscreen_message_and_wait_P(_i("I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration."));////MSG_WIZARD_V2_CAL_2 c=20 r=12 - lcd_commands_type = LcdCommands::V2_CAL; + lcd_commands_type = LcdCommands::Layer1Cal; lcd_return_to_status(); end = true; break; @@ -6267,13 +6267,13 @@ static void lcd_main_menu() }*/ - if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) + if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 } - if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) + if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) { MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE } else @@ -6282,7 +6282,7 @@ static void lcd_main_menu() } #ifdef SDSUPPORT - if (card.cardOK || lcd_commands_type == LcdCommands::V2_CAL) + if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) { if (card.isFileOpen()) { @@ -6298,12 +6298,12 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } } - else if (lcd_commands_type == LcdCommands::V2_CAL && mesh_bed_leveling_flag == false && homing_flag == false) { + else if (lcd_commands_type == LcdCommands::Layer1Cal && mesh_bed_leveling_flag == false && homing_flag == false) { //MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } else { - if (!is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); /*else*/ { @@ -6327,7 +6327,7 @@ static void lcd_main_menu() #endif - if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::V2_CAL)) + if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) { if (farm_mode) { @@ -6371,7 +6371,7 @@ static void lcd_main_menu() } - if (!is_usb_printing && (lcd_commands_type != LcdCommands::V2_CAL)) + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS } @@ -6656,7 +6656,7 @@ void lcd_print_stop() lcd_return_to_status(); lcd_ignore_click(true); lcd_commands_step = 0; - lcd_commands_type = LcdCommands::STOP_PRINT; + lcd_commands_type = LcdCommands::StopPrint; // Turn off the print fan SET_OUTPUT(FAN_PIN); WRITE(FAN_PIN, 0); @@ -8229,5 +8229,5 @@ void menu_lcd_lcdupdate_func(void) if (!SdFatUtil::test_stack_integrity()) stack_error(); lcd_ping(); //check that we have received ping command if we are in farm mode lcd_send_status(); - if (lcd_commands_type == LcdCommands::V2_CAL) lcd_commands(); + if (lcd_commands_type == LcdCommands::Layer1Cal) lcd_commands(); } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 26e282a0f..f980b7fb5 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -90,14 +90,14 @@ extern void lcd_diag_show_end_stops(); // To be used in lcd_commands_type. enum class LcdCommands : uint8_t { - IDLE = 0, - LOAD_FILAMENT = 1, - STOP_PRINT = 2, - UNKNOWN3 = 3, - FARM_MODE_CONFIRM = 4, - LONG_PAUSE = 5, - PID_EXTRUDER = 7, - V2_CAL = 8, + Idle = 0, + LoadFilament = 1, + StopPrint = 2, + Unknown3 = 3, + FarmModeConfirm = 4, + LongPause = 5, + PidExtruder = 7, + Layer1Cal = 8, }; extern LcdCommands lcd_commands_type; From 51df6cdfdc75c69cd6b167f9d4ed4b7e27b89972 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 18:22:57 +0200 Subject: [PATCH 275/368] Remove LcdCommands::Unknown3. Remove LcdCommands mapping to numbers, as it is not needed. --- Firmware/ultralcd.cpp | 5 ----- Firmware/ultralcd.h | 18 +++++++++--------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 808cbfea4..890475c25 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1543,11 +1543,6 @@ void lcd_commands() } } - if (lcd_commands_type == LcdCommands::Unknown3) - { - lcd_commands_type = LcdCommands::Idle; - } - if (lcd_commands_type == LcdCommands::FarmModeConfirm) /// farm mode confirm { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index f980b7fb5..1a88679f4 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -89,15 +89,15 @@ extern void lcd_diag_show_end_stops(); // To be used in lcd_commands_type. -enum class LcdCommands : uint8_t { - Idle = 0, - LoadFilament = 1, - StopPrint = 2, - Unknown3 = 3, - FarmModeConfirm = 4, - LongPause = 5, - PidExtruder = 7, - Layer1Cal = 8, +enum class LcdCommands : uint8_t +{ + Idle, + LoadFilament, + StopPrint, + FarmModeConfirm, + LongPause, + PidExtruder, + Layer1Cal, }; extern LcdCommands lcd_commands_type; From 5fcf76095468e9a8eb65ed573264d281d71c252e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 18:42:55 +0200 Subject: [PATCH 276/368] Use first letter capital camel case for enum class members. Rename CustomMsgTypes to CustomMsg. Remove unnecessary maping to numbers. Change underlying type to uint_least8_t. --- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 26 +++++++++++++------------- Firmware/mmu.cpp | 4 ++-- Firmware/ultralcd.cpp | 38 +++++++++++++++++++------------------- Firmware/ultralcd.h | 19 ++++++++++--------- 5 files changed, 45 insertions(+), 44 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index e896b8383..cef1aa255 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -389,7 +389,7 @@ extern bool wizard_active; //autoload temporarily disabled during wizard extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff -#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsgTypes::TEMCAL) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || card.paused || mmu_print_saved) +#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsg::TempCal) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || card.paused || mmu_print_saved) //! Beware - mcode_in_progress is set as soon as the command gets really processed, //! which is not the same as posting the M600 command into the command queue //! There can be a considerable lag between posting M600 and its real processing which might result diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 374d0b68c..17d9e0877 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3157,7 +3157,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float #endif //IR_SENSOR lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; } //! @brief Rise Z if too low to avoid blob/jam before filament loading @@ -3181,7 +3181,7 @@ void gcode_M701() else { enable_z(); - custom_message_type = CustomMsgTypes::F_LOAD; + custom_message_type = CustomMsg::FilamentLoading; #ifdef FSENSOR_QUALITY fsensor_oq_meassure_start(40); @@ -3211,7 +3211,7 @@ void gcode_M701() lcd_setstatuspgm(_T(WELCOME_MSG)); disable_z(); loading_flag = false; - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; #ifdef FSENSOR_QUALITY fsensor_oq_meassure_stop(); @@ -4194,7 +4194,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // setTargetHotend(200, 0); setTargetBed(70 + (start_temp - 30)); - custom_message_type = CustomMsgTypes::TEMCAL; + custom_message_type = CustomMsg::TempCal; custom_message_state = 1; lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION)); current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; @@ -4296,7 +4296,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; } puts_P(_N("PINDA probe calibration start")); - custom_message_type = CustomMsgTypes::TEMCAL; + custom_message_type = CustomMsg::TempCal; custom_message_state = 1; lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION)); current_position[X_AXIS] = PINDA_PREHEAT_X; @@ -4364,7 +4364,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1); puts_P(_N("Temperature calibration done.")); @@ -4481,9 +4481,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; } // Save custom message state, set a new custom message state to display: Calibrating point 9. - CustomMsgTypes custom_message_type_old = custom_message_type; + CustomMsg custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CustomMsgTypes::MESHBL; + custom_message_type = CustomMsg::MeshBedLeveling; custom_message_state = (nMeasPoints * nMeasPoints) + 10; lcd_update(1); @@ -4683,7 +4683,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) enable_z_endstop(bState); } while (st_get_position_mm(Z_AXIS) > MESH_HOME_Z_SEARCH); // i.e. Z-leveling not o.k. // plan_set_z_position(MESH_HOME_Z_SEARCH); // is not necessary ('do-while' loop always ends at the expected Z-position) - custom_message_type=CustomMsgTypes::STATUS; // display / status-line recovery + custom_message_type=CustomMsg::Status; // display / status-line recovery lcd_update_enable(true); // display / status-line recovery gcode_G28(true, true, true); // X & Y & Z-homing (must be after individual Z-homing (problem with spool-holder)!) repeatcommand_front(); // re-run (i.e. of "G80") @@ -8210,7 +8210,7 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CustomMsgTypes::MESHBL; + custom_message_type = CustomMsg::MeshBedLeveling; custom_message_state = (x_points_num * y_points_num) + 10; lcd_update(1); @@ -8408,7 +8408,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; - custom_message_type = CustomMsgTypes::MESHBL; + custom_message_type = CustomMsg::MeshBedLeveling; custom_message_state = (x_points_num * y_points_num) + 10; lcd_update(1); @@ -8558,7 +8558,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ void temp_compensation_start() { - custom_message_type = CustomMsgTypes::TEMPRE; + custom_message_type = CustomMsg::TempCompPreheat; custom_message_state = PINDA_HEAT_T + 1; lcd_update(2); if (degHotend(active_extruder) > EXTRUDE_MINTEMP) { @@ -8579,7 +8579,7 @@ void temp_compensation_start() { if (custom_message_state == 99 || custom_message_state == 9) lcd_update(2); //force whole display redraw if number of digits changed else lcd_update(1); } - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; custom_message_state = 0; } diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 912305d2a..d13cee6f7 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1372,13 +1372,13 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr) mmu_load_to_nozzle(); load_filament_final_feed(); st_synchronize(); - custom_message_type = CustomMsgTypes::F_LOAD; + custom_message_type = CustomMsg::FilamentLoading; lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); lcd_return_to_status(); lcd_update_enable(true); lcd_load_filament_color_check(); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 890475c25..f07efa321 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -77,7 +77,7 @@ bool presort_flag = false; LcdCommands lcd_commands_type = LcdCommands::Idle; static uint8_t lcd_commands_step = 0; -CustomMsgTypes custom_message_type = CustomMsgTypes::STATUS; +CustomMsg custom_message_type = CustomMsg::Status; unsigned int custom_message_state = 0; @@ -565,7 +565,7 @@ void lcdui_print_temp(char type, int val_current, int val_target) // Print Z-coordinate (8 chars total) void lcdui_print_Z_coord(void) { - if (custom_message_type == CustomMsgTypes::MESHBL) + if (custom_message_type == CustomMsg::MeshBedLeveling) lcd_puts_P(_N("Z --- ")); else lcd_printf_P(_N("Z%6.2f "), current_position[Z_AXIS]); @@ -760,7 +760,7 @@ void lcdui_print_status_line(void) break; } } - else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsgTypes::STATUS)) + else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsg::Status)) { // If printing from SD, show what we are printing if(strlen(card.longFilename) > LCD_WIDTH) { @@ -794,10 +794,10 @@ void lcdui_print_status_line(void) { // Otherwise check for other special events switch (custom_message_type) { - case CustomMsgTypes::STATUS: // Nothing special, print status message normally + case CustomMsg::Status: // Nothing special, print status message normally lcd_print(lcd_status_message); break; - case CustomMsgTypes::MESHBL: // If mesh bed leveling in progress, show the status + case CustomMsg::MeshBedLeveling: // If mesh bed leveling in progress, show the status if (custom_message_state > 10) { lcd_set_cursor(0, 3); @@ -813,7 +813,7 @@ void lcdui_print_status_line(void) { lcd_puts_P(_T(WELCOME_MSG)); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; } if (custom_message_state > 3 && custom_message_state <= 10 ) { @@ -825,10 +825,10 @@ void lcdui_print_status_line(void) } } break; - case CustomMsgTypes::F_LOAD: // If loading filament, print status + case CustomMsg::FilamentLoading: // If loading filament, print status lcd_print(lcd_status_message); break; - case CustomMsgTypes::PIDCAL: // PID tuning in progress + case CustomMsg::PidCal: // PID tuning in progress lcd_print(lcd_status_message); if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) { @@ -838,7 +838,7 @@ void lcdui_print_status_line(void) lcd_print(itostr3left(pid_number_of_cycles)); } break; - case CustomMsgTypes::TEMCAL: // PINDA temp calibration in progress + case CustomMsg::TempCal: // PINDA temp calibration in progress { char progress[4]; lcd_set_cursor(0, 3); @@ -848,7 +848,7 @@ void lcdui_print_status_line(void) lcd_print(progress); } break; - case CustomMsgTypes::TEMPRE: // temp compensation preheat + case CustomMsg::TempCompPreheat: // temp compensation preheat lcd_set_cursor(0, 3); lcd_puts_P(_i("PINDA Heating"));////MSG_PINDA_PREHEAT c=20 r=1 if (custom_message_state <= PINDA_HEAT_T) @@ -1465,7 +1465,7 @@ void lcd_commands() lcd_commands_step = 0; lcd_commands_type = LcdCommands::Idle; lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; isPrintPaused = false; } if (lcd_commands_step == 2 && !blocks_queued()) @@ -1521,7 +1521,7 @@ void lcd_commands() if (mmu_enabled) setAllTargetHotends(0); manage_heater(); - custom_message_type = CustomMsgTypes::F_LOAD; + custom_message_type = CustomMsg::FilamentLoading; lcd_commands_step = 5; } if (lcd_commands_step == 7 && !blocks_queued()) @@ -1589,7 +1589,7 @@ void lcd_commands() char cmd1[30]; if (lcd_commands_step == 0) { - custom_message_type = CustomMsgTypes::PIDCAL; + custom_message_type = CustomMsg::PidCal; custom_message_state = 1; lcd_draw_update = 3; lcd_commands_step = 3; @@ -1625,7 +1625,7 @@ void lcd_commands() } if ((lcd_commands_step == 1) && ((_millis()- display_time)>2000)) { //calibration finished message lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; pid_temp = DEFAULT_PID_TEMP; lcd_commands_step = 0; lcd_commands_type = LcdCommands::Idle; @@ -2758,7 +2758,7 @@ static void lcd_LoadFilament() if(0) { // menu_back(); // not necessary (see "lcd_return_to_status()" below) - custom_message_type = CustomMsgTypes::F_LOAD; + custom_message_type = CustomMsg::FilamentLoading; loading_flag = true; enquecommand_P(PSTR("M701")); //load filament SERIAL_ECHOLN("Loading filament"); @@ -3817,7 +3817,7 @@ void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, ui void lcd_temp_cal_show_result(bool result) { - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; disable_x(); disable_y(); disable_z(); @@ -5900,7 +5900,7 @@ static void change_extr_menu(){ //unload filament for single material printer (used in M702 gcode) void unload_filament() { - custom_message_type = CustomMsgTypes::F_LOAD; + custom_message_type = CustomMsg::FilamentLoading; lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT)); // extr_unload2(); @@ -5935,7 +5935,7 @@ void unload_filament() lcd_update_enable(true); lcd_setstatuspgm(_T(WELCOME_MSG)); - custom_message_type = CustomMsgTypes::STATUS; + custom_message_type = CustomMsg::Status; } @@ -6422,7 +6422,7 @@ static void lcd_colorprint_change() { enquecommand_P(PSTR("M600")); - custom_message_type = CustomMsgTypes::F_LOAD; //just print status message + custom_message_type = CustomMsg::FilamentLoading; //just print status message lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); lcd_return_to_status(); lcd_draw_update = 3; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 1a88679f4..f802edd85 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -89,7 +89,7 @@ extern void lcd_diag_show_end_stops(); // To be used in lcd_commands_type. -enum class LcdCommands : uint8_t +enum class LcdCommands : uint_least8_t { Idle, LoadFilament, @@ -103,16 +103,17 @@ enum class LcdCommands : uint8_t extern LcdCommands lcd_commands_type; extern int8_t FSensorStateMenu; -enum class CustomMsgTypes : uint8_t { - STATUS = 0, //!< status message from lcd_status_message variable - MESHBL = 1, //!< Mesh bed leveling in progress - F_LOAD = 2, //!< Loading filament in progress - PIDCAL = 3, //!< PID tuning in progress - TEMCAL = 4, //!< PINDA temp calibration - TEMPRE = 5, //!< Temp compensation preheat +enum class CustomMsg : uint_least8_t +{ + Status, //!< status message from lcd_status_message variable + MeshBedLeveling, //!< Mesh bed leveling in progress + FilamentLoading, //!< Loading filament in progress + PidCal, //!< PID tuning in progress + TempCal, //!< PINDA temperature calibration + TempCompPreheat, //!< Temperature compensation preheat }; -extern CustomMsgTypes custom_message_type; +extern CustomMsg custom_message_type; extern unsigned int custom_message_state; extern uint8_t farm_mode; From 1390d4e5b9cf74b20b721be7cffee32a35f1473a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 12 Jun 2019 19:11:41 +0200 Subject: [PATCH 277/368] Use first letter capital camel case for enum class members. Change underlying type to uint_least8_t. --- Firmware/Marlin_main.cpp | 4 +- Firmware/mmu.cpp | 2 +- Firmware/ultralcd.cpp | 96 ++++++++++++++++++++-------------------- Firmware/ultralcd.h | 21 ++++----- 4 files changed, 62 insertions(+), 61 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 17d9e0877..e6b0f9476 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7693,7 +7693,7 @@ bool bInhibitFlag; #ifdef IR_SENSOR bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active #endif // IR_SENSOR - if ((mcode_in_progress != 600) && (eFilamentAction != eFILAMENT_ACTION::autoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active + if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && !wizard_active) { @@ -7719,7 +7719,7 @@ if(0) show_preheat_nozzle_warning(); lcd_update_enable(true); */ - eFilamentAction=eFILAMENT_ACTION::autoLoad; + eFilamentAction=FilamentAction::AutoLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index d13cee6f7..fa4a55172 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1076,7 +1076,7 @@ if(0) extr_unload(); } else { - eFilamentAction=eFILAMENT_ACTION::mmuUnLoad; + eFilamentAction=FilamentAction::MmuUnLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f07efa321..890b74750 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1640,7 +1640,7 @@ void lcd_return_to_status() lcd_refresh(); // to maybe revive the LCD if static electricity killed it. menu_goto(lcd_status_screen, 0, false, true); menu_depth = 0; - eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad + eFilamentAction=FilamentAction::None; // i.e. non-autoLoad } //! @brief Pause print, disable nozzle heater, move to park position @@ -2179,7 +2179,7 @@ void lcd_set_filament_oq_meass() } -eFILAMENT_ACTION eFilamentAction=eFILAMENT_ACTION::none; // must be initialized as 'non-autoLoad' +FilamentAction eFilamentAction=FilamentAction::None; // must be initialized as 'non-autoLoad' bool bFilamentFirstRun; bool bFilamentPreheatState; bool bFilamentAction=false; @@ -2196,18 +2196,18 @@ lcd_puts_P(_i("Press the knob")); ////MSG_ c=20 r=1 lcd_set_cursor(0,3); switch(eFilamentAction) { - case eFILAMENT_ACTION::load: - case eFILAMENT_ACTION::autoLoad: - case eFILAMENT_ACTION::mmuLoad: + case FilamentAction::Load: + case FilamentAction::AutoLoad: + case FilamentAction::MmuLoad: lcd_puts_P(_i("to load filament")); ////MSG_ c=20 r=1 break; - case eFILAMENT_ACTION::unLoad: - case eFILAMENT_ACTION::mmuUnLoad: + case FilamentAction::UnLoad: + case FilamentAction::MmuUnLoad: lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1 break; - case eFILAMENT_ACTION::mmuEject: - case eFILAMENT_ACTION::mmuCut: - case eFILAMENT_ACTION::none: + case FilamentAction::MmuEject: + case FilamentAction::MmuCut: + case FilamentAction::None: break; } if(lcd_clicked()) @@ -2221,21 +2221,21 @@ if(lcd_clicked()) menu_back(nLevel); switch(eFilamentAction) { - case eFILAMENT_ACTION::autoLoad: - eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad + case FilamentAction::AutoLoad: + eFilamentAction=FilamentAction::None; // i.e. non-autoLoad // no break - case eFILAMENT_ACTION::load: + case FilamentAction::Load: loading_flag=true; enquecommand_P(PSTR("M701")); // load filament break; - case eFILAMENT_ACTION::unLoad: + case FilamentAction::UnLoad: enquecommand_P(PSTR("M702")); // unload filament break; - case eFILAMENT_ACTION::mmuLoad: - case eFILAMENT_ACTION::mmuUnLoad: - case eFILAMENT_ACTION::mmuEject: - case eFILAMENT_ACTION::mmuCut: - case eFILAMENT_ACTION::none: + case FilamentAction::MmuLoad: + case FilamentAction::MmuUnLoad: + case FilamentAction::MmuEject: + case FilamentAction::MmuCut: + case FilamentAction::None: break; } } @@ -2360,44 +2360,44 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) { switch(eFilamentAction) { - case eFILAMENT_ACTION::load: - case eFILAMENT_ACTION::autoLoad: - case eFILAMENT_ACTION::unLoad: + case FilamentAction::Load: + case FilamentAction::AutoLoad: + case FilamentAction::UnLoad: if(bFilamentWaitingFlag) menu_submenu(mFilamentPrompt); else { nLevel=bFilamentPreheatState?1:2; menu_back(nLevel); - if((eFilamentAction==eFILAMENT_ACTION::load)||(eFilamentAction==eFILAMENT_ACTION::autoLoad)) + if((eFilamentAction==FilamentAction::Load)||(eFilamentAction==FilamentAction::AutoLoad)) { loading_flag=true; enquecommand_P(PSTR("M701")); // load filament - if(eFilamentAction==eFILAMENT_ACTION::autoLoad) - eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad + if(eFilamentAction==FilamentAction::AutoLoad) + eFilamentAction=FilamentAction::None; // i.e. non-autoLoad } - if(eFilamentAction==eFILAMENT_ACTION::unLoad) + if(eFilamentAction==FilamentAction::UnLoad) enquecommand_P(PSTR("M702")); // unload filament } break; - case eFILAMENT_ACTION::mmuLoad: + case FilamentAction::MmuLoad: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); menu_submenu(mmu_load_to_nozzle_menu); break; - case eFILAMENT_ACTION::mmuUnLoad: + case FilamentAction::MmuUnLoad: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); extr_unload(); break; - case eFILAMENT_ACTION::mmuEject: + case FilamentAction::MmuEject: nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; menu_back(nLevel); menu_submenu(mmu_fil_eject_menu); break; - case eFILAMENT_ACTION::mmuCut: + case FilamentAction::MmuCut: #ifdef MMU_HAS_CUTTER nLevel=bFilamentPreheatState?1:2; bFilamentAction=true; @@ -2405,7 +2405,7 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) menu_submenu(mmu_cut_filament_menu); #endif //MMU_HAS_CUTTER break; - case eFILAMENT_ACTION::none: + case FilamentAction::None: break; } if(bFilamentWaitingFlag) @@ -2419,22 +2419,22 @@ else { lcd_set_cursor(0,1); switch(eFilamentAction) { - case eFILAMENT_ACTION::load: - case eFILAMENT_ACTION::autoLoad: - case eFILAMENT_ACTION::mmuLoad: + case FilamentAction::Load: + case FilamentAction::AutoLoad: + case FilamentAction::MmuLoad: lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 break; - case eFILAMENT_ACTION::unLoad: - case eFILAMENT_ACTION::mmuUnLoad: + case FilamentAction::UnLoad: + case FilamentAction::MmuUnLoad: lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 break; - case eFILAMENT_ACTION::mmuEject: + case FilamentAction::MmuEject: lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 break; - case eFILAMENT_ACTION::mmuCut: + case FilamentAction::MmuCut: lcd_puts_P(_i("Preheating to cut")); ////MSG_ c=20 r=1 break; - case eFILAMENT_ACTION::none: + case FilamentAction::None: break; } lcd_set_cursor(0,3); @@ -2453,8 +2453,8 @@ else { setTargetBed((float)nTargetBedOld); } menu_back(); - if(eFilamentAction==eFILAMENT_ACTION::autoLoad) - eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad + if(eFilamentAction==FilamentAction::AutoLoad) + eFilamentAction=FilamentAction::None; // i.e. non-autoLoad } } } @@ -2499,8 +2499,8 @@ mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP,FLEX_PREHEAT_HPB_TEMP); void mFilamentBack() { menu_back(); -if(eFilamentAction==eFILAMENT_ACTION::autoLoad) - eFilamentAction=eFILAMENT_ACTION::none; // i.e. non-autoLoad +if(eFilamentAction==FilamentAction::AutoLoad) + eFilamentAction=FilamentAction::None; // i.e. non-autoLoad } void mFilamentMenu() @@ -2531,7 +2531,7 @@ if(0) enquecommand_P(PSTR("M702")); // unload filament } else { - eFilamentAction=eFILAMENT_ACTION::unLoad; + eFilamentAction=FilamentAction::UnLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -2766,7 +2766,7 @@ if(0) } else { - eFilamentAction=eFILAMENT_ACTION::load; + eFilamentAction=FilamentAction::Load; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -5795,7 +5795,7 @@ static void mmu_load_to_nozzle_menu() } else { - eFilamentAction = eFILAMENT_ACTION::mmuLoad; + eFilamentAction = FilamentAction::MmuLoad; bFilamentFirstRun = false; if (target_temperature[0] >= EXTRUDE_MINTEMP) { @@ -5827,7 +5827,7 @@ static void mmu_fil_eject_menu() } else { - eFilamentAction = eFILAMENT_ACTION::mmuEject; + eFilamentAction = FilamentAction::MmuEject; bFilamentFirstRun = false; if (target_temperature[0] >= EXTRUDE_MINTEMP) { @@ -5855,7 +5855,7 @@ static void mmu_cut_filament_menu() } else { - eFilamentAction=eFILAMENT_ACTION::mmuCut; + eFilamentAction=FilamentAction::MmuCut; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index f802edd85..99c4c0cfe 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -151,18 +151,19 @@ void extr_unload_used(); #endif //SNMM void extr_unload(); -enum class eFILAMENT_ACTION : uint8_t { - none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) - load, - autoLoad, - unLoad, - mmuLoad, - mmuUnLoad, - mmuEject, - mmuCut, +enum class FilamentAction : uint_least8_t +{ + None, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) + Load, + AutoLoad, + UnLoad, + MmuLoad, + MmuUnLoad, + MmuEject, + MmuCut, }; -extern eFILAMENT_ACTION eFilamentAction; +extern FilamentAction eFilamentAction; extern bool bFilamentFirstRun; extern bool bFilamentPreheatState; extern bool bFilamentAction; From 25f0eb9a3983782d63d2de517e44db174f25ca0f Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 13 Jun 2019 15:01:54 +0200 Subject: [PATCH 278/368] Fix spelling. --- Firmware/Marlin_main.cpp | 4 ++-- Firmware/first_lay_cal.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 230fda94e..660f50956 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8229,7 +8229,7 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi float bed_zero_ref_y = (-0.6f + Y_PROBE_OFFSET_FROM_EXTRUDER); float mesh_home_z_search = 4; - float measure_z_heigth = 0.2f; + float measure_z_height = 0.2f; float row[x_points_num]; int ix = 0; int iy = 0; @@ -8264,7 +8264,7 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi } st_synchronize(); */ - destination[Z_AXIS] = measure_z_heigth; + destination[Z_AXIS] = measure_z_height; plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); for(int8_t i=0; i < NUM_AXIS; i++) { current_position[i] = destination[i]; diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 50f08c5e3..bfec021fd 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -128,19 +128,19 @@ void lay1cal_before_meander() //! @brief Count extrude length //! -//! @param layer_heigth layer heigth in mm +//! @param layer_height layer height in mm //! @param extrusion_width extrusion width in mm //! @param extrusion_length extrusion length in mm //! @return filament length in mm which needs to be extruded to form line -static constexpr float count_e(float layer_heigth, float extrusion_width, float extrusion_length) +static constexpr float count_e(float layer_height, float extrusion_width, float extrusion_length) { - return (extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4)); + return (extrusion_length * layer_height * extrusion_width / (M_PI * pow(1.75, 2) / 4)); } static const float width = 0.4; //!< line width static const float length = 20 - width; //!< line length -static const float heigth = 0.2; //!< layer height TODO This is wrong, as current Z height is 0.15 mm -static const float extr = count_e(heigth, width, length); //!< E axis movement needed to print line +static const float height = 0.2; //!< layer height TODO This is wrong, as current Z height is 0.15 mm +static const float extr = count_e(height, width, length); //!< E axis movement needed to print line //! @brief Print meander //! @param cmd_buffer character buffer needed to format gcodes @@ -199,7 +199,7 @@ void lay1cal_meander(char *cmd_buffer) //! @param i iteration void lay1cal_square(char *cmd_buffer, uint8_t i) { - const float extr_short_segment = count_e(heigth, width, width); + const float extr_short_segment = count_e(height, width, width); static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f"; static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f"; From fee67d9451a68c203617bdfd5c87652401a3cc94 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 13 Jun 2019 16:37:51 +0200 Subject: [PATCH 279/368] Increase version. --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index bfa44a735..eee1b1672 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.7.1" -#define FW_COMMIT_NR 2266 +#define FW_VERSION "3.7.2-RC1" +#define FW_COMMIT_NR 2359 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From e46cc30c61aa624811dfcdc8a425a44f44bdb2de Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Thu, 13 Jun 2019 18:00:31 +0200 Subject: [PATCH 280/368] Fix length false positives... - Just reading the length of the translation line gives false positives as the " are included in the length BUT not displayed on the LCD. - added missing argument 'pl' --- lang/lang-check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/lang-check.py b/lang/lang-check.py index 6b918df81..f592798e6 100644 --- a/lang/lang-check.py +++ b/lang/lang-check.py @@ -38,7 +38,7 @@ def parse_txt(lang, no_warning): if rows is None: rows = 1 - if len(translation) > cols*rows: + if len(translation)-2 > cols*rows: stderr.write( "[E]: Text %s is longer then definiton on line %d\n" % (translation, lines)) @@ -56,7 +56,7 @@ def main(): usage="$(prog)s lang") parser.add_argument( "lang", nargs='?', default="en", type=str, - help="Check lang file (en|cs|de|es|fr|it)") + help="Check lang file (en|cs|de|es|fr|it|pl)") parser.add_argument( "--no-warning", action="store_true", help="Disable warnings") From b1df1fb1f120114c032ae475e4e663944b1d8a4e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 14 Jun 2019 18:18:27 +0200 Subject: [PATCH 281/368] Fix formatting. We are never using 2 space indentation. 4 spaces are preferred, tabulator is acceptable if surrounding code uses tabs. --- Firmware/Marlin_main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index cb262e128..575dec977 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3146,9 +3146,10 @@ void gcode_M701() { printf_P(PSTR("gcode_M701 begin\n")); - if (farm_mode){ - prusa_statistics(22); - } + if (farm_mode) + { + prusa_statistics(22); + } if (mmu_enabled) { From 6cb85a455f307105ac3e777022510cb277f3443c Mon Sep 17 00:00:00 2001 From: KDanielK Date: Fri, 14 Jun 2019 18:28:11 +0200 Subject: [PATCH 282/368] Update mmu.cpp --- Firmware/mmu.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index fa4a55172..5deb466dc 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1462,11 +1462,20 @@ static void load_more() mmu_command(MmuCmd::C0); manage_response(true, true, MMU_LOAD_MOVE); } - current_position[E_AXIS] += 60; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); - current_position[E_AXIS] -= 58; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); - st_synchronize(); + uint8_t retries = 3; + do + {//We will retry the load to nozzle three times since it most of the time fails due to a bad tip and not a clog + current_position[E_AXIS] += 60; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + current_position[E_AXIS] -= 58; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + st_synchronize(); + if(PIN_GET(IR_SENSOR_PIN) != 0) + {//Adjust position so we are back at zero if sensor isn't detecting filament but dont do the actual movement + current_position[E_AXIS] -= 2; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + } + }while(PIN_GET(IR_SENSOR_PIN) != 0 && retries-- > 0); } static void increment_load_fail() From ae9ae951877707c2c8c17b198128f88b5a035c25 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 18 Jun 2019 19:15:16 +0200 Subject: [PATCH 283/368] MMU: Filter IR sensor signal when detecting whether filament tip passes to heat break. Increase number of tries when loading filament to 3. --- Firmware/mmu.cpp | 88 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 23 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 5deb466dc..97dba519c 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -81,9 +81,11 @@ uint16_t mmu_power_failures = 0; #ifdef MMU_DEBUG +static const auto DEBUG_PUTCHAR = putchar; static const auto DEBUG_PUTS_P = puts_P; static const auto DEBUG_PRINTF_P = printf_P; #else //MMU_DEBUG +#define DEBUG_PUTCHAR(c) #define DEBUG_PUTS_P(str) #define DEBUG_PRINTF_P( __fmt, ... ) #endif //MMU_DEBUG @@ -1447,35 +1449,69 @@ bFilamentAction=false; // NOT in "mmu_fil_eject_menu( } } +//! @brief Fits filament tip into heatbreak? +//! +//! If PTFE tube is jammed, this cause filament to be unloaded and no longer +//! detected by pulley IR sensor. +//! @retval true Fits +//! @retval false Doesn't fit +static bool can_load() +{ + current_position[E_AXIS] += 60; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], + current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + current_position[E_AXIS] -= 52; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], + current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + st_synchronize(); + + uint_least8_t filament_detected_count = 0; + const float e_increment = 0.2; + const uint_least8_t steps = 6.0 / e_increment; + DEBUG_PUTS_P(PSTR("MMU can_load:")); + for(uint_least8_t i = 0; i < steps; ++i) + { + current_position[E_AXIS] -= e_increment; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], + current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + st_synchronize(); + if(0 == PIN_GET(IR_SENSOR_PIN)) + { + ++filament_detected_count; + DEBUG_PUTCHAR('O'); + } + else + { + DEBUG_PUTCHAR('o'); + } + } + if (filament_detected_count > steps - 4) + { + DEBUG_PUTS_P(PSTR(" succeeded.")); + return true; + } + else + { + DEBUG_PUTS_P(PSTR(" failed.")); + return false; + } +} + //! @brief load more //! //! Try to feed more filament from MMU if it is not detected by filament sensor. -//! Move filament back and forth to nozzle in order to detect jam. -//! If PTFE tube is jammed, this cause filament to be unloaded and no longer -//! detected by pulley IR sensor in next step. -static void load_more() +//! @retval true Success, filament detected by IR sensor +//! @retval false Failed, filament not detected by IR sensor after maximum number of attempts +static bool load_more() { for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) { - if (PIN_GET(IR_SENSOR_PIN) == 0) break; + if (PIN_GET(IR_SENSOR_PIN) == 0) return true; DEBUG_PRINTF_P(PSTR("Additional load attempt nr. %d\n"), i); mmu_command(MmuCmd::C0); manage_response(true, true, MMU_LOAD_MOVE); } - uint8_t retries = 3; - do - {//We will retry the load to nozzle three times since it most of the time fails due to a bad tip and not a clog - current_position[E_AXIS] += 60; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); - current_position[E_AXIS] -= 58; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); - st_synchronize(); - if(PIN_GET(IR_SENSOR_PIN) != 0) - {//Adjust position so we are back at zero if sensor isn't detecting filament but dont do the actual movement - current_position[E_AXIS] -= 2; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); - } - }while(PIN_GET(IR_SENSOR_PIN) != 0 && retries-- > 0); + return false; } static void increment_load_fail() @@ -1516,7 +1552,8 @@ void mmu_continue_loading(bool blocking) return; } - load_more(); + bool success = load_more(); + if (success) success = can_load(); enum class Ls : uint_least8_t { @@ -1526,7 +1563,10 @@ void mmu_continue_loading(bool blocking) }; Ls state = Ls::Enter; - while (PIN_GET(IR_SENSOR_PIN) != 0) + const uint_least8_t max_retry = 2; + uint_least8_t retry = 0; + + while (!success) { switch (state) { @@ -1543,8 +1583,10 @@ void mmu_continue_loading(bool blocking) #endif //MMU_HAS_CUTTER mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); - load_more(); - state = Ls::Unload; + success = load_more(); + if (success) success = can_load(); + ++retry; // overflow not handled, as it is not dangerous. + if (retry >= max_retry) state = Ls::Unload; break; case Ls::Unload: stop_and_save_print_to_ram(0, 0); From 8b6629ad58ef6760f3816bd53ff0171185460bb6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 18 Jun 2019 20:00:02 +0200 Subject: [PATCH 284/368] Fix comment grammar. --- Firmware/mmu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 97dba519c..c207a74d9 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1451,8 +1451,8 @@ bFilamentAction=false; // NOT in "mmu_fil_eject_menu( //! @brief Fits filament tip into heatbreak? //! -//! If PTFE tube is jammed, this cause filament to be unloaded and no longer -//! detected by pulley IR sensor. +//! If PTFE tube is jammed, this causes filament to be unloaded and no longer +//! being detected by the pulley IR sensor. //! @retval true Fits //! @retval false Doesn't fit static bool can_load() From 64903e0ae8849d8819cdfd4bf38790173ba7fa89 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 19 Jun 2019 14:27:02 +0200 Subject: [PATCH 285/368] Remove unused defines. --- Firmware/eeprom.h | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 70f9f726b..4d37b93a6 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -171,27 +171,6 @@ // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! -//TMC2130 configuration -#define EEPROM_TMC_AXIS_SIZE //axis configuration block size -#define EEPROM_TMC_X (EEPROM_TMC + 0 * EEPROM_TMC_AXIS_SIZE) //X axis configuration blok -#define EEPROM_TMC_Y (EEPROM_TMC + 1 * EEPROM_TMC_AXIS_SIZE) //Y axis -#define EEPROM_TMC_Z (EEPROM_TMC + 2 * EEPROM_TMC_AXIS_SIZE) //Z axis -#define EEPROM_TMC_E (EEPROM_TMC + 3 * EEPROM_TMC_AXIS_SIZE) //E axis -//TMC2130 - X axis -#define EEPROM_TMC_X_USTEPS_INTPOL (EEPROM_TMC_X + 0) // 1byte, bit 0..4 USTEPS, bit 7 INTPOL -#define EEPROM_TMC_X_PWM_AMPL (EEPROM_TMC_X + 1) // 1byte (0..255) -#define EEPROM_TMC_X_PWM_GRAD_FREQ (EEPROM_TMC_X + 2) // 1byte, bit 0..3 GRAD, bit 4..5 FREQ -#define EEPROM_TMC_X_TCOOLTHRS (EEPROM_TMC_X + 3) // 2bytes (0..) -#define EEPROM_TMC_X_SG_THRS (EEPROM_TMC_X + 5) // 1byte, (-64..+63) -#define EEPROM_TMC_X_CURRENT_H (EEPROM_TMC_X + 6) // 1byte, (0..63) -#define EEPROM_TMC_X_CURRENT_R (EEPROM_TMC_X + 7) // 1byte, (0..63) -#define EEPROM_TMC_X_HOME_SG_THRS (EEPROM_TMC_X + 8) // 1byte, (-64..+63) -#define EEPROM_TMC_X_HOME_CURRENT_R (EEPROM_TMC_X + 9) // 1byte, (-64..+63) -#define EEPROM_TMC_X_HOME_DTCOOLTHRS (EEPROM_TMC_X + 10) // 1byte (-128..+127) -#define EEPROM_TMC_X_DTCOOLTHRS_LOW (EEPROM_TMC_X + 11) // 1byte (-128..+127) -#define EEPROM_TMC_X_DTCOOLTHRS_HIGH (EEPROM_TMC_X + 12) // 1byte (-128..+127) -#define EEPROM_TMC_X_SG_THRS_LOW (EEPROM_TMC_X + 13) // 1byte, (-64..+63) -#define EEPROM_TMC_X_SG_THRS_HIGH (EEPROM_TMC_X + 14) // 1byte, (-64..+63) // Currently running firmware, each digit stored as uint16_t. // The flavor differentiates a dev, alpha, beta, release candidate or a release version. From 6a272d83b1e50695f0aea0860ee811daf6cf4e10 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 19 Jun 2019 15:09:07 +0200 Subject: [PATCH 286/368] Add compile time check for EEPROM stored varibles size. --- Firmware/eeprom.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 4d37b93a6..f8f944c65 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -167,11 +167,15 @@ #define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 #define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 +//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. +#define EEPROM_LAST_ITEM EEPROM_NOZZLE_DIAMETER_uM + // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! + // Currently running firmware, each digit stored as uint16_t. // The flavor differentiates a dev, alpha, beta, release candidate or a release version. #define EEPROM_FIRMWARE_VERSION_END (FW_PRUSA3D_MAGIC_LEN+8) @@ -184,7 +188,9 @@ #ifdef __cplusplus #include "ConfigurationStore.h" +static_assert(EEPROM_FIRMWARE_VERSION_END < 20, "Firmware version EEPROM address conflicts with EEPROM_M500_base"); static M500_conf * const EEPROM_M500_base = reinterpret_cast(20); //offset for storing settings using M500 +static_assert(((sizeof(M500_conf) + 20) < EEPROM_LAST_ITEM), "M500_conf address space conflicts with previous items."); #endif enum From 524121141ab1168dffb33b40e2582c7602164236 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 19 Jun 2019 15:54:24 +0200 Subject: [PATCH 287/368] Remove commented out code. This code is of unknown genesis and purpose. It was added in commit "3.0.10 sync" two years ago and it was already commented out in that moment. --- Firmware/ultralcd.cpp | 49 ------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 608b8c291..52e5988d6 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6321,55 +6321,6 @@ static void lcd_main_menu() MENU_ITEM_FUNCTION_P(PSTR("recover print"), recover_print); MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_); #endif //TMC2130_DEBUG - - /* if (farm_mode && !IS_SD_PRINTING ) - { - - int tempScrool = 0; - if (lcd_draw_update == 0 && LCD_CLICKED == 0) - //_delay(100); - return; // nothing to do (so don't thrash the SD card) - uint16_t fileCnt = card.getnrfilenames(); - - card.getWorkDirName(); - if (card.filename[0] == '/') - { -#if SDCARDDETECT == -1 - MENU_ITEM_FUNCTION_P(_T(MSG_REFRESH), lcd_sd_refresh); -#endif - } else { - MENU_ITEM_FUNCTION_P(PSTR(LCD_STR_FOLDER ".."), lcd_sd_updir); - } - - for (uint16_t i = 0; i < fileCnt; i++) - { - if (menu_item == menu_line) - { -#ifndef SDCARD_RATHERRECENTFIRST - card.getfilename(i); -#else - card.getfilename(fileCnt - 1 - i); -#endif - if (card.filenameIsDir) - { - MENU_ITEM_SDDIR(_T(MSG_CARD_MENU), card.filename, card.longFilename); - } else { - - MENU_ITEM_SDFILE(_T(MSG_CARD_MENU), card.filename, card.longFilename); - - - - - } - } else { - MENU_ITEM_DUMMY(); - } - } - - MENU_ITEM_BACK_P(PSTR("- - - - - - - - -")); - - - }*/ if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { From 46a5f8328350cd87a62492c348f93e565ec5d780 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 19 Jun 2019 18:30:12 +0200 Subject: [PATCH 288/368] Disable language check warnings of type "[W]: No display definition on line". Those warnings were masking all other much more useful build process output. --- lang/lang-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/lang-build.sh b/lang/lang-build.sh index e528ff94d..b8c2476eb 100755 --- a/lang/lang-build.sh +++ b/lang/lang-build.sh @@ -82,7 +82,7 @@ generate_binary() rm -f lang_$1.dat LNG=$1 #check lang dictionary - /usr/bin/env python lang-check.py $1 + /usr/bin/env python lang-check.py $1 --no-warning #create lang_xx.tmp - different processing for 'en' language if [ "$1" = "en" ]; then #remove comments and empty lines From 0a48082609f2252f49ae1dadd2ee4c12bb43cdf9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 20 Jun 2019 16:40:53 +0200 Subject: [PATCH 289/368] Add steel sheet profile selector. --- Firmware/Marlin_main.cpp | 16 +++++++++++++++- Firmware/eeprom.h | 26 ++++++++++++++++++++++++-- Firmware/menu.cpp | 26 ++++++++++++++++++++++++++ Firmware/menu.h | 5 +++++ Firmware/ultralcd.cpp | 15 +++++++++++++++ 5 files changed, 85 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c8f5feb63..ddb9b2039 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1076,6 +1076,7 @@ void setup() SERIAL_ECHO_START; printf_P(PSTR(" " FW_VERSION_FULL "\n")); + //SERIAL_ECHOPAIR("Active sheet before:", static_cast(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))); #ifdef DEBUG_SEC_LANG lang_table_header_t header; @@ -1437,6 +1438,20 @@ void setup() if (eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0); if (eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0); if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0); + if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); + for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i) + { + bool is_uninitialized = true; + for (uint_least8_t j = 0; j < (sizeof(Sheet::name)/sizeof(Sheet::name[0])); ++j) + { + if (0xff != eeprom_read_byte(&(EEPROM_Sheets_base->s[i].name[j]))) is_uninitialized = false; + } + if(is_uninitialized) + { + eeprom_write_byte(&(EEPROM_Sheets_base->s[i].name[0]), i + '1'); + eeprom_write_byte(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); + } + } #ifdef SNMM if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM @@ -1650,7 +1665,6 @@ void setup() #ifdef WATCHDOG wdt_enable(WDTO_4S); #endif //WATCHDOG - } diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index f8f944c65..989f6a394 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -1,6 +1,8 @@ #ifndef EEPROM_H #define EEPROM_H +#include + // The total size of the EEPROM is // 4096 for the Atmega2560 #define EEPROM_TOP 4096 @@ -167,8 +169,28 @@ #define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 #define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 +typedef struct +{ + char name[7]; +} Sheet; + +typedef struct +{ + Sheet s[3]; + uint8_t active_sheet; +} Sheets; +// sizeof(Sheets). Do not change it unless EEPROM_Sheets_base is last item in EEPROM. +// Otherwise it would move following items. +#define EEPROM_SHEETS_SIZEOF 22 + +static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER - EEPROM_SHEETS_SIZEOF); + +#ifdef __cplusplus +static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF."); +#endif + //This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. -#define EEPROM_LAST_ITEM EEPROM_NOZZLE_DIAMETER_uM +#define EEPROM_LAST_ITEM ((uint16_t)EEPROM_Sheets_base) // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! @@ -189,7 +211,7 @@ #ifdef __cplusplus #include "ConfigurationStore.h" static_assert(EEPROM_FIRMWARE_VERSION_END < 20, "Firmware version EEPROM address conflicts with EEPROM_M500_base"); -static M500_conf * const EEPROM_M500_base = reinterpret_cast(20); //offset for storing settings using M500 +static constexpr M500_conf * const EEPROM_M500_base = reinterpret_cast(20); //offset for storing settings using M500 static_assert(((sizeof(M500_conf) + 20) < EEPROM_LAST_ITEM), "M500_conf address space conflicts with previous items."); #endif diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index e0364056e..71ddd1bad 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -174,6 +174,17 @@ static void menu_draw_item_puts_P(char type_char, const char* str) lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); } +static void menu_draw_item_puts_P(char type_char, const char *str_P, const Sheet &sheet) +{ + lcd_set_cursor(0, menu_row); + char buffer[19]; + uint_least8_t index = sprintf_P(buffer, PSTR("%.10S "), str_P); + eeprom_read_block(&(buffer[index]), sheet.name, 7); + index += 7; + buffer[index] = '\0'; + lcd_printf_P(PSTR("%c%-18.18s%c"), (lcd_encoder == menu_item)?'>':' ', buffer, type_char); +} + static void menu_draw_item_puts_P(char type_char, const char* str, char num) { lcd_set_cursor(0, menu_row); @@ -224,6 +235,21 @@ uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu) return 0; } +uint8_t menu_item_submenu_P(const char* str_P, const Sheet &sheet, menu_func_t submenu) +{ + if (menu_item == menu_line) + { + if (lcd_draw_update) menu_draw_item_puts_P(LCD_STR_ARROW_RIGHT[0], str_P, sheet); + if (menu_clicked && (lcd_encoder == menu_item)) + { + menu_submenu(submenu); + return menu_item_ret(); + } + } + menu_item++; + return 0; +} + uint8_t menu_item_back_P(const char* str) { if (menu_item == menu_line) diff --git a/Firmware/menu.h b/Firmware/menu.h index 5f73e18b0..1e4252874 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -3,6 +3,7 @@ #define _MENU_H #include +#include "eeprom.h" #define MENU_DATA_SIZE 32 @@ -99,6 +100,10 @@ extern uint8_t menu_item_text_P(const char* str); #define MENU_ITEM_SUBMENU_P(str, submenu) do { if (menu_item_submenu_P(str, submenu)) return; } while (0) extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu); +#define MENU_ITEM_SUBMENU_P_E(str_P, eeprom_address_7b, submenu) do { if (menu_item_submenu_P(str_P, eeprom_address_7b, submenu)) return; } while (0) +extern uint8_t menu_item_submenu_P(const char *str_P, const Sheet &sheet, menu_func_t submenu); + + #define MENU_ITEM_BACK_P(str) do { if (menu_item_back_P(str)) return; } while (0) extern uint8_t menu_item_back_P(const char* str); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 52e5988d6..b057af506 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6300,6 +6300,15 @@ void lcd_resume_print() isPrintPaused = false; } +static void lcd_sheet_menu() +{ + uint_least8_t sheet_index = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); + sheet_index++; + if (sheet_index >= (sizeof(Sheets::s)/sizeof(Sheets::s[0]))) sheet_index = 0; + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_index); + menu_back(); +} + static void lcd_main_menu() { @@ -6334,8 +6343,14 @@ static void lcd_main_menu() } else { MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT + do + { + if (menu_item_submenu_P(_i("Sheet"), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu)) return; + } while (0); } + + #ifdef SDSUPPORT if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) { From 19a474eaa5298cf2aceae713daeaf0fa38bf1870 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 20 Jun 2019 18:00:29 +0200 Subject: [PATCH 290/368] Fix compiler warnings. --- Firmware/Marlin_main.cpp | 29 +--------------- Firmware/eeprom.cpp | 74 ++++++++++++++++++++++++++++++++++++++++ Firmware/eeprom.h | 2 ++ 3 files changed, 77 insertions(+), 28 deletions(-) create mode 100644 Firmware/eeprom.cpp diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index ddb9b2039..bbf5bae09 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1425,34 +1425,7 @@ void setup() printf_P(PSTR("Card NG!\n")); #endif //DEBUG_SD_SPEED_TEST - if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0); - if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0); - if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_Y, 0); - if (eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_FERROR_COUNT, 0); - if (eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_POWER_COUNT_TOT, 0); - if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT, 0); - if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT, 0); - if (eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, 0); - - if (eeprom_read_word((uint16_t*)EEPROM_MMU_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_FAIL_TOT, 0); - if (eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0); - if (eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0); - if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0); - if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); - for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i) - { - bool is_uninitialized = true; - for (uint_least8_t j = 0; j < (sizeof(Sheet::name)/sizeof(Sheet::name[0])); ++j) - { - if (0xff != eeprom_read_byte(&(EEPROM_Sheets_base->s[i].name[j]))) is_uninitialized = false; - } - if(is_uninitialized) - { - eeprom_write_byte(&(EEPROM_Sheets_base->s[i].name[0]), i + '1'); - eeprom_write_byte(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); - } - } - + eeprom_init(); #ifdef SNMM if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM int _z = BOWDEN_LENGTH; diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp new file mode 100644 index 000000000..74c086fa8 --- /dev/null +++ b/Firmware/eeprom.cpp @@ -0,0 +1,74 @@ +//! @file +//! @date Jun 20, 2019 +//! @author Marek Běl + +#include "eeprom.h" + +#include +#include + +#if 0 +template +static T eeprom_read(T *address); + +template<> +char eeprom_read(char *address) +{ + return eeprom_read_byte(reinterpret_cast(address)); +} +#endif + +template +static void eeprom_write(T *address, T value); + +template<> +void eeprom_write(char *addres, char value) +{ + eeprom_write_byte(reinterpret_cast(addres), static_cast(value)); +} + + +template +static bool eeprom_is_uninitialized(T *address); + +template <> +bool eeprom_is_uninitialized(char *address) +{ + return (0xff == eeprom_read_byte(reinterpret_cast(address))); +} + +void eeprom_init() +{ + if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_Y, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_FERROR_COUNT, 0); + if (eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_POWER_COUNT_TOT, 0); + if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT, 0); + if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT, 0); + if (eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, 0); + + if (eeprom_read_word((uint16_t*)EEPROM_MMU_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_FAIL_TOT, 0); + if (eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0); + if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0); + if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); + for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i) + { + bool is_uninitialized = true; + for (uint_least8_t j = 0; j < (sizeof(Sheet::name)/sizeof(Sheet::name[0])); ++j) + { + if (!eeprom_is_uninitialized(&(EEPROM_Sheets_base->s[i].name[j]))) is_uninitialized = false; + } + if(is_uninitialized) + { + eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast(i + '1')); + eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); + } + } + +} + + + + diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 989f6a394..4b16c81b4 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -3,6 +3,8 @@ #include +void eeprom_init(); + // The total size of the EEPROM is // 4096 for the Atmega2560 #define EEPROM_TOP 4096 From e6fbac08ed8a76b457854db80afb129443bbb123 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 21 Jun 2019 15:44:56 +0200 Subject: [PATCH 291/368] Move sheet selector to submenu. --- Firmware/menu.h | 2 +- Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/ultralcd.cpp | 41 ++++++++++++++++++++++++++++++++--------- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Firmware/menu.h b/Firmware/menu.h index 1e4252874..e7e42b68c 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -100,7 +100,7 @@ extern uint8_t menu_item_text_P(const char* str); #define MENU_ITEM_SUBMENU_P(str, submenu) do { if (menu_item_submenu_P(str, submenu)) return; } while (0) extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu); -#define MENU_ITEM_SUBMENU_P_E(str_P, eeprom_address_7b, submenu) do { if (menu_item_submenu_P(str_P, eeprom_address_7b, submenu)) return; } while (0) +#define MENU_ITEM_SUBMENU_P_E(str_P, sheet, submenu) do { if (menu_item_submenu_P(str_P, sheet, submenu)) return; } while (0) extern uint8_t menu_item_submenu_P(const char *str_P, const Sheet &sheet, menu_func_t submenu); diff --git a/Firmware/messages.c b/Firmware/messages.c index 53ec20e86..804b0f50f 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -55,6 +55,7 @@ const char MSG_CUT_FILAMENT[] PROGMEM_I1 = ISTR("Cut filament"); //// Number 1 t const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1 const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); //// const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); //// +const char MSG_SHEET[] PROGMEM_I1 = ISTR("Sheet"); ////c=10 const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[] PROGMEM_I1 = ISTR("Measuring reference height of calibration point"); ////c=60 const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[] PROGMEM_I1 = ISTR(" of 9"); ////c=14 const char MSG_MENU_CALIBRATION[] PROGMEM_I1 = ISTR("Calibration"); //// diff --git a/Firmware/messages.h b/Firmware/messages.h index d74412fca..bbfc10658 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -54,6 +54,7 @@ extern const char MSG_LOADING_FILAMENT[]; extern const char MSG_M117_V2_CALIBRATION[]; extern const char MSG_MAIN[]; extern const char MSG_BACK[]; +extern const char MSG_SHEET[]; extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[]; extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[]; extern const char MSG_MENU_CALIBRATION[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b057af506..f37f55659 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6300,13 +6300,39 @@ void lcd_resume_print() isPrintPaused = false; } +static void lcd_select_sheet_0_menu() +{ + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); + menu_back(3); +} +static void lcd_select_sheet_1_menu() +{ + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 1); + menu_back(3); +} +static void lcd_select_sheet_2_menu() +{ + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 2); + menu_back(3); +} + +static void lcd_select_sheet_menu() +{ + MENU_BEGIN(); + MENU_ITEM_BACK_P(_T(MSG_SHEET)); + MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); + MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); + MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); + MENU_END(); +} + static void lcd_sheet_menu() { - uint_least8_t sheet_index = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); - sheet_index++; - if (sheet_index >= (sizeof(Sheets::s)/sizeof(Sheets::s[0]))) sheet_index = 0; - eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_index); - menu_back(); + MENU_BEGIN(); + MENU_ITEM_BACK_P(_T(MSG_MAIN)); + MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); + + MENU_END(); } static void lcd_main_menu() @@ -6343,10 +6369,7 @@ static void lcd_main_menu() } else { MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT - do - { - if (menu_item_submenu_P(_i("Sheet"), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu)) return; - } while (0); + MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); } From b67ec501b4a8af76bd889d9e398abc32bcc6b428 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 24 Jun 2019 17:11:13 +0200 Subject: [PATCH 292/368] Add rename sheet menu. --- Firmware/ultralcd.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f37f55659..db1f043b0 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6326,11 +6326,56 @@ static void lcd_select_sheet_menu() MENU_END(); } +static void lcd_rename_sheet_menu() +{ + struct MenuData + { + bool initialized; + uint8_t selected; + char name[sizeof(Sheet::name)]; + }; + static_assert(sizeof(menu_data)>= sizeof(MenuData),"MenuData doesn't fit into menu_data"); + MenuData* menuData = (MenuData*)&(menu_data[0]); + + if (!menuData->initialized) + { + eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, sizeof(Sheet::name)); + lcd_encoder = menuData->name[0]; + menuData->initialized = true; + } + if (lcd_encoder < '\x20') lcd_encoder = '\x20'; + if (lcd_encoder > '\x7F') lcd_encoder = '\x7F'; + + menuData->name[menuData->selected] = lcd_encoder; + lcd_set_cursor(0,0); + for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i) + { + lcd_putc(menuData->name[i]); + } + lcd_set_cursor(menuData->selected, 1); + lcd_putc('^'); + if (lcd_clicked()) + { + if ((menuData->selected + 1u) < sizeof(Sheet::name)) + { + lcd_encoder = menuData->name[++(menuData->selected)]; + } + else + { + eeprom_update_block(menuData->name, + EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, + sizeof(Sheet::name)); + menu_back(); + } + } +} + static void lcd_sheet_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); + MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18 + MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 MENU_END(); } From b5168bd6c2b165094d5479b5f17fc242e3411354 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 24 Jun 2019 17:30:56 +0200 Subject: [PATCH 293/368] fan error fix --- Firmware/Marlin_main.cpp | 9 +++++++++ Firmware/temperature.cpp | 7 +++++-- Firmware/ultralcd.cpp | 5 ++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 711c428b9..7f2efe35b 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9387,6 +9387,11 @@ void restore_print_from_ram_and_continue(float e_move) fanSpeed = saved_fanSpeed; float e = saved_pos[E_AXIS] - e_move; plan_set_e_position(e); + + #ifdef FANCHECK + fans_check_enabled = false; + #endif + //first move print head in XY to the saved position: plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], current_position[Z_AXIS], saved_pos[E_AXIS] - e_move, homing_feedrate[Z_AXIS]/13, active_extruder); st_synchronize(); @@ -9397,6 +9402,10 @@ void restore_print_from_ram_and_continue(float e_move) plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], saved_pos[E_AXIS], 35, active_extruder); st_synchronize(); + #ifdef FANCHECK + fans_check_enabled = true; + #endif + memcpy(current_position, saved_pos, sizeof(saved_pos)); memcpy(destination, current_position, sizeof(destination)); if (saved_printing_type == PRINTING_TYPE_SD) { //was sd printing diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 9c49cf79c..7ea6d07cc 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -500,8 +500,9 @@ void checkFanSpeed() max_print_fan_errors = 15; //15 seconds max_extruder_fan_errors = 5; //5 seconds #endif //FAN_SOFT_PWM - - fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0); + + if(fans_check_enabled != false) + fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0); static unsigned char fan_speed_errors[2] = { 0,0 }; #if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 >-1)) if ((fan_speed[0] == 0) && (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE)) fan_speed_errors[0]++; @@ -560,6 +561,8 @@ void fanSpeedError(unsigned char _fan) { else { setTargetHotend0(0); SERIAL_ECHOLNPGM("// action:pause"); //for octoprint + heating_status = 0; + fan_check_error = EFCE_REPORTED; } switch (_fan) { case 0: // extracting the same code from case 0 and case 1 into a function saves 72B diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f69efbbc3..0a22a9373 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6380,6 +6380,7 @@ static void lcd_test_menu() void lcd_resume_print() { lcd_return_to_status(); + lcd_reset_alert_level(); lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); lcd_reset_alert_level(); //for fan speed error restore_print_from_ram_and_continue(0.0); @@ -6485,7 +6486,9 @@ static void lcd_main_menu() } else { - MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + checkFanSpeed(); //Check manually to get most recent fan speed status + if(fan_check_error == EFCE_OK) + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT } MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } From 3e9dc91cefac628539cabf2099b78285867b70df Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 24 Jun 2019 18:01:49 +0200 Subject: [PATCH 294/368] ifdef for mk2 --- Firmware/ultralcd.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0a22a9373..47c42747a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6486,9 +6486,14 @@ static void lcd_main_menu() } else { - checkFanSpeed(); //Check manually to get most recent fan speed status - if(fan_check_error == EFCE_OK) - MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + #ifdef FANCHECK + checkFanSpeed(); //Check manually to get most recent fan speed status + if(fan_check_error == EFCE_OK) + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + #else + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + #endif + } MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } From 4058cd144b3ee112fc41dc5b39fe274fa23c2e28 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 25 Jun 2019 14:30:11 +0200 Subject: [PATCH 295/368] add delay_keep_alive without updating lcd --- Firmware/Marlin.h | 2 ++ Firmware/Marlin_main.cpp | 18 ++++++++++++++++++ Firmware/sound.cpp | 30 +++++++++++++++--------------- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 509880922..3d4fc2238 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -407,6 +407,8 @@ extern void calculate_extruder_multipliers(); // Similar to the default Arduino delay function, // but it keeps the background tasks running. extern void delay_keep_alive(unsigned int ms); +// same but this need to be used when calling delay from lcd_update() else stack owerflow can occur +extern void delay_keep_alive_no_lcd_update(unsigned int ms); extern void check_babystep(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 88fc1b459..ec59c3460 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8078,6 +8078,24 @@ void delay_keep_alive(unsigned int ms) } } +void delay_keep_alive_no_lcd_update(unsigned int ms) +{ + for (;;) { + manage_heater(); + // Manage inactivity, but don't disable steppers on timeout. + manage_inactivity(true); + if (ms == 0) + break; + else if (ms >= 50) { + _delay(50); + ms -= 50; + } else { + _delay(ms); + ms = 0; + } + } +} + static void wait_for_heater(long codenum, uint8_t extruder) { #ifdef TEMP_RESIDENCY_TIME diff --git a/Firmware/sound.cpp b/Firmware/sound.cpp index b84c6e60b..6545caaef 100644 --- a/Firmware/sound.cpp +++ b/Firmware/sound.cpp @@ -66,12 +66,12 @@ void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ if (eSoundMode != e_SOUND_MODE_SILENT){ if(!tone_){ WRITE(BEEPER, HIGH); - delayMicroseconds(ms); + delay_keep_alive_no_lcd_update(ms); WRITE(BEEPER, LOW); } else{ _tone(BEEPER, tone_); - delay_keep_alive(ms); + delay_keep_alive_no_lcd_update(ms); _noTone(BEEPER); } } @@ -79,13 +79,13 @@ void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ else{ if(!tone_){ WRITE(BEEPER, HIGH); - delayMicroseconds(ms); + delay_keep_alive_no_lcd_update(ms); WRITE(BEEPER, LOW); - delayMicroseconds(100); + delay_keep_alive_no_lcd_update(100); } else{ _tone(BEEPER, tone_); - delay_keep_alive(ms); + delay_keep_alive_no_lcd_update(ms); _noTone(BEEPER); } } @@ -97,7 +97,7 @@ switch(eSoundMode) { case e_SOUND_MODE_LOUD: if(eSoundType==e_SOUND_TYPE_ButtonEcho) - Sound_DoSound_Echo(); + delay_keep_alive_no_lcd_update(); if(eSoundType==e_SOUND_TYPE_StandardPrompt) Sound_DoSound_Prompt(); if(eSoundType==e_SOUND_TYPE_StandardAlert) @@ -135,9 +135,9 @@ switch(eSoundMode) static void Sound_DoSound_Blind_Alert(void) { _tone(BEEPER,100); - delay_keep_alive(50); + delay_keep_alive_no_lcd_update(50); _noTone(BEEPER); - delay_keep_alive(200); + delay_keep_alive_no_lcd_update(200); } static void Sound_DoSound_Encoder_Move(void) @@ -147,9 +147,9 @@ uint8_t nI; for(nI=0;nI<5;nI++) { WRITE(BEEPER,HIGH); - delayMicroseconds(75); + delay_keep_alive_no_lcd_update(75); WRITE(BEEPER,LOW); - delayMicroseconds(75); + delay_keep_alive_no_lcd_update(75); } } @@ -160,16 +160,16 @@ uint8_t nI; for(nI=0;nI<10;nI++) { WRITE(BEEPER,HIGH); - delayMicroseconds(100); + delay_keep_alive_no_lcd_update(100); WRITE(BEEPER,LOW); - delayMicroseconds(100); + delay_keep_alive_no_lcd_update(100); } } static void Sound_DoSound_Prompt(void) { WRITE(BEEPER,HIGH); -delay_keep_alive(500); +delay_keep_alive_no_lcd_update(500); WRITE(BEEPER,LOW); } @@ -181,8 +181,8 @@ nMax=bOnce?1:3; for(nI=0;nI Date: Tue, 25 Jun 2019 18:55:25 +0200 Subject: [PATCH 296/368] Add menu to show sheet live adjust Z value. --- Firmware/messages.c | 2 +- Firmware/ultralcd.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 804b0f50f..5f30a54ac 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -10,7 +10,7 @@ //internationalized messages const char MSG_AUTO_HOME[] PROGMEM_I1 = ISTR("Auto home"); //// const char MSG_AUTO_MODE_ON[] PROGMEM_I1 = ISTR("Mode [auto power]"); //// -const char MSG_BABYSTEP_Z[] PROGMEM_I1 = ISTR("Live adjust Z"); //// +const char MSG_BABYSTEP_Z[] PROGMEM_I1 = ISTR("Live adjust Z"); //// c=18 const char MSG_BABYSTEP_Z_NOT_SET[] PROGMEM_I1 = ISTR("Distance between tip of the nozzle and the bed surface has not been set yet. Please follow the manual, chapter First steps, section First layer calibration."); ////c=20 r=12 const char MSG_BED[] PROGMEM_I1 = ISTR("Bed"); //// const char MSG_BED_DONE[] PROGMEM_I1 = ISTR("Bed done"); //// diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index db1f043b0..367a8cdff 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6376,6 +6376,7 @@ static void lcd_sheet_menu() MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18 MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 + MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z); //TODO show value associated with sheet, not global legacy value MENU_END(); } From 20dd1110f6db3c4a0969158567a609d68f66ae06 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 25 Jun 2019 19:43:10 +0200 Subject: [PATCH 297/368] Remove unused parameters of function _lcd_babystep(int axis, chonst char *msg). Saves 24B of flash memory. --- Firmware/ultralcd.cpp | 59 +++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 367a8cdff..b734187d0 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3068,13 +3068,13 @@ static void lcd_move_z() { * other value leads to storing Z_AXIS * @param msg text to be displayed */ -static void _lcd_babystep(int axis, const char *msg) +static void lcd_babystep_z() { typedef struct - { // 19bytes total - int8_t status; // 1byte - int babystepMem[3]; // 6bytes - float babystepMemMM[3]; // 12bytes + { + int8_t status; + int babystepMemZ; + float babystepMemMMZ; } _menu_data_t; static_assert(sizeof(menu_data)>= sizeof(_menu_data_t),"_menu_data_t doesn't fit into menu_data"); _menu_data_t* _md = (_menu_data_t*)&(menu_data[0]); @@ -3085,17 +3085,13 @@ static void _lcd_babystep(int axis, const char *msg) _md->status = 1; check_babystep(); - EEPROM_read_B(EEPROM_BABYSTEP_X, &_md->babystepMem[0]); - EEPROM_read_B(EEPROM_BABYSTEP_Y, &_md->babystepMem[1]); - EEPROM_read_B(EEPROM_BABYSTEP_Z, &_md->babystepMem[2]); + EEPROM_read_B(EEPROM_BABYSTEP_Z, &_md->babystepMemZ); // same logic as in babystep_load if (calibration_status() >= CALIBRATION_STATUS_LIVE_ADJUST) - _md->babystepMem[2] = 0; + _md->babystepMemZ = 0; - _md->babystepMemMM[0] = _md->babystepMem[0]/cs.axis_steps_per_unit[X_AXIS]; - _md->babystepMemMM[1] = _md->babystepMem[1]/cs.axis_steps_per_unit[Y_AXIS]; - _md->babystepMemMM[2] = _md->babystepMem[2]/cs.axis_steps_per_unit[Z_AXIS]; + _md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_unit[Z_AXIS]; lcd_draw_update = 1; //SERIAL_ECHO("Z baby step: "); //SERIAL_ECHO(_md->babystepMem[2]); @@ -3106,19 +3102,18 @@ static void _lcd_babystep(int axis, const char *msg) if (lcd_encoder != 0) { if (homing_flag) lcd_encoder = 0; - _md->babystepMem[axis] += (int)lcd_encoder; - if (axis == 2) - { - if (_md->babystepMem[axis] < Z_BABYSTEP_MIN) _md->babystepMem[axis] = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm - else if (_md->babystepMem[axis] > Z_BABYSTEP_MAX) _md->babystepMem[axis] = Z_BABYSTEP_MAX; //0 - else - { - CRITICAL_SECTION_START - babystepsTodo[axis] += (int)lcd_encoder; - CRITICAL_SECTION_END - } - } - _md->babystepMemMM[axis] = _md->babystepMem[axis]/cs.axis_steps_per_unit[axis]; + _md->babystepMemZ += (int)lcd_encoder; + + if (_md->babystepMemZ < Z_BABYSTEP_MIN) _md->babystepMemZ = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm + else if (_md->babystepMemZ > Z_BABYSTEP_MAX) _md->babystepMemZ = Z_BABYSTEP_MAX; //0 + else + { + CRITICAL_SECTION_START + babystepsTodo[Z_AXIS] += (int)lcd_encoder; + CRITICAL_SECTION_END + } + + _md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_unit[Z_AXIS]; _delay(50); lcd_encoder = 0; lcd_draw_update = 1; @@ -3126,26 +3121,18 @@ static void _lcd_babystep(int axis, const char *msg) if (lcd_draw_update) { lcd_set_cursor(0, 1); - menu_draw_float13(msg, _md->babystepMemMM[axis]); + menu_draw_float13(_i("Adjusting Z:"), _md->babystepMemMMZ); ////MSG_BABYSTEPPING_Z c=15 Beware: must include the ':' as its last character } if (LCD_CLICKED || menu_leaving) { // Only update the EEPROM when leaving the menu. - EEPROM_save_B( - (axis == X_AXIS) ? EEPROM_BABYSTEP_X : ((axis == Y_AXIS) ? EEPROM_BABYSTEP_Y : EEPROM_BABYSTEP_Z), - &_md->babystepMem[axis]); - if(Z_AXIS == axis) calibration_status_store(CALIBRATION_STATUS_CALIBRATED); + EEPROM_save_B(EEPROM_BABYSTEP_Z, &_md->babystepMemZ); + calibration_status_store(CALIBRATION_STATUS_CALIBRATED); } if (LCD_CLICKED) menu_back(); } -static void lcd_babystep_z() -{ - _lcd_babystep(Z_AXIS, (_i("Adjusting Z:")));////MSG_BABYSTEPPING_Z c=15 Beware: must include the ':' as its last character -} - - typedef struct { // 12bytes + 9bytes = 21bytes total menu_data_edit_t reserved; //12 bytes reserved for number editing functions From 4a16fe69023a7299e37eb2e6c8c4ab706973c9d7 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 26 Jun 2019 14:10:12 +0200 Subject: [PATCH 298/368] Save z_offset, bed_temp and pinda_temp with sheet calibration. --- Firmware/Marlin_main.cpp | 10 ++++++---- Firmware/eeprom.cpp | 3 ++- Firmware/eeprom.h | 7 +++++-- Firmware/mesh_bed_calibration.cpp | 5 +++-- Firmware/ultralcd.cpp | 15 ++++++++++++--- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index bbf5bae09..d9e210b62 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1492,7 +1492,6 @@ void setup() SilentModeMenu_MMU = 1; eeprom_write_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU); } - check_babystep(); //checking if Z babystep is in allowed range #if !defined(DEBUG_DISABLE_FANCHECK) && defined(FANCHECK) && defined(TACH_1) && TACH_1 >-1 setup_fan_interrupt(); @@ -8146,12 +8145,15 @@ static void wait_for_heater(long codenum, uint8_t extruder) { void check_babystep() { - int babystep_z; - EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystep_z); + int babystep_z = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset))); + if ((babystep_z < Z_BABYSTEP_MIN) || (babystep_z > Z_BABYSTEP_MAX)) { babystep_z = 0; //if babystep value is out of min max range, set it to 0 SERIAL_ECHOLNPGM("Z live adjust out of range. Setting to 0"); - EEPROM_save_B(EEPROM_BABYSTEP_Z, &babystep_z); + eeprom_write_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)), + babystep_z); lcd_show_fullscreen_message_and_wait_P(PSTR("Z live adjust out of range. Setting to 0. Click to continue.")); lcd_update_enable(true); } diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 74c086fa8..a677241cb 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -3,6 +3,7 @@ //! @author Marek Běl #include "eeprom.h" +#include "Marlin.h" #include #include @@ -66,7 +67,7 @@ void eeprom_init() eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); } } - + check_babystep(); } diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 4b16c81b4..5e73c3537 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -173,7 +173,10 @@ void eeprom_init(); typedef struct { - char name[7]; + char name[7]; //!< Can be null terminated, doesn't need to be null terminated + int16_t z_offset; //!< Z_BABYSTEP_MIN .. Z_BABYSTEP_MAX = Z_BABYSTEP_MIN*2/1000 [mm] .. Z_BABYSTEP_MAX*2/1000 [mm] + uint8_t bed_temp; //!< 0 .. 254 [°C] + uint8_t pinda_temp; //!< 0 .. 254 [°C] } Sheet; typedef struct @@ -183,7 +186,7 @@ typedef struct } Sheets; // sizeof(Sheets). Do not change it unless EEPROM_Sheets_base is last item in EEPROM. // Otherwise it would move following items. -#define EEPROM_SHEETS_SIZEOF 22 +#define EEPROM_SHEETS_SIZEOF 34 static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER - EEPROM_SHEETS_SIZEOF); diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 91dadaefa..1edac56bf 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3031,7 +3031,8 @@ void babystep_load() check_babystep(); //checking if babystep is in allowed range, otherwise setting babystep to 0 // End of G80: Apply the baby stepping value. - EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystepLoadZ); + babystepLoadZ = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset))); #if 0 SERIAL_ECHO("Z baby step: "); @@ -3186,4 +3187,4 @@ void mbl_interpolation(uint8_t meas_points) { } } } -} \ No newline at end of file +} diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b734187d0..eef9465cc 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3073,7 +3073,7 @@ static void lcd_babystep_z() typedef struct { int8_t status; - int babystepMemZ; + int16_t babystepMemZ; float babystepMemMMZ; } _menu_data_t; static_assert(sizeof(menu_data)>= sizeof(_menu_data_t),"_menu_data_t doesn't fit into menu_data"); @@ -3085,7 +3085,8 @@ static void lcd_babystep_z() _md->status = 1; check_babystep(); - EEPROM_read_B(EEPROM_BABYSTEP_Z, &_md->babystepMemZ); + _md->babystepMemZ = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset))); // same logic as in babystep_load if (calibration_status() >= CALIBRATION_STATUS_LIVE_ADJUST) @@ -3126,7 +3127,15 @@ static void lcd_babystep_z() if (LCD_CLICKED || menu_leaving) { // Only update the EEPROM when leaving the menu. - EEPROM_save_B(EEPROM_BABYSTEP_Z, &_md->babystepMemZ); + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)), + _md->babystepMemZ); + eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte( + &(EEPROM_Sheets_base->active_sheet)))].bed_temp), + target_temperature_bed); + eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte( + &(EEPROM_Sheets_base->active_sheet)))].pinda_temp), + current_temperature_pinda); calibration_status_store(CALIBRATION_STATUS_CALIBRATED); } if (LCD_CLICKED) menu_back(); From 53dbcdd85237f54df8615fa55668ff1e41797dd1 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 26 Jun 2019 15:23:55 +0200 Subject: [PATCH 299/368] Display sheet name when adjusting Z. Costs 130B of flash. --- Firmware/menu.cpp | 22 ++++++++++++++++------ Firmware/menu.h | 7 +++++++ Firmware/ultralcd.cpp | 6 +++++- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 71ddd1bad..2e8e3e8a2 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -174,15 +174,25 @@ static void menu_draw_item_puts_P(char type_char, const char* str) lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); } +//! @brief Format sheet name after PROGMEM text +//! +//! @param[in] str_P Pointer to string in PROGMEM +//! @param[in] sheet_E Sheet in EEPROM +//! @param[out] buffer for formatted output +void menu_format_sheet_P_E(const char *str_P, const Sheet &sheet_E, SheetFormatBuffer &buffer) +{ + uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S "), str_P); + eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); + index += 7; + buffer.c[index] = '\0'; +} + static void menu_draw_item_puts_P(char type_char, const char *str_P, const Sheet &sheet) { lcd_set_cursor(0, menu_row); - char buffer[19]; - uint_least8_t index = sprintf_P(buffer, PSTR("%.10S "), str_P); - eeprom_read_block(&(buffer[index]), sheet.name, 7); - index += 7; - buffer[index] = '\0'; - lcd_printf_P(PSTR("%c%-18.18s%c"), (lcd_encoder == menu_item)?'>':' ', buffer, type_char); + SheetFormatBuffer buffer; + menu_format_sheet_P_E(str_P, sheet, buffer); + lcd_printf_P(PSTR("%c%-18.18s%c"), (lcd_encoder == menu_item)?'>':' ', buffer.c, type_char); } static void menu_draw_item_puts_P(char type_char, const char* str, char num) diff --git a/Firmware/menu.h b/Firmware/menu.h index e7e42b68c..91a64ec4b 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -130,6 +130,13 @@ extern void menu_draw_float31(const char* str, float val); extern void menu_draw_float13(const char* str, float val); +struct SheetFormatBuffer +{ + char c[19]; +}; + +extern void menu_format_sheet_P_E(const char *str_P, const Sheet &sheet_E, SheetFormatBuffer &buffer); + #define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { if (menu_item_edit_P(str, pval, minval, maxval)) return; } while (0) //#define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) MENU_ITEM_EDIT(int3, str, pval, minval, maxval) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index eef9465cc..03c4a3cc8 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3121,6 +3121,10 @@ static void lcd_babystep_z() } if (lcd_draw_update) { + SheetFormatBuffer buffer; + menu_format_sheet_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer); + lcd_set_cursor(0, 0); + lcd_print(buffer.c); lcd_set_cursor(0, 1); menu_draw_float13(_i("Adjusting Z:"), _md->babystepMemMMZ); ////MSG_BABYSTEPPING_Z c=15 Beware: must include the ':' as its last character } @@ -6372,7 +6376,7 @@ static void lcd_sheet_menu() MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18 MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 - MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z); //TODO show value associated with sheet, not global legacy value + MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z); MENU_END(); } From d8797949220d51c9f531ee4dc13a86f7a68049df Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 26 Jun 2019 15:47:06 +0200 Subject: [PATCH 300/368] Remove first parameter of macro menu_format_sheet_P_E, of function menu_format_sheet_P_E and menu_item_submenu_P as it was always called with the same parameter. Saves 66B of FLASH. --- Firmware/menu.cpp | 15 +++++++-------- Firmware/menu.h | 6 +++--- Firmware/ultralcd.cpp | 10 +++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 2e8e3e8a2..30727a083 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -174,24 +174,23 @@ static void menu_draw_item_puts_P(char type_char, const char* str) lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); } -//! @brief Format sheet name after PROGMEM text +//! @brief Format sheet name //! -//! @param[in] str_P Pointer to string in PROGMEM //! @param[in] sheet_E Sheet in EEPROM //! @param[out] buffer for formatted output -void menu_format_sheet_P_E(const char *str_P, const Sheet &sheet_E, SheetFormatBuffer &buffer) +void menu_format_sheet_P_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) { - uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S "), str_P); + uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S "), _T(MSG_SHEET)); eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); index += 7; buffer.c[index] = '\0'; } -static void menu_draw_item_puts_P(char type_char, const char *str_P, const Sheet &sheet) +static void menu_draw_item_puts_P(char type_char, const Sheet &sheet) { lcd_set_cursor(0, menu_row); SheetFormatBuffer buffer; - menu_format_sheet_P_E(str_P, sheet, buffer); + menu_format_sheet_P_E(sheet, buffer); lcd_printf_P(PSTR("%c%-18.18s%c"), (lcd_encoder == menu_item)?'>':' ', buffer.c, type_char); } @@ -245,11 +244,11 @@ uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu) return 0; } -uint8_t menu_item_submenu_P(const char* str_P, const Sheet &sheet, menu_func_t submenu) +uint8_t menu_item_submenu_P(const Sheet &sheet, menu_func_t submenu) { if (menu_item == menu_line) { - if (lcd_draw_update) menu_draw_item_puts_P(LCD_STR_ARROW_RIGHT[0], str_P, sheet); + if (lcd_draw_update) menu_draw_item_puts_P(LCD_STR_ARROW_RIGHT[0], sheet); if (menu_clicked && (lcd_encoder == menu_item)) { menu_submenu(submenu); diff --git a/Firmware/menu.h b/Firmware/menu.h index 91a64ec4b..7b8c519b9 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -100,8 +100,8 @@ extern uint8_t menu_item_text_P(const char* str); #define MENU_ITEM_SUBMENU_P(str, submenu) do { if (menu_item_submenu_P(str, submenu)) return; } while (0) extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu); -#define MENU_ITEM_SUBMENU_P_E(str_P, sheet, submenu) do { if (menu_item_submenu_P(str_P, sheet, submenu)) return; } while (0) -extern uint8_t menu_item_submenu_P(const char *str_P, const Sheet &sheet, menu_func_t submenu); +#define MENU_ITEM_SUBMENU_P_E(sheet, submenu) do { if (menu_item_submenu_P(sheet, submenu)) return; } while (0) +extern uint8_t menu_item_submenu_P(const Sheet &sheet, menu_func_t submenu); #define MENU_ITEM_BACK_P(str) do { if (menu_item_back_P(str)) return; } while (0) @@ -135,7 +135,7 @@ struct SheetFormatBuffer char c[19]; }; -extern void menu_format_sheet_P_E(const char *str_P, const Sheet &sheet_E, SheetFormatBuffer &buffer); +extern void menu_format_sheet_P_E(const Sheet &sheet_E, SheetFormatBuffer &buffer); #define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { if (menu_item_edit_P(str, pval, minval, maxval)) return; } while (0) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 03c4a3cc8..f21e6e190 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3122,7 +3122,7 @@ static void lcd_babystep_z() if (lcd_draw_update) { SheetFormatBuffer buffer; - menu_format_sheet_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer); + menu_format_sheet_P_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer); lcd_set_cursor(0, 0); lcd_print(buffer.c); lcd_set_cursor(0, 1); @@ -6320,9 +6320,9 @@ static void lcd_select_sheet_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_SHEET)); - MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); - MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); - MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); + MENU_ITEM_SUBMENU_P_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); + MENU_ITEM_SUBMENU_P_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); + MENU_ITEM_SUBMENU_P_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); MENU_END(); } @@ -6415,7 +6415,7 @@ static void lcd_main_menu() } else { MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT - MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); + MENU_ITEM_SUBMENU_P_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); } From d344e514c40bc0a8555879b08091e03a64ec7ff6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 26 Jun 2019 15:51:58 +0200 Subject: [PATCH 301/368] Rename functions and macro to match with naming convention - remove 'P' where there is no pointer to progmem. --- Firmware/menu.cpp | 10 +++++----- Firmware/menu.h | 6 +++--- Firmware/ultralcd.cpp | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 30727a083..00c64e8b7 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -178,7 +178,7 @@ static void menu_draw_item_puts_P(char type_char, const char* str) //! //! @param[in] sheet_E Sheet in EEPROM //! @param[out] buffer for formatted output -void menu_format_sheet_P_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) +void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) { uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S "), _T(MSG_SHEET)); eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); @@ -186,11 +186,11 @@ void menu_format_sheet_P_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) buffer.c[index] = '\0'; } -static void menu_draw_item_puts_P(char type_char, const Sheet &sheet) +static void menu_draw_item_puts_E(char type_char, const Sheet &sheet) { lcd_set_cursor(0, menu_row); SheetFormatBuffer buffer; - menu_format_sheet_P_E(sheet, buffer); + menu_format_sheet_E(sheet, buffer); lcd_printf_P(PSTR("%c%-18.18s%c"), (lcd_encoder == menu_item)?'>':' ', buffer.c, type_char); } @@ -244,11 +244,11 @@ uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu) return 0; } -uint8_t menu_item_submenu_P(const Sheet &sheet, menu_func_t submenu) +uint8_t menu_item_submenu_E(const Sheet &sheet, menu_func_t submenu) { if (menu_item == menu_line) { - if (lcd_draw_update) menu_draw_item_puts_P(LCD_STR_ARROW_RIGHT[0], sheet); + if (lcd_draw_update) menu_draw_item_puts_E(LCD_STR_ARROW_RIGHT[0], sheet); if (menu_clicked && (lcd_encoder == menu_item)) { menu_submenu(submenu); diff --git a/Firmware/menu.h b/Firmware/menu.h index 7b8c519b9..a4cb30104 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -100,8 +100,8 @@ extern uint8_t menu_item_text_P(const char* str); #define MENU_ITEM_SUBMENU_P(str, submenu) do { if (menu_item_submenu_P(str, submenu)) return; } while (0) extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu); -#define MENU_ITEM_SUBMENU_P_E(sheet, submenu) do { if (menu_item_submenu_P(sheet, submenu)) return; } while (0) -extern uint8_t menu_item_submenu_P(const Sheet &sheet, menu_func_t submenu); +#define MENU_ITEM_SUBMENU_E(sheet, submenu) do { if (menu_item_submenu_E(sheet, submenu)) return; } while (0) +extern uint8_t menu_item_submenu_E(const Sheet &sheet, menu_func_t submenu); #define MENU_ITEM_BACK_P(str) do { if (menu_item_back_P(str)) return; } while (0) @@ -135,7 +135,7 @@ struct SheetFormatBuffer char c[19]; }; -extern void menu_format_sheet_P_E(const Sheet &sheet_E, SheetFormatBuffer &buffer); +extern void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer); #define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { if (menu_item_edit_P(str, pval, minval, maxval)) return; } while (0) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f21e6e190..5f7328bee 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3122,7 +3122,7 @@ static void lcd_babystep_z() if (lcd_draw_update) { SheetFormatBuffer buffer; - menu_format_sheet_P_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer); + menu_format_sheet_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer); lcd_set_cursor(0, 0); lcd_print(buffer.c); lcd_set_cursor(0, 1); @@ -6320,9 +6320,9 @@ static void lcd_select_sheet_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_SHEET)); - MENU_ITEM_SUBMENU_P_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); - MENU_ITEM_SUBMENU_P_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); - MENU_ITEM_SUBMENU_P_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); + MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); + MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); + MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); MENU_END(); } @@ -6415,7 +6415,7 @@ static void lcd_main_menu() } else { MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT - MENU_ITEM_SUBMENU_P_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); + MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); } From a59e7090ead7bafb46b4478211cf6283f86ff368 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 27 Jun 2019 17:32:40 +0200 Subject: [PATCH 302/368] Increase version. --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index eee1b1672..acdadfe7f 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.7.2-RC1" -#define FW_COMMIT_NR 2359 +#define FW_VERSION "3.7.2" +#define FW_COMMIT_NR 2363 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From ff3c9d1a7cf648994648aa3843fbb12920755c18 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Fri, 28 Jun 2019 11:25:56 +0200 Subject: [PATCH 303/368] dont fire power panic at normal power off --- Firmware/Marlin_main.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c8f5feb63..5c134c1d0 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -354,7 +354,6 @@ unsigned long starttime=0; unsigned long stoptime=0; unsigned long _usb_timer = 0; - bool extruder_under_pressure = true; @@ -9009,8 +9008,7 @@ ISR(INT4_vect) { EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once SERIAL_ECHOLNPGM("INT4"); //fire normal uvlo only in case where EEPROM_UVLO is 0 or if IS_SD_PRINTING is 1. - //Don't change || to && because in some case the printer can be moving although IS_SD_PRINTING is zero - if((IS_SD_PRINTING ) || (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_(); + if(PRINTER_ACTIVE && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_(); if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny(); } From a3a7f3106e69533f492c91454eaef745866fda2e Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 3 Jul 2019 17:21:11 +0200 Subject: [PATCH 304/368] print parameters checking --- Firmware/Configuration.h | 3 + Firmware/Marlin_main.cpp | 97 +++++++- Firmware/eeprom.h | 4 + Firmware/printers.h | 27 +- Firmware/ultralcd.cpp | 232 ++++++++++++++---- Firmware/util.cpp | 229 +++++++++++++++-- Firmware/util.h | 69 ++++-- .../variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 2 + 8 files changed, 568 insertions(+), 95 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index bfa44a735..41358686a 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -15,6 +15,9 @@ #define FW_REPOSITORY "Unknown" #define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) +// G-code language level +#define GCODE_LEVEL 1 + // Debug version has debugging enabled (the symbol DEBUG_BUILD is set). // The debug build may be a bit slower than the non-debug build, therefore the debug build should // not be shipped to a customer. diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 230fda94e..3594419a5 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3654,7 +3654,7 @@ void process_commands() //-// /* - } else if(code_seen("qqq")) { + } else if(code_seen("rrr")) { MYSERIAL.println("=== checking ==="); MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODE),DEC); MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER),DEC); @@ -3676,13 +3676,47 @@ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF); } else if(code_seen("set") && farm_mode) { + strchr_pointer++; // skip 1st char (~ 's') strchr_pointer++; // skip 2nd char (~ 'e') - strchr_pointer++; // skip 3rd char (~ 't') nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um] - eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)e_NOZZLE_DIAMETER_NULL); // for correct synchronization after farm-mode exiting + eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)ClNozzleDiameter::_Diameter_Undef); // for correct synchronization after farm-mode exiting eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); } else SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0); + +//-// !!! SupportMenu +/* +// musi byt PRED "PRUSA model" + } else if (code_seen("smodel")) { //! PRUSA smodel + size_t nOffset; +// ! -> "l" + strchr_pointer+=5*sizeof(*strchr_pointer); // skip 1st - 5th char (~ 'smode') + nOffset=strspn(strchr_pointer+1," \t\n\r\v\f"); + if(*(strchr_pointer+1+nOffset)) + printer_smodel_check(strchr_pointer); + else SERIAL_PROTOCOLLN(PRINTER_NAME); + } else if (code_seen("model")) { //! PRUSA model + uint16_t nPrinterModel; + strchr_pointer+=4*sizeof(*strchr_pointer); // skip 1st - 4th char (~ 'mode') + nPrinterModel=(uint16_t)code_value_long(); + if(nPrinterModel!=0) + printer_model_check(nPrinterModel); + else SERIAL_PROTOCOLLN(PRINTER_TYPE); + } else if (code_seen("version")) { //! PRUSA version + strchr_pointer+=7*sizeof(*strchr_pointer); // skip 1st - 7th char (~ 'version') + while(*strchr_pointer==' ') // skip leading spaces + strchr_pointer++; + if(*strchr_pointer!=0) + fw_version_check(strchr_pointer); + else SERIAL_PROTOCOLLN(FW_VERSION); + } else if (code_seen("gcode")) { //! PRUSA gcode + uint16_t nGcodeLevel; + strchr_pointer+=4*sizeof(*strchr_pointer); // skip 1st - 4th char (~ 'gcod') + nGcodeLevel=(uint16_t)code_value_long(); + if(nGcodeLevel!=0) + gcode_level_check(nGcodeLevel); + else SERIAL_PROTOCOLLN(GCODE_LEVEL); +*/ } //else if (code_seen('Cal')) { // lcd_calibration(); @@ -6847,6 +6881,63 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) #endif //PINDA_THERMISTOR + case 862: // M862: print checking + float nDummy; + uint8_t nCommand; + nCommand=(uint8_t)(modff(code_value_float(),&nDummy)*10.0+0.5); + switch((ClPrintChecking)nCommand) + { + case ClPrintChecking::_Nozzle: // ~ .1 + uint16_t nDiameter; + if(code_seen('P')) + { + nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um] + nozzle_diameter_check(nDiameter); + } + else if(code_seen('S')&&farm_mode) + { + nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um] + eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)ClNozzleDiameter::_Diameter_Undef); // for correct synchronization after farm-mode exiting + eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); + } + else if(code_seen('Q')) + SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0); + break; + case ClPrintChecking::_Model: // ~ .2 + if(code_seen('P')) + { + uint16_t nPrinterModel; + nPrinterModel=(uint16_t)code_value_long(); + printer_model_check(nPrinterModel); + } + else if(code_seen('Q')) + SERIAL_PROTOCOLLN(PRINTER_TYPE); + break; + case ClPrintChecking::_Smodel: // ~ .3 + if(code_seen('P')) + printer_smodel_check(strchr_pointer); + else if(code_seen('Q')) + SERIAL_PROTOCOLLN(PRINTER_NAME); + break; + case ClPrintChecking::_Version: // ~ .4 + if(code_seen('P')) + fw_version_check(++strchr_pointer); + else if(code_seen('Q')) + SERIAL_PROTOCOLLN(FW_VERSION); + break; + case ClPrintChecking::_Gcode: // ~ .5 + if(code_seen('P')) + { + uint16_t nGcodeLevel; + nGcodeLevel=(uint16_t)code_value_long(); + gcode_level_check(nGcodeLevel); + } + else if(code_seen('Q')) + SERIAL_PROTOCOLLN(GCODE_LEVEL); + break; + } + break; + #ifdef LIN_ADVANCE case 900: // M900: Set LIN_ADVANCE options. gcode_M900(); diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 70f9f726b..464a1fb01 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -1,6 +1,7 @@ #ifndef EEPROM_H #define EEPROM_H +#define EEPROM_EMPTY_VALUE 0xFF // The total size of the EEPROM is // 4096 for the Atmega2560 #define EEPROM_TOP 4096 @@ -166,6 +167,9 @@ #define EEPROM_CHECK_MODE (EEPROM_MMU_STEALTH-1) // uint8 #define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 #define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 +#define EEPROM_CHECK_MODEL (EEPROM_NOZZLE_DIAMETER_uM-1) // uint8 +#define EEPROM_CHECK_VERSION (EEPROM_CHECK_MODEL-1) // uint8 +#define EEPROM_CHECK_GCODE (EEPROM_CHECK_VERSION-1) // uint8 // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! diff --git a/Firmware/printers.h b/Firmware/printers.h index 8111beb05..cdebbba5d 100644 --- a/Firmware/printers.h +++ b/Firmware/printers.h @@ -3,14 +3,23 @@ #define PRINTER_UNKNOWN 0 -#define PRINTER_MK1 100 -#define PRINTER_MK2 200 -#define PRINTER_MK2_SNMM 201 -#define PRINTER_MK25 250 -#define PRINTER_MK25_SNMM 251 -#define PRINTER_MK25S 252 -#define PRINTER_MK3 300 -#define PRINTER_MK3_SNMM 301 -#define PRINTER_MK3S 302 +#define PRINTER_MK1 100 +#define PRINTER_MK2 200 +#define PRINTER_MK2_SNMM 201 +#define PRINTER_MK25 250 +#define PRINTER_MK25_SNMM 251 +#define PRINTER_MK25S 252 + +#define PRINTER_MK3 300 +#define PRINTER_MK3_NAME "MK3" +#define PRINTER_MK3_SNMM 301 + +#define PRINTER_MK3_MMU2 20300 +#define PRINTER_MK3_MMU2_NAME "MK3MMU2" + +#define PRINTER_MK3S 302 +#define PRINTER_MK3S_NAME "MK3S" +#define PRINTER_MK3S_MMU2 20302 +#define PRINTER_MK3S_MMU2_NAME "MK3SMMU2S" #endif //PRINTERS_H diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 88d0b7d01..cdd6f9a6e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5288,95 +5288,218 @@ while (0) //-// static void lcd_check_mode_set(void) { -switch(eCheckMode) +switch(oCheckMode) { - case e_CHECK_MODE_none: - eCheckMode=e_CHECK_MODE_warn; + case ClCheckMode::_None: + oCheckMode=ClCheckMode::_Warn; break; - case e_CHECK_MODE_warn: - eCheckMode=e_CHECK_MODE_strict; + case ClCheckMode::_Warn: + oCheckMode=ClCheckMode::_Strict; break; - case e_CHECK_MODE_strict: - eCheckMode=e_CHECK_MODE_none; + case ClCheckMode::_Strict: + oCheckMode=ClCheckMode::_None; break; default: - eCheckMode=e_CHECK_MODE_none; + oCheckMode=ClCheckMode::_None; } -eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)eCheckMode); -} - -static void lcd_nozzle_diameter_set(void) -{ -uint16_t nDiameter; - -switch(eNozzleDiameter) - { - case e_NOZZLE_DIAMETER_250: - eNozzleDiameter=e_NOZZLE_DIAMETER_400; - nDiameter=400; - break; - case e_NOZZLE_DIAMETER_400: - eNozzleDiameter=e_NOZZLE_DIAMETER_600; - nDiameter=600; - break; - case e_NOZZLE_DIAMETER_600: - eNozzleDiameter=e_NOZZLE_DIAMETER_250; - nDiameter=250; - break; - default: - eNozzleDiameter=e_NOZZLE_DIAMETER_400; - nDiameter=400; - } -eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)eNozzleDiameter); -eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); +eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)oCheckMode); } #define SETTINGS_MODE \ do\ {\ - switch(eCheckMode)\ + switch(oCheckMode)\ {\ - case e_CHECK_MODE_none:\ - MENU_ITEM_FUNCTION_P(_i("Action [none]"),lcd_check_mode_set);\ + case ClCheckMode::_None:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle Ch. [none]"),lcd_check_mode_set);\ break;\ - case e_CHECK_MODE_warn:\ - MENU_ITEM_FUNCTION_P(_i("Action [warn]"),lcd_check_mode_set);\ + case ClCheckMode::_Warn:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle Ch. [warn]"),lcd_check_mode_set);\ break;\ - case e_CHECK_MODE_strict:\ - MENU_ITEM_FUNCTION_P(_i("Action [strict]"),lcd_check_mode_set);\ + case ClCheckMode::_Strict:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle Ch[strict]"),lcd_check_mode_set);\ break;\ default:\ - MENU_ITEM_FUNCTION_P(_i("Action [none]"),lcd_check_mode_set);\ + MENU_ITEM_FUNCTION_P(_i("Nozzle Ch. [none]"),lcd_check_mode_set);\ }\ }\ while (0) +static void lcd_nozzle_diameter_set(void) +{ +uint16_t nDiameter; + +switch(oNozzleDiameter) + { + case ClNozzleDiameter::_Diameter_250: + oNozzleDiameter=ClNozzleDiameter::_Diameter_400; + nDiameter=400; + break; + case ClNozzleDiameter::_Diameter_400: + oNozzleDiameter=ClNozzleDiameter::_Diameter_600; + nDiameter=600; + break; + case ClNozzleDiameter::_Diameter_600: + oNozzleDiameter=ClNozzleDiameter::_Diameter_250; + nDiameter=250; + break; + default: + oNozzleDiameter=ClNozzleDiameter::_Diameter_400; + nDiameter=400; + } +eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)oNozzleDiameter); +eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); +} + #define SETTINGS_NOZZLE \ do\ {\ - switch(eNozzleDiameter)\ + switch(oNozzleDiameter)\ {\ - case e_NOZZLE_DIAMETER_250:\ - MENU_ITEM_FUNCTION_P(_i("Nozzle [0.25]"),lcd_nozzle_diameter_set);\ + case ClNozzleDiameter::_Diameter_250:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle d. [0.25]"),lcd_nozzle_diameter_set);\ break;\ - case e_NOZZLE_DIAMETER_400:\ - MENU_ITEM_FUNCTION_P(_i("Nozzle [0.40]"),lcd_nozzle_diameter_set);\ + case ClNozzleDiameter::_Diameter_400:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle d. [0.40]"),lcd_nozzle_diameter_set);\ break;\ - case e_NOZZLE_DIAMETER_600:\ - MENU_ITEM_FUNCTION_P(_i("Nozzle [0.60]"),lcd_nozzle_diameter_set);\ + case ClNozzleDiameter::_Diameter_600:\ + MENU_ITEM_FUNCTION_P(_i("Nozzle d. [0.60]"),lcd_nozzle_diameter_set);\ break;\ default:\ - MENU_ITEM_FUNCTION_P(_i("Nozzle [0.40]"),lcd_nozzle_diameter_set);\ + MENU_ITEM_FUNCTION_P(_i("Nozzle d. [0.40]"),lcd_nozzle_diameter_set);\ }\ }\ while (0) -static void lcd_checking_menu() +static void lcd_check_model_set(void) +{ +switch(oCheckModel) + { + case ClCheckModel::_None: + oCheckModel=ClCheckModel::_Warn; + break; + case ClCheckModel::_Warn: + oCheckModel=ClCheckModel::_Strict; + break; + case ClCheckModel::_Strict: + oCheckModel=ClCheckModel::_None; + break; + default: + oCheckModel=ClCheckModel::_None; + } +eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODEL,(uint8_t)oCheckModel); +} + +#define SETTINGS_MODEL \ +do\ +{\ + switch(oCheckModel)\ + {\ + case ClCheckModel::_None:\ + MENU_ITEM_FUNCTION_P(_i("Model Ch. [none]"),lcd_check_model_set);\ + break;\ + case ClCheckModel::_Warn:\ + MENU_ITEM_FUNCTION_P(_i("Model Ch. [warn]"),lcd_check_model_set);\ + break;\ + case ClCheckModel::_Strict:\ + MENU_ITEM_FUNCTION_P(_i("Model Ch.[strict]"),lcd_check_model_set);\ + break;\ + default:\ + MENU_ITEM_FUNCTION_P(_i("Model Ch. [none]"),lcd_check_model_set);\ + }\ +}\ +while (0) + +static void lcd_check_version_set(void) +{ +switch(oCheckVersion) + { + case ClCheckVersion::_None: + oCheckVersion=ClCheckVersion::_Warn; + break; + case ClCheckVersion::_Warn: + oCheckVersion=ClCheckVersion::_Strict; + break; + case ClCheckVersion::_Strict: + oCheckVersion=ClCheckVersion::_None; + break; + default: + oCheckVersion=ClCheckVersion::_None; + } +eeprom_update_byte((uint8_t*)EEPROM_CHECK_VERSION,(uint8_t)oCheckVersion); +} + +#define SETTINGS_VERSION \ +do\ +{\ + switch(oCheckVersion)\ + {\ + case ClCheckVersion::_None:\ + MENU_ITEM_FUNCTION_P(_i("FW Ch. [none]"),lcd_check_version_set);\ + break;\ + case ClCheckVersion::_Warn:\ + MENU_ITEM_FUNCTION_P(_i("FW Ch. [warn]"),lcd_check_version_set);\ + break;\ + case ClCheckVersion::_Strict:\ + MENU_ITEM_FUNCTION_P(_i("FW Ch. [strict]"),lcd_check_version_set);\ + break;\ + default:\ + MENU_ITEM_FUNCTION_P(_i("FW Ch. [none]"),lcd_check_version_set);\ + }\ +}\ +while (0) + +static void lcd_check_gcode_set(void) +{ +switch(oCheckGcode) + { + case ClCheckGcode::_None: + oCheckGcode=ClCheckGcode::_Warn; + break; + case ClCheckGcode::_Warn: + oCheckGcode=ClCheckGcode::_Strict; + break; + case ClCheckGcode::_Strict: + oCheckGcode=ClCheckGcode::_None; + break; + default: + oCheckGcode=ClCheckGcode::_None; + } +eeprom_update_byte((uint8_t*)EEPROM_CHECK_GCODE,(uint8_t)oCheckGcode); +} + +#define SETTINGS_GCODE \ +do\ +{\ + switch(oCheckGcode)\ + {\ + case ClCheckGcode::_None:\ + MENU_ITEM_FUNCTION_P(_i("Gcode Ch. [none]"),lcd_check_gcode_set);\ + break;\ + case ClCheckGcode::_Warn:\ + MENU_ITEM_FUNCTION_P(_i("Gcode Ch. [warn]"),lcd_check_gcode_set);\ + break;\ + case ClCheckGcode::_Strict:\ + MENU_ITEM_FUNCTION_P(_i("Gcode Ch.[strict]"),lcd_check_gcode_set);\ + break;\ + default:\ + MENU_ITEM_FUNCTION_P(_i("Gcode Ch. [none]"),lcd_check_gcode_set);\ + }\ +}\ +while (0) + +//static void lcd_checking_menu() +void lcd_checking_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); -SETTINGS_MODE; SETTINGS_NOZZLE; +MENU_ITEM_TEXT_P(STR_SEPARATOR); +MENU_ITEM_TEXT_P(_i("Checks:")); +SETTINGS_MODE; +SETTINGS_MODEL; +SETTINGS_VERSION; +SETTINGS_GCODE; MENU_END(); } @@ -6489,7 +6612,8 @@ static void lcd_main_menu() if (mmu_enabled) { MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu); } - MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT +//-// +// MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT #ifdef LCD_TEST MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT #endif //LCD_TEST diff --git a/Firmware/util.cpp b/Firmware/util.cpp index da60cb701..02e054618 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -330,43 +330,244 @@ void update_current_firmware_version_to_eeprom() //-// -eNOZZLE_DIAMETER eNozzleDiameter=e_NOZZLE_DIAMETER_400; -eCHECK_MODE eCheckMode=e_CHECK_MODE_none; +void lcd_checking_menu(void); + +ClNozzleDiameter oNozzleDiameter=ClNozzleDiameter::_Diameter_400; +ClCheckMode oCheckMode=ClCheckMode::_None; +ClCheckModel oCheckModel=ClCheckModel::_None; +ClCheckVersion oCheckVersion=ClCheckVersion::_None; +ClCheckGcode oCheckGcode=ClCheckGcode::_None; void fCheckModeInit() { -eCheckMode=(eCHECK_MODE)eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODE); -if(eCheckMode==e_CHECK_MODE_NULL) +oCheckMode=(ClCheckMode)eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODE); +if(oCheckMode==ClCheckMode::_Undef) { - eCheckMode=e_CHECK_MODE_warn; - eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)eCheckMode); + oCheckMode=ClCheckMode::_Warn; + eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)oCheckMode); } if(farm_mode) - eCheckMode=e_CHECK_MODE_strict; -eNozzleDiameter=(eNOZZLE_DIAMETER)eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER); -if((eNozzleDiameter==e_NOZZLE_DIAMETER_NULL)&& !farm_mode) + oCheckMode=ClCheckMode::_Strict; +oNozzleDiameter=(ClNozzleDiameter)eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER); +if((oNozzleDiameter==ClNozzleDiameter::_Diameter_Undef)&& !farm_mode) { - eNozzleDiameter=e_NOZZLE_DIAMETER_400; - eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)eNozzleDiameter); + oNozzleDiameter=ClNozzleDiameter::_Diameter_400; + eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)oNozzleDiameter); eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,400); } +oCheckModel=(ClCheckModel)eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODEL); +if(oCheckModel==ClCheckModel::_Undef) + { + oCheckModel=ClCheckModel::_Warn; +// eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODEL,(uint8_t)oCheckModel); + } +oCheckVersion=(ClCheckVersion)eeprom_read_byte((uint8_t*)EEPROM_CHECK_VERSION); +if(oCheckVersion==ClCheckVersion::_Undef) + { + oCheckVersion=ClCheckVersion::_Warn; +// eeprom_update_byte((uint8_t*)EEPROM_CHECK_VERSION,(uint8_t)oCheckVersion); + } +oCheckGcode=(ClCheckGcode)eeprom_read_byte((uint8_t*)EEPROM_CHECK_GCODE); +if(oCheckGcode==ClCheckGcode::_Undef) + { + oCheckGcode=ClCheckGcode::_Warn; +// eeprom_update_byte((uint8_t*)EEPROM_CHECK_GCODE,(uint8_t)oCheckGcode); + } } void nozzle_diameter_check(uint16_t nDiameter) { uint16_t nDiameter_um; +if(oCheckMode==ClCheckMode::_None) + return; nDiameter_um=eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM); if(nDiameter==nDiameter_um) return; -switch(eCheckMode) +SERIAL_ECHO_START; +SERIAL_ECHOLNPGM("Nozzle diameter doesn't match ..."); +SERIAL_ECHOPGM("actual : "); +SERIAL_ECHOLN((float)(nDiameter_um/1000.0)); +SERIAL_ECHOPGM("expected: "); +SERIAL_ECHOLN((float)(nDiameter/1000.0)); +switch(oCheckMode) { - case e_CHECK_MODE_warn: + case ClCheckMode::_Warn: lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Press the knob to continue.")); break; - case e_CHECK_MODE_strict: + case ClCheckMode::_Strict: lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; } +menu_submenu(lcd_checking_menu); +} + +void printer_model_check(uint16_t nPrinterModel) +{ +if(oCheckModel==ClCheckModel::_None) + return; +if(nPrinterModel==(uint16_t)PRINTER_TYPE) + return; +SERIAL_ECHO_START; +SERIAL_ECHOLNPGM("Printer model doesn't match ..."); +SERIAL_ECHOPGM("actual : "); +SERIAL_ECHOLN(PRINTER_TYPE); +SERIAL_ECHOPGM("expected: "); +SERIAL_ECHOLN(nPrinterModel); +switch(oCheckModel) + { + case ClCheckModel::_Warn: + lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Press the knob to continue.")); + break; + case ClCheckModel::_Strict: + lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); + lcd_print_stop(); + break; + } +} + +int8_t mCmp(uint16_t nX,uint16_t nY) +{ +if(nX>nY) + return(1); +if(nXeeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR)); +bMatch=!bMatch||(aVersion[1]>eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR)); +bMatch=!bMatch||(aVersion[2]>eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION)); +bMatch=!bMatch||(aVersion[3]>eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR)); +if(!bMatch&&oCheckVersion==ClCheckVersion::_Warn) + return; +/* +if((aVersion[0] cmdqueue ??? +#define PRINTER_NAME_LENGTH (sizeof(PRINTER_NAME)-1) +#define GCODE_DELIMITER '"' +#define ELLIPSIS "..." + +char* code_string(char* pStr,size_t* nLength) +{ +char* pStrBegin; +char* pStrEnd; + +pStrBegin=strchr(pStr,GCODE_DELIMITER); +if(!pStrBegin) + return(NULL); +pStrBegin++; +pStrEnd=strchr(pStrBegin,GCODE_DELIMITER); +if(!pStrEnd) + return(NULL); +*nLength=pStrEnd-pStrBegin; +return(pStrBegin); +} + +void printer_smodel_check(char* pStrPos) +{ +char* pResult; +size_t nLength; +bool bCheckOK; +char sPrinterName[PRINTER_NAME_LENGTH+sizeof(ELLIPSIS)-1+1]=""; + +pResult=code_string(pStrPos,&nLength); +if(pResult!=NULL) + { + strlcpy(sPrinterName,pResult,min(PRINTER_NAME_LENGTH,nLength)+1); + if(nLength>PRINTER_NAME_LENGTH) + strcat(sPrinterName,ELLIPSIS); + bCheckOK=(nLength==PRINTER_NAME_LENGTH); + if(bCheckOK&&(!strncasecmp(pResult,PRINTER_NAME,nLength))) // i.e. string compare execute only if lengths are same + return; + } +SERIAL_ECHO_START; +SERIAL_ECHOLNPGM("Printer model doesn't match ..."); +SERIAL_ECHOPGM("actual : \""); +SERIAL_ECHO(PRINTER_NAME); +SERIAL_ECHOLNPGM("\""); +SERIAL_ECHOPGM("expected: \""); +SERIAL_ECHO(sPrinterName); +SERIAL_ECHOLNPGM("\""); +switch(oCheckModel) + { + case ClCheckModel::_Warn: + lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Press the knob to continue.")); + break; + case ClCheckModel::_Strict: + lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); + lcd_print_stop(); + break; + } } diff --git a/Firmware/util.h b/Firmware/util.h index d3b7e7d16..96358ef7c 100644 --- a/Firmware/util.h +++ b/Firmware/util.h @@ -35,27 +35,66 @@ inline void eeprom_update_int8(unsigned char* addr, int8_t v) { //-// -#define e_CHECK_MODE_NULL 0xFF -#define e_NOZZLE_DIAMETER_NULL 0xFF - -typedef enum +enum class ClPrintChecking:uint_least8_t { - e_NOZZLE_DIAMETER_250, - e_NOZZLE_DIAMETER_400, - e_NOZZLE_DIAMETER_600 -} eNOZZLE_DIAMETER; + _Nozzle=1, + _Model=2, + _Smodel=3, + _Version=4, + _Gcode=5 +}; -typedef enum +enum class ClNozzleDiameter:uint_least8_t { - e_CHECK_MODE_none, - e_CHECK_MODE_warn, - e_CHECK_MODE_strict -} eCHECK_MODE; + _Diameter_250=25, + _Diameter_400=40, + _Diameter_600=60, + _Diameter_Undef=EEPROM_EMPTY_VALUE +}; -extern eNOZZLE_DIAMETER eNozzleDiameter; -extern eCHECK_MODE eCheckMode; +enum class ClCheckMode:uint_least8_t +{ + _None, + _Warn, + _Strict, + _Undef=EEPROM_EMPTY_VALUE +}; + +enum class ClCheckModel:uint_least8_t +{ + _None, + _Warn, + _Strict, + _Undef=EEPROM_EMPTY_VALUE +}; + +enum class ClCheckVersion:uint_least8_t +{ + _None, + _Warn, + _Strict, + _Undef=EEPROM_EMPTY_VALUE +}; + +enum class ClCheckGcode:uint_least8_t +{ + _None, + _Warn, + _Strict, + _Undef=EEPROM_EMPTY_VALUE +}; + +extern ClNozzleDiameter oNozzleDiameter; +extern ClCheckMode oCheckMode; +extern ClCheckModel oCheckModel; +extern ClCheckVersion oCheckVersion; +extern ClCheckGcode oCheckGcode; void fCheckModeInit(); void nozzle_diameter_check(uint16_t nDiameter); +void printer_model_check(uint16_t nPrinterModel); +void printer_smodel_check(char* pStrPos); +void fw_version_check(const char *pVersion); +void gcode_level_check(uint16_t nGcodeLevel); #endif /* UTIL_H */ diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index 1e1fcfe13..39b0c9e8b 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -8,6 +8,8 @@ // Printer revision #define PRINTER_TYPE PRINTER_MK3 +#define PRINTER_NAME PRINTER_MK3_NAME +#define PRINTER_MMU_NAME PRINTER_MK3_MMU2_NAME #define FILAMENT_SIZE "1_75mm_MK3" #define NOZZLE_TYPE "E3Dv6full" From 7e3cb98a1f966143b5eebe0084fec4d3638ee5db Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 3 Jul 2019 17:50:41 +0200 Subject: [PATCH 305/368] & MK3S --- Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 9bb423675..9b03dbbdb 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -8,6 +8,8 @@ // Printer revision #define PRINTER_TYPE PRINTER_MK3S +#define PRINTER_NAME PRINTER_MK3S_NAME +#define PRINTER_MMU_NAME PRINTER_MK3S_MMU2_NAME #define FILAMENT_SIZE "1_75mm_MK3" #define NOZZLE_TYPE "E3Dv6full" From 4db4f19128225dac9c6d9612f4f1bde0753096fe Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 3 Jul 2019 18:14:48 +0200 Subject: [PATCH 306/368] 'variant files' update ;-((( --- Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 1 + Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 1 + 2 files changed, 2 insertions(+) diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index 39b0c9e8b..9a1938e0f 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -2,6 +2,7 @@ #define CONFIGURATION_PRUSA_H #include +#include "printers.h" /*------------------------------------ GENERAL SETTINGS *------------------------------------*/ diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 9b03dbbdb..6e3b5150d 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -2,6 +2,7 @@ #define CONFIGURATION_PRUSA_H #include +#include "printers.h" /*------------------------------------ GENERAL SETTINGS *------------------------------------*/ From 81b3b71cca40c2682c84bd6d5a47f723aeb0f801 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 3 Jul 2019 19:37:11 +0200 Subject: [PATCH 307/368] check eeprom inicialization --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 5 +++++ Firmware/eeprom.cpp | 4 ++++ Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/ultralcd.cpp | 38 ++++++++++++++++++++++++++------------ 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 509880922..90d838688 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -323,6 +323,7 @@ extern float retract_recover_length_swap; extern uint8_t host_keepalive_interval; +extern bool is_sheet_inicialized(); extern unsigned long starttime; extern unsigned long stoptime; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d9e210b62..9dcb4f47f 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8143,6 +8143,11 @@ static void wait_for_heater(long codenum, uint8_t extruder) { } } +bool is_sheet_inicialized(){ + return (0xffff != eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))].z_offset)))); +} + void check_babystep() { int babystep_z = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index a677241cb..03dee689c 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -8,6 +8,9 @@ #include #include + +#include "language.h" + #if 0 template static T eeprom_read(T *address); @@ -65,6 +68,7 @@ void eeprom_init() { eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast(i + '1')); eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); + //eeprom_write_word(reinterpret_cast(&(EEPROM_Sheets_base->s[i].z_offset)),0); //TODO: nedavat dalsi } } check_babystep(); diff --git a/Firmware/messages.c b/Firmware/messages.c index 5f30a54ac..57d2aba99 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -127,3 +127,4 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// +const char MSG_V2_CALIBRATION[] PROGMEM_N1 = "First layer cal."; ////c=17 r=1 diff --git a/Firmware/messages.h b/Firmware/messages.h index bbfc10658..e4c4187cd 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -128,6 +128,7 @@ extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; +extern const char MSG_V2_CALIBRATION[]; #if defined(__cplusplus) } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5f7328bee..40a49025e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3084,9 +3084,14 @@ static void lcd_babystep_z() // Initialize its status. _md->status = 1; check_babystep(); - - _md->babystepMemZ = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> - s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset))); + + if(!is_sheet_inicialized()){ + _md->babystepMemZ = 0; + } + else{ + _md->babystepMemZ = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset))); + } // same logic as in babystep_load if (calibration_status() >= CALIBRATION_STATUS_LIVE_ADJUST) @@ -6300,26 +6305,34 @@ void lcd_resume_print() isPrintPaused = false; } +static void sheet_check(uint8_t sheet_num) +{ + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_num); + if(is_sheet_inicialized()) + calibration_status_store(CALIBRATION_STATUS_CALIBRATED); + else + calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); + + menu_back(3); +} + static void lcd_select_sheet_0_menu() { - eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); - menu_back(3); + sheet_check(0); } static void lcd_select_sheet_1_menu() { - eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 1); - menu_back(3); + sheet_check(1); } static void lcd_select_sheet_2_menu() { - eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 2); - menu_back(3); + sheet_check(2); } static void lcd_select_sheet_menu() { MENU_BEGIN(); - MENU_ITEM_BACK_P(_T(MSG_SHEET)); + MENU_ITEM_BACK_P(_T(MSG_BACK)); MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); @@ -6376,7 +6389,7 @@ static void lcd_sheet_menu() MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18 MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 - MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z); + MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); ////MSG_V2_CALIBRATION c=17 r=1 MENU_END(); } @@ -6415,7 +6428,6 @@ static void lcd_main_menu() } else { MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT - MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); } @@ -6510,6 +6522,8 @@ static void lcd_main_menu() } + if(!isPrintPaused)MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS From e77898d5dc3a40fbbe64154741c6704621b1bce7 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Thu, 4 Jul 2019 13:21:27 +0200 Subject: [PATCH 308/368] code edit --- Firmware/Marlin.h | 2 -- Firmware/Marlin_main.cpp | 5 ----- Firmware/eeprom.cpp | 5 +++++ Firmware/eeprom.h | 1 + Firmware/ultralcd.cpp | 12 ++++++------ 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 90d838688..afc018596 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -323,8 +323,6 @@ extern float retract_recover_length_swap; extern uint8_t host_keepalive_interval; -extern bool is_sheet_inicialized(); - extern unsigned long starttime; extern unsigned long stoptime; extern int bowden_length[4]; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 9dcb4f47f..d9e210b62 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8143,11 +8143,6 @@ static void wait_for_heater(long codenum, uint8_t extruder) { } } -bool is_sheet_inicialized(){ - return (0xffff != eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> - s[eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))].z_offset)))); -} - void check_babystep() { int babystep_z = eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 03dee689c..499c197b1 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -41,6 +41,11 @@ bool eeprom_is_uninitialized(char *address) return (0xff == eeprom_read_byte(reinterpret_cast(address))); } +bool is_sheet_initialized(){ + return (0xffff != eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))].z_offset)))); +} + void eeprom_init() { if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0); diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 5e73c3537..f4e20e5d2 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -191,6 +191,7 @@ typedef struct static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER - EEPROM_SHEETS_SIZEOF); #ifdef __cplusplus +extern bool is_sheet_initialized(); static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF."); #endif diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 40a49025e..bb9bfa4da 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3085,7 +3085,7 @@ static void lcd_babystep_z() _md->status = 1; check_babystep(); - if(!is_sheet_inicialized()){ + if(!is_sheet_initialized()){ _md->babystepMemZ = 0; } else{ @@ -6305,10 +6305,10 @@ void lcd_resume_print() isPrintPaused = false; } -static void sheet_check(uint8_t sheet_num) +static void change_sheet(uint8_t sheet_num) { eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_num); - if(is_sheet_inicialized()) + if(is_sheet_initialized()) calibration_status_store(CALIBRATION_STATUS_CALIBRATED); else calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); @@ -6318,15 +6318,15 @@ static void sheet_check(uint8_t sheet_num) static void lcd_select_sheet_0_menu() { - sheet_check(0); + change_sheet(0); } static void lcd_select_sheet_1_menu() { - sheet_check(1); + change_sheet(1); } static void lcd_select_sheet_2_menu() { - sheet_check(2); + change_sheet(2); } static void lcd_select_sheet_menu() From 1f9dce9513711d85ea35f555036ecfbad392a3f4 Mon Sep 17 00:00:00 2001 From: DRracer Date: Thu, 4 Jul 2019 13:36:02 +0200 Subject: [PATCH 309/368] next almost 200B down --- Firmware/menu.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 00c64e8b7..7927b0ef4 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -168,10 +168,14 @@ int menu_draw_item_printf_P(char type_char, const char* format, ...) } */ +static char menu_selection_mark(){ + return (lcd_encoder == menu_item)?'>':' '; +} + static void menu_draw_item_puts_P(char type_char, const char* str) { lcd_set_cursor(0, menu_row); - lcd_printf_P(PSTR("%c%-18.18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char); + lcd_printf_P(PSTR("%c%-18.18S%c"), menu_selection_mark(), str, type_char); } //! @brief Format sheet name @@ -182,8 +186,9 @@ void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) { uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S "), _T(MSG_SHEET)); eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); - index += 7; - buffer.c[index] = '\0'; + //index += 7; + buffer.c[index + 7] = '\0'; // tohle vyjde vyrazne lepe, nez inkrementovat promennou index - o celych 12B kratsi + // compiler totiz pochopi, ze tu promennou nechci, cili si ji necha v registru } static void menu_draw_item_puts_E(char type_char, const Sheet &sheet) @@ -191,13 +196,13 @@ static void menu_draw_item_puts_E(char type_char, const Sheet &sheet) lcd_set_cursor(0, menu_row); SheetFormatBuffer buffer; menu_format_sheet_E(sheet, buffer); - lcd_printf_P(PSTR("%c%-18.18s%c"), (lcd_encoder == menu_item)?'>':' ', buffer.c, type_char); + lcd_printf_P(PSTR("%c%-18.18s%c"), menu_selection_mark(), buffer.c, type_char); } static void menu_draw_item_puts_P(char type_char, const char* str, char num) { lcd_set_cursor(0, menu_row); - lcd_printf_P(PSTR("%c%-.16S "), (lcd_encoder == menu_item)?'>':' ', str); + lcd_printf_P(PSTR("%c%-.16S "), menu_selection_mark(), str); lcd_putc(num); lcd_set_cursor(19, menu_row); lcd_putc(type_char); @@ -434,7 +439,7 @@ uint8_t menu_item_edit_P(const char* str, T pval, int16_t min_val, int16_t max_v if (lcd_draw_update) { lcd_set_cursor(0, menu_row); - menu_draw_P((lcd_encoder == menu_item)?'>':' ', str, *pval); + menu_draw_P(menu_selection_mark(), str, *pval); } if (menu_clicked && (lcd_encoder == menu_item)) { From a1a8945bee9d548befa78b0af767b04cbc04a311 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Thu, 4 Jul 2019 15:31:44 +0200 Subject: [PATCH 310/368] more code editing --- Firmware/eeprom.cpp | 1 - Firmware/menu.cpp | 3 +-- Firmware/messages.c | 2 ++ Firmware/messages.h | 2 ++ Firmware/ultralcd.cpp | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 499c197b1..1be708d00 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -73,7 +73,6 @@ void eeprom_init() { eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast(i + '1')); eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); - //eeprom_write_word(reinterpret_cast(&(EEPROM_Sheets_base->s[i].z_offset)),0); //TODO: nedavat dalsi } } check_babystep(); diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 7927b0ef4..2a8e32abb 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -187,8 +187,7 @@ void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S "), _T(MSG_SHEET)); eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); //index += 7; - buffer.c[index + 7] = '\0'; // tohle vyjde vyrazne lepe, nez inkrementovat promennou index - o celych 12B kratsi - // compiler totiz pochopi, ze tu promennou nechci, cili si ji necha v registru + buffer.c[index + 7] = '\0'; } static void menu_draw_item_puts_E(char type_char, const Sheet &sheet) diff --git a/Firmware/messages.c b/Firmware/messages.c index 57d2aba99..67f32bc3e 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -128,3 +128,5 @@ const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// const char MSG_V2_CALIBRATION[] PROGMEM_N1 = "First layer cal."; ////c=17 r=1 +const char MSG_SELECT[] PROGMEM_N1 = "Select"; //// +const char MSG_RENAME[] PROGMEM_N1 = "Rename"; //// diff --git a/Firmware/messages.h b/Firmware/messages.h index e4c4187cd..da72d073c 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -129,6 +129,8 @@ extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; extern const char MSG_V2_CALIBRATION[]; +extern const char MSG_SELECT[]; +extern const char MSG_RENAME[]; #if defined(__cplusplus) } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index bb9bfa4da..2d420c0c5 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6387,8 +6387,8 @@ static void lcd_sheet_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18 - MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 + MENU_ITEM_SUBMENU_P(_T(MSG_SELECT), lcd_select_sheet_menu); //// c=18 + MENU_ITEM_SUBMENU_P(_T(MSG_RENAME), lcd_rename_sheet_menu); //// c=18 MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); ////MSG_V2_CALIBRATION c=17 r=1 MENU_END(); From 9592460281045a508ff12fea011efd5ea54281c8 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Thu, 4 Jul 2019 18:43:59 +0200 Subject: [PATCH 311/368] add old delay --- Firmware/Marlin_main.cpp | 18 ------------------ Firmware/sound.cpp | 30 +++++++++++++++--------------- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index ec59c3460..88fc1b459 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8078,24 +8078,6 @@ void delay_keep_alive(unsigned int ms) } } -void delay_keep_alive_no_lcd_update(unsigned int ms) -{ - for (;;) { - manage_heater(); - // Manage inactivity, but don't disable steppers on timeout. - manage_inactivity(true); - if (ms == 0) - break; - else if (ms >= 50) { - _delay(50); - ms -= 50; - } else { - _delay(ms); - ms = 0; - } - } -} - static void wait_for_heater(long codenum, uint8_t extruder) { #ifdef TEMP_RESIDENCY_TIME diff --git a/Firmware/sound.cpp b/Firmware/sound.cpp index 6545caaef..7b965a2d2 100644 --- a/Firmware/sound.cpp +++ b/Firmware/sound.cpp @@ -66,12 +66,12 @@ void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ if (eSoundMode != e_SOUND_MODE_SILENT){ if(!tone_){ WRITE(BEEPER, HIGH); - delay_keep_alive_no_lcd_update(ms); + delayMicroseconds(ms); WRITE(BEEPER, LOW); } else{ _tone(BEEPER, tone_); - delay_keep_alive_no_lcd_update(ms); + delayMicroseconds(ms); _noTone(BEEPER); } } @@ -79,13 +79,13 @@ void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ else{ if(!tone_){ WRITE(BEEPER, HIGH); - delay_keep_alive_no_lcd_update(ms); + delayMicroseconds(ms); WRITE(BEEPER, LOW); - delay_keep_alive_no_lcd_update(100); + delayMicroseconds(100); } else{ _tone(BEEPER, tone_); - delay_keep_alive_no_lcd_update(ms); + delayMicroseconds(ms); _noTone(BEEPER); } } @@ -97,7 +97,7 @@ switch(eSoundMode) { case e_SOUND_MODE_LOUD: if(eSoundType==e_SOUND_TYPE_ButtonEcho) - delay_keep_alive_no_lcd_update(); + Sound_DoSound_Echo(); if(eSoundType==e_SOUND_TYPE_StandardPrompt) Sound_DoSound_Prompt(); if(eSoundType==e_SOUND_TYPE_StandardAlert) @@ -135,9 +135,9 @@ switch(eSoundMode) static void Sound_DoSound_Blind_Alert(void) { _tone(BEEPER,100); - delay_keep_alive_no_lcd_update(50); + delayMicroseconds(50); _noTone(BEEPER); - delay_keep_alive_no_lcd_update(200); + delayMicroseconds(200); } static void Sound_DoSound_Encoder_Move(void) @@ -147,9 +147,9 @@ uint8_t nI; for(nI=0;nI<5;nI++) { WRITE(BEEPER,HIGH); - delay_keep_alive_no_lcd_update(75); + delayMicroseconds(75); WRITE(BEEPER,LOW); - delay_keep_alive_no_lcd_update(75); + delayMicroseconds(75); } } @@ -160,16 +160,16 @@ uint8_t nI; for(nI=0;nI<10;nI++) { WRITE(BEEPER,HIGH); - delay_keep_alive_no_lcd_update(100); + delayMicroseconds(100); WRITE(BEEPER,LOW); - delay_keep_alive_no_lcd_update(100); + delayMicroseconds(100); } } static void Sound_DoSound_Prompt(void) { WRITE(BEEPER,HIGH); -delay_keep_alive_no_lcd_update(500); +delayMicroseconds(500); WRITE(BEEPER,LOW); } @@ -181,8 +181,8 @@ nMax=bOnce?1:3; for(nI=0;nI Date: Mon, 8 Jul 2019 16:42:21 +0200 Subject: [PATCH 312/368] heatbed audible noise suppression using short fast PWM pulses with variable duty --- Firmware/heatbed_pwm.cpp | 109 +++++++++++++++++++++++++++++++++++++++ Firmware/system_timer.h | 9 ++-- Firmware/temperature.cpp | 53 ++++++++++--------- Firmware/timer02.c | 56 ++++++-------------- Firmware/timer02.h | 15 +++--- 5 files changed, 167 insertions(+), 75 deletions(-) create mode 100755 Firmware/heatbed_pwm.cpp diff --git a/Firmware/heatbed_pwm.cpp b/Firmware/heatbed_pwm.cpp new file mode 100755 index 000000000..8a913b638 --- /dev/null +++ b/Firmware/heatbed_pwm.cpp @@ -0,0 +1,109 @@ +#include +#include +#include "io_atmega2560.h" + +// All this is about silencing the heat bed, as it behaves like a loudspeaker. +// Basically, we want the PWM heating switched at 30Hz (or so) which is a well ballanced +// frequency for both power supply units (i.e. both PSUs are reasonably silent). +// The only trouble is the rising or falling edge of bed heating - that creates an audible click. +// This audible click may be suppressed by making the rising or falling edge NOT sharp. +// Of course, making non-sharp edges in digital technology is not easy, but there is a solution. +// It is possible to do a fast PWM sequence with duty starting from 0 to 255. +// Doing this at higher frequency than the bed "loudspeaker" can handle makes the click barely audible. +// Technically: +// timer0 is set to fast PWM mode at 62.5kHz (timer0 is linked to the bed heating pin) (zero prescaler) +// To keep the bed switching at 30Hz - we don't want the PWM running at 62kHz all the time +// since it would burn the heatbed's MOSFET: +// 16MHz/256 levels of PWM duty gives us 62.5kHz +// 62.5kHz/256 gives ~244Hz, that is still too fast - 244/8 gives ~30Hz, that's what we need +// So the automaton runs atop of inner 8 (or 16) cycles. +// The finite automaton is running in the ISR(TIMER0_OVF_vect) + +///! Definition off finite automaton states +enum class States : uint8_t { + ZERO = 0, + RISE = 1, + ONE = 2, + FALL = 3 +}; + +///! State table for the inner part of the finite automaton +///! Basically it specifies what shall happen if the outer automaton is requesting setting the heat pin to 0 (OFF) or 1 (ON) +///! ZERO: steady 0 (OFF), no change for the whole period +///! RISE: 8 (16) fast PWM cycles with increasing duty up to steady ON +///! ONE: steady 1 (ON), no change for the whole period +///! FALL: 8 (16) fast PWM cycles with decreasing duty down to steady OFF +///! @@TODO move it into progmem +static States stateTable[4*2] = { +// off on +States::ZERO, States::RISE, // ZERO +States::FALL, States::ONE, // RISE +States::FALL, States::ONE, // ONE +States::ZERO, States::RISE // FALL +}; + +///! Inner states of the finite automaton +static States state = States::ZERO; + +///! Inner and outer PWM counters +static uint8_t outer = 0; +static uint8_t inner = 0; +static uint8_t pwm = 0; + +///! the slow PWM duty for the next 30Hz cycle +///! Set in the whole firmware at various places +extern unsigned char soft_pwm_bed; + +/// Fine tuning of automaton cycles +#if 1 +static const uint8_t innerMax = 16; +static const uint8_t innerShift = 4; +#else +static const uint8_t innerMax = 8; +static const uint8_t innerShift = 5; +#endif + +ISR(TIMER0_OVF_vect) // timer compare interrupt service routine +{ + if( inner ){ + switch(state){ + case States::ZERO: + OCR0B = 255; + // Commenting the following code saves 6B, but it is left here for reference + // It is not necessary to set it all over again, because we can only get into the ZERO state from the FALL state (which sets this register) +// TCCR0A |= (1 << COM0B1) | (1 << COM0B0); + break; + case States::RISE: + OCR0B = (innerMax - inner) << innerShift; +// TCCR0A |= (1 << COM0B1); // this bit is always 1 + TCCR0A &= ~(1 << COM0B0); + break; + case States::ONE: + OCR0B = 255; + // again - may be skipped, because we get into the ONE state only from RISE (which sets this register) +// TCCR0A |= (1 << COM0B1); + TCCR0A &= ~(1 << COM0B0); + break; + case States::FALL: + OCR0B = (innerMax - inner) << innerShift; // this is the same as in RISE, because now we are setting the zero part of duty due to inverting mode + // must switch to inverting mode already here, because it takes a whole PWM cycle and it would make a "1" at the end of this pwm cycle + TCCR0A |= /*(1 << COM0B1) |*/ (1 << COM0B0); + break; + } + --inner; + } else { + if( ! outer ){ // at the end of 30Hz PWM period + // synchro is not needed (almost), soft_pwm_bed is just 1 byte, 1-byte write instruction is atomic + pwm = soft_pwm_bed << 1; + } + if( pwm > outer || pwm >= 254 ){ + // soft_pwm_bed has a range of 0-127, that why a <<1 is done here. That also means that we may get only up to 254 which we want to be full-time 1 (ON) + state = stateTable[ uint8_t(state) * 2 + 1 ]; + } else { + // switch OFF + state = stateTable[ uint8_t(state) * 2 + 0 ]; + } + ++outer; + inner = innerMax; + } +} diff --git a/Firmware/system_timer.h b/Firmware/system_timer.h index d4fbfc39b..ca8f2f9ab 100644 --- a/Firmware/system_timer.h +++ b/Firmware/system_timer.h @@ -4,7 +4,7 @@ #define FIRMWARE_SYSTEM_TIMER_H_ #include "Arduino.h" -//#define SYSTEM_TIMER_2 +#define SYSTEM_TIMER_2 #ifdef SYSTEM_TIMER_2 #include "timer02.h" @@ -13,12 +13,15 @@ #define _delay delay2 #define _tone tone2 #define _noTone noTone2 + +#define timer02_set_pwm0(pwm0) + #else //SYSTEM_TIMER_2 #define _millis millis #define _micros micros #define _delay delay -#define _tone tone -#define _noTone noTone +#define _tone(x, y) /*tone*/ +#define _noTone(x) /*noTone*/ #define timer02_set_pwm0(pwm0) #endif //SYSTEM_TIMER_2 diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index db0b8628a..688761135 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -44,8 +44,6 @@ #include "Timer.h" #include "Configuration_prusa.h" - - //=========================================================================== //=============================public variables============================ //=========================================================================== @@ -1130,18 +1128,9 @@ void tp_init() adc_init(); -#ifdef SYSTEM_TIMER_2 - timer02_init(); + timer0_init(); OCR2B = 128; TIMSK2 |= (1< -1 - WRITE(HEATER_BED_PIN,LOW); + #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 + //WRITE(HEATER_BED_PIN,LOW); #endif #endif } @@ -1544,7 +1533,7 @@ void min_temp_error(uint8_t e) { void bed_max_temp_error(void) { #if HEATER_BED_PIN > -1 - WRITE(HEATER_BED_PIN, 0); + //WRITE(HEATER_BED_PIN, 0); #endif if(IsStopped() == false) { SERIAL_ERROR_START; @@ -1563,7 +1552,7 @@ void bed_min_temp_error(void) { #endif //if (current_temperature_ambient < MINTEMP_MINAMBIENT) return; #if HEATER_BED_PIN > -1 - WRITE(HEATER_BED_PIN, 0); + //WRITE(HEATER_BED_PIN, 0); #endif static const char err[] PROGMEM = "Err: MINTEMP BED"; if(IsStopped() == false) { @@ -1660,7 +1649,6 @@ void adc_ready(void) //callback from adc when sampling finished } // extern "C" - // Timer2 (originaly timer0) is shared with millies #ifdef SYSTEM_TIMER_2 ISR(TIMER2_COMPB_vect) @@ -1676,8 +1664,8 @@ ISR(TIMER0_COMPB_vect) if (!temp_meas_ready) adc_cycle(); lcd_buttons_update(); - static unsigned char pwm_count = (1 << SOFT_PWM_SCALE); - static unsigned char soft_pwm_0; + static uint8_t pwm_count = (1 << SOFT_PWM_SCALE); + static uint8_t soft_pwm_0; #ifdef SLOW_PWM_HEATERS static unsigned char slow_pwm_count = 0; static unsigned char state_heater_0 = 0; @@ -1698,7 +1686,7 @@ ISR(TIMER0_COMPB_vect) #endif #endif #if HEATER_BED_PIN > -1 - static unsigned char soft_pwm_b; + // @@DR static unsigned char soft_pwm_b; #ifdef SLOW_PWM_HEATERS static unsigned char state_heater_b = 0; static unsigned char state_timer_heater_b = 0; @@ -1733,14 +1721,25 @@ ISR(TIMER0_COMPB_vect) #endif } #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 + +#if 0 // @@DR vypnuto pro hw pwm bedu + // tuhle prasarnu bude potreba poustet ve stanovenych intervalech, jinak nemam moc sanci zareagovat + // teoreticky by se tato cast uz vubec nemusela poustet if ((pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1)) == 0) { soft_pwm_b = soft_pwm_bed >> (7 - HEATER_BED_SOFT_PWM_BITS); -#ifndef SYSTEM_TIMER_2 - if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); else WRITE(HEATER_BED_PIN,0); -#endif //SYSTEM_TIMER_2 +# ifndef SYSTEM_TIMER_2 + // tady budu krokovat pomalou frekvenci na automatu - tohle je rizeni spinani a rozepinani + // jako ridici frekvenci mam 2khz, jako vystupni frekvenci mam 30hz + // 2kHz jsou ovsem ve slysitelnem pasmu, mozna bude potreba jit s frekvenci nahoru (a tomu taky prizpusobit ostatni veci) + // Teoreticky bych mohl stahnout OCR0B citac na 6, cimz bych se dostal nekam ke 40khz a tady potom honit PWM rychleji nebo i pomaleji + // to nicemu nevadi. Soft PWM scale by se 20x zvetsilo (no dobre, 16x), cimz by se to posunulo k puvodnimu 30Hz PWM + //if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); else WRITE(HEATER_BED_PIN,0); +# endif //SYSTEM_TIMER_2 } #endif +#endif + #ifdef FAN_SOFT_PWM if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0) { @@ -1762,8 +1761,14 @@ ISR(TIMER0_COMPB_vect) #if EXTRUDERS > 2 if(soft_pwm_2 < pwm_count) WRITE(HEATER_2_PIN,0); #endif + +#if 0 // @@DR #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1 - if (soft_pwm_b < (pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1))) WRITE(HEATER_BED_PIN,0); + if (soft_pwm_b < (pwm_count & ((1 << HEATER_BED_SOFT_PWM_BITS) - 1))){ + //WRITE(HEATER_BED_PIN,0); + } + //WRITE(HEATER_BED_PIN, pwm_count & 1 ); +#endif #endif #ifdef FAN_SOFT_PWM if (soft_pwm_fan < (pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1))) WRITE(FAN_PIN,0); diff --git a/Firmware/timer02.c b/Firmware/timer02.c index e0a0a5a67..6b6cbe2cf 100644 --- a/Firmware/timer02.c +++ b/Firmware/timer02.c @@ -9,48 +9,27 @@ #include #include -#include "Arduino.h" #include "io_atmega2560.h" #define BEEPER 84 -uint8_t timer02_pwm0 = 0; - -void timer02_set_pwm0(uint8_t pwm0) -{ - if (timer02_pwm0 == pwm0) return; - if (pwm0) - { - TCCR0A |= (2 << COM0B0); - OCR0B = pwm0 - 1; - } - else - { - TCCR0A &= ~(2 << COM0B0); - OCR0B = 0; - } - timer02_pwm0 = pwm0; -} - -void timer02_init(void) +void timer0_init(void) { //save sreg uint8_t _sreg = SREG; //disable interrupts for sure cli(); - //mask timer0 interrupts - disable all - TIMSK0 &= ~(1<> 3) #define FRACT_MAX (1000 >> 3) -//extern volatile unsigned long timer0_overflow_count; -//extern volatile unsigned long timer0_millis; -//unsigned char timer0_fract = 0; volatile unsigned long timer2_overflow_count; volatile unsigned long timer2_millis; unsigned char timer2_fract = 0; diff --git a/Firmware/timer02.h b/Firmware/timer02.h index 103360b9c..48a4842fe 100644 --- a/Firmware/timer02.h +++ b/Firmware/timer02.h @@ -11,24 +11,25 @@ extern "C" { #endif //defined(__cplusplus) +///! Initializes TIMER0 for fast PWM mode-driven bed heating +extern void timer0_init(void); -extern uint8_t timer02_pwm0; - -extern void timer02_set_pwm0(uint8_t pwm0); - -extern void timer02_init(void); - +///! Reimplemented original millis() using timer2 extern unsigned long millis2(void); +///! Reimplemented original micros() using timer2 extern unsigned long micros2(void); +///! Reimplemented original delay() using timer2 extern void delay2(unsigned long ms); +///! Reimplemented original tone() using timer2 +///! Does not perform any PWM tone generation, it just sets the beeper pin to 1 extern void tone2(uint8_t _pin, unsigned int frequency/*, unsigned long duration*/); +///! Turn off beeping - set beeper pin to 0 extern void noTone2(uint8_t _pin); - #if defined(__cplusplus) } #endif //defined(__cplusplus) From 774f9b46adff3b627e3fa940027c510be8e8afab Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 8 Jul 2019 19:02:24 +0200 Subject: [PATCH 313/368] update build.sh for the new board definition --- build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 12005a247..bd32b02ee 100755 --- a/build.sh +++ b/build.sh @@ -31,7 +31,8 @@ if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then cp $SCRIPT_PATH/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 8 fi -$BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board rambo:avr:rambo --pref build.path=$BUILD_PATH --pref compiler.warning_level=all || exit 9 +$BUILD_ENV_PATH/arduino --pref boardsmanager.additional.urls=https://raw.githubusercontent.com/DRracer/Arduino_Boards/master/IDE_Board_Manager/package_prusa3d_index.json +$BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board PrusaResearchRambo:avr:rambo --pref build.path=$BUILD_PATH --pref compiler.warning_level=all || exit export ARDUINO=$BUILD_ENV_PATH From 61566f7fb1c248f9b669f176af0c82014d3a6778 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 8 Jul 2019 21:18:41 +0200 Subject: [PATCH 314/368] Move translated string MSG_V2_CALIBRATION from untranslated section to PROGMEM_I1, add missing ISTR macro. Revert _T(MSG_SELECT) and _T(MSG_RENAME) to _i("Select") and _i("Rename") as it is preferred macro for internationalized strings. Use MSG_V2_CALIBRATION in both occurrences. --- Firmware/messages.c | 4 +--- Firmware/messages.h | 4 +--- Firmware/ultralcd.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 67f32bc3e..0a7506121 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -101,6 +101,7 @@ const char MSG_WIZARD_DONE[] PROGMEM_I1 = ISTR("All is done. Happy printing!"); const char MSG_WIZARD_HEATING[] PROGMEM_I1 = ISTR("Preheating nozzle. Please wait."); ////c=20 r=3 const char MSG_WIZARD_QUIT[] PROGMEM_I1 = ISTR("You can always resume the Wizard from Calibration -> Wizard."); ////c=20 r=8 const char MSG_YES[] PROGMEM_I1 = ISTR("Yes"); //// +const char MSG_V2_CALIBRATION[] PROGMEM_I1 = ISTR("First layer cal."); ////c=17 r=1 const char WELCOME_MSG[] PROGMEM_I1 = ISTR(CUSTOM_MENDEL_NAME " OK."); ////c=20 //not internationalized messages const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; //// @@ -127,6 +128,3 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// -const char MSG_V2_CALIBRATION[] PROGMEM_N1 = "First layer cal."; ////c=17 r=1 -const char MSG_SELECT[] PROGMEM_N1 = "Select"; //// -const char MSG_RENAME[] PROGMEM_N1 = "Rename"; //// diff --git a/Firmware/messages.h b/Firmware/messages.h index da72d073c..6260e0d30 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -101,6 +101,7 @@ extern const char MSG_WIZARD_DONE[]; extern const char MSG_WIZARD_HEATING[]; extern const char MSG_WIZARD_QUIT[]; extern const char MSG_YES[]; +extern const char MSG_V2_CALIBRATION[]; extern const char WELCOME_MSG[]; //not internationalized messages extern const char MSG_BROWNOUT_RESET[]; @@ -128,9 +129,6 @@ extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; -extern const char MSG_V2_CALIBRATION[]; -extern const char MSG_SELECT[]; -extern const char MSG_RENAME[]; #if defined(__cplusplus) } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2d420c0c5..815731a1c 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5482,7 +5482,7 @@ static void lcd_calibration_menu() if (!isPrintPaused) { MENU_ITEM_FUNCTION_P(_i("Wizard"), lcd_wizard);////MSG_WIZARD c=17 r=1 - MENU_ITEM_SUBMENU_P(_i("First layer cal."), lcd_v2_calibration);////MSG_V2_CALIBRATION c=17 r=1 + MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); MENU_ITEM_GCODE_P(_T(MSG_AUTO_HOME), PSTR("G28 W")); MENU_ITEM_FUNCTION_P(_i("Selftest "), lcd_selftest_v);////MSG_SELFTEST #ifdef MK1BP @@ -6387,9 +6387,9 @@ static void lcd_sheet_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); - MENU_ITEM_SUBMENU_P(_T(MSG_SELECT), lcd_select_sheet_menu); //// c=18 - MENU_ITEM_SUBMENU_P(_T(MSG_RENAME), lcd_rename_sheet_menu); //// c=18 - MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); ////MSG_V2_CALIBRATION c=17 r=1 + MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18 + MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 + MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); MENU_END(); } From 8229a451872eb8b0414aeac59343c5c26ba3d291 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 9 Jul 2019 12:16:51 +0200 Subject: [PATCH 315/368] pre-production version ;-) --- Firmware/Configuration.c | 12 +++ Firmware/Configuration.h | 9 +++ Firmware/Marlin_main.cpp | 12 ++- Firmware/mmu.cpp | 5 ++ Firmware/printers.h | 54 +++++++++---- Firmware/ultralcd.cpp | 37 ++++----- Firmware/util.cpp | 80 +++++++++---------- Firmware/util.h | 10 +++ .../variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 4 + .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 4 + .../variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 4 + .../variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 4 + .../1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 4 + .../1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 4 + .../variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 2 + .../variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 1 + 16 files changed, 168 insertions(+), 78 deletions(-) create mode 100644 Firmware/Configuration.c diff --git a/Firmware/Configuration.c b/Firmware/Configuration.c new file mode 100644 index 000000000..1fd334541 --- /dev/null +++ b/Firmware/Configuration.c @@ -0,0 +1,12 @@ +#include +#include +//!?! #include "Configuration.h" +#include "Configuration_prusa.h" + +const uint16_t _nPrinterType PROGMEM=PRINTER_TYPE; +const char _sPrinterName[] PROGMEM=PRINTER_NAME; +const uint16_t _nPrinterMmuType PROGMEM=PRINTER_MMU_TYPE; +const char _sPrinterMmuName[] PROGMEM=PRINTER_MMU_NAME; + +uint16_t nPrinterType; +PGM_P sPrinterName; \ No newline at end of file diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 41358686a..010213eac 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -6,6 +6,15 @@ #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) +//-// +#include +extern const uint16_t _nPrinterType; +extern const char _sPrinterName[] PROGMEM; +extern const uint16_t _nPrinterMmuType; +extern const char _sPrinterMmuName[] PROGMEM; +extern uint16_t nPrinterType; +extern PGM_P sPrinterName; + // Firmware version #define FW_VERSION "3.7.1" #define FW_COMMIT_NR 2266 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3594419a5..1fdfd0b4b 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -43,8 +43,10 @@ * */ +//-// +#include "Configuration.h" #include "Marlin.h" - + #ifdef ENABLE_AUTO_BED_LEVELING #include "vector_3.h" #ifdef AUTO_BED_LEVELING_GRID @@ -1646,11 +1648,11 @@ void setup() } #endif //UVLO_SUPPORT fCheckModeInit(); + fSetMmuMode(mmu_enabled); KEEPALIVE_STATE(NOT_BUSY); #ifdef WATCHDOG wdt_enable(WDTO_4S); #endif //WATCHDOG - } @@ -6894,12 +6896,14 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um] nozzle_diameter_check(nDiameter); } +/* else if(code_seen('S')&&farm_mode) { nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um] eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)ClNozzleDiameter::_Diameter_Undef); // for correct synchronization after farm-mode exiting eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); } +*/ else if(code_seen('Q')) SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0); break; @@ -6911,13 +6915,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) printer_model_check(nPrinterModel); } else if(code_seen('Q')) - SERIAL_PROTOCOLLN(PRINTER_TYPE); + SERIAL_PROTOCOLLN(nPrinterType); break; case ClPrintChecking::_Smodel: // ~ .3 if(code_seen('P')) printer_smodel_check(strchr_pointer); else if(code_seen('Q')) - SERIAL_PROTOCOLLN(PRINTER_NAME); + SERIAL_PROTOCOLLNRPGM(sPrinterName); break; case ClPrintChecking::_Version: // ~ .4 if(code_seen('P')) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 916b3d0fd..d4b55b485 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -15,6 +15,8 @@ #include #include "io_atmega2560.h" #include "AutoDeplete.h" +//-// +#include "util.h" #ifdef TMC2130 #include "tmc2130.h" @@ -263,6 +265,9 @@ void mmu_loop(void) FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda); puts_P(PSTR("MMU - ENABLED")); mmu_enabled = true; +//-// +// ... PrinterType/Name +fSetMmuMode(true); mmu_state = S::Idle; } return; diff --git a/Firmware/printers.h b/Firmware/printers.h index cdebbba5d..ef8c6e80c 100644 --- a/Firmware/printers.h +++ b/Firmware/printers.h @@ -3,23 +3,49 @@ #define PRINTER_UNKNOWN 0 -#define PRINTER_MK1 100 -#define PRINTER_MK2 200 -#define PRINTER_MK2_SNMM 201 -#define PRINTER_MK25 250 -#define PRINTER_MK25_SNMM 251 +/* original definition(s) +#define PRINTER_MK1 100 +#define PRINTER_MK2 200 +#define PRINTER_MK2_SNMM 201 +#define PRINTER_MK25 250 +#define PRINTER_MK25_SNMM 251 +#define PRINTER_MK25S 252 +#define PRINTER_MK3 300 +#define PRINTER_MK3_SNMM 301 +#define PRINTER_MK3S 302 +*/ +// *** MK1 +#define PRINTER_MK1 100 +#define PRINTER_MK1_NAME "MK1" +// *** MK2 +#define PRINTER_MK2 200 +#define PRINTER_MK2_NAME "MK2" +#define PRINTER_MK2_SNMM 201 // better is "10200" +#define PRINTER_MK2_SNMM_NAME "MK2MM" // better is "MK2MMU1" +// *** MK2S ??? is same as "MK2" ??? +#define PRINTER_MK2S 202 +#define PRINTER_MK2S_NAME "MK2S" +#define PRINTER_MK2S_SNMM 203 // better is "10202" +#define PRINTER_MK2S_SNMM_NAME "MK2SMM" // better is "MK2SMMU1" +// *** MK2.5 +#define PRINTER_MK25 250 +#define PRINTER_MK25_NAME "MK2.5" +#define PRINTER_MK25_MMU2 20250 +#define PRINTER_MK25_MMU2_NAME "MK2.5MMU2" +// *** MK2.5S #define PRINTER_MK25S 252 - -#define PRINTER_MK3 300 +#define PRINTER_MK25S_NAME "MK2.5S" +#define PRINTER_MK25S_MMU2 20252 +#define PRINTER_MK25S_MMU2_NAME "MK2.5SMMU2S" +// *** MK3 +#define PRINTER_MK3 300 #define PRINTER_MK3_NAME "MK3" -#define PRINTER_MK3_SNMM 301 - -#define PRINTER_MK3_MMU2 20300 -#define PRINTER_MK3_MMU2_NAME "MK3MMU2" - +#define PRINTER_MK3_MMU2 20300 +#define PRINTER_MK3_MMU2_NAME "MK3MMU2" +// *** MK3S #define PRINTER_MK3S 302 -#define PRINTER_MK3S_NAME "MK3S" -#define PRINTER_MK3S_MMU2 20302 +#define PRINTER_MK3S_NAME "MK3S" +#define PRINTER_MK3S_MMU2 20302 #define PRINTER_MK3S_MMU2_NAME "MK3SMMU2S" #endif //PRINTERS_H diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index cdd6f9a6e..5983f657b 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5311,16 +5311,16 @@ do\ switch(oCheckMode)\ {\ case ClCheckMode::_None:\ - MENU_ITEM_FUNCTION_P(_i("Nozzle Ch. [none]"),lcd_check_mode_set);\ + MENU_ITEM_FUNCTION_P(_i("Nozzle [none]"),lcd_check_mode_set);\ break;\ case ClCheckMode::_Warn:\ - MENU_ITEM_FUNCTION_P(_i("Nozzle Ch. [warn]"),lcd_check_mode_set);\ + MENU_ITEM_FUNCTION_P(_i("Nozzle [warn]"),lcd_check_mode_set);\ break;\ case ClCheckMode::_Strict:\ - MENU_ITEM_FUNCTION_P(_i("Nozzle Ch[strict]"),lcd_check_mode_set);\ + MENU_ITEM_FUNCTION_P(_i("Nozzle [strict]"),lcd_check_mode_set);\ break;\ default:\ - MENU_ITEM_FUNCTION_P(_i("Nozzle Ch. [none]"),lcd_check_mode_set);\ + MENU_ITEM_FUNCTION_P(_i("Nozzle [none]"),lcd_check_mode_set);\ }\ }\ while (0) @@ -5396,16 +5396,16 @@ do\ switch(oCheckModel)\ {\ case ClCheckModel::_None:\ - MENU_ITEM_FUNCTION_P(_i("Model Ch. [none]"),lcd_check_model_set);\ + MENU_ITEM_FUNCTION_P(_i("Model [none]"),lcd_check_model_set);\ break;\ case ClCheckModel::_Warn:\ - MENU_ITEM_FUNCTION_P(_i("Model Ch. [warn]"),lcd_check_model_set);\ + MENU_ITEM_FUNCTION_P(_i("Model [warn]"),lcd_check_model_set);\ break;\ case ClCheckModel::_Strict:\ - MENU_ITEM_FUNCTION_P(_i("Model Ch.[strict]"),lcd_check_model_set);\ + MENU_ITEM_FUNCTION_P(_i("Model [strict]"),lcd_check_model_set);\ break;\ default:\ - MENU_ITEM_FUNCTION_P(_i("Model Ch. [none]"),lcd_check_model_set);\ + MENU_ITEM_FUNCTION_P(_i("Model [none]"),lcd_check_model_set);\ }\ }\ while (0) @@ -5435,16 +5435,16 @@ do\ switch(oCheckVersion)\ {\ case ClCheckVersion::_None:\ - MENU_ITEM_FUNCTION_P(_i("FW Ch. [none]"),lcd_check_version_set);\ + MENU_ITEM_FUNCTION_P(_i("Firmware [none]"),lcd_check_version_set);\ break;\ case ClCheckVersion::_Warn:\ - MENU_ITEM_FUNCTION_P(_i("FW Ch. [warn]"),lcd_check_version_set);\ + MENU_ITEM_FUNCTION_P(_i("Firmware [warn]"),lcd_check_version_set);\ break;\ case ClCheckVersion::_Strict:\ - MENU_ITEM_FUNCTION_P(_i("FW Ch. [strict]"),lcd_check_version_set);\ + MENU_ITEM_FUNCTION_P(_i("Firmware [strict]"),lcd_check_version_set);\ break;\ default:\ - MENU_ITEM_FUNCTION_P(_i("FW Ch. [none]"),lcd_check_version_set);\ + MENU_ITEM_FUNCTION_P(_i("Firmware [none]"),lcd_check_version_set);\ }\ }\ while (0) @@ -5474,25 +5474,26 @@ do\ switch(oCheckGcode)\ {\ case ClCheckGcode::_None:\ - MENU_ITEM_FUNCTION_P(_i("Gcode Ch. [none]"),lcd_check_gcode_set);\ + MENU_ITEM_FUNCTION_P(_i("Gcode [none]"),lcd_check_gcode_set);\ break;\ case ClCheckGcode::_Warn:\ - MENU_ITEM_FUNCTION_P(_i("Gcode Ch. [warn]"),lcd_check_gcode_set);\ + MENU_ITEM_FUNCTION_P(_i("Gcode [warn]"),lcd_check_gcode_set);\ break;\ case ClCheckGcode::_Strict:\ - MENU_ITEM_FUNCTION_P(_i("Gcode Ch.[strict]"),lcd_check_gcode_set);\ + MENU_ITEM_FUNCTION_P(_i("Gcode [strict]"),lcd_check_gcode_set);\ break;\ default:\ - MENU_ITEM_FUNCTION_P(_i("Gcode Ch. [none]"),lcd_check_gcode_set);\ + MENU_ITEM_FUNCTION_P(_i("Gcode [none]"),lcd_check_gcode_set);\ }\ }\ while (0) -//static void lcd_checking_menu() +//-//static void lcd_checking_menu() void lcd_checking_menu() { MENU_BEGIN(); -MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); +//-//MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); +MENU_ITEM_BACK_P(_T(MSG_BACK)); SETTINGS_NOZZLE; MENU_ITEM_TEXT_P(STR_SEPARATOR); MENU_ITEM_TEXT_P(_i("Checks:")); diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 02e054618..d2d8e6cc1 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -359,19 +359,19 @@ oCheckModel=(ClCheckModel)eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODEL); if(oCheckModel==ClCheckModel::_Undef) { oCheckModel=ClCheckModel::_Warn; -// eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODEL,(uint8_t)oCheckModel); + eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODEL,(uint8_t)oCheckModel); } oCheckVersion=(ClCheckVersion)eeprom_read_byte((uint8_t*)EEPROM_CHECK_VERSION); if(oCheckVersion==ClCheckVersion::_Undef) { oCheckVersion=ClCheckVersion::_Warn; -// eeprom_update_byte((uint8_t*)EEPROM_CHECK_VERSION,(uint8_t)oCheckVersion); + eeprom_update_byte((uint8_t*)EEPROM_CHECK_VERSION,(uint8_t)oCheckVersion); } oCheckGcode=(ClCheckGcode)eeprom_read_byte((uint8_t*)EEPROM_CHECK_GCODE); if(oCheckGcode==ClCheckGcode::_Undef) { oCheckGcode=ClCheckGcode::_Warn; -// eeprom_update_byte((uint8_t*)EEPROM_CHECK_GCODE,(uint8_t)oCheckGcode); + eeprom_update_byte((uint8_t*)EEPROM_CHECK_GCODE,(uint8_t)oCheckGcode); } } @@ -407,12 +407,12 @@ void printer_model_check(uint16_t nPrinterModel) { if(oCheckModel==ClCheckModel::_None) return; -if(nPrinterModel==(uint16_t)PRINTER_TYPE) +if(nPrinterModel==nPrinterType) return; SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Printer model doesn't match ..."); SERIAL_ECHOPGM("actual : "); -SERIAL_ECHOLN(PRINTER_TYPE); +SERIAL_ECHOLN(nPrinterType); SERIAL_ECHOPGM("expected: "); SERIAL_ECHOLN(nPrinterModel); switch(oCheckModel) @@ -427,47 +427,31 @@ switch(oCheckModel) } } -int8_t mCmp(uint16_t nX,uint16_t nY) +uint8_t mCompareValue(uint16_t nX,uint16_t nY) { if(nX>nY) - return(1); + return((uint8_t)ClCompareValue::_Greater); if(nXeeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR)); -bMatch=!bMatch||(aVersion[1]>eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR)); -bMatch=!bMatch||(aVersion[2]>eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION)); -bMatch=!bMatch||(aVersion[3]>eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR)); -if(!bMatch&&oCheckVersion==ClCheckVersion::_Warn) +if((nCompareValueResult cmdqueue ??? -#define PRINTER_NAME_LENGTH (sizeof(PRINTER_NAME)-1) +#define PRINTER_NAME_LENGTH ((sizeof(PRINTER_MMU_NAME)>sizeof(PRINTER_NAME))?(sizeof(PRINTER_MMU_NAME)-1):(sizeof(PRINTER_NAME)-1)) #define GCODE_DELIMITER '"' #define ELLIPSIS "..." @@ -538,24 +520,25 @@ return(pStrBegin); void printer_smodel_check(char* pStrPos) { char* pResult; -size_t nLength; +size_t nLength,nPrinterNameLength; bool bCheckOK; char sPrinterName[PRINTER_NAME_LENGTH+sizeof(ELLIPSIS)-1+1]=""; +nPrinterNameLength=strlen_P(::sPrinterName); pResult=code_string(pStrPos,&nLength); if(pResult!=NULL) { - strlcpy(sPrinterName,pResult,min(PRINTER_NAME_LENGTH,nLength)+1); - if(nLength>PRINTER_NAME_LENGTH) + strlcpy(sPrinterName,pResult,min(nPrinterNameLength,nLength)+1); + if(nLength>nPrinterNameLength) strcat(sPrinterName,ELLIPSIS); - bCheckOK=(nLength==PRINTER_NAME_LENGTH); - if(bCheckOK&&(!strncasecmp(pResult,PRINTER_NAME,nLength))) // i.e. string compare execute only if lengths are same + bCheckOK=(nLength==nPrinterNameLength); + if(bCheckOK&&(!strncasecmp_P(pResult,::sPrinterName,nLength))) // i.e. string compare execute only if lengths are same return; } SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Printer model doesn't match ..."); SERIAL_ECHOPGM("actual : \""); -SERIAL_ECHO(PRINTER_NAME); +serialprintPGM(::sPrinterName); SERIAL_ECHOLNPGM("\""); SERIAL_ECHOPGM("expected: \""); SERIAL_ECHO(sPrinterName); @@ -571,3 +554,16 @@ switch(oCheckModel) break; } } + +void fSetMmuMode(bool bMMu) +{ +if(bMMu) + { + nPrinterType=pgm_read_word(&_nPrinterMmuType); + sPrinterName=_sPrinterMmuName; + } +else { + nPrinterType=pgm_read_word(&_nPrinterType); + sPrinterName=_sPrinterName; + } +} diff --git a/Firmware/util.h b/Firmware/util.h index 96358ef7c..a9bbcb1d6 100644 --- a/Firmware/util.h +++ b/Firmware/util.h @@ -84,6 +84,14 @@ enum class ClCheckGcode:uint_least8_t _Undef=EEPROM_EMPTY_VALUE }; +#define COMPARE_VALUE_EQUAL (((uint8_t)ClCompareValue::_Equal<<6)+((uint8_t)ClCompareValue::_Equal<<4)+((uint8_t)ClCompareValue::_Equal<<2)+((uint8_t)ClCompareValue::_Equal)) +enum class ClCompareValue:uint_least8_t +{ + _Less=0, + _Equal=1, + _Greater=2 +}; + extern ClNozzleDiameter oNozzleDiameter; extern ClCheckMode oCheckMode; extern ClCheckModel oCheckModel; @@ -97,4 +105,6 @@ void printer_smodel_check(char* pStrPos); void fw_version_check(const char *pVersion); void gcode_level_check(uint16_t nGcodeLevel); +void fSetMmuMode(bool bMMu); + #endif /* UTIL_H */ diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 1ed888edb..442e8b944 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -2,12 +2,16 @@ #define CONFIGURATION_PRUSA_H #include +#include "printers.h" /*------------------------------------ GENERAL SETTINGS *------------------------------------*/ // Printer revision #define PRINTER_TYPE PRINTER_MK2 +#define PRINTER_NAME PRINTER_MK2_NAME +#define PRINTER_MMU_TYPE PRINTER_MK2 // dummy item (due to successfully compilation / building only) +#define PRINTER_MMU_NAME PRINTER_MK2_NAME // dummy item (due to successfully compilation / building only) #define FILAMENT_SIZE "1_75mm_MK2" #define NOZZLE_TYPE "E3Dv6full" diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 26ca70be2..44fee01ec 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -2,12 +2,16 @@ #define CONFIGURATION_PRUSA_H #include +#include "printers.h" /*------------------------------------ GENERAL SETTINGS *------------------------------------*/ // Printer revision #define PRINTER_TYPE PRINTER_MK2 +#define PRINTER_NAME PRINTER_MK2_NAME +#define PRINTER_MMU_TYPE PRINTER_MK2 // dummy item (due to successfully compilation / building only) +#define PRINTER_MMU_NAME PRINTER_MK2_NAME // dummy item (due to successfully compilation / building only) #define FILAMENT_SIZE "1_75mm_MK2" #define NOZZLE_TYPE "E3Dv6full" diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index 752a61317..a979503ae 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -2,12 +2,16 @@ #define CONFIGURATION_PRUSA_H #include +#include "printers.h" /*------------------------------------ GENERAL SETTINGS *------------------------------------*/ // Printer revision #define PRINTER_TYPE PRINTER_MK25 +#define PRINTER_NAME PRINTER_MK25_NAME +#define PRINTER_MMU_TYPE PRINTER_MK25_MMU2 +#define PRINTER_MMU_NAME PRINTER_MK25_MMU2_NAME #define FILAMENT_SIZE "1_75mm_MK25" #define NOZZLE_TYPE "E3Dv6full" diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 525590bd4..bb897fd74 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -2,12 +2,16 @@ #define CONFIGURATION_PRUSA_H #include +#include "printers.h" /*------------------------------------ GENERAL SETTINGS *------------------------------------*/ // Printer revision #define PRINTER_TYPE PRINTER_MK25 +#define PRINTER_NAME PRINTER_MK25_NAME +#define PRINTER_MMU_TYPE PRINTER_MK25_MMU2 +#define PRINTER_MMU_NAME PRINTER_MK25_MMU2_NAME #define FILAMENT_SIZE "1_75mm_MK25" #define NOZZLE_TYPE "E3Dv6full" diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index b47991590..8425dfd72 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -2,12 +2,16 @@ #define CONFIGURATION_PRUSA_H #include +#include "printers.h" /*------------------------------------ GENERAL SETTINGS *------------------------------------*/ // Printer revision #define PRINTER_TYPE PRINTER_MK25S +#define PRINTER_NAME PRINTER_MK25S_NAME +#define PRINTER_MMU_TYPE PRINTER_MK25S_MMU2 +#define PRINTER_MMU_NAME PRINTER_MK25S_MMU2_NAME #define FILAMENT_SIZE "1_75mm_MK25S" #define NOZZLE_TYPE "E3Dv6full" diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 927fc9a18..525c2206f 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -2,12 +2,16 @@ #define CONFIGURATION_PRUSA_H #include +#include "printers.h" /*------------------------------------ GENERAL SETTINGS *------------------------------------*/ // Printer revision #define PRINTER_TYPE PRINTER_MK25S +#define PRINTER_NAME PRINTER_MK25S_NAME +#define PRINTER_MMU_TYPE PRINTER_MK25S_MMU2 +#define PRINTER_MMU_NAME PRINTER_MK25S_MMU2_NAME #define FILAMENT_SIZE "1_75mm_MK25" #define NOZZLE_TYPE "E3Dv6full" diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index 9a1938e0f..b3828ce53 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -2,6 +2,7 @@ #define CONFIGURATION_PRUSA_H #include +//-// #include "printers.h" /*------------------------------------ GENERAL SETTINGS @@ -10,6 +11,7 @@ // Printer revision #define PRINTER_TYPE PRINTER_MK3 #define PRINTER_NAME PRINTER_MK3_NAME +#define PRINTER_MMU_TYPE PRINTER_MK3_MMU2 #define PRINTER_MMU_NAME PRINTER_MK3_MMU2_NAME #define FILAMENT_SIZE "1_75mm_MK3" #define NOZZLE_TYPE "E3Dv6full" diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 6e3b5150d..d331171f5 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -10,6 +10,7 @@ // Printer revision #define PRINTER_TYPE PRINTER_MK3S #define PRINTER_NAME PRINTER_MK3S_NAME +#define PRINTER_MMU_TYPE PRINTER_MK3S_MMU2 #define PRINTER_MMU_NAME PRINTER_MK3S_MMU2_NAME #define FILAMENT_SIZE "1_75mm_MK3" #define NOZZLE_TYPE "E3Dv6full" From 4d535f12172b70b0f1ab2c3e6fc16e7e492ace9f Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 9 Jul 2019 12:31:20 +0200 Subject: [PATCH 316/368] ... incl. SupportMenu ;-P --- Firmware/ultralcd.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5983f657b..6eaf6c63d 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6613,8 +6613,7 @@ static void lcd_main_menu() if (mmu_enabled) { MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu); } -//-// -// MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT + MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT #ifdef LCD_TEST MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT #endif //LCD_TEST From cd1ea0a6552e957c8f2207fe88631d9d742bbec6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 9 Jul 2019 13:38:58 +0200 Subject: [PATCH 317/368] Move function declaration and structs declarations to top of eeprom.h file. --- Firmware/eeprom.h | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index f4e20e5d2..16bb6729b 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -3,7 +3,32 @@ #include +#ifdef __cplusplus void eeprom_init(); +extern bool is_sheet_initialized(); +#endif + + +typedef struct +{ + char name[7]; //!< Can be null terminated, doesn't need to be null terminated + int16_t z_offset; //!< Z_BABYSTEP_MIN .. Z_BABYSTEP_MAX = Z_BABYSTEP_MIN*2/1000 [mm] .. Z_BABYSTEP_MAX*2/1000 [mm] + uint8_t bed_temp; //!< 0 .. 254 [°C] + uint8_t pinda_temp; //!< 0 .. 254 [°C] +} Sheet; + +typedef struct +{ + Sheet s[3]; + uint8_t active_sheet; +} Sheets; +// sizeof(Sheets). Do not change it unless EEPROM_Sheets_base is last item in EEPROM. +// Otherwise it would move following items. +#define EEPROM_SHEETS_SIZEOF 34 + +#ifdef __cplusplus +static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF."); +#endif // The total size of the EEPROM is // 4096 for the Atmega2560 @@ -171,30 +196,8 @@ void eeprom_init(); #define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 #define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 -typedef struct -{ - char name[7]; //!< Can be null terminated, doesn't need to be null terminated - int16_t z_offset; //!< Z_BABYSTEP_MIN .. Z_BABYSTEP_MAX = Z_BABYSTEP_MIN*2/1000 [mm] .. Z_BABYSTEP_MAX*2/1000 [mm] - uint8_t bed_temp; //!< 0 .. 254 [°C] - uint8_t pinda_temp; //!< 0 .. 254 [°C] -} Sheet; - -typedef struct -{ - Sheet s[3]; - uint8_t active_sheet; -} Sheets; -// sizeof(Sheets). Do not change it unless EEPROM_Sheets_base is last item in EEPROM. -// Otherwise it would move following items. -#define EEPROM_SHEETS_SIZEOF 34 - static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER - EEPROM_SHEETS_SIZEOF); -#ifdef __cplusplus -extern bool is_sheet_initialized(); -static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF."); -#endif - //This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. #define EEPROM_LAST_ITEM ((uint16_t)EEPROM_Sheets_base) From 898f6d9d8b6565e65723aa4bba77e838ee1462f8 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 9 Jul 2019 13:41:18 +0200 Subject: [PATCH 318/368] Fix EEPROM_Sheets_base overlay of EEPROM_NOZZLE_DIAMETER_uM. --- Firmware/eeprom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 16bb6729b..7cc07fb20 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -196,7 +196,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 #define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 -static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER - EEPROM_SHEETS_SIZEOF); +static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER_uM - EEPROM_SHEETS_SIZEOF); //This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. #define EEPROM_LAST_ITEM ((uint16_t)EEPROM_Sheets_base) From fddf175b24bcb273c4d7e21e0a639399e7a37f7e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 9 Jul 2019 16:35:46 +0200 Subject: [PATCH 319/368] Use build environment which includes PrusaResearchRambo:avr:rambo board definition. --- build.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index bd32b02ee..58b078c10 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -BUILD_ENV="1.0.2" +BUILD_ENV="1.0.5" SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" if [ ! -d "build-env" ]; then @@ -31,8 +31,7 @@ if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then cp $SCRIPT_PATH/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 8 fi -$BUILD_ENV_PATH/arduino --pref boardsmanager.additional.urls=https://raw.githubusercontent.com/DRracer/Arduino_Boards/master/IDE_Board_Manager/package_prusa3d_index.json -$BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board PrusaResearchRambo:avr:rambo --pref build.path=$BUILD_PATH --pref compiler.warning_level=all || exit +$BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board PrusaResearchRambo:avr:rambo --pref build.path=$BUILD_PATH --pref compiler.warning_level=all || exit 9 export ARDUINO=$BUILD_ENV_PATH From acc71232eaa6ddd35b5ac23df09db8d916dc601b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 9 Jul 2019 17:09:09 +0200 Subject: [PATCH 320/368] Suppress Arduino SocketListener messages. --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 790e5b306..4d9039dc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,13 @@ dist: trusty before_install: - sudo apt-get install -y ninja-build + # Arduino IDE adds a lot of noise caused by network traffic, trying to firewall it off + - sudo iptables -P INPUT DROP + - sudo iptables -P FORWARD DROP + - sudo iptables -P OUTPUT ACCEPT + - sudo iptables -A INPUT -i lo -j ACCEPT + - sudo iptables -A OUTPUT -o lo -j ACCEPT + - sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT script: - bash -x test.sh - cp Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h From dbc603d5f6ea605f0dc086072b2141646e779a12 Mon Sep 17 00:00:00 2001 From: leptun Date: Tue, 9 Jul 2019 18:38:24 +0300 Subject: [PATCH 321/368] Fix compile error on windows addresses issue #1965 --- Firmware/eeprom.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 7cc07fb20..2491e58db 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -196,10 +196,11 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 #define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 -static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER_uM - EEPROM_SHEETS_SIZEOF); +#define EEPROM_SHEETS_BASE (EEPROM_NOZZLE_DIAMETER_uM - EEPROM_SHEETS_SIZEOF) // Sheets +static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE); //This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. -#define EEPROM_LAST_ITEM ((uint16_t)EEPROM_Sheets_base) +#define EEPROM_LAST_ITEM EEPROM_SHEETS_BASE // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! From 712fb1cceb57d541d17a8b269f0d4fa22c61cf45 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 9 Jul 2019 19:19:59 +0200 Subject: [PATCH 322/368] #undef EEPROM_SHEETS_BASE so this internal define for compile-time checking only is not used outside of eeprom.h --- Firmware/eeprom.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 2491e58db..9451ca65d 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -201,7 +201,6 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE); //This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. #define EEPROM_LAST_ITEM EEPROM_SHEETS_BASE - // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! @@ -225,6 +224,8 @@ static constexpr M500_conf * const EEPROM_M500_base = reinterpret_cast Date: Tue, 9 Jul 2019 20:17:59 +0200 Subject: [PATCH 323/368] Fix build time flash size check. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 58b078c10..907b1e037 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -BUILD_ENV="1.0.5" +BUILD_ENV="1.0.6" SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" if [ ! -d "build-env" ]; then From 3333d937ed4b37ff8b3863e1373b6319c63c4bf2 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 10 Jul 2019 16:29:40 +0200 Subject: [PATCH 324/368] some improvements --- .../{Configuration.c => Configuration.cpp} | 4 +- Firmware/ultralcd.cpp | 7 +- Firmware/ultralcd.h | 3 + Firmware/util.cpp | 65 ++++++++++--------- 4 files changed, 42 insertions(+), 37 deletions(-) rename Firmware/{Configuration.c => Configuration.cpp} (73%) diff --git a/Firmware/Configuration.c b/Firmware/Configuration.cpp similarity index 73% rename from Firmware/Configuration.c rename to Firmware/Configuration.cpp index 1fd334541..f87849285 100644 --- a/Firmware/Configuration.c +++ b/Firmware/Configuration.cpp @@ -1,6 +1,4 @@ -#include -#include -//!?! #include "Configuration.h" +#include "Configuration.h" #include "Configuration_prusa.h" const uint16_t _nPrinterType PROGMEM=PRINTER_TYPE; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6eaf6c63d..35ce0f63a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -307,6 +307,7 @@ bool wait_for_unclick; #endif bool bMain; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function +bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_checkink_menu()' function @@ -5492,8 +5493,7 @@ while (0) void lcd_checking_menu() { MENU_BEGIN(); -//-//MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); -MENU_ITEM_BACK_P(_T(MSG_BACK)); +MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch SETTINGS_NOZZLE; MENU_ITEM_TEXT_P(STR_SEPARATOR); MENU_ITEM_TEXT_P(_i("Checks:")); @@ -5556,7 +5556,10 @@ static void lcd_settings_menu() #endif //(LANG_MODE != 0) if (!farm_mode) + { + bSettings=true; // flag ('fake parameter') for 'lcd_checking_menu()' function MENU_ITEM_SUBMENU_P(_i("Print checking"), lcd_checking_menu); + } SETTINGS_SD; SETTINGS_SOUND; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index a75cf6c40..a4abd1068 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -137,6 +137,9 @@ void lcd_ignore_click(bool b=true); void lcd_commands(); +extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_checkink_menu()' function + + void change_extr(int extr); #ifdef SNMM diff --git a/Firmware/util.cpp b/Firmware/util.cpp index d2d8e6cc1..490f2897d 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -384,12 +384,12 @@ if(oCheckMode==ClCheckMode::_None) nDiameter_um=eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM); if(nDiameter==nDiameter_um) return; -SERIAL_ECHO_START; -SERIAL_ECHOLNPGM("Nozzle diameter doesn't match ..."); -SERIAL_ECHOPGM("actual : "); -SERIAL_ECHOLN((float)(nDiameter_um/1000.0)); -SERIAL_ECHOPGM("expected: "); -SERIAL_ECHOLN((float)(nDiameter/1000.0)); +//SERIAL_ECHO_START; +//SERIAL_ECHOLNPGM("Nozzle diameter doesn't match ..."); +//SERIAL_ECHOPGM("actual : "); +//SERIAL_ECHOLN((float)(nDiameter_um/1000.0)); +//SERIAL_ECHOPGM("expected: "); +//SERIAL_ECHOLN((float)(nDiameter/1000.0)); switch(oCheckMode) { case ClCheckMode::_Warn: @@ -400,6 +400,7 @@ switch(oCheckMode) lcd_print_stop(); break; } +bSettings=false; // flag ('fake parameter') for 'lcd_checking_menu()' function menu_submenu(lcd_checking_menu); } @@ -409,12 +410,12 @@ if(oCheckModel==ClCheckModel::_None) return; if(nPrinterModel==nPrinterType) return; -SERIAL_ECHO_START; -SERIAL_ECHOLNPGM("Printer model doesn't match ..."); -SERIAL_ECHOPGM("actual : "); -SERIAL_ECHOLN(nPrinterType); -SERIAL_ECHOPGM("expected: "); -SERIAL_ECHOLN(nPrinterModel); +//SERIAL_ECHO_START; +//SERIAL_ECHOLNPGM("Printer model doesn't match ..."); +//SERIAL_ECHOPGM("actual : "); +//SERIAL_ECHOLN(nPrinterType); +//SERIAL_ECHOPGM("expected: "); +//SERIAL_ECHOLN(nPrinterModel); switch(oCheckModel) { case ClCheckModel::_Warn: @@ -452,12 +453,12 @@ if(nCompareValueResult==COMPARE_VALUE_EQUAL) return; if((nCompareValueResult Date: Wed, 10 Jul 2019 17:07:00 +0200 Subject: [PATCH 325/368] Disable TMC2130 linarity correction for MK3 to save FLASH to enable compilation. Add symlink /Firmware/variants/printers.h to .gitignore. --- .gitignore | 1 + Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index bbd9b9ac2..dec628d07 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,4 @@ Firmware/Doc /build-env/ /Firmware/Firmware.vcxproj /Firmware/Configuration_prusa_bckp.h +/Firmware/variants/printers.h diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index b3828ce53..8b843095f 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -193,9 +193,9 @@ //#define FSENSOR_QUALITY -#define LINEARITY_CORRECTION -#define TMC2130_LINEARITY_CORRECTION -#define TMC2130_LINEARITY_CORRECTION_XYZ +//#define LINEARITY_CORRECTION +//#define TMC2130_LINEARITY_CORRECTION +//#define TMC2130_LINEARITY_CORRECTION_XYZ #define TMC2130_VARIABLE_RESOLUTION From e0f46f128dd71e7caa7c692c74fb0f6b0804ab4d Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 10 Jul 2019 17:39:24 +0200 Subject: [PATCH 326/368] Fix indentation. --- Firmware/mmu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 541a53d91..48baeb314 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -267,9 +267,9 @@ void mmu_loop(void) FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda); puts_P(PSTR("MMU - ENABLED")); mmu_enabled = true; -//-// -// ... PrinterType/Name -fSetMmuMode(true); + //-// + // ... PrinterType/Name + fSetMmuMode(true); mmu_state = S::Idle; } return; From 7189f44bcd8ba8fa4487db7c638c90c1daed201f Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 10 Jul 2019 17:40:33 +0200 Subject: [PATCH 327/368] Remove commented out defines. --- Firmware/printers.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Firmware/printers.h b/Firmware/printers.h index ef8c6e80c..e26431302 100644 --- a/Firmware/printers.h +++ b/Firmware/printers.h @@ -3,17 +3,6 @@ #define PRINTER_UNKNOWN 0 -/* original definition(s) -#define PRINTER_MK1 100 -#define PRINTER_MK2 200 -#define PRINTER_MK2_SNMM 201 -#define PRINTER_MK25 250 -#define PRINTER_MK25_SNMM 251 -#define PRINTER_MK25S 252 -#define PRINTER_MK3 300 -#define PRINTER_MK3_SNMM 301 -#define PRINTER_MK3S 302 -*/ // *** MK1 #define PRINTER_MK1 100 #define PRINTER_MK1_NAME "MK1" From 333ade9aeedd7b1fcab72c50e141903fbd56137c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 10 Jul 2019 17:59:04 +0200 Subject: [PATCH 328/368] Remove non-existing function prototype. --- Firmware/Marlin.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 3d4fc2238..509880922 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -407,8 +407,6 @@ extern void calculate_extruder_multipliers(); // Similar to the default Arduino delay function, // but it keeps the background tasks running. extern void delay_keep_alive(unsigned int ms); -// same but this need to be used when calling delay from lcd_update() else stack owerflow can occur -extern void delay_keep_alive_no_lcd_update(unsigned int ms); extern void check_babystep(); From 6ed146c37cbcaf7aa15926db7aa5279758497f0c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 10 Jul 2019 18:41:12 +0200 Subject: [PATCH 329/368] Fix EEPROM conflict. --- Firmware/eeprom.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 258c16684..e2b8fdd9f 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -196,15 +196,16 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #define EEPROM_CHECK_MODE (EEPROM_MMU_STEALTH-1) // uint8 #define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 #define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 -#define EEPROM_CHECK_MODEL (EEPROM_NOZZLE_DIAMETER_uM-1) // uint8 -#define EEPROM_CHECK_VERSION (EEPROM_CHECK_MODEL-1) // uint8 -#define EEPROM_CHECK_GCODE (EEPROM_CHECK_VERSION-1) // uint8 #define EEPROM_SHEETS_BASE (EEPROM_NOZZLE_DIAMETER_uM - EEPROM_SHEETS_SIZEOF) // Sheets static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE); +#define EEPROM_CHECK_MODEL (EEPROM_SHEETS_BASE-1) // uint8 +#define EEPROM_CHECK_VERSION (EEPROM_CHECK_MODEL-1) // uint8 +#define EEPROM_CHECK_GCODE (EEPROM_CHECK_VERSION-1) // uint8 + //This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. -#define EEPROM_LAST_ITEM EEPROM_SHEETS_BASE +#define EEPROM_LAST_ITEM EEPROM_CHECK_GCODE // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! From 8985d2e26c41070c708c2b7c7c8af1867dcfc2fd Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 10 Jul 2019 18:50:16 +0200 Subject: [PATCH 330/368] Fix fix EEPROM conflict. --- Firmware/eeprom.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index e2b8fdd9f..6691bc1ee 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -229,8 +229,6 @@ static constexpr M500_conf * const EEPROM_M500_base = reinterpret_cast Date: Wed, 10 Jul 2019 21:03:30 +0200 Subject: [PATCH 331/368] Reorder EEPROM items to allow possible future grow for Sheets struct. --- Firmware/eeprom.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 6691bc1ee..54f30ccd1 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -196,16 +196,16 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #define EEPROM_CHECK_MODE (EEPROM_MMU_STEALTH-1) // uint8 #define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8 #define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16 - -#define EEPROM_SHEETS_BASE (EEPROM_NOZZLE_DIAMETER_uM - EEPROM_SHEETS_SIZEOF) // Sheets -static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE); - -#define EEPROM_CHECK_MODEL (EEPROM_SHEETS_BASE-1) // uint8 +#define EEPROM_CHECK_MODEL (EEPROM_NOZZLE_DIAMETER_uM-1) // uint8 #define EEPROM_CHECK_VERSION (EEPROM_CHECK_MODEL-1) // uint8 #define EEPROM_CHECK_GCODE (EEPROM_CHECK_VERSION-1) // uint8 +#define EEPROM_SHEETS_BASE (EEPROM_CHECK_GCODE - EEPROM_SHEETS_SIZEOF) // Sheets +static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE); + + //This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. -#define EEPROM_LAST_ITEM EEPROM_CHECK_GCODE +#define EEPROM_LAST_ITEM EEPROM_SHEETS_BASE // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! From a3fde091ab024676654a4648d73fdf04947d0690 Mon Sep 17 00:00:00 2001 From: DRracer Date: Fri, 12 Jul 2019 10:10:56 +0200 Subject: [PATCH 332/368] More than 7.5KB saved by slight refactoring of printing to serial line --- Firmware/Marlin.h | 18 +++----- Firmware/MarlinSerial.h | 6 +-- Firmware/Marlin_main.cpp | 18 ++++++++ Firmware/ultralcd.cpp | 97 +++++++++++++++------------------------- 4 files changed, 63 insertions(+), 76 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index afc018596..c71f70ea8 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -79,9 +79,9 @@ extern FILE _uartout; #define SERIAL_PROTOCOL_F(x,y) (MYSERIAL.print(x,y)) #define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x))) #define SERIAL_PROTOCOLRPGM(x) (serialprintPGM((x))) -#define SERIAL_PROTOCOLLN(x) (MYSERIAL.print(x),MYSERIAL.write('\n')) -#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x)),MYSERIAL.write('\n')) -#define SERIAL_PROTOCOLLNRPGM(x) (serialprintPGM((x)),MYSERIAL.write('\n')) +#define SERIAL_PROTOCOLLN(x) (MYSERIAL.println(x)/*,MYSERIAL.write('\n')*/) +#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x)),MYSERIAL.println()/*write('\n')*/) +#define SERIAL_PROTOCOLLNRPGM(x) (serialprintPGM((x)),MYSERIAL.println()/*write('\n')*/) extern const char errormagic[] PROGMEM; @@ -111,15 +111,9 @@ void serial_echopair_P(const char *s_P, unsigned long v); //Things to write to serial from Program memory. Saves 400 to 2k of RAM. -FORCE_INLINE void serialprintPGM(const char *str) -{ - char ch=pgm_read_byte(str); - while(ch) - { - MYSERIAL.write(ch); - ch=pgm_read_byte(++str); - } -} +// Making this FORCE_INLINE is not a good idea when running out of FLASH +// I'd rather skip a few CPU ticks than 5.5KB (!!) of FLASH +void serialprintPGM(const char *str); bool is_buffer_empty(); void get_command(); diff --git a/Firmware/MarlinSerial.h b/Firmware/MarlinSerial.h index d596708e4..27e722bc0 100644 --- a/Firmware/MarlinSerial.h +++ b/Firmware/MarlinSerial.h @@ -96,7 +96,7 @@ class MarlinSerial //: public Stream static int read(void); static void flush(void); - static FORCE_INLINE int available(void) + static /*FORCE_INLINE*/ int available(void) { return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE; } @@ -184,14 +184,14 @@ class MarlinSerial //: public Stream public: - static FORCE_INLINE void write(const char *str) + static /*FORCE_INLINE*/ void write(const char *str) { while (*str) write(*str++); } - static FORCE_INLINE void write(const uint8_t *buffer, size_t size) + static /*FORCE_INLINE*/ void write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde72397..d21d11b6d 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -411,6 +411,24 @@ void serial_echopair_P(const char *s_P, double v) void serial_echopair_P(const char *s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +/*FORCE_INLINE*/ void serialprintPGM(const char *str) +{ +#if 0 + char ch=pgm_read_byte(str); + while(ch) + { + MYSERIAL.write(ch); + ch=pgm_read_byte(++str); + } +#else + // hmm, same size as the above version, the compiler did a good job optimizing the above + while( uint8_t ch = pgm_read_byte(str) ){ + MYSERIAL.write((char)ch); + ++str; + } +#endif +} + #ifdef SDSUPPORT #include "SdFatUtil.h" int freeMemory() { return SdFatUtil::FreeRam(); } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e1d9e0abc..d3699f45c 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3954,6 +3954,13 @@ void lcd_menu_show_sensors_state() // NOT static due to using ins } } +void prusa_statistics_err(char c){ + SERIAL_ECHO("{[ERR:"); + SERIAL_ECHO(c); + SERIAL_ECHO(']'); + prusa_stat_farm_number(); +} + void prusa_statistics(int _message, uint8_t _fil_nr) { #ifdef DEBUG_DISABLE_PRUSA_STATISTICS return; @@ -3963,114 +3970,93 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { case 0: // default message if (busy_state == PAUSED_FOR_USER) - { - SERIAL_ECHO("{"); - prusa_stat_printerstatus(15); - prusa_stat_farm_number(); - prusa_stat_printinfo(); - SERIAL_ECHOLN("}"); + { status_number = 15; } else if (isPrintPaused || card.paused) { - SERIAL_ECHO("{"); - prusa_stat_printerstatus(14); - prusa_stat_farm_number(); - prusa_stat_printinfo(); - SERIAL_ECHOLN("}"); status_number = 14; } else if (IS_SD_PRINTING || loading_flag) { - SERIAL_ECHO("{"); - prusa_stat_printerstatus(4); - prusa_stat_farm_number(); - prusa_stat_printinfo(); - SERIAL_ECHOLN("}"); status_number = 4; } else { - SERIAL_ECHO("{"); - prusa_stat_printerstatus(1); - prusa_stat_farm_number(); - prusa_stat_diameter(); - SERIAL_ECHOLN("}"); status_number = 1; } + SERIAL_ECHO('{'); + prusa_stat_printerstatus(status_number); + prusa_stat_farm_number(); + prusa_stat_printinfo(); break; case 1: // 1 heating farm_status = 2; - SERIAL_ECHO("{"); + SERIAL_ECHO('{'); prusa_stat_printerstatus(2); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); status_number = 2; farm_timer = 1; break; case 2: // heating done farm_status = 3; - SERIAL_ECHO("{"); + SERIAL_ECHO('{'); prusa_stat_printerstatus(3); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); + SERIAL_ECHOLN('}'); status_number = 3; farm_timer = 1; if (IS_SD_PRINTING || loading_flag) { farm_status = 4; - SERIAL_ECHO("{"); + SERIAL_ECHO('{'); prusa_stat_printerstatus(4); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); status_number = 4; } else { - SERIAL_ECHO("{"); + SERIAL_ECHO('{'); prusa_stat_printerstatus(3); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); status_number = 3; } farm_timer = 1; break; case 3: // filament change - + // must do a return here to prevent doing SERIAL_ECHOLN("}") at the very end of this function + // saved a considerable amount of FLASH + return; break; case 4: // print succesfull SERIAL_ECHO("{[RES:1][FIL:"); MYSERIAL.print(int(_fil_nr)); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); prusa_stat_printerstatus(status_number); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); farm_timer = 2; break; case 5: // print not succesfull SERIAL_ECHO("{[RES:0][FIL:"); MYSERIAL.print(int(_fil_nr)); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); prusa_stat_printerstatus(status_number); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); farm_timer = 2; break; case 6: // print done SERIAL_ECHO("{[PRN:8]"); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); status_number = 8; farm_timer = 2; break; case 7: // print done - stopped SERIAL_ECHO("{[PRN:9]"); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); status_number = 9; farm_timer = 2; break; @@ -4078,49 +4064,38 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { SERIAL_ECHO("{[PRN:0][PFN:"); status_number = 0; SERIAL_ECHO(farm_no); - SERIAL_ECHOLN("]}"); + SERIAL_ECHO(']'); farm_timer = 2; break; case 20: // echo farm no - SERIAL_ECHO("{"); + SERIAL_ECHO('{'); prusa_stat_printerstatus(status_number); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); farm_timer = 4; break; case 21: // temperatures - SERIAL_ECHO("{"); + SERIAL_ECHO('{'); prusa_stat_temperatures(); prusa_stat_farm_number(); prusa_stat_printerstatus(status_number); - SERIAL_ECHOLN("}"); break; case 22: // waiting for filament change SERIAL_ECHO("{[PRN:5]"); prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); status_number = 5; break; case 90: // Error - Thermal Runaway - SERIAL_ECHO("{[ERR:1]"); - prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); + prusa_statistics_err('1'); break; case 91: // Error - Thermal Runaway Preheat - SERIAL_ECHO("{[ERR:2]"); - prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); + prusa_statistics_err('2'); break; case 92: // Error - Min temp - SERIAL_ECHO("{[ERR:3]"); - prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); + prusa_statistics_err('3'); break; case 93: // Error - Max temp - SERIAL_ECHO("{[ERR:4]"); - prusa_stat_farm_number(); - SERIAL_ECHOLN("}"); + prusa_statistics_err('4'); break; case 99: // heartbeat @@ -4128,11 +4103,11 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { prusa_stat_temperatures(); SERIAL_ECHO("[PFN:"); SERIAL_ECHO(farm_no); - SERIAL_ECHO("]"); - SERIAL_ECHOLN("}"); + SERIAL_ECHO(']'); break; } + SERIAL_ECHOLN('}'); } @@ -4140,19 +4115,19 @@ static void prusa_stat_printerstatus(int _status) { SERIAL_ECHO("[PRN:"); SERIAL_ECHO(_status); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); } static void prusa_stat_farm_number() { SERIAL_ECHO("[PFN:"); SERIAL_ECHO(farm_no); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); } static void prusa_stat_diameter() { SERIAL_ECHO("[DIA:"); SERIAL_ECHO(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); } static void prusa_stat_temperatures() @@ -4165,7 +4140,7 @@ static void prusa_stat_temperatures() SERIAL_ECHO(current_temperature[0]); SERIAL_ECHO("][ATB:"); SERIAL_ECHO(current_temperature_bed); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); } static void prusa_stat_printinfo() @@ -4189,7 +4164,7 @@ static void prusa_stat_printinfo() } SERIAL_ECHO("][FWR:"); SERIAL_ECHO(FW_VERSION); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); prusa_stat_diameter(); } From 759d9f5a2ee362eab5ca9184bbf7994ba6ced219 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 15 Jul 2019 11:41:16 +0200 Subject: [PATCH 333/368] small text edits --- Firmware/sound.h | 2 +- lang/lang_en_cz.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/sound.h b/Firmware/sound.h index 2c14dfee6..bdd32ec83 100644 --- a/Firmware/sound.h +++ b/Firmware/sound.h @@ -6,7 +6,7 @@ #define MSG_SOUND_MODE_LOUD "Sound [loud]" #define MSG_SOUND_MODE_ONCE "Sound [once]" #define MSG_SOUND_MODE_SILENT "Sound [silent]" -#define MSG_SOUND_MODE_BLIND "Sound [blind]" +#define MSG_SOUND_MODE_BLIND "Sound [blind]" #define e_SOUND_MODE_NULL 0xFF diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 027d04097..b4f613339 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -828,7 +828,7 @@ # "Press the knob" -"Stisknete hl. tlacitko" +"Stisknete tlacitko" #MSG_PRINT_PAUSED c=20 r=1 "Print paused" From 8fb30f886a6090fa5bab5beb73a63af3a82e6c28 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 15 Jul 2019 14:30:21 +0200 Subject: [PATCH 334/368] octoprint stop fix --- Firmware/Marlin_main.cpp | 6 +++++- Firmware/temperature.cpp | 2 +- Firmware/ultralcd.cpp | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde72397..6f43c7f87 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6734,6 +6734,10 @@ Sigma_Exit: } break; + case 603: { //! M603 - Stop print + lcd_print_stop(); + } + #ifdef PINDA_THERMISTOR case 860: // M860 - Wait for PINDA thermistor to reach target temperature. { @@ -9501,7 +9505,6 @@ void restore_print_from_ram_and_continue(float e_move) card.setIndex(saved_sdpos); sdpos_atomic = saved_sdpos; card.sdprinting = true; - printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this } else if (saved_printing_type == PRINTING_TYPE_USB) { //was usb printing gcode_LastN = saved_sdpos; //saved_sdpos was reused for storing line number when usb printing @@ -9511,6 +9514,7 @@ void restore_print_from_ram_and_continue(float e_move) else { //not sd printing nor usb printing } + printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this lcd_setstatuspgm(_T(WELCOME_MSG)); saved_printing = false; } diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 779bee32c..536e96bfd 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -547,7 +547,7 @@ void fanSpeedError(unsigned char _fan) { } else { fan_check_error = EFCE_DETECTED; - + SERIAL_ECHOLNPGM("// action:pause"); //for octoprint } } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e1d9e0abc..e87908867 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6952,7 +6952,6 @@ void lcd_print_stop() if(!card.sdprinting) { SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint - return; } saved_printing = false; cancel_heatup = true; From 549a8a1a6b56b38c661f4079fc43262afef7d608 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 16:23:16 +0200 Subject: [PATCH 335/368] Restore print fan speed earlier then nozzle temperature. Avoids nozzle temperature dip when fan is turned on. --- Firmware/Marlin_main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde72397..81e87ea1a 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9456,10 +9456,11 @@ void stop_and_save_print_to_ram(float z_move, float e_move) //! @brief Restore print from ram //! -//! Restore print saved by stop_and_save_print_to_ram(). Is blocking, -//! waits for extruder temperature restore, then restores position and continues -//! print moves. -//! Internaly lcd_update() is called by wait_for_heater(). +//! Restore print saved by stop_and_save_print_to_ram(). Is blocking, restores +//! print fan speed, waits for extruder temperature restore, then restores +//! position and continues print moves. +//! +//! Internally lcd_update() is called by wait_for_heater(). //! //! @param e_move void restore_print_from_ram_and_continue(float e_move) @@ -9474,6 +9475,7 @@ void restore_print_from_ram_and_continue(float e_move) // for (int axis = X_AXIS; axis <= E_AXIS; axis++) // current_position[axis] = st_get_position_mm(axis); active_extruder = saved_active_extruder; //restore active_extruder + fanSpeed = saved_fanSpeed; if (saved_extruder_temperature) { setTargetHotendSafe(saved_extruder_temperature, saved_active_extruder); heating_status = 1; @@ -9482,7 +9484,6 @@ void restore_print_from_ram_and_continue(float e_move) } feedrate = saved_feedrate2; //restore feedrate axis_relative_modes[E_AXIS] = saved_extruder_relative_mode; - fanSpeed = saved_fanSpeed; float e = saved_pos[E_AXIS] - e_move; plan_set_e_position(e); //first move print head in XY to the saved position: From ab4e7896885575a5046916be2ef1634053e37a36 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 17:22:39 +0200 Subject: [PATCH 336/368] Partially revert "aeed49a Fix filament runout on optical filament sensors" Revert plan move to filament change position before enqued M600. This was workaround to problem that restore_print_from_ram_and_continue() did 3s heating pause before resuming print. This problem will be fixed properly in restore_print_from_ram_and_continue() in next commit. Save 166B of FLASH. --- Firmware/fsensor.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index fd7936ee9..f20f647d6 100755 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -522,19 +522,6 @@ void fsensor_st_block_chunk(block_t* bl, int cnt) } } -//! This ensures generating z-position at least 25mm above the heat bed. -//! Making this a template enables changing the computation data type easily at all spots where necessary. -//! @param current_z current z-position -//! @return z-position at least 25mm above the heat bed plus FILAMENTCHANGE_ZADD -template -inline T fsensor_clamp_z(float current_z){ - T z( current_z ); - if(z < T(25)){ // make sure the compiler understands, that the constant 25 is of correct type - // - necessary for uint8_t -> results in shorter code - z = T(25); // move to at least 25mm above heat bed - } - return z + T(FILAMENTCHANGE_ZADD); // always move above the printout by FILAMENTCHANGE_ZADD (default 2mm) -} //! Common code for enqueing M600 and supplemental codes into the command queue. //! Used both for the IR sensor and the PAT9125 @@ -545,22 +532,6 @@ void fsensor_enque_M600(){ enquecommand_front_P(PSTR("PRUSA fsensor_recover")); fsensor_m600_enqueued = true; enquecommand_front_P((PSTR("M600"))); -#define xstr(a) str(a) -#define str(a) #a - static const char gcodeMove[] PROGMEM = - "G1 X" xstr(FILAMENTCHANGE_XPOS) - " Y" xstr(FILAMENTCHANGE_YPOS) - " Z%u"; -#undef str -#undef xstr - char buf[32]; - // integer arithmetics is far shorter, I don't need a precise float position here, just move a bit above - // 8bit arithmetics in fsensor_clamp_z is 10B shorter than 16bit (not talking about float ;) ) - // The compile-time static_assert here ensures, that the computation gets enough bits in case of Z-range too high, - // i.e. makes the user change the data type, which also results in larger code - static_assert(Z_MAX_POS < (255 - FILAMENTCHANGE_ZADD), "Z-range too high, change fsensor_clamp_z to "); - sprintf_P(buf, gcodeMove, fsensor_clamp_z(current_position[Z_AXIS]) ); - enquecommand_front(buf, false); } //! @brief filament sensor update (perform M600 on filament runout) From 9083d151b2b3387b68e096f3b199525b9113e784 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 18:07:05 +0200 Subject: [PATCH 337/368] wait_for_heater() in restore_print_from_ram_and_continue() only if saved_extruder_temperature differs from target hot-end temperature. This fixes problem, that restore_print_from_ram_and_continue() blocked for heating for at least TEMP_RESIDENCY_TIME (3 seconds) even if temperature was resumed by M600 command. --- Firmware/Marlin_main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 81e87ea1a..7372dae93 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9476,7 +9476,8 @@ void restore_print_from_ram_and_continue(float e_move) // current_position[axis] = st_get_position_mm(axis); active_extruder = saved_active_extruder; //restore active_extruder fanSpeed = saved_fanSpeed; - if (saved_extruder_temperature) { + if (degTargetHotend(saved_active_extruder) != saved_extruder_temperature) + { setTargetHotendSafe(saved_extruder_temperature, saved_active_extruder); heating_status = 1; wait_for_heater(_millis(), saved_active_extruder); From f0727214ed11cc8872409d94349f150c7be962ee Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 19:15:15 +0200 Subject: [PATCH 338/368] Document --- Firmware/temperature.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Firmware/temperature.h b/Firmware/temperature.h index 27a7e713d..e9ba11b47 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -122,6 +122,7 @@ inline void babystepsTodoZsubtract(int n) //inline so that there is no performance decrease. //deg=degreeCelsius +// Doesn't save FLASH when FORCE_INLINE removed. FORCE_INLINE float degHotend(uint8_t extruder) { return current_temperature[extruder]; }; @@ -140,6 +141,7 @@ FORCE_INLINE float degBed() { return current_temperature_bed; }; +// Doesn't save FLASH when FORCE_INLINE removed. FORCE_INLINE float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; }; @@ -148,11 +150,13 @@ FORCE_INLINE float degTargetBed() { return target_temperature_bed; }; +// Doesn't save FLASH when FORCE_INLINE removed. FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) { target_temperature[extruder] = celsius; resetPID(extruder); }; +// Doesn't save FLASH when not inlined. static inline void setTargetHotendSafe(const float &celsius, uint8_t extruder) { if (extruder Date: Mon, 15 Jul 2019 20:32:58 +0300 Subject: [PATCH 339/368] Lcd optimization - 1K of flash saved --- Firmware/Marlin_main.cpp | 14 +- Firmware/lcd.cpp | 276 +++++++++++++++------------------------ Firmware/lcd.h | 42 +----- Firmware/ultralcd.cpp | 97 +++++++------- lang/lang_en.txt | 4 +- lang/lang_en_cz.txt | 8 +- lang/lang_en_de.txt | 8 +- lang/lang_en_es.txt | 8 +- lang/lang_en_fr.txt | 8 +- lang/lang_en_it.txt | 8 +- lang/lang_en_pl.txt | 8 +- 11 files changed, 190 insertions(+), 291 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde72397..e4698df45 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -775,12 +775,8 @@ int uart_putchar(char c, FILE *) void lcd_splash() { -// lcd_puts_at_P(0, 1, PSTR(" Original Prusa ")); -// lcd_puts_at_P(0, 2, PSTR(" 3D Printers ")); -// lcd_puts_P(PSTR("\x1b[1;3HOriginal Prusa\x1b[2;4H3D Printers")); -// fputs_P(PSTR(ESC_2J ESC_H(1,1) "Original Prusa i3" ESC_H(3,2) "Prusa Research"), lcdout); - lcd_puts_P(PSTR(ESC_2J ESC_H(1,1) "Original Prusa i3" ESC_H(3,2) "Prusa Research")); -// lcd_printf_P(_N(ESC_2J "x:%.3f\ny:%.3f\nz:%.3f\ne:%.3f"), _x, _y, _z, _e); + lcd_clear(); // clears display and homes screen + lcd_puts_P(PSTR("\n Original Prusa i3\n Prusa Research")); } @@ -910,7 +906,7 @@ void update_sec_lang_from_external_flash() uint32_t src_addr; if (lang_get_header(lang, &header, &src_addr)) { - fputs_P(PSTR(ESC_H(1,3) "Language update."), lcdout); + lcd_puts_at_P(1,3,PSTR("Language update.")); for (uint8_t i = 0; i < state; i++) fputc('.', lcdout); _delay(100); boot_reserved = (state + 1) | (lang << 4); @@ -984,8 +980,8 @@ void list_sec_lang_from_external_flash() static void w25x20cl_err_msg() { - lcd_puts_P(_n(ESC_2J ESC_H(0,0) "External SPI flash" ESC_H(0,1) "W25X20CL is not res-" - ESC_H(0,2) "ponding. Language" ESC_H(0,3) "switch unavailable.")); + lcd_clear(); + lcd_puts_P(_n("External SPI flash\nW25X20CL is not res-\nponding. Language\nswitch unavailable.")); } // "Setup" function is called by the Arduino framework on startup. diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 5bd7cad67..4df14bfbc 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -16,6 +16,13 @@ //-// #include "sound.h" +#define LCD_DEFAULT_DELAY 100 + +#if (defined(LCD_PINS_D0) && defined(LCD_PINS_D1) && defined(LCD_PINS_D2) && defined(LCD_PINS_D3)) + #define LCD_8BIT +#endif + +// #define VT100 // commands #define LCD_CLEARDISPLAY 0x01 @@ -55,73 +62,63 @@ #define LCD_5x10DOTS 0x04 #define LCD_5x8DOTS 0x00 +// bitmasks for flag argument settings +#define LCD_RS_FLAG 0x01 +#define LCD_HALF_FLAG 0x02 FILE _lcdout; // = {0}; Global variable is always zero initialized, no need to explicitly state that. +uint8_t lcd_displayfunction = 0; +uint8_t lcd_displaycontrol = 0; +uint8_t lcd_displaymode = 0; -uint8_t lcd_rs_pin; // LOW: command. HIGH: character. -uint8_t lcd_rw_pin; // LOW: write to LCD. HIGH: read from LCD. -uint8_t lcd_enable_pin; // activated by a HIGH pulse. -uint8_t lcd_data_pins[8]; - -uint8_t lcd_displayfunction; -uint8_t lcd_displaycontrol; -uint8_t lcd_displaymode; - -uint8_t lcd_numlines; uint8_t lcd_currline; +#ifdef VT100 uint8_t lcd_escape[8]; - +#endif void lcd_pulseEnable(void) -{ - digitalWrite(lcd_enable_pin, LOW); - delayMicroseconds(1); - digitalWrite(lcd_enable_pin, HIGH); - delayMicroseconds(1); // enable pulse must be >450ns - digitalWrite(lcd_enable_pin, LOW); - delayMicroseconds(100); // commands need > 37us to settle +{ + WRITE(LCD_PINS_ENABLE,HIGH); + _delay_us(1); // enable pulse must be >450ns + WRITE(LCD_PINS_ENABLE,LOW); } -void lcd_write4bits(uint8_t value) +void lcd_writebits(uint8_t value) { - for (int i = 0; i < 4; i++) - { - pinMode(lcd_data_pins[i], OUTPUT); - digitalWrite(lcd_data_pins[i], (value >> i) & 0x01); - } +#ifdef LCD_8BIT + WRITE(LCD_PINS_D0, value & 0x01); + WRITE(LCD_PINS_D1, value & 0x02); + WRITE(LCD_PINS_D2, value & 0x04); + WRITE(LCD_PINS_D3, value & 0x08); +#endif + WRITE(LCD_PINS_D4, value & 0x10); + WRITE(LCD_PINS_D5, value & 0x20); + WRITE(LCD_PINS_D6, value & 0x40); + WRITE(LCD_PINS_D7, value & 0x80); + lcd_pulseEnable(); } -void lcd_write8bits(uint8_t value) +void lcd_send(uint8_t data, uint8_t flags, uint16_t duration = LCD_DEFAULT_DELAY) { - for (int i = 0; i < 8; i++) + WRITE(LCD_PINS_RS,flags&LCD_RS_FLAG); + _delay_us(5); + lcd_writebits(data); +#ifndef LCD_8BIT + if (!(flags & LCD_HALF_FLAG)) { - pinMode(lcd_data_pins[i], OUTPUT); - digitalWrite(lcd_data_pins[i], (value >> i) & 0x01); + _delay_us(LCD_DEFAULT_DELAY); + lcd_writebits(data<<4); } - lcd_pulseEnable(); +#endif + delayMicroseconds(duration); } -// write either command or data, with automatic 4/8-bit selection -void lcd_send(uint8_t value, uint8_t mode) +void lcd_command(uint8_t value, uint16_t delayExtra = 0) { - digitalWrite(lcd_rs_pin, mode); - // if there is a RW pin indicated, set it low to Write - if (lcd_rw_pin != 255) digitalWrite(lcd_rw_pin, LOW); - if (lcd_displayfunction & LCD_8BITMODE) - lcd_write8bits(value); - else - { - lcd_write4bits(value>>4); - lcd_write4bits(value); - } -} - -void lcd_command(uint8_t value) -{ - lcd_send(value, LOW); + lcd_send(value, LOW, LCD_DEFAULT_DELAY + delayExtra); } void lcd_clear(void); @@ -141,141 +138,98 @@ void lcd_no_autoscroll(void); void lcd_set_cursor(uint8_t col, uint8_t row); void lcd_createChar_P(uint8_t location, const uint8_t* charmap); -uint8_t lcd_escape_write(uint8_t chr); +#ifdef VT100 +void lcd_escape_write(uint8_t chr); +#endif -uint8_t lcd_write(uint8_t value) +void lcd_write(uint8_t value) { - if (value == '\n') + if (value == '\n' || value == '\r') { if (lcd_currline > 3) lcd_currline = -1; lcd_set_cursor(0, lcd_currline + 1); // LF - return 1; + return; } - if (lcd_escape[0] || (value == 0x1b)) - return lcd_escape_write(value); + #ifdef VT100 + if (lcd_escape[0] || (value == 0x1b)){ + lcd_escape_write(value); + return; + } + #endif lcd_send(value, HIGH); - return 1; // assume sucess } -static void lcd_begin(uint8_t lines, uint8_t dotsize, uint8_t clear) +static void lcd_begin(uint8_t clear) { - if (lines > 1) lcd_displayfunction |= LCD_2LINE; - lcd_numlines = lines; lcd_currline = 0; - // for some 1 line displays you can select a 10 pixel high font - if ((dotsize != 0) && (lines == 1)) lcd_displayfunction |= LCD_5x10DOTS; - // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION! - // according to datasheet, we need at least 40ms after power rises above 2.7V - // before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50 - _delay_us(50000); - // Now we pull both RS and R/W low to begin commands - digitalWrite(lcd_rs_pin, LOW); - digitalWrite(lcd_enable_pin, LOW); - if (lcd_rw_pin != 255) - digitalWrite(lcd_rw_pin, LOW); - //put the LCD into 4 bit or 8 bit mode - if (!(lcd_displayfunction & LCD_8BITMODE)) - { - // this is according to the hitachi HD44780 datasheet - // figure 24, pg 46 - // we start in 8bit mode, try to set 4 bit mode - lcd_write4bits(0x03); - _delay_us(4500); // wait min 4.1ms - // second try - lcd_write4bits(0x03); - _delay_us(4500); // wait min 4.1ms - // third go! - lcd_write4bits(0x03); - _delay_us(150); - // finally, set to 4-bit interface - lcd_write4bits(0x02); - } - else - { - // this is according to the hitachi HD44780 datasheet - // page 45 figure 23 - // Send function set command sequence - lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); - _delay_us(4500); // wait more than 4.1ms - // second try - lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); - _delay_us(150); - // third go - lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); - } - // finally, set # lines, font size, etc. - lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); - _delay_us(60); + + lcd_send(LCD_FUNCTIONSET | LCD_8BITMODE, LOW | LCD_HALF_FLAG, 4500); // wait min 4.1ms + // second try + lcd_send(LCD_FUNCTIONSET | LCD_8BITMODE, LOW | LCD_HALF_FLAG, 150); + // third go! + lcd_send(LCD_FUNCTIONSET | LCD_8BITMODE, LOW | LCD_HALF_FLAG, 150); +#ifndef LCD_8BIT + // set to 4-bit interface + lcd_send(LCD_FUNCTIONSET | LCD_4BITMODE, LOW | LCD_HALF_FLAG, 150); +#endif + + // finally, set # lines, font size, etc.0 + lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); // turn the display on with no cursor or blinking default - lcd_displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF; + lcd_displaycontrol = LCD_CURSOROFF | LCD_BLINKOFF; lcd_display(); - _delay_us(60); // clear it off if (clear) lcd_clear(); - _delay_us(3000); // Initialize to default text direction (for romance languages) lcd_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; // set the entry mode lcd_command(LCD_ENTRYMODESET | lcd_displaymode); - _delay_us(60); + + #ifdef VT100 lcd_escape[0] = 0; + #endif } int lcd_putchar(char c, FILE *) { lcd_write(c); - return 0; } void lcd_init(void) { - uint8_t fourbitmode = 1; - lcd_rs_pin = LCD_PINS_RS; - lcd_rw_pin = 255; - lcd_enable_pin = LCD_PINS_ENABLE; - lcd_data_pins[0] = LCD_PINS_D4; - lcd_data_pins[1] = LCD_PINS_D5; - lcd_data_pins[2] = LCD_PINS_D6; - lcd_data_pins[3] = LCD_PINS_D7; - lcd_data_pins[4] = 0; - lcd_data_pins[5] = 0; - lcd_data_pins[6] = 0; - lcd_data_pins[7] = 0; - pinMode(lcd_rs_pin, OUTPUT); - // we can save 1 pin by not using RW. Indicate by passing 255 instead of pin# - if (lcd_rw_pin != 255) pinMode(lcd_rw_pin, OUTPUT); - pinMode(lcd_enable_pin, OUTPUT); - if (fourbitmode) lcd_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; - else lcd_displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS; - lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 1); - //lcd_clear(); + SET_OUTPUT(LCD_PINS_RS); + SET_OUTPUT(LCD_PINS_ENABLE); +#ifdef LCD_8BIT + lcd_displayfunction |= LCD_8BITMODE; +#endif + lcd_displayfunction |= LCD_2LINE; + _delay_us(50000); + lcd_begin(1); //first time init fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream } void lcd_refresh(void) { - lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 1); + lcd_begin(1); lcd_set_custom_characters(); } void lcd_refresh_noclear(void) { - lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 0); + lcd_begin(0); lcd_set_custom_characters(); } - - void lcd_clear(void) { - lcd_command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero - _delay_us(1600); // this command takes a long time + lcd_command(LCD_CLEARDISPLAY, 1600); // clear display, set cursor position to zero + lcd_currline = 0; } void lcd_home(void) { - lcd_command(LCD_RETURNHOME); // set cursor position to zero - _delay_us(1600); // this command takes a long time! + lcd_command(LCD_RETURNHOME, 1600); // set cursor position to zero + lcd_currline = 0; } // Turn the display on/off (quickly) @@ -359,8 +313,8 @@ void lcd_no_autoscroll(void) void lcd_set_cursor(uint8_t col, uint8_t row) { int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; - if ( row >= lcd_numlines ) - row = lcd_numlines-1; // we count rows starting w/0 + if (row >= LCD_HEIGHT) + row = LCD_HEIGHT - 1; // we count rows starting w/0 lcd_currline = row; lcd_command(LCD_SETDDRAMADDR | (col + row_offsets[row])); } @@ -375,12 +329,14 @@ void lcd_createChar_P(uint8_t location, const uint8_t* charmap) lcd_send(pgm_read_byte(&charmap[i]), HIGH); } +#ifdef VT100 + //Supported VT100 escape codes: //EraseScreen "\x1b[2J" //CursorHome "\x1b[%d;%dH" //CursorShow "\x1b[?25h" //CursorHide "\x1b[?25l" -uint8_t lcd_escape_write(uint8_t chr) +void lcd_escape_write(uint8_t chr) { #define escape_cnt (lcd_escape[0]) //escape character counter #define is_num_msk (lcd_escape[1]) //numeric character bit mask @@ -410,26 +366,26 @@ uint8_t lcd_escape_write(uint8_t chr) switch (escape_cnt++) { case 0: - if (chr == 0x1b) return 1; // escape = "\x1b" + if (chr == 0x1b) return; // escape = "\x1b" break; case 1: is_num_msk = 0x00; // reset 'is number' bit mask - if (chr == '[') return 1; // escape = "\x1b[" + if (chr == '[') return; // escape = "\x1b[" break; case 2: switch (chr) { - case '2': return 1; // escape = "\x1b[2" - case '?': return 1; // escape = "\x1b[?" + case '2': return; // escape = "\x1b[2" + case '?': return; // escape = "\x1b[?" default: - if (chr_is_num) return 1; // escape = "\x1b[%1d" + if (chr_is_num) return; // escape = "\x1b[%1d" } break; case 3: switch (lcd_escape[2]) { case '?': // escape = "\x1b[?" - if (chr == '2') return 1; // escape = "\x1b[?2" + if (chr == '2') return; // escape = "\x1b[?2" break; case '2': if (chr == 'J') // escape = "\x1b[2J" @@ -438,20 +394,20 @@ uint8_t lcd_escape_write(uint8_t chr) if (e_2_is_num && // escape = "\x1b[%1d" ((chr == ';') || // escape = "\x1b[%1d;" chr_is_num)) // escape = "\x1b[%2d" - return 1; + return; } break; case 4: switch (lcd_escape[2]) { case '?': // "\x1b[?" - if ((lcd_escape[3] == '2') && (chr == '5')) return 1; // escape = "\x1b[?25" + if ((lcd_escape[3] == '2') && (chr == '5')) return; // escape = "\x1b[?25" break; default: if (e_2_is_num) // escape = "\x1b[%1d" { - if ((lcd_escape[3] == ';') && chr_is_num) return 1; // escape = "\x1b[%1d;%1d" - else if (e_3_is_num && (chr == ';')) return 1; // escape = "\x1b[%2d;" + if ((lcd_escape[3] == ';') && chr_is_num) return; // escape = "\x1b[%1d;%1d" + else if (e_3_is_num && (chr == ';')) return; // escape = "\x1b[%2d;" } } break; @@ -478,10 +434,10 @@ uint8_t lcd_escape_write(uint8_t chr) if (chr == 'H') // escape = "\x1b%1d;%1dH" lcd_set_cursor(e4_num, e2_num); // CursorHome else if (chr_is_num) - return 1; // escape = "\x1b%1d;%2d" + return; // escape = "\x1b%1d;%2d" } else if (e_3_is_num && (lcd_escape[4] == ';') && chr_is_num) - return 1; // escape = "\x1b%2d;%1d" + return; // escape = "\x1b%2d;%1d" } } break; @@ -495,7 +451,7 @@ uint8_t lcd_escape_write(uint8_t chr) if (chr == 'H') // escape = "\x1b%2d;%1dH" lcd_set_cursor(e5_num, e23_num); // CursorHome else if (chr_is_num) // "\x1b%2d;%2d" - return 1; + return; } } break; @@ -506,10 +462,9 @@ uint8_t lcd_escape_write(uint8_t chr) break; } escape_cnt = 0; // reset escape - return 1; // assume sucess } - +#endif //VT100 int lcd_putc(int c) @@ -648,16 +603,6 @@ void lcd_printFloat(double number, uint8_t digits) } - - - - - - - - - - uint8_t lcd_draw_update = 2; int32_t lcd_encoder = 0; uint8_t lcd_encoder_bits = 0; @@ -710,7 +655,7 @@ Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); for(int8_t i = 0; i < 10; i++) { Sound_MakeCustom(100,0,false); - delayMicroseconds(100); + _delay_us(100); } */ } @@ -722,13 +667,6 @@ void lcd_quick_feedback(void) lcd_beeper_quick_feedback(); } - - - - - - - void lcd_update(uint8_t lcdDrawUpdateOverride) { if (lcd_draw_update < lcdDrawUpdateOverride) diff --git a/Firmware/lcd.h b/Firmware/lcd.h index 9f3eb5c13..d4d978f2c 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -13,20 +13,16 @@ extern FILE _lcdout; #define lcdout (&_lcdout) extern int lcd_putchar(char c, FILE *stream); - extern void lcd_init(void); extern void lcd_refresh(void); extern void lcd_refresh_noclear(void); - - extern void lcd_clear(void); extern void lcd_home(void); - /*extern void lcd_no_display(void); extern void lcd_display(void); extern void lcd_no_blink(void); @@ -45,7 +41,6 @@ extern void lcd_set_cursor(uint8_t col, uint8_t row); extern void lcd_createChar_P(uint8_t, const uint8_t*); - extern int lcd_putc(int c); extern int lcd_puts_P(const char* str); extern int lcd_puts_at_P(uint8_t c, uint8_t r, const char* str); @@ -66,7 +61,9 @@ extern void lcd_print(double, int = 2); //! @brief Clear screen #define ESC_2J "\x1b[2J" +//! @brief Show cursor #define ESC_25h "\x1b[?25h" +//! @brief Hide cursor #define ESC_25l "\x1b[?25l" //! @brief Set cursor to //! @param c column @@ -118,9 +115,6 @@ extern lcd_lcdupdate_func_t lcd_lcdupdate_func; - - - extern uint8_t lcd_clicked(void); extern void lcd_beeper_quick_feedback(void); @@ -128,13 +122,6 @@ extern void lcd_beeper_quick_feedback(void); //Cause an LCD refresh, and give the user visual or audible feedback that something has happened extern void lcd_quick_feedback(void); - - - - - - - extern void lcd_update(uint8_t lcdDrawUpdateOverride); extern void lcd_update_enable(uint8_t enabled); @@ -165,29 +152,6 @@ private: }; - - - - - - - - - - - - - - - - - -/** -* Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays. -* When selecting the Russian language, a slightly different LCD implementation is used to handle UTF8 characters. -**/ - - //////////////////////////////////// // Setup button and encode mappings for each panel (into 'lcd_buttons' variable // @@ -223,8 +187,6 @@ private: #define encrot3 1 - - //Custom characters defined in the first 8 characters of the LCD #define LCD_STR_BEDTEMP "\x00" #define LCD_STR_DEGREE "\x01" diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e1d9e0abc..c9759323e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1771,8 +1771,8 @@ void lcd_menu_extruder_info() // NOT static due to using ins lcd_timeoutToStatus.stop(); //infinite timeout + lcd_home(); lcd_printf_P(_N( - ESC_H(0,0) "%S: %4d RPM\n" "%S: %4d RPM\n" ), @@ -1833,8 +1833,8 @@ static void lcd_menu_fails_stats_mmu_print() lcd_timeoutToStatus.stop(); //infinite timeout uint8_t fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL); uint16_t load_fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL); -// lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY); - lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3)), _i("Last print failures"), _i("MMU fails"), fails, _i("MMU load fails"), load_fails); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " %S %-3d\n" " %S %-3d"), _i("Last print failures"), _i("MMU fails"), fails, _i("MMU load fails"), load_fails); menu_back_if_clicked_fb(); } @@ -1850,8 +1850,8 @@ static void lcd_menu_fails_stats_mmu_total() lcd_timeoutToStatus.stop(); //infinite timeout uint8_t fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL_TOT); uint16_t load_fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL_TOT); -// lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY); - lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S %-3d"), _i("Total failures"), _i("MMU fails"), fails, _i("MMU load fails"), load_fails, _i("MMU power fails"), mmu_power_failures); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " %S %-3d\n" " %S %-3d\n" " %S %-3d"), _i("Total failures"), _i("MMU fails"), fails, _i("MMU load fails"), load_fails, _i("MMU power fails"), mmu_power_failures); menu_back_if_clicked_fb(); } @@ -1869,8 +1869,8 @@ static void lcd_menu_fails_stats_total() uint16_t filam = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); uint16_t crashX = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT); uint16_t crashY = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT); -// lcd_printf_P(PSTR(ESC_H(0,0) "Total failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY); - lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S X %-3d Y %-3d"), _i("Total failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " %S %-3d\n" " %S %-3d\n" " %S X %-3d Y %-3d"), _i("Total failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY); menu_back_if_clicked_fb(); } @@ -1887,8 +1887,8 @@ static void lcd_menu_fails_stats_print() uint8_t filam = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT); uint8_t crashX = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X); uint8_t crashY = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y); -// lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY); - lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S X %-3d Y %-3d"), _i("Last print failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " %S %-3d\n" " %S %-3d\n" " %S X %-3d Y %-3d"), _i("Last print failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY); menu_back_if_clicked_fb(); } @@ -1929,7 +1929,8 @@ static void lcd_menu_fails_stats() lcd_timeoutToStatus.stop(); //infinite timeout uint8_t filamentLast = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT); uint16_t filamentTotal = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); - lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Filam. runouts %-3d" ESC_H(0,2) "Total failures" ESC_H(1,3) "Filam. runouts %-3d"), filamentLast, filamentTotal); + lcd_home(); + lcd_printf_P(PSTR("Last print failures\n" " Filam. runouts %-3d\n" "Total failures\n" " Filam. runouts %-3d"), filamentLast, filamentTotal); menu_back_if_clicked(); } #else @@ -1953,7 +1954,8 @@ extern char* __malloc_heap_end; static void lcd_menu_debug() { #ifdef DEBUG_STACK_MONITOR - lcd_printf_P(PSTR(ESC_H(1,1) "RAM statistics" ESC_H(5,1) "SP_min: 0x%04x" ESC_H(1,2) "heap_start: 0x%04x" ESC_H(3,3) "heap_end: 0x%04x"), SP_min, __malloc_heap_start, __malloc_heap_end); + lcd_home(); + lcd_printf_P(PSTR("RAM statistics\n" " SP_min: 0x%04x\n" " heap_start: 0x%04x\n" " heap_end: 0x%04x"), SP_min, __malloc_heap_start, __malloc_heap_end); #endif //DEBUG_STACK_MONITOR menu_back_if_clicked_fb(); @@ -1963,12 +1965,13 @@ static void lcd_menu_debug() static void lcd_menu_temperatures() { lcd_timeoutToStatus.stop(); //infinite timeout - - lcd_printf_P(PSTR(ESC_H(1,0) "%S: %d%c" ESC_H(1,1) "%S: %d%c"), _i("Nozzle"), (int)current_temperature[0], '\x01', _i("Bed"), (int)current_temperature_bed, '\x01'); + + lcd_home(); + lcd_printf_P(PSTR(" %S: %d%c \n" " %S: %d%c \n"), _i("Nozzle"), (int)current_temperature[0], '\x01', _i("Bed"), (int)current_temperature_bed, '\x01'); #ifdef AMBIENT_THERMISTOR - lcd_printf_P(PSTR(ESC_H(1,2) "%S: %d%c" ESC_H(1,3) "PINDA: %d%c"), _i("Ambient"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01'); + lcd_printf_P(PSTR(" %S: %d%c\n" " PINDA: %d%c"), _i("Ambient"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01'); #else //AMBIENT_THERMISTOR - lcd_printf_P(PSTR(ESC_H(1,2) "PINDA: %d%c"), (int)current_temperature_pinda, '\x01'); + lcd_printf_P(PSTR(" PINDA: %d%c"), (int)current_temperature_pinda, '\x01'); #endif //AMBIENT_THERMISTOR menu_back_if_clicked(); @@ -1984,7 +1987,8 @@ static void lcd_menu_voltages() lcd_timeoutToStatus.stop(); //infinite timeout float volt_pwr = VOLT_DIV_REF * ((float)current_voltage_raw_pwr / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC; float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC; - lcd_printf_P(PSTR(ESC_H(1,1)"PWR: %d.%01dV" ESC_H(1,2)"BED: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr)), (int)volt_bed, (int)(10*fabs(volt_bed - (int)volt_bed))); + lcd_home(); + lcd_printf_P(PSTR(" PWR: %d.%01dV\n" " BED: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr)), (int)volt_bed, (int)(10*fabs(volt_bed - (int)volt_bed))); menu_back_if_clicked(); } #endif //defined VOLT_BED_PIN || defined VOLT_PWR_PIN @@ -1992,7 +1996,8 @@ static void lcd_menu_voltages() #ifdef TMC2130 static void lcd_menu_belt_status() { - lcd_printf_P(PSTR(ESC_H(1,0) "%S" ESC_H(2,1) "X %d" ESC_H(2,2) "Y %d" ), _i("Belt status"), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y))); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " X %d\n" " Y %d"), _i("Belt status"), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y))); menu_back_if_clicked(); } #endif //TMC2130 @@ -2817,18 +2822,14 @@ void lcd_menu_statistics() const int _m = (_t - (_h * 3600ul)) / 60ul; const int _s = _t - ((_h * 3600ul) + (_m * 60ul)); + lcd_clear(); lcd_printf_P(_N( - ESC_2J - "%S:" - ESC_H(6,1) "%8.2fm \n" - "%S :" - ESC_H(8,3) "%2dh %02dm %02ds" - ), - _i("Filament used"), - _met, - _i("Print time"), - _h, _m, _s - ); + "%S:\n" + "%8.2fm\n" + "%S:\n" + "%2dh %02dm %02ds" + ),_i("Filament used"), _met, _i("Print time"), _h, _m, _s); + menu_back_if_clicked_fb(); } else @@ -2844,18 +2845,14 @@ void lcd_menu_statistics() _hours = (_time - (_days * 1440)) / 60; _minutes = _time - ((_days * 1440) + (_hours * 60)); + lcd_clear(); lcd_printf_P(_N( - ESC_2J - "%S :" - ESC_H(9,1) "%8.2f m\n" - "%S :\n" - "%7ldd :%2hhdh :%02hhd m" - ), - _i("Total filament"), - _filament_m, - _i("Total print time"), - _days, _hours, _minutes - ); + "%S:\n" + "%8.2fm\n" + "%S:\n" + "%7ldd :%2hhdh :%02hhdm" + ), _i("Total filament"), _filament_m, _i("Total print time"), _days, _hours, _minutes); + KEEPALIVE_STATE(PAUSED_FOR_USER); while (!lcd_clicked()) { @@ -2953,8 +2950,8 @@ static void lcd_menu_xyz_y_min() //---------------------- float distanceMin[2]; count_xyz_details(distanceMin); + lcd_home(); lcd_printf_P(_N( - ESC_H(0,0) "%S:\n" "%S\n" "%S:\n" @@ -2990,8 +2987,8 @@ static void lcd_menu_xyz_skew() //|Severe skew: 0.25d| //---------------------- float angleDiff = eeprom_read_float((float*)(EEPROM_XYZ_CAL_SKEW)); + lcd_home(); lcd_printf_P(_N( - ESC_H(0,0) "%S:\n" "%S\n" "%S: %5.2f\x01\n" @@ -3002,10 +2999,14 @@ static void lcd_menu_xyz_skew() _i("Slight skew"), _deg(bed_skew_angle_mild), _i("Severe skew"), _deg(bed_skew_angle_extreme) ); - if (angleDiff < 100) - lcd_printf_P(_N(ESC_H(15,0)"%4.2f\x01"), _deg(angleDiff)); - else - lcd_puts_P(_N(ESC_H(15,0)"N/A")); + if (angleDiff < 100){ + lcd_set_cursor(15,0); + lcd_printf_P(_N("%4.2f\x01"), _deg(angleDiff)); + } + else{ + lcd_set_cursor(15,0); + lcd_puts_P(_N("N/A")); + } if (lcd_clicked()) menu_goto(lcd_menu_xyz_offset, 0, true, true); } @@ -4355,7 +4356,8 @@ static void lcd_crash_mode_info() static uint32_t tim = 0; if ((tim + 1000) < _millis()) { - fputs_P(_i("\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode"), lcdout);////MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 + lcd_clear(); + fputs_P(_i("Crash detection can\rbe turned on only in\rNormal mode"), lcdout);////MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 tim = _millis(); } menu_back_if_clicked(); @@ -4367,7 +4369,8 @@ static void lcd_crash_mode_info2() static uint32_t tim = 0; if ((tim + 1000) < _millis()) { - fputs_P(_i("\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode"), lcdout);////MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 + lcd_clear(); + fputs_P(_i("WARNING:\rCrash detection\rdisabled in\rStealth mode"), lcdout);////MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 tim = _millis(); } menu_back_if_clicked(); diff --git a/lang/lang_en.txt b/lang/lang_en.txt index b8ea25d0c..c8d35cce5 100755 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -8,10 +8,10 @@ "[0;0] point offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" +"Crash detection can\rbe turned on only in\rNormal mode" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" # ">Cancel" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 027d04097..13a110a4c 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -11,12 +11,12 @@ "[0;0] odsazeni bodu" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JCrash detekce muze\x1b[1;0Hbyt zapnuta pouze v\x1b[2;0HNormal modu" +Crash detection can\rbe turned on only in\rNormal mode" +Crash detekce muze\rbyt zapnuta pouze v\rNormal modu" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JPOZOR:\x1b[1;0HCrash detekce\x1b[2;0Hdeaktivovana ve\x1b[3;0HStealth modu" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +POZOR:\rCrash detekce\rdeaktivovana ve\rStealth modu" # ">Cancel" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index c4c80d937..55f0040da 100755 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -11,12 +11,12 @@ "[0;0] Punktversatz" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JCrash Erkennung kann\x1b[1;0Hnur im Modus Normal\x1b[2;0Hgenutzt werden" +Crash detection can\rbe turned on only in\rNormal mode" +Crash Erkennung kann\rnur im Modus Normal\rgenutzt werden" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JWARNUNG:\x1b[1;0HCrash Erkennung\x1b[2;0Hdeaktiviert im\x1b[3;0HStealth Modus" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +WARNUNG:\rCrash Erkennung\rdeaktiviert im\rStealth Modus" # ">Cancel" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 2f4dc2516..ef402c5db 100755 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -11,12 +11,12 @@ "[0;0] punto offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JDec. choque\x1b[1;0Hpuede ser activada solo en\x1b[2;0HModo normal" +Crash detection can\rbe turned on only in\rNormal mode" +Dec. choque\rpuede ser activada solo en\rModo normal" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JATENCION:\x1b[1;0HDec. choque\x1b[2;0Hdesactivada en\x1b[3;0HModo silencio" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +ATENCION:\rDec. choque\rdesactivada en\rModo silencio" # ">Cancel" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index dfb0dd851..f7fb5857b 100755 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -11,12 +11,12 @@ "Offset point [0;0]" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JLa detection de crash peut etre\x1b[1;0Hactive seulement\x1b[2;0Hen mode Normal" +Crash detection can\rbe turned on only in\rNormal mode" +La detection de crash peut etre\ractive seulement\ren mode Normal" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JATTENTION :\x1b[1;0HDetection de crash\x1b[2;0H desactivee en\x1b[3;0Hmode Furtif" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +ATTENTION :\rDetection de crash\r desactivee en\rmode Furtif" # ">Cancel" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 9637777f0..ed327cefc 100755 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -11,12 +11,12 @@ "[0;0] punto offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JRilev. impatto\x1b[1;0Hattivabile solo\x1b[2;0Hin Modalita normale" +Crash detection can\rbe turned on only in\rNormal mode" +Rilev. impatto\rattivabile solo\rin Modalita normale" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JATTENZIONE:\x1b[1;0HRilev. impatto\x1b[2;0Hdisattivato in\x1b[3;0HModalita silenziosa" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +ATTENZIONE:\rRilev. impatto\rdisattivato in\rModalita silenziosa" # ">Cancel" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index fe422cc37..6b34a3d3d 100755 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -11,12 +11,12 @@ "[0;0] przesuniecie punktu" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JWykrywanie zderzen moze\x1b[1;0Hbyc wlaczone tylko w\x1b[2;0Htrybie Normalnym" +Crash detection can\rbe turned on only in\rNormal mode" +Wykrywanie zderzen moze\rbyc wlaczone tylko w\rtrybie Normalnym" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JUWAGA:\x1b[1;0HWykrywanie zderzen\x1b[2;0Hwylaczone w\x1b[3;0Htrybie Stealth" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +UWAGA:\rWykrywanie zderzen\rwylaczone w\rtrybie Stealth" # ">Cancel" From 2e25a853f495b172483fb0e9c966d63d5376e732 Mon Sep 17 00:00:00 2001 From: Marek Kuhn Date: Mon, 15 Jul 2019 19:34:12 +0200 Subject: [PATCH 340/368] Added prusatat test --- CMakeLists.txt | 1 + Tests/PrusaStatistics_test.cpp | 340 +++++++++++++++++++++++++++++++++ 2 files changed, 341 insertions(+) create mode 100644 Tests/PrusaStatistics_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c0c2aacd0..4ca1d95be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ set(TEST_SOURCES Tests/Example_test.cpp Tests/Timer_test.cpp Tests/AutoDeplete_test.cpp + Tests/PrusaStatistics_test.cpp Firmware/Timer.cpp Firmware/AutoDeplete.cpp ) diff --git a/Tests/PrusaStatistics_test.cpp b/Tests/PrusaStatistics_test.cpp new file mode 100644 index 000000000..fd934a449 --- /dev/null +++ b/Tests/PrusaStatistics_test.cpp @@ -0,0 +1,340 @@ +/** + * @file + * @author Marek Kuhn + */ + +// For now the functions are just COPIED (lots of depencendies in ultralcd.h) + +#include "catch.hpp" +#include + +// Mocking Serial line +std::string SERIAL_BUFFER = ""; + +//#define SERIAL_ECHO(s) ( SERIAL_BUFFER += s ) +/* +#define SERIAL_FLUSH() ( SERIAL_BUFFER.clear() ) +#define SERIAL_ECHOLN(s) { \ + SERIAL_ECHO(s); \ + SERIAL_BUFFER += "\n"; \ +} +*/ +void SERIAL_ECHO(std::string s){ + SERIAL_BUFFER += s; +} + +void SERIAL_ECHO(int i){ + SERIAL_BUFFER += std::to_string(i); +} + +void SERIAL_ECHOLN(std::string s){ + SERIAL_BUFFER += s + "\n"; +} + +void SERIAL_FLUSH(){ + SERIAL_BUFFER.clear(); +} + +std::string itostr3(int i){ + return std::to_string(i); +} + +int _millis(){return 10000;} + +int farm_no; +int busy_state; +int PAUSED_FOR_USER; +int status_number; +int total_filament_used; +int feedmultiply; +int longFilenameOLD; +int starttime; + +int target_temperature[1] = {215}; +int current_temperature[1] = {204}; +int target_temperature_bed = 60; +int current_temperature_bed = 55; + +std::string FW_VERSION; + +struct Card { + int percentDone(){ return 50; } +} card; + +void setup_mockups(){ + farm_no = 0; + + busy_state = 0; + status_number = 0; + PAUSED_FOR_USER = 0; + + total_filament_used = 0; + feedmultiply = 0; + longFilenameOLD = 0; + starttime = 0; + + FW_VERSION = "3.8.0"; +} + +/* +void prusa_statistics(int _message, uint8_t _fil_nr) { +#ifdef DEBUG_DISABLE_PRUSA_STATISTICS + return; +#endif //DEBUG_DISABLE_PRUSA_STATISTICS + switch (_message) + { + + case 0: // default message + if (busy_state == PAUSED_FOR_USER) + { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(15); + prusa_stat_farm_number(); + prusa_stat_printinfo(); + SERIAL_ECHOLN("}"); + status_number = 15; + } + else if (isPrintPaused || card.paused) + { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(14); + prusa_stat_farm_number(); + prusa_stat_printinfo(); + SERIAL_ECHOLN("}"); + status_number = 14; + } + else if (IS_SD_PRINTING) + { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(4); + prusa_stat_farm_number(); + prusa_stat_printinfo(); + SERIAL_ECHOLN("}"); + status_number = 4; + } + else + { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(1); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + status_number = 1; + } + break; + + case 1: // 1 heating + farm_status = 2; + SERIAL_ECHO("{"); + prusa_stat_printerstatus(2); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + status_number = 2; + farm_timer = 1; + break; + + case 2: // heating done + farm_status = 3; + SERIAL_ECHO("{"); + prusa_stat_printerstatus(3); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + status_number = 3; + farm_timer = 1; + + if (IS_SD_PRINTING) + { + farm_status = 4; + SERIAL_ECHO("{"); + prusa_stat_printerstatus(4); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + status_number = 4; + } + else + { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(3); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + status_number = 3; + } + farm_timer = 1; + break; + + case 3: // filament change + + break; + case 4: // print succesfull + SERIAL_ECHO("{[RES:1][FIL:"); + MYSERIAL.print(int(_fil_nr)); + SERIAL_ECHO("]"); + prusa_stat_printerstatus(status_number); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + farm_timer = 2; + break; + case 5: // print not succesfull + SERIAL_ECHO("{[RES:0][FIL:"); + MYSERIAL.print(int(_fil_nr)); + SERIAL_ECHO("]"); + prusa_stat_printerstatus(status_number); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + farm_timer = 2; + break; + case 6: // print done + SERIAL_ECHO("{[PRN:8]"); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + status_number = 8; + farm_timer = 2; + break; + case 7: // print done - stopped + SERIAL_ECHO("{[PRN:9]"); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + status_number = 9; + farm_timer = 2; + break; + case 8: // printer started + SERIAL_ECHO("{[PRN:0][PFN:"); + status_number = 0; + SERIAL_ECHO(farm_no); + SERIAL_ECHOLN("]}"); + farm_timer = 2; + break; + case 20: // echo farm no + SERIAL_ECHO("{"); + prusa_stat_printerstatus(status_number); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + farm_timer = 4; + break; + case 21: // temperatures + SERIAL_ECHO("{"); + prusa_stat_temperatures(); + prusa_stat_farm_number(); + prusa_stat_printerstatus(status_number); + SERIAL_ECHOLN("}"); + break; + case 22: // waiting for filament change + SERIAL_ECHO("{[PRN:5]"); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + status_number = 5; + break; + + case 90: // Error - Thermal Runaway + SERIAL_ECHO("{[ERR:1]"); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + break; + case 91: // Error - Thermal Runaway Preheat + SERIAL_ECHO("{[ERR:2]"); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + break; + case 92: // Error - Min temp + SERIAL_ECHO("{[ERR:3]"); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + break; + case 93: // Error - Max temp + SERIAL_ECHO("{[ERR:4]"); + prusa_stat_farm_number(); + SERIAL_ECHOLN("}"); + break; + + case 99: // heartbeat + SERIAL_ECHO("{[PRN:99]"); + prusa_stat_temperatures(); + SERIAL_ECHO("[PFN:"); + SERIAL_ECHO(farm_no); + SERIAL_ECHO("]"); + SERIAL_ECHOLN("}"); + + break; + } + +} +*/ +static void prusa_stat_printerstatus(int _status) +{ + SERIAL_ECHO("[PRN:"); + SERIAL_ECHO(_status); + SERIAL_ECHO("]"); +} + +static void prusa_stat_farm_number() { + SERIAL_ECHO("[PFN:"); + SERIAL_ECHO(farm_no); + SERIAL_ECHO("]"); +} + +static void prusa_stat_temperatures() +{ + SERIAL_ECHO("[ST0:"); + SERIAL_ECHO(target_temperature[0]); + SERIAL_ECHO("][STB:"); + SERIAL_ECHO(target_temperature_bed); + SERIAL_ECHO("][AT0:"); + SERIAL_ECHO(current_temperature[0]); + SERIAL_ECHO("][ATB:"); + SERIAL_ECHO(current_temperature_bed); + SERIAL_ECHO("]"); +} + +static void prusa_stat_printinfo() +{ + SERIAL_ECHO("[TFU:"); + SERIAL_ECHO(total_filament_used); + SERIAL_ECHO("][PCD:"); + SERIAL_ECHO(itostr3(card.percentDone())); + SERIAL_ECHO("][FEM:"); + SERIAL_ECHO(itostr3(feedmultiply)); + SERIAL_ECHO("][FNM:"); + SERIAL_ECHO(longFilenameOLD); + SERIAL_ECHO("][TIM:"); + if (starttime != 0) + { + SERIAL_ECHO(_millis() / 1000 - starttime / 1000); + } + else + { + SERIAL_ECHO(0); + } + SERIAL_ECHO("][FWR:"); + SERIAL_ECHO(FW_VERSION); + SERIAL_ECHO("]"); +} + + +TEST_CASE("Printer status is shown", "[prusa_stats]") +{ + SERIAL_FLUSH(); + prusa_stat_printerstatus(1); + CHECK(SERIAL_BUFFER.compare("[PRN:1]") == 0); +} + +TEST_CASE("Printer info is showsn", "[prusa_stats]") +{ + SERIAL_FLUSH(); + setup_mockups(); + prusa_stat_printinfo(); + CHECK(SERIAL_BUFFER.compare("[TFU:0][PCD:50][FEM:0][FNM:0][TIM:0][FWR:3.8.0]") == 0); +} + +TEST_CASE("Printer temperatures are shown", "[prusa_stats]") +{ + SERIAL_FLUSH(); + setup_mockups(); + prusa_stat_temperatures(); + CHECK(SERIAL_BUFFER.compare("[ST0:215][STB:60][AT0:204][ATB:55]") == 0); +} + +TEST_CASE("Prusa_statistics Paused test", "[prusa_stats]") +{ + + + CHECK(1 == 1); +} From 0481db87d672093e9615927061aefa9652e3f5fd Mon Sep 17 00:00:00 2001 From: leptun Date: Tue, 16 Jul 2019 12:12:09 +0300 Subject: [PATCH 341/368] Fix missing commas --- lang/lang_en_cz.txt | 8 ++++---- lang/lang_en_de.txt | 8 ++++---- lang/lang_en_es.txt | 8 ++++---- lang/lang_en_fr.txt | 8 ++++---- lang/lang_en_it.txt | 8 ++++---- lang/lang_en_pl.txt | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 13a110a4c..74bf63d0b 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -11,12 +11,12 @@ "[0;0] odsazeni bodu" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Crash detekce muze\rbyt zapnuta pouze v\rNormal modu" +"Crash detection can\rbe turned on only in\rNormal mode" +"Crash detekce muze\rbyt zapnuta pouze v\rNormal modu" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -POZOR:\rCrash detekce\rdeaktivovana ve\rStealth modu" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"POZOR:\rCrash detekce\rdeaktivovana ve\rStealth modu" # ">Cancel" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 55f0040da..3c2c8a14f 100755 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -11,12 +11,12 @@ "[0;0] Punktversatz" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Crash Erkennung kann\rnur im Modus Normal\rgenutzt werden" +"Crash detection can\rbe turned on only in\rNormal mode" +"Crash Erkennung kann\rnur im Modus Normal\rgenutzt werden" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -WARNUNG:\rCrash Erkennung\rdeaktiviert im\rStealth Modus" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"WARNUNG:\rCrash Erkennung\rdeaktiviert im\rStealth Modus" # ">Cancel" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index ef402c5db..3f4629e97 100755 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -11,12 +11,12 @@ "[0;0] punto offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Dec. choque\rpuede ser activada solo en\rModo normal" +"Crash detection can\rbe turned on only in\rNormal mode" +"Dec. choque\rpuede ser activada solo en\rModo normal" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -ATENCION:\rDec. choque\rdesactivada en\rModo silencio" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"ATENCION:\rDec. choque\rdesactivada en\rModo silencio" # ">Cancel" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index f7fb5857b..2919f11fa 100755 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -11,12 +11,12 @@ "Offset point [0;0]" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -La detection de crash peut etre\ractive seulement\ren mode Normal" +"Crash detection can\rbe turned on only in\rNormal mode" +"La detection de crash peut etre\ractive seulement\ren mode Normal" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -ATTENTION :\rDetection de crash\r desactivee en\rmode Furtif" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"ATTENTION :\rDetection de crash\r desactivee en\rmode Furtif" # ">Cancel" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index ed327cefc..0726fef2c 100755 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -11,12 +11,12 @@ "[0;0] punto offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Rilev. impatto\rattivabile solo\rin Modalita normale" +"Crash detection can\rbe turned on only in\rNormal mode" +"Rilev. impatto\rattivabile solo\rin Modalita normale" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -ATTENZIONE:\rRilev. impatto\rdisattivato in\rModalita silenziosa" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"ATTENZIONE:\rRilev. impatto\rdisattivato in\rModalita silenziosa" # ">Cancel" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 6b34a3d3d..6919d0570 100755 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -11,12 +11,12 @@ "[0;0] przesuniecie punktu" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Wykrywanie zderzen moze\rbyc wlaczone tylko w\rtrybie Normalnym" +"Crash detection can\rbe turned on only in\rNormal mode" +"Wykrywanie zderzen moze\rbyc wlaczone tylko w\rtrybie Normalnym" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -UWAGA:\rWykrywanie zderzen\rwylaczone w\rtrybie Stealth" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"UWAGA:\rWykrywanie zderzen\rwylaczone w\rtrybie Stealth" # ">Cancel" From 1f4542fe8bd4300efbb9ea0fc01c78aaf7bcb819 Mon Sep 17 00:00:00 2001 From: Marek Kuhn Date: Tue, 16 Jul 2019 15:41:28 +0200 Subject: [PATCH 342/368] Added unit test for prusa_statistics --- Tests/PrusaStatistics_test.cpp | 545 +++++++++++++++++++++++++++++---- 1 file changed, 491 insertions(+), 54 deletions(-) diff --git a/Tests/PrusaStatistics_test.cpp b/Tests/PrusaStatistics_test.cpp index fd934a449..05aaa3633 100644 --- a/Tests/PrusaStatistics_test.cpp +++ b/Tests/PrusaStatistics_test.cpp @@ -8,37 +8,15 @@ #include "catch.hpp" #include -// Mocking Serial line -std::string SERIAL_BUFFER = ""; - -//#define SERIAL_ECHO(s) ( SERIAL_BUFFER += s ) -/* -#define SERIAL_FLUSH() ( SERIAL_BUFFER.clear() ) -#define SERIAL_ECHOLN(s) { \ - SERIAL_ECHO(s); \ - SERIAL_BUFFER += "\n"; \ -} -*/ -void SERIAL_ECHO(std::string s){ - SERIAL_BUFFER += s; -} - -void SERIAL_ECHO(int i){ - SERIAL_BUFFER += std::to_string(i); -} - -void SERIAL_ECHOLN(std::string s){ - SERIAL_BUFFER += s + "\n"; -} - -void SERIAL_FLUSH(){ - SERIAL_BUFFER.clear(); -} std::string itostr3(int i){ return std::to_string(i); } +std::string eeprom_read_word(uint16_t* i){ + return "eeprom_read"; +} + int _millis(){return 10000;} int farm_no; @@ -49,18 +27,28 @@ int total_filament_used; int feedmultiply; int longFilenameOLD; int starttime; +int isPrintPaused; +int IS_SD_PRINTING; +int farm_status; +int farm_timer; +int loading_flag; -int target_temperature[1] = {215}; -int current_temperature[1] = {204}; -int target_temperature_bed = 60; -int current_temperature_bed = 55; +int target_temperature[1]; +int current_temperature[1]; +int target_temperature_bed; +int current_temperature_bed; + +uint16_t nozzle_diameter; +uint16_t* EEPROM_NOZZLE_DIAMETER_uM; std::string FW_VERSION; struct Card { + int paused = 0; int percentDone(){ return 50; } } card; + void setup_mockups(){ farm_no = 0; @@ -74,9 +62,119 @@ void setup_mockups(){ starttime = 0; FW_VERSION = "3.8.0"; + + isPrintPaused = 0; + IS_SD_PRINTING = 0; + farm_status = 0; + farm_timer = 1; + loading_flag = 0; + + target_temperature[0] = {215}; + current_temperature[0] = {204}; + target_temperature_bed = 60; + current_temperature_bed = 55; + + nozzle_diameter = 400; + EEPROM_NOZZLE_DIAMETER_uM = &nozzle_diameter; + +} + + +// Copy of pre 3.8 version set of functions +namespace old_code +{ + +// Mocking Serial line +std::string SERIAL_BUFFER = ""; + +void SERIAL_ECHO(std::string s){ + SERIAL_BUFFER += s; +} + +void SERIAL_ECHO(int i){ + SERIAL_BUFFER += std::to_string(i); +} + +void SERIAL_ECHO(char c){ + SERIAL_BUFFER += char(c); +} + +void SERIAL_ECHOLN(std::string s){ + SERIAL_BUFFER += s + "\n"; +} + +void SERIAL_ECHOLN(char c){ + SERIAL_BUFFER += char(c); +} + +void SERIAL_RESET(){ + SERIAL_BUFFER.clear(); +} + +struct MySerial { + void print(int i){ + SERIAL_ECHO(i); + } +} MYSERIAL; + + +static void prusa_stat_printerstatus(int _status) +{ + SERIAL_ECHO("[PRN:"); + SERIAL_ECHO(_status); + SERIAL_ECHO("]"); +} + +static void prusa_stat_farm_number() { + SERIAL_ECHO("[PFN:"); + SERIAL_ECHO(farm_no); + SERIAL_ECHO("]"); +} + +static void prusa_stat_diameter() { + SERIAL_ECHO("[DIA:"); + SERIAL_ECHO(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)); + SERIAL_ECHO("]"); +} + +static void prusa_stat_temperatures() +{ + SERIAL_ECHO("[ST0:"); + SERIAL_ECHO(target_temperature[0]); + SERIAL_ECHO("][STB:"); + SERIAL_ECHO(target_temperature_bed); + SERIAL_ECHO("][AT0:"); + SERIAL_ECHO(current_temperature[0]); + SERIAL_ECHO("][ATB:"); + SERIAL_ECHO(current_temperature_bed); + SERIAL_ECHO("]"); +} + +static void prusa_stat_printinfo() +{ + SERIAL_ECHO("[TFU:"); + SERIAL_ECHO(total_filament_used); + SERIAL_ECHO("][PCD:"); + SERIAL_ECHO(itostr3(card.percentDone())); + SERIAL_ECHO("][FEM:"); + SERIAL_ECHO(itostr3(feedmultiply)); + SERIAL_ECHO("][FNM:"); + SERIAL_ECHO(longFilenameOLD); + SERIAL_ECHO("][TIM:"); + if (starttime != 0) + { + SERIAL_ECHO(_millis() / 1000 - starttime / 1000); + } + else + { + SERIAL_ECHO(0); + } + SERIAL_ECHO("][FWR:"); + SERIAL_ECHO(FW_VERSION); + SERIAL_ECHO("]"); + prusa_stat_diameter(); } -/* void prusa_statistics(int _message, uint8_t _fil_nr) { #ifdef DEBUG_DISABLE_PRUSA_STATISTICS return; @@ -103,7 +201,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { SERIAL_ECHOLN("}"); status_number = 14; } - else if (IS_SD_PRINTING) + else if (IS_SD_PRINTING || loading_flag) { SERIAL_ECHO("{"); prusa_stat_printerstatus(4); @@ -117,6 +215,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { SERIAL_ECHO("{"); prusa_stat_printerstatus(1); prusa_stat_farm_number(); + prusa_stat_diameter(); SERIAL_ECHOLN("}"); status_number = 1; } @@ -141,7 +240,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { status_number = 3; farm_timer = 1; - if (IS_SD_PRINTING) + if (IS_SD_PRINTING || loading_flag) { farm_status = 4; SERIAL_ECHO("{"); @@ -257,18 +356,62 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { } } -*/ +} + +// Copy of 3.8 version of functions +namespace new_code +{ + +// Mocking Serial line +std::string SERIAL_BUFFER = ""; + +void SERIAL_ECHO(std::string s){ + SERIAL_BUFFER += s; +} + +void SERIAL_ECHO(int i){ + SERIAL_BUFFER += std::to_string(i); +} + +void SERIAL_ECHO(char c){ + SERIAL_BUFFER += char(c); +} + +void SERIAL_ECHOLN(std::string s){ + SERIAL_BUFFER += s + "\n"; +} + +void SERIAL_ECHOLN(char c){ + SERIAL_BUFFER += char(c); +} + +void SERIAL_RESET(){ + SERIAL_BUFFER.clear(); +} + +struct MySerial { + void print(int i){ + SERIAL_ECHO(i); + } +} MYSERIAL; + static void prusa_stat_printerstatus(int _status) -{ +{ SERIAL_ECHO("[PRN:"); SERIAL_ECHO(_status); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); } static void prusa_stat_farm_number() { SERIAL_ECHO("[PFN:"); SERIAL_ECHO(farm_no); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); +} + +static void prusa_stat_diameter() { + SERIAL_ECHO("[DIA:"); + SERIAL_ECHO(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)); + SERIAL_ECHO(']'); } static void prusa_stat_temperatures() @@ -281,7 +424,7 @@ static void prusa_stat_temperatures() SERIAL_ECHO(current_temperature[0]); SERIAL_ECHO("][ATB:"); SERIAL_ECHO(current_temperature_bed); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); } static void prusa_stat_printinfo() @@ -305,36 +448,330 @@ static void prusa_stat_printinfo() } SERIAL_ECHO("][FWR:"); SERIAL_ECHO(FW_VERSION); - SERIAL_ECHO("]"); + SERIAL_ECHO(']'); + prusa_stat_diameter(); } +void prusa_statistics_err(char c){ + SERIAL_ECHO("{[ERR:"); + SERIAL_ECHO(c); + SERIAL_ECHO(']'); + prusa_stat_farm_number(); +} + + +void prusa_statistics(int _message, uint8_t _fil_nr) { +#ifdef DEBUG_DISABLE_PRUSA_STATISTICS + return; +#endif //DEBUG_DISABLE_PRUSA_STATISTICS + switch (_message) + { + + case 0: // default message + if (busy_state == PAUSED_FOR_USER) + { + status_number = 15; + } + else if (isPrintPaused || card.paused) + { + status_number = 14; + } + else if (IS_SD_PRINTING || loading_flag) + { + status_number = 4; + } + else + { + status_number = 1; + } + SERIAL_ECHO('{'); + prusa_stat_printerstatus(status_number); + prusa_stat_farm_number(); + prusa_stat_printinfo(); + break; + + case 1: // 1 heating + farm_status = 2; + SERIAL_ECHO('{'); + prusa_stat_printerstatus(2); + prusa_stat_farm_number(); + status_number = 2; + farm_timer = 1; + break; + + case 2: // heating done + farm_status = 3; + SERIAL_ECHO('{'); + prusa_stat_printerstatus(3); + prusa_stat_farm_number(); + SERIAL_ECHOLN('}'); + status_number = 3; + farm_timer = 1; + + if (IS_SD_PRINTING || loading_flag) + { + farm_status = 4; + SERIAL_ECHO('{'); + prusa_stat_printerstatus(4); + prusa_stat_farm_number(); + status_number = 4; + } + else + { + SERIAL_ECHO('{'); + prusa_stat_printerstatus(3); + prusa_stat_farm_number(); + status_number = 3; + } + farm_timer = 1; + break; + + case 3: // filament change + // must do a return here to prevent doing SERIAL_ECHOLN("}") at the very end of this function + // saved a considerable amount of FLASH + return; + break; + case 4: // print succesfull + SERIAL_ECHO("{[RES:1][FIL:"); + MYSERIAL.print(int(_fil_nr)); + SERIAL_ECHO(']'); + prusa_stat_printerstatus(status_number); + prusa_stat_farm_number(); + farm_timer = 2; + break; + case 5: // print not succesfull + SERIAL_ECHO("{[RES:0][FIL:"); + MYSERIAL.print(int(_fil_nr)); + SERIAL_ECHO(']'); + prusa_stat_printerstatus(status_number); + prusa_stat_farm_number(); + farm_timer = 2; + break; + case 6: // print done + SERIAL_ECHO("{[PRN:8]"); + prusa_stat_farm_number(); + status_number = 8; + farm_timer = 2; + break; + case 7: // print done - stopped + SERIAL_ECHO("{[PRN:9]"); + prusa_stat_farm_number(); + status_number = 9; + farm_timer = 2; + break; + case 8: // printer started + SERIAL_ECHO("{[PRN:0][PFN:"); + status_number = 0; + SERIAL_ECHO(farm_no); + SERIAL_ECHO(']'); + farm_timer = 2; + break; + case 20: // echo farm no + SERIAL_ECHO('{'); + prusa_stat_printerstatus(status_number); + prusa_stat_farm_number(); + farm_timer = 4; + break; + case 21: // temperatures + SERIAL_ECHO('{'); + prusa_stat_temperatures(); + prusa_stat_farm_number(); + prusa_stat_printerstatus(status_number); + break; + case 22: // waiting for filament change + SERIAL_ECHO("{[PRN:5]"); + prusa_stat_farm_number(); + status_number = 5; + break; + + case 90: // Error - Thermal Runaway + prusa_statistics_err('1'); + break; + case 91: // Error - Thermal Runaway Preheat + prusa_statistics_err('2'); + break; + case 92: // Error - Min temp + prusa_statistics_err('3'); + break; + case 93: // Error - Max temp + prusa_statistics_err('4'); + break; + + case 99: // heartbeat + SERIAL_ECHO("{[PRN:99]"); + prusa_stat_temperatures(); + SERIAL_ECHO("[PFN:"); + SERIAL_ECHO(farm_no); + SERIAL_ECHO(']'); + + break; + } + SERIAL_ECHOLN('}'); + +} + +} // end namespace new + +void SERIALS_RESET(){ + old_code::SERIAL_RESET(); + new_code::SERIAL_RESET(); +} + +std::string SERIALS_SERIALIZE(){ + return old_code::SERIAL_BUFFER + "\n" + new_code::SERIAL_BUFFER; +} +void SERIALS_PRINT(){ + std::cout << "[Printing buffers...] \n"; + std::cout << old_code::SERIAL_BUFFER << "\n"; + std::cout << new_code::SERIAL_BUFFER << "\n"; +} + +int SERIALS_COMPARE(){ + // Trim the newline at the end + + if(old_code::SERIAL_BUFFER.back() == '\n'){ + old_code::SERIAL_BUFFER.pop_back(); + } + if(new_code::SERIAL_BUFFER.back() == '\n'){ + new_code::SERIAL_BUFFER.pop_back(); + } + + std::cout << "Comparing: \n"; + std::cout << old_code::SERIAL_BUFFER << "\n"; + std::cout << new_code::SERIAL_BUFFER << "\n"; + + return old_code::SERIAL_BUFFER.compare(new_code::SERIAL_BUFFER); +} + + +// --------------- TEST CASES ---------------- // + +TEST_CASE("Serials compare ignore newline at the end", "[helper]") +{ + SERIALS_RESET(); + old_code::SERIAL_BUFFER = "Hello compare me."; + new_code::SERIAL_BUFFER = "Hello compare me."; + CHECK(SERIALS_COMPARE() == 0); + + SERIALS_RESET(); + old_code::SERIAL_BUFFER = "Hello compare me.\n"; + new_code::SERIAL_BUFFER = "Hello compare me."; + CHECK(SERIALS_COMPARE() == 0); + + SERIALS_RESET(); + old_code::SERIAL_BUFFER = "Hello compare me."; + new_code::SERIAL_BUFFER = "Hello compare me.\n"; + CHECK(SERIALS_COMPARE() == 0); +} TEST_CASE("Printer status is shown", "[prusa_stats]") { - SERIAL_FLUSH(); - prusa_stat_printerstatus(1); - CHECK(SERIAL_BUFFER.compare("[PRN:1]") == 0); + SERIALS_RESET(); + setup_mockups(); + + old_code::prusa_stat_printerstatus(1); + new_code::prusa_stat_printerstatus(1); + + INFO(SERIALS_SERIALIZE()); + CHECK(SERIALS_COMPARE() == 0); } -TEST_CASE("Printer info is showsn", "[prusa_stats]") + +TEST_CASE("Printer info is shown", "[prusa_stats]") { - SERIAL_FLUSH(); + SERIALS_RESET(); setup_mockups(); - prusa_stat_printinfo(); - CHECK(SERIAL_BUFFER.compare("[TFU:0][PCD:50][FEM:0][FNM:0][TIM:0][FWR:3.8.0]") == 0); + + old_code::prusa_stat_printinfo(); + new_code::prusa_stat_printinfo(); + + INFO(SERIALS_SERIALIZE()); + CHECK(SERIALS_COMPARE() == 0); } TEST_CASE("Printer temperatures are shown", "[prusa_stats]") { - SERIAL_FLUSH(); + SERIALS_RESET(); setup_mockups(); - prusa_stat_temperatures(); - CHECK(SERIAL_BUFFER.compare("[ST0:215][STB:60][AT0:204][ATB:55]") == 0); -} -TEST_CASE("Prusa_statistics Paused test", "[prusa_stats]") -{ + old_code::prusa_stat_temperatures(); + new_code::prusa_stat_temperatures(); - - CHECK(1 == 1); + INFO(SERIALS_SERIALIZE()); + CHECK(SERIALS_COMPARE() == 0); +} + +TEST_CASE("Prusa_statistics test", "[prusa_stats]") +{ + SERIALS_RESET(); + setup_mockups(); + + int test_codes[] = {0,1,2,3,4,5,6,7,8,20,21,22,90,91,92,93,99}; + int size = sizeof(test_codes)/sizeof(test_codes[0]); + + for(int i = 0; i < size; i++){ + std::cout << "Testing prusa_statistics(" << std::to_string(i) << ")\n"; + + switch(i) + { + case 0: { + busy_state = 0; + PAUSED_FOR_USER = 0; + old_code::prusa_statistics(test_codes[i],0); + new_code::prusa_statistics(test_codes[i],0); + CHECK(SERIALS_COMPARE() == 0); + SERIALS_RESET(); + + busy_state = 1; + PAUSED_FOR_USER = 0; + isPrintPaused = 1; + old_code::prusa_statistics(test_codes[i],0); + new_code::prusa_statistics(test_codes[i],0); + CHECK(SERIALS_COMPARE() == 0); + SERIALS_RESET(); + + isPrintPaused = 0; + card.paused = 0; + IS_SD_PRINTING = 1; + old_code::prusa_statistics(test_codes[i],0); + new_code::prusa_statistics(test_codes[i],0); + CHECK(SERIALS_COMPARE() == 0); + SERIALS_RESET(); + + busy_state = 1; + PAUSED_FOR_USER = 0; + isPrintPaused = 0; + IS_SD_PRINTING = 0; + loading_flag = 0; + old_code::prusa_statistics(test_codes[i],0); + new_code::prusa_statistics(test_codes[i],0); + CHECK(SERIALS_COMPARE() == 0); + SERIALS_RESET(); + break; + } + case 2: { + IS_SD_PRINTING = 1; + old_code::prusa_statistics(test_codes[i],0); + new_code::prusa_statistics(test_codes[i],0); + CHECK(SERIALS_COMPARE() == 0); + SERIALS_RESET(); + + IS_SD_PRINTING = 0; + loading_flag = 0; + old_code::prusa_statistics(test_codes[i],0); + new_code::prusa_statistics(test_codes[i],0); + CHECK(SERIALS_COMPARE() == 0); + SERIALS_RESET(); + + break; + } + default:{ + + old_code::prusa_statistics(test_codes[i],0); + new_code::prusa_statistics(test_codes[i],0); + CHECK(SERIALS_COMPARE() == 0); + SERIALS_RESET(); + } + } + } } From 6b8a5bc3ac5c35ab038f7696a4c53bd09e2cd506 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 17:31:56 +0200 Subject: [PATCH 343/368] Fix compiler warnings sketch/tmc2130.cpp:146:42: warning: default argument given for parameter 1 of 'void tmc2130_init(bool)' [-fpermissive] sketch/tmc2130.cpp:146:24: warning: unused parameter 'bSupressFlag' [-Wunused-parameter] --- Firmware/tmc2130.cpp | 7 +++++-- Firmware/tmc2130.h | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index f9dee3be9..15188fc42 100755 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -142,8 +142,11 @@ uint16_t __tcoolthrs(uint8_t axis) } return 0; } - -void tmc2130_init(bool bSupressFlag=false) +#ifdef PSU_Delta +void tmc2130_init(bool bSupressFlag) +#else +void tmc2130_init() +#endif { // DBG(_n("tmc2130_init(), mode=%S\n"), tmc2130_mode?_n("STEALTH"):_n("NORMAL")); WRITE(X_TMC2130_CS, HIGH); diff --git a/Firmware/tmc2130.h b/Firmware/tmc2130.h index a1d160f05..ed4c0d7c0 100644 --- a/Firmware/tmc2130.h +++ b/Firmware/tmc2130.h @@ -51,7 +51,11 @@ typedef struct extern tmc2130_chopper_config_t tmc2130_chopper_config[4]; //initialize tmc2130 +#ifdef PSU_Delta extern void tmc2130_init(bool bSupressFlag=false); +#else +extern void tmc2130_init(); +#endif //check diag pins (called from stepper isr) extern void tmc2130_st_isr(); //update stall guard (called from st_synchronize inside the loop) From cee875fc6aef5b388c28d9244849298aa1128a7e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 17:40:28 +0200 Subject: [PATCH 344/368] Fix compiler warnings: warning: enumeration value '_None' not handled in switch [-Wswitch] warning: enumeration value '_Undef' not handled in switch [-Wswitch] --- Firmware/util.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Firmware/util.cpp b/Firmware/util.cpp index b2105e929..fc6b0f0b5 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -393,6 +393,9 @@ switch(oCheckMode) lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckMode::_None: + case ClCheckMode::_Undef: + break; } bSettings=false; // flag ('fake parameter') for 'lcd_checking_menu()' function menu_submenu(lcd_checking_menu); @@ -419,6 +422,9 @@ switch(oCheckModel) lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckModel::_None: + case ClCheckModel::_Undef: + break; } } @@ -462,6 +468,9 @@ switch(oCheckVersion) lcd_show_fullscreen_message_and_wait_P(_i("FW version doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckVersion::_None: + case ClCheckVersion::_Undef: + break; } } @@ -488,6 +497,9 @@ switch(oCheckGcode) lcd_show_fullscreen_message_and_wait_P(_i("G-code level doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckGcode::_None: + case ClCheckGcode::_Undef: + break; } } @@ -547,6 +559,9 @@ switch(oCheckModel) lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckModel::_None: + case ClCheckModel::_Undef: + break; } } From 3e292fd6b0cd61801d6e5457f78b8e72d72ccbf6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 18:16:05 +0200 Subject: [PATCH 345/368] Fix compiler warnings: sketch/Marlin.h:178:17: warning: extra tokens at end of #undef directive sketch/Marlin.h:181:24: warning: extra tokens at end of #undef directive sketch/Marlin.h:182:0: warning: "enable_z" redefined --- Firmware/Marlin.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 35cfe651d..a44346619 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -173,14 +173,14 @@ void manage_inactivity(bool ignore_stepper_queue=false); #endif #ifdef PSU_Delta -void init_force_z(); -void check_force_z(); -#undef disable_z() -#define disable_z() disable_force_z() -void disable_force_z(); -#undef enable_disable_z() -#define enable_z() enable_force_z() -void enable_force_z(); + void init_force_z(); + void check_force_z(); + #undef disable_z + #define disable_z() disable_force_z() + void disable_force_z(); + #undef enable_z + #define enable_z() enable_force_z() + void enable_force_z(); #endif // PSU_Delta From fecccf50e50f52556e1584b6f6b23bc18e3265ef Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 16:52:23 +0200 Subject: [PATCH 346/368] Remove duplicate prototypes from ultralcd.h. Make functions unreferenced outside lcd.cpp static. Disable unused functions by preprocessor to suppress warnings. --- Firmware/lcd.cpp | 69 +++++++++++++++++++++++---------------------- Firmware/ultralcd.h | 3 -- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 4df14bfbc..765a821a9 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -10,7 +10,7 @@ #include "Configuration.h" #include "pins.h" #include -//#include +#include #include "Marlin.h" #include "fastio.h" //-// @@ -78,14 +78,34 @@ uint8_t lcd_currline; uint8_t lcd_escape[8]; #endif -void lcd_pulseEnable(void) +static void lcd_display(void); + +#if 0 +static void lcd_no_display(void); +static void lcd_no_cursor(void); +static void lcd_cursor(void); +static void lcd_no_blink(void); +static void lcd_blink(void); +static void lcd_scrollDisplayLeft(void); +static void lcd_scrollDisplayRight(void); +static void lcd_leftToRight(void); +static void lcd_rightToLeft(void); +static void lcd_autoscroll(void); +static void lcd_no_autoscroll(void); +#endif + +#ifdef VT100 +void lcd_escape_write(uint8_t chr); +#endif + +static void lcd_pulseEnable(void) { WRITE(LCD_PINS_ENABLE,HIGH); _delay_us(1); // enable pulse must be >450ns WRITE(LCD_PINS_ENABLE,LOW); } -void lcd_writebits(uint8_t value) +static void lcd_writebits(uint8_t value) { #ifdef LCD_8BIT WRITE(LCD_PINS_D0, value & 0x01); @@ -101,7 +121,7 @@ void lcd_writebits(uint8_t value) lcd_pulseEnable(); } -void lcd_send(uint8_t data, uint8_t flags, uint16_t duration = LCD_DEFAULT_DELAY) +static void lcd_send(uint8_t data, uint8_t flags, uint16_t duration = LCD_DEFAULT_DELAY) { WRITE(LCD_PINS_RS,flags&LCD_RS_FLAG); _delay_us(5); @@ -116,33 +136,12 @@ void lcd_send(uint8_t data, uint8_t flags, uint16_t duration = LCD_DEFAULT_DELAY delayMicroseconds(duration); } -void lcd_command(uint8_t value, uint16_t delayExtra = 0) +static void lcd_command(uint8_t value, uint16_t delayExtra = 0) { lcd_send(value, LOW, LCD_DEFAULT_DELAY + delayExtra); } -void lcd_clear(void); -void lcd_home(void); -void lcd_no_display(void); -void lcd_display(void); -void lcd_no_cursor(void); -void lcd_cursor(void); -void lcd_no_blink(void); -void lcd_blink(void); -void lcd_scrollDisplayLeft(void); -void lcd_scrollDisplayRight(void); -void lcd_leftToRight(void); -void lcd_rightToLeft(void); -void lcd_autoscroll(void); -void lcd_no_autoscroll(void); -void lcd_set_cursor(uint8_t col, uint8_t row); -void lcd_createChar_P(uint8_t location, const uint8_t* charmap); - -#ifdef VT100 -void lcd_escape_write(uint8_t chr); -#endif - -void lcd_write(uint8_t value) +static void lcd_write(uint8_t value) { if (value == '\n' || value == '\r') { @@ -190,7 +189,7 @@ static void lcd_begin(uint8_t clear) #endif } -int lcd_putchar(char c, FILE *) +static int lcd_putchar(char c, FILE *) { lcd_write(c); } @@ -233,18 +232,19 @@ void lcd_home(void) } // Turn the display on/off (quickly) +void lcd_display(void) +{ + lcd_displaycontrol |= LCD_DISPLAYON; + lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); +} + +#if 0 void lcd_no_display(void) { lcd_displaycontrol &= ~LCD_DISPLAYON; lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); } -void lcd_display(void) -{ - lcd_displaycontrol |= LCD_DISPLAYON; - lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); -} - // Turns the underline cursor on/off void lcd_no_cursor(void) { @@ -309,6 +309,7 @@ void lcd_no_autoscroll(void) lcd_displaymode &= ~LCD_ENTRYSHIFTINCREMENT; lcd_command(LCD_ENTRYMODESET | lcd_displaymode); } +#endif void lcd_set_cursor(uint8_t col, uint8_t row) { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index cb2aad106..a8070eca6 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -7,9 +7,6 @@ #include "menu.h" #include "mesh_bed_calibration.h" -extern int lcd_puts_P(const char* str); -extern int lcd_printf_P(const char* format, ...); - extern void menu_lcd_longpress_func(void); extern void menu_lcd_charsetup_func(void); extern void menu_lcd_lcdupdate_func(void); From a54fd29fa4d27f74eb05b2be2352c11c8bf1e841 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 17:21:28 +0200 Subject: [PATCH 347/368] Fix sketch/lcd.cpp:196:1: warning: no return statement in function returning non-void [-Wreturn-type]. --- Firmware/lcd.cpp | 1 + Firmware/lcd.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 765a821a9..7376014d3 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -192,6 +192,7 @@ static void lcd_begin(uint8_t clear) static int lcd_putchar(char c, FILE *) { lcd_write(c); + return c; } void lcd_init(void) diff --git a/Firmware/lcd.h b/Firmware/lcd.h index d4d978f2c..790c0a955 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -11,7 +11,6 @@ extern FILE _lcdout; #define lcdout (&_lcdout) -extern int lcd_putchar(char c, FILE *stream); extern void lcd_init(void); From e6255e8451acfec30c363561869deac8465f0710 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 16 Jul 2019 19:18:31 +0200 Subject: [PATCH 348/368] octoprint fan error work --- Firmware/Marlin_main.cpp | 1 - Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/temperature.cpp | 9 +++++---- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6f43c7f87..35827021d 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9432,7 +9432,6 @@ void stop_and_save_print_to_ram(float z_move, float e_move) if(!saved_extruder_relative_mode){ enquecommand(PSTR("M83"), true); } - //retract 45mm/s // A single sprintf may not be faster, but is definitely 20B shorter // than a sequence of commands building the string piece by piece diff --git a/Firmware/messages.c b/Firmware/messages.c index 0a7506121..5c6cb7960 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -128,3 +128,4 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// +const char MSG_OCTOPRINT_PAUSE[] PROGMEM_N1 = "// action:pause"; //// diff --git a/Firmware/messages.h b/Firmware/messages.h index 6260e0d30..1dc4880cb 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -129,6 +129,7 @@ extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; +extern const char MSG_OCTOPRINT_PAUSE[]; #if defined(__cplusplus) } diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 536e96bfd..f9bb11f80 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -40,7 +40,7 @@ #include #include "adc.h" #include "ConfigurationStore.h" - +#include "messages.h" #include "Timer.h" #include "Configuration_prusa.h" @@ -541,18 +541,18 @@ static void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){ void fanSpeedError(unsigned char _fan) { if (get_message_level() != 0 && isPrintPaused) return; //to ensure that target temp. is not set to zero in case taht we are resuming print - if (card.sdprinting) { + if (card.sdprinting || is_usb_printing) { if (heating_status != 0) { lcd_print_stop(); } else { fan_check_error = EFCE_DETECTED; - SERIAL_ECHOLNPGM("// action:pause"); //for octoprint + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } } else { + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //for octoprint setTargetHotend0(0); - SERIAL_ECHOLNPGM("// action:pause"); //for octoprint } switch (_fan) { case 0: // extracting the same code from case 0 and case 1 into a function saves 72B @@ -562,6 +562,7 @@ void fanSpeedError(unsigned char _fan) { fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") ); break; } + SERIAL_PROTOCOLLNRPGM(MSG_OK); } #endif //(defined(TACH_0) && TACH_0 >-1) || (defined(TACH_1) && TACH_1 > -1) From 0c660a6fb1d61a496a484b916266a20993fa74f4 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 17:21:28 +0200 Subject: [PATCH 349/368] Revert "Fix sketch/lcd.cpp:196:1: warning: no return statement in function returning non-void [-Wreturn-type]." This reverts commit a54fd29fa4d27f74eb05b2be2352c11c8bf1e841. --- Firmware/lcd.cpp | 1 - Firmware/lcd.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 7376014d3..765a821a9 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -192,7 +192,6 @@ static void lcd_begin(uint8_t clear) static int lcd_putchar(char c, FILE *) { lcd_write(c); - return c; } void lcd_init(void) diff --git a/Firmware/lcd.h b/Firmware/lcd.h index 790c0a955..d4d978f2c 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -11,6 +11,7 @@ extern FILE _lcdout; #define lcdout (&_lcdout) +extern int lcd_putchar(char c, FILE *stream); extern void lcd_init(void); From 034cbff10a5c872b0cd2661f22d0fb0ccab08174 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 16 Jul 2019 20:10:49 +0200 Subject: [PATCH 350/368] GUI updates --- Firmware/eeprom.h | 61 +++++++++++++++++++++++++++---------------- Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/ultralcd.cpp | 35 +++++++++++++++---------- Firmware/ultralcd.h | 3 ++- Firmware/util.cpp | 56 ++++++++++++++++++++++++++------------- 6 files changed, 102 insertions(+), 55 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 464a1fb01..54f30ccd1 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -1,6 +1,35 @@ #ifndef EEPROM_H #define EEPROM_H +#include + +#ifdef __cplusplus +void eeprom_init(); +extern bool is_sheet_initialized(); +#endif + + +typedef struct +{ + char name[7]; //!< Can be null terminated, doesn't need to be null terminated + int16_t z_offset; //!< Z_BABYSTEP_MIN .. Z_BABYSTEP_MAX = Z_BABYSTEP_MIN*2/1000 [mm] .. Z_BABYSTEP_MAX*2/1000 [mm] + uint8_t bed_temp; //!< 0 .. 254 [°C] + uint8_t pinda_temp; //!< 0 .. 254 [°C] +} Sheet; + +typedef struct +{ + Sheet s[3]; + uint8_t active_sheet; +} Sheets; +// sizeof(Sheets). Do not change it unless EEPROM_Sheets_base is last item in EEPROM. +// Otherwise it would move following items. +#define EEPROM_SHEETS_SIZEOF 34 + +#ifdef __cplusplus +static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF."); +#endif + #define EEPROM_EMPTY_VALUE 0xFF // The total size of the EEPROM is // 4096 for the Atmega2560 @@ -171,31 +200,17 @@ #define EEPROM_CHECK_VERSION (EEPROM_CHECK_MODEL-1) // uint8 #define EEPROM_CHECK_GCODE (EEPROM_CHECK_VERSION-1) // uint8 +#define EEPROM_SHEETS_BASE (EEPROM_CHECK_GCODE - EEPROM_SHEETS_SIZEOF) // Sheets +static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE); + + +//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. +#define EEPROM_LAST_ITEM EEPROM_SHEETS_BASE // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! -//TMC2130 configuration -#define EEPROM_TMC_AXIS_SIZE //axis configuration block size -#define EEPROM_TMC_X (EEPROM_TMC + 0 * EEPROM_TMC_AXIS_SIZE) //X axis configuration blok -#define EEPROM_TMC_Y (EEPROM_TMC + 1 * EEPROM_TMC_AXIS_SIZE) //Y axis -#define EEPROM_TMC_Z (EEPROM_TMC + 2 * EEPROM_TMC_AXIS_SIZE) //Z axis -#define EEPROM_TMC_E (EEPROM_TMC + 3 * EEPROM_TMC_AXIS_SIZE) //E axis -//TMC2130 - X axis -#define EEPROM_TMC_X_USTEPS_INTPOL (EEPROM_TMC_X + 0) // 1byte, bit 0..4 USTEPS, bit 7 INTPOL -#define EEPROM_TMC_X_PWM_AMPL (EEPROM_TMC_X + 1) // 1byte (0..255) -#define EEPROM_TMC_X_PWM_GRAD_FREQ (EEPROM_TMC_X + 2) // 1byte, bit 0..3 GRAD, bit 4..5 FREQ -#define EEPROM_TMC_X_TCOOLTHRS (EEPROM_TMC_X + 3) // 2bytes (0..) -#define EEPROM_TMC_X_SG_THRS (EEPROM_TMC_X + 5) // 1byte, (-64..+63) -#define EEPROM_TMC_X_CURRENT_H (EEPROM_TMC_X + 6) // 1byte, (0..63) -#define EEPROM_TMC_X_CURRENT_R (EEPROM_TMC_X + 7) // 1byte, (0..63) -#define EEPROM_TMC_X_HOME_SG_THRS (EEPROM_TMC_X + 8) // 1byte, (-64..+63) -#define EEPROM_TMC_X_HOME_CURRENT_R (EEPROM_TMC_X + 9) // 1byte, (-64..+63) -#define EEPROM_TMC_X_HOME_DTCOOLTHRS (EEPROM_TMC_X + 10) // 1byte (-128..+127) -#define EEPROM_TMC_X_DTCOOLTHRS_LOW (EEPROM_TMC_X + 11) // 1byte (-128..+127) -#define EEPROM_TMC_X_DTCOOLTHRS_HIGH (EEPROM_TMC_X + 12) // 1byte (-128..+127) -#define EEPROM_TMC_X_SG_THRS_LOW (EEPROM_TMC_X + 13) // 1byte, (-64..+63) -#define EEPROM_TMC_X_SG_THRS_HIGH (EEPROM_TMC_X + 14) // 1byte, (-64..+63) + // Currently running firmware, each digit stored as uint16_t. // The flavor differentiates a dev, alpha, beta, release candidate or a release version. @@ -209,7 +224,9 @@ #ifdef __cplusplus #include "ConfigurationStore.h" -static M500_conf * const EEPROM_M500_base = reinterpret_cast(20); //offset for storing settings using M500 +static_assert(EEPROM_FIRMWARE_VERSION_END < 20, "Firmware version EEPROM address conflicts with EEPROM_M500_base"); +static constexpr M500_conf * const EEPROM_M500_base = reinterpret_cast(20); //offset for storing settings using M500 +static_assert(((sizeof(M500_conf) + 20) < EEPROM_LAST_ITEM), "M500_conf address space conflicts with previous items."); #endif enum diff --git a/Firmware/messages.c b/Firmware/messages.c index 53ec20e86..1a87f6b08 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -83,6 +83,7 @@ const char MSG_SELFTEST_MOTOR[] PROGMEM_I1 = ISTR("Motor"); //// const char MSG_SELFTEST_FILAMENT_SENSOR[] PROGMEM_I1 = ISTR("Filament sensor"); ////c=17 const char MSG_SELFTEST_WIRINGERROR[] PROGMEM_I1 = ISTR("Wiring error"); //// const char MSG_SETTINGS[] PROGMEM_I1 = ISTR("Settings"); //// +const char MSG_HW_SETUP[] PROGMEM_I1 = ISTR("HW Setup"); //// const char MSG_SILENT_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [high power]"); //// const char MSG_SILENT_MODE_ON[] PROGMEM_I1 = ISTR("Mode [silent]"); //// const char MSG_STEALTH_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [Normal]"); //// diff --git a/Firmware/messages.h b/Firmware/messages.h index d74412fca..9c1110b9e 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -83,6 +83,7 @@ extern const char MSG_SELFTEST_MOTOR[]; extern const char MSG_SELFTEST_FILAMENT_SENSOR[]; extern const char MSG_SELFTEST_WIRINGERROR[]; extern const char MSG_SETTINGS[]; +extern const char MSG_HW_SETUP[]; extern const char MSG_SILENT_MODE_OFF[]; extern const char MSG_SILENT_MODE_ON[]; extern const char MSG_STEALTH_MODE_OFF[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 35ce0f63a..76b4e04dd 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -307,7 +307,7 @@ bool wait_for_unclick; #endif bool bMain; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function -bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_checkink_menu()' function +bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function @@ -5489,18 +5489,27 @@ do\ }\ while (0) -//-//static void lcd_checking_menu() -void lcd_checking_menu() +static void lcd_checking_menu(void) { MENU_BEGIN(); -MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch -SETTINGS_NOZZLE; -MENU_ITEM_TEXT_P(STR_SEPARATOR); -MENU_ITEM_TEXT_P(_i("Checks:")); +MENU_ITEM_BACK_P(_T(MSG_HW_SETUP)); SETTINGS_MODE; SETTINGS_MODEL; SETTINGS_VERSION; -SETTINGS_GCODE; +//-// temporarily disabled +//SETTINGS_GCODE; +MENU_END(); +} + +void lcd_hw_setup_menu(void) // can not be "static" +{ +MENU_BEGIN(); +MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch +if(!farm_mode) + SETTINGS_NOZZLE; +// ... a sem prijdou 'plechy' +if(!farm_mode) + MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu); MENU_END(); } @@ -5528,6 +5537,10 @@ static void lcd_settings_menu() MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1 SETTINGS_SILENT_MODE; + + bSettings=true; // flag ('fake parameter') for 'lcd_hw_setup_menu()' function + MENU_ITEM_SUBMENU_P(_i("HW Setup"), lcd_hw_setup_menu);////MSG_HW_SETUP + SETTINGS_MMU_MODE; MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_MBL_SETTINGS c=18 r=1 @@ -5555,12 +5568,6 @@ static void lcd_settings_menu() MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT #endif //(LANG_MODE != 0) - if (!farm_mode) - { - bSettings=true; // flag ('fake parameter') for 'lcd_checking_menu()' function - MENU_ITEM_SUBMENU_P(_i("Print checking"), lcd_checking_menu); - } - SETTINGS_SD; SETTINGS_SOUND; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index a4abd1068..1760c3c17 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -137,7 +137,8 @@ void lcd_ignore_click(bool b=true); void lcd_commands(); -extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_checkink_menu()' function +extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function +void lcd_hw_setup_menu(void); // NOT static due to using inside "util" module ("nozzle_diameter_check()") void change_extr(int extr); diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 490f2897d..f8ad87d42 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -330,7 +330,7 @@ void update_current_firmware_version_to_eeprom() //-// -void lcd_checking_menu(void); +#define MSG_PRINT_CHECKING_FAILED_TIMEOUT 30 ClNozzleDiameter oNozzleDiameter=ClNozzleDiameter::_Diameter_400; ClCheckMode oCheckMode=ClCheckMode::_None; @@ -385,7 +385,7 @@ nDiameter_um=eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM); if(nDiameter==nDiameter_um) return; //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("Nozzle diameter doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer nozzle diameter differs from the G-code ..."); //SERIAL_ECHOPGM("actual : "); //SERIAL_ECHOLN((float)(nDiameter_um/1000.0)); //SERIAL_ECHOPGM("expected: "); @@ -393,15 +393,19 @@ if(nDiameter==nDiameter_um) switch(oCheckMode) { case ClCheckMode::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer nozzle diameter differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer nozzle diameter differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckMode::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer nozzle diameter differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; } -bSettings=false; // flag ('fake parameter') for 'lcd_checking_menu()' function -menu_submenu(lcd_checking_menu); +bSettings=false; // flag ('fake parameter') for 'lcd_hw_setup_menu()' function +menu_submenu(lcd_hw_setup_menu); } void printer_model_check(uint16_t nPrinterModel) @@ -411,7 +415,7 @@ if(oCheckModel==ClCheckModel::_None) if(nPrinterModel==nPrinterType) return; //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("Printer model doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer model differs from the G-code ..."); //SERIAL_ECHOPGM("actual : "); //SERIAL_ECHOLN(nPrinterType); //SERIAL_ECHOPGM("expected: "); @@ -419,10 +423,14 @@ if(nPrinterModel==nPrinterType) switch(oCheckModel) { case ClCheckModel::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer model differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckModel::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; } @@ -454,7 +462,7 @@ if(nCompareValueResult==COMPARE_VALUE_EQUAL) if((nCompareValueResult Date: Tue, 16 Jul 2019 21:11:27 +0300 Subject: [PATCH 351/368] Fix status screen --- Firmware/lcd.cpp | 2 +- Firmware/lcd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 765a821a9..b2f90c6cd 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -189,7 +189,7 @@ static void lcd_begin(uint8_t clear) #endif } -static int lcd_putchar(char c, FILE *) +static void lcd_putchar(char c, FILE *) { lcd_write(c); } diff --git a/Firmware/lcd.h b/Firmware/lcd.h index d4d978f2c..307e9486c 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -11,7 +11,7 @@ extern FILE _lcdout; #define lcdout (&_lcdout) -extern int lcd_putchar(char c, FILE *stream); +extern void lcd_putchar(char c, FILE *stream); extern void lcd_init(void); From 1c44eddf8169fb36a3018247a1aa8107b84d5c8a Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 17 Jul 2019 12:32:27 +0200 Subject: [PATCH 352/368] crash and filament unload sound change --- Firmware/sound.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Firmware/sound.cpp b/Firmware/sound.cpp index 7b965a2d2..b01285a5f 100644 --- a/Firmware/sound.cpp +++ b/Firmware/sound.cpp @@ -61,17 +61,18 @@ switch(eSoundMode) Sound_SaveMode(); } +//if critical is true then silend and once mode is ignored void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ if (!critical){ if (eSoundMode != e_SOUND_MODE_SILENT){ if(!tone_){ WRITE(BEEPER, HIGH); - delayMicroseconds(ms); + _delay(ms); WRITE(BEEPER, LOW); } else{ _tone(BEEPER, tone_); - delayMicroseconds(ms); + _delay(ms); _noTone(BEEPER); } } @@ -79,13 +80,13 @@ void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ else{ if(!tone_){ WRITE(BEEPER, HIGH); - delayMicroseconds(ms); + _delay(ms); WRITE(BEEPER, LOW); - delayMicroseconds(100); + _delay(ms); } else{ _tone(BEEPER, tone_); - delayMicroseconds(ms); + _delay(ms); _noTone(BEEPER); } } @@ -134,10 +135,10 @@ switch(eSoundMode) static void Sound_DoSound_Blind_Alert(void) { - _tone(BEEPER,100); - delayMicroseconds(50); + _tone(BEEPER,300); + _delay_ms(75); _noTone(BEEPER); - delayMicroseconds(200); + _delay_ms(75); } static void Sound_DoSound_Encoder_Move(void) @@ -169,7 +170,7 @@ for(nI=0;nI<10;nI++) static void Sound_DoSound_Prompt(void) { WRITE(BEEPER,HIGH); -delayMicroseconds(500); +_delay_ms(500); WRITE(BEEPER,LOW); } From b8fec59f216a020c0e28dcdfe06f75d891ea6c68 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 17 Jul 2019 19:59:31 +0200 Subject: [PATCH 353/368] octoprint fan error fix --- Firmware/Marlin_main.cpp | 11 +++++++++-- Firmware/temperature.cpp | 3 ++- Firmware/ultralcd.cpp | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 35827021d..e536df96d 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3393,8 +3393,15 @@ void process_commands() if (fan_check_error){ if( fan_check_error == EFCE_DETECTED ){ fan_check_error = EFCE_REPORTED; - lcd_pause_print(); - } // otherwise it has already been reported, so just ignore further processing + + if(is_usb_printing){ + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); + } + else{ + lcd_pause_print(); + } + + } // otherwise it has already been reported, so just ignore further processing return; } #endif diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index f9bb11f80..1ef855492 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -524,6 +524,8 @@ void checkFanSpeed() fan_speed_errors[1] = 0; fanSpeedError(1); //print fan } + + SERIAL_PROTOCOLLNRPGM(MSG_OK); //for octoprint } //! Prints serialMsg to serial port, displays lcdMsg onto the LCD and beeps. @@ -547,7 +549,6 @@ void fanSpeedError(unsigned char _fan) { } else { fan_check_error = EFCE_DETECTED; - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e87908867..c70fe8fc2 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1658,6 +1658,7 @@ void lcd_pause_print() { lcd_commands_type = LcdCommands::LongPause; } + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint } From 121e60655af40e2abee8ede37146f00c55682923 Mon Sep 17 00:00:00 2001 From: leptun Date: Thu, 18 Jul 2019 10:14:03 +0300 Subject: [PATCH 354/368] Fix lcd not initing after WDT reset --- Firmware/lcd.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index b2f90c6cd..1f4e6e2f4 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -196,8 +196,21 @@ static void lcd_putchar(char c, FILE *) void lcd_init(void) { + WRITE(LCD_PINS_ENABLE,LOW); SET_OUTPUT(LCD_PINS_RS); SET_OUTPUT(LCD_PINS_ENABLE); + +#ifdef LCD_8BIT + SET_OUTPUT(LCD_PINS_D0); + SET_OUTPUT(LCD_PINS_D1); + SET_OUTPUT(LCD_PINS_D2); + SET_OUTPUT(LCD_PINS_D3); +#endif + SET_OUTPUT(LCD_PINS_D4); + SET_OUTPUT(LCD_PINS_D5); + SET_OUTPUT(LCD_PINS_D6); + SET_OUTPUT(LCD_PINS_D7); + #ifdef LCD_8BIT lcd_displayfunction |= LCD_8BITMODE; #endif From 03e80ce4a8eac8855050f967ce8b675732cd5741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BChn?= Date: Thu, 18 Jul 2019 16:50:44 +0200 Subject: [PATCH 355/368] PFW-917 Adjust Z value persists across update to v3.8 --- Firmware/eeprom.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 1be708d00..f2d897165 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -71,6 +71,12 @@ void eeprom_init() } if(is_uninitialized) { + // When upgrading from version older version (before multiple sheets were implemented in v3.8.0) + // Sheet 1 uses the previous Live adjust Z (@EEPROM_BABYSTEP_Z) + if(i == 0){ + int last_babystep = eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z); + eeprom_write_word(reinterpret_cast(&(EEPROM_Sheets_base->s[i].z_offset)), last_babystep); + } eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast(i + '1')); eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); } From 94e79806bce1c73bae384b6b25ecd64585078bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BChn?= Date: Fri, 19 Jul 2019 13:51:55 +0200 Subject: [PATCH 356/368] Updated doxygen docs to work better with confluence. --- Firmware/Marlin_main.cpp | 936 +++++++++++++++++++++++++++++++-------- Firmware/doxyfile | 2 +- 2 files changed, 763 insertions(+), 175 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 8ac1aaf54..0415b2bfa 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3256,14 +3256,19 @@ extern uint8_t st_backlash_x; extern uint8_t st_backlash_y; #endif //BACKLASH_Y +//! \ingroup marlin_main + //! @brief Parse and process commands //! //! look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html //! http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes //! -//! Implemented Codes +//! +//! Implemented Codes //! ------------------- //! +//! * _This list is not updated. Current documentation is maintained inside the process_cmd function._ +//! //!@n PRUSA CODES //!@n P F - Returns FW versions //!@n P R - Returns revision of printer @@ -3386,6 +3391,15 @@ extern uint8_t st_backlash_y; //! //!@n M928 - Start SD logging (M928 filename.g) - ended by M29 //!@n M999 - Restart after being stopped by error +//!

+ +/** @defgroup marlin_main Marlin main */ + +/** \ingroup GCodes */ + +//! _This is a list of currently implemented G Codes in Prusa firmware (dynamically generated from doxygen)_ + + void process_commands() { #ifdef FANCHECK @@ -3444,21 +3458,33 @@ void process_commands() #ifdef TMC2130 else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("CRASH_"), 6) == 0) { - if(code_seen("CRASH_DETECTED")) //! CRASH_DETECTED + + //! ### CRASH_DETECTED - TMC2130 + // --------------------------------- + if(code_seen("CRASH_DETECTED")) { uint8_t mask = 0; if (code_seen('X')) mask |= X_AXIS_MASK; if (code_seen('Y')) mask |= Y_AXIS_MASK; crashdet_detected(mask); } - else if(code_seen("CRASH_RECOVER")) //! CRASH_RECOVER + + //! ### CRASH_RECOVER - TMC2130 + // ---------------------------------- + else if(code_seen("CRASH_RECOVER")) crashdet_recover(); - else if(code_seen("CRASH_CANCEL")) //! CRASH_CANCEL + + //! ### CRASH_CANCEL - TMC2130 + // ---------------------------------- + else if(code_seen("CRASH_CANCEL")) crashdet_cancel(); } else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("TMC_"), 4) == 0) { - if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0) //! TMC_SET_WAVE_ + + //! ### TMC_SET_WAVE_ + // -------------------- + if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0) { uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13); axis = (axis == 'E')?3:(axis - 'X'); @@ -3468,7 +3494,10 @@ void process_commands() tmc2130_set_wave(axis, 247, fac); } } - else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0) //! TMC_SET_STEP_ + + //! ### TMC_SET_STEP_ + // ------------------ + else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0) { uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13); axis = (axis == 'E')?3:(axis - 'X'); @@ -3479,7 +3508,10 @@ void process_commands() tmc2130_goto_step(axis, step & (4*res - 1), 2, 1000, res); } } - else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0) //! TMC_SET_CHOP_ + + //! ### TMC_SET_CHOP_ + // ------------------- + else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0) { uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13); axis = (axis == 'E')?3:(axis - 'X'); @@ -3530,19 +3562,50 @@ void process_commands() } #endif //BACKLASH_Y #endif //TMC2130 - else if(code_seen("PRUSA")){ - if (code_seen("Ping")) { //! PRUSA Ping + else if(code_seen("PRUSA")){ + /*! + * + ### PRUSA - Internal command set + + Set of internal PRUSA commands + + PRUSA [ Ping | PRN | FAN | fn | thx | uvlo | fsensor_recover | MMURES | RESET | fv | M28 | SN | Fir | Rev | Lang | Lz | Beat | FR ] + + - `Ping` + - `PRN` - Prints revision of the printer + - `FAN` - Prints fan details + - `fn` - Prints farm no. + - `thx` + - `uvlo` + - `fsensor_recover` - Filament sensor recover - restore print and continue + - `MMURES` - Reset MMU + - `RESET` - (Careful!) + - `fv` - ? + - `M28` + - `SN` + - `Fir` - Prints firmware version + - `Rev`- Prints filament size, elelectronics, nozzle type + - `Lang` - Reset the language + - `Lz` + - `Beat` - Kick farm link timer + - `FR` - Full factory reset + - `nozzle D G1 case 1: // G1 if(Stopped == false) { @@ -3907,19 +3973,30 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) //ClearToSend(); } break; - case 2: // G2 - CW ARC + + //! ### G2 - CW ARC + // ------------------------------ + case 2: if(Stopped == false) { get_arc_coordinates(); prepare_arc_move(true); } break; - case 3: // G3 - CCW ARC + + + //! ### G3 - CCW ARC + // ------------------------------- + case 3: if(Stopped == false) { get_arc_coordinates(); prepare_arc_move(false); } break; - case 4: // G4 dwell + + + //! ### G4 - Dwell + // ------------------------------- + case 4: codenum = 0; if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait @@ -3934,7 +4011,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; #ifdef FWRETRACT - case 10: // G10 retract + + + //! ### G10 Retract + // ------------------------------ + case 10: #if EXTRUDERS > 1 retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument retract(true,retracted_swap[active_extruder]); @@ -3942,7 +4023,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) retract(true); #endif break; - case 11: // G11 retract_recover + + + //! ### G11 - Retract recover + // ----------------------------- + case 11: #if EXTRUDERS > 1 retract(false,retracted_swap[active_extruder]); #else @@ -3950,7 +4035,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) #endif break; #endif //FWRETRACT - case 28: //G28 Home all Axis one at a time + + + //! ### G28 - Home all Axis one at a time + // -------------------------------------------- + case 28: { long home_x_value = 0; long home_y_value = 0; @@ -3977,8 +4066,13 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; } + #ifdef ENABLE_AUTO_BED_LEVELING - case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points. + + + //! ### G29 - Detailed Z-Probe + // -------------------------------- + case 29: { #if Z_MIN_PIN == -1 #error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature! Z_MIN_PIN must point to a valid hardware pin." @@ -4121,7 +4215,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; #ifndef Z_PROBE_SLED - case 30: // G30 Single Z Probe + + //! ### G30 - Single Z Probe + // ------------------------------------ + case 30: { st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly @@ -4143,17 +4240,27 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; #else - case 31: // dock the sled + + //! ### G31 - Dock the sled + // --------------------------- + case 31: dock_sled(true); break; - case 32: // undock the sled + + + //! ### G32 - Undock the sled + // ---------------------------- + case 32: dock_sled(false); break; #endif // Z_PROBE_SLED #endif // ENABLE_AUTO_BED_LEVELING #ifdef MESH_BED_LEVELING - case 30: // G30 Single Z Probe + + //! ### G30 - Single Z Probe + // ---------------------------- + case 30: { st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly @@ -4169,7 +4276,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - + //! ### G75 - Print temperature interpolation + // --------------------------------------------- case 75: { for (int i = 40; i <= 110; i++) @@ -4177,7 +4285,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - case 76: //! G76 - PINDA probe temperature calibration + //! ### G76 - PINDA probe temperature calibration + // ------------------------------------------------ + case 76: { #ifdef PINDA_THERMISTOR if (true) @@ -4434,18 +4544,16 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; - - /** - * G80: Mesh-based Z probe, probes a grid and produces a - * mesh to compensate for variable bed height - * + //! ### G80 - Mesh-based Z probe + // ----------------------------------- + + /* + * Probes a grid and produces a mesh to compensate for variable bed height * The S0 report the points as below - * @code{.unparsed} * +----> X-axis * | * | * v Y-axis - * @endcode */ case 80: @@ -4869,8 +4977,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - /** - * G81: Print mesh bed leveling status and bed profile if activated + //! ### G81 - Mesh bed leveling status + // ----------------------------------------- + + /* + * Prints mesh bed leveling status and bed profile if activated */ case 81: if (mbl.active) { @@ -4894,7 +5005,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; #if 0 - /** + /* * G82: Single Z probe at current location * * WARNING! USE WITH CAUTION! If you'll try to probe where is no leveling pad, nasty things can happen! @@ -4910,7 +5021,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) SERIAL_PROTOCOLPGM("\n"); break; - /** + /* * G83: Prusa3D specific: Babystep in Z and store to EEPROM */ case 83: @@ -4935,7 +5046,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - /** + /* * G84: Prusa3D specific: UNDO Babystep Z (move Z axis back) */ case 84: @@ -4943,7 +5054,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) // babystepLoadZ = 0; break; - /** + /* * G85: Prusa3D specific: Pick best babystep */ case 85: @@ -4951,38 +5062,58 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; #endif - /** - * G86: Prusa3D specific: Disable babystep correction after home. - * This G-code will be performed at the start of a calibration script. - */ + /** + * ### G86 - Disable babystep correction after home + * + * This G-code will be performed at the start of a calibration script. + * (Prusa3D specific) + */ case 86: calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); break; - /** - * G87: Prusa3D specific: Enable babystep correction after home - * This G-code will be performed at the end of a calibration script. - */ + + + /** + * ### G87 - Enable babystep correction after home + * + * + * This G-code will be performed at the end of a calibration script. + * (Prusa3D specific) + */ case 87: calibration_status_store(CALIBRATION_STATUS_CALIBRATED); break; - /** - * G88: Prusa3D specific: Don't know what it is for, it is in V2Calibration.gcode - */ + + /** + * ### G88 - Reserved + * + * Currently has no effect. + */ + + // Prusa3D specific: Don't know what it is for, it is in V2Calibration.gcode + case 88: break; #endif // ENABLE_MESH_BED_LEVELING - - case 90: // G90 + //! ### G90 - Switch off relative mode + // ------------------------------- + case 90: relative_mode = false; break; - case 91: // G91 + + //! ### G91 - Switch on relative mode + // ------------------------------- + case 91: relative_mode = true; break; - case 92: // G92 + + //! ### G92 - Set position + // ----------------------------- + case 92: if(!code_seen(axis_codes[E_AXIS])) st_synchronize(); for(int8_t i=0; i < NUM_AXIS; i++) { @@ -4999,7 +5130,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - case 98: //! G98 (activate farm mode) + + //! ### G98 - Activate farm mode + // ----------------------------------- + case 98: farm_mode = 1; PingTime = _millis(); eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode); @@ -5009,7 +5143,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) fCheckModeInit(); // alternatively invoke printer reset break; - case 99: //! G99 (deactivate farm mode) + //! ### G99 - Deactivate farm mode + // ------------------------------------- + case 99: farm_mode = 0; lcd_printer_connected(); eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode); @@ -5023,6 +5159,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) gcode_in_progress = 0; } // end if(code_seen('G')) + + //! --------------------------------------------------------------------------------- + else if(code_seen('M')) { @@ -5041,6 +5180,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) switch(mcode_in_progress) { + //! ### M0, M1 - Stop the printer + // --------------------------------------------------------------- case 0: // M0 - Unconditional stop - Wait for user button press on LCD case 1: // M1 - Conditional stop - Wait for user button press on LCD { @@ -5088,6 +5229,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) LCD_MESSAGERPGM(_T(WELCOME_MSG)); } break; + + //! ### M17 - Enable axes + // --------------------------------- case 17: LCD_MESSAGERPGM(_i("No move."));////MSG_NO_MOVE enable_x(); @@ -5099,44 +5243,68 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; #ifdef SDSUPPORT - case 20: // M20 - list SD card + + //! ### M20 - SD Card file list + // ----------------------------------- + case 20: SERIAL_PROTOCOLLNRPGM(_N("Begin file list"));////MSG_BEGIN_FILE_LIST card.ls(); SERIAL_PROTOCOLLNRPGM(_N("End file list"));////MSG_END_FILE_LIST break; - case 21: // M21 - init SD card + //! ### M21 - Init SD card + // ------------------------------------ + case 21: card.initsd(); - break; - case 22: //M22 - release SD card + + //! ### M22 - Release SD card + // ----------------------------------- + case 22: card.release(); - break; - case 23: //M23 - Select file + + //! ### M23 - Select file + // ----------------------------------- + case 23: starpos = (strchr(strchr_pointer + 4,'*')); if(starpos!=NULL) *(starpos)='\0'; card.openFile(strchr_pointer + 4,true); break; - case 24: //M24 - Start SD print + + //! ### M24 - Start SD print + // ---------------------------------- + case 24: if (!card.paused) failstats_reset_print(); card.startFileprint(); starttime=_millis(); break; - case 25: //M25 - Pause SD print + + //! ### M25 - Pause SD print + // ---------------------------------- + case 25: card.pauseSDPrint(); break; - case 26: //M26 - Set SD index + + //! ### M26 - Set SD index + // ---------------------------------- + case 26: if(card.cardOK && code_seen('S')) { card.setIndex(code_value_long()); } break; - case 27: //M27 - Get SD status + + //! ### M27 - Get SD status + // ---------------------------------- + case 27: card.getStatus(); break; - case 28: //M28 - Start SD write + + //! ### M28 - Start SD write + // --------------------------------- + case 28: starpos = (strchr(strchr_pointer + 4,'*')); if(starpos != NULL){ char* npos = strchr(CMDBUFFER_CURRENT_STRING, 'N'); @@ -5145,11 +5313,18 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } card.openFile(strchr_pointer+4,false); break; - case 29: //M29 - Stop SD write + + //! ### M29 - Stop SD write + // ------------------------------------- + //! Currently has no effect. + case 29: //processed in write to file routine above //card,saving = false; break; - case 30: //M30 Delete File + + //! ### M30 - Delete file + // ---------------------------------- + case 30: if (card.cardOK){ card.closefile(); starpos = (strchr(strchr_pointer + 4,'*')); @@ -5161,7 +5336,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) card.removeFile(strchr_pointer + 4); } break; - case 32: //M32 - Select file and start SD print + + //! ### M32 - Select file and start SD print + // ------------------------------------ + case 32: { if(card.sdprinting) { st_synchronize(); @@ -5196,7 +5374,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) starttime=_millis(); //procedure calls count as normal print time. } } break; - case 928: //M928 - Start SD write + + //! ### M982 - Start SD write + // --------------------------------- + case 928: starpos = (strchr(strchr_pointer + 5,'*')); if(starpos != NULL){ char* npos = strchr(CMDBUFFER_CURRENT_STRING, 'N'); @@ -5208,6 +5389,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) #endif //SDSUPPORT + //! ### M31 - Report current print time + // -------------------------------------------------- case 31: //M31 take time since the start of the SD print or an M109 command { stoptime=_millis(); @@ -5223,7 +5406,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) autotempShutdown(); } break; - case 42: //M42 -Change pin status via gcode + + //! ### M42 - Set pin state + // ----------------------------- + case 42: if (code_seen('S')) { int pin_status = code_value(); @@ -5250,7 +5436,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } } break; - case 44: //! M44: Prusa3D: Reset the bed skew and offset calibration. + + + //! ### M44 - Reset the bed skew and offset calibration (Prusa specific) + // -------------------------------------------------------------------- + case 44: // M44: Prusa3D: Reset the bed skew and offset calibration. // Reset the baby step value and the baby step applied flag. calibration_status_store(CALIBRATION_STATUS_ASSEMBLED); @@ -5264,7 +5454,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) world2machine_revert_to_uncorrected(); break; - case 45: //! M45: Prusa3D: bed skew and offset with manual Z up + //! ### M45 - Bed skew and offset with manual Z up (Prusa specific) + // ------------------------------------------------------ + case 45: // M45: Prusa3D: bed skew and offset with manual Z up { int8_t verbosity_level = 0; bool only_Z = code_seen('Z'); @@ -5303,15 +5495,17 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } */ + //! ### M47 - Show end stops dialog on the display (Prusa specific) + // ---------------------------------------------------- case 47: - //! M47: Prusa3D: Show end stops dialog on the display. + KEEPALIVE_STATE(PAUSED_FOR_USER); lcd_diag_show_end_stops(); KEEPALIVE_STATE(IN_HANDLER); break; #if 0 - case 48: //! M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC. + case 48: // M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC. { // Disable the default update procedure of the display. We will do a modal dialog. lcd_update_enable(false); @@ -5349,11 +5543,15 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) #ifdef ENABLE_AUTO_BED_LEVELING #ifdef Z_PROBE_REPEATABILITY_TEST - //! M48 Z-Probe repeatability measurement function. + + //! ### M48 - Z-Probe repeatability measurement function. + // ------------------------------------------------------ //! - //! Usage: M48 - //! - //! This function assumes the bed has been homed. Specificaly, that a G28 command + //! _Usage:_ + //! + //! M48 + //! + //! This function assumes the bed has been homed. Specifically, that a G28 command //! as been issued prior to invoking the M48 Z-Probe repeatability measurement function. //! Any information generated by a prior G29 Bed leveling command will be lost and need to be //! regenerated. @@ -5599,6 +5797,13 @@ Sigma_Exit: } #endif // Z_PROBE_REPEATABILITY_TEST #endif // ENABLE_AUTO_BED_LEVELING + + //! ### M73 - Set/get print progress + // ------------------------------------- + //! _Usage:_ + //! + //! M73 P R Q S + //! case 73: //M73 show percent done and time remaining if(code_seen('P')) print_percent_done_normal = code_value(); if(code_seen('R')) print_time_remaining_normal = code_value(); @@ -5612,6 +5817,8 @@ Sigma_Exit: } break; + //! ### M104 - Set hotend temperature + // ----------------------------------------- case 104: // M104 { uint8_t extruder; @@ -5625,13 +5832,22 @@ Sigma_Exit: setWatch(); break; } - case 112: // M112 -Emergency Stop + + //! ### M112 - Emergency stop + // ----------------------------------------- + case 112: kill(_n(""), 3); break; - case 140: // M140 set bed temp + + //! ### M140 - Set bed temperature + // ----------------------------------------- + case 140: if (code_seen('S')) setTargetBed(code_value()); break; - case 105 : // M105 + + //! ### M105 - Report temperatures + // ----------------------------------------- + case 105: { uint8_t extruder; if(setTargetedHotend(105, extruder)){ @@ -5725,8 +5941,11 @@ Sigma_Exit: return; break; } + + //! ### M109 - Wait for extruder temperature + // ------------------------------------------------- case 109: - {// M109 - Wait for extruder heater to reach target. + { uint8_t extruder; if(setTargetedHotend(109, extruder)){ break; @@ -5776,7 +5995,10 @@ Sigma_Exit: previous_millis_cmd = _millis(); } break; - case 190: // M190 - Wait for bed heater to reach target. + + //! ### M190 - Wait for bed temperature + // --------------------------------------- + case 190: #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 LCD_MESSAGERPGM(_T(MSG_BED_HEATING)); heating_status = 3; @@ -5827,7 +6049,10 @@ Sigma_Exit: break; #if defined(FAN_PIN) && FAN_PIN > -1 - case 106: //!M106 Sxxx Fan On S 0 .. 255 + + //! ### M106 - Set fan speed + // ------------------------------------------- + case 106: // M106 Sxxx Fan On S 0 .. 255 if (code_seen('S')){ fanSpeed=constrain(code_value(),0,255); } @@ -5835,13 +6060,19 @@ Sigma_Exit: fanSpeed=255; } break; - case 107: //M107 Fan Off + + //! ### M107 - Fan off + // ------------------------------- + case 107: fanSpeed = 0; break; #endif //FAN_PIN #if defined(PS_ON_PIN) && PS_ON_PIN > -1 - case 80: // M80 - Turn on Power Supply + + //! ### M80 - Turn on the Power Supply + // ------------------------------- + case 80: SET_OUTPUT(PS_ON_PIN); //GND WRITE(PS_ON_PIN, PS_ON_AWAKE); @@ -5859,7 +6090,9 @@ Sigma_Exit: break; #endif - case 81: // M81 - Turn off Power Supply + //! ### M81 - Turn off Power Supply + // -------------------------------------- + case 81: disable_heater(); st_synchronize(); disable_e0(); @@ -5880,12 +6113,24 @@ Sigma_Exit: lcd_update(0); break; + //! ### M82 - Set E axis to absolute mode + // --------------------------------------- case 82: axis_relative_modes[3] = false; break; + + //! ### M83 - Set E axis to relative mode + // --------------------------------------- case 83: axis_relative_modes[3] = true; break; + + //! ### M84, M18 - Disable steppers + //--------------------------------------- + //! This command can be used to set the stepper inactivity timeout (`S`) or to disable steppers (`X`,`Y`,`Z`,`E`) + //! + //! M84 [E] [S] [X] [Y] [Z] + //! case 18: //compatibility case 84: // M84 if(code_seen('S')){ @@ -5921,21 +6166,35 @@ Sigma_Exit: print_time_remaining_init(); snmm_filaments_used = 0; break; + + //! ### M85 - Set max inactive time + // --------------------------------------- case 85: // M85 if(code_seen('S')) { max_inactive_time = code_value() * 1000; } break; #ifdef SAFETYTIMER - case 86: // M86 - set safety timer expiration time in seconds; M86 S0 will disable safety timer - //when safety timer expires heatbed and nozzle target temperatures are set to zero + + //! ### M86 - Set safety timer expiration time + //! + //! _Usage:_ + //! M86 S + //! + //! Sets the safety timer expiration time in seconds. M86 S0 will disable safety timer. + //! When safety timer expires, heatbed and nozzle target temperatures are set to zero. + case 86: if (code_seen('S')) { safetytimer_inactive_time = code_value() * 1000; safetyTimer.start(); } break; #endif - case 92: // M92 + + //! ### M92 Set Axis steps-per-unit + // --------------------------------------- + //! Same syntax as G92 + case 92: for(int8_t i=0; i < NUM_AXIS; i++) { if(code_seen(axis_codes[i])) @@ -5956,11 +6215,17 @@ Sigma_Exit: } } break; - case 110: //! M110 N - reset line pos + + //! ### M110 - Set Line number + // --------------------------------------- + case 110: if (code_seen('N')) gcode_LastN = code_value_long(); break; - case 113: // M113 - Get or set Host Keepalive interval + + //! ### M113 - Get or set host keep-alive interval + // ------------------------------------------ + case 113: if (code_seen('S')) { host_keepalive_interval = (uint8_t)code_value_short(); // NOMORE(host_keepalive_interval, 60); @@ -5971,6 +6236,16 @@ Sigma_Exit: SERIAL_PROTOCOLLN(""); } break; + + //! ### M115 - Firmware info + // -------------------------------------- + //! Print the firmware info and capabilities + //! + //! M115 [V] [U] + //! + //! Without any arguments, prints Prusa firmware version number, machine type, extruder count and UUID. + //! `M115 U` Checks the firmware version provided. If the firmware version provided by the U code is higher than the currently running firmware, + //! pause the print for 30s and ask the user to upgrade the firmware. case 115: // M115 if (code_seen('V')) { // Report the Prusa version number. @@ -5992,22 +6267,43 @@ Sigma_Exit: SERIAL_ECHOLNPGM(MACHINE_UUID); } break; -/* case 117: // M117 display message + + //! ### M114 - Get current position + // ------------------------------------- + case 114: + gcode_M114(); + break; + + + + //! ### M117 - Set LCD Message + // -------------------------------------- + + /* + M117 moved up to get the high priority + + case 117: // M117 display message starpos = (strchr(strchr_pointer + 5,'*')); if(starpos!=NULL) *(starpos)='\0'; lcd_setstatus(strchr_pointer + 5); break;*/ - case 114: // M114 - gcode_M114(); - break; - case 120: //! M120 - Disable endstops + + //! ### M120 - Disable endstops + // ---------------------------------------- + case 120: enable_endstops(false) ; break; - case 121: //! M121 - Enable endstops + + //! ### M121 - Enable endstops + // ---------------------------------------- + case 121: enable_endstops(true) ; break; - case 119: // M119 + + //! ### M119 - Get endstop states + // ---------------------------------------- + case 119: SERIAL_PROTOCOLRPGM(_N("Reporting endstop status"));////MSG_M119_REPORT SERIAL_PROTOCOLLN(""); #if defined(X_MIN_PIN) && X_MIN_PIN > -1 @@ -6066,8 +6362,12 @@ Sigma_Exit: #endif break; //TODO: update for all axis, use for loop + #ifdef BLINKM - case 150: // M150 + + //! ### M150 - Set RGB(W) Color + // ------------------------------------------- + case 150: { byte red; byte grn; @@ -6081,6 +6381,9 @@ Sigma_Exit: } break; #endif //BLINKM + + //! ### M200 - Set filament diameter + // ---------------------------------------- case 200: // M200 D set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters). { @@ -6119,7 +6422,10 @@ Sigma_Exit: calculate_extruder_multipliers(); } break; - case 201: // M201 + + //! ### M201 - Set Print Max Acceleration + // ------------------------------------------- + case 201: for (int8_t i = 0; i < NUM_AXIS; i++) { if (code_seen(axis_codes[i])) @@ -6151,6 +6457,9 @@ Sigma_Exit: } break; #endif + + //! ### M203 - Set Max Feedrate + // --------------------------------------- case 203: // M203 max feedrate mm/sec for (int8_t i = 0; i < NUM_AXIS; i++) { @@ -6174,10 +6483,17 @@ Sigma_Exit: } } break; + + //! ### M204 - Acceleration settings + // ------------------------------------------ + //! Supporting old format: + //! + //! M204 S[normal moves] T[filmanent only moves] + //! + //! and new format: + //! + //! M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored) case 204: - //! M204 acclereration settings. - //!@n Supporting old format: M204 S[normal moves] T[filmanent only moves] - //!@n and new format: M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored) { if(code_seen('S')) { // Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware, @@ -6201,7 +6517,19 @@ Sigma_Exit: } } break; - case 205: //M205 advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk + + //! ### M205 - Set advanced settings + // --------------------------------------------- + //! Set some advanced settings related to movement. + //! + //! M205 [S] [T] [B] [X] [Y] [Z] [E] + /*! + - `S` - Minimum feedrate for print moves (unit/s) + - `T` - Minimum feedrate for travel moves (units/s) + - `B` - Minimum segment time (us) + - `X` - Maximum X jerk (units/s), similarly for other axes + */ + case 205: { if(code_seen('S')) cs.minimumfeedrate = code_value(); if(code_seen('T')) cs.mintravelfeedrate = code_value(); @@ -6214,13 +6542,19 @@ Sigma_Exit: if (cs.max_jerk[Y_AXIS] > DEFAULT_YJERK) cs.max_jerk[Y_AXIS] = DEFAULT_YJERK; } break; - case 206: // M206 additional homing offset + + //! ### M206 - Set additional homing offsets + // ---------------------------------------------- + case 206: for(int8_t i=0; i < 3; i++) { if(code_seen(axis_codes[i])) cs.add_homing[i] = code_value(); } break; #ifdef FWRETRACT + + //! ### M207 - Set firmware retraction + // -------------------------------------------------- case 207: //M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop] { if(code_seen('S')) @@ -6236,6 +6570,9 @@ Sigma_Exit: cs.retract_zlift = code_value() ; } }break; + + //! ### M208 - Set retract recover length + // -------------------------------------------- case 208: // M208 - set retract recover length S[positive mm surplus to the M207 S*] F[feedrate mm/min] { if(code_seen('S')) @@ -6247,6 +6584,9 @@ Sigma_Exit: cs.retract_recover_feedrate = code_value()/60 ; } }break; + + //! ### M209 - Enable/disable automatict retract + // --------------------------------------------- case 209: // M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction. { if(code_seen('S')) @@ -6287,6 +6627,9 @@ Sigma_Exit: }break; #endif // FWRETRACT #if EXTRUDERS > 1 + + // ### M218 - Set hotend offset + // ---------------------------------------- case 218: // M218 - set hotend offset (in mm), T X Y { uint8_t extruder; @@ -6314,6 +6657,8 @@ Sigma_Exit: }break; #endif + //! ### M220 Set feedrate percentage + // ----------------------------------------------- case 220: // M220 S- set speed factor override percentage { if (code_seen('B')) //backup current speed factor @@ -6329,6 +6674,9 @@ Sigma_Exit: } } break; + + //! ### M221 - Set extrude factor override percentage + // ---------------------------------------------------- case 221: // M221 S- set extrude factor override percentage { if(code_seen('S')) @@ -6351,6 +6699,8 @@ Sigma_Exit: } break; + //! ### M226 - Wait for Pin state + // ------------------------------------------ case 226: // M226 P S- Wait until the specified pin reaches the state required { if(code_seen('P')){ @@ -6404,6 +6754,9 @@ Sigma_Exit: break; #if NUM_SERVOS > 0 + + //! ### M280 - Set/Get servo position + // -------------------------------------------- case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds { int servo_index = -1; @@ -6442,6 +6795,9 @@ Sigma_Exit: #endif // NUM_SERVOS > 0 #if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER))) + + //! ### M300 - Play tone + // ----------------------- case 300: // M300 { int beepS = code_seen('S') ? code_value() : 110; @@ -6461,7 +6817,10 @@ Sigma_Exit: #endif // M300 #ifdef PIDTEMP - case 301: // M301 + + //! ### M301 - Set hotend PID + // --------------------------------------- + case 301: { if(code_seen('P')) cs.Kp = code_value(); if(code_seen('I')) cs.Ki = scalePID_i(code_value()); @@ -6489,7 +6848,10 @@ Sigma_Exit: break; #endif //PIDTEMP #ifdef PIDTEMPBED - case 304: // M304 + + //! ### M304 - Set bed PID + // -------------------------------------- + case 304: { if(code_seen('P')) cs.bedKp = code_value(); if(code_seen('I')) cs.bedKi = scalePID_i(code_value()); @@ -6507,6 +6869,9 @@ Sigma_Exit: } break; #endif //PIDTEMP + + //! ### M240 - Trigger camera + // -------------------------------------------- case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/ { #ifdef CHDK @@ -6539,7 +6904,10 @@ Sigma_Exit: } break; #ifdef PREVENT_DANGEROUS_EXTRUDE - case 302: // allow cold extrudes, or set the minimum extrude temperature + + //! ### M302 - Allow cold extrude, or set minimum extrude temperature + // ------------------------------------------------------------------- + case 302: { float temp = .0; if (code_seen('S')) temp=code_value(); @@ -6547,7 +6915,10 @@ Sigma_Exit: } break; #endif - case 303: // M303 PID autotune + + //! ### M303 - PID autotune + // ------------------------------------- + case 303: { float temp = 150.0; int e=0; @@ -6560,17 +6931,22 @@ Sigma_Exit: PID_autotune(temp, e, c); } break; - case 400: // M400 finish all moves + + //! ### M400 - Wait for all moves to finish + // ----------------------------------------- + case 400: { st_synchronize(); } break; - case 403: //! M403 set filament type (material) for particular extruder and send this information to mmu + //! ### M403 - Set filament type (material) for particular extruder and notify the MMU + // ---------------------------------------------- + case 403: { - //! currently three different materials are needed (default, flex and PVA) - //! add storing this information for different load/unload profiles etc. in the future - //!firmware does not wait for "ok" from mmu + // currently three different materials are needed (default, flex and PVA) + // add storing this information for different load/unload profiles etc. in the future + // firmware does not wait for "ok" from mmu if (mmu_enabled) { uint8_t extruder = 255; @@ -6582,27 +6958,41 @@ Sigma_Exit: } break; - case 500: // M500 Store settings in EEPROM + //! ### M500 - Store settings in EEPROM + // ----------------------------------------- + case 500: { Config_StoreSettings(); } break; - case 501: // M501 Read settings from EEPROM + + //! ### M501 - Read settings from EEPROM + // ---------------------------------------- + case 501: { Config_RetrieveSettings(); } break; - case 502: // M502 Revert to default settings + + //! ### M502 - Revert all settings to factory default + // ------------------------------------------------- + case 502: { Config_ResetDefault(); } break; - case 503: // M503 print settings currently in memory + + //! ### M503 - Repport all settings currently in memory + // ------------------------------------------------- + case 503: { Config_PrintSettings(); } break; - case 509: //M509 Force language selection + + //! ### M509 - Force language selection + // ------------------------------------------------ + case 509: { lang_reset(); SERIAL_ECHO_START; @@ -6610,6 +7000,9 @@ Sigma_Exit: } break; #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + + //! ### M540 - Abort print on endstop hit (enable/disable) + // ----------------------------------------------------- case 540: { if(code_seen('S')) abort_on_endstop_hit = code_value() > 0; @@ -6654,6 +7047,9 @@ Sigma_Exit: #endif // CUSTOM_M_CODE_SET_Z_PROBE_OFFSET #ifdef FILAMENTCHANGEENABLE + + //! ### M600 - Initiate Filament change procedure + // -------------------------------------- case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] { st_synchronize(); @@ -6728,24 +7124,39 @@ Sigma_Exit: } break; #endif //FILAMENTCHANGEENABLE - case 601: //! M601 - Pause print + + //! ### M601 - Pause print + // ------------------------------- + case 601: { cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore lcd_pause_print(); } break; - case 602: { //! M602 - Resume print + //! ### M602 - Resume print + // ------------------------------- + case 602: { lcd_resume_print(); } break; - case 603: { //! M603 - Stop print + //! ### M603 - Stop print + // ------------------------------- + case 603: { lcd_print_stop(); } #ifdef PINDA_THERMISTOR - case 860: // M860 - Wait for PINDA thermistor to reach target temperature. + //! ### M860 - Wait for extruder temperature (PINDA) + // -------------------------------------------------------------- + /*! + Wait for PINDA thermistor to reach target temperature + + M860 [S] + + */ + case 860: { int set_target_pinda = 0; @@ -6789,7 +7200,18 @@ Sigma_Exit: break; } - case 861: // M861 - Set/Read PINDA temperature compensation offsets + //! ### M861 - Set/Get PINDA temperature compensation offsets + // ----------------------------------------------------------- + /*! + + M861 [ ? | ! | Z | S [I] ] + + - `?` - Print current EEPROM offset values + - `!` - Set factory default values + - `Z` - Set all values to 0 (effectively disabling PINDA temperature compensation) + - `S` `I` - Set compensation ustep value S for compensation table index I + */ + case 861: if (code_seen('?')) { // ? - Print out current EEPROM offset values uint8_t cal_status = calibration_status_pinda(); int16_t usteps = 0; @@ -6860,7 +7282,9 @@ Sigma_Exit: break; #endif //PINDA_THERMISTOR - + + //! ### M862 - Print checking + // ---------------------------------------------- case 862: // M862: print checking float nDummy; uint8_t nCommand; @@ -6921,12 +7345,16 @@ Sigma_Exit: break; #ifdef LIN_ADVANCE - case 900: // M900: Set LIN_ADVANCE options. + //! ### M900 - Set Linear advance options + // ---------------------------------------------- + case 900: gcode_M900(); break; #endif - case 907: // M907 Set digital trimpot motor current using axis codes. + //! ### M907 - Set digital trimpot motor current using axis codes + // --------------------------------------------------------------- + case 907: { #ifdef TMC2130 for (int i = 0; i < NUM_AXIS; i++) @@ -6957,7 +7385,10 @@ Sigma_Exit: #endif //TMC2130 } break; - case 908: // M908 Control digital trimpot directly. + + //! ### M908 - Control digital trimpot directly + // --------------------------------------------------------- + case 908: { #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 uint8_t channel,current; @@ -6970,13 +7401,17 @@ Sigma_Exit: #ifdef TMC2130_SERVICE_CODES_M910_M918 - case 910: //! M910 - TMC2130 init + //! ### M910 - TMC2130 init + // ----------------------------------------------- + case 910: { tmc2130_init(); } break; - case 911: //! M911 - Set TMC2130 holding currents + //! ### M911 - Set TMC2130 holding currents + // ------------------------------------------------- + case 911: { if (code_seen('X')) tmc2130_set_current_h(0, code_value()); if (code_seen('Y')) tmc2130_set_current_h(1, code_value()); @@ -6985,7 +7420,9 @@ Sigma_Exit: } break; - case 912: //! M912 - Set TMC2130 running currents + //! ### M912 - Set TMC2130 running currents + // ----------------------------------------------- + case 912: { if (code_seen('X')) tmc2130_set_current_r(0, code_value()); if (code_seen('Y')) tmc2130_set_current_r(1, code_value()); @@ -6993,13 +7430,18 @@ Sigma_Exit: if (code_seen('E')) tmc2130_set_current_r(3, code_value()); } break; - case 913: //! M913 - Print TMC2130 currents + + //! ### M913 - Print TMC2130 currents + // ----------------------------- + case 913: { tmc2130_print_currents(); } break; - case 914: //! M914 - Set normal mode + //! ### M914 - Set TMC2130 normal mode + // ------------------------------ + case 914: { tmc2130_mode = TMC2130_MODE_NORMAL; update_mode_profile(); @@ -7007,7 +7449,9 @@ Sigma_Exit: } break; - case 915: //! M915 - Set silent mode + //! ### M95 - Set TMC2130 silent mode + // ------------------------------ + case 915: { tmc2130_mode = TMC2130_MODE_SILENT; update_mode_profile(); @@ -7015,7 +7459,9 @@ Sigma_Exit: } break; - case 916: //! M916 - Set sg_thrs + //! ### M916 - Set TMC2130 Stallguard sensitivity threshold + // ------------------------------------------------------- + case 916: { if (code_seen('X')) tmc2130_sg_thr[X_AXIS] = code_value(); if (code_seen('Y')) tmc2130_sg_thr[Y_AXIS] = code_value(); @@ -7026,7 +7472,9 @@ Sigma_Exit: } break; - case 917: //! M917 - Set TMC2130 pwm_ampl + //! ### M917 - Set TMC2130 PWM amplitude offset (pwm_ampl) + // -------------------------------------------------------------- + case 917: { if (code_seen('X')) tmc2130_set_pwm_ampl(0, code_value()); if (code_seen('Y')) tmc2130_set_pwm_ampl(1, code_value()); @@ -7035,7 +7483,9 @@ Sigma_Exit: } break; - case 918: //! M918 - Set TMC2130 pwm_grad + //! ### M918 - Set TMC2130 PWM amplitude gradient (pwm_grad) + // ------------------------------------------------------------- + case 918: { if (code_seen('X')) tmc2130_set_pwm_grad(0, code_value()); if (code_seen('Y')) tmc2130_set_pwm_grad(1, code_value()); @@ -7046,7 +7496,10 @@ Sigma_Exit: #endif //TMC2130_SERVICE_CODES_M910_M918 - case 350: //! M350 - Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. + //! ### M350 - Set microstepping mode + // --------------------------------------------------- + //! Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. + case 350: { #ifdef TMC2130 if(code_seen('E')) @@ -7083,7 +7536,13 @@ Sigma_Exit: #endif //TMC2130 } break; - case 351: //! M351 - Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. + + //! ### M351 - Toggle Microstep Pins + // ----------------------------------- + //! Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. + //! + //! M351 [B<0|1>] [E<0|1>] S<1|2> [X<0|1>] [Y<0|1>] [Z<0|1>] + case 351: { #if defined(X_MS1_PIN) && X_MS1_PIN > -1 if(code_seen('S')) switch((int)code_value()) @@ -7101,14 +7560,28 @@ Sigma_Exit: #endif } break; - case 701: //! M701 - load filament + + //! ### M701 - Load filament + // ------------------------- + case 701: { if (mmu_enabled && code_seen('E')) tmp_extruder = code_value(); gcode_M701(); } break; - case 702: //! M702 [U C] - + + //! ### M702 - Unload filament + // ------------------------ + /*! + + M702 [U C] + + - `U` Unload all filaments used in current print + - `C` Unload just current filament + - without any parameters unload all filaments + */ + case 702: { #ifdef SNMM if (code_seen('U')) @@ -7130,7 +7603,9 @@ Sigma_Exit: } break; - case 999: // M999: Restart after being stopped + //! ### M999 - Restart after being stopped + // ------------------------------------ + case 999: Stopped = false; lcd_reset_alert_level(); gcode_LastN = Stopped_gcode_LastN; @@ -7144,6 +7619,10 @@ Sigma_Exit: } } // end if(code_seen('M')) (end of M codes) + + //! ----------------------------------------------------------------------------------------- + //! T Codes + //! //! T - select extruder in case of multi extruder printer //! select filament in case of MMU_V2 //! if extruder is "?", open menu to let the user select extruder/filament @@ -7337,46 +7816,95 @@ Sigma_Exit: } } // end if(code_seen('T')) (end of T codes) + //! ---------------------------------------------------------------------------------------------- + else if (code_seen('D')) // D codes (debug) { switch((int)code_value()) { - case -1: //! D-1 - Endless loop + + //! ### D-1 - Endless loop + // ------------------- + case -1: dcode__1(); break; #ifdef DEBUG_DCODES - case 0: //! D0 - Reset + + //! ### D0 - Reset + // -------------- + case 0: dcode_0(); break; - case 1: //! D1 - Clear EEPROM + + //! ### D1 - Clear EEPROM + // ------------------ + case 1: dcode_1(); break; - case 2: //! D2 - Read/Write RAM + + //! ### D2 - Read/Write RAM + // -------------------- + case 2: dcode_2(); break; #endif //DEBUG_DCODES #ifdef DEBUG_DCODE3 - case 3: //! D3 - Read/Write EEPROM + + //! ### D3 - Read/Write EEPROM + // ----------------------- + case 3: dcode_3(); break; #endif //DEBUG_DCODE3 #ifdef DEBUG_DCODES - case 4: //! D4 - Read/Write PIN + + //! ### D4 - Read/Write PIN + // --------------------- + case 4: dcode_4(); break; #endif //DEBUG_DCODES #ifdef DEBUG_DCODE5 - case 5: // D5 - Read/Write FLASH + + //! ### D5 - Read/Write FLASH + // ------------------------ + case 5: dcode_5(); break; break; #endif //DEBUG_DCODE5 #ifdef DEBUG_DCODES - case 6: // D6 - Read/Write external FLASH + + //! ### D6 - Read/Write external FLASH + // --------------------------------------- + case 6: dcode_6(); break; - case 7: //! D7 - Read/Write Bootloader + + //! ### D7 - Read/Write Bootloader + // ------------------------------- + case 7: dcode_7(); break; - case 8: //! D8 - Read/Write PINDA + + //! ### D8 - Read/Write PINDA + // --------------------------- + case 8: dcode_8(); break; - case 9: //! D9 - Read/Write ADC + + // ### D9 - Read/Write ADC + // ------------------------ + case 9: dcode_9(); break; - case 10: //! D10 - XYZ calibration = OK + + //! ### D10 - XYZ calibration = OK + // ------------------------------ + case 10: dcode_10(); break; #endif //DEBUG_DCODES #ifdef HEATBED_ANALYSIS + + //! ### D80 - Bed check + // --------------------- + /*! + - `E` - dimension x + - `F` - dimention y + - `G` - points_x + - `H` - points_y + - `I` - offset_x + - `J` - offset_y + */ case 80: { float dimension_x = 40; @@ -7401,6 +7929,16 @@ Sigma_Exit: bed_check(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y); }break; + //! ### D81 - Bed analysis + // ----------------------------- + /*! + - `E` - dimension x + - `F` - dimention y + - `G` - points_x + - `H` - points_y + - `I` - offset_x + - `J` - offset_y + */ case 81: { float dimension_x = 40; @@ -7423,7 +7961,10 @@ Sigma_Exit: #endif //HEATBED_ANALYSIS #ifdef DEBUG_DCODES - case 106: //D106 print measured fan speed for different pwm values + + //! ### D106 print measured fan speed for different pwm values + // -------------------------------------------------------------- + case 106: { for (int i = 255; i > 0; i = i - 5) { fanSpeed = i; @@ -7437,12 +7978,52 @@ Sigma_Exit: }break; #ifdef TMC2130 - case 2130: //! D2130 - TMC2130 + //! ### D2130 - TMC2130 Trinamic stepper controller + // --------------------------- + + + /*! + + + D2130[subcommand][value] + + - : + - '0' current off + - '1' current on + - '+' single step + - * value sereval steps + - '-' dtto oposite direction + - '?' read register + - * "mres" + - * "step" + - * "mscnt" + - * "mscuract" + - * "wave" + - '!' set register + - * "mres" + - * "step" + - * "wave" + - '@' home calibrate axis + + Example: + + D2130E?wave ... print extruder microstep linearity compensation curve + + D2130E!wave0 ... disable extruder linearity compensation curve, (sine curve is used) + + D2130E!wave220 ... (sin(x))^1.1 extruder microstep compensation curve used + */ + + + case 2130: dcode_2130(); break; #endif //TMC2130 #if (defined (FILAMENT_SENSOR) && defined(PAT9125)) - case 9125: //! D9125 - FILAMENT_SENSOR + + //! ### D9125 - FILAMENT_SENSOR + // --------------------------------- + case 9125: dcode_9125(); break; #endif //FILAMENT_SENSOR @@ -7461,6 +8042,13 @@ Sigma_Exit: ClearToSend(); } + + + /** @defgroup GCodes G-Code List + */ + +// --------------------------------------------------- + void FlushSerialRequestResend() { //char cmdbuffer[bufindr][100]="Resend:"; diff --git a/Firmware/doxyfile b/Firmware/doxyfile index 9c2d550c0..346ce6045 100644 --- a/Firmware/doxyfile +++ b/Firmware/doxyfile @@ -2050,7 +2050,7 @@ PERLMOD_MAKEVAR_PREFIX = # C-preprocessor directives found in the sources and include files. # The default value is: YES. -ENABLE_PREPROCESSING = YES +ENABLE_PREPROCESSING = NO # If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names # in the source code. If set to NO, only conditional compilation will be From bd4bfbe58622352f6da7be93b4eb0c8868a0c370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BChn?= Date: Fri, 19 Jul 2019 16:15:12 +0200 Subject: [PATCH 357/368] Added M862 details --- Firmware/Marlin_main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0415b2bfa..0e5850b96 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7285,6 +7285,24 @@ Sigma_Exit: //! ### M862 - Print checking // ---------------------------------------------- + /*! + Checks the parameters of the printer and gcode and performs compatibility check + + - M862.1 [ P | Q ] + + - M862.2 [ P | Q ] + + - M862.3 [ P | Q ] + + - M862.4 [ P | Q] + + - M862.5 [ P | Q] + + + When run with P<> argument, the check is performed against the input value. + When run with Q argument, the current value is shown. + + */ case 862: // M862: print checking float nDummy; uint8_t nCommand; From 9c95f8c015ba479308cab9cc361f05a527947d2f Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Fri, 19 Jul 2019 18:34:46 +0200 Subject: [PATCH 358/368] sheet menu --- Firmware/menu.cpp | 37 ++++++++++++++++++ Firmware/menu.h | 2 + Firmware/ultralcd.cpp | 87 +++++++++++++++++++++++++++++++++++++++---- 3 files changed, 119 insertions(+), 7 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 096838cb6..9b9d01dbc 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -196,6 +196,28 @@ void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) buffer.c[index + 7] = '\0'; } +//! @brief Format sheet name in select menu +//! +//! @param[in] sheet_E Sheet in EEPROM +//! @param[out] buffer for formatted output +void menu_format_sheet_select_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) +{ + uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S ["), _T(MSG_SHEET)); + eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); + buffer.c[index + 7] = ']'; + //index += 7; + buffer.c[index + 8] = '\0'; +} + +static void menu_draw_item_select_sheet_E(char type_char, const Sheet &sheet) +{ + lcd_set_cursor(0, menu_row); + SheetFormatBuffer buffer; + menu_format_sheet_select_E(sheet, buffer); + lcd_printf_P(PSTR("%c%-18.18s%c"), menu_selection_mark(), buffer.c, type_char); +} + + static void menu_draw_item_puts_E(char type_char, const Sheet &sheet) { lcd_set_cursor(0, menu_row); @@ -269,6 +291,21 @@ uint8_t menu_item_submenu_E(const Sheet &sheet, menu_func_t submenu) return 0; } +uint8_t menu_item_submenu_select_sheet_E(const Sheet &sheet, menu_func_t submenu) +{ + if (menu_item == menu_line) + { + if (lcd_draw_update) menu_draw_item_select_sheet_E(LCD_STR_ARROW_RIGHT[0], sheet); + if (menu_clicked && (lcd_encoder == menu_item)) + { + menu_submenu(submenu); + return menu_item_ret(); + } + } + menu_item++; + return 0; +} + uint8_t menu_item_back_P(const char* str) { if (menu_item == menu_line) diff --git a/Firmware/menu.h b/Firmware/menu.h index a4cb30104..d9bbf876c 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -103,6 +103,8 @@ extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu); #define MENU_ITEM_SUBMENU_E(sheet, submenu) do { if (menu_item_submenu_E(sheet, submenu)) return; } while (0) extern uint8_t menu_item_submenu_E(const Sheet &sheet, menu_func_t submenu); +#define MENU_ITEM_SUBMENU_SELECT_SHEET_E(sheet, submenu) do { if (menu_item_submenu_select_sheet_E(sheet, submenu)) return; } while (0) +extern uint8_t menu_item_submenu_select_sheet_E(const Sheet &sheet, menu_func_t submenu); #define MENU_ITEM_BACK_P(str) do { if (menu_item_back_P(str)) return; } while (0) extern uint8_t menu_item_back_P(const char* str); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ee9c6c2b6..5ab59e96c 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -257,6 +257,7 @@ static void lcd_connect_printer(); void lcd_finishstatus(); static void lcd_sdcard_menu(); +static void lcd_sheet_menu(); #ifdef DELTA_CALIBRATION_MENU static void lcd_delta_calibrate_menu(); @@ -5517,15 +5518,41 @@ SETTINGS_VERSION; MENU_END(); } +//TODO: ---------- HW menu void lcd_hw_setup_menu(void) // can not be "static" { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch -if(!farm_mode) + +MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_sheet_menu); +MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_sheet_menu); +MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_sheet_menu); + +char buffer[] = "work cunt"; +//strncpy(buffer,_i("Sheet"),sizeof(buffer)); +//strncpy(buffer,_i(" "),sizeof(buffer)); +//strncpy(buffer,EEPROM_Sheets_base->s[0].name,sizeof(buffer)); + +//const char* menu = EEPROM_Sheets_base->s[0].name.c_str(); + +//const char *b = new char(buffer); +//const char *b = const char *b = new char(buffer);(buffer); +//printf_P(_N("UVLO - end %d\n"), _millis() - time_start); +//SERIAL_ECHOPGM(buffer); +//SERIAL_ECHOPGM(reinterpret_cast(buffer)); +//SERIAL_ECHOPGM("lakdjushasdjaljsdakjsdn"); +//char* p = &buffer[0]; + +//MENU_ITEM_SUBMENU_P(reinterpret_cast(p),lcd_sheet_menu); + +//delete(b); + +if(!farm_mode){ SETTINGS_NOZZLE; // ... a sem prijdou 'plechy' if(!farm_mode) MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu); +} MENU_END(); } @@ -6500,14 +6527,14 @@ static void lcd_select_sheet_2_menu() change_sheet(2); } -static void lcd_select_sheet_menu() +static void lcd_select_sheet_menu() //TODO: -----------------sheet menu { - MENU_BEGIN(); + /*MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_BACK)); MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); - MENU_END(); + MENU_END();*/ } static void lcd_rename_sheet_menu() @@ -6554,13 +6581,59 @@ static void lcd_rename_sheet_menu() } } +static void lcd_reset_sheet() +{ + struct MenuData + { + bool initialized; + uint8_t selected; + char name[sizeof(Sheet::name)]; + }; + static_assert(sizeof(menu_data)>= sizeof(MenuData),"MenuData doesn't fit into menu_data"); + MenuData* menuData = (MenuData*)&(menu_data[0]); + + if (!menuData->initialized) + { + eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, sizeof(Sheet::name)); + lcd_encoder = menuData->name[0]; + menuData->initialized = true; + } + if (lcd_encoder < '\x20') lcd_encoder = '\x20'; + if (lcd_encoder > '\x7F') lcd_encoder = '\x7F'; + + menuData->name[menuData->selected] = lcd_encoder; + lcd_set_cursor(0,0); + for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i) + { + lcd_putc(menuData->name[i]); + } + lcd_set_cursor(menuData->selected, 1); + lcd_putc('^'); + if (lcd_clicked()) + { + if ((menuData->selected + 1u) < sizeof(Sheet::name)) + { + lcd_encoder = menuData->name[++(menuData->selected)]; + } + else + { + eeprom_update_block(menuData->name, + EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, + sizeof(Sheet::name)); + menu_back(); + } + } +} + static void lcd_sheet_menu() { MENU_BEGIN(); - MENU_ITEM_BACK_P(_T(MSG_MAIN)); + MENU_ITEM_BACK_P(_T(MSG_HW_SETUP)); + //if() MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18 - MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); + MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 + MENU_ITEM_SUBMENU_P(_i("Reset"), lcd_reset_sheet); //// c=18 MENU_END(); } @@ -6700,7 +6773,7 @@ static void lcd_main_menu() } - if(!isPrintPaused)MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); + if(!isPrintPaused)MENU_ITEM_SUBMENU_SELECT_SHEET_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { From 254dd7463b1615f79db9b08f53592710a4ed86d9 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 22 Jul 2019 17:08:10 +0200 Subject: [PATCH 359/368] fix tests --- Tests/PrusaStatistics_test.cpp | 84 ++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 34 deletions(-) diff --git a/Tests/PrusaStatistics_test.cpp b/Tests/PrusaStatistics_test.cpp index 05aaa3633..587a3fb0f 100644 --- a/Tests/PrusaStatistics_test.cpp +++ b/Tests/PrusaStatistics_test.cpp @@ -13,41 +13,42 @@ std::string itostr3(int i){ return std::to_string(i); } -std::string eeprom_read_word(uint16_t* i){ +std::string eeprom_read_word(uint16_t* /*i*/){ return "eeprom_read"; } int _millis(){return 10000;} -int farm_no; -int busy_state; -int PAUSED_FOR_USER; -int status_number; -int total_filament_used; -int feedmultiply; -int longFilenameOLD; -int starttime; -int isPrintPaused; -int IS_SD_PRINTING; -int farm_status; -int farm_timer; -int loading_flag; +static int farm_no; +static int busy_state; +static int PAUSED_FOR_USER; +static int status_number; +static int total_filament_used; +static int feedmultiply; +static int longFilenameOLD; +static int starttime; +static int isPrintPaused; +static int IS_SD_PRINTING; +static int farm_status; +static int farm_timer; +static int loading_flag; -int target_temperature[1]; -int current_temperature[1]; -int target_temperature_bed; -int current_temperature_bed; +static int target_temperature[1]; +static int current_temperature[1]; +static int target_temperature_bed; +static int current_temperature_bed; -uint16_t nozzle_diameter; -uint16_t* EEPROM_NOZZLE_DIAMETER_uM; +static uint16_t nozzle_diameter; +static uint16_t* EEPROM_NOZZLE_DIAMETER_uM; -std::string FW_VERSION; +static std::string FW_VERSION; struct Card { int paused = 0; int percentDone(){ return 50; } -} card; +}; +static Card card; void setup_mockups(){ farm_no = 0; @@ -85,7 +86,7 @@ namespace old_code { // Mocking Serial line -std::string SERIAL_BUFFER = ""; +static std::string SERIAL_BUFFER = ""; void SERIAL_ECHO(std::string s){ SERIAL_BUFFER += s; @@ -115,8 +116,12 @@ struct MySerial { void print(int i){ SERIAL_ECHO(i); } -} MYSERIAL; + void println(){ + SERIAL_ECHO("\n"); + } +}; +static MySerial MYSERIAL; static void prusa_stat_printerstatus(int _status) { @@ -363,7 +368,7 @@ namespace new_code { // Mocking Serial line -std::string SERIAL_BUFFER = ""; +static std::string SERIAL_BUFFER = ""; void SERIAL_ECHO(std::string s){ SERIAL_BUFFER += s; @@ -383,6 +388,7 @@ void SERIAL_ECHOLN(std::string s){ void SERIAL_ECHOLN(char c){ SERIAL_BUFFER += char(c); + SERIAL_BUFFER += "\n"; } void SERIAL_RESET(){ @@ -393,7 +399,12 @@ struct MySerial { void print(int i){ SERIAL_ECHO(i); } -} MYSERIAL; + void println(){ + SERIAL_ECHO("\n"); + } +}; + +static MySerial MYSERIAL; static void prusa_stat_printerstatus(int _status) { @@ -459,6 +470,12 @@ void prusa_statistics_err(char c){ prusa_stat_farm_number(); } +void prusa_statistics_case0(uint8_t statnr){ + SERIAL_ECHO("{"); + prusa_stat_printerstatus(statnr); + prusa_stat_farm_number(); + prusa_stat_printinfo(); +} void prusa_statistics(int _message, uint8_t _fil_nr) { #ifdef DEBUG_DISABLE_PRUSA_STATISTICS @@ -470,24 +487,24 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { case 0: // default message if (busy_state == PAUSED_FOR_USER) { - status_number = 15; + prusa_statistics_case0(15); } else if (isPrintPaused || card.paused) { - status_number = 14; + prusa_statistics_case0(14); } else if (IS_SD_PRINTING || loading_flag) { - status_number = 4; + prusa_statistics_case0(4); } else { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(1); + prusa_stat_farm_number(); + prusa_stat_diameter(); status_number = 1; } - SERIAL_ECHO('{'); - prusa_stat_printerstatus(status_number); - prusa_stat_farm_number(); - prusa_stat_printinfo(); break; case 1: // 1 heating @@ -530,7 +547,6 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { // must do a return here to prevent doing SERIAL_ECHOLN("}") at the very end of this function // saved a considerable amount of FLASH return; - break; case 4: // print succesfull SERIAL_ECHO("{[RES:1][FIL:"); MYSERIAL.print(int(_fil_nr)); From b96c9700ce75c5f96587517387219a5c85a50c72 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 22 Jul 2019 17:10:04 +0200 Subject: [PATCH 360/368] fix prusa_statistics code size optimization according to unit test results --- Firmware/ultralcd.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b7f076d3a..f3832d177 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3962,6 +3962,13 @@ void prusa_statistics_err(char c){ prusa_stat_farm_number(); } +static void prusa_statistics_case0(uint8_t statnr){ + SERIAL_ECHO("{"); + prusa_stat_printerstatus(statnr); + prusa_stat_farm_number(); + prusa_stat_printinfo(); +} + void prusa_statistics(int _message, uint8_t _fil_nr) { #ifdef DEBUG_DISABLE_PRUSA_STATISTICS return; @@ -3972,24 +3979,24 @@ void prusa_statistics(int _message, uint8_t _fil_nr) { case 0: // default message if (busy_state == PAUSED_FOR_USER) { - status_number = 15; + prusa_statistics_case0(15); } else if (isPrintPaused || card.paused) { - status_number = 14; + prusa_statistics_case0(14); } else if (IS_SD_PRINTING || loading_flag) { - status_number = 4; + prusa_statistics_case0(4); } else { + SERIAL_ECHO("{"); + prusa_stat_printerstatus(1); + prusa_stat_farm_number(); + prusa_stat_diameter(); status_number = 1; } - SERIAL_ECHO('{'); - prusa_stat_printerstatus(status_number); - prusa_stat_farm_number(); - prusa_stat_printinfo(); break; case 1: // 1 heating From 6f79ef4c9cf06b7c843d32eef2e95729cca2c0c7 Mon Sep 17 00:00:00 2001 From: DRracer Date: Mon, 22 Jul 2019 17:29:43 +0200 Subject: [PATCH 361/368] resolve hidden conflicts in commented code --- Firmware/Marlin_main.cpp | 8 -------- Firmware/ultralcd.cpp | 4 ---- 2 files changed, 12 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d3b15f515..35722679b 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8943,11 +8943,7 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; -<<<<<<< HEAD custom_message_type = CustomMsg::MeshBedLeveling; -======= - custom_message_type = CustomMsgTypes::MESHBL; ->>>>>>> origin/code-size-reduction custom_message_state = (x_points_num * y_points_num) + 10; lcd_update(1); @@ -9145,11 +9141,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } unsigned int custom_message_type_old = custom_message_type; unsigned int custom_message_state_old = custom_message_state; -<<<<<<< HEAD custom_message_type = CustomMsg::MeshBedLeveling; -======= - custom_message_type = CustomMsgTypes::MESHBL; ->>>>>>> origin/code-size-reduction custom_message_state = (x_points_num * y_points_num) + 10; lcd_update(1); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 46bcde1ce..ac7539d63 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6600,11 +6600,7 @@ static void lcd_main_menu() if(fan_check_error == EFCE_OK) MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT #else -<<<<<<< HEAD - MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT -======= MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT ->>>>>>> upstream/MK3 #endif } From ab2eafe1752e373bc65fbb34b1d100c480e3a88d Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 22 Jul 2019 18:43:43 +0200 Subject: [PATCH 362/368] sheet menu, add hw setting, sheet change in menu, sheet name initialization in eeprom --- Firmware/eeprom.cpp | 11 ++-- Firmware/eeprom.h | 2 +- Firmware/menu.cpp | 3 +- Firmware/ultralcd.cpp | 114 ++++++++++++++++++------------------------ 4 files changed, 59 insertions(+), 71 deletions(-) diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 1be708d00..5861109da 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -41,9 +41,9 @@ bool eeprom_is_uninitialized(char *address) return (0xff == eeprom_read_byte(reinterpret_cast(address))); } -bool is_sheet_initialized(){ +bool is_sheet_initialized(uint8_t sheet_num){ return (0xffff != eeprom_read_word(reinterpret_cast(&(EEPROM_Sheets_base-> - s[eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))].z_offset)))); + s[sheet_num].z_offset)))); } void eeprom_init() @@ -62,6 +62,8 @@ void eeprom_init() if (eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0); if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0); if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); + + char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"}; for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i) { bool is_uninitialized = true; @@ -71,8 +73,9 @@ void eeprom_init() } if(is_uninitialized) { - eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast(i + '1')); - eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); + for (uint_least8_t a = 0; a < sizeof(Sheet::name); ++a){ + eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), defaultSheetNames[i][a]); + } } } check_babystep(); diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 54f30ccd1..c41fb9ff9 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -5,7 +5,7 @@ #ifdef __cplusplus void eeprom_init(); -extern bool is_sheet_initialized(); +extern bool is_sheet_initialized(uint8_t sheet_num); #endif diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 9b9d01dbc..e08b5710f 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -202,10 +202,9 @@ void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) //! @param[out] buffer for formatted output void menu_format_sheet_select_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) { - uint_least8_t index = sprintf_P(buffer.c, PSTR("%.10S ["), _T(MSG_SHEET)); + uint_least8_t index = sprintf_P(buffer.c,PSTR("%.10S ["), _T(MSG_SHEET)); eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); buffer.c[index + 7] = ']'; - //index += 7; buffer.c[index + 8] = '\0'; } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5ab59e96c..d94d29bed 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -259,6 +259,10 @@ void lcd_finishstatus(); static void lcd_sdcard_menu(); static void lcd_sheet_menu(); +static void lcd_select_sheet_0_menu(); +static void lcd_select_sheet_1_menu(); +static void lcd_select_sheet_2_menu(); + #ifdef DELTA_CALIBRATION_MENU static void lcd_delta_calibrate_menu(); #endif // DELTA_CALIBRATION_MENU @@ -299,6 +303,9 @@ static void menu_action_sddirectory(const char* filename); bool lcd_oldcardstatus; #endif +uint8_t selected_sheet = 0; +char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"}; + bool ignore_click = false; bool wait_for_unclick; @@ -3091,7 +3098,7 @@ static void lcd_babystep_z() _md->status = 1; check_babystep(); - if(!is_sheet_initialized()){ + if(!is_sheet_initialized(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))){ _md->babystepMemZ = 0; } else{ @@ -4700,6 +4707,7 @@ void lcd_toshiba_flash_air_compatibility_toggle() void lcd_v2_calibration() { + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), selected_sheet); if (mmu_enabled) { const uint8_t filament = choose_menu_P(_i("Select PLA filament:"),_T(MSG_FILAMENT),_i("Cancel")); ////c=20 r=1 ////c=19 r=1 @@ -5518,17 +5526,15 @@ SETTINGS_VERSION; MENU_END(); } -//TODO: ---------- HW menu void lcd_hw_setup_menu(void) // can not be "static" { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch -MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_sheet_menu); -MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_sheet_menu); -MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_sheet_menu); +MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); +MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); +MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); -char buffer[] = "work cunt"; //strncpy(buffer,_i("Sheet"),sizeof(buffer)); //strncpy(buffer,_i(" "),sizeof(buffer)); //strncpy(buffer,EEPROM_Sheets_base->s[0].name,sizeof(buffer)); @@ -5549,8 +5555,6 @@ char buffer[] = "work cunt"; if(!farm_mode){ SETTINGS_NOZZLE; -// ... a sem prijdou 'plechy' -if(!farm_mode) MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu); } MENU_END(); @@ -6503,38 +6507,36 @@ void lcd_resume_print() isPrintPaused = false; } -static void change_sheet(uint8_t sheet_num) +static void change_sheet() { - eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_num); - if(is_sheet_initialized()) - calibration_status_store(CALIBRATION_STATUS_CALIBRATED); - else - calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); - + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), selected_sheet); menu_back(3); } +static void change_sheet_from_menu(){ + uint8_t next_sheet = selected_sheet+1; + if(next_sheet > 2) next_sheet = 0; + if(is_sheet_initialized(next_sheet)){ + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), next_sheet); + selected_sheet = next_sheet; + } + menu_back(); +} + static void lcd_select_sheet_0_menu() { - change_sheet(0); + selected_sheet = 0; + lcd_sheet_menu(); } static void lcd_select_sheet_1_menu() { - change_sheet(1); + selected_sheet = 1; + lcd_sheet_menu(); } static void lcd_select_sheet_2_menu() { - change_sheet(2); -} - -static void lcd_select_sheet_menu() //TODO: -----------------sheet menu -{ - /*MENU_BEGIN(); - MENU_ITEM_BACK_P(_T(MSG_BACK)); - MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu); - MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu); - MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu); - MENU_END();*/ + selected_sheet = 2; + lcd_sheet_menu(); } static void lcd_rename_sheet_menu() @@ -6550,7 +6552,7 @@ static void lcd_rename_sheet_menu() if (!menuData->initialized) { - eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, sizeof(Sheet::name)); + eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name)); lcd_encoder = menuData->name[0]; menuData->initialized = true; } @@ -6574,7 +6576,7 @@ static void lcd_rename_sheet_menu() else { eeprom_update_block(menuData->name, - EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, + EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name)); menu_back(); } @@ -6591,46 +6593,27 @@ static void lcd_reset_sheet() }; static_assert(sizeof(menu_data)>= sizeof(MenuData),"MenuData doesn't fit into menu_data"); MenuData* menuData = (MenuData*)&(menu_data[0]); + eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name)); + + menuData->initialized = false; + for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i){ + menuData->name[i] = defaultSheetNames[selected_sheet][i]; + } - if (!menuData->initialized) - { - eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, sizeof(Sheet::name)); - lcd_encoder = menuData->name[0]; - menuData->initialized = true; - } - if (lcd_encoder < '\x20') lcd_encoder = '\x20'; - if (lcd_encoder > '\x7F') lcd_encoder = '\x7F'; - - menuData->name[menuData->selected] = lcd_encoder; - lcd_set_cursor(0,0); - for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i) - { - lcd_putc(menuData->name[i]); - } - lcd_set_cursor(menuData->selected, 1); - lcd_putc('^'); - if (lcd_clicked()) - { - if ((menuData->selected + 1u) < sizeof(Sheet::name)) - { - lcd_encoder = menuData->name[++(menuData->selected)]; - } - else - { - eeprom_update_block(menuData->name, - EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, - sizeof(Sheet::name)); - menu_back(); - } - } + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),0xffff); + eeprom_update_block(menuData->name,EEPROM_Sheets_base->s[selected_sheet].name,sizeof(Sheet::name)); + menu_back(2); } static void lcd_sheet_menu() { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_HW_SETUP)); - //if() - MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18 + + if(is_sheet_initialized(selected_sheet)){ + MENU_ITEM_SUBMENU_P(_i("Select"), change_sheet); //// c=18 + } + MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 MENU_ITEM_SUBMENU_P(_i("Reset"), lcd_reset_sheet); //// c=18 @@ -6773,7 +6756,10 @@ static void lcd_main_menu() } - if(!isPrintPaused)MENU_ITEM_SUBMENU_SELECT_SHEET_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu); + if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) + { + MENU_ITEM_SUBMENU_SELECT_SHEET_E(EEPROM_Sheets_base->s[selected_sheet], change_sheet_from_menu); + } if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { From 23ed612efe29546259c10ecaac2474f83fec4590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BChn?= Date: Mon, 22 Jul 2019 18:45:41 +0200 Subject: [PATCH 363/368] Updated linux build manual --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 765204a50..c44983ba7 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,24 @@ # Build ## Linux -Run shell script build.sh to build for MK3 and flash with Slic3er. -If you have a different printer model, follow step [2.b](#2b) from Windows build first. -If you wish to flash from Arduino, follow step [2.c](#2c) from Windows build first. -The script downloads Arduino with our modifications and Rambo board support installed, unpacks it into folder PF-build-env-\ on the same level, as your Prusa-Firmware folder is located, builds firmware for MK3 using that Arduino in Prusa-Firmware-build folder on the same level as Prusa-Firmware, runs secondary language support scripts. Firmware with secondary language support is generated in lang subfolder. Use firmware.hex for MK3 variant. Use firmware_\.hex for other printers. Don't forget to follow step [2.b](#2b) first for non-MK3 printers. +1. Clone this repository and checkout the correct branch for your desired release version. + +2. Set your printer model. + - For MK3 --> skip to step 3. + - If you have a different printer model, follow step [2.b](#2b) from Windows build + +3. Run `sudo ./build.sh` + - Output hex file is at `"PrusaFirmware/lang/firmware.hex"` . In the same folder you can hex files for other languages as well. + +4. Connect your printer and flash with PrusaSlicer ( Configuration --> Flash printer firmware ) or Slic3r PE. + - If you wish to flash from Arduino, follow step [2.c](#2c) from Windows build first. + + +_Notes:_ + +The script downloads Arduino with our modifications and Rambo board support installed, unpacks it into folder `PF-build-env-\` on the same level, as your Prusa-Firmware folder is located, builds firmware for MK3 using that Arduino in Prusa-Firmware-build folder on the same level as Prusa-Firmware, runs secondary language support scripts. Firmware with secondary language support is generated in lang subfolder. Use firmware.hex for MK3 variant. Use `firmware_\.hex` for other printers. Don't forget to follow step [2.b](#2b) first for non-MK3 printers. + ## Windows ### Using Arduino note: Multi language build is not supported. From 19e7838c20e499a093356ec34c2de0a81787856b Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 22 Jul 2019 20:35:10 +0200 Subject: [PATCH 364/368] add default names to PROGMEM, text formating edit --- Firmware/Marlin.h | 4 ++++ Firmware/eeprom.cpp | 6 +++--- Firmware/menu.cpp | 2 +- Firmware/ultralcd.cpp | 5 +---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index a44346619..6b2261c3c 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -331,6 +331,10 @@ extern float retract_length_swap; extern float retract_recover_length_swap; #endif +const char smooth1[] PROGMEM = "Smooth1"; +const char smooth2[] PROGMEM = "Smooth2"; +const char textured[] PROGMEM = "Textur1"; +const char *const defaultSheetNames[] PROGMEM = {smooth1,smooth2,textured}; extern uint8_t host_keepalive_interval; diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 5861109da..726288b5b 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -8,7 +8,6 @@ #include #include - #include "language.h" #if 0 @@ -63,7 +62,6 @@ void eeprom_init() if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0); if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); - char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"}; for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i) { bool is_uninitialized = true; @@ -73,8 +71,10 @@ void eeprom_init() } if(is_uninitialized) { + char sheet_PROGMEM_buffer[8]; + strcpy_P(sheet_PROGMEM_buffer, (char *)pgm_read_word(&(defaultSheetNames[i]))); for (uint_least8_t a = 0; a < sizeof(Sheet::name); ++a){ - eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), defaultSheetNames[i][a]); + eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), sheet_PROGMEM_buffer[a]); } } } diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index e08b5710f..7f1ab12f3 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -202,7 +202,7 @@ void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) //! @param[out] buffer for formatted output void menu_format_sheet_select_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) { - uint_least8_t index = sprintf_P(buffer.c,PSTR("%.10S ["), _T(MSG_SHEET)); + uint_least8_t index = sprintf_P(buffer.c,PSTR("%-9.10S["), _T(MSG_SHEET)); eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); buffer.c[index + 7] = ']'; buffer.c[index + 8] = '\0'; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d94d29bed..ee5d06ac3 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -304,7 +304,6 @@ bool lcd_oldcardstatus; #endif uint8_t selected_sheet = 0; -char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"}; bool ignore_click = false; bool wait_for_unclick; @@ -6596,9 +6595,7 @@ static void lcd_reset_sheet() eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name)); menuData->initialized = false; - for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i){ - menuData->name[i] = defaultSheetNames[selected_sheet][i]; - } + strcpy_P(menuData->name, (char *)pgm_read_word(&(defaultSheetNames[selected_sheet]))); eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),0xffff); eeprom_update_block(menuData->name,EEPROM_Sheets_base->s[selected_sheet].name,sizeof(Sheet::name)); From b5129ff2ecf3a2dce3cb7a0ac0867973b1fc49dd Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 23 Jul 2019 11:12:53 +0200 Subject: [PATCH 365/368] Revert "force push" This reverts commit 19e7838c20e499a093356ec34c2de0a81787856b. --- Firmware/Marlin.h | 4 ---- Firmware/eeprom.cpp | 6 +++--- Firmware/menu.cpp | 2 +- Firmware/ultralcd.cpp | 5 ++++- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 6b2261c3c..a44346619 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -331,10 +331,6 @@ extern float retract_length_swap; extern float retract_recover_length_swap; #endif -const char smooth1[] PROGMEM = "Smooth1"; -const char smooth2[] PROGMEM = "Smooth2"; -const char textured[] PROGMEM = "Textur1"; -const char *const defaultSheetNames[] PROGMEM = {smooth1,smooth2,textured}; extern uint8_t host_keepalive_interval; diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 726288b5b..5861109da 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -8,6 +8,7 @@ #include #include + #include "language.h" #if 0 @@ -62,6 +63,7 @@ void eeprom_init() if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0); if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); + char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"}; for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i) { bool is_uninitialized = true; @@ -71,10 +73,8 @@ void eeprom_init() } if(is_uninitialized) { - char sheet_PROGMEM_buffer[8]; - strcpy_P(sheet_PROGMEM_buffer, (char *)pgm_read_word(&(defaultSheetNames[i]))); for (uint_least8_t a = 0; a < sizeof(Sheet::name); ++a){ - eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), sheet_PROGMEM_buffer[a]); + eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), defaultSheetNames[i][a]); } } } diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 7f1ab12f3..e08b5710f 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -202,7 +202,7 @@ void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) //! @param[out] buffer for formatted output void menu_format_sheet_select_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) { - uint_least8_t index = sprintf_P(buffer.c,PSTR("%-9.10S["), _T(MSG_SHEET)); + uint_least8_t index = sprintf_P(buffer.c,PSTR("%.10S ["), _T(MSG_SHEET)); eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); buffer.c[index + 7] = ']'; buffer.c[index + 8] = '\0'; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ee5d06ac3..d94d29bed 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -304,6 +304,7 @@ bool lcd_oldcardstatus; #endif uint8_t selected_sheet = 0; +char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"}; bool ignore_click = false; bool wait_for_unclick; @@ -6595,7 +6596,9 @@ static void lcd_reset_sheet() eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name)); menuData->initialized = false; - strcpy_P(menuData->name, (char *)pgm_read_word(&(defaultSheetNames[selected_sheet]))); + for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i){ + menuData->name[i] = defaultSheetNames[selected_sheet][i]; + } eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),0xffff); eeprom_update_block(menuData->name,EEPROM_Sheets_base->s[selected_sheet].name,sizeof(Sheet::name)); From b9f622f8a6ad503b7840d12ec4e924171b99494d Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 23 Jul 2019 11:31:20 +0200 Subject: [PATCH 366/368] variables to PROGMEM, text formating --- Firmware/Marlin.h | 5 +++++ Firmware/eeprom.cpp | 5 +++-- Firmware/menu.cpp | 2 +- Firmware/ultralcd.cpp | 6 ++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index a44346619..c42bfca09 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -314,6 +314,11 @@ extern bool axis_known_position[3]; extern int fanSpeed; extern int8_t lcd_change_fil_state; +const char smooth1[] PROGMEM = "Smooth1"; +const char smooth2[] PROGMEM = "Smooth2"; +const char textured[] PROGMEM = "Textur1"; +const char *const defaultSheetNames[] PROGMEM = {smooth1,smooth2,textured}; + #ifdef TMC2130 void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0); #else diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 5861109da..c5faec419 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -63,7 +63,6 @@ void eeprom_init() if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0); if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); - char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"}; for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i) { bool is_uninitialized = true; @@ -73,8 +72,10 @@ void eeprom_init() } if(is_uninitialized) { + char sheet_PROGMEM_buffer[8]; + strcpy_P(sheet_PROGMEM_buffer, (char *)pgm_read_word(&(defaultSheetNames[i]))); for (uint_least8_t a = 0; a < sizeof(Sheet::name); ++a){ - eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), defaultSheetNames[i][a]); + eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), sheet_PROGMEM_buffer[a]); } } } diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index e08b5710f..7839bbdc0 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -202,7 +202,7 @@ void menu_format_sheet_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) //! @param[out] buffer for formatted output void menu_format_sheet_select_E(const Sheet &sheet_E, SheetFormatBuffer &buffer) { - uint_least8_t index = sprintf_P(buffer.c,PSTR("%.10S ["), _T(MSG_SHEET)); + uint_least8_t index = sprintf_P(buffer.c,PSTR("%-9.9S["), _T(MSG_SHEET)); eeprom_read_block(&(buffer.c[index]), sheet_E.name, 7); buffer.c[index + 7] = ']'; buffer.c[index + 8] = '\0'; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d94d29bed..4e36c3f77 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -304,7 +304,6 @@ bool lcd_oldcardstatus; #endif uint8_t selected_sheet = 0; -char defaultSheetNames[3][8] = {"Smooth1","Smooth2","Textur1"}; bool ignore_click = false; bool wait_for_unclick; @@ -6596,9 +6595,8 @@ static void lcd_reset_sheet() eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[selected_sheet].name, sizeof(Sheet::name)); menuData->initialized = false; - for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i){ - menuData->name[i] = defaultSheetNames[selected_sheet][i]; - } + strcpy_P(menuData->name, (char *)pgm_read_word(&(defaultSheetNames[selected_sheet]))); + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),0xffff); eeprom_update_block(menuData->name,EEPROM_Sheets_base->s[selected_sheet].name,sizeof(Sheet::name)); From f9e32c4bf4bca3956bc8ee7a2939b46a513f92ae Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 23 Jul 2019 19:22:54 +0200 Subject: [PATCH 367/368] Re-enable linearity correction for MK3. --- Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index 8b843095f..b3828ce53 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -193,9 +193,9 @@ //#define FSENSOR_QUALITY -//#define LINEARITY_CORRECTION -//#define TMC2130_LINEARITY_CORRECTION -//#define TMC2130_LINEARITY_CORRECTION_XYZ +#define LINEARITY_CORRECTION +#define TMC2130_LINEARITY_CORRECTION +#define TMC2130_LINEARITY_CORRECTION_XYZ #define TMC2130_VARIABLE_RESOLUTION From fb35009628773968f5dbb706de1cd5656b9c07f2 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 23 Jul 2019 19:25:59 +0200 Subject: [PATCH 368/368] multiple sheets,fix of bug in switching sheets from menu --- Firmware/ultralcd.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4e36c3f77..21255fb65 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6514,10 +6514,19 @@ static void change_sheet() static void change_sheet_from_menu(){ uint8_t next_sheet = selected_sheet+1; - if(next_sheet > 2) next_sheet = 0; - if(is_sheet_initialized(next_sheet)){ - eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), next_sheet); - selected_sheet = next_sheet; + while(true){ + if(next_sheet > 2) next_sheet = 0; + if(is_sheet_initialized(next_sheet)){ + eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), next_sheet); + selected_sheet = next_sheet; + break; + } + else if (next_sheet == selected_sheet){ + break; + } + else{ + next_sheet++; + } } menu_back(); }