From 06bd56f54da90a481adb83401cf36f3022b717bf Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Tue, 2 Jun 2020 19:20:48 +0200 Subject: [PATCH] Working Implementation of Anycubic Touchscreen. Also with UTF8 workaround when using invalid characters on SD. --- Marlin/Configuration.h | 171 ++++++++++++++---------- Marlin/Configuration_adv.h | 53 ++++---- Marlin/src/core/language.h | 3 +- Marlin/src/inc/Version.h | 46 +++---- Marlin/src/lcd/anycubic_serial.h | 1 - Marlin/src/lcd/anycubic_touchscreen.cpp | 107 ++++++++++----- 6 files changed, 222 insertions(+), 159 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f02e69ee..d0d292de 100755 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -71,8 +71,7 @@ // @section info // Author info of this build printed to the host during boot and M115 -#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. -//#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes) +#define STRING_CONFIG_H_AUTHOR "(knutwurst)" // Who made the changes. /** * *** VENDORS PLEASE READ *** @@ -128,7 +127,7 @@ // Choose the name from boards.h that matches your setup #ifndef MOTHERBOARD - #define MOTHERBOARD BOARD_RAMPS_14_EFB + #define MOTHERBOARD BOARD_TRIGORILLA_14 #endif // Name displayed in the LCD "Ready" message and Info menu @@ -145,7 +144,7 @@ #define EXTRUDERS 1 // Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. -#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0 +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 // For Cyclops or any "multi-extruder" that shares a single nozzle. //#define SINGLENOZZLE @@ -406,7 +405,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. */ -#define TEMP_SENSOR_0 1 +#define TEMP_SENSOR_0 5 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 #define TEMP_SENSOR_3 0 @@ -414,7 +413,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_6 0 #define TEMP_SENSOR_7 0 -#define TEMP_SENSOR_BED 0 +#define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_PROBE 0 #define TEMP_SENSOR_CHAMBER 0 @@ -450,7 +449,7 @@ // Above this temperature the heater will be switched off. // This can protect components from overheating, but NOT from shorts and failures. // (Use MINTEMP for thermistor short/failure protection.) -#define HEATER_0_MAXTEMP 275 +#define HEATER_0_MAXTEMP 295 #define HEATER_1_MAXTEMP 275 #define HEATER_2_MAXTEMP 275 #define HEATER_3_MAXTEMP 275 @@ -483,10 +482,15 @@ // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it + // i3 Mega stock v5 hotend, 40W heater cartridge (3.6Ω @ 22°C) + #define DEFAULT_Kp 15.94 + #define DEFAULT_Ki 1.17 + #define DEFAULT_Kd 54.19 + // Ultimaker - #define DEFAULT_Kp 22.2 - #define DEFAULT_Ki 1.08 - #define DEFAULT_Kd 114 + // #define DEFAULT_Kp 22.2 + // #define DEFAULT_Ki 1.08 + // #define DEFAULT_Kd 114 // MakerGear //#define DEFAULT_Kp 7.0 @@ -517,7 +521,7 @@ * heater. If your configuration is significantly different than this and you don't understand * the issues involved, don't use bed PID until someone else verifies that your hardware works. */ -//#define PIDTEMPBED +#define PIDTEMPBED //#define BED_LIMIT_SWITCHING @@ -533,11 +537,10 @@ //#define MIN_BED_POWER 0 //#define PID_BED_DEBUG // Sends debug data to the serial port. - //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) - //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) - #define DEFAULT_bedKp 10.00 - #define DEFAULT_bedKi .023 - #define DEFAULT_bedKd 305.4 + //Anycubic i3 Mega Ultrabase (0.9Ω @ 22°C) + #define DEFAULT_bedKp 251.78 + #define DEFAULT_bedKi 49.57 + #define DEFAULT_bedKd 319.73 //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //from pidautotune @@ -565,7 +568,7 @@ * Note: For Bowden Extruders make this large enough to allow load/unload. */ #define PREVENT_LENGTHY_EXTRUDE -#define EXTRUDE_MAXLENGTH 200 +#define EXTRUDE_MAXLENGTH 600 //=========================================================================== //======================== Thermal Runaway Protection ======================= @@ -586,7 +589,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed -#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber +//#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -615,7 +618,7 @@ #define USE_XMIN_PLUG #define USE_YMIN_PLUG #define USE_ZMIN_PLUG -//#define USE_XMAX_PLUG +#define USE_XMAX_PLUG //#define USE_YMAX_PLUG //#define USE_ZMAX_PLUG @@ -646,13 +649,13 @@ #endif // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). -#define X_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define Y_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define Z_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. -#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe. +#define X_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define X_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. /** * Stepper Drivers @@ -670,19 +673,20 @@ * TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE'] */ -//#define X_DRIVER_TYPE A4988 -//#define Y_DRIVER_TYPE A4988 -//#define Z_DRIVER_TYPE A4988 -//#define X2_DRIVER_TYPE A4988 -//#define Y2_DRIVER_TYPE A4988 -//#define Z2_DRIVER_TYPE A4988 -//#define Z3_DRIVER_TYPE A4988 -//#define Z4_DRIVER_TYPE A4988 -//#define E0_DRIVER_TYPE A4988 -//#define E1_DRIVER_TYPE A4988 -//#define E2_DRIVER_TYPE A4988 -//#define E3_DRIVER_TYPE A4988 -//#define E4_DRIVER_TYPE A4988 + +#define X_DRIVER_TYPE TMC2208_STANDALONE +#define Y_DRIVER_TYPE TMC2208_STANDALONE +#define Z_DRIVER_TYPE TMC2208_STANDALONE +#define X2_DRIVER_TYPE TMC2208_STANDALONE +#define Y2_DRIVER_TYPE TMC2208_STANDALONE +#define Z2_DRIVER_TYPE TMC2208_STANDALONE +#define Z3_DRIVER_TYPE TMC2208_STANDALONE +#define Z4_DRIVER_TYPE TMC2208_STANDALONE +#define E0_DRIVER_TYPE TMC2208_STANDALONE +#define E1_DRIVER_TYPE TMC2208_STANDALONE +#define E2_DRIVER_TYPE TMC2208_STANDALONE +#define E3_DRIVER_TYPE TMC2208_STANDALONE +#define E4_DRIVER_TYPE TMC2208_STANDALONE //#define E5_DRIVER_TYPE A4988 //#define E6_DRIVER_TYPE A4988 //#define E7_DRIVER_TYPE A4988 @@ -703,7 +707,7 @@ * * :[2,3,4,5,6,7] */ -//#define ENDSTOP_NOISE_THRESHOLD 2 +#define ENDSTOP_NOISE_THRESHOLD 2 //============================================================================= //============================== Movement Settings ============================ @@ -730,14 +734,13 @@ * Override with M92 * X, Y, Z, E0 [, E1[, E2...]] */ -#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 4000, 500 } - +#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 384 } /** * Default Max Feed Rate (mm/s) * Override with M203 * X, Y, Z, E0 [, E1[, E2...]] */ -#define DEFAULT_MAX_FEEDRATE { 300, 300, 5, 25 } +#define DEFAULT_MAX_FEEDRATE { 500, 500, 6, 60 } //#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2 #if ENABLED(LIMITED_MAX_FR_EDITING) @@ -750,7 +753,7 @@ * Override with M201 * X, Y, Z, E0 [, E1[, E2...]] */ -#define DEFAULT_MAX_ACCELERATION { 3000, 3000, 100, 10000 } +#define DEFAULT_MAX_ACCELERATION { 3000, 2000, 60, 10000 } //#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2 #if ENABLED(LIMITED_MAX_ACCEL_EDITING) @@ -765,7 +768,7 @@ * M204 R Retract Acceleration * M204 T Travel Acceleration */ -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_ACCELERATION 1600 // X, Y, Z and E acceleration for printing moves #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves @@ -779,9 +782,9 @@ */ //#define CLASSIC_JERK #if ENABLED(CLASSIC_JERK) - #define DEFAULT_XJERK 10.0 - #define DEFAULT_YJERK 10.0 - #define DEFAULT_ZJERK 0.3 + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 0.4 //#define TRAVEL_EXTRA_XYJERK 0.0 // Additional jerk allowance for all travel moves @@ -812,7 +815,7 @@ * * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained */ -//#define S_CURVE_ACCELERATION +#define S_CURVE_ACCELERATION //=========================================================================== //============================= Z Probe Options ============================= @@ -828,7 +831,7 @@ * * Enable this option for a probe connected to the Z Min endstop pin. */ -#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN +//#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** * Z_MIN_PROBE_PIN @@ -860,7 +863,7 @@ * Use G29 repeatedly, adjusting the Z height at each point with movement commands * or (with LCD_BED_LEVELING) the LCD controller. */ -//#define PROBE_MANUALLY +#define PROBE_MANUALLY //#define MANUAL_PROBE_START_Z 0.2 /** @@ -1056,15 +1059,15 @@ // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR false -#define INVERT_Y_DIR true -#define INVERT_Z_DIR false +#define INVERT_X_DIR false // set to true for stock drivers or TMC2208 with reversed connectors +#define INVERT_Y_DIR true // set to false for stock drivers or TMC2208 with reversed connectors +#define INVERT_Z_DIR true // set to false for stock drivers or TMC2208 with reversed connectors // @section extruder // For direct drive extruder v9 set to true, for geared extruder set to false. -#define INVERT_E0_DIR false -#define INVERT_E1_DIR false +#define INVERT_E0_DIR true // set to false for stock drivers or TMC2208 with reversed connectors +#define INVERT_E1_DIR true // set to false for stock drivers or TMC2208 with reversed connectors #define INVERT_E2_DIR false #define INVERT_E3_DIR false #define INVERT_E4_DIR false @@ -1092,16 +1095,16 @@ // @section machine // The size of the print bed -#define X_BED_SIZE 200 -#define Y_BED_SIZE 200 +#define X_BED_SIZE 215 +#define Y_BED_SIZE 215 // Travel limits (mm) after homing, corresponding to endstop positions. -#define X_MIN_POS 0 +#define X_MIN_POS -5 #define Y_MIN_POS 0 #define Z_MIN_POS 0 #define X_MAX_POS X_BED_SIZE #define Y_MAX_POS Y_BED_SIZE -#define Z_MAX_POS 200 +#define Z_MAX_POS 205 /** * Software Endstops @@ -1206,7 +1209,7 @@ //#define AUTO_BED_LEVELING_LINEAR //#define AUTO_BED_LEVELING_BILINEAR //#define AUTO_BED_LEVELING_UBL -//#define MESH_BED_LEVELING +#define MESH_BED_LEVELING /** * Normally G28 leaves leveling disabled on completion. Enable @@ -1236,11 +1239,11 @@ /** * Enable the G26 Mesh Validation Pattern tool. */ - //#define G26_MESH_VALIDATION + #define G26_MESH_VALIDATION #if ENABLED(G26_MESH_VALIDATION) #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 200 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #define G26_RETRACT_MULTIPLIER 1.0 // G26 Q (retraction) used by default between mesh test elements. @@ -1300,7 +1303,7 @@ //=========================================================================== #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed - #define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited. + #define GRID_MAX_POINTS_X 5 // Don't use more than 7 points per axis, implementation limited. #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS @@ -1442,7 +1445,7 @@ * M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes) * M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.) */ -//#define EEPROM_SETTINGS // Persistent storage with M500 and M501 +#define EEPROM_SETTINGS // Persistent storage with M500 and M501 //#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! #define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. #define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load @@ -1494,7 +1497,7 @@ * P1 Raise the nozzle always to Z-park height. * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. */ -//#define NOZZLE_PARK_FEATURE +#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) // Specify a park position as { X, Y, Z_raise } @@ -1598,7 +1601,7 @@ * * View the current statistics with M78. */ -//#define PRINTCOUNTER +#define PRINTCOUNTER //============================================================================= //============================= LCD and SD support ============================ @@ -1656,7 +1659,7 @@ * you must uncomment the following option or it won't work. * */ -//#define SDSUPPORT +#define SDSUPPORT /** * SD CARD: SPI SPEED @@ -1744,7 +1747,18 @@ // If you have a speaker that can produce tones, enable it here. // By default Marlin assumes you have a buzzer with a fixed frequency. // -//#define SPEAKER +#define SPEAKER + +// Play a (non-earpiercing) startup chime on startup/serial connection +// of the Trigorilla board +//#define STARTUP_CHIME + +// +// ENDSTOP BEEP +// +// Short 2KHz beep when endstops are hit +// +//#define ENDSTOP_BEEP // // The duration and frequency for the UI feedback sound. @@ -2255,3 +2269,22 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES + +/** + * Select your version of the Trigorilla (RAMPS1.4) board here. + * + * 0 = Default Trigorilla + * 1 = Newer Trigorilla v1.1 (first seen late 2018) + * + * The only major difference is a slight change on the servo pin mapping. + * This setting only is relevant if you want to use BLtouch or similar + * mods to be used via servo pins. + * The new version is to be identified by a "TRIGORILLA1.1" lettering + * on the upper left of the PCB silkscreen. + */ +#define TRIGORILLA_VERSION 1 + +// Enable Anycubic TFT +#define ANYCUBIC_TOUCHSCREEN +#define ANYCUBIC_FILAMENT_RUNOUT_SENSOR +#define ANYCUBIC_TFT_DEBUG diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 00f89662..96ff6306 100755 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -149,8 +149,8 @@ * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD */ #if ENABLED(THERMAL_PROTECTION_HOTENDS) - #define THERMAL_PROTECTION_PERIOD 40 // Seconds - #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + #define THERMAL_PROTECTION_PERIOD 3 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 15 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) @@ -169,8 +169,8 @@ * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set * below 2. */ - #define WATCH_TEMP_PERIOD 20 // Seconds - #define WATCH_TEMP_INCREASE 2 // Degrees Celsius + #define WATCH_TEMP_PERIOD 35 // Seconds + #define WATCH_TEMP_INCREASE 5 // Degrees Celsius #endif /** @@ -342,7 +342,7 @@ * off (or reduces to idle speed) shortly after drivers are turned off. * */ -//#define USE_CONTROLLER_FAN +#define USE_CONTROLLER_FAN #if ENABLED(USE_CONTROLLER_FAN) //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan //#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered @@ -420,7 +420,7 @@ * Multiple extruders can be assigned to the same pin in which case * the fan will turn on when any selected extruder is above the threshold. */ -#define E0_AUTO_FAN_PIN -1 +#define E0_AUTO_FAN_PIN FAN2_PIN #define E1_AUTO_FAN_PIN -1 #define E2_AUTO_FAN_PIN -1 #define E3_AUTO_FAN_PIN -1 @@ -517,10 +517,10 @@ // // For Z set the number of stepper drivers // -#define NUM_Z_STEPPER_DRIVERS 1 // (1-4) Z options change based on how many +#define NUM_Z_STEPPER_DRIVERS 2 // (1-4) Z options change based on how many #if NUM_Z_STEPPER_DRIVERS > 1 - //#define Z_MULTI_ENDSTOPS + #define Z_MULTI_ENDSTOPS #if ENABLED(Z_MULTI_ENDSTOPS) #define Z2_USE_ENDSTOP _XMAX_ #define Z2_ENDSTOP_ADJUSTMENT 0 @@ -1515,11 +1515,10 @@ * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ -//#define LIN_ADVANCE +#define LIN_ADVANCE #if ENABLED(LIN_ADVANCE) - //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants - #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed - //#define LA_DEBUG // If enabled, this will generate debug information output over USB. + #define LIN_ADVANCE_K 0 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling @@ -1724,8 +1723,8 @@ // @section serial // The ASCII buffer for serial input -#define MAX_CMD_SIZE 96 -#define BUFSIZE 4 +#define MAX_CMD_SIZE 128 +#define BUFSIZE 8 // Transmission to Host Buffer Size // To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. @@ -1734,13 +1733,13 @@ // For debug-echo: 128 bytes for the optimal speed. // Other output doesn't need to be that speedy. // :[0, 2, 4, 8, 16, 32, 64, 128, 256] -#define TX_BUFFER_SIZE 0 +#define TX_BUFFER_SIZE 4 // Host Receive Buffer Size // Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. // To use flow control, set this buffer size to at least 1024 bytes. // :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] -//#define RX_BUFFER_SIZE 1024 +#define RX_BUFFER_SIZE 256 #if RX_BUFFER_SIZE >= 1024 // Enable to have the controller send XON/XOFF control characters to @@ -1765,7 +1764,7 @@ // enter the serial receive buffer, so they cannot be blocked. // Currently handles M108, M112, M410 // Does not work on boards using AT90USB (USBCON) processors! -//#define EMERGENCY_PARSER +#define EMERGENCY_PARSER // Bad Serial-connections can miss a received command by sending an 'ok' // Therefore some clients abort after 30 seconds in a timeout. @@ -1868,28 +1867,28 @@ * Requires NOZZLE_PARK_FEATURE. * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. */ -//#define ADVANCED_PAUSE_FEATURE +#define ADVANCED_PAUSE_FEATURE #if ENABLED(ADVANCED_PAUSE_FEATURE) #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. - #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. + #define PAUSE_PARK_RETRACT_LENGTH 4 // (mm) Initial retract. // This short retract is done immediately, before parking the nozzle. - #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 30 // (mm/s) Unload filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. + #define FILAMENT_CHANGE_UNLOAD_LENGTH 555 // (mm) The length of filament for a complete unload. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. // Set to 0 for manual unloading. #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. // 0 to disable start loading and skip to fast load only - #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 30 // (mm/s) Load filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 538 // (mm) Load length of filament, from extruder gear to nozzle. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. - #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. - #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. + #define ADVANCED_PAUSE_PURGE_FEEDRATE 2 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. + #define ADVANCED_PAUSE_PURGE_LENGTH 2 // (mm) Length to extrude after loading. // Set to 0 for manual extrusion. // Filament can be extruded repeatedly from the Filament Change menu // until extrusion is consistent, and to purge old filament. @@ -1902,11 +1901,11 @@ #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. #define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload - #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. + #define PAUSE_PARK_NOZZLE_TIMEOUT 600 // (seconds) Time limit before the nozzle is turned off for safety. #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. - //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. + #define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index f58ace77..000c8640 100755 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -126,7 +126,8 @@ #define STR_INVALID_E_STEPPER "Invalid E stepper" #define STR_E_STEPPER_NOT_SPECIFIED "E stepper not specified" #define STR_INVALID_SOLENOID "Invalid solenoid" -#define STR_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID +#define STR_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " MARLIN-AI3M_VERSION:" CUSTOM_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID +#define STR_MARLIN_AI3M "Marlin-AI3M" #define STR_COUNT_X " Count X:" #define STR_COUNT_A " Count A:" #define STR_WATCHDOG_FIRED "Watchdog timeout. Reset required." diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a5960c16..89bb37ff 100755 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -28,19 +28,18 @@ #define SHORT_BUILD_VERSION "2.0.5.3" #endif -/** - * Verbose version identifier containing a unique identifier, such as the - * vendor name, download location, GitHub account, etc. - */ -#ifndef DETAILED_BUILD_VERSION - #define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (GitHub)" -#endif + /** + * Verbose version identifier which should contain a reference to the location + * from where the binary was downloaded or the source code was compiled. + */ + #define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (knutwurst, Github)" /** - * The STRING_DISTRIBUTION_DATE represents when the binary file was built, - * here we define this default string as the date where the latest release - * version was tagged. + * Defines the version of the Marlin build. Not to be confused with + * Marlin's own build number, e.g. 2.0.x. */ + #define CUSTOM_BUILD_VERSION "1.0.0" + #ifndef STRING_DISTRIBUTION_DATE #define STRING_DISTRIBUTION_DATE "2020-03-31" #endif @@ -69,27 +68,24 @@ #define PROTOCOL_VERSION "1.0" #endif -/** - * Define a generic printer name to be output to the LCD after booting Marlin. - */ -#ifndef MACHINE_NAME - #define MACHINE_NAME "3D Printer" -#endif + /** + * Defines a generic printer name to be output to the LCD after booting Marlin. + */ + #define MACHINE_NAME "Anycubic i3 MEGA S" -/** - * Website where users can find Marlin source code for the binary installed on the - * device. Override this if you provide public source code download. (GPLv3 requires - * providing the source code to your customers.) - */ -#ifndef SOURCE_CODE_URL - #define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin" -#endif + /** + * The SOURCE_CODE_URL is the location where users will find the Marlin Source + * Code which is installed on the device. In most cases —unless the manufacturer + * has a distinct Github fork— the Source Code URL should just be the main + * Marlin repository. + */ + #define SOURCE_CODE_URL "https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S" /** * Default generic printer UUID. */ #ifndef DEFAULT_MACHINE_UUID - #define DEFAULT_MACHINE_UUID "cede2a2f-41a2-4748-9b12-c55c62f367ff" + #define DEFAULT_MACHINE_UUID "b6153152-86fb-4cd8-bda7-91c6a04c467d" #endif /** diff --git a/Marlin/src/lcd/anycubic_serial.h b/Marlin/src/lcd/anycubic_serial.h index cfb8dba6..2c2aa1e1 100755 --- a/Marlin/src/lcd/anycubic_serial.h +++ b/Marlin/src/lcd/anycubic_serial.h @@ -131,7 +131,6 @@ const char newSucc[] PROGMEM = "OK"; #define ANYCUBIC_SERIAL_ERRORLN(x) ANYCUBIC_SERIAL_PROTOCOLLN(x) #define ANYCUBIC_SERIAL_ERRORLNPGM(x) ANYCUBIC_SERIAL_PROTOCOLLNPGM(x) -//##define ANYCUBIC_SERIAL_ECHO_START (AnycubicSerialprintPGM(newSucc)) #define ANYCUBIC_SERIAL_ECHOLN(x) ANYCUBIC_SERIAL_PROTOCOLLN(x) #define ANYCUBIC_SERIAL_SUCC_START (AnycubicSerialprintPGM(newSucc)) #define ANYCUBIC_SERIAL_ECHOPAIR(name, value) (serial_echopair_P(PSTR(name), (value))) diff --git a/Marlin/src/lcd/anycubic_touchscreen.cpp b/Marlin/src/lcd/anycubic_touchscreen.cpp index c8acd6b2..6f9fc9c0 100755 --- a/Marlin/src/lcd/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/anycubic_touchscreen.cpp @@ -509,44 +509,49 @@ void AnycubicTouchscreenClass::Ls() switch (filenumber) { case 0: // First Page - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); break; case 4: // Second Page - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); break; case 8: // Third Page - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); break; - +/* case 12: // Fourth Page - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); - ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); + ANYCUBIC_SERIAL_PROTOCOLLNPGM(""); break; +*/ default: break; @@ -590,24 +595,54 @@ void AnycubicTouchscreenClass::Ls() else { card.selectFileByIndex(cnt - 1); - // card.selectFileByIndex(cnt); + + bool hasInvalidCharacter = false; + for (unsigned char currentChar = 0; currentChar < strlen(card.longFilename); currentChar++) + if (!isAscii(card.longFilename[currentChar])) + { + hasInvalidCharacter = true; + break; + } if (card.flag.filenameIsDir) { - ANYCUBIC_SERIAL_PROTOCOLPGM("/"); - ANYCUBIC_SERIAL_PROTOCOLLN(card.filename); - ANYCUBIC_SERIAL_PROTOCOLPGM("/"); - ANYCUBIC_SERIAL_PROTOCOLLN(card.longFilename); - SERIAL_ECHO(cnt); - SERIAL_ECHOPGM("/"); - SERIAL_ECHOLN(card.longFilename); + if(hasInvalidCharacter) + { + ANYCUBIC_SERIAL_PROTOCOLPGM("/"); + ANYCUBIC_SERIAL_PROTOCOLLN(card.filename); + ANYCUBIC_SERIAL_PROTOCOLPGM("/"); + ANYCUBIC_SERIAL_PROTOCOLLN(card.filename); + SERIAL_ECHO(cnt); + SERIAL_ECHOPGM("/"); + SERIAL_ECHOLN(card.filename); + } + else + { + ANYCUBIC_SERIAL_PROTOCOLPGM("/"); + ANYCUBIC_SERIAL_PROTOCOLLN(card.longFilename); + ANYCUBIC_SERIAL_PROTOCOLPGM("/"); + ANYCUBIC_SERIAL_PROTOCOLLN(card.longFilename); + SERIAL_ECHO(cnt); + SERIAL_ECHOPGM("/"); + SERIAL_ECHOLN(card.longFilename); + } } else { - ANYCUBIC_SERIAL_PROTOCOLLN(card.filename); - ANYCUBIC_SERIAL_PROTOCOLLN(card.longFilename); - SERIAL_ECHO(cnt); - SERIAL_ECHOLN(card.longFilename); + if(hasInvalidCharacter) + { + ANYCUBIC_SERIAL_PROTOCOLLN(card.filename); + ANYCUBIC_SERIAL_PROTOCOLLN(card.filename); + SERIAL_ECHO(cnt); + SERIAL_ECHOLN(card.filename); + } + else + { + ANYCUBIC_SERIAL_PROTOCOLLN(card.longFilename); + ANYCUBIC_SERIAL_PROTOCOLLN(card.longFilename); + SERIAL_ECHO(cnt); + SERIAL_ECHOLN(card.longFilename); + } } } } @@ -1152,7 +1187,7 @@ void AnycubicTouchscreenClass::GetCommandFromTFT() thermalManager.setTargetHotend(tempvalue, 0); } } - // ANYCUBIC_SERIAL_ENTER(); + // ANYCUBIC_SERIAL_ENTER(); break; case 17: // A17 set heated bed temp {