sync with upstream

parent c3a55864
Pipeline #49 skipped
...@@ -7,10 +7,9 @@ ...@@ -7,10 +7,9 @@
* - Board type * - Board type
* - Mechanism type * - Mechanism type
* - Extruders number * - Extruders number
* - Thermistor type
* - Temperature limits
* *
* 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)
* Temperature settings can be found in Configuration_Temperature.h
* Feature-settings can be found in Configuration_Feature.h * Feature-settings can be found in Configuration_Feature.h
* Pins-settings can be found in "Configuration_Pins.h" * Pins-settings can be found in "Configuration_Pins.h"
*/ */
...@@ -116,16 +115,6 @@ ...@@ -116,16 +115,6 @@
//#define PS_DEFAULT_OFF //#define PS_DEFAULT_OFF
/*************************************************************************************/ /*************************************************************************************/
/***********************************************************************
******************************* Cooler ********************************
***********************************************************************
* *
* Uncomment the following line to enable COOLER support *
* *
***********************************************************************/
//#define COOLER
/*********************************************************************** /***********************************************************************
************************** Extruders number *************************** ************************** Extruders number ***************************
...@@ -137,128 +126,4 @@ ...@@ -137,128 +126,4 @@
#define DRIVER_EXTRUDERS 1 #define DRIVER_EXTRUDERS 1
/***********************************************************************/ /***********************************************************************/
/*****************************************************************************************************
************************************** Thermistor type **********************************************
*****************************************************************************************************
* *
* 4.7kohm PULLUP! *
* This is a normal value, if you use a 1k pullup thermistor see below *
* Please choose the one that matches your setup and set to TEMP_SENSOR_. *
* *
* Temperature sensor settings (4.7kohm PULLUP): *
* -2 is thermocouple with MAX6675 (only for sensor 0) *
* -1 is thermocouple with AD595 or AD597 *
* 0 is not used *
* 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) *
* 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) *
* 3 is Mendel-parts thermistor (4.7k pullup) *
* 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! *
* 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) *
* 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) *
* 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) *
* 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) *
* 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) *
* 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) *
* 10 is 100k RS thermistor 198-961 (4.7k pullup) *
* 11 is 100k beta 3950 1% thermistor (4.7k pullup) *
* 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) *
* 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" *
* 20 is the PT100 circuit found in the Ultimainboard V2.x *
* 40 is the 10k Carel NTC015WH01 or ELIWELL SN8T6A1502 (4.7k pullup) *
* 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 *
* *
* 1kohm PULLUP! *
* This is not normal, you would have to have changed out your 4.7k for 1k *
* (but gives greater accuracy and more stable PID) *
* Please choose the one that matches your setup. *
* *
* Temperature sensor settings (1kohm PULLUP): *
* 51 is 100k thermistor - EPCOS (1k pullup) *
* 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) *
* 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) *
* *
* 1047 is Pt1000 with 4k7 pullup *
* 1010 is Pt1000 with 1k pullup (non standard) *
* 147 is Pt100 with 4k7 pullup *
* 110 is Pt100 with 1k pullup (non standard) *
* 998 and 999 are Dummy Tables. ALWAYS read 25°C or DUMMY_THERMISTOR_998_VALUE temperature *
* *
*****************************************************************************************************/
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0
#define TEMP_SENSOR_BED 0
#define TEMP_SENSOR_COOLER 0
//These 2 defines help to calibrate the AD595 sensor in case you get wrong temperature measurements.
//The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET"
#define TEMP_SENSOR_AD595_OFFSET 0.0
#define TEMP_SENSOR_AD595_GAIN 1.0
// Use it for Testing or Development purposes. NEVER for production machine.
#define DUMMY_THERMISTOR_998_VALUE 25
#define DUMMY_THERMISTOR_999_VALUE 25
//Show Temperature ADC value
//The M105 command return, besides traditional information, the ADC value read from temperature sensors.
//#define SHOW_TEMP_ADC_VALUES
/*****************************************************************************************************/
/***********************************************************************
************************* Temperature limits ***************************
***********************************************************************/
// Hotend temperature must be close to target for this long before M109 returns success
#define TEMP_RESIDENCY_TIME 10 // (seconds)
#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early.
// Bed temperature must be close to target for this long before M190 returns success
#define TEMP_BED_RESIDENCY_TIME 0 // (seconds)
#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early.
// Cooler temperature must be close to target for this long before M190 returns success
#define TEMP_COOLER_RESIDENCY_TIME 0 // (seconds)
#define TEMP_COOLER_HYSTERESIS 1 // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_COOLER_WINDOW 1 // (degC) Window around target to start the residency timer x degC early.
// When temperature exceeds max temp, your heater will be switched off.
// When temperature exceeds max temp, your cooler cannot be activaed.
// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
// You should use MINTEMP for thermistor short/failure protection.
#define HEATER_0_MAXTEMP 275 // (degC)
#define HEATER_1_MAXTEMP 275 // (degC)
#define HEATER_2_MAXTEMP 275 // (degC)
#define HEATER_3_MAXTEMP 275 // (degC)
#define BED_MAXTEMP 150 // (degC)
#define COOLER_MAXTEMP 35 //
// The minimal temperature defines the temperature below which the heater will not be enabled It is used
// or, in case of cooler, it will switched off.
// to check that the wiring to the thermistor is not broken.
// Otherwise this would lead to the heater being powered on all the time.
#define HEATER_0_MINTEMP 5 // (degC)
#define HEATER_1_MINTEMP 5 // (degC)
#define HEATER_2_MINTEMP 5 // (degC)
#define HEATER_3_MINTEMP 5 // (degC)
#define BED_MINTEMP 5 // (degC)
#define COOLER_MINTEMP 10 // (degC)
//Preheat Constants
#define PLA_PREHEAT_HOTEND_TEMP 190
#define PLA_PREHEAT_HPB_TEMP 60
#define PLA_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
#define ABS_PREHEAT_HOTEND_TEMP 240
#define ABS_PREHEAT_HPB_TEMP 100
#define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
#define GUM_PREHEAT_HOTEND_TEMP 230
#define GUM_PREHEAT_HPB_TEMP 60
#define GUM_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
/*****************************************************************************************************/
#endif #endif
...@@ -467,4 +467,4 @@ ...@@ -467,4 +467,4 @@
#define DEFAULT_ZWOBBLE 0, 0, 0 // A, W, P #define DEFAULT_ZWOBBLE 0, 0, 0 // A, W, P
/*****************************************************************************************/ /*****************************************************************************************/
#endif #endif
\ No newline at end of file
This diff is collapsed.
...@@ -4,17 +4,14 @@ ...@@ -4,17 +4,14 @@
//=========================================================================== //===========================================================================
//============================= Laser Settings ============================== //============================= Laser Settings ==============================
//=========================================================================== //===========================================================================
//
// Laser control is used by the Muve1 3D printer and the Buildlog.net laser cutter
//
//// The following define selects how to control the laser. Please choose the one that matches your setup. // The following define selects how to control the laser.
// Please choose the one that matches your setup.
// 1 = Single pin control - LOW when off, HIGH when on, PWM to adjust intensity // 1 = Single pin control - LOW when off, HIGH when on, PWM to adjust intensity
// 2 = Two pin control - A firing pin for which LOW = off, HIGH = on, and a seperate intensity pin which carries a constant PWM signal and adjusts duty cycle to control intensity // 2 = Two pin control - A firing pin for which LOW = off, HIGH = on, and a seperate intensity pin which carries a constant PWM signal and adjusts duty cycle to control intensity
// mUVe, buildlog.net and K40 chinese machines uses 2, AMRI ablative uses 1, AMRI SLS uses 2 #define LASER_CONTROL 1
#define LASER_CONTROL 2
/// The following define to use the new HakanBasted laser_pulse method to fire laser. It should be more efficient, but it's less tested. // The following define to use the new HakanBasted laser_pulse method to fire laser. It should be more efficient, but it's less tested.
// Thanks for it to HakanBastedt that has implemented it for Marlin at https://github.com/HakanBastedt/Marlin // Thanks for it to HakanBastedt that has implemented it for Marlin at https://github.com/HakanBastedt/Marlin
// Uncomment to enable it *USE AT YOUR OWN RISK*, it should work but it's *NOT WELL TESTED YET* // Uncomment to enable it *USE AT YOUR OWN RISK*, it should work but it's *NOT WELL TESTED YET*
//#define LASER_PULSE_METHOD //#define LASER_PULSE_METHOD
...@@ -27,50 +24,32 @@ ...@@ -27,50 +24,32 @@
// At least some CO2-drivers need it, not sure about laserdiode drivers. // At least some CO2-drivers need it, not sure about laserdiode drivers.
#define LASER_REMAP_INTENSITY 7 #define LASER_REMAP_INTENSITY 7
// Uncomment the following if your laser firing pin (not the PWM pin) for two pin control requires a HIGH signal to fire rather than a low (eg Red Sail M300 RS 3040) // Uncomment the following if your laser firing pin (not the PWM pin) for two pin control requires a HIGH signal to fire rather than a low (eg Red Sail M300 RS 3040)
/// #define HIGH_TO_FIRE // #define HIGH_TO_FIRE
//// The following defines select which G codes tell the laser to fire. It's OK to uncomment more than one. // The following defines select which G codes tell the laser to fire. It's OK to uncomment more than one.
#define LASER_FIRE_G1 10 // fire the laser on a G1 move, extinguish when the move ends #define LASER_FIRE_G1 10 // fire the laser on a G1 move, extinguish when the move ends
#define LASER_FIRE_SPINDLE 11 // fire the laser on M3, extinguish on M5 #define LASER_FIRE_SPINDLE 11 // fire the laser on M3, extinguish on M5
#define LASER_FIRE_E 12 // fire the laser when the E axis moves #define LASER_FIRE_E 12 // fire the laser when the E axis moves
//// Raster mode enables the laser to etch bitmap data at high speeds. Increases command buffer size substantially. // Raster mode enables the laser to etch bitmap data at high speeds. Increases command buffer size substantially.
#define LASER_RASTER #define LASER_RASTER
#define LASER_MAX_RASTER_LINE 68 // maximum number of base64 encoded pixels per raster gcode command #define LASER_MAX_RASTER_LINE 68 // Maximum number of base64 encoded pixels per raster gcode command
#define LASER_RASTER_ASPECT_RATIO 1 // pixels aren't square on most displays, 1.33 == 4:3 aspect ratio. #define LASER_RASTER_ASPECT_RATIO 1 // pixels aren't square on most displays, 1.33 == 4:3 aspect ratio.
#define LASER_RASTER_MM_PER_PULSE 0.2 //Can be overridden by providing an R value in M649 command : M649 S17 B2 D0 R0.1 F4000 #define LASER_RASTER_MM_PER_PULSE 0.2 // Can be overridden by providing an R value in M649 command : M649 S17 B2 D0 R0.1 F4000
//// Uncomment the following if the laser cutter is equipped with a peripheral relay board // Uncomment the following if the laser cutter is equipped with a peripheral relay board
//// to control power to an exhaust fan, cooler pump, laser power supply, etc. // to control power to an exhaust fan, cooler pump, laser power supply, etc.
//#define LASER_PERIPHERALS //#define LASER_PERIPHERALS
//#define LASER_PERIPHERALS_TIMEOUT 30000 // Number of milliseconds to wait for status signal from peripheral control board //#define LASER_PERIPHERALS_TIMEOUT 30000 // Number of milliseconds to wait for status signal from peripheral control board
//// Uncomment the following line to enable cubic bezier curve movement with the G5 code // Uncomment the following line to enable cubic bezier curve movement with the G5 code
// #define G5_BEZIER // #define G5_BEZIER
// Uncomment these options for the mUVe 1 3D printer
// #define CUSTOM_MENDEL_NAME "mUVe1 Printer"
// #define LASER_WATTS 0.05
// #define LASER_DIAMETER 0.1 // milimeters
// #define LASER_PWM 8000 // hertz
// #define MUVE_Z_PEEL // The mUVe 1 uses a special peel maneuver between each layer, it requires independent control of each Z motor
// Uncomment these options for the Buildlog.net laser cutter, and other similar models // Uncomment these options for the Buildlog.net laser cutter, and other similar models
#define CUSTOM_MENDEL_NAME "Laser Cutter"
#define LASER_WATTS 40.0 #define LASER_WATTS 40.0
#define LASER_DIAMETER 0.1 // milimeters #define LASER_DIAMETER 0.1 // milimeters
#define LASER_PWM 50000 // hertz #define LASER_PWM 50000 // hertz
#define LASER_FOCAL_HEIGHT 74.50 // z axis position at which the laser is focused #define LASER_FOCAL_HEIGHT 74.50 // z axis position at which the laser is focused
//Uncomment for AMRI Ablative or SLS
//#define CUSTOM_MENDEL_NAME "Laser Cutter"
//#define LASER_WATTS 40.0
//#define LASER_DIAMETER 0.1 // milimeters
//#define LASER_PWM 25000 // hertz
//#define LASER_FOCAL_HEIGHT 74.50 // z axis position at which the laser is focused
#endif #endif
...@@ -64,18 +64,22 @@ ...@@ -64,18 +64,22 @@
#define Z_MAX_PIN ORIG_Z_MAX_PIN #define Z_MAX_PIN ORIG_Z_MAX_PIN
// HEATER pin // HEATER pin
#define HEATER_0_PIN ORIG_HEATER_0_PIN #define HEATER_0_PIN ORIG_HEATER_0_PIN
#define HEATER_1_PIN ORIG_HEATER_1_PIN #define HEATER_1_PIN ORIG_HEATER_1_PIN
#define HEATER_2_PIN ORIG_HEATER_2_PIN #define HEATER_2_PIN ORIG_HEATER_2_PIN
#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 COOLER_PIN -1
// TEMP pin // TEMP pin
#define TEMP_0_PIN ORIG_TEMP_0_PIN #define TEMP_0_PIN ORIG_TEMP_0_PIN
#define TEMP_1_PIN ORIG_TEMP_1_PIN #define TEMP_1_PIN ORIG_TEMP_1_PIN
#define TEMP_2_PIN ORIG_TEMP_2_PIN #define TEMP_2_PIN ORIG_TEMP_2_PIN
#define TEMP_3_PIN ORIG_TEMP_3_PIN #define TEMP_3_PIN ORIG_TEMP_3_PIN
#define TEMP_BED_PIN ORIG_TEMP_BED_PIN #define TEMP_BED_PIN ORIG_TEMP_BED_PIN
#define TEMP_CHAMBER_PIN -1
#define TEMP_COOLER_PIN -1
// FAN pin // FAN pin
#define FAN_PIN ORIG_FAN_PIN #define FAN_PIN ORIG_FAN_PIN
...@@ -104,37 +108,14 @@ ...@@ -104,37 +108,14 @@
#endif #endif
#if ENABLED(LASERBEAM) #if ENABLED(LASERBEAM)
#define LASER_PWR_PIN -1 #define LASER_PWR_PIN -1
#define LASER_TTL_PIN -1 #define LASER_TTL_PIN -1
#endif #if ENABLED(LASER_PERIPHERALS)
#define LASER_PERIPHERALS_PIN -1
#if ENABLED(LASER) #define LASER_PERIPHERALS_STATUS_PIN -1
#if LASER_CONTROL == 1 #endif
#define LASER_FIRING_PIN 5
#define LASER_INTENSITY_PIN -1
#endif
#if LASER_CONTROL == 2
#define LASER_INTENSITY_PIN 6 // Digital pins 2, 3, 5, 6, 7, 8 are attached to timers we can use
#define LASER_FIRING_PIN 5
#endif
#if DISABLED(ORIG_TEMP_COOLER_PIN)
#define TEMP_COOLER_PIN ORIG_TEMP_0_PIN // Default to the first thermistor
#endif
#if ENABLED(LASER_POWER_DOWN)
#define LASER_POWER_PIN 9 // This is currently hard-coded to timer2 which services pins 9, 10
#endif // LASER_POWER_DOWN
#if ENABLED(LASER_PERIPHERALS)
#define LASER_PERIPHERALS_PIN 11
#define LASER_PERIPHERALS_STATUS_PIN 4
#endif // LASER_PERIPHERALS
#if ENABLED(COOLER)
#define COOLER_PIN 2 // Digital pins 2, 3, 5, 6, 7, 8 are attached to timers we can use
#endif // COOLER
#endif #endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FILRUNOUT_PIN -1 #define FILRUNOUT_PIN -1
#endif #endif
......
This diff is collapsed.
/** /**
* Marlin 3D Printer Firmware * MK & MK4due 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* *
* Based on Sprinter and grbl. * Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * 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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -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/>.
* *
*/ */
...@@ -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.82_dev" #define SHORT_BUILD_VERSION "4.2.83_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
......
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
#include "Configuration_Scara.h" #include "Configuration_Scara.h"
#endif #endif
#include "Configuration_Temperature.h"
#include "Configuration_Feature.h" #include "Configuration_Feature.h"
#include "Configuration_Overall.h" #include "Configuration_Overall.h"
#if ENABLED(LASERBEAM)
#if ENABLED(LASER)
#include "Configuration_Laser.h" #include "Configuration_Laser.h"
#if ENABLED(LASER_RASTER) #if ENABLED(LASER_RASTER)
#include "module/base64/Base64.h" #include "module/laser/base64/base64.h"
#endif #endif
#include "module/laser/laser.h" #include "module/laser/laser.h"
#endif #endif
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#include "module/motion/qr_solve.h" #include "module/motion/qr_solve.h"
#include "module/motion/cartesian_correction.h" #include "module/motion/cartesian_correction.h"
#include "module/temperature/temperature.h" #include "module/temperature/temperature.h"
#include "module/flowmeter/flowmeter.h" #include "module/sensor/flowmeter.h"
#include "module/temperature/thermistortables.h" #include "module/temperature/thermistortables.h"
#include "module/lcd/ultralcd.h" #include "module/lcd/ultralcd.h"
#include "module/lcd/buzzer.h" #include "module/lcd/buzzer.h"
......
...@@ -117,8 +117,7 @@ inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); } ...@@ -117,8 +117,7 @@ inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
extern void delay_ms(millis_t ms); extern void delay_ms(millis_t ms);
#if ENABLED(FAST_PWM_FAN) || ENABLED(FAST_PWM_COOLER) #if ENABLED(FAST_PWM_FAN) || ENABLED(FAST_PWM_COOLER)
void setPwmFrequency(uint8_t pin, uint8_t val);
void setPwmFrequency(uint8_t pin, int val);
#endif #endif
extern float homing_feedrate[]; extern float homing_feedrate[];
...@@ -237,10 +236,6 @@ extern int fanSpeed; ...@@ -237,10 +236,6 @@ extern int fanSpeed;
extern bool allow_lengthy_extrude_once; // for load/unload extern bool allow_lengthy_extrude_once; // for load/unload
#endif #endif
#if ENABLED(LASERBEAM)
extern int laser_ttl_modulation;
#endif
// Print job timer // Print job timer
extern PrintCounter print_job_counter; extern PrintCounter print_job_counter;
...@@ -262,12 +257,16 @@ extern uint8_t active_driver; ...@@ -262,12 +257,16 @@ extern uint8_t active_driver;
void print_heaterstates(); void print_heaterstates();
#endif #endif
#if HAS(TEMP_CHAMBER)
void print_chamberstate();
#endif
#if HAS(TEMP_COOLER) #if HAS(TEMP_COOLER)
void print_coolerstates(); void print_coolerstate();
#endif #endif
#if ENABLED(FLOWMETER_SENSOR) #if ENABLED(FLOWMETER_SENSOR)
void print_flowratestates(); void print_flowratestate();
#endif #endif
#if ENABLED(FIRMWARE_TEST) #if ENABLED(FIRMWARE_TEST)
......
/*
* Copyright (c) 2013 Adam Rudd.
* See LICENSE for more information
*/
#ifndef _BASE64_H
#define _BASE64_H
/* b64_alphabet:
* Description: Base64 alphabet table, a mapping between integers
* and base64 digits
* Notes: This is an extern here but is defined in Base64.c
*/
extern const char b64_alphabet[];
/* base64_encode:
* Description:
* Encode a string of characters as base64
* Parameters:
* output: the output buffer for the encoding, stores the encoded string
* input: the input buffer for the encoding, stores the binary to be encoded
* inputLen: the length of the input buffer, in bytes
* Return value:
* Returns the length of the encoded string
* Requirements:
* 1. output must not be null or empty
* 2. input must not be null
* 3. inputLen must be greater than or equal to 0
*/
int base64_encode(char *output, char *input, int inputLen);
/* base64_decode:
* Description:
* Decode a base64 encoded string into bytes
* Parameters:
* output: the output buffer for the decoding,
* stores the decoded binary
* input: the input buffer for the decoding,
* stores the base64 string to be decoded
* inputLen: the length of the input buffer, in bytes
* Return value:
* Returns the length of the decoded string
* Requirements:
* 1. output must not be null or empty
* 2. input must not be null
* 3. inputLen must be greater than or equal to 0
*/
int base64_decode(unsigned char *output, char *input, int inputLen);
/* base64_enc_len:
* Description:
* Returns the length of a base64 encoded string whose decoded
* form is inputLen bytes long
* Parameters:
* inputLen: the length of the decoded string
* Return value:
* The length of a base64 encoded string whose decoded form
* is inputLen bytes long
* Requirements:
* None
*/
int base64_enc_len(int inputLen);
/* base64_dec_len:
* Description:
* Returns the length of the decoded form of a
* base64 encoded string
* Parameters:
* input: the base64 encoded string to be measured
* inputLen: the length of the base64 encoded string
* Return value:
* Returns the length of the decoded form of a
* base64 encoded string
* Requirements:
* 1. input must not be null
* 2. input must be greater than or equal to zero
*/
int base64_dec_len(char *input, int inputLen);
#endif // _BASE64_H
...@@ -605,6 +605,16 @@ ...@@ -605,6 +605,16 @@
#define BED_USES_THERMISTOR #define BED_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_CHAMBER == -1
#define CHAMBER_USES_AD595
#elif TEMP_SENSOR_CHAMBER == 0
#undef CHAMBER_MINTEMP
#undef CHAMBER_MAXTEMP
#elif TEMP_SENSOR_CHAMBER > 0
#define THERMISTORCHAMBER TEMP_SENSOR_CHAMBER
#define CHAMBER_USES_THERMISTOR
#endif
#if TEMP_SENSOR_COOLER == -1 #if TEMP_SENSOR_COOLER == -1
#define COOLER_USES_AD595 #define COOLER_USES_AD595
#elif TEMP_SENSOR_COOLER == 0 #elif TEMP_SENSOR_COOLER == 0
...@@ -615,20 +625,21 @@ ...@@ -615,20 +625,21 @@
#define COOLER_USES_THERMISTOR #define COOLER_USES_THERMISTOR
#endif #endif
#if !ENABLED(COOLER) #if HASNT(COOLER)
#if ENABLED(PIDTEMPCOOLER) #if ENABLED(PIDTEMPCOOLER)
#undef PIDTEMPCOOLER #undef PIDTEMPCOOLER
#endif #endif
#endif #endif
#define HEATER_USES_AD595 (ENABLED(HEATER_0_USES_AD595) || ENABLED(HEATER_1_USES_AD595) || ENABLED(HEATER_2_USES_AD595) || ENABLED(HEATER_3_USES_AD595)) #define HEATER_USES_AD595 (ENABLED(HEATER_0_USES_AD595) || ENABLED(HEATER_1_USES_AD595) || ENABLED(HEATER_2_USES_AD595) || ENABLED(HEATER_3_USES_AD595))
/** /**
* Flags for PID handling * Flags for PID handling
*/ */
#define HAS_PID_HEATING (ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)) #define HAS_PID_HEATING (ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED))
#define HAS_PID_COOLING (ENABLED(PIDTEMPCOOLER))
#define HAS_PID_FOR_BOTH (ENABLED(PIDTEMP) && ENABLED(PIDTEMPBED)) #define HAS_PID_FOR_BOTH (ENABLED(PIDTEMP) && ENABLED(PIDTEMPBED))
#define HAS_PID_COOLING (ENABLED(PIDTEMPCOOLER))
/** /**
* ARRAY_BY_EXTRUDERS based on EXTRUDERS * ARRAY_BY_EXTRUDERS based on EXTRUDERS
*/ */
...@@ -677,13 +688,15 @@ ...@@ -677,13 +688,15 @@
#define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0) #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0)
#define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0) #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0)
#define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0) #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0)
#define HAS_TEMP_CHAMBER (PIN_EXISTS(TEMP_CHAMBER) && TEMP_SENSOR_CHAMBER != 0)
#define HAS_TEMP_COOLER (PIN_EXISTS(TEMP_COOLER) && TEMP_SENSOR_COOLER != 0) #define HAS_TEMP_COOLER (PIN_EXISTS(TEMP_COOLER) && TEMP_SENSOR_COOLER != 0)
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1)) #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2)) #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
#define HAS_HEATER_3 (PIN_EXISTS(HEATER_3)) #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED)) #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
#define HAS_COOLER_DEV (PIN_EXISTS(COOLER)) #define HAS_HEATER_CHAMBER (PIN_EXISTS(HEATER_CHAMBER))
#define HAS_COOLER (PIN_EXISTS(COOLER))
#define HAS_AUTO_FAN_0 (ENABLED(EXTRUDER_AUTO_FAN) && PIN_EXISTS(EXTRUDER_0_AUTO_FAN)) #define HAS_AUTO_FAN_0 (ENABLED(EXTRUDER_AUTO_FAN) && PIN_EXISTS(EXTRUDER_0_AUTO_FAN))
#define HAS_AUTO_FAN_1 (ENABLED(EXTRUDER_AUTO_FAN) && PIN_EXISTS(EXTRUDER_1_AUTO_FAN)) #define HAS_AUTO_FAN_1 (ENABLED(EXTRUDER_AUTO_FAN) && PIN_EXISTS(EXTRUDER_1_AUTO_FAN))
#define HAS_AUTO_FAN_2 (ENABLED(EXTRUDER_AUTO_FAN) && PIN_EXISTS(EXTRUDER_2_AUTO_FAN)) #define HAS_AUTO_FAN_2 (ENABLED(EXTRUDER_AUTO_FAN) && PIN_EXISTS(EXTRUDER_2_AUTO_FAN))
...@@ -808,14 +821,21 @@ ...@@ -808,14 +821,21 @@
#define WRITE_HEATER_0(v) WRITE_HEATER_0P(v) #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
#endif #endif
#if HAS(HEATER_BED) #if HAS(HEATER_BED)
#if ENABLED(INVERTED_BED_PINS) #if ENABLED(INVERTED_BED_PIN)
#define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN,!v) #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN,!v)
#else #else
#define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN,v) #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN,v)
#endif #endif
#endif #endif
#if HAS(COOLER_DEV) #if HAS(HEATER_CHAMBER)
#if ENABLED(INVERTED_COOLER_PINS) #if ENABLED(INVERTED_CHAMBER_PIN)
#define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN,!v)
#else
#define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN,v)
#endif
#endif
#if HAS(COOLER)
#if ENABLED(INVERTED_COOLER_PIN)
#define WRITE_COOLER(v) WRITE(COOLER_PIN,!v) #define WRITE_COOLER(v) WRITE(COOLER_PIN,!v)
#else #else
#define WRITE_COOLER(v) WRITE(COOLER_PIN,v) #define WRITE_COOLER(v) WRITE(COOLER_PIN,v)
......
...@@ -198,9 +198,10 @@ ...@@ -198,9 +198,10 @@
#define SERIAL_PID_DEBUG_CTERM " cTerm " #define SERIAL_PID_DEBUG_CTERM " cTerm "
#define SERIAL_INVALID_EXTRUDER_NUM " - Invalid extruder number !" #define SERIAL_INVALID_EXTRUDER_NUM " - Invalid extruder number !"
#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_BED ", system stopped! Bed"
#define SERIAL_STOPPED_CHAMBER ", system stopped! Chamber"
#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"
......
#include "Base64.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/>.
*
*/
#include "base64.h"
const char b64_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" const char b64_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz" "abcdefghijklmnopqrstuvwxyz"
...@@ -53,7 +75,6 @@ int base64_decode(unsigned char * output, char * input, int inputLen) { ...@@ -53,7 +75,6 @@ int base64_decode(unsigned char * output, char * input, int inputLen) {
unsigned char a3[3]; unsigned char a3[3];
unsigned char a4[4]; unsigned char a4[4];
while (inputLen--) { while (inputLen--) {
if(*input == '=') { if(*input == '=') {
break; break;
......
/**
* 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/>.
*
*/
/**
* Copyright (c) 2013 Adam Rudd.
* See LICENSE for more information
*/
#ifndef _BASE64_H
#define _BASE64_H
/* b64_alphabet:
* Description: Base64 alphabet table, a mapping between integers
* and base64 digits
* Notes: This is an extern here but is defined in Base64.c
*/
extern const char b64_alphabet[];
/* base64_encode:
* Description:
* Encode a string of characters as base64
* Parameters:
* output: the output buffer for the encoding, stores the encoded string
* input: the input buffer for the encoding, stores the binary to be encoded
* inputLen: the length of the input buffer, in bytes
* Return value:
* Returns the length of the encoded string
* Requirements:
* 1. output must not be null or empty
* 2. input must not be null
* 3. inputLen must be greater than or equal to 0
*/
int base64_encode(char *output, char *input, int inputLen);
/* base64_decode:
* Description:
* Decode a base64 encoded string into bytes
* Parameters:
* output: the output buffer for the decoding,
* stores the decoded binary
* input: the input buffer for the decoding,
* stores the base64 string to be decoded
* inputLen: the length of the input buffer, in bytes
* Return value:
* Returns the length of the decoded string
* Requirements:
* 1. output must not be null or empty
* 2. input must not be null
* 3. inputLen must be greater than or equal to 0
*/
int base64_decode(unsigned char *output, char *input, int inputLen);
/* base64_enc_len:
* Description:
* Returns the length of a base64 encoded string whose decoded
* form is inputLen bytes long
* Parameters:
* inputLen: the length of the decoded string
* Return value:
* The length of a base64 encoded string whose decoded form
* is inputLen bytes long
* Requirements:
* None
*/
int base64_enc_len(int inputLen);
/* base64_dec_len:
* Description:
* Returns the length of the decoded form of a
* base64 encoded string
* Parameters:
* input: the base64 encoded string to be measured
* inputLen: the length of the base64 encoded string
* Return value:
* Returns the length of the decoded form of a
* base64 encoded string
* Requirements:
* 1. input must not be null
* 2. input must be greater than or equal to zero
*/
int base64_dec_len(char *input, int inputLen);
#endif // _BASE64_H
This diff is collapsed.
/* /**
laser.h - Laser cutter control library for Arduino using 16 bit timers- Version 1 * MK & MK4due 3D Printer Firmware
Copyright (c) 2013 Timothy Schmidt. All right reserved. *
* 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/>.
*
*/
This library is free software; you can redistribute it and/or /**
modify it under the terms of the GNU Lesser General Public * laser.cpp - Laser control library for Arduino using 16 bit timers- Version 1
License as published by the Free Software Foundation; either * Copyright (c) 2013 Timothy Schmidt. All right reserved.
version 3 of the License, or (at your option) any later version. *
* This library is free software; you can redistribute it and/or
This library is distributed in the hope that it will be useful, * modify it under the terms of the GNU Lesser General Public
but WITHOUT ANY WARRANTY; without even the implied warranty of * License as published by the Free Software Foundation; either
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * version 3 of the License, or (at your option) any later version.
Lesser General Public License for more details. *
* This library is distributed in the hope that it will be useful,
You should have received a copy of the GNU Lesser General Public * but WITHOUT ANY WARRANTY; without even the implied warranty of
License along with this library; if not, write to the Free Software * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Lesser General Public License for more details.
*/ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LASER_H #ifndef LASER_H
#define LASER_H #define LASER_H
#include <inttypes.h> #include <inttypes.h>
#include "../../base.h"
// split into planned and status // split into planned and status
typedef struct { typedef struct {
int fired; // method used to ask the laser to fire - LASER_FIRE_G1, LASER_FIRE_SPINDLE, LASER_FIRE_E, etc int fired; // method used to ask the laser to fire - LASER_FIRE_G1, LASER_FIRE_SPINDLE, LASER_FIRE_E, etc
float intensity; // Laser firing instensity 0.0 - 100.0 float intensity; // Laser firing instensity 0.0 - 100.0
float ppm; // pulses per millimeter, for pulsed firing mode float ppm; // pulses per millimeter, for pulsed firing mode
unsigned long duration; // laser firing duration in microseconds, for pulsed firing mode unsigned long duration; // laser firing duration in microseconds, for pulsed firing mode
unsigned long dur; // instantaneous duration unsigned long dur; // instantaneous duration
bool status; // LASER_ON / LASER_OFF - buffered bool status; // LASER_ON / LASER_OFF - buffered
bool firing; // LASER_ON / LASER_OFF - instantaneous bool firing; // LASER_ON / LASER_OFF - instantaneous
uint8_t mode; // CONTINUOUS, PULSED, RASTER uint8_t mode; // CONTINUOUS, PULSED, RASTER
unsigned long last_firing; // microseconds since last laser firing unsigned long last_firing; // microseconds since last laser firing
bool diagnostics; // Verbose debugging output over serial bool diagnostics; // Verbose debugging output over serial
unsigned int time; // temporary counter to limit eeprom writes unsigned int time; // temporary counter to limit eeprom writes
unsigned int lifetime; // laser lifetime firing counter in minutes unsigned int lifetime; // laser lifetime firing counter in minutes
#ifdef LASER_RASTER #if ENABLED(LASER_RASTER)
unsigned char raster_data[LASER_MAX_RASTER_LINE]; unsigned char raster_data[LASER_MAX_RASTER_LINE];
unsigned char rasterlaserpower; unsigned char rasterlaserpower;
float raster_aspect_ratio; float raster_aspect_ratio;
float raster_mm_per_pulse; float raster_mm_per_pulse;
int raster_raw_length; int raster_raw_length;
int raster_num_pixels; int raster_num_pixels;
bool raster_direction; bool raster_direction;
#endif // LASER_RASTER #endif // LASER_RASTER
#ifdef MUVE_Z_PEEL } laser_t;
float peel_distance;
float peel_speed;
float peel_pause;
#endif // MUVE_Z_PEEL
} laser_t;
extern laser_t laser; extern laser_t laser;
void laser_init(); void laser_init();
void laser_fire(float intensity); void laser_fire(float intensity);
#if ENABLED(LASER_PULSE_METHOD) #if ENABLED(LASER_PULSE_METHOD)
void laser_pulse(uint32_t ulValue, unsigned long usec); void laser_pulse(uint32_t ulValue, unsigned long usec);
#endif #endif
void laser_extinguish(); void laser_extinguish();
void laser_update_lifetime(); void laser_update_lifetime();
void laser_set_mode(int mode); void laser_set_mode(int mode);
#ifdef LASER_PERIPHERALS #if ENABLED(LASER_PERIPHERALS)
bool laser_peripherals_ok(); bool laser_peripherals_ok();
void laser_peripherals_on(); void laser_peripherals_on();
void laser_peripherals_off(); void laser_peripherals_off();
void laser_wait_for_peripherals(); void laser_wait_for_peripherals();
#endif // LASER_PERIPHERALS #endif // LASER_PERIPHERALS
#ifdef HIGH_TO_FIRE // Some cutters fire on high, some on low. #ifdef HIGH_TO_FIRE // Some cutters fire on high, some on low.
#define LASER_ARM HIGH #define LASER_ARM HIGH
#define LASER_UNARM LOW #define LASER_UNARM LOW
#else #else
#define LASER_ARM LOW #define LASER_ARM LOW
#define LASER_UNARM HIGH #define LASER_UNARM HIGH
#endif #endif
// Laser constants // Laser constants
#define LASER_OFF 0 #define LASER_OFF 0
#define LASER_ON 1 #define LASER_ON 1
#define CONTINUOUS 0 #define CONTINUOUS 0
#define PULSED 1 #define PULSED 1
#define RASTER 2 #define RASTER 2
#endif // LASER_H #endif // LASER_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/>.
*
*/
#define LASERENABLE_HEIGHT 20 #define LASERENABLE_HEIGHT 20
#define LASERENABLE_WIDTH 25 #define LASERENABLE_WIDTH 25
......
...@@ -21,61 +21,61 @@ ...@@ -21,61 +21,61 @@
*/ */
#ifndef MACROS_H #ifndef MACROS_H
#define MACROS_H #define MACROS_H
// Compiler warning on unused varable. // Compiler warning on unused varable.
#define UNUSED(x) (void) (x) #define UNUSED(x) (void) (x)
// Macros for bit masks // Macros for bit masks
#ifndef _BV #ifndef _BV
#define _BV(b) (1<<(b)) #define _BV(b) (1<<(b))
#endif #endif
#define TEST(n,b) (((n)&_BV(b))!=0) #define TEST(n,b) (((n)&_BV(b))!=0)
#define SBI(n,b) (n |= _BV(b)) #define SBI(n,b) (n |= _BV(b))
#define CBI(n,b) (n &= ~_BV(b)) #define CBI(n,b) (n &= ~_BV(b))
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b)) #define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
// Macros for maths shortcuts // Macros for maths shortcuts
#ifndef M_PI #ifndef M_PI
#define M_PI 3.1415926536 #define M_PI 3.1415926536
#endif #endif
#define RADIANS(d) ((d)*M_PI/180.0) #define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((r)*180.0/M_PI) #define DEGREES(r) ((r)*180.0/M_PI)
#define SIN_60 0.8660254037844386 #define SIN_60 0.8660254037844386
#define COS_60 0.5 #define COS_60 0.5
// Macros to support option testing // Macros to support option testing
#define ENABLED defined #define ENABLED defined
#define DISABLED !defined #define DISABLED !defined
#define HAS(FE) (HAS_##FE) #define HAS(FE) (HAS_##FE)
#define HASNT(FE) (!(HAS_##FE)) #define HASNT(FE) (!(HAS_##FE))
// Macros to contrain values // Macros to contrain values
#define NUMERIC(a) ((a) >= '0' && '9' >= (a)) #define NUMERIC(a) ((a) >= '0' && '9' >= (a))
#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-') #define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-')
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0) #define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
#define NOMORE(v,n) do{ if (v > n) v = n; }while(0) #define NOMORE(v,n) do{ if (v > n) v = n; }while(0)
#define COUNT(a) (sizeof(a)/sizeof(*a)) #define COUNT(a) (sizeof(a)/sizeof(*a))
// Function macro // Function macro
#define FORCE_INLINE __attribute__((always_inline)) inline #define FORCE_INLINE __attribute__((always_inline)) inline
// Macro for debugging // Macro for debugging
#define DEBUGGING(F) (mk_debug_flags & (DEBUG_## F)) #define DEBUGGING(F) (mk_debug_flags & (DEBUG_## F))
// Macro for String // Macro for String
#define STRINGIFY_(n) #n #define STRINGIFY_(n) #n
#define STRINGIFY(n) STRINGIFY_(n) #define STRINGIFY(n) STRINGIFY_(n)
// Macro for varie // Macro for varie
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0) #define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0) #define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0)
#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) #define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON))
#define NOOP do{}while(0) #define NOOP do{}while(0)
#define _AXIS(AXIS) AXIS ##_AXIS #define _AXIS(AXIS) AXIS ##_AXIS
#endif //__MACROS_H #endif //__MACROS_H
...@@ -21,18 +21,18 @@ ...@@ -21,18 +21,18 @@
*/ */
#ifndef MECHANICS_H #ifndef MECHANICS_H
#define MECHANICS_H #define MECHANICS_H
// Macros for mechanics type // Macros for mechanics type
#define MECH_UNKNOWN -1 #define MECH_UNKNOWN -1
#define MECH_CARTESIAN 0 #define MECH_CARTESIAN 0
#define MECH_COREXY 1 #define MECH_COREXY 1
#define MECH_COREYX 2 #define MECH_COREYX 2
#define MECH_COREXZ 8 #define MECH_COREXZ 8
#define MECH_COREZX 9 #define MECH_COREZX 9
#define MECH_DELTA 3 #define MECH_DELTA 3
#define MECH_SCARA 4 #define MECH_SCARA 4
#define MECH(mech) (MECHANISM == MECH_##mech) #define MECH(mech) (MECHANISM == MECH_##mech)
#endif #endif
\ No newline at end of file
...@@ -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/>.
* *
* *
* The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis. * The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis.
...@@ -417,9 +417,7 @@ void check_axes_activity() { ...@@ -417,9 +417,7 @@ void check_axes_activity() {
unsigned char tail_valve_pressure = ValvePressure, unsigned char tail_valve_pressure = ValvePressure,
tail_e_to_p_pressure = EtoPPressure; tail_e_to_p_pressure = EtoPPressure;
#endif #endif
#if ENABLED(LASERBEAM)
unsigned char tail_laser_ttl_modulation = laser_ttl_modulation;
#endif
block_t* block; block_t* block;
if (blocks_queued()) { if (blocks_queued()) {
...@@ -430,9 +428,6 @@ void check_axes_activity() { ...@@ -430,9 +428,6 @@ void check_axes_activity() {
tail_valve_pressure = block->valve_pressure; tail_valve_pressure = block->valve_pressure;
tail_e_to_p_pressure = block->e_to_p_pressure; tail_e_to_p_pressure = block->e_to_p_pressure;
#endif #endif
#if ENABLED(LASERBEAM)
tail_laser_ttl_modulation = block_buffer[block_index].laser_ttlmodulation;
#endif
while (block_index != block_buffer_head) { while (block_index != block_buffer_head) {
block = &block_buffer[block_index]; block = &block_buffer[block_index];
...@@ -493,10 +488,6 @@ void check_axes_activity() { ...@@ -493,10 +488,6 @@ void check_axes_activity() {
#endif #endif
#endif #endif
// add Laser TTL Modulation(PWM) Control
#if ENABLED(LASERBEAM)
analogWrite(LASER_TTL_PIN, tail_laser_ttl_modulation);
#endif
} }
float junction_deviation = 0.1; float junction_deviation = 0.1;
...@@ -629,9 +620,9 @@ float junction_deviation = 0.1; ...@@ -629,9 +620,9 @@ float junction_deviation = 0.1;
block->steps[E_AXIS] /= 100; block->steps[E_AXIS] /= 100;
block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS]))); block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS])));
#if DISABLED(LASER) #if DISABLED(LASERBEAM)
// Bail if this is a zero-length block // Bail if this is a zero-length block
if (block->step_event_count <= DROP_SEGMENTS) return; if (block->step_event_count <= DROP_SEGMENTS) return;
#endif #endif
block->fan_speed = fanSpeed; block->fan_speed = fanSpeed;
...@@ -647,11 +638,6 @@ float junction_deviation = 0.1; ...@@ -647,11 +638,6 @@ float junction_deviation = 0.1;
block->mix_event_count[i] = block->steps[E_AXIS] * mixing_factor[i]; block->mix_event_count[i] = block->steps[E_AXIS] * mixing_factor[i];
#endif #endif
// Add update block variables for LASER BEAM control
#if ENABLED(LASERBEAM)
block->laser_ttlmodulation = laser_ttl_modulation;
#endif
// Compute direction bits for this block // Compute direction bits for this block
uint8_t dirb = 0; uint8_t dirb = 0;
#if MECH(COREXY) || MECH(COREYX) #if MECH(COREXY) || MECH(COREYX)
...@@ -882,52 +868,49 @@ float junction_deviation = 0.1; ...@@ -882,52 +868,49 @@ float junction_deviation = 0.1;
); );
} }
#if ENABLED(LASER) #if ENABLED(LASERBEAM)
block->laser_intensity = laser.intensity; block->laser_intensity = laser.intensity;
block->laser_duration = laser.duration; block->laser_duration = laser.duration;
block->laser_status = laser.status; block->laser_status = laser.status;
block->laser_mode = laser.mode; block->laser_mode = laser.mode;
// When operating in PULSED or RASTER modes, laser pulsing must operate in sync with movement. // When operating in PULSED or RASTER modes, laser pulsing must operate in sync with movement.
// Calculate steps between laser firings (steps_l) and consider that when determining largest // Calculate steps between laser firings (steps_l) and consider that when determining largest
// interval between steps for X, Y, Z, E, L to feed to the motion control code. // interval between steps for X, Y, Z, E, L to feed to the motion control code.
if (laser.mode == RASTER || laser.mode == PULSED) { if (laser.mode == RASTER || laser.mode == PULSED) {
#if ENABLED(LASER_PULSE_METHOD) #if ENABLED(LASER_PULSE_METHOD)
// Optimizing. Move calculations here rather than in stepper isr // Optimizing. Move calculations here rather than in stepper isr
static const float Factor = F_CPU/(LASER_PWM*2*100.0*255.0); static const float Factor = F_CPU/(LASER_PWM*2*100.0*255.0);
block->laser_raster_intensity_factor = laser.intensity * Factor; block->laser_raster_intensity_factor = laser.intensity * Factor;
#endif #endif
block->steps_l = (unsigned long)labs(block->millimeters*laser.ppm); block->steps_l = (unsigned long)labs(block->millimeters*laser.ppm);
if (laser.mode == RASTER) { if (laser.mode == RASTER) {
for (int i = 0; i < LASER_MAX_RASTER_LINE; i++) { for (int i = 0; i < LASER_MAX_RASTER_LINE; i++) {
#if (!ENABLED(LASER_PULSE_METHOD)) #if (!ENABLED(LASER_PULSE_METHOD))
float OldRange, NewRange, NewValue; float OldRange, NewRange, NewValue;
OldRange = (255.0 - 0.0); OldRange = (255.0 - 0.0);
NewRange = (laser.rasterlaserpower - LASER_REMAP_INTENSITY); NewRange = (laser.rasterlaserpower - LASER_REMAP_INTENSITY);
NewValue = (float)(((((float)laser.raster_data[i] - 0) * NewRange) / OldRange) + LASER_REMAP_INTENSITY); NewValue = (float)(((((float)laser.raster_data[i] - 0) * NewRange) / OldRange) + LASER_REMAP_INTENSITY);
//If less than 7%, turn off the laser tube. //If less than 7%, turn off the laser tube.
if(NewValue == LASER_REMAP_INTENSITY) if(NewValue == LASER_REMAP_INTENSITY)
NewValue = 0; NewValue = 0;
block->laser_raster_data[i] = NewValue; block->laser_raster_data[i] = NewValue;
#else #else
block->laser_raster_data[i] = laser.raster_data[i]; block->laser_raster_data[i] = laser.raster_data[i];
#endif #endif
} }
} }
} else {
block->steps_l = 0;
} }
else
block->steps_l = 0;
block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], max(block->steps[E_AXIS], block->steps_l)))); block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], max(block->steps[E_AXIS], block->steps_l))));
if (laser.diagnostics) { if (laser.diagnostics && block->laser_status == LASER_ON)
if (block->laser_status == LASER_ON) { ECHO_LM(INFO, "Laser firing enabled");
ECHO_LM(INFO, "Laser firing enabled");
}
}
#endif // LASER
#endif // LASERBEAM
float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
......
...@@ -98,8 +98,8 @@ typedef struct { ...@@ -98,8 +98,8 @@ typedef struct {
unsigned long valve_pressure; unsigned long valve_pressure;
unsigned long e_to_p_pressure; unsigned long e_to_p_pressure;
#endif #endif
#if ENABLED(LASER) #if ENABLED(LASERBEAM)
uint8_t laser_mode; // CONTINUOUS, PULSED, RASTER uint8_t laser_mode; // CONTINUOUS, PULSED, RASTER
bool laser_status; // LASER_OFF, LASER_ON bool laser_status; // LASER_OFF, LASER_ON
float laser_ppm; // pulses per millimeter, for pulsed and raster firing modes float laser_ppm; // pulses per millimeter, for pulsed and raster firing modes
...@@ -112,10 +112,6 @@ typedef struct { ...@@ -112,10 +112,6 @@ typedef struct {
#endif #endif
#endif #endif
#if ENABLED(LASERBEAM)
unsigned long laser_ttlmodulation;
#endif
volatile char busy; volatile char busy;
} block_t; } block_t;
......
...@@ -68,15 +68,12 @@ block_t* current_block; // A pointer to the block currently being traced ...@@ -68,15 +68,12 @@ block_t* current_block; // A pointer to the block currently being traced
static unsigned char last_direction_bits = 0; // The next stepping-bits to be output static unsigned char last_direction_bits = 0; // The next stepping-bits to be output
static unsigned int cleaning_buffer_counter = 0; static unsigned int cleaning_buffer_counter = 0;
#ifdef LASER #if ENABLED(LASERBEAM)
static long counter_L; static long counter_L;
#endif // LASER #if ENABLED(LASER_RASTER)
static int counter_raster;
#ifdef LASER_RASTER #endif // LASER_RASTER
static int counter_raster; #endif // LASERBEAM
#endif // LASER_RASTER
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
static bool performing_homing = false, static bool performing_homing = false,
...@@ -124,7 +121,7 @@ static unsigned short OCR1A_nominal; ...@@ -124,7 +121,7 @@ static unsigned short OCR1A_nominal;
static bool check_endstops = true; static bool check_endstops = true;
volatile long count_position[NUM_AXIS] = { 0 }; // Positions of stepper motors, in step units volatile long count_position[NUM_AXIS] = { 0 }; // Positions of stepper motors, in step units
volatile signed char count_direction[NUM_AXIS] = { 1 }; volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
//=========================================================================== //===========================================================================
...@@ -307,11 +304,11 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) { ...@@ -307,11 +304,11 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
NOMORE(step_rate, MAX_STEP_FREQUENCY); NOMORE(step_rate, MAX_STEP_FREQUENCY);
if(step_rate > (2 * DOUBLE_STEP_FREQUENCY)) { // If steprate > 2*DOUBLE_STEP_FREQUENCY >> step 4 times if(step_rate > (2 * DOUBLE_STEP_FREQUENCY)) { // If steprate > 2*DOUBLE_STEP_FREQUENCY >> step 4 times
step_rate = (step_rate >> 2); step_rate >>= 2;
step_loops = 4; step_loops = 4;
} }
else if(step_rate > DOUBLE_STEP_FREQUENCY) { // If steprate > DOUBLE_STEP_FREQUENCY >> step 2 times else if(step_rate > DOUBLE_STEP_FREQUENCY) { // If steprate > DOUBLE_STEP_FREQUENCY >> step 2 times
step_rate = (step_rate >> 1); step_rate >>= 1;
step_loops = 2; step_loops = 2;
} }
else { else {
...@@ -429,10 +426,12 @@ ISR(TIMER1_COMPA_vect) { ...@@ -429,10 +426,12 @@ ISR(TIMER1_COMPA_vect) {
return; return;
} }
#if ENABLED(LASER) && (!ENABLED(LASER_PULSE_METHOD)) #if ENABLED(LASERBEAM) && (!ENABLED(LASER_PULSE_METHOD))
if (laser.dur != 0 && (laser.last_firing + laser.dur < micros())) { if (laser.dur != 0 && (laser.last_firing + laser.dur < micros())) {
if (laser.diagnostics) ECHO_LM(INFO,"Laser firing duration elapsed, in interrupt handler"); if (laser.diagnostics)
laser_extinguish(); ECHO_LM(INFO, "Laser firing duration elapsed, in interrupt handler");
laser_extinguish();
} }
#endif #endif
...@@ -446,7 +445,8 @@ ISR(TIMER1_COMPA_vect) { ...@@ -446,7 +445,8 @@ ISR(TIMER1_COMPA_vect) {
// Initialize Bresenham counters to 1/2 the ceiling // Initialize Bresenham counters to 1/2 the ceiling
counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1); counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1);
#if ENABLED(LASER)
#if ENABLED(LASERBEAM)
counter_L = counter_X; counter_L = counter_X;
#if !ENABLED(LASER_PULSE_METHOD) #if !ENABLED(LASER_PULSE_METHOD)
laser.dur = current_block->laser_duration; laser.dur = current_block->laser_duration;
...@@ -463,15 +463,12 @@ ISR(TIMER1_COMPA_vect) { ...@@ -463,15 +463,12 @@ ISR(TIMER1_COMPA_vect) {
#if ENABLED(Z_LATE_ENABLE) #if ENABLED(Z_LATE_ENABLE)
if (current_block->steps[Z_AXIS] > 0) { if (current_block->steps[Z_AXIS] > 0) {
enable_z(); enable_z();
#if ENABLED(MUVE)
enable_e();
#endif
OCR1A = 2000; // 1ms wait OCR1A = 2000; // 1ms wait
return; return;
} }
#endif #endif
#if ENABLED(LASER_RASTER) #if ENABLED(LASERBEAM) && ENABLED(LASER_RASTER)
if (current_block->laser_mode == RASTER) counter_raster = 0; if (current_block->laser_mode == RASTER) counter_raster = 0;
#endif #endif
...@@ -494,15 +491,15 @@ ISR(TIMER1_COMPA_vect) { ...@@ -494,15 +491,15 @@ ISR(TIMER1_COMPA_vect) {
#endif #endif
// Continuous firing of the laser during a move happens here, PPM and raster happen further down // Continuous firing of the laser during a move happens here, PPM and raster happen further down
#if ENABLED(LASER) #if ENABLED(LASERBEAM)
if (current_block->laser_mode == CONTINUOUS && current_block->laser_status == LASER_ON) { if (current_block->laser_mode == CONTINUOUS && current_block->laser_status == LASER_ON)
laser_fire(current_block->laser_intensity); laser_fire(current_block->laser_intensity);
}
#if !ENABLED(LASER_PULSE_METHOD) #if !ENABLED(LASER_PULSE_METHOD)
if (current_block->laser_status == LASER_OFF) { if (current_block->laser_status == LASER_OFF) {
if (laser.diagnostics) ECHO_LM(INFO,"Laser status set to off, in interrupt handler"); if (laser.diagnostics) ECHO_LM(INFO,"Laser status set to off, in interrupt handler");
laser_extinguish(); laser_extinguish();
} }
#endif #endif
#endif #endif
...@@ -600,14 +597,14 @@ ISR(TIMER1_COMPA_vect) { ...@@ -600,14 +597,14 @@ ISR(TIMER1_COMPA_vect) {
#endif #endif
#endif #endif
#if ENABLED(LASER) #if ENABLED(LASERBEAM)
counter_L += current_block->steps_l; counter_L += current_block->steps_l;
if (counter_L > 0) { if (counter_L > 0) {
if (current_block->laser_mode == PULSED && current_block->laser_status == LASER_ON) { // Pulsed Firing Mode if (current_block->laser_mode == PULSED && current_block->laser_status == LASER_ON) { // Pulsed Firing Mode
#if ENABLED(LASER_PULSE_METHOD) #if ENABLED(LASER_PULSE_METHOD)
uint32_t ulValue = current_block->laser_raster_intensity_factor * 255; uint32_t ulValue = current_block->laser_raster_intensity_factor * 255;
laser_pulse(ulValue, current_block->laser_duration); laser_pulse(ulValue, current_block->laser_duration);
laser.time += current_block->laser_duration/1000; laser.time += current_block->laser_duration / 1000;
#else #else
laser_fire(current_block->laser_intensity); laser_fire(current_block->laser_intensity);
#endif #endif
...@@ -652,7 +649,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -652,7 +649,7 @@ ISR(TIMER1_COMPA_vect) {
laser_extinguish(); laser_extinguish();
} }
#endif #endif
#endif // LASER #endif // LASERBEAM
// safe check for erroneous calculated events count // safe check for erroneous calculated events count
if(current_block->step_event_count >= MAX_EVENTS_COUNT) { if(current_block->step_event_count >= MAX_EVENTS_COUNT) {
...@@ -767,10 +764,9 @@ ISR(TIMER1_COMPA_vect) { ...@@ -767,10 +764,9 @@ ISR(TIMER1_COMPA_vect) {
if (step_events_completed >= current_block->step_event_count) { if (step_events_completed >= current_block->step_event_count) {
current_block = NULL; current_block = NULL;
plan_discard_current_block(); plan_discard_current_block();
#if ENABLED(LASER) && ENABLED(LASER_PULSE_METHOD) #if ENABLED(LASERBEAM) && ENABLED(LASER_PULSE_METHOD)
if (current_block->laser_mode == CONTINUOUS && current_block->laser_status == LASER_ON) { if (current_block->laser_mode == CONTINUOUS && current_block->laser_status == LASER_ON)
laser_extinguish(); laser_extinguish();
}
#endif #endif
} }
} }
......
...@@ -352,12 +352,12 @@ ...@@ -352,12 +352,12 @@
#define COOLER_PIN -1 #define COOLER_PIN -1
#endif #endif
#ifndef LASER_FIRING_PIN #ifndef LASER_PWR_PIN
#define LASER_FIRING_PIN -1 #define LASER_PWR_PIN -1
#endif #endif
#ifndef LASER_INTENSITY_PIN #ifndef LASER_TTL_PIN
#define LASER_INTENSITY_PIN -1 #define LASER_TTL_PIN -1
#endif #endif
#ifndef FLOWMETER_PIN #ifndef FLOWMETER_PIN
...@@ -373,7 +373,7 @@ ...@@ -373,7 +373,7 @@
_E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS \ _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS \
analogInputToDigitalPin(TEMP_BED_PIN), \ analogInputToDigitalPin(TEMP_BED_PIN), \
analogInputToDigitalPin(TEMP_COOLER_PIN), \ analogInputToDigitalPin(TEMP_COOLER_PIN), \
COOLER_PIN, LASER_FIRING_PIN, LASER_INTENSITY_PIN, \ COOLER_PIN, LASER_PWR_PIN, LASER_TTL_PIN, \
FLOWMETER_PIN \ FLOWMETER_PIN \
} }
......
...@@ -82,15 +82,18 @@ ...@@ -82,15 +82,18 @@
#if DISABLED(TEMP_SENSOR_BED) #if DISABLED(TEMP_SENSOR_BED)
#error DEPENDENCY ERROR: Missing setting TEMP_SENSOR_BED #error DEPENDENCY ERROR: Missing setting TEMP_SENSOR_BED
#endif #endif
#if DISABLED(TEMP_SENSOR_CHAMBER)
#error DEPENDENCY_ERROR: Missing setting TEMP_SENSOR_CHAMBER
#endif
#if DISABLED(TEMP_SENSOR_COOLER) #if DISABLED(TEMP_SENSOR_COOLER)
#error DEPENDENCY_ERROR: Missing setting TEMP_SENSOR_COOLER #error DEPENDENCY_ERROR: Missing setting TEMP_SENSOR_COOLER
#endif #endif
#if (THERMISTORHEATER_0 == 998) || (THERMISTORHEATER_1 == 998) || (THERMISTORHEATER_2 == 998) || (THERMISTORHEATER_3 == 998) || (THERMISTORBED == 998) || (THERMISTORCOOLER == 998) //User EXIST table #if (THERMISTORHEATER_0 == 998) || (THERMISTORHEATER_1 == 998) || (THERMISTORHEATER_2 == 998) || (THERMISTORHEATER_3 == 998) || (THERMISTORBED == 998) || (THERMISTORCHAMBER == 998) || (THERMISTORCOOLER == 998) // User EXIST table
#if DISABLED(DUMMY_THERMISTOR_998_VALUE) #if DISABLED(DUMMY_THERMISTOR_998_VALUE)
#define DUMMY_THERMISTOR_998_VALUE 25 #define DUMMY_THERMISTOR_998_VALUE 25
#endif #endif
#endif #endif
#if (THERMISTORHEATER_0 == 999) || (THERMISTORHEATER_1 == 999) || (THERMISTORHEATER_2 == 999) || (THERMISTORHEATER_3 == 999) || (THERMISTORBED == 999) || (THERMISTORCOOLER == 999)//User EXIST table #if (THERMISTORHEATER_0 == 999) || (THERMISTORHEATER_1 == 999) || (THERMISTORHEATER_2 == 999) || (THERMISTORHEATER_3 == 999) || (THERMISTORBED == 999) || (THERMISTORCHAMBER == 999) || (THERMISTORCOOLER == 999)// User EXIST table
#if DISABLED(DUMMY_THERMISTOR_999_VALUE) #if DISABLED(DUMMY_THERMISTOR_999_VALUE)
#define DUMMY_THERMISTOR_999_VALUE 25 #define DUMMY_THERMISTOR_999_VALUE 25
#endif #endif
...@@ -148,6 +151,17 @@ ...@@ -148,6 +151,17 @@
#error DEPENDENCY ERROR: Missing setting BED_MINTEMP #error DEPENDENCY ERROR: Missing setting BED_MINTEMP
#endif #endif
#endif #endif
#if TEMP_SENSOR_CHAMBER != 0
#if DISABLED(CHAMBER_MAXTEMP)
#error DEPENDENCY ERROR: Missing setting CHAMBER_MAXTEMP
#endif
#if DISABLED(CHAMBER_MINTEMP)
#error DEPENDENCY ERROR: Missing setting CHAMBER_MINTEMP
#endif
#if HASNT(HEATER_CHAMBER)
#error DEPENDENCY ERROR: Cannot enable TEMP_SENSOR_CHAMBER and not HEATER_CHAMBER_PIN
#endif
#endif
#if TEMP_SENSOR_COOLER != 0 #if TEMP_SENSOR_COOLER != 0
#if DISABLED(COOLER_MAXTEMP) #if DISABLED(COOLER_MAXTEMP)
#error DEPENDENCY ERROR: Missing setting COOLER_MAXTEMP #error DEPENDENCY ERROR: Missing setting COOLER_MAXTEMP
...@@ -155,8 +169,8 @@ ...@@ -155,8 +169,8 @@
#if DISABLED(COOLER_MINTEMP) #if DISABLED(COOLER_MINTEMP)
#error DEPENDENCY ERROR: Missing setting COOLER_MINTEMP #error DEPENDENCY ERROR: Missing setting COOLER_MINTEMP
#endif #endif
#if DISABLED(COOLER) #if HASNT(COOLER)
#error DEPENDENCY ERROR: Cannot enable TEMP_SENSOR_COOLER and not COOLER #error DEPENDENCY ERROR: Cannot enable TEMP_SENSOR_COOLER and not COOLER_PIN
#endif #endif
#endif #endif
#if DISABLED(PLA_PREHEAT_HOTEND_TEMP) #if DISABLED(PLA_PREHEAT_HOTEND_TEMP)
...@@ -201,10 +215,13 @@ ...@@ -201,10 +215,13 @@
#if DISABLED(MAX_BED_POWER) #if DISABLED(MAX_BED_POWER)
#error DEPENDENCY ERROR: Missing setting MAX_BED_POWER #error DEPENDENCY ERROR: Missing setting MAX_BED_POWER
#endif #endif
#if DISABLED(MAX_CHAMBER_POWER)
#error DEPENDENCY ERROR: Missing setting MAX_CHAMBER_POWER
#endif
#if DISABLED(MAX_COOLER_POWER) #if DISABLED(MAX_COOLER_POWER)
#error DEPENDENCY ERROR: Missing setting MAX_COOLER_POWER #error DEPENDENCY ERROR: Missing setting MAX_COOLER_POWER
#endif #endif
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) || ENABLED(PIDTEMPCOOLER) #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) || ENABLED(PIDTEMPCHAMBER) || ENABLED(PIDTEMPCOOLER)
#if DISABLED(MAX_OVERSHOOT_PID_AUTOTUNE) #if DISABLED(MAX_OVERSHOOT_PID_AUTOTUNE)
#error DEPENDENCY ERROR: Missing setting MAX_OVERSHOOT_PID_AUTOTUNE #error DEPENDENCY ERROR: Missing setting MAX_OVERSHOOT_PID_AUTOTUNE
#endif #endif
...@@ -240,6 +257,21 @@ ...@@ -240,6 +257,21 @@
#error DEPENDENCY ERROR: Missing setting DEFAULT_bedKd #error DEPENDENCY ERROR: Missing setting DEFAULT_bedKd
#endif #endif
#endif #endif
#if ENABLED(PIDTEMPCHAMBER)
#if DISABLED(PID_CHAMBER_INTEGRAL_DRIVE_MAX)
#error DEPENDENCY ERROR: Missing setting PID_CHAMBER_INTEGRAL_DRIVE_MAX
#endif
#if DISABLED(DEFAULT_chamberKp)
#error DEPENDENCY ERROR: Missing setting DEFAULT_chamberKp
#endif
#if DISABLED(DEFAULT_chamberKi)
#error DEPENDENCY ERROR: Missing setting DEFAULT_chamberKi
#endif
#if DISABLED(DEFAULT_chamberKd)
#error DEPENDENCY ERROR: Missing setting DEFAULT_chamberKd
#endif
#endif
#if ENABLED(PIDTEMPCOOLER) #if ENABLED(PIDTEMPCOOLER)
#if DISABLED(PID_COOLER_INTEGRAL_DRIVE_MAX) #if DISABLED(PID_COOLER_INTEGRAL_DRIVE_MAX)
#error DEPENDENCY ERROR: Missing setting PID_COOLER_INTEGRAL_DRIVE_MAX #error DEPENDENCY ERROR: Missing setting PID_COOLER_INTEGRAL_DRIVE_MAX
...@@ -253,7 +285,6 @@ ...@@ -253,7 +285,6 @@
#if DISABLED(DEFAULT_coolerKd) #if DISABLED(DEFAULT_coolerKd)
#error DEPENDENCY ERROR: Missing setting DEFAULT_coolerKd #error DEPENDENCY ERROR: Missing setting DEFAULT_coolerKd
#endif #endif
#endif #endif
#if ENABLED(BED_LIMIT_SWITCHING) #if ENABLED(BED_LIMIT_SWITCHING)
#if DISABLED(BED_HYSTERESIS) #if DISABLED(BED_HYSTERESIS)
...@@ -263,6 +294,14 @@ ...@@ -263,6 +294,14 @@
#error DEPENDENCY ERROR: Missing setting BED_CHECK_INTERVAL #error DEPENDENCY ERROR: Missing setting BED_CHECK_INTERVAL
#endif #endif
#endif #endif
#if ENABLED(CHAMBER_LIMIT_SWITCHING)
#if DISABLED(CHAMBER_HYSTERESIS)
#error DEPENDENCY ERROR: Missing setting CHAMBER_HYSTERESIS
#endif
#if DISABLED(CHAMBER_CHECK_INTERVAL)
#error DEPENDENCY ERROR: Missing setting CHAMBER_CHECK_INTERVAL
#endif
#endif
#if ENABLED(COOLER_LIMIT_SWITCHING) #if ENABLED(COOLER_LIMIT_SWITCHING)
#if DISABLED(COOLER_HYSTERESIS) #if DISABLED(COOLER_HYSTERESIS)
#error DEPENDENCY ERROR: Missing setting COOLER_HYSTERESIS #error DEPENDENCY ERROR: Missing setting COOLER_HYSTERESIS
...@@ -271,7 +310,6 @@ ...@@ -271,7 +310,6 @@
#error DEPENDENCY ERROR: Missing setting COOLER_CHECK_INTERVAL #error DEPENDENCY ERROR: Missing setting COOLER_CHECK_INTERVAL
#endif #endif
#endif #endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) #if ENABLED(THERMAL_PROTECTION_HOTENDS)
#if DISABLED(THERMAL_PROTECTION_PERIOD) #if DISABLED(THERMAL_PROTECTION_PERIOD)
#error DEPENDENCY ERROR: Missing setting THERMAL_PROTECTION_PERIOD #error DEPENDENCY ERROR: Missing setting THERMAL_PROTECTION_PERIOD
...@@ -1820,35 +1858,26 @@ ...@@ -1820,35 +1858,26 @@
#error DEPENDENCY ERROR: You must set EXTRUDERS = 2 for DONDOLO #error DEPENDENCY ERROR: You must set EXTRUDERS = 2 for DONDOLO
#endif #endif
#if ENABLED(LASERBEAM) && (!PIN_EXISTS(LASER_PWR) || !PIN_EXISTS(LASER_TTL)) #if ENABLED(LASERBEAM)
#error DEPENDENCY ERROR: You have to set LASER_PWR_PIN and LASER_TTL_PIN to a valid pin if you enable LASERBEAM
#endif
#if ENABLED(LASERBEAM) && ENABLED(LASER)
#error DEPENDENCY ERROR: You must enable only one of LASERBEAM or LASER, not both!
#endif
#if ENABLED(LASER)
#if (!ENABLED(LASER_REMAP_INTENSITY) && ENABLED(LASER_RASTER)) #if (!ENABLED(LASER_REMAP_INTENSITY) && ENABLED(LASER_RASTER))
#error DEPENDENCY ERROR: You have to set LASER_REMAP_INTENSITY with LASER_RASTER enabled #error DEPENDENCY ERROR: You have to set LASER_REMAP_INTENSITY with LASER_RASTER enabled
#endif #endif
#if (!ENABLED(LASER_CONTROL) || ((LASER_CONTROL > 0) && (LASER_CONTROL < 2))) #if (!ENABLED(LASER_CONTROL) || ((LASER_CONTROL != 1) && (LASER_CONTROL != 2)))
#error DEPENDENCY ERROR: You have to set LASER_CONTROL to 1 or 2 #error DEPENDENCY ERROR: You have to set LASER_CONTROL to 1 or 2
#else #else
#if(LASER_CONTROL == 1) #if(LASER_CONTROL == 1)
#if( !PIN_EXISTS(LASER_FIRING)) #if( !PIN_EXISTS(LASER_PWR))
#error DEPENDENCY ERROR: You have to set LASER_FIRING_PIN #error DEPENDENCY ERROR: You have to set LASER_PWR_PIN
#endif #endif
#else #else
#if( !PIN_EXISTS(LASER_FIRING) || !PIN_EXISTS(LASER_INTENSITY)) #if( !PIN_EXISTS(LASER_PWR) || !PIN_EXISTS(LASER_TTL))
#error DEPENDENCY ERROR: You have to set LASER_FIRING_PIN and LASER_INTENSITY_PIN to a valid pin if you enable LASER #error DEPENDENCY ERROR: You have to set LASER_PWR_PIN and LASER_TTL_PIN to a valid pin if you enable LASER
#endif #endif
#endif #endif
#endif #endif
#endif #if DISABLED(LASER_HAS_FOCUS)
#error DEPENDENCY ERROR: Missing LASER_HAS_FOCUS setting
#if DISABLED(LASER_HAS_FOCUS) #endif
#error DEPENDENCY ERROR: Missing LASER_HAS_FOCUS setting
#endif #endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && !PIN_EXISTS(FILRUNOUT) #if ENABLED(FILAMENT_RUNOUT_SENSOR) && !PIN_EXISTS(FILRUNOUT)
...@@ -1895,8 +1924,4 @@ ...@@ -1895,8 +1924,4 @@
#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
#if ENABLED(LASERBEAM) && ENABLED(LASER)
#error DEPENDENCY ERROR: You have to select only one of LASER or LASERBEAM
#endif
#endif //SANITYCHECK_H #endif //SANITYCHECK_H
This diff is collapsed.
...@@ -69,15 +69,20 @@ void manage_temp_controller(); //it is critical that this is called periodically ...@@ -69,15 +69,20 @@ void manage_temp_controller(); //it is critical that this is called periodically
// do not use these routines and variables outside of temperature.cpp // do not use these routines and variables outside of temperature.cpp
extern int target_temperature[4]; extern int target_temperature[4];
extern float current_temperature[4]; extern float current_temperature[4];
extern int target_temperature_bed;
extern float current_temperature_bed;
extern int target_temperature_chamber;
extern float current_temperature_chamber;
extern int target_temperature_cooler;
extern float current_temperature_cooler;
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
extern int current_temperature_raw[4]; extern int current_temperature_raw[4];
extern int current_temperature_bed_raw; extern int current_temperature_bed_raw;
extern int current_temperature_chamber_raw;
extern int current_temperature_cooler_raw; extern int current_temperature_cooler_raw;
#endif #endif
extern int target_temperature_bed;
extern float current_temperature_bed;
extern int target_temperature_cooler;
extern float current_temperature_cooler;
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
extern float redundant_temperature; extern float redundant_temperature;
#endif #endif
...@@ -95,11 +100,15 @@ extern float current_temperature_cooler; ...@@ -95,11 +100,15 @@ extern float current_temperature_cooler;
extern float bedKp, bedKi, bedKd; extern float bedKp, bedKi, bedKd;
#endif #endif
#if ENABLED(PIDTEMPCHAMBER)
extern float chamberKp, chamberKi, chamberKd;
#endif
#if ENABLED(PIDTEMPCOOLER) #if ENABLED(PIDTEMPCOOLER)
extern float coolerKp, coolerKi, coolerKd; extern float coolerKp, coolerKi, coolerKd;
#endif #endif
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) || ENABLED(PIDTEMPCOOLER) #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) || ENABLED(PIDTEMPCHAMBER) || ENABLED(PIDTEMPCOOLER)
float scalePID_i(float i); float scalePID_i(float i);
float scalePID_d(float d); float scalePID_d(float d);
float unscalePID_i(float i); float unscalePID_i(float i);
...@@ -121,30 +130,37 @@ extern float current_temperature_cooler; ...@@ -121,30 +130,37 @@ extern float current_temperature_cooler;
FORCE_INLINE float degHotend(uint8_t hotend) { return current_temperature[HOTEND_ARG]; } FORCE_INLINE float degHotend(uint8_t hotend) { return current_temperature[HOTEND_ARG]; }
FORCE_INLINE float degBed() { return current_temperature_bed; } FORCE_INLINE float degBed() { return current_temperature_bed; }
FORCE_INLINE float degChamber() { return current_temperature_chamber; }
FORCE_INLINE float degCooler() { return current_temperature_cooler; } FORCE_INLINE float degCooler() { return current_temperature_cooler; }
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
FORCE_INLINE float rawHotendTemp(uint8_t hotend) { return current_temperature_raw[HOTEND_ARG]; } FORCE_INLINE float rawHotendTemp(uint8_t hotend) { return current_temperature_raw[HOTEND_ARG]; }
FORCE_INLINE float rawBedTemp() { return current_temperature_bed_raw; } FORCE_INLINE float rawBedTemp() { return current_temperature_bed_raw; }
FORCE_INLINE float rawChamberTemp() { return current_temperature_chamber_raw; }
FORCE_INLINE float rawCoolerTemp() { return current_temperature_cooler_raw; } FORCE_INLINE float rawCoolerTemp() { return current_temperature_cooler_raw; }
#endif #endif
FORCE_INLINE float degTargetHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG]; } FORCE_INLINE float degTargetHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG]; }
FORCE_INLINE float degTargetBed() { return target_temperature_bed; } FORCE_INLINE float degTargetBed() { return target_temperature_bed; }
FORCE_INLINE float degTargetChamber() { return target_temperature_chamber; }
FORCE_INLINE float degTargetCooler() { return target_temperature_cooler; } FORCE_INLINE float degTargetCooler() { return target_temperature_cooler; }
#if ENABLED(THERMAL_PROTECTION_HOTENDS) #if ENABLED(THERMAL_PROTECTION_HOTENDS)
void start_watching_heater(int h = 0); void start_watching_heater(int h = 0);
#endif #endif
#if ENABLED(THERMAL_PROTECTION_COOLERS)
void start_watching_cooler();
#endif
#if ENABLED(THERMAL_PROTECTION_BED) #if ENABLED(THERMAL_PROTECTION_BED)
void start_watching_bed(); void start_watching_bed();
#endif #endif
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
void start_watching_chamber();
#endif
#if ENABLED(THERMAL_PROTECTION_COOLER)
void start_watching_cooler();
#endif
FORCE_INLINE void setTargetHotend(const float& celsius, uint8_t hotend) { FORCE_INLINE void setTargetHotend(const float& celsius, uint8_t hotend) {
target_temperature[HOTEND_ARG] = celsius; target_temperature[HOTEND_ARG] = celsius;
#if ENABLED(THERMAL_PROTECTION_HOTENDS) #if ENABLED(THERMAL_PROTECTION_HOTENDS)
...@@ -159,20 +175,28 @@ FORCE_INLINE void setTargetBed(const float& celsius) { ...@@ -159,20 +175,28 @@ FORCE_INLINE void setTargetBed(const float& celsius) {
#endif #endif
} }
FORCE_INLINE void setTargetChamber(const float& celsius) {
target_temperature_chamber = celsius;
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
start_watching_chamber();
#endif
}
FORCE_INLINE void setTargetCooler(const float& celsius) { FORCE_INLINE void setTargetCooler(const float& celsius) {
target_temperature_cooler = celsius; target_temperature_cooler = celsius;
#if ENABLED(THERMAL_PROTECTION_COOLER) && ENABLED(THERMAL_PROTECTION_COOLER_WATCHDOG) #if ENABLED(THERMAL_PROTECTION_COOLER)
start_watching_cooler(); start_watching_cooler();
#endif #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; }
FORCE_INLINE bool isHeatingChamber() { return target_temperature_chamber > current_temperature_chamber; }
FORCE_INLINE bool isHeatingCooler() { return target_temperature_cooler > current_temperature_cooler; } FORCE_INLINE bool isHeatingCooler() { return target_temperature_cooler > current_temperature_cooler; }
FORCE_INLINE bool isCoolingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] < current_temperature[HOTEND_ARG]; } FORCE_INLINE bool isCoolingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] < current_temperature[HOTEND_ARG]; }
FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; } FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
FORCE_INLINE bool isCoolingChamber() { return target_temperature_chamber < current_temperature_chamber; }
FORCE_INLINE bool isCoolingCooler() { return target_temperature_cooler < current_temperature_cooler; } FORCE_INLINE bool isCoolingCooler() { return target_temperature_cooler < current_temperature_cooler; }
#define HOTEND_ROUTINES(NR) \ #define HOTEND_ROUTINES(NR) \
...@@ -199,14 +223,16 @@ HOTEND_ROUTINES(0); ...@@ -199,14 +223,16 @@ HOTEND_ROUTINES(0);
#endif #endif
int getHeaterPower(int heater); int getHeaterPower(int heater);
int getBedPower();
int getChamberPower();
int getCoolerPower(); int getCoolerPower();
unsigned char getPwmCooler(bool soft); unsigned char getPwmCooler(bool soft);
void disable_all_heaters(); void disable_all_heaters();
void disable_all_coolers(); void disable_all_coolers();
void updatePID(); void updatePID();
#if HAS(PID_HEATING) || HAS(PID_COOLING) #if HAS(PID_HEATING) || HAS(PID_COOLING)
void PID_autotune(float temp, int temp_controller, int ncycles, bool set_result = false); void PID_autotune(float temp, int temp_controller, int ncycles, bool set_result = false);
#endif #endif
......
This diff is collapsed.
...@@ -46,6 +46,8 @@ Added total filament printed writed in SD CARD. ...@@ -46,6 +46,8 @@ 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 Laser beam and raster base64
## 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