Bump and fix homing

This commit is contained in:
InsanityAutomation
2019-03-31 11:38:05 -04:00
parent 4910c6256c
commit 03580ae173
245 changed files with 2336 additions and 1356 deletions
+34 -27
View File
@@ -269,7 +269,7 @@
*/
//#define MAGNETIC_PARKING_EXTRUDER
#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER)
#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER)
#define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders
#define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder
@@ -404,6 +404,7 @@
* 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
* 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup
* 66 : 4.7M High Temperature thermistor from Dyze Design
* 67 : 450C thermistor from SliceEngineering
* 70 : the 100K thermistor found in the bq Hephestos 2
* 75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
*
@@ -422,7 +423,7 @@
* 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
* 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
*
* :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" }
* :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" }
*/
#if ENABLED(TREX3)
#define TEMP_SENSOR_0 61
@@ -453,30 +454,30 @@
//#define TEMP_SENSOR_1_AS_REDUNDANT
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
// Extruder 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.
#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
// Bed temperature must be close to target for this long before M190 returns success
#define TEMP_BED_RESIDENCY_TIME 10 // (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.
#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190
#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
// The minimal temperature defines the temperature below which the heater will not be enabled It is used
// 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
#define HEATER_1_MINTEMP 5
#define HEATER_2_MINTEMP 5
#define HEATER_3_MINTEMP 5
#define HEATER_4_MINTEMP 5
#define HEATER_5_MINTEMP 5
#define BED_MINTEMP 5
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
// When temperature exceeds max temp, your heater will be switched off.
// 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.
// Below this temperature the heater will be switched off
// because it probably indicates a broken thermistor wire.
#define HEATER_0_MINTEMP 5
#define HEATER_1_MINTEMP 5
#define HEATER_2_MINTEMP 5
#define HEATER_3_MINTEMP 5
#define HEATER_4_MINTEMP 5
#define HEATER_5_MINTEMP 5
#define BED_MINTEMP 5
#define CHAMBER_MINTEMP 5
// Above this temperature the heater will be switched off.
// This can protect components from overheating, but NOT from shorts and failures.
// (Use MINTEMP for thermistor short/failure protection.)
#if ENABLED(TREX3)
#define HEATER_0_MAXTEMP 350
#define HEATER_1_MAXTEMP 350
@@ -488,7 +489,8 @@
#define HEATER_3_MAXTEMP 275
#define HEATER_4_MAXTEMP 275
#define HEATER_5_MAXTEMP 275
#define BED_MAXTEMP 150
#define BED_MAXTEMP 150
#define CHAMBER_MAXTEMP 100
//===========================================================================
//============================= PID Settings ================================
@@ -621,6 +623,7 @@
#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
//===========================================================================
//============================= Mechanical Settings =========================
@@ -816,7 +819,7 @@
* Override with M201
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
*/
#define DEFAULT_MAX_ACCELERATION { 1500, 500, 400, 4000 }
#define DEFAULT_MAX_ACCELERATION { 750, 500, 400, 4000 }
/**
* Default Acceleration (change/s) change = mm/s
@@ -835,7 +838,7 @@
//
#define JUNCTION_DEVIATION
#if ENABLED(JUNCTION_DEVIATION)
#define JUNCTION_DEVIATION_MM 0.12 // (mm) Distance from real junction edge
#define JUNCTION_DEVIATION_MM 0.08 // (mm) Distance from real junction edge
#endif
/**
@@ -932,7 +935,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
#define BLTOUCH_FORCE_5V_MODE
+8 -7
View File
@@ -412,20 +412,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -779,7 +779,7 @@
#define SD_DETECT_INVERTED
#define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place.
// Reverse SD sort to show "more recent" files first, according to the card's FAT.
// Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended.
@@ -1105,7 +1105,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
+19
View File
@@ -372,3 +372,22 @@ inline void HAL_adc_init(void) {
// AVR compatibility
#define strtof strtod
/**
* set_pwm_frequency
* Sets the frequency of the timer corresponding to the provided pin
* as close as possible to the provided desired frequency. Internally
* calculates the required waveform generation mode, prescaler and
* resolution values required and sets the timer registers accordingly.
* NOTE that the frequency is applied to all pins on the timer (Ex OC3A, OC3B and OC3B)
* NOTE that there are limitations, particularly if using TIMER2. (see Configuration_adv.h -> FAST FAN PWM Settings)
*/
void set_pwm_frequency(const pin_t pin, int f_desired);
/**
* set_pwm_duty
* Sets the PWM duty cycle of the provided pin to the provided value
* Optionally allows inverting the duty cycle [default = false]
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
*/
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
+1 -1
View File
@@ -46,7 +46,7 @@
* Sanity checks for Spindle / Laser
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if SPINDLE_LASER_ENABLE_PIN <= 0
#if DISABLED(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
+250
View File
@@ -0,0 +1,250 @@
#ifdef __AVR__
#include "../../inc/MarlinConfigPre.h"
/**
* get_pwm_timer
* Grabs timer information and registers of the provided pin
* returns Timer struct containing this information
* Used by set_pwm_frequency, set_pwm_duty
*
*/
#if ENABLED(FAST_PWM_FAN)
#include "HAL.h"
struct Timer {
volatile uint8_t* TCCRnQ[3]; // max 3 TCCR registers per timer
volatile uint16_t* OCRnQ[3]; // max 3 OCR registers per timer
volatile uint16_t* ICRn; // max 1 ICR register per timer
uint8_t n; // the timer number [0->5]
uint8_t q; // the timer output [0->2] (A->C)
};
Timer get_pwm_timer(pin_t pin) {
uint8_t q = 0;
switch (digitalPinToTimer(pin)) {
// Protect reserved timers (TIMER0 & TIMER1)
#ifdef TCCR0A
#if !AVR_AT90USB1286_FAMILY
case TIMER0A:
#endif
case TIMER0B:
#endif
#ifdef TCCR1A
case TIMER1A: case TIMER1B:
#endif
break;
#if defined(TCCR2) || defined(TCCR2A)
#ifdef TCCR2
case TIMER2: {
Timer timer = {
/*TCCRnQ*/ { &TCCR2, NULL, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2, NULL, NULL},
/*ICRn*/ NULL,
/*n, q*/ 2, 0
};
}
#elif defined TCCR2A
#if ENABLED(USE_OCR2A_AS_TOP)
case TIMER2A: break; // protect TIMER2A
case TIMER2B: {
Timer timer = {
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL},
/*ICRn*/ NULL,
/*n, q*/ 2, 1
};
return timer;
}
#else
case TIMER2B: ++q;
case TIMER2A: {
Timer timer = {
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL},
/*ICRn*/ NULL,
2, q
};
return timer;
}
#endif
#endif
#endif
#ifdef TCCR3A
case TIMER3C: ++q;
case TIMER3B: ++q;
case TIMER3A: {
Timer timer = {
/*TCCRnQ*/ { &TCCR3A, &TCCR3B, &TCCR3C},
/*OCRnQ*/ { &OCR3A, &OCR3B, &OCR3C},
/*ICRn*/ &ICR3,
/*n, q*/ 3, q
};
return timer;
}
#endif
#ifdef TCCR4A
case TIMER4C: ++q;
case TIMER4B: ++q;
case TIMER4A: {
Timer timer = {
/*TCCRnQ*/ { &TCCR4A, &TCCR4B, &TCCR4C},
/*OCRnQ*/ { &OCR4A, &OCR4B, &OCR4C},
/*ICRn*/ &ICR4,
/*n, q*/ 4, q
};
return timer;
}
#endif
#ifdef TCCR5A
case TIMER5C: ++q;
case TIMER5B: ++q;
case TIMER5A: {
Timer timer = {
/*TCCRnQ*/ { &TCCR5A, &TCCR5B, &TCCR5C},
/*OCRnQ*/ { &OCR5A, &OCR5B, &OCR5C },
/*ICRn*/ &ICR5,
/*n, q*/ 5, q
};
return timer;
}
#endif
}
Timer timer = {
/*TCCRnQ*/ { NULL, NULL, NULL},
/*OCRnQ*/ { NULL, NULL, NULL},
/*ICRn*/ NULL,
0, 0
};
return timer;
}
void set_pwm_frequency(const pin_t pin, int f_desired) {
Timer timer = get_pwm_timer(pin);
if (timer.n == 0) return; // Don't proceed if protected timer or not recognised
uint16_t size;
if (timer.n == 2) size = 255; else size = 65535;
uint16_t res = 255; // resolution (TOP value)
uint8_t j = 0; // prescaler index
uint8_t wgm = 1; // waveform generation mode
// Calculating the prescaler and resolution to use to achieve closest frequency
if (f_desired != 0) {
int f = (F_CPU) / (2 * 1024 * size) + 1; // Initialize frequency as lowest (non-zero) achievable
uint16_t prescaler[] = { 0, 1, 8, /*TIMER2 ONLY*/32, 64, /*TIMER2 ONLY*/128, 256, 1024 };
// loop over prescaler values
for (uint8_t i = 1; i < 8; i++) {
uint16_t res_temp_fast = 255, res_temp_phase_correct = 255;
if (timer.n == 2) {
// No resolution calculation for TIMER2 unless enabled USE_OCR2A_AS_TOP
#if ENABLED(USE_OCR2A_AS_TOP)
const uint16_t rtf = (F_CPU) / (prescaler[i] * f_desired);
res_temp_fast = rtf - 1;
res_temp_phase_correct = rtf / 2;
#endif
}
else {
// Skip TIMER2 specific prescalers when not TIMER2
if (i == 3 || i == 5) continue;
const uint16_t rtf = (F_CPU) / (prescaler[i] * f_desired);
res_temp_fast = rtf - 1;
res_temp_phase_correct = rtf / 2;
}
LIMIT(res_temp_fast, 1u, size);
LIMIT(res_temp_phase_correct, 1u, size);
// Calculate frequencies of test prescaler and resolution values
const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)),
f_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct),
f_diff = ABS(f - f_desired),
f_fast_diff = ABS(f_temp_fast - f_desired),
f_phase_diff = ABS(f_temp_phase_correct - f_desired);
// If FAST values are closest to desired f
if (f_fast_diff < f_diff && f_fast_diff <= f_phase_diff) {
// Remember this combination
f = f_temp_fast;
res = res_temp_fast;
j = i;
// Set the Wave Generation Mode to FAST PWM
if (timer.n == 2) {
wgm = (
#if ENABLED(USE_OCR2A_AS_TOP)
WGM2_FAST_PWM_OCR2A
#else
WGM2_FAST_PWM
#endif
);
}
else wgm = WGM_FAST_PWM_ICRn;
}
// If PHASE CORRECT values are closes to desired f
else if (f_phase_diff < f_diff) {
f = f_temp_phase_correct;
res = res_temp_phase_correct;
j = i;
// Set the Wave Generation Mode to PWM PHASE CORRECT
if (timer.n == 2) {
wgm = (
#if ENABLED(USE_OCR2A_AS_TOP)
WGM2_PWM_PC_OCR2A
#else
WGM2_PWM_PC
#endif
);
}
else wgm = WGM_PWM_PC_ICRn;
}
}
}
_SET_WGMnQ(timer.TCCRnQ, wgm);
_SET_CSn(timer.TCCRnQ, j);
if (timer.n == 2) {
#if ENABLED(USE_OCR2A_AS_TOP)
_SET_OCRnQ(timer.OCRnQ, 0, res); // Set OCR2A value (TOP) = res
#endif
}
else
_SET_ICRn(timer.ICRn, res); // Set ICRn value (TOP) = res
}
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
// If v is 0 or v_size (max), digitalWrite to LOW or HIGH.
// Note that digitalWrite also disables pwm output for us (sets COM bit to 0)
if (v == 0)
digitalWrite(pin, invert);
else if (v == v_size)
digitalWrite(pin, !invert);
else {
Timer timer = get_pwm_timer(pin);
if (timer.n == 0) return; // Don't proceed if protected timer or not recognised
// Set compare output mode to CLEAR -> SET or SET -> CLEAR (if inverted)
_SET_COMnQ(timer.TCCRnQ, (timer.q
#ifdef TCCR2
+ (timer.q == 2) // COM20 is on bit 4 of TCCR2, thus requires q + 1 in the macro
#endif
), COM_CLEAR_SET + invert
);
uint16_t top;
if (timer.n == 2) { // if TIMER2
top = (
#if ENABLED(USE_OCR2A_AS_TOP)
*timer.OCRnQ[0] // top = OCR2A
#else
255 // top = 0xFF (max)
#endif
);
}
else
top = *timer.ICRn; // top = ICRn
_SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top / v_size)); // Scale 8/16-bit v to top value
}
}
#endif // FAST_PWM_FAN
#endif // __AVR__
+11 -11
View File
@@ -81,9 +81,9 @@
#define _SET_INPUT(IO) CBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _SET_OUTPUT(IO) SBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _GET_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _GET_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _GET_TIMER(IO) DIO ## IO ## _PWM
#define _IS_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _IS_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _HAS_TIMER(IO) DIO ## IO ## _PWM
// digitalRead/Write wrappers
#ifdef FASTIO_EXT_START
@@ -104,9 +104,9 @@
#define SET_PWM(IO) SET_OUTPUT(IO)
#define GET_INPUT(IO) _GET_INPUT(IO)
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define GET_TIMER(IO) _GET_TIMER(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
#define HAS_TIMER(IO) _HAS_TIMER(IO)
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
@@ -200,7 +200,7 @@ enum ClockSource2 : char {
TCCR##T##B = (TCCR##T##B & ~(0x3 << WGM##T##2)) | (((int(V) >> 2) & 0x3) << WGM##T##2); \
}while(0)
#define SET_WGM(T,V) _SET_WGM(T,WGM_##V)
// Runtime (see Temperature::set_pwm_frequency):
// Runtime (see set_pwm_frequency):
#define _SET_WGMnQ(TCCRnQ, V) do{ \
*(TCCRnQ)[0] = (*(TCCRnQ)[0] & ~(0x3 << 0)) | (( int(V) & 0x3) << 0); \
*(TCCRnQ)[1] = (*(TCCRnQ)[1] & ~(0x3 << 3)) | (((int(V) >> 2) & 0x3) << 3); \
@@ -230,7 +230,7 @@ enum ClockSource2 : char {
#define SET_CS4(V) _SET_CS4(CS_##V)
#define SET_CS5(V) _SET_CS5(CS_##V)
#define SET_CS(T,V) SET_CS##T(V)
// Runtime (see Temperature::set_pwm_frequency)
// Runtime (see set_pwm_frequency)
#define _SET_CSn(TCCRnQ, V) do{ \
(*(TCCRnQ)[1] = (*(TCCRnQ[1]) & ~(0x7 << 0)) | ((int(V) & 0x7) << 0)); \
}while(0)
@@ -243,19 +243,19 @@ enum ClockSource2 : char {
#define SET_COMB(T,V) SET_COM(T,B,V)
#define SET_COMC(T,V) SET_COM(T,C,V)
#define SET_COMS(T,V1,V2,V3) do{ SET_COMA(T,V1); SET_COMB(T,V2); SET_COMC(T,V3); }while(0)
// Runtime (see Temperature::set_pwm_duty)
// Runtime (see set_pwm_duty)
#define _SET_COMnQ(TCCRnQ, Q, V) do{ \
(*(TCCRnQ)[0] = (*(TCCRnQ)[0] & ~(0x3 << (6-2*(Q)))) | (int(V) << (6-2*(Q)))); \
}while(0)
// Set OCRnQ register
// Runtime (see Temperature::set_pwm_duty):
// Runtime (see set_pwm_duty):
#define _SET_OCRnQ(OCRnQ, Q, V) do{ \
(*(OCRnQ)[(Q)] = (0x0000) | (int(V) & 0xFFFF)); \
}while(0)
// Set ICRn register (one per timer)
// Runtime (see Temperature::set_pwm_frequency)
// Runtime (see set_pwm_frequency)
#define _SET_ICRn(ICRn, V) do{ \
(*(ICRn) = (0x0000) | (int(V) & 0xFFFF)); \
}while(0)
+2 -2
View File
@@ -63,8 +63,8 @@
const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = {
{ TC0, 0, TC0_IRQn, 3}, // 0 - [servo timer5]
{ TC0, 1, TC1_IRQn, 0}, // 1
{ TC0, 2, TC2_IRQn, 0}, // 2
{ TC1, 0, TC3_IRQn, 2}, // 3 - stepper
{ TC0, 2, TC2_IRQn, 2}, // 2 - stepper
{ TC1, 0, TC3_IRQn, 0}, // 3
{ TC1, 1, TC4_IRQn, 15}, // 4 - temperature
{ TC1, 2, TC5_IRQn, 3}, // 5 - [servo timer3]
{ TC2, 0, TC6_IRQn, 14}, // 6 - tone
+2 -2
View File
@@ -43,7 +43,7 @@ typedef uint32_t hal_timer_t;
#define HAL_TIMER_RATE ((F_CPU) / 2) // frequency of timers peripherals
#define STEP_TIMER_NUM 3 // index of timer to use for stepper
#define STEP_TIMER_NUM 2 // index of timer to use for stepper
#define TEMP_TIMER_NUM 4 // index of timer to use for temperature
#define PULSE_TIMER_NUM STEP_TIMER_NUM
#define TONE_TIMER_NUM 6 // index of timer to use for beeper tones
@@ -65,7 +65,7 @@ typedef uint32_t hal_timer_t;
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define HAL_STEP_TIMER_ISR() void TC3_Handler()
#define HAL_STEP_TIMER_ISR() void TC2_Handler()
#define HAL_TEMP_TIMER_ISR() void TC4_Handler()
#define HAL_TONE_TIMER_ISR() void TC6_Handler()
+4
View File
@@ -50,3 +50,7 @@
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
#endif
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+3 -3
View File
@@ -177,11 +177,11 @@
#define SET_PWM(IO) SET_OUTPUT(IO)
// Check if pin is an input
#define GET_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
#define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
// Check if pin is an output
#define GET_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
#define IS_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
// Check if pin is a timer - Must be a constexpr
#define GET_TIMER(IO) ((IO) >= 2 && (IO) <= 13)
#define HAS_TIMER(IO) ((IO) >= 2 && (IO) <= 13)
// Shorthand
#define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); }
+4
View File
@@ -23,3 +23,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for ESP32. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4
View File
@@ -65,3 +65,7 @@
#endif
#endif
#endif // SPINDLE_LASER_ENABLE
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+8 -8
View File
@@ -75,19 +75,19 @@
// hg42: currently not used, but was used by pinsDebug
/// check if pin is an input
#define _GET_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
#define _IS_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
/// check if pin is an output
#define _GET_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
#define _IS_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
// hg42: GET_TIMER is used only to check if it's a PWM pin
// hg42: HAS_TIMER is used only to check if it's a PWM pin
// hg42: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically
// hg42: instead use PWM bit from the #define
/// check if pin is a timer
#define _GET_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there
#define _HAS_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there
// hg42: could be this:
// #define _GET_TIMER(IO) LPC1768_PIN_PWM(IO)
// #define _HAS_TIMER(IO) LPC1768_PIN_PWM(IO)
// but this is an incomplete check (12 pins are PWMable, but only 6 can be used at the same time)
/// Read a pin wrapper
@@ -112,12 +112,12 @@
#define SET_PWM(IO) SET_OUTPUT(IO)
/// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
/// check if pin is an output wrapper
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
/// check if pin is a timer (wrapper)
#define GET_TIMER(IO) _GET_TIMER(IO)
#define HAS_TIMER(IO) _HAS_TIMER(IO)
// Shorthand
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
+16
View File
@@ -157,3 +157,19 @@ void HAL_idletask(void);
#define PLATFORM_M997_SUPPORT
void flashFirmware(int16_t value);
/**
* set_pwm_frequency
* Set the frequency of the timer corresponding to the provided pin
* All Hardware PWM pins run at the same frequency and all
* Software PWM pins run at the same frequency
*/
void set_pwm_frequency(const pin_t pin, int f_desired);
/**
* set_pwm_duty
* Set the PWM duty cycle of the provided pin to the provided value
* Optionally allows inverting the duty cycle [default = false]
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
*/
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
+40
View File
@@ -0,0 +1,40 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(FAST_PWM_FAN)
#include <pwm.h>
void set_pwm_frequency(const pin_t pin, int f_desired) {
pwm_set_frequency(pin, f_desired);
}
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size);
}
#endif // FAST_PWM_FAN
#endif // TARGET_LPC1768
+6 -6
View File
@@ -84,14 +84,14 @@
#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
/// check if pin is an input
#define _GET_INPUT(IO) (!gpio_get_dir(IO))
#define _IS_INPUT(IO) (!gpio_get_dir(IO))
/// check if pin is an output
#define _GET_OUTPUT(IO) (gpio_get_dir(IO))
#define _IS_OUTPUT(IO) (gpio_get_dir(IO))
/// check if pin is a timer
/// all gpio pins are pwm capable, either interrupt or hardware pwm controlled
#define _GET_TIMER(IO) true
#define _HAS_TIMER(IO) true
/// Read a pin wrapper
#define READ(IO) _READ(IO)
@@ -115,12 +115,12 @@
#define SET_PWM(IO) SET_OUTPUT(IO)
/// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
/// check if pin is an output wrapper
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
/// check if pin is a timer (wrapper)
#define GET_TIMER(IO) _GET_TIMER(IO)
#define HAS_TIMER(IO) _HAS_TIMER(IO)
// Shorthand
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
@@ -74,7 +74,8 @@ bool PersistentStore::access_start() {
// sector is blank so nothing stored yet
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = EEPROM_ERASE;
current_slot = EEPROM_SLOTS;
} else {
}
else {
// current slot is the first non blank one
current_slot = first_nblank_loc / EEPROM_SIZE;
uint8_t *eeprom_data = SLOT_ADDRESS(EEPROM_SECTOR, current_slot);
+4
View File
@@ -69,3 +69,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for STM32. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4 -4
View File
@@ -78,11 +78,11 @@ void FastIO_init(); // Must be called before using fast io macros
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#define SET_PWM(IO) _SET_MODE(IO, PWM)
#define GET_INPUT(IO)
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define IS_INPUT(IO)
#define IS_OUTPUT(IO)
#define HAS_TIMER(IO) digitalPinHasPWM(IO)
#define PWM_PIN(P) digitalPinHasPWM(P)
#define PWM_PIN(P) HAS_TIMER(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// digitalRead/Write wrappers
+4
View File
@@ -130,6 +130,10 @@ void HAL_init();
#define analogInputToDigitalPin(p) (p)
#endif
#ifndef digitalPinHasPWM
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != NULL)
#endif
#define CRITICAL_SECTION_START uint32_t primask = __get_primask(); (void)__iCliRetVal()
#define CRITICAL_SECTION_END if (!primask) (void)__iSeiRetVal()
#define ISRS_ENABLED() (!__get_primask())
@@ -21,7 +21,7 @@
*
*/
#if defined(__STM32F1__) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#include "HAL_sdio_STM32F1.h"
@@ -76,7 +76,7 @@ bool SDIO_Init(void) {
return true;
}
bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) {
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false;
if ((0x03 & (uint32_t)data)) return false; // misaligned data
@@ -100,6 +100,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
if (SDIO->STA & SDIO_STA_RXDAVL) {
while (SDIO->STA & SDIO_STA_RXDAVL) (void) SDIO->FIFO;
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
}
if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
@@ -108,6 +114,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
return true;
}
bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
uint32_t retries = 3;
while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
return false;
}
bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) {
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false;
@@ -264,4 +276,4 @@ bool SDIO_GetCmdResp7(void) {
return true;
}
#endif // __STM32F1__ && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
+4
View File
@@ -74,3 +74,7 @@
#if ENABLED(SDIO_SUPPORT) && DISABLED(SDSUPPORT)
#error "SDIO_SUPPORT requires SDSUPPORT. Enable SDSUPPORT to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4 -4
View File
@@ -45,11 +45,11 @@
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#define SET_PWM(IO) pinMode(IO, PWM) // do{ gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, GPIO_AF_OUTPUT_PP); timer_set_mode(PIN_MAP[pin].timer_device, PIN_MAP[pin].timer_channel, TIMER_PWM); }while(0)
#define GET_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
#define GET_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)
#define GET_TIMER(IO) (PIN_MAP[IO].timer_device != NULL)
#define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)
#define HAS_TIMER(IO) (PIN_MAP[IO].timer_device != NULL)
#define PWM_PIN(P) digitalPinHasPWM(P)
#define PWM_PIN(P) HAS_TIMER(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// digitalRead/Write wrappers
@@ -79,14 +79,15 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t si
}
// Now, write any remaining single byte
if (size & 1) {
const uint16_t odd = size & 1;
if (odd) {
uint16_t temp = value[size - 1];
status = FLASH_ProgramHalfWord(pageBase + pos + i, temp);
if (status != FLASH_COMPLETE) return true;
}
crc16(crc, value, size);
pos += ((size + 1) & ~1);
pos += size + odd;
return false;
}
@@ -97,7 +98,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
if (writing) value[i] = c;
crc16(crc, &c, 1);
}
pos += ((size + 1) & ~1);
pos += ((size + 1) & ~1); // i.e., size+(size&1), round up odd values
return false;
}
@@ -55,7 +55,7 @@ bool PersistentStore::access_start() {
bool PersistentStore::access_finish() {
if (!card.isDetected()) return false;
card.openFile(eeprom_filename, true);
card.openFile(eeprom_filename, false);
int16_t bytes_written = card.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
card.closefile();
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
@@ -26,7 +26,7 @@
* Communication interface for FSMC
*/
#if (defined(STM32F1) || defined(STM32F1xx)) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#include "../../inc/MarlinConfig.h"
@@ -267,4 +267,4 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
#endif // HAS_GRAPHICAL_LCD
#endif // (STM32F1 || STM32F1xx) && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
+4
View File
@@ -68,3 +68,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for STM32F4. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4 -4
View File
@@ -48,11 +48,11 @@
#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
#define GET_INPUT(IO)
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define IS_INPUT(IO)
#define IS_OUTPUT(IO)
#define HAS_TIMER(IO) true
#define PWM_PIN(P) true
#define PWM_PIN(P) HAS_TIMER(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// digitalRead/Write wrappers
+4
View File
@@ -70,3 +70,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for STM32F7. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4 -4
View File
@@ -47,11 +47,11 @@
#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
#define GET_INPUT(IO)
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define IS_INPUT(IO)
#define IS_OUTPUT(IO)
#define HAS_TIMER(IO) true
#define PWM_PIN(P) true
#define PWM_PIN(P) HAS_TIMER(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// digitalRead/Write wrappers
@@ -27,3 +27,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for Teensy 3.1/3.2. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
@@ -67,8 +67,8 @@
GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \
}while(0)
#define _GET_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _GET_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _IS_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define READ(IO) _READ(IO)
@@ -81,8 +81,8 @@
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
#define SET_PWM(IO) SET_OUTPUT(IO)
#define GET_INPUT(IO) _GET_INPUT(IO)
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
+3 -5
View File
@@ -49,6 +49,7 @@
#include "HAL_timers_Teensy.h"
#include <stdint.h>
#include <util/atomic.h>
#define ST7920_DELAY_1 DELAY_NS(600)
#define ST7920_DELAY_2 DELAY_NS(750)
@@ -58,9 +59,6 @@
// Defines
// --------------------------------------------------------------------------
#undef MOTHERBOARD
#define MOTHERBOARD BOARD_TEENSY35_36
#define IS_32BIT_TEENSY (defined(__MK64FX512__) || defined(__MK66FX1M0__))
#define IS_TEENSY35 defined(__MK64FX512__)
#define IS_TEENSY36 defined(__MK66FX1M0__)
@@ -87,9 +85,9 @@ typedef int8_t pin_t;
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
#endif
#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_START uint32_t primask = __get_primask(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_PRIMASK())
#define ISRS_ENABLED() (!__get_primask())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
@@ -27,3 +27,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for Teensy 3.5/3.6. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
@@ -66,8 +66,8 @@
GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \
}while(0)
#define _GET_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _GET_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _IS_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define READ(IO) _READ(IO)
@@ -80,8 +80,8 @@
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
#define SET_PWM(IO) SET_OUTPUT(IO)
#define GET_INPUT(IO) _GET_INPUT(IO)
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
+1
View File
@@ -30,6 +30,7 @@
#include "Marlin.h"
#include "core/utility.h"
#include "lcd/ultralcd.h"
#include "module/motion.h"
#include "module/planner.h"
+10
View File
@@ -57,6 +57,16 @@ void safe_delay(millis_t ms) {
#define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ')
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
// Convert a full-range unsigned 8bit int to a percentage
char* ui8tostr_percent(const uint8_t i) {
const uint8_t percent = ui8_to_percent(i);
conv[3] = RJDIGIT(percent, 100);
conv[4] = RJDIGIT(percent, 10);
conv[5] = DIGIMOD(percent, 1);
conv[6] = '%';
return &conv[3];
}
// Convert unsigned 8bit int to string 123 format
char* ui8tostr3(const uint8_t i) {
conv[4] = RJDIGIT(i, 100);
+8
View File
@@ -55,6 +55,9 @@ inline void serial_delay(const millis_t ms) {
#if ANY(ULTRA_LCD, DEBUG_LEVELING_FEATURE, EXTENSIBLE_UI)
// Convert a full-range unsigned 8bit int to a percentage
char* ui8tostr_percent(const uint8_t i);
// Convert uint8_t to string with 123 format
char* ui8tostr3(const uint8_t x);
@@ -135,3 +138,8 @@ public:
#define REMEMBER(N,X, ...) restorer<typeof(X)> restorer_##N(X, ##__VA_ARGS__)
#define RESTORE(N) restorer_##N.restore()
// Converts from an uint8_t in the range of 0-255 to an uint8_t
// in the range 0-100 while avoiding rounding artifacts
constexpr uint8_t ui8_to_percent(const uint8_t i) { return (int(i) * 100 + 127) / 255; }
constexpr uint8_t all_on = 0xFF, all_off = 0x00;
+12 -10
View File
@@ -36,7 +36,7 @@ void stop();
#include "../core/debug_out.h"
void BLTouch::command(const BLTCommand cmd) {
SERIAL_ECHOLNPAIR("BLTouch Command :", cmd);
//SERIAL_ECHOLNPAIR("BLTouch Command :", cmd);
MOVE_SERVO(Z_PROBE_SERVO_NR, cmd);
safe_delay(BLTOUCH_DELAY);
}
@@ -70,19 +70,21 @@ bool BLTouch::set_deployed(const bool in_deploy) {
}
}
#if ENABLED(BLTOUCH_FORCE_5V_MODE)
set_5V_mode();
#elif ENABLED(BLTOUCH_FORCE_OPEN_DRAIN_MODE)
set_OD_mode();
#elif ENABLED(ENDSTOPPULLUPS) || ALL(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, ENDSTOPPULLUP_ZMIN) || (USES_Z_MIN_PROBE_ENDSTOP && ENABLED(ENDSTOPPULLUP_ZMIN_PROBE))
set_5V_mode(); // Assume 5V DC logic level if endstop pullup resistors are enabled
#else
set_OD_mode();
#if ENABLED(BLTOUCH_V3)
#if EITHER(BLTOUCH_FORCE_5V_MODE, ENDSTOPPULLUPS) \
|| ALL(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, ENDSTOPPULLUP_ZMIN) \
|| (USES_Z_MIN_PROBE_ENDSTOP && ENABLED(ENDSTOPPULLUP_ZMIN_PROBE))
set_5V_mode(); // Assume 5V DC logic level if endstop pullup resistors are enabled
#elif true || ENABLED(BLTOUCH_FORCE_OPEN_DRAIN_MODE)
set_OD_mode();
#endif
#endif
if (in_deploy) {
_deploy();
set_SW_mode(); // Ensure Switch mode is activated for BLTouch V3. Ignored on V2.
#if ENABLED(BLTOUCH_V3)
set_SW_mode();
#endif
}
else _stow();
+4 -3
View File
@@ -41,13 +41,14 @@ public:
static bool triggered();
FORCE_INLINE static void reset() { command(BLTOUCH_RESET); }
FORCE_INLINE static void selftest() { command(BLTOUCH_SELFTEST); }
FORCE_INLINE static void set_5V_mode() { command(BLTOUCH_5V_MODE); }
FORCE_INLINE static void set_OD_mode() { command(BLTOUCH_OD_MODE); }
FORCE_INLINE static void set_SW_mode() { command(BLTOUCH_SW_MODE); }
FORCE_INLINE static void selftest() { command(BLTOUCH_SELFTEST); }
FORCE_INLINE static bool deploy() { return set_deployed(true); }
FORCE_INLINE static bool stow() { return set_deployed(false); }
FORCE_INLINE static bool deploy() { return set_deployed(true); }
FORCE_INLINE static bool stow() { return set_deployed(false); }
FORCE_INLINE static void _deploy() { command(BLTOUCH_DEPLOY); }
FORCE_INLINE static void _stow() { command(BLTOUCH_STOW); }
+1 -1
View File
@@ -209,7 +209,7 @@ class Mixer {
// Refresh the gradient after a change
static void refresh_gradient() {
#if ENABLED(GRADIENT_VTOOL)
const bool is_grd = (selected_vtool == gradient.vtool_index || gradient.vtool_index == -1);
const bool is_grd = (gradient.vtool_index == -1 || selected_vtool == (uint8_t)gradient.vtool_index);
#else
constexpr bool is_grd = true;
#endif
@@ -185,6 +185,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
info.retract_hop = fwretract.current_hop;
#endif
//relative mode
info.relative_mode = relative_mode;
info.relative_modes_e = gcode.axis_relative_modes[E_AXIS];
// Commands in the queue
info.commands_in_queue = save_queue ? commands_in_queue : 0;
info.cmd_queue_index_r = cmd_queue_index_r;
@@ -218,6 +222,8 @@ void PrintJobRecovery::write() {
open(false);
file.seekSet(0);
const int16_t ret = file.write(&info, sizeof(info));
close();
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
if (ret == -1) SERIAL_ECHOLNPGM("Power-loss file write failed.");
#else
@@ -339,6 +345,10 @@ void PrintJobRecovery::resume() {
sprintf_P(cmd, PSTR("G1 F%d"), info.feedrate);
gcode.process_subcommands_now(cmd);
//relative mode
if (info.relative_mode) relative_mode = true;
if (info.relative_modes_e) gcode.axis_relative_modes[E_AXIS] = true;
// Process commands from the old pending queue
uint8_t c = info.commands_in_queue, r = info.cmd_queue_index_r;
for (; c--; r = (r + 1) % BUFSIZE)
+3
View File
@@ -76,6 +76,9 @@ typedef struct {
#endif
#endif
// Relative mode
bool relative_mode, relative_modes_e;
// Command queue
uint8_t commands_in_queue, cmd_queue_index_r;
char command_queue[BUFSIZE][MAX_CMD_SIZE];
+19 -8
View File
@@ -688,6 +688,12 @@ void GcodeSuite::G26() {
set_current_from_destination();
}
#if DISABLED(NO_VOLUMETRICS)
bool volumetric_was_enabled = parser.volumetric_enabled;
parser.volumetric_enabled = false;
planner.calculate_volumetric_multipliers();
#endif
if (turn_on_heaters() != G26_OK) goto LEAVE;
current_position[E_AXIS] = 0.0;
@@ -769,10 +775,14 @@ void GcodeSuite::G26() {
// Figure out where to start and end the arc - we always print counterclockwise
if (xi == 0) { // left edge
sx = f ? circle_x + INTERSECTION_CIRCLE_RADIUS : circle_x;
ex = b ? circle_x + INTERSECTION_CIRCLE_RADIUS : circle_x;
sy = f ? circle_y : circle_y - (INTERSECTION_CIRCLE_RADIUS);
ey = b ? circle_y : circle_y + INTERSECTION_CIRCLE_RADIUS;
if (!f) {
sx = circle_x;
sy -= (INTERSECTION_CIRCLE_RADIUS);
}
if (!b) {
ex = circle_x;
ey += INTERSECTION_CIRCLE_RADIUS;
}
arc_length = (f || b) ? ARC_LENGTH(1) : ARC_LENGTH(2);
}
else if (r) { // right edge
@@ -783,15 +793,11 @@ void GcodeSuite::G26() {
arc_length = (f || b) ? ARC_LENGTH(1) : ARC_LENGTH(2);
}
else if (f) {
sx = circle_x + INTERSECTION_CIRCLE_RADIUS;
ex = circle_x - (INTERSECTION_CIRCLE_RADIUS);
sy = ey = circle_y;
arc_length = ARC_LENGTH(2);
}
else if (b) {
sx = circle_x - (INTERSECTION_CIRCLE_RADIUS);
ex = circle_x + INTERSECTION_CIRCLE_RADIUS;
sy = ey = circle_y;
arc_length = ARC_LENGTH(2);
}
const float arc_offset[2] = {
@@ -911,6 +917,11 @@ void GcodeSuite::G26() {
move_to(destination, 0); // Move back to the starting position
//debug_current_and_destination(PSTR("done doing X/Y move."));
#if DISABLED(NO_VOLUMETRICS)
parser.volumetric_enabled = volumetric_was_enabled;
planner.calculate_volumetric_multipliers();
#endif
#if HAS_LCD_MENU
ui.release(); // Give back control of the LCD
#endif
+1 -1
View File
@@ -417,7 +417,7 @@ void GcodeSuite::G28(const bool always_home_all) {
// Restore the active tool after homing
#if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
#if ENABLED(PARKING_EXTRUDER)
#if ENABLED(PARKING_EXTRUDER) || ENABLED(DUAL_X_CARRIAGE)
#define NO_FETCH false // fetch the previous toolhead
#else
#define NO_FETCH true
+7 -6
View File
@@ -56,7 +56,8 @@
#define HAS_Y_CENTER BOTH(CALIBRATION_MEASURE_FRONT, CALIBRATION_MEASURE_BACK)
#if ENABLED(BACKLASH_GCODE)
extern float backlash_distance_mm[], backlash_correction, backlash_smoothing_mm;
extern float backlash_distance_mm[], backlash_smoothing_mm;
extern uint8_t backlash_correction;
#endif
enum side_t : uint8_t { TOP, RIGHT, FRONT, LEFT, BACK, NUM_SIDES };
@@ -446,7 +447,7 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) {
{
// New scope for TEMPORARY_BACKLASH_CORRECTION
TEMPORARY_BACKLASH_CORRECTION(0.0f);
TEMPORARY_BACKLASH_CORRECTION(all_off);
TEMPORARY_BACKLASH_SMOOTHING(0.0f);
probe_sides(m, uncertainty);
@@ -478,7 +479,7 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) {
{
// New scope for TEMPORARY_BACKLASH_CORRECTION
TEMPORARY_BACKLASH_CORRECTION(1.0f);
TEMPORARY_BACKLASH_CORRECTION(all_on);
TEMPORARY_BACKLASH_SMOOTHING(0.0f);
move_to(
X_AXIS, current_position[X_AXIS] + 3,
@@ -513,7 +514,7 @@ inline void update_measurements(measurements_t &m, const AxisEnum axis) {
* - Call calibrate_backlash() beforehand for best accuracy
*/
inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const uint8_t extruder) {
TEMPORARY_BACKLASH_CORRECTION(1.0f);
TEMPORARY_BACKLASH_CORRECTION(all_on);
TEMPORARY_BACKLASH_SMOOTHING(0.0f);
#if HOTENDS > 1
@@ -556,7 +557,7 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const
* uncertainty in - How far away from the object to begin probing
*/
inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty) {
TEMPORARY_BACKLASH_CORRECTION(1.0f);
TEMPORARY_BACKLASH_CORRECTION(all_on);
TEMPORARY_BACKLASH_SMOOTHING(0.0f);
HOTEND_LOOP() calibrate_toolhead(m, uncertainty, e);
@@ -588,7 +589,7 @@ inline void calibrate_all() {
reset_hotend_offsets();
#endif
TEMPORARY_BACKLASH_CORRECTION(1.0f);
TEMPORARY_BACKLASH_CORRECTION(all_on);
TEMPORARY_BACKLASH_SMOOTHING(0.0f);
// Do a fast and rough calibration of the toolheads
+4 -5
View File
@@ -26,8 +26,8 @@
#include "../../module/planner.h"
float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM,
backlash_correction = BACKLASH_CORRECTION;
float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
uint8_t backlash_correction = BACKLASH_CORRECTION * all_on;
#ifdef BACKLASH_SMOOTHING_MM
float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM;
@@ -74,7 +74,7 @@ void GcodeSuite::M425() {
if (parser.seen('F')) {
planner.synchronize();
backlash_correction = MAX(0, MIN(1.0, parser.value_linear_units()));
backlash_correction = MAX(0, MIN(1.0, parser.value_float())) * all_on;
noArgs = false;
}
@@ -90,8 +90,7 @@ void GcodeSuite::M425() {
SERIAL_ECHOPGM("Backlash correction is ");
if (!backlash_correction) SERIAL_ECHOPGM("in");
SERIAL_ECHOLNPGM("active:");
SERIAL_ECHOPAIR(" Correction Amount/Fade-out: F", backlash_correction);
SERIAL_ECHOLNPGM(" (F1.0 = full, F0.0 = none)");
SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", float(ui8_to_percent(backlash_correction)) / 100, " (F1.0 = full, F0.0 = none)");
SERIAL_ECHOPGM(" Backlash Distance (mm): ");
LOOP_XYZ(a) {
SERIAL_CHAR(' ');
+94 -24
View File
@@ -28,45 +28,115 @@
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#if ENABLED(EXTRA_LIN_ADVANCE_K)
float saved_extruder_advance_K[EXTRUDERS];
uint8_t lin_adv_slot = 0;
#endif
/**
* M900: Get or Set Linear Advance K-factor
*
* K<factor> Set advance K factor
* T<tool> Which tool to address
* K<factor> Set current advance K factor (Slot 0).
* L<factor> Set secondary advance K factor (Slot 1). Requires EXTRA_LIN_ADVANCE_K.
* S<0/1> Activate slot 0 or 1. Requires EXTRA_LIN_ADVANCE_K.
*/
void GcodeSuite::M900() {
#if EXTRUDERS < 2
constexpr uint8_t tmp_extruder = 0;
#else
const uint8_t tmp_extruder = parser.seenval('T') ? parser.value_int() : active_extruder;
const uint8_t tmp_extruder = parser.intval('T', active_extruder);
if (tmp_extruder >= EXTRUDERS) {
SERIAL_ECHOLNPGM("?T value out of range.");
return;
}
#endif
if (parser.seenval('K')) {
const float newK = parser.floatval('K');
if (WITHIN(newK, 0, 10)) {
planner.synchronize();
planner.extruder_advance_K[tmp_extruder] = newK;
}
else
SERIAL_ECHOLNPGM("?K value out of range (0-10).");
}
else {
SERIAL_ECHO_START();
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]);
#else
SERIAL_ECHOPGM("Advance K");
LOOP_L_N(i, EXTRUDERS) {
SERIAL_CHAR(' '); SERIAL_ECHO(int(i));
SERIAL_CHAR('='); SERIAL_ECHO(planner.extruder_advance_K[i]);
#if ENABLED(EXTRA_LIN_ADVANCE_K)
bool ext_slot = bitRead(lin_adv_slot, tmp_extruder);
if (parser.seenval('S')) {
const bool slot = parser.value_bool();
if (ext_slot != slot) {
ext_slot = slot;
bitWrite(lin_adv_slot, tmp_extruder, slot);
planner.synchronize();
const float temp = planner.extruder_advance_K[tmp_extruder];
planner.extruder_advance_K[tmp_extruder] = saved_extruder_advance_K[tmp_extruder];
saved_extruder_advance_K[tmp_extruder] = temp;
}
SERIAL_EOL();
#endif
}
}
if (parser.seenval('K')) {
const float newK = parser.value_float();
if (WITHIN(newK, 0, 10)) {
if (ext_slot)
saved_extruder_advance_K[tmp_extruder] = newK;
else {
planner.synchronize();
planner.extruder_advance_K[tmp_extruder] = newK;
}
}
else
SERIAL_ECHOLNPGM("?K value out of range (0-10).");
}
if (parser.seenval('L')) {
const float newL = parser.value_float();
if (WITHIN(newL, 0, 10)) {
if (!ext_slot)
saved_extruder_advance_K[tmp_extruder] = newL;
else {
planner.synchronize();
planner.extruder_advance_K[tmp_extruder] = newL;
}
}
else
SERIAL_ECHOLNPGM("?L value out of range (0-10).");
}
if (!parser.seen_any()) {
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR("Advance S", ext_slot, " K", planner.extruder_advance_K[0]);
SERIAL_ECHOLNPAIR("(Slot ", 1 - ext_slot, " K", saved_extruder_advance_K[0], ")");
#else
LOOP_L_N(i, EXTRUDERS) {
const int slot = (int)bitRead(lin_adv_slot, i);
SERIAL_ECHOLNPAIR("Advance T", int(i), " S", slot, " K", planner.extruder_advance_K[i]);
SERIAL_ECHOLNPAIR("(Slot ", 1 - slot, " K", saved_extruder_advance_K[i], ")");
SERIAL_EOL();
}
#endif
}
#else
if (parser.seenval('K')) {
const float newK = parser.value_float();
if (WITHIN(newK, 0, 10)) {
planner.synchronize();
planner.extruder_advance_K[tmp_extruder] = newK;
}
else
SERIAL_ECHOLNPGM("?K value out of range (0-10).");
}
else {
SERIAL_ECHO_START();
#if EXTRUDERS < 2
SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]);
#else
SERIAL_ECHOPGM("Advance K");
LOOP_L_N(i, EXTRUDERS) {
SERIAL_CHAR(' '); SERIAL_ECHO(int(i));
SERIAL_CHAR('='); SERIAL_ECHO(planner.extruder_advance_K[i]);
}
SERIAL_EOL();
#endif
}
#endif
}
#endif // LIN_ADVANCE
+1 -1
View File
@@ -50,7 +50,7 @@ void GcodeSuite::M413() {
if (parser.seen('R') || parser.seen('L')) recovery.load();
if (parser.seen('W')) recovery.save(true);
if (parser.seen('P')) recovery.purge();
if (parser.seen('E')) serialprintPGM(recovery.exists() ? PSTR("BIN Exists\n") : PSTR("No BIN\n"));
if (parser.seen('E')) serialprintPGM(recovery.exists() ? PSTR("PLR Exists\n") : PSTR("No PLR\n"));
if (parser.seen('V')) serialprintPGM(recovery.valid() ? PSTR("Valid\n") : PSTR("Invalid\n"));
#endif
}
+12 -2
View File
@@ -83,18 +83,28 @@ void plan_arc(
// CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required.
float angular_travel = ATAN2(r_P * rt_Y - r_Q * rt_X, r_P * rt_X + r_Q * rt_Y);
if (angular_travel < 0) angular_travel += RADIANS(360);
#ifdef MIN_ARC_SEGMENTS
uint16_t min_segments = CEIL((MIN_ARC_SEGMENTS) * (angular_travel / RADIANS(360)));
NOLESS(min_segments, 1U);
#else
constexpr uint16_t min_segments = 1;
#endif
if (clockwise) angular_travel -= RADIANS(360);
// Make a circle if the angular rotation is 0 and the target is current position
if (angular_travel == 0 && current_position[p_axis] == cart[p_axis] && current_position[q_axis] == cart[q_axis])
if (angular_travel == 0 && current_position[p_axis] == cart[p_axis] && current_position[q_axis] == cart[q_axis]) {
angular_travel = RADIANS(360);
#ifdef MIN_ARC_SEGMENTS
min_segments = MIN_ARC_SEGMENTS;
#endif
}
const float flat_mm = radius * angular_travel,
mm_of_travel = linear_travel ? HYPOT(flat_mm, linear_travel) : ABS(flat_mm);
if (mm_of_travel < 0.001f) return;
uint16_t segments = FLOOR(mm_of_travel / (MM_PER_ARC_SEGMENT));
if (segments == 0) segments = 1;
NOLESS(segments, min_segments);
/**
* Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector,
+3 -3
View File
@@ -33,7 +33,7 @@
#define _CNT_P EXTRUDERS
#else
#define _ALT_P MIN(active_extruder, FAN_COUNT - 1)
#define _CNT_P MIN(EXTRUDERS, FAN_COUNT)
#define _CNT_P FAN_COUNT
#endif
/**
@@ -58,8 +58,8 @@ void GcodeSuite::M106() {
const uint16_t t = parser.intval('T');
if (t > 0) return thermalManager.set_temp_fan_speed(p, t);
#endif
uint16_t s = parser.ushortval('S', 255);
uint16_t d = parser.seen('A') ? thermalManager.fan_speed[active_extruder] : 255;
uint16_t s = parser.ushortval('S', d);
NOMORE(s, 255U);
thermalManager.set_fan_speed(p, s);
-4
View File
@@ -2015,10 +2015,6 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#error "POWER_LOSS_RECOVERY currently requires an LCD Controller."
#endif
#if ENABLED(FAST_PWM_FAN) && !(defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM))
#error "FAST_PWM_FAN is only supported for ARDUINO and ARDUINO_ARCH_SAM."
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
#if !Z_MULTI_STEPPER_DRIVERS
#error "Z_STEPPER_AUTO_ALIGN requires Z_DUAL_STEPPER_DRIVERS or Z_TRIPLE_STEPPER_DRIVERS."
+1 -1
View File
@@ -39,7 +39,7 @@
/**
* Marlin release version identifier
*/
#define SHORT_BUILD_VERSION "2.0.x_TR10"
#define SHORT_BUILD_VERSION "2.0.x_TR11"
/**
* Verbose version identifier which should contain a reference to the location
+1 -1
View File
@@ -47,7 +47,7 @@
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
#if defined(STM32F1) || defined(STM32F1xx)
#if defined(ARDUINO_ARCH_STM32F1)
uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn
#else
+127 -9
View File
@@ -74,21 +74,23 @@
#define IFSD(A,B) (B)
#endif
#if HAS_TRINAMIC && HAS_LCD_MENU
#if HAS_TRINAMIC
#include "../../feature/tmc_util.h"
#include "../../module/stepper_indirection.h"
#endif
#include "ui_api.h"
#if ENABLED(BACKLASH_GCODE)
extern float backlash_distance_mm[XYZ], backlash_correction;
extern float backlash_distance_mm[XYZ];
extern uint8_t backlash_correction;
#ifdef BACKLASH_SMOOTHING_MM
extern float backlash_smoothing_mm;
#endif
#endif
#if HAS_LEVELING
#include "../../feature/bedlevel.h"
#include "../../feature/bedlevel/bedlevel.h"
#endif
#if HAS_FILAMENT_SENSOR
@@ -339,6 +341,126 @@ namespace ExtUI {
return !thermalManager.tooColdToExtrude(extruder - E0);
}
#if HAS_SOFTWARE_ENDSTOPS
bool getSoftEndstopState() {
return soft_endstops_enabled;
}
void setSoftEndstopState(const bool value) {
soft_endstops_enabled = value;
}
#endif
#if HAS_TRINAMIC
float getAxisCurrent_mA(const axis_t axis) {
switch (axis) {
#if AXIS_IS_TMC(X)
case X: return stepperX.getMilliamps();
#endif
#if AXIS_IS_TMC(Y)
case Y: return stepperY.getMilliamps();
#endif
#if AXIS_IS_TMC(Z)
case Z: return stepperZ.getMilliamps();
#endif
default: return NAN;
};
}
float getAxisCurrent_mA(const extruder_t extruder) {
switch (extruder) {
#if AXIS_IS_TMC(E0)
case E0: return stepperE0.getMilliamps();
#endif
#if AXIS_IS_TMC(E1)
case E1: return stepperE1.getMilliamps();
#endif
#if AXIS_IS_TMC(E2)
case E2: return stepperE2.getMilliamps();
#endif
#if AXIS_IS_TMC(E3)
case E3: return stepperE3.getMilliamps();
#endif
#if AXIS_IS_TMC(E4)
case E4: return stepperE4.getMilliamps();
#endif
#if AXIS_IS_TMC(E5)
case E5: return stepperE5.getMilliamps();
#endif
default: return NAN;
};
}
void setAxisCurrent_mA(const float mA, const axis_t axis) {
switch (axis) {
#if AXIS_IS_TMC(X)
case X: stepperX.rms_current(clamp(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(Y)
case Y: stepperY.rms_current(clamp(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(Z)
case Z: stepperZ.rms_current(clamp(mA, 500, 1500)); break;
#endif
default: break;
};
}
void setAxisCurrent_mA(const float mA, const extruder_t extruder) {
switch (extruder) {
#if AXIS_IS_TMC(E0)
case E0: stepperE0.rms_current(clamp(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(E1)
case E1: stepperE1.rms_current(clamp(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(E2)
case E2: stepperE2.rms_current(clamp(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(E3)
case E3: stepperE3.rms_current(clamp(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(E4)
case E4: stepperE4.rms_current(clamp(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(E5)
case E5: stepperE5.rms_current(clamp(mA, 500, 1500)); break;
#endif
default: break;
};
}
int getTMCBumpSensitivity(const axis_t axis) {
switch (axis) {
#if X_SENSORLESS && AXIS_HAS_STALLGUARD(X)
case X: return stepperX.sgt();
#endif
#if Y_SENSORLESS && AXIS_HAS_STALLGUARD(Y)
case Y: return stepperY.sgt();
#endif
#if Z_SENSORLESS && AXIS_HAS_STALLGUARD(Z)
case Z: return stepperZ.sgt();
#endif
default: return 0;
}
}
void setTMCBumpSensitivity(const float value, const axis_t axis) {
switch (axis) {
#if X_SENSORLESS && AXIS_HAS_STALLGUARD(X)
case X: stepperX.sgt(clamp(value, -64, 63)); break;
#endif
#if Y_SENSORLESS && AXIS_HAS_STALLGUARD(Y)
case Y: stepperY.sgt(clamp(value, -64, 63)); break;
#endif
#if Z_SENSORLESS && AXIS_HAS_STALLGUARD(Z)
case Z: stepperZ.sgt(clamp(value, -64, 63)); break;
#endif
default: break;
}
}
#endif
float getAxisSteps_per_mm(const axis_t axis) {
return planner.settings.axis_steps_per_mm[axis];
}
@@ -565,8 +687,8 @@ namespace ExtUI {
void setAxisBacklash_mm(const float value, const axis_t axis)
{ backlash_distance_mm[axis] = clamp(value,0,5); }
float getBacklashCorrection_percent() { return backlash_correction * 100; }
void setBacklashCorrection_percent(const float value) { backlash_correction = clamp(value, 0, 100) / 100.0f; }
float getBacklashCorrection_percent() { return ui8_to_percent(backlash_correction); }
void setBacklashCorrection_percent(const float value) { backlash_correction = map(clamp(value, 0, 100), 0, 100, 0, 255); }
#ifdef BACKLASH_SMOOTHING_MM
float getBacklashSmoothing_mm() { return backlash_smoothing_mm; }
@@ -787,10 +909,6 @@ void MarlinUI::init() {
SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif
#if HAS_TRINAMIC && HAS_LCD_MENU
init_tmc_section();
#endif
ExtUI::onStartup();
}
+15
View File
@@ -68,6 +68,21 @@ namespace ExtUI {
*/
PGM_P getFirmwareName_str();
#if HAS_SOFTWARE_ENDSTOPS
bool getSoftEndstopState();
void setSoftEndstopState(const bool);
#endif
#if HAS_TRINAMIC
float getAxisCurrent_mA(const axis_t);
float getAxisCurrent_mA(const extruder_t);
void setAxisCurrent_mA(const float, const axis_t);
void setAxisCurrent_mA(const float, const extruder_t);
int getTMCBumpSensitivity(const axis_t);
void setTMCBumpSensitivity(const float, const axis_t);
#endif
float getActualTemp_celsius(const heater_t);
float getActualTemp_celsius(const extruder_t);
float getTargetTemp_celsius(const heater_t);
+10
View File
@@ -1386,3 +1386,13 @@
#ifndef MSG_SERVICE_IN
#define MSG_SERVICE_IN _UxGT(" in:")
#endif
#ifndef MSG_BACKLASH
#define MSG_BACKLASH _UxGT("Backlash")
#endif
#ifndef MSG_BACKLASH_CORRECTION
#define MSG_BACKLASH_CORRECTION _UxGT("Correction")
#endif
#ifndef MSG_BACKLASH_SMOOTHING
#define MSG_BACKLASH_SMOOTHING _UxGT("Smoothing")
#endif
+1 -1
View File
@@ -357,7 +357,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
void lcd_babystep_zoffset() {
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
ui.defer_status_screen(true);
ui.defer_status_screen();
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
const bool do_probe = (active_extruder == 0);
#else
+3
View File
@@ -43,6 +43,7 @@ bool printer_busy();
static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \
};
DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr_percent,1 ); // 100% right-justified
DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1 ); // 123, -12 right-justified
DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified
DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified
@@ -102,6 +103,7 @@ FORCE_INLINE void draw_menu_item_edit_P(const bool sel, const uint8_t row, PGM_P
typedef void NAME##_void
#define DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(NAME) _DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(MenuItemInfo_##NAME::type_t, NAME, MenuItemInfo_##NAME::strfunc)
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(percent); // 100% right-justified
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int3); // 123, -12 right-justified
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int4); // 1234, -123 right-justified
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int8); // 123, -12 right-justified
@@ -174,6 +176,7 @@ class TMenuItem : MenuItemBase {
#define DECLARE_MENU_EDIT_ITEM(NAME) typedef TMenuItem<MenuItemInfo_##NAME> MenuItem_##NAME;
DECLARE_MENU_EDIT_ITEM(percent);
DECLARE_MENU_EDIT_ITEM(int3);
DECLARE_MENU_EDIT_ITEM(int4);
DECLARE_MENU_EDIT_ITEM(int8);
+5
View File
@@ -49,6 +49,7 @@
#endif
void menu_tmc();
void menu_backlash();
#if ENABLED(DAC_STEPPER_CURRENT)
@@ -647,6 +648,10 @@ void menu_advanced_settings() {
}
#endif // !SLIM_LCD_MENUS
#if ENABLED(BACKLASH_GCODE)
MENU_ITEM(submenu, MSG_BACKLASH, menu_backlash);
#endif
#if ENABLED(DAC_STEPPER_CURRENT)
MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_dac);
#endif
+58
View File
@@ -0,0 +1,58 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
//
// Backlash Menu
//
#include "../../inc/MarlinConfigPre.h"
#if HAS_LCD_MENU && ENABLED(BACKLASH_GCODE)
#include "menu.h"
extern float backlash_distance_mm[XYZ];
extern uint8_t backlash_correction;
#ifdef BACKLASH_SMOOTHING_MM
extern float backlash_smoothing_mm;
#endif
void menu_backlash() {
START_MENU();
MENU_BACK(MSG_MAIN);
MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_BACKLASH_CORRECTION, &backlash_correction, all_off, all_on);
#define EDIT_BACKLASH_DISTANCE(N) MENU_MULTIPLIER_ITEM_EDIT(float43, MSG_##N, &backlash_distance_mm[_AXIS(N)], 0.0f, 9.9f);
EDIT_BACKLASH_DISTANCE(A);
EDIT_BACKLASH_DISTANCE(B);
EDIT_BACKLASH_DISTANCE(C);
#ifdef BACKLASH_SMOOTHING_MM
MENU_MULTIPLIER_ITEM_EDIT(float43, MSG_BACKLASH_SMOOTHING, &backlash_smoothing_mm, 0.0f, 9.9f);
#endif
END_MENU();
}
#endif // HAS_LCD_MENU && BACKLASH_COMPENSATION
+29 -6
View File
@@ -32,6 +32,10 @@
#include "../../module/motion.h"
#include "../../module/planner.h"
#if HAS_LEVELING
#include "../../feature/bedlevel/bedlevel.h"
#endif
#ifndef LEVEL_CORNERS_Z_HOP
#define LEVEL_CORNERS_Z_HOP 4.0
#endif
@@ -42,11 +46,22 @@
static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Please update your configuration.");
#if HAS_LEVELING
static bool leveling_was_active = false;
#endif
static inline void _lcd_level_bed_corners_back() {
#if HAS_LEVELING
set_bed_leveling_enabled(leveling_was_active);
#endif
ui.goto_previous_screen_no_defer();
}
/**
* Level corners, starting in the front-left corner.
*/
static int8_t bed_corner;
void _lcd_goto_next_corner() {
static inline void _lcd_goto_next_corner() {
line_to_z(LEVEL_CORNERS_Z_HOP);
switch (bed_corner) {
case 0:
@@ -78,7 +93,7 @@ void _lcd_goto_next_corner() {
) bed_corner = 0;
}
void menu_level_bed_corners() {
static inline void menu_level_bed_corners() {
START_MENU();
MENU_ITEM(function,
#if ENABLED(LEVEL_CENTER_TOO)
@@ -86,12 +101,13 @@ void menu_level_bed_corners() {
#else
MSG_NEXT_CORNER
#endif
, _lcd_goto_next_corner);
MENU_ITEM(function, MSG_BACK, ui.goto_previous_screen_no_defer);
, _lcd_goto_next_corner
);
MENU_ITEM(function, MSG_BACK, _lcd_level_bed_corners_back);
END_MENU();
}
void _lcd_level_bed_corners_homing() {
static inline void _lcd_level_bed_corners_homing() {
_lcd_draw_homing();
if (all_axes_homed()) {
bed_corner = 0;
@@ -101,11 +117,18 @@ void _lcd_level_bed_corners_homing() {
}
void _lcd_level_bed_corners() {
ui.defer_status_screen(true);
ui.defer_status_screen();
if (!all_axes_known()) {
set_all_unhomed();
enqueue_and_echo_commands_P(PSTR("G28"));
}
// Disable leveling so the planner won't mess with us
#if HAS_LEVELING
leveling_was_active = planner.leveling_active;
set_bed_leveling_enabled(false);
#endif
ui.goto_screen(_lcd_level_bed_corners_homing);
}
+1 -1
View File
@@ -191,7 +191,7 @@
// Step 2: Continue Bed Leveling...
//
void _lcd_level_bed_continue() {
ui.defer_status_screen(true);
ui.defer_status_screen();
set_all_unhomed();
ui.goto_screen(_lcd_level_bed_homing);
enqueue_and_echo_commands_P(PSTR("G28"));
+1 -1
View File
@@ -50,7 +50,7 @@ void _man_probe_pt(const float &rx, const float &ry) {
float lcd_probe_pt(const float &rx, const float &ry) {
_man_probe_pt(rx, ry);
KEEPALIVE_STATE(PAUSED_FOR_USER);
ui.defer_status_screen(true);
ui.defer_status_screen();
wait_for_user = true;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), PSTR("Continue"));
+1 -1
View File
@@ -528,7 +528,7 @@ void lcd_pause_show_message(
hotend_status_extruder = extruder;
const screenFunc_t next_screen = ap_message_screen(message);
if (next_screen) {
ui.defer_status_screen(true);
ui.defer_status_screen();
ui.goto_screen(next_screen);
}
else
+1 -1
View File
@@ -45,7 +45,7 @@ static void lcd_power_loss_recovery_cancel() {
}
void menu_job_recovery() {
ui.defer_status_screen(true);
ui.defer_status_screen();
START_MENU();
STATIC_ITEM(MSG_OUTAGE_RECOVERY);
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_power_loss_recovery_resume);
+2 -2
View File
@@ -40,7 +40,7 @@
#if ENABLED(GRADIENT_MIX)
void lcd_mixer_gradient_z_start_edit() {
ui.defer_status_screen(true);
ui.defer_status_screen();
ui.encoder_direction_normal();
ENCODER_RATE_MULTIPLY(true);
if (ui.encoderPosition != 0) {
@@ -65,7 +65,7 @@
}
void lcd_mixer_gradient_z_end_edit() {
ui.defer_status_screen(true);
ui.defer_status_screen();
ui.encoder_direction_normal();
ENCODER_RATE_MULTIPLY(true);
if (ui.encoderPosition != 0) {
+2 -2
View File
@@ -197,14 +197,14 @@ void menu_mmu2_pause() {
}
void mmu2_M600() {
ui.defer_status_screen(true);
ui.defer_status_screen();
ui.goto_screen(menu_mmu2_pause);
mmuMenuWait = true;
while (mmuMenuWait) idle();
}
uint8_t mmu2_chooseFilament() {
ui.defer_status_screen(true);
ui.defer_status_screen();
ui.goto_screen(menu_mmu2_chooseFilament);
mmuMenuWait = true;
while (mmuMenuWait) idle();
+1 -1
View File
@@ -235,7 +235,7 @@ inline void lcd_move_e() { _lcd_move_e(); }
screenFunc_t _manual_move_func_ptr;
void _goto_manual_move(const float scale) {
ui.defer_status_screen(true);
ui.defer_status_screen();
move_menu_scale = scale;
ui.goto_screen(_manual_move_func_ptr);
}
+1 -1
View File
@@ -64,7 +64,7 @@ void lcd_sd_updir() {
goto_screen(menu_sdcard, last_sdfile_encoderPosition);
last_sdfile_encoderPosition = 0xFFFF;
defer_status_screen(true);
defer_status_screen();
//#if HAS_GRAPHICAL_LCD
// update();
+6 -6
View File
@@ -395,21 +395,21 @@ void menu_temperature() {
//
#if FAN_COUNT > 0
#if HAS_FAN0
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(uint8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.lcd_tmpfan_speed[0], 0, 255, thermalManager.lcd_setFanSpeed0);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(percent, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.lcd_tmpfan_speed[0], 0, 255, thermalManager.lcd_setFanSpeed0);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255);
#endif
#endif
#if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1)
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(uint8, MSG_FAN_SPEED " 2", &thermalManager.lcd_tmpfan_speed[1], 0, 255, thermalManager.lcd_setFanSpeed1);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(percent, MSG_FAN_SPEED " 2", &thermalManager.lcd_tmpfan_speed[1], 0, 255, thermalManager.lcd_setFanSpeed1);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED " 2", &thermalManager.new_fan_speed[1], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_EXTRA_FAN_SPEED " 2", &thermalManager.new_fan_speed[1], 3, 255);
#endif
#endif
#if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2)
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(uint8, MSG_FAN_SPEED " 3", &thermalManager.lcd_tmpfan_speed[2], 0, 255, thermalManager.lcd_setFanSpeed2);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(percent, MSG_FAN_SPEED " 3", &thermalManager.lcd_tmpfan_speed[2], 0, 255, thermalManager.lcd_setFanSpeed2);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED " 3", &thermalManager.new_fan_speed[2], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_EXTRA_FAN_SPEED " 3", &thermalManager.new_fan_speed[2], 3, 255);
#endif
#endif
#endif // FAN_COUNT > 0
+3 -3
View File
@@ -84,13 +84,13 @@
#if ENABLED(BABYSTEP_XY)
void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); }
void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); }
void lcd_babystep_x() { ui.goto_screen(_lcd_babystep_x); babysteps_done = 0; ui.defer_status_screen(true); }
void lcd_babystep_y() { ui.goto_screen(_lcd_babystep_y); babysteps_done = 0; ui.defer_status_screen(true); }
void lcd_babystep_x() { ui.goto_screen(_lcd_babystep_x); babysteps_done = 0; ui.defer_status_screen(); }
void lcd_babystep_y() { ui.goto_screen(_lcd_babystep_y); babysteps_done = 0; ui.defer_status_screen(); }
#endif
#if DISABLED(BABYSTEP_ZPROBE_OFFSET)
void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); }
void lcd_babystep_z() { ui.goto_screen(_lcd_babystep_z); babysteps_done = 0; ui.defer_status_screen(true); }
void lcd_babystep_z() { ui.goto_screen(_lcd_babystep_z); babysteps_done = 0; ui.defer_status_screen(); }
#endif
#endif // BABYSTEPPING
+42 -16
View File
@@ -51,7 +51,7 @@ float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5
static int16_t ubl_encoderPosition = 0;
static void _lcd_mesh_fine_tune(PGM_P msg) {
ui.defer_status_screen(true);
ui.defer_status_screen();
if (ubl.encoder_diff) {
ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1;
ubl.encoder_diff = 0;
@@ -74,7 +74,7 @@ static void _lcd_mesh_fine_tune(PGM_P msg) {
}
void _lcd_mesh_edit_NOP() {
ui.defer_status_screen(true);
ui.defer_status_screen();
}
float lcd_mesh_edit() {
@@ -408,7 +408,7 @@ void _lcd_ubl_storage_mesh() {
void _lcd_ubl_output_map_lcd();
void _lcd_ubl_map_homing() {
ui.defer_status_screen(true);
ui.defer_status_screen();
_lcd_draw_homing();
if (all_axes_homed()) {
ubl.lcd_map_control = true; // Return to the map screen
@@ -431,9 +431,21 @@ void _lcd_ubl_map_lcd_edit_cmd() {
* UBL LCD Map Movement
*/
void ubl_map_move_to_xy() {
current_position[X_AXIS] = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]);
current_position[Y_AXIS] = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]);
planner.buffer_line(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
REMEMBER(fr, feedrate_mm_s, MMM_TO_MMS(XY_PROBE_SPEED));
set_destination_from_current(); // sync destination at the start
#if ENABLED(DELTA)
if (current_position[Z_AXIS] > delta_clip_start_height) {
destination[Z_AXIS] = delta_clip_start_height;
prepare_move_to_destination();
}
#endif
destination[X_AXIS] = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]);
destination[Y_AXIS] = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]);
prepare_move_to_destination();
}
/**
@@ -461,22 +473,33 @@ void _lcd_ubl_output_map_lcd() {
if (ui.encoderPosition) {
step_scaler += (int32_t)ui.encoderPosition;
x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
if (ABS(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM) step_scaler = 0;
ui.encoderPosition = 0;
ui.refresh(LCDVIEW_REDRAW_NOW);
}
// Encoder to the right (++)
if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
#if IS_KINEMATIC
#define KEEP_LOOPING true // Loop until a valid point is found
#else
#define KEEP_LOOPING false
#endif
// Encoder to the left (--)
if (x_plot <= GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1)) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; }
if (y_plot <= GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1)) y_plot = GRID_MAX_POINTS_Y - 1;
do {
// Encoder to the right (++)
if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
// Prevent underrun/overrun of plot numbers
x_plot = constrain(x_plot, GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1), GRID_MAX_POINTS_X + 1);
y_plot = constrain(y_plot, GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1), GRID_MAX_POINTS_Y + 1);
// Encoder to the left (--)
if (x_plot < 0) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; }
if (y_plot < 0) y_plot = GRID_MAX_POINTS_Y - 1;
#if IS_KINEMATIC
const float x = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]),
y = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]);
if (position_is_reachable(x, y)) break; // Found a valid point
x_plot += (step_scaler < 0) ? -1 : 1;
#endif
} while(KEEP_LOOPING);
// Determine number of points to edit
#if IS_KINEMATIC
@@ -487,6 +510,9 @@ void _lcd_ubl_output_map_lcd() {
n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners
#endif
// Cleanup
if (ABS(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM) step_scaler = 0;
if (ui.should_draw()) {
ui.ubl_plot(x_plot, y_plot);
+1 -1
View File
@@ -430,7 +430,7 @@ public:
static void lcd_in_status(const bool inStatus);
#endif
static inline void defer_status_screen(const bool defer) {
static inline void defer_status_screen(const bool defer=true) {
#if LCD_TIMEOUT_TO_STATUS
defer_return_to_status = defer;
#else
+35 -9
View File
@@ -86,6 +86,10 @@
#include "../feature/pause.h"
#if ENABLED(EXTRA_LIN_ADVANCE_K)
extern float saved_extruder_advance_K[EXTRUDERS];
#endif
#if EXTRUDERS > 1
#include "tool_change.h"
void M217_report(const bool eeprom);
@@ -384,18 +388,35 @@ void MarlinSettings::postprocess() {
#if ENABLED(EEPROM_SETTINGS)
#define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start()
#define EEPROM_FINISH() persistentStore.access_finish()
#define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
#define EEPROM_WRITE(VAR) persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
#define EEPROM_READ(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating)
#define EEPROM_READ_ALWAYS(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
#define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0)
#define WORD_PADDED_EEPROM ENABLED(__STM32F1__, FLASH_EEPROM_EMULATION)
#if WORD_PADDED_EEPROM && ENABLED(DEBUG_EEPROM_READWRITE)
#define UPDATE_TEST_INDEX(VAR) (text_index += sizeof(VAR))
#else
#define UPDATE_TEST_INDEX(VAR) NOOP
#endif
#if WORD_PADDED_EEPROM
#define EEPROM_SKIP(VAR) do{ eeprom_index += sizeof(VAR) + (sizeof(VAR) & 1); UPDATE_TEST_INDEX(sizeof(VAR)); }while(0)
#else
#define EEPROM_SKIP(VAR) (eeprom_index += sizeof(VAR))
#endif
#define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start()
#define EEPROM_FINISH() persistentStore.access_finish()
#define EEPROM_WRITE(VAR) do{ persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc); UPDATE_TEST_INDEX(VAR); }while(0)
#define EEPROM_READ(VAR) do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating); UPDATE_TEST_INDEX(VAR); }while(0)
#define EEPROM_READ_ALWAYS(VAR) do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc); UPDATE_TEST_INDEX(VAR); }while(0)
#define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0)
#if ENABLED(DEBUG_EEPROM_READWRITE)
#if WORD_PADDED_EEPROM
int test_index;
#else
#define test_index eeprom_index
#endif
#define _FIELD_TEST(FIELD) \
EEPROM_ASSERT( \
eeprom_error || eeprom_index == offsetof(SettingsData, FIELD) + EEPROM_OFFSET, \
eeprom_error || test_index == offsetof(SettingsData, FIELD) + EEPROM_OFFSET, \
"Field " STRINGIFY(FIELD) " mismatch." \
)
#else
@@ -2216,7 +2237,12 @@ void MarlinSettings::reset() {
//
#if ENABLED(LIN_ADVANCE)
LOOP_L_N(i, EXTRUDERS) planner.extruder_advance_K[i] = LIN_ADVANCE_K;
LOOP_L_N(i, EXTRUDERS) {
planner.extruder_advance_K[i] = LIN_ADVANCE_K;
#if ENABLED(EXTRA_LIN_ADVANCE_K)
saved_extruder_advance_K[i] = LIN_ADVANCE_K;
#endif
}
#endif
//
+9 -6
View File
@@ -1278,13 +1278,13 @@ void Planner::check_axes_activity() {
#elif ENABLED(FAST_PWM_FAN)
#if HAS_FAN0
thermalManager.set_pwm_duty(FAN_PIN, CALC_FAN_SPEED(0));
set_pwm_duty(FAN_PIN, CALC_FAN_SPEED(0));
#endif
#if HAS_FAN1
thermalManager.set_pwm_duty(FAN1_PIN, CALC_FAN_SPEED(1));
set_pwm_duty(FAN1_PIN, CALC_FAN_SPEED(1));
#endif
#if HAS_FAN2
thermalManager.set_pwm_duty(FAN2_PIN, CALC_FAN_SPEED(2));
set_pwm_duty(FAN2_PIN, CALC_FAN_SPEED(2));
#endif
#else
@@ -1572,13 +1572,14 @@ void Planner::synchronize() {
*/
#if ENABLED(BACKLASH_COMPENSATION)
#if ENABLED(BACKLASH_GCODE)
extern float backlash_distance_mm[], backlash_correction;
extern float backlash_distance_mm[];
extern uint8_t backlash_correction;
#ifdef BACKLASH_SMOOTHING_MM
extern float backlash_smoothing_mm;
#endif
#else
constexpr float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM,
backlash_correction = BACKLASH_CORRECTION;
constexpr uint8_t backlash_correction = BACKLASH_CORRECTION * 255;
#ifdef BACKLASH_SMOOTHING_MM
constexpr float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM;
#endif
@@ -1612,13 +1613,15 @@ void Planner::synchronize() {
if (!changed_dir) return;
#endif
const float f_corr = float(backlash_correction) / 255.0f;
LOOP_XYZ(axis) {
if (backlash_distance_mm[axis]) {
const bool reversing = TEST(dm,axis);
// When an axis changes direction, add axis backlash to the residual error
if (TEST(changed_dir, axis))
residual_error[axis] += backlash_correction * (reversing ? -1.0f : 1.0f) * backlash_distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
residual_error[axis] += (reversing ? -f_corr : f_corr) * backlash_distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
// Decide how much of the residual error to correct in this segment
int32_t error_correction = residual_error[axis];
+6 -233
View File
@@ -1544,237 +1544,6 @@ void Temperature::init() {
#endif
}
#if ENABLED(FAST_PWM_FAN)
Temperature::Timer Temperature::get_pwm_timer(pin_t pin) {
#if defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM)
uint8_t q = 0;
switch (digitalPinToTimer(pin)) {
// Protect reserved timers (TIMER0 & TIMER1)
#ifdef TCCR0A
#if !AVR_AT90USB1286_FAMILY
case TIMER0A:
#endif
case TIMER0B:
#endif
#ifdef TCCR1A
case TIMER1A: case TIMER1B:
#endif
break;
#if defined(TCCR2) || defined(TCCR2A)
#ifdef TCCR2
case TIMER2: {
Temperature::Timer timer = {
/*TCCRnQ*/ { &TCCR2, NULL, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2, NULL, NULL},
/*ICRn*/ NULL,
/*n, q*/ 2, 0
};
}
#elif defined TCCR2A
#if ENABLED(USE_OCR2A_AS_TOP)
case TIMER2A: break; // protect TIMER2A
case TIMER2B: {
Temperature::Timer timer = {
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL},
/*ICRn*/ NULL,
/*n, q*/ 2, 1
};
return timer;
}
#else
case TIMER2B: q += 1;
case TIMER2A: {
Temperature::Timer timer = {
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL},
/*ICRn*/ NULL,
2, q
};
return timer;
}
#endif
#endif
#endif
#ifdef TCCR3A
case TIMER3C: q += 1;
case TIMER3B: q += 1;
case TIMER3A: {
Temperature::Timer timer = {
/*TCCRnQ*/ { &TCCR3A, &TCCR3B, &TCCR3C},
/*OCRnQ*/ { &OCR3A, &OCR3B, &OCR3C},
/*ICRn*/ &ICR3,
/*n, q*/ 3, q
};
return timer;
}
#endif
#ifdef TCCR4A
case TIMER4C: q += 1;
case TIMER4B: q += 1;
case TIMER4A: {
Temperature::Timer timer = {
/*TCCRnQ*/ { &TCCR4A, &TCCR4B, &TCCR4C},
/*OCRnQ*/ { &OCR4A, &OCR4B, &OCR4C},
/*ICRn*/ &ICR4,
/*n, q*/ 4, q
};
return timer;
}
#endif
#ifdef TCCR5A
case TIMER5C: q += 1;
case TIMER5B: q += 1;
case TIMER5A: {
Temperature::Timer timer = {
/*TCCRnQ*/ { &TCCR5A, &TCCR5B, &TCCR5C},
/*OCRnQ*/ { &OCR5A, &OCR5B, &OCR5C },
/*ICRn*/ &ICR5,
/*n, q*/ 5, q
};
return timer;
}
#endif
}
Temperature::Timer timer = {
/*TCCRnQ*/ { NULL, NULL, NULL},
/*OCRnQ*/ { NULL, NULL, NULL},
/*ICRn*/ NULL,
0, 0
};
return timer;
#endif // ARDUINO && !ARDUINO_ARCH_SAM
}
void Temperature::set_pwm_frequency(const pin_t pin, int f_desired) {
#if defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM)
Temperature::Timer timer = get_pwm_timer(pin);
if (timer.n == 0) return; // Don't proceed if protected timer or not recognised
uint16_t size;
if (timer.n == 2) size = 255; else size = 65535;
uint16_t res = 255; // resolution (TOP value)
uint8_t j = 0; // prescaler index
uint8_t wgm = 1; // waveform generation mode
// Calculating the prescaler and resolution to use to achieve closest frequency
if (f_desired != 0) {
int f = F_CPU/(2*1024*size) + 1; // Initialize frequency as lowest (non-zero) achievable
uint16_t prescaler[] = {0, 1, 8, /*TIMER2 ONLY*/32, 64, /*TIMER2 ONLY*/128, 256, 1024};
// loop over prescaler values
for (uint8_t i = 1; i < 8; i++) {
uint16_t res_temp_fast = 255, res_temp_phase_correct = 255;
if (timer.n == 2) {
// No resolution calculation for TIMER2 unless enabled USE_OCR2A_AS_TOP
#if ENABLED(USE_OCR2A_AS_TOP)
res_temp_fast = (F_CPU / (prescaler[i] * f_desired)) - 1;
res_temp_phase_correct = F_CPU / (2 * prescaler[i] * f_desired);
#endif
}
else {
// Skip TIMER2 specific prescalers when not TIMER2
if (i == 3 || i == 5) continue;
res_temp_fast = (F_CPU / (prescaler[i] * f_desired)) - 1;
res_temp_phase_correct = F_CPU / (2 * prescaler[i] * f_desired);
}
LIMIT(res_temp_fast, 1u, size);
LIMIT(res_temp_phase_correct, 1u, size);
// Calculate frequncies of test prescaler and resolution values
int f_temp_fast = F_CPU / (prescaler[i] * (1 + res_temp_fast));
int f_temp_phase_correct = F_CPU / (2 * prescaler[i] * res_temp_phase_correct);
// If FAST values are closest to desired f
if (ABS(f_temp_fast - f_desired) < ABS(f - f_desired)
&& ABS(f_temp_fast - f_desired) <= ABS(f_temp_phase_correct - f_desired)) {
// Remember this combination
f = f_temp_fast;
res = res_temp_fast;
j = i;
// Set the Wave Generation Mode to FAST PWM
if(timer.n == 2){
wgm =
#if ENABLED(USE_OCR2A_AS_TOP)
WGM2_FAST_PWM_OCR2A;
#else
WGM2_FAST_PWM;
#endif
}
else wgm = WGM_FAST_PWM_ICRn;
}
// If PHASE CORRECT values are closes to desired f
else if (ABS(f_temp_phase_correct - f_desired) < ABS(f - f_desired)) {
f = f_temp_phase_correct;
res = res_temp_phase_correct;
j = i;
// Set the Wave Generation Mode to PWM PHASE CORRECT
if (timer.n == 2) {
wgm =
#if ENABLED(USE_OCR2A_AS_TOP)
WGM2_PWM_PC_OCR2A;
#else
WGM2_PWM_PC;
#endif
}
else wgm = WGM_PWM_PC_ICRn;
}
}
}
_SET_WGMnQ(timer.TCCRnQ, wgm);
_SET_CSn(timer.TCCRnQ, j);
if (timer.n == 2) {
#if ENABLED(USE_OCR2A_AS_TOP)
_SET_OCRnQ(timer.OCRnQ, 0, res); // Set OCR2A value (TOP) = res
#endif
}
else {
_SET_ICRn(timer.ICRn, res); // Set ICRn value (TOP) = res
}
#endif // ARDUINO && !ARDUINO_ARCH_SAM
}
void Temperature::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
#if defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM)
// If v is 0 or v_size (max), digitalWrite to LOW or HIGH.
// Note that digitalWrite also disables pwm output for us (sets COM bit to 0)
if (v == 0)
digitalWrite(pin, invert);
else if (v == v_size)
digitalWrite(pin, !invert);
else {
Temperature::Timer timer = get_pwm_timer(pin);
if (timer.n == 0) return; // Don't proceed if protected timer or not recognised
// Set compare output mode to CLEAR -> SET or SET -> CLEAR (if inverted)
_SET_COMnQ(timer.TCCRnQ, timer.q
#ifdef TCCR2
+ (timer.q == 2) // COM20 is on bit 4 of TCCR2, thus requires q + 1 in the macro
#endif
, COM_CLEAR_SET + invert
);
uint16_t top;
if (timer.n == 2) { // if TIMER2
top =
#if ENABLED(USE_OCR2A_AS_TOP)
*timer.OCRnQ[0] // top = OCR2A
#else
255 // top = 0xFF (max)
#endif
;
}
else
top = *timer.ICRn; // top = ICRn
_SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top / v_size)); // Scale 8/16-bit v to top value
}
#endif // ARDUINO && !ARDUINO_ARCH_SAM
}
#endif // FAST_PWM_FAN
#if WATCH_HOTENDS
/**
* Start Heating Sanity Check for hotends that are below
@@ -2047,19 +1816,23 @@ void Temperature::disable_all_heaters() {
//
// TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
//
#if MAX6675_SEPARATE_SPI
#if !MAX6675_SEPARATE_SPI
spiBegin();
spiInit(MAX6675_SPEED_BITS);
#endif
#if COUNT_6675 > 1
#define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
#define SET_OUTPUT_MAX6675() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN); break; default: SET_OUTPUT(MAX6675_SS_PIN); } }while(0)
#elif ENABLED(HEATER_1_USES_MAX6675)
#define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V)
#define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS2_PIN)
#else
#define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V)
#define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS_PIN)
#endif
SET_OUTPUT_MAX6675();
WRITE_MAX6675(LOW); // enable TT_MAX6675
DELAY_NS(100); // Ensure 100ns delay
@@ -2379,7 +2152,7 @@ void Temperature::isr() {
#if ENABLED(FAN_SOFT_PWM)
#define _FAN_PWM(N) do{ \
soft_pwm_count_fan[N] = (soft_pwm_count_fan[N] & pwm_mask) + (soft_pwm_amount_fan[N] >> 1); \
WRITE_FAN(soft_pwm_count_fan[N] > pwm_mask ? HIGH : LOW); \
WRITE_FAN_N(N, soft_pwm_count_fan[N] > pwm_mask ? HIGH : LOW); \
}while(0)
#if HAS_FAN0
_FAN_PWM(0);
+1 -42
View File
@@ -266,16 +266,6 @@ class Temperature {
soft_pwm_count_fan[FAN_COUNT];
#endif
/**
* set_pwm_duty (8-bit AVRs only)
* Sets the PWM duty cycle of the provided pin to the provided value
* Optionally allows inverting the duty cycle [default = false]
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
*/
#if ENABLED(FAST_PWM_FAN)
static void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
#endif
#if ENABLED(BABYSTEPPING)
static volatile int16_t babystepsTodo[3];
#endif
@@ -430,7 +420,7 @@ class Temperature {
static uint8_t paused_fan_speed[FAN_COUNT];
#endif
static constexpr inline uint8_t fanPercent(const uint8_t speed) { return (int(speed) * 100 + 127) / 255; }
static constexpr inline uint8_t fanPercent(const uint8_t speed) { return ui8_to_percent(speed); }
#if ENABLED(ADAPTIVE_FAN_SLOWING)
static uint8_t fan_speed_scaler[FAN_COUNT];
@@ -744,38 +734,7 @@ class Temperature {
#endif
private:
/**
* (8-bit AVRs only)
*
* get_pwm_timer
* Grabs timer information and registers of the provided pin
* returns Timer struct containing this information
* Used by set_pwm_frequency, set_pwm_duty
*
* set_pwm_frequency
* Sets the frequency of the timer corresponding to the provided pin
* as close as possible to the provided desired frequency. Internally
* calculates the required waveform generation mode, prescaler and
* resolution values required and sets the timer registers accordingly.
* NOTE that the frequency is applied to all pins on the timer (Ex OC3A, OC3B and OC3B)
* NOTE that there are limitations, particularly if using TIMER2. (see Configuration_adv.h -> FAST FAN PWM Settings)
*/
#if ENABLED(FAST_PWM_FAN)
typedef struct Timer {
volatile uint8_t* TCCRnQ[3]; // max 3 TCCR registers per timer
volatile uint16_t* OCRnQ[3]; // max 3 OCR registers per timer
volatile uint16_t* ICRn; // max 1 ICR register per timer
uint8_t n; // the timer number [0->5]
uint8_t q; // the timer output [0->2] (A->C)
} Timer;
static Timer get_pwm_timer(const pin_t pin);
static void set_pwm_frequency(const pin_t pin, int f_desired);
#endif
static void set_current_temp_raw();
static void updateTemperaturesFromRawValues();
#define HAS_MAX6675 EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
+4 -4
View File
@@ -139,11 +139,11 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa
#if AVR_AT90USB1286_FAMILY //Teensy IDEs don't know about these pins so must use FASTIO
if (pin == 46 || pin == 47) {
if (pin == 46) {
print_input_or_output(GET_OUTPUT(46));
print_input_or_output(IS_OUTPUT(46));
SERIAL_CHAR('0' + READ(46));
}
else if (pin == 47) {
print_input_or_output(GET_OUTPUT(47));
print_input_or_output(IS_OUTPUT(47));
SERIAL_CHAR('0' + READ(47));
}
}
@@ -195,11 +195,11 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa
if (pin == 46 || pin == 47) {
SERIAL_ECHO_SP(12);
if (pin == 46) {
print_input_or_output(GET_OUTPUT(46));
print_input_or_output(IS_OUTPUT(46));
SERIAL_CHAR('0' + READ(46));
}
else {
print_input_or_output(GET_OUTPUT(47));
print_input_or_output(IS_OUTPUT(47));
SERIAL_CHAR('0' + READ(47));
}
}
+32 -13
View File
@@ -140,6 +140,10 @@
#define E1_SERIAL_TX_PIN P1_04
#define E1_SERIAL_RX_PIN P1_01
#define Z2_SERIAL_TX_PIN P1_04
#define Z2_SERIAL_RX_PIN P1_01
#endif
//
@@ -173,24 +177,39 @@
| EXP2 EXP1
*/
#if ENABLED(ULTRA_LCD)
#define BEEPER_PIN P1_30 // (37) not 5V tolerant
#define BTN_ENC P0_28 // (58) open-drain
#define LCD_PINS_RS P1_19
#define BEEPER_PIN P1_30 // (37) not 5V tolerant
#define BTN_ENC P0_28 // (58) open-drain
#define BTN_EN1 P3_26 // (31) J3-2 & AUX-4
#define BTN_EN2 P3_25 // (33) J3-4 & AUX-4
#define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant)
#if ENABLED(CR10_STOCKDISPLAY)
#define LCD_PINS_RS P1_22
#define LCD_SDSS P0_16 // (16) J3-7 & AUX-4
#define BTN_EN1 P1_18
#define BTN_EN2 P1_20
#define LCD_PINS_ENABLE P1_18
#define LCD_PINS_D4 P1_20
#define LCD_PINS_ENABLE P1_23
#define LCD_PINS_D4 P1_21
#else
#define LCD_PINS_RS P1_19
#define BTN_EN1 P3_26 // (31) J3-2 & AUX-4
#define BTN_EN2 P3_25 // (33) J3-4 & AUX-4
#define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant)
#define LCD_SDSS P0_16 // (16) J3-7 & AUX-4
#define LCD_PINS_ENABLE P1_18
#define LCD_PINS_D4 P1_20
#if ENABLED(ULTIPANEL)
#define LCD_PINS_D5 P1_21
#define LCD_PINS_D6 P1_22
#define LCD_PINS_D7 P1_23
#endif
#if ENABLED(ULTIPANEL)
#define LCD_PINS_D5 P1_21
#define LCD_PINS_D6 P1_22
#define LCD_PINS_D7 P1_23
#endif
#endif // ULTRA_LCD
//#define USB_SD_DISABLED
+1 -2
View File
@@ -1004,7 +1004,7 @@ void CardReader::printingHasFinished() {
#if ENABLED(POWER_LOSS_RECOVERY)
constexpr char job_recovery_file_name[4] = "BIN";
constexpr char job_recovery_file_name[4] = "PLR";
bool CardReader::jobRecoverFileExists() {
const bool exists = recovery.file.open(&root, job_recovery_file_name, O_READ);
@@ -1026,7 +1026,6 @@ void CardReader::printingHasFinished() {
// be zeroed and written instead of deleted.
void CardReader::removeJobRecoveryFile() {
if (jobRecoverFileExists()) {
//closefile();
removeFile(job_recovery_file_name);
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
SERIAL_ECHOPGM("Power-loss file delete");
+5 -1
View File
@@ -818,7 +818,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
+11 -10
View File
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1672,8 +1674,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
@@ -824,7 +824,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1672,8 +1674,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
@@ -838,7 +838,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1672,8 +1674,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
@@ -818,7 +818,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
@@ -829,7 +829,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1674,8 +1676,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
+5 -1
View File
@@ -818,7 +818,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
+11 -10
View File
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1672,8 +1674,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
+5 -1
View File
@@ -818,7 +818,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
+11 -10
View File
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1672,8 +1674,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
+5 -1
View File
@@ -865,7 +865,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
+11 -10
View File
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
//#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1672,8 +1674,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
+5 -1
View File
@@ -831,7 +831,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
+11 -10
View File
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
//#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1672,8 +1674,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
+5 -1
View File
@@ -828,7 +828,11 @@
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
// BLTouch V3.0 and newer smart series
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
+11 -10
View File
@@ -404,20 +404,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -1032,8 +1032,9 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
@@ -1072,7 +1073,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1672,8 +1674,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \

Some files were not shown because too many files have changed in this diff Show More