This commit is contained in:
InsanityAutomation
2019-04-12 14:01:48 -04:00
parent b22a302a72
commit 149c483db2
148 changed files with 1851 additions and 1149 deletions
+4 -4
View File
@@ -1146,13 +1146,13 @@
#if DISABLED(TREX3) || ENABLED(TREX3_UPGRADE)
#define X_MIN_POS -42
#define Y_MIN_POS 0
#define Z_MIN_POS 0
#define Z_MIN_POS 3
#define X_MAX_POS 450
#define Y_MAX_POS Y_BED_SIZE
#else ENABLED(TREX3)
#else
#define X_MIN_POS -47
#define Y_MIN_POS 0
#define Z_MIN_POS 0
#define Z_MIN_POS -3
#define X_MAX_POS 460
#define Y_MAX_POS Y_BED_SIZE
#endif
@@ -1432,7 +1432,7 @@
// For DELTA this is the top-center of the Cartesian print volume.
//#define MANUAL_X_HOME_POS 0
//#define MANUAL_Y_HOME_POS 0
//#define MANUAL_Z_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area.
//
+2 -2
View File
@@ -46,8 +46,8 @@
* Sanity checks for Spindle / Laser
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
@@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "FlushableHardwareSerial.h"
#ifdef ARDUINO_ARCH_ESP32
FlushableHardwareSerial::FlushableHardwareSerial(int uart_nr)
: HardwareSerial(uart_nr)
{}
FlushableHardwareSerial flushableSerial(0);
#endif // ARDUINO_ARCH_ESP32
@@ -20,21 +20,17 @@
*
*/
/**
* M49.cpp - Toggle the G26 debug flag
*/
#ifdef ARDUINO_ARCH_ESP32
#include "../../../inc/MarlinConfig.h"
#include <HardwareSerial.h>
#if ENABLED(G26_MESH_VALIDATION)
class FlushableHardwareSerial : public HardwareSerial {
public:
FlushableHardwareSerial(int uart_nr);
#include "../../gcode.h"
#include "../../../feature/bedlevel/bedlevel.h"
inline void flushTX(void) { /* No need to flush the hardware serial, but defined here for compatibility. */ }
};
void GcodeSuite::M49() {
g26_debug_flag ^= true;
SERIAL_ECHOPGM("G26 Debug: ");
serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n"));
}
extern FlushableHardwareSerial flushableSerial;
#endif // G26_MESH_VALIDATION
#endif // ARDUINO_ARCH_ESP32
+2 -1
View File
@@ -48,6 +48,7 @@
#include "HAL_timers_ESP32.h"
#include "WebSocketSerial.h"
#include "FlushableHardwareSerial.h"
// --------------------------------------------------------------------------
// Defines
@@ -55,7 +56,7 @@
extern portMUX_TYPE spinlock;
#define MYSERIAL0 Serial
#define MYSERIAL0 flushableSerial
#if ENABLED(WIFISUPPORT)
#define NUM_SERIAL 2
+19 -7
View File
@@ -44,6 +44,15 @@ static SPISettings spiConfig;
// Public functions
// --------------------------------------------------------------------------
#if ENABLED(SOFTWARE_SPI)
// --------------------------------------------------------------------------
// Software SPI
// --------------------------------------------------------------------------
#error "Software SPI not supported for ESP32. Use Hardware SPI."
#else
// --------------------------------------------------------------------------
// Hardware SPI
// --------------------------------------------------------------------------
@@ -61,13 +70,14 @@ void spiInit(uint8_t spiRate) {
uint32_t clock;
switch (spiRate) {
case SPI_FULL_SPEED: clock = SPI_CLOCK_DIV2; break;
case SPI_HALF_SPEED: clock = SPI_CLOCK_DIV4; break;
case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break;
case SPI_EIGHTH_SPEED: clock = SPI_CLOCK_DIV16; break;
case SPI_SPEED_5: clock = SPI_CLOCK_DIV32; break;
case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break;
default: clock = SPI_CLOCK_DIV2; // Default from the SPI library
case SPI_FULL_SPEED: clock = 16000000; break;
case SPI_HALF_SPEED: clock = 8000000; break;
case SPI_QUARTER_SPEED: clock = 4000000; break;
case SPI_EIGHTH_SPEED: clock = 2000000; break;
case SPI_SIXTEENTH_SPEED: clock = 1000000; break;
case SPI_SPEED_5: clock = 500000; break;
case SPI_SPEED_6: clock = 250000; break;
default: clock = 1000000; // Default from the SPI library
}
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
@@ -106,4 +116,6 @@ void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode)
SPI.beginTransaction(spiConfig);
}
#endif // !SOFTWARE_SPI
#endif // ARDUINO_ARCH_ESP32
+3
View File
@@ -64,6 +64,9 @@
#define PWM_PIN(P) true
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// Toggle pin value
#define TOGGLE(IO) WRITE(IO, !READ(IO))
//
// Ports and functions
//
+2 -2
View File
@@ -25,8 +25,8 @@
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
+6 -4
View File
@@ -52,11 +52,13 @@ int freeMemory() {
return result;
}
// scan command line for code
// return index into pin map array if found and the pin is valid.
// return dval if not found or not a valid pin.
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
const uint16_t val = (uint16_t)parser.intval(code), port = val / 100, pin = val % 100;
const int16_t ind = (port < (NUM_DIGITAL_PINS >> 5) && (pin < 32))
? GET_PIN_MAP_INDEX(port << 5 | pin) : -2;
return ind > -2 ? ind : dval;
const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100;
const int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? GET_PIN_MAP_INDEX((port << 5) | pin) : -2;
return ind > -1 ? ind : dval;
}
void flashFirmware(int16_t value) {
+2 -2
View File
@@ -25,8 +25,8 @@
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
+6
View File
@@ -40,6 +40,12 @@
#define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%d.%02d"), LPC1768_PIN_PORT(p), LPC1768_PIN_PIN(p)); SERIAL_ECHO(buffer);} while (0)
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
// uses pin index
#ifndef M43_NEVER_TOUCH
#define M43_NEVER_TOUCH(Q) ((Q) == 29 || (Q) == 30 || (Q) == 73) // USB pins
#endif
// active ADC function/mode/code values for PINSEL registers
constexpr int8_t ADC_pin_mode(pin_t pin) {
return (LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 2 ? 2 :
+4 -2
View File
@@ -74,8 +74,10 @@ void watchdog_reset() {
#else
void HAL_clear_reset_source(void) {}
uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
void watchdog_init(void) {}
void watchdog_reset(void) {}
void HAL_clear_reset_source(void) {}
uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
#endif // USE_WATCHDOG
+3 -1
View File
@@ -36,8 +36,10 @@
#if ENABLED(EEPROM_EMULATED_WITH_SRAM)
#if STM32F7xx
#include "stm32f7xx_ll_pwr.h"
#elif STM32F4xx
#include "stm32f4xx_ll_pwr.h"
#else
#error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F7xx"
#error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F4xx and STM32F7xx"
#endif
#endif // EEPROM_EMULATED_WITH_SRAM
+2 -2
View File
@@ -25,8 +25,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
+2 -2
View File
@@ -28,8 +28,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
+2 -2
View File
@@ -24,8 +24,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
+2 -2
View File
@@ -24,8 +24,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
+10 -13
View File
@@ -457,7 +457,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
if (stepper_inactive_time) {
static bool already_shutdown_steppers; // = false
if (planner.has_blocks_queued())
gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered
gcode.reset_stepper_timeout();
else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
@@ -473,14 +473,11 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
#if ENABLED(DISABLE_INACTIVE_E)
disable_e_steppers();
#endif
#if HAS_LCD_MENU
ui.status_screen();
#if ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
ui.defer_status_screen(false);
}
#endif
#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
ui.defer_status_screen(false);
}
#endif
}
}
@@ -617,7 +614,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
}
#endif // !SWITCHING_EXTRUDER
gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered
gcode.reset_stepper_timeout();
}
#endif // EXTRUDER_RUNOUT_PREVENT
@@ -723,7 +720,7 @@ void idle(
#endif
#if ENABLED(PRUSA_MMU2)
mmu2.mmuLoop();
mmu2.mmu_loop();
#endif
}
@@ -975,7 +972,7 @@ void setup() {
#endif
#if ENABLED(SPINDLE_LASER_ENABLE)
OUT_WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // init spindle to off
OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); // init spindle to off
#if SPINDLE_DIR_CHANGE
OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // init rotation to clockwise (M3)
#endif
@@ -1145,7 +1142,7 @@ void loop() {
#endif
#ifdef EVENT_GCODE_SD_STOP
enqueue_and_echo_commands_P(PSTR(EVENT_GCODE_SD_STOP));
#endif
#endif
}
#endif // SDSUPPORT
+4 -1
View File
@@ -189,10 +189,11 @@
#define BOARD_COHESION3D_REMIX 1755 // Cohesion3D ReMix
#define BOARD_COHESION3D_MINI 1756 // Cohesion3D Mini
#define BOARD_SMOOTHIEBOARD 1757 // Smoothieboard
#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan)
#define BOARD_BIQU_SKR_V1_1 1759 // BIQU SKR_V1.1 (Power outputs: Hotend0,Hotend1, Fan, Bed)
#define BOARD_BIQU_B300_V1_0 1760 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
#define BOARD_BIGTREE_SKR_V1_3 1761 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
#define BOARD_AZTEEG_X5_MINI 1762 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
//
// SAM3X8E ARM Cortex M3
@@ -253,6 +254,8 @@
#define BOARD_STM32F4 1804 // STM32 STM32GENERIC based STM32F4 controller
#define BOARD_ARMED 1807 // Arm'ed STM32F4 based controller
#define BOARD_RUMBA32 1809 // RUMBA32 STM32F4 based controller
#define BOARD_BLACK_STM32F407VE 1810 // BLACK_STM32F407VE
#define BOARD_BLACK_STM32F407ZE 1811 // BLACK_STM32F407ZE
#define BOARD_STEVAL 1866 // STEVAL-3DP001V1 3D PRINTER BOARD
//
+2
View File
@@ -47,6 +47,7 @@
#undef DEBUG_DELAY
#if DEBUG_OUT
#define DEBUG_PRINT_P(P) serialprintPGM(P)
#define DEBUG_ECHO_START SERIAL_ECHO_START
#define DEBUG_ERROR_START SERIAL_ERROR_START
#define DEBUG_CHAR SERIAL_CHAR
@@ -66,6 +67,7 @@
#define DEBUG_XYZ SERIAL_XYZ
#define DEBUG_DELAY(ms) serial_delay(ms)
#else
#define DEBUG_PRINT_P(P) NOOP
#define DEBUG_ECHO_START() NOOP
#define DEBUG_ERROR_START() NOOP
#define DEBUG_CHAR(...) NOOP
+38 -13
View File
@@ -65,20 +65,45 @@
#define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T)
#define HAS_DRIVER(T) (AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) || \
AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) || \
AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) || \
AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) || \
AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) || \
AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \
|| AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
// Test for supported TMC drivers that require advanced configuration
// Does not match standalone configurations
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160) )
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) \
|| HAS_DRIVER(TMC2160) \
|| HAS_DRIVER(TMC2208) \
|| HAS_DRIVER(TMC2660) \
|| HAS_DRIVER(TMC5130) \
|| HAS_DRIVER(TMC5160) )
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE_##A(TMC2130) || \
AXIS_DRIVER_TYPE_##A(TMC2160) || \
AXIS_DRIVER_TYPE_##A(TMC2208) || \
AXIS_DRIVER_TYPE_##A(TMC2660) || \
AXIS_DRIVER_TYPE_##A(TMC5130) || \
AXIS_DRIVER_TYPE_##A(TMC5160))
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
// Test for a driver that uses SPI - this allows checking whether a _CS_ pin
// is considered sensitive
#define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_STEALTHCHOP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
+6
View File
@@ -39,6 +39,12 @@ enum AxisEnum : unsigned char {
X_HEAD = 4,
Y_HEAD = 5,
Z_HEAD = 6,
E0_AXIS = 3,
E1_AXIS = 4,
E2_AXIS = 5,
E3_AXIS = 6,
E4_AXIS = 7,
E5_AXIS = 8,
ALL_AXES = 0xFE,
NO_AXIS = 0xFF
};
+18 -17
View File
@@ -22,6 +22,7 @@
#include "serial.h"
#include "language.h"
#include "enum.h"
uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE;
@@ -49,8 +50,14 @@ void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P)
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=NULL*/) {
if (pre) serialprintPGM(pre);
serialprintPGM(onoff ? on : off);
if (post) serialprintPGM(post);
}
void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); }
void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
void serialprint_truefalse(const bool tf) { serialprintPGM(tf ? PSTR("true") : PSTR("false")); }
void print_bin(const uint16_t val) {
uint16_t mask = 0x8000;
@@ -61,21 +68,15 @@ void print_bin(const uint16_t val) {
}
}
#if ENABLED(DEBUG_LEVELING_FEATURE)
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) {
serialprintPGM(prefix);
SERIAL_CHAR('(');
SERIAL_ECHO(x);
SERIAL_ECHOPAIR(", ", y, ", ", z);
SERIAL_CHAR(')');
if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
}
#include "enum.h"
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) {
serialprintPGM(prefix);
SERIAL_CHAR('(');
SERIAL_ECHO(x);
SERIAL_ECHOPAIR(", ", y, ", ", z);
SERIAL_CHAR(')');
if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
}
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]) {
print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
}
#endif
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]) {
print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
}
+6 -9
View File
@@ -174,18 +174,15 @@ inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PG
void serialprintPGM(PGM_P str);
void serial_echo_start();
void serial_error_start();
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=NULL);
void serialprint_onoff(const bool onoff);
void serialprintln_onoff(const bool onoff);
void serialprint_truefalse(const bool tf);
void serial_spaces(uint8_t count);
void print_bin(const uint16_t val);
#if ENABLED(DEBUG_LEVELING_FEATURE)
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);
#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
#define SERIAL_XYZ(PREFIX,...) do { print_xyz(PSTR(PREFIX), NULL, __VA_ARGS__); } while(0)
#else
#define SERIAL_POS(...) NOOP
#define SERIAL_XYZ(...) NOOP
#endif
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);
#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
#define SERIAL_XYZ(PREFIX,...) do { print_xyz(PSTR(PREFIX), NULL, __VA_ARGS__); } while(0)
+18 -5
View File
@@ -58,11 +58,11 @@ void safe_delay(millis_t ms) {
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
// Convert a full-range unsigned 8bit int to a percentage
char* ui8tostr_percent(const uint8_t i) {
const uint8_t percent = ui8_to_percent(i);
conv[3] = RJDIGIT(percent, 100);
conv[4] = RJDIGIT(percent, 10);
conv[5] = DIGIMOD(percent, 1);
char* ui8tostr4pct(const uint8_t i) {
const uint8_t n = ui8_to_percent(i);
conv[3] = RJDIGIT(n, 100);
conv[4] = RJDIGIT(n, 10);
conv[5] = DIGIMOD(n, 1);
conv[6] = '%';
return &conv[3];
}
@@ -214,6 +214,19 @@ void safe_delay(millis_t ms) {
return &conv[1];
}
// Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format
char* ftostr54sign(const float &f, char plus/*=' '*/) {
long i = (f * 100000 + (f < 0 ? -5: 5)) / 10;
conv[0] = i ? MINUSOR(i, plus) : ' ';
conv[1] = DIGIMOD(i, 10000);
conv[2] = '.';
conv[3] = DIGIMOD(i, 1000);
conv[4] = DIGIMOD(i, 100);
conv[5] = DIGIMOD(i, 10);
conv[6] = DIGIMOD(i, 1);
return &conv[0];
}
// Convert unsigned float to rj string with 12345 format
char* ftostr5rj(const float &f) {
const long i = ((f < 0 ? -f : f) * 10 + 5) / 10;
+4 -1
View File
@@ -56,7 +56,7 @@ inline void serial_delay(const millis_t ms) {
#if ANY(ULTRA_LCD, DEBUG_LEVELING_FEATURE, EXTENSIBLE_UI)
// Convert a full-range unsigned 8bit int to a percentage
char* ui8tostr_percent(const uint8_t i);
char* ui8tostr4pct(const uint8_t i);
// Convert uint8_t to string with 123 format
char* ui8tostr3(const uint8_t x);
@@ -91,6 +91,9 @@ inline void serial_delay(const millis_t ms) {
// Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format
char* ftostr43sign(const float &x, char plus=' ');
// Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format
char* ftostr54sign(const float &x, char plus=' ');
// Convert unsigned float to rj string with 12345 format
char* ftostr5rj(const float &x);
+6 -6
View File
@@ -38,6 +38,8 @@
#include "../module/stepper.h"
#include "../gcode/parser.h"
#include "../feature/babystep.h"
#include <Wire.h>
void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) {
@@ -169,7 +171,7 @@ void I2CPositionEncoder::update() {
const int32_t errorP = int32_t(sumP * (1.0f / (I2CPE_ERR_PRST_ARRAY_SIZE)));
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOLNPAIR(" - err detected: ", errorP * planner.steps_to_mm[encoderAxis], "mm; correcting!");
thermalManager.babystepsTodo[encoderAxis] = -LROUND(errorP);
babystep.add_steps(encoderAxis, -LROUND(errorP));
errPrstIdx = 0;
}
}
@@ -180,7 +182,7 @@ void I2CPositionEncoder::update() {
if (ABS(error) > threshold * planner.settings.axis_steps_per_mm[encoderAxis]) {
//SERIAL_ECHOLN(error);
//SERIAL_ECHOLN(position);
thermalManager.babystepsTodo[encoderAxis] = -LROUND(error / 2);
babystep.add_steps(encoderAxis, -LROUND(error / 2));
}
#endif
@@ -227,13 +229,11 @@ bool I2CPositionEncoder::passes_test(const bool report) {
if (report) {
if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. ");
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOPGM(" axis ");
serialprintPGM(H == I2CPE_MAG_SIG_BAD ? PSTR("magnetic strip ") : PSTR("encoder "));
serial_ternary(H == I2CPE_MAG_SIG_BAD, PSTR(" axis "), PSTR("magnetic strip "), PSTR("encoder "));
switch (H) {
case I2CPE_MAG_SIG_GOOD:
case I2CPE_MAG_SIG_MID:
SERIAL_ECHOLNPGM("passes test; field strength ");
serialprintPGM(H == I2CPE_MAG_SIG_GOOD ? PSTR("good.\n") : PSTR("fair.\n"));
serial_ternary(H == I2CPE_MAG_SIG_GOOD, PSTR("passes test; field strength "), PSTR("good"), PSTR("fair"), PSTR(".\n"));
break;
default:
SERIAL_ECHOLNPGM("not detected!");
+2 -3
View File
@@ -275,9 +275,8 @@ class I2CPositionEncodersMgr {
static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) {
CHECK_IDX();
encoders[idx].set_ec_enabled(enabled);
SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis], " axis is ");
serialprintPGM(encoders[idx].get_ec_enabled() ? PSTR("en") : PSTR("dis"));
SERIAL_ECHOLNPGM("abled.");
SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis]);
serial_ternary(encoders[idx].get_ec_enabled(), PSTR(" axis is "), PSTR("en"), PSTR("dis"), PSTR("abled.\n"));
}
static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) {
+135
View File
@@ -0,0 +1,135 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../inc/MarlinConfig.h"
#if ENABLED(BABYSTEPPING)
#include "babystep.h"
#include "../Marlin.h"
#include "../module/planner.h"
#include "../module/stepper.h"
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
#include "../gcode/gcode.h"
#endif
Babystep babystep;
volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1];
#if HAS_LCD_MENU
int16_t Babystep::accum;
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
#endif
#endif
void Babystep::step_axis(const AxisEnum axis) {
const int16_t curTodo = todo[BS_TODO_AXIS(axis)]; // get rid of volatile for performance
if (curTodo) {
stepper.babystep((AxisEnum)axis, curTodo > 0);
if (curTodo > 0) todo[BS_TODO_AXIS(axis)]--; else todo[BS_TODO_AXIS(axis)]++;
}
}
void Babystep::task() {
#if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
LOOP_XYZ(axis) step_axis((AxisEnum)axis);
#else
step_axis(Z_AXIS);
#endif
}
void Babystep::add_mm(const AxisEnum axis, const float &mm) {
add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]);
}
void Babystep::add_steps(const AxisEnum axis, const int32_t distance) {
#if ENABLED(BABYSTEP_WITHOUT_HOMING)
#define CAN_BABYSTEP(AXIS) true
#else
extern uint8_t axis_known_position;
#define CAN_BABYSTEP(AXIS) TEST(axis_known_position, AXIS)
#endif
if (!CAN_BABYSTEP(axis)) return;
#if HAS_LCD_MENU
accum += distance; // Count up babysteps for the UI
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
axis_total[BS_TOTAL_AXIS(axis)] += distance;
#endif
#endif
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
#define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: enable_X(); break; case Y_AXIS: enable_Y(); break; case Z_AXIS: enable_Z(); } }while(0)
#else
#define BSA_ENABLE(AXIS) NOOP
#endif
#if IS_CORE
#if ENABLED(BABYSTEP_XY)
switch (axis) {
case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
todo[CORE_AXIS_1] += distance * 2;
todo[CORE_AXIS_2] += distance * 2;
break;
case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
todo[CORE_AXIS_1] += CORESIGN(distance * 2);
todo[CORE_AXIS_2] -= CORESIGN(distance * 2);
break;
case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
default:
BSA_ENABLE(NORMAL_AXIS);
todo[NORMAL_AXIS] += distance;
break;
}
#elif CORE_IS_XZ || CORE_IS_YZ
// Only Z stepping needs to be handled here
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
todo[CORE_AXIS_1] += CORESIGN(distance * 2);
todo[CORE_AXIS_2] -= CORESIGN(distance * 2);
#else
BSA_ENABLE(Z_AXIS);
todo[Z_AXIS] += distance;
#endif
#else
#if ENABLED(BABYSTEP_XY)
BSA_ENABLE(axis);
#else
BSA_ENABLE(Z_AXIS);
#endif
todo[BS_TODO_AXIS(axis)] += distance;
#endif
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
gcode.reset_stepper_timeout();
#endif
}
#endif // BABYSTEPPING
+63
View File
@@ -0,0 +1,63 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../inc/MarlinConfigPre.h"
#include "../core/enum.h"
#if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
#define BS_TODO_AXIS(A) A
#else
#define BS_TODO_AXIS(A) 0
#endif
#if HAS_LCD_MENU && ENABLED(BABYSTEP_DISPLAY_TOTAL)
#if ENABLED(BABYSTEP_XY)
#define BS_TOTAL_AXIS(A) A
#else
#define BS_TOTAL_AXIS(A) 0
#endif
#endif
class Babystep {
public:
static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1];
#if HAS_LCD_MENU
static int16_t accum; // Total babysteps in current edit
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28
static inline void reset_total(const AxisEnum axis) {
#if ENABLED(BABYSTEP_XY)
if (axis == Z_AXIS)
#endif
axis_total[BS_TOTAL_AXIS(axis)] = 0;
}
#endif
#endif
static void add_steps(const AxisEnum axis, const int32_t distance);
static void add_mm(const AxisEnum axis, const float &mm);
static void task();
private:
static void step_axis(const AxisEnum axis);
};
extern Babystep babystep;
-4
View File
@@ -42,10 +42,6 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../core/debug_out.h"
#if ENABLED(G26_MESH_VALIDATION)
bool g26_debug_flag; // = false
#endif
bool leveling_is_valid() {
return
#if ENABLED(MESH_BED_LEVELING)
-6
View File
@@ -28,12 +28,6 @@ typedef struct {
float distance; // When populated, the distance from the search location
} mesh_index_pair;
#if ENABLED(G26_MESH_VALIDATION)
extern bool g26_debug_flag;
#else
constexpr bool g26_debug_flag = false;
#endif
#if ENABLED(PROBE_MANUALLY)
extern bool g29_in_progress;
#else
@@ -49,8 +49,8 @@
ZERO(z_values);
#if ENABLED(EXTENSIBLE_UI)
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
ExtUI::onMeshUpdate(x, y, 0);
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
ExtUI::onMeshUpdate(x, y, 0);
#endif
}
+4 -48
View File
@@ -35,7 +35,7 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extensible_ui/ui_api.h"
#endif
#include "math.h"
void unified_bed_leveling::echo_name() {
@@ -58,54 +58,10 @@
void unified_bed_leveling::report_state() {
echo_name();
SERIAL_ECHOPGM(" System v" UBL_VERSION " ");
if (!planner.leveling_active) SERIAL_ECHOPGM("in");
SERIAL_ECHOLNPGM("active.");
serial_ternary(planner.leveling_active, PSTR(" System v" UBL_VERSION " "), PSTR(""), PSTR("in"), PSTR("active\n"));
serial_delay(50);
}
#if ENABLED(UBL_DEVEL_DEBUGGING)
static void debug_echo_axis(const AxisEnum axis) {
if (current_position[axis] == destination[axis])
SERIAL_ECHOPGM("-------------");
else
SERIAL_ECHO_F(destination[X_AXIS], 6);
}
void debug_current_and_destination(PGM_P title) {
// if the title message starts with a '!' it is so important, we are going to
// ignore the status of the g26_debug_flag
if (*title != '!' && !g26_debug_flag) return;
const float de = destination[E_AXIS] - current_position[E_AXIS];
if (de == 0.0) return; // Printing moves only
const float dx = destination[X_AXIS] - current_position[X_AXIS],
dy = destination[Y_AXIS] - current_position[Y_AXIS],
xy_dist = HYPOT(dx, dy);
if (xy_dist == 0.0) return;
const float fpmm = de / xy_dist;
SERIAL_ECHOPAIR_F(" fpmm=", fpmm, 6);
SERIAL_ECHOPAIR_F(" current=( ", current_position[X_AXIS], 6);
SERIAL_ECHOPAIR_F(", ", current_position[Y_AXIS], 6);
SERIAL_ECHOPAIR_F(", ", current_position[Z_AXIS], 6);
SERIAL_ECHOPAIR_F(", ", current_position[E_AXIS], 6);
SERIAL_ECHOPGM(" ) destination=( "); debug_echo_axis(X_AXIS);
SERIAL_ECHOPGM(", "); debug_echo_axis(Y_AXIS);
SERIAL_ECHOPGM(", "); debug_echo_axis(Z_AXIS);
SERIAL_ECHOPGM(", "); debug_echo_axis(E_AXIS);
SERIAL_ECHOPGM(" ) ");
serialprintPGM(title);
SERIAL_EOL();
}
#endif // UBL_DEVEL_DEBUGGING
int8_t unified_bed_leveling::storage_slot;
float unified_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
@@ -135,8 +91,8 @@
ZERO(z_values);
#if ENABLED(EXTENSIBLE_UI)
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
ExtUI::onMeshUpdate(x, y, 0);
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
ExtUI::onMeshUpdate(x, y, 0);
#endif
if (was_enabled) report_current_position();
}
-8
View File
@@ -39,14 +39,6 @@
#define USE_NOZZLE_AS_REFERENCE 0
#define USE_PROBE_AS_REFERENCE 1
// ubl_motion.cpp
#if ENABLED(UBL_DEVEL_DEBUGGING)
void debug_current_and_destination(PGM_P const title);
#else
FORCE_INLINE void debug_current_and_destination(PGM_P const title) { UNUSED(title); }
#endif
// ubl_G29.cpp
enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP };
+2 -6
View File
@@ -24,8 +24,6 @@
#if ENABLED(AUTO_BED_LEVELING_UBL)
//#define UBL_DEVEL_DEBUGGING
#include "ubl.h"
#include "../../../Marlin.h"
@@ -765,14 +763,12 @@
if (location.x_index >= 0) { // mesh point found and is reachable by probe
const float rawx = mesh_index_to_xpos(location.x_index),
rawy = mesh_index_to_ypos(location.y_index);
const float measured_z = probe_pt(rawx, rawy, stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling
rawy = mesh_index_to_ypos(location.y_index),
measured_z = probe_pt(rawx, rawy, stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling
z_values[location.x_index][location.y_index] = measured_z;
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(location.x_index, location.y_index, measured_z);
#endif
}
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} while (location.x_index >= 0 && --count);
@@ -64,17 +64,6 @@
cell_dest_xi = get_cell_index_x(end[X_AXIS]),
cell_dest_yi = get_cell_index_y(end[Y_AXIS]);
if (g26_debug_flag) {
SERIAL_ECHOLNPAIR(
" ubl.line_to_destination_cartesian(xe=", destination[X_AXIS],
", ye=", destination[Y_AXIS],
", ze=", destination[Z_AXIS],
", ee=", destination[E_AXIS],
")"
);
debug_current_and_destination(PSTR("Start of ubl.line_to_destination_cartesian()"));
}
// A move within the same cell needs no splitting
if (cell_start_xi == cell_dest_xi && cell_start_yi == cell_dest_yi) {
@@ -93,9 +82,6 @@
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder);
set_current_from_destination();
if (g26_debug_flag)
debug_current_and_destination(PSTR("out of bounds in ubl.line_to_destination_cartesian()"));
return;
}
@@ -119,9 +105,6 @@
// Replace NAN corrections with 0.0 to prevent NAN propagation.
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], feed_rate, extruder);
if (g26_debug_flag)
debug_current_and_destination(PSTR("FINAL_MOVE in ubl.line_to_destination_cartesian()"));
set_current_from_destination();
return;
}
@@ -215,9 +198,6 @@
} //else printf("FIRST MOVE PRUNED ");
}
if (g26_debug_flag)
debug_current_and_destination(PSTR("vertical move done in ubl.line_to_destination_cartesian()"));
// At the final destination? Usually not, but when on a Y Mesh Line it's completed.
if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
goto FINAL_MOVE;
@@ -267,9 +247,6 @@
} //else printf("FIRST MOVE PRUNED ");
}
if (g26_debug_flag)
debug_current_and_destination(PSTR("horizontal move done in ubl.line_to_destination_cartesian()"));
if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
goto FINAL_MOVE;
@@ -353,9 +330,6 @@
if (xi_cnt < 0 || yi_cnt < 0) break; // Too far! Exit the loop and go to FINAL_MOVE
}
if (g26_debug_flag)
debug_current_and_destination(PSTR("generic move done in ubl.line_to_destination_cartesian()"));
if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
goto FINAL_MOVE;
@@ -35,6 +35,9 @@
#if MB(5DPRINT)
#define DIGIPOT_I2C_FACTOR 117.96
#define DIGIPOT_I2C_MAX_CURRENT 1.736
#elif MB(AZTEEG_X5_MINI) || MB(AZTEEG_X5_MINI_WIFI)
#define DIGIPOT_I2C_FACTOR 113.5
#define DIGIPOT_I2C_MAX_CURRENT 2.0
#else
#define DIGIPOT_I2C_FACTOR 106.7
#define DIGIPOT_I2C_MAX_CURRENT 2.5
+20 -11
View File
@@ -120,19 +120,28 @@ typedef struct LEDColor {
#else
#define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B, W)
#endif
#define LEDColorWhite() LEDColor(0, 0, 0, 255)
#else
#define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B)
#define LEDColorWhite() LEDColor(255, 255, 255)
#define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B)
#endif
#define LEDColorOff() LEDColor( 0, 0, 0)
#define LEDColorRed() LEDColor(255, 0, 0)
#if ENABLED(LED_COLORS_REDUCE_GREEN)
#define LEDColorOrange() LEDColor(255, 25, 0)
#define LEDColorYellow() LEDColor(255, 75, 0)
#else
#define LEDColorOrange() LEDColor(255, 80, 0)
#define LEDColorYellow() LEDColor(255, 255, 0)
#endif
#define LEDColorGreen() LEDColor( 0, 255, 0)
#define LEDColorBlue() LEDColor( 0, 0, 255)
#define LEDColorIndigo() LEDColor( 0, 255, 255)
#define LEDColorViolet() LEDColor(255, 0, 255)
#if HAS_WHITE_LED
#define LEDColorWhite() LEDColor( 0, 0, 0, 255)
#else
#define LEDColorWhite() LEDColor(255, 255, 255)
#endif
#define LEDColorOff() LEDColor( 0, 0, 0)
#define LEDColorRed() LEDColor(255, 0, 0)
#define LEDColorOrange() LEDColor(255, 80, 0)
#define LEDColorYellow() LEDColor(255, 255, 0)
#define LEDColorGreen() LEDColor( 0, 255, 0)
#define LEDColorBlue() LEDColor( 0, 0, 255)
#define LEDColorIndigo() LEDColor( 0, 255, 255)
#define LEDColorViolet() LEDColor(255, 0, 255)
class LEDLights {
public:
+39 -46
View File
@@ -50,6 +50,9 @@ job_recovery_info_t PrintJobRecovery::info;
#include "fwretract.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
#include "../core/debug_out.h"
PrintJobRecovery recovery;
/**
@@ -110,9 +113,7 @@ void PrintJobRecovery::load() {
(void)file.read(&info, sizeof(info));
close();
}
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
debug(PSTR("Load"));
#endif
debug(PSTR("Load"));
}
/**
@@ -126,8 +127,6 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
#endif
// Did Z change since the last call?
const float zmoved = current_position[Z_AXIS] - info.current_position[Z_AXIS];
if (force
#if DISABLED(SAVE_EACH_CMD_MODE) // Always save state when enabled
#if PIN_EXISTS(POWER_LOSS) // Save if power loss pin is triggered
@@ -136,8 +135,8 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
#if SAVE_INFO_INTERVAL_MS > 0 // Save if interval is elapsed
|| ELAPSED(ms, next_save_ms)
#endif
|| zmoved > 0 // Z moved up (including Z-hop)
|| zmoved < -5 // Z moved down a lot (for some reason)
// Save every time Z is higher than the last call
|| current_position[Z_AXIS] > info.current_position[Z_AXIS]
#endif
) {
@@ -218,20 +217,14 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
*/
void PrintJobRecovery::write() {
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
debug(PSTR("Write"));
#endif
debug(PSTR("Write"));
open(false);
file.seekSet(0);
const int16_t ret = file.write(&info, sizeof(info));
close();
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
if (ret == -1) SERIAL_ECHOLNPGM("Power-loss file write failed.");
#else
UNUSED(ret);
#endif
if (ret == -1) DEBUG_ECHOLNPGM("Power-loss file write failed.");
}
/**
@@ -369,65 +362,65 @@ void PrintJobRecovery::resume() {
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
void PrintJobRecovery::debug(PGM_P const prefix) {
serialprintPGM(prefix);
SERIAL_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot));
DEBUG_PRINT_P(prefix);
DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot));
if (info.valid_head) {
if (info.valid_head == info.valid_foot) {
SERIAL_ECHOPGM("current_position: ");
DEBUG_ECHOPGM("current_position: ");
LOOP_XYZE(i) {
SERIAL_ECHO(info.current_position[i]);
if (i < E_AXIS) SERIAL_CHAR(',');
if (i) DEBUG_CHAR(',');
DEBUG_ECHO(info.current_position[i]);
}
SERIAL_EOL();
SERIAL_ECHOLNPAIR("feedrate: ", info.feedrate);
DEBUG_EOL();
DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate);
#if HOTENDS > 1
SERIAL_ECHOLNPAIR("active_hotend: ", int(info.active_hotend));
DEBUG_ECHOLNPAIR("active_hotend: ", int(info.active_hotend));
#endif
SERIAL_ECHOPGM("target_temperature: ");
DEBUG_ECHOPGM("target_temperature: ");
HOTEND_LOOP() {
SERIAL_ECHO(info.target_temperature[e]);
if (e < HOTENDS - 1) SERIAL_CHAR(',');
DEBUG_ECHO(info.target_temperature[e]);
if (e < HOTENDS - 1) DEBUG_CHAR(',');
}
SERIAL_EOL();
DEBUG_EOL();
#if HAS_HEATED_BED
SERIAL_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed);
DEBUG_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed);
#endif
#if FAN_COUNT
SERIAL_ECHOPGM("fan_speed: ");
DEBUG_ECHOPGM("fan_speed: ");
FANS_LOOP(i) {
SERIAL_ECHO(int(info.fan_speed[i]));
if (i < FAN_COUNT - 1) SERIAL_CHAR(',');
DEBUG_ECHO(int(info.fan_speed[i]));
if (i < FAN_COUNT - 1) DEBUG_CHAR(',');
}
SERIAL_EOL();
DEBUG_EOL();
#endif
#if HAS_LEVELING
SERIAL_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade));
DEBUG_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade));
#endif
#if ENABLED(FWRETRACT)
SERIAL_ECHOPGM("retract: ");
DEBUG_ECHOPGM("retract: ");
for (int8_t e = 0; e < EXTRUDERS; e++) {
SERIAL_ECHO(info.retract[e]);
if (e < EXTRUDERS - 1) SERIAL_CHAR(',');
DEBUG_ECHO(info.retract[e]);
if (e < EXTRUDERS - 1) DEBUG_CHAR(',');
}
SERIAL_EOL();
SERIAL_ECHOLNPAIR("retract_hop: ", info.retract_hop);
DEBUG_EOL();
DEBUG_ECHOLNPAIR("retract_hop: ", info.retract_hop);
#endif
SERIAL_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r));
SERIAL_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue));
for (uint8_t i = 0; i < info.commands_in_queue; i++) SERIAL_ECHOLNPAIR("> ", info.command_queue[i]);
SERIAL_ECHOLNPAIR("sd_filename: ", info.sd_filename);
SERIAL_ECHOLNPAIR("sdpos: ", info.sdpos);
SERIAL_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
DEBUG_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r));
DEBUG_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue));
for (uint8_t i = 0; i < info.commands_in_queue; i++) DEBUG_ECHOLNPAIR("> ", info.command_queue[i]);
DEBUG_ECHOLNPAIR("sd_filename: ", info.sd_filename);
DEBUG_ECHOLNPAIR("sdpos: ", info.sdpos);
DEBUG_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
}
else
SERIAL_ECHOLNPGM("INVALID DATA");
DEBUG_ECHOLNPGM("INVALID DATA");
}
SERIAL_ECHOLNPGM("---");
DEBUG_ECHOLNPGM("---");
}
#endif // DEBUG_POWER_LOSS_RECOVERY
+5 -3
View File
@@ -125,9 +125,11 @@ class PrintJobRecovery {
static inline bool valid() { return info.valid_head && info.valid_head == info.valid_foot; }
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
static void debug(PGM_P const prefix);
#endif
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
static void debug(PGM_P const prefix);
#else
static inline void debug(PGM_P const prefix) { UNUSED(prefix); }
#endif
private:
static void write();
+40 -40
View File
@@ -90,7 +90,7 @@ bool MMU2::enabled, MMU2::ready, MMU2::mmu_print_saved;
uint8_t MMU2::cmd, MMU2::cmd_arg, MMU2::last_cmd, MMU2::extruder;
int8_t MMU2::state = 0;
volatile int8_t MMU2::finda = 1;
volatile bool MMU2::findaRunoutValid;
volatile bool MMU2::finda_runout_valid;
int16_t MMU2::version = -1, MMU2::buildnr = -1;
millis_t MMU2::last_request, MMU2::next_P0_request;
char MMU2::rx_buffer[16], MMU2::tx_buffer[16];
@@ -103,7 +103,7 @@ char MMU2::rx_buffer[16], MMU2::tx_buffer[16];
};
static constexpr E_Step ramming_sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE };
static constexpr E_Step loadToNozzle_sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE };
static constexpr E_Step load_to_nozzle_sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE };
#endif // MMU2_MENUS
@@ -142,11 +142,11 @@ void MMU2::reset() {
#endif
}
uint8_t MMU2::getCurrentTool() {
uint8_t MMU2::get_current_tool() {
return extruder == MMU2_NO_TOOL ? -1 : extruder;
}
void MMU2::mmuLoop() {
void MMU2::mmu_loop() {
switch (state) {
@@ -185,7 +185,7 @@ void MMU2::mmuLoop() {
DEBUG_ECHOLNPAIR("MMU => ", buildnr);
checkVersion();
check_version();
#if ENABLED(MMU2_MODE_12V)
DEBUG_ECHOLNPGM("MMU <= 'M1'");
@@ -207,7 +207,7 @@ void MMU2::mmuLoop() {
if (rx_ok()) {
DEBUG_ECHOLNPGM("MMU => ok");
checkVersion();
check_version();
DEBUG_ECHOLNPGM("MMU <= 'P0'");
@@ -294,13 +294,13 @@ void MMU2::mmuLoop() {
sscanf(rx_buffer, "%hhuok\n", &finda);
// This is super annoying. Only activate if necessary
// if (findaRunoutValid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6);
// if (finda_runout_valid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6);
state = 1;
if (cmd == 0) ready = true;
if (!finda && findaRunoutValid) filamentRunout();
if (!finda && finda_runout_valid) filament_runout();
}
else if (ELAPSED(millis(), last_request + MMU_P0_TIMEOUT)) // Resend request after timeout (30s)
state = 1;
@@ -434,7 +434,7 @@ bool MMU2::rx_ok() {
/**
* Check if MMU has compatible firmware
*/
void MMU2::checkVersion() {
void MMU2::check_version() {
if (buildnr < MMU_REQUIRED_FW_BUILDNR) {
SERIAL_ERROR_START();
SERIAL_ECHOPGM("MMU2 firmware version invalid. Required version >= ");
@@ -447,7 +447,7 @@ void MMU2::checkVersion() {
/**
* Handle tool change
*/
void MMU2::toolChange(uint8_t index) {
void MMU2::tool_change(uint8_t index) {
if (!enabled) return;
@@ -461,7 +461,7 @@ void MMU2::toolChange(uint8_t index) {
command(MMU_CMD_T0 + index);
manageResponse(true, true);
manage_response(true, true);
KEEPALIVE_STATE(IN_HANDLER);
command(MMU_CMD_C0);
@@ -490,7 +490,7 @@ void MMU2::toolChange(uint8_t index) {
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*
*/
void MMU2::toolChange(const char* special) {
void MMU2::tool_change(const char* special) {
if (!enabled) return;
@@ -501,19 +501,19 @@ void MMU2::toolChange(const char* special) {
switch (*special) {
case '?': {
uint8_t index = mmu2_chooseFilament();
uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
loadFilamentToNozzle(index);
load_filament_to_nozzle(index);
} break;
case 'x': {
planner.synchronize();
uint8_t index = mmu2_chooseFilament();
uint8_t index = mmu2_choose_filament();
disable_E0();
command(MMU_CMD_T0 + index);
manageResponse(true, true);
manage_response(true, true);
command(MMU_CMD_C0);
mmuLoop();
mmu_loop();
enable_E0();
extruder = index;
@@ -522,7 +522,7 @@ void MMU2::toolChange(const char* special) {
case 'c': {
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
executeExtruderSequence((const E_Step *)loadToNozzle_sequence, COUNT(loadToNozzle_sequence));
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
} break;
}
@@ -547,7 +547,7 @@ void MMU2::command(const uint8_t mmu_cmd) {
/**
* Wait for response from MMU
*/
bool MMU2::getResponse(void) {
bool MMU2::get_response(void) {
while (cmd != MMU_CMD_NONE) idle();
while (!ready) {
@@ -565,7 +565,7 @@ bool MMU2::getResponse(void) {
/**
* Wait for response and deal with timeout if nexcessary
*/
void MMU2::manageResponse(bool move_axes, bool turn_off_nozzle) {
void MMU2::manage_response(bool move_axes, bool turn_off_nozzle) {
bool response = false;
mmu_print_saved = false;
@@ -575,7 +575,7 @@ void MMU2::manageResponse(bool move_axes, bool turn_off_nozzle) {
while (!response) {
response = getResponse(); //wait for "ok" from mmu
response = get_response(); //wait for "ok" from mmu
if (!response) { //no "ok" was received in reserved time frame, user will fix the issue on mmu unit
if (!mmu_print_saved) { //first occurence, we are saving current position, park print head in certain position and disable nozzle heater
@@ -636,7 +636,7 @@ void MMU2::manageResponse(bool move_axes, bool turn_off_nozzle) {
}
}
void MMU2::setFilamentType(uint8_t index, uint8_t filamentType) {
void MMU2::set_filament_type(uint8_t index, uint8_t filamentType) {
if (!enabled) return;
KEEPALIVE_STATE(IN_HANDLER);
@@ -644,12 +644,12 @@ void MMU2::setFilamentType(uint8_t index, uint8_t filamentType) {
cmd_arg = filamentType;
command(MMU_CMD_F0 + index);
manageResponse(true, true);
manage_response(true, true);
KEEPALIVE_STATE(NOT_BUSY);
}
void MMU2::filamentRunout() {
void MMU2::filament_runout() {
enqueue_and_echo_commands_P(PSTR(MMU2_FILAMENT_RUNOUT_SCRIPT));
planner.synchronize();
}
@@ -657,10 +657,10 @@ void MMU2::filamentRunout() {
#if HAS_LCD_MENU && ENABLED(MMU2_MENUS)
// Load filament into MMU2
void MMU2::loadFilament(uint8_t index) {
void MMU2::load_filament(uint8_t index) {
if (!enabled) return;
command(MMU_CMD_L0 + index);
manageResponse(false, false);
manage_response(false, false);
BUZZ(200, 404);
}
@@ -669,7 +669,7 @@ void MMU2::filamentRunout() {
* Switch material and load to nozzle
*
*/
bool MMU2::loadFilamentToNozzle(uint8_t index) {
bool MMU2::load_filament_to_nozzle(uint8_t index) {
if (!enabled) return false;
@@ -682,14 +682,14 @@ void MMU2::filamentRunout() {
KEEPALIVE_STATE(IN_HANDLER);
command(MMU_CMD_T0 + index);
manageResponse(true, true);
manage_response(true, true);
command(MMU_CMD_C0);
mmuLoop();
mmu_loop();
extruder = index;
active_extruder = 0;
loadToNozzle();
load_to_nozzle();
BUZZ(200, 404);
@@ -706,12 +706,12 @@ void MMU2::filamentRunout() {
* It is not used after T0 .. T4 command (select filament), in such case, gcode is responsible for loading
* filament to nozzle.
*/
void MMU2::loadToNozzle() {
void MMU2::load_to_nozzle() {
if (!enabled) return;
executeExtruderSequence((const E_Step *)loadToNozzle_sequence, COUNT(loadToNozzle_sequence));
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
}
bool MMU2::ejectFilament(uint8_t index, bool recover) {
bool MMU2::eject_filament(uint8_t index, bool recover) {
if (!enabled) return false;
@@ -731,7 +731,7 @@ void MMU2::filamentRunout() {
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2500 / 60, active_extruder);
planner.synchronize();
command(MMU_CMD_E0 + index);
manageResponse(false, false);
manage_response(false, false);
if (recover) {
LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER);
@@ -745,7 +745,7 @@ void MMU2::filamentRunout() {
BUZZ(200, 404);
command(MMU_CMD_R0);
manageResponse(false, false);
manage_response(false, false);
}
ui.reset_status();
@@ -783,10 +783,10 @@ void MMU2::filamentRunout() {
KEEPALIVE_STATE(IN_HANDLER);
filamentRamming();
filament_ramming();
command(MMU_CMD_U0);
manageResponse(false, true);
manage_response(false, true);
BUZZ(200, 404);
@@ -803,11 +803,11 @@ void MMU2::filamentRunout() {
/**
* Unload sequence to optimize shape of the tip of the unloaded filament
*/
void MMU2::filamentRamming() {
executeExtruderSequence((const E_Step *)ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step));
void MMU2::filament_ramming() {
execute_extruder_sequence((const E_Step *)ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step));
}
void MMU2::executeExtruderSequence(const E_Step * sequence, int steps) {
void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) {
planner.synchronize();
enable_E0();
+18 -18
View File
@@ -36,18 +36,18 @@ public:
static void init();
static void reset();
static void mmuLoop();
static void toolChange(uint8_t index);
static void toolChange(const char* special);
static uint8_t getCurrentTool();
static void setFilamentType(uint8_t index, uint8_t type);
static void mmu_loop();
static void tool_change(uint8_t index);
static void tool_change(const char* special);
static uint8_t get_current_tool();
static void set_filament_type(uint8_t index, uint8_t type);
#if HAS_LCD_MENU && ENABLED(MMU2_MENUS)
static bool unload();
static void loadFilament(uint8_t);
static void loadAll();
static bool loadFilamentToNozzle(uint8_t index);
static bool ejectFilament(uint8_t index, bool recover);
static void load_filament(uint8_t);
static void load_all();
static bool load_filament_to_nozzle(uint8_t index);
static bool eject_filament(uint8_t index, bool recover);
#endif
private:
@@ -59,31 +59,31 @@ private:
static bool rx_ok();
static bool rx_start();
static void checkVersion();
static void check_version();
static void command(const uint8_t cmd);
static bool getResponse(void);
static void manageResponse(bool move_axes, bool turn_off_nozzle);
static bool get_response(void);
static void manage_response(bool move_axes, bool turn_off_nozzle);
#if HAS_LCD_MENU && ENABLED(MMU2_MENUS)
static void loadToNozzle();
static void filamentRamming();
static void executeExtruderSequence(const E_Step * sequence, int steps);
static void load_to_nozzle();
static void filament_ramming();
static void execute_extruder_sequence(const E_Step * sequence, int steps);
#endif
static void filamentRunout();
static void filament_runout();
static bool enabled, ready, mmu_print_saved;
static uint8_t cmd, cmd_arg, last_cmd, extruder;
static int8_t state;
static volatile int8_t finda;
static volatile bool findaRunoutValid;
static volatile bool finda_runout_valid;
static int16_t version, buildnr;
static millis_t last_request, next_P0_request;
static char rx_buffer[16], tx_buffer[16];
static inline void set_runout_valid(const bool valid) {
findaRunoutValid = valid;
finda_runout_valid = valid;
#if HAS_FILAMENT_SENSOR
if (valid) runout.reset();
#endif
+9 -9
View File
@@ -474,7 +474,7 @@
switch (i) {
case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break;
case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
default: break;
}
}
@@ -497,7 +497,7 @@
switch (i) {
case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break;
case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
case TMC_GLOBAL_SCALER:
{
uint16_t value = st.GLOBAL_SCALER();
@@ -514,7 +514,7 @@
static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
switch (i) {
case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break;
case TMC_STEALTHCHOP: serialprintPGM(st.stealth() ? PSTR("true") : PSTR("false")); break;
case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break;
case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('X'); break;
case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('X'); break;
default: break;
@@ -541,7 +541,7 @@
SERIAL_CHAR('\t');
switch (i) {
case TMC_CODES: st.printLabel(); break;
case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break;
case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
@@ -578,9 +578,9 @@
SERIAL_CHAR('-');
}
break;
case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
#if ENABLED(MONITOR_DRIVER_STATUS)
case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
#endif
case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break;
case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break;
@@ -596,7 +596,7 @@
SERIAL_CHAR('\t');
switch (i) {
case TMC_CODES: st.printLabel(); break;
case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break;
case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
@@ -606,8 +606,8 @@
break;
case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
//case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
//case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
//case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
//case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break;
case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break;
+1 -1
View File
@@ -227,7 +227,7 @@ void tmc_set_current(TMC &st, const int mA) {
void tmc_report_otpw(TMC &st) {
st.printLabel();
SERIAL_ECHOPGM(" temperature prewarn triggered: ");
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
serialprint_truefalse(st.getOTPW());
SERIAL_EOL();
}
template<typename TMC>
+13 -57
View File
@@ -246,8 +246,6 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de
// Yes: a 'normal' movement. No: a retract() or recover()
feed_value = has_xy_component ? G26_XY_FEEDRATE : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5;
if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
destination[X_AXIS] = rx;
destination[Y_AXIS] = ry;
destination[E_AXIS] += e_delta;
@@ -327,19 +325,15 @@ inline bool look_for_lines_to_connect() {
for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
#if HAS_LCD_MENU
if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation
if (user_canceled()) return true;
#endif
if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X.
// This is already a half circle because we are at the edge of the bed.
if (i < GRID_MAX_POINTS_X) { // Can't connect to anything to the right than GRID_MAX_POINTS_X.
// Already a half circle at the edge of the bed.
if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i + 1, j)) { // check if we can do a line to the left
if (!is_bitmap_set(horizontal_mesh_line_flags, i, j)) {
//
// We found two circles that need a horizontal line to connect them
// Print it!
//
// Two circles need a horizontal line to connect them
sx = _GET_MESH_X( i ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // right edge
ex = _GET_MESH_X(i + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // left edge
@@ -347,27 +341,19 @@ inline bool look_for_lines_to_connect() {
sy = ey = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
if (g26_debug_flag) {
SERIAL_ECHOLNPAIR(" Connecting with horizontal line (sx=", sx, ", sy=", sy, ") -> (ex=", ex, ", ey=", ey, ")");
//debug_current_and_destination(PSTR("Connecting horizontal line."));
}
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey))
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
}
bitmap_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it
bitmap_set(horizontal_mesh_line_flags, i, j); // Mark done, even if skipped
}
}
if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y.
// This is already a half circle because we are at the edge of the bed.
if (j < GRID_MAX_POINTS_Y) { // Can't connect to anything further back than GRID_MAX_POINTS_Y.
// Already a half circle at the edge of the bed.
if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i, j + 1)) { // check if we can do a line straight down
if (!is_bitmap_set( vertical_mesh_line_flags, i, j)) {
//
// We found two circles that need a vertical line to connect them
// Print it!
//
// Two circles that need a vertical line to connect them
sy = _GET_MESH_Y( j ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // top edge
ey = _GET_MESH_Y(j + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // bottom edge
@@ -375,23 +361,10 @@ inline bool look_for_lines_to_connect() {
sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
if (g26_debug_flag) {
SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
SERIAL_ECHOPAIR(", sy=", sy);
SERIAL_ECHOPAIR(") -> (ex=", ex);
SERIAL_ECHOPAIR(", ey=", ey);
SERIAL_CHAR(')');
SERIAL_EOL();
#if ENABLED(AUTO_BED_LEVELING_UBL)
debug_current_and_destination(PSTR("Connecting vertical line."));
#endif
}
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey))
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
}
bitmap_set(vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if skipped
bitmap_set(vertical_mesh_line_flags, i, j); // Mark done, even if skipped
}
}
}
@@ -725,8 +698,6 @@ void GcodeSuite::G26() {
ui.capture();
#endif
//debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern."));
#if DISABLED(ARC_SUPPORT)
/**
@@ -819,18 +790,6 @@ void GcodeSuite::G26() {
const float save_feedrate = feedrate_mm_s;
feedrate_mm_s = PLANNER_XY_FEEDRATE() / 10.0;
if (g26_debug_flag) {
SERIAL_ECHOPAIR(" plan_arc(ex=", endpoint[X_AXIS]);
SERIAL_ECHOPAIR(", ey=", endpoint[Y_AXIS]);
SERIAL_ECHOPAIR(", ez=", endpoint[Z_AXIS]);
SERIAL_ECHOPAIR(", len=", arc_length);
SERIAL_ECHOPAIR(") -> (ex=", current_position[X_AXIS]);
SERIAL_ECHOPAIR(", ey=", current_position[Y_AXIS]);
SERIAL_ECHOPAIR(", ez=", current_position[Z_AXIS]);
SERIAL_CHAR(')');
SERIAL_EOL();
}
plan_arc(endpoint, arc_offset, false); // Draw a counter-clockwise arc
feedrate_mm_s = save_feedrate;
set_destination_from_current();
@@ -898,16 +857,13 @@ void GcodeSuite::G26() {
retract_filament(destination);
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
//debug_current_and_destination(PSTR("ready to do Z-Raise."));
move_to(destination, 0); // Raise the nozzle
//debug_current_and_destination(PSTR("done doing Z-Raise."));
destination[X_AXIS] = g26_x_pos; // Move back to the starting position
destination[Y_AXIS] = g26_y_pos;
//destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is
move_to(destination, 0); // Move back to the starting position
//debug_current_and_destination(PSTR("done doing X/Y move."));
#if DISABLED(NO_VOLUMETRICS)
parser.volumetric_enabled = volumetric_was_enabled;
+2 -3
View File
@@ -406,14 +406,13 @@ void GcodeSuite::G28(const bool always_home_all) {
#ifdef HOMING_BACKOFF_MM
endstops.enable(false);
constexpr float backoff[XYZ] = HOMING_BACKOFF_MM;
constexpr float endstop_backoff[XYZ] = HOMING_BACKOFF_MM;
const float backoff_x = doX ? ABS(endstop_backoff[X_AXIS]) * (X_HOME_DIR) : 0,
backoff_y = doY ? ABS(endstop_backoff[Y_AXIS]) * (Y_HOME_DIR) : 0,
backoff_z = doZ ? ABS(endstop_backoff[Z_AXIS]) * (Z_HOME_DIR) : 0;
if (backoff_z) do_blocking_move_to_z(current_position[Z_AXIS] - backoff_z);
if (backoff_x || backoff_y) do_blocking_move_to_xy(current_position[X_AXIS] - backoff_x, current_position[Y_AXIS] - backoff_y);
#endif
endstops.not_homing();
#if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)
@@ -429,7 +428,7 @@ void GcodeSuite::G28(const bool always_home_all) {
// Restore the active tool after homing
#if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
#if ENABLED(PARKING_EXTRUDER) || ENABLED(DUAL_X_CARRIAGE)
#if EITHER(PARKING_EXTRUDER, DUAL_X_CARRIAGE)
#define NO_FETCH false // fetch the previous toolhead
#else
#define NO_FETCH true
+1 -1
View File
@@ -30,7 +30,7 @@
void M217_report(const bool eeprom=false) {
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Singlenozzle:"));
serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed));
SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed));
+8 -8
View File
@@ -47,13 +47,13 @@ inline void toggle_pins() {
for (uint8_t i = start; i <= end; i++) {
pin_t pin = GET_PIN_MAP_PIN(i);
//report_pin_state_extended(pin, ignore_protection, false);
if (!VALID_PIN(pin)) continue;
if (!ignore_protection && pin_is_protected(pin)) {
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) {
report_pin_state_extended(pin, ignore_protection, true, "Untouched ");
SERIAL_EOL();
}
else {
watchdog_reset();
report_pin_state_extended(pin, ignore_protection, true, "Pulsing ");
#if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
if (pin == TEENSY_E2) {
@@ -77,12 +77,12 @@ inline void toggle_pins() {
{
pinMode(pin, OUTPUT);
for (int16_t j = 0; j < repeat; j++) {
extDigitalWrite(pin, 0); safe_delay(wait);
extDigitalWrite(pin, 1); safe_delay(wait);
extDigitalWrite(pin, 0); safe_delay(wait);
watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait);
watchdog_reset(); extDigitalWrite(pin, 1); safe_delay(wait);
watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait);
watchdog_reset();
}
}
}
SERIAL_EOL();
}
@@ -277,7 +277,7 @@ void GcodeSuite::M43() {
for (uint8_t i = first_pin; i <= last_pin; i++) {
pin_t pin = GET_PIN_MAP_PIN(i);
if (!VALID_PIN(pin)) continue;
if (!ignore_protection && pin_is_protected(pin)) continue;
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
pinMode(pin, INPUT_PULLUP);
delay(1);
/*
@@ -300,7 +300,7 @@ void GcodeSuite::M43() {
for (uint8_t i = first_pin; i <= last_pin; i++) {
pin_t pin = GET_PIN_MAP_PIN(i);
if (!VALID_PIN(pin)) continue;
if (!ignore_protection && pin_is_protected(pin)) continue;
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
const byte val =
/*
IS_ANALOG(pin)
+6 -6
View File
@@ -53,7 +53,7 @@ uint8_t spindle_laser_power; // = 0
* NOTE: A minimum PWM frequency of 50 Hz is needed. All prescaler
* factors for timers 2, 3, 4, and 5 are acceptable.
*
* SPINDLE_LASER_ENABLE_PIN needs an external pullup or it may power on
* SPINDLE_LASER_ENA_PIN needs an external pullup or it may power on
* the spindle/laser during power-up or when connecting to the host
* (usually goes through a reset which sets all I/O pins to tri-state)
*
@@ -73,7 +73,7 @@ inline void delay_for_power_down() { safe_delay(SPINDLE_LASER_POWERDOWN_DELAY);
*/
inline void set_spindle_laser_ocr(const uint8_t ocr) {
WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low)
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low)
analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr);
}
@@ -81,7 +81,7 @@ inline void set_spindle_laser_ocr(const uint8_t ocr) {
void update_spindle_laser_power() {
if (spindle_laser_power == 0) {
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low)
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low)
analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // only write low byte
delay_for_power_down();
}
@@ -101,7 +101,7 @@ inline void set_spindle_laser_ocr(const uint8_t ocr) {
#endif // SPINDLE_LASER_PWM
bool spindle_laser_enabled() {
return !!spindle_laser_power; // READ(SPINDLE_LASER_ENABLE_PIN) == SPINDLE_LASER_ENABLE_INVERT;
return !!spindle_laser_power; // READ(SPINDLE_LASER_ENA_PIN) == SPINDLE_LASER_ENABLE_INVERT;
}
void set_spindle_laser_enabled(const bool enable) {
@@ -111,11 +111,11 @@ void set_spindle_laser_enabled(const bool enable) {
update_spindle_laser_power();
#else
if (enable) {
WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT);
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT);
delay_for_power_up();
}
else {
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT);
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT);
delay_for_power_down();
}
#endif
+2 -2
View File
@@ -42,10 +42,10 @@
*
* M605 S0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages.
*
*
* M605 S1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so that
* additional slicer support is not required.
*
*
* M605 S2 X R : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
+1 -1
View File
@@ -55,7 +55,7 @@ void GcodeSuite::T(const uint8_t tool_index) {
#if ENABLED(PRUSA_MMU2)
if (parser.string_arg) {
mmu2.toolChange(parser.string_arg); // Special commands T?/Tx/Tc
mmu2.tool_change(parser.string_arg); // Special commands T?/Tx/Tc
return;
}
#endif
+1 -1
View File
@@ -84,7 +84,7 @@ void GcodeSuite::M701() {
// Load filament
#if ENABLED(PRUSA_MMU2)
mmu2.loadFilamentToNozzle(target_extruder);
mmu2.load_filament_to_nozzle(target_extruder);
#else
constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS)
+13 -13
View File
@@ -29,17 +29,20 @@
#include "../../../module/motion.h"
#include "../../../lcd/ultralcd.h"
#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
#include "../../../core/debug_out.h"
void menu_job_recovery();
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
inline void plr_error(PGM_P const prefix) {
SERIAL_ECHO_START();
inline void plr_error(PGM_P const prefix) {
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
DEBUG_ECHO_START();
serialprintPGM(prefix);
SERIAL_ECHOLNPGM(" Power-Loss Recovery Data");
}
#endif
DEBUG_ECHOLNPGM(" Power-Loss Recovery Data");
#else
UNUSED(prefix);
#endif
}
/**
* M1000: Resume from power-loss (undocumented)
@@ -54,11 +57,8 @@ void GcodeSuite::M1000() {
else
recovery.resume();
}
else {
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
#endif
}
else
plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
}
+1 -1
View File
@@ -41,7 +41,7 @@ void GcodeSuite::M403() {
type = parser.intval('F', -1);
if (WITHIN(index, 0, 4) && WITHIN(type, 0, 2))
mmu2.setFilamentType(index, type);
mmu2.set_filament_type(index, type);
else
SERIAL_ECHO_MSG("M403 - bad arguments.");
}
+10 -4
View File
@@ -269,6 +269,16 @@ void GcodeSuite::process_parsed_command(
break;
#endif
#if ENABLED(CNC_COORDINATE_SYSTEMS)
case 53: G53(); break;
case 54: G54(); break;
case 55: G55(); break;
case 56: G56(); break;
case 57: G57(); break;
case 58: G58(); break;
case 59: G59(); break;
#endif
#if ENABLED(GCODE_MOTION_MODES)
case 80: G80(); break; // G80: Reset the current motion mode
#endif
@@ -348,10 +358,6 @@ void GcodeSuite::process_parsed_command(
case 48: M48(); break; // M48: Z probe repeatability test
#endif
#if ENABLED(G26_MESH_VALIDATION)
case 49: M49(); break; // M49: Turn on or off G26 debug flag for verbose output
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
case 73: M73(); break; // M73: Set progress percentage (for display on LCD)
#endif
-4
View File
@@ -495,10 +495,6 @@ private:
static void M48();
#endif
#if ENABLED(G26_MESH_VALIDATION)
static void M49();
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
static void M73();
#endif
+1 -1
View File
@@ -59,7 +59,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) {
*
* Marlin also uses G53 on a line by itself to go back to native space.
*/
inline void GcodeSuite::G53() {
void GcodeSuite::G53() {
const int8_t _system = active_coordinate_system;
active_coordinate_system = -1;
if (parser.chain()) { // If this command has more following...
+4 -3
View File
@@ -25,6 +25,7 @@
#if ENABLED(BABYSTEPPING)
#include "../gcode.h"
#include "../../feature/babystep.h"
#include "../../module/probe.h"
#include "../../module/temperature.h"
#include "../../module/planner.h"
@@ -49,7 +50,7 @@
else {
hotend_offset[Z_AXIS][active_extruder] -= offs;
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(MSG_IDEX_Z_OFFSET ": ", hotend_offset[Z_AXIS][active_extruder]);
SERIAL_ECHOLNPAIR(MSG_Z_OFFSET ": ", hotend_offset[Z_AXIS][active_extruder]);
}
#endif
}
@@ -64,7 +65,7 @@ void GcodeSuite::M290() {
for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
thermalManager.babystep_axis((AxisEnum)a, offs * planner.settings.axis_steps_per_mm[a]);
babystep.add_mm((AxisEnum)a, offs);
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
if (a == Z_AXIS && (!parser.seen('P') || parser.value_bool())) mod_zprobe_zoffset(offs);
#endif
@@ -72,7 +73,7 @@ void GcodeSuite::M290() {
#else
if (parser.seenval('Z') || parser.seenval('S')) {
const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
thermalManager.babystep_axis(Z_AXIS, offs * planner.settings.axis_steps_per_mm[Z_AXIS]);
babystep.add_mm(Z_AXIS, offs);
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
if (!parser.seen('P') || parser.value_bool()) mod_zprobe_zoffset(offs);
#endif
+27 -25
View File
@@ -87,8 +87,8 @@
#define U8GLIB_LM6059_AF
#define SD_DETECT_INVERTED
#elif ENABLED(AZSMZ_12864)
#define LCD_CONTRAST_MIN 120
#define LCD_CONTRAST_MAX 255
#define LCD_CONTRAST_MIN 120
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 190
#define U8GLIB_ST7565_64128N
#endif
@@ -139,6 +139,13 @@
#define MINIPANEL
#elif ENABLED(FYSETC_MINI_12864)
#define DOGLCD
#define ULTIPANEL
#define DEFAULT_LCD_CONTRAST 255
#define LED_COLORS_REDUCE_GREEN
#endif
#if EITHER(MAKRPANEL, MINIPANEL)
@@ -313,28 +320,19 @@
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
#if HAS_GRAPHICAL_LCD
/**
* Default LCD contrast for Graphical LCD displays
*/
#define HAS_LCD_CONTRAST ( \
ENABLED(MAKRPANEL) \
|| ENABLED(CARTESIO_UI) \
|| ENABLED(VIKI2) \
|| ENABLED(AZSMZ_12864) \
|| ENABLED(miniVIKI) \
|| ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \
)
#if HAS_LCD_CONTRAST
#ifndef LCD_CONTRAST_MIN
#define LCD_CONTRAST_MIN 0
#endif
#ifndef LCD_CONTRAST_MAX
#define LCD_CONTRAST_MAX 63
#endif
#ifndef DEFAULT_LCD_CONTRAST
#define DEFAULT_LCD_CONTRAST 32
#endif
/**
* Default LCD contrast for Graphical LCD displays
*/
#define HAS_LCD_CONTRAST HAS_GRAPHICAL_LCD && defined(DEFAULT_LCD_CONTRAST)
#if HAS_LCD_CONTRAST
#ifndef LCD_CONTRAST_MIN
#define LCD_CONTRAST_MIN 0
#endif
#ifndef LCD_CONTRAST_MAX
#define LCD_CONTRAST_MAX 63
#endif
#ifndef DEFAULT_LCD_CONTRAST
#define DEFAULT_LCD_CONTRAST 32
#endif
#endif
@@ -427,7 +425,7 @@
*/
#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
#define XYZE_N (XYZ + E_STEPPERS)
#define E_AXIS_N(E) (E_AXIS + E)
#define E_AXIS_N(E) AxisEnum(E_AXIS + E)
#else
#undef DISTINCT_E_FACTORS
#define XYZE_N XYZE
@@ -558,3 +556,7 @@
#endif
#endif
#endif
#if ENABLED(SLIM_LCD_MENUS)
#define BOOT_MARLIN_LOGO_SMALL
#endif
+1 -4
View File
@@ -873,9 +873,6 @@
#define TMC_HAS_SPI (HAS_TMCX1X0 || HAS_DRIVER(TMC2660))
#define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2660))
#define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_DRIVER(TMC2208))
#define AXIS_HAS_SPI(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2660))
#define AXIS_HAS_STALLGUARD(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160))
#define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160))
#define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
#define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
@@ -1679,7 +1676,7 @@
// Get LCD character width/height, which may be overridden by pins, configs, etc.
#ifndef LCD_WIDTH
#if HAS_GRAPHICAL_LCD
#define LCD_WIDTH 22
#define LCD_WIDTH 21
#elif ENABLED(ULTIPANEL)
#define LCD_WIDTH 20
#elif HAS_SPI_LCD
+3
View File
@@ -341,6 +341,8 @@
#error "MAX6675_SS is now MAX6675_SS_PIN. Please update your configuration and/or pins."
#elif defined(MAX6675_SS2)
#error "MAX6675_SS2 is now MAX6675_SS2_PIN. Please update your configuration and/or pins."
#elif defined(SPINDLE_LASER_ENABLE_PIN)
#error "SPINDLE_LASER_ENABLE_PIN is now SPINDLE_LASER_ENA_PIN. Please update your configuration and/or pins."
#elif defined(TMC_Z_CALIBRATION)
#error "TMC_Z_CALIBRATION has been deprecated in favor of Z_STEPPER_AUTO_ALIGN. Please update your configuration."
#elif defined(Z_MIN_PROBE_ENDSTOP)
@@ -1762,6 +1764,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
+ ENABLED(G3D_PANEL) \
+ (ENABLED(MINIPANEL) && DISABLED(MKS_MINI_12864)) \
+ ENABLED(MKS_MINI_12864) \
+ ENABLED(FYSETC_MINI_12864) \
+ (ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(CARTESIO_UI, ZONESTAR_LCD)) \
+ ENABLED(RIGIDBOT_PANEL) \
+ ENABLED(RA_CONTROL_PANEL) \
+11 -1
View File
@@ -1025,7 +1025,7 @@ void MarlinUI::draw_status_screen() {
}
void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) {
lcd_moveto(1, 1);
lcd_moveto(0, 1);
lcd_put_u8str_P(pstr);
if (value != NULL) {
lcd_put_wchar(':');
@@ -1037,6 +1037,16 @@ void MarlinUI::draw_status_screen() {
}
}
void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
SETCURSOR(0, 0); lcd_put_u8str_P(pref);
if (string) wrap_string(1, string);
if (suff) lcd_put_u8str_P(suff);
SETCURSOR(0, LCD_HEIGHT - 1);
lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']');
SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1);
lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd_put_wchar(yesno ? ']' : ' ');
}
#if ENABLED(SDSUPPORT)
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
+27 -29
View File
@@ -29,8 +29,6 @@
#include "../../inc/MarlinConfig.h"
//#define START_BMPHIGH // Costs 399 bytes more flash
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
#include "../../../_Bootscreen.h"
@@ -44,7 +42,33 @@
#endif
#if ENABLED(START_BMPHIGH)
#if ENABLED(BOOT_MARLIN_LOGO_SMALL)
#define START_BMPWIDTH 56
const unsigned char start_bmp[] PROGMEM = {
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111,
B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111,
B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111,
B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B11100111,
B10001100,B00110000,B11001111,B11000111,B11001100,B00110001,B11110011,
B10001100,B00110000,B11011100,B11101100,B11101100,B00110011,B10111001,
B10001100,B00110000,B11011000,B01101100,B01101100,B00110011,B00011001,
B10001100,B00110000,B11010000,B01101100,B00001100,B00110011,B00011001,
B10001100,B00110000,B11011000,B01101100,B00001100,B00110011,B00011001,
B10001100,B00110000,B11011100,B01101100,B00001110,B00111011,B00011001,
B10001100,B00110000,B11001111,B01111100,B00000111,B10011111,B00011001,
B10001100,B00110000,B11000111,B01111100,B00000011,B10001111,B00011001,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
#else
#define START_BMPWIDTH 112
@@ -89,32 +113,6 @@
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
};
#else
#define START_BMPWIDTH 56
const unsigned char start_bmp[] PROGMEM = {
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111,
B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111,
B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111,
B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B11100111,
B10001100,B00110000,B11001111,B11000111,B11001100,B00110001,B11110011,
B10001100,B00110000,B11011100,B11101100,B11101100,B00110011,B10111001,
B10001100,B00110000,B11011000,B01101100,B01101100,B00110011,B00011001,
B10001100,B00110000,B11010000,B01101100,B00001100,B00110011,B00011001,
B10001100,B00110000,B11011000,B01101100,B00001100,B00110011,B00011001,
B10001100,B00110000,B11011100,B01101100,B00001110,B00111011,B00011001,
B10001100,B00110000,B11001111,B01111100,B00000111,B10011111,B00011001,
B10001100,B00110000,B11000111,B01111100,B00000011,B10001111,B00011001,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
#endif
#ifndef START_BMP_BYTEWIDTH
+1 -1
View File
@@ -97,7 +97,7 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default,
* @param utf8_msg : the UTF-8 string
* @param cb_read_byte : how to read the utf8_msg, from RAM or ROM (call read_byte_ram or pgm_read_byte)
* @param userdata : User's data
* @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actural it is to draw a one byte string in RAM)
* @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actually it is to draw a one byte string in RAM)
*
* @return N/A
*
+61 -16
View File
@@ -154,29 +154,53 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
lcd_custom_bootscreen();
#endif
constexpr uint8_t offy =
#if ENABLED(START_BMPHIGH)
(LCD_PIXEL_HEIGHT - (START_BMPHEIGHT)) / 2
#else
MENU_FONT_HEIGHT
#endif
;
// Screen dimensions.
//const uint8_t width = u8g.getWidth(), height = u8g.getHeight();
constexpr uint8_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT;
const uint8_t width = u8g.getWidth(), height = u8g.getHeight(),
offx = (width - (START_BMPWIDTH)) / 2;
// Determine text space needed
#ifndef STRING_SPLASH_LINE2
constexpr uint8_t text_total_height = MENU_FONT_HEIGHT,
text_width_1 = (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH),
text_width_2 = 0;
#else
constexpr uint8_t text_total_height = (MENU_FONT_HEIGHT) * 2,
text_width_1 = (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH),
text_width_2 = (sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH);
#endif
constexpr uint8_t text_max_width = MAX(text_width_1, text_width_2),
rspace = width - (START_BMPWIDTH);
int8_t offx, offy, txt_base, txt_offx_1, txt_offx_2;
// Can the text fit to the right of the bitmap?
if (text_max_width < rspace) {
constexpr uint8_t inter = (width - text_max_width - (START_BMPWIDTH)) / 3; // Evenly distribute horizontal space
offx = inter; // First the boot logo...
offy = (height - (START_BMPHEIGHT)) / 2; // ...V-aligned in the full height
txt_offx_1 = txt_offx_2 = inter + (START_BMPWIDTH) + inter; // Text right of the bitmap
txt_base = (height + MENU_FONT_ASCENT + text_total_height - (MENU_FONT_HEIGHT)) / 2; // Text vertical center
}
else {
constexpr uint8_t inter = (height - text_total_height - (START_BMPHEIGHT)) / 3; // Evenly distribute vertical space
offy = inter; // V-align boot logo proportionally
offx = rspace / 2; // Center the boot logo in the whole space
txt_offx_1 = (width - text_width_1) / 2; // Text 1 centered
txt_offx_2 = (width - text_width_2) / 2; // Text 2 centered
txt_base = offy + START_BMPHEIGHT + offy + text_total_height - (MENU_FONT_DESCENT); // Even spacing looks best
}
NOLESS(offx, 0);
NOLESS(offy, 0);
u8g.firstPage();
do {
u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp);
set_font(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
const uint8_t txt1X = width - (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH);
u8g.drawStr(txt1X, (height + MENU_FONT_HEIGHT) / 2, STRING_SPLASH_LINE1);
u8g.drawStr(txt_offx_1, txt_base, STRING_SPLASH_LINE1);
#else
const uint8_t txt1X = (width - (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH)) / 2,
txt2X = (width - (sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH)) / 2;
u8g.drawStr(txt1X, height - (MENU_FONT_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
u8g.drawStr(txt2X, height - (MENU_FONT_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
u8g.drawStr(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), STRING_SPLASH_LINE1);
u8g.drawStr(txt_offx_2, txt_base, STRING_SPLASH_LINE2);
#endif
} while (u8g.nextPage());
#ifndef BOOTSCREEN_TIMEOUT
@@ -389,7 +413,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
if (value != NULL) {
lcd_put_wchar(':');
if (extra_row) {
// Assume the value is numeric (with no descender)
// Assume that value is numeric (with no descender)
baseline += EDIT_FONT_ASCENT + 2;
onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
}
@@ -401,6 +425,27 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}
}
inline void draw_boxed_string(const uint8_t x, const uint8_t y, PGM_P const pstr, const bool inv) {
const uint8_t len = utf8_strlen_P(pstr), bw = len * (MENU_FONT_WIDTH),
bx = x * (MENU_FONT_WIDTH), by = (y + 1) * (MENU_FONT_HEIGHT);
if (inv) {
u8g.setColorIndex(1);
u8g.drawBox(bx - 1, by - (MENU_FONT_ASCENT) + 1, bw + 2, MENU_FONT_HEIGHT - 1);
u8g.setColorIndex(0);
}
lcd_moveto(bx, by);
lcd_put_u8str_P(pstr);
if (inv) u8g.setColorIndex(1);
}
void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
SETCURSOR(0, 0); lcd_put_u8str_P(pref);
if (string) wrap_string(1, string);
if (suff) lcd_put_u8str_P(suff);
draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) + 1), LCD_HEIGHT - 1, yes, yesno);
}
#if ENABLED(SDSUPPORT)
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
+1 -1
View File
@@ -107,7 +107,7 @@
// Generic support for SSD1309 OLED I2C LCDs
#define U8G_CLASS U8GLIB_SSD1309_128X64
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
#elif ENABLED(MINIPANEL)
#elif EITHER(MINIPANEL, FYSETC_MINI_12864)
// The MINIPanel display
//#define U8G_CLASS U8GLIB_MINI12864
//#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
+7 -3
View File
@@ -97,6 +97,10 @@
#include "../../feature/runout.h"
#endif
#if ENABLED(BABYSTEPPING)
#include "../../feature/babystep.h"
#endif
inline float clamp(const float value, const float minimum, const float maximum) {
return MAX(MIN(value, maximum), minimum);
}
@@ -584,10 +588,10 @@ namespace ExtUI {
bool babystepAxis_steps(const int16_t steps, const axis_t axis) {
switch (axis) {
#if ENABLED(BABYSTEP_XY)
case X: thermalManager.babystep_axis(X_AXIS, steps); break;
case Y: thermalManager.babystep_axis(Y_AXIS, steps); break;
case X: babystep.add_steps(X_AXIS, steps); break;
case Y: babystep.add_steps(Y_AXIS, steps); break;
#endif
case Z: thermalManager.babystep_axis(Z_AXIS, steps); break;
case Z: babystep.add_steps(Z_AXIS, steps); break;
default: return false;
};
return true;
+1 -1
View File
@@ -105,7 +105,7 @@ namespace ExtUI {
float getFeedrate_percent();
uint8_t getProgress_percent();
uint32_t getProgress_seconds_elapsed();
#if HAS_LEVELING
bool getLevelingActive();
void setLevelingActive(const bool);
+2 -2
View File
@@ -10,8 +10,8 @@
#include "../inc/MarlinConfig.h"
#if ENABLED(ULTRA_LCD)
#include "ultralcd.h"
#include "../Marlin.h"
#include "ultralcd.h"
#include "../Marlin.h"
#endif
#include "fontutils.h"
+3 -4
View File
@@ -101,10 +101,9 @@
#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplizieren")
#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Spiegelkopie")
#define MSG_IDEX_MODE_FULL_CTRL _UxGT("vollstä. Kontrolle")
#define MSG_IDEX_X_OFFSET _UxGT("2. Düse X")
#define MSG_IDEX_Y_OFFSET _UxGT("2. Düse Y")
#define MSG_IDEX_Z_OFFSET _UxGT("2. Düse Z")
#define MSG_IDEX_SAVE_OFFSETS _UxGT("Versätze speichern")
#define MSG_X_OFFSET _UxGT("2. Düse X")
#define MSG_Y_OFFSET _UxGT("2. Düse Y")
#define MSG_Z_OFFSET _UxGT("2. Düse Z")
#define MSG_UBL_MANUAL_MESH _UxGT("Netz manuell erst.")
#define MSG_UBL_BC_INSERT _UxGT("Unterlegen & messen")
#define MSG_UBL_BC_INSERT2 _UxGT("Messen")
+27 -9
View File
@@ -52,6 +52,12 @@
#ifndef WELCOME_MSG
#define WELCOME_MSG MACHINE_NAME _UxGT(" Ready.")
#endif
#ifndef MSG_YES
#define MSG_YES _UxGT("YES")
#endif
#ifndef MSG_NO
#define MSG_NO _UxGT("NO")
#endif
#ifndef MSG_BACK
#define MSG_BACK _UxGT("Back")
#endif
@@ -241,6 +247,9 @@
#ifndef MSG_IDEX_MENU
#define MSG_IDEX_MENU _UxGT("IDEX Mode")
#endif
#ifndef MSG_OFFSETS_MENU
#define MSG_OFFSETS_MENU _UxGT("Tool Offsets")
#endif
#ifndef MSG_IDEX_MODE_AUTOPARK
#define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park")
#endif
@@ -253,17 +262,14 @@
#ifndef MSG_IDEX_MODE_FULL_CTRL
#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Full control")
#endif
#ifndef MSG_IDEX_X_OFFSET
#define MSG_IDEX_X_OFFSET _UxGT("2nd nozzle X")
#ifndef MSG_X_OFFSET
#define MSG_X_OFFSET _UxGT("2nd nozzle X")
#endif
#ifndef MSG_IDEX_Y_OFFSET
#define MSG_IDEX_Y_OFFSET _UxGT("2nd nozzle Y")
#ifndef MSG_Y_OFFSET
#define MSG_Y_OFFSET _UxGT("2nd nozzle Y")
#endif
#ifndef MSG_IDEX_Z_OFFSET
#define MSG_IDEX_Z_OFFSET _UxGT("2nd nozzle Z")
#endif
#ifndef MSG_IDEX_SAVE_OFFSETS
#define MSG_IDEX_SAVE_OFFSETS _UxGT("Save Offsets")
#ifndef MSG_Z_OFFSET
#define MSG_Z_OFFSET _UxGT("2nd nozzle Z")
#endif
#ifndef MSG_UBL_MANUAL_MESH
#define MSG_UBL_MANUAL_MESH _UxGT("Manually Build Mesh")
@@ -744,6 +750,15 @@
#ifndef MSG_TUNE
#define MSG_TUNE _UxGT("Tune")
#endif
#ifndef MSG_START_PRINT
#define MSG_START_PRINT _UxGT("Start print")
#endif
#ifndef MSG_BUTTON_PRINT
#define MSG_BUTTON_PRINT _UxGT("Print")
#endif
#ifndef MSG_BUTTON_CANCEL
#define MSG_BUTTON_CANCEL _UxGT("Cancel")
#endif
#ifndef MSG_PAUSE_PRINT
#define MSG_PAUSE_PRINT _UxGT("Pause print")
#endif
@@ -903,6 +918,9 @@
#ifndef MSG_BABYSTEP_Z
#define MSG_BABYSTEP_Z _UxGT("Babystep Z")
#endif
#ifndef MSG_BABYSTEP_TOTAL
#define MSG_BABYSTEP_TOTAL _UxGT("Total")
#endif
#ifndef MSG_ENDSTOP_ABORT
#define MSG_ENDSTOP_ABORT _UxGT("Endstop abort")
#endif
+18 -4
View File
@@ -32,6 +32,8 @@
#define DISPLAY_CHARSET_ISO10646_1
#define WELCOME_MSG MACHINE_NAME _UxGT(" pronto.")
#define MSG_YES _UxGT("SI")
#define MSG_NO _UxGT("NO")
#define MSG_BACK _UxGT("Indietro")
#define MSG_SD_INSERTED _UxGT("SD Card inserita")
#define MSG_SD_REMOVED _UxGT("SD Card rimossa")
@@ -95,14 +97,14 @@
#define MSG_UBL_TOOLS _UxGT("Strumenti UBL")
#define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling")
#define MSG_IDEX_MENU _UxGT("Modo IDEX")
#define MSG_OFFSETS_MENU _UxGT("Strumenti Offsets")
#define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park")
#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicazione")
#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Copia speculare")
#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Pieno controllo")
#define MSG_IDEX_X_OFFSET _UxGT("2° ugello X")
#define MSG_IDEX_Y_OFFSET _UxGT("2° ugello Y")
#define MSG_IDEX_Z_OFFSET _UxGT("2° ugello Z")
#define MSG_IDEX_SAVE_OFFSETS _UxGT("Memorizza Offsets")
#define MSG_X_OFFSET _UxGT("2° ugello X")
#define MSG_Y_OFFSET _UxGT("2° ugello Y")
#define MSG_Z_OFFSET _UxGT("2° ugello Z")
#define MSG_UBL_MANUAL_MESH _UxGT("Mesh Manuale")
#define MSG_UBL_BC_INSERT _UxGT("Metti spes. e misura")
#define MSG_UBL_BC_INSERT2 _UxGT("Misura")
@@ -268,6 +270,9 @@
#define MSG_WATCH _UxGT("Schermata info")
#define MSG_PREPARE _UxGT("Prepara")
#define MSG_TUNE _UxGT("Regola")
#define MSG_START_PRINT _UxGT("Avvia stampa")
#define MSG_BUTTON_PRINT _UxGT("Stampa")
#define MSG_BUTTON_CANCEL _UxGT("Annulla")
#define MSG_PAUSE_PRINT _UxGT("Pausa stampa")
#define MSG_RESUME_PRINT _UxGT("Riprendi stampa")
#define MSG_STOP_PRINT _UxGT("Arresta stampa")
@@ -321,6 +326,7 @@
#define MSG_BABYSTEP_X _UxGT("Babystep X")
#define MSG_BABYSTEP_Y _UxGT("Babystep Y")
#define MSG_BABYSTEP_Z _UxGT("Babystep Z")
#define MSG_BABYSTEP_TOTAL _UxGT("Totali")
#define MSG_ENDSTOP_ABORT _UxGT("Finecorsa annullati")
#define MSG_HEATING_FAILED_LCD _UxGT("Riscald. Fallito")
#define MSG_HEATING_FAILED_LCD_BED _UxGT("Risc. piatto fallito")
@@ -449,6 +455,10 @@
#define MSG_VTOOLS_RESET _UxGT("V-tools ripristin.")
#define MSG_START_Z _UxGT("Z inizio")
#define MSG_END_Z _UxGT("Z fine")
#define MSG_BRICKOUT _UxGT("Brickout")
#define MSG_INVADERS _UxGT("Invaders")
#define MSG_SNAKE _UxGT("Sn4k3")
#define MSG_MAZE _UxGT("Maze")
//
// Le schermate di Cambio Filamento possono visualizzare fino a 3 linee su un display a 4 righe
@@ -505,3 +515,7 @@
#define MSG_SERVICE_RESET _UxGT("Resetta")
#define MSG_SERVICE_IN _UxGT(" tra:")
#define MSG_BACKLASH _UxGT("Gioco")
#define MSG_BACKLASH_CORRECTION _UxGT("Correzione")
#define MSG_BACKLASH_SMOOTHING _UxGT("Smoothing")
+3 -4
View File
@@ -90,10 +90,9 @@
#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplication")
#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("미러 사본")
#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Full control")
#define MSG_IDEX_X_OFFSET _UxGT("2nd nozzle X")
#define MSG_IDEX_Y_OFFSET _UxGT("2nd nozzle Y")
#define MSG_IDEX_Z_OFFSET _UxGT("2nd nozzle Z")
#define MSG_IDEX_SAVE_OFFSETS _UxGT("Save Offsets")
#define MSG_X_OFFSET _UxGT("2nd nozzle X")
#define MSG_Y_OFFSET _UxGT("2nd nozzle Y")
#define MSG_Z_OFFSET _UxGT("2nd nozzle Z")
#define MSG_UBL_MANUAL_MESH _UxGT("Manually Build Mesh")
#define MSG_UBL_BC_INSERT _UxGT("Place shim & measure")
#define MSG_UBL_BC_INSERT2 _UxGT("Measure")
+3 -4
View File
@@ -101,10 +101,9 @@
#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicação")
#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Cópia espelhada")
#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Controle Total")
#define MSG_IDEX_X_OFFSET _UxGT("2o bico X")
#define MSG_IDEX_Y_OFFSET _UxGT("2o bico Y")
#define MSG_IDEX_Z_OFFSET _UxGT("2o bico Z")
#define MSG_IDEX_SAVE_OFFSETS _UxGT("Salvar Compensação")
#define MSG_X_OFFSET _UxGT("2o bico X")
#define MSG_Y_OFFSET _UxGT("2o bico Y")
#define MSG_Z_OFFSET _UxGT("2o bico Z")
#define MSG_UBL_MANUAL_MESH _UxGT("Fazer malha manual")
#define MSG_UBL_BC_INSERT _UxGT("Calçar e calibrar")
+3 -4
View File
@@ -108,10 +108,9 @@
#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplikácia")
#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Zrkadlená kópia")
#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Plná kontrola")
#define MSG_IDEX_X_OFFSET _UxGT("2. tryska X")
#define MSG_IDEX_Y_OFFSET _UxGT("2. tryska Y")
#define MSG_IDEX_Z_OFFSET _UxGT("2. tryska Z")
#define MSG_IDEX_SAVE_OFFSETS _UxGT("Uložiť offsety")
#define MSG_X_OFFSET _UxGT("2. tryska X")
#define MSG_Y_OFFSET _UxGT("2. tryska Y")
#define MSG_Z_OFFSET _UxGT("2. tryska Z")
#define MSG_UBL_MANUAL_MESH _UxGT("Manuálna sieť bodov")
#define MSG_UBL_BC_INSERT _UxGT("Položte a zmerajte")
#define MSG_UBL_BC_INSERT2 _UxGT("Zmerajte")
+3 -4
View File
@@ -100,10 +100,9 @@
#define MSG_IDEX_MODE_DUPLICATE _UxGT("Kopyala")
#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Yansıtılmış kopya")
#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Tam Kontrol")
#define MSG_IDEX_X_OFFSET _UxGT("2. nozul X")
#define MSG_IDEX_Y_OFFSET _UxGT("2. nozul Y")
#define MSG_IDEX_Z_OFFSET _UxGT("2. nozul Z")
#define MSG_IDEX_SAVE_OFFSETS _UxGT("Ofsetleri Kaydet")
#define MSG_X_OFFSET _UxGT("2. nozul X")
#define MSG_Y_OFFSET _UxGT("2. nozul Y")
#define MSG_Z_OFFSET _UxGT("2. nozul Z")
#define MSG_UBL_MANUAL_MESH _UxGT("Elle Mesh Oluştur")
#define MSG_UBL_BC_INSERT _UxGT("Altlık & Ölçü Ver")
#define MSG_UBL_BC_INSERT2 _UxGT("Ölçü")
+1 -2
View File
@@ -62,8 +62,7 @@ void MarlinGame::init_game(const uint8_t init_state, const screenFunc_t screen)
}
void MarlinGame::exit_game() {
ui.goto_previous_screen();
ui.defer_status_screen(false);
ui.goto_previous_screen_no_defer();
}
#endif // HAS_GAMES
+9 -7
View File
@@ -63,7 +63,7 @@ const unsigned char invader[3][2][16] PROGMEM = {
B01111111,B11110000,
B00011111,B11000000,
B00010000,B01000000,
B00100000,B00100000
B00100000,B00100000
}
}, {
{ B00001111,B00000000,
@@ -182,7 +182,7 @@ typedef struct { int8_t x, y, v; } laser_t;
uint8_t cannons_left;
int8_t cannon_x;
laser_t laser, expl, bullet[10];
laser_t explod, laser, bullet[10];
constexpr uint8_t inv_off[] = { 2, 1, 0 }, inv_wide[] = { 8, 11, 12 };
int8_t invaders_x, invaders_y, invaders_dir, leftmost, rightmost, botmost;
uint8_t invader_count, quit_count, bugs[INVADER_ROWS], shooters[(INVADER_ROWS) * (INVADER_COLS)];
@@ -236,7 +236,9 @@ inline void fire_cannon() {
}
inline void explode(const int8_t x, const int8_t y, const int8_t v=4) {
expl.x = x - (EXPL_W) / 2; expl.y = y; expl.v = v;
explod.x = x - (EXPL_W) / 2;
explod.y = y;
explod.v = v;
}
inline void kill_cannon(uint8_t &game_state, const uint8_t st) {
@@ -261,7 +263,7 @@ void InvadersGame::game_screen() {
if (ui.first_page) {
// Update Cannon Position
int32_t ep = (int32_t)ui.encoderPosition;
int16_t ep = int16_t(ui.encoderPosition);
ep = constrain(ep, 0, (LCD_PIXEL_WIDTH - (CANNON_W)) / (CANNON_VEL));
ui.encoderPosition = ep;
@@ -431,9 +433,9 @@ void InvadersGame::game_screen() {
}
// Draw explosion
if (expl.v && PAGE_CONTAINS(expl.y, expl.y + 7 - 1)) {
u8g.drawBitmapP(expl.x, expl.y, 2, 7, explosion);
--expl.v;
if (explod.v && PAGE_CONTAINS(explod.y, explod.y + 7 - 1)) {
u8g.drawBitmapP(explod.x, explod.y, 2, 7, explosion);
--explod.v;
}
// Blink GAME OVER when game is over
+24 -14
View File
@@ -37,7 +37,7 @@
#include "../../module/configuration_store.h"
#endif
#if WATCH_HOTENDS || WATCH_BED || ENABLED(BABYSTEP_ZPROBE_OFFSET)
#if WATCH_HOTENDS || WATCH_BED
#include "../../module/temperature.h"
#endif
@@ -59,18 +59,18 @@ int8_t encoderTopLine, encoderLine, screen_items;
typedef struct {
screenFunc_t menu_function;
uint32_t encoder_position;
uint8_t top_line, items;
int8_t top_line, items;
} menuPosition;
menuPosition screen_history[6];
uint8_t screen_history_depth = 0;
bool screen_changed;
// Value Editing
PGM_P editLabel;
void *editValue;
int32_t minEditValue, maxEditValue;
screenFunc_t callbackFunc;
bool liveEdit;
PGM_P MenuItemBase::editLabel;
void* MenuItemBase::editValue;
int16_t MenuItemBase::minEditValue, MenuItemBase::maxEditValue;
screenFunc_t MenuItemBase::callbackFunc;
bool MenuItemBase::liveEdit;
// Prevent recursion into screen handlers
bool no_reentry = false;
@@ -131,8 +131,8 @@ void MenuItem_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode);
*/
void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) {
ui.encoder_direction_normal();
if ((int32_t)ui.encoderPosition < 0) ui.encoderPosition = 0;
if ((int32_t)ui.encoderPosition > maxEditValue) ui.encoderPosition = maxEditValue;
if (int16_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
if (int16_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
if (ui.should_draw())
draw_edit_screen(editLabel, strfunc(ui.encoderPosition + minEditValue));
if (ui.lcd_clicked || (liveEdit && ui.should_draw())) {
@@ -142,7 +142,7 @@ void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) {
}
}
void MenuItemBase::init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint32_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) {
void MenuItemBase::init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) {
ui.save_previous_screen();
ui.refresh();
editLabel = el;
@@ -193,7 +193,7 @@ bool printer_busy() {
/**
* General function to go directly to a screen
*/
void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) {
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(ENABLE_LEVELING_FADE_HEIGHT)
@@ -352,6 +352,8 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
#include "../../feature/babystep.h"
void lcd_babystep_zoffset() {
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
ui.defer_status_screen();
@@ -362,7 +364,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
#endif
ui.encoder_direction_normal();
if (ui.encoderPosition) {
const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR);
const int16_t babystep_increment = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR);
ui.encoderPosition = 0;
const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
@@ -376,7 +378,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
;
if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
thermalManager.babystep_axis(Z_AXIS, babystep_increment);
babystep.add_steps(Z_AXIS, babystep_increment);
if (do_probe) zprobe_zoffset = new_offs;
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
@@ -389,7 +391,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
if (ui.should_draw()) {
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
if (!do_probe)
draw_edit_screen(PSTR(MSG_IDEX_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder]));
draw_edit_screen(PSTR(MSG_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder]));
else
#endif
draw_edit_screen(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset));
@@ -434,4 +436,12 @@ void _lcd_draw_homing() {
void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); }
#endif
void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
if (ui.encoderPosition) {
yesno = int16_t(ui.encoderPosition) > 0;
ui.encoderPosition = 0;
}
draw_select_screen(yes, no, yesno, pref, string, suff);
}
#endif // HAS_LCD_MENU
+19 -8
View File
@@ -43,7 +43,7 @@ bool printer_busy();
static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \
};
DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr_percent,1 ); // 100% right-justified
DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr4pct, 1 ); // 100% right-justified
DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1 ); // 123, -12 right-justified
DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified
DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified
@@ -64,6 +64,11 @@ DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 123
////////////////////////////////////////////
void draw_edit_screen(PGM_P const pstr, const char* const value=NULL);
void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff);
void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL);
inline void do_select_screen_yn(bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
do_select_screen(PSTR(MSG_YES), PSTR(MSG_NO), yesno, pref, string, suff);
}
void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char);
void draw_menu_item_static(const uint8_t row, PGM_P const pstr, const bool center=true, const bool invert=false, const char *valstr=NULL);
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm);
@@ -151,10 +156,16 @@ class MenuItem_function {
////////////////////////////////////////////
class MenuItemBase {
private:
static PGM_P editLabel;
static void *editValue;
static int16_t minEditValue, maxEditValue;
static screenFunc_t callbackFunc;
static bool liveEdit;
protected:
typedef char* (*strfunc_t)(const int32_t);
typedef void (*loadfunc_t)(void *, const int32_t);
static void init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint32_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le);
typedef char* (*strfunc_t)(const int16_t);
typedef void (*loadfunc_t)(void *, const int16_t);
static void init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le);
static void edit(strfunc_t, loadfunc_t);
};
@@ -164,12 +175,12 @@ class TMenuItem : MenuItemBase {
typedef typename NAME::type_t type_t;
static inline float unscale(const float value) { return value * (1.0f / NAME::scale); }
static inline float scale(const float value) { return value * NAME::scale; }
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
static char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
static void load(void *ptr, const int16_t value) { *((type_t*)ptr) = unscale(value); }
static char* to_string(const int16_t value) { return NAME::strfunc(unscale(value)); }
public:
static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=NULL, const bool live=false) {
const int32_t minv = scale(minValue);
init(pstr, ptr, minv, int32_t(scale(maxValue)) - minv, int32_t(scale(*ptr)) - minv, edit, callback, live);
const int16_t minv = scale(minValue);
init(pstr, ptr, minv, int16_t(scale(maxValue)) - minv, int16_t(scale(*ptr)) - minv, edit, callback, live);
}
static void edit() { MenuItemBase::edit(to_string, load); }
};
+1 -1
View File
@@ -120,7 +120,7 @@
// Encoder knob or keypad buttons adjust the Z position
//
if (ui.encoderPosition) {
const float z = current_position[Z_AXIS] + float((int32_t)ui.encoderPosition) * (MESH_EDIT_Z_STEP);
const float z = current_position[Z_AXIS] + float(int16_t(ui.encoderPosition)) * (MESH_EDIT_Z_STEP);
line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5f, (LCD_PROBE_Z_RANGE) * 0.5f));
ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
ui.encoderPosition = 0;
+28 -10
View File
@@ -119,19 +119,37 @@ static void lcd_factory_settings() {
#endif
#if ENABLED(DUAL_X_CARRIAGE)
#if HAS_HOTEND_OFFSET
#include "../../module/motion.h"
#include "../../gcode/queue.h"
void _recalc_IDEX_settings() {
if (active_extruder) { // For the 2nd extruder re-home so the next tool-change gets the new offsets.
void _recalc_offsets() {
if (active_extruder && all_axes_known()) { // For the 2nd extruder re-home so the next tool-change gets the new offsets.
enqueue_and_echo_commands_P(PSTR("G28")); // In future, we can babystep the 2nd extruder (if active), making homing unnecessary.
active_extruder = 0;
}
}
void menu_IDEX() {
void menu_tool_offsets() {
START_MENU();
MENU_BACK(MSG_MAIN);
#if ENABLED(DUAL_X_CARRIAGE)
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_offsets);
#else
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], -10.0, 10.0, _recalc_offsets);
#endif
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Y_OFFSET, &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_offsets);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Z_OFFSET, &hotend_offset[Z_AXIS][1], Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
#if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
#endif
END_MENU();
}
#endif
#if ENABLED(DUAL_X_CARRIAGE)
void menu_idex() {
START_MENU();
MENU_BACK(MSG_MAIN);
@@ -146,10 +164,6 @@ static void lcd_factory_settings() {
: PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200")
);
MENU_ITEM(gcode, MSG_IDEX_MODE_FULL_CTRL, PSTR("M605 S0\nG28 X"));
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_X_OFFSET , &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_IDEX_settings);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_Y_OFFSET , &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_IDEX_settings);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_Z_OFFSET , &hotend_offset[Z_AXIS][1], -10.0, 10.0, _recalc_IDEX_settings);
MENU_ITEM(gcode, MSG_IDEX_SAVE_OFFSETS, PSTR("M500"));
END_MENU();
}
@@ -287,8 +301,12 @@ void menu_configuration() {
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, menu_delta_calibrate);
#endif
#if HAS_HOTEND_OFFSET
MENU_ITEM(submenu, MSG_OFFSETS_MENU, menu_tool_offsets);
#endif
#if ENABLED(DUAL_X_CARRIAGE)
MENU_ITEM(submenu, MSG_IDEX_MENU, menu_IDEX);
MENU_ITEM(submenu, MSG_IDEX_MENU, menu_idex);
#endif
#if ENABLED(BLTOUCH)
+2 -5
View File
@@ -33,15 +33,12 @@
#include "../../gcode/queue.h"
#include "../../module/printcounter.h"
#include "../../module/stepper.h"
#include "../../sd/cardreader.h"
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../feature/power_loss_recovery.h"
#endif
#if ENABLED(SDSUPPORT)
#include "../../sd/cardreader.h"
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
#include "../../feature/host_actions.h"
#endif
@@ -146,7 +143,7 @@ void menu_main() {
START_MENU();
MENU_BACK(MSG_WATCH);
const bool busy = printer_busy()
const bool busy = IS_SD_PRINTING() || print_job_timer.isRunning()
#if ENABLED(SDSUPPORT)
, card_detected = card.isDetected()
, card_open = card_detected && card.isFileOpen()
+3 -3
View File
@@ -44,7 +44,7 @@
ui.encoder_direction_normal();
ENCODER_RATE_MULTIPLY(true);
if (ui.encoderPosition != 0) {
mixer.gradient.start_z += float((int)ui.encoderPosition) * 0.1;
mixer.gradient.start_z += float(int16_t(ui.encoderPosition)) * 0.1;
ui.encoderPosition = 0;
NOLESS(mixer.gradient.start_z, 0);
NOMORE(mixer.gradient.start_z, Z_MAX_POS);
@@ -69,7 +69,7 @@
ui.encoder_direction_normal();
ENCODER_RATE_MULTIPLY(true);
if (ui.encoderPosition != 0) {
mixer.gradient.end_z += float((int)ui.encoderPosition) * 0.1;
mixer.gradient.end_z += float(int16_t(ui.encoderPosition)) * 0.1;
ui.encoderPosition = 0;
NOLESS(mixer.gradient.end_z, 0);
NOMORE(mixer.gradient.end_z, Z_MAX_POS);
@@ -185,7 +185,7 @@ void lcd_mixer_mix_edit() {
#elif DUAL_MIXING_EXTRUDER
if (ui.encoderPosition != 0) {
mixer.mix[0] += (int)ui.encoderPosition;
mixer.mix[0] += int16_t(ui.encoderPosition);
ui.encoderPosition = 0;
if (mixer.mix[0] < 0) mixer.mix[0] += 101;
if (mixer.mix[0] > 100) mixer.mix[0] -= 101;
+59 -59
View File
@@ -35,60 +35,60 @@ bool mmuMenuWait;
// Load Filament
//
void _mmu2_loadFilamentToNozzle(uint8_t index) {
void _mmu2_load_filamentToNozzle(uint8_t index) {
ui.reset_status();
ui.return_to_status();
ui.status_printf_P(0, PSTR(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
if (mmu2.loadFilamentToNozzle(index)) ui.reset_status();
if (mmu2.load_filament_to_nozzle(index)) ui.reset_status();
}
inline void action_mmu2_loadFilamentToNozzle(const uint8_t tool) {
_mmu2_loadFilamentToNozzle(tool);
inline void action_mmu2_load_filament_to_nozzl_e(const uint8_t tool) {
_mmu2_load_filamentToNozzle(tool);
ui.return_to_status();
}
inline void action_mmu2_loadFilamentToNozzle0() { action_mmu2_loadFilamentToNozzle(0); }
inline void action_mmu2_loadFilamentToNozzle1() { action_mmu2_loadFilamentToNozzle(1); }
inline void action_mmu2_loadFilamentToNozzle2() { action_mmu2_loadFilamentToNozzle(2); }
inline void action_mmu2_loadFilamentToNozzle3() { action_mmu2_loadFilamentToNozzle(3); }
inline void action_mmu2_loadFilamentToNozzle4() { action_mmu2_loadFilamentToNozzle(4); }
inline void action_mmu2_load_filament_to_nozzle_0() { action_mmu2_load_filament_to_nozzl_e(0); }
inline void action_mmu2_load_filament_to_nozzle_1() { action_mmu2_load_filament_to_nozzl_e(1); }
inline void action_mmu2_load_filament_to_nozzle_2() { action_mmu2_load_filament_to_nozzl_e(2); }
inline void action_mmu2_load_filament_to_nozzle_3() { action_mmu2_load_filament_to_nozzl_e(3); }
inline void action_mmu2_load_filament_to_nozzle_4() { action_mmu2_load_filament_to_nozzl_e(4); }
void _mmu2_loadFilament(uint8_t index) {
void _mmu2_load_filament(uint8_t index) {
ui.return_to_status();
ui.status_printf_P(0, PSTR(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
mmu2.loadFilament(index);
mmu2.load_filament(index);
ui.reset_status();
}
void action_mmu2_loadAll() {
void action_mmu2_load_all() {
for (uint8_t i = 0; i < EXTRUDERS; i++)
_mmu2_loadFilament(i);
_mmu2_load_filament(i);
ui.return_to_status();
}
inline void action_mmu2_loadFilament0() { _mmu2_loadFilament(0); }
inline void action_mmu2_loadFilament1() { _mmu2_loadFilament(1); }
inline void action_mmu2_loadFilament2() { _mmu2_loadFilament(2); }
inline void action_mmu2_loadFilament3() { _mmu2_loadFilament(3); }
inline void action_mmu2_loadFilament4() { _mmu2_loadFilament(4); }
inline void action_mmu2_load_filament_0() { _mmu2_load_filament(0); }
inline void action_mmu2_load_filament_1() { _mmu2_load_filament(1); }
inline void action_mmu2_load_filament_2() { _mmu2_load_filament(2); }
inline void action_mmu2_load_filament_3() { _mmu2_load_filament(3); }
inline void action_mmu2_load_filament_4() { _mmu2_load_filament(4); }
void menu_mmu2_loadFilament() {
void menu_mmu2_load_filament() {
START_MENU();
MENU_BACK(MSG_MMU2_MENU);
MENU_ITEM(function, MSG_MMU2_ALL, action_mmu2_loadAll);
MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_loadFilament0);
MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_loadFilament1);
MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_loadFilament2);
MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_loadFilament3);
MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_loadFilament4);
MENU_ITEM(function, MSG_MMU2_ALL, action_mmu2_load_all);
MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_load_filament_0);
MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_load_filament_1);
MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_load_filament_2);
MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_load_filament_3);
MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_load_filament_4);
END_MENU();
}
void menu_mmu2_loadToNozzle() {
void menu_mmu2_load_to_nozzle() {
START_MENU();
MENU_BACK(MSG_MMU2_MENU);
MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_loadFilamentToNozzle0);
MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_loadFilamentToNozzle1);
MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_loadFilamentToNozzle2);
MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_loadFilamentToNozzle3);
MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_loadFilamentToNozzle4);
MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_load_filament_to_nozzle_0);
MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_load_filament_to_nozzle_1);
MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_load_filament_to_nozzle_2);
MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_load_filament_to_nozzle_3);
MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_load_filament_to_nozzle_4);
END_MENU();
}
@@ -96,19 +96,19 @@ void menu_mmu2_loadToNozzle() {
// Eject Filament
//
void _mmu2_ejectFilament(uint8_t index) {
void _mmu2_eject_filament(uint8_t index) {
ui.reset_status();
ui.return_to_status();
ui.status_printf_P(0, PSTR(MSG_MMU2_EJECTING_FILAMENT), int(index + 1));
if (mmu2.ejectFilament(index, true)) ui.reset_status();
if (mmu2.eject_filament(index, true)) ui.reset_status();
}
inline void action_mmu2_ejectFilament0() { _mmu2_ejectFilament(0); }
inline void action_mmu2_ejectFilament1() { _mmu2_ejectFilament(1); }
inline void action_mmu2_ejectFilament2() { _mmu2_ejectFilament(2); }
inline void action_mmu2_ejectFilament3() { _mmu2_ejectFilament(3); }
inline void action_mmu2_ejectFilament4() { _mmu2_ejectFilament(4); }
inline void action_mmu2_eject_filament_0() { _mmu2_eject_filament(0); }
inline void action_mmu2_eject_filament_1() { _mmu2_eject_filament(1); }
inline void action_mmu2_eject_filament_2() { _mmu2_eject_filament(2); }
inline void action_mmu2_eject_filament_3() { _mmu2_eject_filament(3); }
inline void action_mmu2_eject_filament_4() { _mmu2_eject_filament(4); }
void action_mmu2_unloadFilament() {
void action_mmu2_unload_filament() {
ui.reset_status();
ui.return_to_status();
LCD_MESSAGEPGM(MSG_MMU2_UNLOADING_FILAMENT);
@@ -116,14 +116,14 @@ void action_mmu2_unloadFilament() {
if (mmu2.unload()) ui.reset_status();
}
void menu_mmu2_ejectFilament() {
void menu_mmu2_eject_filament() {
START_MENU();
MENU_BACK(MSG_MMU2_MENU);
MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_ejectFilament0);
MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_ejectFilament1);
MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_ejectFilament2);
MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_ejectFilament3);
MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_ejectFilament4);
MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_eject_filament_0);
MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_eject_filament_1);
MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_eject_filament_2);
MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_eject_filament_3);
MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_eject_filament_4);
END_MENU();
}
@@ -139,10 +139,10 @@ void action_mmu2_reset() {
void menu_mmu2() {
START_MENU();
MENU_BACK(MSG_MAIN);
MENU_ITEM(submenu, MSG_MMU2_LOAD_FILAMENT, menu_mmu2_loadFilament);
MENU_ITEM(submenu, MSG_MMU2_LOAD_TO_NOZZLE, menu_mmu2_loadToNozzle);
MENU_ITEM(submenu, MSG_MMU2_EJECT_FILAMENT, menu_mmu2_ejectFilament);
MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_unloadFilament);
MENU_ITEM(submenu, MSG_MMU2_LOAD_FILAMENT, menu_mmu2_load_filament);
MENU_ITEM(submenu, MSG_MMU2_LOAD_TO_NOZZLE, menu_mmu2_load_to_nozzle);
MENU_ITEM(submenu, MSG_MMU2_EJECT_FILAMENT, menu_mmu2_eject_filament);
MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_unload_filament);
MENU_ITEM(function, MSG_MMU2_RESET, action_mmu2_reset);
END_MENU();
}
@@ -161,7 +161,7 @@ inline void action_mmu2_choose2() { action_mmu2_choose(2); }
inline void action_mmu2_choose3() { action_mmu2_choose(3); }
inline void action_mmu2_choose4() { action_mmu2_choose(4); }
void menu_mmu2_chooseFilament() {
void menu_mmu2_choose_filament() {
START_MENU();
#if LCD_HEIGHT > 2
STATIC_ITEM(MSG_MMU2_CHOOSE_FILAMENT_HEADER, true, true);
@@ -178,21 +178,21 @@ void menu_mmu2_chooseFilament() {
// MMU2 Filament Runout
//
inline void action_mmu2_M600_loadCurrentFilament() { mmu2.loadFilament(currentTool); }
inline void action_mmu2_M600_loadCurrentFilamentToNozzle() { mmu2.loadFilamentToNozzle(currentTool); }
inline void action_mmu2_M600_unloadFilament() { mmu2.unload(); }
inline void action_mmu2_M600_load_current_filament() { mmu2.load_filament(currentTool); }
inline void action_mmu2_M600_load_current_filament_to_nozzle() { mmu2.load_filament_to_nozzle(currentTool); }
inline void action_mmu2_M600_unload_filament() { mmu2.unload(); }
inline void action_mmu2_M600_resume() { mmuMenuWait = false; }
void menu_mmu2_pause() {
currentTool = mmu2.getCurrentTool();
currentTool = mmu2.get_current_tool();
START_MENU();
#if LCD_HEIGHT > 2
STATIC_ITEM(MSG_MMU2_FILAMENT_CHANGE_HEADER, true, true);
#endif
MENU_ITEM(function, MSG_MMU2_RESUME, action_mmu2_M600_resume);
MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_M600_unloadFilament);
MENU_ITEM(function, MSG_MMU2_LOAD_FILAMENT, action_mmu2_M600_loadCurrentFilament);
MENU_ITEM(function, MSG_MMU2_LOAD_TO_NOZZLE, action_mmu2_M600_loadCurrentFilamentToNozzle);
MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_M600_unload_filament);
MENU_ITEM(function, MSG_MMU2_LOAD_FILAMENT, action_mmu2_M600_load_current_filament);
MENU_ITEM(function, MSG_MMU2_LOAD_TO_NOZZLE, action_mmu2_M600_load_current_filament_to_nozzle);
END_MENU();
}
@@ -203,9 +203,9 @@ void mmu2_M600() {
while (mmuMenuWait) idle();
}
uint8_t mmu2_chooseFilament() {
uint8_t mmu2_choose_filament() {
ui.defer_status_screen();
ui.goto_screen(menu_mmu2_chooseFilament);
ui.goto_screen(menu_mmu2_choose_filament);
mmuMenuWait = true;
while (mmuMenuWait) idle();
ui.return_to_status();
+1 -1
View File
@@ -25,4 +25,4 @@
void menu_mmu2();
void mmu2_M600();
uint8_t mmu2_chooseFilament();
uint8_t mmu2_choose_filament();
+6 -6
View File
@@ -121,16 +121,16 @@ static void _lcd_move_xyz(PGM_P name, AxisEnum axis) {
#endif
// Get the new position
const float diff = float((int32_t)ui.encoderPosition) * move_menu_scale;
const float diff = float(int16_t(ui.encoderPosition)) * move_menu_scale;
#if IS_KINEMATIC
manual_move_offset += diff;
if ((int32_t)ui.encoderPosition < 0)
if (int16_t(ui.encoderPosition) < 0)
NOLESS(manual_move_offset, min - current_position[axis]);
else
NOMORE(manual_move_offset, max - current_position[axis]);
#else
current_position[axis] += diff;
if ((int32_t)ui.encoderPosition < 0)
if (int16_t(ui.encoderPosition) < 0)
NOLESS(current_position[axis], min);
else
NOMORE(current_position[axis], max);
@@ -161,7 +161,7 @@ static void _lcd_move_e(
ui.encoder_direction_normal();
if (ui.encoderPosition) {
if (!ui.processing_manual_move) {
const float diff = float((int32_t)ui.encoderPosition) * move_menu_scale;
const float diff = float(int16_t(ui.encoderPosition)) * move_menu_scale;
#if IS_KINEMATIC
manual_move_offset += diff;
#else
@@ -335,7 +335,7 @@ void menu_move() {
else
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
#if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE)
#if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, MAGNETIC_SWITCHING_TOOLHEAD)
#if EXTRUDERS == 6
switch (active_extruder) {
@@ -465,7 +465,7 @@ void menu_motion() {
#if DISABLED(PROBE_MANUALLY)
MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G28\nG29"));
#endif
if (leveling_is_valid()) {
if (all_axes_homed() && leveling_is_valid()) {
bool new_level_state = planner.leveling_active;
MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling);
}
+39 -9
View File
@@ -47,10 +47,11 @@ void lcd_sd_updir() {
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
uint32_t last_sdfile_encoderPosition = 0xFFFF;
uint16_t sd_encoder_position = 0xFFFF;
int8_t sd_top_line, sd_items;
void MarlinUI::reselect_last_file() {
if (last_sdfile_encoderPosition == 0xFFFF) return;
if (sd_encoder_position == 0xFFFF) return;
//#if HAS_GRAPHICAL_LCD
// // This is a hack to force a screen update.
// ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
@@ -61,8 +62,8 @@ void lcd_sd_updir() {
// ui.drawing_screen = screen_changed = true;
//#endif
goto_screen(menu_sdcard, last_sdfile_encoderPosition);
last_sdfile_encoderPosition = 0xFFFF;
goto_screen(menu_sdcard, sd_encoder_position, sd_top_line, sd_items);
sd_encoder_position = 0xFFFF;
defer_status_screen();
@@ -72,15 +73,44 @@ void lcd_sd_updir() {
}
#endif
inline void sdcard_start_selected_file() {
card.openAndPrintFile(card.filename);
ui.return_to_status();
ui.reset_status();
}
#if ENABLED(SD_MENU_CONFIRM_START)
bool do_print_file;
void menu_sd_confirm() {
if (ui.should_draw())
do_select_screen(PSTR(MSG_BUTTON_PRINT), PSTR(MSG_BUTTON_CANCEL), do_print_file, PSTR(MSG_START_PRINT " "), card.longest_filename(), PSTR("?"));
if (ui.use_click()) {
if (do_print_file)
sdcard_start_selected_file();
else
ui.goto_previous_screen();
}
}
#endif
class MenuItem_sdfile {
public:
static void action(CardReader &theCard) {
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
last_sdfile_encoderPosition = ui.encoderPosition; // Save which file was selected for later use
// Save menu state for the selected file
sd_encoder_position = ui.encoderPosition;
sd_top_line = encoderTopLine;
sd_items = screen_items;
#endif
#if ENABLED(SD_MENU_CONFIRM_START)
do_print_file = false;
MenuItem_submenu::action(menu_sd_confirm);
#else
sdcard_start_selected_file();
#endif
card.openAndPrintFile(theCard.filename);
ui.return_to_status();
ui.reset_status();
}
};
@@ -89,7 +119,7 @@ class MenuItem_sdfolder {
static void action(CardReader &theCard) {
card.chdir(theCard.filename);
encoderTopLine = 0;
ui.encoderPosition = 2 * ENCODER_STEPS_PER_MENU_ITEM;
ui.encoderPosition = 2 * (ENCODER_STEPS_PER_MENU_ITEM);
screen_changed = true;
#if HAS_GRAPHICAL_LCD
ui.drawing_screen = false;
+38 -10
View File
@@ -65,32 +65,60 @@
#if ENABLED(BABYSTEPPING)
long babysteps_done = 0;
#include "../../feature/babystep.h"
#include "../lcdprint.h"
#if HAS_GRAPHICAL_LCD
#include "../dogm/ultralcd_DOGM.h"
#endif
void _lcd_babystep(const AxisEnum axis, PGM_P msg) {
void _lcd_babystep(const AxisEnum axis, PGM_P const msg) {
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
ui.encoder_direction_normal();
if (ui.encoderPosition) {
const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR);
const int16_t steps = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR);
ui.encoderPosition = 0;
ui.refresh(LCDVIEW_REDRAW_NOW);
thermalManager.babystep_axis(axis, babystep_increment);
babysteps_done += babystep_increment;
babystep.add_steps(axis, steps);
}
if (ui.should_draw())
draw_edit_screen(msg, ftostr43sign(planner.steps_to_mm[axis] * babysteps_done));
if (ui.should_draw()) {
const float spm = planner.steps_to_mm[axis];
draw_edit_screen(msg, ftostr54sign(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
);
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
lcd_put_u8str_P(PSTR(MSG_BABYSTEP_TOTAL ":"));
lcd_put_u8str(ftostr54sign(spm * babystep.axis_total[BS_TOTAL_AXIS(axis)]));
}
#endif
}
}
inline void _lcd_babystep_go(const screenFunc_t screen) {
ui.goto_screen(screen);
ui.defer_status_screen();
babystep.accum = 0;
}
#if ENABLED(BABYSTEP_XY)
void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); }
void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); }
void lcd_babystep_x() { ui.goto_screen(_lcd_babystep_x); babysteps_done = 0; ui.defer_status_screen(); }
void lcd_babystep_y() { ui.goto_screen(_lcd_babystep_y); babysteps_done = 0; ui.defer_status_screen(); }
void lcd_babystep_x() { _lcd_babystep_go(_lcd_babystep_x); }
void lcd_babystep_y() { _lcd_babystep_go(_lcd_babystep_y); }
#endif
#if DISABLED(BABYSTEP_ZPROBE_OFFSET)
void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); }
void lcd_babystep_z() { ui.goto_screen(_lcd_babystep_z); babysteps_done = 0; ui.defer_status_screen(); }
void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); }
#endif
#endif // BABYSTEPPING
+1 -1
View File
@@ -471,7 +471,7 @@ void _lcd_ubl_output_map_lcd() {
ui.encoder_direction_normal();
if (ui.encoderPosition) {
step_scaler += (int32_t)ui.encoderPosition;
step_scaler += int16_t(ui.encoderPosition);
x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
ui.encoderPosition = 0;
ui.refresh(LCDVIEW_REDRAW_NOW);
+29 -8
View File
@@ -118,7 +118,7 @@ millis_t next_button_update_ms;
// Encoder Handling
#if HAS_ENCODER_ACTION
uint32_t MarlinUI::encoderPosition;
uint16_t MarlinUI::encoderPosition;
volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
#endif
@@ -192,7 +192,25 @@ millis_t next_button_update_ms;
#endif
#endif
void wrap_string(uint8_t y, const char * const string) {
uint8_t x = LCD_WIDTH;
if (string) {
uint8_t *p = (uint8_t*)string;
for (;;) {
if (x >= LCD_WIDTH) {
x = 0;
SETCURSOR(0, y++);
}
wchar_t ch;
p = get_utf8_value_cb(p, read_byte_ram, &ch);
if (!ch) break;
lcd_put_wchar(ch);
x++;
}
}
}
#endif // HAS_LCD_MENU
void MarlinUI::init() {
@@ -462,13 +480,13 @@ void MarlinUI::status_screen() {
#if ENABLED(ULTIPANEL_FEEDMULTIPLY)
const int16_t old_frm = feedrate_percentage;
int16_t new_frm = old_frm + (int32_t)encoderPosition;
int16_t new_frm = old_frm + int16_t(encoderPosition);
// Dead zone at 100% feedrate
if (old_frm == 100) {
if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE)
if (int16_t(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
new_frm -= ENCODER_FEEDRATE_DEADZONE;
else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE))
else if (int16_t(encoderPosition) < -(ENCODER_FEEDRATE_DEADZONE))
new_frm += ENCODER_FEEDRATE_DEADZONE;
else
new_frm = old_frm;
@@ -809,10 +827,13 @@ void MarlinUI::update() {
#if HAS_LCD_MENU && ENABLED(SCROLL_LONG_FILENAMES)
// If scrolling of long file names is enabled and we are in the sd card menu,
// cause a refresh to occur until all the text has scrolled into view.
if (currentScreen == menu_sdcard && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) {
lcd_status_update_delay = 6;
if (currentScreen == menu_sdcard && !lcd_status_update_delay--) {
lcd_status_update_delay = 4;
if (++filename_scroll_pos > filename_scroll_max) {
filename_scroll_pos = 0;
lcd_status_update_delay = 12;
}
refresh(LCDVIEW_REDRAW_NOW);
filename_scroll_pos++;
#if LCD_TIMEOUT_TO_STATUS
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
#endif
+16 -14
View File
@@ -56,22 +56,24 @@
uint8_t get_ADC_keyValue();
#endif
#if HAS_GRAPHICAL_LCD
#define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
#define LCDPRINT(p) u8g.print(p)
#define LCDWRITE(c) u8g.print(c)
#else
#define SETCURSOR(col, row) lcd_moveto(col, row)
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - len, row)
#define LCDPRINT(p) lcd_put_u8str(p)
#define LCDWRITE(c) lcd_put_wchar(c)
#endif
#define LCD_UPDATE_INTERVAL 100
#if HAS_LCD_MENU
#if HAS_GRAPHICAL_LCD
#define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
#define LCDPRINT(p) u8g.print(p)
#define LCDWRITE(c) u8g.print(c)
#else
#define SETCURSOR(col, row) lcd_moveto(col, row)
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - (len), row)
#define LCDPRINT(p) lcd_put_u8str(p)
#define LCDWRITE(c) lcd_put_wchar(c)
#endif
void wrap_string(uint8_t y, const char * const string);
#if ENABLED(SDSUPPORT)
#include "../sd/cardreader.h"
#endif
@@ -419,7 +421,7 @@ public:
static void synchronize(PGM_P const msg=NULL);
static screenFunc_t currentScreen;
static void goto_screen(const screenFunc_t screen, const uint32_t encoder=0, const uint8_t top=0, const uint8_t items=0);
static void goto_screen(const screenFunc_t screen, const uint16_t encoder=0, const uint8_t top=0, const uint8_t items=0);
static void save_previous_screen();
static void goto_previous_screen();
static void return_to_status();
@@ -494,7 +496,7 @@ public:
static void wait_for_release();
#endif
static uint32_t encoderPosition;
static uint16_t encoderPosition;
#if ENABLED(REVERSE_ENCODER_DIRECTION)
#define ENCODERBASE -1
+12 -4
View File
@@ -63,6 +63,10 @@
#include "../feature/fwretract.h"
#endif
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
#include "../feature/babystep.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../core/debug_out.h"
@@ -1316,6 +1320,14 @@ void set_axis_is_at_home(const AxisEnum axis) {
}
#endif
#if ENABLED(I2C_POSITION_ENCODERS)
I2CPEM.homed(axis);
#endif
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
babystep.reset_total(axis);
#endif
if (DEBUGGING(LEVELING)) {
#if HAS_HOME_OFFSET
DEBUG_ECHOLNPAIR("> home_offset[", axis_codes[axis], "] = ", home_offset[axis]);
@@ -1323,10 +1335,6 @@ void set_axis_is_at_home(const AxisEnum axis) {
DEBUG_POS("", current_position);
DEBUG_ECHOLNPAIR("<<< set_axis_is_at_home(", axis_codes[axis], ")");
}
#if ENABLED(I2C_POSITION_ENCODERS)
I2CPEM.homed(axis);
#endif
}
/**
+2 -84
View File
@@ -44,7 +44,7 @@
#endif
#if ENABLED(BABYSTEPPING)
#include "../module/motion.h"
#include "../feature/babystep.h"
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
#include "../gcode/gcode.h"
#endif
@@ -239,10 +239,6 @@ hotend_info_t Temperature::temp_hotend[HOTENDS]; // = { 0 }
//hotend_pid_t Temperature::pid[HOTENDS];
#endif
#if ENABLED(BABYSTEPPING)
volatile int16_t Temperature::babystepsTodo[XYZ] = { 0 };
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
bool Temperature::allow_cold_extrude = false;
int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
@@ -2516,21 +2512,7 @@ void Temperature::isr() {
//
#if ENABLED(BABYSTEPPING)
#if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
LOOP_XYZ(axis) {
const int16_t curTodo = babystepsTodo[axis]; // get rid of volatile for performance
if (curTodo) {
stepper.babystep((AxisEnum)axis, curTodo > 0);
if (curTodo > 0) babystepsTodo[axis]--; else babystepsTodo[axis]++;
}
}
#else
const int16_t curTodo = babystepsTodo[Z_AXIS];
if (curTodo) {
stepper.babystep(Z_AXIS, curTodo > 0);
if (curTodo > 0) babystepsTodo[Z_AXIS]--; else babystepsTodo[Z_AXIS]++;
}
#endif
babystep.task();
#endif
// Poll endstops state, if required
@@ -2540,70 +2522,6 @@ void Temperature::isr() {
planner.tick();
}
#if ENABLED(BABYSTEPPING)
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
#define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: enable_X(); break; case Y_AXIS: enable_Y(); break; case Z_AXIS: enable_Z(); } }while(0)
#else
#define BSA_ENABLE(AXIS) NOOP
#endif
#if ENABLED(BABYSTEP_WITHOUT_HOMING)
#define CAN_BABYSTEP(AXIS) true
#else
#define CAN_BABYSTEP(AXIS) TEST(axis_known_position, AXIS)
#endif
extern uint8_t axis_known_position;
void Temperature::babystep_axis(const AxisEnum axis, const int16_t distance) {
if (!CAN_BABYSTEP(axis)) return;
#if IS_CORE
#if ENABLED(BABYSTEP_XY)
switch (axis) {
case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
babystepsTodo[CORE_AXIS_1] += distance * 2;
babystepsTodo[CORE_AXIS_2] += distance * 2;
break;
case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
break;
case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
default:
BSA_ENABLE(NORMAL_AXIS);
babystepsTodo[NORMAL_AXIS] += distance;
break;
}
#elif CORE_IS_XZ || CORE_IS_YZ
// Only Z stepping needs to be handled here
BSA_ENABLE(CORE_AXIS_1);
BSA_ENABLE(CORE_AXIS_2);
babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
#else
BSA_ENABLE(Z_AXIS);
babystepsTodo[Z_AXIS] += distance;
#endif
#else
#if ENABLED(BABYSTEP_XY)
BSA_ENABLE(axis);
#else
BSA_ENABLE(Z_AXIS);
#endif
babystepsTodo[axis] += distance;
#endif
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
gcode.reset_stepper_timeout();
#endif
}
#endif // BABYSTEPPING
#if HAS_TEMP_SENSOR
#include "../gcode/gcode.h"
-8
View File
@@ -266,10 +266,6 @@ class Temperature {
soft_pwm_count_fan[FAN_COUNT];
#endif
#if ENABLED(BABYSTEPPING)
static volatile int16_t babystepsTodo[3];
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
static bool allow_cold_extrude;
static int16_t extrude_min_temp;
@@ -689,10 +685,6 @@ class Temperature {
#endif
#if ENABLED(BABYSTEPPING)
static void babystep_axis(const AxisEnum axis, const int16_t distance);
#endif
#if ENABLED(PROBING_HEATERS_OFF)
static void pause(const bool p);
FORCE_INLINE static bool is_paused() { return paused; }
+147 -28
View File
@@ -121,7 +121,7 @@
void move_nozzle_servo(const uint8_t angle_index) {
planner.synchronize();
MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][e]);
MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][angle_index]);
safe_delay(500);
}
@@ -369,12 +369,6 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
pe_activate_solenoid(active_extruder); // Just save power for inverted magnets
#endif
}
#if HAS_HOTEND_OFFSET
current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
#endif
if (DEBUGGING(LEVELING)) DEBUG_POS("Applying Z-offset", current_position);
}
#endif // PARKING_EXTRUDER
@@ -493,6 +487,133 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
#endif // SWITCHING_TOOLHEAD
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
inline void magnetic_switching_toolhead_tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
if (no_move) return;
const float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS,
placexpos = toolheadposx[active_extruder],
grabxpos = toolheadposx[tmp_extruder];
/**
* 1. Raise Z to give enough clearance
* 2. Move to switch position of current toolhead
* 3. Release and place toolhead in the dock
* 4. Move to the new toolhead
* 5. Grab the new toolhead and move to security position
*/
if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position);
// 1. Raise Z to give enough clearance
current_position[Z_AXIS] += toolchange_settings.z_raise;
if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position);
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder);
planner.synchronize();
// 2. Move to switch position current toolhead
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR;
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPAIR("(2) Place old tool ", int(active_extruder));
DEBUG_POS("Move Y SwitchPos + Security", current_position);
}
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder);
planner.synchronize();
current_position[X_AXIS] = placexpos + SWITCHING_TOOLHEAD_X_SECURITY;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move X SwitchPos + Security", current_position);
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder);
planner.synchronize();
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position);
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder);
planner.synchronize();
current_position[X_AXIS] = placexpos;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move X SwitchPos", current_position);
planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[X_AXIS] * 0.25), active_extruder);
planner.synchronize();
// 3. Release and place toolhead in the dock
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Release and Place Toolhead");
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position);
planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.1), active_extruder);
planner.synchronize();
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_SECURITY;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Security", current_position);
planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder);
planner.synchronize();
// 4. Move to new toolhead position
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to new toolhead position");
current_position[X_AXIS] = grabxpos;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X", current_position);
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder);
planner.synchronize();
// 5. Grab the new toolhead and move to security position
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(5) Grab new toolhead and move to security position");
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position);
planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder);
planner.synchronize();
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position);
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.2, active_extruder);
planner.synchronize();
safe_delay(100);
current_position[X_AXIS] = grabxpos + SWITCHING_TOOLHEAD_X_SECURITY;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X + Security", current_position);
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.1, active_extruder);
planner.synchronize();
safe_delay(100);
current_position[Y_AXIS] += SWITCHING_TOOLHEAD_Y_CLEAR;
if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position);
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead
planner.synchronize();
}
#endif // MAGNETIC_SWITCHING_TOOLHEAD
inline void invalid_extruder_error(const uint8_t e) {
SERIAL_ECHO_START();
SERIAL_CHAR('T'); SERIAL_ECHO(int(e));
@@ -525,10 +646,6 @@ inline void invalid_extruder_error(const uint8_t e) {
planner.synchronize();
}
// Apply Y & Z extruder offset (X offset is used as home pos with Dual X)
current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder];
current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
// Activate the new extruder ahead of calling set_axis_is_at_home!
active_extruder = tmp_extruder;
@@ -567,6 +684,11 @@ inline void invalid_extruder_error(const uint8_t e) {
* previous tool out of the way and the new tool into place.
*/
void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
if (tmp_extruder == active_extruder) return;
#endif
#if ENABLED(MIXING_EXTRUDER)
UNUSED(fr_mm_s); UNUSED(no_move);
@@ -583,7 +705,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
UNUSED(fr_mm_s); UNUSED(no_move);
mmu2.toolChange(tmp_extruder);
mmu2.tool_change(tmp_extruder);
#elif EXTRUDERS < 2
@@ -696,6 +818,8 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
magnetic_parking_extruder_tool_change(tmp_extruder);
#elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead
switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move);
#elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching Toolhead
magnetic_switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move);
#elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS
// Raise by a configured distance to avoid workpiece, except with
// SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead.
@@ -765,7 +889,16 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
#endif
// Prevent a move outside physical bounds
apply_motion_limits(destination);
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
// If the original position is within tool store area, go to X origin at once
if (destination[Y_AXIS] < SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR) {
current_position[X_AXIS] = 0;
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder);
planner.synchronize();
}
#else
apply_motion_limits(destination);
#endif
// Move back to the original (or tweaked) position
do_blocking_move_to(destination);
@@ -783,27 +916,13 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
#endif
#if ENABLED(PRUSA_MMU2)
mmu2.toolChange(tmp_extruder);
mmu2.tool_change(tmp_extruder);
#endif
#if SWITCHING_NOZZLE_TWO_SERVOS
lower_nozzle(active_extruder);
#endif
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP) && ADVANCED_PAUSE_RESUME_PRIME != 0
if (should_swap && !too_cold) {
const float resume_eaxis = current_position[E_AXIS];
#if ENABLED(ADVANCED_PAUSE_FEATURE)
do_pause_e_move(toolchange_settings.swap_length, toolchange_settings.prime_speed);
#else
current_position[E_AXIS] += (ADVANCED_PAUSE_RESUME_PRIME) / planner.e_factor[active_extruder];
planner.buffer_line(current_position, ADVANCED_PAUSE_PURGE_FEEDRATE, active_extruder);
#endif
planner.synchronize();
planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = resume_eaxis));
}
#endif
} // (tmp_extruder != active_extruder)
planner.synchronize();
+24 -18
View File
@@ -305,39 +305,41 @@
//
#elif MB(RAMPS_14_RE_ARM_EFB)
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#elif MB(RAMPS_14_RE_ARM_EEB)
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#elif MB(RAMPS_14_RE_ARM_EFF)
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#elif MB(RAMPS_14_RE_ARM_EEF)
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#elif MB(RAMPS_14_RE_ARM_SF)
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768
#elif MB(MKS_SBASE)
#include "pins_MKS_SBASE.h" // LPC1768 env:LPC1768
#include "pins_MKS_SBASE.h" // LPC1768 env:LPC1768
#elif MB(AZSMZ_MINI)
#include "pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768
#include "pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768
#elif MB(AZTEEG_X5_GT)
#include "pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769
#include "pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769
#elif MB(AZTEEG_X5_MINI)
#include "pins_AZTEEG_X5_MINI.h" // LPC1769 env:LPC1769
#elif MB(AZTEEG_X5_MINI_WIFI)
#include "pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769
#include "pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769
#elif MB(BIQU_BQ111_A4)
#include "pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768
#include "pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768
#elif MB(SELENA_COMPACT)
#include "pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768
#include "pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768
#elif MB(COHESION3D_REMIX)
#include "pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769
#include "pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769
#elif MB(COHESION3D_MINI)
#include "pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769
#include "pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769
#elif MB(SMOOTHIEBOARD)
#include "pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769
#include "pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769
#elif MB(BIQU_SKR_V1_1)
#include "pins_BIQU_SKR_V1.1.h" // LPC1768 env:LPC1768
#include "pins_BIQU_SKR_V1.1.h" // LPC1768 env:LPC1768
#elif MB(BIQU_B300_V1_0)
#include "pins_BIQU_B300_V1.0.h" // LPC1768 env:LPC1768
#include "pins_BIQU_B300_V1.0.h" // LPC1768 env:LPC1768
#elif MB(BIGTREE_SKR_V1_3)
#include "pins_BIGTREE_SKR_V1.3.h" // LPC1768 env:LPC1768
#include "pins_BIGTREE_SKR_V1.3.h" // LPC1768 env:LPC1768
//
// Other 32-bit Boards
@@ -417,7 +419,7 @@
#elif MB(MORPHEUS)
#include "pins_MORPHEUS.h" // STM32F1 env:STM32F1
#elif MB(MKS_ROBIN)
#include "pins_MKS_ROBIN.h" // STM32F1 env:STM32F1
#include "pins_MKS_ROBIN.h" // STM32F1 env:mks_robin
//
// STM32 ARM Cortex-M4F
@@ -435,9 +437,13 @@
#include "pins_ARMED.h" // STM32F4 env:ARMED
#elif MB(RUMBA32)
#include "pins_RUMBA32.h" // STM32F4 env:RUMBA32
#elif MB(BLACK_STM32F407VE)
#include "pins_BLACK_STM32F407VE.h" // STM32F4 env:black_stm32f407ve
#elif MB(STEVAL)
#include "pins_STEVAL.h" // STM32F4 env:STM32F4
//
// ARM Cortex M7
//
+3
View File
@@ -102,6 +102,9 @@ const PinInfo pin_array[] PROGMEM = {
#include HAL_PATH(../HAL, pinsDebug.h) // get the correct support file for this CPU
#ifndef M43_NEVER_TOUCH
#define M43_NEVER_TOUCH(Q) false
#endif
static void print_input_or_output(const bool isout) {
serialprintPGM(isout ? PSTR("Output = ") : PSTR("Input = "));
+2 -2
View File
@@ -788,8 +788,8 @@
#if PIN_EXISTS(SPINDLE_ENABLE)
REPORT_NAME_DIGITAL(__LINE__, SPINDLE_ENABLE_PIN)
#endif
#if PIN_EXISTS(SPINDLE_LASER_ENABLE)
REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_ENABLE_PIN)
#if PIN_EXISTS(SPINDLE_LASER_ENA)
REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_ENA_PIN)
#endif
#if PIN_EXISTS(SPINDLE_LASER_PWM)
REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_PWM_PIN)

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