Commit f9402c11 authored by Franco (nextime) Lanza's avatar Franco (nextime) Lanza

Merge remote-tracking branch 'upstream/dev' into dev

parents 1e4aa09f f33933b0
### Version 4.2.81
* Fix serial protocol for Repetier Host
* Bug fix
### Version 4.2.8 ### Version 4.2.8
* Add board folder with files of various board containing the pins * Add board folder with files of various board containing the pins
* Add End time on Graphics display when SD print * Add End time on Graphics display when SD print
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* - Extruders number * - Extruders number
* - Thermistor type * - Thermistor type
* - Temperature limits * - Temperature limits
* - UI Language
* *
* Mechanisms-settings can be found in Configuration_Xxxxxx.h (where Xxxxxx can be: Cartesian - Delta - Core - Scara) * Mechanisms-settings can be found in Configuration_Xxxxxx.h (where Xxxxxx can be: Cartesian - Delta - Core - Scara)
* Feature-settings can be found in Configuration_Feature.h * Feature-settings can be found in Configuration_Feature.h
...@@ -244,34 +243,4 @@ ...@@ -244,34 +243,4 @@
#define GUM_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255 #define GUM_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
/*****************************************************************************************************/ /*****************************************************************************************************/
/***********************************************************************
*************************** UI Language ******************************
***********************************************************************
* *
* Select the language that you prefer and change LANGUAGE_CHOICE *
* *
* 1 English *
* 2 Polish *
* 3 French *
* 4 German *
* 5 Spanish *
* 6 Russian *
* 7 Italian *
* 8 Portuguese *
* 9 Finnish *
* 10 Aragonese *
* 11 Dutch *
* 12 Danish *
* 13 Catalan *
* 14 Basque-Euskera *
* 15 Portuguese (Brazil) *
* 16 Bulgarian *
* 17 Japanese *
* 18 Japanese utf *
* 19 Chinese *
* *
***********************************************************************/
#define LANGUAGE_CHOICE 1
/***********************************************************************/
#endif #endif
...@@ -142,9 +142,6 @@ ...@@ -142,9 +142,6 @@
// Precision for G30 delta autocalibration function // Precision for G30 delta autocalibration function
#define AUTOCALIBRATION_PRECISION 0.1 // mm #define AUTOCALIBRATION_PRECISION 0.1 // mm
// Precision probe. Number of probe for the mean
#define PROBE_COUNT 3
// Z-Probe variables // Z-Probe variables
// Offsets to the probe relative to the extruder tip (Hotend - Probe) // Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets MUST be INTEGERS // X and Y offsets MUST be INTEGERS
...@@ -163,13 +160,13 @@ ...@@ -163,13 +160,13 @@
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // Z offset: -below [of the nozzle] (always negative!) #define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // Z offset: -below [of the nozzle] (always negative!)
// Start and end location values are used to deploy/retract the probe (will move from start to end and back again) // Start and end location values are used to deploy/retract the probe (will move from start to end and back again)
#define Z_PROBE_DEPLOY_START_LOCATION {0, 0, 20} // X, Y, Z, E start location for z-probe deployment sequence #define Z_PROBE_DEPLOY_START_LOCATION {0, 0, 30} // X, Y, Z, E start location for z-probe deployment sequence
#define Z_PROBE_DEPLOY_END_LOCATION {0, 0, 20} // X, Y, Z, E end location for z-probe deployment sequence #define Z_PROBE_DEPLOY_END_LOCATION {0, 0, 30} // X, Y, Z, E end location for z-probe deployment sequence
#define Z_PROBE_RETRACT_START_LOCATION {0, 0, 20} // X, Y, Z, E start location for z-probe retract sequence #define Z_PROBE_RETRACT_START_LOCATION {0, 0, 30} // X, Y, Z, E start location for z-probe retract sequence
#define Z_PROBE_RETRACT_END_LOCATION {0, 0, 20} // X, Y, Z, E end location for z-probe retract sequence #define Z_PROBE_RETRACT_END_LOCATION {0, 0, 30} // X, Y, Z, E end location for z-probe retract sequence
// How much the nozzle will be raised when travelling from between next probing points // How much the nozzle will be raised when travelling from between next probing points
#define Z_RAISE_BETWEEN_PROBINGS 5 #define Z_RAISE_BETWEEN_PROBINGS 30
// Define the grid for bed level AUTO BED LEVELING GRID POINTS X AUTO BED LEVELING GRID POINTS. // Define the grid for bed level AUTO BED LEVELING GRID POINTS X AUTO BED LEVELING GRID POINTS.
#define AUTO_BED_LEVELING_GRID_POINTS 9 #define AUTO_BED_LEVELING_GRID_POINTS 9
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
* ADDON FEATURES: * ADDON FEATURES:
* - EEPROM * - EEPROM
* - SDCARD * - SDCARD
* - LCD Language
* - LCD * - LCD
* - Canon RC-1 Remote * - Canon RC-1 Remote
* - Camera trigger * - Camera trigger
...@@ -310,13 +311,21 @@ ...@@ -310,13 +311,21 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds #define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
// Whenever an M104 or M109 increases the target temperature the firmware will wait for the /**
// WATCH TEMP PERIOD to expire, and if the temperature hasn't increased by WATCH TEMP INCREASE * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
// degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109, * WATCH TEMP PERIOD to expire, and if the temperature hasn't increased by WATCH TEMP INCREASE
//but only if the current temperature is far enough below the target for a reliable test. * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
#define WATCH_TEMP_PERIOD 16 // Seconds * but only if the current temperature is far enough below the target for a reliable test.
#define WATCH_TEMP_INCREASE 4 // Degrees Celsius *
* If you get false positives for "Heating failed" increase WATCH TEMP PERIOD and/or decrease WATCH TEMP INCREASE
* WATCH TEMP INCREASE should not be below 2.
*/
#define WATCH_TEMP_PERIOD 20 // Seconds
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius
/**
* Thermal Protection parameters for the bed are just as above for hotends.
*/
//#define THERMAL_PROTECTION_BED //#define THERMAL_PROTECTION_BED
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
...@@ -325,7 +334,7 @@ ...@@ -325,7 +334,7 @@
//#define THERMAL_PROTECTION_COOLER //#define THERMAL_PROTECTION_COOLER
#define THERMAL_PROTECTION_BED_COOLER 30 // Seconds #define THERMAL_PROTECTION_COOLER_PERIOD 30 // Seconds
#define THERMAL_PROTECTION_COOLER_HYSTERESIS 3 // Degree Celsius #define THERMAL_PROTECTION_COOLER_HYSTERESIS 3 // Degree Celsius
// Using M141 to set cooling temperature the firmware will wait for the WATCH_COOLER_TEMP_PERIOD // Using M141 to set cooling temperature the firmware will wait for the WATCH_COOLER_TEMP_PERIOD
...@@ -338,8 +347,17 @@ ...@@ -338,8 +347,17 @@
#define WATCH_TEMP_COOLER_PERIOD 60 // Seconds #define WATCH_TEMP_COOLER_PERIOD 60 // Seconds
#define WATCH_TEMP_COOLER_DECREASE 1 // Degree Celsius #define WATCH_TEMP_COOLER_DECREASE 1 // Degree Celsius
/**
* Whenever an M140 or M190 increases the target temperature the firmware will wait for the
* WATCH BED TEMP PERIOD to expire, and if the temperature hasn't increased by WATCH BED TEMP INCREASE
* degrees, the machine is halted, requiring a hard reset. This test restarts with any M140/M190,
* but only if the current temperature is far enough below the target for a reliable test.
*
* If you get too many "Heating failed" errors, increase WATCH BED TEMP PERIOD and/or decrease
* WATCH BED TEMP INCREASE. (WATCH BED TEMP INCREASE should not be below 2.)
*/
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
/********************************************************************************/ /********************************************************************************/
...@@ -624,9 +642,21 @@ ...@@ -624,9 +642,21 @@
*****************************************************************************************/ *****************************************************************************************/
//#define ADVANCE //#define ADVANCE
#define EXTRUDER_ADVANCE_K .0 #define EXTRUDER_ADVANCE_K 0.0
#define D_FILAMENT 1.75 #define D_FILAMENT 1.75
#define STEPS_PER_CUBIC_MM_E 0.85 /*****************************************************************************************/
/*****************************************************************************************
****************** Extruder Advance Linear Pressure Control *****************************
*****************************************************************************************
* *
* Assumption: advance = k * (delta velocity) *
* K=0 means advance disabled. A good value for a gregs wade extruder will be around K=75*
* *
*****************************************************************************************/
//#define ADVANCE_LPC
#define ADVANCE_LPC_K 75
/*****************************************************************************************/ /*****************************************************************************************/
...@@ -1074,6 +1104,7 @@ ...@@ -1074,6 +1104,7 @@
/**************************************************************************/ /**************************************************************************/
//=========================================================================== //===========================================================================
//============================= ADDON FEATURES ============================== //============================= ADDON FEATURES ==============================
//=========================================================================== //===========================================================================
...@@ -1130,9 +1161,25 @@ ...@@ -1130,9 +1161,25 @@
/*****************************************************************************************/ /*****************************************************************************************/
/************************************************************************************************ /***********************************************************************
********************************************* LCD ********************************************** *************************** LCD Language ******************************
************************************************************************************************/ ***********************************************************************
* *
* Here you may choose the language used by MK or MK4due *
* on the LCD menus, the following *
* *
* list of languages are available: *
* en, pl, fr, de, es, ru, it, pt, fi, an, nl, ca, eu *
* pt-br, bg, kana, kana_utf8, cn *
* *
***********************************************************************/
#define LCD_LANGUAGE en
/***********************************************************************/
/***********************************************************************
******************************* LCD ***********************************
***********************************************************************/
//Charset type //Charset type
//Choose ONE of these 3 charsets. This has to match your hardware. //Choose ONE of these 3 charsets. This has to match your hardware.
......
#include "base.h" /**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/** /**
* configuration_store.cpp * configuration_store.cpp
...@@ -15,6 +35,7 @@ ...@@ -15,6 +35,7 @@
* either sets a Sane Default, or results in No Change to the existing value. * either sets a Sane Default, or results in No Change to the existing value.
* *
*/ */
#include "base.h"
#define EEPROM_VERSION "MKV429" #define EEPROM_VERSION "MKV429"
...@@ -665,8 +686,8 @@ void Config_ResetDefault() { ...@@ -665,8 +686,8 @@ void Config_ResetDefault() {
ECHO_LM(CFG, "Maximum feedrates (mm/s):"); ECHO_LM(CFG, "Maximum feedrates (mm/s):");
} }
ECHO_SMV(CFG, " M203 X", max_feedrate[X_AXIS]); ECHO_SMV(CFG, " M203 X", max_feedrate[X_AXIS]);
ECHO_MV(" Y", max_feedrate[Y_AXIS] ); ECHO_MV(" Y", max_feedrate[Y_AXIS] );
ECHO_MV(" Z", max_feedrate[Z_AXIS] ); ECHO_MV(" Z", max_feedrate[Z_AXIS] );
ECHO_EMV(" E", max_feedrate[E_AXIS]); ECHO_EMV(" E", max_feedrate[E_AXIS]);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
for (short i = 1; i < EXTRUDERS; i++) { for (short i = 1; i < EXTRUDERS; i++) {
......
/**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef CONFIGURATION_STORE_H #ifndef CONFIGURATION_STORE_H
#define CONFIGURATION_STORE_H #define CONFIGURATION_STORE_H
void Config_ResetDefault(); void Config_ResetDefault();
void ConfigSD_ResetDefault(); void ConfigSD_ResetDefault();
#if DISABLED(DISABLE_M503) #if DISABLED(DISABLE_M503)
void Config_PrintSettings(bool forReplay = false); void Config_PrintSettings(bool forReplay = false);
void ConfigSD_PrintSettings(bool forReplay = false); void ConfigSD_PrintSettings(bool forReplay = false);
#else #else
FORCE_INLINE void Config_PrintSettings(bool forReplay = false) {} FORCE_INLINE void Config_PrintSettings(bool forReplay = false) {}
FORCE_INLINE void ConfigSD_PrintSettings(bool forReplay = false) {} FORCE_INLINE void ConfigSD_PrintSettings(bool forReplay = false) {}
#endif #endif
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
void Config_StoreSettings(); void Config_StoreSettings();
void Config_RetrieveSettings(); void Config_RetrieveSettings();
#else #else
FORCE_INLINE void Config_StoreSettings() {} FORCE_INLINE void Config_StoreSettings() {}
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); } FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
#endif #endif
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS) #if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
#define CFG_SD_MAX_KEY_LEN 3+1 // icrease this if you add key name longer than the actual value. #define CFG_SD_MAX_KEY_LEN 3+1 // icrease this if you add key name longer than the actual value.
#define CFG_SD_MAX_VALUE_LEN 10+1 // this should be enought for int, long and float if you need to retrive strings increase this carefully #define CFG_SD_MAX_VALUE_LEN 10+1 // this should be enought for int, long and float if you need to retrive strings increase this carefully
//(11 = strlen("4294967295")+1) (4294967295 = (2^32)-1) (32 = the num of bits of the bigger basic data scructor used) //(11 = strlen("4294967295")+1) (4294967295 = (2^32)-1) (32 = the num of bits of the bigger basic data scructor used)
//If yuou need to save string increase this to strlen("YOUR LONGER STRING")+1 //If yuou need to save string increase this to strlen("YOUR LONGER STRING")+1
void ConfigSD_StoreSettings(); void ConfigSD_StoreSettings();
void ConfigSD_RetrieveSettings(bool addValue = false); void ConfigSD_RetrieveSettings(bool addValue = false);
int ConfigSD_KeyIndex(char *key); int ConfigSD_KeyIndex(char *key);
#else #else
FORCE_INLINE void ConfigSD_RetrieveSettings() { ConfigSD_ResetDefault(); } FORCE_INLINE void ConfigSD_RetrieveSettings() { ConfigSD_ResetDefault(); }
#endif #endif
#endif //CONFIGURATION_STORE_H #endif //CONFIGURATION_STORE_H
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef CONFIGURATION_VERSION_H #ifndef CONFIGURATION_VERSION_H
#define CONFIGURATION_VERSION_H #define CONFIGURATION_VERSION_H
#define FIRMWARE_NAME "MK" #define FIRMWARE_NAME "MK"
#define SHORT_BUILD_VERSION "4.2.8_dev" #define SHORT_BUILD_VERSION "4.2.81_dev"
#define BUILD_VERSION FIRMWARE_NAME "_" SHORT_BUILD_VERSION #define BUILD_VERSION FIRMWARE_NAME "_" SHORT_BUILD_VERSION
#define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time #define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time
// It might also be appropriate to define a location where additional information can be found // It might also be appropriate to define a location where additional information can be found
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "module/motion/planner.h" #include "module/motion/planner.h"
#include "module/motion/stepper_indirection.h" #include "module/motion/stepper_indirection.h"
#include "module/motion/stepper.h" #include "module/motion/stepper.h"
#include "module/motion/endstops.h"
#include "module/motion/vector_3.h" #include "module/motion/vector_3.h"
#include "module/motion/qr_solve.h" #include "module/motion/qr_solve.h"
#include "module/motion/cartesian_correction.h" #include "module/motion/cartesian_correction.h"
......
This diff is collapsed.
...@@ -36,23 +36,26 @@ void idle( ...@@ -36,23 +36,26 @@ void idle(
void manage_inactivity(bool ignore_stepper_queue = false); void manage_inactivity(bool ignore_stepper_queue = false);
#if ENABLED(DUAL_X_CARRIAGE)
extern bool extruder_duplication_enabled;
#endif
void FlushSerialRequestResend(); void FlushSerialRequestResend();
void ok_to_send(); void ok_to_send();
#if MECH(DELTA) #if MECH(DELTA)
float probe_bed(float x, float y);
void set_delta_constants();
void adj_tower_delta(int tower);
void adj_tower_radius(int tower);
void home_delta_axis();
void calibration_report();
void bed_probe_all();
void set_delta_constants(); void set_delta_constants();
void calculate_delta(float cartesian[3]); void calculate_delta(float cartesian[3]);
void adjust_delta(float cartesian[3]); static float probe_bed(float x, float y);
void adj_endstops(); static void adj_tower_delta(int tower);
void reset_bed_level(); static void adj_tower_radius(int tower);
void prepare_move_raw(); static void home_delta_axis();
static void calibration_report();
static void bed_probe_all();
static void adjust_delta(float cartesian[3]);
static void adj_endstops();
static void reset_bed_level();
static void prepare_move_raw();
extern float delta[3]; extern float delta[3];
extern float delta_tmp[3]; extern float delta_tmp[3];
extern float delta_tower1_x, delta_tower1_y; extern float delta_tower1_x, delta_tower1_y;
...@@ -71,11 +74,7 @@ void ok_to_send(); ...@@ -71,11 +74,7 @@ void ok_to_send();
void calculate_SCARA_forward_Transform(float f_scara[3]); void calculate_SCARA_forward_Transform(float f_scara[3]);
#endif #endif
void prepare_move( void prepare_move();
#if MECH(DELTA)
const bool delta_probe = false
#endif
);
void kill(const char *); void kill(const char *);
void Stop(); void Stop();
...@@ -113,7 +112,7 @@ void prepare_arc_move(char isclockwise); ...@@ -113,7 +112,7 @@ void prepare_arc_move(char isclockwise);
void clamp_to_software_endstops(float target[3]); void clamp_to_software_endstops(float target[3]);
extern millis_t previous_cmd_ms; extern millis_t previous_cmd_ms;
void refresh_cmd_timeout(); inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
extern void delay_ms(millis_t ms); extern void delay_ms(millis_t ms);
...@@ -140,6 +139,10 @@ extern bool axis_known_position[3]; ...@@ -140,6 +139,10 @@ extern bool axis_known_position[3];
extern bool axis_homed[3]; extern bool axis_homed[3];
extern float zprobe_zoffset; extern float zprobe_zoffset;
#if ENABLED(ADVANCE_LPC)
extern int extruder_advance_k;
#endif
#if HEATER_USES_AD595 #if HEATER_USES_AD595
extern float ad595_offset[HOTENDS]; extern float ad595_offset[HOTENDS];
extern float ad595_gain[HOTENDS]; extern float ad595_gain[HOTENDS];
......
...@@ -368,6 +368,17 @@ ...@@ -368,6 +368,17 @@
#define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS)) #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
#define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS)) #define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS))
/**
* CoreXY or CoreYX or CoreXZ or CoreZX
*/
#if MECH(COREXY) || MECH(COREYX)
#define CORE_AXIS_2 B_AXIS
#define CORE_AXIS_3 Z_AXIS
#elif MECH(COREXZ) || MECH(COREZX)
#define CORE_AXIS_2 C_AXIS
#define CORE_AXIS_3 Y_AXIS
#endif
/** /**
* SCARA * SCARA
*/ */
...@@ -505,7 +516,7 @@ ...@@ -505,7 +516,7 @@
*/ */
#if ENABLED(ADVANCE) #if ENABLED(ADVANCE)
#define EXTRUSION_AREA (0.25 * (D_FILAMENT) * (D_FILAMENT) * M_PI) #define EXTRUSION_AREA (0.25 * (D_FILAMENT) * (D_FILAMENT) * M_PI)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS + active_extruder] / EXTRUSION_AREA) #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS + active_extruder] / (EXTRUSION_AREA))
#endif #endif
/** /**
...@@ -754,6 +765,10 @@ ...@@ -754,6 +765,10 @@
#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
#define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
#define HAS_THERMALLY_PROTECTED_BED (HAS_TEMP_BED && HAS_HEATER_BED && ENABLED(THERMAL_PROTECTION_BED))
/** /**
* Shorthand for filament sensor and power sensor for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h * Shorthand for filament sensor and power sensor for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h
*/ */
......
...@@ -23,32 +23,9 @@ ...@@ -23,32 +23,9 @@
#ifndef LANGUAGE_H #ifndef LANGUAGE_H
#define LANGUAGE_H #define LANGUAGE_H
// NOTE: IF YOU CHANGE LANGUAGE FILES OR MERGE A FILE WITH CHANGES #ifndef LCD_LANGUAGE
// #define LCD_LANGUAGE en
// ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration_Basic.h" #endif
// ==> ALSO TRY ALL AVAILABLE "LANGUAGE_CHOICE" OPTIONS
// See also documentation/LCDLanguageFont.md
// Languages
// 1 English // Language base
// 2 Polish
// 3 French
// 4 German
// 5 Spanish
// 6 Russian
// 7 Italian
// 8 Portuguese
// 9 Finnish
// 10 Aragonese
// 11 Dutch
// 12 Danish
// 13 Catalan
// 14 Basque-Euskera
// 15 Portuguese (Brazil)
// 16 Bulgarian
// 17 Japanese
// 18 Japanese utf
// 19 Chinese
#define PROTOCOL_VERSION "2.0" #define PROTOCOL_VERSION "2.0"
...@@ -223,7 +200,7 @@ ...@@ -223,7 +200,7 @@
#define SERIAL_HEATER_BED "bed" #define SERIAL_HEATER_BED "bed"
#define SERIAL_STOPPED_HEATER ", system stopped! Heater_ID: " #define SERIAL_STOPPED_HEATER ", system stopped! Heater_ID: "
#define SERIAL_STOPPED_COOLER "system stopped! Cooler" #define SERIAL_STOPPED_COOLER "system stopped! Cooler"
//#define SERIAL_REDUNDANCY "Heater switched off. Temperature difference between temp sensors is too high !" #define SERIAL_REDUNDANCY "Heater switched off. Temperature difference between temp sensors is too high !"
#define SERIAL_T_HEATING_FAILED "Heating failed" #define SERIAL_T_HEATING_FAILED "Heating failed"
#define SERIAL_T_THERMAL_RUNAWAY "Thermal Runaway" #define SERIAL_T_THERMAL_RUNAWAY "Thermal Runaway"
#define SERIAL_T_MAXTEMP "MAXTEMP triggered" #define SERIAL_T_MAXTEMP "MAXTEMP triggered"
...@@ -253,45 +230,13 @@ ...@@ -253,45 +230,13 @@
#define SERIAL_BED_LEVELLING_Y " Y: " #define SERIAL_BED_LEVELLING_Y " Y: "
#define SERIAL_BED_LEVELLING_Z " Z: " #define SERIAL_BED_LEVELLING_Z " Z: "
#if LANGUAGE_CHOICE == 1 // English // LCD Menu Messages
#include "language_en.h"
#elif LANGUAGE_CHOICE == 2 // Polish #define LANGUAGE_INCL_(M) STRINGIFY_(language_##M.h)
#include "language_pl.h" #define LANGUAGE_INCL(M) LANGUAGE_INCL_(M)
#elif LANGUAGE_CHOICE == 3 // French #define INCLUDE_LANGUAGE LANGUAGE_INCL(LCD_LANGUAGE)
#include "language_fr.h"
#elif LANGUAGE_CHOICE == 4 // German #include "language_en.h"
#include "language_de.h" #include INCLUDE_LANGUAGE
#elif LANGUAGE_CHOICE == 5 // Spanish
#include "language_es.h"
#elif LANGUAGE_CHOICE == 6 // Russian
#define MAPPER_D0D1 // For Cyrillic
#include "language_ru.h"
#elif LANGUAGE_CHOICE == 7 // Italian
#include "language_it.h"
#elif LANGUAGE_CHOICE == 8 // Portuguese
#include "language_pt.h"
#elif LANGUAGE_CHOICE == 9 // Finnish
#include "language_fi.h"
#elif LANGUAGE_CHOICE == 10 // Aragonese
#include "language_an.h"
#elif LANGUAGE_CHOICE == 11 // Dutch
#include "language_nl.h"
#elif LANGUAGE_CHOICE == 12 // Danish
#include "language_da.h"
#elif LANGUAGE_CHOICE == 13 // Catalan
#include "language_ca.h"
#elif LANGUAGE_CHOICE == 14 // Basque-Euskera
#include "language_eu.h"
#elif LANGUAGE_CHOICE == 15 // Portuguese - Brasil
#include "language_pt-br.h"
#elif LANGUAGE_CHOICE == 16 // Bulgarian
#include "language_bg.h"
#elif LANGUAGE_CHOICE == 17 // Japanese
#include "language_kana.h"
#elif LANGUAGE_CHOICE == 18 // Japanese utf
#include "language_kana_utf8.h"
#elif LANGUAGE_CHOICE == 19 // Chinese
#include "language_cn.h"
#endif
#endif //__LANGUAGE_H #endif //__LANGUAGE_H
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
...@@ -151,13 +152,13 @@ ...@@ -151,13 +152,13 @@
#define MSG_BABYSTEP_Z MSG_BABYSTEP " " MSG_Z #define MSG_BABYSTEP_Z MSG_BABYSTEP " " MSG_Z
#define MSG_ENDSTOP_ABORT "Finecorsa abort." #define MSG_ENDSTOP_ABORT "Finecorsa abort."
#define MSG_HEATING_FAILED_LCD "Riscaldamento fallito" #define MSG_HEATING_FAILED_LCD "Riscaldamento fallito"
#define MSG_ERR_REDUNDANT_TEMP "REDUNDANT TEMP ERROR" #define MSG_ERR_REDUNDANT_TEMP "Err: TEMP RIDONDANTI"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY" #define MSG_THERMAL_RUNAWAY "TEMP FUORI CONTROLLO"
#define MSG_AD595 "AD595 Offset & Gain" #define MSG_AD595 "AD595 Offset & Gain"
#define MSG_ERR_MAXTEMP "MAXTEMP ERROR" #define MSG_ERR_MAXTEMP "Err: TEMP MASSIMA"
#define MSG_ERR_MINTEMP "MINTEMP ERROR" #define MSG_ERR_MINTEMP "Err: TEMP MINIMA"
#define MSG_ERR_MAXTEMP_BED "MAXTEMP BED ERROR" #define MSG_ERR_MAXTEMP_BED "Err: TEMP MASSIMA PIATTO"
#define MSG_ERR_MINTEMP_BED "MINTEMP BED ERROR" #define MSG_ERR_MINTEMP_BED "Err: TEMP MINIMA PIATTO"
#define MSG_END_DAY "giorni" #define MSG_END_DAY "giorni"
#define MSG_END_HOUR "ore" #define MSG_END_HOUR "ore"
#define MSG_END_MINUTE "minuti" #define MSG_END_MINUTE "minuti"
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1" #define MSG_H1 " H1"
#define MSG_H2 " H2" #define MSG_H2 " H2"
#define MSG_H3 " H3" #define MSG_H3 " H3"
......
...@@ -2723,10 +2723,17 @@ char* ftostr32sp(const float& x) { ...@@ -2723,10 +2723,17 @@ char* ftostr32sp(const float& x) {
return conv; return conv;
} }
// Convert int to lj string with +123.0 format // Convert signed int to lj string with +012 / -012 format
char* itostr31(const int& x) { char* itostr3sign(const int& x) {
conv[0] = x >= 0 ? '+' : '-'; int xx;
int xx = abs(x); if (x >= 0) {
conv[0] = '+';
xx = x;
}
else {
conv[0] = '-';
xx = -x;
}
conv[1] = (xx / 100) % 10 + '0'; conv[1] = (xx / 100) % 10 + '0';
conv[2] = (xx / 10) % 10 + '0'; conv[2] = (xx / 10) % 10 + '0';
conv[3] = xx % 10 + '0'; conv[3] = xx % 10 + '0';
......
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
#endif // NEWPANEL #endif // NEWPANEL
char* itostr2(const uint8_t& x); char* itostr2(const uint8_t& x);
char* itostr31(const int& xx); char* itostr3sign(const int& x);
char* itostr3(const int& xx); char* itostr3(const int& xx);
char* itostr3left(const int& xx); char* itostr3left(const int& xx);
char* itostr4(const int& xx); char* itostr4(const int& xx);
...@@ -195,8 +195,8 @@ ...@@ -195,8 +195,8 @@
FORCE_INLINE void lcd_reset_alert_level() {} FORCE_INLINE void lcd_reset_alert_level() {}
FORCE_INLINE bool lcd_detected(void) { return true; } FORCE_INLINE bool lcd_detected(void) { return true; }
#define LCD_MESSAGEPGM(x) do{}while(0) #define LCD_MESSAGEPGM(x) NOOP
#define LCD_ALERTMESSAGEPGM(x) do{}while(0) #define LCD_ALERTMESSAGEPGM(x) NOOP
#endif //ULTRA_LCD #endif //ULTRA_LCD
......
...@@ -474,7 +474,7 @@ char lcd_printPGM(const char* str) { ...@@ -474,7 +474,7 @@ char lcd_printPGM(const char* str) {
return n; return n;
} }
char lcd_print(char* str) { char lcd_print(const char* str) {
char c, n = 0; char c, n = 0;
unsigned char i = 0; unsigned char i = 0;
while ((c = str[i++])) n += charset_mapper(c); while ((c = str[i++])) n += charset_mapper(c);
......
...@@ -76,4 +76,6 @@ ...@@ -76,4 +76,6 @@
#define NOOP do{}while(0) #define NOOP do{}while(0)
#define _AXIS(AXIS) AXIS ##_AXIS
#endif //__MACROS_H #endif //__MACROS_H
This diff is collapsed.
/**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* endstops.h - manages endstops
*/
#ifndef ENDSTOPS_H
#define ENDSTOPS_H
enum EndstopEnum {X_MIN = 0, Y_MIN = 1, Z_MIN = 2, Z_PROBE = 3, X_MAX = 4, Y_MAX = 5, Z_MAX = 6, Z2_MIN = 7, Z2_MAX = 8, E_MIN = 9};
class Endstops {
public:
volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value
#if ENABLED(Z_DUAL_ENDSTOPS)
uint16_t current_endstop_bits = 0,
old_endstop_bits = 0;
#else
byte current_endstop_bits = 0,
old_endstop_bits = 0;
#endif
bool enabled = true;
bool enabled_globally =
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
false
#else
true
#endif
;
Endstops();
/**
* Initialize the endstop pins
*/
void init();
/**
* Update the endstops bits from the pins
*/
void update();
/**
* Print an error message reporting the position when the endstops were last hit.
*/
void report_state(); //call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered
/**
* Report endstop positions in response to M119
*/
void M119();
// Enable / disable endstop checking globally
FORCE_INLINE void enable_globally(bool onoff = true) { enabled_globally = enabled = onoff; }
// Enable / disable endstop checking
FORCE_INLINE void enable(bool onoff = true) { enabled = onoff; }
// Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable
FORCE_INLINE void not_homing() { enabled = enabled_globally; }
// Clear endstops (i.e., they were hit intentionally) to suppress the report
FORCE_INLINE void hit_on_purpose() { endstop_hit_bits = 0; }
// Enable / disable endstop z-probe checking
#if ENABLED(HAS_Z_PROBE)
volatile bool z_probe_enabled = false;
FORCE_INLINE void enable_z_probe(bool onoff = true) { z_probe_enabled = onoff; }
#endif
private:
#if ENABLED(Z_DUAL_ENDSTOPS)
void test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2);
#endif
};
extern Endstops endstops;
#endif // ENDSTOPS_H
...@@ -1037,7 +1037,7 @@ float junction_deviation = 0.1; ...@@ -1037,7 +1037,7 @@ float junction_deviation = 0.1;
// Compute and limit the acceleration rate for the trapezoid generator. // Compute and limit the acceleration rate for the trapezoid generator.
float steps_per_mm = block->step_event_count / block->millimeters; float steps_per_mm = block->step_event_count / block->millimeters;
unsigned long bsx = block->steps[X_AXIS], bsy = block->steps[Y_AXIS], bsz = block->steps[Z_AXIS], bse = block->steps[E_AXIS]; long bsx = block->steps[X_AXIS], bsy = block->steps[Y_AXIS], bsz = block->steps[Z_AXIS], bse = block->steps[E_AXIS];
if (bsx == 0 && bsy == 0 && bsz == 0) { if (bsx == 0 && bsy == 0 && bsz == 0) {
block->acceleration_st = ceil(retract_acceleration[extruder] * steps_per_mm); // convert to: acceleration steps/sec^2 block->acceleration_st = ceil(retract_acceleration[extruder] * steps_per_mm); // convert to: acceleration steps/sec^2
} }
...@@ -1171,7 +1171,20 @@ float junction_deviation = 0.1; ...@@ -1171,7 +1171,20 @@ float junction_deviation = 0.1;
ECHO_SMV(OK, "advance :", block->advance/256); ECHO_SMV(OK, "advance :", block->advance/256);
ECHO_EMV("advance rate :", block->advance_rate/256); ECHO_EMV("advance rate :", block->advance_rate/256);
*/ */
#endif // ADVANCE #elif ENABLED(ADVANCE_LPC) // ADVANCE_LPC
// bse == allsteps: A problem occurs when there's a very tiny move before a retract.
// In this case, the retract and the move will be executed together.
// This leads to an enormous number of advance steps due to a huge e_acceleration.
// The math is correct, but you don't want a retract move done with advance!
// So this situation is filtered out here.
if (!bse || (!bsx && !bsy && !bsz) || extruder_advance_k == 0 || bse == allsteps) {
block->use_advance_lead = false;
}
else {
block->use_advance_lead = true;
block->e_speed_multiplier8 = (block->steps[E_AXIS] << 8) / block->step_event_count;
}
#endif
calculate_trapezoid_for_block(block, block->entry_speed / block->nominal_speed, safe_speed / block->nominal_speed); calculate_trapezoid_for_block(block, block->entry_speed / block->nominal_speed, safe_speed / block->nominal_speed);
......
...@@ -49,25 +49,32 @@ ...@@ -49,25 +49,32 @@
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
// the source g-code and may never actually be reached if acceleration management is active. // the source g-code and may never actually be reached if acceleration management is active.
typedef struct { typedef struct {
unsigned char active_driver; // Selects the active driver
// Fields used by the bresenham algorithm for tracing the line // Fields used by the bresenham algorithm for tracing the line
unsigned long steps[NUM_AXIS]; // Step count along each axis unsigned long steps[NUM_AXIS]; // Step count along each axis
unsigned long step_event_count; // The number of step events required to complete this block
#if ENABLED(COLOR_MIXING_EXTRUDER) #if ENABLED(COLOR_MIXING_EXTRUDER)
unsigned long mix_event_count[DRIVER_EXTRUDERS]; // Step count for each stepper in a mixing extruder unsigned long mix_event_count[DRIVER_EXTRUDERS]; // Step count for each stepper in a mixing extruder
#endif #endif
unsigned long step_event_count; // The number of step events required to complete this block
long accelerate_until; // The index of the step event on which to stop acceleration long accelerate_until; // The index of the step event on which to stop acceleration
long decelerate_after; // The index of the step event on which to start decelerating long decelerate_after; // The index of the step event on which to start decelerating
long acceleration_rate; // The acceleration rate used for acceleration calculation long acceleration_rate; // The acceleration rate used for acceleration calculation
unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h) unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
unsigned char active_driver; // Selects the active driver
// Advance extrusion
#if ENABLED(ADVANCE) #if ENABLED(ADVANCE)
long advance_rate; long advance_rate;
volatile long initial_advance; volatile long initial_advance;
volatile long final_advance; volatile long final_advance;
float advance; float advance;
#elif ENABLED(ADVANCE_LPC)
bool use_advance_lead;
int e_speed_multiplier8;
#endif #endif
// Fields used by the motion planner to manage acceleration // Fields used by the motion planner to manage acceleration
......
This diff is collapsed.
...@@ -34,11 +34,14 @@ ...@@ -34,11 +34,14 @@
* A_AXIS and C_AXIS are used by COREXZ or COREZX printers * A_AXIS and C_AXIS are used by COREXZ or COREZX printers
* X_HEAD and Y_HEAD and Z_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots. * X_HEAD and Y_HEAD and Z_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
*/ */
enum AxisEnum {X_AXIS=0, A_AXIS=0, Y_AXIS=1, B_AXIS=1, Z_AXIS=2, C_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5, Z_HEAD=5}; enum AxisEnum {X_AXIS = 0, A_AXIS = 0, Y_AXIS = 1, B_AXIS = 1, Z_AXIS = 2, C_AXIS = 2, E_AXIS = 3, X_HEAD = 4, Y_HEAD = 5, Z_HEAD = 5};
enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6, Z2_MIN=7, Z2_MAX=8, E_MIN=9};
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
extern bool abort_on_endstop_hit; #if ENABLED(ABORT_ON_ENDSTOP_HIT_INIT)
bool abort_on_endstop_hit = ABORT_ON_ENDSTOP_HIT_INIT;
#else
bool abort_on_endstop_hit = false;
#endif
#endif #endif
// Initialize and start the stepper motor subsystem // Initialize and start the stepper motor subsystem
...@@ -69,10 +72,20 @@ ...@@ -69,10 +72,20 @@
// //
void report_positions(); void report_positions();
void checkHitEndstops(); //call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered //
void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homing and before a routine call of checkHitEndstops(); // Handle a triggered endstop
//
void endstop_triggered(AxisEnum axis);
void enable_endstops(bool check); // Enable/disable endstop checking //
// Triggered position of an axis in mm (not core-savvy)
//
float triggered_position_mm(AxisEnum axis);
//
// The direction of a single motor
//
bool motor_direction(AxisEnum axis);
void checkStepperErrors(); //Print errors detected by the stepper void checkStepperErrors(); //Print errors detected by the stepper
...@@ -91,6 +104,7 @@ ...@@ -91,6 +104,7 @@
void digipot_current(uint8_t driver, int current); void digipot_current(uint8_t driver, int current);
void microstep_init(); void microstep_init();
void microstep_readings(); void microstep_readings();
void kill_current_block();
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
void In_Homing_Process(bool state); void In_Homing_Process(bool state);
......
...@@ -232,7 +232,6 @@ ...@@ -232,7 +232,6 @@
#define NORM_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; }} #define NORM_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; }}
#define REV_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; }} #define REV_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; }}
#else #else
extern bool extruder_duplication_enabled;
#define E_STEP_WRITE(v) { if(extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }} #define E_STEP_WRITE(v) { if(extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define NORM_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }} #define NORM_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
#define REV_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE( INVERT_E1_DIR); } else { E0_DIR_WRITE( INVERT_E0_DIR); }} #define REV_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE( INVERT_E1_DIR); } else { E0_DIR_WRITE( INVERT_E0_DIR); }}
......
...@@ -174,8 +174,8 @@ ...@@ -174,8 +174,8 @@
#endif #endif
// Language // Language
#if DISABLED(LANGUAGE_CHOICE) #if DISABLED(LCD_LANGUAGE)
#error DEPENDENCY ERROR: Missing setting LANGUAGE_CHOICE #error DEPENDENCY ERROR: Missing setting LCD_LANGUAGE
#endif #endif
/// FEATURE /// FEATURE
...@@ -415,6 +415,12 @@ ...@@ -415,6 +415,12 @@
#endif #endif
#endif #endif
/**
* Advance Extrusion
*/
#if ENABLED(ADVANCE) && ENABLED(ADVANCE_LPC)
#error You can enable ADVANCE or ADVANCE_LPC, but not both.
#endif
#if ENABLED(ADVANCE) #if ENABLED(ADVANCE)
#if DISABLED(EXTRUDER_ADVANCE_K) #if DISABLED(EXTRUDER_ADVANCE_K)
#error DEPENDENCY ERROR: Missing setting EXTRUDER_ADVANCE_K #error DEPENDENCY ERROR: Missing setting EXTRUDER_ADVANCE_K
......
...@@ -29,29 +29,29 @@ Stopwatch::Stopwatch() { ...@@ -29,29 +29,29 @@ Stopwatch::Stopwatch() {
void Stopwatch::stop() { void Stopwatch::stop() {
#if ENABLED(DEBUG_STOPWATCH) #if ENABLED(DEBUG_STOPWATCH)
debug(PSTR("stop")); Stopwatch::debug(PSTR("stop"));
#endif #endif
if (!this->isRunning()) return; if (!this->isRunning()) return;
this->status = STPWTCH_STOPPED; this->state = STPWTCH_STOPPED;
this->stopTimestamp = millis(); this->stopTimestamp = millis();
} }
void Stopwatch::pause() { void Stopwatch::pause() {
#if ENABLED(DEBUG_STOPWATCH) #if ENABLED(DEBUG_STOPWATCH)
debug(PSTR("pause")); Stopwatch::debug(PSTR("pause"));
#endif #endif
if (!this->isRunning()) return; if (!this->isRunning()) return;
this->status = STPWTCH_PAUSED; this->state = STPWTCH_PAUSED;
this->stopTimestamp = millis(); this->stopTimestamp = millis();
} }
void Stopwatch::start() { void Stopwatch::start() {
#if ENABLED(DEBUG_STOPWATCH) #if ENABLED(DEBUG_STOPWATCH)
debug(PSTR("start")); Stopwatch::debug(PSTR("start"));
#endif #endif
if (this->isRunning()) return; if (this->isRunning()) return;
...@@ -59,27 +59,27 @@ void Stopwatch::start() { ...@@ -59,27 +59,27 @@ void Stopwatch::start() {
if (this->isPaused()) this->accumulator = this->duration(); if (this->isPaused()) this->accumulator = this->duration();
else this->reset(); else this->reset();
this->status = STPWTCH_RUNNING; this->state = STPWTCH_RUNNING;
this->startTimestamp = millis(); this->startTimestamp = millis();
} }
void Stopwatch::reset() { void Stopwatch::reset() {
#if ENABLED(DEBUG_STOPWATCH) #if ENABLED(DEBUG_STOPWATCH)
debug(PSTR("reset")); Stopwatch::debug(PSTR("reset"));
#endif #endif
this->status = STPWTCH_STOPPED; this->state = STPWTCH_STOPPED;
this->startTimestamp = 0; this->startTimestamp = 0;
this->stopTimestamp = 0; this->stopTimestamp = 0;
this->accumulator = 0; this->accumulator = 0;
} }
bool Stopwatch::isRunning() { bool Stopwatch::isRunning() {
return (this->status == STPWTCH_RUNNING) ? true : false; return (this->state == STPWTCH_RUNNING) ? true : false;
} }
bool Stopwatch::isPaused() { bool Stopwatch::isPaused() {
return (this->status == STPWTCH_PAUSED) ? true : false; return (this->state == STPWTCH_PAUSED) ? true : false;
} }
uint16_t Stopwatch::duration() { uint16_t Stopwatch::duration() {
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM) // Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
//#define DEBUG_STOPWATCH //#define DEBUG_STOPWATCH
enum StopwatchStatus { enum StopwatchState {
STPWTCH_STOPPED, STPWTCH_STOPPED,
STPWTCH_RUNNING, STPWTCH_RUNNING,
STPWTCH_PAUSED STPWTCH_PAUSED
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
*/ */
class Stopwatch { class Stopwatch {
private: private:
StopwatchStatus status; StopwatchState state;
uint16_t accumulator; uint16_t accumulator;
uint32_t startTimestamp; uint32_t startTimestamp;
uint32_t stopTimestamp; uint32_t stopTimestamp;
......
...@@ -113,8 +113,8 @@ unsigned char soft_pwm_cooler; ...@@ -113,8 +113,8 @@ unsigned char soft_pwm_cooler;
enum TRState { TRReset, TRInactive, TRFirstRunnig, TRStable, TRRunaway }; enum TRState { TRReset, TRInactive, TRFirstRunnig, TRStable, TRRunaway };
void thermal_runaway_protection(TRState* state, millis_t* timer, float temperature, float target_temperature, int temp_controller_id, int period_seconds, int hysteresis_degc); void thermal_runaway_protection(TRState* state, millis_t* timer, float temperature, float target_temperature, int temp_controller_id, int period_seconds, int hysteresis_degc);
#if ENABLED(THERMAL_PROTECTION_HOTENDS) #if ENABLED(THERMAL_PROTECTION_HOTENDS)
static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset }; static TRState thermal_runaway_state_machine[HOTENDS] = { TRReset };
static millis_t thermal_runaway_timer[4]; // = {0,0,0,0}; static millis_t thermal_runaway_timer[HOTENDS] = { 0 };
#endif #endif
#if ENABLED(THERMAL_PROTECTION_BED) && TEMP_SENSOR_BED != 0 #if ENABLED(THERMAL_PROTECTION_BED) && TEMP_SENSOR_BED != 0
static TRState thermal_runaway_bed_state_machine = TRReset; static TRState thermal_runaway_bed_state_machine = TRReset;
...@@ -125,6 +125,7 @@ unsigned char soft_pwm_cooler; ...@@ -125,6 +125,7 @@ unsigned char soft_pwm_cooler;
static millis_t thermal_runaway_cooler_timer; static millis_t thermal_runaway_cooler_timer;
#endif #endif
#endif #endif
#if HAS(POWER_CONSUMPTION_SENSOR) #if HAS(POWER_CONSUMPTION_SENSOR)
int current_raw_powconsumption = 0; //Holds measured power consumption int current_raw_powconsumption = 0; //Holds measured power consumption
static unsigned long raw_powconsumption_value = 0; static unsigned long raw_powconsumption_value = 0;
...@@ -245,6 +246,11 @@ static void updateTemperaturesFromRawValues(); ...@@ -245,6 +246,11 @@ static void updateTemperaturesFromRawValues();
millis_t watch_cooler_next_ms = 0; millis_t watch_cooler_next_ms = 0;
#endif #endif
#if ENABLED(THERMAL_PROTECTION_BED)
int watch_target_bed_temp = 0;
millis_t watch_bed_next_ms = 0;
#endif
#if DISABLED(SOFT_PWM_SCALE) #if DISABLED(SOFT_PWM_SCALE)
#define SOFT_PWM_SCALE 0 #define SOFT_PWM_SCALE 0
#endif #endif
...@@ -346,12 +352,12 @@ void autotempShutdown() { ...@@ -346,12 +352,12 @@ void autotempShutdown() {
#if HAS(AUTO_FAN) #if HAS(AUTO_FAN)
if (ms > next_auto_fan_check_ms) { if (ms > next_auto_fan_check_ms) {
checkExtruderAutoFans(); checkExtruderAutoFans();
next_auto_fan_check_ms = ms + 2500; next_auto_fan_check_ms = ms + 2500UL;
} }
#endif #endif
if (running && ((input > temp && temp_controller >= -1) || (input < temp && temp_controller < -1))) { if (running && ((input > temp && temp_controller >= -1) || (input < temp && temp_controller < -1))) {
if (ms > t2 + 5000) { if (ms > t2 + 5000UL) {
runnig = false; runnig = false;
if (temp_controller < -1) if (temp_controller < -1)
soft_pwm_cooler = (bias - d) >> 1; soft_pwm_cooler = (bias - d) >> 1;
...@@ -369,7 +375,7 @@ void autotempShutdown() { ...@@ -369,7 +375,7 @@ void autotempShutdown() {
} }
if (!running && ((input < temp && temp_controller >= -1) || (input > temp && temp_controller < -1))) { if (!running && ((input < temp && temp_controller >= -1) || (input > temp && temp_controller < -1))) {
if (ms > t1 + 5000) { if (ms > t1 + 5000UL) {
running = true; running = true;
t2 = ms; t2 = ms;
t_low = t2 - t1; t_low = t2 - t1;
...@@ -833,7 +839,7 @@ void manage_temp_controller() { ...@@ -833,7 +839,7 @@ void manage_temp_controller() {
if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
#endif #endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || DISABLED(PIDTEMPBED) || DISABLED(PIDTEMPCOOLER) || HAS(AUTO_FAN) #if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED) || ENABLED(THERMAL_PROTECTION_COOLER) || DISABLED(PIDTEMPBED) || DISABLED(PIDTEMPCOOLER) || HAS(AUTO_FAN)
millis_t ms = millis(); millis_t ms = millis();
#endif #endif
...@@ -867,9 +873,27 @@ void manage_temp_controller() { ...@@ -867,9 +873,27 @@ void manage_temp_controller() {
#endif // THERMAL_PROTECTION_HOTENDS #endif // THERMAL_PROTECTION_HOTENDS
// Check if the temperature is failing to increase
#if ENABLED(THERMAL_PROTECTION_BED)
// Is it time to check the bed?
if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {
// Has it failed to increase enough?
if (degBed() < watch_target_bed_temp) {
// Stop!
_temp_error(-1, PSTR(SERIAL_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
}
else {
// Start again if the target is still far off
start_watching_bed();
}
}
#endif // THERMAL_PROTECTION_HOTENDS
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) { if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
_temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP)); _temp_error(0, PSTR(SERIAL_REDUNDANCY), PSTR(MSG_ERR_REDUNDANT_TEMP));
} }
#endif #endif
...@@ -930,7 +954,7 @@ void manage_temp_controller() { ...@@ -930,7 +954,7 @@ void manage_temp_controller() {
soft_pwm_bed = 0; soft_pwm_bed = 0;
WRITE_HEATER_BED(LOW); WRITE_HEATER_BED(LOW);
} }
#else // BED_LIMIT_SWITCHING #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
// Check if temperature is within the correct range // Check if temperature is within the correct range
if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) { if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) {
soft_pwm_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0; soft_pwm_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0;
...@@ -1487,6 +1511,22 @@ void tp_init() { ...@@ -1487,6 +1511,22 @@ void tp_init() {
} }
#endif #endif
#if ENABLED(THERMAL_PROTECTION_BED)
/**
* Start Heating Sanity Check for bed that are below
* their target temperature by a configurable margin.
* This is called when the temperature is set. (M140, M190)
*/
void start_watching_bed() {
if (degBed() < degTargetBed() - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) {
watch_target_bed_temp = degBed() + WATCH_BED_TEMP_INCREASE;
watch_bed_next_ms = millis() + (WATCH_BED_TEMP_PERIOD) * 1000UL;
}
else
watch_bed_next_ms = 0;
}
#endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED) || ENABLED(THERMAL_PROTECTION_COOLER) #if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED) || ENABLED(THERMAL_PROTECTION_COOLER)
...@@ -1538,14 +1578,14 @@ void tp_init() { ...@@ -1538,14 +1578,14 @@ void tp_init() {
if (temperature >= tr_target_temperature[temp_controller_index] - hysteresis_degc) if (temperature >= tr_target_temperature[temp_controller_index] - hysteresis_degc)
*timer = millis(); *timer = millis();
// If the timer goes too long without a reset, trigger shutdown // If the timer goes too long without a reset, trigger shutdown
else if (millis() > *timer + period_seconds * 1000UL) else if (ELAPSED(millis() > *timer + period_seconds * 1000UL))
*state = TRRunaway; *state = TRRunaway;
} }
else { // COOLERS else { // COOLERS
if (temperature <= tr_target_temperature[temp_controller_index] + hysteresis_degc) if (temperature <= tr_target_temperature[temp_controller_index] + hysteresis_degc)
*timer = millis(); *timer = millis();
// If the timer goes too long without a reset, trigger shutdown // If the timer goes too long without a reset, trigger shutdown
else if (millis() > *timer + period_seconds * 1000UL) else if (ELAPSED(millis() > *timer + period_seconds * 1000UL))
*state = TRRunaway; *state = TRRunaway;
} }
break; break;
...@@ -1561,6 +1601,9 @@ void disable_all_heaters() { ...@@ -1561,6 +1601,9 @@ void disable_all_heaters() {
for (int i = 0; i < HOTENDS; i++) setTargetHotend(0, i); for (int i = 0; i < HOTENDS; i++) setTargetHotend(0, i);
setTargetBed(0); setTargetBed(0);
// If all heaters go down then for sure our print job has stopped
print_job_timer.stop();
#define DISABLE_HEATER(NR) { \ #define DISABLE_HEATER(NR) { \
target_temperature[NR] = 0; \ target_temperature[NR] = 0; \
soft_pwm[NR] = 0; \ soft_pwm[NR] = 0; \
...@@ -1607,59 +1650,61 @@ void disable_all_coolers() { ...@@ -1607,59 +1650,61 @@ void disable_all_coolers() {
} }
#if ENABLED(HEATER_0_USES_MAX6675) #if ENABLED(HEATER_0_USES_MAX6675)
#define MAX6675_HEAT_INTERVAL 250u #define MAX6675_HEAT_INTERVAL 250u
static millis_t next_max6675_ms = 0;
int max6675_temp = 2000;
static int read_max6675() { #if ENABLED(MAX6675_IS_MAX31855)
uint32_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 7
#define MAX6675_DISCARD_BITS 18
#else
uint16_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 4
#define MAX6675_DISCARD_BITS 3
#endif
millis_t ms = millis(); int Temperature::read_max6675() {
if (ms < next_max6675_ms) static millis_t next_max6675_ms = 0;
return max6675_temp;
next_max6675_ms = ms + MAX6675_HEAT_INTERVAL; millis_t ms = millis();
max6675_temp = 0; if (PENDING(ms, next_max6675_ms)) return (int)max6675_temp;
#ifdef PRR next_max6675_ms = ms + MAX6675_HEAT_INTERVAL;
CBI(PRR, PRSPI);
#elif defined(PRR0)
CBI(PRR0, PRSPI);
#endif
CBI(
#ifdef PRR
PRR
#elif defined(PRR0)
PRR0
#endif
, PRSPI);
SPCR = _BV(MSTR) | _BV(SPE) | _BV(SPR0); SPCR = _BV(MSTR) | _BV(SPE) | _BV(SPR0);
// enable TT_MAX6675 WRITE(MAX6675_SS, 0); // enable TT_MAX6675
WRITE(MAX6675_SS, 0);
// ensure 100ns delay - a bit extra is fine // ensure 100ns delay - a bit extra is fine
asm("nop"); // 50ns on 20Mhz, 62.5ns on 16Mhz asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
asm("nop"); // 50ns on 20Mhz, 62.5ns on 16Mhz asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
// read MSB // Read a big-endian temperature value
SPDR = 0; max6675_temp = 0;
for (; !TEST(SPSR, SPIF);); for (uint8_t i = sizeof(max6675_temp); i--;) {
max6675_temp = SPDR; SPDR = 0;
max6675_temp <<= 8; for (;!TEST(SPSR, SPIF););
max6675_temp |= SPDR;
// read LSB if (i > 0) max6675_temp <<= 8; // shift left if not the last byte
SPDR = 0;
for (; !TEST(SPSR, SPIF););
max6675_temp |= SPDR;
// disable TT_MAX6675
WRITE(MAX6675_SS, 1);
if (max6675_temp & 4) {
// thermocouple open
max6675_temp = 4000;
}
else {
max6675_temp = max6675_temp >> 3;
} }
return max6675_temp; WRITE(MAX6675_SS, 1); // disable TT_MAX6675
if (max6675_temp & MAX6675_ERROR_MASK)
max6675_temp = 4000; // thermocouple open
else
max6675_temp >>= MAX6675_DISCARD_BITS;
return (int)max6675_temp;
} }
#endif // HEATER_0_USES_MAX6675 #endif // HEATER_0_USES_MAX6675
......
...@@ -138,7 +138,11 @@ FORCE_INLINE float degTargetCooler() { return target_temperature_cooler; } ...@@ -138,7 +138,11 @@ FORCE_INLINE float degTargetCooler() { return target_temperature_cooler; }
#endif #endif
#if ENABLED(THERMAL_PROTECTION_COOLERS) #if ENABLED(THERMAL_PROTECTION_COOLERS)
void start_watching_cooler(void); void start_watching_cooler();
#endif
#if ENABLED(THERMAL_PROTECTION_BED)
void start_watching_bed();
#endif #endif
FORCE_INLINE void setTargetHotend(const float& celsius, uint8_t hotend) { FORCE_INLINE void setTargetHotend(const float& celsius, uint8_t hotend) {
...@@ -147,8 +151,21 @@ FORCE_INLINE void setTargetHotend(const float& celsius, uint8_t hotend) { ...@@ -147,8 +151,21 @@ FORCE_INLINE void setTargetHotend(const float& celsius, uint8_t hotend) {
start_watching_heater(HOTEND_ARG); start_watching_heater(HOTEND_ARG);
#endif #endif
} }
FORCE_INLINE void setTargetBed(const float& celsius) { target_temperature_bed = celsius; }
FORCE_INLINE void setTargetCooler(const float& celsius) { target_temperature_cooler = celsius; } FORCE_INLINE void setTargetBed(const float& celsius) {
target_temperature_bed = celsius;
#if ENABLED(THERMAL_PROTECTION_BED)
start_watching_bed();
#endif
}
FORCE_INLINE void setTargetCooler(const float& celsius) {
target_temperature_cooler = celsius;
#if ENABLED(THERMAL_PROTECTION_COOLER) && ENABLED(THERMAL_PROTECTION_COOLER_WATCHDOG)
start_watching_cooler();
#endif
}
FORCE_INLINE bool isHeatingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] > current_temperature[HOTEND_ARG]; } FORCE_INLINE bool isHeatingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] > current_temperature[HOTEND_ARG]; }
FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; } FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
......
<img align="right" src="Documentation/Logo/MarlinKimbra%20Logo%20GitHub.png" /> <img align="right" src="Documentation/Logo/MarlinKimbra%20Logo%20GitHub.png" />
# MarlinKimbra 3D Printer Firmware for Arduino # MarlinKimbra 3D Printer Firmware for Arduino
## Version 4.2.8 dev ## Version 4.2.81 dev
### Special thanks ### Special thanks
* all Marlin8bit-developers. * all Marlin8bit-developers.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment