Skip to content

Commit 7f4fd10

Browse files
committed
Merge branch 'bugfix-2.0.x' into 2.0.x-Sapphire-Pro-Stock
2 parents 1538ee9 + e1fc6f7 commit 7f4fd10

File tree

119 files changed

+2697
-1129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+2697
-1129
lines changed

Marlin/Configuration_adv.h

+109-24
Original file line numberDiff line numberDiff line change
@@ -1600,18 +1600,11 @@
16001600
// Add additional compensation depending on hotend temperature
16011601
// Note: this values cannot be calibrated and have to be set manually
16021602
#if ENABLED(PROBE_TEMP_COMPENSATION)
1603-
// Max temperature that can be reached by heated bed.
1604-
// This is required only for the calibration process.
1605-
#define PTC_MAX_BED_TEMP BED_MAXTEMP
1606-
16071603
// Park position to wait for probe cooldown
1608-
#define PTC_PARK_POS_X 0.0F
1609-
#define PTC_PARK_POS_Y 0.0F
1610-
#define PTC_PARK_POS_Z 100.0F
1604+
#define PTC_PARK_POS { 0, 0, 100 }
16111605

16121606
// Probe position to probe and wait for probe to reach target temperature
1613-
#define PTC_PROBE_POS_X 90.0F
1614-
#define PTC_PROBE_POS_Y 100.0F
1607+
#define PTC_PROBE_POS { 90, 100 }
16151608

16161609
// Enable additional compensation using hotend temperature
16171610
// Note: this values cannot be calibrated automatically but have to be set manually
@@ -2662,31 +2655,123 @@
26622655
#define SPINDLE_LASER_ACTIVE_HIGH false // Set to "true" if the on/off function is active HIGH
26632656
#define SPINDLE_LASER_PWM true // Set to "true" if your controller supports setting the speed/power
26642657
#define SPINDLE_LASER_PWM_INVERT true // Set to "true" if the speed/power goes up when you want it to go slower
2665-
#define SPINDLE_LASER_POWERUP_DELAY 5000 // (ms) Delay to allow the spindle/laser to come up to speed/power
2666-
#define SPINDLE_LASER_POWERDOWN_DELAY 5000 // (ms) Delay to allow the spindle to stop
2658+
2659+
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
2660+
2661+
/**
2662+
* Speed / Power can be set ('M3 S') and displayed in terms of:
2663+
* - PWM (S0 - S255)
2664+
* - PERCENT (S0 - S100)
2665+
* - RPM (S0 - S50000) Best for use with a spindle
2666+
*/
2667+
#define CUTTER_POWER_DISPLAY PWM
2668+
2669+
/**
2670+
* Relative mode uses relative range (SPEED_POWER_MIN to SPEED_POWER_MAX) instead of normal range (0 to SPEED_POWER_MAX)
2671+
* Best use with SuperPID router controller where for example S0 = 5,000 RPM and S255 = 30,000 RPM
2672+
*/
2673+
//#define CUTTER_POWER_RELATIVE // Set speed proportional to [SPEED_POWER_MIN...SPEED_POWER_MAX] instead of directly
26672674

26682675
#if ENABLED(SPINDLE_FEATURE)
26692676
//#define SPINDLE_CHANGE_DIR // Enable if your spindle controller can change spindle direction
26702677
#define SPINDLE_CHANGE_DIR_STOP // Enable if the spindle should stop before changing spin direction
26712678
#define SPINDLE_INVERT_DIR false // Set to "true" if the spin direction is reversed
26722679

2680+
#define SPINDLE_LASER_POWERUP_DELAY 5000 // (ms) Delay to allow the spindle/laser to come up to speed/power
2681+
#define SPINDLE_LASER_POWERDOWN_DELAY 5000 // (ms) Delay to allow the spindle to stop
2682+
26732683
/**
2674-
* The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power
2684+
* M3/M4 uses the following equation to convert speed/power to PWM duty cycle
2685+
* Power = ((DC / 255 * 100) - SPEED_POWER_INTERCEPT)) * (1 / SPEED_POWER_SLOPE)
2686+
* where PWM DC varies from 0 to 255
26752687
*
2676-
* SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT
2677-
* where PWM duty cycle varies from 0 to 255
2678-
*
2679-
* set the following for your controller (ALL MUST BE SET)
2688+
* Set these required parameters for your controller
26802689
*/
2681-
#define SPEED_POWER_SLOPE 118.4
2682-
#define SPEED_POWER_INTERCEPT 0
2683-
#define SPEED_POWER_MIN 5000
2684-
#define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM
2690+
#define SPEED_POWER_SLOPE 118.4 // SPEED_POWER_SLOPE = SPEED_POWER_MAX / 255
2691+
#define SPEED_POWER_INTERCEPT 0
2692+
#define SPEED_POWER_MIN 5000
2693+
#define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM
2694+
#define SPEED_POWER_STARTUP 25000 // The default value for speed power when M3 is called without arguments
2695+
26852696
#else
2686-
#define SPEED_POWER_SLOPE 0.3922
2687-
#define SPEED_POWER_INTERCEPT 0
2688-
#define SPEED_POWER_MIN 10
2689-
#define SPEED_POWER_MAX 100 // 0-100%
2697+
2698+
#define SPEED_POWER_SLOPE 0.3922 // SPEED_POWER_SLOPE = SPEED_POWER_MAX / 255
2699+
#define SPEED_POWER_INTERCEPT 0
2700+
#define SPEED_POWER_MIN 0
2701+
#define SPEED_POWER_MAX 100 // 0-100%
2702+
#define SPEED_POWER_STARTUP 80 // The default value for speed power when M3 is called without arguments
2703+
2704+
/**
2705+
* Enable inline laser power to be handled in the planner / stepper routines.
2706+
* Inline power is specified by the I (inline) flag in an M3 command (e.g., M3 S20 I)
2707+
* or by the 'S' parameter in G0/G1/G2/G3 moves (see LASER_MOVE_POWER).
2708+
*
2709+
* This allows the laser to keep in perfect sync with the planner and removes
2710+
* the powerup/down delay since lasers require negligible time.
2711+
*/
2712+
#define LASER_POWER_INLINE
2713+
2714+
#if ENABLED(LASER_POWER_INLINE)
2715+
/**
2716+
* Scale the laser's power in proportion to the movement rate.
2717+
*
2718+
* - Sets the entry power proportional to the entry speed over the nominal speed.
2719+
* - Ramps the power up every N steps to approximate the speed trapezoid.
2720+
* - Due to the limited power resolution this is only approximate.
2721+
*/
2722+
#define LASER_POWER_INLINE_TRAPEZOID
2723+
2724+
/**
2725+
* Continuously calculate the current power (nominal_power * current_rate / nominal_rate).
2726+
* Required for accurate power with non-trapezoidal acceleration (e.g., S_CURVE_ACCELERATION).
2727+
* This is a costly calculation so this option is discouraged on 8-bit AVR boards.
2728+
*
2729+
* LASER_POWER_INLINE_TRAPEZOID_CONT_PER defines how many step cycles there are between power updates. If your
2730+
* board isn't able to generate steps fast enough (and you are using LASER_POWER_INLINE_TRAPEZOID_CONT), increase this.
2731+
* Note that when this is zero it means it occurs every cycle; 1 means a delay wait one cycle then run, etc.
2732+
*/
2733+
//#define LASER_POWER_INLINE_TRAPEZOID_CONT
2734+
2735+
/**
2736+
* Stepper iterations between power updates. Increase this value if the board
2737+
* can't keep up with the processing demands of LASER_POWER_INLINE_TRAPEZOID_CONT.
2738+
* Disable (or set to 0) to recalculate power on every stepper iteration.
2739+
*/
2740+
//#define LASER_POWER_INLINE_TRAPEZOID_CONT_PER 10
2741+
2742+
/**
2743+
* Include laser power in G0/G1/G2/G3/G5 commands with the 'S' parameter
2744+
*/
2745+
//#define LASER_MOVE_POWER
2746+
2747+
#if ENABLED(LASER_MOVE_POWER)
2748+
// Turn off the laser on G0 moves with no power parameter.
2749+
// If a power parameter is provided, use that instead.
2750+
//#define LASER_MOVE_G0_OFF
2751+
#endif
2752+
2753+
/**
2754+
* Inline flag inverted
2755+
*
2756+
* WARNING: M5 will NOT turn off the laser unless another move
2757+
* is done (so G-code files must end with 'M5 I').
2758+
*/
2759+
//#define LASER_POWER_INLINE_INVERT
2760+
2761+
/**
2762+
* Continuously apply inline power. ('M3 S3' == 'G1 S3' == 'M3 S3 I')
2763+
*
2764+
* The laser might do some weird things, so only enable this
2765+
* feature if you understand the implications.
2766+
*/
2767+
//#define LASER_POWER_INLINE_CONTINUOUS
2768+
2769+
#else
2770+
2771+
#define SPINDLE_LASER_POWERUP_DELAY 50 // (ms) Delay to allow the spindle/laser to come up to speed/power
2772+
#define SPINDLE_LASER_POWERDOWN_DELAY 50 // (ms) Delay to allow the spindle to stop
2773+
2774+
#endif
26902775
#endif
26912776
#endif
26922777

Marlin/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ ifeq ($(HARDWARE_VARIANT), Teensy)
686686

687687
else ifeq ($(HARDWARE_VARIANT), archim)
688688
CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"'
689-
LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp
689+
LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp
690690
LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
691691

692692
ifeq ($(U8GLIB), 1)

Marlin/src/HAL/AVR/HAL.h

+2
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ inline void HAL_adc_init() {
395395
// AVR compatibility
396396
#define strtof strtod
397397

398+
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
399+
398400
/**
399401
* set_pwm_frequency
400402
* Sets the frequency of the timer corresponding to the provided pin

Marlin/src/HAL/AVR/fast_pwm.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include "../../inc/MarlinConfigPre.h"
2525

26-
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_PWM
26+
#if NEEDS_HARDWARE_PWM // Specific meta-flag for features that mandate PWM
2727

2828
#include "HAL.h"
2929

@@ -278,5 +278,5 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255
278278
}
279279
}
280280

281-
#endif // FAST_PWM_FAN || SPINDLE_LASER_PWM
281+
#endif // NEEDS_HARDWARE_PWM
282282
#endif // __AVR__

Marlin/src/HAL/AVR/fastio.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@
9898

9999
#define SET_INPUT(IO) _SET_INPUT(IO)
100100
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0)
101+
#define SET_INPUT_PULLDOWN SET_INPUT
101102
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
102-
103-
#define SET_PWM(IO) SET_OUTPUT(IO)
103+
#define SET_PWM SET_OUTPUT
104104

105105
#define IS_INPUT(IO) _IS_INPUT(IO)
106106
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)

Marlin/src/HAL/DUE/fastio.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
// Set pin as output (wrapper) - reads the pin and sets the output to that value
167167
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
168168
// Set pin as PWM
169-
#define SET_PWM(IO) SET_OUTPUT(IO)
169+
#define SET_PWM SET_OUTPUT
170170

171171
// Check if pin is an input
172172
#define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)

Marlin/src/HAL/ESP32/eeprom_impl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
#include "../../inc/MarlinConfig.h"
2626

27-
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
27+
#if USE_WIRED_EEPROM
2828

2929
#include "../shared/eeprom_api.h"
30-
#include "EEPROM.h"
30+
#include <EEPROM.h>
3131

3232
#define EEPROM_SIZE 4096
3333

@@ -59,5 +59,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
5959

6060
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
6161

62-
#endif // EEPROM_SETTINGS
62+
#endif // USE_WIRED_EEPROM
6363
#endif // ARDUINO_ARCH_ESP32

Marlin/src/HAL/ESP32/fastio.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)
5757

5858
// Set pin as PWM
59-
#define SET_PWM(IO) SET_OUTPUT(IO)
59+
#define SET_PWM SET_OUTPUT
6060

6161
// Set pin as output and init
6262
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)

Marlin/src/HAL/ESP32/inc/Conditionals_post.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
#pragma once
2323

24-
// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
25-
#if ENABLED(EEPROM_SETTINGS) && NONE(USE_WIRED_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION)
26-
#define SDCARD_EEPROM_EMULATION
24+
#undef USE_WIRED_EEPROM
25+
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
26+
#define USE_WIRED_EEPROM 1
2727
#endif

Marlin/src/HAL/LPC1768/HAL.h

+2
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ void HAL_idletask();
197197
#define PLATFORM_M997_SUPPORT
198198
void flashFirmware(const int16_t);
199199

200+
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
201+
200202
/**
201203
* set_pwm_frequency
202204
* Set the frequency of the timer corresponding to the provided pin

Marlin/src/HAL/LPC1768/fast_pwm.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "../../inc/MarlinConfigPre.h"
2626

27-
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_PWM
27+
#if NEEDS_HARDWARE_PWM // Specific meta-flag for features that mandate PWM
2828

2929
#include <pwm.h>
3030

Marlin/src/HAL/LPC1768/fastio.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
/// set pin as output wrapper - reads the pin and sets the output to that value
105105
#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
106106
// set pin as PWM
107-
#define SET_PWM(IO) SET_OUTPUT(IO)
107+
#define SET_PWM SET_OUTPUT
108108

109109
/// check if pin is an input wrapper
110110
#define IS_INPUT(IO) _IS_INPUT(IO)

Marlin/src/HAL/SAMD51/QSPIFlash.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#pragma once
3131

32-
#include "Adafruit_SPIFlashBase.h"
32+
#include <Adafruit_SPIFlashBase.h>
3333

3434
// This class extends Adafruit_SPIFlashBase by adding caching support.
3535
//

Marlin/src/HAL/SAMD51/fastio.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@
100100
PORT->Group[port].DIRCLR.reg = MASK(pin); \
101101
}while(0)
102102
// Set pin as PWM (push pull)
103-
#define SET_PWM(IO) SET_OUTPUT(IO)
103+
#define SET_PWM SET_OUTPUT
104104
// Set pin as PWM (open drain)
105-
#define SET_PWM_OD(IO) SET_OUTPUT_OD(IO)
105+
#define SET_PWM_OD SET_OUTPUT_OD
106106

107107
// check if pin is an output
108108
#define IS_OUTPUT(IO) ((PORT->Group[(EPortType)GET_SAMD_PORT(IO)].DIR.reg & MASK(GET_SAMD_PIN(IO))) \

Marlin/src/HAL/TEENSY31_32/fastio.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@
7676

7777
#define SET_INPUT(IO) _SET_INPUT(IO)
7878
#define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO)
79+
#define SET_INPUT_PULLDOWN SET_INPUT
7980
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
80-
#define SET_PWM(IO) SET_OUTPUT(IO)
81+
#define SET_PWM SET_OUTPUT
8182

8283
#define IS_INPUT(IO) _IS_INPUT(IO)
8384
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)

Marlin/src/HAL/TEENSY35_36/fastio.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@
7676

7777
#define SET_INPUT(IO) _SET_INPUT(IO)
7878
#define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO)
79+
#define SET_INPUT_PULLDOWN SET_INPUT
7980
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
80-
#define SET_PWM(IO) SET_OUTPUT(IO)
81+
#define SET_PWM SET_OUTPUT
8182

8283
#define IS_INPUT(IO) _IS_INPUT(IO)
8384
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)

0 commit comments

Comments
 (0)