Apply TERN to compact code (#17619)
This commit is contained in:
parent
88bdd26c99
commit
6d90d1e1f5
162 changed files with 1493 additions and 3530 deletions
|
@ -73,9 +73,7 @@ int MarlinSerialUSB::peek() {
|
|||
|
||||
pending_char = udi_cdc_getc();
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
emergency_parser.update(emergency_state, (char)pending_char);
|
||||
#endif
|
||||
TERN_(EMERGENCY_PARSER, emergency_parser.update(emergency_state, (char)pending_char));
|
||||
|
||||
return pending_char;
|
||||
}
|
||||
|
@ -97,9 +95,7 @@ int MarlinSerialUSB::read() {
|
|||
|
||||
int c = udi_cdc_getc();
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
emergency_parser.update(emergency_state, (char)c);
|
||||
#endif
|
||||
TERN_(EMERGENCY_PARSER, emergency_parser.update(emergency_state, (char)c));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -47,43 +47,21 @@ void endstop_ISR() { endstops.update(); }
|
|||
|
||||
void setup_endstop_interrupts() {
|
||||
#define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
|
||||
#if HAS_X_MAX
|
||||
_ATTACH(X_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
_ATTACH(X_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
_ATTACH(Y_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
_ATTACH(Y_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
_ATTACH(Z_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
_ATTACH(Z_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
_ATTACH(Z2_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
_ATTACH(Z2_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
_ATTACH(Z3_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
|
||||
TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
|
||||
TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
|
||||
TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
|
||||
TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
|
||||
TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
|
||||
TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
|
||||
TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
|
||||
TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
|
||||
TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
|
||||
TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
|
||||
TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
|
||||
TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
|
||||
TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
|
||||
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
#define IS_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
|
||||
|
||||
// Shorthand
|
||||
#define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); }
|
||||
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
||||
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
|
|
|
@ -97,9 +97,7 @@ void HAL_init_board() {
|
|||
esp3dlib.init();
|
||||
#elif ENABLED(WIFISUPPORT)
|
||||
wifi_init();
|
||||
#if ENABLED(OTASUPPORT)
|
||||
OTA_init();
|
||||
#endif
|
||||
TERN_(OTASUPPORT, OTA_init());
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
spiffs_init();
|
||||
web_init();
|
||||
|
@ -133,9 +131,7 @@ void HAL_idletask() {
|
|||
#if BOTH(WIFISUPPORT, OTASUPPORT)
|
||||
OTA_handle();
|
||||
#endif
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
esp3dlib.idletask();
|
||||
#endif
|
||||
TERN_(ESP3D_WIFISUPPORT, esp3dlib.idletask());
|
||||
}
|
||||
|
||||
void HAL_clear_reset_source() { }
|
||||
|
@ -176,39 +172,17 @@ void HAL_adc_init() {
|
|||
adc1_config_width(ADC_WIDTH_12Bit);
|
||||
|
||||
// Configure channels only if used as (re-)configuring a pin for ADC that is used elsewhere might have adverse effects
|
||||
#if HAS_TEMP_ADC_0
|
||||
adc1_set_attenuation(get_channel(TEMP_0_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_1
|
||||
adc1_set_attenuation(get_channel(TEMP_1_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_2
|
||||
adc1_set_attenuation(get_channel(TEMP_2_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_3
|
||||
adc1_set_attenuation(get_channel(TEMP_3_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_4
|
||||
adc1_set_attenuation(get_channel(TEMP_4_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_5
|
||||
adc1_set_attenuation(get_channel(TEMP_5_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
adc2_set_attenuation(get_channel(TEMP_6_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
TERN_(HAS_TEMP_ADC_0, adc1_set_attenuation(get_channel(TEMP_0_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_1, adc1_set_attenuation(get_channel(TEMP_1_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_2, adc1_set_attenuation(get_channel(TEMP_2_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_3, adc1_set_attenuation(get_channel(TEMP_3_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_4, adc1_set_attenuation(get_channel(TEMP_4_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_5, adc1_set_attenuation(get_channel(TEMP_5_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_6, adc2_set_attenuation(get_channel(TEMP_6_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_7, adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_HEATED_BED, adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_CHAMBER, adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db));
|
||||
TERN_(FILAMENT_WIDTH_SENSOR, adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db));
|
||||
|
||||
// Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail.
|
||||
// That's why we're not setting it up here.
|
||||
|
|
|
@ -61,9 +61,7 @@ void Servo::move(const int value) {
|
|||
if (attach(0) >= 0) {
|
||||
write(value);
|
||||
safe_delay(servo_delay[channel]);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
}
|
||||
#endif // HAS_SERVOS
|
||||
|
|
|
@ -42,43 +42,21 @@ void ICACHE_RAM_ATTR endstop_ISR() { endstops.update(); }
|
|||
|
||||
void setup_endstop_interrupts() {
|
||||
#define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
|
||||
#if HAS_X_MAX
|
||||
_ATTACH(X_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
_ATTACH(X_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
_ATTACH(Y_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
_ATTACH(Y_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
_ATTACH(Z_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
_ATTACH(Z_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
_ATTACH(Z2_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
_ATTACH(Z2_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
_ATTACH(Z3_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
|
||||
TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
|
||||
TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
|
||||
TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
|
||||
TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
|
||||
TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
|
||||
TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
|
||||
TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
|
||||
TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
|
||||
TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
|
||||
TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
|
||||
TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
|
||||
TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
|
||||
TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
|
||||
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
}
|
||||
|
|
|
@ -28,7 +28,5 @@
|
|||
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
||||
|
||||
inline void watchdog_refresh() {
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
HAL_watchdog_refresh();
|
||||
#endif
|
||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
||||
}
|
||||
|
|
|
@ -211,11 +211,7 @@ void HardFault_HandlerC(unsigned long *sp, unsigned long lr, unsigned long cause
|
|||
|
||||
// Nothing below here is compiled because NVIC_SystemReset loops forever
|
||||
|
||||
for (;;) {
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
watchdog_init();
|
||||
#endif
|
||||
}
|
||||
for (;;) { TERN_(USE_WATCHDOG, watchdog_init()); }
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -70,9 +70,7 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
|
|||
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
|
||||
|
||||
void HAL_clear_reset_source(void) {
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
watchdog_clear_timeout_flag();
|
||||
#endif
|
||||
TERN_(USE_WATCHDOG, watchdog_clear_timeout_flag());
|
||||
}
|
||||
|
||||
uint8_t HAL_get_reset_source(void) {
|
||||
|
|
|
@ -44,10 +44,9 @@ public:
|
|||
MarlinSerial(LPC_UART_TypeDef *UARTx) :
|
||||
HardwareSerial<RX_BUFFER_SIZE, TX_BUFFER_SIZE>(UARTx)
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
, emergency_state(EmergencyParser::State::EP_RESET)
|
||||
, emergency_state(EmergencyParser::State::EP_RESET)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
void end() {}
|
||||
|
||||
|
|
|
@ -60,9 +60,7 @@ class libServo: public Servo {
|
|||
if (attach(servo_info[servoIndex].Pin.nbr) >= 0) { // try to reattach
|
||||
write(value);
|
||||
safe_delay(servo_delay[servoIndex]); // delay to allow servo to reach position
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,71 +29,19 @@
|
|||
// Local defines
|
||||
// ------------------------
|
||||
|
||||
#if HAS_TEMP_ADC_0
|
||||
#define GET_TEMP_0_ADC() PIN_TO_ADC(TEMP_0_PIN)
|
||||
#else
|
||||
#define GET_TEMP_0_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_1
|
||||
#define GET_TEMP_1_ADC() PIN_TO_ADC(TEMP_1_PIN)
|
||||
#else
|
||||
#define GET_TEMP_1_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_2
|
||||
#define GET_TEMP_2_ADC() PIN_TO_ADC(TEMP_2_PIN)
|
||||
#else
|
||||
#define GET_TEMP_2_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_3
|
||||
#define GET_TEMP_3_ADC() PIN_TO_ADC(TEMP_3_PIN)
|
||||
#else
|
||||
#define GET_TEMP_3_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_4
|
||||
#define GET_TEMP_4_ADC() PIN_TO_ADC(TEMP_4_PIN)
|
||||
#else
|
||||
#define GET_TEMP_4_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_5
|
||||
#define GET_TEMP_5_ADC() PIN_TO_ADC(TEMP_5_PIN)
|
||||
#else
|
||||
#define GET_TEMP_5_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
#define GET_TEMP_6_ADC() PIN_TO_ADC(TEMP_6_PIN)
|
||||
#else
|
||||
#define GET_TEMP_6_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
#define GET_TEMP_7_ADC() PIN_TO_ADC(TEMP_7_PIN)
|
||||
#else
|
||||
#define GET_TEMP_7_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_PROBE
|
||||
#define GET_PROBE_ADC() PIN_TO_ADC(TEMP_PROBE_PIN)
|
||||
#else
|
||||
#define GET_PROBE_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_BED
|
||||
#define GET_BED_ADC() PIN_TO_ADC(TEMP_BED_PIN)
|
||||
#else
|
||||
#define GET_BED_ADC() -1
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_CHAMBER
|
||||
#define GET_CHAMBER_ADC() PIN_TO_ADC(TEMP_CHAMBER_PIN)
|
||||
#else
|
||||
#define GET_CHAMBER_ADC() -1
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
#define GET_FILAMENT_WIDTH_ADC() PIN_TO_ADC(FILWIDTH_PIN)
|
||||
#else
|
||||
#define GET_FILAMENT_WIDTH_ADC() -1
|
||||
#endif
|
||||
#if HAS_ADC_BUTTONS
|
||||
#define GET_BUTTONS_ADC() PIN_TO_ADC(ADC_KEYPAD_PIN)
|
||||
#else
|
||||
#define GET_BUTTONS_ADC() -1
|
||||
#endif
|
||||
#define GET_TEMP_0_ADC() TERN(HAS_TEMP_ADC_0, PIN_TO_ADC(TEMP_0_PIN), -1)
|
||||
#define GET_TEMP_1_ADC() TERN(HAS_TEMP_ADC_1, PIN_TO_ADC(TEMP_1_PIN), -1)
|
||||
#define GET_TEMP_2_ADC() TERN(HAS_TEMP_ADC_2, PIN_TO_ADC(TEMP_2_PIN), -1)
|
||||
#define GET_TEMP_3_ADC() TERN(HAS_TEMP_ADC_3, PIN_TO_ADC(TEMP_3_PIN), -1)
|
||||
#define GET_TEMP_4_ADC() TERN(HAS_TEMP_ADC_4, PIN_TO_ADC(TEMP_4_PIN), -1)
|
||||
#define GET_TEMP_5_ADC() TERN(HAS_TEMP_ADC_5, PIN_TO_ADC(TEMP_5_PIN), -1)
|
||||
#define GET_TEMP_6_ADC() TERN(HAS_TEMP_ADC_6, PIN_TO_ADC(TEMP_6_PIN), -1)
|
||||
#define GET_TEMP_7_ADC() TERN(HAS_TEMP_ADC_7, PIN_TO_ADC(TEMP_7_PIN), -1)
|
||||
#define GET_PROBE_ADC() TERN(HAS_TEMP_PROBE, PIN_TO_ADC(TEMP_PROBE_PIN), -1)
|
||||
#define GET_BED_ADC() TERN(HAS_TEMP_ADC_BED, PIN_TO_ADC(TEMP_BED_PIN), -1)
|
||||
#define GET_CHAMBER_ADC() TERN(HAS_TEMP_ADC_CHAMBER, PIN_TO_ADC(TEMP_CHAMBER_PIN), -1)
|
||||
#define GET_FILAMENT_WIDTH_ADC() TERN(FILAMENT_WIDTH_SENSOR, PIN_TO_ADC(FILWIDTH_PIN), -1)
|
||||
#define GET_BUTTONS_ADC() TERN(HAS_ADC_BUTTONS, PIN_TO_ADC(ADC_KEYPAD_PIN), -1)
|
||||
|
||||
#define IS_ADC_REQUIRED(n) ( \
|
||||
GET_TEMP_0_ADC() == n || GET_TEMP_1_ADC() == n || GET_TEMP_2_ADC() == n || GET_TEMP_3_ADC() == n \
|
||||
|
@ -105,21 +53,22 @@
|
|||
|| GET_BUTTONS_ADC() == n \
|
||||
)
|
||||
|
||||
#define ADC0_IS_REQUIRED IS_ADC_REQUIRED(0)
|
||||
#define ADC1_IS_REQUIRED IS_ADC_REQUIRED(1)
|
||||
#define ADC_IS_REQUIRED (ADC0_IS_REQUIRED || ADC1_IS_REQUIRED)
|
||||
#if ADC0_IS_REQUIRED
|
||||
#if IS_ADC_REQUIRED(0)
|
||||
#define ADC0_IS_REQUIRED 1
|
||||
#define FIRST_ADC 0
|
||||
#else
|
||||
#define FIRST_ADC 1
|
||||
#endif
|
||||
#if ADC1_IS_REQUIRED
|
||||
#if IS_ADC_REQUIRED(1)
|
||||
#define ADC1_IS_REQUIRED 1
|
||||
#define LAST_ADC 1
|
||||
#else
|
||||
#define LAST_ADC 0
|
||||
#endif
|
||||
|
||||
#define DMA_IS_REQUIRED ADC_IS_REQUIRED
|
||||
#if ADC0_IS_REQUIRED || ADC1_IS_REQUIRED
|
||||
#define ADC_IS_REQUIRED 1
|
||||
#define DMA_IS_REQUIRED 1
|
||||
#endif
|
||||
|
||||
// ------------------------
|
||||
// Types
|
||||
|
@ -423,9 +372,7 @@ uint16_t HAL_adc_result;
|
|||
|
||||
// HAL initialization task
|
||||
void HAL_init() {
|
||||
#if DMA_IS_REQUIRED
|
||||
dma_init();
|
||||
#endif
|
||||
TERN_(DMA_IS_REQUIRED, dma_init());
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#if SD_CONNECTION_IS(ONBOARD) && PIN_EXISTS(SD_DETECT)
|
||||
SET_INPUT_PULLUP(SD_DETECT_PIN);
|
||||
|
|
|
@ -76,20 +76,18 @@ void HAL_init() {
|
|||
#endif
|
||||
|
||||
#if ENABLED(SRAM_EEPROM_EMULATION)
|
||||
// Enable access to backup SRAM
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
HAL_PWR_EnableBkUpAccess(); // Enable access to backup SRAM
|
||||
__HAL_RCC_BKPSRAM_CLK_ENABLE();
|
||||
|
||||
// Enable backup regulator
|
||||
LL_PWR_EnableBkUpRegulator();
|
||||
// Wait until backup regulator is initialized
|
||||
while (!LL_PWR_IsActiveFlag_BRR());
|
||||
LL_PWR_EnableBkUpRegulator(); // Enable backup regulator
|
||||
while (!LL_PWR_IsActiveFlag_BRR()); // Wait until backup regulator is initialized
|
||||
#endif
|
||||
|
||||
#if HAS_TMC_SW_SERIAL
|
||||
SoftwareSerial::setInterruptPriority(SWSERIAL_TIMER_IRQ_PRIO, 0);
|
||||
#endif
|
||||
|
||||
TERN_(HAS_TMC_SW_SERIAL, SoftwareSerial::setInterruptPriority(SWSERIAL_TIMER_IRQ_PRIO, 0));
|
||||
}
|
||||
|
||||
void HAL_clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
__HAL_RCC_SDIO_CLK_ENABLE(); // turn on SDIO clock
|
||||
}
|
||||
|
||||
constexpr uint8_t SD_RETRY_COUNT = 1 + 2 * ENABLED(SD_CHECK_AND_RETRY);
|
||||
constexpr uint8_t SD_RETRY_COUNT = TERN(SD_CHECK_AND_RETRY, 3, 1);
|
||||
|
||||
bool SDIO_Init() {
|
||||
//init SDIO and get SD card info
|
||||
|
|
|
@ -52,9 +52,7 @@ void libServo::move(const int value) {
|
|||
if (attach(0) >= 0) {
|
||||
write(value);
|
||||
safe_delay(delay);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
}
|
||||
#endif // HAS_SERVOS
|
||||
|
|
|
@ -28,43 +28,22 @@
|
|||
void endstop_ISR() { endstops.update(); }
|
||||
|
||||
void setup_endstop_interrupts() {
|
||||
#if HAS_X_MAX
|
||||
attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
attachInterrupt(Z3_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
attachInterrupt(Z4_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
attachInterrupt(Z4_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#define _ATTACH(P) attachInterrupt(P, endstop_ISR, CHANGE)
|
||||
TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
|
||||
TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
|
||||
TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
|
||||
TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
|
||||
TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
|
||||
TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
|
||||
TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
|
||||
TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
|
||||
TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
|
||||
TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
|
||||
TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
|
||||
TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
|
||||
TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
|
||||
TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
|
||||
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
}
|
||||
|
|
|
@ -138,9 +138,7 @@ void libServo::move(const int32_t value) {
|
|||
angle = constrain(value, minAngle, maxAngle);
|
||||
servoWrite(pin, US_TO_COMPARE(ANGLE_TO_US(angle)));
|
||||
safe_delay(servo_delay[servoIndex]);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,43 +53,22 @@
|
|||
void endstop_ISR() { endstops.update(); }
|
||||
|
||||
void setup_endstop_interrupts() {
|
||||
#if HAS_X_MAX
|
||||
attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE); // assign it
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
attachInterrupt(Z3_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
attachInterrupt(Z4_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
attachInterrupt(Z4_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#define _ATTACH(P) attachInterrupt(P, endstop_ISR, CHANGE)
|
||||
TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
|
||||
TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
|
||||
TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
|
||||
TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
|
||||
TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
|
||||
TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
|
||||
TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
|
||||
TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
|
||||
TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
|
||||
TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
|
||||
TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
|
||||
TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
|
||||
TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
|
||||
TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
|
||||
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
}
|
||||
|
|
|
@ -44,9 +44,7 @@ void libServo::move(const int value) {
|
|||
if (attach(0) >= 0) {
|
||||
write(value);
|
||||
safe_delay(servo_delay[servoIndex]);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,43 +28,22 @@
|
|||
void endstop_ISR() { endstops.update(); }
|
||||
|
||||
void setup_endstop_interrupts() {
|
||||
#if HAS_X_MAX
|
||||
attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
attachInterrupt(Z3_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
attachInterrupt(Z4_MAX_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
attachInterrupt(Z4_MIN_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
|
||||
#endif
|
||||
#define _ATTACH(P) attachInterrupt(P, endstop_ISR, CHANGE)
|
||||
TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
|
||||
TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
|
||||
TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
|
||||
TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
|
||||
TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
|
||||
TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
|
||||
TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
|
||||
TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
|
||||
TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
|
||||
TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
|
||||
TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
|
||||
TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
|
||||
TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
|
||||
TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
|
||||
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
}
|
||||
|
|
|
@ -46,9 +46,7 @@ void libServo::move(const int value) {
|
|||
if (attach(0) >= 0) {
|
||||
write(value);
|
||||
safe_delay(servo_delay[servoIndex]);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,31 +47,21 @@ void endstop_ISR() { endstops.update(); }
|
|||
|
||||
void setup_endstop_interrupts() {
|
||||
#define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
|
||||
#if HAS_X_MAX
|
||||
_ATTACH(X_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
_ATTACH(X_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
_ATTACH(Y_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
_ATTACH(Y_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
_ATTACH(Z_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
_ATTACH(Z_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
_ATTACH(Z2_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
_ATTACH(Z2_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
|
||||
TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
|
||||
TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
|
||||
TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
|
||||
TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
|
||||
TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
|
||||
TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
|
||||
TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
|
||||
TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
|
||||
TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
|
||||
TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
|
||||
TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
|
||||
TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
|
||||
TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
|
||||
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
}
|
||||
|
|
|
@ -46,9 +46,7 @@ void libServo::move(const int value) {
|
|||
if (attach(0) >= 0) {
|
||||
write(value);
|
||||
safe_delay(servo_delay[servoIndex]);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,43 +46,21 @@ void endstop_ISR() { endstops.update(); }
|
|||
*/
|
||||
void setup_endstop_interrupts() {
|
||||
#define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
|
||||
#if HAS_X_MAX
|
||||
_ATTACH(X_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_X_MIN
|
||||
_ATTACH(X_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
_ATTACH(Y_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
_ATTACH(Y_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
_ATTACH(Z_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
_ATTACH(Z_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
_ATTACH(Z2_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z2_MIN
|
||||
_ATTACH(Z2_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MAX
|
||||
_ATTACH(Z3_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z3_MIN
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MAX
|
||||
_ATTACH(Z4_MAX_PIN);
|
||||
#endif
|
||||
#if HAS_Z4_MIN
|
||||
_ATTACH(Z4_MIN_PIN);
|
||||
#endif
|
||||
#if HAS_Z_MIN_PROBE_PIN
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
|
||||
TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
|
||||
TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
|
||||
TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
|
||||
TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
|
||||
TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
|
||||
TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
|
||||
TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
|
||||
TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
|
||||
TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
|
||||
TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
|
||||
TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
|
||||
TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
|
||||
TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
|
||||
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
||||
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
||||
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
|
||||
}
|
||||
|
|
|
@ -150,9 +150,7 @@ void Servo::move(const int value) {
|
|||
if (attach(0) >= 0) {
|
||||
write(value);
|
||||
safe_delay(servo_delay[servoIndex]);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -313,9 +313,7 @@ void enable_e_steppers() {
|
|||
}
|
||||
|
||||
void enable_all_steppers() {
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.power_on();
|
||||
#endif
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
ENABLE_AXIS_X();
|
||||
ENABLE_AXIS_Y();
|
||||
ENABLE_AXIS_Z();
|
||||
|
@ -359,9 +357,7 @@ void disable_all_steppers() {
|
|||
}
|
||||
|
||||
void event_probe_recover() {
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), DISMISS_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), DISMISS_STR));
|
||||
#ifdef ACTION_ON_G29_RECOVER
|
||||
host_action(PSTR(ACTION_ON_G29_RECOVER));
|
||||
#endif
|
||||
|
@ -394,12 +390,8 @@ bool printingIsPaused() {
|
|||
|
||||
void startOrResumeJob() {
|
||||
if (!printingIsPaused()) {
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
cancelable.reset();
|
||||
#endif
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
e_move_accumulator = 0;
|
||||
#endif
|
||||
TERN_(CANCEL_OBJECTS, cancelable.reset());
|
||||
TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator = 0);
|
||||
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
|
||||
ui.reset_remaining_time();
|
||||
#endif
|
||||
|
@ -410,11 +402,7 @@ void startOrResumeJob() {
|
|||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
inline void abortSDPrinting() {
|
||||
card.endFilePrint(
|
||||
#if SD_RESORT
|
||||
true
|
||||
#endif
|
||||
);
|
||||
card.endFilePrint(TERN_(SD_RESORT, true));
|
||||
queue.clear();
|
||||
quickstop_stepper();
|
||||
print_job_timer.stop();
|
||||
|
@ -427,9 +415,7 @@ void startOrResumeJob() {
|
|||
cutter.kill(); // Full cutter shutdown including ISR control
|
||||
#endif
|
||||
wait_for_heatup = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.purge();
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
|
||||
#ifdef EVENT_GCODE_SD_STOP
|
||||
queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
|
||||
#endif
|
||||
|
@ -534,13 +520,9 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
controllerFan.update(); // Check if fan should be turned on to cool stepper drivers down
|
||||
#endif
|
||||
TERN_(USE_CONTROLLER_FAN, controllerFan.update()); // Check if fan should be turned on to cool stepper drivers down
|
||||
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.check();
|
||||
#endif
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.check());
|
||||
|
||||
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
|
||||
if (thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP
|
||||
|
@ -608,17 +590,11 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(TEMP_STAT_LEDS)
|
||||
handle_status_leds();
|
||||
#endif
|
||||
TERN_(TEMP_STAT_LEDS, handle_status_leds());
|
||||
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
monitor_tmc_drivers();
|
||||
#endif
|
||||
TERN_(MONITOR_DRIVER_STATUS, monitor_tmc_drivers());
|
||||
|
||||
#if ENABLED(MONITOR_L6470_DRIVER_STATUS)
|
||||
L64xxManager.monitor_driver();
|
||||
#endif
|
||||
TERN_(MONITOR_L6470_DRIVER_STATUS, L64xxManager.monitor_driver());
|
||||
|
||||
// Limit check_axes_activity frequency to 10Hz
|
||||
static millis_t next_check_axes_ms = 0;
|
||||
|
@ -669,17 +645,13 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
|||
thermalManager.manage_heater();
|
||||
|
||||
// Max7219 heartbeat, animation, etc
|
||||
#if ENABLED(MAX7219_DEBUG)
|
||||
max7219.idle_tasks();
|
||||
#endif
|
||||
TERN_(MAX7219_DEBUG, max7219.idle_tasks());
|
||||
|
||||
// Return if setup() isn't completed
|
||||
if (marlin_state == MF_INITIALIZING) return;
|
||||
|
||||
// Handle filament runout sensors
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
runout.run();
|
||||
#endif
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.run());
|
||||
|
||||
// Run HAL idle tasks
|
||||
#ifdef HAL_IDLETASK
|
||||
|
@ -700,29 +672,19 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
|||
#endif
|
||||
|
||||
// Handle SD Card insert / remove
|
||||
#if ENABLED(SDSUPPORT)
|
||||
card.manage_media();
|
||||
#endif
|
||||
TERN_(SDSUPPORT, card.manage_media());
|
||||
|
||||
// Handle USB Flash Drive insert / remove
|
||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
||||
Sd2Card::idle();
|
||||
#endif
|
||||
TERN_(USB_FLASH_DRIVE_SUPPORT, Sd2Card::idle());
|
||||
|
||||
// Announce Host Keepalive state (if any)
|
||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
gcode.host_keepalive();
|
||||
#endif
|
||||
TERN_(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive());
|
||||
|
||||
// Update the Print Job Timer state
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
print_job_timer.tick();
|
||||
#endif
|
||||
TERN_(PRINTCOUNTER, print_job_timer.tick());
|
||||
|
||||
// Update the Beeper queue
|
||||
#if USE_BEEPER
|
||||
buzzer.tick();
|
||||
#endif
|
||||
TERN_(USE_BEEPER, buzzer.tick());
|
||||
|
||||
// Read Buttons and Update the LCD
|
||||
ui.update();
|
||||
|
@ -742,24 +704,16 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
|||
// Auto-report Temperatures / SD Status
|
||||
#if HAS_AUTO_REPORTING
|
||||
if (!gcode.autoreport_paused) {
|
||||
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||
thermalManager.auto_report_temperatures();
|
||||
#endif
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
card.auto_report_sd_status();
|
||||
#endif
|
||||
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_report_temperatures());
|
||||
TERN_(AUTO_REPORT_SD_STATUS, card.auto_report_sd_status());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Update the Prusa MMU2
|
||||
#if ENABLED(PRUSA_MMU2)
|
||||
mmu2.mmu_loop();
|
||||
#endif
|
||||
TERN_(PRUSA_MMU2, mmu2.mmu_loop());
|
||||
|
||||
// Handle Joystick jogging
|
||||
#if ENABLED(POLL_JOG)
|
||||
joystick.inject_jog_moves();
|
||||
#endif
|
||||
TERN_(POLL_JOG, joystick.inject_jog_moves());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -769,9 +723,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
|||
void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr*/, const bool steppers_off/*=false*/) {
|
||||
thermalManager.disable_all_heaters();
|
||||
|
||||
#if HAS_CUTTER
|
||||
cutter.kill(); // Full cutter shutdown including ISR control
|
||||
#endif
|
||||
TERN_(HAS_CUTTER, cutter.kill()); // Full cutter shutdown including ISR control
|
||||
|
||||
SERIAL_ERROR_MSG(STR_ERR_KILLED);
|
||||
|
||||
|
@ -802,20 +754,14 @@ void minkill(const bool steppers_off/*=false*/) {
|
|||
// Reiterate heaters off
|
||||
thermalManager.disable_all_heaters();
|
||||
|
||||
#if HAS_CUTTER
|
||||
cutter.kill(); // Reiterate cutter shutdown
|
||||
#endif
|
||||
TERN_(HAS_CUTTER, cutter.kill()); // Reiterate cutter shutdown
|
||||
|
||||
// Power off all steppers (for M112) or just the E steppers
|
||||
steppers_off ? disable_all_steppers() : disable_e_steppers();
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
PSU_OFF();
|
||||
#endif
|
||||
TERN_(PSU_CONTROL, PSU_OFF());
|
||||
|
||||
#if HAS_SUICIDE
|
||||
suicide();
|
||||
#endif
|
||||
TERN_(HAS_SUICIDE, suicide());
|
||||
|
||||
#if HAS_KILL
|
||||
|
||||
|
@ -1016,9 +962,7 @@ void setup() {
|
|||
SETUP_RUN(touch.init());
|
||||
#endif
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
current_position += home_offset; // Init current position based on home_offset
|
||||
#endif
|
||||
TERN_(HAS_M206_COMMAND, current_position += home_offset); // Init current position based on home_offset
|
||||
|
||||
sync_plan_position(); // Vital to init stepper/planner equivalent for current_position
|
||||
|
||||
|
|
|
@ -86,6 +86,10 @@
|
|||
|| AXIS_DRIVER_TYPE_X2(T) || AXIS_DRIVER_TYPE_Y2(T) || AXIS_DRIVER_TYPE_Z2(T) \
|
||||
|| AXIS_DRIVER_TYPE_Z3(T) || AXIS_DRIVER_TYPE_Z4(T) || HAS_E_DRIVER(T) )
|
||||
|
||||
//
|
||||
// Trinamic Stepper Drivers
|
||||
//
|
||||
|
||||
// Test for supported TMC drivers that require advanced configuration
|
||||
// Does not match standalone configurations
|
||||
#if ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) \
|
||||
|
@ -171,8 +175,9 @@
|
|||
#define HAS_TMC_SPI 1
|
||||
#endif
|
||||
|
||||
// Defines that can't be evaluated now
|
||||
#define HAS_TMC_SW_SERIAL ANY_AXIS_HAS(SW_SERIAL)
|
||||
//
|
||||
// L64XX Stepper Drivers
|
||||
//
|
||||
|
||||
#if HAS_DRIVER(L6470) || HAS_DRIVER(L6474) || HAS_DRIVER(L6480) || HAS_DRIVER(POWERSTEP01)
|
||||
#define HAS_L64XX 1
|
||||
|
|
|
@ -57,21 +57,21 @@ void safe_delay(millis_t ms) {
|
|||
|
||||
void log_machine_info() {
|
||||
SERIAL_ECHOLNPGM("Machine Type: "
|
||||
TERN(DELTA, "Delta", "")
|
||||
TERN(IS_SCARA, "SCARA", "")
|
||||
TERN(IS_CORE, "Core", "")
|
||||
TERN(IS_CARTESIAN, "Cartesian", "")
|
||||
TERN_(DELTA, "Delta")
|
||||
TERN_(IS_SCARA, "SCARA")
|
||||
TERN_(IS_CORE, "Core")
|
||||
TERN_(IS_CARTESIAN, "Cartesian")
|
||||
);
|
||||
|
||||
SERIAL_ECHOLNPGM("Probe: "
|
||||
TERN(PROBE_MANUALLY, "PROBE_MANUALLY", "")
|
||||
TERN(NOZZLE_AS_PROBE, "NOZZLE_AS_PROBE", "")
|
||||
TERN(FIX_MOUNTED_PROBE, "FIX_MOUNTED_PROBE", "")
|
||||
TERN(HAS_Z_SERVO_PROBE, TERN(BLTOUCH, "BLTOUCH", "SERVO PROBE"), "")
|
||||
TERN(TOUCH_MI_PROBE, "TOUCH_MI_PROBE", "")
|
||||
TERN(Z_PROBE_SLED, "Z_PROBE_SLED", "")
|
||||
TERN(Z_PROBE_ALLEN_KEY, "Z_PROBE_ALLEN_KEY", "")
|
||||
TERN(SOLENOID_PROBE, "SOLENOID_PROBE", "")
|
||||
TERN_(PROBE_MANUALLY, "PROBE_MANUALLY")
|
||||
TERN_(NOZZLE_AS_PROBE, "NOZZLE_AS_PROBE")
|
||||
TERN_(FIX_MOUNTED_PROBE, "FIX_MOUNTED_PROBE")
|
||||
TERN_(HAS_Z_SERVO_PROBE, TERN(BLTOUCH, "BLTOUCH", "SERVO PROBE"))
|
||||
TERN_(TOUCH_MI_PROBE, "TOUCH_MI_PROBE")
|
||||
TERN_(Z_PROBE_SLED, "Z_PROBE_SLED")
|
||||
TERN_(Z_PROBE_ALLEN_KEY, "Z_PROBE_ALLEN_KEY")
|
||||
TERN_(SOLENOID_PROBE, "SOLENOID_PROBE")
|
||||
TERN(PROBE_SELECTED, "", "NONE")
|
||||
);
|
||||
|
||||
|
@ -108,10 +108,10 @@ void safe_delay(millis_t ms) {
|
|||
|
||||
#if HAS_ABL_OR_UBL
|
||||
SERIAL_ECHOPGM("Auto Bed Leveling: "
|
||||
TERN(AUTO_BED_LEVELING_LINEAR, "LINEAR", "")
|
||||
TERN(AUTO_BED_LEVELING_BILINEAR, "BILINEAR", "")
|
||||
TERN(AUTO_BED_LEVELING_3POINT, "3POINT", "")
|
||||
TERN(AUTO_BED_LEVELING_UBL, "UBL", "")
|
||||
TERN_(AUTO_BED_LEVELING_LINEAR, "LINEAR")
|
||||
TERN_(AUTO_BED_LEVELING_BILINEAR, "BILINEAR")
|
||||
TERN_(AUTO_BED_LEVELING_3POINT, "3POINT")
|
||||
TERN_(AUTO_BED_LEVELING_UBL, "UBL")
|
||||
);
|
||||
|
||||
if (planner.leveling_active) {
|
||||
|
|
|
@ -58,9 +58,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
|
|||
if (DISABLED(BABYSTEP_WITHOUT_HOMING) && !TEST(axis_known_position, axis)) return;
|
||||
|
||||
accum += distance; // Count up babysteps for the UI
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
axis_total[BS_TOTAL_IND(axis)] += distance;
|
||||
#endif
|
||||
TERN_(BABYSTEP_DISPLAY_TOTAL, axis_total[BS_TOTAL_IND(axis)] += distance);
|
||||
|
||||
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
|
||||
#define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: ENABLE_AXIS_X(); break; case Y_AXIS: ENABLE_AXIS_Y(); break; case Z_AXIS: ENABLE_AXIS_Z(); break; default: break; } }while(0)
|
||||
|
@ -107,13 +105,10 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
|
|||
#endif
|
||||
steps[BS_AXIS_IND(axis)] += distance;
|
||||
#endif
|
||||
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
|
||||
gcode.reset_stepper_timeout();
|
||||
#endif
|
||||
|
||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
||||
if (has_steps()) stepper.initiateBabystepping();
|
||||
#endif
|
||||
TERN_(BABYSTEP_ALWAYS_AVAILABLE, gcode.reset_stepper_timeout());
|
||||
|
||||
TERN_(INTEGRATED_BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
|
||||
}
|
||||
|
||||
#endif // BABYSTEPPING
|
||||
|
|
|
@ -55,11 +55,8 @@ public:
|
|||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
static int16_t axis_total[BS_TOTAL_IND(Z_AXIS) + 1]; // Total babysteps since G28
|
||||
static inline void reset_total(const AxisEnum axis) {
|
||||
if (true
|
||||
#if ENABLED(BABYSTEP_XY)
|
||||
&& axis == Z_AXIS
|
||||
#endif
|
||||
) axis_total[BS_TOTAL_IND(axis)] = 0;
|
||||
if (TERN1(BABYSTEP_XY, axis == Z_AXIS))
|
||||
axis_total[BS_TOTAL_IND(axis)] = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -55,26 +55,16 @@ public:
|
|||
|
||||
static inline float get_measurement(const AxisEnum a) {
|
||||
// Return the measurement averaged over all readings
|
||||
return (
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
measured_count[a] > 0 ? measured_mm[a] / measured_count[a] :
|
||||
#endif
|
||||
0
|
||||
return TERN(MEASURE_BACKLASH_WHEN_PROBING
|
||||
, measured_count[a] > 0 ? measured_mm[a] / measured_count[a] : 0
|
||||
, 0
|
||||
);
|
||||
#if DISABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
UNUSED(a);
|
||||
#endif
|
||||
TERN(MEASURE_BACKLASH_WHEN_PROBING,,UNUSED(a));
|
||||
}
|
||||
|
||||
static inline bool has_measurement(const AxisEnum a) {
|
||||
return (false
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
|| (measured_count[a] > 0)
|
||||
#endif
|
||||
);
|
||||
#if DISABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
UNUSED(a);
|
||||
#endif
|
||||
return TERN0(MEASURE_BACKLASH_WHEN_PROBING, measured_count[a] > 0);
|
||||
TERN(MEASURE_BACKLASH_WHEN_PROBING,,UNUSED(a));
|
||||
}
|
||||
|
||||
static inline bool has_any_measurement() {
|
||||
|
|
|
@ -74,9 +74,7 @@ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t
|
|||
|
||||
// Take the average instead of the median
|
||||
z_values[x][y] = (a + b + c) / 3.0;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, z_values[x][y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
|
||||
// Median is robust (ignores outliers).
|
||||
// z_values[x][y] = (a < b) ? ((b < c) ? b : (c < a) ? a : c)
|
||||
|
@ -241,9 +239,7 @@ void print_bilinear_leveling_grid() {
|
|||
// Refresh after other values have been updated
|
||||
void refresh_bed_level() {
|
||||
bilinear_grid_factor = bilinear_grid_spacing.reciprocal();
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
bed_level_virt_interpolate();
|
||||
#endif
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
|
||||
}
|
||||
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
|
|
|
@ -145,9 +145,7 @@ void reset_bed_level() {
|
|||
bilinear_grid_spacing.reset();
|
||||
GRID_LOOP(x, y) {
|
||||
z_values[x][y] = NAN;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, 0);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, 0));
|
||||
}
|
||||
#elif ABL_PLANAR
|
||||
planner.bed_level_matrix.set_to_identity();
|
||||
|
@ -245,9 +243,7 @@ void reset_bed_level() {
|
|||
|
||||
current_position = pos;
|
||||
|
||||
#if ENABLED(LCD_BED_LEVELING)
|
||||
ui.wait_for_move = false;
|
||||
#endif
|
||||
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -113,9 +113,7 @@
|
|||
void unified_bed_leveling::set_all_mesh_points_to_value(const float value) {
|
||||
GRID_LOOP(x, y) {
|
||||
z_values[x][y] = value;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, value);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -305,17 +305,13 @@
|
|||
|
||||
const int8_t p_val = parser.intval('P', -1);
|
||||
const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen('J');
|
||||
#if HOTENDS > 1
|
||||
const uint8_t old_tool_index = active_extruder;
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index = active_extruder);
|
||||
|
||||
// Check for commands that require the printer to be homed
|
||||
if (may_move) {
|
||||
planner.synchronize();
|
||||
if (axes_need_homing()) gcode.home_all_axes();
|
||||
#if HOTENDS > 1
|
||||
if (active_extruder != 0) tool_change(0);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, if (active_extruder) tool_change(0));
|
||||
}
|
||||
|
||||
// Invalidate Mesh Points. This command is a little bit asymmetrical because
|
||||
|
@ -340,9 +336,7 @@
|
|||
break; // No more invalid Mesh Points to populate
|
||||
}
|
||||
z_values[cpos.x][cpos.y] = NAN;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(cpos, 0.0f);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(cpos, 0.0f));
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
@ -369,9 +363,7 @@
|
|||
const float p1 = 0.5f * (GRID_MAX_POINTS_X) - x,
|
||||
p2 = 0.5f * (GRID_MAX_POINTS_Y) - y;
|
||||
z_values[x][y] += 2.0f * HYPOT(p1, p2);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, z_values[x][y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -392,9 +384,7 @@
|
|||
for (uint8_t x = (GRID_MAX_POINTS_X) / 3; x < 2 * (GRID_MAX_POINTS_X) / 3; x++) // Create a rectangular raised area in
|
||||
for (uint8_t y = (GRID_MAX_POINTS_Y) / 3; y < 2 * (GRID_MAX_POINTS_Y) / 3; y++) { // the center of the bed
|
||||
z_values[x][y] += parser.seen('C') ? g29_constant : 9.99f;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, z_values[x][y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -540,9 +530,7 @@
|
|||
}
|
||||
else {
|
||||
z_values[cpos.x][cpos.y] = g29_constant;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(cpos, g29_constant);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(cpos, g29_constant));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -683,9 +671,7 @@
|
|||
UNUSED(probe_deployed);
|
||||
#endif
|
||||
|
||||
#if HOTENDS > 1
|
||||
tool_change(old_tool_index);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -718,9 +704,7 @@
|
|||
GRID_LOOP(x, y)
|
||||
if (!isnan(z_values[x][y])) {
|
||||
z_values[x][y] -= mean + value;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, z_values[x][y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,9 +712,7 @@
|
|||
GRID_LOOP(x, y)
|
||||
if (!isnan(z_values[x][y])) {
|
||||
z_values[x][y] += g29_constant;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, z_values[x][y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -742,9 +724,7 @@
|
|||
void unified_bed_leveling::probe_entire_mesh(const xy_pos_t &near, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) {
|
||||
probe.deploy(); // Deploy before ui.capture() to allow for PAUSE_BEFORE_DEPLOY_STOW
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.capture());
|
||||
|
||||
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
|
||||
uint8_t count = GRID_MAX_POINTS;
|
||||
|
@ -755,9 +735,7 @@
|
|||
|
||||
const int point_num = (GRID_MAX_POINTS) - count + 1;
|
||||
SERIAL_ECHOLNPAIR("\nProbing mesh point ", point_num, "/", int(GRID_MAX_POINTS), ".\n");
|
||||
#if HAS_DISPLAY
|
||||
ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), point_num, int(GRID_MAX_POINTS));
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), point_num, int(GRID_MAX_POINTS)));
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (ui.button_pressed()) {
|
||||
|
@ -776,9 +754,7 @@
|
|||
: find_closest_mesh_point_of_type(INVALID, near, true);
|
||||
|
||||
if (best.pos.x >= 0) { // mesh point found and is reachable by probe
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(best.pos, ExtUI::PROBE_START);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(best.pos, ExtUI::PROBE_START));
|
||||
const float measured_z = probe.probe_at_point(
|
||||
best.meshpos(),
|
||||
stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level
|
||||
|
@ -793,13 +769,10 @@
|
|||
|
||||
} while (best.pos.x >= 0 && --count);
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ui.release();
|
||||
#endif
|
||||
probe.stow(); // Release UI during stow to allow for PAUSE_BEFORE_DEPLOY_STOW
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
// Release UI during stow to allow for PAUSE_BEFORE_DEPLOY_STOW
|
||||
TERN_(HAS_LCD_MENU, ui.release());
|
||||
probe.stow();
|
||||
TERN_(HAS_LCD_MENU, ui.capture());
|
||||
|
||||
#ifdef Z_AFTER_PROBING
|
||||
probe.move_z_after_probing();
|
||||
|
@ -858,9 +831,7 @@
|
|||
static void echo_and_take_a_measurement() { SERIAL_ECHOLNPGM(" and take a measurement."); }
|
||||
|
||||
float unified_bed_leveling::measure_business_card_thickness(float in_height) {
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.capture());
|
||||
save_ubl_active_state_and_disable(); // Disable bed level correction for probing
|
||||
|
||||
do_blocking_move_to(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)), in_height);
|
||||
|
@ -899,9 +870,7 @@
|
|||
}
|
||||
|
||||
void unified_bed_leveling::manually_probe_remaining_mesh(const xy_pos_t &pos, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) {
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.capture());
|
||||
|
||||
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
|
||||
do_blocking_move_to_xy_z(current_position, z_clearance);
|
||||
|
@ -929,9 +898,7 @@
|
|||
do_blocking_move_to_z(z_clearance);
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.capture());
|
||||
|
||||
if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing
|
||||
|
||||
|
@ -950,9 +917,7 @@
|
|||
}
|
||||
|
||||
z_values[lpos.x][lpos.y] = current_position.z - thick;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(location, z_values[lpos.x][lpos.y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location, z_values[lpos.x][lpos.y]));
|
||||
|
||||
if (g29_verbose_level > 2)
|
||||
SERIAL_ECHOLNPAIR_F("Mesh Point Measured at: ", z_values[lpos.x][lpos.y], 6);
|
||||
|
@ -998,14 +963,11 @@
|
|||
save_ubl_active_state_and_disable();
|
||||
|
||||
LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH);
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture(); // Take over control of the LCD encoder
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.capture()); // Take over control of the LCD encoder
|
||||
|
||||
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance
|
||||
|
||||
#if ENABLED(UBL_MESH_EDIT_MOVES_Z)
|
||||
do_blocking_move_to_z(h_offset); // Move Z to the given 'H' offset
|
||||
#endif
|
||||
TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset)); // Move Z to the given 'H' offset
|
||||
|
||||
MeshFlags done_flags{0};
|
||||
const xy_int8_t &lpos = location.pos;
|
||||
|
@ -1026,9 +988,7 @@
|
|||
|
||||
do_blocking_move_to(raw); // Move the nozzle to the edit point with probe clearance
|
||||
|
||||
#if ENABLED(UBL_MESH_EDIT_MOVES_Z)
|
||||
do_blocking_move_to_z(h_offset); // Move Z to the given 'H' offset before editing
|
||||
#endif
|
||||
TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset)); // Move Z to the given 'H' offset before editing
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
|
||||
|
@ -1044,9 +1004,7 @@
|
|||
|
||||
do {
|
||||
new_z = lcd_mesh_edit();
|
||||
#if ENABLED(UBL_MESH_EDIT_MOVES_Z)
|
||||
do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited
|
||||
#endif
|
||||
TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset + new_z)); // Move the nozzle as the point is edited
|
||||
idle();
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
} while (!ui.button_pressed());
|
||||
|
@ -1056,9 +1014,7 @@
|
|||
if (click_and_hold(abort_fine_tune)) break; // Button held down? Abort editing
|
||||
|
||||
z_values[lpos.x][lpos.y] = new_z; // Save the updated Z value
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(location, new_z);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location, new_z));
|
||||
|
||||
serial_delay(20); // No switch noise
|
||||
ui.refresh();
|
||||
|
@ -1086,9 +1042,7 @@
|
|||
bool unified_bed_leveling::g29_parameter_parsing() {
|
||||
bool err_flag = false;
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
set_message_with_feedback(GET_TEXT(MSG_UBL_DOING_G29));
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, set_message_with_feedback(GET_TEXT(MSG_UBL_DOING_G29)));
|
||||
|
||||
g29_constant = 0;
|
||||
g29_repetition_cnt = 0;
|
||||
|
@ -1210,9 +1164,7 @@
|
|||
ubl_state_recursion_chk++;
|
||||
if (ubl_state_recursion_chk != 1) {
|
||||
SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
|
||||
#if HAS_LCD_MENU
|
||||
set_message_with_feedback(GET_TEXT(MSG_UBL_SAVE_ERROR));
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, set_message_with_feedback(GET_TEXT(MSG_UBL_SAVE_ERROR)));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1224,9 +1176,7 @@
|
|||
#if ENABLED(UBL_DEVEL_DEBUGGING)
|
||||
if (--ubl_state_recursion_chk) {
|
||||
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
|
||||
#if HAS_LCD_MENU
|
||||
set_message_with_feedback(GET_TEXT(MSG_UBL_RESTORE_ERROR));
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, set_message_with_feedback(GET_TEXT(MSG_UBL_RESTORE_ERROR)));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1341,9 +1291,7 @@
|
|||
const float v2 = z_values[dx + xdir][dy + ydir];
|
||||
if (!isnan(v2)) {
|
||||
z_values[x][y] = v1 < v2 ? v1 : v1 + v1 - v2;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, z_values[x][y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1407,9 +1355,7 @@
|
|||
|
||||
if (do_3_pt_leveling) {
|
||||
SERIAL_ECHOLNPGM("Tilting mesh (1/3)");
|
||||
#if HAS_DISPLAY
|
||||
ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH));
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
|
||||
measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, g29_verbose_level);
|
||||
if (isnan(measured_z))
|
||||
|
@ -1428,9 +1374,7 @@
|
|||
|
||||
if (!abort_flag) {
|
||||
SERIAL_ECHOLNPGM("Tilting mesh (2/3)");
|
||||
#if HAS_DISPLAY
|
||||
ui.status_printf_P(0, PSTR(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH));
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
|
||||
measured_z = probe.probe_at_point(points[1], PROBE_PT_RAISE, g29_verbose_level);
|
||||
#ifdef VALIDATE_MESH_TILT
|
||||
|
@ -1450,9 +1394,7 @@
|
|||
|
||||
if (!abort_flag) {
|
||||
SERIAL_ECHOLNPGM("Tilting mesh (3/3)");
|
||||
#if HAS_DISPLAY
|
||||
ui.status_printf_P(0, PSTR(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH));
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
|
||||
measured_z = probe.probe_at_point(points[2], PROBE_PT_STOW, g29_verbose_level);
|
||||
#ifdef VALIDATE_MESH_TILT
|
||||
|
@ -1495,9 +1437,7 @@
|
|||
|
||||
if (!abort_flag) {
|
||||
SERIAL_ECHOLNPAIR("Tilting mesh point ", point_num, "/", total_points, "\n");
|
||||
#if HAS_DISPLAY
|
||||
ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points);
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points));
|
||||
|
||||
measured_z = probe.probe_at_point(rpos, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling
|
||||
|
||||
|
@ -1586,9 +1526,7 @@
|
|||
}
|
||||
|
||||
z_values[i][j] = mz - lsf_results.D;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(i, j, z_values[i][j]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(i, j, z_values[i][j]));
|
||||
}
|
||||
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
|
@ -1684,9 +1622,7 @@
|
|||
}
|
||||
const float ez = -lsf_results.D - lsf_results.A * ppos.x - lsf_results.B * ppos.y;
|
||||
z_values[ix][iy] = ez;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(ix, iy, z_values[ix][iy]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, z_values[ix][iy]));
|
||||
idle(); // housekeeping
|
||||
}
|
||||
}
|
||||
|
@ -1826,9 +1762,7 @@
|
|||
|
||||
GRID_LOOP(x, y) {
|
||||
z_values[x][y] -= tmp_z_values[x][y];
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, z_values[x][y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,9 +82,7 @@ private:
|
|||
}
|
||||
transfer_active = true;
|
||||
data_waiting = 0;
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
heatshrink_decoder_reset(&hsd);
|
||||
#endif
|
||||
TERN_(BINARY_STREAM_COMPRESSION, heatshrink_decoder_reset(&hsd));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -127,9 +125,7 @@ private:
|
|||
card.closefile();
|
||||
card.release();
|
||||
}
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
heatshrink_decoder_finish(&hsd);
|
||||
#endif
|
||||
TERN_(BINARY_STREAM_COMPRESSION, heatshrink_decoder_finish(&hsd));
|
||||
transfer_active = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -139,9 +135,7 @@ private:
|
|||
card.closefile();
|
||||
card.removeFile(card.filename);
|
||||
card.release();
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
heatshrink_decoder_finish(&hsd);
|
||||
#endif
|
||||
TERN_(BINARY_STREAM_COMPRESSION, heatshrink_decoder_finish(&hsd));
|
||||
}
|
||||
transfer_active = false;
|
||||
return;
|
||||
|
|
|
@ -124,9 +124,7 @@ bool BLTouch::deploy_proc() {
|
|||
}
|
||||
|
||||
// One of the recommended ANTClabs ways to probe, using SW MODE
|
||||
#if ENABLED(BLTOUCH_FORCE_SW_MODE)
|
||||
_set_SW_mode();
|
||||
#endif
|
||||
TERN_(BLTOUCH_FORCE_SW_MODE, _set_SW_mode());
|
||||
|
||||
// Now the probe is ready to issue a 10ms pulse when the pin goes up.
|
||||
// The trigger STOW (see motion.cpp for example) will pull up the probes pin as soon as the pulse
|
||||
|
|
|
@ -81,11 +81,8 @@ void ControllerFan::update() {
|
|||
;
|
||||
|
||||
// If any of the drivers or the heated bed are enabled...
|
||||
if (motor_on
|
||||
#if HAS_HEATED_BED
|
||||
|| thermalManager.temp_bed.soft_pwm_amount > 0
|
||||
#endif
|
||||
) lastMotorOn = ms; //... set time to NOW so the fan will turn on
|
||||
if (motor_on || TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0))
|
||||
lastMotorOn = ms; //... set time to NOW so the fan will turn on
|
||||
|
||||
// Fan Settings. Set fan > 0:
|
||||
// - If AutoMode is on and steppers have been enabled for CONTROLLERFAN_IDLE_TIME seconds.
|
||||
|
|
|
@ -62,11 +62,7 @@ class ControllerFan {
|
|||
#endif
|
||||
static inline bool state() { return speed > 0; }
|
||||
static inline void init() { reset(); }
|
||||
static inline void reset() {
|
||||
#if ENABLED(CONTROLLER_FAN_EDITABLE)
|
||||
settings = controllerFan_defaults;
|
||||
#endif
|
||||
}
|
||||
static inline void reset() { TERN_(CONTROLLER_FAN_EDITABLE, settings = controllerFan_defaults); }
|
||||
static void setup();
|
||||
static void update();
|
||||
};
|
||||
|
|
|
@ -459,9 +459,7 @@ void I2CPositionEncoder::reset() {
|
|||
Wire.write(I2CPE_RESET_COUNT);
|
||||
Wire.endTransmission();
|
||||
|
||||
#if ENABLED(I2CPE_ERR_ROLLING_AVERAGE)
|
||||
ZERO(err);
|
||||
#endif
|
||||
TERN_(I2CPE_ERR_ROLLING_AVERAGE, ZERO(err));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,9 +60,7 @@ float FWRetract::current_retract[EXTRUDERS], // Retract value used by p
|
|||
FWRetract::current_hop;
|
||||
|
||||
void FWRetract::reset() {
|
||||
#if ENABLED(FWRETRACT_AUTORETRACT)
|
||||
autoretract_enabled = false;
|
||||
#endif
|
||||
TERN_(FWRETRACT_AUTORETRACT, autoretract_enabled = false);
|
||||
settings.retract_length = RETRACT_LENGTH;
|
||||
settings.retract_feedrate_mm_s = RETRACT_FEEDRATE;
|
||||
settings.retract_zraise = RETRACT_ZRAISE;
|
||||
|
@ -128,7 +126,7 @@ void FWRetract::retract(const bool retracting
|
|||
SERIAL_ECHOLNPAIR("current_hop ", current_hop);
|
||||
//*/
|
||||
|
||||
const float base_retract = TERN(RETRACT_SYNC_MIXING, MIXING_STEPPERS, 1)
|
||||
const float base_retract = TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS))
|
||||
* (swapping ? settings.swap_retract_length : settings.retract_length);
|
||||
|
||||
// The current position will be the destination for E and Z moves
|
||||
|
@ -144,7 +142,7 @@ void FWRetract::retract(const bool retracting
|
|||
// Retract by moving from a faux E position back to the current E position
|
||||
current_retract[active_extruder] = base_retract;
|
||||
prepare_internal_move_to_destination( // set current to destination
|
||||
settings.retract_feedrate_mm_s * TERN(RETRACT_SYNC_MIXING, MIXING_STEPPERS, 1)
|
||||
settings.retract_feedrate_mm_s * TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS))
|
||||
);
|
||||
|
||||
// Is a Z hop set, and has the hop not yet been done?
|
||||
|
@ -170,9 +168,11 @@ void FWRetract::retract(const bool retracting
|
|||
|
||||
current_retract[active_extruder] = 0;
|
||||
|
||||
const feedRate_t fr_mm_s = TERN(RETRACT_SYNC_MIXING, MIXING_STEPPERS, 1)
|
||||
* (swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s);
|
||||
prepare_internal_move_to_destination(fr_mm_s); // Recover E, set_current_to_destination
|
||||
// Recover E, set_current_to_destination
|
||||
prepare_internal_move_to_destination(
|
||||
(swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s)
|
||||
* TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS))
|
||||
);
|
||||
}
|
||||
|
||||
TERN_(RETRACT_SYNC_MIXING, mixer.T(old_mixing_tool)); // Restore original mixing tool
|
||||
|
|
|
@ -108,11 +108,7 @@ void host_action(const char * const pstr, const bool eol) {
|
|||
}
|
||||
|
||||
void filament_load_host_prompt() {
|
||||
const bool disable_to_continue = (false
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
|| runout.filament_ran_out
|
||||
#endif
|
||||
);
|
||||
const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out);
|
||||
host_prompt_do(PROMPT_FILAMENT_RUNOUT, PSTR("Paused"), PSTR("PurgeMore"),
|
||||
disable_to_continue ? PSTR("DisableRunout") : CONTINUE_STR
|
||||
);
|
||||
|
@ -160,9 +156,7 @@ void host_action(const char * const pstr, const bool eol) {
|
|||
}
|
||||
break;
|
||||
case PROMPT_USER_CONTINUE:
|
||||
#if HAS_RESUME_CONTINUE
|
||||
wait_for_user = false;
|
||||
#endif
|
||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
|
||||
msg = PSTR("FILAMENT_RUNOUT_CONTINUE");
|
||||
break;
|
||||
case PROMPT_PAUSE_RESUME:
|
||||
|
|
|
@ -154,9 +154,7 @@ Joystick joystick;
|
|||
// Other non-joystick poll-based jogging could be implemented here
|
||||
// with "jogging" encapsulated as a more general class.
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::_joystick_update(norm_jog);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::_joystick_update(norm_jog));
|
||||
|
||||
// norm_jog values of [-1 .. 1] maps linearly to [-feedrate .. feedrate]
|
||||
xyz_float_t move_dist{0};
|
||||
|
|
|
@ -35,19 +35,11 @@
|
|||
class Joystick {
|
||||
friend class Temperature;
|
||||
private:
|
||||
#if HAS_JOY_ADC_X
|
||||
static temp_info_t x;
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
static temp_info_t y;
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
static temp_info_t z;
|
||||
#endif
|
||||
TERN_(HAS_JOY_ADC_X, static temp_info_t x);
|
||||
TERN_(HAS_JOY_ADC_Y, static temp_info_t y);
|
||||
TERN_(HAS_JOY_ADC_Z, static temp_info_t z);
|
||||
public:
|
||||
#if ENABLED(JOYSTICK_DEBUG)
|
||||
static void report();
|
||||
#endif
|
||||
TERN_(JOYSTICK_DEBUG, static void report());
|
||||
static void calculate(xyz_float_t &norm_jog);
|
||||
static void inject_jog_moves();
|
||||
};
|
||||
|
|
|
@ -68,15 +68,9 @@ void LEDLights::setup() {
|
|||
if (PWM_PIN(RGB_LED_W_PIN)) SET_PWM(RGB_LED_W_PIN); else SET_OUTPUT(RGB_LED_W_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
neo.init();
|
||||
#endif
|
||||
#if ENABLED(PCA9533)
|
||||
PCA9533_init();
|
||||
#endif
|
||||
#if ENABLED(LED_USER_PRESET_STARTUP)
|
||||
set_default();
|
||||
#endif
|
||||
TERN_(NEOPIXEL_LED, neo.init());
|
||||
TERN_(PCA9533, PCA9533_init());
|
||||
TERN_(LED_USER_PRESET_STARTUP, set_default());
|
||||
}
|
||||
|
||||
void LEDLights::set_color(const LEDColor &incol
|
||||
|
@ -140,9 +134,7 @@ void LEDLights::set_color(const LEDColor &incol
|
|||
pca9632_set_led_color(incol);
|
||||
#endif
|
||||
|
||||
#if ENABLED(PCA9533)
|
||||
PCA9533_setColor(incol.r, incol.g, incol.b);
|
||||
#endif
|
||||
TERN_(PCA9533, PCA9533_setColor(incol.r, incol.g, incol.b));
|
||||
|
||||
#if EITHER(LED_CONTROL_MENU, PRINTER_EVENT_LEDS)
|
||||
// Don't update the color when OFF
|
||||
|
|
|
@ -34,7 +34,9 @@
|
|||
#endif
|
||||
|
||||
// A white component can be passed
|
||||
#define HAS_WHITE_LED EITHER(RGBW_LED, NEOPIXEL_LED)
|
||||
#if EITHER(RGBW_LED, NEOPIXEL_LED)
|
||||
#define HAS_WHITE_LED 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LEDcolor type for use with leds.set_color
|
||||
|
@ -85,9 +87,7 @@ typedef struct LEDColor {
|
|||
|
||||
LEDColor& operator=(const uint8_t (&rgbw)[4]) {
|
||||
r = rgbw[0]; g = rgbw[1]; b = rgbw[2];
|
||||
#if HAS_WHITE_LED
|
||||
w = rgbw[3];
|
||||
#endif
|
||||
TERN_(HAS_WHITE_LED, w = rgbw[3]);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,15 @@
|
|||
// Defines
|
||||
// ------------------------
|
||||
|
||||
#define MULTIPLE_NEOPIXEL_TYPES (defined(NEOPIXEL2_TYPE) && (NEOPIXEL2_TYPE != NEOPIXEL_TYPE))
|
||||
#if defined(NEOPIXEL2_TYPE) && NEOPIXEL2_TYPE != NEOPIXEL_TYPE
|
||||
#define MULTIPLE_NEOPIXEL_TYPES 1
|
||||
#endif
|
||||
|
||||
#define NEOPIXEL_IS_RGB (NEOPIXEL_TYPE == NEO_RGB || NEOPIXEL_TYPE == NEO_RBG || NEOPIXEL_TYPE == NEO_GRB || NEOPIXEL_TYPE == NEO_GBR || NEOPIXEL_TYPE == NEO_BRG || NEOPIXEL_TYPE == NEO_BGR)
|
||||
#define NEOPIXEL_IS_RGBW !NEOPIXEL_IS_RGB
|
||||
#if NEOPIXEL_TYPE == NEO_RGB || NEOPIXEL_TYPE == NEO_RBG || NEOPIXEL_TYPE == NEO_GRB || NEOPIXEL_TYPE == NEO_GBR || NEOPIXEL_TYPE == NEO_BRG || NEOPIXEL_TYPE == NEO_BGR
|
||||
#define NEOPIXEL_IS_RGB 1
|
||||
#else
|
||||
#define NEOPIXEL_IS_RGBW 1
|
||||
#endif
|
||||
|
||||
#if NEOPIXEL_IS_RGB
|
||||
#define NEO_WHITE 255, 255, 255, 0
|
||||
|
@ -73,23 +78,17 @@ public:
|
|||
|
||||
static inline void begin() {
|
||||
adaneo1.begin();
|
||||
#if MULTIPLE_NEOPIXEL_TYPES
|
||||
adaneo2.begin();
|
||||
#endif
|
||||
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.begin());
|
||||
}
|
||||
|
||||
static inline void set_pixel_color(const uint16_t n, const uint32_t c) {
|
||||
adaneo1.setPixelColor(n, c);
|
||||
#if MULTIPLE_NEOPIXEL_TYPES
|
||||
adaneo2.setPixelColor(n, c);
|
||||
#endif
|
||||
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.setPixelColor(n, c));
|
||||
}
|
||||
|
||||
static inline void set_brightness(const uint8_t b) {
|
||||
adaneo1.setBrightness(b);
|
||||
#if MULTIPLE_NEOPIXEL_TYPES
|
||||
adaneo2.setBrightness(b);
|
||||
#endif
|
||||
TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.setBrightness(b));
|
||||
}
|
||||
|
||||
static inline void show() {
|
||||
|
|
|
@ -47,10 +47,10 @@ PrinterEventLEDs printerEventLEDs;
|
|||
inline void pel_set_rgb(const uint8_t r, const uint8_t g, const uint8_t b) {
|
||||
leds.set_color(
|
||||
MakeLEDColor(r, g, b, 0, neo.brightness())
|
||||
#if ENABLED(NEOPIXEL_IS_SEQUENTIAL)
|
||||
, true
|
||||
#endif
|
||||
);
|
||||
#if ENABLED(NEOPIXEL_IS_SEQUENTIAL)
|
||||
, true
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,10 +36,7 @@ void handle_status_leds() {
|
|||
static millis_t next_status_led_update_ms = 0;
|
||||
if (ELAPSED(millis(), next_status_led_update_ms)) {
|
||||
next_status_led_update_ms += 500; // Update every 0.5s
|
||||
float max_temp = 0.0;
|
||||
#if HAS_HEATED_BED
|
||||
max_temp = _MAX(thermalManager.degTargetBed(), thermalManager.degBed());
|
||||
#endif
|
||||
float max_temp = TERN0(HAS_HEATED_BED, _MAX(thermalManager.degTargetBed(), thermalManager.degBed()));
|
||||
HOTEND_LOOP()
|
||||
max_temp = _MAX(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
|
||||
const int8_t new_red = (max_temp > 55.0) ? HIGH : (max_temp < 54.0 || old_red < 0) ? LOW : old_red;
|
||||
|
|
|
@ -44,7 +44,7 @@ int_fast8_t Mixer::runner = 0;
|
|||
mixer_comp_t Mixer::s_color[MIXING_STEPPERS];
|
||||
mixer_accu_t Mixer::accu[MIXING_STEPPERS] = { 0 };
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER || ENABLED(GRADIENT_MIX)
|
||||
#if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX)
|
||||
mixer_perc_t Mixer::mix[MIXING_STEPPERS];
|
||||
#endif
|
||||
|
||||
|
@ -90,9 +90,7 @@ void Mixer::normalize(const uint8_t tool_index) {
|
|||
SERIAL_ECHOLNPGM("]");
|
||||
#endif
|
||||
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
refresh_gradient();
|
||||
#endif
|
||||
TERN_(GRADIENT_MIX, refresh_gradient());
|
||||
}
|
||||
|
||||
void Mixer::reset_vtools() {
|
||||
|
@ -123,13 +121,11 @@ void Mixer::init() {
|
|||
|
||||
ZERO(collector);
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER || ENABLED(GRADIENT_MIX)
|
||||
#if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX)
|
||||
update_mix_from_vtool();
|
||||
#endif
|
||||
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
update_gradient_for_planner_z();
|
||||
#endif
|
||||
TERN_(GRADIENT_MIX, update_gradient_for_planner_z());
|
||||
}
|
||||
|
||||
void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=selected_vtool*/, float (&c)[MIXING_STEPPERS]/*=collector*/) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
//#define MIXER_NORMALIZER_DEBUG
|
||||
|
||||
#ifndef __AVR__ // || DUAL_MIXING_EXTRUDER
|
||||
#ifndef __AVR__ // || HAS_DUAL_MIXING
|
||||
// Use 16-bit (or fastest) data for the integer mix factors
|
||||
typedef uint_fast16_t mixer_comp_t;
|
||||
typedef uint_fast16_t mixer_accu_t;
|
||||
|
@ -48,14 +48,14 @@ typedef int8_t mixer_perc_t;
|
|||
#endif
|
||||
|
||||
enum MixTool {
|
||||
FIRST_USER_VIRTUAL_TOOL = 0,
|
||||
LAST_USER_VIRTUAL_TOOL = MIXING_VIRTUAL_TOOLS - 1,
|
||||
NR_USER_VIRTUAL_TOOLS,
|
||||
MIXER_DIRECT_SET_TOOL = NR_USER_VIRTUAL_TOOLS,
|
||||
FIRST_USER_VIRTUAL_TOOL = 0
|
||||
, LAST_USER_VIRTUAL_TOOL = MIXING_VIRTUAL_TOOLS - 1
|
||||
, NR_USER_VIRTUAL_TOOLS
|
||||
, MIXER_DIRECT_SET_TOOL = NR_USER_VIRTUAL_TOOLS
|
||||
#if HAS_MIXER_SYNC_CHANNEL
|
||||
MIXER_AUTORETRACT_TOOL,
|
||||
, MIXER_AUTORETRACT_TOOL
|
||||
#endif
|
||||
NR_MIXING_VIRTUAL_TOOLS
|
||||
, NR_MIXING_VIRTUAL_TOOLS
|
||||
};
|
||||
|
||||
#define MAX_VTOOLS TERN(HAS_MIXER_SYNC_CHANNEL, 254, 255)
|
||||
|
@ -75,9 +75,7 @@ static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must
|
|||
int8_t start_vtool, end_vtool; // Start and end virtual tools
|
||||
mixer_perc_t start_mix[MIXING_STEPPERS], // Start and end mixes from those tools
|
||||
end_mix[MIXING_STEPPERS];
|
||||
#if ENABLED(GRADIENT_VTOOL)
|
||||
int8_t vtool_index; // Use this virtual tool number as index
|
||||
#endif
|
||||
TERN_(GRADIENT_VTOOL, int8_t vtool_index); // Use this virtual tool number as index
|
||||
} gradient_t;
|
||||
|
||||
#endif
|
||||
|
@ -106,12 +104,8 @@ class Mixer {
|
|||
|
||||
FORCE_INLINE static void T(const uint_fast8_t c) {
|
||||
selected_vtool = c;
|
||||
#if ENABLED(GRADIENT_VTOOL)
|
||||
refresh_gradient();
|
||||
#endif
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
update_mix_from_vtool();
|
||||
#endif
|
||||
TERN_(GRADIENT_VTOOL, refresh_gradient());
|
||||
TERN_(HAS_DUAL_MIXING, update_mix_from_vtool());
|
||||
}
|
||||
|
||||
// Used when dealing with blocks
|
||||
|
@ -129,7 +123,7 @@ class Mixer {
|
|||
MIXER_STEPPER_LOOP(i) s_color[i] = b_color[i];
|
||||
}
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER || ENABLED(GRADIENT_MIX)
|
||||
#if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX)
|
||||
|
||||
static mixer_perc_t mix[MIXING_STEPPERS]; // Scratch array for the Mix in proportion to 100
|
||||
|
||||
|
@ -167,21 +161,19 @@ class Mixer {
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // DUAL_MIXING_EXTRUDER || GRADIENT_MIX
|
||||
#endif // HAS_DUAL_MIXING || GRADIENT_MIX
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
#if HAS_DUAL_MIXING
|
||||
|
||||
// Update the virtual tool from an edited mix
|
||||
static inline void update_vtool_from_mix() {
|
||||
copy_mix_to_color(color[selected_vtool]);
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
refresh_gradient();
|
||||
#endif
|
||||
TERN_(GRADIENT_MIX, refresh_gradient());
|
||||
// MIXER_STEPPER_LOOP(i) collector[i] = mix[i];
|
||||
// normalize();
|
||||
}
|
||||
|
||||
#endif // DUAL_MIXING_EXTRUDER
|
||||
#endif // HAS_DUAL_MIXING
|
||||
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
|
||||
|
|
|
@ -707,12 +707,8 @@ void MMU2::filament_runout() {
|
|||
if (recover) {
|
||||
LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER);
|
||||
BUZZ(200, 404);
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover")));
|
||||
wait_for_user_response();
|
||||
BUZZ(200, 404);
|
||||
BUZZ(200, 404);
|
||||
|
|
|
@ -86,9 +86,7 @@ fil_change_settings_t fc_settings[EXTRUDERS];
|
|||
#if HAS_BUZZER
|
||||
static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (pause_mode == PAUSE_MODE_PAUSE_PRINT) return;
|
||||
#endif
|
||||
if (TERN0(HAS_LCD_MENU, pause_mode == PAUSE_MODE_PAUSE_PRINT)) return;
|
||||
|
||||
static millis_t next_buzz = 0;
|
||||
static int8_t runout_beep = 0;
|
||||
|
@ -184,13 +182,9 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
|||
host_action_prompt_button(CONTINUE_STR);
|
||||
host_action_prompt_show();
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"));
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
|
||||
while (wait_for_user) {
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, filament_change_beep(max_beep_count));
|
||||
idle_no_sleep();
|
||||
}
|
||||
}
|
||||
|
@ -235,12 +229,8 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
|||
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
|
||||
#endif
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging..."));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")));
|
||||
wait_for_user = true; // A click or M108 breaks the purge_length loop
|
||||
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
|
||||
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
|
@ -259,9 +249,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
|||
unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
}
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
filament_load_host_prompt(); // Initiate another host prompt. (NOTE: host_response_handler may also do this!)
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt. (NOTE: host_response_handler may also do this!)
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (show_lcd) {
|
||||
|
@ -274,11 +262,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
|||
#endif
|
||||
|
||||
// Keep looping if "Purge More" was selected
|
||||
} while (false
|
||||
#if HAS_LCD_MENU
|
||||
|| (show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE)
|
||||
#endif
|
||||
);
|
||||
} while (TERN0(HAS_LCD_MENU, show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -384,9 +368,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_INFO, PSTR("Pause"), DISMISS_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Pause"), DISMISS_STR));
|
||||
|
||||
if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
|
||||
SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
|
||||
|
@ -465,9 +447,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
|
|||
*/
|
||||
|
||||
void show_continue_prompt(const bool is_reload) {
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING));
|
||||
SERIAL_ECHO_START();
|
||||
serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
|
||||
}
|
||||
|
@ -497,17 +477,11 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
|||
|
||||
// Wait for filament insert by user and press button
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_NOZZLE_PARKED), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_NOZZLE_PARKED), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED)));
|
||||
wait_for_user = true; // LCD click or M108 will clear this
|
||||
while (wait_for_user) {
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, filament_change_beep(max_beep_count));
|
||||
|
||||
// If the nozzle has timed out...
|
||||
if (!nozzle_timed_out)
|
||||
|
@ -516,27 +490,18 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
|||
// Wait for the user to press the button to re-heat the nozzle, then
|
||||
// re-heat the nozzle, re-show the continue prompt, restart idle timers, start over
|
||||
if (nozzle_timed_out) {
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_HEAT);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_HEAT));
|
||||
SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT));
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_HEATER_TIMEOUT), GET_TEXT(MSG_REHEAT));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_HEATER_TIMEOUT), GET_TEXT(MSG_REHEAT)));
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_HEATER_TIMEOUT));
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_HEATER_TIMEOUT)));
|
||||
|
||||
wait_for_user_response(0, true); // Wait for LCD click or M108
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_INFO, GET_TEXT(MSG_REHEATING));
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, GET_TEXT(MSG_REHEATING)));
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING)));
|
||||
|
||||
// Re-enable the heaters if they timed out
|
||||
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);
|
||||
|
@ -551,18 +516,12 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
|||
const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
|
||||
|
||||
HOTEND_LOOP() thermalManager.hotend_idle[e].start(nozzle_timeout);
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Reheat finished."));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Reheat finished.")));
|
||||
wait_for_user = true;
|
||||
nozzle_timed_out = false;
|
||||
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count, true);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, filament_change_beep(max_beep_count, true));
|
||||
}
|
||||
idle_no_sleep();
|
||||
}
|
||||
|
@ -613,9 +572,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
|||
if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament
|
||||
load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, PAUSE_MODE_SAME DXC_PASS);
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_RESUME);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_RESUME));
|
||||
|
||||
// Intelligent resuming
|
||||
#if ENABLED(FWRETRACT)
|
||||
|
@ -641,9 +598,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
|||
// Set extruder to saved position
|
||||
planner.set_e_position_mm((destination.e = current_position.e = resume_position.e));
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
|
||||
|
||||
#ifdef ACTION_ON_RESUMED
|
||||
host_action_resumed();
|
||||
|
@ -653,9 +608,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
|||
|
||||
--did_pause_print;
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_INFO, PSTR("Resuming"), DISMISS_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Resuming"), DISMISS_STR));
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
if (did_pause_print) {
|
||||
|
@ -668,19 +621,13 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
|||
thermalManager.set_fans_paused(false);
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
runout.reset();
|
||||
#endif
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
|
||||
|
||||
// Resume the print job timer if it was running
|
||||
if (print_job_timer.isPaused()) print_job_timer.start();
|
||||
|
||||
#if HAS_DISPLAY
|
||||
ui.reset_status();
|
||||
#if HAS_LCD_MENU
|
||||
ui.return_to_status();
|
||||
#endif
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.reset_status());
|
||||
TERN_(HAS_LCD_MENU, ui.return_to_status());
|
||||
}
|
||||
|
||||
#endif // ADVANCED_PAUSE_FEATURE
|
||||
|
|
|
@ -50,15 +50,12 @@ bool Power::is_power_needed() {
|
|||
if (controllerFan.state()) return true;
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_POWER_CHAMBER_FAN)
|
||||
if (thermalManager.chamberfan_speed) return true;
|
||||
#endif
|
||||
if (TERN0(AUTO_POWER_CHAMBER_FAN, thermalManager.chamberfan_speed))
|
||||
return true;
|
||||
|
||||
// If any of the drivers or the bed are enabled...
|
||||
if (X_ENABLE_READ() == X_ENABLE_ON || Y_ENABLE_READ() == Y_ENABLE_ON || Z_ENABLE_READ() == Z_ENABLE_ON
|
||||
#if HAS_HEATED_BED
|
||||
|| thermalManager.temp_bed.soft_pwm_amount > 0
|
||||
#endif
|
||||
|| TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0)
|
||||
#if HAS_X2_ENABLE
|
||||
|| X2_ENABLE_READ() == X_ENABLE_ON
|
||||
#endif
|
||||
|
@ -75,10 +72,7 @@ bool Power::is_power_needed() {
|
|||
) return true;
|
||||
|
||||
HOTEND_LOOP() if (thermalManager.degTargetHotend(e) > 0) return true;
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
if (thermalManager.degTargetBed() > 0) return true;
|
||||
#endif
|
||||
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0)) return true;
|
||||
|
||||
#if HOTENDS && AUTO_POWER_E_TEMP
|
||||
HOTEND_LOOP() if (thermalManager.degHotend(e) >= AUTO_POWER_E_TEMP) return true;
|
||||
|
|
|
@ -172,12 +172,8 @@ void PrintJobRecovery::save(const bool force/*=false*/) {
|
|||
|
||||
// Machine state
|
||||
info.current_position = current_position;
|
||||
#if HAS_HOME_OFFSET
|
||||
info.home_offset = home_offset;
|
||||
#endif
|
||||
#if HAS_POSITION_SHIFT
|
||||
info.position_shift = position_shift;
|
||||
#endif
|
||||
TERN_(HAS_HOME_OFFSET, info.home_offset = home_offset);
|
||||
TERN_(HAS_POSITION_SHIFT, info.position_shift = position_shift);
|
||||
info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
|
||||
|
||||
#if EXTRUDERS > 1
|
||||
|
@ -197,9 +193,7 @@ void PrintJobRecovery::save(const bool force/*=false*/) {
|
|||
HOTEND_LOOP() info.target_temperature[e] = thermalManager.temp_hotend[e].target;
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
info.target_temperature_bed = thermalManager.temp_bed.target;
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, info.target_temperature_bed = thermalManager.temp_bed.target);
|
||||
|
||||
#if FAN_COUNT
|
||||
COPY(info.fan_speed, thermalManager.fan_speed);
|
||||
|
@ -207,18 +201,10 @@ void PrintJobRecovery::save(const bool force/*=false*/) {
|
|||
|
||||
#if HAS_LEVELING
|
||||
info.leveling = planner.leveling_active;
|
||||
info.fade = (
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
planner.z_fade_height
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
);
|
||||
info.fade = TERN0(ENABLE_LEVELING_FADE_HEIGHT, planner.z_fade_height);
|
||||
#endif
|
||||
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
memcpy(&info.gradient, &mixer.gradient, sizeof(info.gradient));
|
||||
#endif
|
||||
TERN_(GRADIENT_MIX, memcpy(&info.gradient, &mixer.gradient, sizeof(info.gradient)));
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
COPY(info.retract, fwretract.current_retract);
|
||||
|
@ -244,9 +230,7 @@ void PrintJobRecovery::save(const bool force/*=false*/) {
|
|||
lock = true;
|
||||
#endif
|
||||
if (IS_SD_PRINTING()) save(true);
|
||||
#if ENABLED(BACKUP_POWER_SUPPLY)
|
||||
raise_z();
|
||||
#endif
|
||||
TERN_(BACKUP_POWER_SUPPLY, raise_z());
|
||||
|
||||
kill(GET_TEXT(MSG_OUTAGE_RECOVERY));
|
||||
}
|
||||
|
@ -299,9 +283,7 @@ void PrintJobRecovery::resume() {
|
|||
// If Z homing goes to max, just reset E and home all
|
||||
"\n"
|
||||
"G28R0"
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
"S"
|
||||
#endif
|
||||
TERN_(MARLIN_DEV_MODE, "S")
|
||||
|
||||
#else // "G92.9 E0 ..."
|
||||
|
||||
|
@ -460,12 +442,8 @@ void PrintJobRecovery::resume() {
|
|||
// Relative axis modes
|
||||
gcode.axis_relative = info.axis_relative;
|
||||
|
||||
#if HAS_HOME_OFFSET
|
||||
home_offset = info.home_offset;
|
||||
#endif
|
||||
#if HAS_POSITION_SHIFT
|
||||
position_shift = info.position_shift;
|
||||
#endif
|
||||
TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
|
||||
TERN_(HAS_POSITION_SHIFT, position_shift = info.position_shift);
|
||||
#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
|
||||
LOOP_XYZ(i) update_workspace_offset((AxisEnum)i);
|
||||
#endif
|
||||
|
|
|
@ -82,9 +82,7 @@ class ProbeTempComp {
|
|||
static inline void clear_all_offsets() {
|
||||
clear_offsets(TSI_BED);
|
||||
clear_offsets(TSI_PROBE);
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
clear_offsets(TSI_EXT);
|
||||
#endif
|
||||
TERN_(USE_TEMP_EXT_COMPENSATION, clear_offsets(TSI_EXT));
|
||||
}
|
||||
static bool set_offset(const TempSensorID tsi, const uint8_t idx, const int16_t offset);
|
||||
static void print_offsets();
|
||||
|
|
|
@ -74,13 +74,9 @@ void FilamentSensorBase::filament_present(const uint8_t extruder) {
|
|||
|
||||
void event_filament_runout() {
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
if (did_pause_print) return; // Action already in progress. Purge triggered repeated runout.
|
||||
#endif
|
||||
if (TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print)) return; // Action already in progress. Purge triggered repeated runout.
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onFilamentRunout(ExtUI::getActiveTool());
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getActiveTool()));
|
||||
|
||||
#if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS)
|
||||
const char tool = '0'
|
||||
|
|
|
@ -54,9 +54,7 @@ void SpindleLaser::init() {
|
|||
#endif
|
||||
#if ENABLED(HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY)
|
||||
set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY);
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
frequency = SPINDLE_LASER_FREQUENCY;
|
||||
#endif
|
||||
TERN_(MARLIN_DEV_MODE, frequency = SPINDLE_LASER_FREQUENCY);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -99,9 +97,7 @@ void SpindleLaser::apply_power(const cutter_power_t inpow) {
|
|||
//
|
||||
void SpindleLaser::set_direction(const bool reverse) {
|
||||
const bool dir_state = (reverse == SPINDLE_INVERT_DIR); // Forward (M3) HIGH when not inverted
|
||||
#if ENABLED(SPINDLE_STOP_ON_DIR_CHANGE)
|
||||
if (enabled() && READ(SPINDLE_DIR_PIN) != dir_state) disable();
|
||||
#endif
|
||||
if (TERN0(SPINDLE_STOP_ON_DIR_CHANGE, enabled()) && READ(SPINDLE_DIR_PIN) != dir_state) disable();
|
||||
WRITE(SPINDLE_DIR_PIN, dir_state);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,9 +162,7 @@ public:
|
|||
#endif
|
||||
|
||||
static inline void kill() {
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
inline_disable();
|
||||
#endif
|
||||
TERN_(LASER_POWER_INLINE, inline_disable());
|
||||
disable();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -63,9 +63,9 @@
|
|||
, is_stall:1
|
||||
, is_stealth:1
|
||||
, is_standstill:1
|
||||
#if HAS_STALLGUARD
|
||||
, sg_result_reasonable:1
|
||||
#endif
|
||||
#if HAS_STALLGUARD
|
||||
, sg_result_reasonable:1
|
||||
#endif
|
||||
#endif
|
||||
;
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
|
@ -169,9 +169,7 @@
|
|||
data.is_stealth = TEST(ds, STEALTH_bp);
|
||||
data.is_standstill = TEST(ds, STST_bp);
|
||||
#endif
|
||||
#if HAS_STALLGUARD
|
||||
data.sg_result_reasonable = false;
|
||||
#endif
|
||||
TERN_(HAS_STALLGUARD, data.sg_result_reasonable = false);
|
||||
#endif
|
||||
return data;
|
||||
}
|
||||
|
@ -213,9 +211,7 @@
|
|||
SERIAL_PRINTLN(data.drv_status, HEX);
|
||||
if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature");
|
||||
if (data.is_s2g) SERIAL_ECHOLNPGM("coil short circuit");
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
tmc_report_all(true, true, true, true);
|
||||
#endif
|
||||
TERN_(TMC_DEBUG, tmc_report_all(true, true, true, true));
|
||||
kill(PSTR("Driver error"));
|
||||
}
|
||||
#endif
|
||||
|
@ -446,9 +442,7 @@
|
|||
(void)monitor_tmc_driver(stepperE7, need_update_error_counters, need_debug_reporting);
|
||||
#endif
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
if (need_debug_reporting) SERIAL_EOL();
|
||||
#endif
|
||||
if (TERN0(TMC_DEBUG, need_debug_reporting)) SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,15 +69,9 @@ class TMCStorage {
|
|||
}
|
||||
|
||||
struct {
|
||||
#if HAS_STEALTHCHOP
|
||||
bool stealthChop_enabled = false;
|
||||
#endif
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
uint8_t hybrid_thrs = 0;
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
int16_t homing_thrs = 0;
|
||||
#endif
|
||||
TERN_(HAS_STEALTHCHOP, bool stealthChop_enabled = false);
|
||||
TERN_(HYBRID_THRESHOLD, uint8_t hybrid_thrs = 0);
|
||||
TERN_(USE_SENSORLESS, int16_t homing_thrs = 0);
|
||||
} stored;
|
||||
};
|
||||
|
||||
|
@ -118,9 +112,7 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
|||
}
|
||||
void set_pwm_thrs(const uint32_t thrs) {
|
||||
TMC::TPWMTHRS(_tmc_thrs(this->microsteps(), thrs, planner.settings.axis_steps_per_mm[AXIS_ID]));
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.hybrid_thrs = thrs;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, this->stored.hybrid_thrs = thrs);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -129,9 +121,7 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
|||
void homing_threshold(int16_t sgt_val) {
|
||||
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
|
||||
TMC::sgt(sgt_val);
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.homing_thrs = sgt_val;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, this->stored.homing_thrs = sgt_val);
|
||||
}
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
bool test_stall_status();
|
||||
|
@ -184,9 +174,7 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
|
|||
}
|
||||
void set_pwm_thrs(const uint32_t thrs) {
|
||||
TMC2208Stepper::TPWMTHRS(_tmc_thrs(this->microsteps(), thrs, planner.settings.axis_steps_per_mm[AXIS_ID]));
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.hybrid_thrs = thrs;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, this->stored.hybrid_thrs = thrs);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -231,9 +219,7 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
|
|||
}
|
||||
void set_pwm_thrs(const uint32_t thrs) {
|
||||
TMC2209Stepper::TPWMTHRS(_tmc_thrs(this->microsteps(), thrs, planner.settings.axis_steps_per_mm[AXIS_ID]));
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.hybrid_thrs = thrs;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, this->stored.hybrid_thrs = thrs);
|
||||
}
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
|
@ -241,9 +227,7 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
|
|||
void homing_threshold(int16_t sgt_val) {
|
||||
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
|
||||
TMC2209Stepper::SGTHRS(sgt_val);
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.homing_thrs = sgt_val;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, this->stored.homing_thrs = sgt_val);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -283,9 +267,7 @@ class TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC266
|
|||
void homing_threshold(int16_t sgt_val) {
|
||||
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
|
||||
TMC2660Stepper::sgt(sgt_val);
|
||||
#if HAS_LCD_MENU
|
||||
this->stored.homing_thrs = sgt_val;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, this->stored.homing_thrs = sgt_val);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -367,9 +349,7 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
|
|||
|
||||
struct slow_homing_t {
|
||||
xy_ulong_t acceleration;
|
||||
#if HAS_CLASSIC_JERK
|
||||
xy_float_t jerk_xy;
|
||||
#endif
|
||||
TERN_(HAS_CLASSIC_JERK, xy_float_t jerk_xy);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -165,9 +165,7 @@ int8_t g26_prime_flag;
|
|||
bool user_canceled() {
|
||||
if (!ui.button_pressed()) return false; // Return if the button isn't pressed
|
||||
ui.set_status_P(GET_TEXT(MSG_G26_CANCELED), 99);
|
||||
#if HAS_LCD_MENU
|
||||
ui.quick_feedback();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.quick_feedback());
|
||||
ui.wait_for_release();
|
||||
return true;
|
||||
}
|
||||
|
@ -301,9 +299,7 @@ inline bool look_for_lines_to_connect() {
|
|||
|
||||
GRID_LOOP(i, j) {
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (user_canceled()) return true;
|
||||
#endif
|
||||
if (TERN0(HAS_LCD_MENU, user_canceled())) return true;
|
||||
|
||||
if (i < (GRID_MAX_POINTS_X)) { // Can't connect to anything farther to the right than GRID_MAX_POINTS_X.
|
||||
// Already a half circle at the edge of the bed.
|
||||
|
@ -364,9 +360,7 @@ inline bool turn_on_heaters() {
|
|||
#if HAS_SPI_LCD
|
||||
ui.set_status_P(GET_TEXT(MSG_G26_HEATING_BED), 99);
|
||||
ui.quick_feedback();
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.capture());
|
||||
#endif
|
||||
thermalManager.setTargetBed(g26_bed_temp);
|
||||
|
||||
|
@ -390,11 +384,10 @@ inline bool turn_on_heaters() {
|
|||
|
||||
// Wait for the temperature to stabilize
|
||||
if (!thermalManager.wait_for_hotend(active_extruder, true
|
||||
#if G26_CLICK_CAN_CANCEL
|
||||
, true
|
||||
#endif
|
||||
)
|
||||
) return G26_ERR;
|
||||
#if G26_CLICK_CAN_CANCEL
|
||||
, true
|
||||
#endif
|
||||
)) return G26_ERR;
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
ui.reset_status();
|
||||
|
@ -665,9 +658,7 @@ void GcodeSuite::G26() {
|
|||
move_to(destination, 0.0);
|
||||
move_to(destination, g26_ooze_amount);
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.capture());
|
||||
|
||||
#if DISABLED(ARC_SUPPORT)
|
||||
|
||||
|
@ -762,9 +753,7 @@ void GcodeSuite::G26() {
|
|||
feedrate_mm_s = old_feedrate;
|
||||
destination = current_position;
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
||||
#endif
|
||||
if (TERN0(HAS_LCD_MENU, user_canceled())) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
||||
|
||||
#else // !ARC_SUPPORT
|
||||
|
||||
|
@ -788,9 +777,7 @@ void GcodeSuite::G26() {
|
|||
|
||||
for (int8_t ind = start_ind; ind <= end_ind; ind++) {
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
||||
#endif
|
||||
if (TERN0(HAS_LCD_MENU, user_canceled())) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
||||
|
||||
xyz_float_t p = { circle.x + _COS(ind ), circle.y + _SIN(ind ), g26_layer_height },
|
||||
q = { circle.x + _COS(ind + 1), circle.y + _SIN(ind + 1), g26_layer_height };
|
||||
|
@ -833,14 +820,10 @@ void GcodeSuite::G26() {
|
|||
planner.calculate_volumetric_multipliers();
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ui.release(); // Give back control of the LCD
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.release()); // Give back control of the LCD
|
||||
|
||||
if (!g26_keep_heaters_on) {
|
||||
#if HAS_HEATED_BED
|
||||
thermalManager.setTargetBed(0);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(0));
|
||||
thermalManager.setTargetHotend(active_extruder, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,9 +73,7 @@ void GcodeSuite::M420() {
|
|||
#endif
|
||||
GRID_LOOP(x, y) {
|
||||
Z_VALUES(x, y) = 0.001 * random(-200, 200);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y));
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)));
|
||||
}
|
||||
SERIAL_ECHOPGM("Simulated " STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh ");
|
||||
SERIAL_ECHOPAIR(" (", x_min);
|
||||
|
@ -178,13 +176,9 @@ void GcodeSuite::M420() {
|
|||
// Subtract the mean from all values
|
||||
GRID_LOOP(x, y) {
|
||||
Z_VALUES(x, y) -= zmean;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y));
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)));
|
||||
}
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
bed_level_virt_interpolate();
|
||||
#endif
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -206,9 +200,7 @@ void GcodeSuite::M420() {
|
|||
if (leveling_is_valid()) {
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
print_bilinear_leveling_grid();
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
print_bilinear_leveling_grid_virt();
|
||||
#endif
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, print_bilinear_leveling_grid_virt());
|
||||
#elif ENABLED(MESH_BED_LEVELING)
|
||||
SERIAL_ECHOLNPGM("Mesh Bed Level data:");
|
||||
mbl.report_mesh();
|
||||
|
|
|
@ -283,9 +283,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
*/
|
||||
if (!g29_in_progress) {
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
if (active_extruder != 0) tool_change(0);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, if (active_extruder) tool_change(0));
|
||||
|
||||
#if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR)
|
||||
abl_probe_index = -1;
|
||||
|
@ -322,12 +320,8 @@ G29_TYPE GcodeSuite::G29() {
|
|||
if (WITHIN(i, 0, GRID_MAX_POINTS_X - 1) && WITHIN(j, 0, GRID_MAX_POINTS_Y)) {
|
||||
set_bed_leveling_enabled(false);
|
||||
z_values[i][j] = rz;
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
bed_level_virt_interpolate();
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(i, j, rz);
|
||||
#endif
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(i, j, rz));
|
||||
set_bed_leveling_enabled(abl_should_enable);
|
||||
if (abl_should_enable) report_current_position();
|
||||
}
|
||||
|
@ -492,14 +486,10 @@ G29_TYPE GcodeSuite::G29() {
|
|||
// Abort current G29 procedure, go back to idle state
|
||||
if (seenA && g29_in_progress) {
|
||||
SERIAL_ECHOLNPGM("Manual G29 aborted");
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
soft_endstops_enabled = saved_soft_endstops_state;
|
||||
#endif
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
|
||||
set_bed_leveling_enabled(abl_should_enable);
|
||||
g29_in_progress = false;
|
||||
#if ENABLED(LCD_BED_LEVELING)
|
||||
ui.wait_for_move = false;
|
||||
#endif
|
||||
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
|
||||
}
|
||||
|
||||
// Query G29 status
|
||||
|
@ -517,9 +507,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
if (abl_probe_index == 0) {
|
||||
// For the initial G29 S2 save software endstop state
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
saved_soft_endstops_state = soft_endstops_enabled;
|
||||
#endif
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, saved_soft_endstops_state = soft_endstops_enabled);
|
||||
// Move close to the bed before the first point
|
||||
do_blocking_move_to_z(0);
|
||||
}
|
||||
|
@ -551,9 +539,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
const float newz = measured_z + zoffset;
|
||||
z_values[meshCount.x][meshCount.y] = newz;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(meshCount, newz);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(meshCount, newz));
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR_P(PSTR("Save X"), meshCount.x, SP_Y_STR, meshCount.y, SP_Z_STR, measured_z + zoffset);
|
||||
|
||||
|
@ -580,9 +566,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
probePos = probe_position_lf + gridSpacing * meshCount.asFloat();
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
indexIntoAB[meshCount.x][meshCount.y] = abl_probe_index;
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_LINEAR, indexIntoAB[meshCount.x][meshCount.y] = abl_probe_index);
|
||||
|
||||
// Keep looping till a reachable point is found
|
||||
if (position_is_reachable(probePos)) break;
|
||||
|
@ -606,9 +590,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
SERIAL_ECHOLNPGM("Grid probing done.");
|
||||
|
||||
// Re-enable software endstops, if needed
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
soft_endstops_enabled = saved_soft_endstops_state;
|
||||
#endif
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
|
||||
}
|
||||
|
||||
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
|
||||
|
@ -629,9 +611,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
SERIAL_ECHOLNPGM("3-point probing done.");
|
||||
|
||||
// Re-enable software endstops, if needed
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
soft_endstops_enabled = saved_soft_endstops_state;
|
||||
#endif
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
|
||||
|
||||
if (!dryrun) {
|
||||
vector_3 planeNormal = vector_3::cross(points[0] - points[1], points[2] - points[1]).get_normal();
|
||||
|
@ -688,9 +668,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
probePos = probe_position_lf + gridSpacing * meshCount.asFloat();
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
indexIntoAB[meshCount.x][meshCount.y] = ++abl_probe_index; // 0...
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_LINEAR, indexIntoAB[meshCount.x][meshCount.y] = ++abl_probe_index); // 0...
|
||||
|
||||
#if IS_KINEMATIC
|
||||
// Avoid probing outside the round or hexagonal area
|
||||
|
@ -698,9 +676,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
#endif
|
||||
|
||||
if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", int(GRID_MAX_POINTS), ".");
|
||||
#if HAS_DISPLAY
|
||||
ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(GRID_MAX_POINTS));
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(GRID_MAX_POINTS)));
|
||||
|
||||
measured_z = faux ? 0.001f * random(-100, 101) : probe.probe_at_point(probePos, raise_after, verbose_level);
|
||||
|
||||
|
@ -712,9 +688,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), measured_z);
|
||||
temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), measured_z);
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(), measured_z);
|
||||
#endif
|
||||
TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(), measured_z));
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
|
@ -730,9 +704,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
|
||||
z_values[meshCount.x][meshCount.y] = measured_z + zoffset;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(meshCount, z_values[meshCount.x][meshCount.y]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(meshCount, z_values[meshCount.x][meshCount.y]));
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -748,9 +720,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
LOOP_L_N(i, 3) {
|
||||
if (verbose_level) SERIAL_ECHOLNPAIR("Probing point ", int(i), "/3.");
|
||||
#if HAS_DISPLAY
|
||||
ui.status_printf_P(0, PSTR(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_MESH), int(i));
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_MESH), int(i)));
|
||||
|
||||
// Retain the last probe position
|
||||
probePos = points[i];
|
||||
|
@ -773,9 +743,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
#endif // AUTO_BED_LEVELING_3POINT
|
||||
|
||||
#if HAS_DISPLAY
|
||||
ui.reset_status();
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.reset_status());
|
||||
|
||||
// Stow the probe. No raise for FIX_MOUNTED_PROBE.
|
||||
if (probe.stow()) {
|
||||
|
@ -799,9 +767,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
g29_in_progress = false;
|
||||
#if ENABLED(LCD_BED_LEVELING)
|
||||
ui.wait_for_move = false;
|
||||
#endif
|
||||
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
|
||||
#endif
|
||||
|
||||
// Calculate leveling, print reports, correct the position
|
||||
|
@ -813,9 +779,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
refresh_bed_level();
|
||||
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
print_bilinear_leveling_grid_virt();
|
||||
#endif
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, print_bilinear_leveling_grid_virt());
|
||||
|
||||
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
|
||||
|
|
|
@ -55,12 +55,8 @@ void GcodeSuite::M421() {
|
|||
SERIAL_ERROR_MSG(STR_ERR_MESH_XY);
|
||||
else {
|
||||
z_values[ix][iy] = parser.value_linear_units() + (hasQ ? z_values[ix][iy] : 0);
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
bed_level_virt_interpolate();
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(ix, iy, z_values[ix][iy]);
|
||||
#endif
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, z_values[ix][iy]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,7 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
|
|||
void GcodeSuite::G29() {
|
||||
|
||||
static int mbl_probe_index = -1;
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
static bool saved_soft_endstops_state;
|
||||
#endif
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, static bool saved_soft_endstops_state);
|
||||
|
||||
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
|
||||
if (!WITHIN(state, 0, 5)) {
|
||||
|
@ -111,9 +109,7 @@ void GcodeSuite::G29() {
|
|||
else {
|
||||
// Save Z for the previous mesh position
|
||||
mbl.set_zigzag_z(mbl_probe_index - 1, current_position.z);
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
soft_endstops_enabled = saved_soft_endstops_state;
|
||||
#endif
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
|
||||
}
|
||||
// If there's another point to sample, move there with optional lift.
|
||||
if (mbl_probe_index < GRID_MAX_POINTS) {
|
||||
|
@ -147,9 +143,7 @@ void GcodeSuite::G29() {
|
|||
planner.synchronize();
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_BED_LEVELING)
|
||||
ui.wait_for_move = false;
|
||||
#endif
|
||||
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -178,9 +172,7 @@ void GcodeSuite::G29() {
|
|||
|
||||
if (parser.seenval('Z')) {
|
||||
mbl.z_values[ix][iy] = parser.value_linear_units();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(ix, iy, mbl.z_values[ix][iy]);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, mbl.z_values[ix][iy]));
|
||||
}
|
||||
else
|
||||
return echo_not_entered('Z');
|
||||
|
|
|
@ -63,9 +63,7 @@ void GcodeSuite::M421() {
|
|||
else {
|
||||
float &zval = ubl.z_values[ij.x][ij.y];
|
||||
zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(ij.x, ij.y, zval);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -126,22 +126,16 @@
|
|||
*/
|
||||
destination.set(safe_homing_xy, current_position.z);
|
||||
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
destination -= probe.offset_xy;
|
||||
#endif
|
||||
TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);
|
||||
|
||||
if (position_is_reachable(destination)) {
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("home_z_safely", destination);
|
||||
|
||||
// This causes the carriage on Dual X to unpark
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
active_extruder_parked = false;
|
||||
#endif
|
||||
TERN_(DUAL_X_CARRIAGE, active_extruder_parked = false);
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
safe_delay(500); // Short delay needed to settle
|
||||
#endif
|
||||
TERN_(SENSORLESS_HOMING, safe_delay(500)); // Short delay needed to settle
|
||||
|
||||
do_blocking_move_to_xy(destination);
|
||||
homeaxis(Z_AXIS);
|
||||
|
@ -175,9 +169,7 @@
|
|||
void end_slow_homing(const slow_homing_t &slow_homing) {
|
||||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = slow_homing.acceleration.x;
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = slow_homing.acceleration.y;
|
||||
#if HAS_CLASSIC_JERK
|
||||
planner.max_jerk = slow_homing.jerk_xy;
|
||||
#endif
|
||||
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = slow_homing.jerk_xy);
|
||||
planner.reset_acceleration_rates();
|
||||
}
|
||||
|
||||
|
@ -237,22 +229,18 @@ void GcodeSuite::G28() {
|
|||
#if HAS_LEVELING
|
||||
|
||||
// Cancel the active G29 session
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
g29_in_progress = false;
|
||||
#endif
|
||||
TERN_(PROBE_MANUALLY, g29_in_progress = false);
|
||||
|
||||
#if ENABLED(RESTORE_LEVELING_AFTER_G28)
|
||||
const bool leveling_was_active = planner.leveling_active;
|
||||
#endif
|
||||
TERN_(RESTORE_LEVELING_AFTER_G28, const bool leveling_was_active = planner.leveling_active);
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
workspace_plane = PLANE_XY;
|
||||
#endif
|
||||
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
|
||||
|
||||
#define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
|
||||
#define HAS_HOMING_CURRENT (HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2))
|
||||
#if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2)
|
||||
#define HAS_HOMING_CURRENT 1
|
||||
#endif
|
||||
|
||||
#if HAS_HOMING_CURRENT
|
||||
auto debug_current = [](PGM_P const s, const int16_t a, const int16_t b){
|
||||
|
@ -280,9 +268,7 @@ void GcodeSuite::G28() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
slow_homing_t slow_homing = begin_slow_homing();
|
||||
#endif
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing_t slow_homing = begin_slow_homing());
|
||||
|
||||
// Always home with tool 0 active
|
||||
#if HAS_MULTI_HOTEND
|
||||
|
@ -292,9 +278,7 @@ void GcodeSuite::G28() {
|
|||
tool_change(0, true);
|
||||
#endif
|
||||
|
||||
#if HAS_DUPLICATION_MODE
|
||||
extruder_duplication_enabled = false;
|
||||
#endif
|
||||
TERN_(HAS_DUPLICATION_MODE, extruder_duplication_enabled = false);
|
||||
|
||||
remember_feedrate_scaling_off();
|
||||
|
||||
|
@ -306,9 +290,7 @@ void GcodeSuite::G28() {
|
|||
|
||||
home_delta();
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
end_slow_homing(slow_homing);
|
||||
#endif
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
|
||||
|
||||
#else // NOT DELTA
|
||||
|
||||
|
@ -380,17 +362,13 @@ void GcodeSuite::G28() {
|
|||
if (DISABLED(HOME_Y_BEFORE_X) && doY)
|
||||
homeaxis(Y_AXIS);
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
end_slow_homing(slow_homing);
|
||||
#endif
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
|
||||
|
||||
// Home Z last if homing towards the bed
|
||||
#if Z_HOME_DIR < 0
|
||||
|
||||
if (doZ) {
|
||||
#if ENABLED(BLTOUCH)
|
||||
bltouch.init();
|
||||
#endif
|
||||
TERN_(BLTOUCH, bltouch.init());
|
||||
#if ENABLED(Z_SAFE_HOMING)
|
||||
home_z_safely();
|
||||
#else
|
||||
|
@ -425,9 +403,7 @@ void GcodeSuite::G28() {
|
|||
|
||||
if (dxc_is_duplicating()) {
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
slow_homing = begin_slow_homing();
|
||||
#endif
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing = begin_slow_homing());
|
||||
|
||||
// Always home the 2nd (right) extruder first
|
||||
active_extruder = 1;
|
||||
|
@ -448,9 +424,7 @@ void GcodeSuite::G28() {
|
|||
dual_x_carriage_mode = IDEX_saved_mode;
|
||||
stepper.set_directions();
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
end_slow_homing(slow_homing);
|
||||
#endif
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
|
||||
}
|
||||
|
||||
#endif // DUAL_X_CARRIAGE
|
||||
|
@ -458,18 +432,14 @@ void GcodeSuite::G28() {
|
|||
endstops.not_homing();
|
||||
|
||||
// Clear endstop state for polled stallGuard endstops
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
endstops.clear_endstop_state();
|
||||
#endif
|
||||
TERN_(SPI_ENDSTOPS, endstops.clear_endstop_state());
|
||||
|
||||
#if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)
|
||||
// move to a height where we can use the full xy-area
|
||||
do_blocking_move_to_z(delta_clip_start_height);
|
||||
#endif
|
||||
|
||||
#if ENABLED(RESTORE_LEVELING_AFTER_G28)
|
||||
set_bed_leveling_enabled(leveling_was_active);
|
||||
#endif
|
||||
TERN_(RESTORE_LEVELING_AFTER_G28, set_bed_leveling_enabled(leveling_was_active));
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
|
||||
|
|
|
@ -63,12 +63,7 @@ enum CalEnum : char { // the 7 main calibration points -
|
|||
#define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP)
|
||||
#define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP)
|
||||
|
||||
#if HOTENDS > 1
|
||||
const uint8_t old_tool_index = active_extruder;
|
||||
#define AC_CLEANUP() ac_cleanup(old_tool_index)
|
||||
#else
|
||||
#define AC_CLEANUP() ac_cleanup()
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index = active_extruder);
|
||||
|
||||
float lcd_probe_pt(const xy_pos_t &xy);
|
||||
|
||||
|
@ -79,9 +74,7 @@ void ac_home() {
|
|||
}
|
||||
|
||||
void ac_setup(const bool reset_bed) {
|
||||
#if HOTENDS > 1
|
||||
tool_change(0, true);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, tool_change(0, true));
|
||||
|
||||
planner.synchronize();
|
||||
remember_feedrate_scaling_off();
|
||||
|
@ -91,21 +84,11 @@ void ac_setup(const bool reset_bed) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void ac_cleanup(
|
||||
#if HOTENDS > 1
|
||||
const uint8_t old_tool_index
|
||||
#endif
|
||||
) {
|
||||
#if ENABLED(DELTA_HOME_TO_SAFE_ZONE)
|
||||
do_blocking_move_to_z(delta_clip_start_height);
|
||||
#endif
|
||||
#if HAS_BED_PROBE
|
||||
probe.stow();
|
||||
#endif
|
||||
void ac_cleanup(TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index)) {
|
||||
TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height));
|
||||
TERN_(HAS_BED_PROBE, probe.stow());
|
||||
restore_feedrate_and_scaling();
|
||||
#if HOTENDS > 1
|
||||
tool_change(old_tool_index, true);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, true));
|
||||
}
|
||||
|
||||
void print_signed_float(PGM_P const prefix, const float &f) {
|
||||
|
@ -488,7 +471,7 @@ void GcodeSuite::G33() {
|
|||
zero_std_dev_old = zero_std_dev;
|
||||
if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each)) {
|
||||
SERIAL_ECHOLNPGM("Correct delta settings with M665 and M666");
|
||||
return AC_CLEANUP();
|
||||
return ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index));
|
||||
}
|
||||
zero_std_dev = std_dev_points(z_at_pt, _0p_calibration, _1p_calibration, _4p_calibration, _4p_opposite_points);
|
||||
|
||||
|
@ -659,7 +642,7 @@ void GcodeSuite::G33() {
|
|||
}
|
||||
while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);
|
||||
|
||||
AC_CLEANUP();
|
||||
ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index));
|
||||
}
|
||||
|
||||
#endif // DELTA_AUTO_CALIBRATION
|
||||
|
|
|
@ -113,15 +113,11 @@ void GcodeSuite::G34() {
|
|||
|
||||
// Disable the leveling matrix before auto-aligning
|
||||
#if HAS_LEVELING
|
||||
#if ENABLED(RESTORE_LEVELING_AFTER_G34)
|
||||
const bool leveling_was_active = planner.leveling_active;
|
||||
#endif
|
||||
TERN_(RESTORE_LEVELING_AFTER_G34, const bool leveling_was_active = planner.leveling_active);
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
workspace_plane = PLANE_XY;
|
||||
#endif
|
||||
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
|
||||
|
||||
// Always home with tool 0 active
|
||||
#if HAS_MULTI_HOTEND
|
||||
|
@ -129,18 +125,12 @@ void GcodeSuite::G34() {
|
|||
tool_change(0, true);
|
||||
#endif
|
||||
|
||||
#if HAS_DUPLICATION_MODE
|
||||
extruder_duplication_enabled = false;
|
||||
#endif
|
||||
TERN_(HAS_DUPLICATION_MODE, extruder_duplication_enabled = false);
|
||||
|
||||
#if BOTH(BLTOUCH, BLTOUCH_HS_MODE)
|
||||
// In BLTOUCH HS mode, the probe travels in a deployed state.
|
||||
// Users of G34 might have a badly misaligned bed, so raise Z by the
|
||||
// length of the deployed pin (BLTOUCH stroke < 7mm)
|
||||
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES + 7.0f
|
||||
#else
|
||||
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES
|
||||
#endif
|
||||
// In BLTOUCH HS mode, the probe travels in a deployed state.
|
||||
// Users of G34 might have a badly misaligned bed, so raise Z by the
|
||||
// length of the deployed pin (BLTOUCH stroke < 7mm)
|
||||
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES + 7.0f * BOTH(BLTOUCH, BLTOUCH_HS_MODE)
|
||||
|
||||
// Compute a worst-case clearance height to probe from. After the first
|
||||
// iteration this will be re-calculated based on the actual bed position
|
||||
|
@ -386,9 +376,7 @@ void GcodeSuite::G34() {
|
|||
#endif
|
||||
|
||||
// Restore the active tool after homing
|
||||
#if HAS_MULTI_HOTEND
|
||||
tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER)); // Fetch previous tool for parking extruder
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER))); // Fetch previous tool for parking extruder
|
||||
|
||||
#if HAS_LEVELING && ENABLED(RESTORE_LEVELING_AFTER_G34)
|
||||
set_bed_leveling_enabled(leveling_was_active);
|
||||
|
|
|
@ -285,37 +285,19 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
|||
probe_side(m, uncertainty, TOP);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CALIBRATION_MEASURE_RIGHT)
|
||||
probe_side(m, uncertainty, RIGHT, probe_top_at_edge);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CALIBRATION_MEASURE_FRONT)
|
||||
probe_side(m, uncertainty, FRONT, probe_top_at_edge);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CALIBRATION_MEASURE_LEFT)
|
||||
probe_side(m, uncertainty, LEFT, probe_top_at_edge);
|
||||
#endif
|
||||
#if ENABLED(CALIBRATION_MEASURE_BACK)
|
||||
probe_side(m, uncertainty, BACK, probe_top_at_edge);
|
||||
#endif
|
||||
TERN_(CALIBRATION_MEASURE_RIGHT, probe_side(m, uncertainty, RIGHT, probe_top_at_edge));
|
||||
TERN_(CALIBRATION_MEASURE_FRONT, probe_side(m, uncertainty, FRONT, probe_top_at_edge));
|
||||
TERN_(CALIBRATION_MEASURE_LEFT, probe_side(m, uncertainty, LEFT, probe_top_at_edge));
|
||||
TERN_(CALIBRATION_MEASURE_BACK, probe_side(m, uncertainty, BACK, probe_top_at_edge));
|
||||
|
||||
// Compute the measured center of the calibration object.
|
||||
#if HAS_X_CENTER
|
||||
m.obj_center.x = (m.obj_side[LEFT] + m.obj_side[RIGHT]) / 2;
|
||||
#endif
|
||||
#if HAS_Y_CENTER
|
||||
m.obj_center.y = (m.obj_side[FRONT] + m.obj_side[BACK]) / 2;
|
||||
#endif
|
||||
TERN_(HAS_X_CENTER, m.obj_center.x = (m.obj_side[LEFT] + m.obj_side[RIGHT]) / 2);
|
||||
TERN_(HAS_Y_CENTER, m.obj_center.y = (m.obj_side[FRONT] + m.obj_side[BACK]) / 2);
|
||||
|
||||
// Compute the outside diameter of the nozzle at the height
|
||||
// at which it makes contact with the calibration object
|
||||
#if HAS_X_CENTER
|
||||
m.nozzle_outer_dimension.x = m.obj_side[RIGHT] - m.obj_side[LEFT] - dimensions.x;
|
||||
#endif
|
||||
#if HAS_Y_CENTER
|
||||
m.nozzle_outer_dimension.y = m.obj_side[BACK] - m.obj_side[FRONT] - dimensions.y;
|
||||
#endif
|
||||
TERN_(HAS_X_CENTER, m.nozzle_outer_dimension.x = m.obj_side[RIGHT] - m.obj_side[LEFT] - dimensions.x);
|
||||
TERN_(HAS_Y_CENTER, m.nozzle_outer_dimension.y = m.obj_side[BACK] - m.obj_side[FRONT] - dimensions.y);
|
||||
|
||||
park_above_object(m, uncertainty);
|
||||
|
||||
|
@ -544,13 +526,9 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty)
|
|||
|
||||
HOTEND_LOOP() calibrate_toolhead(m, uncertainty, e);
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
normalize_hotend_offsets();
|
||||
#endif
|
||||
TERN_(HAS_HOTEND_OFFSET, normalize_hotend_offsets());
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
set_nozzle(m, 0);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, set_nozzle(m, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -567,9 +545,7 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty)
|
|||
inline void calibrate_all() {
|
||||
measurements_t m;
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
reset_hotend_offsets();
|
||||
#endif
|
||||
TERN_(HAS_HOTEND_OFFSET, reset_hotend_offsets());
|
||||
|
||||
TEMPORARY_BACKLASH_CORRECTION(all_on);
|
||||
TEMPORARY_BACKLASH_SMOOTHING(0.0f);
|
||||
|
@ -577,9 +553,7 @@ inline void calibrate_all() {
|
|||
// Do a fast and rough calibration of the toolheads
|
||||
calibrate_all_toolheads(m, CALIBRATION_MEASUREMENT_UNKNOWN);
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
calibrate_backlash(m, CALIBRATION_MEASUREMENT_UNCERTAIN);
|
||||
#endif
|
||||
TERN_(BACKLASH_GCODE, calibrate_backlash(m, CALIBRATION_MEASUREMENT_UNCERTAIN));
|
||||
|
||||
// Cycle the toolheads so the servos settle into their "natural" positions
|
||||
#if HAS_MULTI_HOTEND
|
||||
|
|
|
@ -178,9 +178,7 @@ void GcodeSuite::G76() {
|
|||
report_temps(next_temp_report);
|
||||
|
||||
// Disable leveling so it won't mess with us
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
|
||||
|
||||
for (;;) {
|
||||
thermalManager.setTargetBed(target_bed);
|
||||
|
@ -214,9 +212,7 @@ void GcodeSuite::G76() {
|
|||
|
||||
// Cleanup
|
||||
thermalManager.setTargetBed(0);
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(true);
|
||||
#endif
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(true));
|
||||
} // do_bed_cal
|
||||
|
||||
/********************************************
|
||||
|
@ -240,9 +236,7 @@ void GcodeSuite::G76() {
|
|||
wait_for_temps(target_bed, target_probe, next_temp_report);
|
||||
|
||||
// Disable leveling so it won't mess with us
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
|
||||
|
||||
bool timeout = false;
|
||||
for (;;) {
|
||||
|
@ -273,9 +267,7 @@ void GcodeSuite::G76() {
|
|||
|
||||
// Cleanup
|
||||
thermalManager.setTargetBed(0);
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(true);
|
||||
#endif
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(true));
|
||||
|
||||
SERIAL_ECHOLNPGM("Final compensation values:");
|
||||
temp_comp.print_offsets();
|
||||
|
|
|
@ -263,9 +263,7 @@ void GcodeSuite::M48() {
|
|||
restore_feedrate_and_scaling();
|
||||
|
||||
// Re-enable bed level correction if it had been on
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(was_enabled);
|
||||
#endif
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(was_enabled));
|
||||
|
||||
report_current_position();
|
||||
}
|
||||
|
|
|
@ -142,9 +142,7 @@ void GcodeSuite::M205() {
|
|||
const float junc_dev = parser.value_linear_units();
|
||||
if (WITHIN(junc_dev, 0.01f, 0.3f)) {
|
||||
planner.junction_deviation_mm = junc_dev;
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
planner.recalculate_max_e_jerk();
|
||||
#endif
|
||||
TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk());
|
||||
}
|
||||
else
|
||||
SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)");
|
||||
|
|
|
@ -340,12 +340,8 @@ void GcodeSuite::M43() {
|
|||
#if HAS_RESUME_CONTINUE
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
wait_for_user = true;
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("M43 Wait Called"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("M43 Wait Called")));
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
|
@ -366,9 +362,7 @@ void GcodeSuite::M43() {
|
|||
}
|
||||
}
|
||||
|
||||
#if HAS_RESUME_CONTINUE
|
||||
if (!wait_for_user) break;
|
||||
#endif
|
||||
if (TERN0(HAS_RESUME_CONTINUE, !wait_for_user)) break;
|
||||
|
||||
safe_delay(200);
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
* M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
|
||||
*/
|
||||
void GcodeSuite::M108() {
|
||||
#if HAS_RESUME_CONTINUE
|
||||
wait_for_user = false;
|
||||
#endif
|
||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
|
||||
wait_for_heatup = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,7 @@ void GcodeSuite::M17() {
|
|||
if (parser.seen('X')) ENABLE_AXIS_X();
|
||||
if (parser.seen('Y')) ENABLE_AXIS_Y();
|
||||
if (parser.seen('Z')) ENABLE_AXIS_Z();
|
||||
#if HAS_E_STEPPER_ENABLE
|
||||
if (parser.seen('E')) enable_e_steppers();
|
||||
#endif
|
||||
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen('E'))) enable_e_steppers();
|
||||
}
|
||||
else {
|
||||
LCD_MESSAGEPGM(MSG_NO_MOVE);
|
||||
|
@ -60,9 +58,7 @@ void GcodeSuite::M18_M84() {
|
|||
if (parser.seen('X')) DISABLE_AXIS_X();
|
||||
if (parser.seen('Y')) DISABLE_AXIS_Y();
|
||||
if (parser.seen('Z')) DISABLE_AXIS_Z();
|
||||
#if HAS_E_STEPPER_ENABLE
|
||||
if (parser.seen('E')) disable_e_steppers();
|
||||
#endif
|
||||
if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen('E'))) disable_e_steppers();
|
||||
}
|
||||
else
|
||||
planner.finish_and_disable();
|
||||
|
|
|
@ -86,12 +86,8 @@ void GcodeSuite::M907() {
|
|||
* M908: Control digital trimpot directly (M908 P<pin> S<current>)
|
||||
*/
|
||||
void GcodeSuite::M908() {
|
||||
#if HAS_DIGIPOTSS
|
||||
stepper.digitalPotWrite(parser.intval('P'), parser.intval('S'));
|
||||
#endif
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
dac_current_raw(parser.byteval('P', -1), parser.ushortval('S', 0));
|
||||
#endif
|
||||
TERN_(HAS_DIGIPOTSS, stepper.digitalPotWrite(parser.intval('P'), parser.intval('S')));
|
||||
TERN_(DAC_STEPPER_CURRENT, dac_current_raw(parser.byteval('P', -1), parser.ushortval('S', 0)));
|
||||
}
|
||||
|
||||
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT
|
||||
|
|
|
@ -56,11 +56,7 @@
|
|||
*/
|
||||
void GcodeSuite::M125() {
|
||||
// Initial retract before move to filament change position
|
||||
const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
|
||||
#ifdef PAUSE_PARK_RETRACT_LENGTH
|
||||
+ (PAUSE_PARK_RETRACT_LENGTH)
|
||||
#endif
|
||||
);
|
||||
const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : (PAUSE_PARK_RETRACT_LENGTH));
|
||||
|
||||
xyz_pos_t park_point = NOZZLE_PARK_POINT;
|
||||
|
||||
|
@ -75,23 +71,14 @@ void GcodeSuite::M125() {
|
|||
park_point += hotend_offset[active_extruder];
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
const bool sd_printing = IS_SD_PRINTING();
|
||||
#else
|
||||
constexpr bool sd_printing = false;
|
||||
#endif
|
||||
const bool sd_printing = TERN0(SDSUPPORT, IS_SD_PRINTING());
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT);
|
||||
const bool show_lcd = parser.seenval('P');
|
||||
#else
|
||||
constexpr bool show_lcd = false;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT));
|
||||
|
||||
const bool show_lcd = TERN0(HAS_LCD_MENU, parser.seenval('P'));
|
||||
|
||||
if (pause_print(retract, park_point, 0, show_lcd)) {
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
if (recovery.enabled) recovery.save(true);
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
|
||||
if (!sd_printing || show_lcd) {
|
||||
wait_for_confirmation(false, 0);
|
||||
resume_print(0, 0, -retract, 0);
|
||||
|
|
|
@ -112,11 +112,7 @@ void GcodeSuite::M600() {
|
|||
#endif
|
||||
|
||||
// Initial retract before move to filament change position
|
||||
const float retract = -ABS(parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
|
||||
#ifdef PAUSE_PARK_RETRACT_LENGTH
|
||||
+ (PAUSE_PARK_RETRACT_LENGTH)
|
||||
#endif
|
||||
);
|
||||
const float retract = -ABS(parser.seen('E') ? parser.value_axis_units(E_AXIS) : (PAUSE_PARK_RETRACT_LENGTH));
|
||||
|
||||
xyz_pos_t park_point NOZZLE_PARK_POINT;
|
||||
|
||||
|
@ -149,11 +145,9 @@ void GcodeSuite::M600() {
|
|||
: fc_settings[active_extruder].load_length);
|
||||
#endif
|
||||
|
||||
const int beep_count = parser.intval('B',
|
||||
const int beep_count = parser.intval('B', -1
|
||||
#ifdef FILAMENT_CHANGE_ALERT_BEEPS
|
||||
FILAMENT_CHANGE_ALERT_BEEPS
|
||||
#else
|
||||
-1
|
||||
+ 1 + FILAMENT_CHANGE_ALERT_BEEPS
|
||||
#endif
|
||||
);
|
||||
|
||||
|
@ -173,9 +167,7 @@ void GcodeSuite::M600() {
|
|||
tool_change(active_extruder_before_filament_change, false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
mixer.T(old_mixing_tool); // Restore original mixing tool
|
||||
#endif
|
||||
TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
|
||||
}
|
||||
|
||||
#endif // ADVANCED_PAUSE_FEATURE
|
||||
|
|
|
@ -84,9 +84,7 @@ void GcodeSuite::M701() {
|
|||
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
|
||||
|
||||
// Show initial "wait for load" message
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder));
|
||||
|
||||
#if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2)
|
||||
// Change toolhead if specified
|
||||
|
@ -129,14 +127,10 @@ void GcodeSuite::M701() {
|
|||
tool_change(active_extruder_before_filament_change, false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
mixer.T(old_mixing_tool); // Restore original mixing tool
|
||||
#endif
|
||||
TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
|
||||
|
||||
// Show status screen
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,9 +184,7 @@ void GcodeSuite::M702() {
|
|||
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
|
||||
|
||||
// Show initial "wait for unload" message
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder));
|
||||
|
||||
#if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2)
|
||||
// Change toolhead if specified
|
||||
|
@ -241,14 +233,10 @@ void GcodeSuite::M702() {
|
|||
tool_change(active_extruder_before_filament_change, false);
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
mixer.T(old_mixing_tool); // Restore original mixing tool
|
||||
#endif
|
||||
TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
|
||||
|
||||
// Show status screen
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
|
||||
}
|
||||
|
||||
#endif // ADVANCED_PAUSE_FEATURE
|
||||
|
|
|
@ -74,9 +74,7 @@ void GcodeSuite::M1000() {
|
|||
#else
|
||||
recovery.cancel();
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerStopped();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
|
||||
}
|
||||
else
|
||||
recovery.resume();
|
||||
|
|
|
@ -218,9 +218,7 @@ void GcodeSuite::dwell(millis_t time) {
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_action_prompt_end();
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());
|
||||
|
||||
#ifdef G29_SUCCESS_COMMANDS
|
||||
process_subcommands_now_P(PSTR(G29_SUCCESS_COMMANDS));
|
||||
|
|
|
@ -396,24 +396,18 @@ private:
|
|||
#endif
|
||||
);
|
||||
|
||||
#if ENABLED(ARC_SUPPORT)
|
||||
static void G2_G3(const bool clockwise);
|
||||
#endif
|
||||
TERN_(ARC_SUPPORT, static void G2_G3(const bool clockwise));
|
||||
|
||||
static void G4();
|
||||
|
||||
#if ENABLED(BEZIER_CURVE_SUPPORT)
|
||||
static void G5();
|
||||
#endif
|
||||
TERN_(BEZIER_CURVE_SUPPORT, static void G5());
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
static void G10();
|
||||
static void G11();
|
||||
#endif
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_FEATURE)
|
||||
static void G12();
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_FEATURE, static void G12());
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
static void G17();
|
||||
|
@ -426,13 +420,9 @@ private:
|
|||
static void G21();
|
||||
#endif
|
||||
|
||||
#if ENABLED(G26_MESH_VALIDATION)
|
||||
static void G26();
|
||||
#endif
|
||||
TERN_(G26_MESH_VALIDATION, static void G26());
|
||||
|
||||
#if ENABLED(NOZZLE_PARK_FEATURE)
|
||||
static void G27();
|
||||
#endif
|
||||
TERN_(NOZZLE_PARK_FEATURE, static void G27());
|
||||
|
||||
static void G28();
|
||||
|
||||
|
@ -454,22 +444,16 @@ private:
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
||||
static void G33();
|
||||
#endif
|
||||
TERN_(DELTA_AUTO_CALIBRATION, static void G33());
|
||||
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
static void G34();
|
||||
static void M422();
|
||||
#endif
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
static void G38(const int8_t subcode);
|
||||
#endif
|
||||
TERN_(G38_PROBE_TARGET, static void G38(const int8_t subcode));
|
||||
|
||||
#if HAS_MESH
|
||||
static void G42();
|
||||
#endif
|
||||
TERN_(HAS_MESH, static void G42());
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
static void G53();
|
||||
|
@ -481,28 +465,20 @@ private:
|
|||
static void G59();
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
static void G76();
|
||||
#endif
|
||||
TERN_(PROBE_TEMP_COMPENSATION, static void G76());
|
||||
|
||||
#if SAVED_POSITIONS
|
||||
static void G60();
|
||||
static void G61();
|
||||
#endif
|
||||
|
||||
#if ENABLED(GCODE_MOTION_MODES)
|
||||
static void G80();
|
||||
#endif
|
||||
TERN_(GCODE_MOTION_MODES, static void G80());
|
||||
|
||||
static void G92();
|
||||
|
||||
#if ENABLED(CALIBRATION_GCODE)
|
||||
static void G425();
|
||||
#endif
|
||||
TERN_(CALIBRATION_GCODE, static void G425());
|
||||
|
||||
#if HAS_RESUME_CONTINUE
|
||||
static void M0_M1();
|
||||
#endif
|
||||
TERN_(HAS_RESUME_CONTINUE, static void M0_M1());
|
||||
|
||||
#if HAS_CUTTER
|
||||
static void M3_M4(const bool is_M4);
|
||||
|
@ -510,22 +486,14 @@ private:
|
|||
#endif
|
||||
|
||||
#if ENABLED(COOLANT_CONTROL)
|
||||
#if ENABLED(COOLANT_MIST)
|
||||
static void M7();
|
||||
#endif
|
||||
#if ENABLED(COOLANT_FLOOD)
|
||||
static void M8();
|
||||
#endif
|
||||
TERN_(COOLANT_MIST, static void M7());
|
||||
TERN_(COOLANT_FLOOD, static void M8());
|
||||
static void M9();
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
|
||||
static void M12();
|
||||
#endif
|
||||
TERN_(EXTERNAL_CLOSED_LOOP_CONTROLLER, static void M12());
|
||||
|
||||
#if ENABLED(EXPECTED_PRINTER_CHECK)
|
||||
static void M16();
|
||||
#endif
|
||||
TERN_(EXPECTED_PRINTER_CHECK, static void M16());
|
||||
|
||||
static void M17();
|
||||
|
||||
|
@ -549,9 +517,7 @@ private:
|
|||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static void M32();
|
||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||
static void M33();
|
||||
#endif
|
||||
TERN_(LONG_FILENAME_HOST_SUPPORT, static void M33());
|
||||
#if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE)
|
||||
static void M34();
|
||||
#endif
|
||||
|
@ -559,29 +525,19 @@ private:
|
|||
|
||||
static void M42();
|
||||
|
||||
#if ENABLED(PINS_DEBUGGING)
|
||||
static void M43();
|
||||
#endif
|
||||
TERN_(PINS_DEBUGGING, static void M43());
|
||||
|
||||
#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
|
||||
static void M48();
|
||||
#endif
|
||||
TERN_(Z_MIN_PROBE_REPEATABILITY_TEST, static void M48());
|
||||
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
static void M73();
|
||||
#endif
|
||||
TERN_(LCD_SET_PROGRESS_MANUALLY, static void M73());
|
||||
|
||||
static void M75();
|
||||
static void M76();
|
||||
static void M77();
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
static void M78();
|
||||
#endif
|
||||
TERN_(PRINTCOUNTER, static void M78());
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
static void M80();
|
||||
#endif
|
||||
TERN_(PSU_CONTROL, static void M80());
|
||||
|
||||
static void M81();
|
||||
static void M82();
|
||||
|
@ -589,9 +545,7 @@ private:
|
|||
static void M85();
|
||||
static void M92();
|
||||
|
||||
#if ENABLED(M100_FREE_MEMORY_WATCHER)
|
||||
static void M100();
|
||||
#endif
|
||||
TERN_(M100_FREE_MEMORY_WATCHER, static void M100());
|
||||
|
||||
#if EXTRUDERS
|
||||
static void M104();
|
||||
|
@ -609,17 +563,13 @@ private:
|
|||
static void M108();
|
||||
static void M112();
|
||||
static void M410();
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
static void M876();
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, static void M876());
|
||||
#endif
|
||||
|
||||
static void M110();
|
||||
static void M111();
|
||||
|
||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
static void M113();
|
||||
#endif
|
||||
TERN_(HOST_KEEPALIVE_FEATURE, static void M113());
|
||||
|
||||
static void M114();
|
||||
static void M115();
|
||||
|
@ -629,9 +579,7 @@ private:
|
|||
static void M120();
|
||||
static void M121();
|
||||
|
||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
||||
static void M125();
|
||||
#endif
|
||||
TERN_(PARK_HEAD_ON_PAUSE, static void M125());
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
|
@ -658,13 +606,9 @@ private:
|
|||
static void M145();
|
||||
#endif
|
||||
|
||||
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
|
||||
static void M149();
|
||||
#endif
|
||||
TERN_(TEMPERATURE_UNITS_SUPPORT, static void M149());
|
||||
|
||||
#if HAS_COLOR_LEDS
|
||||
static void M150();
|
||||
#endif
|
||||
TERN_(HAS_COLOR_LEDS, static void M150());
|
||||
|
||||
#if ENABLED(AUTO_REPORT_TEMPERATURES) && HAS_TEMP_SENSOR
|
||||
static void M155();
|
||||
|
@ -673,12 +617,8 @@ private:
|
|||
#if ENABLED(MIXING_EXTRUDER)
|
||||
static void M163();
|
||||
static void M164();
|
||||
#if ENABLED(DIRECT_MIXING_IN_G1)
|
||||
static void M165();
|
||||
#endif
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
static void M166();
|
||||
#endif
|
||||
TERN_(DIRECT_MIXING_IN_G1, static void M165());
|
||||
TERN_(GRADIENT_MIX, static void M166());
|
||||
#endif
|
||||
|
||||
static void M200();
|
||||
|
@ -692,16 +632,12 @@ private:
|
|||
static void M204();
|
||||
static void M205();
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
static void M206();
|
||||
#endif
|
||||
TERN_(HAS_M206_COMMAND, static void M206());
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
static void M207();
|
||||
static void M208();
|
||||
#if ENABLED(FWRETRACT_AUTORETRACT)
|
||||
static void M209();
|
||||
#endif
|
||||
TERN_(FWRETRACT_AUTORETRACT, static void M209());
|
||||
#endif
|
||||
|
||||
static void M211();
|
||||
|
@ -710,9 +646,7 @@ private:
|
|||
static void M217();
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
static void M218();
|
||||
#endif
|
||||
TERN_(HAS_HOTEND_OFFSET, static void M218());
|
||||
|
||||
static void M220();
|
||||
|
||||
|
@ -722,13 +656,9 @@ private:
|
|||
|
||||
static void M226();
|
||||
|
||||
#if ENABLED(PHOTO_GCODE)
|
||||
static void M240();
|
||||
#endif
|
||||
TERN_(PHOTO_GCODE, static void M240());
|
||||
|
||||
#if HAS_LCD_CONTRAST
|
||||
static void M250();
|
||||
#endif
|
||||
TERN_(HAS_LCD_CONTRAST, static void M250());
|
||||
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
static void M260();
|
||||
|
@ -737,47 +667,29 @@ private:
|
|||
|
||||
#if HAS_SERVOS
|
||||
static void M280();
|
||||
#if ENABLED(EDITABLE_SERVO_ANGLES)
|
||||
static void M281();
|
||||
#endif
|
||||
TERN_(EDITABLE_SERVO_ANGLES, static void M281());
|
||||
#endif
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
static void M290();
|
||||
#endif
|
||||
TERN_(BABYSTEPPING, static void M290());
|
||||
|
||||
#if HAS_BUZZER
|
||||
static void M300();
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, static void M300());
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
static void M301();
|
||||
#endif
|
||||
TERN_(PIDTEMP, static void M301());
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
static void M302();
|
||||
#endif
|
||||
TERN_(PREVENT_COLD_EXTRUSION, static void M302());
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
static void M303();
|
||||
#endif
|
||||
TERN_(HAS_PID_HEATING, static void M303());
|
||||
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
static void M304();
|
||||
#endif
|
||||
TERN_(PIDTEMPBED, static void M304());
|
||||
|
||||
#if HAS_USER_THERMISTORS
|
||||
static void M305();
|
||||
#endif
|
||||
TERN_(HAS_USER_THERMISTORS, static void M305());
|
||||
|
||||
#if HAS_MICROSTEPS
|
||||
static void M350();
|
||||
static void M351();
|
||||
#endif
|
||||
|
||||
#if HAS_CASE_LIGHT
|
||||
static void M355();
|
||||
#endif
|
||||
TERN_(HAS_CASE_LIGHT, static void M355());
|
||||
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
static bool M360();
|
||||
|
@ -799,9 +711,7 @@ private:
|
|||
static void M402();
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRUSA_MMU2)
|
||||
static void M403();
|
||||
#endif
|
||||
TERN_(PRUSA_MMU2, static void M403());
|
||||
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
static void M404();
|
||||
|
@ -810,26 +720,18 @@ private:
|
|||
static void M407();
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
static void M412();
|
||||
#endif
|
||||
TERN_(HAS_FILAMENT_SENSOR, static void M412());
|
||||
|
||||
#if HAS_LEVELING
|
||||
static void M420();
|
||||
static void M421();
|
||||
#endif
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
static void M425();
|
||||
#endif
|
||||
TERN_(BACKLASH_GCODE, static void M425());
|
||||
|
||||
#if HAS_M206_COMMAND
|
||||
static void M428();
|
||||
#endif
|
||||
TERN_(HAS_M206_COMMAND, static void M428());
|
||||
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
static void M486();
|
||||
#endif
|
||||
TERN_(CANCEL_OBJECTS, static void M486());
|
||||
|
||||
static void M500();
|
||||
static void M501();
|
||||
|
@ -837,34 +739,22 @@ private:
|
|||
#if DISABLED(DISABLE_M503)
|
||||
static void M503();
|
||||
#endif
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
static void M504();
|
||||
#endif
|
||||
TERN_(EEPROM_SETTINGS, static void M504());
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static void M524();
|
||||
#endif
|
||||
TERN_(SDSUPPORT, static void M524());
|
||||
|
||||
#if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
|
||||
static void M540();
|
||||
#endif
|
||||
TERN_(SD_ABORT_ON_ENDSTOP_HIT, static void M540());
|
||||
|
||||
#if ENABLED(BAUD_RATE_GCODE)
|
||||
static void M575();
|
||||
#endif
|
||||
TERN_(BAUD_RATE_GCODE, static void M575());
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
static void M600();
|
||||
static void M603();
|
||||
#endif
|
||||
|
||||
#if HAS_DUPLICATION_MODE
|
||||
static void M605();
|
||||
#endif
|
||||
TERN_(HAS_DUPLICATION_MODE, static void M605());
|
||||
|
||||
#if IS_KINEMATIC
|
||||
static void M665();
|
||||
#endif
|
||||
TERN_(IS_KINEMATIC, static void M665());
|
||||
|
||||
#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
|
||||
static void M666();
|
||||
|
@ -879,17 +769,11 @@ private:
|
|||
static void M702();
|
||||
#endif
|
||||
|
||||
#if ENABLED(GCODE_MACROS)
|
||||
static void M810_819();
|
||||
#endif
|
||||
TERN_(GCODE_MACROS, static void M810_819());
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
static void M851();
|
||||
#endif
|
||||
TERN_(HAS_BED_PROBE, static void M851());
|
||||
|
||||
#if ENABLED(SKEW_CORRECTION_GCODE)
|
||||
static void M852();
|
||||
#endif
|
||||
TERN_(SKEW_CORRECTION_GCODE, static void M852());
|
||||
|
||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||
FORCE_INLINE static void M860() { I2CPEM.M860(); }
|
||||
|
@ -904,30 +788,20 @@ private:
|
|||
FORCE_INLINE static void M869() { I2CPEM.M869(); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_TEMP_COMPENSATION)
|
||||
static void M871();
|
||||
#endif
|
||||
TERN_(PROBE_TEMP_COMPENSATION, static void M871());
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
static void M900();
|
||||
#endif
|
||||
TERN_(LIN_ADVANCE, static void M900());
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
static void M122();
|
||||
static void M906();
|
||||
#if HAS_STEALTHCHOP
|
||||
static void M569();
|
||||
#endif
|
||||
TERN_(HAS_STEALTHCHOP, static void M569());
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
static void M911();
|
||||
static void M912();
|
||||
#endif
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
static void M913();
|
||||
#endif
|
||||
#if USE_SENSORLESS
|
||||
static void M914();
|
||||
#endif
|
||||
TERN_(HYBRID_THRESHOLD, static void M913());
|
||||
TERN_(USE_SENSORLESS, static void M914());
|
||||
#endif
|
||||
|
||||
#if HAS_L64XX
|
||||
|
@ -949,17 +823,11 @@ private:
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static void M928();
|
||||
#endif
|
||||
TERN_(SDSUPPORT, static void M928());
|
||||
|
||||
#if ENABLED(MAGNETIC_PARKING_EXTRUDER)
|
||||
static void M951();
|
||||
#endif
|
||||
TERN_(MAGNETIC_PARKING_EXTRUDER, static void M951());
|
||||
|
||||
#if ENABLED(PLATFORM_M997_SUPPORT)
|
||||
static void M997();
|
||||
#endif
|
||||
TERN_(PLATFORM_M997_SUPPORT, static void M997());
|
||||
|
||||
static void M999();
|
||||
|
||||
|
@ -968,17 +836,11 @@ private:
|
|||
static void M1000();
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static void M1001();
|
||||
#endif
|
||||
TERN_(SDSUPPORT, static void M1001());
|
||||
|
||||
#if ENABLED(MAX7219_GCODE)
|
||||
static void M7219();
|
||||
#endif
|
||||
TERN_(MAX7219_GCODE, static void M7219());
|
||||
|
||||
#if ENABLED(CONTROLLER_FAN_EDITABLE)
|
||||
static void M710();
|
||||
#endif
|
||||
TERN_(CONTROLLER_FAN_EDITABLE, static void M710());
|
||||
|
||||
static void T(const uint8_t tool_index);
|
||||
|
||||
|
|
|
@ -213,8 +213,6 @@ void GcodeSuite::M114() {
|
|||
if (parser.seen('R')) { report_real_position(); return; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(M114_LEGACY)
|
||||
planner.synchronize();
|
||||
#endif
|
||||
TERN_(M114_LEGACY, planner.synchronize());
|
||||
report_current_position_projected();
|
||||
}
|
||||
|
|
|
@ -44,14 +44,10 @@ void GcodeSuite::M115() {
|
|||
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
|
||||
|
||||
// PAREN_COMMENTS
|
||||
#if ENABLED(PAREN_COMMENTS)
|
||||
cap_line(PSTR("PAREN_COMMENTS"), true);
|
||||
#endif
|
||||
TERN_(PAREN_COMMENTS, cap_line(PSTR("PAREN_COMMENTS"), true));
|
||||
|
||||
// QUOTED_STRINGS
|
||||
#if ENABLED(GCODE_QUOTED_STRINGS)
|
||||
cap_line(PSTR("QUOTED_STRINGS"), true);
|
||||
#endif
|
||||
TERN_(GCODE_QUOTED_STRINGS, cap_line(PSTR("QUOTED_STRINGS"), true));
|
||||
|
||||
// SERIAL_XON_XOFF
|
||||
cap_line(PSTR("SERIAL_XON_XOFF"), ENABLED(SERIAL_XON_XOFF));
|
||||
|
@ -92,7 +88,7 @@ void GcodeSuite::M115() {
|
|||
// CASE LIGHTS (M355)
|
||||
cap_line(PSTR("TOGGLE_LIGHTS"), ENABLED(HAS_CASE_LIGHT));
|
||||
|
||||
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN(HAS_CASE_LIGHT, PWM_PIN(CASE_LIGHT_PIN), 0));
|
||||
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN0(HAS_CASE_LIGHT, PWM_PIN(CASE_LIGHT_PIN)));
|
||||
|
||||
// EMERGENCY_PARSER (M108, M112, M410, M876)
|
||||
cap_line(PSTR("EMERGENCY_PARSER"), ENABLED(EMERGENCY_PARSER));
|
||||
|
|
|
@ -77,15 +77,11 @@ void GcodeSuite::M0_M1() {
|
|||
|
||||
#endif
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR));
|
||||
|
||||
wait_for_user_response(ms);
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ui.reset_status();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ui.reset_status());
|
||||
}
|
||||
|
||||
#endif // HAS_RESUME_CONTINUE
|
||||
|
|
|
@ -70,14 +70,12 @@ void plan_arc(
|
|||
ab_float_t rvec = -offset;
|
||||
|
||||
const float radius = HYPOT(rvec.a, rvec.b),
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
start_L = current_position[l_axis],
|
||||
#endif
|
||||
center_P = current_position[p_axis] - rvec.a,
|
||||
center_Q = current_position[q_axis] - rvec.b,
|
||||
rt_X = cart[p_axis] - center_P,
|
||||
rt_Y = cart[q_axis] - center_Q,
|
||||
linear_travel = cart[l_axis] - current_position[l_axis],
|
||||
start_L = current_position[l_axis],
|
||||
linear_travel = cart[l_axis] - start_L,
|
||||
extruder_travel = cart.e - current_position.e;
|
||||
|
||||
// CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required.
|
||||
|
@ -157,7 +155,6 @@ void plan_arc(
|
|||
// Initialize the extruder axis
|
||||
raw.e = current_position.e;
|
||||
|
||||
|
||||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
const float inv_duration = scaled_fr_mm_s / seg_length;
|
||||
#endif
|
||||
|
@ -220,15 +217,12 @@ void plan_arc(
|
|||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
, inv_duration
|
||||
#endif
|
||||
))
|
||||
break;
|
||||
)) break;
|
||||
}
|
||||
|
||||
// Ensure last segment arrives at target location.
|
||||
raw = cart;
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
raw[l_axis] = start_L;
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_UBL, raw[l_axis] = start_L);
|
||||
|
||||
apply_motion_limits(raw);
|
||||
|
||||
|
@ -242,10 +236,9 @@ void plan_arc(
|
|||
#endif
|
||||
);
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
raw[l_axis] = start_L;
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_UBL, raw[l_axis] = start_L);
|
||||
current_position = raw;
|
||||
|
||||
} // plan_arc
|
||||
|
||||
/**
|
||||
|
@ -285,9 +278,7 @@ void GcodeSuite::G2_G3(const bool clockwise) {
|
|||
|
||||
get_destination_from_command(); // Get X Y Z E F (and set cutter power)
|
||||
|
||||
#if ENABLED(SF_ARC_FIX)
|
||||
relative_mode = relative_mode_backup;
|
||||
#endif
|
||||
TERN_(SF_ARC_FIX, relative_mode = relative_mode_backup);
|
||||
|
||||
ab_float_t arc_offset = { 0, 0 };
|
||||
if (parser.seenval('R')) {
|
||||
|
|
|
@ -83,9 +83,7 @@ void GCodeParser::reset() {
|
|||
string_arg = nullptr; // No whole line argument
|
||||
command_letter = '?'; // No command letter
|
||||
codenum = 0; // No command code
|
||||
#if ENABLED(USE_GCODE_SUBCODES)
|
||||
subcode = 0; // No command sub-code
|
||||
#endif
|
||||
TERN_(USE_GCODE_SUBCODES, subcode = 0); // No command sub-code
|
||||
#if ENABLED(FASTER_GCODE_PARSER)
|
||||
codebits = 0; // No codes yet
|
||||
//ZERO(param); // No parameters (should be safe to comment out this line)
|
||||
|
@ -119,9 +117,8 @@ void GCodeParser::parse(char *p) {
|
|||
reset(); // No codes to report
|
||||
|
||||
auto uppercase = [](char c) {
|
||||
#if ENABLED(GCODE_CASE_INSENSITIVE)
|
||||
if (WITHIN(c, 'a', 'z')) c += 'A' - 'a';
|
||||
#endif
|
||||
if (TERN0(GCODE_CASE_INSENSITIVE, WITHIN(c, 'a', 'z')))
|
||||
c += 'A' - 'a';
|
||||
return c;
|
||||
};
|
||||
|
||||
|
@ -130,9 +127,7 @@ void GCodeParser::parse(char *p) {
|
|||
|
||||
// Skip N[-0-9] if included in the command line
|
||||
if (uppercase(*p) == 'N' && NUMERIC_SIGNED(p[1])) {
|
||||
#if ENABLED(FASTER_GCODE_PARSER)
|
||||
//set('N', p + 1); // (optional) Set the 'N' parameter value
|
||||
#endif
|
||||
//TERN_(FASTER_GCODE_PARSER, set('N', p + 1)); // (optional) Set the 'N' parameter value
|
||||
p += 2; // skip N[-0-9]
|
||||
while (NUMERIC(*p)) ++p; // skip [0-9]*
|
||||
while (*p == ' ') ++p; // skip [ ]*
|
||||
|
@ -213,9 +208,7 @@ void GCodeParser::parse(char *p) {
|
|||
)
|
||||
) {
|
||||
motion_mode_codenum = codenum;
|
||||
#if ENABLED(USE_GCODE_SUBCODES)
|
||||
motion_mode_subcode = subcode;
|
||||
#endif
|
||||
TERN_(USE_GCODE_SUBCODES, motion_mode_subcode = subcode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -232,9 +225,7 @@ void GCodeParser::parse(char *p) {
|
|||
if (motion_mode_codenum < 0) return;
|
||||
command_letter = 'G';
|
||||
codenum = motion_mode_codenum;
|
||||
#if ENABLED(USE_GCODE_SUBCODES)
|
||||
subcode = motion_mode_subcode;
|
||||
#endif
|
||||
TERN_(USE_GCODE_SUBCODES, subcode = motion_mode_subcode);
|
||||
p--; // Back up one character to use the current parameter
|
||||
break;
|
||||
#endif // GCODE_MOTION_MODES
|
||||
|
@ -331,13 +322,9 @@ void GCodeParser::parse(char *p) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||
if (debug) SERIAL_EOL();
|
||||
#endif
|
||||
if (TERN0(DEBUG_GCODE_PARSER, debug)) SERIAL_EOL();
|
||||
|
||||
#if ENABLED(FASTER_GCODE_PARSER)
|
||||
set(param, valptr); // Set parameter exists and pointer (nullptr for no value)
|
||||
#endif
|
||||
TERN_(FASTER_GCODE_PARSER, set(param, valptr)); // Set parameter exists and pointer (nullptr for no value)
|
||||
}
|
||||
else if (!string_arg) { // Not A-Z? First time, keep as the string_arg
|
||||
string_arg = p - 1;
|
||||
|
|
|
@ -46,9 +46,7 @@ void GcodeSuite::G30() {
|
|||
if (!probe.can_reach(pos)) return;
|
||||
|
||||
// Disable leveling so the planner won't mess with us
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
|
||||
|
||||
remember_feedrate_scaling_off();
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ void mpe_settings_init() {
|
|||
mpe_settings.parking_xpos[0] = pex[0]; // M951 L
|
||||
mpe_settings.parking_xpos[1] = pex[1]; // M951 R
|
||||
mpe_settings.grab_distance = PARKING_EXTRUDER_GRAB_DISTANCE; // M951 I
|
||||
#if HAS_HOME_OFFSET
|
||||
set_home_offset(X_AXIS, mpe_settings.grab_distance * -1);
|
||||
#endif
|
||||
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, mpe_settings.grab_distance * -1));
|
||||
mpe_settings.slow_feedrate = MMM_TO_MMS(MPE_SLOW_SPEED); // M951 J
|
||||
mpe_settings.fast_feedrate = MMM_TO_MMS(MPE_FAST_SPEED); // M951 H
|
||||
mpe_settings.travel_distance = MPE_TRAVEL_DISTANCE; // M951 D
|
||||
|
@ -61,9 +59,7 @@ void GcodeSuite::M951() {
|
|||
if (parser.seenval('R')) mpe_settings.parking_xpos[1] = parser.value_linear_units();
|
||||
if (parser.seenval('I')) {
|
||||
mpe_settings.grab_distance = parser.value_linear_units();
|
||||
#if HAS_HOME_OFFSET
|
||||
set_home_offset(X_AXIS, mpe_settings.grab_distance * -1);
|
||||
#endif
|
||||
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, mpe_settings.grab_distance * -1));
|
||||
}
|
||||
if (parser.seenval('J')) mpe_settings.slow_feedrate = MMM_TO_MMS(parser.value_linear_units());
|
||||
if (parser.seenval('H')) mpe_settings.fast_feedrate = MMM_TO_MMS(parser.value_linear_units());
|
||||
|
|
|
@ -127,9 +127,7 @@ void GCodeQueue::_commit_command(bool say_ok
|
|||
#if NUM_SERIAL > 1
|
||||
port[index_w] = p;
|
||||
#endif
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.commit_sdpos(index_w);
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.commit_sdpos(index_w));
|
||||
if (++index_w >= BUFSIZE) index_w = 0;
|
||||
length++;
|
||||
}
|
||||
|
@ -522,9 +520,7 @@ void GCodeQueue::get_serial_commands() {
|
|||
// Process critical commands early
|
||||
if (strcmp(command, "M108") == 0) {
|
||||
wait_for_heatup = false;
|
||||
#if HAS_LCD_MENU
|
||||
wait_for_user = false;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, wait_for_user = false);
|
||||
}
|
||||
if (strcmp(command, "M112") == 0) kill(M112_KILL_STR, nullptr, true);
|
||||
if (strcmp(command, "M410") == 0) quickstop_stepper();
|
||||
|
@ -601,9 +597,7 @@ void GCodeQueue::get_available_commands() {
|
|||
|
||||
get_serial_commands();
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
get_sdcard_commands();
|
||||
#endif
|
||||
TERN_(SDSUPPORT, get_sdcard_commands());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,14 +72,10 @@ void GcodeSuite::M1001() {
|
|||
gcode.process_subcommands_now_P(PSTR("M77"));
|
||||
|
||||
// Set the progress bar "done" state
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
ui.set_progress_done();
|
||||
#endif
|
||||
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done());
|
||||
|
||||
// Purge the recovery file
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.purge();
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
|
||||
|
||||
// Announce SD file completion
|
||||
SERIAL_ECHOLNPGM(STR_FILE_PRINTED);
|
||||
|
@ -88,12 +84,8 @@ void GcodeSuite::M1001() {
|
|||
#if HAS_LEDS_OFF_FLAG
|
||||
if (long_print) {
|
||||
printerEventLEDs.onPrintCompleted();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE));
|
||||
#endif
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR));
|
||||
wait_for_user_response(1000UL * TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30));
|
||||
printerEventLEDs.onResumeAfterWait();
|
||||
}
|
||||
|
@ -105,9 +97,7 @@ void GcodeSuite::M1001() {
|
|||
#endif
|
||||
|
||||
// Re-select the last printed file in the UI
|
||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||
ui.reselect_last_file();
|
||||
#endif
|
||||
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
|
|
@ -38,9 +38,7 @@ void GcodeSuite::M23() {
|
|||
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
|
||||
card.openFileRead(parser.string_arg);
|
||||
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
ui.set_progress(0);
|
||||
#endif
|
||||
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(0));
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
|
|
@ -64,18 +64,14 @@ void GcodeSuite::M24() {
|
|||
if (card.isFileOpen()) {
|
||||
card.startFileprint(); // SD card will now be read for commands
|
||||
startOrResumeJob(); // Start (or resume) the print job timer
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.prepare();
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
}
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
#ifdef ACTION_ON_RESUME
|
||||
host_action_resume();
|
||||
#endif
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR));
|
||||
#endif
|
||||
|
||||
ui.reset_status();
|
||||
|
@ -105,9 +101,7 @@ void GcodeSuite::M25() {
|
|||
ui.reset_status();
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));
|
||||
#ifdef ACTION_ON_PAUSE
|
||||
host_action_pause();
|
||||
#endif
|
||||
|
|
|
@ -87,9 +87,7 @@ void GcodeSuite::M104() {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
planner.autotemp_M104_M109();
|
||||
#endif
|
||||
TERN_(AUTOTEMP, planner.autotemp_M104_M109());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,9 +137,7 @@ void GcodeSuite::M109() {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
planner.autotemp_M104_M109();
|
||||
#endif
|
||||
TERN_(AUTOTEMP, planner.autotemp_M104_M109());
|
||||
|
||||
if (set_temp)
|
||||
(void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling);
|
||||
|
|
|
@ -76,9 +76,7 @@ void GcodeSuite::M190() {
|
|||
const bool no_wait_for_cooling = parser.seenval('S');
|
||||
if (no_wait_for_cooling || parser.seenval('R')) {
|
||||
thermalManager.setTargetBed(parser.value_celsius());
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
thermalManager.check_timer_autostart(true, false);
|
||||
#endif
|
||||
TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.check_timer_autostart(true, false));
|
||||
}
|
||||
else return;
|
||||
|
||||
|
|
|
@ -75,9 +75,7 @@ void GcodeSuite::M191() {
|
|||
const bool no_wait_for_cooling = parser.seenval('S');
|
||||
if (no_wait_for_cooling || parser.seenval('R')) {
|
||||
thermalManager.setTargetChamber(parser.value_celsius());
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
thermalManager.check_timer_autostart(true, false);
|
||||
#endif
|
||||
TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.check_timer_autostart(true, false));
|
||||
}
|
||||
else return;
|
||||
|
||||
|
|
|
@ -72,9 +72,7 @@ void GcodeSuite::M303() {
|
|||
const heater_ind_t e = (heater_ind_t)parser.intval('E');
|
||||
if (!WITHIN(e, SI, EI)) {
|
||||
SERIAL_ECHOLNPGM(STR_PID_BAD_EXTRUDER_NUM);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -431,7 +431,9 @@
|
|||
#elif ENABLED(MIXING_EXTRUDER)
|
||||
#define E_STEPPERS MIXING_STEPPERS
|
||||
#define E_MANUAL 1
|
||||
#define DUAL_MIXING_EXTRUDER (MIXING_STEPPERS == 2)
|
||||
#if MIXING_STEPPERS == 2
|
||||
#define HAS_DUAL_MIXING 1
|
||||
#endif
|
||||
#elif ENABLED(SWITCHING_TOOLHEAD)
|
||||
#define E_STEPPERS EXTRUDERS
|
||||
#define E_MANUAL EXTRUDERS
|
||||
|
|
|
@ -399,7 +399,9 @@
|
|||
|
||||
#define ANY_TEMP_SENSOR_IS(n) (TEMP_SENSOR_0 == (n) || TEMP_SENSOR_1 == (n) || TEMP_SENSOR_2 == (n) || TEMP_SENSOR_3 == (n) || TEMP_SENSOR_4 == (n) || TEMP_SENSOR_5 == (n) || TEMP_SENSOR_6 == (n) || TEMP_SENSOR_7 == (n) || TEMP_SENSOR_BED == (n) || TEMP_SENSOR_PROBE == (n) || TEMP_SENSOR_CHAMBER == (n))
|
||||
|
||||
#define HAS_USER_THERMISTORS ANY_TEMP_SENSOR_IS(1000)
|
||||
#if ANY_TEMP_SENSOR_IS(1000)
|
||||
#define HAS_USER_THERMISTORS 1
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
|
||||
#define HEATER_0_USES_MAX6675
|
||||
|
@ -1269,7 +1271,7 @@
|
|||
#define HAS_X_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(X_MS1)
|
||||
#define HAS_X_MICROSTEPS 1
|
||||
#define HAS_X_MS_PINS 1
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(X2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2))
|
||||
|
@ -1282,7 +1284,7 @@
|
|||
#define HAS_X2_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(X2_MS1)
|
||||
#define HAS_X2_MICROSTEPS 1
|
||||
#define HAS_X2_MS_PINS 1
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(Y_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y))
|
||||
|
@ -1295,7 +1297,7 @@
|
|||
#define HAS_Y_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Y_MS1)
|
||||
#define HAS_Y_MICROSTEPS 1
|
||||
#define HAS_Y_MS_PINS 1
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2))
|
||||
|
@ -1308,7 +1310,7 @@
|
|||
#define HAS_Y2_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Y2_MS1)
|
||||
#define HAS_Y2_MICROSTEPS 1
|
||||
#define HAS_Y2_MS_PINS 1
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(Z_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z))
|
||||
|
@ -1321,7 +1323,7 @@
|
|||
#define HAS_Z_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z_MS1)
|
||||
#define HAS_Z_MICROSTEPS 1
|
||||
#define HAS_Z_MS_PINS 1
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(Z2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2))
|
||||
|
@ -1334,7 +1336,7 @@
|
|||
#define HAS_Z2_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z2_MS1)
|
||||
#define HAS_Z2_MICROSTEPS 1
|
||||
#define HAS_Z2_MS_PINS 1
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(Z3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3))
|
||||
|
@ -1347,7 +1349,7 @@
|
|||
#define HAS_Z3_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z3_MS1)
|
||||
#define HAS_Z3_MICROSTEPS 1
|
||||
#define HAS_Z3_MS_PINS 1
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(Z4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z4))
|
||||
|
@ -1360,7 +1362,7 @@
|
|||
#define HAS_Z4_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z4_MS1)
|
||||
#define HAS_Z4_MICROSTEPS 1
|
||||
#define HAS_Z4_MS_PINS 1
|
||||
#endif
|
||||
|
||||
// Extruder steppers and solenoids
|
||||
|
@ -1374,7 +1376,7 @@
|
|||
#define HAS_E0_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(E0_MS1)
|
||||
#define HAS_E0_MICROSTEPS 1
|
||||
#define HAS_E0_MS_PINS 1
|
||||
#endif
|
||||
#if PIN_EXISTS(SOL0)
|
||||
#define HAS_SOLENOID_0 1
|
||||
|
@ -1390,7 +1392,7 @@
|
|||
#define HAS_E1_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(E1_MS1)
|
||||
#define HAS_E1_MICROSTEPS 1
|
||||
#define HAS_E1_MS_PINS 1
|
||||
#endif
|
||||
#if PIN_EXISTS(SOL1)
|
||||
#define HAS_SOLENOID_1 1
|
||||
|
@ -1406,7 +1408,7 @@
|
|||
#define HAS_E2_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(E2_MS1)
|
||||
#define HAS_E2_MICROSTEPS 1
|
||||
#define HAS_E2_MS_PINS 1
|
||||
#endif
|
||||
#if PIN_EXISTS(SOL2)
|
||||
#define HAS_SOLENOID_2 1
|
||||
|
@ -1422,7 +1424,7 @@
|
|||
#define HAS_E3_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(E3_MS1)
|
||||
#define HAS_E3_MICROSTEPS 1
|
||||
#define HAS_E3_MS_PINS 1
|
||||
#endif
|
||||
#if PIN_EXISTS(SOL3)
|
||||
#define HAS_SOLENOID_3 1
|
||||
|
@ -1438,7 +1440,7 @@
|
|||
#define HAS_E4_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(E4_MS1)
|
||||
#define HAS_E4_MICROSTEPS 1
|
||||
#define HAS_E4_MS_PINS 1
|
||||
#endif
|
||||
#if PIN_EXISTS(SOL4)
|
||||
#define HAS_SOLENOID_4 1
|
||||
|
@ -1454,7 +1456,7 @@
|
|||
#define HAS_E5_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(E5_MS1)
|
||||
#define HAS_E5_MICROSTEPS 1
|
||||
#define HAS_E5_MS_PINS 1
|
||||
#endif
|
||||
#if PIN_EXISTS(SOL5)
|
||||
#define HAS_SOLENOID_5 1
|
||||
|
@ -1470,7 +1472,7 @@
|
|||
#define HAS_E6_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(E6_MS1)
|
||||
#define HAS_E6_MICROSTEPS 1
|
||||
#define HAS_E6_MS_PINS 1
|
||||
#endif
|
||||
#if PIN_EXISTS(SOL6)
|
||||
#define HAS_SOLENOID_6 1
|
||||
|
@ -1486,13 +1488,16 @@
|
|||
#define HAS_E7_STEP 1
|
||||
#endif
|
||||
#if PIN_EXISTS(E7_MS1)
|
||||
#define HAS_E7_MICROSTEPS 1
|
||||
#define HAS_E7_MS_PINS 1
|
||||
#endif
|
||||
#if PIN_EXISTS(SOL7)
|
||||
#define HAS_SOLENOID_7 1
|
||||
#endif
|
||||
|
||||
//
|
||||
// Trinamic Stepper Drivers
|
||||
//
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
#if ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
|
||||
#define STEALTHCHOP_ENABLED 1
|
||||
|
@ -1535,10 +1540,15 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define HAS_E_STEPPER_ENABLE (HAS_E_DRIVER(TMC2660) \
|
||||
#if (HAS_E_DRIVER(TMC2660) \
|
||||
|| ( E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != X_ENABLE_PIN \
|
||||
&& E0_ENABLE_PIN != Y_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN ) \
|
||||
)
|
||||
&& E0_ENABLE_PIN != Y_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN ) )
|
||||
#define HAS_E_STEPPER_ENABLE 1
|
||||
#endif
|
||||
|
||||
#if ANY_AXIS_HAS(SW_SERIAL)
|
||||
#define HAS_TMC_SW_SERIAL 1
|
||||
#endif
|
||||
|
||||
//
|
||||
// Endstops and bed probe
|
||||
|
@ -1767,24 +1777,31 @@
|
|||
#define HAS_AUTO_CHAMBER_FAN 1
|
||||
#endif
|
||||
|
||||
#define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_FAN_4 || HAS_AUTO_FAN_5 || HAS_AUTO_FAN_6 || HAS_AUTO_FAN_7 || HAS_AUTO_CHAMBER_FAN)
|
||||
#if HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_FAN_4 || HAS_AUTO_FAN_5 || HAS_AUTO_FAN_6 || HAS_AUTO_FAN_7 || HAS_AUTO_CHAMBER_FAN
|
||||
#define HAS_AUTO_FAN 1
|
||||
#endif
|
||||
#define _FANOVERLAP(A,B) (A##_AUTO_FAN_PIN == E##B##_AUTO_FAN_PIN)
|
||||
#if HAS_AUTO_FAN
|
||||
#define AUTO_CHAMBER_IS_E (_FANOVERLAP(CHAMBER,0) || _FANOVERLAP(CHAMBER,1) || _FANOVERLAP(CHAMBER,2) || _FANOVERLAP(CHAMBER,3) || _FANOVERLAP(CHAMBER,4) || _FANOVERLAP(CHAMBER,5) || _FANOVERLAP(CHAMBER,6) || _FANOVERLAP(CHAMBER,7))
|
||||
#if HAS_AUTO_FAN && (_FANOVERLAP(CHAMBER,0) || _FANOVERLAP(CHAMBER,1) || _FANOVERLAP(CHAMBER,2) || _FANOVERLAP(CHAMBER,3) || _FANOVERLAP(CHAMBER,4) || _FANOVERLAP(CHAMBER,5) || _FANOVERLAP(CHAMBER,6) || _FANOVERLAP(CHAMBER,7))
|
||||
#define AUTO_CHAMBER_IS_E 1
|
||||
#endif
|
||||
|
||||
#if !HAS_TEMP_SENSOR
|
||||
#undef AUTO_REPORT_TEMPERATURES
|
||||
#endif
|
||||
#define HAS_AUTO_REPORTING EITHER(AUTO_REPORT_TEMPERATURES, AUTO_REPORT_SD_STATUS)
|
||||
#if EITHER(AUTO_REPORT_TEMPERATURES, AUTO_REPORT_SD_STATUS)
|
||||
#define HAS_AUTO_REPORTING 1
|
||||
#endif
|
||||
|
||||
#if !HAS_AUTO_CHAMBER_FAN || AUTO_CHAMBER_IS_E
|
||||
#undef AUTO_POWER_CHAMBER_FAN
|
||||
#endif
|
||||
|
||||
// Other fans
|
||||
#define HAS_FAN0 (PIN_EXISTS(FAN))
|
||||
#define _HAS_FAN(P) (PIN_EXISTS(FAN##P) && CONTROLLER_FAN_PIN != FAN##P##_PIN && E0_AUTO_FAN_PIN != FAN##P##_PIN && E1_AUTO_FAN_PIN != FAN##P##_PIN && E2_AUTO_FAN_PIN != FAN##P##_PIN && E3_AUTO_FAN_PIN != FAN##P##_PIN && E4_AUTO_FAN_PIN != FAN##P##_PIN && E5_AUTO_FAN_PIN != FAN##P##_PIN && E6_AUTO_FAN_PIN != FAN##P##_PIN && E7_AUTO_FAN_PIN != FAN##P##_PIN)
|
||||
#if PIN_EXISTS(FAN)
|
||||
#define HAS_FAN0 1
|
||||
#endif
|
||||
#define _NOT_E_AUTO(N,F) (E##N##_AUTO_FAN_PIN != FAN##F##_PIN)
|
||||
#define _HAS_FAN(F) (PIN_EXISTS(FAN##F) && CONTROLLER_FAN_PIN != FAN##F##_PIN && _NOT_E_AUTO(0,F) && _NOT_E_AUTO(1,F) && _NOT_E_AUTO(2,F) && _NOT_E_AUTO(3,F) && _NOT_E_AUTO(4,F) && _NOT_E_AUTO(5,F) && _NOT_E_AUTO(6,F) && _NOT_E_AUTO(7,F))
|
||||
#if _HAS_FAN(1)
|
||||
#define HAS_FAN1 1
|
||||
#endif
|
||||
|
@ -1806,6 +1823,8 @@
|
|||
#if _HAS_FAN(7)
|
||||
#define HAS_FAN7 1
|
||||
#endif
|
||||
#undef _NOT_E_AUTO
|
||||
#undef _HAS_FAN
|
||||
#if PIN_EXISTS(CONTROLLER_FAN)
|
||||
#define HAS_CONTROLLER_FAN 1
|
||||
#endif
|
||||
|
@ -1866,13 +1885,13 @@
|
|||
#define HAS_MOTOR_CURRENT_PWM 1
|
||||
#endif
|
||||
|
||||
#if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_Z4_MICROSTEPS
|
||||
#define HAS_SOME_Z_MICROSTEPS 1
|
||||
#if HAS_Z_MS_PINS || HAS_Z2_MS_PINS || HAS_Z3_MS_PINS || HAS_Z4_MS_PINS
|
||||
#define HAS_SOME_Z_MS_PINS 1
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS || HAS_E6_MICROSTEPS || HAS_E7_MICROSTEPS
|
||||
#define HAS_SOME_E_MICROSTEPS 1
|
||||
#if HAS_E0_MS_PINS || HAS_E1_MS_PINS || HAS_E2_MS_PINS || HAS_E3_MS_PINS || HAS_E4_MS_PINS || HAS_E5_MS_PINS || HAS_E6_MS_PINS || HAS_E7_MS_PINS
|
||||
#define HAS_SOME_E_MS_PINS 1
|
||||
#endif
|
||||
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_SOME_Z_MICROSTEPS || HAS_SOME_E_MICROSTEPS
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS || HAS_Y_MS_PINS || HAS_Y2_MS_PINS || HAS_SOME_Z_MICROSTEPS || HAS_SOME_E_MS_PINS
|
||||
#define HAS_MICROSTEPS 1
|
||||
#endif
|
||||
|
||||
|
@ -2071,7 +2090,9 @@
|
|||
/**
|
||||
* Part Cooling fan multipliexer
|
||||
*/
|
||||
#define HAS_FANMUX PIN_EXISTS(FANMUX0)
|
||||
#if PIN_EXISTS(FANMUX0)
|
||||
#define HAS_FANMUX 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MIN/MAX fan PWM scaling
|
||||
|
|
|
@ -2124,6 +2124,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
|||
#undef IS_EXTUI
|
||||
#undef IS_ULTIPANEL
|
||||
|
||||
#if 1 < ENABLED(LCD_SCREEN_ROT_0) + ENABLED(LCD_SCREEN_ROT_90) + ENABLED(LCD_SCREEN_ROT_180) + ENABLED(LCD_SCREEN_ROT_270)
|
||||
#error "Please enable only one LCD_SCREEN_ROT_* option: 0, 90, 180, or 270."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* FYSETC Mini 12864 RGB backlighting required
|
||||
*/
|
||||
|
|
|
@ -802,7 +802,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
#else // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED)
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
#if HAS_DUAL_MIXING
|
||||
|
||||
// Two-component mix / gradient instead of XY
|
||||
|
||||
|
@ -822,13 +822,9 @@ void MarlinUI::draw_status_screen() {
|
|||
sprintf_P(mixer_messages, PSTR("%s %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
|
||||
lcd_put_u8str(mixer_messages);
|
||||
|
||||
#else // !DUAL_MIXING_EXTRUDER
|
||||
#else // !HAS_DUAL_MIXING
|
||||
|
||||
if (true
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
&& !printingIsActive()
|
||||
#endif
|
||||
) {
|
||||
if (TERN1(LCD_SHOW_E_TOTAL, !printingIsActive())) {
|
||||
const xy_pos_t lpos = current_position.asLogical();
|
||||
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
|
||||
lcd_put_wchar(' ');
|
||||
|
@ -843,7 +839,7 @@ void MarlinUI::draw_status_screen() {
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // !DUAL_MIXING_EXTRUDER
|
||||
#endif // !HAS_DUAL_MIXING
|
||||
|
||||
#endif // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED)
|
||||
|
||||
|
@ -1073,46 +1069,22 @@ void MarlinUI::draw_status_screen() {
|
|||
static uint8_t ledsprev = 0;
|
||||
uint8_t leds = 0;
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
if (thermalManager.degTargetBed() > 0) leds |= LED_A;
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND
|
||||
if (thermalManager.degTargetHotend(0) > 0) leds |= LED_B;
|
||||
#endif
|
||||
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0)) leds |= LED_A;
|
||||
if (TERN0(HAS_HOTEND, thermalManager.degTargetHotend(0) > 0)) leds |= LED_B;
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
if (0
|
||||
#if HAS_FAN0
|
||||
|| thermalManager.fan_speed[0]
|
||||
#endif
|
||||
#if HAS_FAN1
|
||||
|| thermalManager.fan_speed[1]
|
||||
#endif
|
||||
#if HAS_FAN2
|
||||
|| thermalManager.fan_speed[2]
|
||||
#endif
|
||||
#if HAS_FAN3
|
||||
|| thermalManager.fan_speed[3]
|
||||
#endif
|
||||
#if HAS_FAN4
|
||||
|| thermalManager.fan_speed[4]
|
||||
#endif
|
||||
#if HAS_FAN5
|
||||
|| thermalManager.fan_speed[5]
|
||||
#endif
|
||||
#if HAS_FAN6
|
||||
|| thermalManager.fan_speed[6]
|
||||
#endif
|
||||
#if HAS_FAN7
|
||||
|| thermalManager.fan_speed[7]
|
||||
#endif
|
||||
if ( TERN0(HAS_FAN0, thermalManager.fan_speed[0])
|
||||
|| TERN0(HAS_FAN1, thermalManager.fan_speed[1])
|
||||
|| TERN0(HAS_FAN2, thermalManager.fan_speed[2])
|
||||
|| TERN0(HAS_FAN3, thermalManager.fan_speed[3])
|
||||
|| TERN0(HAS_FAN4, thermalManager.fan_speed[4])
|
||||
|| TERN0(HAS_FAN5, thermalManager.fan_speed[5])
|
||||
|| TERN0(HAS_FAN6, thermalManager.fan_speed[6])
|
||||
|| TERN0(HAS_FAN7, thermalManager.fan_speed[7])
|
||||
) leds |= LED_C;
|
||||
#endif // FAN_COUNT > 0
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
if (thermalManager.degTargetHotend(1) > 0) leds |= LED_C;
|
||||
#endif
|
||||
if (TERN0(HAS_MULTI_HOTEND, thermalManager.degTargetHotend(1) > 0)) leds |= LED_C;
|
||||
|
||||
if (leds != ledsprev) {
|
||||
lcd.setBacklight(leds);
|
||||
|
|
|
@ -1731,16 +1731,36 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define DO_DRAW_LOGO (STATUS_LOGO_WIDTH && ENABLED(CUSTOM_STATUS_SCREEN_IMAGE))
|
||||
#define DO_DRAW_HOTENDS (HOTENDS > 0)
|
||||
#define DO_DRAW_BED (HAS_HEATED_BED && HOTENDS <= 4)
|
||||
#define DO_DRAW_CUTTER (HAS_CUTTER && !DO_DRAW_BED)
|
||||
#define DO_DRAW_CHAMBER (HAS_TEMP_CHAMBER && STATUS_CHAMBER_WIDTH && HOTENDS <= 4)
|
||||
#define DO_DRAW_FAN (HAS_FAN0 && STATUS_FAN_WIDTH && HOTENDS <= 4 && defined(STATUS_FAN_FRAMES))
|
||||
|
||||
#define ANIM_HOTEND (HOTENDS && ENABLED(STATUS_HOTEND_ANIM))
|
||||
#define ANIM_BED (DO_DRAW_BED && ENABLED(STATUS_BED_ANIM))
|
||||
#define ANIM_CHAMBER (DO_DRAW_CHAMBER && ENABLED(STATUS_CHAMBER_ANIM))
|
||||
#define ANIM_CUTTER (DO_DRAW_CUTTER && ENABLED(STATUS_CUTTER_ANIM))
|
||||
|
||||
#define ANIM_HBCC (ANIM_HOTEND || ANIM_BED || ANIM_CHAMBER || ANIM_CUTTER)
|
||||
#if STATUS_LOGO_WIDTH && ENABLED(CUSTOM_STATUS_SCREEN_IMAGE)
|
||||
#define DO_DRAW_LOGO 1
|
||||
#endif
|
||||
#if HOTENDS > 0
|
||||
#define DO_DRAW_HOTENDS 1
|
||||
#endif
|
||||
#if HAS_HEATED_BED && HOTENDS <= 4
|
||||
#define DO_DRAW_BED 1
|
||||
#endif
|
||||
#if HAS_CUTTER && !DO_DRAW_BED
|
||||
#define DO_DRAW_CUTTER 1
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER && STATUS_CHAMBER_WIDTH && HOTENDS <= 4
|
||||
#define DO_DRAW_CHAMBER 1
|
||||
#endif
|
||||
#if HAS_FAN0 && STATUS_FAN_WIDTH && HOTENDS <= 4 && defined(STATUS_FAN_FRAMES)
|
||||
#define DO_DRAW_FAN 1
|
||||
#endif
|
||||
#if HOTENDS && ENABLED(STATUS_HOTEND_ANIM)
|
||||
#define ANIM_HOTEND 1
|
||||
#endif
|
||||
#if DO_DRAW_BED && ENABLED(STATUS_BED_ANIM)
|
||||
#define ANIM_BED 1
|
||||
#endif
|
||||
#if DO_DRAW_CHAMBER && ENABLED(STATUS_CHAMBER_ANIM)
|
||||
#define ANIM_CHAMBER 1
|
||||
#endif
|
||||
#if DO_DRAW_CUTTER && ENABLED(STATUS_CUTTER_ANIM)
|
||||
#define ANIM_CUTTER 1
|
||||
#endif
|
||||
#if ANIM_HOTEND || ANIM_BED || ANIM_CHAMBER || ANIM_CUTTER
|
||||
#define ANIM_HBCC 1
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "../../module/printcounter.h"
|
||||
#endif
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
#if HAS_DUAL_MIXING
|
||||
#include "../../feature/mixing.h"
|
||||
#endif
|
||||
|
||||
|
@ -365,15 +365,11 @@ void MarlinUI::draw_status_screen() {
|
|||
#if ANIM_HOTEND
|
||||
HOTEND_LOOP() if (thermalManager.isHeatingHotend(e)) SBI(new_bits, HEATBIT_HOTEND + e);
|
||||
#endif
|
||||
#if ANIM_BED
|
||||
if (thermalManager.isHeatingBed()) SBI(new_bits, HEATBIT_BED);
|
||||
#endif
|
||||
if (TERN0(ANIM_BED, thermalManager.isHeatingBed())) SBI(new_bits, HEATBIT_BED);
|
||||
#if DO_DRAW_CHAMBER && HAS_HEATED_CHAMBER
|
||||
if (thermalManager.isHeatingChamber()) SBI(new_bits, HEATBIT_CHAMBER);
|
||||
#endif
|
||||
#if ANIM_CUTTER
|
||||
if (cutter.enabled()) SBI(new_bits, HEATBIT_CUTTER);
|
||||
#endif
|
||||
if (TERN0(ANIM_CUTTER, cutter.enabled())) SBI(new_bits, HEATBIT_CUTTER);
|
||||
heat_bits = new_bits;
|
||||
#endif
|
||||
|
||||
|
@ -555,14 +551,10 @@ void MarlinUI::draw_status_screen() {
|
|||
#endif
|
||||
|
||||
// Heated Bed
|
||||
#if DO_DRAW_BED
|
||||
_draw_bed_status(blink);
|
||||
#endif
|
||||
TERN_(DO_DRAW_BED, _draw_bed_status(blink));
|
||||
|
||||
// Heated Chamber
|
||||
#if DO_DRAW_CHAMBER
|
||||
_draw_chamber_status();
|
||||
#endif
|
||||
TERN_(DO_DRAW_CHAMBER, _draw_chamber_status());
|
||||
|
||||
// Fan, if a bitmap was provided
|
||||
#if DO_DRAW_FAN
|
||||
|
@ -695,7 +687,7 @@ void MarlinUI::draw_status_screen() {
|
|||
u8g.setColorIndex(0); // white on black
|
||||
#endif
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
#if HAS_DUAL_MIXING
|
||||
|
||||
// Two-component mix / gradient instead of XY
|
||||
|
||||
|
|
|
@ -537,14 +537,9 @@ void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool
|
|||
static struct {
|
||||
bool E1_show_target : 1;
|
||||
bool E2_show_target : 1;
|
||||
#if HAS_HEATED_BED
|
||||
bool bed_show_target : 1;
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, bool bed_show_target : 1);
|
||||
} display_state = {
|
||||
true, true
|
||||
#if HAS_HEATED_BED
|
||||
, true
|
||||
#endif
|
||||
true, true, TERN_(HAS_HEATED_BED, true)
|
||||
};
|
||||
|
||||
void ST7920_Lite_Status_Screen::draw_temps(uint8_t line, const int16_t temp, const int16_t target, bool showTarget, bool targetStateChange) {
|
||||
|
@ -672,11 +667,7 @@ void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool
|
|||
// If position is unknown, flash the labels.
|
||||
const unsigned char alt_label = position_known ? 0 : (ui.get_blink() ? ' ' : 0);
|
||||
|
||||
if (true
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
&& !printingIsActive()
|
||||
#endif
|
||||
) {
|
||||
if (TERN1(LCD_SHOW_E_TOTAL, !printingIsActive())) {
|
||||
write_byte(alt_label ? alt_label : 'X');
|
||||
write_str(dtostrf(pos.x, -4, 0, str), 4);
|
||||
|
||||
|
@ -712,13 +703,8 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
|
|||
#endif
|
||||
static uint16_t last_checksum = 0;
|
||||
const uint16_t checksum = blink ^ feedrate_perc ^ fs ^ extruder_1_target
|
||||
#if HOTENDS > 1
|
||||
^ extruder_2_target
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
^ bed_target
|
||||
#endif
|
||||
;
|
||||
^ TERN0(HAS_MULTI_HOTEND, extruder_2_target)
|
||||
^ TERN0(HAS_HEATED_BED, bed_target);
|
||||
if (last_checksum == checksum) return false;
|
||||
last_checksum = checksum;
|
||||
return true;
|
||||
|
@ -741,12 +727,8 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
|
|||
#endif
|
||||
|
||||
draw_extruder_1_temp(extruder_1_temp, extruder_1_target, forceUpdate);
|
||||
#if HAS_MULTI_HOTEND
|
||||
draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate);
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
draw_bed_temp(bed_temp, bed_target, forceUpdate);
|
||||
#endif
|
||||
TERN_(HAS_MULTI_HOTEND, draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate));
|
||||
TERN_(HAS_HEATED_BED, draw_bed_temp(bed_temp, bed_target, forceUpdate));
|
||||
|
||||
uint16_t spd = thermalManager.fan_speed[0];
|
||||
|
||||
|
@ -761,9 +743,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
|
|||
|
||||
// Update the fan and bed animations
|
||||
if (spd) draw_fan_icon(blink);
|
||||
#if HAS_HEATED_BED
|
||||
draw_heat_icon(bed_target > 0 && blink, bed_target > 0);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, draw_heat_icon(bed_target > 0 && blink, bed_target > 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -813,9 +793,7 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) {
|
|||
* If STATUS_EXPIRE_SECONDS is zero, only the status is shown.
|
||||
*/
|
||||
if (forceUpdate || status_changed()) {
|
||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||
ui.status_scroll_offset = 0;
|
||||
#endif
|
||||
TERN_(STATUS_MESSAGE_SCROLLING, ui.status_scroll_offset = 0);
|
||||
#if STATUS_EXPIRE_SECONDS
|
||||
countdown = ui.status_message[0] ? STATUS_EXPIRE_SECONDS : 0;
|
||||
#endif
|
||||
|
@ -823,26 +801,20 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) {
|
|||
blink_changed(); // Clear changed flag
|
||||
}
|
||||
#if !STATUS_EXPIRE_SECONDS
|
||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||
else if (blink_changed())
|
||||
draw_status_message();
|
||||
#endif
|
||||
else if (TERN0(STATUS_MESSAGE_SCROLLING, blink_changed()))
|
||||
draw_status_message();
|
||||
#else
|
||||
else if (blink_changed()) {
|
||||
if (countdown > 1) {
|
||||
countdown--;
|
||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||
draw_status_message();
|
||||
#endif
|
||||
TERN_(STATUS_MESSAGE_SCROLLING, draw_status_message());
|
||||
}
|
||||
else if (countdown > 0) {
|
||||
if (position_changed()) {
|
||||
countdown--;
|
||||
forceUpdate = true;
|
||||
}
|
||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||
draw_status_message();
|
||||
#endif
|
||||
TERN_(STATUS_MESSAGE_SCROLLING, draw_status_message());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -227,9 +227,7 @@ bool MarlinUI::detected() { return true; }
|
|||
}
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
||||
show_custom_bootscreen();
|
||||
#endif
|
||||
TERN_(SHOW_CUSTOM_BOOTSCREEN, show_custom_bootscreen());
|
||||
show_marlin_bootscreen();
|
||||
}
|
||||
|
||||
|
@ -267,17 +265,11 @@ void MarlinUI::init_lcd() {
|
|||
WRITE(LCD_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_CONTRAST
|
||||
refresh_contrast();
|
||||
#endif
|
||||
TERN_(HAS_LCD_CONTRAST, refresh_contrast());
|
||||
|
||||
#if ENABLED(LCD_SCREEN_ROT_90)
|
||||
u8g.setRot90();
|
||||
#elif ENABLED(LCD_SCREEN_ROT_180)
|
||||
u8g.setRot180();
|
||||
#elif ENABLED(LCD_SCREEN_ROT_270)
|
||||
u8g.setRot270();
|
||||
#endif
|
||||
TERN_(LCD_SCREEN_ROT_90, u8g.setRot90());
|
||||
TERN_(LCD_SCREEN_ROT_180, u8g.setRot180());
|
||||
TERN_(LCD_SCREEN_ROT_270, u8g.setRot270());
|
||||
|
||||
#endif // !MKS_LCD12864B
|
||||
|
||||
|
@ -286,9 +278,7 @@ void MarlinUI::init_lcd() {
|
|||
|
||||
// The kill screen is displayed for unrecoverable conditions
|
||||
void MarlinUI::draw_kill_screen() {
|
||||
#if ENABLED(LIGHTWEIGHT_UI)
|
||||
ST7920_Lite_Status_Screen::clear_text_buffer();
|
||||
#endif
|
||||
TERN_(LIGHTWEIGHT_UI, ST7920_Lite_Status_Screen::clear_text_buffer());
|
||||
const u8g_uint_t h4 = u8g.getHeight() / 4;
|
||||
u8g.firstPage();
|
||||
do {
|
||||
|
|
|
@ -734,9 +734,7 @@ void DGUSScreenVariableHandler::HandleSettings(DGUS_VP_Variable &var, void *val_
|
|||
switch (value) {
|
||||
default: break;
|
||||
case 1:
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
print_job_timer.initStats();
|
||||
#endif
|
||||
TERN_(PRINTCOUNTER, print_job_timer.initStats());
|
||||
queue.enqueue_now_P(PSTR("M502\nM500"));
|
||||
break;
|
||||
case 2: queue.enqueue_now_P(PSTR("M501")); break;
|
||||
|
@ -958,17 +956,13 @@ void DGUSScreenVariableHandler::HandleHeaterControl(DGUS_VP_Variable &var, void
|
|||
#if HOTENDS >= 1
|
||||
case VP_E0_BED_PREHEAT:
|
||||
thermalManager.setTargetHotend(e_temp, 0);
|
||||
#if HAS_HEATED_BED
|
||||
thermalManager.setTargetBed(bed_temp);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
|
||||
break;
|
||||
#endif
|
||||
#if HOTENDS >= 2
|
||||
case VP_E1_BED_PREHEAT:
|
||||
thermalManager.setTargetHotend(e_temp, 1);
|
||||
#if HAS_HEATED_BED
|
||||
thermalManager.setTargetBed(bed_temp);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -1002,9 +996,7 @@ void DGUSScreenVariableHandler::HandleHeaterControl(DGUS_VP_Variable &var, void
|
|||
#endif
|
||||
break;
|
||||
case 1: // Load ABS
|
||||
#if ENABLED(PREHEAT_2_TEMP_HOTEND)
|
||||
e_temp = PREHEAT_2_TEMP_HOTEND;
|
||||
#endif
|
||||
TERN_(PREHEAT_2_TEMP_HOTEND, e_temp = PREHEAT_2_TEMP_HOTEND);
|
||||
break;
|
||||
case 2: // Load PET
|
||||
#ifdef PREHEAT_3_TEMP_HOTEND
|
||||
|
@ -1227,9 +1219,8 @@ bool DGUSScreenVariableHandler::loop() {
|
|||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool booted = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
if (!booted && recovery.valid()) booted = true;
|
||||
#endif
|
||||
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
|
||||
booted = true;
|
||||
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
|
||||
booted = true;
|
||||
GotoScreen(DGUSLCD_SCREEN_MAIN);
|
||||
|
|
|
@ -453,9 +453,7 @@ bool UIFlashStorage::is_present = false;
|
|||
if (nBytes != write_page_size)
|
||||
break;
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::yield();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::yield());
|
||||
}
|
||||
|
||||
SERIAL_ECHOLNPGM("DONE");
|
||||
|
@ -493,9 +491,7 @@ bool UIFlashStorage::is_present = false;
|
|||
|
||||
addr += nBytes;
|
||||
if (nBytes != write_page_size) break;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::yield();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::yield());
|
||||
};
|
||||
|
||||
if (verifyOk) {
|
||||
|
|
|
@ -922,9 +922,8 @@ template <class T> bool CLCD::CommandFifo::_write_unaligned(T data, uint16_t len
|
|||
uint32_t command_read_ptr;
|
||||
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
if (command_write_ptr == 0xFFFFFFFFul) {
|
||||
SERIAL_ECHO_MSG("Attempt to write to FIFO before CommandFifo::Cmd_Start().");
|
||||
}
|
||||
if (command_write_ptr == 0xFFFFFFFFul)
|
||||
SERIAL_ECHO_MSG("Attempt to write to FIFO before CommandFifo::Cmd_Start().");
|
||||
#endif
|
||||
|
||||
/* Wait until there is enough space in the circular buffer for the transfer */
|
||||
|
@ -1160,24 +1159,15 @@ void CLCD::default_display_orientation() {
|
|||
// processor to do this since it will also update the transform matrices.
|
||||
if (FTDI::ftdi_chip >= 810) {
|
||||
CommandFifo cmd;
|
||||
cmd.setrotate(0
|
||||
#if ENABLED(TOUCH_UI_MIRRORED)
|
||||
+ 4
|
||||
#endif
|
||||
#if ENABLED(TOUCH_UI_PORTRAIT)
|
||||
+ 2
|
||||
#endif
|
||||
#if ENABLED(TOUCH_UI_INVERTED)
|
||||
+ 1
|
||||
#endif
|
||||
cmd.setrotate(
|
||||
ENABLED(TOUCH_UI_MIRRORED) * 4
|
||||
+ ENABLED(TOUCH_UI_PORTRAIT) * 2
|
||||
+ ENABLED(TOUCH_UI_INVERTED) * 1
|
||||
);
|
||||
cmd.execute();
|
||||
}
|
||||
else {
|
||||
#if ENABLED(TOUCH_UI_INVERTED)
|
||||
mem_write_32(REG::ROTATE, 1);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
TERN_(TOUCH_UI_INVERTED, mem_write_32(REG::ROTATE, 1));
|
||||
#elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED)
|
||||
#error "PORTRAIT or MIRRORED orientation not supported on the FT800."
|
||||
#elif ENABLED(TOUCH_UI_INVERTED)
|
||||
|
|
|
@ -206,14 +206,58 @@
|
|||
|
||||
// Define macros for compatibility
|
||||
|
||||
#define _CAT(a, ...) a ## __VA_ARGS__
|
||||
#define SWITCH_ENABLED_ 1
|
||||
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
|
||||
#define DISABLED(b) !ENABLED(b)
|
||||
#define ANY(A,B) (ENABLED(A) || ENABLED(B))
|
||||
#define EITHER(A,B) (ENABLED(A) || ENABLED(B))
|
||||
#define BOTH(A,B) (ENABLED(A) && ENABLED(B))
|
||||
#define NONE(A,B) (DISABLED(A) && DISABLED(B))
|
||||
#define _CAT(a,V...) a##V
|
||||
#define CAT(a,V...) _CAT(a,V)
|
||||
|
||||
#define FIRST(a,...) a
|
||||
#define SECOND(a,b,...) b
|
||||
#define THIRD(a,b,c,...) c
|
||||
|
||||
#define IS_PROBE(V...) SECOND(V, 0) // Get the second item passed, or 0
|
||||
#define PROBE() ~, 1 // Second item will be 1 if this is passed
|
||||
#define _NOT_0 PROBE()
|
||||
#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'.
|
||||
#define _BOOL(x) NOT(NOT(x)) // NOT('0') gets '0'. Anything else gets '1'.
|
||||
|
||||
#define _DO_1(W,C,A) (_##W##_1(A))
|
||||
#define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B))
|
||||
#define _DO_3(W,C,A,V...) (_##W##_1(A) C _DO_2(W,C,V))
|
||||
#define _DO_4(W,C,A,V...) (_##W##_1(A) C _DO_3(W,C,V))
|
||||
#define _DO_5(W,C,A,V...) (_##W##_1(A) C _DO_4(W,C,V))
|
||||
#define _DO_6(W,C,A,V...) (_##W##_1(A) C _DO_5(W,C,V))
|
||||
#define _DO_7(W,C,A,V...) (_##W##_1(A) C _DO_6(W,C,V))
|
||||
#define _DO_8(W,C,A,V...) (_##W##_1(A) C _DO_7(W,C,V))
|
||||
#define _DO_9(W,C,A,V...) (_##W##_1(A) C _DO_8(W,C,V))
|
||||
#define _DO_10(W,C,A,V...) (_##W##_1(A) C _DO_9(W,C,V))
|
||||
#define _DO_11(W,C,A,V...) (_##W##_1(A) C _DO_10(W,C,V))
|
||||
#define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V))
|
||||
#define __DO_N(W,C,N,V...) _DO_##N(W,C,V)
|
||||
#define _DO_N(W,C,N,V...) __DO_N(W,C,N,V)
|
||||
#define DO(W,C,V...) _DO_N(W,C,NUM_ARGS(V),V)
|
||||
|
||||
#define _ISENA_ ~,1
|
||||
#define _ISENA_1 ~,1
|
||||
#define _ISENA_0x1 ~,1
|
||||
#define _ISENA_true ~,1
|
||||
#define _ISENA(V...) IS_PROBE(V)
|
||||
#define _ENA_1(O) _ISENA(CAT(_IS,CAT(ENA_, O)))
|
||||
#define _DIS_1(O) NOT(_ENA_1(O))
|
||||
#define ENABLED(V...) DO(ENA,&&,V)
|
||||
#define DISABLED(V...) DO(DIS,&&,V)
|
||||
|
||||
#define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION converted to '0' or '1'
|
||||
#define TERN0(O,A) _TERN(_ENA_1(O),0,A) // OPTION converted to A or '0'
|
||||
#define TERN1(O,A) _TERN(_ENA_1(O),1,A) // OPTION converted to A or '1'
|
||||
#define TERN_(O,A) _TERN(_ENA_1(O),,A) // OPTION converted to A or '<nul>'
|
||||
#define _TERN(E,V...) __TERN(_CAT(T_,E),V) // Prepend 'T_' to get 'T_0' or 'T_1'
|
||||
#define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
|
||||
#define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B.
|
||||
|
||||
#define ANY(V...) !DISABLED(V)
|
||||
#define NONE(V...) DISABLED(V)
|
||||
#define ALL(V...) ENABLED(V)
|
||||
#define BOTH(V1,V2) ALL(V1,V2)
|
||||
#define EITHER(V1,V2) ANY(V1,V2)
|
||||
|
||||
// Remove compiler warning on an unused variable
|
||||
#ifndef UNUSED
|
||||
|
|
|
@ -78,9 +78,7 @@ void BaseScreen::onIdle() {
|
|||
}
|
||||
|
||||
void BaseScreen::reset_menu_timeout() {
|
||||
#if LCD_TIMEOUT_TO_STATUS
|
||||
last_interaction = millis();
|
||||
#endif
|
||||
TERN_(LCD_TIMEOUT_TO_STATUS, last_interaction = millis());
|
||||
}
|
||||
|
||||
#if LCD_TIMEOUT_TO_STATUS
|
||||
|
|
|
@ -198,16 +198,14 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
|
|||
|
||||
void StatusScreen::draw_syringe(draw_mode_t what) {
|
||||
int16_t x, y, h, v;
|
||||
#ifdef E_MAX_POS
|
||||
const float fill_level = 1.0 - min(1.0, max(0.0, getAxisPosition_mm(E0) / E_MAX_POS));
|
||||
#else
|
||||
const float fill_level = 0.75;
|
||||
#endif
|
||||
const bool e_homed = (true
|
||||
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
|
||||
&& isAxisPositionKnown(E0)
|
||||
const float fill_level = (
|
||||
#ifdef E_MAX_POS
|
||||
1.0 - min(1.0, max(0.0, getAxisPosition_mm(E0) / E_MAX_POS))
|
||||
#else
|
||||
0.75
|
||||
#endif
|
||||
);
|
||||
const bool e_homed = TERN0(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0));
|
||||
|
||||
CommandProcessor cmd;
|
||||
PolyUI ui(cmd, what);
|
||||
|
@ -237,12 +235,8 @@ void StatusScreen::draw_syringe(draw_mode_t what) {
|
|||
}
|
||||
|
||||
void StatusScreen::draw_arrows(draw_mode_t what) {
|
||||
const bool e_homed = (true
|
||||
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
|
||||
&& isAxisPositionKnown(E0)
|
||||
#endif
|
||||
);
|
||||
const bool z_homed = isAxisPositionKnown(Z);
|
||||
const bool e_homed = TERN1(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0)),
|
||||
z_homed = isAxisPositionKnown(Z);
|
||||
|
||||
CommandProcessor cmd;
|
||||
PolyUI ui(cmd, what);
|
||||
|
@ -299,12 +293,8 @@ void StatusScreen::draw_fine_motion(draw_mode_t what) {
|
|||
}
|
||||
|
||||
void StatusScreen::draw_overlay_icons(draw_mode_t what) {
|
||||
const bool e_homed = (true
|
||||
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
|
||||
&& isAxisPositionKnown(E0)
|
||||
#endif
|
||||
);
|
||||
const bool z_homed = isAxisPositionKnown(Z);
|
||||
const bool e_homed = TERN1(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0)),
|
||||
z_homed = isAxisPositionKnown(Z);
|
||||
|
||||
CommandProcessor cmd;
|
||||
PolyUI ui(cmd, what);
|
||||
|
|
|
@ -50,11 +50,7 @@ void TuneMenu::onRedraw(draw_mode_t what) {
|
|||
.font(font_medium)
|
||||
.enabled( isPrinting()).tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_SPEED))
|
||||
.tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_BED_TEMPERATURE))
|
||||
.enabled(
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
true
|
||||
#endif
|
||||
)
|
||||
.enabled(TERN_(BABYSTEPPING, true))
|
||||
.tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_NUDGE_NOZZLE))
|
||||
.enabled(!isPrinting()).tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_MOVE_TO_HOME))
|
||||
.enabled(!isPrinting()).tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_RAISE_PLUNGER))
|
||||
|
|
|
@ -89,11 +89,7 @@ void FilesScreen::drawFileButton(const char* filename, uint8_t tag, bool is_dir,
|
|||
cmd.cmd(MACRO(0));
|
||||
}
|
||||
#endif
|
||||
cmd.text (BTN_POS(1,header_h+line), BTN_SIZE(6,1), filename, OPT_CENTERY
|
||||
#if ENABLED(SCROLL_LONG_FILENAMES)
|
||||
| OPT_NOFIT
|
||||
#endif
|
||||
);
|
||||
cmd.text (BTN_POS(1,header_h+line), BTN_SIZE(6,1), filename, OPT_CENTERY | TERN0(SCROLL_LONG_FILENAMES, OPT_NOFIT));
|
||||
if (is_dir) {
|
||||
cmd.text(BTN_POS(1,header_h+line), BTN_SIZE(6,1), F("> "), OPT_CENTERY | OPT_RIGHTX);
|
||||
}
|
||||
|
|
|
@ -252,9 +252,7 @@ void InterfaceSettingsScreen::loadSettings(const char *buff) {
|
|||
for(uint8_t i = 0; i < InterfaceSoundsScreen::NUM_EVENTS; i++)
|
||||
InterfaceSoundsScreen::event_sounds[i] = eeprom.event_sounds[i];
|
||||
|
||||
#if ENABLED(TOUCH_UI_DEVELOPER_MENU)
|
||||
StressTestScreen::startupCheck();
|
||||
#endif
|
||||
TERN_(TOUCH_UI_DEVELOPER_MENU, StressTestScreen::startupCheck());
|
||||
}
|
||||
|
||||
#ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE
|
||||
|
|
|
@ -97,12 +97,8 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) {
|
|||
case 30:
|
||||
#define _HOTEND_OFF(N) setTargetTemp_celsius(0,E##N);
|
||||
REPEAT(HOTENDS, _HOTEND_OFF);
|
||||
#if HAS_HEATED_BED
|
||||
setTargetTemp_celsius(0,BED);
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
setTargetTemp_celsius(0,CHAMBER);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, setTargetTemp_celsius(0,BED));
|
||||
TERN_(HAS_HEATED_CHAMBER, setTargetTemp_celsius(0,CHAMBER));
|
||||
#if FAN_COUNT > 0
|
||||
setTargetFan_percent(0,FAN0);
|
||||
#endif
|
||||
|
|
|
@ -109,12 +109,8 @@
|
|||
namespace ExtUI {
|
||||
static struct {
|
||||
uint8_t printer_killed : 1;
|
||||
#if ENABLED(JOYSTICK)
|
||||
uint8_t jogging : 1;
|
||||
#endif
|
||||
#if ENABLED(SDSUPPORT)
|
||||
uint8_t was_sd_printing : 1;
|
||||
#endif
|
||||
TERN_(JOYSTICK, uint8_t jogging : 1);
|
||||
TERN_(SDSUPPORT, uint8_t was_sd_printing : 1);
|
||||
} flags;
|
||||
|
||||
#ifdef __SAM3X8E__
|
||||
|
@ -192,9 +188,7 @@ namespace ExtUI {
|
|||
case CHAMBER: return; // Chamber has no idle timer
|
||||
#endif
|
||||
default:
|
||||
#if HAS_HOTEND
|
||||
thermalManager.reset_hotend_idle_timer(heater - H0);
|
||||
#endif
|
||||
TERN_(HAS_HOTEND, thermalManager.reset_hotend_idle_timer(heater - H0));
|
||||
break;
|
||||
}
|
||||
#else
|
||||
|
@ -251,9 +245,7 @@ namespace ExtUI {
|
|||
bool isHeaterIdle(const heater_t heater) {
|
||||
#if HEATER_IDLE_HANDLER
|
||||
switch (heater) {
|
||||
#if HAS_HEATED_BED
|
||||
case BED: return thermalManager.bed_idle.timed_out;
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, case BED: return thermalManager.bed_idle.timed_out);
|
||||
#if HAS_HEATED_CHAMBER
|
||||
case CHAMBER: return false; // Chamber has no idle timer
|
||||
#endif
|
||||
|
@ -278,12 +270,8 @@ namespace ExtUI {
|
|||
|
||||
float getActualTemp_celsius(const heater_t heater) {
|
||||
switch (heater) {
|
||||
#if HAS_HEATED_BED
|
||||
case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed());
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber());
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed()));
|
||||
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber()));
|
||||
default: return GET_TEMP_ADJUSTMENT(thermalManager.degHotend(heater - H0));
|
||||
}
|
||||
}
|
||||
|
@ -294,12 +282,8 @@ namespace ExtUI {
|
|||
|
||||
float getTargetTemp_celsius(const heater_t heater) {
|
||||
switch (heater) {
|
||||
#if HAS_HEATED_BED
|
||||
case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed());
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber());
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed()));
|
||||
TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber()));
|
||||
default: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetHotend(heater - H0));
|
||||
}
|
||||
}
|
||||
|
@ -356,28 +340,16 @@ namespace ExtUI {
|
|||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
if (soft_endstops_enabled) switch (axis) {
|
||||
case X_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
|
||||
min = soft_endstop.min.x;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_X)
|
||||
max = soft_endstop.max.x;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_X, min = soft_endstop.min.x);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_X, max = soft_endstop.max.x);
|
||||
break;
|
||||
case Y_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Y)
|
||||
min = soft_endstop.min.y;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Y)
|
||||
max = soft_endstop.max.y;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_Y, min = soft_endstop.min.y);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_Y, max = soft_endstop.max.y);
|
||||
break;
|
||||
case Z_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Z)
|
||||
min = soft_endstop.min.z;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
|
||||
max = soft_endstop.max.z;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_Z, min = soft_endstop.min.z);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_Z, max = soft_endstop.max.z);
|
||||
default: break;
|
||||
}
|
||||
#endif // HAS_SOFTWARE_ENDSTOPS
|
||||
|
@ -541,15 +513,9 @@ namespace ExtUI {
|
|||
|
||||
int getTMCBumpSensitivity(const axis_t axis) {
|
||||
switch (axis) {
|
||||
#if X_SENSORLESS
|
||||
case X: return stepperX.homing_threshold();
|
||||
#endif
|
||||
#if Y_SENSORLESS
|
||||
case Y: return stepperY.homing_threshold();
|
||||
#endif
|
||||
#if Z_SENSORLESS
|
||||
case Z: return stepperZ.homing_threshold();
|
||||
#endif
|
||||
TERN_(X_SENSORLESS, case X: return stepperX.homing_threshold());
|
||||
TERN_(Y_SENSORLESS, case Y: return stepperY.homing_threshold());
|
||||
TERN_(Z_SENSORLESS, case Z: return stepperZ.homing_threshold());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
@ -673,9 +639,7 @@ namespace ExtUI {
|
|||
|
||||
void setJunctionDeviation_mm(const float value) {
|
||||
planner.junction_deviation_mm = constrain(value, 0.01, 0.3);
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
planner.recalculate_max_e_jerk();
|
||||
#endif
|
||||
TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk());
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -871,9 +835,7 @@ namespace ExtUI {
|
|||
void setMeshPoint(const xy_uint8_t &pos, const float zoff) {
|
||||
if (WITHIN(pos.x, 0, GRID_MAX_POINTS_X) && WITHIN(pos.y, 0, GRID_MAX_POINTS_Y)) {
|
||||
Z_VALUES(pos.x, pos.y) = zoff;
|
||||
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
||||
bed_level_virt_interpolate();
|
||||
#endif
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1020,9 +982,7 @@ namespace ExtUI {
|
|||
}
|
||||
|
||||
void setUserConfirmed() {
|
||||
#if HAS_RESUME_CONTINUE
|
||||
wait_for_user = false;
|
||||
#endif
|
||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
|
||||
}
|
||||
|
||||
void printFile(const char *filename) {
|
||||
|
|
|
@ -51,21 +51,9 @@ namespace ExtUI {
|
|||
while (!ScreenHandler.loop()); // Wait while anything is left to be sent
|
||||
}
|
||||
|
||||
void onMediaInserted() {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
ScreenHandler.SDCardInserted();
|
||||
#endif
|
||||
}
|
||||
void onMediaError() {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
ScreenHandler.SDCardError();
|
||||
#endif
|
||||
}
|
||||
void onMediaRemoved() {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
ScreenHandler.SDCardRemoved();
|
||||
#endif
|
||||
}
|
||||
void onMediaInserted() { TERN_(SDSUPPORT, ScreenHandler.SDCardInserted()); }
|
||||
void onMediaError() { TERN_(SDSUPPORT, ScreenHandler.SDCardError()); }
|
||||
void onMediaRemoved() { TERN_(SDSUPPORT, ScreenHandler.SDCardRemoved()); }
|
||||
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
|
||||
void onPrintTimerStarted() {}
|
||||
|
|
|
@ -53,18 +53,10 @@
|
|||
|
||||
// Pool game data to save SRAM
|
||||
union MarlinGameData {
|
||||
#if ENABLED(MARLIN_BRICKOUT)
|
||||
brickout_data_t brickout;
|
||||
#endif
|
||||
#if ENABLED(MARLIN_INVADERS)
|
||||
invaders_data_t invaders;
|
||||
#endif
|
||||
#if ENABLED(MARLIN_SNAKE)
|
||||
snake_data_t snake;
|
||||
#endif
|
||||
#if ENABLED(MARLIN_MAZE)
|
||||
maze_data_t maze;
|
||||
#endif
|
||||
TERN_(MARLIN_BRICKOUT, brickout_data_t brickout);
|
||||
TERN_(MARLIN_INVADERS, invaders_data_t invaders);
|
||||
TERN_(MARLIN_SNAKE, snake_data_t snake);
|
||||
TERN_(MARLIN_MAZE, maze_data_t maze);
|
||||
};
|
||||
|
||||
extern MarlinGameData marlin_game_data;
|
||||
|
|
|
@ -141,9 +141,7 @@ void MenuItem_gcode::action(PGM_P const, PGM_P const pgcode) { queue.inject_P(pg
|
|||
* MenuItem_int3::draw(encoderLine == _thisItemNr, _lcdLineNr, plabel, &feedrate_percentage, 10, 999)
|
||||
*/
|
||||
void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
|
||||
#if ENABLED(TOUCH_BUTTONS)
|
||||
ui.repeat_delay = BUTTON_DELAY_EDIT;
|
||||
#endif
|
||||
TERN_(TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
|
||||
if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
|
||||
if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
|
||||
if (ui.should_draw())
|
||||
|
@ -222,13 +220,9 @@ bool printer_busy() {
|
|||
void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) {
|
||||
if (currentScreen != screen) {
|
||||
|
||||
#if ENABLED(TOUCH_BUTTONS)
|
||||
repeat_delay = BUTTON_DELAY_MENU;
|
||||
#endif
|
||||
TERN_(TOUCH_BUTTONS, repeat_delay = BUTTON_DELAY_MENU);
|
||||
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
progress_reset();
|
||||
#endif
|
||||
TERN_(LCD_SET_PROGRESS_MANUALLY, progress_reset());
|
||||
|
||||
#if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING)
|
||||
static millis_t doubleclick_expire_ms = 0;
|
||||
|
@ -275,9 +269,7 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
|
|||
screen_items = items;
|
||||
if (screen == status_screen) {
|
||||
defer_status_screen(false);
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
ubl.lcd_map_control = false;
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_UBL, ubl.lcd_map_control = false);
|
||||
screen_history_depth = 0;
|
||||
}
|
||||
|
||||
|
@ -294,13 +286,9 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
|
|||
|
||||
refresh(LCDVIEW_CALL_REDRAW_NEXT);
|
||||
screen_changed = true;
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
drawing_screen = false;
|
||||
#endif
|
||||
TERN_(HAS_GRAPHICAL_LCD, drawing_screen = false);
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
encoder_direction_normal();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, encoder_direction_normal());
|
||||
|
||||
set_selection(false);
|
||||
}
|
||||
|
@ -400,10 +388,10 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
|
|||
|
||||
babystep.add_steps(Z_AXIS, babystep_increment);
|
||||
|
||||
if (do_probe) probe.offset.z = new_offs;
|
||||
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
|
||||
else hotend_offset[active_extruder].z = new_offs;
|
||||
#endif
|
||||
if (do_probe)
|
||||
probe.offset.z = new_offs;
|
||||
else
|
||||
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
||||
|
||||
ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
|
||||
}
|
||||
|
@ -415,9 +403,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
|
|||
#endif
|
||||
if (do_probe) {
|
||||
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z));
|
||||
#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY)
|
||||
_lcd_zoffset_overlay_gfx(probe.offset.z);
|
||||
#endif
|
||||
TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(probe.offset.z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -427,16 +413,12 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
|
|||
#if ENABLED(EEPROM_SETTINGS)
|
||||
void lcd_store_settings() {
|
||||
const bool saved = settings.save();
|
||||
#if HAS_BUZZER
|
||||
ui.completion_feedback(saved);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, ui.completion_feedback(saved));
|
||||
UNUSED(saved);
|
||||
}
|
||||
void lcd_load_settings() {
|
||||
const bool loaded = settings.load();
|
||||
#if HAS_BUZZER
|
||||
ui.completion_feedback(loaded);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, ui.completion_feedback(loaded));
|
||||
UNUSED(loaded);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -576,9 +576,7 @@ void menu_advanced_settings() {
|
|||
//
|
||||
const bool new_state = !settings.sd_update_status(),
|
||||
didset = settings.set_sd_update_status(new_state);
|
||||
#if HAS_BUZZER
|
||||
ui.completion_feedback(didset);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, ui.completion_feedback(didset));
|
||||
ui.return_to_status();
|
||||
if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status();
|
||||
});
|
||||
|
@ -589,9 +587,7 @@ void menu_advanced_settings() {
|
|||
MSG_BUTTON_INIT, MSG_BUTTON_CANCEL,
|
||||
[]{
|
||||
const bool inited = settings.init_eeprom();
|
||||
#if HAS_BUZZER
|
||||
ui.completion_feedback(inited);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, ui.completion_feedback(inited));
|
||||
UNUSED(inited);
|
||||
},
|
||||
ui.goto_previous_screen,
|
||||
|
|
|
@ -70,11 +70,7 @@ static inline void _lcd_goto_next_corner() {
|
|||
}
|
||||
line_to_current_position(manual_feedrate_mm_s.x);
|
||||
line_to_z(LEVEL_CORNERS_HEIGHT);
|
||||
if (++bed_corner > (3
|
||||
#if ENABLED(LEVEL_CENTER_TOO)
|
||||
+ 1
|
||||
#endif
|
||||
)) bed_corner = 0;
|
||||
if (++bed_corner > 3 + ENABLED(LEVEL_CENTER_TOO)) bed_corner = 0;
|
||||
}
|
||||
|
||||
static inline void _lcd_level_bed_corners_homing() {
|
||||
|
@ -86,9 +82,7 @@ static inline void _lcd_level_bed_corners_homing() {
|
|||
GET_TEXT(MSG_BUTTON_NEXT), GET_TEXT(MSG_BUTTON_DONE),
|
||||
_lcd_goto_next_corner,
|
||||
[]{
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(leveling_was_active);
|
||||
#endif
|
||||
TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active));
|
||||
ui.goto_previous_screen_no_defer();
|
||||
},
|
||||
GET_TEXT(
|
||||
|
|
|
@ -75,9 +75,7 @@
|
|||
ui.synchronize(GET_TEXT(MSG_LEVEL_BED_DONE));
|
||||
#endif
|
||||
ui.goto_previous_screen_no_defer();
|
||||
#if HAS_BUZZER
|
||||
ui.completion_feedback();
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, ui.completion_feedback());
|
||||
}
|
||||
if (ui.should_draw()) MenuItem_static::draw(LCD_HEIGHT >= 4, GET_TEXT(MSG_LEVEL_BED_DONE));
|
||||
ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
|
||||
|
|
|
@ -44,9 +44,7 @@ static void lcd_cancel_object_confirm() {
|
|||
MenuItem_confirm::confirm_screen(
|
||||
[]{
|
||||
cancelable.cancel_object(MenuItemBase::itemIndex - 1);
|
||||
#if HAS_BUZZER
|
||||
ui.completion_feedback();
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, ui.completion_feedback());
|
||||
ui.goto_previous_screen();
|
||||
},
|
||||
ui.goto_previous_screen,
|
||||
|
|
|
@ -421,9 +421,7 @@ void menu_configuration() {
|
|||
if (!busy)
|
||||
ACTION_ITEM(MSG_RESTORE_DEFAULTS, []{
|
||||
settings.reset();
|
||||
#if HAS_BUZZER
|
||||
ui.completion_feedback();
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, ui.completion_feedback());
|
||||
});
|
||||
|
||||
END_MENU();
|
||||
|
|
|
@ -42,9 +42,7 @@ void _lcd_user_gcode(PGM_P const cmd) {
|
|||
#if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK) && HAS_BUZZER
|
||||
ui.completion_feedback();
|
||||
#endif
|
||||
#if ENABLED(USER_SCRIPT_RETURN)
|
||||
ui.return_to_status();
|
||||
#endif
|
||||
TERN_(USER_SCRIPT_RETURN, ui.return_to_status());
|
||||
}
|
||||
|
||||
void menu_user() {
|
||||
|
|
|
@ -62,12 +62,8 @@ void _man_probe_pt(const xy_pos_t &xy) {
|
|||
float lcd_probe_pt(const xy_pos_t &xy) {
|
||||
_man_probe_pt(xy);
|
||||
ui.defer_status_screen();
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Delta Calibration in progress"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Delta Calibration in progress")));
|
||||
wait_for_user_response();
|
||||
ui.goto_previous_screen_no_defer();
|
||||
return current_position.z;
|
||||
|
@ -102,9 +98,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
|
|||
|
||||
void lcd_delta_settings() {
|
||||
auto _recalc_delta_settings = []{
|
||||
#if HAS_LEVELING
|
||||
reset_bed_level(); // After changing kinematics bed-level data is no longer valid
|
||||
#endif
|
||||
TERN_(HAS_LEVELING, reset_bed_level()); // After changing kinematics bed-level data is no longer valid
|
||||
recalc_delta_settings();
|
||||
};
|
||||
START_MENU();
|
||||
|
|
|
@ -39,8 +39,12 @@
|
|||
#include "game/game.h"
|
||||
#endif
|
||||
|
||||
#define MACHINE_CAN_STOP (EITHER(SDSUPPORT, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL))
|
||||
#define MACHINE_CAN_PAUSE (ANY(SDSUPPORT, HOST_PROMPT_SUPPORT, PARK_HEAD_ON_PAUSE) || defined(ACTION_ON_PAUSE))
|
||||
#if EITHER(SDSUPPORT, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL)
|
||||
#define MACHINE_CAN_STOP 1
|
||||
#endif
|
||||
#if ANY(SDSUPPORT, HOST_PROMPT_SUPPORT, PARK_HEAD_ON_PAUSE) || defined(ACTION_ON_PAUSE)
|
||||
#define MACHINE_CAN_PAUSE 1
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRUSA_MMU2)
|
||||
#include "../../lcd/menu/menu_mmu2.h"
|
||||
|
@ -140,9 +144,8 @@ void menu_main() {
|
|||
|
||||
#endif // !HAS_ENCODER_WHEEL && SDSUPPORT
|
||||
|
||||
#if MACHINE_CAN_PAUSE
|
||||
if (printingIsPaused()) ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
|
||||
#endif
|
||||
if (TERN0(MACHINE_CAN_PAUSE, printingIsPaused()))
|
||||
ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
|
||||
|
||||
SUBMENU(MSG_MOTION, menu_motion);
|
||||
}
|
||||
|
@ -236,9 +239,7 @@ void menu_main() {
|
|||
#if HAS_SERVICE_INTERVALS
|
||||
static auto _service_reset = [](const int index) {
|
||||
print_job_timer.resetServiceInterval(index);
|
||||
#if HAS_BUZZER
|
||||
ui.completion_feedback();
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, ui.completion_feedback());
|
||||
ui.reset_status();
|
||||
ui.return_to_status();
|
||||
};
|
||||
|
|
|
@ -113,9 +113,7 @@ class MenuItem_sdfolder : public MenuItem_sdbase {
|
|||
encoderTopLine = 0;
|
||||
ui.encoderPosition = 2 * (ENCODER_STEPS_PER_MENU_ITEM);
|
||||
ui.screen_changed = true;
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
ui.drawing_screen = false;
|
||||
#endif
|
||||
TERN_(HAS_GRAPHICAL_LCD, ui.drawing_screen = false);
|
||||
ui.refresh();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "../../feature/mixing.h"
|
||||
|
||||
#define CHANNEL_MIX_EDITING !DUAL_MIXING_EXTRUDER
|
||||
#define CHANNEL_MIX_EDITING !HAS_DUAL_MIXING
|
||||
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
|
||||
|
@ -120,7 +120,7 @@
|
|||
|
||||
static uint8_t v_index;
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
#if HAS_DUAL_MIXING
|
||||
void _lcd_draw_mix(const uint8_t y) {
|
||||
char tmp[20]; // "100%_100%"
|
||||
sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
|
||||
|
@ -131,9 +131,7 @@ static uint8_t v_index;
|
|||
|
||||
void _lcd_mixer_select_vtool() {
|
||||
mixer.T(v_index);
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
_lcd_draw_mix(LCD_HEIGHT - 1);
|
||||
#endif
|
||||
TERN_(HAS_DUAL_MIXING, _lcd_draw_mix(LCD_HEIGHT - 1));
|
||||
}
|
||||
|
||||
#if CHANNEL_MIX_EDITING
|
||||
|
@ -156,7 +154,7 @@ void _lcd_mixer_select_vtool() {
|
|||
|
||||
void lcd_mixer_mix_edit() {
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER && !CHANNEL_MIX_EDITING
|
||||
#if HAS_DUAL_MIXING && !CHANNEL_MIX_EDITING
|
||||
|
||||
// Adjust 2-channel mix from the encoder
|
||||
if (ui.encoderPosition != 0) {
|
||||
|
@ -194,7 +192,7 @@ void lcd_mixer_mix_edit() {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
#if HAS_DUAL_MIXING
|
||||
|
||||
//
|
||||
// Toggle Dual-Mix
|
||||
|
@ -240,12 +238,12 @@ void menu_mixer() {
|
|||
|
||||
v_index = mixer.get_current_vtool();
|
||||
EDIT_ITEM(uint8, MSG_ACTIVE_VTOOL, &v_index, 0, MIXING_VIRTUAL_TOOLS - 1, _lcd_mixer_select_vtool
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
#if HAS_DUAL_MIXING
|
||||
, true
|
||||
#endif
|
||||
);
|
||||
|
||||
#if DUAL_MIXING_EXTRUDER
|
||||
#if HAS_DUAL_MIXING
|
||||
{
|
||||
char tmp[10];
|
||||
SUBMENU(MSG_MIX, lcd_mixer_mix_edit);
|
||||
|
|
|
@ -86,28 +86,16 @@ static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) {
|
|||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
if (soft_endstops_enabled) switch (axis) {
|
||||
case X_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
|
||||
min = soft_endstop.min.x;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_X)
|
||||
max = soft_endstop.max.x;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_X, min = soft_endstop.min.x);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_X, max = soft_endstop.max.x);
|
||||
break;
|
||||
case Y_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Y)
|
||||
min = soft_endstop.min.y;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Y)
|
||||
max = soft_endstop.max.y;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_Y, min = soft_endstop.min.y);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_Y, max = soft_endstop.max.y);
|
||||
break;
|
||||
case Z_AXIS:
|
||||
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Z)
|
||||
min = soft_endstop.min.z;
|
||||
#endif
|
||||
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
|
||||
max = soft_endstop.max.z;
|
||||
#endif
|
||||
TERN_(MIN_SOFTWARE_ENDSTOP_Z, min = soft_endstop.min.z);
|
||||
TERN_(MAX_SOFTWARE_ENDSTOP_Z, max = soft_endstop.max.z);
|
||||
default: break;
|
||||
}
|
||||
#endif // HAS_SOFTWARE_ENDSTOPS
|
||||
|
@ -230,9 +218,7 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
|
|||
case Y_AXIS: STATIC_ITEM(MSG_MOVE_Y, SS_CENTER|SS_INVERT); break;
|
||||
case Z_AXIS: STATIC_ITEM(MSG_MOVE_Z, SS_CENTER|SS_INVERT); break;
|
||||
default:
|
||||
#if ENABLED(MANUAL_E_MOVES_RELATIVE)
|
||||
manual_move_e_origin = current_position.e;
|
||||
#endif
|
||||
TERN_(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin = current_position.e);
|
||||
STATIC_ITEM(MSG_MOVE_E, SS_CENTER|SS_INVERT);
|
||||
break;
|
||||
}
|
||||
|
@ -275,20 +261,12 @@ void menu_move() {
|
|||
EDIT_ITEM(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstops_enabled);
|
||||
#endif
|
||||
|
||||
if (
|
||||
if (true
|
||||
#if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
|
||||
all_axes_homed()
|
||||
#else
|
||||
true
|
||||
&& all_axes_homed()
|
||||
#endif
|
||||
) {
|
||||
if (
|
||||
#if ENABLED(DELTA)
|
||||
current_position.z <= delta_clip_start_height
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
) {
|
||||
if (TERN1(DELTA, current_position.z <= delta_clip_start_height)) {
|
||||
SUBMENU(MSG_MOVE_X, []{ _menu_move_distance(X_AXIS, lcd_move_x); });
|
||||
SUBMENU(MSG_MOVE_Y, []{ _menu_move_distance(Y_AXIS, lcd_move_y); });
|
||||
}
|
||||
|
|
|
@ -113,9 +113,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
|
|||
#endif
|
||||
LOOP_S_L_N(n, 1, HOTENDS) PREHEAT_ITEMS(1,n);
|
||||
ACTION_ITEM(MSG_PREHEAT_1_ALL, []() {
|
||||
#if HAS_HEATED_BED
|
||||
_preheat_bed(0);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, _preheat_bed(0));
|
||||
HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], e);
|
||||
});
|
||||
#endif // HAS_MULTI_HOTEND
|
||||
|
@ -141,9 +139,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
|
|||
#endif
|
||||
LOOP_S_L_N(n, 1, HOTENDS) PREHEAT_ITEMS(2,n);
|
||||
ACTION_ITEM(MSG_PREHEAT_2_ALL, []() {
|
||||
#if HAS_HEATED_BED
|
||||
_preheat_bed(1);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, _preheat_bed(1));
|
||||
HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], e);
|
||||
});
|
||||
#endif // HAS_MULTI_HOTEND
|
||||
|
@ -284,9 +280,7 @@ void menu_temperature() {
|
|||
//
|
||||
bool has_heat = false;
|
||||
HOTEND_LOOP() if (thermalManager.temp_hotend[HOTEND_INDEX].target) { has_heat = true; break; }
|
||||
#if HAS_HEATED_BED
|
||||
if (thermalManager.temp_bed.target) has_heat = true;
|
||||
#endif
|
||||
if (TERN0(HAS_HEATED_BED, thermalManager.temp_bed.target)) has_heat = true;
|
||||
if (has_heat) ACTION_ITEM(MSG_COOLDOWN, lcd_cooldown);
|
||||
|
||||
#endif // HAS_TEMP_HOTEND
|
||||
|
|
|
@ -67,18 +67,10 @@
|
|||
const float spm = planner.steps_to_mm[axis];
|
||||
MenuEditItemBase::draw_edit_screen(msg, BABYSTEP_TO_STR(spm * babystep.accum));
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
const bool in_view = (true
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
&& PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1)
|
||||
#endif
|
||||
);
|
||||
const bool in_view = TERN1(HAS_GRAPHICAL_LCD, PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1));
|
||||
if (in_view) {
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
ui.set_font(FONT_MENU);
|
||||
lcd_moveto(0, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT);
|
||||
#else
|
||||
lcd_moveto(0, LCD_HEIGHT - 1);
|
||||
#endif
|
||||
TERN_(HAS_GRAPHICAL_LCD, ui.set_font(FONT_MENU));
|
||||
lcd_moveto(0, TERN(HAS_GRAPHICAL_LCD, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
|
||||
lcd_put_u8str_P(GET_TEXT(MSG_BABYSTEP_TOTAL));
|
||||
lcd_put_wchar(':');
|
||||
lcd_put_u8str(BABYSTEP_TO_STR(spm * babystep.axis_total[BS_TOTAL_IND(axis)]));
|
||||
|
|
|
@ -68,9 +68,7 @@ static void _lcd_mesh_fine_tune(PGM_P const msg) {
|
|||
|
||||
if (ui.should_draw()) {
|
||||
MenuEditItemBase::draw_edit_screen(msg, ftostr43sign(mesh_edit_value));
|
||||
#if ENABLED(MESH_EDIT_GFX_OVERLAY)
|
||||
_lcd_zoffset_overlay_gfx(mesh_edit_value);
|
||||
#endif
|
||||
TERN_(MESH_EDIT_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(mesh_edit_value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -348,9 +348,7 @@ void MarlinUI::init() {
|
|||
|
||||
update_buttons();
|
||||
|
||||
#if HAS_ENCODER_ACTION
|
||||
encoderDiff = 0;
|
||||
#endif
|
||||
TERN_(HAS_ENCODER_ACTION, encoderDiff = 0);
|
||||
}
|
||||
|
||||
bool MarlinUI::get_blink() {
|
||||
|
@ -487,9 +485,7 @@ bool MarlinUI::get_blink() {
|
|||
|
||||
void MarlinUI::status_screen() {
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ENCODER_RATE_MULTIPLY(false);
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, ENCODER_RATE_MULTIPLY(false));
|
||||
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
|
||||
|
@ -590,9 +586,7 @@ void MarlinUI::status_screen() {
|
|||
void MarlinUI::kill_screen(PGM_P lcd_error, PGM_P lcd_component) {
|
||||
init();
|
||||
status_printf_P(1, PSTR(S_FMT ": " S_FMT), lcd_error, lcd_component);
|
||||
#if HAS_LCD_MENU
|
||||
return_to_status();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, return_to_status());
|
||||
|
||||
// RED ALERT. RED ALERT.
|
||||
#ifdef LED_BACKLIGHT_TIMEOUT
|
||||
|
@ -608,9 +602,7 @@ void MarlinUI::kill_screen(PGM_P lcd_error, PGM_P lcd_component) {
|
|||
|
||||
void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
refresh();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, refresh());
|
||||
|
||||
#if HAS_ENCODER_ACTION
|
||||
if (clear_buttons) buttons = 0;
|
||||
|
@ -777,16 +769,12 @@ void MarlinUI::update() {
|
|||
if (ELAPSED(ms, next_button_update_ms)) {
|
||||
encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP) * encoderDirection;
|
||||
if (touch_buttons & EN_A) encoderDiff *= -1;
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
if (external_control) ubl.encoder_diff = encoderDiff;
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_UBL, if (external_control) ubl.encoder_diff = encoderDiff);
|
||||
next_button_update_ms = ms + repeat_delay; // Assume the repeat delay
|
||||
if (!wait_for_unclick) {
|
||||
next_button_update_ms += 250; // Longer delay on first press
|
||||
wait_for_unclick = true; // Avoid Back/Select click while repeating
|
||||
#if HAS_BUZZER
|
||||
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -813,11 +801,7 @@ void MarlinUI::update() {
|
|||
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
if (ELAPSED(ms, next_lcd_update_ms)
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|| drawing_screen
|
||||
#endif
|
||||
) {
|
||||
if (ELAPSED(ms, next_lcd_update_ms) || TERN0(HAS_GRAPHICAL_LCD, drawing_screen)) {
|
||||
|
||||
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
|
||||
|
||||
|
@ -825,25 +809,18 @@ void MarlinUI::update() {
|
|||
|
||||
if (on_status_screen()) next_lcd_update_ms += (LCD_UPDATE_INTERVAL) * 2;
|
||||
|
||||
#if HAS_ENCODER_ACTION
|
||||
touch_buttons = touch.read_buttons();
|
||||
#endif
|
||||
TERN_(HAS_ENCODER_ACTION, touch_buttons = touch.read_buttons());
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
|
||||
update_indicators();
|
||||
#endif
|
||||
TERN_(LCD_HAS_STATUS_INDICATORS, update_indicators());
|
||||
|
||||
#if HAS_ENCODER_ACTION
|
||||
|
||||
#if HAS_SLOW_BUTTONS
|
||||
slow_buttons = read_slow_buttons(); // Buttons that take too long to read in interrupt context
|
||||
#endif
|
||||
TERN_(HAS_SLOW_BUTTONS, slow_buttons = read_slow_buttons()); // Buttons that take too long to read in interrupt context
|
||||
|
||||
#if ENABLED(REPRAPWORLD_KEYPAD)
|
||||
if (handle_keypad()) RESET_STATUS_TIMEOUT();
|
||||
#endif
|
||||
if (TERN0(REPRAPWORLD_KEYPAD, handle_keypad()))
|
||||
RESET_STATUS_TIMEOUT();
|
||||
|
||||
const float abs_diff = ABS(encoderDiff);
|
||||
const bool encoderPastThreshold = (abs_diff >= (ENCODER_PULSES_PER_STEP));
|
||||
|
@ -943,9 +920,7 @@ void MarlinUI::update() {
|
|||
break;
|
||||
} // switch
|
||||
|
||||
#if HAS_ADC_BUTTONS
|
||||
keypad_buttons = 0;
|
||||
#endif
|
||||
TERN_(HAS_ADC_BUTTONS, keypad_buttons = 0);
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|
||||
|
@ -984,9 +959,7 @@ void MarlinUI::update() {
|
|||
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_clicked = false;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, lcd_clicked = false);
|
||||
|
||||
// Keeping track of the longest time for an individual LCD update.
|
||||
// Used to do screen throttling when the planner starts to fill up.
|
||||
|
@ -1229,9 +1202,7 @@ void MarlinUI::update() {
|
|||
case encrot3: ENCODER_SPIN(encrot2, encrot0); break;
|
||||
}
|
||||
if (external_control) {
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
ubl.encoder_diff = encoderDiff; // Make encoder rotation available to UBL G29 mesh editing.
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_UBL, ubl.encoder_diff = encoderDiff); // Make encoder rotation available to UBL G29 mesh editing.
|
||||
encoderDiff = 0; // Hide the encoder event from the current screen handler.
|
||||
}
|
||||
lastEncoderBits = enc;
|
||||
|
@ -1294,9 +1265,7 @@ void MarlinUI::update() {
|
|||
status_scroll_offset = 0;
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onStatusChanged(status_message);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
|
||||
}
|
||||
|
||||
bool MarlinUI::has_status() { return (status_message[0] != '\0'); }
|
||||
|
@ -1304,9 +1273,7 @@ void MarlinUI::update() {
|
|||
void MarlinUI::set_status(const char * const message, const bool persist) {
|
||||
if (alert_level) return;
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_action_notify(message);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_action_notify(message));
|
||||
|
||||
// Here we have a problem. The message is encoded in UTF8, so
|
||||
// arbitrarily cutting it will be a problem. We MUST be sure
|
||||
|
@ -1347,9 +1314,7 @@ void MarlinUI::update() {
|
|||
if (level < alert_level) return;
|
||||
alert_level = level;
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_action_notify(message);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_action_notify(message));
|
||||
|
||||
// Since the message is encoded in UTF8 it must
|
||||
// only be cut on a character boundary.
|
||||
|
@ -1374,9 +1339,7 @@ void MarlinUI::update() {
|
|||
|
||||
void MarlinUI::set_alert_status_P(PGM_P const message) {
|
||||
set_status_P(message, 1);
|
||||
#if HAS_LCD_MENU
|
||||
return_to_status();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, return_to_status());
|
||||
}
|
||||
|
||||
PGM_P print_paused = GET_TEXT(MSG_PRINT_PAUSED);
|
||||
|
@ -1436,14 +1399,10 @@ void MarlinUI::update() {
|
|||
#ifdef ACTION_ON_CANCEL
|
||||
host_action_cancel();
|
||||
#endif
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_INFO, PSTR("UI Aborted"), DISMISS_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("UI Aborted"), DISMISS_STR));
|
||||
print_job_timer.stop();
|
||||
set_status_P(GET_TEXT(MSG_PRINT_ABORTED));
|
||||
#if HAS_LCD_MENU
|
||||
return_to_status();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, return_to_status());
|
||||
}
|
||||
|
||||
#if ANY(PARK_HEAD_ON_PAUSE, SDSUPPORT)
|
||||
|
@ -1456,16 +1415,12 @@ void MarlinUI::update() {
|
|||
defer_status_screen();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume")));
|
||||
|
||||
set_status_P(print_paused);
|
||||
|
||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
||||
#if HAS_SPI_LCD
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT); // Show message immediately to let user know about pause in progress
|
||||
#endif
|
||||
TERN_(HAS_SPI_LCD, lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT)); // Show message immediately to let user know about pause in progress
|
||||
queue.inject_P(PSTR("M25 P\nM24"));
|
||||
#elif ENABLED(SDSUPPORT)
|
||||
queue.inject_P(PSTR("M25"));
|
||||
|
@ -1476,9 +1431,7 @@ void MarlinUI::update() {
|
|||
|
||||
void MarlinUI::resume_print() {
|
||||
reset_status();
|
||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
||||
wait_for_heatup = wait_for_user = false;
|
||||
#endif
|
||||
TERN_(PARK_HEAD_ON_PAUSE, wait_for_heatup = wait_for_user = false);
|
||||
if (IS_SD_PAUSED()) queue.inject_P(M24_STR);
|
||||
#ifdef ACTION_ON_RESUME
|
||||
host_action_resume();
|
||||
|
@ -1543,30 +1496,22 @@ void MarlinUI::update() {
|
|||
|
||||
void MarlinUI::media_changed(const uint8_t old_status, const uint8_t status) {
|
||||
if (old_status == status) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMediaError(); // Failed to mount/unmount
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMediaError()); // Failed to mount/unmount
|
||||
return;
|
||||
}
|
||||
|
||||
if (status) {
|
||||
if (old_status < 2) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMediaInserted(); // ExtUI response
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMediaInserted()); // ExtUI response
|
||||
set_status_P(GET_TEXT(MSG_MEDIA_INSERTED));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (old_status < 2) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMediaRemoved(); // ExtUI response
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMediaRemoved()); // ExtUI response
|
||||
#if PIN_EXISTS(SD_DETECT)
|
||||
set_status_P(GET_TEXT(MSG_MEDIA_REMOVED));
|
||||
#if HAS_LCD_MENU
|
||||
return_to_status();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, return_to_status());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1581,9 +1526,7 @@ void MarlinUI::update() {
|
|||
const millis_t ms = millis();
|
||||
#endif
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL; // Delay LCD update for SD activity
|
||||
#endif
|
||||
TERN_(HAS_SPI_LCD, next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL); // Delay LCD update for SD activity
|
||||
|
||||
#ifdef LED_BACKLIGHT_TIMEOUT
|
||||
leds.reset_timeout(ms);
|
||||
|
|
|
@ -41,7 +41,9 @@
|
|||
#endif
|
||||
|
||||
// I2C buttons must be read in the main thread
|
||||
#define HAS_SLOW_BUTTONS EITHER(LCD_I2C_VIKI, LCD_I2C_PANELOLU2)
|
||||
#if EITHER(LCD_I2C_VIKI, LCD_I2C_PANELOLU2)
|
||||
#define HAS_SLOW_BUTTONS 1
|
||||
#endif
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
|
||||
|
@ -64,11 +66,7 @@
|
|||
uint8_t get_ADC_keyValue();
|
||||
#endif
|
||||
|
||||
#if ENABLED(TOUCH_BUTTONS)
|
||||
#define LCD_UPDATE_INTERVAL 50
|
||||
#else
|
||||
#define LCD_UPDATE_INTERVAL 100
|
||||
#endif
|
||||
#define LCD_UPDATE_INTERVAL TERN(TOUCH_BUTTONS, 50, 100)
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
|
||||
|
@ -207,12 +205,12 @@
|
|||
#define BL_DW 4 // Down
|
||||
#define BL_RI 3 // Right
|
||||
#define BL_ST 2 // Red Button
|
||||
#define B_LE (_BV(BL_LE))
|
||||
#define B_UP (_BV(BL_UP))
|
||||
#define B_MI (_BV(BL_MI))
|
||||
#define B_DW (_BV(BL_DW))
|
||||
#define B_RI (_BV(BL_RI))
|
||||
#define B_ST (_BV(BL_ST))
|
||||
#define B_LE _BV(BL_LE)
|
||||
#define B_UP _BV(BL_UP)
|
||||
#define B_MI _BV(BL_MI)
|
||||
#define B_DW _BV(BL_DW)
|
||||
#define B_RI _BV(BL_RI)
|
||||
#define B_ST _BV(BL_ST)
|
||||
|
||||
#ifndef BUTTON_CLICK
|
||||
#define BUTTON_CLICK() (buttons & (B_MI|B_ST))
|
||||
|
@ -258,9 +256,7 @@ class MarlinUI {
|
|||
public:
|
||||
|
||||
MarlinUI() {
|
||||
#if HAS_LCD_MENU
|
||||
currentScreen = status_screen;
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, currentScreen = status_screen);
|
||||
}
|
||||
|
||||
#if HAS_BUZZER
|
||||
|
@ -530,9 +526,7 @@ public:
|
|||
|
||||
#if ENABLED(G26_MESH_VALIDATION)
|
||||
FORCE_INLINE static void chirp() {
|
||||
#if HAS_BUZZER
|
||||
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
||||
#endif
|
||||
TERN_(HAS_BUZZER, buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -605,15 +599,11 @@ public:
|
|||
}
|
||||
|
||||
FORCE_INLINE static void encoder_direction_menus() {
|
||||
#if ENABLED(REVERSE_MENU_DIRECTION)
|
||||
encoderDirection = -(ENCODERBASE);
|
||||
#endif
|
||||
TERN_(REVERSE_MENU_DIRECTION, encoderDirection = -(ENCODERBASE));
|
||||
}
|
||||
|
||||
FORCE_INLINE static void encoder_direction_select() {
|
||||
#if ENABLED(REVERSE_SELECT_DIRECTION)
|
||||
encoderDirection = -(ENCODERBASE);
|
||||
#endif
|
||||
TERN_(REVERSE_SELECT_DIRECTION, encoderDirection = -(ENCODERBASE));
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -923,9 +923,7 @@ void L64XX_Marlin::say_axis(const L64XX_axis_t axis, const uint8_t label/*=true*
|
|||
monitor_update(E5);
|
||||
#endif
|
||||
|
||||
#if ENABLED(L6470_DEBUG)
|
||||
if (report_L6470_status) DEBUG_EOL();
|
||||
#endif
|
||||
if (TERN0(L6470_DEBUG, report_L6470_status)) DEBUG_EOL();
|
||||
|
||||
spi_active = false; // done with all SPI transfers - clear handshake flags
|
||||
spi_abort = false;
|
||||
|
|
|
@ -42,9 +42,7 @@ Nozzle nozzle;
|
|||
* @param strokes number of strokes to execute
|
||||
*/
|
||||
void Nozzle::stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) {
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t oldpos = current_position;
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t oldpos = current_position);
|
||||
|
||||
// Move to the starting point
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
|
@ -59,9 +57,7 @@ Nozzle nozzle;
|
|||
do_blocking_move_to_xy(start);
|
||||
}
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(oldpos);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(oldpos));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,9 +73,7 @@ Nozzle nozzle;
|
|||
const xy_pos_t diff = end - start;
|
||||
if (!diff.x || !diff.y) return;
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t back = current_position;
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position);
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
do_blocking_move_to_xy(start);
|
||||
|
@ -108,9 +102,7 @@ Nozzle nozzle;
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(back);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(back));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,15 +116,8 @@ Nozzle nozzle;
|
|||
void Nozzle::circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const float &radius) {
|
||||
if (strokes == 0) return;
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t back = current_position;
|
||||
#endif
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
do_blocking_move_to_xy(start);
|
||||
#else
|
||||
do_blocking_move_to(start);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position);
|
||||
TERN(NOZZLE_CLEAN_NO_Z, do_blocking_move_to_xy, do_blocking_move_to)(start);
|
||||
|
||||
LOOP_L_N(s, strokes)
|
||||
LOOP_L_N(i, NOZZLE_CLEAN_CIRCLE_FN)
|
||||
|
@ -144,9 +129,7 @@ Nozzle nozzle;
|
|||
// Let's be safe
|
||||
do_blocking_move_to_xy(start);
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(back);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(back));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,14 +34,10 @@ millis_t Stopwatch::startTimestamp;
|
|||
millis_t Stopwatch::stopTimestamp;
|
||||
|
||||
bool Stopwatch::stop() {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("stop"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("stop"));
|
||||
|
||||
if (isRunning() || isPaused()) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerStopped();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
|
||||
state = STOPPED;
|
||||
stopTimestamp = millis();
|
||||
return true;
|
||||
|
@ -50,14 +46,10 @@ bool Stopwatch::stop() {
|
|||
}
|
||||
|
||||
bool Stopwatch::pause() {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("pause"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("pause"));
|
||||
|
||||
if (isRunning()) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerPaused();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerPaused());
|
||||
state = PAUSED;
|
||||
stopTimestamp = millis();
|
||||
return true;
|
||||
|
@ -66,13 +58,9 @@ bool Stopwatch::pause() {
|
|||
}
|
||||
|
||||
bool Stopwatch::start() {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("start"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("start"));
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerStarted();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStarted());
|
||||
|
||||
if (!isRunning()) {
|
||||
if (isPaused()) accumulator = duration();
|
||||
|
@ -86,18 +74,14 @@ bool Stopwatch::start() {
|
|||
}
|
||||
|
||||
void Stopwatch::resume(const millis_t with_time) {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("resume"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("resume"));
|
||||
|
||||
reset();
|
||||
if ((accumulator = with_time)) state = RUNNING;
|
||||
}
|
||||
|
||||
void Stopwatch::reset() {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("reset"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("reset"));
|
||||
|
||||
state = STOPPED;
|
||||
startTimestamp = 0;
|
||||
|
|
|
@ -114,5 +114,9 @@ class Stopwatch {
|
|||
*/
|
||||
static void debug(const char func[]);
|
||||
|
||||
#else
|
||||
|
||||
static inline void debug(const char[]) {}
|
||||
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -126,9 +126,9 @@
|
|||
void M710_report(const bool forReplay);
|
||||
#endif
|
||||
|
||||
#define HAS_CASE_LIGHT_BRIGHTNESS (ENABLED(CASE_LIGHT_MENU) && DISABLED(CASE_LIGHT_NO_BRIGHTNESS))
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
#if ENABLED(CASE_LIGHT_MENU) && DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
|
||||
#include "../feature/caselight.h"
|
||||
#define HAS_CASE_LIGHT_BRIGHTNESS 1
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 1) // No padding between variables
|
||||
|
@ -235,7 +235,7 @@ typedef struct SettingsDataStruct {
|
|||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
, z_offsets_ext[COUNT(temp_comp.z_offsets_ext)] // M871 E I V
|
||||
#endif
|
||||
;
|
||||
;
|
||||
#endif
|
||||
|
||||
//
|
||||
|
@ -411,13 +411,9 @@ void MarlinSettings::postprocess() {
|
|||
|
||||
// Make sure delta kinematics are updated before refreshing the
|
||||
// planner position so the stepper counts will be set correctly.
|
||||
#if ENABLED(DELTA)
|
||||
recalc_delta_settings();
|
||||
#endif
|
||||
TERN_(DELTA, recalc_delta_settings());
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
thermalManager.updatePID();
|
||||
#endif
|
||||
TERN_(PIDTEMP, thermalManager.updatePID());
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
planner.calculate_volumetric_multipliers();
|
||||
|
@ -432,29 +428,17 @@ void MarlinSettings::postprocess() {
|
|||
update_software_endstops((AxisEnum)i);
|
||||
}
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
set_z_fade_height(new_z_fade_height, false); // false = no report
|
||||
#endif
|
||||
TERN_(ENABLE_LEVELING_FADE_HEIGHT, set_z_fade_height(new_z_fade_height, false)); // false = no report
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
refresh_bed_level();
|
||||
#endif
|
||||
TERN_(AUTO_BED_LEVELING_BILINEAR, refresh_bed_level());
|
||||
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
stepper.refresh_motor_power();
|
||||
#endif
|
||||
TERN_(HAS_MOTOR_CURRENT_PWM, stepper.refresh_motor_power());
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
fwretract.refresh_autoretract();
|
||||
#endif
|
||||
TERN_(FWRETRACT, fwretract.refresh_autoretract());
|
||||
|
||||
#if HAS_LINEAR_E_JERK
|
||||
planner.recalculate_max_e_jerk();
|
||||
#endif
|
||||
TERN_(HAS_LINEAR_E_JERK, planner.recalculate_max_e_jerk());
|
||||
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
update_case_light();
|
||||
#endif
|
||||
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, update_case_light());
|
||||
|
||||
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
|
||||
// and init stepper.count[], planner.position[] with current_position
|
||||
|
@ -585,9 +569,7 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_WRITE(planner_max_jerk);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CLASSIC_JERK)
|
||||
dummyf = 0.02f;
|
||||
#endif
|
||||
TERN_(CLASSIC_JERK, dummyf = 0.02f);
|
||||
EEPROM_WRITE(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
|
||||
}
|
||||
|
||||
|
@ -1130,18 +1112,10 @@ void MarlinSettings::postprocess() {
|
|||
{
|
||||
tmc_sgt_t tmc_sgt{0};
|
||||
#if USE_SENSORLESS
|
||||
#if X_SENSORLESS
|
||||
tmc_sgt.X = stepperX.homing_threshold();
|
||||
#endif
|
||||
#if X2_SENSORLESS
|
||||
tmc_sgt.X2 = stepperX2.homing_threshold();
|
||||
#endif
|
||||
#if Y_SENSORLESS
|
||||
tmc_sgt.Y = stepperY.homing_threshold();
|
||||
#endif
|
||||
#if Z_SENSORLESS
|
||||
tmc_sgt.Z = stepperZ.homing_threshold();
|
||||
#endif
|
||||
TERN_(X_SENSORLESS, tmc_sgt.X = stepperX.homing_threshold());
|
||||
TERN_(X2_SENSORLESS, tmc_sgt.X2 = stepperX2.homing_threshold());
|
||||
TERN_(Y_SENSORLESS, tmc_sgt.Y = stepperY.homing_threshold());
|
||||
TERN_(Z_SENSORLESS, tmc_sgt.Z = stepperZ.homing_threshold());
|
||||
#endif
|
||||
EEPROM_WRITE(tmc_sgt);
|
||||
}
|
||||
|
@ -1362,9 +1336,7 @@ void MarlinSettings::postprocess() {
|
|||
|
||||
if (!eeprom_error) LCD_MESSAGEPGM(MSG_SETTINGS_STORED);
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onConfigurationStoreWritten(!eeprom_error);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(!eeprom_error));
|
||||
|
||||
return !eeprom_error;
|
||||
}
|
||||
|
@ -1703,12 +1675,8 @@ void MarlinSettings::postprocess() {
|
|||
PID_PARAM(Kp, e) = pidcf.Kp;
|
||||
PID_PARAM(Ki, e) = scalePID_i(pidcf.Ki);
|
||||
PID_PARAM(Kd, e) = scalePID_d(pidcf.Kd);
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
PID_PARAM(Kc, e) = pidcf.Kc;
|
||||
#endif
|
||||
#if ENABLED(PID_FAN_SCALING)
|
||||
PID_PARAM(Kf, e) = pidcf.Kf;
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, PID_PARAM(Kc, e) = pidcf.Kc);
|
||||
TERN_(PID_FAN_SCALING, PID_PARAM(Kf, e) = pidcf.Kf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1761,9 +1729,7 @@ void MarlinSettings::postprocess() {
|
|||
|
||||
int16_t lcd_contrast;
|
||||
EEPROM_READ(lcd_contrast);
|
||||
#if HAS_LCD_CONTRAST
|
||||
ui.set_contrast(lcd_contrast);
|
||||
#endif
|
||||
TERN_(HAS_LCD_CONTRAST, ui.set_contrast(lcd_contrast));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1981,9 +1947,7 @@ void MarlinSettings::postprocess() {
|
|||
stepperX2.homing_threshold(tmc_sgt.X);
|
||||
#endif
|
||||
#endif
|
||||
#if X2_SENSORLESS
|
||||
stepperX2.homing_threshold(tmc_sgt.X2);
|
||||
#endif
|
||||
TERN_(X2_SENSORLESS, stepperX2.homing_threshold(tmc_sgt.X2));
|
||||
#ifdef Y_STALL_SENSITIVITY
|
||||
#if AXIS_HAS_STALLGUARD(Y)
|
||||
stepperY.homing_threshold(tmc_sgt.Y);
|
||||
|
@ -2284,9 +2248,7 @@ void MarlinSettings::postprocess() {
|
|||
bool MarlinSettings::load() {
|
||||
if (validate()) {
|
||||
const bool success = _load();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onConfigurationStoreRead(success);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreRead(success));
|
||||
return success;
|
||||
}
|
||||
reset();
|
||||
|
@ -2428,9 +2390,7 @@ void MarlinSettings::reset() {
|
|||
#define DEFAULT_ZJERK 0
|
||||
#endif
|
||||
planner.max_jerk.set(DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK);
|
||||
#if HAS_CLASSIC_E_JERK
|
||||
planner.max_jerk.e = DEFAULT_EJERK;
|
||||
#endif
|
||||
TERN_(HAS_CLASSIC_E_JERK, planner.max_jerk.e = DEFAULT_EJERK;);
|
||||
#endif
|
||||
|
||||
#if DISABLED(CLASSIC_JERK)
|
||||
|
@ -2443,9 +2403,7 @@ void MarlinSettings::reset() {
|
|||
home_offset.reset();
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
reset_hotend_offsets();
|
||||
#endif
|
||||
TERN_(HAS_HOTEND_OFFSET, reset_hotend_offsets());
|
||||
|
||||
//
|
||||
// Filament Runout Sensor
|
||||
|
@ -2486,37 +2444,23 @@ void MarlinSettings::reset() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onFactoryReset();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
|
||||
|
||||
//
|
||||
// Case Light Brightness
|
||||
//
|
||||
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS;
|
||||
#endif
|
||||
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS);
|
||||
|
||||
//
|
||||
// Magnetic Parking Extruder
|
||||
//
|
||||
|
||||
#if ENABLED(MAGNETIC_PARKING_EXTRUDER)
|
||||
mpe_settings_init();
|
||||
#endif
|
||||
TERN_(MAGNETIC_PARKING_EXTRUDER, mpe_settings_init());
|
||||
|
||||
//
|
||||
// Global Leveling
|
||||
//
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
new_z_fade_height = 0.0;
|
||||
#endif
|
||||
|
||||
#if HAS_LEVELING
|
||||
reset_bed_level();
|
||||
#endif
|
||||
TERN_(ENABLE_LEVELING_FADE_HEIGHT, new_z_fade_height = 0.0);
|
||||
TERN_(HAS_LEVELING, reset_bed_level());
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
constexpr float dpo[] = NOZZLE_TO_PROBE_OFFSET;
|
||||
|
@ -2532,18 +2476,12 @@ void MarlinSettings::reset() {
|
|||
//
|
||||
// Z Stepper Auto-alignment points
|
||||
//
|
||||
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
z_stepper_align.reset_to_default();
|
||||
#endif
|
||||
TERN_(Z_STEPPER_AUTO_ALIGN, z_stepper_align.reset_to_default());
|
||||
|
||||
//
|
||||
// Servo Angles
|
||||
//
|
||||
|
||||
#if ENABLED(EDITABLE_SERVO_ANGLES)
|
||||
COPY(servo_angles, base_servo_angles); // When not editable only one copy of servo angles exists
|
||||
#endif
|
||||
TERN_(EDITABLE_SERVO_ANGLES, COPY(servo_angles, base_servo_angles)); // When not editable only one copy of servo angles exists
|
||||
|
||||
//
|
||||
// BLTOUCH
|
||||
|
@ -2564,7 +2502,6 @@ void MarlinSettings::reset() {
|
|||
delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
||||
delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
|
||||
delta_tower_angle_trim = dta;
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
|
@ -2622,23 +2559,15 @@ void MarlinSettings::reset() {
|
|||
PID_PARAM(Kp, e) = float(DEFAULT_Kp);
|
||||
PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki);
|
||||
PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd);
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
PID_PARAM(Kc, e) = DEFAULT_Kc;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PID_FAN_SCALING)
|
||||
PID_PARAM(Kf, e) = DEFAULT_Kf;
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, PID_PARAM(Kc, e) = DEFAULT_Kc);
|
||||
TERN_(PID_FAN_SCALING, PID_PARAM(Kf, e) = DEFAULT_Kf);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// PID Extrusion Scaling
|
||||
//
|
||||
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
thermalManager.lpq_len = 20; // Default last-position-queue size
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, thermalManager.lpq_len = 20); // Default last-position-queue size
|
||||
|
||||
//
|
||||
// Heated Bed PID
|
||||
|
@ -2653,67 +2582,39 @@ void MarlinSettings::reset() {
|
|||
//
|
||||
// User-Defined Thermistors
|
||||
//
|
||||
|
||||
#if HAS_USER_THERMISTORS
|
||||
thermalManager.reset_user_thermistors();
|
||||
#endif
|
||||
TERN_(HAS_USER_THERMISTORS, thermalManager.reset_user_thermistors());
|
||||
|
||||
//
|
||||
// LCD Contrast
|
||||
//
|
||||
|
||||
#if HAS_LCD_CONTRAST
|
||||
ui.set_contrast(DEFAULT_LCD_CONTRAST);
|
||||
#endif
|
||||
TERN_(HAS_LCD_CONTRAST, ui.set_contrast(DEFAULT_LCD_CONTRAST));
|
||||
|
||||
//
|
||||
// Controller Fan
|
||||
//
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
controllerFan.reset();
|
||||
#endif
|
||||
TERN_(USE_CONTROLLER_FAN, controllerFan.reset());
|
||||
|
||||
//
|
||||
// Power-Loss Recovery
|
||||
//
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.enable(ENABLED(PLR_ENABLED_DEFAULT));
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.enable(ENABLED(PLR_ENABLED_DEFAULT)));
|
||||
|
||||
//
|
||||
// Firmware Retraction
|
||||
//
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
fwretract.reset();
|
||||
#endif
|
||||
TERN_(FWRETRACT, fwretract.reset());
|
||||
|
||||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
|
||||
parser.volumetric_enabled =
|
||||
#if ENABLED(VOLUMETRIC_DEFAULT_ON)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
;
|
||||
parser.volumetric_enabled = ENABLED(VOLUMETRIC_DEFAULT_ON);
|
||||
LOOP_L_N(q, COUNT(planner.filament_size))
|
||||
planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||
|
||||
#endif
|
||||
|
||||
endstops.enable_globally(
|
||||
#if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
endstops.enable_globally(ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT));
|
||||
|
||||
reset_stepper_drivers();
|
||||
|
||||
|
@ -2724,9 +2625,7 @@ void MarlinSettings::reset() {
|
|||
#if ENABLED(LIN_ADVANCE)
|
||||
LOOP_L_N(i, EXTRUDERS) {
|
||||
planner.extruder_advance_K[i] = LIN_ADVANCE_K;
|
||||
#if ENABLED(EXTRA_LIN_ADVANCE_K)
|
||||
other_extruder_advance_K[i] = LIN_ADVANCE_K;
|
||||
#endif
|
||||
TERN_(EXTRA_LIN_ADVANCE_K, other_extruder_advance_K[i] = LIN_ADVANCE_K);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2743,15 +2642,11 @@ void MarlinSettings::reset() {
|
|||
//
|
||||
// CNC Coordinate System
|
||||
//
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
(void)gcode.select_coordinate_system(-1); // Go back to machine space
|
||||
#endif
|
||||
TERN_(CNC_COORDINATE_SYSTEMS, (void)gcode.select_coordinate_system(-1)); // Go back to machine space
|
||||
|
||||
//
|
||||
// Skew Correction
|
||||
//
|
||||
|
||||
#if ENABLED(SKEW_CORRECTION_GCODE)
|
||||
planner.skew_factor.xy = XY_SKEW_FACTOR;
|
||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
||||
|
@ -2763,7 +2658,6 @@ void MarlinSettings::reset() {
|
|||
//
|
||||
// Advanced Pause filament load & unload lengths
|
||||
//
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
LOOP_L_N(e, EXTRUDERS) {
|
||||
fc_settings[e].unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH;
|
||||
|
@ -2776,9 +2670,7 @@ void MarlinSettings::reset() {
|
|||
DEBUG_ECHO_START();
|
||||
DEBUG_ECHOLNPGM("Hardcoded Default Settings Loaded");
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onFactoryReset();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
|
||||
}
|
||||
|
||||
#if DISABLED(DISABLE_M503)
|
||||
|
@ -2959,9 +2851,7 @@ void MarlinSettings::reset() {
|
|||
#endif
|
||||
#if HAS_CLASSIC_JERK
|
||||
" X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>"
|
||||
#if HAS_CLASSIC_E_JERK
|
||||
" E<max_e_jerk>"
|
||||
#endif
|
||||
TERN_(HAS_CLASSIC_E_JERK, " E<max_e_jerk>")
|
||||
#endif
|
||||
);
|
||||
CONFIG_ECHO_START();
|
||||
|
@ -3237,9 +3127,7 @@ void MarlinSettings::reset() {
|
|||
SERIAL_ECHOLNPAIR(" M250 C", ui.contrast);
|
||||
#endif
|
||||
|
||||
#if ENABLED(CONTROLLER_FAN_EDITABLE)
|
||||
M710_report(forReplay);
|
||||
#endif
|
||||
TERN_(CONTROLLER_FAN_EDITABLE, M710_report(forReplay));
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
CONFIG_ECHO_HEADING("Power-Loss Recovery:");
|
||||
|
|
|
@ -38,9 +38,7 @@ class MarlinSettings {
|
|||
reset();
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
const bool success = save();
|
||||
#if ENABLED(EEPROM_CHITCHAT)
|
||||
if (success) report();
|
||||
#endif
|
||||
if (TERN0(EEPROM_CHITCHAT, success)) report();
|
||||
return success;
|
||||
#else
|
||||
return true;
|
||||
|
|
|
@ -249,11 +249,7 @@ void home_delta() {
|
|||
#endif
|
||||
|
||||
// Move all carriages together linearly until an endstop is hit.
|
||||
current_position.z = (delta_height + 10
|
||||
#if HAS_BED_PROBE
|
||||
- probe.offset.z
|
||||
#endif
|
||||
);
|
||||
current_position.z = (delta_height + 10 - TERN0(HAS_BED_PROBE, probe.offset.z));
|
||||
line_to_current_position(homing_feedrate(Z_AXIS));
|
||||
planner.synchronize();
|
||||
|
||||
|
|
|
@ -276,27 +276,17 @@ void Endstops::init() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
|
||||
setup_endstop_interrupts();
|
||||
#endif
|
||||
TERN_(ENDSTOP_INTERRUPTS_FEATURE, setup_endstop_interrupts());
|
||||
|
||||
// Enable endstops
|
||||
enable_globally(
|
||||
#if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
enable_globally(ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT));
|
||||
|
||||
} // Endstops::init
|
||||
|
||||
// Called at ~1KHz from Temperature ISR: Poll endstop state if required
|
||||
void Endstops::poll() {
|
||||
|
||||
#if ENABLED(PINS_DEBUGGING)
|
||||
run_monitor(); // report changes in endstop status
|
||||
#endif
|
||||
TERN_(PINS_DEBUGGING, run_monitor()); // Report changes in endstop status
|
||||
|
||||
#if DISABLED(ENDSTOP_INTERRUPTS_FEATURE)
|
||||
update();
|
||||
|
@ -341,14 +331,9 @@ void Endstops::not_homing() {
|
|||
void Endstops::resync() {
|
||||
if (!abort_enabled()) return; // If endstops/probes are disabled the loop below can hang
|
||||
|
||||
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
|
||||
update();
|
||||
#else
|
||||
safe_delay(2); // Wait for Temperature ISR to run at least once (runs at 1KHz)
|
||||
#endif
|
||||
#if ENDSTOP_NOISE_THRESHOLD
|
||||
while (endstop_poll_count) safe_delay(1);
|
||||
#endif
|
||||
// Wait for Temperature ISR to run at least once (runs at 1KHz)
|
||||
TERN(ENDSTOP_INTERRUPTS_FEATURE, update(), safe_delay(2));
|
||||
while (TERN0(ENDSTOP_NOISE_THRESHOLD, endstop_poll_count)) safe_delay(1);
|
||||
}
|
||||
|
||||
#if ENABLED(PINS_DEBUGGING)
|
||||
|
@ -397,9 +382,7 @@ void Endstops::event_handler() {
|
|||
#endif
|
||||
SERIAL_EOL();
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), GET_TEXT(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP);
|
||||
#endif
|
||||
TERN_(HAS_SPI_LCD, ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), GET_TEXT(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP));
|
||||
|
||||
#if BOTH(SD_ABORT_ON_ENDSTOP_HIT, SDSUPPORT)
|
||||
if (planner.abort_on_endstop_hit) {
|
||||
|
@ -420,9 +403,7 @@ static void print_es_state(const bool is_hit, PGM_P const label=nullptr) {
|
|||
}
|
||||
|
||||
void _O2 Endstops::report_states() {
|
||||
#if ENABLED(BLTOUCH)
|
||||
bltouch._set_SW_mode();
|
||||
#endif
|
||||
TERN_(BLTOUCH, bltouch._set_SW_mode());
|
||||
SERIAL_ECHOLNPGM(STR_M119_REPORT);
|
||||
#define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(STR_##S))
|
||||
#if HAS_X_MIN
|
||||
|
@ -494,13 +475,9 @@ void _O2 Endstops::report_states() {
|
|||
#undef _CASE_RUNOUT
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(BLTOUCH)
|
||||
bltouch._reset_SW_mode();
|
||||
#endif
|
||||
|
||||
#if ENABLED(JOYSTICK_DEBUG)
|
||||
joystick.report();
|
||||
#endif
|
||||
TERN_(BLTOUCH, bltouch._reset_SW_mode());
|
||||
TERN_(JOYSTICK_DEBUG, joystick.report());
|
||||
|
||||
} // Endstops::report_states
|
||||
|
||||
|
@ -796,12 +773,8 @@ void Endstops::update() {
|
|||
if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
|
||||
|
||||
#if HAS_Z_MIN || (Z_SPI_SENSORLESS && Z_HOME_DIR < 0)
|
||||
if (true
|
||||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
&& z_probe_enabled
|
||||
#elif HAS_CUSTOM_PROBE_PIN
|
||||
&& !z_probe_enabled
|
||||
#endif
|
||||
if ( TERN1(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, z_probe_enabled)
|
||||
&& TERN1(HAS_CUSTOM_PROBE_PIN, !z_probe_enabled)
|
||||
) PROCESS_ENDSTOP_Z(MIN);
|
||||
#endif
|
||||
|
||||
|
@ -852,15 +825,9 @@ void Endstops::update() {
|
|||
}
|
||||
|
||||
void Endstops::clear_endstop_state() {
|
||||
#if X_SPI_SENSORLESS
|
||||
CBI(live_state, X_STOP);
|
||||
#endif
|
||||
#if Y_SPI_SENSORLESS
|
||||
CBI(live_state, Y_STOP);
|
||||
#endif
|
||||
#if Z_SPI_SENSORLESS
|
||||
CBI(live_state, Z_STOP);
|
||||
#endif
|
||||
TERN_(X_SPI_SENSORLESS, CBI(live_state, X_STOP));
|
||||
TERN_(Y_SPI_SENSORLESS, CBI(live_state, Y_STOP));
|
||||
TERN_(Z_SPI_SENSORLESS, CBI(live_state, Z_STOP));
|
||||
}
|
||||
|
||||
#endif // SPI_ENDSTOPS
|
||||
|
|
|
@ -42,15 +42,9 @@ class Endstops {
|
|||
public:
|
||||
#if HAS_EXTRA_ENDSTOPS
|
||||
typedef uint16_t esbits_t;
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
static float x2_endstop_adj;
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
static float y2_endstop_adj;
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
static float z2_endstop_adj;
|
||||
#endif
|
||||
TERN_(X_DUAL_ENDSTOPS, static float x2_endstop_adj);
|
||||
TERN_(Y_DUAL_ENDSTOPS, static float y2_endstop_adj);
|
||||
TERN_(Z_MULTI_ENDSTOPS, static float z2_endstop_adj);
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
|
||||
static float z3_endstop_adj;
|
||||
#endif
|
||||
|
@ -83,11 +77,7 @@ class Endstops {
|
|||
* Are endstops or the probe set to abort the move?
|
||||
*/
|
||||
FORCE_INLINE static bool abort_enabled() {
|
||||
return (enabled
|
||||
#if HAS_BED_PROBE
|
||||
|| z_probe_enabled
|
||||
#endif
|
||||
);
|
||||
return enabled || TERN0(HAS_BED_PROBE, z_probe_enabled);
|
||||
}
|
||||
|
||||
static inline bool global_enabled() { return enabled_globally; }
|
||||
|
|
|
@ -204,9 +204,7 @@ xyz_pos_t cartes;
|
|||
|
||||
inline void report_more_positions() {
|
||||
stepper.report_positions();
|
||||
#if IS_SCARA
|
||||
scara_report_positions();
|
||||
#endif
|
||||
TERN_(IS_SCARA, scara_report_positions());
|
||||
}
|
||||
|
||||
// Report the logical position for a given machine position
|
||||
|
@ -329,9 +327,7 @@ void line_to_current_position(const feedRate_t &fr_mm_s/*=feedrate_mm_s*/) {
|
|||
|
||||
#if EXTRUDERS
|
||||
void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s) {
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
runout.reset();
|
||||
#endif
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
|
||||
current_position.e += length / planner.e_factor[active_extruder];
|
||||
line_to_current_position(fr_mm_s);
|
||||
planner.synchronize();
|
||||
|
@ -554,7 +550,8 @@ void restore_feedrate_and_scaling() {
|
|||
*/
|
||||
void update_software_endstops(const AxisEnum axis
|
||||
#if HAS_HOTEND_OFFSET
|
||||
, const uint8_t old_tool_index/*=0*/, const uint8_t new_tool_index/*=0*/
|
||||
, const uint8_t old_tool_index/*=0*/
|
||||
, const uint8_t new_tool_index/*=0*/
|
||||
#endif
|
||||
) {
|
||||
|
||||
|
@ -587,11 +584,7 @@ void restore_feedrate_and_scaling() {
|
|||
#elif ENABLED(DELTA)
|
||||
|
||||
soft_endstop.min[axis] = base_min_pos(axis);
|
||||
soft_endstop.max[axis] = (axis == Z_AXIS ? delta_height
|
||||
#if HAS_BED_PROBE
|
||||
- probe.offset.z
|
||||
#endif
|
||||
: base_max_pos(axis));
|
||||
soft_endstop.max[axis] = (axis == Z_AXIS) ? delta_height - TERN0(HAS_BED_PROBE, probe.offset.z) : base_max_pos(axis);
|
||||
|
||||
switch (axis) {
|
||||
case X_AXIS:
|
||||
|
@ -644,9 +637,7 @@ void restore_feedrate_and_scaling() {
|
|||
|
||||
#if IS_KINEMATIC
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
if (!all_axes_homed()) return;
|
||||
#endif
|
||||
if (TERN0(DELTA, !all_axes_homed())) return;
|
||||
|
||||
#if HAS_HOTEND_OFFSET && ENABLED(DELTA)
|
||||
// The effector center position will be the target minus the hotend offset.
|
||||
|
@ -656,11 +647,7 @@ void restore_feedrate_and_scaling() {
|
|||
constexpr xy_pos_t offs{0};
|
||||
#endif
|
||||
|
||||
if (true
|
||||
#if IS_SCARA
|
||||
&& TEST(axis_homed, X_AXIS) && TEST(axis_homed, Y_AXIS)
|
||||
#endif
|
||||
) {
|
||||
if (TERN1(IS_SCARA, TEST(axis_homed, X_AXIS) && TEST(axis_homed, Y_AXIS))) {
|
||||
const float dist_2 = HYPOT2(target.x - offs.x, target.y - offs.y);
|
||||
if (dist_2 > delta_max_radius_2)
|
||||
target *= float(delta_max_radius / SQRT(dist_2)); // 200 / 300 = 0.66
|
||||
|
@ -811,8 +798,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
|
|||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
, inv_duration
|
||||
#endif
|
||||
))
|
||||
break;
|
||||
)) break;
|
||||
}
|
||||
|
||||
// Ensure last segment arrives at target location.
|
||||
|
@ -883,8 +869,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
|
|||
#if ENABLED(SCARA_FEEDRATE_SCALING)
|
||||
, inv_duration
|
||||
#endif
|
||||
))
|
||||
break;
|
||||
)) break;
|
||||
}
|
||||
|
||||
// Since segment_distance is only approximate,
|
||||
|
@ -1090,9 +1075,7 @@ void prepare_line_to_destination() {
|
|||
|
||||
#endif // PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
if (dual_x_carriage_unpark()) return;
|
||||
#endif
|
||||
if (TERN0(DUAL_X_CARRIAGE, dual_x_carriage_unpark())) return;
|
||||
|
||||
if (
|
||||
#if UBL_SEGMENTED
|
||||
|
@ -1135,9 +1118,7 @@ bool axis_unhomed_error(uint8_t axis_bits/*=0x07*/) {
|
|||
);
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLN(msg);
|
||||
#if HAS_DISPLAY
|
||||
ui.set_status(msg);
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, ui.set_status(msg));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1147,9 +1128,8 @@ bool axis_unhomed_error(uint8_t axis_bits/*=0x07*/) {
|
|||
* Homing bump feedrate (mm/s)
|
||||
*/
|
||||
feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
if (axis == Z_AXIS) return MMM_TO_MMS(Z_PROBE_SPEED_SLOW);
|
||||
#endif
|
||||
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS))
|
||||
return MMM_TO_MMS(Z_PROBE_SPEED_SLOW);
|
||||
static const uint8_t homing_bump_divisor[] PROGMEM = HOMING_BUMP_DIVISOR;
|
||||
uint8_t hbd = pgm_read_byte(&homing_bump_divisor[axis]);
|
||||
if (hbd < 1) {
|
||||
|
@ -1224,9 +1204,7 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
sg_guard_period = millis() + default_sg_guard_duration;
|
||||
#endif
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, sg_guard_period = millis() + default_sg_guard_duration);
|
||||
|
||||
return stealth_states;
|
||||
}
|
||||
|
@ -1316,11 +1294,8 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
|
|||
#endif
|
||||
|
||||
// Only do some things when moving towards an endstop
|
||||
const int8_t axis_home_dir =
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
(axis == X_AXIS) ? x_home_dir(active_extruder) :
|
||||
#endif
|
||||
home_dir(axis);
|
||||
const int8_t axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
|
||||
? x_home_dir(active_extruder) : home_dir(axis);
|
||||
const bool is_home_dir = (axis_home_dir > 0) == (distance > 0);
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
|
@ -1334,9 +1309,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
|
|||
#endif
|
||||
|
||||
// Disable stealthChop if used. Enable diag1 pin on driver.
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
stealth_states = start_sensorless_homing_per_axis(axis);
|
||||
#endif
|
||||
TERN_(SENSORLESS_HOMING, stealth_states = start_sensorless_homing_per_axis(axis));
|
||||
}
|
||||
|
||||
#if IS_SCARA
|
||||
|
@ -1375,9 +1348,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
|
|||
endstops.validate_homing_move();
|
||||
|
||||
// Re-enable stealthChop if used. Disable diag1 pin on driver.
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
end_sensorless_homing_per_axis(axis, stealth_states);
|
||||
#endif
|
||||
TERN_(SENSORLESS_HOMING, end_sensorless_homing_per_axis(axis, stealth_states));
|
||||
}
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< do_homing_move(", axis_codes[axis], ")");
|
||||
|
@ -1417,11 +1388,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
|||
#if ENABLED(MORGAN_SCARA)
|
||||
scara_set_axis_is_at_home(axis);
|
||||
#elif ENABLED(DELTA)
|
||||
current_position[axis] = (axis == Z_AXIS ? delta_height
|
||||
#if HAS_BED_PROBE
|
||||
- probe.offset.z
|
||||
#endif
|
||||
: base_home_pos(axis));
|
||||
current_position[axis] = (axis == Z_AXIS) ? delta_height - TERN0(HAS_BED_PROBE, probe.offset.z) : base_home_pos(axis);
|
||||
#else
|
||||
current_position[axis] = base_home_pos(axis);
|
||||
#endif
|
||||
|
@ -1445,13 +1412,9 @@ void set_axis_is_at_home(const AxisEnum axis) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||
I2CPEM.homed(axis);
|
||||
#endif
|
||||
TERN_(I2C_POSITION_ENCODERS, I2CPEM.homed(axis));
|
||||
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
babystep.reset_total(axis);
|
||||
#endif
|
||||
TERN_(BABYSTEP_DISPLAY_TOTAL, babystep.reset_total(axis));
|
||||
|
||||
#if HAS_POSITION_SHIFT
|
||||
position_shift[axis] = 0;
|
||||
|
@ -1478,9 +1441,7 @@ void set_axis_not_trusted(const AxisEnum axis) {
|
|||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< set_axis_not_trusted(", axis_codes[axis], ")");
|
||||
|
||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||
I2CPEM.unhomed(axis);
|
||||
#endif
|
||||
TERN_(I2C_POSITION_ENCODERS, I2CPEM.unhomed(axis));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1596,31 +1557,20 @@ void homeaxis(const AxisEnum axis) {
|
|||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> homeaxis(", axis_codes[axis], ")");
|
||||
|
||||
const int axis_home_dir = (
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
axis == X_AXIS ? x_home_dir(active_extruder) :
|
||||
#endif
|
||||
home_dir(axis)
|
||||
);
|
||||
const int axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
|
||||
? x_home_dir(active_extruder) : home_dir(axis);
|
||||
|
||||
// Homing Z towards the bed? Deploy the Z probe or endstop.
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
if (axis == Z_AXIS && probe.deploy()) return;
|
||||
#endif
|
||||
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy()))
|
||||
return;
|
||||
|
||||
// Set flags for X, Y, Z motor locking
|
||||
#if HAS_EXTRA_ENDSTOPS
|
||||
switch (axis) {
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
case X_AXIS:
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
case Y_AXIS:
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
case Z_AXIS:
|
||||
#endif
|
||||
stepper.set_separate_multi_axis(true);
|
||||
TERN_(X_DUAL_ENDSTOPS, case X_AXIS:)
|
||||
TERN_(Y_DUAL_ENDSTOPS, case Y_AXIS:)
|
||||
TERN_(Z_MULTI_ENDSTOPS, case Z_AXIS:)
|
||||
stepper.set_separate_multi_axis(true);
|
||||
default: break;
|
||||
}
|
||||
#endif
|
||||
|
@ -1645,11 +1595,9 @@ void homeaxis(const AxisEnum axis) {
|
|||
#endif
|
||||
|
||||
// When homing Z with probe respect probe clearance
|
||||
const bool use_probe_bump = TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && home_bump_mm(Z_AXIS));
|
||||
const float bump = axis_home_dir * (
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
(axis == Z_AXIS && home_bump_mm(Z_AXIS)) ? _MAX(Z_CLEARANCE_BETWEEN_PROBES, home_bump_mm(Z_AXIS)) :
|
||||
#endif
|
||||
home_bump_mm(axis)
|
||||
use_probe_bump ? _MAX(Z_CLEARANCE_BETWEEN_PROBES, home_bump_mm(Z_AXIS)) : home_bump_mm(axis)
|
||||
);
|
||||
|
||||
// If a second homing move is configured...
|
||||
|
@ -1803,16 +1751,10 @@ void homeaxis(const AxisEnum axis) {
|
|||
// Reset flags for X, Y, Z motor locking
|
||||
switch (axis) {
|
||||
default: break;
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
case X_AXIS:
|
||||
#endif
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
case Y_AXIS:
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
case Z_AXIS:
|
||||
#endif
|
||||
stepper.set_separate_multi_axis(false);
|
||||
TERN_(X_DUAL_ENDSTOPS, case X_AXIS:)
|
||||
TERN_(Y_DUAL_ENDSTOPS, case Y_AXIS:)
|
||||
TERN_(Z_MULTI_ENDSTOPS, case Z_AXIS:)
|
||||
stepper.set_separate_multi_axis(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1868,9 +1810,8 @@ void homeaxis(const AxisEnum axis) {
|
|||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
planner.synchronize();
|
||||
#if IS_CORE
|
||||
if (axis != NORMAL_AXIS) safe_delay(200); // Short delay to allow belts to spring back
|
||||
#endif
|
||||
if (TERN0(IS_CORE, axis != NORMAL_AXIS))
|
||||
safe_delay(200); // Short delay to allow belts to spring back
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -44,13 +44,7 @@ FORCE_INLINE void set_all_unhomed() { axis_homed = 0; }
|
|||
FORCE_INLINE void set_all_unknown() { axis_known_position = 0; }
|
||||
|
||||
FORCE_INLINE bool homing_needed() {
|
||||
return !(
|
||||
#if ENABLED(HOME_AFTER_DEACTIVATE)
|
||||
all_axes_known()
|
||||
#else
|
||||
all_axes_homed()
|
||||
#endif
|
||||
);
|
||||
return !TERN(HOME_AFTER_DEACTIVATE, all_axes_known, all_axes_homed)();
|
||||
}
|
||||
|
||||
// Error margin to work around float imprecision
|
||||
|
@ -136,7 +130,7 @@ inline float home_bump_mm(const AxisEnum axis) {
|
|||
#if HAS_WORKSPACE_OFFSET
|
||||
void update_workspace_offset(const AxisEnum axis);
|
||||
#else
|
||||
#define update_workspace_offset(x) NOOP
|
||||
inline void update_workspace_offset(const AxisEnum) {}
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
|
|
|
@ -236,17 +236,11 @@ Planner::Planner() { init(); }
|
|||
|
||||
void Planner::init() {
|
||||
position.reset();
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.reset();
|
||||
#endif
|
||||
#if IS_KINEMATIC
|
||||
position_cart.reset();
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.reset());
|
||||
TERN_(IS_KINEMATIC, position_cart.reset());
|
||||
previous_speed.reset();
|
||||
previous_nominal_speed_sqr = 0;
|
||||
#if ABL_PLANAR
|
||||
bed_level_matrix.set_to_identity();
|
||||
#endif
|
||||
TERN_(ABL_PLANAR, bed_level_matrix.set_to_identity());
|
||||
clear_block_buffer();
|
||||
delay_before_delivering = 0;
|
||||
}
|
||||
|
@ -738,9 +732,8 @@ block_t* Planner::get_current_block() {
|
|||
// No trapezoid calculated? Don't execute yet.
|
||||
if (TEST(block->flag, BLOCK_BIT_RECALCULATE)) return nullptr;
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
block_buffer_runtime_us -= block->segment_time_us; // We can't be sure how long an active block will take, so don't count it.
|
||||
#endif
|
||||
// We can't be sure how long an active block will take, so don't count it.
|
||||
TERN_(HAS_SPI_LCD, block_buffer_runtime_us -= block->segment_time_us);
|
||||
|
||||
// As this block is busy, advance the nonbusy block pointer
|
||||
block_buffer_nonbusy = next_block_index(block_buffer_tail);
|
||||
|
@ -754,9 +747,7 @@ block_t* Planner::get_current_block() {
|
|||
}
|
||||
|
||||
// The queue became empty
|
||||
#if HAS_SPI_LCD
|
||||
clear_block_buffer_runtime(); // paranoia. Buffer is empty now - so reset accumulated time to zero.
|
||||
#endif
|
||||
TERN_(HAS_SPI_LCD, clear_block_buffer_runtime()); // paranoia. Buffer is empty now - so reset accumulated time to zero.
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1304,12 +1295,8 @@ void Planner::check_axes_activity() {
|
|||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
tail_valve_pressure = block->valve_pressure;
|
||||
#endif
|
||||
#if HAS_HEATER_2
|
||||
tail_e_to_p_pressure = block->e_to_p_pressure;
|
||||
#endif
|
||||
TERN_(HAS_HEATER_1, tail_valve_pressure = block->valve_pressure);
|
||||
TERN_(HAS_HEATER_2, tail_e_to_p_pressure = block->e_to_p_pressure);
|
||||
#endif
|
||||
|
||||
#if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z, DISABLE_E)
|
||||
|
@ -1321,9 +1308,7 @@ void Planner::check_axes_activity() {
|
|||
}
|
||||
else {
|
||||
|
||||
#if HAS_CUTTER
|
||||
cutter.refresh();
|
||||
#endif
|
||||
TERN_(HAS_CUTTER, cutter.refresh());
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
FANS_LOOP(i)
|
||||
|
@ -1331,30 +1316,18 @@ void Planner::check_axes_activity() {
|
|||
#endif
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
tail_valve_pressure = baricuda_valve_pressure;
|
||||
#endif
|
||||
#if HAS_HEATER_2
|
||||
tail_e_to_p_pressure = baricuda_e_to_p_pressure;
|
||||
#endif
|
||||
TERN_(HAS_HEATER_1, tail_valve_pressure = baricuda_valve_pressure);
|
||||
TERN_(HAS_HEATER_2, tail_e_to_p_pressure = baricuda_e_to_p_pressure);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Disable inactive axes
|
||||
//
|
||||
#if ENABLED(DISABLE_X)
|
||||
if (!axis_active.x) DISABLE_AXIS_X();
|
||||
#endif
|
||||
#if ENABLED(DISABLE_Y)
|
||||
if (!axis_active.y) DISABLE_AXIS_Y();
|
||||
#endif
|
||||
#if ENABLED(DISABLE_Z)
|
||||
if (!axis_active.z) DISABLE_AXIS_Z();
|
||||
#endif
|
||||
#if ENABLED(DISABLE_E)
|
||||
if (!axis_active.e) disable_e_steppers();
|
||||
#endif
|
||||
if (TERN0(DISABLE_X, !axis_active.x)) DISABLE_AXIS_X();
|
||||
if (TERN0(DISABLE_Y, !axis_active.y)) DISABLE_AXIS_Y();
|
||||
if (TERN0(DISABLE_Z, !axis_active.z)) DISABLE_AXIS_Z();
|
||||
if (TERN0(DISABLE_E, !axis_active.e)) disable_e_steppers();
|
||||
|
||||
//
|
||||
// Update Fan speeds
|
||||
|
@ -1391,43 +1364,21 @@ void Planner::check_axes_activity() {
|
|||
#endif
|
||||
#define FAN_SET(F) do{ KICKSTART_FAN(F); _FAN_SET(F); }while(0)
|
||||
|
||||
#if HAS_FAN0
|
||||
FAN_SET(0);
|
||||
#endif
|
||||
#if HAS_FAN1
|
||||
FAN_SET(1);
|
||||
#endif
|
||||
#if HAS_FAN2
|
||||
FAN_SET(2);
|
||||
#endif
|
||||
#if HAS_FAN3
|
||||
FAN_SET(3);
|
||||
#endif
|
||||
#if HAS_FAN4
|
||||
FAN_SET(4);
|
||||
#endif
|
||||
#if HAS_FAN5
|
||||
FAN_SET(5);
|
||||
#endif
|
||||
#if HAS_FAN6
|
||||
FAN_SET(6);
|
||||
#endif
|
||||
#if HAS_FAN7
|
||||
FAN_SET(7);
|
||||
#endif
|
||||
TERN_(HAS_FAN0, FAN_SET(0));
|
||||
TERN_(HAS_FAN1, FAN_SET(1));
|
||||
TERN_(HAS_FAN2, FAN_SET(2));
|
||||
TERN_(HAS_FAN3, FAN_SET(3));
|
||||
TERN_(HAS_FAN4, FAN_SET(4));
|
||||
TERN_(HAS_FAN5, FAN_SET(5));
|
||||
TERN_(HAS_FAN6, FAN_SET(6));
|
||||
TERN_(HAS_FAN7, FAN_SET(7));
|
||||
#endif // FAN_COUNT > 0
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
getHighESpeed();
|
||||
#endif
|
||||
TERN_(AUTOTEMP, getHighESpeed());
|
||||
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
analogWrite(pin_t(HEATER_1_PIN), tail_valve_pressure);
|
||||
#endif
|
||||
#if HAS_HEATER_2
|
||||
analogWrite(pin_t(HEATER_2_PIN), tail_e_to_p_pressure);
|
||||
#endif
|
||||
TERN_(HAS_HEATER_1, analogWrite(pin_t(HEATER_1_PIN), tail_valve_pressure));
|
||||
TERN_(HAS_HEATER_2, analogWrite(pin_t(HEATER_2_PIN), tail_e_to_p_pressure));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1477,11 +1428,8 @@ void Planner::check_axes_activity() {
|
|||
#if HAS_LEVELING
|
||||
|
||||
constexpr xy_pos_t level_fulcrum = {
|
||||
#if ENABLED(Z_SAFE_HOMING)
|
||||
Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT
|
||||
#else
|
||||
X_HOME_POS, Y_HOME_POS
|
||||
#endif
|
||||
TERN(Z_SAFE_HOMING, Z_SAFE_HOMING_X_POINT, X_HOME_POS),
|
||||
TERN(Z_SAFE_HOMING, Z_SAFE_HOMING_Y_POINT, Y_HOME_POS)
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1779,9 +1727,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (thermalManager.tooColdToExtrude(extruder)) {
|
||||
position.e = target.e; // Behave as if the move really took place, but ignore E part
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.e = target_float.e;
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = target_float.e);
|
||||
de = 0; // no difference
|
||||
SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP);
|
||||
}
|
||||
|
@ -1801,9 +1747,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
#endif
|
||||
if (ignore_e) {
|
||||
position.e = target.e; // Behave as if the move really took place, but ignore E part
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.e = target_float.e;
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = target_float.e);
|
||||
de = 0; // no difference
|
||||
SERIAL_ECHO_MSG(STR_ERR_LONG_EXTRUDE_STOP);
|
||||
}
|
||||
|
@ -1882,9 +1826,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
|
||||
*/
|
||||
struct DistanceMM : abce_float_t {
|
||||
#if IS_CORE
|
||||
xyz_pos_t head;
|
||||
#endif
|
||||
TERN_(IS_CORE, xyz_pos_t head);
|
||||
} steps_dist_mm;
|
||||
#if IS_CORE
|
||||
#if CORE_IS_XY
|
||||
|
@ -1918,9 +1860,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
steps_dist_mm.e = 0.0f;
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
e_move_accumulator += steps_dist_mm.e;
|
||||
#endif
|
||||
TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += steps_dist_mm.e);
|
||||
|
||||
if (block->steps.a < MIN_STEPS_PER_SEGMENT && block->steps.b < MIN_STEPS_PER_SEGMENT && block->steps.c < MIN_STEPS_PER_SEGMENT) {
|
||||
block->millimeters = (0
|
||||
|
@ -1954,9 +1894,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
* A correction function is permitted to add steps to an axis, it
|
||||
* should *never* remove steps!
|
||||
*/
|
||||
#if ENABLED(BACKLASH_COMPENSATION)
|
||||
backlash.add_correction_steps(da, db, dc, dm, block);
|
||||
#endif
|
||||
TERN_(BACKLASH_COMPENSATION, backlash.add_correction_steps(da, db, dc, dm, block));
|
||||
}
|
||||
|
||||
#if EXTRUDERS
|
||||
|
@ -1972,9 +1910,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
MIXER_POPULATE_BLOCK();
|
||||
#endif
|
||||
|
||||
#if HAS_CUTTER
|
||||
block->cutter_power = cutter.power;
|
||||
#endif
|
||||
TERN_(HAS_CUTTER, block->cutter_power = cutter.power);
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i];
|
||||
|
@ -2026,9 +1962,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
// Enable extruder(s)
|
||||
#if EXTRUDERS
|
||||
if (esteps) {
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.power_on();
|
||||
#endif
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
|
||||
#if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder
|
||||
|
||||
|
@ -2195,9 +2129,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
if (!block->steps.a && !block->steps.b && !block->steps.c) {
|
||||
// convert to: acceleration steps/sec^2
|
||||
accel = CEIL(settings.retract_acceleration * steps_per_mm);
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
block->use_advance_lead = false;
|
||||
#endif
|
||||
TERN_(LIN_ADVANCE, block->use_advance_lead = false);
|
||||
}
|
||||
else {
|
||||
#define LIMIT_ACCEL_LONG(AXIS,INDX) do{ \
|
||||
|
@ -2260,9 +2192,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
block->use_advance_lead = false;
|
||||
else {
|
||||
const uint32_t max_accel_steps_per_s2 = MAX_E_JERK / (extruder_advance_K[active_extruder] * block->e_D_ratio) * steps_per_mm;
|
||||
#if ENABLED(LA_DEBUG)
|
||||
if (accel > max_accel_steps_per_s2) SERIAL_ECHOLNPGM("Acceleration limited.");
|
||||
#endif
|
||||
if (TERN0(LA_DEBUG, accel > max_accel_steps_per_s2))
|
||||
SERIAL_ECHOLNPGM("Acceleration limited.");
|
||||
NOMORE(accel, max_accel_steps_per_s2);
|
||||
}
|
||||
}
|
||||
|
@ -2561,22 +2492,14 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
previous_speed = current_speed;
|
||||
previous_nominal_speed_sqr = block->nominal_speed_sqr;
|
||||
|
||||
// Update the position
|
||||
position = target;
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float = target_float;
|
||||
#endif
|
||||
position = target; // Update the position
|
||||
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
mixer.gradient_control(target_float.z);
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float = target_float);
|
||||
TERN_(GRADIENT_MIX, mixer.gradient_control(target_float.z));
|
||||
TERN_(POWER_LOSS_RECOVERY, block->sdpos = recovery.command_sdpos());
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
block->sdpos = recovery.command_sdpos();
|
||||
#endif
|
||||
return true; // Movement was accepted
|
||||
|
||||
// Movement was accepted
|
||||
return true;
|
||||
} // _populate_block()
|
||||
|
||||
/**
|
||||
|
@ -2654,15 +2577,9 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
|
|||
#endif
|
||||
|
||||
// DRYRUN prevents E moves from taking place
|
||||
if (DEBUGGING(DRYRUN)
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
|| cancelable.skipping
|
||||
#endif
|
||||
) {
|
||||
if (DEBUGGING(DRYRUN) || TERN0(CANCEL_OBJECTS, cancelable.skipping)) {
|
||||
position.e = target.e;
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.e = e;
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = e);
|
||||
}
|
||||
|
||||
/* <-- add a slash to enable
|
||||
|
@ -2697,16 +2614,14 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
|
|||
//*/
|
||||
|
||||
// Queue the movement
|
||||
if (
|
||||
!_buffer_steps(target
|
||||
if (!_buffer_steps(target
|
||||
#if HAS_POSITION_FLOAT
|
||||
, target_float
|
||||
#endif
|
||||
#if HAS_DIST_MM_ARG
|
||||
, cart_dist_mm
|
||||
#endif
|
||||
, fr_mm_s, extruder, millimeters
|
||||
)
|
||||
, fr_mm_s, extruder, millimeters)
|
||||
) return false;
|
||||
|
||||
stepper.wake_up();
|
||||
|
@ -2730,9 +2645,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
|
|||
#endif
|
||||
) {
|
||||
xyze_pos_t machine = { rx, ry, rz, e };
|
||||
#if HAS_POSITION_MODIFIERS
|
||||
apply_modifiers(machine);
|
||||
#endif
|
||||
TERN_(HAS_POSITION_MODIFIERS, apply_modifiers(machine));
|
||||
|
||||
#if IS_KINEMATIC
|
||||
|
||||
|
@ -2785,12 +2698,8 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
|
|||
*/
|
||||
|
||||
void Planner::set_machine_position_mm(const float &a, const float &b, const float &c, const float &e) {
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
last_extruder = active_extruder;
|
||||
#endif
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.set(a, b, c, e);
|
||||
#endif
|
||||
TERN_(DISTINCT_E_FACTORS, last_extruder = active_extruder);
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.set(a, b, c, e));
|
||||
position.set(LROUND(a * settings.axis_steps_per_mm[A_AXIS]),
|
||||
LROUND(b * settings.axis_steps_per_mm[B_AXIS]),
|
||||
LROUND(c * settings.axis_steps_per_mm[C_AXIS]),
|
||||
|
@ -2807,13 +2716,11 @@ void Planner::set_machine_position_mm(const float &a, const float &b, const floa
|
|||
void Planner::set_position_mm(const float &rx, const float &ry, const float &rz, const float &e) {
|
||||
xyze_pos_t machine = { rx, ry, rz, e };
|
||||
#if HAS_POSITION_MODIFIERS
|
||||
{
|
||||
apply_modifiers(machine
|
||||
#if HAS_LEVELING
|
||||
, true
|
||||
#endif
|
||||
);
|
||||
}
|
||||
#endif
|
||||
#if IS_KINEMATIC
|
||||
position_cart.set(rx, ry, rz, e);
|
||||
|
@ -2829,21 +2736,13 @@ void Planner::set_position_mm(const float &rx, const float &ry, const float &rz,
|
|||
*/
|
||||
void Planner::set_e_position_mm(const float &e) {
|
||||
const uint8_t axis_index = E_AXIS_N(active_extruder);
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
last_extruder = active_extruder;
|
||||
#endif
|
||||
#if ENABLED(FWRETRACT)
|
||||
float e_new = e - fwretract.current_retract[active_extruder];
|
||||
#else
|
||||
const float e_new = e;
|
||||
#endif
|
||||
TERN_(DISTINCT_E_FACTORS, last_extruder = active_extruder);
|
||||
|
||||
const float e_new = e - TERN0(FWRETRACT, fwretract.current_retract[active_extruder]);
|
||||
position.e = LROUND(settings.axis_steps_per_mm[axis_index] * e_new);
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float.e = e_new;
|
||||
#endif
|
||||
#if IS_KINEMATIC
|
||||
position_cart.e = e;
|
||||
#endif
|
||||
TERN_(HAS_POSITION_FLOAT, position_float.e = e_new);
|
||||
TERN_(IS_KINEMATIC, position_cart.e = e);
|
||||
|
||||
if (has_blocks_queued())
|
||||
buffer_sync_block();
|
||||
else
|
||||
|
@ -2863,9 +2762,7 @@ void Planner::reset_acceleration_rates() {
|
|||
if (AXIS_CONDITION) NOLESS(highest_rate, max_acceleration_steps_per_s2[i]);
|
||||
}
|
||||
cutoff_long = 4294967295UL / highest_rate; // 0xFFFFFFFFUL
|
||||
#if HAS_LINEAR_E_JERK
|
||||
recalculate_max_e_jerk();
|
||||
#endif
|
||||
TERN_(HAS_LINEAR_E_JERK, recalculate_max_e_jerk());
|
||||
}
|
||||
|
||||
// Recalculate position, steps_to_mm if settings.axis_steps_per_mm changes!
|
||||
|
|
|
@ -197,7 +197,9 @@ typedef struct block_t {
|
|||
|
||||
} block_t;
|
||||
|
||||
#define HAS_POSITION_FLOAT ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL)
|
||||
#if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL)
|
||||
#define HAS_POSITION_FLOAT 1
|
||||
#endif
|
||||
|
||||
#define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1))
|
||||
|
||||
|
@ -547,44 +549,22 @@ class Planner {
|
|||
#if HAS_POSITION_MODIFIERS
|
||||
FORCE_INLINE static void apply_modifiers(xyze_pos_t &pos
|
||||
#if HAS_LEVELING
|
||||
, bool leveling =
|
||||
#if PLANNER_LEVELING
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
, bool leveling = ENABLED(PLANNER_LEVELING)
|
||||
#endif
|
||||
) {
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
skew(pos);
|
||||
#endif
|
||||
#if HAS_LEVELING
|
||||
if (leveling) apply_leveling(pos);
|
||||
#endif
|
||||
#if ENABLED(FWRETRACT)
|
||||
apply_retract(pos);
|
||||
#endif
|
||||
TERN_(SKEW_CORRECTION, skew(pos));
|
||||
TERN_(HAS_LEVELING, if (leveling) apply_leveling(pos));
|
||||
TERN_(FWRETRACT, apply_retract(pos));
|
||||
}
|
||||
|
||||
FORCE_INLINE static void unapply_modifiers(xyze_pos_t &pos
|
||||
#if HAS_LEVELING
|
||||
, bool leveling =
|
||||
#if PLANNER_LEVELING
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
, bool leveling = ENABLED(PLANNER_LEVELING)
|
||||
#endif
|
||||
) {
|
||||
#if ENABLED(FWRETRACT)
|
||||
unapply_retract(pos);
|
||||
#endif
|
||||
#if HAS_LEVELING
|
||||
if (leveling) unapply_leveling(pos);
|
||||
#endif
|
||||
#if ENABLED(SKEW_CORRECTION)
|
||||
unskew(pos);
|
||||
#endif
|
||||
TERN_(FWRETRACT, unapply_retract(pos));
|
||||
TERN_(HAS_LEVELING, if (leveling) unapply_leveling(pos));
|
||||
TERN_(SKEW_CORRECTION, unskew(pos));
|
||||
}
|
||||
#endif // HAS_POSITION_MODIFIERS
|
||||
|
||||
|
|
|
@ -70,19 +70,14 @@ millis_t PrintCounter::lastDuration;
|
|||
bool PrintCounter::loaded = false;
|
||||
|
||||
millis_t PrintCounter::deltaDuration() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("deltaDuration"));
|
||||
#endif
|
||||
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("deltaDuration")));
|
||||
millis_t tmp = lastDuration;
|
||||
lastDuration = duration();
|
||||
return lastDuration - tmp;
|
||||
}
|
||||
|
||||
void PrintCounter::incFilamentUsed(float const &amount) {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("incFilamentUsed"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("incFilamentUsed")));
|
||||
|
||||
// Refuses to update data if object is not loaded
|
||||
if (!isLoaded()) return;
|
||||
|
@ -91,9 +86,7 @@ void PrintCounter::incFilamentUsed(float const &amount) {
|
|||
}
|
||||
|
||||
void PrintCounter::initStats() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("initStats"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("initStats")));
|
||||
|
||||
loaded = true;
|
||||
data = { 0, 0, 0, 0, 0.0
|
||||
|
@ -129,9 +122,7 @@ void PrintCounter::initStats() {
|
|||
#endif
|
||||
|
||||
void PrintCounter::loadStats() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("loadStats"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("loadStats")));
|
||||
|
||||
// Check if the EEPROM block is initialized
|
||||
uint8_t value = 0;
|
||||
|
@ -164,9 +155,7 @@ void PrintCounter::loadStats() {
|
|||
}
|
||||
|
||||
void PrintCounter::saveStats() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("saveStats"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("saveStats")));
|
||||
|
||||
// Refuses to save data if object is not loaded
|
||||
if (!isLoaded()) return;
|
||||
|
@ -176,9 +165,7 @@ void PrintCounter::saveStats() {
|
|||
persistentStore.write_data(address + sizeof(uint8_t), (uint8_t*)&data, sizeof(printStatistics));
|
||||
persistentStore.access_finish();
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onConfigurationStoreWritten(true);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(true));
|
||||
}
|
||||
|
||||
#if HAS_SERVICE_INTERVALS
|
||||
|
@ -239,9 +226,7 @@ void PrintCounter::tick() {
|
|||
|
||||
static uint32_t update_next; // = 0
|
||||
if (ELAPSED(now, update_next)) {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("tick"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("tick")));
|
||||
millis_t delta = deltaDuration();
|
||||
data.printTime += delta;
|
||||
|
||||
|
@ -267,9 +252,7 @@ void PrintCounter::tick() {
|
|||
|
||||
// @Override
|
||||
bool PrintCounter::start() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("start"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("start")));
|
||||
|
||||
bool paused = isPaused();
|
||||
|
||||
|
@ -286,9 +269,7 @@ bool PrintCounter::start() {
|
|||
|
||||
// @Override
|
||||
bool PrintCounter::stop() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("stop"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("stop")));
|
||||
|
||||
if (super::stop()) {
|
||||
data.finishedPrints++;
|
||||
|
@ -305,9 +286,7 @@ bool PrintCounter::stop() {
|
|||
|
||||
// @Override
|
||||
void PrintCounter::reset() {
|
||||
#if ENABLED(DEBUG_PRINTCOUNTER)
|
||||
debug(PSTR("stop"));
|
||||
#endif
|
||||
TERN_(DEBUG_PRINTCOUNTER, debug(PSTR("stop")));
|
||||
|
||||
super::reset();
|
||||
lastDuration = 0;
|
||||
|
|
|
@ -134,9 +134,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
|
|||
LCD_MESSAGEPGM(MSG_MANUAL_DEPLOY_TOUCHMI);
|
||||
ui.return_to_status();
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI"), CONTINUE_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI"), CONTINUE_STR));
|
||||
wait_for_user_response();
|
||||
ui.reset_status();
|
||||
ui.goto_screen(prev_screen);
|
||||
|
@ -241,23 +239,17 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
|
|||
#if QUIET_PROBING
|
||||
|
||||
void Probe::set_probing_paused(const bool p) {
|
||||
#if ENABLED(PROBING_HEATERS_OFF)
|
||||
thermalManager.pause(p);
|
||||
#endif
|
||||
#if ENABLED(PROBING_FANS_OFF)
|
||||
thermalManager.set_fans_paused(p);
|
||||
#endif
|
||||
TERN_(PROBING_HEATERS_OFF, thermalManager.pause(p));
|
||||
TERN_(PROBING_FANS_OFF, thermalManager.set_fans_paused(p));
|
||||
#if ENABLED(PROBING_STEPPERS_OFF)
|
||||
disable_e_steppers();
|
||||
#if NONE(DELTA, HOME_AFTER_DEACTIVATE)
|
||||
DISABLE_AXIS_X(); DISABLE_AXIS_Y();
|
||||
#endif
|
||||
#endif
|
||||
if (p) safe_delay(
|
||||
if (p) safe_delay(25
|
||||
#if DELAY_BEFORE_PROBING > 25
|
||||
DELAY_BEFORE_PROBING
|
||||
#else
|
||||
25
|
||||
- 25 + DELAY_BEFORE_PROBING
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
@ -295,22 +287,13 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
|||
serialprintPGM(ds_str);
|
||||
SERIAL_EOL();
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), CONTINUE_STR);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe")));
|
||||
|
||||
wait_for_user_response();
|
||||
ui.reset_status();
|
||||
|
||||
} while(
|
||||
#if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
} while (ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED));
|
||||
|
||||
#endif // PAUSE_BEFORE_DEPLOY_STOW
|
||||
|
||||
|
@ -381,11 +364,7 @@ bool Probe::set_deployed(const bool deploy) {
|
|||
do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
|
||||
|
||||
#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
|
||||
if (axis_unhomed_error(
|
||||
#if ENABLED(Z_PROBE_SLED)
|
||||
_BV(X_AXIS)
|
||||
#endif
|
||||
)) {
|
||||
if (axis_unhomed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) {
|
||||
SERIAL_ERROR_MSG(STR_STOP_UNHOMED);
|
||||
stop();
|
||||
return true;
|
||||
|
@ -481,9 +460,7 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
|
|||
endstops.enable(true);
|
||||
#endif
|
||||
|
||||
#if QUIET_PROBING
|
||||
set_probing_paused(true);
|
||||
#endif
|
||||
TERN_(QUIET_PROBING, set_probing_paused(true));
|
||||
|
||||
// Move down until the probe is triggered
|
||||
do_blocking_move_to_z(z, fr_mm_s);
|
||||
|
@ -493,19 +470,11 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
|
|||
#if BOTH(DELTA, SENSORLESS_PROBING)
|
||||
endstops.trigger_state() & (_BV(X_MIN) | _BV(Y_MIN) | _BV(Z_MIN))
|
||||
#else
|
||||
TEST(endstops.trigger_state(),
|
||||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||
Z_MIN
|
||||
#else
|
||||
Z_MIN_PROBE
|
||||
#endif
|
||||
)
|
||||
TEST(endstops.trigger_state(), TERN(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, Z_MIN, Z_MIN_PROBE))
|
||||
#endif
|
||||
;
|
||||
|
||||
#if QUIET_PROBING
|
||||
set_probing_paused(false);
|
||||
#endif
|
||||
TERN_(QUIET_PROBING, set_probing_paused(false));
|
||||
|
||||
// Re-enable stealthChop if used. Disable diag1 pin on driver.
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
|
@ -615,9 +584,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
|||
if (try_to_probe(PSTR("SLOW"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW),
|
||||
sanity_check, _MAX(Z_CLEARANCE_MULTI_PROBE, 4) / 2) ) return NAN;
|
||||
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
backlash.measure_with_probe();
|
||||
#endif
|
||||
TERN_(MEASURE_BACKLASH_WHEN_PROBING, backlash.measure_with_probe());
|
||||
|
||||
const float z = current_position.z;
|
||||
|
||||
|
@ -638,11 +605,8 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
|||
|
||||
#if TOTAL_PROBING > 2
|
||||
// Small Z raise after all but the last probe
|
||||
if (p
|
||||
#if EXTRA_PROBING
|
||||
< TOTAL_PROBING - 1
|
||||
#endif
|
||||
) do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
|
||||
if (TERN(EXTRA_PROBING, p < TOTAL_PROBING - 1, p))
|
||||
do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
HAL_SERVO_LIB servo[NUM_SERVOS];
|
||||
|
||||
#if ENABLED(EDITABLE_SERVO_ANGLES)
|
||||
uint16_t servo_angles[NUM_SERVOS][2];
|
||||
#endif
|
||||
TERN_(EDITABLE_SERVO_ANGLES, uint16_t servo_angles[NUM_SERVOS][2]);
|
||||
|
||||
void servo_init() {
|
||||
#if NUM_SERVOS >= 1 && HAS_SERVO_0
|
||||
|
|
|
@ -470,11 +470,9 @@ void Stepper::set_directions() {
|
|||
#if HAS_X_DIR
|
||||
SET_STEP_DIR(X); // A
|
||||
#endif
|
||||
|
||||
#if HAS_Y_DIR
|
||||
SET_STEP_DIR(Y); // B
|
||||
#endif
|
||||
|
||||
#if HAS_Z_DIR
|
||||
SET_STEP_DIR(Z); // C
|
||||
#endif
|
||||
|
@ -1503,8 +1501,12 @@ void Stepper::isr() {
|
|||
ENABLE_ISRS();
|
||||
}
|
||||
|
||||
#define ISR_PULSE_CONTROL (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE)
|
||||
#define ISR_MULTI_STEPS (ISR_PULSE_CONTROL && DISABLED(I2S_STEPPER_STREAM))
|
||||
#if MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE
|
||||
#define ISR_PULSE_CONTROL 1
|
||||
#endif
|
||||
#if ISR_PULSE_CONTROL && DISABLED(I2S_STEPPER_STREAM)
|
||||
#define ISR_MULTI_STEPS 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This phase of the ISR should ONLY create the pulses for the steppers.
|
||||
|
@ -1872,13 +1874,9 @@ uint32_t Stepper::block_phase_isr() {
|
|||
return interval; // No more queued movements!
|
||||
}
|
||||
|
||||
#if HAS_CUTTER
|
||||
cutter.apply_power(current_block->cutter_power);
|
||||
#endif
|
||||
TERN_(HAS_CUTTER, cutter.apply_power(current_block->cutter_power));
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.info.sdpos = current_block->sdpos;
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.info.sdpos = current_block->sdpos);
|
||||
|
||||
// Flag all moving axes for proper endstop handling
|
||||
|
||||
|
@ -2024,9 +2022,7 @@ uint32_t Stepper::block_phase_isr() {
|
|||
last_moved_extruder = stepper_extruder;
|
||||
#endif
|
||||
|
||||
#if HAS_L64XX
|
||||
L64XX_OK_to_power_up = true;
|
||||
#endif
|
||||
TERN_(HAS_L64XX, L64XX_OK_to_power_up = true);
|
||||
set_directions();
|
||||
}
|
||||
|
||||
|
@ -2262,17 +2258,11 @@ void Stepper::init() {
|
|||
#endif
|
||||
|
||||
// Init Microstepping Pins
|
||||
#if HAS_MICROSTEPS
|
||||
microstep_init();
|
||||
#endif
|
||||
TERN_(HAS_MICROSTEPS, microstep_init());
|
||||
|
||||
// Init Dir Pins
|
||||
#if HAS_X_DIR
|
||||
X_DIR_INIT();
|
||||
#endif
|
||||
#if HAS_X2_DIR
|
||||
X2_DIR_INIT();
|
||||
#endif
|
||||
TERN_(HAS_X_DIR, X_DIR_INIT());
|
||||
TERN_(HAS_X2_DIR, X2_DIR_INIT());
|
||||
#if HAS_Y_DIR
|
||||
Y_DIR_INIT();
|
||||
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
|
||||
|
@ -2466,9 +2456,7 @@ void Stepper::init() {
|
|||
set_directions();
|
||||
|
||||
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
initialized = true;
|
||||
#endif
|
||||
TERN_(HAS_MOTOR_CURRENT_PWM, initialized = true);
|
||||
digipot_init();
|
||||
#endif
|
||||
}
|
||||
|
@ -2948,112 +2936,112 @@ void Stepper::report_positions() {
|
|||
*/
|
||||
|
||||
void Stepper::microstep_init() {
|
||||
#if HAS_X_MICROSTEPS
|
||||
#if HAS_X_MS_PINS
|
||||
SET_OUTPUT(X_MS1_PIN);
|
||||
SET_OUTPUT(X_MS2_PIN);
|
||||
#if PIN_EXISTS(X_MS3)
|
||||
SET_OUTPUT(X_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_X2_MICROSTEPS
|
||||
#if HAS_X2_MS_PINS
|
||||
SET_OUTPUT(X2_MS1_PIN);
|
||||
SET_OUTPUT(X2_MS2_PIN);
|
||||
#if PIN_EXISTS(X2_MS3)
|
||||
SET_OUTPUT(X2_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS
|
||||
SET_OUTPUT(Y_MS1_PIN);
|
||||
SET_OUTPUT(Y_MS2_PIN);
|
||||
#if PIN_EXISTS(Y_MS3)
|
||||
SET_OUTPUT(Y_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y2_MS_PINS
|
||||
SET_OUTPUT(Y2_MS1_PIN);
|
||||
SET_OUTPUT(Y2_MS2_PIN);
|
||||
#if PIN_EXISTS(Y2_MS3)
|
||||
SET_OUTPUT(Y2_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z_MICROSTEPS
|
||||
#if HAS_Z_MS_PINS
|
||||
SET_OUTPUT(Z_MS1_PIN);
|
||||
SET_OUTPUT(Z_MS2_PIN);
|
||||
#if PIN_EXISTS(Z_MS3)
|
||||
SET_OUTPUT(Z_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z2_MICROSTEPS
|
||||
#if HAS_Z2_MS_PINS
|
||||
SET_OUTPUT(Z2_MS1_PIN);
|
||||
SET_OUTPUT(Z2_MS2_PIN);
|
||||
#if PIN_EXISTS(Z2_MS3)
|
||||
SET_OUTPUT(Z2_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z3_MICROSTEPS
|
||||
#if HAS_Z3_MS_PINS
|
||||
SET_OUTPUT(Z3_MS1_PIN);
|
||||
SET_OUTPUT(Z3_MS2_PIN);
|
||||
#if PIN_EXISTS(Z3_MS3)
|
||||
SET_OUTPUT(Z3_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_Z4_MICROSTEPS
|
||||
#if HAS_Z4_MS_PINS
|
||||
SET_OUTPUT(Z4_MS1_PIN);
|
||||
SET_OUTPUT(Z4_MS2_PIN);
|
||||
#if PIN_EXISTS(Z4_MS3)
|
||||
SET_OUTPUT(Z4_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS
|
||||
#if HAS_E0_MS_PINS
|
||||
SET_OUTPUT(E0_MS1_PIN);
|
||||
SET_OUTPUT(E0_MS2_PIN);
|
||||
#if PIN_EXISTS(E0_MS3)
|
||||
SET_OUTPUT(E0_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS
|
||||
#if HAS_E1_MS_PINS
|
||||
SET_OUTPUT(E1_MS1_PIN);
|
||||
SET_OUTPUT(E1_MS2_PIN);
|
||||
#if PIN_EXISTS(E1_MS3)
|
||||
SET_OUTPUT(E1_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS
|
||||
#if HAS_E2_MS_PINS
|
||||
SET_OUTPUT(E2_MS1_PIN);
|
||||
SET_OUTPUT(E2_MS2_PIN);
|
||||
#if PIN_EXISTS(E2_MS3)
|
||||
SET_OUTPUT(E2_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS
|
||||
#if HAS_E3_MS_PINS
|
||||
SET_OUTPUT(E3_MS1_PIN);
|
||||
SET_OUTPUT(E3_MS2_PIN);
|
||||
#if PIN_EXISTS(E3_MS3)
|
||||
SET_OUTPUT(E3_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS
|
||||
#if HAS_E4_MS_PINS
|
||||
SET_OUTPUT(E4_MS1_PIN);
|
||||
SET_OUTPUT(E4_MS2_PIN);
|
||||
#if PIN_EXISTS(E4_MS3)
|
||||
SET_OUTPUT(E4_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS
|
||||
#if HAS_E5_MS_PINS
|
||||
SET_OUTPUT(E5_MS1_PIN);
|
||||
SET_OUTPUT(E5_MS2_PIN);
|
||||
#if PIN_EXISTS(E5_MS3)
|
||||
SET_OUTPUT(E5_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS
|
||||
#if HAS_E6_MS_PINS
|
||||
SET_OUTPUT(E6_MS1_PIN);
|
||||
SET_OUTPUT(E6_MS2_PIN);
|
||||
#if PIN_EXISTS(E6_MS3)
|
||||
SET_OUTPUT(E6_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS
|
||||
#if HAS_E7_MS_PINS
|
||||
SET_OUTPUT(E7_MS1_PIN);
|
||||
SET_OUTPUT(E7_MS2_PIN);
|
||||
#if PIN_EXISTS(E7_MS3)
|
||||
|
@ -3068,188 +3056,188 @@ void Stepper::report_positions() {
|
|||
|
||||
void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) {
|
||||
if (ms1 >= 0) switch (driver) {
|
||||
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS
|
||||
case 0:
|
||||
#if HAS_X_MICROSTEPS
|
||||
#if HAS_X_MS_PINS
|
||||
WRITE(X_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_X2_MICROSTEPS
|
||||
#if HAS_X2_MS_PINS
|
||||
WRITE(X2_MS1_PIN, ms1);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS || HAS_Y2_MS_PINS
|
||||
case 1:
|
||||
#if HAS_Y_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS
|
||||
WRITE(Y_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y2_MS_PINS
|
||||
WRITE(Y2_MS1_PIN, ms1);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOME_Z_MICROSTEPS
|
||||
#if HAS_SOME_Z_MS_PINS
|
||||
case 2:
|
||||
#if HAS_Z_MICROSTEPS
|
||||
#if HAS_Z_MS_PINS
|
||||
WRITE(Z_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_Z2_MICROSTEPS
|
||||
#if HAS_Z2_MS_PINS
|
||||
WRITE(Z2_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_Z3_MICROSTEPS
|
||||
#if HAS_Z3_MS_PINS
|
||||
WRITE(Z3_MS1_PIN, ms1);
|
||||
#endif
|
||||
#if HAS_Z4_MICROSTEPS
|
||||
#if HAS_Z4_MS_PINS
|
||||
WRITE(Z4_MS1_PIN, ms1);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS
|
||||
#if HAS_E0_MS_PINS
|
||||
case 3: WRITE(E0_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS
|
||||
#if HAS_E1_MS_PINS
|
||||
case 4: WRITE(E1_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS
|
||||
#if HAS_E2_MS_PINS
|
||||
case 5: WRITE(E2_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS
|
||||
#if HAS_E3_MS_PINS
|
||||
case 6: WRITE(E3_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS
|
||||
#if HAS_E4_MS_PINS
|
||||
case 7: WRITE(E4_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS
|
||||
#if HAS_E5_MS_PINS
|
||||
case 8: WRITE(E5_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS
|
||||
#if HAS_E6_MS_PINS
|
||||
case 9: WRITE(E6_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS
|
||||
#if HAS_E7_MS_PINS
|
||||
case 10: WRITE(E7_MS1_PIN, ms1); break;
|
||||
#endif
|
||||
}
|
||||
if (ms2 >= 0) switch (driver) {
|
||||
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS
|
||||
case 0:
|
||||
#if HAS_X_MICROSTEPS
|
||||
#if HAS_X_MS_PINS
|
||||
WRITE(X_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_X2_MICROSTEPS
|
||||
#if HAS_X2_MS_PINS
|
||||
WRITE(X2_MS2_PIN, ms2);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS || HAS_Y2_MS_PINS
|
||||
case 1:
|
||||
#if HAS_Y_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS
|
||||
WRITE(Y_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y2_MS_PINS
|
||||
WRITE(Y2_MS2_PIN, ms2);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOME_Z_MICROSTEPS
|
||||
#if HAS_SOME_Z_MS_PINS
|
||||
case 2:
|
||||
#if HAS_Z_MICROSTEPS
|
||||
#if HAS_Z_MS_PINS
|
||||
WRITE(Z_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_Z2_MICROSTEPS
|
||||
#if HAS_Z2_MS_PINS
|
||||
WRITE(Z2_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_Z3_MICROSTEPS
|
||||
#if HAS_Z3_MS_PINS
|
||||
WRITE(Z3_MS2_PIN, ms2);
|
||||
#endif
|
||||
#if HAS_Z4_MICROSTEPS
|
||||
#if HAS_Z4_MS_PINS
|
||||
WRITE(Z4_MS2_PIN, ms2);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS
|
||||
#if HAS_E0_MS_PINS
|
||||
case 3: WRITE(E0_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS
|
||||
#if HAS_E1_MS_PINS
|
||||
case 4: WRITE(E1_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS
|
||||
#if HAS_E2_MS_PINS
|
||||
case 5: WRITE(E2_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS
|
||||
#if HAS_E3_MS_PINS
|
||||
case 6: WRITE(E3_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS
|
||||
#if HAS_E4_MS_PINS
|
||||
case 7: WRITE(E4_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS
|
||||
#if HAS_E5_MS_PINS
|
||||
case 8: WRITE(E5_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS
|
||||
#if HAS_E6_MS_PINS
|
||||
case 9: WRITE(E6_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS
|
||||
#if HAS_E7_MS_PINS
|
||||
case 10: WRITE(E7_MS2_PIN, ms2); break;
|
||||
#endif
|
||||
}
|
||||
if (ms3 >= 0) switch (driver) {
|
||||
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS
|
||||
case 0:
|
||||
#if HAS_X_MICROSTEPS && PIN_EXISTS(X_MS3)
|
||||
#if HAS_X_MS_PINS && PIN_EXISTS(X_MS3)
|
||||
WRITE(X_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_X2_MICROSTEPS && PIN_EXISTS(X2_MS3)
|
||||
#if HAS_X2_MS_PINS && PIN_EXISTS(X2_MS3)
|
||||
WRITE(X2_MS3_PIN, ms3);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS || HAS_Y2_MS_PINS
|
||||
case 1:
|
||||
#if HAS_Y_MICROSTEPS && PIN_EXISTS(Y_MS3)
|
||||
#if HAS_Y_MS_PINS && PIN_EXISTS(Y_MS3)
|
||||
WRITE(Y_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_Y2_MICROSTEPS && PIN_EXISTS(Y2_MS3)
|
||||
#if HAS_Y2_MS_PINS && PIN_EXISTS(Y2_MS3)
|
||||
WRITE(Y2_MS3_PIN, ms3);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOME_Z_MICROSTEPS
|
||||
#if HAS_SOME_Z_MS_PINS
|
||||
case 2:
|
||||
#if HAS_Z_MICROSTEPS && PIN_EXISTS(Z_MS3)
|
||||
#if HAS_Z_MS_PINS && PIN_EXISTS(Z_MS3)
|
||||
WRITE(Z_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_Z2_MICROSTEPS && PIN_EXISTS(Z2_MS3)
|
||||
#if HAS_Z2_MS_PINS && PIN_EXISTS(Z2_MS3)
|
||||
WRITE(Z2_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_Z3_MICROSTEPS && PIN_EXISTS(Z3_MS3)
|
||||
#if HAS_Z3_MS_PINS && PIN_EXISTS(Z3_MS3)
|
||||
WRITE(Z3_MS3_PIN, ms3);
|
||||
#endif
|
||||
#if HAS_Z4_MICROSTEPS && PIN_EXISTS(Z4_MS3)
|
||||
#if HAS_Z4_MS_PINS && PIN_EXISTS(Z4_MS3)
|
||||
WRITE(Z4_MS3_PIN, ms3);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS && PIN_EXISTS(E0_MS3)
|
||||
#if HAS_E0_MS_PINS && PIN_EXISTS(E0_MS3)
|
||||
case 3: WRITE(E0_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS && PIN_EXISTS(E1_MS3)
|
||||
#if HAS_E1_MS_PINS && PIN_EXISTS(E1_MS3)
|
||||
case 4: WRITE(E1_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS && PIN_EXISTS(E2_MS3)
|
||||
#if HAS_E2_MS_PINS && PIN_EXISTS(E2_MS3)
|
||||
case 5: WRITE(E2_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS && PIN_EXISTS(E3_MS3)
|
||||
#if HAS_E3_MS_PINS && PIN_EXISTS(E3_MS3)
|
||||
case 6: WRITE(E3_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS && PIN_EXISTS(E4_MS3)
|
||||
#if HAS_E4_MS_PINS && PIN_EXISTS(E4_MS3)
|
||||
case 7: WRITE(E4_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS && PIN_EXISTS(E5_MS3)
|
||||
#if HAS_E5_MS_PINS && PIN_EXISTS(E5_MS3)
|
||||
case 8: WRITE(E5_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS && PIN_EXISTS(E6_MS3)
|
||||
#if HAS_E6_MS_PINS && PIN_EXISTS(E6_MS3)
|
||||
case 9: WRITE(E6_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS && PIN_EXISTS(E7_MS3)
|
||||
#if HAS_E7_MS_PINS && PIN_EXISTS(E7_MS3)
|
||||
case 10: WRITE(E7_MS3_PIN, ms3); break;
|
||||
#endif
|
||||
}
|
||||
|
@ -3288,7 +3276,7 @@ void Stepper::report_positions() {
|
|||
|
||||
void Stepper::microstep_readings() {
|
||||
SERIAL_ECHOLNPGM("MS1|MS2|MS3 Pins");
|
||||
#if HAS_X_MICROSTEPS
|
||||
#if HAS_X_MS_PINS
|
||||
SERIAL_ECHOPGM("X: ");
|
||||
SERIAL_CHAR('0' + READ(X_MS1_PIN), '0' + READ(X_MS2_PIN)
|
||||
#if PIN_EXISTS(X_MS3)
|
||||
|
@ -3296,7 +3284,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_Y_MICROSTEPS
|
||||
#if HAS_Y_MS_PINS
|
||||
SERIAL_ECHOPGM("Y: ");
|
||||
SERIAL_CHAR('0' + READ(Y_MS1_PIN), '0' + READ(Y_MS2_PIN)
|
||||
#if PIN_EXISTS(Y_MS3)
|
||||
|
@ -3304,7 +3292,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_Z_MICROSTEPS
|
||||
#if HAS_Z_MS_PINS
|
||||
SERIAL_ECHOPGM("Z: ");
|
||||
SERIAL_CHAR('0' + READ(Z_MS1_PIN), '0' + READ(Z_MS2_PIN)
|
||||
#if PIN_EXISTS(Z_MS3)
|
||||
|
@ -3312,7 +3300,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E0_MICROSTEPS
|
||||
#if HAS_E0_MS_PINS
|
||||
SERIAL_ECHOPGM("E0: ");
|
||||
SERIAL_CHAR('0' + READ(E0_MS1_PIN), '0' + READ(E0_MS2_PIN)
|
||||
#if PIN_EXISTS(E0_MS3)
|
||||
|
@ -3320,7 +3308,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E1_MICROSTEPS
|
||||
#if HAS_E1_MS_PINS
|
||||
SERIAL_ECHOPGM("E1: ");
|
||||
SERIAL_CHAR('0' + READ(E1_MS1_PIN), '0' + READ(E1_MS2_PIN)
|
||||
#if PIN_EXISTS(E1_MS3)
|
||||
|
@ -3328,7 +3316,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E2_MICROSTEPS
|
||||
#if HAS_E2_MS_PINS
|
||||
SERIAL_ECHOPGM("E2: ");
|
||||
SERIAL_CHAR('0' + READ(E2_MS1_PIN), '0' + READ(E2_MS2_PIN)
|
||||
#if PIN_EXISTS(E2_MS3)
|
||||
|
@ -3336,7 +3324,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E3_MICROSTEPS
|
||||
#if HAS_E3_MS_PINS
|
||||
SERIAL_ECHOPGM("E3: ");
|
||||
SERIAL_CHAR('0' + READ(E3_MS1_PIN), '0' + READ(E3_MS2_PIN)
|
||||
#if PIN_EXISTS(E3_MS3)
|
||||
|
@ -3344,7 +3332,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E4_MICROSTEPS
|
||||
#if HAS_E4_MS_PINS
|
||||
SERIAL_ECHOPGM("E4: ");
|
||||
SERIAL_CHAR('0' + READ(E4_MS1_PIN), '0' + READ(E4_MS2_PIN)
|
||||
#if PIN_EXISTS(E4_MS3)
|
||||
|
@ -3352,7 +3340,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E5_MICROSTEPS
|
||||
#if HAS_E5_MS_PINS
|
||||
SERIAL_ECHOPGM("E5: ");
|
||||
SERIAL_CHAR('0' + READ(E5_MS1_PIN), '0' + READ(E5_MS2_PIN)
|
||||
#if PIN_EXISTS(E5_MS3)
|
||||
|
@ -3360,7 +3348,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E6_MICROSTEPS
|
||||
#if HAS_E6_MS_PINS
|
||||
SERIAL_ECHOPGM("E6: ");
|
||||
SERIAL_CHAR('0' + READ(E6_MS1_PIN), '0' + READ(E6_MS2_PIN)
|
||||
#if PIN_EXISTS(E6_MS3)
|
||||
|
@ -3368,7 +3356,7 @@ void Stepper::report_positions() {
|
|||
#endif
|
||||
);
|
||||
#endif
|
||||
#if HAS_E7_MICROSTEPS
|
||||
#if HAS_E7_MS_PINS
|
||||
SERIAL_ECHOPGM("E7: ");
|
||||
SERIAL_CHAR('0' + READ(E7_MS1_PIN), '0' + READ(E7_MS2_PIN)
|
||||
#if PIN_EXISTS(E7_MS3)
|
||||
|
|
|
@ -33,21 +33,13 @@
|
|||
#include "indirection.h"
|
||||
|
||||
void restore_stepper_drivers() {
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
restore_trinamic_drivers();
|
||||
#endif
|
||||
TERN_(HAS_TRINAMIC_CONFIG, restore_trinamic_drivers());
|
||||
}
|
||||
|
||||
void reset_stepper_drivers() {
|
||||
#if HAS_DRIVER(TMC26X)
|
||||
tmc26x_init_to_defaults();
|
||||
#endif
|
||||
|
||||
#if HAS_L64XX
|
||||
L64xxManager.init_to_defaults();
|
||||
#endif
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
reset_trinamic_drivers();
|
||||
#endif
|
||||
TERN_(HAS_L64XX, L64xxManager.init_to_defaults());
|
||||
TERN_(HAS_TRINAMIC_CONFIG, reset_trinamic_drivers());
|
||||
}
|
||||
|
|
|
@ -140,9 +140,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
|||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
|
@ -181,9 +179,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
|||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
|
@ -475,9 +471,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
|||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
|
@ -523,9 +517,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
|||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
|
@ -569,15 +561,10 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
|||
st.sdoff(0);
|
||||
st.rms_current(mA);
|
||||
st.microsteps(microsteps);
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
st.dedge(true);
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, st.dedge(true));
|
||||
st.intpol(INTERPOLATE);
|
||||
st.diss2g(true); // Disable short to ground protection. Too many false readings?
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
st.rdsel(0b01);
|
||||
#endif
|
||||
TERN_(TMC_DEBUG, st.rdsel(0b01));
|
||||
}
|
||||
#endif // TMC2660
|
||||
|
||||
|
@ -592,9 +579,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
|||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
|
@ -633,9 +618,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
|
|||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
|
|
|
@ -236,15 +236,9 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
|||
#ifdef BED_MAXTEMP
|
||||
int16_t Temperature::maxtemp_raw_BED = HEATER_BED_RAW_HI_TEMP;
|
||||
#endif
|
||||
#if WATCH_BED
|
||||
bed_watch_t Temperature::watch_bed; // = { 0 }
|
||||
#endif
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
millis_t Temperature::next_bed_check_ms;
|
||||
#endif
|
||||
#if HEATER_IDLE_HANDLER
|
||||
hotend_idle_t Temperature::bed_idle; // = { 0 }
|
||||
#endif
|
||||
TERN_(WATCH_BED, bed_watch_t Temperature::watch_bed); // = { 0 }
|
||||
TERN(PIDTEMPBED,, millis_t Temperature::next_bed_check_ms);
|
||||
TERN_(HEATER_IDLE_HANDLER, hotend_idle_t Temperature::bed_idle); // = { 0 }
|
||||
#endif // HAS_HEATED_BED
|
||||
|
||||
#if HAS_TEMP_CHAMBER
|
||||
|
@ -403,15 +397,11 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||
bool heated = false;
|
||||
#endif
|
||||
|
||||
#if HAS_AUTO_FAN
|
||||
next_auto_fan_check_ms = next_temp_ms + 2500UL;
|
||||
#endif
|
||||
TERN_(HAS_AUTO_FAN, next_auto_fan_check_ms = next_temp_ms + 2500UL);
|
||||
|
||||
if (target > GHV(BED_MAXTEMP - 10, temp_range[heater].maxtemp - 15)) {
|
||||
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -427,9 +417,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||
LEDColor color = ONHEATINGSTART();
|
||||
#endif
|
||||
|
||||
#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
|
||||
adaptive_fan_slowing = false;
|
||||
#endif
|
||||
TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = false);
|
||||
|
||||
// PID Tuning loop
|
||||
while (wait_for_heatup) {
|
||||
|
@ -525,9 +513,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||
#endif
|
||||
if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
|
||||
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -562,9 +548,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
|
||||
#endif
|
||||
if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
|
||||
SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
|
||||
break;
|
||||
}
|
||||
|
@ -610,12 +594,9 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
printerEventLEDs.onPidTuningDone(color);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_DONE);
|
||||
#endif
|
||||
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color));
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE));
|
||||
|
||||
goto EXIT_M303;
|
||||
}
|
||||
|
@ -624,17 +605,12 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||
|
||||
disable_all_heaters();
|
||||
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
printerEventLEDs.onPidTuningDone(color);
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPidTuning(ExtUI::result_t::PID_DONE);
|
||||
#endif
|
||||
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color));
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE));
|
||||
|
||||
EXIT_M303:
|
||||
#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
|
||||
adaptive_fan_slowing = true;
|
||||
#endif
|
||||
TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -653,11 +629,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
|
|||
case H_CHAMBER: return temp_chamber.soft_pwm_amount;
|
||||
#endif
|
||||
default:
|
||||
return (0
|
||||
#if HAS_HOTEND
|
||||
+ temp_hotend[heater_id].soft_pwm_amount
|
||||
#endif
|
||||
);
|
||||
return TERN0(HAS_HOTEND, temp_hotend[heater_id].soft_pwm_amount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,19 +743,16 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg,
|
|||
|
||||
static uint8_t killed = 0;
|
||||
|
||||
if (IsRunning()
|
||||
#if BOGUS_TEMPERATURE_GRACE_PERIOD
|
||||
&& killed == 2
|
||||
#endif
|
||||
) {
|
||||
if (IsRunning() && TERN1(BOGUS_TEMPERATURE_GRACE_PERIOD, killed == 2)) {
|
||||
SERIAL_ERROR_START();
|
||||
serialprintPGM(serial_msg);
|
||||
SERIAL_ECHOPGM(STR_STOPPED_HEATER);
|
||||
if (heater >= 0) SERIAL_ECHO((int)heater);
|
||||
#if HAS_HEATED_CHAMBER
|
||||
else if (heater == H_CHAMBER) SERIAL_ECHOPGM(STR_HEATER_CHAMBER);
|
||||
#endif
|
||||
else SERIAL_ECHOPGM(STR_HEATER_BED);
|
||||
if (heater >= 0)
|
||||
SERIAL_ECHO((int)heater);
|
||||
else if (TERN0(HAS_HEATED_CHAMBER, heater == H_CHAMBER))
|
||||
SERIAL_ECHOPGM(STR_HEATER_CHAMBER);
|
||||
else
|
||||
SERIAL_ECHOPGM(STR_HEATER_BED);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
|
@ -839,9 +808,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
|
|||
|
||||
if (temp_hotend[ee].target == 0
|
||||
|| pid_error < -(PID_FUNCTIONAL_RANGE)
|
||||
#if HEATER_IDLE_HANDLER
|
||||
|| hotend_idle[ee].timed_out
|
||||
#endif
|
||||
|| TERN0(HEATER_IDLE_HANDLER, hotend_idle[ee].timed_out)
|
||||
) {
|
||||
pid_output = 0;
|
||||
pid_reset[ee] = true;
|
||||
|
@ -1015,9 +982,8 @@ void Temperature::manage_heater() {
|
|||
if (!inited) return watchdog_refresh();
|
||||
#endif
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
if (emergency_parser.killed_by_M112) kill(M112_KILL_STR, nullptr, true);
|
||||
#endif
|
||||
if (TERN0(EMERGENCY_PARSER, emergency_parser.killed_by_M112))
|
||||
kill(M112_KILL_STR, nullptr, true);
|
||||
|
||||
if (!raw_temps_ready) return;
|
||||
|
||||
|
@ -1043,9 +1009,7 @@ void Temperature::manage_heater() {
|
|||
_temp_error((heater_ind_t)e, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
|
||||
#endif
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
hotend_idle[e].update(ms);
|
||||
#endif
|
||||
TERN_(HEATER_IDLE_HANDLER, hotend_idle[e].update(ms));
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
|
||||
// Check for thermal runaway
|
||||
|
@ -1106,7 +1070,10 @@ void Temperature::manage_heater() {
|
|||
}
|
||||
#endif // WATCH_BED
|
||||
|
||||
#define PAUSE_CHANGE_REQD BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING)
|
||||
#if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING)
|
||||
#define PAUSE_CHANGE_REQD 1
|
||||
#endif
|
||||
|
||||
#if PAUSE_CHANGE_REQD
|
||||
static bool last_pause_state;
|
||||
#endif
|
||||
|
@ -1115,23 +1082,15 @@ void Temperature::manage_heater() {
|
|||
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
if (PENDING(ms, next_bed_check_ms)
|
||||
#if PAUSE_CHANGE_REQD
|
||||
&& paused == last_pause_state
|
||||
#endif
|
||||
&& TERN1(PAUSE_CHANGE_REQD, paused == last_pause_state)
|
||||
) break;
|
||||
next_bed_check_ms = ms + BED_CHECK_INTERVAL;
|
||||
#if PAUSE_CHANGE_REQD
|
||||
last_pause_state = paused;
|
||||
#endif
|
||||
TERN_(PAUSE_CHANGE_REQD, last_pause_state = paused);
|
||||
#endif
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
bed_idle.update(ms);
|
||||
#endif
|
||||
TERN_(HEATER_IDLE_HANDLER, bed_idle.update(ms));
|
||||
|
||||
#if HAS_THERMALLY_PROTECTED_BED
|
||||
thermal_runaway_protection(tr_state_machine_bed, temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
|
||||
#endif
|
||||
TERN_(HAS_THERMALLY_PROTECTED_BED, thermal_runaway_protection(tr_state_machine_bed, temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS));
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
if (bed_idle.timed_out) {
|
||||
|
@ -1207,9 +1166,7 @@ void Temperature::manage_heater() {
|
|||
WRITE_HEATER_CHAMBER(LOW);
|
||||
}
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
|
||||
thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.celsius, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS);
|
||||
#endif
|
||||
TERN_(THERMAL_PROTECTION_CHAMBER, thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.celsius, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS));
|
||||
}
|
||||
|
||||
// TODO: Implement true PID pwm
|
||||
|
@ -1302,36 +1259,16 @@ void Temperature::manage_heater() {
|
|||
SERIAL_ECHOPAIR_F(" C", t.sh_c_coeff, 9);
|
||||
SERIAL_ECHOPGM(" ; ");
|
||||
serialprintPGM(
|
||||
#if ENABLED(HEATER_0_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_0 ? PSTR("HOTEND 0") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_1_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_1 ? PSTR("HOTEND 1") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_2_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_2 ? PSTR("HOTEND 2") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_3_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_3 ? PSTR("HOTEND 3") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_4_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_4 ? PSTR("HOTEND 4") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_5_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_5 ? PSTR("HOTEND 5") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_6_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_6 ? PSTR("HOTEND 6") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_7_USER_THERMISTOR)
|
||||
t_index == CTI_HOTEND_7 ? PSTR("HOTEND 7") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_BED_USER_THERMISTOR)
|
||||
t_index == CTI_BED ? PSTR("BED") :
|
||||
#endif
|
||||
#if ENABLED(HEATER_CHAMBER_USER_THERMISTOR)
|
||||
t_index == CTI_CHAMBER ? PSTR("CHAMBER") :
|
||||
#endif
|
||||
TERN_(HEATER_0_USER_THERMISTOR, t_index == CTI_HOTEND_0 ? PSTR("HOTEND 0") :)
|
||||
TERN_(HEATER_1_USER_THERMISTOR, t_index == CTI_HOTEND_1 ? PSTR("HOTEND 1") :)
|
||||
TERN_(HEATER_2_USER_THERMISTOR, t_index == CTI_HOTEND_2 ? PSTR("HOTEND 2") :)
|
||||
TERN_(HEATER_3_USER_THERMISTOR, t_index == CTI_HOTEND_3 ? PSTR("HOTEND 3") :)
|
||||
TERN_(HEATER_4_USER_THERMISTOR, t_index == CTI_HOTEND_4 ? PSTR("HOTEND 4") :)
|
||||
TERN_(HEATER_5_USER_THERMISTOR, t_index == CTI_HOTEND_5 ? PSTR("HOTEND 5") :)
|
||||
TERN_(HEATER_6_USER_THERMISTOR, t_index == CTI_HOTEND_6 ? PSTR("HOTEND 6") :)
|
||||
TERN_(HEATER_7_USER_THERMISTOR, t_index == CTI_HOTEND_7 ? PSTR("HOTEND 7") :)
|
||||
TERN_(HEATER_BED_USER_THERMISTOR, t_index == CTI_BED ? PSTR("BED") :)
|
||||
TERN_(HEATER_CHAMBER_USER_THERMISTOR, t_index == CTI_CHAMBER ? PSTR("CHAMBER") :)
|
||||
nullptr
|
||||
);
|
||||
SERIAL_EOL();
|
||||
|
@ -1387,12 +1324,7 @@ void Temperature::manage_heater() {
|
|||
// Derived from RepRap FiveD extruder::getTemperature()
|
||||
// For hot end temperature measurement.
|
||||
float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
if (e > HOTENDS)
|
||||
#else
|
||||
if (e >= HOTENDS)
|
||||
#endif
|
||||
{
|
||||
if (e > HOTENDS - DISABLED(TEMP_SENSOR_1_AS_REDUNDANT)) {
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ECHO((int)e);
|
||||
SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
|
||||
|
@ -1577,21 +1509,11 @@ void Temperature::updateTemperaturesFromRawValues() {
|
|||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw);
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw);
|
||||
#endif
|
||||
#if HAS_TEMP_PROBE
|
||||
temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw);
|
||||
#endif
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
redundant_temperature = analog_to_celsius_hotend(redundant_temperature_raw, 1);
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
filwidth.update_measured_mm();
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw));
|
||||
TERN_(HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw));
|
||||
TERN_(HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw));
|
||||
TERN_(TEMP_SENSOR_1_AS_REDUNDANT, redundant_temperature = analog_to_celsius_hotend(redundant_temperature_raw, 1));
|
||||
TERN_(FILAMENT_WIDTH_SENSOR, filwidth.update_measured_mm());
|
||||
|
||||
// Reset the watchdog on good temperature measurement
|
||||
watchdog_refresh();
|
||||
|
@ -1637,9 +1559,7 @@ void Temperature::updateTemperaturesFromRawValues() {
|
|||
*/
|
||||
void Temperature::init() {
|
||||
|
||||
#if ENABLED(MAX6675_IS_MAX31865)
|
||||
max31865.begin(MAX31865_2WIRE); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
|
||||
#endif
|
||||
TERN_(MAX6675_IS_MAX31865, max31865.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
|
||||
|
||||
#if EARLY_WATCHDOG
|
||||
// Flag that the thermalManager should be running
|
||||
|
@ -1931,9 +1851,7 @@ void Temperature::init() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBING_HEATERS_OFF)
|
||||
paused = false;
|
||||
#endif
|
||||
TERN_(PROBING_HEATERS_OFF, paused = false);
|
||||
}
|
||||
|
||||
#if WATCH_HOTENDS
|
||||
|
@ -2004,9 +1922,7 @@ void Temperature::init() {
|
|||
#if HEATER_IDLE_HANDLER
|
||||
// If the heater idle timeout expires, restart
|
||||
if ((heater_id >= 0 && hotend_idle[heater_id].timed_out)
|
||||
#if HAS_HEATED_BED
|
||||
|| (heater_id < 0 && bed_idle.timed_out)
|
||||
#endif
|
||||
|| TERN0(HAS_HEATED_BED, (heater_id < 0 && bed_idle.timed_out))
|
||||
) {
|
||||
sm.state = TRInactive;
|
||||
tr_target_temperature[heater_index] = 0;
|
||||
|
@ -2065,26 +1981,16 @@ void Temperature::init() {
|
|||
|
||||
void Temperature::disable_all_heaters() {
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
planner.autotemp_enabled = false;
|
||||
#endif
|
||||
TERN_(AUTOTEMP, planner.autotemp_enabled = false);
|
||||
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() setTargetHotend(0, e);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
setTargetBed(0);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
setTargetChamber(0);
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, setTargetBed(0));
|
||||
TERN_(HAS_HEATED_CHAMBER, setTargetChamber(0));
|
||||
|
||||
// Unpause and reset everything
|
||||
#if ENABLED(PROBING_HEATERS_OFF)
|
||||
pause(false);
|
||||
#endif
|
||||
TERN_(PROBING_HEATERS_OFF, pause(false));
|
||||
|
||||
#define DISABLE_HEATER(N) { \
|
||||
setTargetHotend(0, N); \
|
||||
|
@ -2115,13 +2021,8 @@ void Temperature::disable_all_heaters() {
|
|||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() if (degTargetHotend(e) > (EXTRUDE_MINTEMP) / 2) return true;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
if (degTargetBed() > BED_MINTEMP) return true;
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
if (degTargetChamber() > CHAMBER_MINTEMP) return true;
|
||||
#endif
|
||||
return false;
|
||||
return TERN0(HAS_HEATED_BED, degTargetBed() > BED_MINTEMP)
|
||||
|| TERN0(HAS_HEATED_CHAMBER, degTargetChamber() > CHAMBER_MINTEMP);
|
||||
}
|
||||
|
||||
void Temperature::check_timer_autostart(const bool can_start, const bool can_stop) {
|
||||
|
@ -2143,16 +2044,12 @@ void Temperature::disable_all_heaters() {
|
|||
if (p != paused) {
|
||||
paused = p;
|
||||
if (p) {
|
||||
HOTEND_LOOP() hotend_idle[e].expire(); // timeout immediately
|
||||
#if HAS_HEATED_BED
|
||||
bed_idle.expire(); // timeout immediately
|
||||
#endif
|
||||
HOTEND_LOOP() hotend_idle[e].expire(); // Timeout immediately
|
||||
TERN_(HAS_HEATED_BED, bed_idle.expire()); // Timeout immediately
|
||||
}
|
||||
else {
|
||||
HOTEND_LOOP() reset_hotend_idle_timer(e);
|
||||
#if HAS_HEATED_BED
|
||||
reset_bed_idle_timer();
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, reset_bed_idle_timer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2303,46 +2200,19 @@ void Temperature::update_raw_temperatures() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_ADC_2
|
||||
temp_hotend[2].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_3
|
||||
temp_hotend[3].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_4
|
||||
temp_hotend[4].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_5
|
||||
temp_hotend[5].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
temp_hotend[6].update();
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
temp_hotend[7].update();
|
||||
#endif
|
||||
TERN_(HAS_TEMP_ADC_2, temp_hotend[2].update());
|
||||
TERN_(HAS_TEMP_ADC_3, temp_hotend[3].update());
|
||||
TERN_(HAS_TEMP_ADC_4, temp_hotend[4].update());
|
||||
TERN_(HAS_TEMP_ADC_5, temp_hotend[5].update());
|
||||
TERN_(HAS_TEMP_ADC_6, temp_hotend[6].update());
|
||||
TERN_(HAS_TEMP_ADC_7, temp_hotend[7].update());
|
||||
TERN_(HAS_HEATED_BED, temp_bed.update());
|
||||
TERN_(HAS_TEMP_CHAMBER, temp_chamber.update());
|
||||
TERN_(HAS_TEMP_PROBE, temp_probe.update());
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
temp_bed.update();
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_CHAMBER
|
||||
temp_chamber.update();
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_PROBE
|
||||
temp_probe.update();
|
||||
#endif
|
||||
|
||||
#if HAS_JOY_ADC_X
|
||||
joystick.x.update();
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
joystick.y.update();
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
joystick.z.update();
|
||||
#endif
|
||||
TERN_(HAS_JOY_ADC_X, joystick.x.update());
|
||||
TERN_(HAS_JOY_ADC_Y, joystick.y.update());
|
||||
TERN_(HAS_JOY_ADC_Z, joystick.z.update());
|
||||
|
||||
raw_temps_ready = true;
|
||||
}
|
||||
|
@ -2353,38 +2223,20 @@ void Temperature::readings_ready() {
|
|||
if (!raw_temps_ready) update_raw_temperatures();
|
||||
|
||||
// Filament Sensor - can be read any time since IIR filtering is used
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
filwidth.reading_ready();
|
||||
#endif
|
||||
TERN_(FILAMENT_WIDTH_SENSOR, filwidth.reading_ready());
|
||||
|
||||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() temp_hotend[e].reset();
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
temp_hotend[1].reset();
|
||||
#endif
|
||||
TERN_(TEMP_SENSOR_1_AS_REDUNDANT, temp_hotend[1].reset());
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
temp_bed.reset();
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, temp_bed.reset());
|
||||
TERN_(HAS_TEMP_CHAMBER, temp_chamber.reset());
|
||||
TERN_(HAS_TEMP_PROBE, temp_probe.reset());
|
||||
|
||||
#if HAS_TEMP_CHAMBER
|
||||
temp_chamber.reset();
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_PROBE
|
||||
temp_probe.reset();
|
||||
#endif
|
||||
|
||||
#if HAS_JOY_ADC_X
|
||||
joystick.x.reset();
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Y
|
||||
joystick.y.reset();
|
||||
#endif
|
||||
#if HAS_JOY_ADC_Z
|
||||
joystick.z.reset();
|
||||
#endif
|
||||
TERN_(HAS_JOY_ADC_X, joystick.x.reset());
|
||||
TERN_(HAS_JOY_ADC_Y, joystick.y.reset());
|
||||
TERN_(HAS_JOY_ADC_Z, joystick.z.reset());
|
||||
|
||||
#if HAS_HOTEND
|
||||
|
||||
|
@ -2412,9 +2264,7 @@ void Temperature::readings_ready() {
|
|||
if (tdir) {
|
||||
const int16_t rawtemp = temp_hotend[e].raw * tdir; // normal direction, +rawtemp, else -rawtemp
|
||||
const bool heater_on = (temp_hotend[e].target > 0
|
||||
#if ENABLED(PIDTEMP)
|
||||
|| temp_hotend[e].soft_pwm_amount > 0
|
||||
#endif
|
||||
|| TERN0(PIDTEMP, temp_hotend[e].soft_pwm_amount) > 0
|
||||
);
|
||||
if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error((heater_ind_t)e);
|
||||
if (heater_on && rawtemp < temp_range[e].raw_min * tdir && !is_preheating(e)) {
|
||||
|
@ -2438,10 +2288,8 @@ void Temperature::readings_ready() {
|
|||
#else
|
||||
#define BEDCMP(A,B) ((A)>=(B))
|
||||
#endif
|
||||
const bool bed_on = (temp_bed.target > 0)
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
|| (temp_bed.soft_pwm_amount > 0)
|
||||
#endif
|
||||
const bool bed_on = temp_bed.target > 0
|
||||
|| TERN0(PIDTEMPBED, temp_bed.soft_pwm_amount) > 0
|
||||
;
|
||||
if (BEDCMP(temp_bed.raw, maxtemp_raw_BED)) max_temp_error(H_BED);
|
||||
if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED);
|
||||
|
@ -2774,10 +2622,8 @@ void Temperature::tick() {
|
|||
#if HAS_HOTEND
|
||||
HOTEND_LOOP() soft_pwm_hotend[e].dec();
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
soft_pwm_bed.dec();
|
||||
#endif
|
||||
} // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0
|
||||
TERN_(HAS_HEATED_BED, soft_pwm_bed.dec());
|
||||
}
|
||||
|
||||
#endif // SLOW_PWM_HEATERS
|
||||
|
||||
|
@ -3218,9 +3064,7 @@ void Temperature::tick() {
|
|||
|
||||
if (wait_for_heatup) {
|
||||
ui.reset_status();
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
printerEventLEDs.onHeatingDone();
|
||||
#endif
|
||||
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onHeatingDone());
|
||||
}
|
||||
|
||||
return wait_for_heatup;
|
||||
|
|
|
@ -173,7 +173,9 @@ enum ADCSensorState : char {
|
|||
#define unscalePID_d(d) ( float(d) * PID_dT )
|
||||
#endif
|
||||
|
||||
#define G26_CLICK_CAN_CANCEL (HAS_LCD_MENU && ENABLED(G26_MESH_VALIDATION))
|
||||
#if BOTH(HAS_LCD_MENU, G26_MESH_VALIDATION)
|
||||
#define G26_CLICK_CAN_CANCEL 1
|
||||
#endif
|
||||
|
||||
// A temperature sensor
|
||||
typedef struct TempInfo {
|
||||
|
@ -317,30 +319,16 @@ class Temperature {
|
|||
|
||||
public:
|
||||
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
#define HOTEND_TEMPS (HOTENDS + 1)
|
||||
#else
|
||||
#define HOTEND_TEMPS HOTENDS
|
||||
#endif
|
||||
#if HAS_HOTEND
|
||||
#define HOTEND_TEMPS (HOTENDS + ENABLED(TEMP_SENSOR_1_AS_REDUNDANT))
|
||||
static hotend_info_t temp_hotend[HOTEND_TEMPS];
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
static bed_info_t temp_bed;
|
||||
#endif
|
||||
#if HAS_TEMP_PROBE
|
||||
static probe_info_t temp_probe;
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
static chamber_info_t temp_chamber;
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, static bed_info_t temp_bed);
|
||||
TERN_(HAS_TEMP_PROBE, static probe_info_t temp_probe);
|
||||
TERN_(HAS_TEMP_CHAMBER, static chamber_info_t temp_chamber);
|
||||
|
||||
#if ENABLED(AUTO_POWER_E_FANS)
|
||||
static uint8_t autofan_speed[HOTENDS];
|
||||
#endif
|
||||
#if ENABLED(AUTO_POWER_CHAMBER_FAN)
|
||||
static uint8_t chamberfan_speed;
|
||||
#endif
|
||||
TERN_(AUTO_POWER_E_FANS, static uint8_t autofan_speed[HOTENDS]);
|
||||
TERN_(AUTO_POWER_CHAMBER_FAN, static uint8_t chamberfan_speed);
|
||||
|
||||
#if ENABLED(FAN_SOFT_PWM)
|
||||
static uint8_t soft_pwm_amount_fan[FAN_COUNT],
|
||||
|
@ -367,25 +355,17 @@ class Temperature {
|
|||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
static hotend_idle_t hotend_idle[HOTENDS];
|
||||
#if HAS_HEATED_BED
|
||||
static hotend_idle_t bed_idle;
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
static hotend_idle_t chamber_idle;
|
||||
#endif
|
||||
TERN_(HAS_HEATED_BED, static hotend_idle_t bed_idle);
|
||||
TERN_(HAS_HEATED_CHAMBER, static hotend_idle_t chamber_idle);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
#if EARLY_WATCHDOG
|
||||
static bool inited; // If temperature controller is running
|
||||
#endif
|
||||
TERN_(EARLY_WATCHDOG, static bool inited); // If temperature controller is running
|
||||
|
||||
static volatile bool raw_temps_ready;
|
||||
|
||||
#if WATCH_HOTENDS
|
||||
static hotend_watch_t watch_hotend[HOTENDS];
|
||||
#endif
|
||||
TERN_(WATCH_HOTENDS, static hotend_watch_t watch_hotend[HOTENDS]);
|
||||
|
||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
static uint16_t redundant_temperature_raw;
|
||||
|
@ -397,17 +377,11 @@ class Temperature {
|
|||
static lpq_ptr_t lpq_ptr;
|
||||
#endif
|
||||
|
||||
#if HOTENDS
|
||||
static temp_range_t temp_range[HOTENDS];
|
||||
#endif
|
||||
TERN_(HAS_HOTEND, static temp_range_t temp_range[HOTENDS]);
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
#if WATCH_BED
|
||||
static bed_watch_t watch_bed;
|
||||
#endif
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
static millis_t next_bed_check_ms;
|
||||
#endif
|
||||
TERN_(WATCH_BED, static bed_watch_t watch_bed);
|
||||
TERN(PIDTEMPBED,,static millis_t next_bed_check_ms);
|
||||
#ifdef BED_MINTEMP
|
||||
static int16_t mintemp_raw_BED;
|
||||
#endif
|
||||
|
@ -417,9 +391,7 @@ class Temperature {
|
|||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
#if WATCH_CHAMBER
|
||||
static chamber_watch_t watch_chamber;
|
||||
#endif
|
||||
TERN_(WATCH_CHAMBER, static chamber_watch_t watch_chamber);
|
||||
static millis_t next_chamber_check_ms;
|
||||
#ifdef CHAMBER_MINTEMP
|
||||
static int16_t mintemp_raw_CHAMBER;
|
||||
|
@ -437,13 +409,9 @@ class Temperature {
|
|||
static millis_t preheat_end_time[HOTENDS];
|
||||
#endif
|
||||
|
||||
#if HAS_AUTO_FAN
|
||||
static millis_t next_auto_fan_check_ms;
|
||||
#endif
|
||||
TERN_(HAS_AUTO_FAN, static millis_t next_auto_fan_check_ms);
|
||||
|
||||
#if ENABLED(PROBING_HEATERS_OFF)
|
||||
static bool paused;
|
||||
#endif
|
||||
TERN_(PROBING_HEATERS_OFF, static bool paused);
|
||||
|
||||
public:
|
||||
#if HAS_ADC_BUTTONS
|
||||
|
@ -451,9 +419,7 @@ class Temperature {
|
|||
static uint8_t ADCKey_count;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
static int16_t lpq_len;
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, static int16_t lpq_len);
|
||||
|
||||
/**
|
||||
* Instance Methods
|
||||
|
@ -524,9 +490,7 @@ class Temperature {
|
|||
|
||||
static constexpr inline uint8_t fanPercent(const uint8_t speed) { return ui8_to_percent(speed); }
|
||||
|
||||
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
||||
static uint8_t fan_speed_scaler[FAN_COUNT];
|
||||
#endif
|
||||
TERN_(ADAPTIVE_FAN_SLOWING, static uint8_t fan_speed_scaler[FAN_COUNT]);
|
||||
|
||||
static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) {
|
||||
UNUSED(target); // Potentially unused!
|
||||
|
@ -593,29 +557,17 @@ class Temperature {
|
|||
//deg=degreeCelsius
|
||||
|
||||
FORCE_INLINE static float degHotend(const uint8_t E_NAME) {
|
||||
return (0
|
||||
#if HOTENDS
|
||||
+ temp_hotend[HOTEND_INDEX].celsius
|
||||
#endif
|
||||
);
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
FORCE_INLINE static int16_t rawHotendTemp(const uint8_t E_NAME) {
|
||||
return (0
|
||||
#if HOTENDS
|
||||
+ temp_hotend[HOTEND_INDEX].raw
|
||||
#endif
|
||||
);
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
|
||||
}
|
||||
#endif
|
||||
|
||||
FORCE_INLINE static int16_t degTargetHotend(const uint8_t E_NAME) {
|
||||
return (0
|
||||
#if HOTENDS
|
||||
+ temp_hotend[HOTEND_INDEX].target
|
||||
#endif
|
||||
);
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].target);
|
||||
}
|
||||
|
||||
#if WATCH_HOTENDS
|
||||
|
@ -634,9 +586,7 @@ class Temperature {
|
|||
else if (temp_hotend[ee].target == 0)
|
||||
start_preheat_time(ee);
|
||||
#endif
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.power_on();
|
||||
#endif
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
temp_hotend[ee].target = _MIN(celsius, temp_range[ee].maxtemp - 15);
|
||||
start_watching_hotend(ee);
|
||||
}
|
||||
|
@ -680,9 +630,7 @@ class Temperature {
|
|||
#endif
|
||||
|
||||
static void setTargetBed(const int16_t celsius) {
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.power_on();
|
||||
#endif
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
temp_bed.target =
|
||||
#ifdef BED_MAXTEMP
|
||||
_MIN(celsius, BED_MAXTEMP - 10)
|
||||
|
@ -784,9 +732,7 @@ class Temperature {
|
|||
*/
|
||||
#if ENABLED(PIDTEMP)
|
||||
FORCE_INLINE static void updatePID() {
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
last_e_position = 0;
|
||||
#endif
|
||||
TERN_(PID_EXTRUSION_SCALING, last_e_position = 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -831,9 +777,7 @@ class Temperature {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
static void set_heating_message(const uint8_t e);
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e));
|
||||
|
||||
private:
|
||||
static void update_raw_temperatures();
|
||||
|
@ -862,13 +806,9 @@ class Temperature {
|
|||
|
||||
static float get_pid_output_hotend(const uint8_t e);
|
||||
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
static float get_pid_output_bed();
|
||||
#endif
|
||||
TERN_(PIDTEMPBED, static float get_pid_output_bed());
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
static float get_pid_output_chamber();
|
||||
#endif
|
||||
TERN_(HAS_HEATED_CHAMBER, static float get_pid_output_chamber());
|
||||
|
||||
static void _temp_error(const heater_ind_t e, PGM_P const serial_msg, PGM_P const lcd_msg);
|
||||
static void min_temp_error(const heater_ind_t e);
|
||||
|
@ -885,15 +825,9 @@ class Temperature {
|
|||
TRState state = TRInactive;
|
||||
} tr_state_machine_t;
|
||||
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
|
||||
static tr_state_machine_t tr_state_machine[HOTENDS];
|
||||
#endif
|
||||
#if HAS_THERMALLY_PROTECTED_BED
|
||||
static tr_state_machine_t tr_state_machine_bed;
|
||||
#endif
|
||||
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
|
||||
static tr_state_machine_t tr_state_machine_chamber;
|
||||
#endif
|
||||
TERN_(THERMAL_PROTECTION_HOTENDS, static tr_state_machine_t tr_state_machine[HOTENDS]);
|
||||
TERN_(HAS_THERMALLY_PROTECTED_BED, static tr_state_machine_t tr_state_machine_bed);
|
||||
TERN_(THERMAL_PROTECTION_CHAMBER, static tr_state_machine_t tr_state_machine_chamber);
|
||||
|
||||
static void thermal_runaway_protection(tr_state_machine_t &state, const float ¤t, const float &target, const heater_ind_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
|
||||
|
||||
|
|
|
@ -152,11 +152,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
|||
|
||||
const float oldx = current_position.x,
|
||||
grabpos = mpe_settings.parking_xpos[new_tool] + (new_tool ? mpe_settings.grab_distance : -mpe_settings.grab_distance),
|
||||
offsetcompensation = (0
|
||||
#if HAS_HOTEND_OFFSET
|
||||
+ hotend_offset[active_extruder].x * mpe_settings.compensation_factor
|
||||
#endif
|
||||
);
|
||||
offsetcompensation = TERN0(HAS_HOTEND_OFFSET, hotend_offset[active_extruder].x * mpe_settings.compensation_factor);
|
||||
|
||||
if (axis_unhomed_error(_BV(X_AXIS))) return;
|
||||
|
||||
|
@ -322,9 +318,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
|||
|
||||
planner.synchronize();
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Engage magnetic field");
|
||||
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
||||
pe_activate_solenoid(active_extruder); // Just save power for inverted magnets
|
||||
#endif
|
||||
// Just save power for inverted magnets
|
||||
TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid(active_extruder));
|
||||
pe_activate_solenoid(new_tool);
|
||||
|
||||
// STEP 5
|
||||
|
@ -341,11 +336,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
|||
|
||||
// STEP 6
|
||||
|
||||
current_position.x = midpos
|
||||
#if HAS_HOTEND_OFFSET
|
||||
- hotend_offset[new_tool].x
|
||||
#endif
|
||||
;
|
||||
current_position.x = midpos - TERN0(HAS_HOTEND_OFFSET, hotend_offset[new_tool].x);
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
planner.synchronize();
|
||||
DEBUG_POS("(6) Move midway between hotends", current_position);
|
||||
|
@ -358,9 +349,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
|||
else { // nomove == true
|
||||
// Only engage magnetic field for new extruder
|
||||
pe_activate_solenoid(new_tool);
|
||||
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
||||
pe_activate_solenoid(active_extruder); // Just save power for inverted magnets
|
||||
#endif
|
||||
// Just save power for inverted magnets
|
||||
TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid(active_extruder));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -775,9 +765,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
|||
*/
|
||||
void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
|
||||
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
|
||||
if (new_tool == active_extruder) return;
|
||||
#endif
|
||||
if (TERN0(MAGNETIC_SWITCHING_TOOLHEAD, new_tool == active_extruder))
|
||||
return;
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
|
||||
|
@ -826,9 +815,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("No move (not homed)");
|
||||
}
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (!no_move) ui.return_to_status();
|
||||
#endif
|
||||
TERN_(HAS_LCD_MENU, if (!no_move) ui.return_to_status());
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const bool idex_full_control = dual_x_carriage_mode == DXC_FULL_CONTROL_MODE;
|
||||
|
@ -873,9 +860,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|||
|
||||
if (new_tool != old_tool) {
|
||||
|
||||
#if SWITCHING_NOZZLE_TWO_SERVOS
|
||||
raise_nozzle(old_tool);
|
||||
#endif
|
||||
TERN_(SWITCHING_NOZZLE_TWO_SERVOS, raise_nozzle(old_tool));
|
||||
|
||||
REMEMBER(fr, feedrate_mm_s, XY_PROBE_FEEDRATE_MM_S);
|
||||
|
||||
|
@ -902,9 +887,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|||
NOMORE(current_position.z, soft_endstop.max.z);
|
||||
#endif
|
||||
fast_line_to_current(Z_AXIS);
|
||||
#if ENABLED(TOOLCHANGE_PARK)
|
||||
current_position = toolchange_settings.change_point;
|
||||
#endif
|
||||
TERN_(TOOLCHANGE_PARK, current_position = toolchange_settings.change_point);
|
||||
planner.buffer_line(current_position, feedrate_mm_s, old_tool);
|
||||
planner.synchronize();
|
||||
}
|
||||
|
@ -912,9 +895,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
xyz_pos_t diff = hotend_offset[new_tool] - hotend_offset[old_tool];
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
diff.x = 0;
|
||||
#endif
|
||||
TERN_(DUAL_X_CARRIAGE, diff.x = 0);
|
||||
#else
|
||||
constexpr xyz_pos_t diff{0};
|
||||
#endif
|
||||
|
@ -981,9 +962,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|||
singlenozzle_temp[old_tool] = thermalManager.temp_hotend[0].target;
|
||||
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
|
||||
thermalManager.setTargetHotend(singlenozzle_temp[new_tool], 0);
|
||||
#if HAS_DISPLAY
|
||||
thermalManager.set_heating_message(0);
|
||||
#endif
|
||||
TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
|
||||
(void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling
|
||||
}
|
||||
#endif
|
||||
|
@ -1030,9 +1009,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|||
}
|
||||
else if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move back skipped");
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
active_extruder_parked = false;
|
||||
#endif
|
||||
TERN_(DUAL_X_CARRIAGE, active_extruder_parked = false);
|
||||
}
|
||||
#if ENABLED(SWITCHING_NOZZLE)
|
||||
else {
|
||||
|
@ -1041,13 +1018,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRUSA_MMU2)
|
||||
mmu2.tool_change(new_tool);
|
||||
#endif
|
||||
TERN_(PRUSA_MMU2, mmu2.tool_change(new_tool));
|
||||
|
||||
#if SWITCHING_NOZZLE_TWO_SERVOS
|
||||
lower_nozzle(new_tool);
|
||||
#endif
|
||||
TERN_(SWITCHING_NOZZLE_TWO_SERVOS, lower_nozzle(new_tool));
|
||||
|
||||
} // (new_tool != old_tool)
|
||||
|
||||
|
@ -1068,9 +1041,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|||
move_extruder_servo(active_extruder);
|
||||
#endif
|
||||
|
||||
#if HAS_FANMUX
|
||||
fanmux_switch(active_extruder);
|
||||
#endif
|
||||
TERN_(HAS_FANMUX, fanmux_switch(active_extruder));
|
||||
|
||||
#ifdef EVENT_GCODE_AFTER_TOOLCHANGE
|
||||
if (!no_move && TERN1(DUAL_X_CARRIAGE, dual_x_carriage_mode == DXC_AUTO_PARK_MODE))
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
float swap_length, extra_prime;
|
||||
int16_t prime_speed, retract_speed;
|
||||
#endif
|
||||
#if ENABLED(TOOLCHANGE_PARK)
|
||||
xy_pos_t change_point;
|
||||
#endif
|
||||
TERN_(TOOLCHANGE_PARK, xy_pos_t change_point);
|
||||
float z_raise;
|
||||
} toolchange_settings_t;
|
||||
|
||||
|
@ -93,13 +91,9 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
|
||||
void est_init();
|
||||
#endif
|
||||
TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());
|
||||
|
||||
#if ENABLED(SWITCHING_TOOLHEAD)
|
||||
void swt_init();
|
||||
#endif
|
||||
TERN_(SWITCHING_TOOLHEAD, void swt_init());
|
||||
|
||||
/**
|
||||
* Perform a tool-change, which may result in moving the
|
||||
|
|
|
@ -407,16 +407,12 @@ void CardReader::manage_media() {
|
|||
ui.media_changed(old_stat, stat); // Update the UI
|
||||
|
||||
if (stat) {
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION)
|
||||
settings.first_load();
|
||||
#endif
|
||||
if (old_stat == 2) { // First mount?
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.check();
|
||||
#else
|
||||
beginautostart(); // Look for autostart files soon
|
||||
#endif
|
||||
}
|
||||
TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
|
||||
if (old_stat == 2) // First mount?
|
||||
TERN(POWER_LOSS_RECOVERY,
|
||||
recovery.check(), // Check for PLR file. (If not there it will beginautostart)
|
||||
beginautostart() // Look for auto0.g on the next loop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -438,25 +434,15 @@ void CardReader::openAndPrintFile(const char *name) {
|
|||
void CardReader::startFileprint() {
|
||||
if (isMounted()) {
|
||||
flag.sdprinting = true;
|
||||
#if SD_RESORT
|
||||
flush_presort();
|
||||
#endif
|
||||
TERN_(SD_RESORT, flush_presort());
|
||||
}
|
||||
}
|
||||
|
||||
void CardReader::endFilePrint(
|
||||
#if SD_RESORT
|
||||
const bool re_sort/*=false*/
|
||||
#endif
|
||||
) {
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
did_pause_print = 0;
|
||||
#endif
|
||||
void CardReader::endFilePrint(TERN_(SD_RESORT, const bool re_sort/*=false*/)) {
|
||||
TERN_(ADVANCED_PAUSE_FEATURE, did_pause_print = 0);
|
||||
flag.sdprinting = flag.abort_sd_printing = false;
|
||||
if (isFileOpen()) file.close();
|
||||
#if SD_RESORT
|
||||
if (re_sort) presort();
|
||||
#endif
|
||||
TERN_(SD_RESORT, if (re_sort) presort());
|
||||
}
|
||||
|
||||
void CardReader::openLogFile(char * const path) {
|
||||
|
@ -590,9 +576,7 @@ void CardReader::openFileWrite(char * const path) {
|
|||
if (file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
|
||||
flag.saving = true;
|
||||
selectFileByName(fname);
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
emergency_parser.disable();
|
||||
#endif
|
||||
TERN_(EMERGENCY_PARSER, emergency_parser.disable());
|
||||
echo_write_to_file(fname);
|
||||
ui.set_status(fname);
|
||||
}
|
||||
|
@ -615,9 +599,7 @@ void CardReader::removeFile(const char * const name) {
|
|||
if (file.remove(curDir, fname)) {
|
||||
SERIAL_ECHOLNPAIR("File deleted:", fname);
|
||||
sdpos = 0;
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
presort();
|
||||
#endif
|
||||
TERN_(SDCARD_SORT_ALPHA, presort());
|
||||
}
|
||||
else
|
||||
SERIAL_ECHOLNPAIR("Deletion failed, File: ", fname, ".");
|
||||
|
@ -664,15 +646,10 @@ void CardReader::checkautostart() {
|
|||
if (autostart_index < 0 || flag.sdprinting) return;
|
||||
|
||||
if (!isMounted()) mount();
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION)
|
||||
else settings.first_load();
|
||||
#endif
|
||||
TERN_(SDCARD_EEPROM_EMULATION, else settings.first_load());
|
||||
|
||||
if (isMounted()
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
&& !recovery.valid() // Don't run auto#.g when a resume file exists
|
||||
#endif
|
||||
) {
|
||||
// Don't run auto#.g when a PLR file exists
|
||||
if (isMounted() && TERN1(POWER_LOSS_RECOVERY, !recovery.valid())) {
|
||||
char autoname[8];
|
||||
sprintf_P(autoname, PSTR("auto%c.g"), autostart_index + '0');
|
||||
dir_t p;
|
||||
|
@ -699,9 +676,7 @@ void CardReader::closefile(const bool store_location) {
|
|||
file.close();
|
||||
flag.saving = flag.logging = false;
|
||||
sdpos = 0;
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
emergency_parser.enable();
|
||||
#endif
|
||||
TERN_(EMERGENCY_PARSER, emergency_parser.enable());
|
||||
|
||||
if (store_location) {
|
||||
//future: store printer state, filename and position for continuing a stopped print
|
||||
|
@ -824,9 +799,7 @@ void CardReader::cd(const char * relpath) {
|
|||
flag.workDirIsRoot = false;
|
||||
if (workDirDepth < MAX_DIR_DEPTH)
|
||||
workDirParents[workDirDepth++] = workDir;
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
presort();
|
||||
#endif
|
||||
TERN_(SDCARD_SORT_ALPHA, presort());
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
|
@ -837,9 +810,7 @@ void CardReader::cd(const char * relpath) {
|
|||
int8_t CardReader::cdup() {
|
||||
if (workDirDepth > 0) { // At least 1 dir has been saved
|
||||
workDir = --workDirDepth ? workDirParents[workDirDepth - 1] : root; // Use parent, or root if none
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
presort();
|
||||
#endif
|
||||
TERN_(SDCARD_SORT_ALPHA, presort());
|
||||
}
|
||||
if (!workDirDepth) flag.workDirIsRoot = true;
|
||||
return workDirDepth;
|
||||
|
@ -848,9 +819,7 @@ int8_t CardReader::cdup() {
|
|||
void CardReader::cdroot() {
|
||||
workDir = root;
|
||||
flag.workDirIsRoot = true;
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
presort();
|
||||
#endif
|
||||
TERN_(SDCARD_SORT_ALPHA, presort());
|
||||
}
|
||||
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
|
@ -859,12 +828,8 @@ void CardReader::cdroot() {
|
|||
* Get the name of a file in the working directory by sort-index
|
||||
*/
|
||||
void CardReader::getfilename_sorted(const uint16_t nr) {
|
||||
selectFileByIndex(
|
||||
#if ENABLED(SDSORT_GCODE)
|
||||
sort_alpha &&
|
||||
#endif
|
||||
(nr < sort_count) ? sort_order[nr] : nr
|
||||
);
|
||||
selectFileByIndex(TERN1(SDSORT_GCODE, sort_alpha) && (nr < sort_count)
|
||||
? sort_order[nr] : nr);
|
||||
}
|
||||
|
||||
#if ENABLED(SDSORT_USES_RAM)
|
||||
|
@ -910,9 +875,7 @@ void CardReader::cdroot() {
|
|||
flush_presort();
|
||||
|
||||
// Sorting may be turned off
|
||||
#if ENABLED(SDSORT_GCODE)
|
||||
if (!sort_alpha) return;
|
||||
#endif
|
||||
if (TERN0(SDSORT_GCODE, !sort_alpha)) return;
|
||||
|
||||
// If there are files, sort up to the limit
|
||||
uint16_t fileCnt = countFilesInWorkDir();
|
||||
|
@ -923,9 +886,7 @@ void CardReader::cdroot() {
|
|||
NOMORE(fileCnt, uint16_t(SDSORT_LIMIT));
|
||||
|
||||
// Sort order is always needed. May be static or dynamic.
|
||||
#if ENABLED(SDSORT_DYNAMIC_RAM)
|
||||
sort_order = new uint8_t[fileCnt];
|
||||
#endif
|
||||
TERN_(SDSORT_DYNAMIC_RAM, sort_order = new uint8_t[fileCnt]);
|
||||
|
||||
// Use RAM to store the entire directory during pre-sort.
|
||||
// SDSORT_LIMIT should be set to prevent over-allocation.
|
||||
|
@ -963,11 +924,7 @@ void CardReader::cdroot() {
|
|||
|
||||
// Init sort order.
|
||||
for (uint16_t i = 0; i < fileCnt; i++) {
|
||||
sort_order[i] = (
|
||||
#if ENABLED(SDCARD_RATHERRECENTFIRST)
|
||||
fileCnt - 1 -
|
||||
#endif
|
||||
i);
|
||||
sort_order[i] = TERN(SDCARD_RATHERRECENTFIRST, fileCnt - 1 - i, i);
|
||||
// If using RAM then read all filenames now.
|
||||
#if ENABLED(SDSORT_USES_RAM)
|
||||
selectFileByIndex(i);
|
||||
|
@ -991,9 +948,7 @@ void CardReader::cdroot() {
|
|||
#if DISABLED(SDSORT_USES_RAM)
|
||||
selectFileByIndex(o1); // Pre-fetch the first entry and save it
|
||||
strcpy(name1, longest_filename()); // so the loop only needs one fetch
|
||||
#if HAS_FOLDER_SORTING
|
||||
bool dir1 = flag.filenameIsDir;
|
||||
#endif
|
||||
TERN_(HAS_FOLDER_SORTING, bool dir1 = flag.filenameIsDir);
|
||||
#endif
|
||||
|
||||
for (uint16_t j = 0; j < i; ++j) {
|
||||
|
@ -1045,9 +1000,7 @@ void CardReader::cdroot() {
|
|||
// The next o1 is the current o2. No new fetch needed.
|
||||
o1 = o2;
|
||||
#if DISABLED(SDSORT_USES_RAM)
|
||||
#if HAS_FOLDER_SORTING
|
||||
dir1 = dir2;
|
||||
#endif
|
||||
TERN_(HAS_FOLDER_SORTING, dir1 = dir2);
|
||||
strcpy(name1, name2);
|
||||
#endif
|
||||
}
|
||||
|
@ -1058,9 +1011,7 @@ void CardReader::cdroot() {
|
|||
#if ENABLED(SDSORT_USES_RAM) && DISABLED(SDSORT_CACHE_NAMES)
|
||||
#if ENABLED(SDSORT_DYNAMIC_RAM)
|
||||
for (uint16_t i = 0; i < fileCnt; ++i) free(sortnames[i]);
|
||||
#if HAS_FOLDER_SORTING
|
||||
free(isDir);
|
||||
#endif
|
||||
TERN_(HAS_FOLDER_SORTING, free(isDir));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1127,9 +1078,7 @@ void CardReader::fileHasFinished() {
|
|||
else {
|
||||
endFilePrint();
|
||||
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
presort();
|
||||
#endif
|
||||
TERN_(SDCARD_SORT_ALPHA, presort());
|
||||
|
||||
marlin_state = MF_SD_COMPLETE;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#define SD_RESORT BOTH(SDCARD_SORT_ALPHA, SDSORT_DYNAMIC_RAM)
|
||||
#if BOTH(SDCARD_SORT_ALPHA, SDSORT_DYNAMIC_RAM)
|
||||
#define SD_RESORT 1
|
||||
#endif
|
||||
|
||||
#define MAX_DIR_DEPTH 10 // Maximum folder depth
|
||||
#define MAXDIRNAMELENGTH 8 // DOS folder name size
|
||||
|
@ -113,11 +115,7 @@ public:
|
|||
static void getAbsFilename(char *dst);
|
||||
static void printFilename();
|
||||
static void startFileprint();
|
||||
static void endFilePrint(
|
||||
#if SD_RESORT
|
||||
const bool re_sort=false
|
||||
#endif
|
||||
);
|
||||
static void endFilePrint(TERN_(SD_RESORT, const bool re_sort=false));
|
||||
static void report_status();
|
||||
static inline void pauseSDPrint() { flag.sdprinting = false; }
|
||||
static inline bool isPaused() { return isFileOpen() && !flag.sdprinting; }
|
||||
|
|
Reference in a new issue