From bf8b6729b259973a2f9efe84b9a825e60e9da829 Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Sun, 24 Mar 2019 16:57:31 +0100 Subject: [PATCH 1/4] Add optional startup chime Enable STARTUP_CHIME in Configuration.h to play a short chime on Trigorilla startup/serial connection, disabled by default --- Marlin/AnycubicTFT.cpp | 7 +++++++ Marlin/Configuration.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/Marlin/AnycubicTFT.cpp b/Marlin/AnycubicTFT.cpp index 46bd506..f2766ab 100644 --- a/Marlin/AnycubicTFT.cpp +++ b/Marlin/AnycubicTFT.cpp @@ -115,6 +115,13 @@ void AnycubicTFTClass::Setup() { SelectedDirectory[0]=0; SpecialMenu=false; + + #ifdef STARTUP_CHIME + buzzer.tone(250, 554); // C#5 + buzzer.tone(250, 740); // F#5 + buzzer.tone(250, 554); // C#5 + buzzer.tone(500, 831); // G#5 + #endif } void AnycubicTFTClass::WriteOutageEEPromData() { diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 995eeb8..fb2be19 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1518,6 +1518,14 @@ // #define SPEAKER +// +// STARTUP CHIME +// +// Play a (non-earpiercing) startup chime on startup/serial connection +// of the Trigorilla board +// +//#define STARTUP_CHIME + // // The duration and frequency for the UI feedback sound. // Set these to 0 to disable audio feedback in the LCD menus. From fd8f28257f06e1758f5f5729524fa71d326c37d8 Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Sun, 24 Mar 2019 18:30:53 +0100 Subject: [PATCH 2/4] Raise PWM frequency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjusting PWM frequencies to better match FDD8780 MOSFET spec. - Hotend PWM frequency increased from 488.28 Hz to 1953.12 Hz – Referencing the Forward Bias Safe Area from the hotend MOSFET's datasheet, this value should be safer. - Hotbed PWM frequency increased from 7.26Hz to 30.48Hz - Use software PWM for fans to reduce whine – The higher PWM frequency works well with the stock parts cooling fan and might allow for better control of third party fans --- Marlin/Configuration.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index fb2be19..8c488f6 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -379,10 +379,10 @@ // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it - // i3 Mega - #define DEFAULT_Kp 15.94 - #define DEFAULT_Ki 1.17 - #define DEFAULT_Kd 54.19 + // i3 Mega stock v5 hotend, 40W heater cartridge (3.6Ω @ 22°C) + #define DEFAULT_Kp 18.58 + #define DEFAULT_Ki 1.38 + #define DEFAULT_Kd 62.40 // Ultimaker //#define DEFAULT_Kp 22.2 @@ -436,10 +436,10 @@ //#define PID_BED_DEBUG // Sends debug data to the serial port. - //Anycubic i3 Mega 160W Ultrabase - #define DEFAULT_bedKp 251.78 - #define DEFAULT_bedKi 49.57 - #define DEFAULT_bedKd 319.73 + //Anycubic i3 Mega Ultrabase (0.9Ω @ 22°C) + #define DEFAULT_bedKp 187.45 + #define DEFAULT_bedKi 35.75 + #define DEFAULT_bedKd 245.71 //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //from pidautotune @@ -1827,13 +1827,13 @@ // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency // which is not as annoying as with the hardware PWM. On the other hand, if this frequency // is too low, you should also increment SOFT_PWM_SCALE. -//#define FAN_SOFT_PWM +#define FAN_SOFT_PWM // 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; // at zero value, there are 128 effective control positions. -#define SOFT_PWM_SCALE 0 +#define SOFT_PWM_SCALE 2 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can // be used to mitigate the associated resolution loss. If enabled, From 9c133f5c05719577fc6364ebedd891f945a4ae4b Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Sun, 24 Mar 2019 21:20:54 +0100 Subject: [PATCH 3/4] Add unretraction parameter to G26 G26 Gcode: - Change Q parameter to only specify retraction length - Add Z parameter for unretraction length - Preserve fixed multiplier of 1.2 if Z isn't specified - Add check to avoid implausible retract/unretract ratios - Change default config values Referencing #31. Thanks to @BlackMulch for the feedback! --- Marlin/G26_Mesh_Validation_Tool.cpp | 58 +++++++++++++++++++++++------ Marlin/Version.h | 4 +- README.md | 17 +++------ 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/Marlin/G26_Mesh_Validation_Tool.cpp b/Marlin/G26_Mesh_Validation_Tool.cpp index ea8b601..ef898f9 100644 --- a/Marlin/G26_Mesh_Validation_Tool.cpp +++ b/Marlin/G26_Mesh_Validation_Tool.cpp @@ -44,8 +44,9 @@ #endif #define EXTRUSION_MULTIPLIER 1.0 - #define RETRACTION_MULTIPLIER 6 - #define PRIME_LENGTH 25.0 + #define RETRACTION_LENGTH 1 + #define UNRETRACTION_LENGTH 1.2 + #define PRIME_LENGTH 5 #define OOZE_AMOUNT 2.25 #define INTERSECTION_CIRCLE_RADIUS 5 @@ -107,8 +108,9 @@ * pliers while holding the LCD Click wheel in a depressed state. If you do not have * an LCD, you must specify a value if you use P. * - * Q # Multiplier Retraction Multiplier. Normally not needed. Retraction defaults to 1.0mm and - * un-retraction is at 1.2mm These numbers will be scaled by the specified amount + * Q # Retract Retraction length. Defaults to 1mm if not specified. + * Z # Unretract Unretraction length. Defaults to 1.2mm if not specified. + * Note: If Q is specified but Z isn't, Z defaults to Q * 1.2. * * R # Repeat Prints the number of patterns given as a parameter, starting at the current location. * If a parameter isn't given, every point will be printed unless G26 is interrupted. @@ -145,7 +147,8 @@ // retracts/recovers won't result in a bad state. static float g26_extrusion_multiplier, - g26_retraction_multiplier, + g26_retraction_length, + g26_unretraction_length, g26_layer_height, g26_prime_length, g26_x_pos, g26_y_pos; @@ -223,13 +226,13 @@ void retract_filament(const float where[XYZE]) { if (!g26_retracted) { // Only retract if we are not already retracted! g26_retracted = true; - move_to(where, -1.0 * g26_retraction_multiplier); + move_to(where, -1.0 * g26_retraction_length); } } void recover_filament(const float where[XYZE]) { if (g26_retracted) { // Only un-retract if we are retracted. - move_to(where, 1.2 * g26_retraction_multiplier); + move_to(where, g26_unretraction_length); g26_retracted = false; } } @@ -564,7 +567,8 @@ if (axis_unhomed_error()) return; g26_extrusion_multiplier = EXTRUSION_MULTIPLIER; - g26_retraction_multiplier = RETRACTION_MULTIPLIER; + g26_retraction_length = RETRACTION_LENGTH; + g26_unretraction_length = UNRETRACTION_LENGTH; g26_layer_height = MESH_TEST_LAYER_HEIGHT; g26_prime_length = PRIME_LENGTH; g26_bed_temp = MESH_TEST_BED_TEMP; @@ -596,14 +600,44 @@ if (parser.seen('Q')) { if (parser.has_value()) { - g26_retraction_multiplier = parser.value_float(); - if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) { - SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible."); + g26_retraction_length = parser.value_float(); + if (!WITHIN(g26_retraction_length, 0.05, 15.0)) { + SERIAL_PROTOCOLLNPGM("?Specified Retraction length not plausible."); return; } } else { - SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified."); + SERIAL_PROTOCOLLNPGM("?Retraction length must be specified."); + return; + } + } + + if (parser.seen('Z')) { + if (parser.has_value()) { + g26_unretraction_length = parser.value_float(); + if (!WITHIN(g26_unretraction_length, 0.05, 15.0)) { + SERIAL_PROTOCOLLNPGM("?Specified Unretraction length not plausible."); + return; + } + } + else { + SERIAL_PROTOCOLLNPGM("?Unretraction length must be specified."); + return; + } + } + + if (!parser.seen('Z') && parser.seen('Q')) { + // retraction without unretraction specified, use 1.2 multiplier (preserve Gcode spec) + g26_unretraction_length = g26_retraction_length * 1.2; + SERIAL_ECHOPAIR(" Unretraction amount automatically set to ", g26_unretraction_length); + SERIAL_EOL(); + } + + if (parser.seen('Z') && parser.seen('Q')) { + // consider typos or unreasonable retract/unretract ratios + float g26_retract_unretract_delta = g26_unretraction_length - g26_retraction_length; + if (!WITHIN(g26_retract_unretract_delta, -5, 5)) { + SERIAL_PROTOCOLLNPGM("?Invalid Retraction/Unretraction ratio. Must be within 5mm."); return; } } diff --git a/Marlin/Version.h b/Marlin/Version.h index faa49fa..f5de352 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * Defines the version of the Marlin-AI3M build. Not to be confused with * Marlin's own build number, e.g. 1.1.9. */ - #define CUSTOM_BUILD_VERSION "v1.4.4" + #define CUSTOM_BUILD_VERSION "v1.4.5" /** * Verbose version identifier which should contain a reference to the location @@ -54,7 +54,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ - #define STRING_DISTRIBUTION_DATE "2019-03-13" + #define STRING_DISTRIBUTION_DATE "2019-03-24" /** * Required minimum Configuration.h and Configuration_adv.h file versions. diff --git a/README.md b/README.md index ef7c8d1..cd6ead9 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,18 @@ -# Anycubic i3 Mega Marlin 1.1.9 by davidramiro +# Anycubic i3 Mega / Mega-S Marlin 1.1.9 by davidramiro [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3MFT8QMP5ZRCE&source=url) [![Downloads](https://img.shields.io/github/downloads/davidramiro/Marlin-AI3M/total.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/releases) [![Open Issues](https://img.shields.io/github/issues-raw/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/issues?q=is%3Aopen+is%3Aissue) [![Closed Issues](https://img.shields.io/github/issues-closed-raw/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/issues?q=is%3Aissue+is%3Aclosed) [![License](https://img.shields.io/github/license/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/blob/master/LICENSE) [![Latest Release](https://img.shields.io/github/release/davidramiro/Marlin-AI3m.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/releases/latest/) ![](https://img.shields.io/github/last-commit/davidramiro/Marlin-AI3m.svg?style=flat) -This is my slightly customized version of the [Marlin Firmware](https://github.com/MarlinFirmware/Marlin), gratefully based on [derhopp's repo](https://github.com/derhopp/Marlin-with-Anycubic-i3-Mega-TFT) with his remarkable efforts to get the Anycubic i3 Mega TFT screen to work. - -Feel free to discuss issues and work with me further optimizing this firmware! - -This firmware works on every i3 Mega that has two Z-axis endstops. If you have an older model with only one Z endstop, a small [adjustment](https://github.com/davidramiro/Marlin-AI3M/wiki/Customization-&-Compiling#single-z-endstop) is required. - -The new **Mega-S** should work too, but you will need to enter two additional commands after flashing the firmware, mentioned in the instructions below. +This is a custom version of the [Marlin Firmware](https://github.com/MarlinFirmware/Marlin) for the i3 Mega/Mega-S, gratefully based on [derhopp's repo](https://github.com/derhopp/Marlin-with-Anycubic-i3-Mega-TFT) with his remarkable efforts to get the Anycubic TFT screen to work with the latest versions of Marlin. Looking for a **BLtouch firmware**? Head [this way](https://github.com/MNieddu91/Marlin-AI3M-BLTouch)! Mounting and configuration instructions are included. -Note: This is just a firmware, not magic. A big part of print quality still depends on your slicer settings and mechanical condition of your machine. - #### Make sure to take a look at the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/), especially the [FAQ](https://github.com/davidramiro/Marlin-AI3M/wiki/Frequently-Asked-Questions). A German translation of the instructions can be found [here](https://kore.cc/i3mega/download/marlin-ai3m_german.pdf). ## Why use this? -While the i3 Mega is a great printer for its price and produces fantastic results in stock, there are some issues that are easily addressed: +While the i3 Mega is a great printer for its price and produces fantastic results in stock, there are some improvements and additional features that this firmware provides: - Many people have issues getting the Ultrabase leveled perfectly, using Manual Mesh Bed Leveling the printer generates a mesh of the flatness of the bed and compensates for it on the Z-axis for perfect prints without having to level with the screws. - Much more efficient bed heating by using PID control. This uses less power and holds the temperature at a steady level. Highly recommended for printing ABS. @@ -156,10 +148,11 @@ M420 S1 - No need to download or create a bed leveling test, simply send those commands to your printer: ``` G28 -G26 C H200 P25 R25 +G26 C H200 P5 R25 Q4.2 Z4 ``` - To adjust your filament's needed temperature, change the number of the `H` parameter - Default bed temperature is 60°C, if you need another temperature, add e.g. `B80` +- `Q` parameter sets retraction length in mm, `Z` sets unretraction. - If your leveling is good, you will have a complete pattern of your mesh on your bed that you can peel off in one piece - Don't worry if the test looks a bit messy, the important thing is just that the line width is the same all over the mesh - Optional: Hang it up on a wall to display it as a trophy of how great your leveling skills are. From a2c47b53c21e804138e01d30541faf34d7d03b0e Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Mon, 25 Mar 2019 19:15:28 +0100 Subject: [PATCH 4/4] Add optional endstop beeps Enable ENDSTOP_BEEP in Configuration.h to enable a 2KHz beep when endstops are hit. Disabled by default. --- Marlin/Configuration.h | 7 +++++++ Marlin/Marlin_main.cpp | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 8c488f6..7a5b278 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1526,6 +1526,13 @@ // //#define STARTUP_CHIME +// +// ENDSTOP BEEP +// +// Short 2KHz beep when endstops are hit +// +//#define ENDSTOP_BEEP + // // The duration and frequency for the UI feedback sound. // Set these to 0 to disable audio feedback in the LCD menus. diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6611bc9..1192126 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -14815,6 +14815,25 @@ void disable_all_steppers() { disable_e_steppers(); } +#ifdef ENDSTOP_BEEP + void EndstopBeep() { + static char last_status=((READ(X_MIN_PIN)<<2)|(READ(Y_MIN_PIN)<<1)|READ(X_MAX_PIN)); + static unsigned char now_status; + + now_status=((READ(X_MIN_PIN)<<2)|(READ(Y_MIN_PIN)<<1)|READ(X_MAX_PIN))&0xff; + + if(now_status