Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
This commit is contained in:
commit
236cc1b4f4
425 changed files with 11227 additions and 10471 deletions
1
.github/workflows/test-builds.yml
vendored
1
.github/workflows/test-builds.yml
vendored
|
|
@ -81,6 +81,7 @@ jobs:
|
|||
- STM32F103RET6_creality
|
||||
- LERDGEX
|
||||
- mks_robin_nano35
|
||||
- NUCLEO_F767ZI
|
||||
|
||||
# Put lengthy tests last
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
* Advanced settings can be found in Configuration_adv.h
|
||||
*/
|
||||
#define CONFIGURATION_H_VERSION 020007
|
||||
#define CONFIGURATION_H_VERSION 020008
|
||||
|
||||
//===========================================================================
|
||||
//============================= Getting Started =============================
|
||||
|
|
@ -376,11 +376,10 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// @section temperature
|
||||
|
||||
//===========================================================================
|
||||
//============================= Thermal Settings ============================
|
||||
//===========================================================================
|
||||
// @section temperature
|
||||
|
||||
/**
|
||||
* --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
|
||||
|
|
@ -462,6 +461,12 @@
|
|||
#define DUMMY_THERMISTOR_998_VALUE 25
|
||||
#define DUMMY_THERMISTOR_999_VALUE 100
|
||||
|
||||
// Resistor values when using a MAX31865 (sensor -5)
|
||||
// Sensor value is typically 100 (PT100) or 1000 (PT1000)
|
||||
// Calibration value is typically 430 ohm for AdaFruit PT100 modules and 4300 ohm for AdaFruit PT1000 modules.
|
||||
//#define MAX31865_SENSOR_OHMS 100
|
||||
//#define MAX31865_CALIBRATION_OHMS 430
|
||||
|
||||
// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings
|
||||
// from the two sensors differ too much the print will be aborted.
|
||||
//#define TEMP_SENSOR_1_AS_REDUNDANT
|
||||
|
|
@ -2383,44 +2388,109 @@
|
|||
//=============================== Graphical TFTs ==============================
|
||||
//=============================================================================
|
||||
|
||||
//
|
||||
// TFT display with optional touch screen
|
||||
// Color Marlin UI with standard menu system
|
||||
//
|
||||
//#define TFT_320x240
|
||||
//#define TFT_320x240_SPI
|
||||
//#define TFT_480x320
|
||||
//#define TFT_480x320_SPI
|
||||
/**
|
||||
* Specific TFT Model Presets. Enable one of the following options
|
||||
* or enable TFT_GENERIC and set sub-options.
|
||||
*/
|
||||
|
||||
//
|
||||
// Skip autodetect and force specific TFT driver
|
||||
// Mandatory for SPI screens with no MISO line
|
||||
// Available drivers are: ST7735, ST7789, ST7796, R61505, ILI9328, ILI9341, ILI9488
|
||||
// 480x320, 3.5", SPI Display From MKS
|
||||
// Normally used in MKS Robin Nano V2
|
||||
//
|
||||
//#define TFT_DRIVER AUTO
|
||||
//#define MKS_TS35_V2_0
|
||||
|
||||
//
|
||||
// SPI display (MKS Robin Nano V2.0, MKS Gen L V2.0)
|
||||
// Upscaled 128x64 Marlin UI
|
||||
// 320x240, 2.4", FSMC Display From MKS
|
||||
// Normally used in MKS Robin Nano V1.2
|
||||
//
|
||||
//#define SPI_GRAPHICAL_TFT
|
||||
//#define MKS_ROBIN_TFT24
|
||||
|
||||
//
|
||||
// FSMC display (MKS Robin, Alfawise U20, JGAurora A5S, REXYZ A1, etc.)
|
||||
// Upscaled 128x64 Marlin UI
|
||||
// 320x240, 2.8", FSMC Display From MKS
|
||||
// Normally used in MKS Robin Nano V1.2
|
||||
//
|
||||
//#define FSMC_GRAPHICAL_TFT
|
||||
//#define MKS_ROBIN_TFT28
|
||||
|
||||
//
|
||||
// TFT LVGL UI
|
||||
// 320x240, 3.2", FSMC Display From MKS
|
||||
// Normally used in MKS Robin Nano V1.2
|
||||
//
|
||||
// Using default MKS icons and fonts from: https://git.io/JJvzK
|
||||
// Just copy the 'assets' folder from the build directory to the
|
||||
// root of your SD card, together with the compiled firmware.
|
||||
//#define MKS_ROBIN_TFT32
|
||||
|
||||
//
|
||||
//#define TFT_LVGL_UI_FSMC // Robin nano v1.2 uses FSMC
|
||||
//#define TFT_LVGL_UI_SPI // Robin nano v2.0 uses SPI_GRAPHICAL_TFT
|
||||
// 480x320, 3.5", FSMC Display From MKS
|
||||
// Normally used in MKS Robin Nano V1.2
|
||||
//
|
||||
//#define MKS_ROBIN_TFT35
|
||||
|
||||
//
|
||||
// 480x272, 4.3", FSMC Display From MKS
|
||||
//
|
||||
//#define MKS_ROBIN_TFT43
|
||||
|
||||
//
|
||||
// 320x240, 3.2", FSMC Display From MKS
|
||||
// Normally used in MKS Robin
|
||||
//
|
||||
//#define MKS_ROBIN_TFT_V1_1R
|
||||
|
||||
//
|
||||
// 480x320, 3.5", FSMC Stock Display from TronxXY
|
||||
//
|
||||
//#define TFT_TRONXY_X5SA
|
||||
|
||||
//
|
||||
// 480x320, 3.5", FSMC Stock Display from AnyCubic
|
||||
//
|
||||
//#define ANYCUBIC_TFT35
|
||||
|
||||
//
|
||||
// 320x240, 2.8", FSMC Stock Display from Longer/Alfawise
|
||||
//
|
||||
//#define LONGER_LK_TFT28
|
||||
|
||||
//
|
||||
// Generic TFT with detailed options
|
||||
//
|
||||
//#define TFT_GENERIC
|
||||
#if ENABLED(TFT_GENERIC)
|
||||
// :[ 'AUTO', 'ST7735', 'ST7789', 'ST7796', 'R61505', 'ILI9328', 'ILI9341', 'ILI9488' ]
|
||||
#define TFT_DRIVER AUTO
|
||||
|
||||
// Interface. Enable one of the following options:
|
||||
//#define TFT_INTERFACE_FSMC
|
||||
//#define TFT_INTERFACE_SPI
|
||||
|
||||
// TFT Resolution. Enable one of the following options:
|
||||
//#define TFT_RES_320x240
|
||||
//#define TFT_RES_480x272
|
||||
//#define TFT_RES_480x320
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TFT UI - User Interface Selection. Enable one of the following options:
|
||||
*
|
||||
* TFT_CLASSIC_UI - Emulated DOGM - 128x64 Upscaled
|
||||
* TFT_COLOR_UI - Marlin Default Menus, Touch Friendly, using full TFT capabilities
|
||||
* TFT_LVGL_UI - A Modern UI using LVGL
|
||||
*
|
||||
* For LVGL_UI also copy the 'assets' folder from the build directory to the
|
||||
* root of your SD card, together with the compiled firmware.
|
||||
*/
|
||||
//#define TFT_CLASSIC_UI
|
||||
//#define TFT_COLOR_UI
|
||||
//#define TFT_LVGL_UI
|
||||
|
||||
/**
|
||||
* TFT Rotation. Set to one of the following values:
|
||||
*
|
||||
* TFT_ROTATE_90, TFT_ROTATE_90_MIRROR_X, TFT_ROTATE_90_MIRROR_Y,
|
||||
* TFT_ROTATE_180, TFT_ROTATE_180_MIRROR_X, TFT_ROTATE_180_MIRROR_Y,
|
||||
* TFT_ROTATE_270, TFT_ROTATE_270_MIRROR_X, TFT_ROTATE_270_MIRROR_Y,
|
||||
* TFT_MIRROR_X, TFT_MIRROR_Y, TFT_NO_ROTATION
|
||||
*/
|
||||
//#define TFT_ROTATION TFT_NO_ROTATION
|
||||
|
||||
//=============================================================================
|
||||
//============================ Other Controllers ============================
|
||||
//=============================================================================
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Basic settings can be found in Configuration.h
|
||||
*/
|
||||
#define CONFIGURATION_ADV_H_VERSION 020007
|
||||
#define CONFIGURATION_ADV_H_VERSION 020008
|
||||
|
||||
//===========================================================================
|
||||
//============================= Thermal Settings ============================
|
||||
|
|
@ -807,11 +807,9 @@
|
|||
#define TRAMMING_POINT_NAME_3 "Back-Right"
|
||||
#define TRAMMING_POINT_NAME_4 "Back-Left"
|
||||
|
||||
// Enable to restore leveling setup after operation
|
||||
#define RESTORE_LEVELING_AFTER_G35
|
||||
|
||||
// Add a menu item for Assisted Tramming
|
||||
//#define ASSISTED_TRAMMING_MENU_ITEM
|
||||
#define RESTORE_LEVELING_AFTER_G35 // Enable to restore leveling setup after operation
|
||||
//#define REPORT_TRAMMING_MM // Report Z deviation (mm) for each point relative to the first
|
||||
//#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item for Assisted Tramming
|
||||
|
||||
/**
|
||||
* Screw thread:
|
||||
|
|
@ -1055,9 +1053,9 @@
|
|||
|
||||
#if EITHER(ULTIPANEL, EXTENSIBLE_UI)
|
||||
#define MANUAL_FEEDRATE_XYZ 50*60
|
||||
#define MANUAL_FEEDRATE { MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, 60 } // (mm/m) Feedrates for manual moves along X, Y, Z, E from panel
|
||||
#define MANUAL_FEEDRATE { MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, 2*60 } // (mm/m) Feedrates for manual moves along X, Y, Z, E from panel
|
||||
#define SHORT_MANUAL_Z_MOVE 0.025 // (mm) Smallest manual Z move (< 0.1mm)
|
||||
#if ENABLED(ULTIPANEL)
|
||||
#if IS_ULTIPANEL
|
||||
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
|
||||
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
|
||||
#endif
|
||||
|
|
@ -1563,10 +1561,9 @@
|
|||
#endif
|
||||
|
||||
//
|
||||
// FSMC / SPI Graphical TFT
|
||||
// Classic UI Options
|
||||
//
|
||||
#if TFT_SCALED_DOGLCD
|
||||
//#define GRAPHICAL_TFT_ROTATE_180
|
||||
//#define TFT_MARLINUI_COLOR 0xFFFF // White
|
||||
//#define TFT_MARLINBG_COLOR 0x0000 // Black
|
||||
//#define TFT_DISABLED_COLOR 0x0003 // Almost black
|
||||
|
|
@ -2461,7 +2458,7 @@
|
|||
*/
|
||||
#define STEALTHCHOP_XY
|
||||
#define STEALTHCHOP_Z
|
||||
#define STEALTHCHOP_E
|
||||
//#define STEALTHCHOP_E
|
||||
|
||||
/**
|
||||
* Optimize spreadCycle chopper parameters by using predefined parameter sets
|
||||
|
|
@ -2475,10 +2472,26 @@
|
|||
* CHOPPER_PRUSAMK3_24V // Imported parameters from the official Průša firmware for MK3 (24V)
|
||||
* CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9
|
||||
*
|
||||
* Define you own with
|
||||
* Define your own with:
|
||||
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
|
||||
*/
|
||||
#define CHOPPER_TIMING CHOPPER_DEFAULT_24V //TMC Have set this to 24V mode
|
||||
#define CHOPPER_TIMING CHOPPER_DEFAULT_24V // All axes (override below)
|
||||
//#define CHOPPER_TIMING_X CHOPPER_DEFAULT_12V // For X Axes (override below)
|
||||
//#define CHOPPER_TIMING_X2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Y CHOPPER_DEFAULT_12V // For Y Axes (override below)
|
||||
//#define CHOPPER_TIMING_Y2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z CHOPPER_DEFAULT_12V // For Z Axes (override below)
|
||||
//#define CHOPPER_TIMING_Z2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z3 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z4 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E CHOPPER_DEFAULT_12V // For Extruders (override below)
|
||||
//#define CHOPPER_TIMING_E1 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E3 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E4 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E5 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E6 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E7 CHOPPER_DEFAULT_12V
|
||||
|
||||
/**
|
||||
* Monitor Trinamic drivers
|
||||
|
|
@ -2508,15 +2521,15 @@
|
|||
*/
|
||||
#define HYBRID_THRESHOLD //TMC
|
||||
|
||||
#define X_HYBRID_THRESHOLD 100 // [mm/s]
|
||||
#define X_HYBRID_THRESHOLD 150 // [mm/s]
|
||||
#define X2_HYBRID_THRESHOLD 100
|
||||
#define Y_HYBRID_THRESHOLD 100
|
||||
#define Y_HYBRID_THRESHOLD 150
|
||||
#define Y2_HYBRID_THRESHOLD 100
|
||||
#define Z_HYBRID_THRESHOLD 100
|
||||
#define Z_HYBRID_THRESHOLD 150
|
||||
#define Z2_HYBRID_THRESHOLD 3
|
||||
#define Z3_HYBRID_THRESHOLD 3
|
||||
#define Z4_HYBRID_THRESHOLD 3
|
||||
#define E0_HYBRID_THRESHOLD 30
|
||||
#define E0_HYBRID_THRESHOLD 150
|
||||
#define E1_HYBRID_THRESHOLD 30
|
||||
#define E2_HYBRID_THRESHOLD 30
|
||||
#define E3_HYBRID_THRESHOLD 30
|
||||
|
|
@ -2558,7 +2571,7 @@
|
|||
#define X2_STALL_SENSITIVITY X_STALL_SENSITIVITY
|
||||
#define Y_STALL_SENSITIVITY 8
|
||||
#define Y2_STALL_SENSITIVITY Y_STALL_SENSITIVITY
|
||||
//#define Z_STALL_SENSITIVITY 8
|
||||
#define Z_STALL_SENSITIVITY 8
|
||||
//#define Z2_STALL_SENSITIVITY Z_STALL_SENSITIVITY
|
||||
//#define Z3_STALL_SENSITIVITY Z_STALL_SENSITIVITY
|
||||
//#define Z4_STALL_SENSITIVITY Z_STALL_SENSITIVITY
|
||||
|
|
@ -2582,7 +2595,7 @@
|
|||
* Beta feature!
|
||||
* Create a 50/50 square wave step pulse optimal for stepper drivers.
|
||||
*/
|
||||
//#define SQUARE_WAVE_STEPPING
|
||||
#define SQUARE_WAVE_STEPPING
|
||||
|
||||
/**
|
||||
* Enable M122 debugging command for TMC stepper drivers.
|
||||
|
|
@ -2962,7 +2975,7 @@
|
|||
* This allows the laser to keep in perfect sync with the planner and removes
|
||||
* the powerup/down delay since lasers require negligible time.
|
||||
*/
|
||||
#define LASER_POWER_INLINE
|
||||
//#define LASER_POWER_INLINE
|
||||
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
/**
|
||||
|
|
@ -3381,6 +3394,25 @@
|
|||
//#define JOYSTICK_DEBUG
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Mechanical Gantry Calibration
|
||||
* Modern replacement for the Prusa TMC_Z_CALIBRATION.
|
||||
* Adds capability to work with any adjustable current drivers.
|
||||
* Implemented as G34 because M915 is deprecated.
|
||||
*/
|
||||
//#define MECHANICAL_GANTRY_CALIBRATION
|
||||
#if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
|
||||
#define GANTRY_CALIBRATION_CURRENT 600 // Default calibration current in ma
|
||||
#define GANTRY_CALIBRATION_EXTRA_HEIGHT 15 // Extra distance in mm past Z_###_POS to move
|
||||
#define GANTRY_CALIBRATION_FEEDRATE 500 // Feedrate for correction move
|
||||
//#define GANTRY_CALIBRATION_TO_MIN // Enable to calibrate Z in the MIN direction
|
||||
|
||||
//#define GANTRY_CALIBRATION_SAFE_POSITION { X_CENTER, Y_CENTER } // Safe position for nozzle
|
||||
//#define GANTRY_CALIBRATION_XY_PARK_FEEDRATE 3000 // XY Park Feedrate - MMM
|
||||
//#define GANTRY_CALIBRATION_COMMANDS_PRE ""
|
||||
#define GANTRY_CALIBRATION_COMMANDS_POST "G28" // G28 highly recommended to ensure an accurate position
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MAX7219 Debug Matrix
|
||||
*
|
||||
|
|
@ -3564,6 +3596,11 @@
|
|||
//
|
||||
//#define M100_FREE_MEMORY_WATCHER
|
||||
|
||||
//
|
||||
// M42 - Set pin states
|
||||
//
|
||||
//#define DIRECT_PIN_CONTROL
|
||||
|
||||
//
|
||||
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
|
||||
//
|
||||
|
|
|
|||
155
Marlin/Makefile
155
Marlin/Makefile
|
|
@ -22,8 +22,10 @@
|
|||
# (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
|
||||
# changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
|
||||
#
|
||||
# 3. Set the line containing "MCU" to match your board's processor.
|
||||
# Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
|
||||
# 3. Set the line containing "MCU" to match your board's processor. Set
|
||||
# "PROG_MCU" as the AVR part name corresponding to "MCU". You can use the
|
||||
# following command to get a list of correspondences: `avrdude -c alf -p x`
|
||||
# Older boards are atmega8 based, newer ones like Arduino Mini, Bluetooth
|
||||
# or Diecimila have the atmega168. If you're using a LilyPad Arduino,
|
||||
# change F_CPU to 8000000. If you are using Gen7 electronics, you
|
||||
# probably need to use 20000000. Either way, you must regenerate
|
||||
|
|
@ -34,18 +36,18 @@
|
|||
# 5. Type "make upload", reset your Arduino board, and press enter to
|
||||
# upload your program to the Arduino board.
|
||||
#
|
||||
# Note that all settings at the top of this file can be overriden from
|
||||
# Note that all settings at the top of this file can be overridden from
|
||||
# the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
|
||||
#
|
||||
# To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
|
||||
#
|
||||
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
||||
# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
|
||||
# HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino
|
||||
#
|
||||
# To compile and upload simply add "upload" to the end of the line...
|
||||
#
|
||||
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
||||
# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
|
||||
# HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino upload
|
||||
#
|
||||
# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
|
||||
# start upload manually (using stk500) like so:
|
||||
|
|
@ -57,7 +59,26 @@
|
|||
#
|
||||
|
||||
# This defines the board to compile for (see boards.h for your board's ID)
|
||||
HARDWARE_MOTHERBOARD ?= 11
|
||||
HARDWARE_MOTHERBOARD ?= 1020
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
# Windows
|
||||
ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
|
||||
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
# Linux
|
||||
ARDUINO_INSTALL_DIR ?= /usr/share/arduino
|
||||
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
# Darwin (macOS)
|
||||
ARDUINO_INSTALL_DIR ?= /Applications/Arduino.app/Contents/Java
|
||||
ARDUINO_USER_DIR ?= ${HOME}/Documents/Arduino
|
||||
AVR_TOOLS_PATH ?= /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/
|
||||
endif
|
||||
endif
|
||||
|
||||
# Arduino source install directory, and version number
|
||||
# On most linuxes this will be /usr/share/arduino
|
||||
|
|
@ -67,32 +88,38 @@ ARDUINO_VERSION ?= 106
|
|||
# The installed Libraries are in the User folder
|
||||
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||
|
||||
# You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
|
||||
# You can optionally set a path to the avr-gcc tools.
|
||||
# Requires a trailing slash. For example, /usr/local/avr-gcc/bin/
|
||||
AVR_TOOLS_PATH ?=
|
||||
|
||||
# Programmer configuration
|
||||
UPLOAD_RATE ?= 57600
|
||||
AVRDUDE_PROGRAMMER ?= arduino
|
||||
# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
|
||||
# On most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
|
||||
UPLOAD_PORT ?= /dev/ttyUSB0
|
||||
|
||||
#Directory used to build files in, contains all the build files, from object files to the final hex file
|
||||
#on linux it is best to put an absolute path like /home/username/tmp .
|
||||
# Directory used to build files in, contains all the build files, from object
|
||||
# files to the final hex file on linux it is best to put an absolute path
|
||||
# like /home/username/tmp .
|
||||
BUILD_DIR ?= applet
|
||||
|
||||
# This defines whether Liquid_TWI2 support will be built
|
||||
LIQUID_TWI2 ?= 0
|
||||
|
||||
# this defines if Wire is needed
|
||||
# This defines if Wire is needed
|
||||
WIRE ?= 0
|
||||
|
||||
# this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
|
||||
U8GLIB ?= 1
|
||||
# This defines if Tone is needed (i.e SPEAKER is defined in Configuration.h)
|
||||
# Disabling this (and SPEAKER) saves approximatively 350 bytes of memory.
|
||||
TONE ?= 1
|
||||
|
||||
# this defines whether to include the Trinamic TMCStepper library
|
||||
TMC ?= 1
|
||||
# This defines if U8GLIB is needed (may require RELOC_WORKAROUND)
|
||||
U8GLIB ?= 0
|
||||
|
||||
# this defines whether to include the AdaFruit NeoPixel library
|
||||
# This defines whether to include the Trinamic TMCStepper library
|
||||
TMC ?= 0
|
||||
|
||||
# This defines whether to include the AdaFruit NeoPixel library
|
||||
NEOPIXEL ?= 0
|
||||
|
||||
############
|
||||
|
|
@ -209,6 +236,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1120)
|
|||
# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1121)
|
||||
MCU ?= atmega1280
|
||||
PROG_MCU ?= m1280
|
||||
|
||||
# Azteeg X3
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1122)
|
||||
|
|
@ -350,9 +378,11 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1320)
|
|||
# Minitronics v1.0/1.1
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1400)
|
||||
MCU ?= atmega1281
|
||||
PROG_MCU ?= m1281
|
||||
# Silvergate v1.0
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1401)
|
||||
MCU ?= atmega1281
|
||||
PROG_MCU ?= m1281
|
||||
|
||||
#
|
||||
# Sanguinololu and Derivatives - ATmega644P, ATmega1284P
|
||||
|
|
@ -362,46 +392,57 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1401)
|
|||
else ifeq ($(HARDWARE_MOTHERBOARD),1500)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
# Sanguinololu 1.2 and above
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1501)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
# Melzi
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1502)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
# Melzi V2.0
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1503)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
# Melzi with ATmega1284 (MaKr3d version)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1504)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
# Melzi Creality3D board (for CR-10 etc)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1505)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
# Melzi Malyan M150 board
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1506)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
# Tronxy X5S
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1507)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
# STB V1.1
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1508)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
# Azteeg X1
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1509)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
# Anet 1.0 (Melzi clone)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1510)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
|
||||
#
|
||||
# Other ATmega644P, ATmega644, ATmega1284P
|
||||
|
|
@ -411,50 +452,61 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1510)
|
|||
else ifeq ($(HARDWARE_MOTHERBOARD),1600)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
# Gen3+
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1601)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
# Gen6
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1602)
|
||||
HARDWARE_VARIANT ?= Gen6
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
# Gen6 deluxe
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1603)
|
||||
HARDWARE_VARIANT ?= Gen6
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
# Gen7 custom (Alfons3 Version)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1604)
|
||||
HARDWARE_VARIANT ?= Gen7
|
||||
MCU ?= atmega644
|
||||
PROG_MCU ?= m644
|
||||
F_CPU ?= 20000000
|
||||
# Gen7 v1.1, v1.2
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1605)
|
||||
HARDWARE_VARIANT ?= Gen7
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
F_CPU ?= 20000000
|
||||
# Gen7 v1.3
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1606)
|
||||
HARDWARE_VARIANT ?= Gen7
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
F_CPU ?= 20000000
|
||||
# Gen7 v1.4
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1607)
|
||||
HARDWARE_VARIANT ?= Gen7
|
||||
MCU ?= atmega1284p
|
||||
PROG_MCU ?= m1284p
|
||||
F_CPU ?= 20000000
|
||||
# Alpha OMCA board
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1608)
|
||||
HARDWARE_VARIANT ?= SanguinoA
|
||||
MCU ?= atmega644
|
||||
PROG_MCU ?= m644
|
||||
# Final OMCA board
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1609)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
# Sethi 3D_1
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1610)
|
||||
HARDWARE_VARIANT ?= Sanguino
|
||||
MCU ?= atmega644p
|
||||
PROG_MCU ?= m644p
|
||||
|
||||
#
|
||||
# Teensyduino - AT90USB1286, AT90USB1286P
|
||||
|
|
@ -464,51 +516,60 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1610)
|
|||
else ifeq ($(HARDWARE_MOTHERBOARD),1700)
|
||||
HARDWARE_VARIANT ?= Teensy
|
||||
MCU ?= at90usb1286
|
||||
PROG_MCU ?= usb1286
|
||||
# Printrboard (AT90USB1286)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1701)
|
||||
HARDWARE_VARIANT ?= Teensy
|
||||
MCU ?= at90usb1286
|
||||
PROG_MCU ?= usb1286
|
||||
# Printrboard Revision F (AT90USB1286)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1702)
|
||||
HARDWARE_VARIANT ?= Teensy
|
||||
MCU ?= at90usb1286
|
||||
PROG_MCU ?= usb1286
|
||||
# Brainwave (AT90USB646)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1703)
|
||||
HARDWARE_VARIANT ?= Teensy
|
||||
MCU ?= at90usb646
|
||||
PROG_MCU ?= usb646
|
||||
# Brainwave Pro (AT90USB1286)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1704)
|
||||
HARDWARE_VARIANT ?= Teensy
|
||||
MCU ?= at90usb1286
|
||||
PROG_MCU ?= usb1286
|
||||
# SAV Mk-I (AT90USB1286)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1705)
|
||||
HARDWARE_VARIANT ?= Teensy
|
||||
MCU ?= at90usb1286
|
||||
PROG_MCU ?= usb1286
|
||||
# Teensy++2.0 (AT90USB1286)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1706)
|
||||
HARDWARE_VARIANT ?= Teensy
|
||||
MCU ?= at90usb1286
|
||||
PROG_MCU ?= usb1286
|
||||
# 5DPrint D8 Driver Board
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1707)
|
||||
HARDWARE_VARIANT ?= Teensy
|
||||
MCU ?= at90usb1286
|
||||
PROG_MCU ?= usb1286
|
||||
|
||||
# UltiMachine Archim1 (with DRV8825 drivers)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),3023)
|
||||
HARDWARE_VARIANT ?= archim
|
||||
MCPU = cortex-m3
|
||||
F_CPU = 84000000L
|
||||
F_CPU = 84000000
|
||||
IS_MCU = 0
|
||||
# UltiMachine Archim2 (with TMC2130 drivers)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),3024)
|
||||
HARDWARE_VARIANT ?= archim
|
||||
MCPU = cortex-m3
|
||||
F_CPU = 84000000L
|
||||
F_CPU = 84000000
|
||||
IS_MCU = 0
|
||||
endif
|
||||
|
||||
# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
|
||||
# if you are setting this to something other than 16MHz
|
||||
# Do not put the UL suffix, it's done later on.
|
||||
# Set to 16Mhz if not yet set.
|
||||
F_CPU ?= 16000000
|
||||
|
||||
|
|
@ -519,6 +580,7 @@ ifeq ($(IS_MCU),1)
|
|||
# Set to arduino, ATmega2560 if not yet set.
|
||||
HARDWARE_VARIANT ?= arduino
|
||||
MCU ?= atmega2560
|
||||
PROG_MCU ?= m2560
|
||||
|
||||
TOOL_PREFIX = avr
|
||||
MCU_FLAGS = -mmcu=$(MCU)
|
||||
|
|
@ -549,27 +611,36 @@ VPATH += $(BUILD_DIR)
|
|||
VPATH += $(HARDWARE_SRC)
|
||||
|
||||
ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
|
||||
# Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
||||
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
||||
endif
|
||||
|
||||
ifeq ($(IS_MCU),1)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
|
||||
|
||||
# Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial
|
||||
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
|
||||
endif
|
||||
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
|
||||
|
||||
ifeq ($(LIQUID_TWI2), 1)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
|
||||
WIRE = 1
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
|
||||
endif
|
||||
ifeq ($(WIRE), 1)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
|
||||
# Old libraries (avr-core 1.6.21 / Arduino < 1.6.8)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/utility
|
||||
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src/utility
|
||||
endif
|
||||
ifeq ($(NEOPIXEL), 1)
|
||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
|
||||
|
|
@ -641,13 +712,23 @@ ifeq ($(WIRE), 1)
|
|||
LIB_CXXSRC += Wire.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(TONE), 1)
|
||||
LIB_CXXSRC += Tone.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(U8GLIB), 1)
|
||||
LIB_CXXSRC += U8glib.cpp
|
||||
LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
|
||||
LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c \
|
||||
u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c \
|
||||
u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
|
||||
endif
|
||||
|
||||
ifeq ($(TMC), 1)
|
||||
LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
|
||||
LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp \
|
||||
CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp \
|
||||
DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp \
|
||||
SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp \
|
||||
TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(RELOC_WORKAROUND), 1)
|
||||
|
|
@ -689,7 +770,7 @@ REMOVE = rm -f
|
|||
MV = mv -f
|
||||
|
||||
# Place -D or -U options here
|
||||
CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
|
||||
CDEFS = -DF_CPU=$(F_CPU)UL ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
|
||||
CXXDEFS = $(CDEFS)
|
||||
|
||||
ifeq ($(HARDWARE_VARIANT), Teensy)
|
||||
|
|
@ -698,8 +779,14 @@ ifeq ($(HARDWARE_VARIANT), Teensy)
|
|||
LIB_CXXSRC += usb_api.cpp
|
||||
|
||||
else ifeq ($(HARDWARE_VARIANT), archim)
|
||||
CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
|
||||
LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp
|
||||
CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__
|
||||
CDEFS += -DUSB_VID=0x27B1 -DUSB_PID=0x0001 -DUSBCON
|
||||
CDEFS += '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
|
||||
|
||||
LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp \
|
||||
UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp \
|
||||
PluggableUSB.cpp USBCore.cpp
|
||||
|
||||
LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
|
||||
|
||||
ifeq ($(U8GLIB), 1)
|
||||
|
|
@ -725,16 +812,20 @@ CTUNING = -fsigned-char -funsigned-bitfields -fno-exceptions \
|
|||
ifneq ($(HARDWARE_MOTHERBOARD),)
|
||||
CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
|
||||
endif
|
||||
|
||||
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
||||
CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
|
||||
CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
|
||||
CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
|
||||
ASFLAGS := $(CDEFS)
|
||||
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
||||
|
||||
ifeq ($(HARDWARE_VARIANT), archim)
|
||||
LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
|
||||
LD_SUFFIX = $(LDLIBS)
|
||||
LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
|
||||
|
||||
LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty
|
||||
LDFLAGS += -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
|
||||
else
|
||||
LD_PREFIX = -Wl,--gc-sections,--relax
|
||||
LDFLAGS = -lm
|
||||
|
|
@ -750,7 +841,7 @@ else
|
|||
AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
|
||||
endif
|
||||
AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
|
||||
-p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
|
||||
-p$(PROG_MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
|
||||
-b$(UPLOAD_RATE)
|
||||
|
||||
# Since Marlin 2.0, the source files may be distributed into several
|
||||
|
|
@ -865,7 +956,7 @@ extcoff: $(TARGET).elf
|
|||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
|
||||
$(Pecho) " CXX $@"
|
||||
$P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
|
||||
$P $(CXX) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
|
||||
|
||||
# Object files that were found in "src" will be stored in $(BUILD_DIR)
|
||||
# in directories that mirror the structure of "src"
|
||||
|
|
|
|||
|
|
@ -120,6 +120,8 @@ void HAL_init();
|
|||
inline void HAL_clear_reset_source() { MCUSR = 0; }
|
||||
inline uint8_t HAL_get_reset_source() { return MCUSR; }
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ void set_pwm_frequency(const pin_t pin, int f_desired) {
|
|||
res_temp_phase_correct = rtf / 2;
|
||||
}
|
||||
|
||||
LIMIT(res_temp_fast, 1u, size);
|
||||
LIMIT(res_temp_phase_correct, 1u, size);
|
||||
LIMIT(res_temp_fast, 1U, size);
|
||||
LIMIT(res_temp_phase_correct, 1U, size);
|
||||
// Calculate frequencies of test prescaler and resolution values
|
||||
const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)),
|
||||
f_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct),
|
||||
|
|
|
|||
|
|
@ -105,13 +105,15 @@ void sei(); // Enable interrupts
|
|||
void HAL_clear_reset_source(); // clear reset reason
|
||||
uint8_t HAL_get_reset_source(); // get reset reason
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
//
|
||||
// ADC
|
||||
//
|
||||
extern uint16_t HAL_adc_result; // result of last ADC conversion
|
||||
|
||||
#ifndef analogInputToDigitalPin
|
||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
||||
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||
#endif
|
||||
|
||||
#define HAL_ANALOG_SELECT(ch)
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
|
|||
}
|
||||
|
||||
#if ENABLED(LIGHTWEIGHT_UI)
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#include "../../shared/HAL_ST7920.h"
|
||||
|
||||
#define ST7920_CS_PIN LCD_PINS_RS
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
#define EEPROMSize 4096
|
||||
#define PagesPerGroup 128
|
||||
#define GroupCount 2
|
||||
#define PageSize 256u
|
||||
#define PageSize 256U
|
||||
|
||||
/* Flash storage */
|
||||
typedef struct FLASH_SECTOR {
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ void Stepper::digipot_init() {
|
|||
NVIC_SetPriority(PWM_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module (can stand some jitter on the Vref signals)
|
||||
}
|
||||
|
||||
void Stepper::digipot_current(const uint8_t driver, const int16_t current) {
|
||||
void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) {
|
||||
|
||||
if (!(PWM->PWM_CH_NUM[0].PWM_CPRD == PWM_PERIOD_US)) digipot_init(); // Init PWM system if needed
|
||||
|
||||
|
|
|
|||
|
|
@ -609,37 +609,37 @@ typedef struct
|
|||
# define clz(u) ((u) ? __CLZ(u) : 32)
|
||||
#else
|
||||
# define clz(u) (((u) == 0) ? 32 : \
|
||||
((u) & (1ul << 31)) ? 0 : \
|
||||
((u) & (1ul << 30)) ? 1 : \
|
||||
((u) & (1ul << 29)) ? 2 : \
|
||||
((u) & (1ul << 28)) ? 3 : \
|
||||
((u) & (1ul << 27)) ? 4 : \
|
||||
((u) & (1ul << 26)) ? 5 : \
|
||||
((u) & (1ul << 25)) ? 6 : \
|
||||
((u) & (1ul << 24)) ? 7 : \
|
||||
((u) & (1ul << 23)) ? 8 : \
|
||||
((u) & (1ul << 22)) ? 9 : \
|
||||
((u) & (1ul << 21)) ? 10 : \
|
||||
((u) & (1ul << 20)) ? 11 : \
|
||||
((u) & (1ul << 19)) ? 12 : \
|
||||
((u) & (1ul << 18)) ? 13 : \
|
||||
((u) & (1ul << 17)) ? 14 : \
|
||||
((u) & (1ul << 16)) ? 15 : \
|
||||
((u) & (1ul << 15)) ? 16 : \
|
||||
((u) & (1ul << 14)) ? 17 : \
|
||||
((u) & (1ul << 13)) ? 18 : \
|
||||
((u) & (1ul << 12)) ? 19 : \
|
||||
((u) & (1ul << 11)) ? 20 : \
|
||||
((u) & (1ul << 10)) ? 21 : \
|
||||
((u) & (1ul << 9)) ? 22 : \
|
||||
((u) & (1ul << 8)) ? 23 : \
|
||||
((u) & (1ul << 7)) ? 24 : \
|
||||
((u) & (1ul << 6)) ? 25 : \
|
||||
((u) & (1ul << 5)) ? 26 : \
|
||||
((u) & (1ul << 4)) ? 27 : \
|
||||
((u) & (1ul << 3)) ? 28 : \
|
||||
((u) & (1ul << 2)) ? 29 : \
|
||||
((u) & (1ul << 1)) ? 30 : \
|
||||
((u) & (1UL << 31)) ? 0 : \
|
||||
((u) & (1UL << 30)) ? 1 : \
|
||||
((u) & (1UL << 29)) ? 2 : \
|
||||
((u) & (1UL << 28)) ? 3 : \
|
||||
((u) & (1UL << 27)) ? 4 : \
|
||||
((u) & (1UL << 26)) ? 5 : \
|
||||
((u) & (1UL << 25)) ? 6 : \
|
||||
((u) & (1UL << 24)) ? 7 : \
|
||||
((u) & (1UL << 23)) ? 8 : \
|
||||
((u) & (1UL << 22)) ? 9 : \
|
||||
((u) & (1UL << 21)) ? 10 : \
|
||||
((u) & (1UL << 20)) ? 11 : \
|
||||
((u) & (1UL << 19)) ? 12 : \
|
||||
((u) & (1UL << 18)) ? 13 : \
|
||||
((u) & (1UL << 17)) ? 14 : \
|
||||
((u) & (1UL << 16)) ? 15 : \
|
||||
((u) & (1UL << 15)) ? 16 : \
|
||||
((u) & (1UL << 14)) ? 17 : \
|
||||
((u) & (1UL << 13)) ? 18 : \
|
||||
((u) & (1UL << 12)) ? 19 : \
|
||||
((u) & (1UL << 11)) ? 20 : \
|
||||
((u) & (1UL << 10)) ? 21 : \
|
||||
((u) & (1UL << 9)) ? 22 : \
|
||||
((u) & (1UL << 8)) ? 23 : \
|
||||
((u) & (1UL << 7)) ? 24 : \
|
||||
((u) & (1UL << 6)) ? 25 : \
|
||||
((u) & (1UL << 5)) ? 26 : \
|
||||
((u) & (1UL << 4)) ? 27 : \
|
||||
((u) & (1UL << 3)) ? 28 : \
|
||||
((u) & (1UL << 2)) ? 29 : \
|
||||
((u) & (1UL << 1)) ? 30 : \
|
||||
31)
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -654,38 +654,38 @@ typedef struct
|
|||
#if (defined __GNUC__) || (defined __CC_ARM)
|
||||
# define ctz(u) ((u) ? __builtin_ctz(u) : 32)
|
||||
#else
|
||||
# define ctz(u) ((u) & (1ul << 0) ? 0 : \
|
||||
(u) & (1ul << 1) ? 1 : \
|
||||
(u) & (1ul << 2) ? 2 : \
|
||||
(u) & (1ul << 3) ? 3 : \
|
||||
(u) & (1ul << 4) ? 4 : \
|
||||
(u) & (1ul << 5) ? 5 : \
|
||||
(u) & (1ul << 6) ? 6 : \
|
||||
(u) & (1ul << 7) ? 7 : \
|
||||
(u) & (1ul << 8) ? 8 : \
|
||||
(u) & (1ul << 9) ? 9 : \
|
||||
(u) & (1ul << 10) ? 10 : \
|
||||
(u) & (1ul << 11) ? 11 : \
|
||||
(u) & (1ul << 12) ? 12 : \
|
||||
(u) & (1ul << 13) ? 13 : \
|
||||
(u) & (1ul << 14) ? 14 : \
|
||||
(u) & (1ul << 15) ? 15 : \
|
||||
(u) & (1ul << 16) ? 16 : \
|
||||
(u) & (1ul << 17) ? 17 : \
|
||||
(u) & (1ul << 18) ? 18 : \
|
||||
(u) & (1ul << 19) ? 19 : \
|
||||
(u) & (1ul << 20) ? 20 : \
|
||||
(u) & (1ul << 21) ? 21 : \
|
||||
(u) & (1ul << 22) ? 22 : \
|
||||
(u) & (1ul << 23) ? 23 : \
|
||||
(u) & (1ul << 24) ? 24 : \
|
||||
(u) & (1ul << 25) ? 25 : \
|
||||
(u) & (1ul << 26) ? 26 : \
|
||||
(u) & (1ul << 27) ? 27 : \
|
||||
(u) & (1ul << 28) ? 28 : \
|
||||
(u) & (1ul << 29) ? 29 : \
|
||||
(u) & (1ul << 30) ? 30 : \
|
||||
(u) & (1ul << 31) ? 31 : \
|
||||
# define ctz(u) ((u) & (1UL << 0) ? 0 : \
|
||||
(u) & (1UL << 1) ? 1 : \
|
||||
(u) & (1UL << 2) ? 2 : \
|
||||
(u) & (1UL << 3) ? 3 : \
|
||||
(u) & (1UL << 4) ? 4 : \
|
||||
(u) & (1UL << 5) ? 5 : \
|
||||
(u) & (1UL << 6) ? 6 : \
|
||||
(u) & (1UL << 7) ? 7 : \
|
||||
(u) & (1UL << 8) ? 8 : \
|
||||
(u) & (1UL << 9) ? 9 : \
|
||||
(u) & (1UL << 10) ? 10 : \
|
||||
(u) & (1UL << 11) ? 11 : \
|
||||
(u) & (1UL << 12) ? 12 : \
|
||||
(u) & (1UL << 13) ? 13 : \
|
||||
(u) & (1UL << 14) ? 14 : \
|
||||
(u) & (1UL << 15) ? 15 : \
|
||||
(u) & (1UL << 16) ? 16 : \
|
||||
(u) & (1UL << 17) ? 17 : \
|
||||
(u) & (1UL << 18) ? 18 : \
|
||||
(u) & (1UL << 19) ? 19 : \
|
||||
(u) & (1UL << 20) ? 20 : \
|
||||
(u) & (1UL << 21) ? 21 : \
|
||||
(u) & (1UL << 22) ? 22 : \
|
||||
(u) & (1UL << 23) ? 23 : \
|
||||
(u) & (1UL << 24) ? 24 : \
|
||||
(u) & (1UL << 25) ? 25 : \
|
||||
(u) & (1UL << 26) ? 26 : \
|
||||
(u) & (1UL << 27) ? 27 : \
|
||||
(u) & (1UL << 28) ? 28 : \
|
||||
(u) & (1UL << 29) ? 29 : \
|
||||
(u) & (1UL << 30) ? 30 : \
|
||||
(u) & (1UL << 31) ? 31 : \
|
||||
32)
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ void HAL_clear_reset_source();
|
|||
// reset reason
|
||||
uint8_t HAL_get_reset_source();
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
void _delay_ms(int delay);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
|
@ -155,14 +157,14 @@ FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
|
|||
|
||||
if (stop >= start) {
|
||||
// no overflow, so only loop while in between start and stop:
|
||||
// 0x00000000 -----------------start****stop-- 0xffffffff
|
||||
// 0x00000000 -----------------start****stop-- 0xFFFFFFFF
|
||||
while (ccount >= start && ccount < stop) {
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
// stop did overflow, so only loop while outside of stop and start:
|
||||
// 0x00000000 **stop-------------------start** 0xffffffff
|
||||
// 0x00000000 **stop-------------------start** 0xFFFFFFFF
|
||||
while (ccount >= start || ccount < stop) {
|
||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
||||
|
||||
#ifndef I2C_ADDRESS
|
||||
#define I2C_ADDRESS(A) (A)
|
||||
#define I2C_ADDRESS(A) uint8_t(A)
|
||||
#endif
|
||||
|
||||
// Needed for AVR sprintf_P PROGMEM extension
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ uint16_t HAL_adc_get_result();
|
|||
inline void HAL_clear_reset_source(void) {}
|
||||
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
/* ---------------- Delay in cycles */
|
||||
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
|
||||
Clock::delayCycles(x);
|
||||
|
|
|
|||
|
|
@ -200,6 +200,8 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255,
|
|||
void HAL_clear_reset_source(void);
|
||||
uint8_t HAL_get_reset_source(void);
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
// Add strcmp_P if missing
|
||||
#ifndef strcmp_P
|
||||
#define strcmp_P(a, b) strcmp((a), (b))
|
||||
|
|
|
|||
|
|
@ -24,10 +24,3 @@
|
|||
#if HAS_FSMC_TFT
|
||||
#error "Sorry! FSMC TFT displays are not current available for HAL/LPC1768."
|
||||
#endif
|
||||
|
||||
// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
|
||||
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
|
||||
#undef TOUCH_SCREEN
|
||||
#undef TOUCH_SCREEN_CALIBRATION
|
||||
#define HAS_TOUCH_XPT2046 1
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static_assert(!(NUM_SERVOS && ENABLED(FAST_PWM_FAN)), "BLTOUCH and Servos are in
|
|||
//#endif
|
||||
|
||||
#if MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF)
|
||||
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
|
||||
#if IS_RRD_FG_SC && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
|
||||
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 requires TMC_USE_SW_SPI."
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -191,7 +191,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
|||
//
|
||||
// Flag any i2c pin conflicts
|
||||
//
|
||||
#if ANY(HAS_I2C_DIGIPOT, DAC_STEPPER_CURRENT, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
|
||||
#if ANY(HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
|
||||
#define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp
|
||||
|
||||
#if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#define DATASIZE_8BIT SSP_DATABIT_8
|
||||
#define DATASIZE_16BIT SSP_DATABIT_16
|
||||
#define TFT_IO TFT_SPI
|
||||
#define TFT_IO_DRIVER TFT_SPI
|
||||
|
||||
#define DMA_MINC_ENABLE 1
|
||||
#define DMA_MINC_DISABLE 0
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@
|
|||
|
||||
// MYSERIAL0 required before MarlinSerial includes!
|
||||
|
||||
#define _MSERIAL(X) Serial##X
|
||||
#define __MSERIAL(X) Serial##X
|
||||
#define _MSERIAL(X) __MSERIAL(X)
|
||||
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
||||
|
||||
#if SERIAL_PORT == -1
|
||||
|
|
@ -88,6 +89,8 @@ typedef int8_t pin_t;
|
|||
void HAL_clear_reset_source(); // clear reset reason
|
||||
uint8_t HAL_get_reset_source(); // get reset reason
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
//
|
||||
// ADC
|
||||
//
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "QSPIFlash.h"
|
||||
|
||||
#define INVALID_ADDR 0xffffffff
|
||||
#define INVALID_ADDR 0xFFFFFFFF
|
||||
#define SECTOR_OF(a) (a & ~(SFLASH_SECTOR_SIZE - 1))
|
||||
#define OFFSET_OF(a) (a & (SFLASH_SECTOR_SIZE - 1))
|
||||
|
||||
|
|
|
|||
|
|
@ -134,6 +134,8 @@ void HAL_clear_reset_source();
|
|||
// Reset reason
|
||||
uint8_t HAL_get_reset_source();
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
extern "C" char* _sbrk(int incr);
|
||||
|
|
|
|||
|
|
@ -51,19 +51,19 @@ void FastIO_init(); // Must be called before using fast io macros
|
|||
|
||||
#if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
|
||||
#define _WRITE(IO, V) do { \
|
||||
if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \
|
||||
else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(STM_PIN(digitalPin[IO])) ; \
|
||||
if (V) FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BSRR = _BV32(STM_PIN(digitalPinToPinName(IO))) ; \
|
||||
else FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BRR = _BV32(STM_PIN(digitalPinToPinName(IO))) ; \
|
||||
}while(0)
|
||||
#else
|
||||
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + ((V) ? 0 : 16)))
|
||||
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BSRR = _BV32(STM_PIN(digitalPinToPinName(IO)) + ((V) ? 0 : 16)))
|
||||
#endif
|
||||
|
||||
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(STM_PIN(digitalPin[IO]))))
|
||||
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(STM_PIN(digitalPin[IO])))
|
||||
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->IDR, _BV32(STM_PIN(digitalPinToPinName(IO)))))
|
||||
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->ODR ^= _BV32(STM_PIN(digitalPinToPinName(IO))))
|
||||
|
||||
#define _GET_MODE(IO)
|
||||
#define _SET_MODE(IO,M) pinMode(IO, M)
|
||||
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */
|
||||
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) //!< Output Push Pull Mode & GPIO_NOPULL
|
||||
#define _SET_OUTPUT_OD(IO) pinMode(IO, OUTPUT_OPEN_DRAIN)
|
||||
|
||||
#define WRITE(IO,V) _WRITE(IO,V)
|
||||
|
|
@ -73,9 +73,9 @@ void FastIO_init(); // Must be called before using fast io macros
|
|||
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
||||
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
|
||||
|
||||
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
|
||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
|
||||
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) //!< Input Floating Mode
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) //!< Input with Pull-up activation
|
||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) //!< Input with Pull-down activation
|
||||
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
||||
#define SET_PWM(IO) _SET_MODE(IO, PWM)
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@
|
|||
* It contains:
|
||||
* - name of the signal
|
||||
* - the Ard_num assigned by the pins_YOUR_BOARD.h file using the platform defines.
|
||||
* EXAMPLE: "#define KILL_PIN PB1" results in Ard_num of 57. 57 is then used as an
|
||||
* index into digitalPin[] to get the Port_pin number
|
||||
* EXAMPLE: "#define KILL_PIN PB1" results in Ard_num of 57. 57 is then used as the
|
||||
* argument to digitalPinToPinName(IO) to get the Port_pin number
|
||||
* - if it is a digital or analog signal. PWMs are considered digital here.
|
||||
*
|
||||
* pin_xref is a structure generated by this header file. It is generated by the
|
||||
|
|
@ -68,8 +68,6 @@
|
|||
* signal. The Arduino pin number is listed by the M43 I command.
|
||||
*/
|
||||
|
||||
extern const PinName digitalPin[]; // provided by the platform
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// make a list of the Arduino pin numbers in the Port/Pin order
|
||||
|
|
@ -137,7 +135,7 @@ const XrefInfo pin_xref[] PROGMEM = {
|
|||
|
||||
uint8_t get_pin_mode(const pin_t Ard_num) {
|
||||
uint32_t mode_all = 0;
|
||||
const PinName dp = digitalPin[Ard_num];
|
||||
const PinName dp = digitalPinToPinName(Ard_num);
|
||||
switch (PORT_ALPHA(dp)) {
|
||||
case 'A' : mode_all = GPIOA->MODER; break;
|
||||
case 'B' : mode_all = GPIOB->MODER; break;
|
||||
|
|
@ -218,7 +216,7 @@ bool pwm_status(const pin_t Ard_num) {
|
|||
void pwm_details(const pin_t Ard_num) {
|
||||
if (pwm_status(Ard_num)) {
|
||||
uint32_t alt_all = 0;
|
||||
const PinName dp = digitalPin[Ard_num];
|
||||
const PinName dp = digitalPinToPinName(Ard_num);
|
||||
pin_t pin_number = uint8_t(PIN_NUM(dp));
|
||||
const bool over_7 = pin_number >= 8;
|
||||
const uint8_t ind = over_7 ? 1 : 0;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
|
||||
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
||||
#define TFT_IO TFT_FSMC
|
||||
#define TFT_IO_DRIVER TFT_FSMC
|
||||
|
||||
#ifdef STM32F1xx
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
|
||||
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
||||
#define TFT_IO TFT_SPI
|
||||
#define TFT_IO_DRIVER TFT_SPI
|
||||
|
||||
class TFT_SPI {
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,11 @@
|
|||
#include "watchdog.h"
|
||||
#include <IWatchdog.h>
|
||||
|
||||
void watchdog_init() { IWatchdog.begin(4000000); } // 4 sec timeout
|
||||
void watchdog_init() {
|
||||
#if DISABLED(DISABLE_WATCHDOG_INIT)
|
||||
IWatchdog.begin(4000000); // 4 sec timeout
|
||||
#endif
|
||||
}
|
||||
|
||||
void HAL_watchdog_refresh() {
|
||||
IWatchdog.reload();
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ const uint8_t adc_pins[] = {
|
|||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH_PIN,
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
#if HAS_ADC_BUTTONS
|
||||
ADC_KEYPAD_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
|
|
@ -187,7 +187,7 @@ enum TempPinIndex : char {
|
|||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH,
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
#if HAS_ADC_BUTTONS
|
||||
ADC_KEY,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
|
|
@ -389,7 +389,7 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
|||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
case FILWIDTH_PIN: pin_index = FILWIDTH; break;
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
#if HAS_ADC_BUTTONS
|
||||
case ADC_KEYPAD_PIN: pin_index = ADC_KEY; break;
|
||||
#endif
|
||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||
|
|
|
|||
|
|
@ -185,6 +185,8 @@ void HAL_clear_reset_source();
|
|||
// Reset reason
|
||||
uint8_t HAL_get_reset_source();
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void spiInit(uint8_t spiRate) {
|
|||
* @details
|
||||
*/
|
||||
uint8_t spiRec() {
|
||||
uint8_t returnByte = SPI.transfer(ff);
|
||||
uint8_t returnByte = SPI.transfer(0xFF);
|
||||
return returnByte;
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
|||
#if ENABLED(SPI_EEPROM)
|
||||
|
||||
// Read single byte from specified SPI channel
|
||||
uint8_t spiRec(uint32_t chan) { return SPI.transfer(ff); }
|
||||
uint8_t spiRec(uint32_t chan) { return SPI.transfer(0xFF); }
|
||||
|
||||
// Write single byte to specified SPI channel
|
||||
void spiSend(uint32_t chan, byte b) { SPI.send(b); }
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
|
||||
|
||||
#include "../HAL.h"
|
||||
#include <U8glib.h>
|
||||
|
||||
#undef SPI_SPEED
|
||||
|
|
@ -161,5 +160,5 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
|||
return 1;
|
||||
}
|
||||
|
||||
#endif // HAS_MARLINUI_U8GLIB
|
||||
#endif // HAS_MARLINUI_U8GLIB && FORCE_SOFT_SPI
|
||||
#endif // STM32F1
|
||||
|
|
|
|||
|
|
@ -25,10 +25,3 @@
|
|||
//#warning "SD_CHECK_AND_RETRY isn't needed with USE_USB_COMPOSITE."
|
||||
#undef SD_CHECK_AND_RETRY
|
||||
#endif
|
||||
|
||||
// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
|
||||
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
|
||||
#undef TOUCH_SCREEN
|
||||
#undef TOUCH_SCREEN_CALIBRATION
|
||||
#define HAS_TOUCH_XPT2046 1
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,3 +51,10 @@
|
|||
#if ENABLED(NEOPIXEL_LED)
|
||||
#error "NEOPIXEL_LED (Adafruit NeoPixel) is not supported for HAL/STM32F1. Comment out this line to proceed at your own risk!"
|
||||
#endif
|
||||
|
||||
// Emergency Parser needs at least one serial with HardwareSerial or USBComposite.
|
||||
// The USBSerial maple don't allow any hook to implement EMERGENCY_PARSER.
|
||||
// And copy all USBSerial code to marlin space to support EMERGENCY_PARSER, when we have another options, don't worth it.
|
||||
#if ENABLED(EMERGENCY_PARSER) && !defined(USE_USB_COMPOSITE) && ((SERIAL_PORT == -1 && !defined(SERIAL_PORT_2)) || (SERIAL_PORT_2 == -1 && !defined(SERIAL_PORT)))
|
||||
#error "EMERGENCY_PARSER is only supported by HardwareSerial or USBComposite in HAL/STM32F1."
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -89,25 +89,12 @@ void TFT_FSMC::Init() {
|
|||
uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN;
|
||||
uint32_t controllerAddress;
|
||||
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
OUT_WRITE(TFT_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT));
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_USE_DMA_FSMC)
|
||||
dma_init(FSMC_DMA_DEV);
|
||||
dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
||||
dma_set_priority(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, DMA_PRIORITY_MEDIUM);
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(TFT_RESET)
|
||||
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||
delay(100);
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
struct fsmc_nor_psram_reg_map* fsmcPsramRegion;
|
||||
|
||||
if (fsmcInit) return;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#define DATASIZE_8BIT DMA_SIZE_8BITS
|
||||
#define DATASIZE_16BIT DMA_SIZE_16BITS
|
||||
#define TFT_IO TFT_FSMC
|
||||
#define TFT_IO_DRIVER TFT_FSMC
|
||||
|
||||
typedef struct {
|
||||
__IO uint16_t REG;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#define DATASIZE_8BIT DATA_SIZE_8BIT
|
||||
#define DATASIZE_16BIT DATA_SIZE_16BIT
|
||||
#define TFT_IO TFT_SPI
|
||||
#define TFT_IO_DRIVER TFT_SPI
|
||||
|
||||
#define DMA_MINC_ENABLE 1
|
||||
#define DMA_MINC_DISABLE 0
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ void watchdogSetup() {
|
|||
* @details The watchdog clock is 40Khz. We need a 4 seconds interval, so use a /256 preescaler and 625 reload value (counts down to 0)
|
||||
*/
|
||||
void watchdog_init() {
|
||||
//iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
|
||||
#if DISABLED(DISABLE_WATCHDOG_INIT)
|
||||
iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // USE_WATCHDOG
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ void HAL_clear_reset_source();
|
|||
// Reset reason
|
||||
uint8_t HAL_get_reset_source();
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@
|
|||
#define DEFAULT_MICROSTEPPING_VALUE 32
|
||||
|
||||
//TMC26X register definitions
|
||||
#define DRIVER_CONTROL_REGISTER 0x0ul
|
||||
#define CHOPPER_CONFIG_REGISTER 0x80000ul
|
||||
#define DRIVER_CONTROL_REGISTER 0x0UL
|
||||
#define CHOPPER_CONFIG_REGISTER 0x80000UL
|
||||
#define COOL_STEP_REGISTER 0xA0000ul
|
||||
#define STALL_GUARD2_LOAD_MEASURE_REGISTER 0xC0000ul
|
||||
#define DRIVER_CONFIG_REGISTER 0xE0000ul
|
||||
|
|
@ -55,58 +55,58 @@
|
|||
|
||||
//definitions for the driver control register
|
||||
#define MICROSTEPPING_PATTERN 0xFul
|
||||
#define STEP_INTERPOLATION 0x200ul
|
||||
#define DOUBLE_EDGE_STEP 0x100ul
|
||||
#define VSENSE 0x40ul
|
||||
#define READ_MICROSTEP_POSTION 0x0ul
|
||||
#define READ_STALL_GUARD_READING 0x10ul
|
||||
#define READ_STALL_GUARD_AND_COOL_STEP 0x20ul
|
||||
#define READ_SELECTION_PATTERN 0x30ul
|
||||
#define STEP_INTERPOLATION 0x200UL
|
||||
#define DOUBLE_EDGE_STEP 0x100UL
|
||||
#define VSENSE 0x40UL
|
||||
#define READ_MICROSTEP_POSTION 0x0UL
|
||||
#define READ_STALL_GUARD_READING 0x10UL
|
||||
#define READ_STALL_GUARD_AND_COOL_STEP 0x20UL
|
||||
#define READ_SELECTION_PATTERN 0x30UL
|
||||
|
||||
//definitions for the chopper config register
|
||||
#define CHOPPER_MODE_STANDARD 0x0ul
|
||||
#define CHOPPER_MODE_T_OFF_FAST_DECAY 0x4000ul
|
||||
#define CHOPPER_MODE_STANDARD 0x0UL
|
||||
#define CHOPPER_MODE_T_OFF_FAST_DECAY 0x4000UL
|
||||
#define T_OFF_PATTERN 0xFul
|
||||
#define RANDOM_TOFF_TIME 0x2000ul
|
||||
#define BLANK_TIMING_PATTERN 0x18000ul
|
||||
#define RANDOM_TOFF_TIME 0x2000UL
|
||||
#define BLANK_TIMING_PATTERN 0x18000UL
|
||||
#define BLANK_TIMING_SHIFT 15
|
||||
#define HYSTERESIS_DECREMENT_PATTERN 0x1800ul
|
||||
#define HYSTERESIS_DECREMENT_PATTERN 0x1800UL
|
||||
#define HYSTERESIS_DECREMENT_SHIFT 11
|
||||
#define HYSTERESIS_LOW_VALUE_PATTERN 0x780ul
|
||||
#define HYSTERESIS_LOW_VALUE_PATTERN 0x780UL
|
||||
#define HYSTERESIS_LOW_SHIFT 7
|
||||
#define HYSTERESIS_START_VALUE_PATTERN 0x78ul
|
||||
#define HYSTERESIS_START_VALUE_PATTERN 0x78UL
|
||||
#define HYSTERESIS_START_VALUE_SHIFT 4
|
||||
#define T_OFF_TIMING_PATERN 0xFul
|
||||
|
||||
//definitions for cool step register
|
||||
#define MINIMUM_CURRENT_FOURTH 0x8000ul
|
||||
#define CURRENT_DOWN_STEP_SPEED_PATTERN 0x6000ul
|
||||
#define MINIMUM_CURRENT_FOURTH 0x8000UL
|
||||
#define CURRENT_DOWN_STEP_SPEED_PATTERN 0x6000UL
|
||||
#define SE_MAX_PATTERN 0xF00ul
|
||||
#define SE_CURRENT_STEP_WIDTH_PATTERN 0x60ul
|
||||
#define SE_CURRENT_STEP_WIDTH_PATTERN 0x60UL
|
||||
#define SE_MIN_PATTERN 0xFul
|
||||
|
||||
//definitions for StallGuard2 current register
|
||||
#define STALL_GUARD_FILTER_ENABLED 0x10000ul
|
||||
#define STALL_GUARD_FILTER_ENABLED 0x10000UL
|
||||
#define STALL_GUARD_TRESHHOLD_VALUE_PATTERN 0x17F00ul
|
||||
#define CURRENT_SCALING_PATTERN 0x1Ful
|
||||
#define STALL_GUARD_CONFIG_PATTERN 0x17F00ul
|
||||
#define STALL_GUARD_VALUE_PATTERN 0x7F00ul
|
||||
|
||||
//definitions for the input from the TMC2660
|
||||
#define STATUS_STALL_GUARD_STATUS 0x1ul
|
||||
#define STATUS_OVER_TEMPERATURE_SHUTDOWN 0x2ul
|
||||
#define STATUS_OVER_TEMPERATURE_WARNING 0x4ul
|
||||
#define STATUS_SHORT_TO_GROUND_A 0x8ul
|
||||
#define STATUS_SHORT_TO_GROUND_B 0x10ul
|
||||
#define STATUS_OPEN_LOAD_A 0x20ul
|
||||
#define STATUS_OPEN_LOAD_B 0x40ul
|
||||
#define STATUS_STAND_STILL 0x80ul
|
||||
#define STATUS_STALL_GUARD_STATUS 0x1UL
|
||||
#define STATUS_OVER_TEMPERATURE_SHUTDOWN 0x2UL
|
||||
#define STATUS_OVER_TEMPERATURE_WARNING 0x4UL
|
||||
#define STATUS_SHORT_TO_GROUND_A 0x8UL
|
||||
#define STATUS_SHORT_TO_GROUND_B 0x10UL
|
||||
#define STATUS_OPEN_LOAD_A 0x20UL
|
||||
#define STATUS_OPEN_LOAD_B 0x40UL
|
||||
#define STATUS_STAND_STILL 0x80UL
|
||||
#define READOUT_VALUE_PATTERN 0xFFC00ul
|
||||
|
||||
#define CPU_32_BIT
|
||||
|
||||
//default values
|
||||
#define INITIAL_MICROSTEPPING 0x3ul //32th microstepping
|
||||
#define INITIAL_MICROSTEPPING 0x3UL //32th microstepping
|
||||
|
||||
SPIClass SPI_6(SPI6, SPI6_MOSI_PIN, SPI6_MISO_PIN, SPI6_SCK_PIN);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
typedef int8_t pin_t;
|
||||
|
||||
#ifndef analogInputToDigitalPin
|
||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
||||
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||
#endif
|
||||
|
||||
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
|
||||
|
|
@ -93,6 +93,8 @@ void HAL_clear_reset_source();
|
|||
// Get the reason for the reset
|
||||
uint8_t HAL_get_reset_source();
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
typedef int8_t pin_t;
|
||||
|
||||
#ifndef analogInputToDigitalPin
|
||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
||||
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||
#endif
|
||||
|
||||
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()
|
||||
|
|
@ -99,6 +99,8 @@ void HAL_clear_reset_source();
|
|||
// Reset reason
|
||||
uint8_t HAL_get_reset_source();
|
||||
|
||||
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||
|
||||
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
typedef int8_t pin_t;
|
||||
|
||||
#ifndef analogInputToDigitalPin
|
||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
||||
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||
#endif
|
||||
|
||||
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
#define START_FLASH_ADDR 0x08000000
|
||||
#define END_FLASH_ADDR 0x08100000
|
||||
|
||||
#elif MB(REMRAM_V1)
|
||||
#elif MB(REMRAM_V1, NUCLEO_F767ZI)
|
||||
|
||||
// For STM32F765VI in RemRam v1
|
||||
// SRAM (0x20000000 - 0x20080000) (512kb)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include "sd/cardreader.h"
|
||||
|
||||
#include "lcd/ultralcd.h"
|
||||
#include "lcd/marlinui.h"
|
||||
#if HAS_TOUCH_XPT2046
|
||||
#include "lcd/touch/touch_buttons.h"
|
||||
#endif
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
#include "feature/closedloop.h"
|
||||
#endif
|
||||
|
||||
#if HAS_I2C_DIGIPOT
|
||||
#if HAS_MOTOR_CURRENT_I2C
|
||||
#include "feature/digipot/digipot.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
#include "module/servo.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#include "feature/dac/stepper_dac.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -1137,12 +1137,12 @@ void setup() {
|
|||
SETUP_RUN(enableStepperDrivers());
|
||||
#endif
|
||||
|
||||
#if HAS_I2C_DIGIPOT
|
||||
SETUP_RUN(digipot_i2c_init());
|
||||
#if HAS_MOTOR_CURRENT_I2C
|
||||
SETUP_RUN(digipot_i2c.init());
|
||||
#endif
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
SETUP_RUN(dac_init());
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
SETUP_RUN(stepper_dac.init());
|
||||
#endif
|
||||
|
||||
#if EITHER(Z_PROBE_SLED, SOLENOID_PROBE) && HAS_SOLENOID_1
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@
|
|||
#define BOARD_CREALITY_V4 4034 // Creality v4.x (STM32F103RE)
|
||||
#define BOARD_CREALITY_V427 4035 // Creality v4.2.7 (STM32F103RE)
|
||||
#define BOARD_TRIGORILLA_PRO 4036 // Trigorilla Pro (STM32F103ZET6)
|
||||
#define BOARD_FLY_MINI 4037 // FLY MINI (STM32F103RCT6)
|
||||
|
||||
//
|
||||
// ARM Cortex-M4F
|
||||
|
|
@ -362,6 +363,7 @@
|
|||
#define BOARD_REMRAM_V1 5001 // RemRam v1
|
||||
#define BOARD_TEENSY41 5002 // Teensy 4.1
|
||||
#define BOARD_T41U5XBB 5003 // T41U5XBB Teensy 4.1 breakout board
|
||||
#define BOARD_NUCLEO_F767ZI 5004 // ST NUCLEO-F767ZI Dev Board
|
||||
|
||||
//
|
||||
// Espressif ESP32 WiFi
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@
|
|||
#define LCD_STR_C STR_C
|
||||
#define LCD_STR_E STR_E
|
||||
|
||||
#if HAS_MARLINUI_HD44780
|
||||
#if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
|
||||
|
||||
// Custom characters defined in the first 8 characters of the LCD
|
||||
#define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string!
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@
|
|||
#define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V))
|
||||
#define __DO_N(W,C,N,V...) _DO_##N(W,C,V)
|
||||
#define _DO_N(W,C,N,V...) __DO_N(W,C,N,V)
|
||||
#define DO(W,C,V...) _DO_N(W,C,NUM_ARGS(V),V)
|
||||
#define DO(W,C,V...) (_DO_N(W,C,NUM_ARGS(V),V))
|
||||
|
||||
// Macros to support option testing
|
||||
#define _CAT(a,V...) a##V
|
||||
|
|
@ -186,6 +186,7 @@
|
|||
#define _DIS_1(O) NOT(_ENA_1(O))
|
||||
#define ENABLED(V...) DO(ENA,&&,V)
|
||||
#define DISABLED(V...) DO(DIS,&&,V)
|
||||
#define COUNT_ENABLED(V...) DO(ENA,+,V)
|
||||
|
||||
#define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION converted to '0' or '1'
|
||||
#define TERN0(O,A) _TERN(_ENA_1(O),0,A) // OPTION converted to A or '0'
|
||||
|
|
@ -200,6 +201,7 @@
|
|||
#define ALL(V...) ENABLED(V)
|
||||
#define BOTH(V1,V2) ALL(V1,V2)
|
||||
#define EITHER(V1,V2) ANY(V1,V2)
|
||||
#define MANY(V...) (COUNT_ENABLED(V) > 1)
|
||||
|
||||
// Macros to support pins/buttons exist testing
|
||||
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
|
||||
|
|
@ -215,6 +217,7 @@
|
|||
#define WITHIN(N,L,H) ((N) >= (L) && (N) <= (H))
|
||||
#define NUMERIC(a) WITHIN(a, '0', '9')
|
||||
#define DECIMAL(a) (NUMERIC(a) || a == '.')
|
||||
#define HEXCHR(a) (NUMERIC(a) ? (a) - '0' : WITHIN(a, 'a', 'f') ? ((a) - 'a' + 10) : WITHIN(a, 'A', 'F') ? ((a) - 'A' + 10) : -1)
|
||||
#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+')
|
||||
#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+')
|
||||
#define COUNT(a) (sizeof(a)/sizeof(*a))
|
||||
|
|
@ -451,6 +454,12 @@
|
|||
#define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)())
|
||||
#define _END_OF_ARGUMENTS_() 0
|
||||
|
||||
|
||||
// Simple Inline IF Macros, friendly to use in other macro definitions
|
||||
#define IF(O, A, B) ((O) ? (A) : (B))
|
||||
#define IF_0(O, A) IF(O, A, 0)
|
||||
#define IF_1(O, A) IF(O, A, 1)
|
||||
|
||||
//
|
||||
// REPEAT core macros. Recurse N times with ascending I.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public:
|
|||
inline void restore() { ref_ = val_; }
|
||||
};
|
||||
|
||||
#define REMEMBER(N,X,V...) restorer<typeof(X)> restorer_##N(X, ##V)
|
||||
#define REMEMBER(N,X,V...) restorer<__typeof__(X)> restorer_##N(X, ##V)
|
||||
#define RESTORE(N) restorer_##N.restore()
|
||||
|
||||
// Converts from an uint8_t in the range of 0-255 to an uint8_t
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#endif
|
||||
|
||||
#if ENABLED(LCD_BED_LEVELING)
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class unified_bed_leveling {
|
|||
static int g29_grid_size;
|
||||
#endif
|
||||
|
||||
#if ENABLED(NEWPANEL)
|
||||
#if IS_NEWPANEL
|
||||
static void move_z_with_encoder(const float &multiplier);
|
||||
static float measure_point_with_encoder();
|
||||
static float measure_business_card_thickness(float in_height);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "../../../HAL/shared/eeprom_api.h"
|
||||
#include "../../../libs/hex_print.h"
|
||||
#include "../../../module/settings.h"
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#include "../../../module/stepper.h"
|
||||
#include "../../../module/planner.h"
|
||||
#include "../../../module/motion.h"
|
||||
|
|
@ -1009,6 +1009,8 @@
|
|||
|
||||
lcd_mesh_edit_setup(new_z);
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
|
||||
do {
|
||||
idle();
|
||||
new_z = lcd_mesh_edit();
|
||||
|
|
@ -1016,6 +1018,8 @@
|
|||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
} while (!ui.button_pressed());
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
|
||||
if (!lcd_map_control) ui.return_to_status(); // Just editing a single point? Return to status
|
||||
|
||||
if (click_and_hold(abort_fine_tune)) break; // Button held down? Abort editing
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "cancel_object.h"
|
||||
#include "../gcode/gcode.h"
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../lcd/marlinui.h"
|
||||
|
||||
CancelObject cancelable;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,16 +32,18 @@
|
|||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
|
||||
#include "dac_mcp4728.h"
|
||||
|
||||
xyze_uint_t mcp4728_values;
|
||||
MCP4728 mcp4728;
|
||||
|
||||
xyze_uint_t dac_values;
|
||||
|
||||
/**
|
||||
* Begin I2C, get current values (input register and eeprom) of mcp4728
|
||||
*/
|
||||
void mcp4728_init() {
|
||||
void MCP4728::init() {
|
||||
Wire.begin();
|
||||
Wire.requestFrom(I2C_ADDRESS(DAC_DEV_ADDRESS), uint8_t(24));
|
||||
while (Wire.available()) {
|
||||
|
|
@ -50,7 +52,7 @@ void mcp4728_init() {
|
|||
loByte = Wire.read();
|
||||
|
||||
if (!(deviceID & 0x08))
|
||||
mcp4728_values[(deviceID & 0x30) >> 4] = word((hiByte & 0x0F), loByte);
|
||||
dac_values[(deviceID & 0x30) >> 4] = word((hiByte & 0x0F), loByte);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -58,9 +60,9 @@ void mcp4728_init() {
|
|||
* Write input resister value to specified channel using fastwrite method.
|
||||
* Channel : 0-3, Values : 0-4095
|
||||
*/
|
||||
uint8_t mcp4728_analogWrite(const uint8_t channel, const uint16_t value) {
|
||||
mcp4728_values[channel] = value;
|
||||
return mcp4728_fastWrite();
|
||||
uint8_t MCP4728::analogWrite(const uint8_t channel, const uint16_t value) {
|
||||
dac_values[channel] = value;
|
||||
return fastWrite();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -68,12 +70,12 @@ uint8_t mcp4728_analogWrite(const uint8_t channel, const uint16_t value) {
|
|||
* This will update both input register and EEPROM value
|
||||
* This will also write current Vref, PowerDown, Gain settings to EEPROM
|
||||
*/
|
||||
uint8_t mcp4728_eepromWrite() {
|
||||
uint8_t MCP4728::eepromWrite() {
|
||||
Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
|
||||
Wire.write(SEQWRITE);
|
||||
LOOP_XYZE(i) {
|
||||
Wire.write(DAC_STEPPER_VREF << 7 | DAC_STEPPER_GAIN << 4 | highByte(mcp4728_values[i]));
|
||||
Wire.write(lowByte(mcp4728_values[i]));
|
||||
Wire.write(DAC_STEPPER_VREF << 7 | DAC_STEPPER_GAIN << 4 | highByte(dac_values[i]));
|
||||
Wire.write(lowByte(dac_values[i]));
|
||||
}
|
||||
return Wire.endTransmission();
|
||||
}
|
||||
|
|
@ -81,7 +83,7 @@ uint8_t mcp4728_eepromWrite() {
|
|||
/**
|
||||
* Write Voltage reference setting to all input regiters
|
||||
*/
|
||||
uint8_t mcp4728_setVref_all(const uint8_t value) {
|
||||
uint8_t MCP4728::setVref_all(const uint8_t value) {
|
||||
Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
|
||||
Wire.write(VREFWRITE | (value ? 0x0F : 0x00));
|
||||
return Wire.endTransmission();
|
||||
|
|
@ -89,7 +91,7 @@ uint8_t mcp4728_setVref_all(const uint8_t value) {
|
|||
/**
|
||||
* Write Gain setting to all input regiters
|
||||
*/
|
||||
uint8_t mcp4728_setGain_all(const uint8_t value) {
|
||||
uint8_t MCP4728::setGain_all(const uint8_t value) {
|
||||
Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
|
||||
Wire.write(GAINWRITE | (value ? 0x0F : 0x00));
|
||||
return Wire.endTransmission();
|
||||
|
|
@ -98,16 +100,16 @@ uint8_t mcp4728_setGain_all(const uint8_t value) {
|
|||
/**
|
||||
* Return Input Register value
|
||||
*/
|
||||
uint16_t mcp4728_getValue(const uint8_t channel) { return mcp4728_values[channel]; }
|
||||
uint16_t MCP4728::getValue(const uint8_t channel) { return dac_values[channel]; }
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Steph: Might be useful in the future
|
||||
* Return Vout
|
||||
*/
|
||||
uint16_t mcp4728_getVout(const uint8_t channel) {
|
||||
uint16_t MCP4728::getVout(const uint8_t channel) {
|
||||
const uint32_t vref = 2048,
|
||||
vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096;
|
||||
vOut = (vref * dac_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096;
|
||||
return _MIN(vOut, defaultVDD);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -115,15 +117,15 @@ uint16_t mcp4728_getVout(const uint8_t channel) {
|
|||
/**
|
||||
* Returns DAC values as a 0-100 percentage of drive strength
|
||||
*/
|
||||
uint8_t mcp4728_getDrvPct(const uint8_t channel) { return uint8_t(100.0 * mcp4728_values[channel] / (DAC_STEPPER_MAX) + 0.5); }
|
||||
uint8_t MCP4728::getDrvPct(const uint8_t channel) { return uint8_t(100.0 * dac_values[channel] / (DAC_STEPPER_MAX) + 0.5); }
|
||||
|
||||
/**
|
||||
* Receives all Drive strengths as 0-100 percent values, updates
|
||||
* DAC Values array and calls fastwrite to update the DAC.
|
||||
*/
|
||||
void mcp4728_setDrvPct(xyze_uint8_t &pct) {
|
||||
mcp4728_values *= 0.01 * pct * (DAC_STEPPER_MAX);
|
||||
mcp4728_fastWrite();
|
||||
void MCP4728::setDrvPct(xyze_uint8_t &pct) {
|
||||
dac_values *= 0.01 * pct * (DAC_STEPPER_MAX);
|
||||
fastWrite();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,11 +133,11 @@ void mcp4728_setDrvPct(xyze_uint8_t &pct) {
|
|||
* DAC Input and PowerDown bits update.
|
||||
* No EEPROM update
|
||||
*/
|
||||
uint8_t mcp4728_fastWrite() {
|
||||
uint8_t MCP4728::fastWrite() {
|
||||
Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
|
||||
LOOP_XYZE(i) {
|
||||
Wire.write(highByte(mcp4728_values[i]));
|
||||
Wire.write(lowByte(mcp4728_values[i]));
|
||||
Wire.write(highByte(dac_values[i]));
|
||||
Wire.write(lowByte(dac_values[i]));
|
||||
}
|
||||
return Wire.endTransmission();
|
||||
}
|
||||
|
|
@ -143,10 +145,10 @@ uint8_t mcp4728_fastWrite() {
|
|||
/**
|
||||
* Common function for simple general commands
|
||||
*/
|
||||
uint8_t mcp4728_simpleCommand(const byte simpleCommand) {
|
||||
uint8_t MCP4728::simpleCommand(const byte simpleCommand) {
|
||||
Wire.beginTransmission(I2C_ADDRESS(GENERALCALL));
|
||||
Wire.write(simpleCommand);
|
||||
return Wire.endTransmission();
|
||||
}
|
||||
|
||||
#endif // DAC_STEPPER_CURRENT
|
||||
#endif // HAS_MOTOR_CURRENT_DAC
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef lowByte
|
||||
#define lowByte(w) ((uint8_t) ((w) & 0xff))
|
||||
#define lowByte(w) ((uint8_t) ((w) & 0xFF))
|
||||
#endif
|
||||
|
||||
#ifndef highByte
|
||||
|
|
@ -65,13 +65,18 @@
|
|||
// DAC_OR_ADDRESS defined in pins_BOARD.h file
|
||||
#define DAC_DEV_ADDRESS (BASE_ADDR | DAC_OR_ADDRESS)
|
||||
|
||||
void mcp4728_init();
|
||||
uint8_t mcp4728_analogWrite(const uint8_t channel, const uint16_t value);
|
||||
uint8_t mcp4728_eepromWrite();
|
||||
uint8_t mcp4728_setVref_all(const uint8_t value);
|
||||
uint8_t mcp4728_setGain_all(const uint8_t value);
|
||||
uint16_t mcp4728_getValue(const uint8_t channel);
|
||||
uint8_t mcp4728_fastWrite();
|
||||
uint8_t mcp4728_simpleCommand(const byte simpleCommand);
|
||||
uint8_t mcp4728_getDrvPct(const uint8_t channel);
|
||||
void mcp4728_setDrvPct(xyze_uint8_t &pct);
|
||||
class MCP4728 {
|
||||
public:
|
||||
static void init();
|
||||
static uint8_t analogWrite(const uint8_t channel, const uint16_t value);
|
||||
static uint8_t eepromWrite();
|
||||
static uint8_t setVref_all(const uint8_t value);
|
||||
static uint8_t setGain_all(const uint8_t value);
|
||||
static uint16_t getValue(const uint8_t channel);
|
||||
static uint8_t fastWrite();
|
||||
static uint8_t simpleCommand(const byte simpleCommand);
|
||||
static uint8_t getDrvPct(const uint8_t channel);
|
||||
static void setDrvPct(xyze_uint8_t &pct);
|
||||
};
|
||||
|
||||
extern MCP4728 mcp4728;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
|
||||
#include "stepper_dac.h"
|
||||
#include "../../MarlinCore.h" // for SP_X_LBL...
|
||||
|
|
@ -35,56 +35,53 @@ bool dac_present = false;
|
|||
constexpr xyze_uint8_t dac_order = DAC_STEPPER_ORDER;
|
||||
xyze_uint8_t dac_channel_pct = DAC_MOTOR_CURRENT_DEFAULT;
|
||||
|
||||
int dac_init() {
|
||||
StepperDAC stepper_dac;
|
||||
|
||||
int StepperDAC::init() {
|
||||
#if PIN_EXISTS(DAC_DISABLE)
|
||||
OUT_WRITE(DAC_DISABLE_PIN, LOW); // set pin low to enable DAC
|
||||
#endif
|
||||
|
||||
mcp4728_init();
|
||||
mcp4728.init();
|
||||
|
||||
if (mcp4728_simpleCommand(RESET)) return -1;
|
||||
if (mcp4728.simpleCommand(RESET)) return -1;
|
||||
|
||||
dac_present = true;
|
||||
|
||||
mcp4728_setVref_all(DAC_STEPPER_VREF);
|
||||
mcp4728_setGain_all(DAC_STEPPER_GAIN);
|
||||
mcp4728.setVref_all(DAC_STEPPER_VREF);
|
||||
mcp4728.setGain_all(DAC_STEPPER_GAIN);
|
||||
|
||||
if (mcp4728_getDrvPct(0) < 1 || mcp4728_getDrvPct(1) < 1 || mcp4728_getDrvPct(2) < 1 || mcp4728_getDrvPct(3) < 1 ) {
|
||||
mcp4728_setDrvPct(dac_channel_pct);
|
||||
mcp4728_eepromWrite();
|
||||
if (mcp4728.getDrvPct(0) < 1 || mcp4728.getDrvPct(1) < 1 || mcp4728.getDrvPct(2) < 1 || mcp4728.getDrvPct(3) < 1 ) {
|
||||
mcp4728.setDrvPct(dac_channel_pct);
|
||||
mcp4728.eepromWrite();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dac_current_percent(uint8_t channel, float val) {
|
||||
if (!dac_present) return;
|
||||
|
||||
NOMORE(val, 100);
|
||||
|
||||
mcp4728_analogWrite(dac_order[channel], val * 0.01 * (DAC_STEPPER_MAX));
|
||||
mcp4728_simpleCommand(UPDATE);
|
||||
}
|
||||
|
||||
void dac_current_raw(uint8_t channel, uint16_t val) {
|
||||
void StepperDAC::set_current_value(const uint8_t channel, uint16_t val) {
|
||||
if (!dac_present) return;
|
||||
|
||||
NOMORE(val, uint16_t(DAC_STEPPER_MAX));
|
||||
|
||||
mcp4728_analogWrite(dac_order[channel], val);
|
||||
mcp4728_simpleCommand(UPDATE);
|
||||
mcp4728.analogWrite(dac_order[channel], val);
|
||||
mcp4728.simpleCommand(UPDATE);
|
||||
}
|
||||
|
||||
static float dac_perc(int8_t n) { return 100.0 * mcp4728_getValue(dac_order[n]) * RECIPROCAL(DAC_STEPPER_MAX); }
|
||||
static float dac_amps(int8_t n) { return mcp4728_getDrvPct(dac_order[n]) * (DAC_STEPPER_MAX) * 0.125 * RECIPROCAL(DAC_STEPPER_SENSE); }
|
||||
void StepperDAC::set_current_percent(const uint8_t channel, float val) {
|
||||
set_current_value(channel, _MIN(val, 100.0f) * (DAC_STEPPER_MAX) / 100.0f);
|
||||
}
|
||||
|
||||
uint8_t dac_current_get_percent(const AxisEnum axis) { return mcp4728_getDrvPct(dac_order[axis]); }
|
||||
void dac_current_set_percents(xyze_uint8_t &pct) {
|
||||
static float dac_perc(int8_t n) { return 100.0 * mcp4728.getValue(dac_order[n]) * RECIPROCAL(DAC_STEPPER_MAX); }
|
||||
static float dac_amps(int8_t n) { return mcp4728.getDrvPct(dac_order[n]) * (DAC_STEPPER_MAX) * 0.125 * RECIPROCAL(DAC_STEPPER_SENSE); }
|
||||
|
||||
uint8_t StepperDAC::get_current_percent(const AxisEnum axis) { return mcp4728.getDrvPct(dac_order[axis]); }
|
||||
void StepperDAC::set_current_percents(xyze_uint8_t &pct) {
|
||||
LOOP_XYZE(i) dac_channel_pct[i] = pct[dac_order[i]];
|
||||
mcp4728_setDrvPct(dac_channel_pct);
|
||||
mcp4728.setDrvPct(dac_channel_pct);
|
||||
}
|
||||
|
||||
void dac_print_values() {
|
||||
void StepperDAC::print_values() {
|
||||
if (!dac_present) return;
|
||||
SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
|
||||
SERIAL_ECHO_START();
|
||||
|
|
@ -94,9 +91,9 @@ void dac_print_values() {
|
|||
SERIAL_ECHOLNPAIR_P(SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")"));
|
||||
}
|
||||
|
||||
void dac_commit_eeprom() {
|
||||
void StepperDAC::commit_eeprom() {
|
||||
if (!dac_present) return;
|
||||
mcp4728_eepromWrite();
|
||||
mcp4728.eepromWrite();
|
||||
}
|
||||
|
||||
#endif // DAC_STEPPER_CURRENT
|
||||
#endif // HAS_MOTOR_CURRENT_DAC
|
||||
|
|
|
|||
|
|
@ -27,10 +27,15 @@
|
|||
|
||||
#include "dac_mcp4728.h"
|
||||
|
||||
int dac_init();
|
||||
void dac_current_percent(uint8_t channel, float val);
|
||||
void dac_current_raw(uint8_t channel, uint16_t val);
|
||||
void dac_print_values();
|
||||
void dac_commit_eeprom();
|
||||
uint8_t dac_current_get_percent(AxisEnum axis);
|
||||
void dac_current_set_percents(xyze_uint8_t &pct);
|
||||
class StepperDAC {
|
||||
public:
|
||||
static int init();
|
||||
static void set_current_percent(const uint8_t channel, float val);
|
||||
static void set_current_value(const uint8_t channel, uint16_t val);
|
||||
static void print_values();
|
||||
static void commit_eeprom();
|
||||
static uint8_t get_current_percent(AxisEnum axis);
|
||||
static void set_current_percents(xyze_uint8_t &pct);
|
||||
};
|
||||
|
||||
extern StepperDAC stepper_dac;
|
||||
|
|
|
|||
|
|
@ -21,5 +21,13 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
void digipot_i2c_set_current(const uint8_t channel, const float current);
|
||||
void digipot_i2c_init();
|
||||
//
|
||||
// Header for MCP4018 and MCP4451 current control i2c devices
|
||||
//
|
||||
class DigipotI2C {
|
||||
public:
|
||||
static void init();
|
||||
static void set_current(const uint8_t channel, const float current);
|
||||
};
|
||||
|
||||
extern DigipotI2C digipot_i2c;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#if ENABLED(DIGIPOT_MCP4018)
|
||||
|
||||
#include "digipot.h"
|
||||
|
||||
#include <Stream.h>
|
||||
#include <SlowSoftI2CMaster.h> // https://github.com/stawel/SlowSoftI2CMaster
|
||||
|
||||
|
|
@ -68,7 +70,7 @@ static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
static void i2c_send(const uint8_t channel, const byte v) {
|
||||
static void digipot_i2c_send(const uint8_t channel, const byte v) {
|
||||
if (WITHIN(channel, 0, DIGIPOT_I2C_NUM_CHANNELS - 1)) {
|
||||
pots[channel].i2c_start(((DIGIPOT_I2C_ADDRESS_A) << 1) | I2C_WRITE);
|
||||
pots[channel].i2c_write(v);
|
||||
|
|
@ -77,12 +79,12 @@ static void i2c_send(const uint8_t channel, const byte v) {
|
|||
}
|
||||
|
||||
// This is for the MCP4018 I2C based digipot
|
||||
void digipot_i2c_set_current(const uint8_t channel, const float current) {
|
||||
void DigipotI2C::set_current(const uint8_t channel, const float current) {
|
||||
const float ival = _MIN(_MAX(current, 0), float(DIGIPOT_MCP4018_MAX_VALUE));
|
||||
i2c_send(channel, current_to_wiper(ival));
|
||||
digipot_i2c_send(channel, current_to_wiper(ival));
|
||||
}
|
||||
|
||||
void digipot_i2c_init() {
|
||||
void DigipotI2C::init() {
|
||||
LOOP_L_N(i, DIGIPOT_I2C_NUM_CHANNELS) pots[i].i2c_init();
|
||||
|
||||
// Init currents according to Configuration_adv.h
|
||||
|
|
@ -94,7 +96,9 @@ void digipot_i2c_init() {
|
|||
#endif
|
||||
;
|
||||
LOOP_L_N(i, COUNT(digipot_motor_current))
|
||||
digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
|
||||
set_current(i, pgm_read_float(&digipot_motor_current[i]));
|
||||
}
|
||||
|
||||
DigipotI2C digipot_i2c;
|
||||
|
||||
#endif // DIGIPOT_MCP4018
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#if ENABLED(DIGIPOT_MCP4451)
|
||||
|
||||
#include "digipot.h"
|
||||
|
||||
#include <Stream.h>
|
||||
#include <Wire.h>
|
||||
|
||||
|
|
@ -61,7 +63,7 @@ static void digipot_i2c_send(const byte addr, const byte a, const byte b) {
|
|||
}
|
||||
|
||||
// This is for the MCP4451 I2C based digipot
|
||||
void digipot_i2c_set_current(const uint8_t channel, const float current) {
|
||||
void DigipotI2C::set_current(const uint8_t channel, const float current) {
|
||||
// These addresses are specific to Azteeg X3 Pro, can be set to others.
|
||||
// In this case first digipot is at address A0=0, A1=0, second one is at A0=0, A1=1
|
||||
const byte addr = channel < 4 ? DIGIPOT_I2C_ADDRESS_A : DIGIPOT_I2C_ADDRESS_B; // channel 0-3 vs 4-7
|
||||
|
|
@ -75,7 +77,7 @@ void digipot_i2c_set_current(const uint8_t channel, const float current) {
|
|||
digipot_i2c_send(addr, addresses[channel & 0x3], current_to_wiper(_MIN(float(_MAX(current, 0)), DIGIPOT_I2C_MAX_CURRENT)));
|
||||
}
|
||||
|
||||
void digipot_i2c_init() {
|
||||
void DigipotI2C::init() {
|
||||
#if MB(MKS_SBASE)
|
||||
configure_i2c(16); // Set clock_option to 16 ensure I2C is initialized at 400kHz
|
||||
#else
|
||||
|
|
@ -90,7 +92,9 @@ void digipot_i2c_init() {
|
|||
#endif
|
||||
;
|
||||
LOOP_L_N(i, COUNT(digipot_motor_current))
|
||||
digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
|
||||
set_current(i, pgm_read_float(&digipot_motor_current[i]));
|
||||
}
|
||||
|
||||
DigipotI2C digipot_i2c;
|
||||
|
||||
#endif // DIGIPOT_MCP4451
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
// Static data members
|
||||
bool EmergencyParser::killed_by_M112, // = false
|
||||
EmergencyParser::quickstop_by_M410,
|
||||
EmergencyParser::enabled;
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public:
|
|||
};
|
||||
|
||||
static bool killed_by_M112;
|
||||
static bool quickstop_by_M410;
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
static uint8_t M876_reason;
|
||||
|
|
@ -88,10 +89,8 @@ public:
|
|||
|
||||
case EP_N:
|
||||
switch (c) {
|
||||
case '0': case '1': case '2':
|
||||
case '3': case '4': case '5':
|
||||
case '6': case '7': case '8':
|
||||
case '9': case '-': case ' ': break;
|
||||
case '0' ... '9':
|
||||
case '-': case ' ': break;
|
||||
case 'M': state = EP_M; break;
|
||||
default: state = EP_IGNORE;
|
||||
}
|
||||
|
|
@ -153,10 +152,7 @@ public:
|
|||
case EP_M876S:
|
||||
switch (c) {
|
||||
case ' ': break;
|
||||
case '0': case '1': case '2':
|
||||
case '3': case '4': case '5':
|
||||
case '6': case '7': case '8':
|
||||
case '9':
|
||||
case '0' ... '9':
|
||||
state = EP_M876SN;
|
||||
M876_reason = (uint8_t)(c - '0');
|
||||
break;
|
||||
|
|
@ -173,7 +169,7 @@ public:
|
|||
if (enabled) switch (state) {
|
||||
case EP_M108: wait_for_user = wait_for_heatup = false; break;
|
||||
case EP_M112: killed_by_M112 = true; break;
|
||||
case EP_M410: quickstop_stepper(); break;
|
||||
case EP_M410: quickstop_by_M410 = true; break;
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
case EP_M876SN: host_response_handler(M876_reason); break;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include "../module/temperature.h"
|
||||
#include "../module/motion.h"
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../lcd/marlinui.h"
|
||||
|
||||
extern HotendIdleProtection hotend_idle;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
MMU2 mmu2;
|
||||
|
||||
#include "../../gcode/gcode.h"
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
#include "../../libs/buzzer.h"
|
||||
#include "../../libs/nozzle.h"
|
||||
#include "../../module/temperature.h"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
|
||||
class Password {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -55,12 +55,16 @@
|
|||
#include "../lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../lcd/marlinui.h"
|
||||
|
||||
#if HAS_BUZZER
|
||||
#include "../libs/buzzer.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "powerloss.h"
|
||||
#endif
|
||||
|
||||
#include "../libs/nozzle.h"
|
||||
#include "pause.h"
|
||||
|
||||
|
|
@ -128,8 +132,10 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P
|
|||
DEBUG_SECTION(est, "ensure_safe_temperature", true);
|
||||
DEBUG_ECHOLNPAIR("... wait:", int(wait), " mode:", int(mode));
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder))
|
||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode);
|
||||
|
|
@ -217,8 +223,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
|||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
active_extruder = DXC_ext;
|
||||
extruder_duplication_enabled = false;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
// Slow Load filament
|
||||
|
|
@ -239,9 +244,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
|||
}
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE) // Tie the two extruders movement back together.
|
||||
active_extruder = saved_ext;
|
||||
extruder_duplication_enabled = saved_ext_dup_mode;
|
||||
stepper.set_directions();
|
||||
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
|
||||
|
|
@ -433,17 +436,14 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
|
|||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
active_extruder = DXC_ext;
|
||||
extruder_duplication_enabled = false;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
if (unload_length) // Unload the filament
|
||||
unload_filament(unload_length, show_lcd, PAUSE_MODE_CHANGE_FILAMENT);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
active_extruder = saved_ext;
|
||||
extruder_duplication_enabled = saved_ext_dup_mode;
|
||||
stepper.set_directions();
|
||||
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
|
@ -489,8 +489,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
|||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
const bool saved_ext_dup_mode = extruder_duplication_enabled;
|
||||
active_extruder = DXC_ext;
|
||||
extruder_duplication_enabled = false;
|
||||
set_duplication_enabled(false, DXC_ext);
|
||||
#endif
|
||||
|
||||
// Wait for filament insert by user and press button
|
||||
|
|
@ -544,9 +543,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
|||
idle_no_sleep();
|
||||
}
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
active_extruder = saved_ext;
|
||||
extruder_duplication_enabled = saved_ext_dup_mode;
|
||||
stepper.set_directions();
|
||||
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -640,6 +637,9 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
|
|||
// Set extruder to saved position
|
||||
planner.set_e_position_mm((destination.e = current_position.e = resume_position.e));
|
||||
|
||||
// Write PLR now to update the z axis value
|
||||
TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
|
||||
|
||||
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
|
||||
|
||||
#ifdef ACTION_ON_RESUMED
|
||||
|
|
|
|||
|
|
@ -89,10 +89,11 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
|
|||
|
||||
void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_count=0 DXC_PARAMS);
|
||||
|
||||
void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, const int8_t max_beep_count=0, int16_t targetTemp=0 DXC_PARAMS);
|
||||
void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH,
|
||||
const int8_t max_beep_count=0, int16_t targetTemp=0 DXC_PARAMS);
|
||||
|
||||
bool load_filament(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=0, const int8_t max_beep_count=0, const bool show_lcd=false,
|
||||
const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);
|
||||
bool load_filament(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=0, const int8_t max_beep_count=0,
|
||||
const bool show_lcd=false, const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);
|
||||
|
||||
bool unload_filament(const float &unload_length, const bool show_lcd=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT
|
||||
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "power_monitor.h"
|
||||
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../lcd/marlinui.h"
|
||||
#include "../lcd/lcdprint.h"
|
||||
#include "../libs/numtostr.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ uint32_t PrintJobRecovery::cmd_sdpos, // = 0
|
|||
#endif
|
||||
|
||||
#include "../sd/cardreader.h"
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../lcd/marlinui.h"
|
||||
#include "../gcode/queue.h"
|
||||
#include "../gcode/gcode.h"
|
||||
#include "../module/motion.h"
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ class FilamentSensorBase {
|
|||
#if NUM_RUNOUT_SENSORS == 1
|
||||
UNUSED(extruder);
|
||||
#else
|
||||
if ( !TERN0(DUAL_X_CARRIAGE, dxc_is_duplicating())
|
||||
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
|
||||
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
|
||||
) return TEST(runout_states, extruder); // A specific extruder ran out
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../lcd/marlinui.h"
|
||||
|
||||
#if HAS_TRINAMIC_CONFIG
|
||||
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
#define CHOPPER_09STEP_24V { 3, -1, 5 }
|
||||
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS) && !defined(MONITOR_DRIVER_STATUS_INTERVAL_MS)
|
||||
#define MONITOR_DRIVER_STATUS_INTERVAL_MS 500u
|
||||
#define MONITOR_DRIVER_STATUS_INTERVAL_MS 500U
|
||||
#endif
|
||||
|
||||
constexpr uint16_t _tmc_thrs(const uint16_t msteps, const uint32_t thrs, const uint32_t spmm) {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
#include "../../module/motion.h"
|
||||
#include "../../module/tool_change.h"
|
||||
#include "../../module/temperature.h"
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
|
||||
#define EXTRUSION_MULTIPLIER 1.0
|
||||
#define PRIME_LENGTH 10.0
|
||||
|
|
@ -511,11 +511,9 @@ void GcodeSuite::G26() {
|
|||
g26_keep_heaters_on = parser.boolval('K');
|
||||
|
||||
// Accept 'I' if temperature presets are defined
|
||||
const uint8_t preset_index = (0
|
||||
#if PREHEAT_COUNT
|
||||
+ (parser.seenval('I') ? _MIN(parser.value_byte(), PREHEAT_COUNT - 1) + 1 : 0)
|
||||
const uint8_t preset_index = parser.seenval('I') ? _MIN(parser.value_byte(), PREHEAT_COUNT - 1) + 1 : 0;
|
||||
#endif
|
||||
);
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
|
||||
|
|
|
|||
|
|
@ -110,9 +110,8 @@ void GcodeSuite::G35() {
|
|||
tool_change(0, true);
|
||||
#endif
|
||||
|
||||
#if HAS_DUPLICATION_MODE
|
||||
extruder_duplication_enabled = false;
|
||||
#endif
|
||||
// Disable duplication mode on homing
|
||||
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
|
||||
|
||||
// Home all before this procedure
|
||||
home_all_axes();
|
||||
|
|
@ -160,6 +159,7 @@ void GcodeSuite::G35() {
|
|||
" ", (screw_thread & 1) == (adjust > 0) ? "CCW" : "CW",
|
||||
" by ", abs(full_turns), " turns");
|
||||
if (minutes) SERIAL_ECHOPAIR(" and ", abs(minutes), " minutes");
|
||||
if (ENABLED(REPORT_TRAMMING_MM)) SERIAL_ECHOPAIR(" (", -diff, "mm)");
|
||||
SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
|
|
@ -201,10 +201,6 @@ G29_TYPE GcodeSuite::G29() {
|
|||
ABL_VAR int abl_probe_index;
|
||||
#endif
|
||||
|
||||
#if BOTH(HAS_SOFTWARE_ENDSTOPS, PROBE_MANUALLY)
|
||||
ABL_VAR bool saved_soft_endstops_state = true;
|
||||
#endif
|
||||
|
||||
#if ABL_GRID
|
||||
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
|
|
@ -461,7 +457,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
// Abort current G29 procedure, go back to idle state
|
||||
if (seenA && g29_in_progress) {
|
||||
SERIAL_ECHOLNPGM("Manual G29 aborted");
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
set_bed_leveling_enabled(abl_should_enable);
|
||||
g29_in_progress = false;
|
||||
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
|
||||
|
|
@ -482,7 +478,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
|
||||
if (abl_probe_index == 0) {
|
||||
// For the initial G29 S2 save software endstop state
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, saved_soft_endstops_state = soft_endstops_enabled);
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
// Move close to the bed before the first point
|
||||
do_blocking_move_to_z(0);
|
||||
}
|
||||
|
|
@ -552,14 +548,14 @@ G29_TYPE GcodeSuite::G29() {
|
|||
_manual_goto_xy(probePos); // Can be used here too!
|
||||
// Disable software endstops to allow manual adjustment
|
||||
// If G29 is not completed, they will not be re-enabled
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = false);
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
G29_RETURN(false);
|
||||
}
|
||||
else {
|
||||
// Leveling done! Fall through to G29 finishing code below
|
||||
SERIAL_ECHOLNPGM("Grid probing done.");
|
||||
// Re-enable software endstops, if needed
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
}
|
||||
|
||||
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
|
||||
|
|
@ -570,7 +566,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
_manual_goto_xy(probePos);
|
||||
// Disable software endstops to allow manual adjustment
|
||||
// If G29 is not completed, they will not be re-enabled
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = false);
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
G29_RETURN(false);
|
||||
}
|
||||
else {
|
||||
|
|
@ -578,7 +574,7 @@ G29_TYPE GcodeSuite::G29() {
|
|||
SERIAL_ECHOLNPGM("3-point probing done.");
|
||||
|
||||
// Re-enable software endstops, if needed
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
|
||||
if (!dryrun) {
|
||||
vector_3 planeNormal = vector_3::cross(points[0] - points[1], points[2] - points[1]).get_normal();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include "../../queue.h"
|
||||
|
||||
#include "../../../libs/buzzer.h"
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../module/stepper.h"
|
||||
|
||||
|
|
@ -61,7 +61,6 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
|
|||
void GcodeSuite::G29() {
|
||||
|
||||
static int mbl_probe_index = -1;
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, static bool saved_soft_endstops_state);
|
||||
|
||||
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
|
||||
if (!WITHIN(state, 0, 5)) {
|
||||
|
|
@ -98,26 +97,19 @@ void GcodeSuite::G29() {
|
|||
}
|
||||
// For each G29 S2...
|
||||
if (mbl_probe_index == 0) {
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
// For the initial G29 S2 save software endstop state
|
||||
saved_soft_endstops_state = soft_endstops_enabled;
|
||||
#endif
|
||||
// Move close to the bed before the first point
|
||||
do_blocking_move_to_z(0);
|
||||
}
|
||||
else {
|
||||
// Save Z for the previous mesh position
|
||||
mbl.set_zigzag_z(mbl_probe_index - 1, current_position.z);
|
||||
TERN_(HAS_SOFTWARE_ENDSTOPS, soft_endstops_enabled = saved_soft_endstops_state);
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
}
|
||||
// If there's another point to sample, move there with optional lift.
|
||||
if (mbl_probe_index < GRID_MAX_POINTS) {
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
// Disable software endstops to allow manual adjustment
|
||||
// If G29 is not completed, they will not be re-enabled
|
||||
soft_endstops_enabled = false;
|
||||
#endif
|
||||
|
||||
// If G29 is left hanging without completion they won't be re-enabled!
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
mbl.zigzag(mbl_probe_index++, ix, iy);
|
||||
_manual_goto_xy({ mbl.index_to_xpos[ix], mbl.index_to_ypos[iy] });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
#include "../../feature/bltouch.h"
|
||||
#endif
|
||||
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
#if ENABLED(DWIN_CREALITY_LCD)
|
||||
#include "../../lcd/dwin/e3v2/dwin.h"
|
||||
#endif
|
||||
|
|
@ -134,8 +134,8 @@
|
|||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_POS("home_z_safely", destination);
|
||||
|
||||
// This causes the carriage on Dual X to unpark
|
||||
TERN_(DUAL_X_CARRIAGE, active_extruder_parked = false);
|
||||
// Free the active extruder for movement
|
||||
TERN_(DUAL_X_CARRIAGE, idex_set_parked(false));
|
||||
|
||||
TERN_(SENSORLESS_HOMING, safe_delay(500)); // Short delay needed to settle
|
||||
|
||||
|
|
@ -222,8 +222,9 @@ void GcodeSuite::G28() {
|
|||
return;
|
||||
}
|
||||
|
||||
// Wait for planner moves to finish!
|
||||
planner.synchronize();
|
||||
planner.synchronize(); // Wait for planner moves to finish!
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false); // Reset a leftover 'loose' motion state
|
||||
|
||||
// Disable the leveling matrix before homing
|
||||
#if HAS_LEVELING
|
||||
|
|
@ -281,7 +282,7 @@ void GcodeSuite::G28() {
|
|||
tool_change(0, true);
|
||||
#endif
|
||||
|
||||
TERN_(HAS_DUPLICATION_MODE, extruder_duplication_enabled = false);
|
||||
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
|
||||
|
||||
remember_feedrate_scaling_off();
|
||||
|
||||
|
|
@ -341,16 +342,14 @@ void GcodeSuite::G28() {
|
|||
homeaxis(X_AXIS);
|
||||
|
||||
// Remember this extruder's position for later tool change
|
||||
inactive_extruder_x_pos = current_position.x;
|
||||
inactive_extruder_x = current_position.x;
|
||||
|
||||
// Home the 1st (left) extruder
|
||||
active_extruder = 0;
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Consider the active extruder to be parked
|
||||
raised_parked_position = current_position;
|
||||
delayed_move_time = 0;
|
||||
active_extruder_parked = true;
|
||||
// Consider the active extruder to be in its "parked" position
|
||||
idex_set_parked();
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -391,7 +390,7 @@ void GcodeSuite::G28() {
|
|||
*/
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
|
||||
if (dxc_is_duplicating()) {
|
||||
if (idex_is_duplicating()) {
|
||||
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing = begin_slow_homing());
|
||||
|
||||
|
|
@ -400,19 +399,17 @@ void GcodeSuite::G28() {
|
|||
homeaxis(X_AXIS);
|
||||
|
||||
// Remember this extruder's position for later tool change
|
||||
inactive_extruder_x_pos = current_position.x;
|
||||
inactive_extruder_x = current_position.x;
|
||||
|
||||
// Home the 1st (left) extruder
|
||||
active_extruder = 0;
|
||||
homeaxis(X_AXIS);
|
||||
|
||||
// Consider the active extruder to be parked
|
||||
raised_parked_position = current_position;
|
||||
delayed_move_time = 0;
|
||||
active_extruder_parked = true;
|
||||
extruder_duplication_enabled = IDEX_saved_duplication_state;
|
||||
idex_set_parked();
|
||||
|
||||
dual_x_carriage_mode = IDEX_saved_mode;
|
||||
stepper.set_directions();
|
||||
set_duplication_enabled(IDEX_saved_duplication_state);
|
||||
|
||||
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "../../module/motion.h"
|
||||
#include "../../module/stepper.h"
|
||||
#include "../../module/endstops.h"
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
#include "../../module/probe.h"
|
||||
|
|
|
|||
156
Marlin/src/gcode/calibrate/G34.cpp
Normal file
156
Marlin/src/gcode/calibrate/G34.cpp
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/stepper.h"
|
||||
#include "../../module/endstops.h"
|
||||
|
||||
#if HAS_LEVELING
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
void GcodeSuite::G34() {
|
||||
|
||||
// Home before the alignment procedure
|
||||
if (!all_axes_known()) home_all_axes();
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
TEMPORARY_BED_LEVELING_STATE(false);
|
||||
TemporaryGlobalEndstopsState unlock_z(false);
|
||||
|
||||
#ifdef GANTRY_CALIBRATION_COMMANDS_PRE
|
||||
gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_PRE));
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Sub Commands Processed");
|
||||
#endif
|
||||
|
||||
#ifdef GANTRY_CALIBRATION_SAFE_POSITION
|
||||
// Move XY to safe position
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Parking XY");
|
||||
const xy_pos_t safe_pos = GANTRY_CALIBRATION_SAFE_POSITION;
|
||||
do_blocking_move_to(safe_pos, MMM_TO_MMS(GANTRY_CALIBRATION_XY_PARK_FEEDRATE));
|
||||
#endif
|
||||
|
||||
const float move_distance = parser.intval('Z', GANTRY_CALIBRATION_EXTRA_HEIGHT),
|
||||
zbase = ENABLED(GANTRY_CALIBRATION_TO_MIN) ? Z_MIN_POS : Z_MAX_POS,
|
||||
zpounce = zbase - move_distance, zgrind = zbase + move_distance;
|
||||
|
||||
// Move Z to pounce position
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Setting Z Pounce");
|
||||
do_blocking_move_to_z(zpounce, MMM_TO_MMS(HOMING_FEEDRATE_Z));
|
||||
|
||||
// Store current motor settings, then apply reduced value
|
||||
|
||||
#define _REDUCE_CURRENT ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_DAC, HAS_MOTOR_CURRENT_I2C, HAS_TRINAMIC_CONFIG)
|
||||
#if _REDUCE_CURRENT
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Reducing Current");
|
||||
#endif
|
||||
|
||||
#if HAS_MOTOR_CURRENT_SPI
|
||||
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
|
||||
stepper.set_digipot_current(Z_AXIS, target_current);
|
||||
#elif HAS_MOTOR_CURRENT_PWM
|
||||
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
|
||||
stepper.set_digipot_current(1, target_current);
|
||||
#elif HAS_MOTOR_CURRENT_DAC
|
||||
const float target_current = parser.floatval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
const float previous_current = dac_amps(Z_AXIS, target_current);
|
||||
stepper_dac.set_current_value(Z_AXIS, target_current);
|
||||
#elif ENABLED(HAS_MOTOR_CURRENT_I2C)
|
||||
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
previous_current = dac_amps(Z_AXIS);
|
||||
digipot_i2c.set_current(Z_AXIS, target_current)
|
||||
#elif HAS_TRINAMIC_CONFIG
|
||||
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
static uint16_t previous_current_arr[NUM_Z_STEPPER_DRIVERS];
|
||||
#if AXIS_IS_TMC(Z)
|
||||
previous_current_arr[0] = stepperZ.getMilliamps();
|
||||
stepperZ.rms_current(target_current);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
previous_current_arr[1] = stepperZ2.getMilliamps();
|
||||
stepperZ2.rms_current(target_current);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
previous_current_arr[2] = stepperZ3.getMilliamps();
|
||||
stepperZ3.rms_current(target_current);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z4)
|
||||
previous_current_arr[3] = stepperZ4.getMilliamps();
|
||||
stepperZ4.rms_current(target_current);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Do Final Z move to adjust
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Final Z Move");
|
||||
do_blocking_move_to_z(zgrind, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE));
|
||||
|
||||
// Back off end plate, back to normal motion range
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Backoff");
|
||||
do_blocking_move_to_z(zpounce, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE));
|
||||
|
||||
#if _REDUCE_CURRENT
|
||||
// Reset current to original values
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Restore Current");
|
||||
#endif
|
||||
|
||||
#if HAS_MOTOR_CURRENT_SPI
|
||||
stepper.set_digipot_current(Z_AXIS, previous_current);
|
||||
#elif HAS_MOTOR_CURRENT_PWM
|
||||
stepper.set_digipot_current(1, previous_current);
|
||||
#elif HAS_MOTOR_CURRENT_DAC
|
||||
stepper_dac.set_current_value(Z_AXIS, previous_current);
|
||||
#elif ENABLED(HAS_MOTOR_CURRENT_I2C)
|
||||
digipot_i2c.set_current(Z_AXIS, previous_current)
|
||||
#elif HAS_TRINAMIC_CONFIG
|
||||
#if AXIS_IS_TMC(Z)
|
||||
stepperZ.rms_current(previous_current_arr[0]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
stepperZ2.rms_current(previous_current_arr[1]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
stepperZ3.rms_current(previous_current_arr[2]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z4)
|
||||
stepperZ4.rms_current(previous_current_arr[3]);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GANTRY_CALIBRATION_COMMANDS_POST
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Running Post Commands");
|
||||
gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_POST));
|
||||
#endif
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
}
|
||||
|
||||
#endif // MECHANICAL_GANTRY_CALIBRATION
|
||||
|
|
@ -20,26 +20,27 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
|
||||
#include "../../feature/z_stepper_align.h"
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/planner.h"
|
||||
#include "../../module/stepper.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/stepper.h"
|
||||
#include "../../module/planner.h"
|
||||
#include "../../module/probe.h"
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
#include "../../module/tool_change.h"
|
||||
#endif
|
||||
#include "../../lcd/marlinui.h" // for LCD_MESSAGEPGM
|
||||
|
||||
#if HAS_LEVELING
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
#endif
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
#include "../../module/tool_change.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
|
||||
#include "../../libs/least_squares_fit.h"
|
||||
#endif
|
||||
|
|
@ -112,12 +113,12 @@ void GcodeSuite::G34() {
|
|||
tool_change(0, true);
|
||||
#endif
|
||||
|
||||
TERN_(HAS_DUPLICATION_MODE, extruder_duplication_enabled = false);
|
||||
TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
|
||||
|
||||
// In BLTOUCH HS mode, the probe travels in a deployed state.
|
||||
// Users of G34 might have a badly misaligned bed, so raise Z by the
|
||||
// length of the deployed pin (BLTOUCH stroke < 7mm)
|
||||
#define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES + 7.0f * BOTH(BLTOUCH, BLTOUCH_HS_MODE)
|
||||
#define Z_BASIC_CLEARANCE (Z_CLEARANCE_BETWEEN_PROBES + 7.0f * BOTH(BLTOUCH, BLTOUCH_HS_MODE))
|
||||
|
||||
// Compute a worst-case clearance height to probe from. After the first
|
||||
// iteration this will be re-calculated based on the actual bed position
|
||||
|
|
@ -154,21 +155,29 @@ void GcodeSuite::G34() {
|
|||
z_maxdiff = 0.0f,
|
||||
amplification = z_auto_align_amplification;
|
||||
|
||||
// These are needed after the for-loop
|
||||
uint8_t iteration;
|
||||
bool err_break = false;
|
||||
float z_measured_min;
|
||||
|
||||
#if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
|
||||
bool adjustment_reverse = false;
|
||||
#endif
|
||||
|
||||
// 'iteration' is declared above and is also used after the for-loop.
|
||||
// *not* the same as LOOP_L_N(iteration, z_auto_align_iterations)
|
||||
for (iteration = 0; iteration < z_auto_align_iterations; ++iteration) {
|
||||
#if HAS_DISPLAY
|
||||
PGM_P const msg_iteration = GET_TEXT(MSG_ITERATION);
|
||||
const uint8_t iter_str_len = strlen_P(msg_iteration);
|
||||
#endif
|
||||
|
||||
// Final z and iteration values will be used after breaking the loop
|
||||
float z_measured_min;
|
||||
uint8_t iteration = 0;
|
||||
bool err_break = false; // To break out of nested loops
|
||||
while (iteration < z_auto_align_iterations) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> probing all positions.");
|
||||
|
||||
SERIAL_ECHOLNPAIR("\nITERATION: ", int(iteration + 1));
|
||||
const int iter = iteration + 1;
|
||||
SERIAL_ECHOLNPAIR("\nG34 Iteration: ", iter);
|
||||
#if HAS_DISPLAY
|
||||
char str[iter_str_len + 2 + 1];
|
||||
sprintf_P(str, msg_iteration, iter);
|
||||
ui.set_status(str);
|
||||
#endif
|
||||
|
||||
// Initialize minimum value
|
||||
z_measured_min = 100000.0f;
|
||||
|
|
@ -190,7 +199,8 @@ void GcodeSuite::G34() {
|
|||
// current_position.z has been manually altered in the "dirty trick" above.
|
||||
const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false);
|
||||
if (isnan(z_probed_height)) {
|
||||
SERIAL_ECHOLNPGM("Probing failed.");
|
||||
SERIAL_ECHOLNPGM("Probing failed");
|
||||
LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
|
||||
err_break = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -249,8 +259,39 @@ void GcodeSuite::G34() {
|
|||
, " Z3-Z1=", ABS(z_measured[2] - z_measured[0])
|
||||
#endif
|
||||
);
|
||||
#if HAS_DISPLAY
|
||||
char fstr1[10];
|
||||
#if NUM_Z_STEPPER_DRIVERS == 2
|
||||
char msg[6 + (6 + 5) * 1 + 1];
|
||||
#else
|
||||
char msg[6 + (6 + 5) * 3 + 1], fstr2[10], fstr3[10];
|
||||
#endif
|
||||
sprintf_P(msg,
|
||||
PSTR("Diffs Z1-Z2=%s"
|
||||
#if NUM_Z_STEPPER_DRIVERS == 3
|
||||
" Z2-Z3=%s"
|
||||
" Z3-Z1=%s"
|
||||
#endif
|
||||
), dtostrf(ABS(z_measured[0] - z_measured[1]), 1, 3, fstr1)
|
||||
#if NUM_Z_STEPPER_DRIVERS == 3
|
||||
, dtostrf(ABS(z_measured[1] - z_measured[2]), 1, 3, fstr2)
|
||||
, dtostrf(ABS(z_measured[2] - z_measured[0]), 1, 3, fstr3)
|
||||
#endif
|
||||
);
|
||||
ui.set_status(msg);
|
||||
#endif
|
||||
|
||||
auto decreasing_accuracy = [](const float &v1, const float &v2){
|
||||
if (v1 < v2 * 0.7f) {
|
||||
SERIAL_ECHOLNPGM("Decreasing Accuracy Detected.");
|
||||
LCD_MESSAGEPGM(MSG_DECREASING_ACCURACY);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
|
||||
|
||||
// Check if the applied corrections go in the correct direction.
|
||||
// Calculate the sum of the absolute deviations from the mean of the probe measurements.
|
||||
// Compare to the last iteration to ensure it's getting better.
|
||||
|
|
@ -266,11 +307,8 @@ void GcodeSuite::G34() {
|
|||
z_align_level_indicator += ABS(z_measured[zstepper] - z_measured_mean);
|
||||
|
||||
// If it's getting worse, stop and throw an error
|
||||
if (last_z_align_level_indicator < z_align_level_indicator * 0.7f) {
|
||||
SERIAL_ECHOLNPGM("Decreasing accuracy detected.");
|
||||
err_break = true;
|
||||
break;
|
||||
}
|
||||
err_break = decreasing_accuracy(last_z_align_level_indicator, z_align_level_indicator);
|
||||
if (err_break) break;
|
||||
|
||||
last_z_align_level_indicator = z_align_level_indicator;
|
||||
#endif
|
||||
|
|
@ -290,8 +328,7 @@ void GcodeSuite::G34() {
|
|||
if (z_align_abs) amplification = (iteration == 1) ? _MIN(last_z_align_move[zstepper] / z_align_abs, 2.0f) : z_auto_align_amplification;
|
||||
|
||||
// Check for less accuracy compared to last move
|
||||
if (last_z_align_move[zstepper] < z_align_abs * 0.7f) {
|
||||
SERIAL_ECHOLNPGM("Decreasing accuracy detected.");
|
||||
if (decreasing_accuracy(last_z_align_move[zstepper], z_align_abs)) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " last_z_align_move = ", last_z_align_move[zstepper]);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " z_align_abs = ", z_align_abs);
|
||||
adjustment_reverse = !adjustment_reverse;
|
||||
|
|
@ -329,9 +366,14 @@ void GcodeSuite::G34() {
|
|||
|
||||
if (err_break) break;
|
||||
|
||||
if (success_break) { SERIAL_ECHOLNPGM("Target accuracy achieved."); break; }
|
||||
if (success_break) {
|
||||
SERIAL_ECHOLNPGM("Target accuracy achieved.");
|
||||
LCD_MESSAGEPGM(MSG_ACCURACY_ACHIEVED);
|
||||
break;
|
||||
}
|
||||
|
||||
} // for (iteration)
|
||||
iteration++;
|
||||
} // while (iteration < z_auto_align_iterations)
|
||||
|
||||
if (err_break)
|
||||
SERIAL_ECHOLNPGM("G34 aborted.");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "../../feature/backlash.h"
|
||||
#endif
|
||||
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/planner.h"
|
||||
#include "../../module/tool_change.h"
|
||||
|
|
@ -581,13 +581,12 @@ void GcodeSuite::G425() {
|
|||
GcodeSuite::process_subcommands_now_P(PSTR(CALIBRATION_SCRIPT_PRE));
|
||||
#endif
|
||||
|
||||
TEMPORARY_SOFT_ENDSTOP_STATE(false);
|
||||
TEMPORARY_BED_LEVELING_STATE(false);
|
||||
|
||||
if (homing_needed_error()) return;
|
||||
|
||||
measurements_t m;
|
||||
TEMPORARY_BED_LEVELING_STATE(false);
|
||||
SET_SOFT_ENDSTOP_LOOSE(true);
|
||||
|
||||
measurements_t m;
|
||||
float uncertainty = parser.seenval('U') ? parser.value_float() : CALIBRATION_MEASUREMENT_UNCERTAIN;
|
||||
|
||||
if (parser.seen('B'))
|
||||
|
|
@ -612,6 +611,8 @@ void GcodeSuite::G425() {
|
|||
else
|
||||
calibrate_all();
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
|
||||
#ifdef CALIBRATION_SCRIPT_POST
|
||||
GcodeSuite::process_subcommands_now_P(PSTR(CALIBRATION_SCRIPT_POST));
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "../../module/probe.h"
|
||||
#include "../../feature/probe_temp_comp.h"
|
||||
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
#include "../../MarlinCore.h" // for wait_for_heatup and idle()
|
||||
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "../gcode.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/probe.h"
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@
|
|||
#include "../../lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#if HAS_RESUME_CONTINUE
|
||||
#include "../../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
#ifndef GET_PIN_MAP_PIN_M43
|
||||
#define GET_PIN_MAP_PIN_M43(Q) GET_PIN_MAP_PIN(Q)
|
||||
#endif
|
||||
|
|
@ -362,7 +366,10 @@ void GcodeSuite::M43() {
|
|||
}
|
||||
}
|
||||
|
||||
if (TERN0(HAS_RESUME_CONTINUE, !wait_for_user)) break;
|
||||
#if HAS_RESUME_CONTINUE
|
||||
ui.update();
|
||||
if (!wait_for_user) break;
|
||||
#endif
|
||||
|
||||
safe_delay(200);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void GcodeSuite::M111() {
|
|||
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
|
||||
SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL0.rxMaxEnqueued());
|
||||
#endif
|
||||
#endif // !defined(__AVR__) || !defined(USBCON)
|
||||
#endif // !__AVR__ || !USBCON
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../gcode.h"
|
||||
#include "../../MarlinCore.h" // for stepper_inactive_time, disable_e_steppers
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
#include "../../module/stepper.h"
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ void GcodeSuite::M211() {
|
|||
l_soft_max = soft_endstop.max.asLogical();
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM(STR_SOFT_ENDSTOPS);
|
||||
if (parser.seen('S')) soft_endstops_enabled = parser.value_bool();
|
||||
serialprint_onoff(soft_endstops_enabled);
|
||||
if (parser.seen('S')) soft_endstop._enabled = parser.value_bool();
|
||||
serialprint_onoff(soft_endstop._enabled);
|
||||
print_xyz(l_soft_min, PSTR(STR_SOFT_MIN), PSTR(" "));
|
||||
print_xyz(l_soft_max, PSTR(STR_SOFT_MAX));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DIRECT_PIN_CONTROL)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../MarlinCore.h" // for pin_is_protected and idle()
|
||||
#include "../../module/stepper.h"
|
||||
|
|
@ -50,3 +54,5 @@ void GcodeSuite::M226() {
|
|||
} // pin_state -1 0 1 && pin > -1
|
||||
} // parser.seen('P')
|
||||
}
|
||||
|
||||
#endif // DIRECT_PIN_CONTROL
|
||||
|
|
|
|||
|
|
@ -20,9 +20,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DIRECT_PIN_CONTROL)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../MarlinCore.h" // for pin_is_protected
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_FAN
|
||||
#include "../../module/temperature.h"
|
||||
|
|
@ -96,3 +99,5 @@ void GcodeSuite::M42() {
|
|||
extDigitalWrite(pin, pin_status);
|
||||
analogWrite(pin, pin_status);
|
||||
}
|
||||
|
||||
#endif // DIRECT_PIN_CONTROL
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
const DualXMode previous_mode = dual_x_carriage_mode;
|
||||
|
||||
dual_x_carriage_mode = (DualXMode)parser.value_byte();
|
||||
mirrored_duplication_mode = false;
|
||||
idex_set_mirrored_mode(false);
|
||||
|
||||
if (dual_x_carriage_mode == DXC_MIRRORED_MODE) {
|
||||
if (previous_mode != DXC_DUPLICATION_MODE) {
|
||||
|
|
@ -77,8 +77,7 @@
|
|||
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
return;
|
||||
}
|
||||
mirrored_duplication_mode = true;
|
||||
stepper.set_directions();
|
||||
idex_set_mirrored_mode(true);
|
||||
float x_jog = current_position.x - .1;
|
||||
for (uint8_t i = 2; --i;) {
|
||||
planner.buffer_line(x_jog, current_position.y, current_position.z, current_position.e, feedrate_mm_s, 0);
|
||||
|
|
@ -102,10 +101,8 @@
|
|||
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
break;
|
||||
}
|
||||
active_extruder_parked = false;
|
||||
extruder_duplication_enabled = false;
|
||||
stepper.set_directions();
|
||||
delayed_move_time = 0;
|
||||
idex_set_parked(false);
|
||||
set_duplication_enabled(false);
|
||||
}
|
||||
else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default
|
||||
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
|
|
@ -125,7 +122,7 @@
|
|||
if (!active_extruder_parked) DEBUG_ECHOPGM(" NOT ");
|
||||
DEBUG_ECHOPGM(" parked.");
|
||||
DEBUG_ECHOPAIR("\nactive_extruder_x_pos: ", current_position.x);
|
||||
DEBUG_ECHOPAIR("\ninactive_extruder_x_pos: ", inactive_extruder_x_pos);
|
||||
DEBUG_ECHOPAIR("\ninactive_extruder_x: ", inactive_extruder_x);
|
||||
DEBUG_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled));
|
||||
DEBUG_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset);
|
||||
DEBUG_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset);
|
||||
|
|
@ -166,7 +163,7 @@
|
|||
if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly
|
||||
else if (parser.seenval('E')) duplication_e_mask = pow(2, parser.value_int() + 1) - 1; // Set the mask by E index
|
||||
ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
|
||||
extruder_duplication_enabled = ena && (duplication_e_mask >= 3);
|
||||
set_duplication_enabled(ena && (duplication_e_mask >= 3));
|
||||
}
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM(STR_DUPLICATION_MODE);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "../../module/temperature.h"
|
||||
#include "../../module/planner.h" // for planner.finish_and_disable
|
||||
#include "../../module/printcounter.h" // for print_job_timer.stop
|
||||
#include "../../lcd/ultralcd.h" // for LCD_MESSAGEPGM_P
|
||||
#include "../../lcd/marlinui.h" // for LCD_MESSAGEPGM_P
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../gcode.h"
|
||||
|
||||
#include "../../lcd/ultralcd.h" // for lcd_reset_alert_level
|
||||
#include "../../lcd/marlinui.h" // for lcd_reset_alert_level
|
||||
#include "../../MarlinCore.h" // for marlin_state
|
||||
#include "../queue.h" // for flush_and_request_resend
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
* Tx Same as T?, but nozzle doesn't have to be preheated. Tc requires a preheated nozzle to finish filament load.
|
||||
* Tc Load to nozzle after filament was prepared by Tc and nozzle is already heated.
|
||||
*/
|
||||
void GcodeSuite::T(const uint8_t tool_index) {
|
||||
void GcodeSuite::T(const int8_t tool_index) {
|
||||
|
||||
DEBUG_SECTION(log_T, "T", DEBUGGING(LEVELING));
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("...(", tool_index, ")");
|
||||
|
|
|
|||
|
|
@ -70,9 +70,11 @@ void GcodeSuite::G12() {
|
|||
TEMPORARY_BED_LEVELING_STATE(!TEST(cleans, Z_AXIS) && planner.leveling_active);
|
||||
#endif
|
||||
|
||||
TEMPORARY_SOFT_ENDSTOP_STATE(parser.boolval('E'));
|
||||
SET_SOFT_ENDSTOP_LOOSE(!parser.boolval('E'));
|
||||
|
||||
nozzle.clean(pattern, strokes, radius, objects, cleans);
|
||||
|
||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||
}
|
||||
|
||||
#endif // NOZZLE_CLEAN_FEATURE
|
||||
|
|
|
|||
|
|
@ -22,19 +22,19 @@
|
|||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ANY(HAS_DIGIPOTSS, HAS_MOTOR_CURRENT_PWM, HAS_I2C_DIGIPOT, DAC_STEPPER_CURRENT)
|
||||
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC)
|
||||
|
||||
#include "../../gcode.h"
|
||||
|
||||
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
|
||||
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
|
||||
#include "../../../module/stepper.h"
|
||||
#endif
|
||||
|
||||
#if HAS_I2C_DIGIPOT
|
||||
#if HAS_MOTOR_CURRENT_I2C
|
||||
#include "../../../feature/digipot/digipot.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
#include "../../../feature/dac/stepper_dac.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -42,61 +42,61 @@
|
|||
* M907: Set digital trimpot motor current using axis codes X, Y, Z, E, B, S
|
||||
*/
|
||||
void GcodeSuite::M907() {
|
||||
#if HAS_DIGIPOTSS
|
||||
#if HAS_MOTOR_CURRENT_SPI
|
||||
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.digipot_current(i, parser.value_int());
|
||||
if (parser.seenval('B')) stepper.digipot_current(4, parser.value_int());
|
||||
if (parser.seenval('S')) LOOP_LE_N(i, 4) stepper.digipot_current(i, parser.value_int());
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.set_digipot_current(i, parser.value_int());
|
||||
if (parser.seenval('B')) stepper.set_digipot_current(4, parser.value_int());
|
||||
if (parser.seenval('S')) LOOP_LE_N(i, 4) stepper.set_digipot_current(i, parser.value_int());
|
||||
|
||||
#elif HAS_MOTOR_CURRENT_PWM
|
||||
|
||||
#if ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY)
|
||||
if (parser.seenval('X') || parser.seenval('Y')) stepper.digipot_current(0, parser.value_int());
|
||||
if (parser.seenval('X') || parser.seenval('Y')) stepper.set_digipot_current(0, parser.value_int());
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||
if (parser.seenval('Z')) stepper.digipot_current(1, parser.value_int());
|
||||
if (parser.seenval('Z')) stepper.set_digipot_current(1, parser.value_int());
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
||||
if (parser.seenval('E')) stepper.digipot_current(2, parser.value_int());
|
||||
if (parser.seenval('E')) stepper.set_digipot_current(2, parser.value_int());
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if HAS_I2C_DIGIPOT
|
||||
#if HAS_MOTOR_CURRENT_I2C
|
||||
// this one uses actual amps in floating point
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float());
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) digipot_i2c.set_current(i, parser.value_float());
|
||||
// Additional extruders use B,C,D for channels 4,5,6.
|
||||
// TODO: Change these parameters because 'E' is used. B<index>?
|
||||
for (uint8_t i = E_AXIS + 1; i < DIGIPOT_I2C_NUM_CHANNELS; i++)
|
||||
if (parser.seenval('B' + i - (E_AXIS + 1))) digipot_i2c_set_current(i, parser.value_float());
|
||||
if (parser.seenval('B' + i - (E_AXIS + 1))) digipot_i2c.set_current(i, parser.value_float());
|
||||
#endif
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
if (parser.seenval('S')) {
|
||||
const float dac_percent = parser.value_float();
|
||||
LOOP_LE_N(i, 4) dac_current_percent(i, dac_percent);
|
||||
LOOP_LE_N(i, 4) stepper_dac.set_current_percent(i, dac_percent);
|
||||
}
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) dac_current_percent(i, parser.value_float());
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper_dac.set_current_percent(i, parser.value_float());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if EITHER(HAS_DIGIPOTSS, DAC_STEPPER_CURRENT)
|
||||
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
|
||||
|
||||
/**
|
||||
* M908: Control digital trimpot directly (M908 P<pin> S<current>)
|
||||
*/
|
||||
void GcodeSuite::M908() {
|
||||
TERN_(HAS_DIGIPOTSS, stepper.digitalPotWrite(parser.intval('P'), parser.intval('S')));
|
||||
TERN_(DAC_STEPPER_CURRENT, dac_current_raw(parser.byteval('P', -1), parser.ushortval('S', 0)));
|
||||
TERN_(HAS_MOTOR_CURRENT_SPI, stepper.set_digipot_value_spi(parser.intval('P'), parser.intval('S')));
|
||||
TERN_(HAS_MOTOR_CURRENT_DAC, stepper_dac.set_current_value(parser.byteval('P', -1), parser.ushortval('S', 0)));
|
||||
}
|
||||
|
||||
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
void GcodeSuite::M909() { stepper_dac.print_values(); }
|
||||
void GcodeSuite::M910() { stepper_dac.commit_eeprom(); }
|
||||
|
||||
void GcodeSuite::M909() { dac_print_values(); }
|
||||
void GcodeSuite::M910() { dac_commit_eeprom(); }
|
||||
#endif // HAS_MOTOR_CURRENT_DAC
|
||||
|
||||
#endif // DAC_STEPPER_CURRENT
|
||||
#endif // HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_DAC
|
||||
|
||||
#endif // HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || HAS_I2C_DIGIPOT || DAC_STEPPER_CURRENT
|
||||
#endif // HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM || HAS_MOTOR_CURRENT_I2C || HAS_MOTOR_CURRENT_DAC
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include "../../../module/printcounter.h"
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(MMU2_MENUS)
|
||||
|
|
@ -87,7 +87,7 @@ void GcodeSuite::M600() {
|
|||
if (!parser.seen('T')) { // If no tool index is specified, M600 was (probably) sent in response to filament runout.
|
||||
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
|
||||
#if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1
|
||||
if (dxc_is_duplicating())
|
||||
if (idex_is_duplicating())
|
||||
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_STATE) ? 1 : 0;
|
||||
#else
|
||||
DXC_ext = active_extruder;
|
||||
|
|
@ -108,7 +108,7 @@ void GcodeSuite::M600() {
|
|||
#if HAS_MULTI_EXTRUDER
|
||||
// Change toolhead if specified
|
||||
const uint8_t active_extruder_before_filament_change = active_extruder;
|
||||
if (active_extruder != target_extruder && TERN1(DUAL_X_CARRIAGE, !dxc_is_duplicating()))
|
||||
if (active_extruder != target_extruder && TERN1(DUAL_X_CARRIAGE, !idex_is_duplicating()))
|
||||
tool_change(target_extruder, false);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRUSA_MMU2)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "../../gcode.h"
|
||||
#include "../../../feature/powerloss.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "../../../lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "../../gcode.h"
|
||||
#include "../../../feature/powerloss.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
#include "../../../lcd/marlinui.h"
|
||||
|
||||
/**
|
||||
* M413: Enable / Disable power-loss recovery
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
|||
case 33: G33(); break; // G33: Delta Auto-Calibration
|
||||
#endif
|
||||
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
#if EITHER(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
|
||||
case 34: G34(); break; // G34: Z Stepper automatic alignment using probe
|
||||
#endif
|
||||
|
||||
|
|
@ -445,7 +445,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
|||
#endif // SDSUPPORT
|
||||
|
||||
case 31: M31(); break; // M31: Report time since the start of SD print or last M109
|
||||
|
||||
#if ENABLED(DIRECT_PIN_CONTROL)
|
||||
case 42: M42(); break; // M42: Change pin state
|
||||
#endif
|
||||
|
||||
#if ENABLED(PINS_DEBUGGING)
|
||||
case 43: M43(); break; // M43: Read pin state
|
||||
|
|
@ -620,7 +623,9 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
|||
case 221: M221(); break; // M221: Set Flow Percentage
|
||||
#endif
|
||||
|
||||
#if ENABLED(DIRECT_PIN_CONTROL)
|
||||
case 226: M226(); break; // M226: Wait until a pin reaches a state
|
||||
#endif
|
||||
|
||||
#if HAS_SERVOS
|
||||
case 280: M280(); break; // M280: Set servo position absolute
|
||||
|
|
@ -818,11 +823,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
|||
case 900: M900(); break; // M900: Set advance K factor.
|
||||
#endif
|
||||
|
||||
#if ANY(HAS_DIGIPOTSS, HAS_MOTOR_CURRENT_PWM, HAS_I2C_DIGIPOT, DAC_STEPPER_CURRENT)
|
||||
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC)
|
||||
case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes.
|
||||
#if EITHER(HAS_DIGIPOTSS, DAC_STEPPER_CURRENT)
|
||||
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
|
||||
case 908: M908(); break; // M908: Control digital trimpot directly.
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
case 909: M909(); break; // M909: Print digipot/DAC current value
|
||||
case 910: M910(); break; // M910: Commit digipot/DAC value to external EEPROM
|
||||
#endif
|
||||
|
|
@ -923,6 +928,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
|||
|
||||
case 'T': T(parser.codenum); break; // Tn: Tool Change
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
case 'D': D(parser.codenum); break; // Dn: Debug codes
|
||||
#endif
|
||||
|
||||
default:
|
||||
#if ENABLED(WIFI_CUSTOM_COMMAND)
|
||||
if (wifi_custom_command(parser.command_ptr)) break;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
* The '#' is necessary when calling from within sd files, as it stops buffer prereading
|
||||
* M33 - Get the longname version of a path. (Requires LONG_FILENAME_HOST_SUPPORT)
|
||||
* M34 - Set SD Card sorting options. (Requires SDCARD_SORT_ALPHA)
|
||||
* M42 - Change pin status via gcode: M42 P<pin> S<value>. LED pin assumed if P is omitted.
|
||||
* M42 - Change pin status via gcode: M42 P<pin> S<value>. LED pin assumed if P is omitted. (Requires DIRECT_PIN_CONTROL)
|
||||
* M43 - Display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins
|
||||
* M48 - Measure Z Probe repeatability: M48 P<points> X<pos> Y<pos> V<level> E<engage> L<legs> S<chizoid>. (Requires Z_MIN_PROBE_REPEATABILITY_TEST)
|
||||
* M73 - Set the progress percentage. (Requires LCD_SET_PROGRESS_MANUALLY)
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
* M220 - Set Feedrate Percentage: "M220 S<percent>" (i.e., "FR" on the LCD)
|
||||
* Use "M220 B" to back up the Feedrate Percentage and "M220 R" to restore it. (Requires PRUSA_MMU2)
|
||||
* M221 - Set Flow Percentage: "M221 S<percent>"
|
||||
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>"
|
||||
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>" (Requires DIRECT_PIN_CONTROL)
|
||||
* M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE)
|
||||
* M250 - Set LCD contrast: "M250 C<contrast>" (0-63). (Requires LCD support)
|
||||
* M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
|
||||
|
|
@ -258,9 +258,9 @@
|
|||
* M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE)
|
||||
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660 or L6470)
|
||||
* M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
|
||||
* M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN)
|
||||
* M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT)
|
||||
* M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT)
|
||||
* M908 - Control digital trimpot directly. (Requires HAS_MOTOR_CURRENT_DAC or DIGIPOTSS_PIN)
|
||||
* M909 - Print digipot/DAC current value. (Requires HAS_MOTOR_CURRENT_DAC)
|
||||
* M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires HAS_MOTOR_CURRENT_DAC)
|
||||
* M911 - Report stepper driver overtemperature pre-warn condition. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
|
||||
* M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
|
||||
* M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
|
||||
|
|
@ -285,6 +285,7 @@
|
|||
* M995 - Touch screen calibration for TFT display
|
||||
* M997 - Perform in-application firmware update
|
||||
* M999 - Restart after being stopped by error
|
||||
* D... - Custom Development G-code. Add hooks to 'gcode_D.cpp' for developers to test features. (Requires MARLIN_DEV_MODE)
|
||||
*
|
||||
* "T" Codes
|
||||
*
|
||||
|
|
@ -408,6 +409,8 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
TERN_(MARLIN_DEV_MODE, static void D(const int16_t dcode));
|
||||
|
||||
static void G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move=false));
|
||||
|
||||
TERN_(ARC_SUPPORT, static void G2_G3(const bool clockwise));
|
||||
|
|
@ -462,11 +465,12 @@ private:
|
|||
|
||||
TERN_(DELTA_AUTO_CALIBRATION, static void G33());
|
||||
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
#if EITHER(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
|
||||
static void G34();
|
||||
static void M422();
|
||||
#endif
|
||||
|
||||
TERN_(Z_STEPPER_AUTO_ALIGN, static void M422());
|
||||
|
||||
TERN_(ASSISTED_TRAMMING, static void G35());
|
||||
|
||||
TERN_(G38_PROBE_TARGET, static void G38(const int8_t subcode));
|
||||
|
|
@ -541,8 +545,7 @@ private:
|
|||
#endif
|
||||
#endif
|
||||
|
||||
static void M42();
|
||||
|
||||
TERN_(DIRECT_PIN_CONTROL, static void M42());
|
||||
TERN_(PINS_DEBUGGING, static void M43());
|
||||
|
||||
TERN_(Z_MIN_PROBE_REPEATABILITY_TEST, static void M48());
|
||||
|
|
@ -670,7 +673,7 @@ private:
|
|||
static void M221();
|
||||
#endif
|
||||
|
||||
static void M226();
|
||||
TERN_(DIRECT_PIN_CONTROL, static void M226());
|
||||
|
||||
TERN_(PHOTO_GCODE, static void M240());
|
||||
|
||||
|
|
@ -845,11 +848,11 @@ private:
|
|||
static void M918();
|
||||
#endif
|
||||
|
||||
#if ANY(HAS_DIGIPOTSS, HAS_MOTOR_CURRENT_PWM, HAS_I2C_DIGIPOT, DAC_STEPPER_CURRENT)
|
||||
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC)
|
||||
static void M907();
|
||||
#if EITHER(HAS_DIGIPOTSS, DAC_STEPPER_CURRENT)
|
||||
#if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC)
|
||||
static void M908();
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#if ENABLED(HAS_MOTOR_CURRENT_DAC)
|
||||
static void M909();
|
||||
static void M910();
|
||||
#endif
|
||||
|
|
@ -882,7 +885,7 @@ private:
|
|||
|
||||
TERN_(CONTROLLER_FAN_EDITABLE, static void M710());
|
||||
|
||||
static void T(const uint8_t tool_index);
|
||||
static void T(const int8_t tool_index);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
191
Marlin/src/gcode/gcode_d.cpp
Normal file
191
Marlin/src/gcode/gcode_d.cpp
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
|
||||
#include "gcode.h"
|
||||
#include "../module/settings.h"
|
||||
#include "../module/temperature.h"
|
||||
#include "../libs/hex_print.h"
|
||||
#include "../HAL/shared/eeprom_if.h"
|
||||
#include "../HAL/shared/Delay.h"
|
||||
|
||||
/**
|
||||
* Dn: G-code for development and testing
|
||||
*
|
||||
* See https://reprap.org/wiki/G-code#D:_Debug_codes
|
||||
*
|
||||
* Put whatever else you need here to test ongoing development.
|
||||
*/
|
||||
void GcodeSuite::D(const int16_t dcode) {
|
||||
switch (dcode) {
|
||||
|
||||
case -1:
|
||||
for (;;); // forever
|
||||
|
||||
case 0:
|
||||
HAL_reboot();
|
||||
break;
|
||||
|
||||
case 1: {
|
||||
// Zero or pattern-fill the EEPROM data
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
persistentStore.access_start();
|
||||
size_t total = persistentStore.capacity();
|
||||
int pos = 0;
|
||||
const uint8_t value = 0x0;
|
||||
while(total--) {
|
||||
persistentStore.write_data(pos, &value, 1);
|
||||
}
|
||||
persistentStore.access_finish();
|
||||
#else
|
||||
settings.reset();
|
||||
settings.save();
|
||||
#endif
|
||||
HAL_reboot();
|
||||
} break;
|
||||
|
||||
case 2: { // D2 Read / Write SRAM
|
||||
#define SRAM_SIZE 8192
|
||||
uint8_t *pointer = parser.hex_adr_val('A');
|
||||
uint16_t len = parser.ushortval('C', 1);
|
||||
uintptr_t addr = (uintptr_t)pointer;
|
||||
NOMORE(addr, (size_t)(SRAM_SIZE - 1));
|
||||
NOMORE(len, SRAM_SIZE - addr);
|
||||
if (parser.seenval('X')) {
|
||||
// Write the hex bytes after the X
|
||||
uint16_t val = parser.hex_val('X');
|
||||
while (len--) {
|
||||
*pointer = val;
|
||||
pointer++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (len--) print_hex_byte(*(pointer++));
|
||||
SERIAL_EOL();
|
||||
}
|
||||
} break;
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
case 3: { // D3 Read / Write EEPROM
|
||||
uint8_t *pointer = parser.hex_adr_val('A');
|
||||
uint16_t len = parser.ushortval('C', 1);
|
||||
uintptr_t addr = (uintptr_t)pointer;
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||
#endif
|
||||
NOMORE(addr, (size_t)(MARLIN_EEPROM_SIZE - 1));
|
||||
NOMORE(len, MARLIN_EEPROM_SIZE - addr);
|
||||
if (parser.seenval('X')) {
|
||||
uint16_t val = parser.hex_val('X');
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
persistentStore.access_start();
|
||||
while(len--) {
|
||||
int pos = 0;
|
||||
persistentStore.write_data(pos, (uint8_t *)&val, sizeof(val));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
persistentStore.access_finish();
|
||||
#else
|
||||
SERIAL_ECHOLN("NO EEPROM");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
while (len--) {
|
||||
// Read bytes from EEPROM
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
persistentStore.access_start();
|
||||
uint8_t val;
|
||||
while(len--) {
|
||||
int pos = 0;
|
||||
if (!persistentStore.read_data(pos, (uint8_t *)&val, sizeof(val))) {
|
||||
print_hex_byte(val);
|
||||
}
|
||||
}
|
||||
SERIAL_EOL();
|
||||
persistentStore.access_finish();
|
||||
#else
|
||||
SERIAL_ECHOLN("NO EEPROM");
|
||||
#endif
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
|
||||
case 4: { // D4 Read / Write PIN
|
||||
// const uint8_t pin = parser.byteval('P');
|
||||
// const bool is_out = parser.boolval('F'),
|
||||
// val = parser.byteval('V', LOW);
|
||||
if (parser.seenval('X')) {
|
||||
// TODO: Write the hex bytes after the X
|
||||
//while (len--) {
|
||||
//}
|
||||
}
|
||||
else {
|
||||
// while (len--) {
|
||||
// TODO: Read bytes from EEPROM
|
||||
// print_hex_byte(eeprom_read_byte(*(adr++));
|
||||
// }
|
||||
SERIAL_EOL();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 5: { // D4 Read / Write onboard Flash
|
||||
#define FLASH_SIZE 1024
|
||||
uint8_t *pointer = parser.hex_adr_val('A');
|
||||
uint16_t len = parser.ushortval('C', 1);
|
||||
uintptr_t addr = (uintptr_t)pointer;
|
||||
NOMORE(addr, (size_t)(FLASH_SIZE - 1));
|
||||
NOMORE(len, FLASH_SIZE - addr);
|
||||
if (parser.seenval('X')) {
|
||||
// TODO: Write the hex bytes after the X
|
||||
//while (len--) {
|
||||
//}
|
||||
}
|
||||
else {
|
||||
// while (len--) {
|
||||
// TODO: Read bytes from EEPROM
|
||||
// print_hex_byte(eeprom_read_byte(adr++));
|
||||
// }
|
||||
SERIAL_EOL();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 100: { // D100 Disable heaters and attempt a hard hang (Watchdog Test)
|
||||
SERIAL_ECHOLN("Disabling heaters and attempting to trigger Watchdog");
|
||||
SERIAL_ECHOLN("(USE_WATCHDOG " TERN(USE_WATCHDOG, "ENABLED", "DISABLED") ")");
|
||||
thermalManager.disable_all_heaters();
|
||||
delay(1000); // Allow time to print
|
||||
DISABLE_ISRS();
|
||||
// Use a low-level delay that does not rely on interrupts to function
|
||||
// Do not spin forever, to avoid thermal risks if heaters are enabled and
|
||||
// watchdog does not work.
|
||||
DELAY_US(10000000);
|
||||
ENABLE_ISRS();
|
||||
SERIAL_ECHOLN("FAILURE: Watchdog did not trigger board reset.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue