Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.1.x

This commit is contained in:
InsanityAutomation
2023-08-04 09:47:12 -04:00
58 changed files with 7348 additions and 1027 deletions
+16 -1
View File
@@ -1751,6 +1751,21 @@
//#define V_HOME_DIR -1
//#define W_HOME_DIR -1
/**
* Safety Stops
* If an axis has endstops on both ends the one specified above is used for
* homing, while the other can be used for things like SD_ABORT_ON_ENDSTOP_HIT.
*/
//#define X_SAFETY_STOP
//#define Y_SAFETY_STOP
//#define Z_SAFETY_STOP
//#define I_SAFETY_STOP
//#define J_SAFETY_STOP
//#define K_SAFETY_STOP
//#define U_SAFETY_STOP
//#define V_SAFETY_STOP
//#define W_SAFETY_STOP
// @section geometry
// The size of the printable area
@@ -3108,7 +3123,7 @@
* - Download https://github.com/InsanityAutomation/Marlin/raw/CrealityDwin_2.0/TM3D_Combined480272_Landscape_V7.7z
* - Copy the downloaded DWIN_SET folder to the SD card.
*
* E3S1PRO (T5UID1)
* E3S1PRO (T5L)
* - Download https://github.com/CrealityOfficial/Ender-3S1/archive/3S1_Plus_Screen.zip
* - Copy the downloaded DWIN_SET folder to the SD card.
*
+1 -1
View File
@@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2023-07-24"
//#define STRING_DISTRIBUTION_DATE "2023-08-04"
/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
+22 -5
View File
@@ -61,23 +61,40 @@ void save_reset_reason() {
wdt_disable();
}
#include "registers.h"
MarlinHAL::MarlinHAL() {
TERN_(HAL_AVR_DIRTY_INIT, _ATmega_resetperipherals()); // Clean-wipe the device state.
}
void MarlinHAL::init() {
// Init Servo Pins
#define INIT_SERVO(N) OUT_WRITE(SERVO##N##_PIN, LOW)
#if HAS_SERVO_0
INIT_SERVO(0);
OUT_WRITE(SERVO0_PIN, LOW);
#endif
#if HAS_SERVO_1
INIT_SERVO(1);
OUT_WRITE(SERVO1_PIN, LOW);
#endif
#if HAS_SERVO_2
INIT_SERVO(2);
OUT_WRITE(SERVO2_PIN, LOW);
#endif
#if HAS_SERVO_3
INIT_SERVO(3);
OUT_WRITE(SERVO3_PIN, LOW);
#endif
init_pwm_timers(); // Init user timers to default frequency - 1000HZ
#if PIN_EXISTS(BEEPER) && ENABLED(HAL_AVR_DIRTY_INIT) && DISABLED(ATMEGA_NO_BEEPFIX)
// Make sure no alternative is locked onto the BEEPER.
// This fixes the issue where the ATmega is constantly beeping.
// Might disable other peripherals using the pin; to circumvent that please undefine one of the above things!
// The true culprit is the AVR ArduinoCore that enables peripherals redundantly.
// (USART1 on the GeeeTech GT2560)
// https://www.youtube.com/watch?v=jMgCvRXkexk
_ATmega_savePinAlternate(BEEPER_PIN);
OUT_WRITE(BEEPER_PIN, LOW);
#endif
}
void MarlinHAL::reboot() {
+1 -1
View File
@@ -187,7 +187,7 @@ class MarlinHAL {
public:
// Earliest possible init, before setup()
MarlinHAL() {}
MarlinHAL();
// Watchdog
static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {});
+1 -1
View File
@@ -160,7 +160,7 @@ void setup_endstop_interrupts() {
pciSetup(Z_MAX_PIN);
#endif
#endif
#if HAS_Z_MIN_PIN
#if USE_Z_MIN
#if (digitalPinToInterrupt(Z_MIN_PIN) != NOT_AN_INTERRUPT)
_ATTACH(Z_MIN_PIN);
#else
+7 -7
View File
@@ -33,13 +33,13 @@
* Check for common serial pin conflicts
*/
#define CHECK_SERIAL_PIN(N) ( \
X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \
|| X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \
|| X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \
|| X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \
|| X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \
|| X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \
|| BTN_EN1 == N || BTN_EN2 == N \
X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \
|| X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \
|| X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \
|| X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \
|| X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \
|| X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \
|| BTN_EN1 == N || BTN_EN2 == N || LCD_PINS_EN == N \
)
#if SERIAL_IN_USE(0)
// D0-D1. No known conflicts.
+979
View File
@@ -0,0 +1,979 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2023 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 <https://www.gnu.org/licenses/>.
*
*/
#ifdef __AVR__
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(HAL_AVR_DIRTY_INIT)
#include "registers.h"
// Since the compiler could be creating multiple copies of function code-graphs for each header inline-inclusion,
// we want to off-load the function definitions that define static memory into this solitary compilation unit.
// This way the ROM is NOT bloated (who knows if the compiler is optimizing same-content constant objects into one?)
ATmegaPinFunctions _ATmega_getPinFunctions(int pin) {
if (pin < 0) return {};
ATmegaPinInfo info = _ATmega_getPinInfo((unsigned int)pin);
#ifdef __AVR_TRM01__
if (info.port == eATmegaPort::PORT_A) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD0 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_B) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC0A, eATmegaPinFunc::TOC1C, eATmegaPinFunc::PCI7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1B, eATmegaPinFunc::PCI6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1A, eATmegaPinFunc::PCI5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC2A, eATmegaPinFunc::PCI4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_MISO, eATmegaPinFunc::PCI3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_MOSI, eATmegaPinFunc::PCI2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_SCK, eATmegaPinFunc::PCI1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_CS, eATmegaPinFunc::PCI0 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_C) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD15 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD14 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD13 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD12 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD11 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD10 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD9 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD8 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_D) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER0_CLKI };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_CLKI };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART1_CLK };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_ICP };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT3, eATmegaPinFunc::USART1_TXD };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT2, eATmegaPinFunc::USART1_RXD };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT1, eATmegaPinFunc::TWI_SDA };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT0, eATmegaPinFunc::TWI_CLK };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_E) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT7, eATmegaPinFunc::TIMER3_ICP, eATmegaPinFunc::CLKO };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT6, eATmegaPinFunc::TIMER3_CLKI };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT5, eATmegaPinFunc::TOC3C };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT4, eATmegaPinFunc::TOC3B };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::AIN1, eATmegaPinFunc::TOC3A };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::AIN0, eATmegaPinFunc::USART0_CLK };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PDO, eATmegaPinFunc::USART0_TXD };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PDI, eATmegaPinFunc::USART0_RXD, eATmegaPinFunc::PCI8 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_F) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC0 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_G) {
if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC0B };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOSC1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3 ) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOSC2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_ALE };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_RD };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_WR };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_H) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER4_CLKI };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC2B };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC4C };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC4B };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC4A };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART2_CLK };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART2_TXD };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART2_RXD };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_J) {
if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI15 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI14 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI13 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI12 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART3_CLK, eATmegaPinFunc::PCI11 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART3_TXD, eATmegaPinFunc::PCI10 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART3_RXD, eATmegaPinFunc::PCI9 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_K) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC15, eATmegaPinFunc::PCI23 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC14, eATmegaPinFunc::PCI22 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC13, eATmegaPinFunc::PCI21 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC12, eATmegaPinFunc::PCI20 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC11, eATmegaPinFunc::PCI19 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC10, eATmegaPinFunc::PCI18 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC9, eATmegaPinFunc::PCI17 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC8, eATmegaPinFunc::PCI16 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_L) {
if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC5C };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC5B };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC5A };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER5_CLKI };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER5_ICP };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER4_ICP };
return { funcs, countof(funcs) };
}
}
#elif defined(__AVR_TRM02__)
if (info.port == eATmegaPort::PORT_A) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI7, eATmegaPinFunc::ADC7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI6, eATmegaPinFunc::ADC6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI5, eATmegaPinFunc::ADC5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI4, eATmegaPinFunc::ADC4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI3, eATmegaPinFunc::ADC3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI2, eATmegaPinFunc::ADC2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI1, eATmegaPinFunc::ADC1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI0, eATmegaPinFunc::ADC0 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_B) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_SCK, eATmegaPinFunc::TOC3B, eATmegaPinFunc::PCI15 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_MISO, eATmegaPinFunc::TOC3A, eATmegaPinFunc::PCI14 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_MOSI, eATmegaPinFunc::TIMER3_ICP, eATmegaPinFunc::PCI13 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_CS, eATmegaPinFunc::TOC0B, eATmegaPinFunc::PCI12 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::AIN1, eATmegaPinFunc::TOC0A, eATmegaPinFunc::PCI11 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::AIN0, eATmegaPinFunc::EINT2, eATmegaPinFunc::PCI10 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_ECI, eATmegaPinFunc::CLKO, eATmegaPinFunc::PCI9 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER0_ECI, eATmegaPinFunc::USART0_CLK, eATmegaPinFunc::PCI8 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_C) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOSC2, eATmegaPinFunc::PCI23 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOSC1, eATmegaPinFunc::PCI22 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI21 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI20 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI19 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI18 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI17, eATmegaPinFunc::TWI_SDA };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TWI_CLK, eATmegaPinFunc::PCI16 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_D) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC2A, eATmegaPinFunc::PCI31 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_ICP, eATmegaPinFunc::TOC2B, eATmegaPinFunc::PCI30 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1A, eATmegaPinFunc::PCI29 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1B, eATmegaPinFunc::USART1_CLK, eATmegaPinFunc::PCI28 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT1, eATmegaPinFunc::USART1_TXD, eATmegaPinFunc::PCI27 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT0, eATmegaPinFunc::USART1_RXD, eATmegaPinFunc::PCI26 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART0_TXD, eATmegaPinFunc::PCI25 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART0_TXD, eATmegaPinFunc::PCI24, eATmegaPinFunc::TIMER3_ECI };
return { funcs, countof(funcs) };
}
}
#elif defined(__AVR_TRM03__)
if (info.port == eATmegaPort::PORT_B) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::XTAL2, eATmegaPinFunc::TOSC2, eATmegaPinFunc::PCI7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::XTAL1, eATmegaPinFunc::TOSC1, eATmegaPinFunc::PCI6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_SCK, eATmegaPinFunc::PCI5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_MISO, eATmegaPinFunc::PCI4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_MOSI, eATmegaPinFunc::TOC2A, eATmegaPinFunc::PCI3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_CS, eATmegaPinFunc::TOC1B, eATmegaPinFunc::PCI2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1A, eATmegaPinFunc::PCI1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_ICP, eATmegaPinFunc::CLKO, eATmegaPinFunc::PCI0 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_C) {
if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI14 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC5, eATmegaPinFunc::TWI_CLK, eATmegaPinFunc::PCI13 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC4, eATmegaPinFunc::TWI_SDA, eATmegaPinFunc::PCI12 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC3, eATmegaPinFunc::PCI11 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC2, eATmegaPinFunc::PCI10 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC1, eATmegaPinFunc::PCI9 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC0, eATmegaPinFunc::PCI8 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_D) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::AIN1, eATmegaPinFunc::PCI23 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::AIN0, eATmegaPinFunc::TOC0A, eATmegaPinFunc::PCI22 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_ECI, eATmegaPinFunc::TOC0B, eATmegaPinFunc::PCI21 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART_CLK, eATmegaPinFunc::TIMER0_ECI, eATmegaPinFunc::PCI20 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT1, eATmegaPinFunc::TOC2B, eATmegaPinFunc::PCI19 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT0, eATmegaPinFunc::PCI18 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART_TXD, eATmegaPinFunc::PCI17 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART_RXD, eATmegaPinFunc::PCI16 };
return { funcs, countof(funcs) };
}
}
#elif defined(__AVR_TRM04__)
if (info.port == eATmegaPort::PORT_A) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD0 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_B) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC0A, eATmegaPinFunc::TOC1C, eATmegaPinFunc::PCI7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1B, eATmegaPinFunc::PCI6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1A, eATmegaPinFunc::PCI5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC2A, eATmegaPinFunc::PCI4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PDO, eATmegaPinFunc::SPI_MISO, eATmegaPinFunc::PCI3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PDI, eATmegaPinFunc::SPI_MOSI, eATmegaPinFunc::PCI2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_SCK, eATmegaPinFunc::PCI1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_CS, eATmegaPinFunc::PCI0 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_C) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD15, eATmegaPinFunc::TIMER3_ICP, eATmegaPinFunc::CLKO };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD14, eATmegaPinFunc::TOC3A };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD13, eATmegaPinFunc::TOC3B };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD12, eATmegaPinFunc::TOC3C };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD11, eATmegaPinFunc::TIMER3_CLKI };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD10 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD9 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_AD8 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_D) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER0_CLKI };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_CLKI };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART1_CLK };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_ICP };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT3, eATmegaPinFunc::USART1_TXD };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT2, eATmegaPinFunc::USART1_RXD };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT1, eATmegaPinFunc::TWI_SDA, eATmegaPinFunc::TOC2B };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT0, eATmegaPinFunc::TWI_CLK, eATmegaPinFunc::TOC0B };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_E) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT7, eATmegaPinFunc::AIN1, eATmegaPinFunc::UVCON };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT6, eATmegaPinFunc::AIN0 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT5, eATmegaPinFunc::TOSC2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT4, eATmegaPinFunc::TOSC2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::UID };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_ALE };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_RD };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EXTMEM_WR };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_F) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC0 };
return { funcs, countof(funcs) };
}
}
#elif defined(__AVR_TRM05__)
if (info.port == eATmegaPort::PORT_A) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC7, eATmegaPinFunc::PCI7 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC6, eATmegaPinFunc::PCI6 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC5, eATmegaPinFunc::PCI5 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC4, eATmegaPinFunc::PCI4 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC3, eATmegaPinFunc::PCI3 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC2, eATmegaPinFunc::PCI2 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC1, eATmegaPinFunc::PCI1 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::ADC0, eATmegaPinFunc::PCI0 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_B) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_SCK, eATmegaPinFunc::PCI15 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_MISO, eATmegaPinFunc::PCI14 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_MOSI, eATmegaPinFunc::PCI13 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::SPI_CS, eATmegaPinFunc::TOC0B, eATmegaPinFunc::PCI12 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::AIN1, eATmegaPinFunc::TOC0A, eATmegaPinFunc::PCI11 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::AIN0, eATmegaPinFunc::EINT2, eATmegaPinFunc::PCI10 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_ECI, eATmegaPinFunc::CLKO, eATmegaPinFunc::PCI9 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER0_ECI, eATmegaPinFunc::USART0_CLK, eATmegaPinFunc::PCI8 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_C) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOSC2, eATmegaPinFunc::PCI23 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOSC1, eATmegaPinFunc::PCI22 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI21 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI20 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI19 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::PCI18 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TWI_SDA, eATmegaPinFunc::PCI17 };
return { funcs, countof(funcs) };
}
else if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TWI_CLK, eATmegaPinFunc::PCI16 };
return { funcs, countof(funcs) };
}
}
else if (info.port == eATmegaPort::PORT_D) {
if (info.pinidx == 7) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC2A, eATmegaPinFunc::PCI31 };
return { funcs, countof(funcs) };
}
if (info.pinidx == 6) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TIMER1_ICP, eATmegaPinFunc::TOC2B, eATmegaPinFunc::PCI30 };
return { funcs, countof(funcs) };
}
if (info.pinidx == 5) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1A, eATmegaPinFunc::PCI29 };
return { funcs, countof(funcs) };
}
if (info.pinidx == 4) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::TOC1B, eATmegaPinFunc::USART1_CLK, eATmegaPinFunc::PCI28 };
return { funcs, countof(funcs) };
}
if (info.pinidx == 3) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT1, eATmegaPinFunc::USART1_TXD, eATmegaPinFunc::PCI27 };
return { funcs, countof(funcs) };
}
if (info.pinidx == 2) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::EINT0, eATmegaPinFunc::USART1_RXD, eATmegaPinFunc::PCI26 };
return { funcs, countof(funcs) };
}
if (info.pinidx == 1) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART0_TXD, eATmegaPinFunc::PCI25 };
return { funcs, countof(funcs) };
}
if (info.pinidx == 0) {
static const eATmegaPinFunc funcs[] = { eATmegaPinFunc::USART0_RXD, eATmegaPinFunc::PCI24 };
return { funcs, countof(funcs) };
}
}
#endif
return ATmegaPinFunctions(); // default and empty.
}
#endif // HAL_AVR_DIRTY_INIT
#endif // __AVR__
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -52,7 +52,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Y_MAX, _ATTACH(Y_MAX_PIN));
TERN_(USE_Y_MIN, _ATTACH(Y_MIN_PIN));
TERN_(USE_Z_MAX, _ATTACH(Z_MAX_PIN));
TERN_(HAS_Z_MIN_PIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_Z_MIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_X2_MAX, _ATTACH(X2_MAX_PIN));
TERN_(USE_X2_MIN, _ATTACH(X2_MIN_PIN));
TERN_(USE_Y2_MAX, _ATTACH(Y2_MAX_PIN));
+1 -1
View File
@@ -47,7 +47,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Y_MAX, _ATTACH(Y_MAX_PIN));
TERN_(USE_Y_MIN, _ATTACH(Y_MIN_PIN));
TERN_(USE_Z_MAX, _ATTACH(Z_MAX_PIN));
TERN_(HAS_Z_MIN_PIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_Z_MIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_X2_MAX, _ATTACH(X2_MAX_PIN));
TERN_(USE_X2_MIN, _ATTACH(X2_MIN_PIN));
TERN_(USE_Y2_MAX, _ATTACH(Y2_MAX_PIN));
+139 -1
View File
@@ -23,7 +23,17 @@
#include "../../inc/MarlinConfig.h"
#include "../shared/Delay.h"
#include "../../../gcode/parser.h"
#include "../../core/millis_t.h"
#include <usb/usb.h>
#include <usb/usbcfg.h>
#include <usb/usbhw.h>
#include <usb/usbcore.h>
#include <usb/cdc.h>
#include <usb/cdcuser.h>
#include <usb/mscuser.h>
#include <CDCSerial.h>
#include <usb/mscuser.h>
DefaultSerial1 USBSerial(false, UsbSerial);
@@ -49,6 +59,132 @@ int freeMemory() {
return result;
}
extern "C" {
#include <debug_frmwrk.h>
int isLPC1769();
void disk_timerproc();
}
extern uint32_t MSC_SD_Init(uint8_t pdrv);
void SysTick_Callback() { disk_timerproc(); }
TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
void MarlinHAL::init() {
// Init LEDs
#if PIN_EXISTS(LED)
SET_DIR_OUTPUT(LED_PIN);
WRITE_PIN_CLR(LED_PIN);
#if PIN_EXISTS(LED2)
SET_DIR_OUTPUT(LED2_PIN);
WRITE_PIN_CLR(LED2_PIN);
#if PIN_EXISTS(LED3)
SET_DIR_OUTPUT(LED3_PIN);
WRITE_PIN_CLR(LED3_PIN);
#if PIN_EXISTS(LED4)
SET_DIR_OUTPUT(LED4_PIN);
WRITE_PIN_CLR(LED4_PIN);
#endif
#endif
#endif
// Flash status LED 3 times to indicate Marlin has started booting
for (uint8_t i = 0; i < 6; ++i) {
TOGGLE(LED_PIN);
delay(100);
}
#endif
// Init Servo Pins
#define INIT_SERVO(N) OUT_WRITE(SERVO##N##_PIN, LOW)
#if HAS_SERVO_0
INIT_SERVO(0);
#endif
#if HAS_SERVO_1
INIT_SERVO(1);
#endif
#if HAS_SERVO_2
INIT_SERVO(2);
#endif
#if HAS_SERVO_3
INIT_SERVO(3);
#endif
//debug_frmwrk_init();
//_DBG("\n\nDebug running\n");
// Initialize the SD card chip select pins as soon as possible
#if PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH);
#endif
#if PIN_EXISTS(ONBOARD_SD_CS) && ONBOARD_SD_CS_PIN != SD_SS_PIN
OUT_WRITE(ONBOARD_SD_CS_PIN, HIGH);
#endif
#ifdef LPC1768_ENABLE_CLKOUT_12M
/**
* CLKOUTCFG register
* bit 8 (CLKOUT_EN) = enables CLKOUT signal. Disabled for now to prevent glitch when enabling GPIO.
* bits 7:4 (CLKOUTDIV) = set to 0 for divider setting of /1
* bits 3:0 (CLKOUTSEL) = set to 1 to select main crystal oscillator as CLKOUT source
*/
LPC_SC->CLKOUTCFG = (0<<8)|(0<<4)|(1<<0);
// set P1.27 pin to function 01 (CLKOUT)
PINSEL_CFG_Type PinCfg;
PinCfg.Portnum = 1;
PinCfg.Pinnum = 27;
PinCfg.Funcnum = 1; // function 01 (CLKOUT)
PinCfg.OpenDrain = 0; // not open drain
PinCfg.Pinmode = 2; // no pull-up/pull-down
PINSEL_ConfigPin(&PinCfg);
// now set CLKOUT_EN bit
SBI(LPC_SC->CLKOUTCFG, 8);
#endif
USB_Init(); // USB Initialization
USB_Connect(false); // USB clear connection
delay(1000); // Give OS time to notice
USB_Connect(true);
TERN_(HAS_SD_HOST_DRIVE, MSC_SD_Init(0)); // Enable USB SD card access
const millis_t usb_timeout = millis() + 2000;
while (!USB_Configuration && PENDING(millis(), usb_timeout)) {
delay(50);
idletask();
#if PIN_EXISTS(LED)
TOGGLE(LED_PIN); // Flash quickly during USB initialization
#endif
}
HAL_timer_init();
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
}
#include "../../sd/cardreader.h"
// HAL idle task
void MarlinHAL::idletask() {
#if HAS_SHARED_MEDIA
// If Marlin is using the SD card we need to lock it to prevent access from
// a PC via USB.
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
// this will not reliably detect delete operations. To be safe we will lock
// the disk if Marlin has it mounted. Unfortunately there is currently no way
// to unmount the disk from the LCD menu.
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
if (card.isMounted())
MSC_Aquire_Lock();
else
MSC_Release_Lock();
#endif
// Perform USB stack housekeeping
MSC_RunDeferredCommands();
}
void MarlinHAL::reboot() { NVIC_SystemReset(); }
uint8_t MarlinHAL::get_reset_source() {
@@ -113,6 +249,8 @@ void flashFirmware(const int16_t) {
#endif // USE_WATCHDOG
#include "../../../gcode/parser.h"
// For M42/M43, scan command line for pin code
// return index into pin map array if found and the pin is valid.
// return dval if not found or not a valid pin.
+1 -1
View File
@@ -74,7 +74,7 @@ void setup_endstop_interrupts() {
#endif
_ATTACH(Z_MAX_PIN);
#endif
#if HAS_Z_MIN_PIN
#if USE_Z_MIN
#if !LPC1768_PIN_INTERRUPT_M(Z_MIN_PIN)
#error "Z_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
-163
View File
@@ -1,163 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
*
*/
#ifdef TARGET_LPC1768
#include <usb/usb.h>
#include <usb/usbcfg.h>
#include <usb/usbhw.h>
#include <usb/usbcore.h>
#include <usb/cdc.h>
#include <usb/cdcuser.h>
#include <usb/mscuser.h>
#include <CDCSerial.h>
#include <usb/mscuser.h>
#include "../../inc/MarlinConfig.h"
#include "../../core/millis_t.h"
#include "../../sd/cardreader.h"
extern uint32_t MSC_SD_Init(uint8_t pdrv);
extern "C" {
#include <debug_frmwrk.h>
extern "C" int isLPC1769();
extern "C" void disk_timerproc();
}
void SysTick_Callback() { disk_timerproc(); }
TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
void MarlinHAL::init() {
// Init LEDs
#if PIN_EXISTS(LED)
SET_DIR_OUTPUT(LED_PIN);
WRITE_PIN_CLR(LED_PIN);
#if PIN_EXISTS(LED2)
SET_DIR_OUTPUT(LED2_PIN);
WRITE_PIN_CLR(LED2_PIN);
#if PIN_EXISTS(LED3)
SET_DIR_OUTPUT(LED3_PIN);
WRITE_PIN_CLR(LED3_PIN);
#if PIN_EXISTS(LED4)
SET_DIR_OUTPUT(LED4_PIN);
WRITE_PIN_CLR(LED4_PIN);
#endif
#endif
#endif
// Flash status LED 3 times to indicate Marlin has started booting
for (uint8_t i = 0; i < 6; ++i) {
TOGGLE(LED_PIN);
delay(100);
}
#endif
// Init Servo Pins
#define INIT_SERVO(N) OUT_WRITE(SERVO##N##_PIN, LOW)
#if HAS_SERVO_0
INIT_SERVO(0);
#endif
#if HAS_SERVO_1
INIT_SERVO(1);
#endif
#if HAS_SERVO_2
INIT_SERVO(2);
#endif
#if HAS_SERVO_3
INIT_SERVO(3);
#endif
//debug_frmwrk_init();
//_DBG("\n\nDebug running\n");
// Initialize the SD card chip select pins as soon as possible
#if PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH);
#endif
#if PIN_EXISTS(ONBOARD_SD_CS) && ONBOARD_SD_CS_PIN != SD_SS_PIN
OUT_WRITE(ONBOARD_SD_CS_PIN, HIGH);
#endif
#ifdef LPC1768_ENABLE_CLKOUT_12M
/**
* CLKOUTCFG register
* bit 8 (CLKOUT_EN) = enables CLKOUT signal. Disabled for now to prevent glitch when enabling GPIO.
* bits 7:4 (CLKOUTDIV) = set to 0 for divider setting of /1
* bits 3:0 (CLKOUTSEL) = set to 1 to select main crystal oscillator as CLKOUT source
*/
LPC_SC->CLKOUTCFG = (0<<8)|(0<<4)|(1<<0);
// set P1.27 pin to function 01 (CLKOUT)
PINSEL_CFG_Type PinCfg;
PinCfg.Portnum = 1;
PinCfg.Pinnum = 27;
PinCfg.Funcnum = 1; // function 01 (CLKOUT)
PinCfg.OpenDrain = 0; // not open drain
PinCfg.Pinmode = 2; // no pull-up/pull-down
PINSEL_ConfigPin(&PinCfg);
// now set CLKOUT_EN bit
SBI(LPC_SC->CLKOUTCFG, 8);
#endif
USB_Init(); // USB Initialization
USB_Connect(false); // USB clear connection
delay(1000); // Give OS time to notice
USB_Connect(true);
TERN_(HAS_SD_HOST_DRIVE, MSC_SD_Init(0)); // Enable USB SD card access
const millis_t usb_timeout = millis() + 2000;
while (!USB_Configuration && PENDING(millis(), usb_timeout)) {
delay(50);
idletask();
#if PIN_EXISTS(LED)
TOGGLE(LED_PIN); // Flash quickly during USB initialization
#endif
}
HAL_timer_init();
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
}
// HAL idle task
void MarlinHAL::idletask() {
#if HAS_SHARED_MEDIA
// If Marlin is using the SD card we need to lock it to prevent access from
// a PC via USB.
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
// this will not reliably detect delete operations. To be safe we will lock
// the disk if Marlin has it mounted. Unfortunately there is currently no way
// to unmount the disk from the LCD menu.
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
if (card.isMounted())
MSC_Aquire_Lock();
else
MSC_Release_Lock();
#endif
// Perform USB stack housekeeping
MSC_RunDeferredCommands();
}
#endif // TARGET_LPC1768
+29 -29
View File
@@ -54,34 +54,34 @@
#include "../../module/endstops.h"
#define MATCH_EILINE(P1,P2) (P1 != P2 && PIN_TO_EILINE(P1) == PIN_TO_EILINE(P2))
#define MATCH_X_MAX_EILINE(P) TERN0(USE_X_MAX, DEFER4(MATCH_EILINE)(P, X_MAX_PIN))
#define MATCH_X_MIN_EILINE(P) TERN0(USE_X_MIN, DEFER4(MATCH_EILINE)(P, X_MIN_PIN))
#define MATCH_Y_MAX_EILINE(P) TERN0(USE_Y_MAX, DEFER4(MATCH_EILINE)(P, Y_MAX_PIN))
#define MATCH_Y_MIN_EILINE(P) TERN0(USE_Y_MIN, DEFER4(MATCH_EILINE)(P, Y_MIN_PIN))
#define MATCH_Z_MAX_EILINE(P) TERN0(USE_Z_MAX, DEFER4(MATCH_EILINE)(P, Z_MAX_PIN))
#define MATCH_Z_MIN_EILINE(P) TERN0(HAS_Z_MIN_PIN, DEFER4(MATCH_EILINE)(P, Z_MIN_PIN))
#define MATCH_I_MAX_EILINE(P) TERN0(USE_I_MAX, DEFER4(MATCH_EILINE)(P, I_MAX_PIN))
#define MATCH_I_MIN_EILINE(P) TERN0(USE_I_MIN, DEFER4(MATCH_EILINE)(P, I_MIN_PIN))
#define MATCH_J_MAX_EILINE(P) TERN0(USE_J_MAX, DEFER4(MATCH_EILINE)(P, J_MAX_PIN))
#define MATCH_J_MIN_EILINE(P) TERN0(USE_J_MIN, DEFER4(MATCH_EILINE)(P, J_MIN_PIN))
#define MATCH_K_MAX_EILINE(P) TERN0(USE_K_MAX, DEFER4(MATCH_EILINE)(P, K_MAX_PIN))
#define MATCH_K_MIN_EILINE(P) TERN0(USE_K_MIN, DEFER4(MATCH_EILINE)(P, K_MIN_PIN))
#define MATCH_U_MAX_EILINE(P) TERN0(USE_U_MAX, DEFER4(MATCH_EILINE)(P, U_MAX_PIN))
#define MATCH_U_MIN_EILINE(P) TERN0(USE_U_MIN, DEFER4(MATCH_EILINE)(P, U_MIN_PIN))
#define MATCH_V_MAX_EILINE(P) TERN0(USE_V_MAX, DEFER4(MATCH_EILINE)(P, V_MAX_PIN))
#define MATCH_V_MIN_EILINE(P) TERN0(USE_V_MIN, DEFER4(MATCH_EILINE)(P, V_MIN_PIN))
#define MATCH_W_MAX_EILINE(P) TERN0(USE_W_MAX, DEFER4(MATCH_EILINE)(P, W_MAX_PIN))
#define MATCH_W_MIN_EILINE(P) TERN0(USE_W_MIN, DEFER4(MATCH_EILINE)(P, W_MIN_PIN))
#define MATCH_X2_MAX_EILINE(P) TERN0(USE_X2_MAX, DEFER4(MATCH_EILINE)(P, X2_MAX_PIN))
#define MATCH_X2_MIN_EILINE(P) TERN0(USE_X2_MIN, DEFER4(MATCH_EILINE)(P, X2_MIN_PIN))
#define MATCH_Y2_MAX_EILINE(P) TERN0(USE_Y2_MAX, DEFER4(MATCH_EILINE)(P, Y2_MAX_PIN))
#define MATCH_Y2_MIN_EILINE(P) TERN0(USE_Y2_MIN, DEFER4(MATCH_EILINE)(P, Y2_MIN_PIN))
#define MATCH_Z2_MAX_EILINE(P) TERN0(USE_Z2_MAX, DEFER4(MATCH_EILINE)(P, Z2_MAX_PIN))
#define MATCH_Z2_MIN_EILINE(P) TERN0(USE_Z2_MIN, DEFER4(MATCH_EILINE)(P, Z2_MIN_PIN))
#define MATCH_Z3_MAX_EILINE(P) TERN0(USE_Z3_MAX, DEFER4(MATCH_EILINE)(P, Z3_MAX_PIN))
#define MATCH_Z3_MIN_EILINE(P) TERN0(USE_Z3_MIN, DEFER4(MATCH_EILINE)(P, Z3_MIN_PIN))
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
#define MATCH_X_MAX_EILINE(P) TERN0(USE_X_MAX, DEFER4(MATCH_EILINE)(P, X_MAX_PIN))
#define MATCH_X_MIN_EILINE(P) TERN0(USE_X_MIN, DEFER4(MATCH_EILINE)(P, X_MIN_PIN))
#define MATCH_Y_MAX_EILINE(P) TERN0(USE_Y_MAX, DEFER4(MATCH_EILINE)(P, Y_MAX_PIN))
#define MATCH_Y_MIN_EILINE(P) TERN0(USE_Y_MIN, DEFER4(MATCH_EILINE)(P, Y_MIN_PIN))
#define MATCH_Z_MAX_EILINE(P) TERN0(USE_Z_MAX, DEFER4(MATCH_EILINE)(P, Z_MAX_PIN))
#define MATCH_Z_MIN_EILINE(P) TERN0(USE_Z_MIN, DEFER4(MATCH_EILINE)(P, Z_MIN_PIN))
#define MATCH_I_MAX_EILINE(P) TERN0(USE_I_MAX, DEFER4(MATCH_EILINE)(P, I_MAX_PIN))
#define MATCH_I_MIN_EILINE(P) TERN0(USE_I_MIN, DEFER4(MATCH_EILINE)(P, I_MIN_PIN))
#define MATCH_J_MAX_EILINE(P) TERN0(USE_J_MAX, DEFER4(MATCH_EILINE)(P, J_MAX_PIN))
#define MATCH_J_MIN_EILINE(P) TERN0(USE_J_MIN, DEFER4(MATCH_EILINE)(P, J_MIN_PIN))
#define MATCH_K_MAX_EILINE(P) TERN0(USE_K_MAX, DEFER4(MATCH_EILINE)(P, K_MAX_PIN))
#define MATCH_K_MIN_EILINE(P) TERN0(USE_K_MIN, DEFER4(MATCH_EILINE)(P, K_MIN_PIN))
#define MATCH_U_MAX_EILINE(P) TERN0(USE_U_MAX, DEFER4(MATCH_EILINE)(P, U_MAX_PIN))
#define MATCH_U_MIN_EILINE(P) TERN0(USE_U_MIN, DEFER4(MATCH_EILINE)(P, U_MIN_PIN))
#define MATCH_V_MAX_EILINE(P) TERN0(USE_V_MAX, DEFER4(MATCH_EILINE)(P, V_MAX_PIN))
#define MATCH_V_MIN_EILINE(P) TERN0(USE_V_MIN, DEFER4(MATCH_EILINE)(P, V_MIN_PIN))
#define MATCH_W_MAX_EILINE(P) TERN0(USE_W_MAX, DEFER4(MATCH_EILINE)(P, W_MAX_PIN))
#define MATCH_W_MIN_EILINE(P) TERN0(USE_W_MIN, DEFER4(MATCH_EILINE)(P, W_MIN_PIN))
#define MATCH_X2_MAX_EILINE(P) TERN0(USE_X2_MAX, DEFER4(MATCH_EILINE)(P, X2_MAX_PIN))
#define MATCH_X2_MIN_EILINE(P) TERN0(USE_X2_MIN, DEFER4(MATCH_EILINE)(P, X2_MIN_PIN))
#define MATCH_Y2_MAX_EILINE(P) TERN0(USE_Y2_MAX, DEFER4(MATCH_EILINE)(P, Y2_MAX_PIN))
#define MATCH_Y2_MIN_EILINE(P) TERN0(USE_Y2_MIN, DEFER4(MATCH_EILINE)(P, Y2_MIN_PIN))
#define MATCH_Z2_MAX_EILINE(P) TERN0(USE_Z2_MAX, DEFER4(MATCH_EILINE)(P, Z2_MAX_PIN))
#define MATCH_Z2_MIN_EILINE(P) TERN0(USE_Z2_MIN, DEFER4(MATCH_EILINE)(P, Z2_MIN_PIN))
#define MATCH_Z3_MAX_EILINE(P) TERN0(USE_Z3_MAX, DEFER4(MATCH_EILINE)(P, Z3_MAX_PIN))
#define MATCH_Z3_MIN_EILINE(P) TERN0(USE_Z3_MIN, DEFER4(MATCH_EILINE)(P, Z3_MIN_PIN))
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN))
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \
@@ -136,7 +136,7 @@ void setup_endstop_interrupts() {
#endif
_ATTACH(Z_MAX_PIN);
#endif
#if HAS_Z_MIN_PIN
#if USE_Z_MIN
#if !AVAILABLE_EILINE(Z_MIN_PIN)
#error "Z_MIN_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
+29 -29
View File
@@ -53,34 +53,34 @@
#include "../../module/endstops.h"
#define MATCH_EILINE(P1,P2) (P1 != P2 && PIN_TO_EILINE(P1) == PIN_TO_EILINE(P2))
#define MATCH_X_MAX_EILINE(P) TERN0(USE_X_MAX, DEFER4(MATCH_EILINE)(P, X_MAX_PIN))
#define MATCH_X_MIN_EILINE(P) TERN0(USE_X_MIN, DEFER4(MATCH_EILINE)(P, X_MIN_PIN))
#define MATCH_Y_MAX_EILINE(P) TERN0(USE_Y_MAX, DEFER4(MATCH_EILINE)(P, Y_MAX_PIN))
#define MATCH_Y_MIN_EILINE(P) TERN0(USE_Y_MIN, DEFER4(MATCH_EILINE)(P, Y_MIN_PIN))
#define MATCH_Z_MAX_EILINE(P) TERN0(USE_Z_MAX, DEFER4(MATCH_EILINE)(P, Z_MAX_PIN))
#define MATCH_Z_MIN_EILINE(P) TERN0(HAS_Z_MIN_PIN, DEFER4(MATCH_EILINE)(P, Z_MIN_PIN))
#define MATCH_I_MAX_EILINE(P) TERN0(USE_I_MAX, DEFER4(MATCH_EILINE)(P, I_MAX_PIN))
#define MATCH_I_MIN_EILINE(P) TERN0(USE_I_MIN, DEFER4(MATCH_EILINE)(P, I_MIN_PIN))
#define MATCH_J_MAX_EILINE(P) TERN0(USE_J_MAX, DEFER4(MATCH_EILINE)(P, J_MAX_PIN))
#define MATCH_J_MIN_EILINE(P) TERN0(USE_J_MIN, DEFER4(MATCH_EILINE)(P, J_MIN_PIN))
#define MATCH_K_MAX_EILINE(P) TERN0(USE_K_MAX, DEFER4(MATCH_EILINE)(P, K_MAX_PIN))
#define MATCH_K_MIN_EILINE(P) TERN0(USE_K_MIN, DEFER4(MATCH_EILINE)(P, K_MIN_PIN))
#define MATCH_U_MAX_EILINE(P) TERN0(USE_U_MAX, DEFER4(MATCH_EILINE)(P, U_MAX_PIN))
#define MATCH_U_MIN_EILINE(P) TERN0(USE_U_MIN, DEFER4(MATCH_EILINE)(P, U_MIN_PIN))
#define MATCH_V_MAX_EILINE(P) TERN0(USE_V_MAX, DEFER4(MATCH_EILINE)(P, V_MAX_PIN))
#define MATCH_V_MIN_EILINE(P) TERN0(USE_V_MIN, DEFER4(MATCH_EILINE)(P, V_MIN_PIN))
#define MATCH_W_MAX_EILINE(P) TERN0(USE_W_MAX, DEFER4(MATCH_EILINE)(P, W_MAX_PIN))
#define MATCH_W_MIN_EILINE(P) TERN0(USE_W_MIN, DEFER4(MATCH_EILINE)(P, W_MIN_PIN))
#define MATCH_X2_MAX_EILINE(P) TERN0(USE_X2_MAX, DEFER4(MATCH_EILINE)(P, X2_MAX_PIN))
#define MATCH_X2_MIN_EILINE(P) TERN0(USE_X2_MIN, DEFER4(MATCH_EILINE)(P, X2_MIN_PIN))
#define MATCH_Y2_MAX_EILINE(P) TERN0(USE_Y2_MAX, DEFER4(MATCH_EILINE)(P, Y2_MAX_PIN))
#define MATCH_Y2_MIN_EILINE(P) TERN0(USE_Y2_MIN, DEFER4(MATCH_EILINE)(P, Y2_MIN_PIN))
#define MATCH_Z2_MAX_EILINE(P) TERN0(USE_Z2_MAX, DEFER4(MATCH_EILINE)(P, Z2_MAX_PIN))
#define MATCH_Z2_MIN_EILINE(P) TERN0(USE_Z2_MIN, DEFER4(MATCH_EILINE)(P, Z2_MIN_PIN))
#define MATCH_Z3_MAX_EILINE(P) TERN0(USE_Z3_MAX, DEFER4(MATCH_EILINE)(P, Z3_MAX_PIN))
#define MATCH_Z3_MIN_EILINE(P) TERN0(USE_Z3_MIN, DEFER4(MATCH_EILINE)(P, Z3_MIN_PIN))
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
#define MATCH_X_MAX_EILINE(P) TERN0(USE_X_MAX, DEFER4(MATCH_EILINE)(P, X_MAX_PIN))
#define MATCH_X_MIN_EILINE(P) TERN0(USE_X_MIN, DEFER4(MATCH_EILINE)(P, X_MIN_PIN))
#define MATCH_Y_MAX_EILINE(P) TERN0(USE_Y_MAX, DEFER4(MATCH_EILINE)(P, Y_MAX_PIN))
#define MATCH_Y_MIN_EILINE(P) TERN0(USE_Y_MIN, DEFER4(MATCH_EILINE)(P, Y_MIN_PIN))
#define MATCH_Z_MAX_EILINE(P) TERN0(USE_Z_MAX, DEFER4(MATCH_EILINE)(P, Z_MAX_PIN))
#define MATCH_Z_MIN_EILINE(P) TERN0(USE_Z_MIN, DEFER4(MATCH_EILINE)(P, Z_MIN_PIN))
#define MATCH_I_MAX_EILINE(P) TERN0(USE_I_MAX, DEFER4(MATCH_EILINE)(P, I_MAX_PIN))
#define MATCH_I_MIN_EILINE(P) TERN0(USE_I_MIN, DEFER4(MATCH_EILINE)(P, I_MIN_PIN))
#define MATCH_J_MAX_EILINE(P) TERN0(USE_J_MAX, DEFER4(MATCH_EILINE)(P, J_MAX_PIN))
#define MATCH_J_MIN_EILINE(P) TERN0(USE_J_MIN, DEFER4(MATCH_EILINE)(P, J_MIN_PIN))
#define MATCH_K_MAX_EILINE(P) TERN0(USE_K_MAX, DEFER4(MATCH_EILINE)(P, K_MAX_PIN))
#define MATCH_K_MIN_EILINE(P) TERN0(USE_K_MIN, DEFER4(MATCH_EILINE)(P, K_MIN_PIN))
#define MATCH_U_MAX_EILINE(P) TERN0(USE_U_MAX, DEFER4(MATCH_EILINE)(P, U_MAX_PIN))
#define MATCH_U_MIN_EILINE(P) TERN0(USE_U_MIN, DEFER4(MATCH_EILINE)(P, U_MIN_PIN))
#define MATCH_V_MAX_EILINE(P) TERN0(USE_V_MAX, DEFER4(MATCH_EILINE)(P, V_MAX_PIN))
#define MATCH_V_MIN_EILINE(P) TERN0(USE_V_MIN, DEFER4(MATCH_EILINE)(P, V_MIN_PIN))
#define MATCH_W_MAX_EILINE(P) TERN0(USE_W_MAX, DEFER4(MATCH_EILINE)(P, W_MAX_PIN))
#define MATCH_W_MIN_EILINE(P) TERN0(USE_W_MIN, DEFER4(MATCH_EILINE)(P, W_MIN_PIN))
#define MATCH_X2_MAX_EILINE(P) TERN0(USE_X2_MAX, DEFER4(MATCH_EILINE)(P, X2_MAX_PIN))
#define MATCH_X2_MIN_EILINE(P) TERN0(USE_X2_MIN, DEFER4(MATCH_EILINE)(P, X2_MIN_PIN))
#define MATCH_Y2_MAX_EILINE(P) TERN0(USE_Y2_MAX, DEFER4(MATCH_EILINE)(P, Y2_MAX_PIN))
#define MATCH_Y2_MIN_EILINE(P) TERN0(USE_Y2_MIN, DEFER4(MATCH_EILINE)(P, Y2_MIN_PIN))
#define MATCH_Z2_MAX_EILINE(P) TERN0(USE_Z2_MAX, DEFER4(MATCH_EILINE)(P, Z2_MAX_PIN))
#define MATCH_Z2_MIN_EILINE(P) TERN0(USE_Z2_MIN, DEFER4(MATCH_EILINE)(P, Z2_MIN_PIN))
#define MATCH_Z3_MAX_EILINE(P) TERN0(USE_Z3_MAX, DEFER4(MATCH_EILINE)(P, Z3_MAX_PIN))
#define MATCH_Z3_MIN_EILINE(P) TERN0(USE_Z3_MIN, DEFER4(MATCH_EILINE)(P, Z3_MIN_PIN))
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN))
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \
@@ -135,7 +135,7 @@ void setup_endstop_interrupts() {
#endif
_ATTACH(Z_MAX_PIN);
#endif
#if HAS_Z_MIN_PIN
#if USE_Z_MIN
#if !AVAILABLE_EILINE(Z_MIN_PIN)
#error "Z_MIN_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
+15 -15
View File
@@ -57,61 +57,61 @@
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)
#if WITHIN(SERIAL_PORT, 1, 6)
#if WITHIN(SERIAL_PORT, 1, 9)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#elif !defined(USBCON)
#error "SERIAL_PORT must be from 1 to 6."
#error "SERIAL_PORT must be from 1 to 9."
#elif SERIAL_PORT == -1
#define MYSERIAL1 MSerialUSB
#else
#error "SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
#error "SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
#endif
#ifdef SERIAL_PORT_2
#if WITHIN(SERIAL_PORT_2, 1, 6)
#if WITHIN(SERIAL_PORT_2, 1, 9)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#elif !defined(USBCON)
#error "SERIAL_PORT_2 must be from 1 to 6."
#error "SERIAL_PORT_2 must be from 1 to 9."
#elif SERIAL_PORT_2 == -1
#define MYSERIAL2 MSerialUSB
#else
#error "SERIAL_PORT_2 must be from 1 to 6, or -1 for Native USB."
#error "SERIAL_PORT_2 must be from 1 to 9, or -1 for Native USB."
#endif
#endif
#ifdef SERIAL_PORT_3
#if WITHIN(SERIAL_PORT_3, 1, 6)
#if WITHIN(SERIAL_PORT_3, 1, 9)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#elif !defined(USBCON)
#error "SERIAL_PORT_3 must be from 1 to 6."
#error "SERIAL_PORT_3 must be from 1 to 9."
#elif SERIAL_PORT_3 == -1
#define MYSERIAL3 MSerialUSB
#else
#error "SERIAL_PORT_3 must be from 1 to 6, or -1 for Native USB."
#error "SERIAL_PORT_3 must be from 1 to 9, or -1 for Native USB."
#endif
#endif
#ifdef MMU2_SERIAL_PORT
#if WITHIN(MMU2_SERIAL_PORT, 1, 6)
#if WITHIN(MMU2_SERIAL_PORT, 1, 9)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#elif !defined(USBCON)
#error "MMU2_SERIAL_PORT must be from 1 to 6."
#error "MMU2_SERIAL_PORT must be from 1 to 9."
#elif MMU2_SERIAL_PORT == -1
#define MMU2_SERIAL MSerialUSB
#else
#error "MMU2_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
#error "MMU2_SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
#endif
#endif
#ifdef LCD_SERIAL_PORT
#if WITHIN(LCD_SERIAL_PORT, 1, 6)
#if WITHIN(LCD_SERIAL_PORT, 1, 9)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#elif !defined(USBCON)
#error "LCD_SERIAL_PORT must be from 1 to 6."
#error "LCD_SERIAL_PORT must be from 1 to 9."
#elif LCD_SERIAL_PORT == -1
#define LCD_SERIAL MSerialUSB
#else
#error "LCD_SERIAL_PORT must be from 1 to 6, or -1 for Native USB."
#error "LCD_SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
#endif
#if HAS_DGUS_LCD
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
+9
View File
@@ -37,6 +37,15 @@
#ifndef USART5
#define USART5 UART5
#endif
#ifndef USART7
#define USART7 UART7
#endif
#ifndef USART8
#define USART8 UART8
#endif
#ifndef USART9
#define USART9 UART9
#endif
#define DECLARE_SERIAL_PORT(ser_num) \
void _rx_complete_irq_ ## ser_num (serial_t * obj); \
+5 -2
View File
@@ -45,7 +45,7 @@ struct USARTMin {
volatile uint32_t CR2;
};
#if WITHIN(SERIAL_PORT, 1, 6)
#if WITHIN(SERIAL_PORT, 1, 9)
// Depending on the CPU, the serial port is different for USART1
static const uintptr_t regsAddr[] = {
TERN(STM32F1xx, 0x40013800, 0x40011000), // USART1
@@ -54,6 +54,9 @@ struct USARTMin {
0x40004C00, // UART4_BASE
0x40005000, // UART5_BASE
0x40011400 // USART6
0x40007800 // UART7_BASE
0x40007C00 // UART8_BASE
0x40011800 // UART9_BASE
};
static USARTMin * regs = (USARTMin*)regsAddr[SERIAL_PORT - 1];
#endif
@@ -116,7 +119,7 @@ static void TXBegin() {
// A SW memory barrier, to ensure GCC does not overoptimize loops
#define sw_barrier() __asm__ volatile("": : :"memory");
static void TX(char c) {
#if WITHIN(SERIAL_PORT, 1, 6)
#if WITHIN(SERIAL_PORT, 1, 9)
constexpr uint32_t usart_sr_txe = _BV(7);
while (!(regs->SR & usart_sr_txe)) {
hal.watchdog_refresh();
+1 -1
View File
@@ -34,7 +34,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Y_MAX, _ATTACH(Y_MAX_PIN));
TERN_(USE_Y_MIN, _ATTACH(Y_MIN_PIN));
TERN_(USE_Z_MAX, _ATTACH(Z_MAX_PIN));
TERN_(HAS_Z_MIN_PIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_Z_MIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_X2_MAX, _ATTACH(X2_MAX_PIN));
TERN_(USE_X2_MIN, _ATTACH(X2_MIN_PIN));
TERN_(USE_Y2_MAX, _ATTACH(Y2_MAX_PIN));
+1 -1
View File
@@ -59,7 +59,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Y_MAX, _ATTACH(Y_MAX_PIN));
TERN_(USE_Y_MIN, _ATTACH(Y_MIN_PIN));
TERN_(USE_Z_MAX, _ATTACH(Z_MAX_PIN));
TERN_(HAS_Z_MIN_PIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_Z_MIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_X2_MAX, _ATTACH(X2_MAX_PIN));
TERN_(USE_X2_MIN, _ATTACH(X2_MIN_PIN));
TERN_(USE_Y2_MAX, _ATTACH(Y2_MAX_PIN));
@@ -52,7 +52,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Y_MAX, _ATTACH(Y_MAX_PIN));
TERN_(USE_Y_MIN, _ATTACH(Y_MIN_PIN));
TERN_(USE_Z_MAX, _ATTACH(Z_MAX_PIN));
TERN_(HAS_Z_MIN_PIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_Z_MIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_X2_MAX, _ATTACH(X2_MAX_PIN));
TERN_(USE_X2_MIN, _ATTACH(X2_MIN_PIN));
TERN_(USE_Y2_MAX, _ATTACH(Y2_MAX_PIN));
@@ -51,7 +51,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Y_MAX, _ATTACH(Y_MAX_PIN));
TERN_(USE_Y_MIN, _ATTACH(Y_MIN_PIN));
TERN_(USE_Z_MAX, _ATTACH(Z_MAX_PIN));
TERN_(HAS_Z_MIN_PIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_Z_MIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_X2_MAX, _ATTACH(X2_MAX_PIN));
TERN_(USE_X2_MIN, _ATTACH(X2_MIN_PIN));
TERN_(USE_Y2_MAX, _ATTACH(Y2_MAX_PIN));
@@ -51,7 +51,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Y_MAX, _ATTACH(Y_MAX_PIN));
TERN_(USE_Y_MIN, _ATTACH(Y_MIN_PIN));
TERN_(USE_Z_MAX, _ATTACH(Z_MAX_PIN));
TERN_(HAS_Z_MIN_PIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_Z_MIN, _ATTACH(Z_MIN_PIN));
TERN_(USE_X2_MAX, _ATTACH(X2_MAX_PIN));
TERN_(USE_X2_MIN, _ATTACH(X2_MIN_PIN));
TERN_(USE_Y2_MAX, _ATTACH(Y2_MAX_PIN));
+2
View File
@@ -249,6 +249,8 @@
#define STR_LASER_TEMP "laser temperature"
#define STR_STOPPED_HEATER ", system stopped! Heater_ID: "
#define STR_DETECTED_TEMP_B " (temp: "
#define STR_DETECTED_TEMP_E ")"
#define STR_REDUNDANCY "Heater switched off. Temperature difference between temp sensors is too high !"
#define STR_T_HEATING_FAILED "Heating failed"
#define STR_T_THERMAL_RUNAWAY "Thermal Runaway"
+4 -4
View File
@@ -55,15 +55,15 @@ void HotendIdleProtection::check_hotends(const millis_t &ms) {
if (!do_prot)
next_protect_ms = 0; // No hotends are hot so cancel timeout
else if (!next_protect_ms) // Timeout is possible?
next_protect_ms = ms + cfg.timeout * 1000; // Start timeout if not already set
next_protect_ms = ms + 1000UL * cfg.timeout; // Start timeout if not already set
}
void HotendIdleProtection::check_e_motion(const millis_t &ms) {
static float old_e_position = 0;
if (old_e_position != current_position.e) {
old_e_position = current_position.e; // Track filament motion
if (next_protect_ms) // If some heater is on then...
next_protect_ms = ms + cfg.timeout * 1000; // ...delay the timeout till later
old_e_position = current_position.e; // Track filament motion
if (next_protect_ms) // If some heater is on then...
next_protect_ms = ms + 1000UL * cfg.timeout; // ...delay the timeout till later
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ bool FilamentMonitorBase::enabled = true,
#if HAS_FILAMENT_RUNOUT_DISTANCE
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
volatile countdown_t RunoutResponseDelayed::mm_countdown;
countdown_t RunoutResponseDelayed::mm_countdown;
#if ENABLED(FILAMENT_MOTION_SENSOR)
uint8_t FilamentSensorEncoder::motion_detected;
#endif
+55 -15
View File
@@ -30,7 +30,8 @@
#include "../module/planner.h"
#include "../module/stepper.h" // for block_t
#include "../gcode/queue.h"
#include "../feature/pause.h"
#include "../feature/pause.h" // for did_pause_print
#include "../MarlinCore.h" // for printingIsActive()
#include "../inc/MarlinConfig.h"
@@ -50,9 +51,16 @@
#define HAS_FILAMENT_SWITCH 1
#endif
typedef Flags<8> runout_flags_t;
typedef Flags<
#if NUM_MOTION_SENSORS > NUM_RUNOUT_SENSORS
NUM_MOTION_SENSORS
#else
NUM_RUNOUT_SENSORS
#endif
> runout_flags_t;
void event_filament_runout(const uint8_t extruder);
inline bool should_monitor_runout() { return did_pause_print || printingIsActive(); }
template<class RESPONSE_T, class SENSOR_T>
class TFilamentMonitor;
@@ -128,7 +136,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Give the response a chance to update its counter.
static void run() {
if (enabled && !filament_ran_out && (printingIsActive() || did_pause_print)) {
if (enabled && !filament_ran_out && should_monitor_runout()) {
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
response.run();
sensor.run();
@@ -340,8 +348,10 @@ class FilamentSensorBase {
typedef struct {
float runout[NUM_RUNOUT_SENSORS];
Flags<NUM_RUNOUT_SENSORS> runout_reset; // Reset runout later
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
float motion[NUM_MOTION_SENSORS];
Flags<NUM_MOTION_SENSORS> motion_reset; // Reset motion later
#endif
} countdown_t;
@@ -350,7 +360,7 @@ class FilamentSensorBase {
// during a runout condition.
class RunoutResponseDelayed {
private:
static volatile countdown_t mm_countdown;
static countdown_t mm_countdown;
public:
static float runout_distance_mm;
@@ -389,26 +399,56 @@ class FilamentSensorBase {
}
static void filament_present(const uint8_t extruder) {
mm_countdown.runout[extruder] = runout_distance_mm;
if (mm_countdown.runout[extruder] < runout_distance_mm || did_pause_print) {
// Reset runout only if it is smaller than runout_distance or printing is paused.
// On Bowden systems retract may be larger than runout_distance_mm, so if retract
// was added leave it in place, or the following unretract will cause runout event.
mm_countdown.runout[extruder] = runout_distance_mm;
mm_countdown.runout_reset.clear(extruder);
}
else {
// If runout is larger than runout distance, we cannot reset right now, as Bowden and retract
// distance larger than runout_distance_mm leads to negative runout right after unretract.
// But we cannot ignore filament_present event. After unretract, runout will become smaller
// than runout_distance_mm and should be reset after that. So activate delayed reset.
mm_countdown.runout_reset.set(extruder);
}
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
static void filament_motion_present(const uint8_t extruder) {
mm_countdown.motion[extruder] = runout_distance_mm;
// Same logic as filament_present
if (mm_countdown.motion[extruder] < runout_distance_mm || did_pause_print) {
mm_countdown.motion[extruder] = runout_distance_mm;
mm_countdown.motion_reset.clear(extruder);
}
else
mm_countdown.motion_reset.set(extruder);
}
#endif
static void block_completed(const block_t * const b) {
if (b->steps.x || b->steps.y || b->steps.z || did_pause_print) { // Allow pause purge move to re-trigger runout state
// Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
const uint8_t e = b->extruder;
const int32_t steps = b->steps.e;
const float mm = (b->direction_bits.e ? steps : -steps) * planner.mm_per_step[E_AXIS_N(e)];
if (e < NUM_RUNOUT_SENSORS) mm_countdown.runout[e] -= mm;
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
if (e < NUM_MOTION_SENSORS) mm_countdown.motion[e] -= mm;
#endif
const int32_t esteps = b->steps.e;
if (!esteps) return;
// No calculation unless paused or printing
if (!should_monitor_runout()) return;
// No need to ignore retract/unretract movement since they complement each other
const uint8_t e = b->extruder;
const float mm = (b->direction_bits.e ? esteps : -esteps) * planner.mm_per_step[E_AXIS_N(e)];
if (e < NUM_RUNOUT_SENSORS) {
mm_countdown.runout[e] -= mm;
if (mm_countdown.runout_reset[e]) filament_present(e); // Reset pending. Try to reset.
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
if (e < NUM_MOTION_SENSORS) {
mm_countdown.motion[e] -= mm;
if (mm_countdown.motion_reset[e]) filament_motion_present(e); // Reset pending. Try to reset.
}
#endif
}
};
+58 -51
View File
@@ -254,69 +254,67 @@ void GcodeSuite::G28() {
// Reset to the XY plane
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
#define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
#if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2) || (ENABLED(DELTA) && HAS_CURRENT_HOME(Z)) || HAS_CURRENT_HOME(I) || HAS_CURRENT_HOME(J) || HAS_CURRENT_HOME(K) || HAS_CURRENT_HOME(U) || HAS_CURRENT_HOME(V) || HAS_CURRENT_HOME(W)
#define _OR_HAS_CURR_HOME(N) HAS_CURRENT_HOME(N) ||
#if MAIN_AXIS_MAP(_OR_HAS_CURR_HOME) MAP(_OR_HAS_CURR_HOME, X2, Y2, Z2, Z3, Z4) 0
#define HAS_HOMING_CURRENT 1
#endif
#if HAS_HOMING_CURRENT
auto debug_current = [](FSTR_P const s, const int16_t a, const int16_t b) {
DEBUG_ECHOLN(s, F(" current: "), a, F(" -> "), b);
};
#if ENABLED(DEBUG_LEVELING_FEATURE)
auto debug_current = [](FSTR_P const s, const int16_t a, const int16_t b) {
if (DEBUGGING(LEVELING)) { DEBUG_ECHOF(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b); }
};
#else
#define debug_current(...)
#endif
#define _SAVE_SET_CURRENT(A) \
const int16_t saved_current_##A = stepper##A.getMilliamps(); \
stepper##A.rms_current(A##_CURRENT_HOME); \
debug_current(F(STR_##A), saved_current_##A, A##_CURRENT_HOME)
#if HAS_CURRENT_HOME(X)
const int16_t tmc_save_current_X = stepperX.getMilliamps();
stepperX.rms_current(X_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_X), tmc_save_current_X, X_CURRENT_HOME);
_SAVE_SET_CURRENT(X);
#endif
#if HAS_CURRENT_HOME(X2)
const int16_t tmc_save_current_X2 = stepperX2.getMilliamps();
stepperX2.rms_current(X2_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_X2), tmc_save_current_X2, X2_CURRENT_HOME);
_SAVE_SET_CURRENT(X2);
#endif
#if HAS_CURRENT_HOME(Y)
const int16_t tmc_save_current_Y = stepperY.getMilliamps();
stepperY.rms_current(Y_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_Y), tmc_save_current_Y, Y_CURRENT_HOME);
_SAVE_SET_CURRENT(Y);
#endif
#if HAS_CURRENT_HOME(Y2)
const int16_t tmc_save_current_Y2 = stepperY2.getMilliamps();
stepperY2.rms_current(Y2_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_Y2), tmc_save_current_Y2, Y2_CURRENT_HOME);
_SAVE_SET_CURRENT(Y2);
#endif
#if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
const int16_t tmc_save_current_Z = stepperZ.getMilliamps();
stepperZ.rms_current(Z_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_Z), tmc_save_current_Z, Z_CURRENT_HOME);
#if HAS_CURRENT_HOME(Z)
_SAVE_SET_CURRENT(Z);
#endif
#if HAS_CURRENT_HOME(Z2)
_SAVE_SET_CURRENT(Z2);
#endif
#if HAS_CURRENT_HOME(Z3)
_SAVE_SET_CURRENT(Z3);
#endif
#if HAS_CURRENT_HOME(Z4)
_SAVE_SET_CURRENT(Z4);
#endif
#if HAS_CURRENT_HOME(I)
const int16_t tmc_save_current_I = stepperI.getMilliamps();
stepperI.rms_current(I_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_I), tmc_save_current_I, I_CURRENT_HOME);
_SAVE_SET_CURRENT(I);
#endif
#if HAS_CURRENT_HOME(J)
const int16_t tmc_save_current_J = stepperJ.getMilliamps();
stepperJ.rms_current(J_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_J), tmc_save_current_J, J_CURRENT_HOME);
_SAVE_SET_CURRENT(J);
#endif
#if HAS_CURRENT_HOME(K)
const int16_t tmc_save_current_K = stepperK.getMilliamps();
stepperK.rms_current(K_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_K), tmc_save_current_K, K_CURRENT_HOME);
_SAVE_SET_CURRENT(K);
#endif
#if HAS_CURRENT_HOME(U)
const int16_t tmc_save_current_U = stepperU.getMilliamps();
stepperU.rms_current(U_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_U), tmc_save_current_U, U_CURRENT_HOME);
_SAVE_SET_CURRENT(U);
#endif
#if HAS_CURRENT_HOME(V)
const int16_t tmc_save_current_V = stepperV.getMilliamps();
stepperV.rms_current(V_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_V), tmc_save_current_V, V_CURRENT_HOME);
_SAVE_SET_CURRENT(V);
#endif
#if HAS_CURRENT_HOME(W)
const int16_t tmc_save_current_W = stepperW.getMilliamps();
stepperW.rms_current(W_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_W), tmc_save_current_W, W_CURRENT_HOME);
_SAVE_SET_CURRENT(W);
#endif
#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
@@ -577,37 +575,46 @@ void GcodeSuite::G28() {
#if HAS_HOMING_CURRENT
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Restore driver current...");
#if HAS_CURRENT_HOME(X)
stepperX.rms_current(tmc_save_current_X);
stepperX.rms_current(saved_current_X);
#endif
#if HAS_CURRENT_HOME(X2)
stepperX2.rms_current(tmc_save_current_X2);
stepperX2.rms_current(saved_current_X2);
#endif
#if HAS_CURRENT_HOME(Y)
stepperY.rms_current(tmc_save_current_Y);
stepperY.rms_current(saved_current_Y);
#endif
#if HAS_CURRENT_HOME(Y2)
stepperY2.rms_current(tmc_save_current_Y2);
stepperY2.rms_current(saved_current_Y2);
#endif
#if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
stepperZ.rms_current(tmc_save_current_Z);
#if HAS_CURRENT_HOME(Z)
stepperZ.rms_current(saved_current_Z);
#endif
#if HAS_CURRENT_HOME(Z2)
stepperZ2.rms_current(saved_current_Z2);
#endif
#if HAS_CURRENT_HOME(Z3)
stepperZ3.rms_current(saved_current_Z3);
#endif
#if HAS_CURRENT_HOME(Z4)
stepperZ4.rms_current(saved_current_Z4);
#endif
#if HAS_CURRENT_HOME(I)
stepperI.rms_current(tmc_save_current_I);
stepperI.rms_current(saved_current_I);
#endif
#if HAS_CURRENT_HOME(J)
stepperJ.rms_current(tmc_save_current_J);
stepperJ.rms_current(saved_current_J);
#endif
#if HAS_CURRENT_HOME(K)
stepperK.rms_current(tmc_save_current_K);
stepperK.rms_current(saved_current_K);
#endif
#if HAS_CURRENT_HOME(U)
stepperU.rms_current(tmc_save_current_U);
stepperU.rms_current(saved_current_U);
#endif
#if HAS_CURRENT_HOME(V)
stepperV.rms_current(tmc_save_current_V);
stepperV.rms_current(saved_current_V);
#endif
#if HAS_CURRENT_HOME(W)
stepperW.rms_current(tmc_save_current_W);
stepperW.rms_current(saved_current_W);
#endif
#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
+2 -2
View File
@@ -67,9 +67,9 @@ float lcd_probe_pt(const xy_pos_t &xy);
void ac_home() {
endstops.enable(true);
TERN_(SENSORLESS_HOMING, endstops.set_homing_current(true));
TERN_(SENSORLESS_HOMING, endstops.set_z_sensorless_current(true));
home_delta();
TERN_(SENSORLESS_HOMING, endstops.set_homing_current(false));
TERN_(SENSORLESS_HOMING, endstops.set_z_sensorless_current(false));
endstops.not_homing();
}
+13 -11
View File
@@ -1422,24 +1422,26 @@
* Conditionals based on the type of Bed Probe
*/
#if HAS_BED_PROBE
#if ALL(DELTA, SENSORLESS_PROBING)
#define HAS_DELTA_SENSORLESS_PROBING 1
#else
#define HAS_REAL_BED_PROBE 1
#endif
#if HAS_REAL_BED_PROBE && NONE(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, Z_SPI_SENSORLESS)
#define NEED_Z_MIN_PROBE_PIN 1
#endif
#if Z_HOME_TO_MIN && (!NEED_Z_MIN_PROBE_PIN || ENABLED(USE_PROBE_FOR_Z_HOMING))
#define HOMING_Z_WITH_PROBE 1
#endif
#if DISABLED(NOZZLE_AS_PROBE)
#define HAS_PROBE_XY_OFFSET 1
#endif
#if ALL(DELTA, SENSORLESS_PROBING)
#define HAS_DELTA_SENSORLESS_PROBING 1
#endif
#if NONE(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, HAS_DELTA_SENSORLESS_PROBING)
#define USE_Z_MIN_PROBE 1
#endif
#if Z_HOME_TO_MIN && (DISABLED(USE_Z_MIN_PROBE) || ENABLED(USE_PROBE_FOR_Z_HOMING))
#define HOMING_Z_WITH_PROBE 1
#if ANY(Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE)
#define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
#endif
#ifndef Z_PROBE_LOW_POINT
#define Z_PROBE_LOW_POINT -5
#endif
#if ANY(Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE)
#define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
#endif
#if MULTIPLE_PROBING > 1
#if EXTRA_PROBING > 0
#define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
+185 -78
View File
@@ -1424,13 +1424,13 @@
#if AXIS_IS_TMC(X)
#if defined(X_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X)
#define X_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(X)
#define X_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(X)
#define X_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define X_SPI_SENSORLESS X_SENSORLESS
#endif
#ifndef X_INTERPOLATE
#define X_INTERPOLATE INTERPOLATE
#endif
@@ -1462,13 +1462,13 @@
#if AXIS_IS_TMC(Y)
#if defined(Y_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y)
#define Y_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(Y)
#define Y_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
#define Y_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define Y_SPI_SENSORLESS Y_SENSORLESS
#endif
#ifndef Y_INTERPOLATE
#define Y_INTERPOLATE INTERPOLATE
#endif
@@ -1500,13 +1500,13 @@
#if AXIS_IS_TMC(Z)
#if defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z)
#define Z_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(Z)
#define Z_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
#define Z_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define Z_SPI_SENSORLESS Z_SENSORLESS
#endif
#ifndef Z_INTERPOLATE
#define Z_INTERPOLATE INTERPOLATE
#endif
@@ -1572,13 +1572,13 @@
#if AXIS_IS_TMC(I)
#if defined(I_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(I)
#define I_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(I)
#define I_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(I)
#define I_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define I_SPI_SENSORLESS I_SENSORLESS
#endif
#ifndef I_INTERPOLATE
#define I_INTERPOLATE INTERPOLATE
#endif
@@ -1593,13 +1593,13 @@
#if AXIS_IS_TMC(J)
#if defined(J_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(J)
#define J_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(J)
#define J_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(J)
#define J_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define J_SPI_SENSORLESS J_SENSORLESS
#endif
#ifndef J_INTERPOLATE
#define J_INTERPOLATE INTERPOLATE
#endif
@@ -1614,13 +1614,13 @@
#if AXIS_IS_TMC(K)
#if defined(K_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(K)
#define K_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(K)
#define K_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(K)
#define K_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define K_SPI_SENSORLESS K_SENSORLESS
#endif
#ifndef K_INTERPOLATE
#define K_INTERPOLATE INTERPOLATE
#endif
@@ -1635,13 +1635,13 @@
#if AXIS_IS_TMC(U)
#if defined(U_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(U)
#define U_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(U)
#define U_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(U)
#define U_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define U_SPI_SENSORLESS U_SENSORLESS
#endif
#ifndef U_INTERPOLATE
#define U_INTERPOLATE INTERPOLATE
#endif
@@ -1656,13 +1656,13 @@
#if AXIS_IS_TMC(V)
#if defined(V_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(V)
#define V_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(V)
#define V_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(V)
#define V_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define V_SPI_SENSORLESS V_SENSORLESS
#endif
#ifndef V_INTERPOLATE
#define V_INTERPOLATE INTERPOLATE
#endif
@@ -1677,13 +1677,13 @@
#if AXIS_IS_TMC(W)
#if defined(W_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(W)
#define W_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS) && AXIS_HAS_SPI(W)
#define W_SPI_SENSORLESS 1
#endif
#endif
#if AXIS_HAS_STEALTHCHOP(W)
#define W_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define W_SPI_SENSORLESS W_SENSORLESS
#endif
#ifndef W_INTERPOLATE
#define W_INTERPOLATE INTERPOLATE
#endif
@@ -1948,11 +1948,18 @@
#endif
#endif
//
// Endstops and bed probe
//
#define _USE_STOP(A,N,M,C) ((A##_HOME_TO_##M || (C+0)) && PIN_EXISTS(A##N##_##M))
/**
* Endstop and probe flags
* - Set USE_(AXIS)_(MIN|MAX) flags for each used endstop that has a pin, including those for DIAG0 state.
* - Note: Dual X Carriage uses "X" and "X2" steppers, but X_MIN and X_MAX endstop states (i.e., not X2_MAX).
* - Set a HAS_(AXIS)_(MIN|MAX)_STATE flag for each endstop that has a state, including SPI Sensorless which don't use a pin.
* - Set a HAS_(AXIS)_STATE flag for each axis that has at least one state.
* - Consider (AXIS)_SAFETY_STOP for the case where the axis has a second endstop.
* Currently this must be distinct, but we can add a mechanism to use the same pin for sensorless
* or switches wired to the same pin, or for the single SPI stall state on the axis.
*/
#define _USE_STOP(A,N,M,C) ((ANY(A##_HOME_TO_##M, A##N##_SAFETY_STOP) || (C+0)) && PIN_EXISTS(A##N##_##M) && !A##_SPI_SENSORLESS)
#define _HAS_STATE(A,N,M) (USE_##A##N##_##M || (ANY(A##_HOME_TO_##M, A##N##_SAFETY_STOP) && A##_SPI_SENSORLESS))
#if _USE_STOP(X,,MIN,)
#define USE_X_MIN 1
@@ -1960,139 +1967,239 @@
#if _USE_STOP(X,,MAX,ENABLED(DUAL_X_CARRIAGE))
#define USE_X_MAX 1
#endif
#if USE_X_MIN || USE_X_MAX
#define HAS_X_ENDSTOP 1
#if _HAS_STATE(X,,MIN)
#define HAS_X_MIN_STATE 1
#endif
#if _HAS_STATE(X,,MAX)
#define HAS_X_MAX_STATE 1
#endif
#if HAS_X_MIN_STATE || HAS_X_MAX_STATE
#define HAS_X_STATE 1
#endif
#if _USE_STOP(Y,,MIN,)
#define USE_Y_MIN 1
#elif _USE_STOP(Y,,MAX,)
#endif
#if _USE_STOP(Y,,MAX,)
#define USE_Y_MAX 1
#endif
#if USE_Y_MIN || USE_Y_MAX
#define HAS_Y_ENDSTOP 1
#if _HAS_STATE(Y,,MIN)
#define HAS_Y_MIN_STATE 1
#endif
#if _HAS_STATE(Y,,MAX)
#define HAS_Y_MAX_STATE 1
#endif
#if HAS_Y_MIN_STATE || HAS_Y_MAX_STATE
#define HAS_Y_STATE 1
#endif
#if _USE_STOP(Z,,MIN,ANY(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, HAS_DELTA_SENSORLESS_PROBING))
#if _USE_STOP(Z,,MIN,ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
#define USE_Z_MIN 1
#if !HAS_DELTA_SENSORLESS_PROBING
#define HAS_Z_MIN_PIN 1
#endif
#endif
#if _USE_STOP(Z,,MAX,)
#define USE_Z_MAX 1
#endif
#if USE_Z_MIN || USE_Z_MAX
#define HAS_Z_ENDSTOP 1
#if _HAS_STATE(Z,,MIN)
#define HAS_Z_MIN_STATE 1
#endif
#if _HAS_STATE(Z,,MAX)
#define HAS_Z_MAX_STATE 1
#endif
#if HAS_Z_MIN_STATE || HAS_Z_MAX_STATE
#define HAS_Z_STATE 1
#endif
#if _USE_STOP(I,,MIN,)
#define USE_I_MIN 1
#elif _USE_STOP(I,,MAX,)
#endif
#if _USE_STOP(I,,MAX,)
#define USE_I_MAX 1
#endif
#if USE_I_MIN || USE_I_MAX
#define HAS_I_ENDSTOP 1
#if _HAS_STATE(I,,MIN)
#define HAS_I_MIN_STATE 1
#endif
#if _HAS_STATE(I,,MAX)
#define HAS_I_MAX_STATE 1
#endif
#if HAS_I_MIN_STATE || HAS_I_MAX_STATE
#define HAS_I_STATE 1
#endif
#if _USE_STOP(J,,MIN,)
#define USE_J_MIN 1
#elif _USE_STOP(J,,MAX,)
#endif
#if _USE_STOP(J,,MAX,)
#define USE_J_MAX 1
#endif
#if USE_J_MIN || USE_J_MAX
#define HAS_J_ENDSTOP 1
#if _HAS_STATE(J,,MIN)
#define HAS_J_MIN_STATE 1
#endif
#if _HAS_STATE(J,,MAX)
#define HAS_J_MAX_STATE 1
#endif
#if HAS_J_MIN_STATE || HAS_J_MAX_STATE
#define HAS_J_STATE 1
#endif
#if _USE_STOP(K,,MIN,)
#define USE_K_MIN 1
#elif _USE_STOP(K,,MAX,)
#endif
#if _USE_STOP(K,,MAX,)
#define USE_K_MAX 1
#endif
#if USE_K_MIN || USE_K_MAX
#define HAS_K_ENDSTOP 1
#if _HAS_STATE(K,,MIN)
#define HAS_K_MIN_STATE 1
#endif
#if _HAS_STATE(K,,MAX)
#define HAS_K_MAX_STATE 1
#endif
#if HAS_K_MIN_STATE || HAS_K_MAX_STATE
#define HAS_K_STATE 1
#endif
#if _USE_STOP(U,,MIN,)
#define USE_U_MIN 1
#elif _USE_STOP(U,,MAX,)
#endif
#if _USE_STOP(U,,MAX,)
#define USE_U_MAX 1
#endif
#if USE_U_MIN || USE_U_MAX
#define HAS_U_ENDSTOP 1
#if _HAS_STATE(U,,MIN)
#define HAS_U_MIN_STATE 1
#endif
#if _HAS_STATE(U,,MAX)
#define HAS_U_MAX_STATE 1
#endif
#if HAS_U_MIN_STATE || HAS_U_MAX_STATE
#define HAS_U_STATE 1
#endif
#if _USE_STOP(V,,MIN,)
#define USE_V_MIN 1
#elif _USE_STOP(V,,MAX,)
#endif
#if _USE_STOP(V,,MAX,)
#define USE_V_MAX 1
#endif
#if USE_V_MIN || USE_V_MAX
#define HAS_V_ENDSTOP 1
#if _HAS_STATE(V,,MIN)
#define HAS_V_MIN_STATE 1
#endif
#if _HAS_STATE(V,,MAX)
#define HAS_V_MAX_STATE 1
#endif
#if HAS_V_MIN_STATE || HAS_V_MAX_STATE
#define HAS_V_STATE 1
#endif
#if _USE_STOP(W,,MIN,)
#define USE_W_MIN 1
#elif _USE_STOP(W,,MAX,)
#endif
#if _USE_STOP(W,,MAX,)
#define USE_W_MAX 1
#endif
#if USE_W_MIN || USE_W_MAX
#define HAS_W_ENDSTOP 1
#if _HAS_STATE(W,,MIN)
#define HAS_W_MIN_STATE 1
#endif
#if _HAS_STATE(W,,MAX)
#define HAS_W_MAX_STATE 1
#endif
#if HAS_W_MIN_STATE || HAS_W_MAX_STATE
#define HAS_W_STATE 1
#endif
#if ANY(DUAL_X_CARRIAGE, X_DUAL_ENDSTOPS)
#if ENABLED(X_DUAL_ENDSTOPS)
#if _USE_STOP(X,2,MIN,)
#define USE_X2_MIN 1
#elif _USE_STOP(X,2,MAX,)
#endif
#if _USE_STOP(X,2,MAX,)
#define USE_X2_MAX 1
#endif
#if USE_X2_MIN || USE_X2_MAX
#define HAS_X2_ENDSTOP 1
#if _HAS_STATE(X,2,MIN) || HAS_X_MIN_STATE
#define HAS_X2_MIN_STATE 1
#endif
#if _HAS_STATE(X,2,MAX) || HAS_X_MAX_STATE
#define HAS_X2_MAX_STATE 1
#endif
#if HAS_X2_MIN_STATE || HAS_X2_MAX_STATE
#define HAS_X2_STATE 1
#endif
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
#if _USE_STOP(Y,2,MIN,)
#define USE_Y2_MIN 1
#elif _USE_STOP(Y,2,MAX,)
#endif
#if _USE_STOP(Y,2,MAX,)
#define USE_Y2_MAX 1
#endif
#if USE_Y2_MIN || USE_Y2_MAX
#define HAS_Y2_ENDSTOP 1
#if _HAS_STATE(Y,2,MIN) || HAS_Y_MIN_STATE
#define HAS_Y2_MIN_STATE 1
#endif
#if _HAS_STATE(Y,2,MAX) || HAS_Y_MAX_STATE
#define HAS_Y2_MAX_STATE 1
#endif
#if HAS_Y2_MIN_STATE || HAS_Y2_MAX_STATE
#define HAS_Y2_STATE 1
#endif
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
#if _USE_STOP(Z,2,MIN,)
#define USE_Z2_MIN 1
#elif _USE_STOP(Z,2,MAX,)
#endif
#if _USE_STOP(Z,2,MAX,)
#define USE_Z2_MAX 1
#endif
#if USE_Z2_MIN || USE_Z2_MAX
#define HAS_Z2_ENDSTOP 1
#if _HAS_STATE(Z,2,MIN) || HAS_Z_MIN_STATE
#define HAS_Z2_MIN_STATE 1
#endif
#if _HAS_STATE(Z,2,MAX) || HAS_Z_MAX_STATE
#define HAS_Z2_MAX_STATE 1
#endif
#if HAS_Z2_MIN_STATE || HAS_Z2_MAX_STATE
#define HAS_Z2_STATE 1
#endif
#if NUM_Z_STEPPERS >= 3
#if _USE_STOP(Z,3,MIN,)
#define USE_Z3_MIN 1
#elif _USE_STOP(Z,3,MAX,)
#endif
#if _USE_STOP(Z,3,MAX,)
#define USE_Z3_MAX 1
#endif
#if USE_Z3_MIN || USE_Z3_MAX
#define HAS_Z3_ENDSTOP 1
#if _HAS_STATE(Z,3,MIN) || HAS_Z_MIN_STATE
#define HAS_Z3_MIN_STATE 1
#endif
#if _HAS_STATE(Z,3,MAX) || HAS_Z_MAX_STATE
#define HAS_Z3_MAX_STATE 1
#endif
#if HAS_Z3_MIN_STATE || HAS_Z3_MAX_STATE
#define HAS_Z3_STATE 1
#endif
#endif
#if NUM_Z_STEPPERS >= 4
#if _USE_STOP(Z,4,MIN,)
#define USE_Z4_MIN 1
#elif _USE_STOP(Z,4,MAX,)
#endif
#if _USE_STOP(Z,4,MAX,)
#define USE_Z4_MAX 1
#endif
#if USE_Z4_MIN || USE_Z4_MAX
#define HAS_Z4_ENDSTOP 1
#if _HAS_STATE(Z,4,MIN) || HAS_Z_MIN_STATE
#define HAS_Z4_MIN_STATE 1
#endif
#if _HAS_STATE(Z,4,MAX) || HAS_Z_MAX_STATE
#define HAS_Z4_MAX_STATE 1
#endif
#if HAS_Z4_MIN_STATE || HAS_Z4_MAX_STATE
#define HAS_Z4_STATE 1
#endif
#endif
#endif
#if NEED_Z_MIN_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE)
#define USE_Z_MIN_PROBE 1
#endif
#if HAS_REAL_BED_PROBE
#define HAS_Z_PROBE_STATE 1
#endif
#undef _USE_STOP
/**
@@ -2111,7 +2218,7 @@
#if USE_Y_MAX
#define ENDSTOPPULLUP_YMAX
#endif
#if HAS_Z_MIN_PIN
#if USE_Z_MIN
#define ENDSTOPPULLUP_ZMIN
#endif
#if USE_Z_MAX
+63 -63
View File
@@ -1388,19 +1388,13 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
/**
* Require pin options and pins to be defined
*/
#if ENABLED(SENSORLESS_PROBING)
#if ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS)
#error "SENSORLESS_PROBING requires TMC2130/2160/2209/5130/5160 drivers on X, Y, and Z and {X|Y|Z}_STALL_SENSITIVITY."
#elif !Z_SENSORLESS
#error "SENSORLESS_PROBING requires a TMC2130/2160/2209/5130/5160 driver on Z and Z_STALL_SENSITIVITY."
#endif
#elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#if !HAS_Z_MIN_PIN
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#if !USE_Z_MIN
#error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires the Z_MIN_PIN to be defined."
#elif Z_MIN_PROBE_ENDSTOP_HIT_STATE != Z_MIN_ENDSTOP_HIT_STATE
#error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_HIT_STATE to match Z_MIN_PROBE_ENDSTOP_HIT_STATE."
#endif
#elif !USE_Z_MIN_PROBE
#elif !PIN_EXISTS(Z_MIN_PROBE)
#error "Z_MIN_PROBE_PIN must be defined if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is not enabled."
#endif
@@ -2323,53 +2317,53 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
/**
* Endstop Tests
*/
#if HAS_ENDSTOPS
// Delta and Cartesian use 3 homing endstops
#if NONE(IS_SCARA, SPI_ENDSTOPS)
#if X_HOME_TO_MIN && !PIN_EXISTS(X_MIN)
#error "X_MIN_PIN (or X_STOP_PIN) is required for X axis homing."
#elif X_HOME_TO_MAX && !PIN_EXISTS(X_MAX)
#error "X_MAX_PIN (or X_STOP_PIN) is required for X axis homing."
#elif Y_HOME_TO_MIN && !PIN_EXISTS(Y_MIN)
#error "Y_MIN_PIN (or Y_STOP_PIN) is required for Y axis homing."
#elif Y_HOME_TO_MAX && !PIN_EXISTS(Y_MAX)
#error "Y_MAX_PIN (or Y_STOP_PIN) is required for Y axis homing."
#elif I_HOME_TO_MIN && !PIN_EXISTS(I_MIN)
#error "I_MIN_PIN (or I_STOP_PIN) is required for I axis homing."
#elif I_HOME_TO_MAX && !PIN_EXISTS(I_MAX)
#error "I_MAX_PIN (or I_STOP_PIN) is required for I axis homing."
#elif J_HOME_TO_MIN && !PIN_EXISTS(J_MIN)
#error "J_MIN_PIN (or J_STOP_PIN) is required for J axis homing."
#elif J_HOME_TO_MAX && !PIN_EXISTS(J_MAX)
#error "J_MAX_PIN (or J_STOP_PIN) is required for J axis homing."
#elif K_HOME_TO_MIN && !PIN_EXISTS(K_MIN)
#error "K_MIN_PIN (or K_STOP_PIN) is required for K axis homing."
#elif K_HOME_TO_MAX && !PIN_EXISTS(K_MAX)
#error "K_MAX_PIN (or K_STOP_PIN) is required for K axis homing."
#elif U_HOME_TO_MIN && !PIN_EXISTS(U_MIN)
#error "U_MIN_PIN (or U_STOP_PIN) is required for U axis homing."
#elif U_HOME_TO_MAX && !PIN_EXISTS(U_MAX)
#error "U_MAX_PIN (or U_STOP_PIN) is required for U axis homing."
#elif V_HOME_TO_MIN && !PIN_EXISTS(V_MIN)
#error "V_MIN_PIN (or V_STOP_PIN) is required for V axis homing."
#elif V_HOME_TO_MAX && !PIN_EXISTS(V_MAX)
#error "V_MAX_PIN (or V_STOP_PIN) is required for V axis homing."
#elif W_HOME_TO_MIN && !PIN_EXISTS(W_MIN)
#error "W_MIN_PIN (or W_STOP_PIN) is required for W axis homing."
#elif W_HOME_TO_MAX && !PIN_EXISTS(W_MAX)
#error "W_MAX_PIN (or W_STOP_PIN) is required for W axis homing."
#endif
#endif
// Z homing requirements
#if Z_HOME_TO_MAX && ENABLED(USE_PROBE_FOR_Z_HOMING)
#error "Z_HOME_DIR must be -1 when homing Z with the probe."
#elif ALL(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS)
#error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING."
#if !IS_SCARA
// Delta and Cartesian require some kind of endstop
#if X_HOME_TO_MIN && !HAS_X_MIN_STATE
#error "X_MIN_PIN, X_STOP_PIN, or X_SPI_SENSORLESS is required for X axis homing."
#elif X_HOME_TO_MAX && !HAS_X_MAX_STATE
#error "X_MAX_PIN, X_STOP_PIN, or X_SPI_SENSORLESS is required for X axis homing."
#elif Y_HOME_TO_MIN && !HAS_Y_MIN_STATE
#error "Y_MIN_PIN, Y_STOP_PIN, or Y_SPI_SENSORLESS is required for Y axis homing."
#elif Y_HOME_TO_MAX && !HAS_Y_MAX_STATE
#error "Y_MAX_PIN, Y_STOP_PIN, or Y_SPI_SENSORLESS is required for Y axis homing."
#elif Z_HOME_TO_MIN && !HAS_Z_MIN_STATE
#error "Z_MIN_PIN, Z_STOP_PIN, or Z_SPI_SENSORLESS is required for Y axis homing."
#elif Z_HOME_TO_MAX && !HAS_Z_MAX_STATE
#error "Z_MAX_PIN, Z_STOP_PIN, or Z_SPI_SENSORLESS is required for Y axis homing."
#elif I_HOME_TO_MIN && !HAS_I_MIN_STATE
#error "I_MIN_PIN, I_STOP_PIN, or I_SPI_SENSORLESS is required for I axis homing."
#elif I_HOME_TO_MAX && !HAS_I_MAX_STATE
#error "I_MAX_PIN, I_STOP_PIN, or I_SPI_SENSORLESS is required for I axis homing."
#elif J_HOME_TO_MIN && !HAS_J_MIN_STATE
#error "J_MIN_PIN, J_STOP_PIN, or J_SPI_SENSORLESS is required for J axis homing."
#elif J_HOME_TO_MAX && !HAS_J_MAX_STATE
#error "J_MAX_PIN, J_STOP_PIN, or J_SPI_SENSORLESS is required for J axis homing."
#elif K_HOME_TO_MIN && !HAS_K_MIN_STATE
#error "K_MIN_PIN, K_STOP_PIN, or K_SPI_SENSORLESS is required for K axis homing."
#elif K_HOME_TO_MAX && !HAS_K_MAX_STATE
#error "K_MAX_PIN, K_STOP_PIN, or K_SPI_SENSORLESS is required for K axis homing."
#elif U_HOME_TO_MIN && !HAS_U_MIN_STATE
#error "U_MIN_PIN, U_STOP_PIN, or U_SPI_SENSORLESS is required for U axis homing."
#elif U_HOME_TO_MAX && !HAS_U_MAX_STATE
#error "U_MAX_PIN, U_STOP_PIN, or U_SPI_SENSORLESS is required for U axis homing."
#elif V_HOME_TO_MIN && !HAS_V_MIN_STATE
#error "V_MIN_PIN, V_STOP_PIN, or V_SPI_SENSORLESS is required for V axis homing."
#elif V_HOME_TO_MAX && !HAS_V_MAX_STATE
#error "V_MAX_PIN, V_STOP_PIN, or V_SPI_SENSORLESS is required for V axis homing."
#elif W_HOME_TO_MIN && !HAS_W_MIN_STATE
#error "W_MIN_PIN, W_STOP_PIN, or W_SPI_SENSORLESS is required for W axis homing."
#elif W_HOME_TO_MAX && !HAS_W_MAX_STATE
#error "W_MAX_PIN, W_STOP_PIN, or W_SPI_SENSORLESS is required for W axis homing."
#endif
#endif
#if ALL(HOME_Z_FIRST, USE_PROBE_FOR_Z_HOMING)
// Z homing with probe requirements
#if ALL(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS)
#error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING (i.e., Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)."
#elif ALL(USE_PROBE_FOR_Z_HOMING, Z_HOME_TO_MAX)
#error "Z_HOME_DIR must be -1 when homing Z with the probe."
#elif ALL(USE_PROBE_FOR_Z_HOMING, HOME_Z_FIRST)
#error "HOME_Z_FIRST can't be used when homing Z with a probe."
#endif
@@ -2381,26 +2375,32 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#if ENABLED(X_DUAL_ENDSTOPS)
#if ENABLED(DELTA)
#error "X_DUAL_ENDSTOPS is not compatible with DELTA."
#elif !HAS_X2_ENDSTOP
#error "X2 Endstop Pin must be defined for X_DUAL_ENDSTOPS."
#elif !HAS_X2_STATE
#error "Some kind of X2 Endstop must be defined for X_DUAL_ENDSTOPS."
#elif X_SPI_SENSORLESS && !AXIS_HAS_SPI(X2)
#error "All X Stepper Drivers must be SPI-capable to use SPI Endstops on X."
#endif
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
#if ENABLED(DELTA)
#error "Y_DUAL_ENDSTOPS is not compatible with DELTA."
#elif !HAS_Y2_ENDSTOP
#error "Y2 Endstop Pin must be defined for Y_DUAL_ENDSTOPS."
#elif !HAS_Y2_STATE
#error "Some kind of Y2 Endstop must be defined for Y_DUAL_ENDSTOPS."
#elif Y_SPI_SENSORLESS && !AXIS_HAS_SPI(Y2)
#error "All Y Stepper Drivers must be SPI-capable to use SPI Endstops on Y."
#endif
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
#if ENABLED(DELTA)
#error "Z_MULTI_ENDSTOPS is not compatible with DELTA."
#elif !HAS_Z2_ENDSTOP
#error "Z2 Endstop Pin must be defined for Z_MULTI_ENDSTOPS."
#elif NUM_Z_STEPPERS >= 3 && !HAS_Z3_ENDSTOP
#error "Z3 Endstop Pin must be defined for Z_MULTI_ENDSTOPS and Z3_DRIVER_TYPE."
#elif NUM_Z_STEPPERS >= 4 && !HAS_Z4_ENDSTOP
#error "Z4 Endstop Pin must be defined for Z_MULTI_ENDSTOPS and Z4_DRIVER_TYPE."
#elif !HAS_Z2_STATE
#error "Some kind of Z2 Endstop must be defined for Z_MULTI_ENDSTOPS."
#elif NUM_Z_STEPPERS >= 3 && !HAS_Z3_STATE
#error "Some kind of Z3 Endstop must be defined for Z_MULTI_ENDSTOPS and Z3_DRIVER_TYPE."
#elif NUM_Z_STEPPERS >= 4 && !HAS_Z4_STATE
#error "Some kind of Z4 Endstop must be defined for Z_MULTI_ENDSTOPS and Z4_DRIVER_TYPE."
#elif Z_SPI_SENSORLESS && !(AXIS_HAS_SPI(Z2) && (NUM_Z_STEPPERS < 3 || AXIS_HAS_SPI(Z3)) && (NUM_Z_STEPPERS < 4 || AXIS_HAS_SPI(Z4)))
#error "All Z Stepper Drivers must be SPI-capable to use SPI Endstops on Z."
#endif
#endif
+1 -1
View File
@@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2023-07-24"
#define STRING_DISTRIBUTION_DATE "2023-08-04"
#endif
/**
+1 -1
View File
@@ -1043,7 +1043,7 @@ int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
* @param cb_read_byte : the callback function to read one byte from the utf8_str (from RAM or ROM)
* @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
*
* @return the number of pixels advanced
* @return the number of characters emitted
*
* Draw a UTF-8 string
*/
+2 -1
View File
@@ -1212,7 +1212,8 @@ void MarlinUI::draw_status_screen() {
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0;
lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen);
uint8_t n = LCD_WIDTH - 2 - vlen;
n -= lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n);
if (vlen) {
lcd_put_u8str(F(":"));
for (; n; --n) lcd_put_u8str(F(" "));
+1 -1
View File
@@ -1041,7 +1041,7 @@ int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
* @param cb_read_byte : the callback function to read one byte from the utf8_str (from RAM or ROM)
* @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
*
* @return the number of pixels advanced
* @return the number of characters emitted
*
* Draw a UTF-8 string
*/
+1 -1
View File
@@ -26,7 +26,7 @@ void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) { u8g.setPrintPos(co
void lcd_put_int(const int i) { u8g.print(i); }
// return < 0 on error
// return the advanced pixels
// return the number of pixels advanced
int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
if (c < 256) {
u8g.print((char)c);
+14 -12
View File
@@ -3437,20 +3437,22 @@ void drawMotionMenu() {
updateMenu(motionMenu);
}
#if HAS_PREHEAT
void drawPreheatHotendMenu() {
checkkey = ID_Menu;
if (SET_MENU(preheatHotendMenu, MSG_PREHEAT_HOTEND, 1 + PREHEAT_COUNT)) {
BACK_ITEM(drawFilamentManMenu);
#define _ITEM_PREHEAT_HE(N) MENU_ITEM(ICON_Preheat##N, MSG_PREHEAT_##N, onDrawMenuItem, DoPreheatHotend##N);
REPEAT_1(PREHEAT_COUNT, _ITEM_PREHEAT_HE)
}
updateMenu(preheatHotendMenu);
}
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#if HAS_PREHEAT
void drawPreheatHotendMenu() {
checkkey = ID_Menu;
if (SET_MENU(preheatHotendMenu, MSG_PREHEAT_HOTEND, 1 + PREHEAT_COUNT)) {
BACK_ITEM(drawFilamentManMenu);
#define _ITEM_PREHEAT_HE(N) MENU_ITEM(ICON_Preheat##N, MSG_PREHEAT_##N, onDrawMenuItem, DoPreheatHotend##N);
REPEAT_1(PREHEAT_COUNT, _ITEM_PREHEAT_HE)
}
updateMenu(preheatHotendMenu);
}
#endif
void drawFilamentManMenu() {
checkkey = ID_Menu;
if (SET_MENU(filamentMenu, MSG_FILAMENT_MAN, 6)) {
+6 -6
View File
@@ -70,9 +70,9 @@ void ESDiag::draw() {
DWINUI::drawButton(BTN_Continue, 86, 250);
DWINUI::cursor.y = 80;
#define ES_LABEL(S) draw_es_label(F(STR_##S))
TERN_(USE_X_MIN, ES_LABEL(X_MIN)); TERN_(USE_X_MAX, ES_LABEL(X_MAX));
TERN_(USE_Y_MIN, ES_LABEL(Y_MIN)); TERN_(USE_Y_MAX, ES_LABEL(Y_MAX));
TERN_(HAS_Z_MIN_PIN, ES_LABEL(Z_MIN)); TERN_(USE_Z_MAX, ES_LABEL(Z_MAX));
TERN_(USE_X_MIN, ES_LABEL(X_MIN)); TERN_(USE_X_MAX, ES_LABEL(X_MAX));
TERN_(USE_Y_MIN, ES_LABEL(Y_MIN)); TERN_(USE_Y_MAX, ES_LABEL(Y_MAX));
TERN_(USE_Z_MIN, ES_LABEL(Z_MIN)); TERN_(USE_Z_MAX, ES_LABEL(Z_MAX));
TERN_(HAS_FILAMENT_SENSOR, draw_es_label(F(STR_FILAMENT)));
update();
}
@@ -80,9 +80,9 @@ void ESDiag::draw() {
void ESDiag::update() {
DWINUI::cursor.y = 80;
#define ES_REPORT(S) draw_es_state(READ(S##_PIN) == S##_ENDSTOP_HIT_STATE)
TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX));
TERN_(USE_Y_MIN, ES_REPORT(Y_MIN)); TERN_(USE_Y_MAX, ES_REPORT(Y_MAX));
TERN_(HAS_Z_MIN_PIN, ES_REPORT(Z_MIN)); TERN_(USE_Z_MAX, ES_REPORT(Z_MAX));
TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX));
TERN_(USE_Y_MIN, ES_REPORT(Y_MIN)); TERN_(USE_Y_MAX, ES_REPORT(Y_MAX));
TERN_(USE_Z_MIN, ES_REPORT(Z_MIN)); TERN_(USE_Z_MAX, ES_REPORT(Z_MAX));
TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE));
dwinUpdateLCD();
}
@@ -79,7 +79,7 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) {
#else
PIN_DISABLED(3, 3, PSTR(STR_Y_MIN), Y_MIN)
#endif
#if HAS_Z_MIN_PIN
#if USE_Z_MIN
PIN_ENABLED (5, 3, PSTR(STR_Z_MIN), Z_MIN, Z_MIN_ENDSTOP_HIT_STATE)
#else
PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
+78 -24
View File
@@ -45,36 +45,56 @@
#if PIN_EXISTS(MT_DET_2)
bool mt_det2_sta;
#endif
#if HAS_X_ENDSTOP
bool endstopx1_sta;
#if USE_X_MIN
bool endstopx1_min;
#else
constexpr static bool endstopx1_sta = true;
constexpr static bool endstopx1_min = true;
#endif
#if HAS_X2_ENDSTOP
#if USE_X_MAX
bool endstopx1_max;
#else
constexpr static bool endstopx1_max = true;
#endif
#if USE_X2_MIN
bool endstopx2_sta;
#else
constexpr static bool endstopx2_sta = true;
#endif
#if HAS_Y_ENDSTOP
#if USE_Y_MIN
bool endstopy1_sta;
#else
constexpr static bool endstopy1_sta = true;
#endif
#if HAS_Y2_ENDSTOP
#if USE_Y2_MIN
bool endstopy2_sta;
#else
constexpr static bool endstopy2_sta = true;
#endif
#if HAS_Z_ENDSTOP
bool endstopz1_sta;
#if USE_Z_MIN
bool endstopz1_min;
#else
constexpr static bool endstopz1_sta = true;
constexpr static bool endstopz1_min = true;
#endif
#if HAS_Z2_ENDSTOP
#if USE_Z_MAX
bool endstopz1_max;
#else
constexpr static bool endstopz1_max = true;
#endif
#if USE_Z2_MIN || USE_Z2_MAX
bool endstopz2_sta;
#else
constexpr static bool endstopz2_sta = true;
#endif
#if USE_Z3_MIN || USE_Z3_MAX
bool endstopz3_sta;
#else
constexpr static bool endstopz3_sta = true;
#endif
#if USE_Z4_MIN || USE_Z4_MAX
bool endstopz4_sta;
#else
constexpr static bool endstopz4_sta = true;
#endif
#define ESTATE(S) (READ(S##_PIN) == S##_ENDSTOP_HIT_STATE)
@@ -87,12 +107,28 @@
#if PIN_EXISTS(MT_DET_2)
mt_det2_sta = (READ(MT_DET_2_PIN) == LOW);
#endif
TERN_(HAS_X_ENDSTOP, endstopx1_sta = ESTATE(TERN(USE_X_MIN, X_MIN, X_MAX)));
TERN_(HAS_X2_ENDSTOP, endstopx2_sta = ESTATE(TERN(USE_X2_MIN, X2_MIN, X2_MAX)));
TERN_(HAS_Y_ENDSTOP, endstopy1_sta = ESTATE(TERN(USE_Y_MIN, Y_MIN, Y_MAX)));
TERN_(HAS_Y2_ENDSTOP, endstopy2_sta = ESTATE(TERN(USE_Y2_MIN, Y2_MIN, Y2_MAX)));
TERN_(HAS_Z_ENDSTOP, endstopz1_sta = ESTATE(TERN(HAS_Z_MIN_PIN, Z_MIN, Z_MAX)));
TERN_(HAS_Z2_ENDSTOP, endstopz2_sta = ESTATE(TERN(USE_Z2_MIN, Z2_MIN, Z2_MAX)));
TERN_(USE_X_MIN, endstopx1_min = ESTATE(X_MIN));
TERN_(USE_X_MAX, endstopx1_max = ESTATE(X_MAX));
#if USE_X2_MIN || USE_X2_MAX
endstopx2_sta = ESTATE(TERN(USE_X2_MIN, X2_MIN, X2_MAX));
#endif
#if USE_Y_MIN || USE_Y_MAX
endstopy1_sta = ESTATE(TERN(USE_Y_MIN, Y_MIN, Y_MAX));
#endif
#if USE_Y2_MIN || USE_Y2_MAX
endstopy2_sta = ESTATE(TERN(USE_Y2_MIN, Y2_MIN, Y2_MAX));
#endif
TERN_(USE_Z_MIN, endstopz1_min = ESTATE(Z_MIN));
TERN_(USE_Z_MAX, endstopz1_max = ESTATE(Z_MAX));
#if USE_Z2_MIN || USE_Z2_MAX
endstopz2_sta = ESTATE(TERN(USE_Z2_MIN, Z2_MIN, Z2_MAX));
#endif
#if USE_Z3_MIN || USE_Z3_MAX
endstopz3_sta = ESTATE(TERN(USE_Z3_MIN, Z3_MIN, Z3_MAX));
#endif
#if USE_Z4_MIN || USE_Z4_MAX
endstopz4_sta = ESTATE(TERN(USE_Z4_MIN, Z4_MIN, Z4_MAX));
#endif
}
void test_gpio_readlevel_H() {
@@ -104,12 +140,28 @@
#if PIN_EXISTS(MT_DET_2)
mt_det2_sta = (READ(MT_DET_2_PIN) == HIGH);
#endif
TERN_(HAS_X_ENDSTOP, endstopx1_sta = !ESTATE(TERN(USE_X_MIN, X_MIN, X_MAX)));
TERN_(HAS_X2_ENDSTOP, endstopx2_sta = !ESTATE(TERN(USE_X2_MIN, X2_MIN, X2_MAX)));
TERN_(HAS_Y_ENDSTOP, endstopy1_sta = !ESTATE(TERN(USE_Y_MIN, Y_MIN, Y_MAX)));
TERN_(HAS_Y2_ENDSTOP, endstopy2_sta = !ESTATE(TERN(USE_Y2_MIN, Y2_MIN, Y2_MAX)));
TERN_(HAS_Z_ENDSTOP, endstopz1_sta = !ESTATE(TERN(HAS_Z_MIN_PIN, Z_MIN, Z_MAX)));
TERN_(HAS_Z2_ENDSTOP, endstopz2_sta = !ESTATE(TERN(USE_Z2_MIN, Z2_MIN, Z2_MAX)));
TERN_(USE_X_MIN, endstopx1_min = !ESTATE(X_MIN));
TERN_(USE_X_MAX, endstopx1_max = !ESTATE(X_MAX));
#if USE_X2_MIN || USE_X2_MAX
endstopx2_sta = !ESTATE(TERN(USE_X2_MIN, X2_MIN, X2_MAX));
#endif
#if USE_Y_MIN || USE_Y_MAX
endstopy1_sta = !ESTATE(TERN(USE_Y_MIN, Y_MIN, Y_MAX));
#endif
#if USE_Y2_MIN || USE_Y2_MAX
endstopy2_sta = !ESTATE(TERN(USE_Y2_MIN, Y2_MIN, Y2_MAX));
#endif
TERN_(USE_Z_MIN, endstopz1_min = !ESTATE(Z_MIN));
TERN_(USE_Z_MAX, endstopz1_max = !ESTATE(Z_MAX));
#if USE_Z2_MIN || USE_Z2_MAX
endstopz2_sta = !ESTATE(TERN(USE_Z2_MIN, Z2_MIN, Z2_MAX));
#endif
#if USE_Z3_MIN || USE_Z3_MAX
endstopz3_sta = !ESTATE(TERN(USE_Z3_MIN, Z3_MIN, Z3_MAX));
#endif
#if USE_Z4_MIN || USE_Z4_MAX
endstopz4_sta = !ESTATE(TERN(USE_Z4_MIN, Z4_MIN, Z4_MAX));
#endif
}
#include "../../../libs/buzzer.h"
@@ -185,7 +237,7 @@
else
disp_det_error();
if (endstopx1_sta && endstopy1_sta && endstopz1_sta && endstopz2_sta)
if (endstopx1_min && endstopx1_max && endstopy1_sta && endstopz1_min && endstopz1_max && endstopz2_sta && endstopz3_sta && endstopz4_sta)
disp_Limit_ok();
else
disp_Limit_error();
@@ -247,7 +299,9 @@
#endif
}
if (endstopx1_sta && endstopx2_sta && endstopy1_sta && endstopy2_sta && endstopz1_sta && endstopz2_sta) {
if ( endstopx1_min && endstopx1_max && endstopx2_sta && endstopy1_sta && endstopy2_sta
&& endstopz1_min && endstopz1_max && endstopz2_sta && endstopz3_sta && endstopz4_sta
) {
// nothing here
}
else {
+2
View File
@@ -41,6 +41,8 @@
* ~ displays '1'....'11' for indexes 0 - 10
* * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
* @ displays an axis name such as XYZUVW, or E for an extruder
*
* Return the given maxlen minus the number of characters emitted, i.e., the number of unused columns
*/
lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {
const uint8_t prop = USE_WIDE_GLYPH ? 2 : 1;
+9 -44
View File
@@ -102,9 +102,10 @@ void menu_advanced_settings();
#if ENABLED(LCD_ENDSTOP_TEST)
#define __STOP_ITEM(F,S) PSTRING_ITEM_F_P(F, TEST(stops, S) ? PSTR(STR_ENDSTOP_HIT) : PSTR(STR_ENDSTOP_OPEN), SS_FULL)
#define __STOP_ITEM(F,S) PSTRING_ITEM_F_P(F, TEST(stops, S) ? PSTR(STR_ENDSTOP_HIT) : PSTR(STR_ENDSTOP_OPEN), SS_FULL);
#define _STOP_ITEM(L,S) __STOP_ITEM(F(L), S)
#define STOP_ITEM(A,I) _STOP_ITEM(STRINGIFY(A) STRINGIFY(I) " " TERN(A##_HOME_TO_MAX, "Max", "Min"), A##I##_ENDSTOP)
#define STOP_ITEM(A,I,M,L) TERN(HAS_##A##I##_##M_STATE, _STOP_ITEM, _IF_1_ELSE)(STRINGIFY(A) STRINGIFY(I) " " STRINGIFY(L), A##I##_##M)
#define STOP_MINMAX(A,I) STOP_ITEM(A,,MIN,"Min") STOP_ITEM(A,,MAX,"Max")
#define FIL_ITEM(N) PSTRING_ITEM_N_P(N-1, MSG_FILAMENT_EN, (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) ? PSTR("PRESENT") : PSTR("out"), SS_FULL);
static void endstop_test() {
@@ -120,48 +121,12 @@ void menu_advanced_settings();
START_SCREEN();
STATIC_ITEM_F(GET_TEXT_F(MSG_ENDSTOP_TEST), SS_DEFAULT|SS_INVERT);
#if HAS_X_ENDSTOP
STOP_ITEM(X,);
#if ENABLED(X_DUAL_ENDSTOPS)
STOP_ITEM(X,2);
#endif
#endif
#if HAS_Y_ENDSTOP
STOP_ITEM(Y,);
#if ENABLED(Y_DUAL_ENDSTOPS)
STOP_ITEM(Y,2);
#endif
#endif
#if HAS_Z_ENDSTOP
STOP_ITEM(Z,);
#if ENABLED(Z_MULTI_ENDSTOPS)
STOP_ITEM(Z,2);
#if NUM_Z_STEPPERS >= 3
STOP_ITEM(Z,3);
#if NUM_Z_STEPPERS >= 4
STOP_ITEM(Z,4);
#endif
#endif
#endif
#endif
#if HAS_I_ENDSTOP
STOP_ITEM(I,);
#endif
#if HAS_J_ENDSTOP
STOP_ITEM(J,);
#endif
#if HAS_K_ENDSTOP
STOP_ITEM(K,);
#endif
#if HAS_U_ENDSTOP
STOP_ITEM(U,);
#endif
#if HAS_V_ENDSTOP
STOP_ITEM(V,);
#endif
#if HAS_W_ENDSTOP
STOP_ITEM(W,);
#endif
STOP_MINMAX(X,) STOP_MINMAX(X,2)
STOP_MINMAX(Y,) STOP_MINMAX(Y,2)
STOP_MINMAX(Z,) STOP_MINMAX(Z,2) STOP_MINMAX(Z,3) STOP_MINMAX(Z,4)
STOP_MINMAX(I,) STOP_MINMAX(J,) STOP_MINMAX(K,)
STOP_MINMAX(U,) STOP_MINMAX(V,) STOP_MINMAX(W,)
#if HAS_BED_PROBE && !HAS_DELTA_SENSORLESS_PROBING
__STOP_ITEM(GET_TEXT_F(MSG_Z_PROBE), Z_MIN_PROBE);
#endif
+236 -248
View File
@@ -138,7 +138,7 @@ void Endstops::init() {
#if USE_Y2_MAX
_INIT_ENDSTOP(MAX,Y,2);
#endif
#if HAS_Z_MIN_PIN
#if USE_Z_MIN
_INIT_ENDSTOP(MIN,Z,);
#endif
#if USE_Z_MAX
@@ -315,7 +315,7 @@ void Endstops::event_handler() {
SERIAL_ECHOPGM(" " STRINGIFY(A) ":", planner.triggered_position_mm(_AXIS(A))); _SET_STOP_CHAR(A,C); }while(0)
#define _ENDSTOP_HIT_TEST(A,C) \
if (TERN0(USE_##A##_MIN, TEST(hit_state, ES_ENUM(A,MIN))) || TERN0(USE_##A##_MAX, TEST(hit_state, ES_ENUM(A,MAX)))) \
if (TERN0(HAS_##A##_MIN_STATE, TEST(hit_state, ES_ENUM(A,MIN))) || TERN0(HAS_##A##_MAX_STATE, TEST(hit_state, ES_ENUM(A,MAX)))) \
_ENDSTOP_HIT_ECHO(A,C)
#define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X')
@@ -504,11 +504,6 @@ void __O2 Endstops::report_states() {
} // Endstops::report_states
#define __ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
#define _ENDSTOP_HIT_STATE(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_HIT_STATE
#define _ENDSTOP(AXIS, MINMAX) __ENDSTOP(AXIS, MINMAX)
/**
* Called from interrupt context by the Endstop ISR or Stepper ISR!
* Read endstops to get their current states, register hits for all
@@ -521,7 +516,9 @@ void Endstops::update() {
#endif
// Macros to update / copy the live_state
#define UPDATE_LIVE_STATE(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ_ENDSTOP(_ENDSTOP_PIN(AXIS, MINMAX)) == _ENDSTOP_HIT_STATE(AXIS, MINMAX)))
#define _ES_PIN(A,M) A##_##M##_PIN
#define _ES_HIT(A,M) A##_##M##_ENDSTOP_HIT_STATE
#define UPDATE_LIVE_STATE(AXIS, MINMAX) SET_BIT_TO(live_state, ES_ENUM(AXIS, MINMAX), (READ_ENDSTOP(_ES_PIN(AXIS, MINMAX)) == _ES_HIT(AXIS, MINMAX)))
#define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
#if ENABLED(G38_PROBE_TARGET)
@@ -560,7 +557,7 @@ void Endstops::update() {
/**
* Check and update endstops
*/
#if USE_X_MIN && !X_SPI_SENSORLESS
#if USE_X_MIN
UPDATE_LIVE_STATE(X, MIN);
#if ENABLED(X_DUAL_ENDSTOPS)
#if USE_X2_MIN
@@ -571,7 +568,7 @@ void Endstops::update() {
#endif
#endif
#if USE_X_MAX && !X_SPI_SENSORLESS
#if USE_X_MAX
UPDATE_LIVE_STATE(X, MAX);
#if ENABLED(X_DUAL_ENDSTOPS)
#if USE_X2_MAX
@@ -582,7 +579,7 @@ void Endstops::update() {
#endif
#endif
#if USE_Y_MIN && !Y_SPI_SENSORLESS
#if USE_Y_MIN
UPDATE_LIVE_STATE(Y, MIN);
#if ENABLED(Y_DUAL_ENDSTOPS)
#if USE_Y2_MIN
@@ -593,7 +590,7 @@ void Endstops::update() {
#endif
#endif
#if USE_Y_MAX && !Y_SPI_SENSORLESS
#if USE_Y_MAX
UPDATE_LIVE_STATE(Y, MAX);
#if ENABLED(Y_DUAL_ENDSTOPS)
#if USE_Y2_MAX
@@ -605,159 +602,84 @@ void Endstops::update() {
#endif
#if USE_Z_MIN && NONE(Z_SPI_SENSORLESS, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#if HAS_Z_MIN_PIN
UPDATE_LIVE_STATE(Z, MIN);
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
#if USE_Z2_MIN
UPDATE_LIVE_STATE(Z2, MIN);
#else
COPY_LIVE_STATE(Z_MIN, Z2_MIN);
#endif
#if NUM_Z_STEPPERS >= 3
#if USE_Z3_MIN
UPDATE_LIVE_STATE(Z3, MIN);
#else
COPY_LIVE_STATE(Z_MIN, Z3_MIN);
#endif
#endif
#if NUM_Z_STEPPERS >= 4
#if USE_Z4_MIN
UPDATE_LIVE_STATE(Z4, MIN);
#else
COPY_LIVE_STATE(Z_MIN, Z4_MIN);
#endif
#endif
#endif
UPDATE_LIVE_STATE(Z, MIN);
#endif
#if USE_Z2_MIN
UPDATE_LIVE_STATE(Z2, MIN);
#elif HAS_Z2_MIN_STATE
COPY_LIVE_STATE(Z_MIN, Z2_MIN);
#endif
#if USE_Z3_MIN
UPDATE_LIVE_STATE(Z3, MIN);
#elif HAS_Z3_MIN_STATE
COPY_LIVE_STATE(Z_MIN, Z3_MIN);
#endif
#if USE_Z4_MIN
UPDATE_LIVE_STATE(Z4, MIN);
#elif HAS_Z4_MIN_STATE
COPY_LIVE_STATE(Z_MIN, Z4_MIN);
#endif
#if HAS_BED_PROBE
#if HAS_REAL_BED_PROBE
// When closing the gap check the enabled probe
if (probe_switch_activated())
UPDATE_LIVE_STATE(Z, TERN(USE_Z_MIN_PROBE, MIN_PROBE, MIN));
#endif
#if USE_Z_MAX && !Z_SPI_SENSORLESS
// Check both Z dual endstops
#if ENABLED(Z_MULTI_ENDSTOPS)
UPDATE_LIVE_STATE(Z, MAX);
#if USE_Z2_MAX
UPDATE_LIVE_STATE(Z2, MAX);
#else
COPY_LIVE_STATE(Z_MAX, Z2_MAX);
#endif
#if NUM_Z_STEPPERS >= 3
#if USE_Z3_MAX
UPDATE_LIVE_STATE(Z3, MAX);
#else
COPY_LIVE_STATE(Z_MAX, Z3_MAX);
#endif
#endif
#if NUM_Z_STEPPERS >= 4
#if USE_Z4_MAX
UPDATE_LIVE_STATE(Z4, MAX);
#else
COPY_LIVE_STATE(Z_MAX, Z4_MAX);
#endif
#endif
#elif TERN1(USE_Z_MIN_PROBE, Z_MAX_PIN != Z_MIN_PROBE_PIN)
// If this pin isn't the bed probe it's the Z endstop
UPDATE_LIVE_STATE(Z, MAX);
#endif
#if USE_Z_MAX
UPDATE_LIVE_STATE(Z, MAX);
#endif
#if USE_Z2_MAX
UPDATE_LIVE_STATE(Z2, MAX);
#elif HAS_Z2_MAX_STATE
COPY_LIVE_STATE(Z_MAX, Z2_MAX);
#endif
#if USE_Z3_MAX
UPDATE_LIVE_STATE(Z3, MAX);
#elif HAS_Z3_MAX_STATE
COPY_LIVE_STATE(Z_MAX, Z3_MAX);
#endif
#if USE_Z4_MAX
UPDATE_LIVE_STATE(Z4, MAX);
#elif HAS_Z4_MAX_STATE
COPY_LIVE_STATE(Z_MAX, Z4_MAX);
#endif
#if USE_I_MIN && !I_SPI_SENSORLESS
#if ENABLED(I_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(I, MIN);
#else
UPDATE_LIVE_STATE(I, MIN);
#endif
#if USE_I_MIN
UPDATE_LIVE_STATE(I, MIN);
#endif
#if USE_I_MAX && !I_SPI_SENSORLESS
#if ENABLED(I_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(I, MAX);
#else
UPDATE_LIVE_STATE(I, MAX);
#endif
#if USE_I_MAX
UPDATE_LIVE_STATE(I, MAX);
#endif
#if USE_J_MIN && !J_SPI_SENSORLESS
#if ENABLED(J_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(J, MIN);
#else
UPDATE_LIVE_STATE(J, MIN);
#endif
#if USE_J_MIN
UPDATE_LIVE_STATE(J, MIN);
#endif
#if USE_J_MAX && !J_SPI_SENSORLESS
#if ENABLED(J_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(J, MAX);
#else
UPDATE_LIVE_STATE(J, MAX);
#endif
#if USE_J_MAX
UPDATE_LIVE_STATE(J, MAX);
#endif
#if USE_K_MIN && !K_SPI_SENSORLESS
#if ENABLED(K_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(K, MIN);
#else
UPDATE_LIVE_STATE(K, MIN);
#endif
#if USE_K_MIN
UPDATE_LIVE_STATE(K, MIN);
#endif
#if USE_K_MAX && !K_SPI_SENSORLESS
#if ENABLED(K_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(K, MAX);
#else
UPDATE_LIVE_STATE(K, MAX);
#endif
#if USE_K_MAX
UPDATE_LIVE_STATE(K, MAX);
#endif
#if USE_U_MIN && !U_SPI_SENSORLESS
#if ENABLED(U_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(U, MIN);
#else
UPDATE_LIVE_STATE(U, MIN);
#endif
#if USE_U_MIN
UPDATE_LIVE_STATE(U, MIN);
#endif
#if USE_U_MAX && !U_SPI_SENSORLESS
#if ENABLED(U_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(U, MAX);
#else
UPDATE_LIVE_STATE(U, MAX);
#endif
#if USE_U_MAX
UPDATE_LIVE_STATE(U, MAX);
#endif
#if USE_V_MIN && !V_SPI_SENSORLESS
#if ENABLED(V_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(V, MIN);
#else
UPDATE_LIVE_STATE(V, MIN);
#endif
#if USE_V_MIN
UPDATE_LIVE_STATE(V, MIN);
#endif
#if USE_V_MAX && !V_SPI_SENSORLESS
#if ENABLED(O_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(V, MAX);
#else
UPDATE_LIVE_STATE(V, MAX);
#endif
#if USE_V_MAX
UPDATE_LIVE_STATE(V, MAX);
#endif
#if USE_W_MIN && !W_SPI_SENSORLESS
#if ENABLED(W_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(W, MIN);
#else
UPDATE_LIVE_STATE(W, MIN);
#endif
#if USE_W_MIN
UPDATE_LIVE_STATE(W, MIN);
#endif
#if USE_W_MAX && !W_SPI_SENSORLESS
#if ENABLED(W_DUAL_ENDSTOPS)
UPDATE_LIVE_STATE(W, MAX);
#else
UPDATE_LIVE_STATE(W, MAX);
#endif
#if USE_W_MAX
UPDATE_LIVE_STATE(W, MAX);
#endif
#if ENDSTOP_NOISE_THRESHOLD
@@ -788,11 +710,11 @@ void Endstops::update() {
#define TEST_ENDSTOP(ENDSTOP) (TEST(state(), ENDSTOP))
// Record endstop was hit
#define _ENDSTOP_HIT(AXIS, MINMAX) SBI(hit_state, _ENDSTOP(AXIS, MINMAX))
#define _ENDSTOP_HIT(AXIS, MINMAX) SBI(hit_state, ES_ENUM(AXIS, MINMAX))
// Call the endstop triggered routine for single endstops
#define PROCESS_ENDSTOP(AXIS, MINMAX) do { \
if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX))) { \
if (TEST_ENDSTOP(ES_ENUM(AXIS, MINMAX))) { \
_ENDSTOP_HIT(AXIS, MINMAX); \
planner.endstop_triggered(_AXIS(AXIS)); \
} \
@@ -801,7 +723,7 @@ void Endstops::update() {
// Core Sensorless Homing needs to test an Extra Pin
#define CORE_DIAG(QQ,A,MM) (CORE_IS_##QQ && A##_SENSORLESS && !A##_SPI_SENSORLESS && USE_##A##_##MM)
#define PROCESS_CORE_ENDSTOP(A1,M1,A2,M2) do { \
if (TEST_ENDSTOP(_ENDSTOP(A1,M1))) { \
if (TEST_ENDSTOP(ES_ENUM(A1,M1))) { \
_ENDSTOP_HIT(A2,M2); \
planner.endstop_triggered(_AXIS(A2)); \
} \
@@ -809,7 +731,7 @@ void Endstops::update() {
// Call the endstop triggered routine for dual endstops
#define PROCESS_DUAL_ENDSTOP(A, MINMAX) do { \
const byte dual_hit = TEST_ENDSTOP(_ENDSTOP(A, MINMAX)) | (TEST_ENDSTOP(_ENDSTOP(A##2, MINMAX)) << 1); \
const byte dual_hit = TEST_ENDSTOP(ES_ENUM(A, MINMAX)) | (TEST_ENDSTOP(ES_ENUM(A##2, MINMAX)) << 1); \
if (dual_hit) { \
_ENDSTOP_HIT(A, MINMAX); \
/* if not performing home or if both endstops were triggered during homing... */ \
@@ -819,7 +741,7 @@ void Endstops::update() {
}while(0)
#define PROCESS_TRIPLE_ENDSTOP(A, MINMAX) do { \
const byte triple_hit = TEST_ENDSTOP(_ENDSTOP(A, MINMAX)) | (TEST_ENDSTOP(_ENDSTOP(A##2, MINMAX)) << 1) | (TEST_ENDSTOP(_ENDSTOP(A##3, MINMAX)) << 2); \
const byte triple_hit = TEST_ENDSTOP(ES_ENUM(A, MINMAX)) | (TEST_ENDSTOP(ES_ENUM(A##2, MINMAX)) << 1) | (TEST_ENDSTOP(ES_ENUM(A##3, MINMAX)) << 2); \
if (triple_hit) { \
_ENDSTOP_HIT(A, MINMAX); \
/* if not performing home or if both endstops were triggered during homing... */ \
@@ -829,7 +751,7 @@ void Endstops::update() {
}while(0)
#define PROCESS_QUAD_ENDSTOP(A, MINMAX) do { \
const byte quad_hit = TEST_ENDSTOP(_ENDSTOP(A, MINMAX)) | (TEST_ENDSTOP(_ENDSTOP(A##2, MINMAX)) << 1) | (TEST_ENDSTOP(_ENDSTOP(A##3, MINMAX)) << 2) | (TEST_ENDSTOP(_ENDSTOP(A##4, MINMAX)) << 3); \
const byte quad_hit = TEST_ENDSTOP(ES_ENUM(A, MINMAX)) | (TEST_ENDSTOP(ES_ENUM(A##2, MINMAX)) << 1) | (TEST_ENDSTOP(ES_ENUM(A##3, MINMAX)) << 2) | (TEST_ENDSTOP(ES_ENUM(A##4, MINMAX)) << 3); \
if (quad_hit) { \
_ENDSTOP_HIT(A, MINMAX); \
/* if not performing home or if both endstops were triggered during homing... */ \
@@ -876,7 +798,7 @@ void Endstops::update() {
#if HAS_X_AXIS
if (stepper.axis_is_moving(X_AXIS)) {
if (!stepper.motor_direction(X_AXIS_HEAD)) { // -direction
#if USE_X_MIN || (X_SPI_SENSORLESS && X_HOME_TO_MIN)
#if HAS_X_MIN_STATE
PROCESS_ENDSTOP_X(MIN);
#if CORE_DIAG(XY, Y, MIN)
PROCESS_CORE_ENDSTOP(Y,MIN,X,MIN);
@@ -890,7 +812,7 @@ void Endstops::update() {
#endif
}
else { // +direction
#if USE_X_MAX || (X_SPI_SENSORLESS && X_HOME_TO_MAX)
#if HAS_X_MAX_STATE
PROCESS_ENDSTOP_X(MAX);
#if CORE_DIAG(XY, Y, MIN)
PROCESS_CORE_ENDSTOP(Y,MIN,X,MAX);
@@ -909,7 +831,7 @@ void Endstops::update() {
#if HAS_Y_AXIS
if (stepper.axis_is_moving(Y_AXIS)) {
if (!stepper.motor_direction(Y_AXIS_HEAD)) { // -direction
#if USE_Y_MIN || (Y_SPI_SENSORLESS && Y_HOME_TO_MIN)
#if HAS_Y_MIN_STATE
PROCESS_ENDSTOP_Y(MIN);
#if CORE_DIAG(XY, X, MIN)
PROCESS_CORE_ENDSTOP(X,MIN,Y,MIN);
@@ -923,7 +845,7 @@ void Endstops::update() {
#endif
}
else { // +direction
#if USE_Y_MAX || (Y_SPI_SENSORLESS && Y_HOME_TO_MAX)
#if HAS_Y_MAX_STATE
PROCESS_ENDSTOP_Y(MAX);
#if CORE_DIAG(XY, X, MIN)
PROCESS_CORE_ENDSTOP(X,MIN,Y,MAX);
@@ -942,34 +864,34 @@ void Endstops::update() {
#if HAS_Z_AXIS
if (stepper.axis_is_moving(Z_AXIS)) {
if (!stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
#if USE_Z_MIN || (Z_SPI_SENSORLESS && Z_HOME_TO_MIN)
if ( TERN1(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, z_probe_enabled)
&& TERN1(USE_Z_MIN_PROBE, !z_probe_enabled)
) PROCESS_ENDSTOP_Z(MIN);
#if CORE_DIAG(XZ, X, MIN)
PROCESS_CORE_ENDSTOP(X,MIN,Z,MIN);
#elif CORE_DIAG(XZ, X, MAX)
PROCESS_CORE_ENDSTOP(X,MAX,Z,MIN);
#elif CORE_DIAG(YZ, Y, MIN)
PROCESS_CORE_ENDSTOP(Y,MIN,Z,MIN);
#elif CORE_DIAG(YZ, Y, MAX)
PROCESS_CORE_ENDSTOP(Y,MAX,Z,MIN);
#endif
#if HAS_Z_MIN_STATE
// If the Z_MIN_PIN is being used for the probe there's no
// separate Z_MIN endstop. But a Z endstop could be wired
// in series, so someone might find this useful.
if ( TERN1(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, z_probe_enabled) // When Z_MIN is the probe, the probe must be enabled
&& TERN1(USE_Z_MIN_PROBE, !z_probe_enabled) // When Z_MIN isn't the probe, Z MIN is ignored while probing
) {
PROCESS_ENDSTOP_Z(MIN);
#if CORE_DIAG(XZ, X, MIN)
PROCESS_CORE_ENDSTOP(X,MIN,Z,MIN);
#elif CORE_DIAG(XZ, X, MAX)
PROCESS_CORE_ENDSTOP(X,MAX,Z,MIN);
#elif CORE_DIAG(YZ, Y, MIN)
PROCESS_CORE_ENDSTOP(Y,MIN,Z,MIN);
#elif CORE_DIAG(YZ, Y, MAX)
PROCESS_CORE_ENDSTOP(Y,MAX,Z,MIN);
#endif
}
#endif
// When closing the gap check the enabled probe
// When closing the gap use the probe trigger state
#if USE_Z_MIN_PROBE
if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN_PROBE);
#endif
}
else { // Z +direction. Gantry up, bed down.
#if USE_Z_MAX || (Z_SPI_SENSORLESS && Z_HOME_TO_MAX)
#if ENABLED(Z_MULTI_ENDSTOPS)
PROCESS_ENDSTOP_Z(MAX);
#elif TERN1(USE_Z_MIN_PROBE, Z_MAX_PIN != Z_MIN_PROBE_PIN) // No probe or probe is Z_MIN || Probe is not Z_MAX
PROCESS_ENDSTOP(Z, MAX);
#endif
#if HAS_Z_MAX_STATE
PROCESS_ENDSTOP_Z(MAX);
#if CORE_DIAG(XZ, X, MIN)
PROCESS_CORE_ENDSTOP(X,MIN,Z,MAX);
#elif CORE_DIAG(XZ, X, MAX)
@@ -987,12 +909,12 @@ void Endstops::update() {
#if HAS_I_AXIS
if (stepper.axis_is_moving(I_AXIS)) {
if (!stepper.motor_direction(I_AXIS_HEAD)) { // -direction
#if USE_I_MIN || (I_SPI_SENSORLESS && I_HOME_TO_MIN)
#if HAS_I_MIN_STATE
PROCESS_ENDSTOP(I, MIN);
#endif
}
else { // +direction
#if USE_I_MAX || (I_SPI_SENSORLESS && I_HOME_TO_MAX)
#if HAS_I_MAX_STATE
PROCESS_ENDSTOP(I, MAX);
#endif
}
@@ -1002,12 +924,12 @@ void Endstops::update() {
#if HAS_J_AXIS
if (stepper.axis_is_moving(J_AXIS)) {
if (!stepper.motor_direction(J_AXIS_HEAD)) { // -direction
#if USE_J_MIN || (J_SPI_SENSORLESS && J_HOME_TO_MIN)
#if HAS_J_MIN_STATE
PROCESS_ENDSTOP(J, MIN);
#endif
}
else { // +direction
#if USE_J_MAX || (J_SPI_SENSORLESS && J_HOME_TO_MAX)
#if HAS_J_MAX_STATE
PROCESS_ENDSTOP(J, MAX);
#endif
}
@@ -1017,12 +939,12 @@ void Endstops::update() {
#if HAS_K_AXIS
if (stepper.axis_is_moving(K_AXIS)) {
if (!stepper.motor_direction(K_AXIS_HEAD)) { // -direction
#if USE_K_MIN || (K_SPI_SENSORLESS && K_HOME_TO_MIN)
#if HAS_K_MIN_STATE
PROCESS_ENDSTOP(K, MIN);
#endif
}
else { // +direction
#if USE_K_MAX || (K_SPI_SENSORLESS && K_HOME_TO_MAX)
#if HAS_K_MAX_STATE
PROCESS_ENDSTOP(K, MAX);
#endif
}
@@ -1032,12 +954,12 @@ void Endstops::update() {
#if HAS_U_AXIS
if (stepper.axis_is_moving(U_AXIS)) {
if (!stepper.motor_direction(U_AXIS_HEAD)) { // -direction
#if USE_U_MIN || (U_SPI_SENSORLESS && U_HOME_TO_MIN)
#if HAS_U_MIN_STATE
PROCESS_ENDSTOP(U, MIN);
#endif
}
else { // +direction
#if USE_U_MAX || (U_SPI_SENSORLESS && U_HOME_TO_MAX)
#if HAS_U_MAX_STATE
PROCESS_ENDSTOP(U, MAX);
#endif
}
@@ -1047,12 +969,12 @@ void Endstops::update() {
#if HAS_V_AXIS
if (stepper.axis_is_moving(V_AXIS)) {
if (!stepper.motor_direction(V_AXIS_HEAD)) { // -direction
#if USE_V_MIN || (V_SPI_SENSORLESS && V_HOME_TO_MIN)
#if HAS_V_MIN_STATE
PROCESS_ENDSTOP(V, MIN);
#endif
}
else { // +direction
#if USE_V_MAX || (V_SPI_SENSORLESS && V_HOME_TO_MAX)
#if HAS_V_MAX_STATE
PROCESS_ENDSTOP(V, MAX);
#endif
}
@@ -1062,17 +984,18 @@ void Endstops::update() {
#if HAS_W_AXIS
if (stepper.axis_is_moving(W_AXIS)) {
if (!stepper.motor_direction(W_AXIS_HEAD)) { // -direction
#if USE_W_MIN || (W_SPI_SENSORLESS && W_HOME_TO_MIN)
#if HAS_W_MIN_STATE
PROCESS_ENDSTOP(W, MIN);
#endif
}
else { // +direction
#if USE_W_MAX || (W_SPI_SENSORLESS && W_HOME_TO_MAX)
#if HAS_W_MAX_STATE
PROCESS_ENDSTOP(W, MAX);
#endif
}
}
#endif // HAS_W_AXIS
} // Endstops::update()
#if ENABLED(SPI_ENDSTOPS)
@@ -1080,39 +1003,67 @@ void Endstops::update() {
// Called from idle() to read Trinamic stall states
bool Endstops::tmc_spi_homing_check() {
bool hit = false;
#if X_SPI_SENSORLESS
if (tmc_spi_homing.x && (stepperX.test_stall_status()
#if Y_SPI_SENSORLESS && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
|| stepperY.test_stall_status()
#elif Z_SPI_SENSORLESS && CORE_IS_XZ
|| stepperZ.test_stall_status()
if (tmc_spi_homing.x) {
#if ENABLED(DUAL_X_CARRIAGE)
const bool ismin = X_MIN_TEST();
#endif
)) { SBI(live_state, X_ENDSTOP); hit = true; }
#if ENABLED(X_DUAL_ENDSTOPS)
if (tmc_spi_homing.x && stepperX2.test_stall_status()) { SBI(live_state, X2_ENDSTOP); hit = true; }
#endif
const bool xhit = (
#if ENABLED(DUAL_X_CARRIAGE)
ismin ? stepperX.test_stall_status() : stepperX2.test_stall_status()
#else
stepperX.test_stall_status()
#if Y_SPI_SENSORLESS && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
|| stepperY.test_stall_status()
#elif Z_SPI_SENSORLESS && CORE_IS_XZ
|| stepperZ.test_stall_status()
#endif
#endif
);
if (xhit) { SBI(live_state, TERN(DUAL_X_CARRIAGE, ismin ? X_MIN : X_MAX, X_ENDSTOP)); hit = true; }
#if ENABLED(X_DUAL_ENDSTOPS)
if (stepperX2.test_stall_status()) { SBI(live_state, X2_ENDSTOP); hit = true; }
#endif
}
#endif
#if Y_SPI_SENSORLESS
if (tmc_spi_homing.y && (stepperY.test_stall_status()
#if X_SPI_SENSORLESS && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
|| stepperX.test_stall_status()
#elif Z_SPI_SENSORLESS && CORE_IS_YZ
|| stepperZ.test_stall_status()
if (tmc_spi_homing.y) {
if (stepperY.test_stall_status()
#if X_SPI_SENSORLESS && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
|| stepperX.test_stall_status()
#elif Z_SPI_SENSORLESS && CORE_IS_YZ
|| stepperZ.test_stall_status()
#endif
) { SBI(live_state, Y_ENDSTOP); hit = true; }
#if ENABLED(Y_DUAL_ENDSTOPS)
if (stepperY2.test_stall_status()) { SBI(live_state, Y2_ENDSTOP); hit = true; }
#endif
)) { SBI(live_state, Y_ENDSTOP); hit = true; }
#if ENABLED(Y_DUAL_ENDSTOPS)
if (tmc_spi_homing.y && stepperY2.test_stall_status()) { SBI(live_state, Y2_ENDSTOP); hit = true; }
#endif
}
#endif
#if Z_SPI_SENSORLESS
if (tmc_spi_homing.z && (stepperZ.test_stall_status()
#if X_SPI_SENSORLESS && CORE_IS_XZ
|| stepperX.test_stall_status()
#elif Y_SPI_SENSORLESS && CORE_IS_YZ
|| stepperY.test_stall_status()
if (tmc_spi_homing.z) {
if (stepperZ.test_stall_status()
#if X_SPI_SENSORLESS && CORE_IS_XZ
|| stepperX.test_stall_status()
#elif Y_SPI_SENSORLESS && CORE_IS_YZ
|| stepperY.test_stall_status()
#endif
) { SBI(live_state, Z_ENDSTOP); hit = true; }
#if ENABLED(Z_MULTI_ENDSTOPS)
if (stepperZ2.test_stall_status()) { SBI(live_state, Z2_ENDSTOP); hit = true; }
#if NUM_Z_STEPPERS >= 3
if (stepperZ3.test_stall_status()) { SBI(live_state, Z3_ENDSTOP); hit = true; }
#if NUM_Z_STEPPERS >= 4
if (stepperZ4.test_stall_status()) { SBI(live_state, Z4_ENDSTOP); hit = true; }
#endif
#endif
#endif
)) { SBI(live_state, Z_ENDSTOP); hit = true; }
}
#endif
#if I_SPI_SENSORLESS
if (tmc_spi_homing.i && stepperI.test_stall_status()) { SBI(live_state, I_ENDSTOP); hit = true; }
#endif
@@ -1147,6 +1098,15 @@ void Endstops::update() {
CBI(live_state, Y2_ENDSTOP);
#endif
TERN_(Z_SPI_SENSORLESS, CBI(live_state, Z_ENDSTOP));
#if ALL(Z_SPI_SENSORLESS, Z_MULTI_ENDSTOPS)
CBI(live_state, Z2_ENDSTOP);
#if NUM_Z_STEPPERS >= 3
CBI(live_state, Z3_ENDSTOP);
#if NUM_Z_STEPPERS >= 4
CBI(live_state, Z4_ENDSTOP);
#endif
#endif
#endif
TERN_(I_SPI_SENSORLESS, CBI(live_state, I_ENDSTOP));
TERN_(J_SPI_SENSORLESS, CBI(live_state, J_ENDSTOP));
TERN_(K_SPI_SENSORLESS, CBI(live_state, K_ENDSTOP));
@@ -1190,7 +1150,7 @@ void Endstops::update() {
#if USE_Y_MAX
ES_GET_STATE(Y_MAX);
#endif
#if HAS_Z_MIN_PIN
#if USE_Z_MIN
ES_GET_STATE(Z_MIN);
#endif
#if USE_Z_MAX
@@ -1266,7 +1226,7 @@ void Endstops::update() {
ES_GET_STATE(W_MIN);
#endif
uint16_t endstop_change = live_state_local ^ old_live_state_local;
const uint16_t endstop_change = live_state_local ^ old_live_state_local;
#define ES_REPORT_CHANGE(S) if (TEST(endstop_change, S)) SERIAL_ECHOPGM(" " STRINGIFY(S) ":", TEST(live_state_local, S))
if (endstop_change) {
@@ -1371,52 +1331,80 @@ void Endstops::update() {
/**
* Change TMC driver currents to N##_CURRENT_HOME, saving the current configuration of each.
*/
void Endstops::set_homing_current(const bool onoff) {
#define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
#define HAS_DELTA_X_CURRENT (ENABLED(DELTA) && HAS_CURRENT_HOME(X))
#define HAS_DELTA_Y_CURRENT (ENABLED(DELTA) && HAS_CURRENT_HOME(Y))
#if HAS_DELTA_X_CURRENT || HAS_DELTA_Y_CURRENT || HAS_CURRENT_HOME(Z)
void Endstops::set_z_sensorless_current(const bool onoff) {
#if ENABLED(DELTA) && HAS_CURRENT_HOME(X)
#define HAS_DELTA_X_CURRENT 1
#endif
#if ENABLED(DELTA) && HAS_CURRENT_HOME(Y)
#define HAS_DELTA_Y_CURRENT 1
#endif
#if HAS_DELTA_X_CURRENT || HAS_DELTA_Y_CURRENT || HAS_CURRENT_HOME(Z) || HAS_CURRENT_HOME(Z2) || HAS_CURRENT_HOME(Z3) || HAS_CURRENT_HOME(Z4)
#if HAS_DELTA_X_CURRENT
static int16_t saved_current_x;
static int16_t saved_current_X;
#endif
#if HAS_DELTA_Y_CURRENT
static int16_t saved_current_y;
static int16_t saved_current_Y;
#endif
#if HAS_CURRENT_HOME(Z)
static int16_t saved_current_z;
static int16_t saved_current_Z;
#endif
auto debug_current_on = [](PGM_P const s, const int16_t a, const int16_t b) {
if (DEBUGGING(LEVELING)) { DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b); }
};
#if HAS_CURRENT_HOME(Z2)
static int16_t saved_current_Z2;
#endif
#if HAS_CURRENT_HOME(Z3)
static int16_t saved_current_Z3;
#endif
#if HAS_CURRENT_HOME(Z4)
static int16_t saved_current_Z4;
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
auto debug_current = [](FSTR_P const s, const int16_t a, const int16_t b) {
if (DEBUGGING(LEVELING)) { DEBUG_ECHOF(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b); }
};
#else
#define debug_current(...)
#endif
#define _SAVE_SET_CURRENT(A) \
saved_current_##A = stepper##A.getMilliamps(); \
stepper##A.rms_current(A##_CURRENT_HOME); \
debug_current(F(STR_##A), saved_current_##A, A##_CURRENT_HOME)
#define _RESTORE_CURRENT(A) \
stepper##A.rms_current(saved_current_##A); \
debug_current(F(STR_##A), saved_current_##A, A##_CURRENT_HOME)
if (onoff) {
#if HAS_DELTA_X_CURRENT
saved_current_x = stepperX.getMilliamps();
stepperX.rms_current(X_CURRENT_HOME);
debug_current_on(PSTR("X"), saved_current_x, X_CURRENT_HOME);
#endif
#if HAS_DELTA_Y_CURRENT
saved_current_y = stepperY.getMilliamps();
stepperY.rms_current(Y_CURRENT_HOME);
debug_current_on(PSTR("Y"), saved_current_y, Y_CURRENT_HOME);
#endif
TERN_(HAS_DELTA_X_CURRENT, _SAVE_SET_CURRENT(X));
TERN_(HAS_DELTA_Y_CURRENT, _SAVE_SET_CURRENT(Y));
#if HAS_CURRENT_HOME(Z)
saved_current_z = stepperZ.getMilliamps();
stepperZ.rms_current(Z_CURRENT_HOME);
debug_current_on(PSTR("Z"), saved_current_z, Z_CURRENT_HOME);
_SAVE_SET_CURRENT(Z);
#endif
#if HAS_CURRENT_HOME(Z2)
_SAVE_SET_CURRENT(Z2);
#endif
#if HAS_CURRENT_HOME(Z3)
_SAVE_SET_CURRENT(Z3);
#endif
#if HAS_CURRENT_HOME(Z4)
_SAVE_SET_CURRENT(Z4);
#endif
}
else {
#if HAS_DELTA_X_CURRENT
stepperX.rms_current(saved_current_x);
debug_current_on(PSTR("X"), X_CURRENT_HOME, saved_current_x);
#endif
#if HAS_DELTA_Y_CURRENT
stepperY.rms_current(saved_current_y);
debug_current_on(PSTR("Y"), Y_CURRENT_HOME, saved_current_y);
#endif
TERN_(HAS_DELTA_X_CURRENT, _RESTORE_CURRENT(X));
TERN_(HAS_DELTA_Y_CURRENT, _RESTORE_CURRENT(Y));
#if HAS_CURRENT_HOME(Z)
stepperZ.rms_current(saved_current_z);
debug_current_on(PSTR("Z"), Z_CURRENT_HOME, saved_current_z);
_RESTORE_CURRENT(Z);
#endif
#if HAS_CURRENT_HOME(Z2)
_RESTORE_CURRENT(Z2);
#endif
#if HAS_CURRENT_HOME(Z3)
_RESTORE_CURRENT(Z3);
#endif
#if HAS_CURRENT_HOME(Z4)
_RESTORE_CURRENT(Z4);
#endif
}
+41 -55
View File
@@ -32,7 +32,12 @@
#define ES_ENUM(A,M) _ES_ENUM(A,M)
#define _ES_ITEM(N) N,
#define ES_ITEM(K,N) TERN_(K,DEFER4(_ES_ITEM)(N))
#define ES_ITEM(K,N) TERN(K,_ES_ITEM,_IF_1_ELSE)(N)
#define _ESN_ITEM(K,A,M) ES_ITEM(K,ES_ENUM(A,M))
#define ES_MINMAX(A) ES_ITEM(HAS_##A##_MIN_STATE, ES_ENUM(A,MIN)) ES_ITEM(HAS_##A##_MAX_STATE, ES_ENUM(A,MAX))
#define HAS_CURRENT_HOME(N) ((N##_CURRENT_HOME > 0) && (N##_CURRENT_HOME != N##_CURRENT))
/**
* Basic Endstop Flag Bits:
@@ -54,90 +59,71 @@
*/
enum EndstopEnum : char {
// Common XYZ (ABC) endstops.
ES_ITEM(USE_X_MIN, X_MIN) ES_ITEM(USE_X_MAX, X_MAX)
ES_ITEM(USE_Y_MIN, Y_MIN) ES_ITEM(USE_Y_MAX, Y_MAX)
ES_ITEM(USE_Z_MIN, Z_MIN) ES_ITEM(USE_Z_MAX, Z_MAX)
ES_ITEM(USE_I_MIN, I_MIN) ES_ITEM(USE_I_MAX, I_MAX)
ES_ITEM(USE_J_MIN, J_MIN) ES_ITEM(USE_J_MAX, J_MAX)
ES_ITEM(USE_K_MIN, K_MIN) ES_ITEM(USE_K_MAX, K_MAX)
ES_ITEM(USE_U_MIN, U_MIN) ES_ITEM(USE_U_MAX, U_MAX)
ES_ITEM(USE_V_MIN, V_MIN) ES_ITEM(USE_V_MAX, V_MAX)
ES_ITEM(USE_W_MIN, W_MIN) ES_ITEM(USE_W_MAX, W_MAX)
ES_MINMAX(X) ES_MINMAX(Y) ES_MINMAX(Z)
ES_MINMAX(I) ES_MINMAX(J) ES_MINMAX(K)
ES_MINMAX(U) ES_MINMAX(V) ES_MINMAX(W)
// Extra Endstops for XYZ
#if ENABLED(X_DUAL_ENDSTOPS)
ES_ITEM(USE_X_MIN, X2_MIN) ES_ITEM(USE_X_MAX, X2_MAX)
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
ES_ITEM(USE_Y_MIN, Y2_MIN) ES_ITEM(USE_Y_MAX, Y2_MAX)
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
ES_ITEM(USE_Z_MIN, Z2_MIN) ES_ITEM(USE_Z_MAX, Z2_MAX)
#if NUM_Z_STEPPERS >= 3
ES_ITEM(USE_Z_MIN, Z3_MIN) ES_ITEM(USE_Z_MAX, Z3_MAX)
#if NUM_Z_STEPPERS >= 4
ES_ITEM(USE_Z_MIN, Z4_MIN) ES_ITEM(USE_Z_MAX, Z4_MAX)
#endif
#endif
#endif
ES_MINMAX(X2) ES_MINMAX(Y2) ES_MINMAX(Z2) ES_MINMAX(Z3) ES_MINMAX(Z4)
// Bed Probe state is distinct or shared with Z_MIN (i.e., when the probe is the only Z endstop)
#if !HAS_DELTA_SENSORLESS_PROBING
ES_ITEM(HAS_BED_PROBE, Z_MIN_PROBE IF_DISABLED(USE_Z_MIN_PROBE, = Z_MIN))
#endif
ES_ITEM(HAS_Z_PROBE_STATE, Z_MIN_PROBE IF_DISABLED(USE_Z_MIN_PROBE, = Z_MIN))
// The total number of states
NUM_ENDSTOP_STATES
// Endstop aliased to MIN or MAX
#if HAS_X_ENDSTOP
// Endstop aliases
#if HAS_X_STATE
, X_ENDSTOP = TERN(X_HOME_TO_MAX, X_MAX, X_MIN)
#if ENABLED(X_DUAL_ENDSTOPS)
, X2_ENDSTOP = TERN(X_HOME_TO_MAX, X2_MAX, X2_MIN)
#endif
#endif
#if HAS_Y_ENDSTOP
#if HAS_X2_STATE
, X2_ENDSTOP = TERN(X_HOME_TO_MAX, X2_MAX, X2_MIN)
#endif
#if HAS_Y_STATE
, Y_ENDSTOP = TERN(Y_HOME_TO_MAX, Y_MAX, Y_MIN)
#if ENABLED(Y_DUAL_ENDSTOPS)
, Y2_ENDSTOP = TERN(Y_HOME_TO_MAX, Y2_MAX, Y2_MIN)
#endif
#endif
#if HAS_Y2_STATE
, Y2_ENDSTOP = TERN(Y_HOME_TO_MAX, Y2_MAX, Y2_MIN)
#endif
#if HOMING_Z_WITH_PROBE
, Z_ENDSTOP = Z_MIN_PROBE
#elif HAS_Z_ENDSTOP
, Z_ENDSTOP = Z_MIN_PROBE // "Z" endstop alias when homing with the probe
#elif HAS_Z_STATE
, Z_ENDSTOP = TERN(Z_HOME_TO_MAX, Z_MAX, Z_MIN)
#if ENABLED(Z_MULTI_ENDSTOPS)
, Z2_ENDSTOP = TERN(Z_HOME_TO_MAX, Z2_MAX, Z2_MIN)
#if NUM_Z_STEPPERS >= 3
, Z3_ENDSTOP = TERN(Z_HOME_TO_MAX, Z3_MAX, Z3_MIN)
#if NUM_Z_STEPPERS >= 4
, Z4_ENDSTOP = TERN(Z_HOME_TO_MAX, Z4_MAX, Z4_MIN)
#endif
#endif
#endif
#endif
#if HAS_I_ENDSTOP
#if HAS_Z2_STATE
, Z2_ENDSTOP = TERN(Z_HOME_TO_MAX, Z2_MAX, Z2_MIN)
#endif
#if HAS_Z3_STATE
, Z3_ENDSTOP = TERN(Z_HOME_TO_MAX, Z3_MAX, Z3_MIN)
#endif
#if HAS_Z4_STATE
, Z4_ENDSTOP = TERN(Z_HOME_TO_MAX, Z4_MAX, Z4_MIN)
#endif
#if HAS_I_STATE
, I_ENDSTOP = TERN(I_HOME_TO_MAX, I_MAX, I_MIN)
#endif
#if HAS_J_ENDSTOP
#if HAS_J_STATE
, J_ENDSTOP = TERN(J_HOME_TO_MAX, J_MAX, J_MIN)
#endif
#if HAS_K_ENDSTOP
#if HAS_K_STATE
, K_ENDSTOP = TERN(K_HOME_TO_MAX, K_MAX, K_MIN)
#endif
#if HAS_U_ENDSTOP
#if HAS_U_STATE
, U_ENDSTOP = TERN(U_HOME_TO_MAX, U_MAX, U_MIN)
#endif
#if HAS_V_ENDSTOP
#if HAS_V_STATE
, V_ENDSTOP = TERN(V_HOME_TO_MAX, V_MAX, V_MIN)
#endif
#if HAS_W_ENDSTOP
#if HAS_W_STATE
, W_ENDSTOP = TERN(W_HOME_TO_MAX, W_MAX, W_MIN)
#endif
};
#undef _ES_ITEM
#undef ES_ITEM
#undef _ESN_ITEM
#undef ES_MINMAX
class Endstops {
public:
@@ -288,7 +274,7 @@ class Endstops {
public:
// Basic functions for Sensorless Homing
#if USE_SENSORLESS
static void set_homing_current(const bool onoff);
static void set_z_sensorless_current(const bool onoff);
#endif
};
+61 -65
View File
@@ -1718,38 +1718,36 @@ void prepare_line_to_destination() {
#endif
}
#if ENABLED(SPI_ENDSTOPS)
switch (axis) {
#if HAS_X_AXIS
case X_AXIS: if (ENABLED(X_SPI_SENSORLESS)) endstops.tmc_spi_homing.x = true; break;
#endif
#if HAS_Y_AXIS
case Y_AXIS: if (ENABLED(Y_SPI_SENSORLESS)) endstops.tmc_spi_homing.y = true; break;
#endif
#if HAS_Z_AXIS
case Z_AXIS: if (ENABLED(Z_SPI_SENSORLESS)) endstops.tmc_spi_homing.z = true; break;
#endif
#if HAS_I_AXIS
case I_AXIS: if (ENABLED(I_SPI_SENSORLESS)) endstops.tmc_spi_homing.i = true; break;
#endif
#if HAS_J_AXIS
case J_AXIS: if (ENABLED(J_SPI_SENSORLESS)) endstops.tmc_spi_homing.j = true; break;
#endif
#if HAS_K_AXIS
case K_AXIS: if (ENABLED(K_SPI_SENSORLESS)) endstops.tmc_spi_homing.k = true; break;
#endif
#if HAS_U_AXIS
case U_AXIS: if (ENABLED(U_SPI_SENSORLESS)) endstops.tmc_spi_homing.u = true; break;
#endif
#if HAS_V_AXIS
case V_AXIS: if (ENABLED(V_SPI_SENSORLESS)) endstops.tmc_spi_homing.v = true; break;
#endif
#if HAS_W_AXIS
case W_AXIS: if (ENABLED(W_SPI_SENSORLESS)) endstops.tmc_spi_homing.w = true; break;
#endif
default: break;
}
#endif
switch (axis) {
#if X_SPI_SENSORLESS
case X_AXIS: endstops.tmc_spi_homing.x = true; break;
#endif
#if Y_SPI_SENSORLESS
case Y_AXIS: endstops.tmc_spi_homing.y = true; break;
#endif
#if Z_SPI_SENSORLESS
case Z_AXIS: endstops.tmc_spi_homing.z = true; break;
#endif
#if I_SPI_SENSORLESS
case I_AXIS: endstops.tmc_spi_homing.i = true; break;
#endif
#if J_SPI_SENSORLESS
case J_AXIS: endstops.tmc_spi_homing.j = true; break;
#endif
#if K_SPI_SENSORLESS
case K_AXIS: endstops.tmc_spi_homing.k = true; break;
#endif
#if U_SPI_SENSORLESS
case U_AXIS: endstops.tmc_spi_homing.u = true; break;
#endif
#if V_SPI_SENSORLESS
case V_AXIS: endstops.tmc_spi_homing.v = true; break;
#endif
#if W_SPI_SENSORLESS
case W_AXIS: endstops.tmc_spi_homing.w = true; break;
#endif
default: break;
}
TERN_(IMPROVE_HOMING_RELIABILITY, sg_guard_period = millis() + default_sg_guard_duration);
@@ -1814,38 +1812,36 @@ void prepare_line_to_destination() {
#endif
}
#if ENABLED(SPI_ENDSTOPS)
switch (axis) {
#if HAS_X_AXIS
case X_AXIS: if (ENABLED(X_SPI_SENSORLESS)) endstops.tmc_spi_homing.x = false; break;
#endif
#if HAS_Y_AXIS
case Y_AXIS: if (ENABLED(Y_SPI_SENSORLESS)) endstops.tmc_spi_homing.y = false; break;
#endif
#if HAS_Z_AXIS
case Z_AXIS: if (ENABLED(Z_SPI_SENSORLESS)) endstops.tmc_spi_homing.z = false; break;
#endif
#if HAS_I_AXIS
case I_AXIS: if (ENABLED(I_SPI_SENSORLESS)) endstops.tmc_spi_homing.i = false; break;
#endif
#if HAS_J_AXIS
case J_AXIS: if (ENABLED(J_SPI_SENSORLESS)) endstops.tmc_spi_homing.j = false; break;
#endif
#if HAS_K_AXIS
case K_AXIS: if (ENABLED(K_SPI_SENSORLESS)) endstops.tmc_spi_homing.k = false; break;
#endif
#if HAS_U_AXIS
case U_AXIS: if (ENABLED(U_SPI_SENSORLESS)) endstops.tmc_spi_homing.u = false; break;
#endif
#if HAS_V_AXIS
case V_AXIS: if (ENABLED(V_SPI_SENSORLESS)) endstops.tmc_spi_homing.v = false; break;
#endif
#if HAS_W_AXIS
case W_AXIS: if (ENABLED(W_SPI_SENSORLESS)) endstops.tmc_spi_homing.w = false; break;
#endif
default: break;
}
#endif
switch (axis) {
#if X_SPI_SENSORLESS
case X_AXIS: endstops.tmc_spi_homing.x = false; break;
#endif
#if Y_SPI_SENSORLESS
case Y_AXIS: endstops.tmc_spi_homing.y = false; break;
#endif
#if Z_SPI_SENSORLESS
case Z_AXIS: endstops.tmc_spi_homing.z = false; break;
#endif
#if I_SPI_SENSORLESS
case I_AXIS: endstops.tmc_spi_homing.i = false; break;
#endif
#if J_SPI_SENSORLESS
case J_AXIS: endstops.tmc_spi_homing.j = false; break;
#endif
#if K_SPI_SENSORLESS
case K_AXIS: endstops.tmc_spi_homing.k = false; break;
#endif
#if U_SPI_SENSORLESS
case U_AXIS: endstops.tmc_spi_homing.u = false; break;
#endif
#if V_SPI_SENSORLESS
case V_AXIS: endstops.tmc_spi_homing.v = false; break;
#endif
#if W_SPI_SENSORLESS
case W_AXIS: endstops.tmc_spi_homing.w = false; break;
#endif
default: break;
}
}
#endif // SENSORLESS_HOMING
@@ -2118,7 +2114,7 @@ void prepare_line_to_destination() {
// Only Z homing (with probe) is permitted
if (axis != Z_AXIS) { BUZZ(100, 880); return; }
#else
#define _CAN_HOME(A) (axis == _AXIS(A) && (ANY(A##_SPI_SENSORLESS, HAS_##A##_ENDSTOP) || TERN0(HOMING_Z_WITH_PROBE, _AXIS(A) == Z_AXIS)))
#define _CAN_HOME(A) (axis == _AXIS(A) && (ANY(A##_SPI_SENSORLESS, HAS_##A##_STATE) || TERN0(HOMING_Z_WITH_PROBE, _AXIS(A) == Z_AXIS)))
#define _ANDCANT(N) && !_CAN_HOME(N)
if (true MAIN_AXIS_MAP(_ANDCANT)) return;
#endif
+27 -5
View File
@@ -610,8 +610,19 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
if (test_sensitivity.x) stealth_states.x = tmc_enable_stallguard(stepperX); // Delta watches all DIAG pins for a stall
if (test_sensitivity.y) stealth_states.y = tmc_enable_stallguard(stepperY);
#endif
if (test_sensitivity.z) stealth_states.z = tmc_enable_stallguard(stepperZ); // All machines will check Z-DIAG for stall
endstops.set_homing_current(true); // The "homing" current also applies to probing
if (test_sensitivity.z) {
stealth_states.z = tmc_enable_stallguard(stepperZ); // All machines will check Z-DIAG for stall
#if ENABLED(Z_MULTI_ENDSTOPS)
stealth_states.z2 = tmc_enable_stallguard(stepperZ2);
#if NUM_Z_STEPPERS >= 3
stealth_states.z3 = tmc_enable_stallguard(stepperZ3);
#if NUM_Z_STEPPERS >= 4
stealth_states.z4 = tmc_enable_stallguard(stepperZ4);
#endif
#endif
#endif
}
endstops.set_z_sensorless_current(true); // The "homing" current also applies to probing
endstops.enable(true);
#endif // SENSORLESS_PROBING
@@ -643,9 +654,20 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
if (test_sensitivity.x) tmc_disable_stallguard(stepperX, stealth_states.x);
if (test_sensitivity.y) tmc_disable_stallguard(stepperY, stealth_states.y);
#endif
if (test_sensitivity.z) tmc_disable_stallguard(stepperZ, stealth_states.z);
endstops.set_homing_current(false);
#endif
if (test_sensitivity.z) {
tmc_disable_stallguard(stepperZ, stealth_states.z);
#if ENABLED(Z_MULTI_ENDSTOPS)
tmc_disable_stallguard(stepperZ2, stealth_states.z2);
#if NUM_Z_STEPPERS >= 3
tmc_disable_stallguard(stepperZ3, stealth_states.z3);
#if NUM_Z_STEPPERS >= 4
tmc_disable_stallguard(stepperZ4, stealth_states.z4);
#endif
#endif
#endif
}
endstops.set_z_sensorless_current(false);
#endif // SENSORLESS_PROBING
#if ENABLED(BLTOUCH)
if (probe_triggered && !bltouch.high_speed_mode && bltouch.stow())
+89 -48
View File
@@ -839,10 +839,10 @@ volatile bool Temperature::raw_temps_ready = false;
if (current_temp > watch_temp_target) heated = true; // - Flag if target temperature reached
}
else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired
_temp_error(heater_id, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD));
_TEMP_ERROR(heater_id, FPSTR(str_t_heating_failed), MSG_HEATING_FAILED_LCD, current_temp);
}
else if (current_temp < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far?
_temp_error(heater_id, FPSTR(str_t_thermal_runaway), GET_TEXT_F(MSG_THERMAL_RUNAWAY));
_TEMP_ERROR(heater_id, FPSTR(str_t_thermal_runaway), MSG_THERMAL_RUNAWAY, current_temp);
}
#endif
} // every 2 seconds
@@ -1467,8 +1467,10 @@ inline void loud_kill(FSTR_P const lcd_msg, const heater_id_t heater_id) {
kill(lcd_msg, HEATER_FSTR(heater_id));
}
void Temperature::_temp_error(const heater_id_t heater_id, FSTR_P const serial_msg, FSTR_P const lcd_msg) {
void Temperature::_temp_error(
const heater_id_t heater_id, FSTR_P const serial_msg, FSTR_P const lcd_msg
OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg)
) {
static uint8_t killed = 0;
if (IsRunning() && TERN1(BOGUS_TEMPERATURE_GRACE_PERIOD, killed == 2)) {
@@ -1493,10 +1495,13 @@ void Temperature::_temp_error(const heater_id_t heater_id, FSTR_P const serial_m
OPTCODE(HAS_TEMP_CHAMBER, case H_CHAMBER: SERIAL_ECHOPGM(STR_HEATER_CHAMBER); break)
OPTCODE(HAS_TEMP_BED, case H_BED: SERIAL_ECHOPGM(STR_HEATER_BED); break)
default:
if (real_heater_id >= 0)
SERIAL_ECHOLNPGM("E", real_heater_id);
if (real_heater_id >= 0) SERIAL_ECHO('E', real_heater_id);
}
SERIAL_EOL();
#if ENABLED(ERR_INCLUDE_TEMP)
SERIAL_ECHOLNPGM(STR_DETECTED_TEMP_B, deg, STR_DETECTED_TEMP_E);
#else
SERIAL_EOL();
#endif
}
disable_all_heaters(); // always disable (even for bogus temp)
@@ -1525,18 +1530,18 @@ void Temperature::_temp_error(const heater_id_t heater_id, FSTR_P const serial_m
#endif
}
void Temperature::maxtemp_error(const heater_id_t heater_id) {
void Temperature::maxtemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg)) {
#if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED)
dwinPopupTemperature(1);
#endif
_temp_error(heater_id, F(STR_T_MAXTEMP), GET_TEXT_F(MSG_ERR_MAXTEMP));
_TEMP_ERROR(heater_id, F(STR_T_MAXTEMP), MSG_ERR_MAXTEMP, deg);
}
void Temperature::mintemp_error(const heater_id_t heater_id) {
void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg)) {
#if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED)
dwinPopupTemperature(0);
#endif
_temp_error(heater_id, F(STR_T_MINTEMP), GET_TEXT_F(MSG_ERR_MINTEMP));
_TEMP_ERROR(heater_id, F(STR_T_MINTEMP), MSG_ERR_MINTEMP, deg);
}
#if HAS_PID_DEBUG
@@ -1736,7 +1741,10 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
void Temperature::manage_hotends(const millis_t &ms) {
HOTEND_LOOP() {
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
if (degHotend(e) > temp_range[e].maxtemp) maxtemp_error((heater_id_t)e);
{
const auto deg = degHotend(e);
if (deg > temp_range[e].maxtemp) MAXTEMP_ERROR(e, deg);
}
#endif
TERN_(HEATER_IDLE_HANDLER, heater_idle[e].update(ms));
@@ -1746,16 +1754,18 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
tr_state_machine[e].run(temp_hotend[e].celsius, temp_hotend[e].target, (heater_id_t)e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
#endif
temp_hotend[e].soft_pwm_amount = (temp_hotend[e].celsius > temp_range[e].mintemp || is_hotend_preheating(e)) && temp_hotend[e].celsius < temp_range[e].maxtemp ? (int)get_pid_output_hotend(e) >> 1 : 0;
temp_hotend[e].soft_pwm_amount = (temp_hotend[e].celsius > temp_range[e].mintemp || is_hotend_preheating(e))
&& temp_hotend[e].celsius < temp_range[e].maxtemp ? (int)get_pid_output_hotend(e) >> 1 : 0;
#if WATCH_HOTENDS
// Make sure temperature is increasing
if (watch_hotend[e].elapsed(ms)) { // Enabled and time to check?
if (watch_hotend[e].check(degHotend(e))) // Increased enough?
auto temp = degHotend(e);
if (watch_hotend[e].check(temp)) // Increased enough?
start_watching_hotend(e); // If temp reached, turn off elapsed check
else {
TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0));
_temp_error((heater_id_t)e, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD));
_TEMP_ERROR(e, FPSTR(str_t_heating_failed), MSG_HEATING_FAILED_LCD, temp);
}
}
#endif
@@ -1770,19 +1780,25 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
void Temperature::manage_heated_bed(const millis_t &ms) {
#if ENABLED(THERMAL_PROTECTION_BED)
if (degBed() > BED_MAXTEMP) maxtemp_error(H_BED);
{
const auto deg = degBed();
if (deg > BED_MAXTEMP) MAXTEMP_ERROR(H_BED, deg);
}
#endif
#if WATCH_BED
{
// Make sure temperature is increasing
if (watch_bed.elapsed(ms)) { // Time to check the bed?
if (watch_bed.check(degBed())) // Increased enough?
const auto deg = degBed();
if (watch_bed.check(deg)) // Increased enough?
start_watching_bed(); // If temp reached, turn off elapsed check
else {
TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0));
_temp_error(H_BED, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD));
_TEMP_ERROR(H_BED, FPSTR(str_t_heating_failed), MSG_HEATING_FAILED_LCD, deg);
}
}
}
#endif // WATCH_BED
#if ALL(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING)
@@ -1860,17 +1876,23 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
#endif
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
if (degChamber() > (CHAMBER_MAXTEMP)) maxtemp_error(H_CHAMBER);
{
const auto deg = degChamber();
if (deg > CHAMBER_MAXTEMP) MAXTEMP_ERROR(H_CHAMBER, deg);
}
#endif
#if WATCH_CHAMBER
{
// Make sure temperature is increasing
if (watch_chamber.elapsed(ms)) { // Time to check the chamber?
if (watch_chamber.check(degChamber())) // Increased enough? Error below.
const auto deg = degChamber();
if (watch_chamber.check(deg)) // Increased enough? Error below.
start_watching_chamber(); // If temp reached, turn off elapsed check.
else
_temp_error(H_CHAMBER, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD));
_TEMP_ERROR(H_CHAMBER, FPSTR(str_t_heating_failed), MSG_HEATING_FAILED_LCD, deg);
}
}
#endif
#if ANY(CHAMBER_FAN, CHAMBER_VENT) || DISABLED(PIDTEMPCHAMBER)
@@ -1986,16 +2008,20 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
#endif
#if ENABLED(THERMAL_PROTECTION_COOLER)
if (degCooler() > COOLER_MAXTEMP) maxtemp_error(H_COOLER);
{
const auto deg = degCooler();
if (deg > COOLER_MAXTEMP) MAXTEMP_ERROR(H_COOLER, deg);
}
#endif
#if WATCH_COOLER
// Make sure temperature is decreasing
if (watch_cooler.elapsed(ms)) { // Time to check the cooler?
if (degCooler() > watch_cooler.target) // Failed to decrease enough?
_temp_error(H_COOLER, GET_TEXT_F(MSG_COOLING_FAILED), GET_TEXT_F(MSG_COOLING_FAILED));
const auto deg = degCooler();
if (deg > watch_cooler.target) // Failed to decrease enough?
_TEMP_ERROR(H_COOLER, GET_TEXT_F(MSG_COOLING_FAILED), MSG_COOLING_FAILED, deg);
else
start_watching_cooler(); // Start again if the target is still far off
start_watching_cooler(); // Start again if the target is still far off
}
#endif
@@ -2076,20 +2102,32 @@ void Temperature::task() {
#if DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
#if TEMP_SENSOR_IS_MAX_TC(0)
if (degHotend(0) > _MIN(HEATER_0_MAXTEMP, TEMP_SENSOR_0_MAX_TC_TMAX - 1.0)) maxtemp_error(H_E0);
if (degHotend(0) < _MAX(HEATER_0_MINTEMP, TEMP_SENSOR_0_MAX_TC_TMIN + .01)) mintemp_error(H_E0);
{
const auto deg = degHotend(0);
if (deg > _MIN(HEATER_0_MAXTEMP, TEMP_SENSOR_0_MAX_TC_TMAX - 1.0)) MAXTEMP_ERROR(H_E0, deg);
if (deg < _MAX(HEATER_0_MINTEMP, TEMP_SENSOR_0_MAX_TC_TMIN + .01)) MINTEMP_ERROR(H_E0, deg);
}
#endif
#if TEMP_SENSOR_IS_MAX_TC(1)
if (degHotend(1) > _MIN(HEATER_1_MAXTEMP, TEMP_SENSOR_1_MAX_TC_TMAX - 1.0)) maxtemp_error(H_E1);
if (degHotend(1) < _MAX(HEATER_1_MINTEMP, TEMP_SENSOR_1_MAX_TC_TMIN + .01)) mintemp_error(H_E1);
{
const auto deg = degHotend(1);
if (deg > _MIN(HEATER_1_MAXTEMP, TEMP_SENSOR_1_MAX_TC_TMAX - 1.0)) MAXTEMP_ERROR(H_E1, deg);
if (deg < _MAX(HEATER_1_MINTEMP, TEMP_SENSOR_1_MAX_TC_TMIN + .01)) MINTEMP_ERROR(H_E1, deg);
}
#endif
#if TEMP_SENSOR_IS_MAX_TC(2)
if (degHotend(2) > _MIN(HEATER_2_MAXTEMP, TEMP_SENSOR_2_MAX_TC_TMAX - 1.0)) maxtemp_error(H_E2);
if (degHotend(2) < _MAX(HEATER_2_MINTEMP, TEMP_SENSOR_2_MAX_TC_TMIN + .01)) mintemp_error(H_E2);
{
const auto deg = degHotend(2);
if (deg > _MIN(HEATER_2_MAXTEMP, TEMP_SENSOR_2_MAX_TC_TMAX - 1.0)) MAXTEMP_ERROR(H_E2, deg);
if (deg < _MAX(HEATER_2_MINTEMP, TEMP_SENSOR_2_MAX_TC_TMIN + .01)) MINTEMP_ERROR(H_E2, deg);
}
#endif
#if TEMP_SENSOR_IS_MAX_TC(REDUNDANT)
if (degRedundant() > TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX - 1.0) maxtemp_error(H_REDUNDANT);
if (degRedundant() < TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN + .01) mintemp_error(H_REDUNDANT);
{
const auto deg = degRedundant();
if (deg > TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX - 1.0) MAXTEMP_ERROR(H_REDUNDANT, deg);
if (deg < TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN + .01) MINTEMP_ERROR(H_REDUNDANT, deg);
}
#endif
#else
#warning "Safety Alert! Disable IGNORE_THERMOCOUPLE_ERRORS for the final build!"
@@ -2101,9 +2139,12 @@ void Temperature::task() {
TERN_(HAS_HOTEND, manage_hotends(ms));
#if HAS_TEMP_REDUNDANT
{
const auto deg = degRedundant();
// Make sure measured temperatures are close together
if (ABS(degRedundantTarget() - degRedundant()) > TEMP_SENSOR_REDUNDANT_MAX_DIFF)
_temp_error((heater_id_t)HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET), F(STR_REDUNDANCY), GET_TEXT_F(MSG_ERR_REDUNDANT_TEMP));
if (ABS(degRedundantTarget() - deg) > TEMP_SENSOR_REDUNDANT_MAX_DIFF)
_TEMP_ERROR(HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET), F(STR_REDUNDANCY), MSG_ERR_REDUNDANT_TEMP, deg);
}
#endif
// Manage extruder auto fans and/or read fan tachometers
@@ -2616,7 +2657,7 @@ void Temperature::updateTemperaturesFromRawValues() {
const raw_adc_t r = temp_hotend[e].getraw();
const bool neg = temp_dir[e] < 0, pos = temp_dir[e] > 0;
if ((neg && r < temp_range[e].raw_max) || (pos && r > temp_range[e].raw_max))
maxtemp_error((heater_id_t)e);
MAXTEMP_ERROR(e, temp_hotend[e].celsius);
/**
// DEBUG PREHEATING TIME
@@ -2628,7 +2669,7 @@ void Temperature::updateTemperaturesFromRawValues() {
const bool heater_on = temp_hotend[e].target > 0;
if (heater_on && !is_hotend_preheating(e) && ((neg && r > temp_range[e].raw_min) || (pos && r < temp_range[e].raw_min))) {
if (TERN1(MULTI_MAX_CONSECUTIVE_LOW_TEMP_ERR, ++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED))
mintemp_error((heater_id_t)e);
MINTEMP_ERROR(e, temp_hotend[e].celsius);
}
else {
TERN_(MULTI_MAX_CONSECUTIVE_LOW_TEMP_ERR, consecutive_low_temperature_error[e] = 0);
@@ -2639,27 +2680,27 @@ void Temperature::updateTemperaturesFromRawValues() {
#define TP_CMP(S,A,B) (TEMPDIR(S) < 0 ? ((A)<(B)) : ((A)>(B)))
#if ENABLED(THERMAL_PROTECTION_BED)
if (TP_CMP(BED, temp_bed.getraw(), maxtemp_raw_BED)) maxtemp_error(H_BED);
if (temp_bed.target > 0 && !is_bed_preheating() && TP_CMP(BED, mintemp_raw_BED, temp_bed.getraw())) mintemp_error(H_BED);
if (TP_CMP(BED, temp_bed.getraw(), maxtemp_raw_BED)) MAXTEMP_ERROR(H_BED, temp_bed.celsius);
if (temp_bed.target > 0 && !is_bed_preheating() && TP_CMP(BED, mintemp_raw_BED, temp_bed.getraw())) MINTEMP_ERROR(H_BED, temp_bed.celsius);
#endif
#if ALL(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER)
if (TP_CMP(CHAMBER, temp_chamber.getraw(), maxtemp_raw_CHAMBER)) maxtemp_error(H_CHAMBER);
if (temp_chamber.target > 0 && TP_CMP(CHAMBER, mintemp_raw_CHAMBER, temp_chamber.getraw())) mintemp_error(H_CHAMBER);
if (TP_CMP(CHAMBER, temp_chamber.getraw(), maxtemp_raw_CHAMBER)) MAXTEMP_ERROR(H_CHAMBER, temp_chamber.celsius);
if (temp_chamber.target > 0 && TP_CMP(CHAMBER, mintemp_raw_CHAMBER, temp_chamber.getraw())) MINTEMP_ERROR(H_CHAMBER, temp_chamber.celsius);
#endif
#if ALL(HAS_COOLER, THERMAL_PROTECTION_COOLER)
if (cutter.unitPower > 0 && TP_CMP(COOLER, temp_cooler.getraw(), maxtemp_raw_COOLER)) maxtemp_error(H_COOLER);
if (TP_CMP(COOLER, mintemp_raw_COOLER, temp_cooler.getraw())) mintemp_error(H_COOLER);
if (cutter.unitPower > 0 && TP_CMP(COOLER, temp_cooler.getraw(), maxtemp_raw_COOLER)) MAXTEMP_ERROR(H_COOLER, temp_cooler.celsius);
if (TP_CMP(COOLER, mintemp_raw_COOLER, temp_cooler.getraw())) MINTEMP_ERROR(H_COOLER, temp_cooler.celsius);
#endif
#if ALL(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD)
if (TP_CMP(BOARD, temp_board.getraw(), maxtemp_raw_BOARD)) maxtemp_error(H_BOARD);
if (TP_CMP(BOARD, mintemp_raw_BOARD, temp_board.getraw())) mintemp_error(H_BOARD);
if (TP_CMP(BOARD, temp_board.getraw(), maxtemp_raw_BOARD)) MAXTEMP_ERROR(H_BOARD, temp_board.celsius);
if (TP_CMP(BOARD, mintemp_raw_BOARD, temp_board.getraw())) MINTEMP_ERROR(H_BOARD, temp_board.celsius);
#endif
#if ALL(HAS_TEMP_SOC, THERMAL_PROTECTION_SOC)
if (TP_CMP(SOC, temp_soc.getraw(), maxtemp_raw_SOC)) maxtemp_error(H_SOC);
if (TP_CMP(SOC, temp_soc.getraw(), maxtemp_raw_SOC)) MAXTEMP_ERROR(H_SOC, temp_soc.celsius);
#endif
#undef TP_CMP
@@ -3178,12 +3219,12 @@ void Temperature::init() {
case TRRunaway:
TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0));
_temp_error(heater_id, FPSTR(str_t_thermal_runaway), GET_TEXT_F(MSG_THERMAL_RUNAWAY));
_TEMP_ERROR(heater_id, FPSTR(str_t_thermal_runaway), MSG_THERMAL_RUNAWAY, current);
#if ENABLED(THERMAL_PROTECTION_VARIANCE_MONITOR)
case TRMalfunction:
TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0));
_temp_error(heater_id, FPSTR(str_t_temp_malfunction), GET_TEXT_F(MSG_TEMP_MALFUNCTION));
_TEMP_ERROR(heater_id, FPSTR(str_t_temp_malfunction), MSG_TEMP_MALFUNCTION, current);
#endif
}
}
+9 -3
View File
@@ -41,6 +41,8 @@
#include "../feature/fancheck.h"
#endif
//#define ERR_INCLUDE_TEMP
#define HOTEND_INDEX TERN(HAS_MULTI_HOTEND, e, 0)
#define E_NAME TERN_(HAS_MULTI_HOTEND, e)
@@ -1360,9 +1362,13 @@ class Temperature {
static float get_pid_output_chamber();
#endif
static void _temp_error(const heater_id_t e, FSTR_P const serial_msg, FSTR_P const lcd_msg);
static void mintemp_error(const heater_id_t e);
static void maxtemp_error(const heater_id_t e);
static void _temp_error(const heater_id_t e, FSTR_P const serial_msg, FSTR_P const lcd_msg OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg));
static void mintemp_error(const heater_id_t e OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg));
static void maxtemp_error(const heater_id_t e OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg));
#define _TEMP_ERROR(e, m, l, d) _temp_error(heater_id_t(e), m, GET_TEXT_F(l) OPTARG(ERR_INCLUDE_TEMP, d))
#define MINTEMP_ERROR(e, d) mintemp_error(heater_id_t(e) OPTARG(ERR_INCLUDE_TEMP, d))
#define MAXTEMP_ERROR(e, d) maxtemp_error(heater_id_t(e) OPTARG(ERR_INCLUDE_TEMP, d))
#define HAS_THERMAL_PROTECTION ANY(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_CHAMBER, THERMAL_PROTECTION_BED, THERMAL_PROTECTION_COOLER)
@@ -5,7 +5,8 @@
# the appropriate framework variants folder, so that its contents
# will be picked up by PlatformIO just like any other variant.
#
import pioutil
import pioutil, re
marlin_variant_pattern = re.compile("marlin_.*")
if pioutil.is_pio_build():
import shutil,marlin
from pathlib import Path
@@ -32,7 +33,7 @@ if pioutil.is_pio_build():
else:
platform_name = PackageSpec(platform_packages[0]).name
if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino", "biqu-bx-workaround", "main" ]:
if platform_name in [ "Arduino_Core_STM32", "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino", "biqu-bx-workaround", "main" ]:
platform_name = "framework-arduinoststm32"
FRAMEWORK_DIR = Path(platform.get_package_dir(platform_name))
@@ -44,15 +45,20 @@ if pioutil.is_pio_build():
variant = board.get("build.variant")
#series = mcu_type[:7].upper() + "xx"
# Prepare a new empty folder at the destination
variant_dir = FRAMEWORK_DIR / "variants" / variant
if variant_dir.is_dir():
shutil.rmtree(variant_dir)
if not variant_dir.is_dir():
variant_dir.mkdir()
# Only prepare a new variant if the PlatformIO configuration provides it (board_build.variant).
# This check is important to avoid deleting official board config variants.
if marlin_variant_pattern.match(str(variant).lower()):
# Prepare a new empty folder at the destination
variant_dir = FRAMEWORK_DIR / "variants" / variant
if variant_dir.is_dir():
shutil.rmtree(variant_dir)
if not variant_dir.is_dir():
variant_dir.mkdir()
# Source dir is a local variant sub-folder
source_dir = Path("buildroot/share/PlatformIO/variants", variant)
assert source_dir.is_dir()
# Source dir is a local variant sub-folder
source_dir = Path("buildroot/share/PlatformIO/variants", variant)
assert source_dir.is_dir()
marlin.copytree(source_dir, variant_dir)
print("Copying variant " + str(variant) + " to framework directory...")
marlin.copytree(source_dir, variant_dir)
+2 -2
View File
@@ -12,8 +12,8 @@ set -e
restore_configs
opt_set MOTHERBOARD BOARD_BTT_BTT002_V1_0 \
SERIAL_PORT 1 \
X_DRIVER_TYPE TMC2209 \
Y_DRIVER_TYPE TMC2130
X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2130
opt_enable SENSORLESS_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY SPI_ENDSTOPS
exec_test $1 $2 "BigTreeTech BTT002 Default Configuration plus TMC steppers" "$3"
#
+9 -2
View File
@@ -50,9 +50,16 @@ opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER \
MARLIN_BRICKOUT MARLIN_INVADERS MARLIN_SNAKE \
MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD \
SENSORLESS_HOMING TMC_DEBUG M114_DETAIL
SENSORLESS_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY TMC_DEBUG M114_DETAIL
exec_test $1 $2 "Mixed TMC | Sensorless | RRDFGSC | Games" "$3"
#
# Delta Config (FLSUN AC because it's complex)
#
use_example_configs delta/FLSUN/auto_calibrate
opt_set MOTHERBOARD BOARD_FYSETC_F6_13
exec_test $1 $2 "RAMPS 1.3 | DELTA | FLSUN AC Config" "$3"
#
# SCARA with Mixed TMC
#
@@ -64,7 +71,7 @@ opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \
X_HARDWARE_SERIAL Serial2
opt_enable FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR PAUSE_BEFORE_DEPLOY_STOW \
FYSETC_242_OLED_12864 EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL Z_SAFE_HOMING \
STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD SENSORLESS_HOMING EDGE_STEPPING
STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD SENSORLESS_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY EDGE_STEPPING
exec_test $1 $2 "SCARA | Mixed TMC | EEPROM" "$3"
# clean up
+4 -3
View File
@@ -53,14 +53,15 @@ opt_set MOTHERBOARD BOARD_COHESION3D_REMIX \
HOMING_FEEDRATE_MM_M '{ (50*60), (50*60), (4*60), (50*60) }' \
HOMING_BUMP_MM '{ 0, 0, 0, 0 }' HOMING_BUMP_DIVISOR '{ 1, 1, 1, 1 }' \
NOZZLE_TO_PROBE_OFFSET '{ 0, 0, 0, 0 }' \
I_MIN_PIN P1_25
I_MIN_PIN P1_25 \
X_CURRENT_HOME 750 Y_CURRENT_HOME 750 Z_CURRENT_HOME 750
opt_enable AUTO_BED_LEVELING_BILINEAR EEPROM_SETTINGS EEPROM_CHITCHAT MECHANICAL_GANTRY_CALIBRATION \
TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z HYBRID_THRESHOLD \
SENSORLESS_PROBING Z_SAFE_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY TMC_DEBUG \
SENSORLESS_PROBING SENSORLESS_HOMING Z_SAFE_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY TMC_DEBUG \
AXIS4_ROTATES I_MIN_POS I_MAX_POS I_HOME_DIR I_ENABLE_ON INVERT_I_DIR \
EXPERIMENTAL_I2CBUS
opt_disable PSU_CONTROL Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
exec_test $1 $2 "Cohesion3D Remix DELTA + ABL Bilinear + EEPROM + SENSORLESS_PROBING + I Axis" "$3"
exec_test $1 $2 "Cohesion3D Remix DELTA | ABL Bilinear | EEPROM | Sensorless Homing/Probing | I Axis" "$3"
# clean up
restore_configs
+1 -2
View File
@@ -25,8 +25,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \
LONG_FILENAME_HOST_SUPPORT CUSTOM_FIRMWARE_UPLOAD M20_TIMESTAMP_SUPPORT \
SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \
MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_GFX_OVERLAY \
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \
EDGE_STEPPING
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS
exec_test $1 $2 "Minitronics 2.0 with assorted features" "$3"
# clean up
+2 -1
View File
@@ -25,7 +25,8 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_R
LONG_FILENAME_HOST_SUPPORT CUSTOM_FIRMWARE_UPLOAD M20_TIMESTAMP_SUPPORT \
SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \
MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_GFX_OVERLAY \
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS \
SENSORLESS_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY Z2_STALL_SENSITIVITY \
EDGE_STEPPING TMC_DEBUG
exec_test $1 $2 "Grand Central M4 with assorted features" "$3"
+1
View File
@@ -41,6 +41,7 @@ opt_set MOTHERBOARD BOARD_ZRIB_V52 \
LCD_LANGUAGE pt REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 \
EXTRUDERS 2 TEMP_SENSOR_1 1 X2_DRIVER_TYPE A4988
opt_enable DUAL_X_CARRIAGE REPRAPWORLD_KEYPAD
opt_add DEBUG_DXC_MODE
exec_test $1 $2 "ZRIB_V52 | DUAL_X_CARRIAGE" "$3"
#
+2 -1
View File
@@ -85,9 +85,10 @@ exec_test $1 $2 "Mixing Extruder" "$3"
restore_configs
opt_set MOTHERBOARD BOARD_TEENSY35_36 \
X_DRIVER_TYPE TMC5160 Y_DRIVER_TYPE TMC5160 \
X_CURRENT_HOME 750 Y_CURRENT_HOME 750 \
X_MIN_ENDSTOP_HIT_STATE LOW Y_MIN_ENDSTOP_HIT_STATE LOW \
X_CS_PIN 46 Y_CS_PIN 47
opt_enable COREXY MONITOR_DRIVER_STATUS SENSORLESS_HOMING
opt_enable COREXY MONITOR_DRIVER_STATUS SENSORLESS_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY
exec_test $1 $2 "Teensy 3.5/3.6 COREXY" "$3"
#
+6
View File
@@ -21,6 +21,12 @@ board = genericSTM32F103RE
# List of environment names that are no longer used
#
[env:megaatmega1280] ;=> mega1280
extends = renamed
[env:megaatmega2560] ;=> mega2560
extends = renamed
[env:STM32F103RET6_creality_maple] ;=> STM32F103RE_creality_maple
extends = renamed