Commit 7c04d49e authored by Franco (nextime) Lanza's avatar Franco (nextime) Lanza

Merge branch 'master' into nextime

parents 1f98c2b1 5e21bf70
...@@ -128,6 +128,8 @@ ...@@ -128,6 +128,8 @@
* M407 - Displays measured filament diameter * M407 - Displays measured filament diameter
* M408 - Report JSON-style response * M408 - Report JSON-style response
* M410 - Quickstop. Abort all the planned moves * M410 - Quickstop. Abort all the planned moves
* M420 - Enable/Disable Mesh Bed Leveling
* M421 - Set a single Mesh Bed Leveling Z coordinate. M421 X<mm> Y<mm> Z<mm>' or 'M421 I<xindex> J<yindex> Z<mm>
* M428 - Set the home_offset logically based on the current_position * M428 - Set the home_offset logically based on the current_position
* M500 - stores paramters in EEPROM * M500 - stores paramters in EEPROM
* M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). * M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
#define HEATER_3_PIN ORIG_HEATER_3_PIN #define HEATER_3_PIN ORIG_HEATER_3_PIN
#define HEATER_BED_PIN ORIG_HEATER_BED_PIN #define HEATER_BED_PIN ORIG_HEATER_BED_PIN
#define HEATER_CHAMBER_PIN -1 #define HEATER_CHAMBER_PIN -1
#define COOLER_PIN -1 #define COOLER_PIN 2
// TEMP pin // TEMP pin
#define TEMP_0_PIN ORIG_TEMP_0_PIN #define TEMP_0_PIN ORIG_TEMP_0_PIN
...@@ -108,11 +108,15 @@ ...@@ -108,11 +108,15 @@
#endif #endif
#if ENABLED(LASERBEAM) #if ENABLED(LASERBEAM)
#define LASER_PWR_PIN -1 #if LASER_CONTROL == 1
#define LASER_TTL_PIN -1 #define LASER_PWR_PIN 5
#define LASER_TTL_PIN -1
#elif LASER_CONTROL == 2
#define LASER_PWR_PIN 6
#define LASER_TTL_PIN 5
#if ENABLED(LASER_PERIPHERALS) #if ENABLED(LASER_PERIPHERALS)
#define LASER_PERIPHERALS_PIN -1 #define LASER_PERIPHERALS_PIN 11
#define LASER_PERIPHERALS_STATUS_PIN -1 #define LASER_PERIPHERALS_STATUS_PIN 14
#endif #endif
#endif #endif
...@@ -125,7 +129,7 @@ ...@@ -125,7 +129,7 @@
#endif #endif
#if ENABLED(FLOWMETER_SENSOR) #if ENABLED(FLOWMETER_SENSOR)
#define FLOWMETER_PIN -1 #define FLOWMETER_PIN 21
#endif #endif
#if ENABLED(POWER_CONSUMPTION) #if ENABLED(POWER_CONSUMPTION)
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
#define HEATER_3_PIN ORIG_HEATER_3_PIN #define HEATER_3_PIN ORIG_HEATER_3_PIN
#define HEATER_BED_PIN ORIG_HEATER_BED_PIN #define HEATER_BED_PIN ORIG_HEATER_BED_PIN
#define HEATER_CHAMBER_PIN -1 #define HEATER_CHAMBER_PIN -1
#define COOLER_PIN -1 #define COOLER_PIN 2
// TEMP pin // TEMP pin
#define TEMP_0_PIN ORIG_TEMP_0_PIN #define TEMP_0_PIN ORIG_TEMP_0_PIN
...@@ -108,11 +108,15 @@ ...@@ -108,11 +108,15 @@
#endif #endif
#if ENABLED(LASERBEAM) #if ENABLED(LASERBEAM)
#define LASER_PWR_PIN -1 #if LASER_CONTROL == 1
#define LASER_TTL_PIN -1 #define LASER_PWR_PIN 5
#define LASER_TTL_PIN -1
#elif LASER_CONTROL == 2
#define LASER_PWR_PIN 6
#define LASER_TTL_PIN 5
#if ENABLED(LASER_PERIPHERALS) #if ENABLED(LASER_PERIPHERALS)
#define LASER_PERIPHERALS_PIN -1 #define LASER_PERIPHERALS_PIN 11
#define LASER_PERIPHERALS_STATUS_PIN -1 #define LASER_PERIPHERALS_STATUS_PIN 14
#endif #endif
#endif #endif
...@@ -125,7 +129,7 @@ ...@@ -125,7 +129,7 @@
#endif #endif
#if ENABLED(FLOWMETER_SENSOR) #if ENABLED(FLOWMETER_SENSOR)
#define FLOWMETER_PIN -1 #define FLOWMETER_PIN 21
#endif #endif
#if ENABLED(POWER_CONSUMPTION) #if ENABLED(POWER_CONSUMPTION)
......
### Version 4.2.84
* Add Mesh Bed Level (MBL)
### Version 4.2.83 ### Version 4.2.83
* Add Cooler and Hot Chamber * Add Cooler and Hot Chamber
* Add Laser Beam PWM and raster base64 * Add Laser Beam PWM and raster base64
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* - Endstop pullup resistors * - Endstop pullup resistors
* - Endstops logic * - Endstops logic
* - Endstops min or max * - Endstops min or max
* - Min Z height for homing
* - Stepper enable logic * - Stepper enable logic
* - Stepper step logic * - Stepper step logic
* - Stepper direction * - Stepper direction
...@@ -104,6 +105,18 @@ ...@@ -104,6 +105,18 @@
/*****************************************************************************************/ /*****************************************************************************************/
/*****************************************************************************************
***************************** MIN Z HEIGHT FOR HOMING **********************************
*****************************************************************************************
* *
* (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, *
* Be sure you have this distance over your Z_MAX_POS in case. *
* *
*****************************************************************************************/
#define MIN_Z_HEIGHT_FOR_HOMING 0
/*****************************************************************************************/
/***************************************************************************************** /*****************************************************************************************
********************************* Stepper enable logic ********************************** ********************************* Stepper enable logic **********************************
***************************************************************************************** *****************************************************************************************
...@@ -233,7 +246,27 @@ ...@@ -233,7 +246,27 @@
/***************************************************************************************** /*****************************************************************************************
******************************* Auto bed levelling ************************************** ******************************* Mesh bed leveling ***************************************
*****************************************************************************************/
//#define MESH_BED_LEVELING
#define MESH_INSET 10 // Mesh inset margin on print area
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 5 // Z after Home, bed somewhere below but above 0.0.
// After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
//#define MESH_G28_REST_ORIGIN
// Add display menu option for bed leveling.
//#define MANUAL_BED_LEVELING
// Step size while manually probing Z axis.
#define MBL_Z_STEP 0.025
/*****************************************************************************************/
/*****************************************************************************************
******************************* Auto bed leveling ***************************************
***************************************************************************************** *****************************************************************************************
* * * *
* There are 2 different ways to specify probing locations * * There are 2 different ways to specify probing locations *
...@@ -292,9 +325,6 @@ ...@@ -292,9 +325,6 @@
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front [of the nozzle] +behind #define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front [of the nozzle] +behind
#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!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point. #define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point. #define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* - Endstop pullup resistors * - Endstop pullup resistors
* - Endstops logic * - Endstops logic
* - Endstops min or max * - Endstops min or max
* - Min Z height for homing
* - Stepper enable logic * - Stepper enable logic
* - Stepper step logic * - Stepper step logic
* - Stepper direction * - Stepper direction
...@@ -126,6 +127,18 @@ ...@@ -126,6 +127,18 @@
/*****************************************************************************************/ /*****************************************************************************************/
/*****************************************************************************************
***************************** MIN Z HEIGHT FOR HOMING **********************************
*****************************************************************************************
* *
* (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, *
* Be sure you have this distance over your Z_MAX_POS in case. *
* *
*****************************************************************************************/
#define MIN_Z_HEIGHT_FOR_HOMING 0
/*****************************************************************************************/
/***************************************************************************************** /*****************************************************************************************
********************************* Stepper enable logic ********************************** ********************************* Stepper enable logic **********************************
***************************************************************************************** *****************************************************************************************
...@@ -255,7 +268,27 @@ ...@@ -255,7 +268,27 @@
/***************************************************************************************** /*****************************************************************************************
******************************* Auto bed levelling ************************************** ******************************* Mesh bed leveling ***************************************
*****************************************************************************************/
//#define MESH_BED_LEVELING
#define MESH_INSET 10 // Mesh inset margin on print area
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 5 // Z after Home, bed somewhere below but above 0.0.
// After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
//#define MESH_G28_REST_ORIGIN
// Add display menu option for bed leveling.
//#define MANUAL_BED_LEVELING
// Step size while manually probing Z axis.
#define MBL_Z_STEP 0.025
/*****************************************************************************************/
/*****************************************************************************************
******************************* Auto bed leveling ***************************************
***************************************************************************************** *****************************************************************************************
* * * *
* There are 2 different ways to specify probing locations * * There are 2 different ways to specify probing locations *
...@@ -293,9 +326,9 @@ ...@@ -293,9 +326,9 @@
#define ABL_PROBE_PT_1_X 15 #define ABL_PROBE_PT_1_X 15
#define ABL_PROBE_PT_1_Y 180 #define ABL_PROBE_PT_1_Y 180
#define ABL_PROBE_PT_2_X 15 #define ABL_PROBE_PT_2_X 15
#define ABL_PROBE_PT_2_Y 20 #define ABL_PROBE_PT_2_Y 15
#define ABL_PROBE_PT_3_X 170 #define ABL_PROBE_PT_3_X 180
#define ABL_PROBE_PT_3_Y 20 #define ABL_PROBE_PT_3_Y 15
// no AUTO_BED_LEVELING_GRID // no AUTO_BED_LEVELING_GRID
// Offsets to the probe relative to the extruder tip (Hotend - Probe) // Offsets to the probe relative to the extruder tip (Hotend - Probe)
...@@ -314,9 +347,6 @@ ...@@ -314,9 +347,6 @@
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front [of the nozzle] +behind #define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front [of the nozzle] +behind
#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!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point. #define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point. #define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
...@@ -324,8 +354,8 @@ ...@@ -324,8 +354,8 @@
//#define Z_PROBE_END_SCRIPT "G1 Z10 F8000\nG1 X10 Y10\nG1 Z0.5" // These commands will be executed in the end of G29 routine. //#define Z_PROBE_END_SCRIPT "G1 Z10 F8000\nG1 X10 Y10\nG1 Z0.5" // These commands will be executed in the end of G29 routine.
// Useful to retract a deployable Z probe. // Useful to retract a deployable Z probe.
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pick up the sled. 0 should be fine but you can push it further if you'd like. #define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pick up the sled. 0 should be fine but you can push it further if you'd like.
/*****************************************************************************************/ /*****************************************************************************************/
...@@ -336,26 +366,26 @@ ...@@ -336,26 +366,26 @@
* If you have enabled the Auto bed levelling this add the Support for * * If you have enabled the Auto bed levelling this add the Support for *
* a dedicated Z PROBE endstop separate from the Z MIN endstop. * * a dedicated Z PROBE endstop separate from the Z MIN endstop. *
* If you would like to use both a Z PROBE and a Z MIN endstop together * * If you would like to use both a Z PROBE and a Z MIN endstop together *
* or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP * * or just a Z PROBE with a custom pin, uncomment #define Z PROBE ENDSTOP *
* and read the instructions below. * * and read the instructions below. *
* * * *
* If you want to still use the Z min endstop for homing, * * If you want to still use the Z min endstop for homing, *
* disable Z_SAFE_HOMING. * * disable Z SAFE HOMING. *
* Eg: to park the head outside the bed area when homing with G28. * * Eg: to park the head outside the bed area when homing with G28. *
* * * *
* WARNING: The Z MIN endstop will need to set properly as it would * * WARNING: The Z MIN endstop will need to set properly as it would *
* without a Z PROBE to prevent head crashes and premature stopping * * without a Z PROBE to prevent head crashes and premature stopping *
* during a print. * * during a print. *
* To use a separte Z PROBE endstop, you must have a Z_PROBE_PIN * * To use a separte Z PROBE endstop, you must have a Z PROBE PIN *
* defined in the pins.h file for your control board. * * defined in the pins.h file for your control board. *
* If you are using a servo based Z PROBE, you will need to enable * * If you are using a servo based Z PROBE, you will need to enable *
* NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in * * NUM SERVOS, SERVO ENDSTOPS and SERVO ENDSTOPS ANGLES in *
* Configuration_Feature R/C Servo section. * * Configuration_Feature R/C Servo section. *
* * * *
* WARNING: Setting the wrong pin may have unexpected and potentially * * WARNING: Setting the wrong pin may have unexpected and potentially *
* disastrous outcomes. Use with caution and do your homework. * * disastrous outcomes. Use with caution and do your homework. *
* * * *
* Uncomment Z_PROBE_ENDSTOP to enable. * * Uncomment Z PROBE ENDSTOP to enable. *
* * * *
*****************************************************************************************/ *****************************************************************************************/
//#define Z_PROBE_ENDSTOP //#define Z_PROBE_ENDSTOP
...@@ -364,10 +394,10 @@ ...@@ -364,10 +394,10 @@
/***************************************************************************************** /*****************************************************************************************
******************************** Manual home positions ********************************** ******************************** Manual home positions **********************************
/*****************************************************************************************/ *****************************************************************************************/
// The position of the homing switches // The position of the homing switches
//#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations: //Manual homing switch locations:
#define MANUAL_X_HOME_POS 0 #define MANUAL_X_HOME_POS 0
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* - Software endstops * - Software endstops
* - Endstops only for homing * - Endstops only for homing
* - Abort on endstop hit feature * - Abort on endstop hit feature
* - Mesh Level Area
* - R/C Servo * - R/C Servo
* - Late Z axis * - Late Z axis
* - Ahead slowdown * - Ahead slowdown
...@@ -437,6 +438,23 @@ ...@@ -437,6 +438,23 @@
**************************************************************************/ **************************************************************************/
//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
#define ABORT_ON_ENDSTOP_HIT_INIT true #define ABORT_ON_ENDSTOP_HIT_INIT true
/**************************************************************************/
/**************************************************************************
*************************** Mesh Level Area ******************************
**************************************************************************
* *
* Default mesh area is an area with an inset margin on the print area. *
* Below are the macros that are used to define the borders for the mesh *
* area, made available here for specialized needs. *
* *
**************************************************************************/
#define MESH_MIN_X (X_MIN_POS + MESH_INSET)
#define MESH_MAX_X (X_MAX_POS - (MESH_INSET))
#define MESH_MIN_Y (Y_MIN_POS + MESH_INSET)
#define MESH_MAX_Y (Y_MAX_POS - (MESH_INSET))
/**************************************************************************/
/************************************************************************** /**************************************************************************
......
...@@ -178,6 +178,14 @@ void Config_StoreSettings() { ...@@ -178,6 +178,14 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, home_offset); EEPROM_WRITE_VAR(i, home_offset);
EEPROM_WRITE_VAR(i, hotend_offset); EEPROM_WRITE_VAR(i, hotend_offset);
#if ENABLED(MESH_BED_LEVELING)
// Compile time test that sizeof(mbl.z_values) is as expected
typedef char c_assert[(sizeof(mbl.z_values) == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS) * sizeof(dummy)) ? 1 : -1];
EEPROM_WRITE_VAR(i, mbl.active);
EEPROM_WRITE_VAR(i, mbl.z_offset);
EEPROM_WRITE_VAR(i, mbl.z_values);
#endif
#if !MECH(DELTA) #if !MECH(DELTA)
EEPROM_WRITE_VAR(i, zprobe_zoffset); EEPROM_WRITE_VAR(i, zprobe_zoffset);
#endif #endif
...@@ -337,6 +345,12 @@ void Config_RetrieveSettings() { ...@@ -337,6 +345,12 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, home_offset); EEPROM_READ_VAR(i, home_offset);
EEPROM_READ_VAR(i, hotend_offset); EEPROM_READ_VAR(i, hotend_offset);
#if ENABLED(MESH_BED_LEVELING)
EPROM_READ_VAR(i, mbl.active);
EEPROM_READ_VAR(i, mbl.z_offset);
EEPROM_READ_VAR(i, mbl.z_values);
#endif
#if !MECH(DELTA) #if !MECH(DELTA)
EEPROM_READ_VAR(i, zprobe_zoffset); EEPROM_READ_VAR(i, zprobe_zoffset);
#endif #endif
...@@ -539,6 +553,10 @@ void Config_ResetDefault() { ...@@ -539,6 +553,10 @@ void Config_ResetDefault() {
max_z_jerk = DEFAULT_ZJERK; max_z_jerk = DEFAULT_ZJERK;
home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0; home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
#if ENABLED(MESH_BED_LEVELING)
mbl.active = false;
#endif
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER; zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
#elif !MECH(DELTA) #elif !MECH(DELTA)
...@@ -744,6 +762,23 @@ void Config_ResetDefault() { ...@@ -744,6 +762,23 @@ void Config_ResetDefault() {
ECHO_EMV(" Z", hotend_offset[Z_AXIS][h]); ECHO_EMV(" Z", hotend_offset[Z_AXIS][h]);
} }
#if ENABLED(MESH_BED_LEVELING)
if (!forReplay) {
ECHO_LM(CFG, "Mesh bed leveling:");
}
ECHO_SMV(CFG, " M420 S", mbl.active);
ECHO_MV(" X", MESH_NUM_X_POINTS);
ECHO_EMV(" Y", MESH_NUM_Y_POINTS);
for (int py = 1; py <= MESH_NUM_Y_POINTS; py++) {
for (int px = 1; px <= MESH_NUM_X_POINTS; px++) {
ECHO_SMV(CFG, " G29 S3 X", px);
ECHO_MV(" Y", py);
ECHO_EMV(" Z", mbl.z_values[py-1][px-1], 5);
}
}
#endif
#if HEATER_USES_AD595 #if HEATER_USES_AD595
if (!forReplay) { if (!forReplay) {
ECHO_LM(CFG, "AD595 Offset and Gain:"); ECHO_LM(CFG, "AD595 Offset and Gain:");
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define CONFIGURATION_VERSION_H #define CONFIGURATION_VERSION_H
#define FIRMWARE_NAME "MK" #define FIRMWARE_NAME "MK"
#define SHORT_BUILD_VERSION "4.2.83_dev" #define SHORT_BUILD_VERSION "4.2.84_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
......
...@@ -171,6 +171,8 @@ ...@@ -171,6 +171,8 @@
* M407 - Display measured filament diameter * M407 - Display measured filament diameter
* M408 - Report JSON-style response * M408 - Report JSON-style response
* M410 - Quickstop. Abort all the planned moves * M410 - Quickstop. Abort all the planned moves
* M420 - Enable/Disable Mesh Bed Leveling
* M421 - Set a single Mesh Bed Leveling Z coordinate. M421 X<mm> Y<mm> Z<mm>' or 'M421 I<xindex> J<yindex> Z<mm>
* M428 - Set the home_offset logically based on the current_position * M428 - Set the home_offset logically based on the current_position
* M500 - Store parameters in EEPROM * M500 - Store parameters in EEPROM
* M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily). * M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
......
...@@ -52,6 +52,10 @@ ...@@ -52,6 +52,10 @@
#include "module/HAL/HAL.h" #include "module/HAL/HAL.h"
#include "module/communication/communication.h" #include "module/communication/communication.h"
#if ENABLED(MESH_BED_LEVELING)
#include "module/mbl/mesh_bed_leveling.h"
#endif
#include "Configuration_Store.h" #include "Configuration_Store.h"
#include "module/language/language.h" #include "module/language/language.h"
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
......
This diff is collapsed.
...@@ -74,26 +74,6 @@ ...@@ -74,26 +74,6 @@
#define KILL_PIN -1 // 80 with Smart Controller LCD #define KILL_PIN -1 // 80 with Smart Controller LCD
#define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing. #define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing.
#undef LASER_TTL_PIN
#undef LASER_PWR_PIN
#if LASER_CONTROL == 1
#define LASER_PWR_PIN 5
#define LASER_TTL_PIN -1
#endif
#if LASER_CONTROL == 2
#define LASER_TTL_PIN 5 // Digital pins 2, 3, 5, 6, 7, 8 are attached to timers we can use
#define LASER_PWR_PIN 2
#endif
#if ENABLED(LASER_PERIPHERALS)
#undef LASER_PERIPHERALS_PIN
#undef LASER_PERIPHERALS_STATUS_PIN
#define LASER_PERIPHERALS_PIN 11
#define LASER_PERIPHERALS_STATUS_PIN 4
#endif
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
#define KILL_PIN 80 #define KILL_PIN 80
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
......
...@@ -70,37 +70,6 @@ ...@@ -70,37 +70,6 @@
#define ORIG_HEATER_BED_PIN 8 // BED #define ORIG_HEATER_BED_PIN 8 // BED
#define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING #define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING
#if ENABLED(LASERBEAM)
#undef LASER_TTL_PIN
#undef LASER_PWR_PIN
#if LASER_CONTROL == 1
#define LASER_PWR_PIN 5
#define LASER_TTL_PIN -1
#endif
#if LASER_CONTROL == 2
#define LASER_TTL_PIN 6 // Digital pins 2, 3, 5, 6, 7, 8 are attached to timers we can use
#define LASER_PWR_PIN 5
#endif
#endif
#if ENABLED(LASER_PERIPHERALS)
#undef LASER_PERIPHERALS_PIN
#undef LASER_PERIPHERALS_STATUS_PIN
#define LASER_PERIPHERALS_PIN 11
#define LASER_PERIPHERALS_STATUS_PIN 4
#endif
#if ENABLED(PIDTEMPCOOLER)
#undef COOLER_PIN
#define COOLER_PIN 2
#endif
#if ENABLED(FLOWMETER_SENSOR)
#undef FLOWMETER_PIN
#define FLOWMETER_PIN 21
#endif
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL) #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL)
#define KILL_PIN 41 #define KILL_PIN 41
#else #else
......
...@@ -376,11 +376,13 @@ ...@@ -376,11 +376,13 @@
* CoreXY or CoreYX or CoreXZ or CoreZX * CoreXY or CoreYX or CoreXZ or CoreZX
*/ */
#if MECH(COREXY) || MECH(COREYX) #if MECH(COREXY) || MECH(COREYX)
#define CORE_AXIS_1 A_AXIS
#define CORE_AXIS_2 B_AXIS #define CORE_AXIS_2 B_AXIS
#define CORE_AXIS_3 Z_AXIS #define NORMAL_AXIS Z_AXIS
#elif MECH(COREXZ) || MECH(COREZX) #elif MECH(COREXZ) || MECH(COREZX)
#define CORE_AXIS_1 A_AXIS
#define CORE_AXIS_2 C_AXIS #define CORE_AXIS_2 C_AXIS
#define CORE_AXIS_3 Y_AXIS #define NORMAL_AXIS Y_AXIS
#endif #endif
/** /**
......
...@@ -116,6 +116,8 @@ ...@@ -116,6 +116,8 @@
#define SERIAL_Z_PROBE "z_probe: " #define SERIAL_Z_PROBE "z_probe: "
#define SERIAL_E_MIN "e_min: " #define SERIAL_E_MIN "e_min: "
#define SERIAL_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-2)" #define SERIAL_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-2)"
#define SERIAL_ERR_M421_PARAMETERS "M421 requires XYZ or IJZ parameters"
#define SERIAL_ERR_MESH_XY "Mesh XY or IJ cannot be resolved"
#define SERIAL_ERR_M428_TOO_FAR "Too far from reference point" #define SERIAL_ERR_M428_TOO_FAR "Too far from reference point"
#define SERIAL_M119_REPORT "Reporting endstop status" #define SERIAL_M119_REPORT "Reporting endstop status"
#define SERIAL_ENDSTOP_HIT "TRIGGERED" #define SERIAL_ENDSTOP_HIT "TRIGGERED"
......
...@@ -45,15 +45,11 @@ ...@@ -45,15 +45,11 @@
#define MSG_AUTO_HOME_X "Home X" #define MSG_AUTO_HOME_X "Home X"
#define MSG_AUTO_HOME_Y "Home Y" #define MSG_AUTO_HOME_Y "Home Y"
#define MSG_AUTO_HOME_Z "Home Z" #define MSG_AUTO_HOME_Z "Home Z"
#define MSG_MBL_SETTING "Manual Bed Leveling" #define MSG_LEVEL_BED_HOMING "Homing XYZ"
#define MSG_MBL_BUTTON " Press the button " #define MSG_LEVEL_BED_WAITING "Click to Begin"
#define MSG_MBL_INTRO " Leveling bed... " #define MSG_LEVEL_BED_NEXT_POINT "Next Point"
#define MSG_MBL_1 " Adjust first point " #define MSG_LEVEL_BED_DONE "Leveling Done!"
#define MSG_MBL_2 " Adjust second point" #define MSG_LEVEL_BED_CANCEL "Cancel"
#define MSG_MBL_3 " Adjust third point "
#define MSG_MBL_4 " Adjust fourth point"
#define MSG_MBL_5 " Is it ok? "
#define MSG_MBL_6 " BED leveled! "
#define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Set origin" #define MSG_SET_ORIGIN "Set origin"
#define MSG_ONFOR "On x:" #define MSG_ONFOR "On x:"
...@@ -83,6 +79,7 @@ ...@@ -83,6 +79,7 @@
#define MSG_SPEED "Speed" #define MSG_SPEED "Speed"
#define MSG_NOZZLE "Nozzle" #define MSG_NOZZLE "Nozzle"
#define MSG_BED "Bed" #define MSG_BED "Bed"
#define MSG_BED_Z "Bed Z"
#define MSG_FAN_SPEED "Fan speed" #define MSG_FAN_SPEED "Fan speed"
#define MSG_FLOW "Flow" #define MSG_FLOW "Flow"
#define MSG_CONTROL "Control" #define MSG_CONTROL "Control"
......
...@@ -42,15 +42,10 @@ ...@@ -42,15 +42,10 @@
#define MSG_AUTOSTART "Autostart" #define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Disabilita Motori" #define MSG_DISABLE_STEPPERS "Disabilita Motori"
#define MSG_AUTO_HOME "Auto Home" #define MSG_AUTO_HOME "Auto Home"
#define MSG_MBL_SETTING "Liv. piatto manuale " #define MSG_LEVEL_BED_HOMING "Home assi XYZ"
#define MSG_MBL_BUTTON " Premi il tasto " #define MSG_LEVEL_BED_WAITING "Premi per iniziare"
#define MSG_MBL_INTRO " Liv. piatto... " #define MSG_LEVEL_BED_DONE "Livel. terminato!"
#define MSG_MBL_1 " Calibra il primo punto" #define MSG_LEVEL_BED_CANCEL "Annulla"
#define MSG_MBL_2 " Calibra il secondo punto"
#define MSG_MBL_3 " Calibra il terzo punto"
#define MSG_MBL_4 " Calibra il quarto punto"
#define MSG_MBL_5 " Va bene? "
#define MSG_MBL_6 " Piatto livellato! "
#define MSG_SET_HOME_OFFSETS "Setta offset home" #define MSG_SET_HOME_OFFSETS "Setta offset home"
#define MSG_SET_ORIGIN "Imposta Origine" #define MSG_SET_ORIGIN "Imposta Origine"
#define MSG_ONFOR "On x:" #define MSG_ONFOR "On x:"
...@@ -76,10 +71,11 @@ ...@@ -76,10 +71,11 @@
#define MSG_EXTRUDE "Estrudi" #define MSG_EXTRUDE "Estrudi"
#define MSG_RETRACT "Ritrai" #define MSG_RETRACT "Ritrai"
#define MSG_PURGE "Purge" #define MSG_PURGE "Purge"
#define MSG_LEVEL_BED "Liv. piatto" #define MSG_LEVEL_BED "Livella piano"
#define MSG_SPEED "Velocita" #define MSG_SPEED "Velocita"
#define MSG_NOZZLE "Ugello" #define MSG_NOZZLE "Ugello"
#define MSG_BED "Piatto" #define MSG_BED "Piatto"
#define MSG_BED_Z "piatto Z"
#define MSG_FAN_SPEED "Ventola" #define MSG_FAN_SPEED "Ventola"
#define MSG_FLOW "Flusso" #define MSG_FLOW "Flusso"
#define MSG_CONTROL "Controllo" #define MSG_CONTROL "Controllo"
......
/** /**
* MK & MK4due 3D Printer Firmware * MK & MK4due 3D Printer Firmware
* *
...@@ -23,7 +24,6 @@ ...@@ -23,7 +24,6 @@
/** /**
* laser.cpp - Laser control library for Arduino using 16 bit timers- Version 1 * laser.cpp - Laser control library for Arduino using 16 bit timers- Version 1
* Copyright (c) 2013 Timothy Schmidt. All right reserved. * Copyright (c) 2013 Timothy Schmidt. All right reserved.
* Copyright (c) 2016 Franco (nextime) Lanza
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
...@@ -58,16 +58,16 @@ ...@@ -58,16 +58,16 @@
void timer3_init(int pin) { void timer3_init(int pin) {
#if ENABLED(LASER_PULSE_METHOD) #if ENABLED(LASER_PULSE_METHOD)
TCCR3A = 0; // clear control register A TCCR3A = 0; // clear control register A
TCCR3B = pulsebit(WGM33); // set mode as phase and frequency correct pwm, stop the timer TCCR3B = pulsebit(WGM33); // set mode as phase and frequency correct pwm, stop the timer
ICR3 = F_CPU / LASER_PWM / 2; // the counter runs backwards after TOP ICR3 = F_CPU / LASER_PWM / 2; // the counter runs backwards after TOP
TCCR3B &= ~(bit(CS30) | bit(CS31) | bit(CS32)); // Stop timer TCCR3B &= ~(bit(CS30) | bit(CS31) | bit(CS32)); // Stop timer
TCCR3A |= pulsebit(COM3A1); // Connect pin5 to timer register TCCR3A |= pulsebit(COM3A1); // Connect pin5 to timer register
DDRE |= pulsebit(PORTE3); // Actually output on pin 5 DDRE |= pulsebit(PORTE3); // Actually output on pin 5
OCR3A = 0; // Zero duty cycle = OFF OCR3A = 0; // Zero duty cycle = OFF
TCCR3B |= pulsebit(CS30); // No prescaler, start timer TCCR3B |= pulsebit(CS30); // No prescaler, start timer
// Use timer4 to end laser pulse // Use timer4 to end laser pulse
/* /*
...@@ -162,20 +162,20 @@ ...@@ -162,20 +162,20 @@
void timer4_init(int pin) { void timer4_init(int pin) {
pinMode(pin, OUTPUT); pinMode(pin, OUTPUT);
analogWrite(pin, 1); // let Arduino setup do it's thing to the PWM pin analogWrite(pin, 1); // let Arduino setup do it's thing to the PWM pin
TCCR4B = 0x00; // stop Timer4 clock for register updates TCCR4B = 0x00; // stop Timer4 clock for register updates
TCCR4A = 0x82; // Clear OC4A on match, fast PWM mode, lower WGM4x=14 TCCR4A = 0x82; // Clear OC4A on match, fast PWM mode, lower WGM4x=14
ICR4 = labs(F_CPU / LASER_PWM); // clock cycles per PWM pulse ICR4 = labs(F_CPU / LASER_PWM); // clock cycles per PWM pulse
OCR4A = labs(F_CPU / LASER_PWM) - 1; // ICR4 - 1 force immediate compare on next tick OCR4A = labs(F_CPU / LASER_PWM) - 1; // ICR4 - 1 force immediate compare on next tick
TCCR4B = 0x18 | 0x01; // upper WGM4x = 14, clock sel = prescaler, start running TCCR4B = 0x18 | 0x01; // upper WGM4x = 14, clock sel = prescaler, start running
noInterrupts(); noInterrupts();
TCCR4B &= 0xf8; // stop timer, OC4A may be active now TCCR4B &= 0xf8; // stop timer, OC4A may be active now
TCNT4 = labs(F_CPU / LASER_PWM); // force immediate compare on next tick TCNT4 = labs(F_CPU / LASER_PWM); // force immediate compare on next tick
ICR4 = labs(F_CPU / LASER_PWM); // set new PWM period ICR4 = labs(F_CPU / LASER_PWM); // set new PWM period
TCCR4B |= 0x01; // start the timer with proper prescaler value TCCR4B |= 0x01; // start the timer with proper prescaler value
interrupts(); interrupts();
} }
#endif // LASER_PULSE_METHOD #endif // LASER_PULSE_METHOD
...@@ -305,7 +305,7 @@ ...@@ -305,7 +305,7 @@
#if ENABLED(LASER_PERIPHERALS) #if ENABLED(LASER_PERIPHERALS)
bool laser_peripherals_ok() { return !digitalRead(LASER_PERIPHERALS_STATUS_PIN); } bool laser_peripherals_ok() { return !digitalRead(LASER_PERIPHERALS_STATUS_PIN); }
void laser_peripherals_on() { void laser_peripherals_on() {
digitalWrite(LASER_PERIPHERALS_PIN, LOW); digitalWrite(LASER_PERIPHERALS_PIN, LOW);
if (laser.diagnostics) if (laser.diagnostics)
...@@ -335,6 +335,7 @@ ...@@ -335,6 +335,7 @@
} }
} }
} }
#endif // LASER_PERIPHERALS #endif // LASER_PERIPHERALS
#endif // LASERBEAM #endif // LASERBEAM
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
/** /**
* laser.cpp - Laser control library for Arduino using 16 bit timers- Version 1 * laser.cpp - Laser control library for Arduino using 16 bit timers- Version 1
* Copyright (c) 2013 Timothy Schmidt. All right reserved. * Copyright (c) 2013 Timothy Schmidt. All right reserved.
* Copyright (c) 2016 Franco (nextime) Lanza
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -32,7 +31,7 @@ ...@@ -32,7 +31,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
#define LCD_WIDTH_EDIT 22 #define LCD_WIDTH_EDIT 22
#endif #endif
#if DISABLED(TALL_FONT_CORRECTION) #ifndef TALL_FONT_CORRECTION
#define TALL_FONT_CORRECTION 0 #define TALL_FONT_CORRECTION 0
#endif #endif
...@@ -158,7 +158,10 @@ ...@@ -158,7 +158,10 @@
U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0);
#elif ENABLED(U8GLIB_SSD1306) #elif ENABLED(U8GLIB_SSD1306)
// Generic support for SSD1306 OLED I2C LCDs // Generic support for SSD1306 OLED I2C LCDs
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST);
#elif ENABLED(U8GLIB_SH1106)
// Generic support for SH1106 OLED I2C LCDs
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST);
#elif ENABLED(MINIPANEL) #elif ENABLED(MINIPANEL)
// The MINIPanel display // The MINIPanel display
U8GLIB_MINI12864 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_MINI12864 u8g(DOGLCD_CS, DOGLCD_A0);
...@@ -167,10 +170,10 @@ ...@@ -167,10 +170,10 @@
U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0
#endif #endif
#if DISABLED(LCD_PIXEL_WIDTH) #ifndef LCD_PIXEL_WIDTH
#define LCD_PIXEL_WIDTH 128 #define LCD_PIXEL_WIDTH 128
#endif #endif
#if DISABLED(LCD_PIXEL_HEIGHT) #ifndef LCD_PIXEL_HEIGHT
#define LCD_PIXEL_HEIGHT 64 #define LCD_PIXEL_HEIGHT 64
#endif #endif
...@@ -269,7 +272,7 @@ static void lcd_implementation_init() { ...@@ -269,7 +272,7 @@ static void lcd_implementation_init() {
if (show_bootscreen) { if (show_bootscreen) {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
lcd_setFont(FONT_MENU); lcd_setFont(FONT_MENU);
#if DISABLED(STRING_SPLASH_LINE2) #ifndef STRING_SPLASH_LINE2
u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1); u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1);
#else #else
int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2; int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2;
......
This diff is collapsed.
...@@ -55,10 +55,6 @@ ...@@ -55,10 +55,6 @@
void lcd_setcontrast(uint8_t value); void lcd_setcontrast(uint8_t value);
#endif #endif
#if !MECH(DELTA) && DISABLED(Z_SAFE_HOMING) && Z_HOME_DIR < 0
void set_pageShowInfo(int value);
#endif
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
...@@ -102,7 +98,7 @@ ...@@ -102,7 +98,7 @@
#endif #endif
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
bool lcd_clicked(); bool lcd_clicked();
void lcd_ignore_click(bool b = true); void lcd_ignore_click(bool b=true);
bool lcd_blink(); bool lcd_blink();
#if ENABLED(ULTIPANEL) && ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(ULTIPANEL) && ENABLED(REPRAPWORLD_KEYPAD)
...@@ -138,6 +134,7 @@ ...@@ -138,6 +134,7 @@
#endif // ULTIPANEL && REPRAPWORLD_KEYPAD #endif // ULTIPANEL && REPRAPWORLD_KEYPAD
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
#define EN_C (_BV(BLEN_C)) #define EN_C (_BV(BLEN_C))
#define EN_B (_BV(BLEN_B)) #define EN_B (_BV(BLEN_B))
#define EN_A (_BV(BLEN_A)) #define EN_A (_BV(BLEN_A))
...@@ -179,25 +176,23 @@ ...@@ -179,25 +176,23 @@
char* itostr2(const uint8_t& x); char* itostr2(const uint8_t& x);
char* itostr3sign(const int& x); char* itostr3sign(const int& x);
char* itostr3(const int& xx); char* itostr3(const int& x);
char* itostr3left(const int& xx); char* itostr3left(const int& x);
char* itostr4(const int& xx); char* itostr4(const int& x);
char* itostr4sign(const int& x); char* itostr4sign(const int& x);
char* ltostr7(const long& xx);
char* ftostr3(const float& x); char* ftostr3(const float& x);
char* ftostr4sign(const float& x); char* ftostr4sign(const float& x);
char* ftostr30(const float& x);
char* ftostr31ns(const float& x); // float to string without sign character char* ftostr31ns(const float& x); // float to string without sign character
char* ftostr31(const float& x); char* ftostr31(const float& x);
char* ftostr32(const float& x); char* ftostr32(const float& x);
char* ftostr43(const float& x); char* ftostr43(const float& x, char plus=' ');
char* ftostr12ns(const float& x); char* ftostr12ns(const float& x);
char* ftostr32sp(const float& x); // remove zero-padding from ftostr32 char* ftostr32sp(const float& x); // remove zero-padding from ftostr32
char* ftostr5(const float& x); char* ftostr5(const float& x);
char* ftostr51(const float& x); char* ftostr51(const float& x);
char* ftostr52(const float& x); char* ftostr52(const float& x);
char* ltostr7(const long& x);
#elif DISABLED(NEXTION) #elif DISABLED(NEXTION)
......
...@@ -416,7 +416,7 @@ static void lcd_implementation_init( ...@@ -416,7 +416,7 @@ static void lcd_implementation_init(
#elif ENABLED(LCD_I2C_TYPE_MCP23017) #elif ENABLED(LCD_I2C_TYPE_MCP23017)
lcd.setMCPType(LTI_TYPE_MCP23017); lcd.setMCPType(LTI_TYPE_MCP23017);
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd.setBacklight(0); //set all the LEDs off to begin with lcd_implementation_update_indicators();
#elif ENABLED(LCD_I2C_TYPE_MCP23008) #elif ENABLED(LCD_I2C_TYPE_MCP23008)
lcd.setMCPType(LTI_TYPE_MCP23008); lcd.setMCPType(LTI_TYPE_MCP23008);
...@@ -990,14 +990,14 @@ void lcd_implementation_drawedit(const char* pstr, const char* value = NULL) { ...@@ -990,14 +990,14 @@ void lcd_implementation_drawedit(const char* pstr, const char* value = NULL) {
static uint8_t ledsprev = 0; static uint8_t ledsprev = 0;
uint8_t leds = 0; uint8_t leds = 0;
if (target_temperature_bed > 0) leds |= LED_A; if (degTargetBed() > 0) leds |= LED_A;
if (target_temperature[0] > 0) leds |= LED_B; if (degTargetHotend(0) > 0) leds |= LED_B;
if (fanSpeed) leds |= LED_C; if (fanSpeed) leds |= LED_C;
#if HOTENDS > 1 #if HOTENDS > 1
if (target_temperature[1] > 0) leds |= LED_C; if (degTargetHotend(1) > 0) leds |= LED_C;
#endif #endif
if (leds != ledsprev) { if (leds != ledsprev) {
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
...@@ -97,11 +97,11 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ...@@ -97,11 +97,11 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
ST7920_WRITE_BYTE(0x01); //clear CGRAM ram ST7920_WRITE_BYTE(0x01); //clear CGRAM ram
u8g_Delay(15); //delay for CGRAM clear u8g_Delay(15); //delay for CGRAM clear
ST7920_WRITE_BYTE(0x3E); //extended mode + GDRAM active ST7920_WRITE_BYTE(0x3E); //extended mode + GDRAM active
for (y = 0; y < LCD_PIXEL_HEIGHT / 2; y++) { //clear GDRAM for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM
ST7920_WRITE_BYTE(0x80 | y); //set y ST7920_WRITE_BYTE(0x80 | y); //set y
ST7920_WRITE_BYTE(0x80); //set x = 0 ST7920_WRITE_BYTE(0x80); //set x = 0
ST7920_SET_DAT(); ST7920_SET_DAT();
for (i = 0; i < 2 * LCD_PIXEL_WIDTH / 8; i++) //2x width clears both segments for (i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) //2x width clears both segments
ST7920_WRITE_BYTE(0); ST7920_WRITE_BYTE(0);
ST7920_SET_CMD(); ST7920_SET_CMD();
} }
...@@ -129,7 +129,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ...@@ -129,7 +129,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
ST7920_WRITE_BYTE(0x80 | 8); //x=64 ST7920_WRITE_BYTE(0x80 | 8); //x=64
} }
ST7920_SET_DAT(); ST7920_SET_DAT();
ST7920_WRITE_BYTES(ptr, LCD_PIXEL_WIDTH / 8); //ptr is incremented inside of macro ST7920_WRITE_BYTES(ptr, (LCD_PIXEL_WIDTH) / 8); //ptr is incremented inside of macro
y++; y++;
} }
ST7920_NCS(); ST7920_NCS();
...@@ -145,7 +145,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ...@@ -145,7 +145,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
#endif #endif
} }
uint8_t u8g_dev_st7920_128x64_rrd_buf[LCD_PIXEL_WIDTH * (PAGE_HEIGHT / 8)] U8G_NOCOMMON; uint8_t u8g_dev_st7920_128x64_rrd_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U8G_NOCOMMON;
u8g_pb_t u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0}, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_rrd_buf}; u8g_pb_t u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0}, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_rrd_buf};
u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g_dev_st7920_128x64_rrd_pb, &u8g_com_null_fn}; u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g_dev_st7920_128x64_rrd_pb, &u8g_com_null_fn};
......
/**
* 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 UTF_MAPPER_H #ifndef UTF_MAPPER_H
#define UTF_MAPPER_H #define UTF_MAPPER_H
...@@ -50,7 +72,7 @@ ...@@ -50,7 +72,7 @@
// ヰ ヱ ヲ ン フ ? ? ? ? ? ヲ ・ ー ヽ ヽ ? // ヰ ヱ ヲ ン フ ? ? ? ? ? ヲ ・ ー ヽ ヽ ?
}; };
#elif ENABLED(MAPPER_D0D1) #elif ENABLED(MAPPER_D0D1)
#error( "Cyrillic on a japanese dsplay makes no sense. There are no matching symbols."); #error "Cyrillic on a JAPANESE display makes no sense. There are no matching symbols."
#endif #endif
#elif ENABLED(DISPLAY_CHARSET_HD44780_WESTERN) #elif ENABLED(DISPLAY_CHARSET_HD44780_WESTERN)
...@@ -84,7 +106,7 @@ ...@@ -84,7 +106,7 @@
// p c T y Ф x Ч ч Ш Щ Ъ Ы b Э Ю Я // p c T y Ф x Ч ч Ш Щ Ъ Ы b Э Ю Я
}; };
#elif ENABLED(MAPPER_E382E383) #elif ENABLED(MAPPER_E382E383)
#error( "Katakana on a western display makes no sense. There are no matching symbols." ); #error "Katakana on a WESTERN display makes no sense. There are no matching symbols."
#endif #endif
#elif ENABLED(DISPLAY_CHARSET_HD44780_CYRILLIC) #elif ENABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
...@@ -94,30 +116,30 @@ ...@@ -94,30 +116,30 @@
// except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
const PROGMEM uint8_t utf_recode[] = const PROGMEM uint8_t utf_recode[] =
{ 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4, // unicode U+0400 to U+047f { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4, // unicode U+0400 to U+047f
// A Б->Ё B Г Д E Ж З // 0 Ѐ Ё Ђ Ѓ Є Ѕ І Ї // A Б->Ё B Г Д E Ж З // 0 Ѐ Ё Ђ Ѓ Є Ѕ І Ї
0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,0xa8, // Ј Љ Њ Ћ Ќ Ѝ Ў Џ 0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,0xa8, // Ј Љ Њ Ћ Ќ Ѝ Ў Џ
// И Й K Л M H O П // 1 А Б В Г Д Е Ж З // И Й K Л M H O П // 1 А Б В Г Д Е Ж З
0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab, // И Й К Л М Н О П 0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab, // И Й К Л М Н О П
// P C T У Ф X Ч ч // 2 Р С Т У Ф Х Г Ч // P C T У Ф X Ч ч // 2 Р С Т У Ф Х Г Ч
0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1, // Ш Щ Ъ Ы Ь Э Ю Я 0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1, // Ш Щ Ъ Ы Ь Э Ю Я
// Ш Щ Ъ Ы b Э Ю Я // 3 а б в г д е ж з // Ш Щ Ъ Ы b Э Ю Я // 3 а б в г д е ж з
0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7, // и й к л м н о п 0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7, // и й к л м н о п
// a б->ё в г д e ж з // 4 р с т у ф х ц ч // a б->ё в г д e ж з // 4 р с т у ф х ц ч
0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,0xbe, // ш щ ъ ы ь э ю я 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,0xbe, // ш щ ъ ы ь э ю я
// и й к л м н o п // 5 ѐ ё ђ ѓ є ѕ і ї // и й к л м н o п // 5 ѐ ё ђ ѓ є ѕ і ї
0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0, // ј љ њ ћ ќ ѝ ў џ 0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0, // ј љ њ ћ ќ ѝ ў џ
// p c т y ф x ц ч // 6 Ѡ ѡ Ѣ ѣ Ѥ ѥ Ѧ ѧ // p c т y ф x ц ч // 6 Ѡ ѡ Ѣ ѣ Ѥ ѥ Ѧ ѧ
0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 // Ѫ ѩ Ѫ ѫ Ѭ ѭ Ѯ ѯ 0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 // Ѫ ѩ Ѫ ѫ Ѭ ѭ Ѯ ѯ
// ш щ ъ ы ь э ю я // 7 Ѱ ѱ Ѳ ѳ Ѵ ѵ Ѷ ѷ // ш щ ъ ы ь э ю я // 7 Ѱ ѱ Ѳ ѳ Ѵ ѵ Ѷ ѷ
}; // ѻ ѹ Ѻ ѻ Ѽ ѽ Ѿ ѿ }; // ѻ ѹ Ѻ ѻ Ѽ ѽ Ѿ ѿ
#elif ENABLED(MAPPER_C2C3) #elif ENABLED(MAPPER_C2C3)
#error( "Western languages on a cyrillic display makes no sense. There are no matching symbols." ); #error "Western languages on a CYRILLIC display makes no sense. There are no matching symbols."
#elif ENABLED(MAPPER_E382E383) #elif ENABLED(MAPPER_E382E383)
#error( "Katakana on a cyrillic display makes no sense. There are no matching symbols." ); #error "Katakana on a CYRILLIC display makes no sense. There are no matching symbols."
#endif #endif
#else #else
#error("Something went wrong in the selection of DISPLAY_CHARSET_HD44780's"); #error "Something went wrong in the setting of DISPLAY_CHARSET_HD44780"
#endif // DISPLAY_CHARSET_HD44780_CYRILLIC #endif // DISPLAY_CHARSET_HD44780
#endif // SIMULATE_ROMFONT #endif // SIMULATE_ROMFONT
#if ENABLED(MAPPER_NON) #if ENABLED(MAPPER_NON)
...@@ -209,7 +231,7 @@ ...@@ -209,7 +231,7 @@
} }
else if (seen_d5) { else if (seen_d5) {
d &= 0x3fu; d &= 0x3fu;
#if DISABLED(MAPPER_ONE_TO_ONE) #ifndef MAPPER_ONE_TO_ONE
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20)); HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
#else #else
HARDWARE_CHAR_OUT((char)(0xa0u + (utf_hi_char << 6) + d)) ; HARDWARE_CHAR_OUT((char)(0xa0u + (utf_hi_char << 6) + d)) ;
...@@ -245,7 +267,7 @@ ...@@ -245,7 +267,7 @@
} }
else if (seen_e3 && seen_82_83) { else if (seen_e3 && seen_82_83) {
d &= 0x3f; d &= 0x3f;
#if DISABLED(MAPPER_ONE_TO_ONE) #ifndef MAPPER_ONE_TO_ONE
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20)); HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
#else #else
HARDWARE_CHAR_OUT((char)(0x80 + (utf_hi_char << 6) + d)) ; HARDWARE_CHAR_OUT((char)(0x80 + (utf_hi_char << 6) + d)) ;
......
/**
* 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/>.
*
*/
#include "../../base.h"
#if ENABLED(MESH_BED_LEVELING)
mesh_bed_leveling mbl;
mesh_bed_leveling::mesh_bed_leveling() { reset(); }
void mesh_bed_leveling::reset() {
active = 0;
z_offset = 0;
for (int8_t y = MESH_NUM_Y_POINTS; y--;)
for (int8_t x = MESH_NUM_X_POINTS; x--;)
z_values[y][x] = 0;
}
#endif // MESH_BED_LEVELING
/**
* 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/>.
*
*/
#if ENABLED(MESH_BED_LEVELING)
#define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X))/(MESH_NUM_X_POINTS - 1))
#define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y))/(MESH_NUM_Y_POINTS - 1))
class mesh_bed_leveling {
public:
bool active;
float z_offset;
float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS];
mesh_bed_leveling();
void reset();
static FORCE_INLINE float get_probe_x(int8_t i) { return MESH_MIN_X + (MESH_X_DIST) * i; }
static FORCE_INLINE float get_probe_y(int8_t i) { return MESH_MIN_Y + (MESH_Y_DIST) * i; }
void set_z(const int8_t px, const int8_t py, const float z) { z_values[py][px] = z; }
inline void zigzag(int8_t index, int8_t &px, int8_t &py) {
px = index % (MESH_NUM_X_POINTS);
py = index / (MESH_NUM_X_POINTS);
if (py & 1) px = (MESH_NUM_X_POINTS - 1) - px; // Zig zag
}
void set_zigzag_z(int8_t index, float z) {
int8_t px, py;
zigzag(index, px, py);
set_z(px, py, z);
}
int8_t cel_index_x(float x) {
int8_t cx = int(x - (MESH_MIN_X)) / (MESH_X_DIST);
return constrain(cx, 0, (MESH_NUM_X_POINTS) - 2);
}
int8_t cel_index_y(float y) {
int8_t cy = int(y - (MESH_MIN_Y)) / (MESH_Y_DIST);
return constrain(cy, 0, (MESH_NUM_Y_POINTS) - 2);
}
int8_t probe_index_x(float x) {
int8_t px = int(x - (MESH_MIN_X) + (MESH_X_DIST) / 2) / (MESH_X_DIST);
return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
}
int8_t probe_index_y(float y) {
int8_t py = int(y - (MESH_MIN_Y) + (MESH_Y_DIST) / 2) / (MESH_Y_DIST);
return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
}
float calc_z0(float a0, float a1, float z1, float a2, float z2) {
float delta_z = (z2 - z1) / (a2 - a1);
float delta_a = a0 - a1;
return z1 + delta_a * delta_z;
}
float get_z(float x0, float y0) {
int8_t cx = cel_index_x(x0),
cy = cel_index_y(y0);
if (cx < 0 || cy < 0) return z_offset;
float z1 = calc_z0(x0,
get_probe_x(cx), z_values[cy][cx],
get_probe_x(cx + 1), z_values[cy][cx + 1]);
float z2 = calc_z0(x0,
get_probe_x(cx), z_values[cy + 1][cx],
get_probe_x(cx + 1), z_values[cy + 1][cx + 1]);
float z0 = calc_z0(y0,
get_probe_y(cy), z1,
get_probe_y(cy + 1), z2);
return z0 + z_offset;
}
};
extern mesh_bed_leveling mbl;
#endif // MESH_BED_LEVELING
...@@ -32,6 +32,34 @@ ...@@ -32,6 +32,34 @@
Endstops endstops; Endstops endstops;
// public:
bool Endstops::enabled = true,
Endstops::enabled_globally =
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
false
#else
true
#endif
;
volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
#if ENABLED(Z_DUAL_ENDSTOPS)
uint16_t
#else
byte
#endif
Endstops::current_endstop_bits = 0,
Endstops::old_endstop_bits = 0;
#if HAS(Z_PROBE)
volatile bool Endstops::z_probe_enabled = false;
#endif
/**
* Class and Instance Methods
*/
Endstops::Endstops() { Endstops::Endstops() {
enable_globally( enable_globally(
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING) #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
...@@ -41,7 +69,7 @@ Endstops::Endstops() { ...@@ -41,7 +69,7 @@ Endstops::Endstops() {
#endif #endif
); );
enable(true); enable(true);
#if ENABLED(HAS_Z_PROBE) #if HAS(Z_PROBE)
enable_z_probe(false); enable_z_probe(false);
#endif #endif
} // Endstops::Endstops } // Endstops::Endstops
...@@ -240,8 +268,8 @@ void Endstops::update() { ...@@ -240,8 +268,8 @@ void Endstops::update() {
#if MECH(COREXY) || MECH(COREYX)|| MECH(COREXZ) || MECH(COREZX) #if MECH(COREXY) || MECH(COREYX)|| MECH(COREXZ) || MECH(COREZX)
// Head direction in -X axis for CoreXY and CoreXZ bots. // Head direction in -X axis for CoreXY and CoreXZ bots.
// If Delta1 == -Delta2, the movement is only in Y or Z axis // If DeltaA == -DeltaB, the movement is only in Y or Z axis
if ((current_block->steps[A_AXIS] != current_block->steps[CORE_AXIS_2]) || (motor_direction(A_AXIS) == motor_direction(CORE_AXIS_2))) { if ((current_block->steps[CORE_AXIS_1] != current_block->steps[CORE_AXIS_2]) || (motor_direction(CORE_AXIS_1) == motor_direction(CORE_AXIS_2))) {
if (motor_direction(X_HEAD)) if (motor_direction(X_HEAD))
#else #else
if (motor_direction(X_AXIS)) // stepping along -X axis (regular Cartesian bot) if (motor_direction(X_AXIS)) // stepping along -X axis (regular Cartesian bot)
...@@ -274,8 +302,8 @@ void Endstops::update() { ...@@ -274,8 +302,8 @@ void Endstops::update() {
#if MECH(COREXY) || MECH(COREYX) #if MECH(COREXY) || MECH(COREYX)
// Head direction in -Y axis for CoreXY bots. // Head direction in -Y axis for CoreXY bots.
// If DeltaX == DeltaY, the movement is only in X axis // If DeltaA == DeltaB, the movement is only in X axis
if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (motor_direction(A_AXIS) != motor_direction(B_AXIS))) { if ((current_block->steps[CORE_AXIS_1] != current_block->steps[CORE_AXIS_2]) || (motor_direction(CORE_AXIS_1) != motor_direction(CORE_AXIS_2))) {
if (motor_direction(Y_HEAD)) if (motor_direction(Y_HEAD))
#else #else
if (motor_direction(Y_AXIS)) // -direction if (motor_direction(Y_AXIS)) // -direction
...@@ -296,8 +324,8 @@ void Endstops::update() { ...@@ -296,8 +324,8 @@ void Endstops::update() {
#if MECH(COREXZ) || MECH(COREZX) #if MECH(COREXZ) || MECH(COREZX)
// Head direction in -Z axis for CoreXZ bots. // Head direction in -Z axis for CoreXZ bots.
// If DeltaX == DeltaZ, the movement is only in X axis // If DeltaA == DeltaB, the movement is only in X axis
if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (motor_direction(A_AXIS) != motor_direction(C_AXIS))) { if ((current_block->steps[CORE_AXIS_1] != current_block->steps[CORE_AXIS_2]) || (motor_direction(CORE_AXIS_1) !) != motor_direction(CORE_AXIS_2))) {
if (motor_direction(Z_HEAD)) if (motor_direction(Z_HEAD))
#else #else
if (motor_direction(Z_AXIS)) if (motor_direction(Z_AXIS))
......
...@@ -33,25 +33,15 @@ class Endstops { ...@@ -33,25 +33,15 @@ class Endstops {
public: public:
volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value static bool enabled, enabled_globally;
static volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
uint16_t current_endstop_bits = 0, static uint16_t
old_endstop_bits = 0;
#else #else
byte current_endstop_bits = 0, static byte
old_endstop_bits = 0;
#endif #endif
current_endstop_bits, old_endstop_bits;
bool enabled = true;
bool enabled_globally =
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
false
#else
true
#endif
;
Endstops(); Endstops();
...@@ -63,40 +53,40 @@ class Endstops { ...@@ -63,40 +53,40 @@ class Endstops {
/** /**
* Update the endstops bits from the pins * Update the endstops bits from the pins
*/ */
void update(); static void update();
/** /**
* Print an error message reporting the position when the endstops were last hit. * 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 static 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 * Report endstop positions in response to M119
*/ */
void M119(); static void M119();
// Enable / disable endstop checking globally // Enable / disable endstop checking globally
FORCE_INLINE void enable_globally(bool onoff = true) { enabled_globally = enabled = onoff; } static void enable_globally(bool onoff = true) { enabled_globally = enabled = onoff; }
// Enable / disable endstop checking // Enable / disable endstop checking
FORCE_INLINE void enable(bool onoff = true) { enabled = onoff; } static void enable(bool onoff = true) { enabled = onoff; }
// Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable
FORCE_INLINE void not_homing() { enabled = enabled_globally; } static void not_homing() { enabled = enabled_globally; }
// Clear endstops (i.e., they were hit intentionally) to suppress the report // Clear endstops (i.e., they were hit intentionally) to suppress the report
FORCE_INLINE void hit_on_purpose() { endstop_hit_bits = 0; } static void hit_on_purpose() { endstop_hit_bits = 0; }
// Enable / disable endstop z-probe checking // Enable / disable endstop z-probe checking
#if ENABLED(HAS_Z_PROBE) #if HAS(Z_PROBE)
volatile bool z_probe_enabled = false; static volatile bool z_probe_enabled;
FORCE_INLINE void enable_z_probe(bool onoff = true) { z_probe_enabled = onoff; } static void enable_z_probe(bool onoff = true) { z_probe_enabled = onoff; }
#endif #endif
private: private:
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
void test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2); static void test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2);
#endif #endif
}; };
......
This diff is collapsed.
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
* *
* Grbl is distributed in the hope that it will be useful, * Grbl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Grbl. If not, see <http://www.gnu.org/licenses/>. * along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
// This module is to be considered a sub-module of stepper.c. Please don't include // This module is to be considered a sub-module of stepper.c. Please don't include
...@@ -127,29 +127,43 @@ void check_axes_activity(); ...@@ -127,29 +127,43 @@ void check_axes_activity();
// Get the number of buffered moves // Get the number of buffered moves
extern volatile unsigned char block_buffer_head; extern volatile unsigned char block_buffer_head;
extern volatile unsigned char block_buffer_tail; extern volatile unsigned char block_buffer_tail;
/**
* Number of moves currently in the planner
*/
FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); } FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
#include "vector_3.h" #if ENABLED(AUTO_BED_LEVELING_FEATURE)
// Transform required to compensate for bed level #include "vector_3.h"
extern matrix_3x3 plan_bed_level_matrix;
/** // Transform to compensate for bed level
* Get the position applying the bed level matrix extern matrix_3x3 plan_bed_level_matrix;
*/
vector_3 plan_get_position(); /**
* The corrected position, applying the bed level matrix
*/
vector_3 plan_adjusted_position();
#endif
/** /**
* Add a new linear movement to the buffer. x, y, z are the signed, absolute target position in * Add a new linear movement to the buffer.
* millimeters. Feed rate specifies the (target) speed of the motion. *
* x,y,z,e - target position in mm
* feed_rate - (target) speed of the move
* extruder - target extruder
*/ */
void plan_buffer_line(float x, float y, float z, const float& e, float feed_rate, const uint8_t extruder, const uint8_t driver); void plan_buffer_line(float x, float y, float z, const float& e, float feed_rate, const uint8_t extruder, const uint8_t driver);
/** /**
* Set the planner positions. Used for G92 instructions. * Set the planner.position and individual stepper positions.
* Multiplies by axis_steps_per_unit[] to set stepper positions. * Used by G92, G28, G29, and other procedures.
*
* Multiplies by axis_steps_per_unit[] and does necessary conversion
* for COREXY / COREXZ to set the corresponding stepper positions.
*
* Clears previous speed values. * Clears previous speed values.
*/ */
void plan_set_position(float x, float y, float z, const float& e); void plan_set_position(float x, float y, float z, const float& e);
...@@ -159,8 +173,11 @@ FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block ...@@ -159,8 +173,11 @@ FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block
void plan_buffer_line(const float& x, const float& y, const float& z, const float& e, float feed_rate, const uint8_t extruder, const uint8_t driver); void plan_buffer_line(const float& x, const float& y, const float& z, const float& e, float feed_rate, const uint8_t extruder, const uint8_t driver);
void plan_set_position(const float& x, const float& y, const float& z, const float& e); void plan_set_position(const float& x, const float& y, const float& z, const float& e);
#endif // AUTO_BED_LEVELING_FEATURE #endif // AUTO_BED_LEVELING_FEATURE || MESH_BED_LEVELING
/**
* Set the E position (mm) of the planner (and the E stepper)
*/
void plan_set_e_position(const float& e); void plan_set_e_position(const float& e);
//=========================================================================== //===========================================================================
...@@ -193,17 +210,24 @@ extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for ...@@ -193,17 +210,24 @@ extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for
extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed
extern volatile unsigned char block_buffer_tail; extern volatile unsigned char block_buffer_tail;
// Returns true if the buffer has a queued block, false otherwise /**
* Does the buffer have any blocks queued?
*/
FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); } FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
// Called when the current block is no longer needed. Discards /**
// the block and makes the memory available for new blocks. * "Discards" the block and "releases" the memory.
* Called when the current block is no longer needed.
*/
FORCE_INLINE void plan_discard_current_block() { FORCE_INLINE void plan_discard_current_block() {
if (blocks_queued()) if (blocks_queued())
block_buffer_tail = BLOCK_MOD(block_buffer_tail + 1); block_buffer_tail = BLOCK_MOD(block_buffer_tail + 1);
} }
// Gets the current block. Returns NULL if buffer empty /**
* The current block. NULL if the buffer is empty.
* This also marks the block as busy.
*/
FORCE_INLINE block_t* plan_get_current_block() { FORCE_INLINE block_t* plan_get_current_block() {
if (blocks_queued()) { if (blocks_queued()) {
block_t* block = &block_buffer[block_buffer_tail]; block_t* block = &block_buffer[block_buffer_tail];
......
...@@ -1104,14 +1104,14 @@ long st_get_position(uint8_t axis) { ...@@ -1104,14 +1104,14 @@ long st_get_position(uint8_t axis) {
float st_get_axis_position_mm(AxisEnum axis) { float st_get_axis_position_mm(AxisEnum axis) {
float axis_pos; float axis_pos;
#if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX) #if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX)
if (axis == X_AXIS || axis == CORE_AXIS_2) { if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
CRITICAL_SECTION_START; CRITICAL_SECTION_START;
long pos1 = count_position[A_AXIS], long pos1 = count_position[CORE_AXIS_1],
pos2 = count_position[CORE_AXIS_2]; pos2 = count_position[CORE_AXIS_2];
CRITICAL_SECTION_END; CRITICAL_SECTION_END;
// ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1 // ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1
// ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2 // ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2
axis_pos = (pos1 + ((axis == X_AXIS) ? pos2 : -pos2)) / 2.0f; axis_pos = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) / 2.0f;
} }
else else
axis_pos = st_get_position(axis); axis_pos = st_get_position(axis);
...@@ -1160,10 +1160,10 @@ void endstop_triggered(AxisEnum axis) { ...@@ -1160,10 +1160,10 @@ void endstop_triggered(AxisEnum axis) {
#if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX) #if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX)
float axis_pos = count_position[axis]; float axis_pos = count_position[axis];
if (axis == A_AXIS) if (axis == CORE_AXIS_1)
axis_pos = (axis_pos + count_position[CORE_AXIS_2]) / 2; axis_pos = (axis_pos + count_position[CORE_AXIS_2]) / 2;
else if (axis == CORE_AXIS_2) else if (axis == CORE_AXIS_2)
axis_pos = (count_position[A_AXIS] - axis_pos) / 2; axis_pos = (count_position[CORE_AXIS_1] - axis_pos) / 2;
endstops_trigsteps[axis] = axis_pos; endstops_trigsteps[axis] = axis_pos;
#else // ! COREXY || COREYX || COREXZ || COREZX #else // ! COREXY || COREYX || COREXZ || COREZX
......
...@@ -530,6 +530,27 @@ ...@@ -530,6 +530,27 @@
#if DISABLED(SOFTWARE_MAX_ENDSTOPS) #if DISABLED(SOFTWARE_MAX_ENDSTOPS)
#error DEPENDENCY ERROR: Missing setting SOFTWARE_MAX_ENDSTOPS #error DEPENDENCY ERROR: Missing setting SOFTWARE_MAX_ENDSTOPS
#endif #endif
/**
* Mesh Bed Leveling
*/
#if ENABLED(MESH_BED_LEVELING)
#if MECH(DELTA)
#error "MESH_BED_LEVELING does not yet support DELTA printers."
#endif
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#error "Select AUTO_BED_LEVELING_FEATURE or MESH_BED_LEVELING, not both."
#endif
#if MESH_NUM_X_POINTS > 7 || MESH_NUM_Y_POINTS > 7
#error "MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS need to be less than 8."
#endif
#elif ENABLED(MANUAL_BED_LEVELING)
#error "MESH_BED_LEVELING is required for MANUAL_BED_LEVELING."
#endif
/**
* Auto Bed Leveling
*/
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if ENABLED(AUTO_BED_LEVELING_GRID) #if ENABLED(AUTO_BED_LEVELING_GRID)
#if DISABLED(MIN_PROBE_EDGE) #if DISABLED(MIN_PROBE_EDGE)
...@@ -1924,4 +1945,12 @@ ...@@ -1924,4 +1945,12 @@
#error DEPENDENCY ERROR: You have to set SLED_PIN to a valid pin if you enable Z_PROBE_SLED #error DEPENDENCY ERROR: You have to set SLED_PIN to a valid pin if you enable Z_PROBE_SLED
#endif #endif
/**
* Warnings for old configurations
*/
#if WATCH_TEMP_PERIOD > 500
#error "WATCH_TEMP_PERIOD now uses seconds instead of milliseconds."
#elif defined(Z_RAISE_BEFORE_HOMING)
#error "Z_RAISE_BEFORE_HOMING is deprecated. Use MIN_Z_HEIGHT_FOR_HOMING instead."
#endif
#endif //SANITYCHECK_H #endif //SANITYCHECK_H
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#define K2 (1.0 - K1) #define K2 (1.0 - K1)
#endif #endif
#if ENABLED(PIDTEMPBED) || ENABLED(PIDTEMP) || ENABLED(PIDTEMPCHAMBER) || ENABLED(PIDTEMPCOOLER) #if ENABLED(PIDTEMPBED) || ENABLED(PIDTEMP) || ENABLED(PIDTEMPCHAMBER) || ENABLED(PIDTEMPCOOLER)
#define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0)) #define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0))
#endif #endif
......
<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.82 Laser dev ## Version 4.2.84 Laser dev
This is the Laser enhananced version with the patches from Franco (nextime) Lanza. This is the Laser enhananced version with the patches from Franco (nextime) Lanza.
...@@ -15,6 +15,9 @@ For K40 laser cutter there are branches with the default config files ready to u ...@@ -15,6 +15,9 @@ For K40 laser cutter there are branches with the default config files ready to u
* [with cooler and flow sensor](https://git.nexlab.net/machinery/MarlinKimbra/tree/k40_flow_cooler) * [with cooler and flow sensor](https://git.nexlab.net/machinery/MarlinKimbra/tree/k40_flow_cooler)
* [without cooler and flow sensor](https://git.nexlab.net/machinery/MarlinKimbra/tree/k40_noflow_nocooler) * [without cooler and flow sensor](https://git.nexlab.net/machinery/MarlinKimbra/tree/k40_noflow_nocooler)
Also, take care that lasers needs a larger serial buffer on arduino mega 2560 than the default 64 byte buffer, so
take a look at needed modification on the arduino ide from [Laser Documentation README](/Documentation/Laser/README.md)
### Special thanks ### Special thanks
* all Marlin8bit-developers. * all Marlin8bit-developers.
...@@ -43,24 +46,25 @@ http://marlinkimbra.it ...@@ -43,24 +46,25 @@ http://marlinkimbra.it
This version of Marlin was made to accommodate some requests made by the community RepRap Italy http://forums.reprap.org/index.php?349 This version of Marlin was made to accommodate some requests made by the community RepRap Italy http://forums.reprap.org/index.php?349
The new features are: The new features are:
A single Firmware for all types of printers; Cartesian, Delta, SCARA, CoreXY & CoreXZ. - A single Firmware for all types of printers; Cartesian, Delta, SCARA, CoreXY & CoreXZ.
The possibility of having only one hotend independently from the extruders that you have. - The possibility of having only one hotend independently from the extruders that you have.
The addition of the 6th extruder. - The addition of the 6th extruder.
Management Color Mixing Extruder - Management Color Mixing Extruder
System Management MKr4 for 6 extruders with just two drivers or only driver. - System Management MKr4 for 6 extruders with just two drivers or only driver.
Management Multyextruder NPr2, 4/6 extruders with only two engines. - Management Multyextruder NPr2, 4/6 extruders with only two engines.
Management Dual Extruder DONDOLO. - Management Dual Extruder DONDOLO.
Adding commands to facilitate purging of hotend. - Adding commands to facilitate purging of hotend.
Step per unit varied for each extruder as well as the feedrate and the acceleration. - Step per unit varied for each extruder as well as the feedrate and the acceleration.
Adding Debug Dryrun used by repetier. - Adding Debug Dryrun used by repetier.
Added total Power on time writed in SD CARD. - Added total Power on time writed in SD CARD.
Added total Power consumption writed in SD CARD. - Added total Power consumption writed in SD CARD.
Added total filament printed writed in SD CARD. - Added total filament printed writed in SD CARD.
Added anti extruder idle oozing system. - Added anti extruder idle oozing system.
Added Hysteresis and Z-Wobble correction (only cartesian printers). - Added Hysteresis and Z-Wobble correction (only cartesian printers).
Added support reader TAG width MFRC522 - Added support reader TAG width MFRC522
Added Cooler and Hot Chamber - Added Cooler and Hot Chamber
Added Laser beam and raster base64 - Added Laser beam and raster base64
- Added Mesh Bed Level (MBL)
## Credits ## Credits
......
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