Compare commits

..

No commits in common. "2.0.x" and "2.0.7" have entirely different histories.
2.0.x ... 2.0.7

369 changed files with 10201 additions and 30181 deletions

View file

@ -9,51 +9,35 @@ assignees: ''
<!-- <!--
Please follow the instructions below. Failure to do so may result in your issue being closed. Have you read Marlin's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/MarlinFirmware/Marlin/blob/master/.github/code_of_conduct.md
### Before Reporting a Bug Do you want to ask a question? Are you looking for support? Please don't post here. Instead please use one of the support links at https://github.com/MarlinFirmware/Marlin/issues/new/choose
1. Test with the `bugfix-2.0.x` branch to see whether the issue still exists. Before filing an issue be sure to test the "bugfix" branches to see whether the issue has been resolved.
2. Get troubleshooting help from the Marlin community to confirm it's a bug and not just a configuration error. Links at https://github.com/MarlinFirmware/Marlin/issues/new/choose
### Instructions
1. Fill out every section of the template below.
2. Always attach configuration files, regardless of whether you think they are involved.
3. Read and understand Marlin's Code of Conduct. By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/MarlinFirmware/Marlin/blob/master/.github/code_of_conduct.md
--> -->
### Bug Description ### Bug Description
<!-- Describe the bug in this section. (You can remove this invisible comment.) --> <!-- Description of the bug -->
### Configuration Files ### My Configurations
**Required:** Include a ZIP file containing `Configuration.h` and `Configuration_adv.h`. **Required:** Please include a ZIP file containing your `Configuration.h` and `Configuration_adv.h` files.
If you've made any other modifications describe them in detail here.
### Steps to Reproduce ### Steps to Reproduce
<!-- Describe the steps needed to reproduce the issue. (You can remove this invisible comment.) --> <!-- Please describe the steps needed to reproduce the issue -->
1. [First Step] 1. [First Step]
2. [Second Step] 2. [Second Step]
3. [and so on...] 3. [and so on...]
**Expected behavior:** **Expected behavior:** [What you expect to happen]
<!-- Describe what you expected to happen here. (You can remove this invisible comment.) --> **Actual behavior:** [What actually happens]
**Actual behavior:**
<!-- Describe what actually happens here. (You can remove this invisible comment.) -->
#### Additional Information #### Additional Information
* Provide pictures or links to videos that clearly demonstrate the issue. * Provide pictures or links to videos that clearly demonstrate the issue.
* See [Contributing to Marlin](https://github.com/MarlinFirmware/Marlin/blob/2.0.x/.github/contributing.md) for additional guidelines. * See [How Can I Contribute](#how-can-i-contribute) for additional guidelines.

View file

@ -346,10 +346,11 @@
#endif #endif
#endif #endif
// @section temperature
//=========================================================================== //===========================================================================
//============================= Thermal Settings ============================ //============================= Thermal Settings ============================
//=========================================================================== //===========================================================================
// @section temperature
/** /**
* --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table * --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
@ -431,12 +432,6 @@
#define DUMMY_THERMISTOR_998_VALUE 25 #define DUMMY_THERMISTOR_998_VALUE 25
#define DUMMY_THERMISTOR_999_VALUE 100 #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 // 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. // from the two sensors differ too much the print will be aborted.
//#define TEMP_SENSOR_1_AS_REDUNDANT //#define TEMP_SENSOR_1_AS_REDUNDANT
@ -491,13 +486,12 @@
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM) //#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2] // Set/get with gcode: M301 E[extruder number, 0-2]
#if ENABLED(PID_PARAMS_PER_HOTEND) #if ENABLED(PID_PARAMS_PER_HOTEND)
// Specify between 1 and HOTENDS values per array. // Specify between 1 and HOTENDS values per array.
// If fewer than EXTRUDER values are provided, the last element will be repeated. // If fewer than EXTRUDER values are provided, the last element will be repeated.
#define DEFAULT_Kp_LIST { 22.20, 22.20 } #define DEFAULT_Kp_LIST { 22.20, 20.0 }
#define DEFAULT_Ki_LIST { 1.08, 1.08 } #define DEFAULT_Ki_LIST { 1.08, 1.0 }
#define DEFAULT_Kd_LIST { 114.00, 114.00 } #define DEFAULT_Kd_LIST { 114.00, 112.0 }
#else #else
#define DEFAULT_Kp 22.20 #define DEFAULT_Kp 22.20
#define DEFAULT_Ki 1.08 #define DEFAULT_Ki 1.08
@ -2204,47 +2198,43 @@
//=============================== Graphical TFTs ============================== //=============================== Graphical TFTs ==============================
//============================================================================= //=============================================================================
/** //
* TFT Type - Select your Display type // TFT display with optional touch screen
* // Color Marlin UI with standard menu system
* Available options are: //
* MKS_TS35_V2_0, //#define TFT_320x240
* MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, //#define TFT_320x240_SPI
* MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R //#define TFT_480x320
* TFT_TRONXY_X5SA, ANYCUBIC_TFT35, LONGER_LK_TFT28 //#define TFT_480x320_SPI
* TFT_GENERIC
*
* For TFT_GENERIC, you need to configure these 3 options:
* Driver: TFT_DRIVER
* Current Drivers are: AUTO, ST7735, ST7789, ST7796, R61505, ILI9328, ILI9341, ILI9488
* Resolution: TFT_WIDTH and TFT_HEIGHT
* Interface: TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI
*/
//#define TFT_GENERIC
/** //
* TFT UI - User Interface Selection. Enable one of the following options: // Skip autodetect and force specific TFT driver
* // Mandatory for SPI screens with no MISO line
* TFT_CLASSIC_UI - Emulated DOGM - 128x64 Upscaled // Available drivers are: ST7735, ST7789, ST7796, R61505, ILI9328, ILI9341, ILI9488
* TFT_COLOR_UI - Marlin Default Menus, Touch Friendly, using full TFT capabilities //
* TFT_LVGL_UI - A Modern UI using LVGL //#define TFT_DRIVER AUTO
*
* 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: // SPI display (MKS Robin Nano V2.0, MKS Gen L V2.0)
* // Upscaled 128x64 Marlin UI
* 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, //#define SPI_GRAPHICAL_TFT
* TFT_ROTATE_270, TFT_ROTATE_270_MIRROR_X, TFT_ROTATE_270_MIRROR_Y,
* TFT_MIRROR_X, TFT_MIRROR_Y, TFT_NO_ROTATION //
*/ // FSMC display (MKS Robin, Alfawise U20, JGAurora A5S, REXYZ A1, etc.)
//#define TFT_ROTATION TFT_NO_ROTATION // Upscaled 128x64 Marlin UI
//
//#define FSMC_GRAPHICAL_TFT
//
// TFT LVGL UI
//
// 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 TFT_LVGL_UI_FSMC // Robin nano v1.2 uses FSMC
//#define TFT_LVGL_UI_SPI // Robin nano v2.0 uses SPI
//============================================================================= //=============================================================================
//============================ Other Controllers ============================ //============================ Other Controllers ============================
@ -2314,6 +2304,9 @@
// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
//#define TEMP_STAT_LEDS //#define TEMP_STAT_LEDS
// SkeinForge sends the wrong arc G-codes when using Arc Point as fillet procedure
//#define SF_ARC_FIX
// Support for the BariCUDA Paste Extruder // Support for the BariCUDA Paste Extruder
//#define BARICUDA //#define BARICUDA
@ -2399,12 +2392,17 @@
#define PRINTER_EVENT_LEDS #define PRINTER_EVENT_LEDS
#endif #endif
/**
* R/C SERVO support
* Sponsored by TrinityLabs, Reworked by codexmas
*/
/** /**
* Number of servos * Number of servos
* *
* For some servo-related options NUM_SERVOS will be set automatically. * For some servo-related options NUM_SERVOS will be set automatically.
* Set this manually if there are extra servos needing manual control. * Set this manually if there are extra servos needing manual control.
* Set to 0 to turn off servo support. * Leave undefined or set to 0 to entirely disable the servo subsystem.
*/ */
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
@ -2416,5 +2414,5 @@
// Only power servos during movement, otherwise leave off to prevent jitter // Only power servos during movement, otherwise leave off to prevent jitter
//#define DEACTIVATE_SERVOS_AFTER_MOVE //#define DEACTIVATE_SERVOS_AFTER_MOVE
// Edit servo angles with M281 and save to EEPROM with M500 // Allow servo angle to be edited and saved to EEPROM
//#define EDITABLE_SERVO_ANGLES //#define EDITABLE_SERVO_ANGLES

View file

@ -32,10 +32,11 @@
*/ */
#define CONFIGURATION_ADV_H_VERSION 020007 #define CONFIGURATION_ADV_H_VERSION 020007
// @section temperature
//=========================================================================== //===========================================================================
//============================= Thermal Settings ============================ //============================= Thermal Settings ============================
//=========================================================================== //===========================================================================
// @section temperature
/** /**
* Thermocouple sensors are quite sensitive to noise. Any noise induced in * Thermocouple sensors are quite sensitive to noise. Any noise induced in
@ -124,19 +125,9 @@
#define HEATER_BED_INVERTING true #define HEATER_BED_INVERTING true
#endif #endif
// /**
// Heated Bed Bang-Bang options * Heated Chamber settings
// */
#if DISABLED(PIDTEMPBED)
#define BED_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control
#if ENABLED(BED_LIMIT_SWITCHING)
#define BED_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > BED_HYSTERESIS
#endif
#endif
//
// Heated Chamber options
//
#if TEMP_SENSOR_CHAMBER #if TEMP_SENSOR_CHAMBER
#define CHAMBER_MINTEMP 5 #define CHAMBER_MINTEMP 5
#define CHAMBER_MAXTEMP 60 #define CHAMBER_MAXTEMP 60
@ -144,28 +135,12 @@
//#define CHAMBER_LIMIT_SWITCHING //#define CHAMBER_LIMIT_SWITCHING
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
//#define HEATER_CHAMBER_INVERTING false //#define HEATER_CHAMBER_INVERTING false
#endif
//#define CHAMBER_FAN // Enable a fan on the chamber #if DISABLED(PIDTEMPBED)
#if ENABLED(CHAMBER_FAN) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
#define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve. #if ENABLED(BED_LIMIT_SWITCHING)
#if CHAMBER_FAN_MODE == 0 #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
#define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255)
#elif CHAMBER_FAN_MODE == 1
#define CHAMBER_FAN_BASE 128 // Base chamber fan PWM (0-255); turns on when chamber temperature is above the target
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C above target
#elif CHAMBER_FAN_MODE == 2
#define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255)
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target
#endif
#endif
//#define CHAMBER_VENT // Enable a servo-controlled vent on the chamber
#if ENABLED(CHAMBER_VENT)
#define CHAMBER_VENT_SERVO_NR 1 // Index of the vent servo
#define HIGH_EXCESS_HEAT_LIMIT 5 // How much above target temp to consider there is excess heat in the chamber
#define LOW_EXCESS_HEAT_LIMIT 3
#define MIN_COOLING_SLOPE_TIME_CHAMBER_VENT 20
#define MIN_COOLING_SLOPE_DEG_CHAMBER_VENT 1.5
#endif #endif
#endif #endif
@ -796,7 +771,6 @@
// //
//#define ASSISTED_TRAMMING //#define ASSISTED_TRAMMING
#if ENABLED(ASSISTED_TRAMMING) #if ENABLED(ASSISTED_TRAMMING)
// Define positions for probing points, use the hotend as reference not the sensor. // Define positions for probing points, use the hotend as reference not the sensor.
#define TRAMMING_POINT_XY { { 20, 20 }, { 200, 20 }, { 200, 200 }, { 20, 200 } } #define TRAMMING_POINT_XY { { 20, 20 }, { 200, 20 }, { 200, 200 }, { 20, 200 } }
@ -806,9 +780,11 @@
#define TRAMMING_POINT_NAME_3 "Back-Right" #define TRAMMING_POINT_NAME_3 "Back-Right"
#define TRAMMING_POINT_NAME_4 "Back-Left" #define TRAMMING_POINT_NAME_4 "Back-Left"
#define RESTORE_LEVELING_AFTER_G35 // Enable to restore leveling setup after operation // Enable to restore leveling setup after operation
//#define REPORT_TRAMMING_MM // Report Z deviation (mm) for each point relative to the first #define RESTORE_LEVELING_AFTER_G35
//#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item for Assisted Tramming
// Add a menu item for Assisted Tramming
//#define ASSISTED_TRAMMING_MENU_ITEM
/** /**
* Screw thread: * Screw thread:
@ -817,7 +793,6 @@
* M5: 50 = Clockwise, 51 = Counter-Clockwise * M5: 50 = Clockwise, 51 = Counter-Clockwise
*/ */
#define TRAMMING_SCREW_THREAD 30 #define TRAMMING_SCREW_THREAD 30
#endif #endif
// @section motion // @section motion
@ -1073,14 +1048,6 @@
#if HAS_LCD_MENU #if HAS_LCD_MENU
// Add Probe Z Offset calibration to the Z Probe Offsets menu
#if HAS_BED_PROBE
//#define PROBE_OFFSET_WIZARD
#if ENABLED(PROBE_OFFSET_WIZARD)
#define PROBE_OFFSET_START -4.0 // Estimated nozzle-to-probe Z offset, plus a little extra
#endif
#endif
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
#if ENABLED(LCD_INFO_MENU) #if ENABLED(LCD_INFO_MENU)
@ -1375,7 +1342,7 @@
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
//#define USE_BIG_EDIT_FONT //#define USE_BIG_EDIT_FONT
// A smaller font may be used on the Info Screen. Costs 2434 bytes of PROGMEM. // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM.
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
//#define USE_SMALL_INFOFONT //#define USE_SMALL_INFOFONT
@ -1560,9 +1527,10 @@
#endif #endif
// //
// Classic UI Options // FSMC / SPI Graphical TFT
// //
#if TFT_SCALED_DOGLCD #if TFT_SCALED_DOGLCD
//#define GRAPHICAL_TFT_ROTATE_180
//#define TFT_MARLINUI_COLOR 0xFFFF // White //#define TFT_MARLINUI_COLOR 0xFFFF // White
//#define TFT_MARLINBG_COLOR 0x0000 // Black //#define TFT_MARLINBG_COLOR 0x0000 // Black
//#define TFT_DISABLED_COLOR 0x0003 // Almost black //#define TFT_DISABLED_COLOR 0x0003 // Almost black
@ -1800,7 +1768,6 @@
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections #define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
//#define SF_ARC_FIX // Enable only if using SkeinForge with "Arc Point" fillet procedure
#endif #endif
// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
@ -3375,25 +3342,6 @@
//#define JOYSTICK_DEBUG //#define JOYSTICK_DEBUG
#endif #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 * MAX7219 Debug Matrix
* *
@ -3575,11 +3523,6 @@
// //
//#define M100_FREE_MEMORY_WATCHER //#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 // M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
// //

View file

@ -22,10 +22,8 @@
# (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file # (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*). # 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. Set # 3. Set the line containing "MCU" to match your board's processor.
# "PROG_MCU" as the AVR part name corresponding to "MCU". You can use the # Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
# 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, # or Diecimila have the atmega168. If you're using a LilyPad Arduino,
# change F_CPU to 8000000. If you are using Gen7 electronics, you # change F_CPU to 8000000. If you are using Gen7 electronics, you
# probably need to use 20000000. Either way, you must regenerate # probably need to use 20000000. Either way, you must regenerate
@ -36,18 +34,18 @@
# 5. Type "make upload", reset your Arduino board, and press enter to # 5. Type "make upload", reset your Arduino board, and press enter to
# upload your program to the Arduino board. # upload your program to the Arduino board.
# #
# Note that all settings at the top of this file can be overridden from # Note that all settings at the top of this file can be overriden from
# the command line with, for example, "make HARDWARE_MOTHERBOARD=71" # 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... # 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/ \ # make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
# HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino # HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
# #
# To compile and upload simply add "upload" to the end of the line... # 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/ \ # make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
# HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino upload # HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
# #
# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or # If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
# start upload manually (using stk500) like so: # start upload manually (using stk500) like so:
@ -59,26 +57,7 @@
# #
# This defines the board to compile for (see boards.h for your board's ID) # This defines the board to compile for (see boards.h for your board's ID)
HARDWARE_MOTHERBOARD ?= 1020 HARDWARE_MOTHERBOARD ?= 11
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 # Arduino source install directory, and version number
# On most linuxes this will be /usr/share/arduino # On most linuxes this will be /usr/share/arduino
@ -88,38 +67,32 @@ ARDUINO_VERSION ?= 106
# The installed Libraries are in the User folder # The installed Libraries are in the User folder
ARDUINO_USER_DIR ?= ${HOME}/Arduino ARDUINO_USER_DIR ?= ${HOME}/Arduino
# You can optionally set a path to the avr-gcc tools. # You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
# Requires a trailing slash. For example, /usr/local/avr-gcc/bin/
AVR_TOOLS_PATH ?= AVR_TOOLS_PATH ?=
# Programmer configuration #Programmer configuration
UPLOAD_RATE ?= 57600 UPLOAD_RATE ?= 57600
AVRDUDE_PROGRAMMER ?= arduino 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 UPLOAD_PORT ?= /dev/ttyUSB0
# Directory used to build files in, contains all the build files, from object #Directory used to build files in, contains all the build files, from object files to the final hex file
# files to the final hex file on linux it is best to put an absolute path #on linux it is best to put an absolute path like /home/username/tmp .
# like /home/username/tmp .
BUILD_DIR ?= applet BUILD_DIR ?= applet
# This defines whether Liquid_TWI2 support will be built # This defines whether Liquid_TWI2 support will be built
LIQUID_TWI2 ?= 0 LIQUID_TWI2 ?= 0
# This defines if Wire is needed # this defines if Wire is needed
WIRE ?= 0 WIRE ?= 0
# This defines if Tone is needed (i.e SPEAKER is defined in Configuration.h) # this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
# Disabling this (and SPEAKER) saves approximatively 350 bytes of memory. U8GLIB ?= 1
TONE ?= 1
# This defines if U8GLIB is needed (may require RELOC_WORKAROUND) # this defines whether to include the Trinamic TMCStepper library
U8GLIB ?= 0 TMC ?= 1
# This defines whether to include the Trinamic TMCStepper library # this defines whether to include the AdaFruit NeoPixel library
TMC ?= 0
# This defines whether to include the AdaFruit NeoPixel library
NEOPIXEL ?= 0 NEOPIXEL ?= 0
############ ############
@ -235,8 +208,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1119)
else ifeq ($(HARDWARE_MOTHERBOARD),1120) else ifeq ($(HARDWARE_MOTHERBOARD),1120)
# Ultimaker (Older electronics. Pre 1.5.4. This is rare) # Ultimaker (Older electronics. Pre 1.5.4. This is rare)
else ifeq ($(HARDWARE_MOTHERBOARD),1121) else ifeq ($(HARDWARE_MOTHERBOARD),1121)
MCU ?= atmega1280 MCU ?= atmega1280
PROG_MCU ?= m1280
# Azteeg X3 # Azteeg X3
else ifeq ($(HARDWARE_MOTHERBOARD),1122) else ifeq ($(HARDWARE_MOTHERBOARD),1122)
@ -378,11 +350,9 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1320)
# Minitronics v1.0/1.1 # Minitronics v1.0/1.1
else ifeq ($(HARDWARE_MOTHERBOARD),1400) else ifeq ($(HARDWARE_MOTHERBOARD),1400)
MCU ?= atmega1281 MCU ?= atmega1281
PROG_MCU ?= m1281
# Silvergate v1.0 # Silvergate v1.0
else ifeq ($(HARDWARE_MOTHERBOARD),1401) else ifeq ($(HARDWARE_MOTHERBOARD),1401)
MCU ?= atmega1281 MCU ?= atmega1281
PROG_MCU ?= m1281
# #
# Sanguinololu and Derivatives - ATmega644P, ATmega1284P # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
@ -392,57 +362,46 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1401)
else ifeq ($(HARDWARE_MOTHERBOARD),1500) else ifeq ($(HARDWARE_MOTHERBOARD),1500)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# Sanguinololu 1.2 and above # Sanguinololu 1.2 and above
else ifeq ($(HARDWARE_MOTHERBOARD),1501) else ifeq ($(HARDWARE_MOTHERBOARD),1501)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# Melzi # Melzi
else ifeq ($(HARDWARE_MOTHERBOARD),1502) else ifeq ($(HARDWARE_MOTHERBOARD),1502)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# Melzi V2.0 # Melzi V2.0
else ifeq ($(HARDWARE_MOTHERBOARD),1503) else ifeq ($(HARDWARE_MOTHERBOARD),1503)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
# Melzi with ATmega1284 (MaKr3d version) # Melzi with ATmega1284 (MaKr3d version)
else ifeq ($(HARDWARE_MOTHERBOARD),1504) else ifeq ($(HARDWARE_MOTHERBOARD),1504)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
# Melzi Creality3D board (for CR-10 etc) # Melzi Creality3D board (for CR-10 etc)
else ifeq ($(HARDWARE_MOTHERBOARD),1505) else ifeq ($(HARDWARE_MOTHERBOARD),1505)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
# Melzi Malyan M150 board # Melzi Malyan M150 board
else ifeq ($(HARDWARE_MOTHERBOARD),1506) else ifeq ($(HARDWARE_MOTHERBOARD),1506)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
# Tronxy X5S # Tronxy X5S
else ifeq ($(HARDWARE_MOTHERBOARD),1507) else ifeq ($(HARDWARE_MOTHERBOARD),1507)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
# STB V1.1 # STB V1.1
else ifeq ($(HARDWARE_MOTHERBOARD),1508) else ifeq ($(HARDWARE_MOTHERBOARD),1508)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
# Azteeg X1 # Azteeg X1
else ifeq ($(HARDWARE_MOTHERBOARD),1509) else ifeq ($(HARDWARE_MOTHERBOARD),1509)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
# Anet 1.0 (Melzi clone) # Anet 1.0 (Melzi clone)
else ifeq ($(HARDWARE_MOTHERBOARD),1510) else ifeq ($(HARDWARE_MOTHERBOARD),1510)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
# #
# Other ATmega644P, ATmega644, ATmega1284P # Other ATmega644P, ATmega644, ATmega1284P
@ -452,61 +411,50 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1510)
else ifeq ($(HARDWARE_MOTHERBOARD),1600) else ifeq ($(HARDWARE_MOTHERBOARD),1600)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# Gen3+ # Gen3+
else ifeq ($(HARDWARE_MOTHERBOARD),1601) else ifeq ($(HARDWARE_MOTHERBOARD),1601)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# Gen6 # Gen6
else ifeq ($(HARDWARE_MOTHERBOARD),1602) else ifeq ($(HARDWARE_MOTHERBOARD),1602)
HARDWARE_VARIANT ?= Gen6 HARDWARE_VARIANT ?= Gen6
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# Gen6 deluxe # Gen6 deluxe
else ifeq ($(HARDWARE_MOTHERBOARD),1603) else ifeq ($(HARDWARE_MOTHERBOARD),1603)
HARDWARE_VARIANT ?= Gen6 HARDWARE_VARIANT ?= Gen6
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# Gen7 custom (Alfons3 Version) # Gen7 custom (Alfons3 Version)
else ifeq ($(HARDWARE_MOTHERBOARD),1604) else ifeq ($(HARDWARE_MOTHERBOARD),1604)
HARDWARE_VARIANT ?= Gen7 HARDWARE_VARIANT ?= Gen7
MCU ?= atmega644 MCU ?= atmega644
PROG_MCU ?= m644
F_CPU ?= 20000000 F_CPU ?= 20000000
# Gen7 v1.1, v1.2 # Gen7 v1.1, v1.2
else ifeq ($(HARDWARE_MOTHERBOARD),1605) else ifeq ($(HARDWARE_MOTHERBOARD),1605)
HARDWARE_VARIANT ?= Gen7 HARDWARE_VARIANT ?= Gen7
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
F_CPU ?= 20000000 F_CPU ?= 20000000
# Gen7 v1.3 # Gen7 v1.3
else ifeq ($(HARDWARE_MOTHERBOARD),1606) else ifeq ($(HARDWARE_MOTHERBOARD),1606)
HARDWARE_VARIANT ?= Gen7 HARDWARE_VARIANT ?= Gen7
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
F_CPU ?= 20000000 F_CPU ?= 20000000
# Gen7 v1.4 # Gen7 v1.4
else ifeq ($(HARDWARE_MOTHERBOARD),1607) else ifeq ($(HARDWARE_MOTHERBOARD),1607)
HARDWARE_VARIANT ?= Gen7 HARDWARE_VARIANT ?= Gen7
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p
F_CPU ?= 20000000 F_CPU ?= 20000000
# Alpha OMCA board # Alpha OMCA board
else ifeq ($(HARDWARE_MOTHERBOARD),1608) else ifeq ($(HARDWARE_MOTHERBOARD),1608)
HARDWARE_VARIANT ?= SanguinoA HARDWARE_VARIANT ?= SanguinoA
MCU ?= atmega644 MCU ?= atmega644
PROG_MCU ?= m644
# Final OMCA board # Final OMCA board
else ifeq ($(HARDWARE_MOTHERBOARD),1609) else ifeq ($(HARDWARE_MOTHERBOARD),1609)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# Sethi 3D_1 # Sethi 3D_1
else ifeq ($(HARDWARE_MOTHERBOARD),1610) else ifeq ($(HARDWARE_MOTHERBOARD),1610)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p
# #
# Teensyduino - AT90USB1286, AT90USB1286P # Teensyduino - AT90USB1286, AT90USB1286P
@ -516,60 +464,51 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1610)
else ifeq ($(HARDWARE_MOTHERBOARD),1700) else ifeq ($(HARDWARE_MOTHERBOARD),1700)
HARDWARE_VARIANT ?= Teensy HARDWARE_VARIANT ?= Teensy
MCU ?= at90usb1286 MCU ?= at90usb1286
PROG_MCU ?= usb1286
# Printrboard (AT90USB1286) # Printrboard (AT90USB1286)
else ifeq ($(HARDWARE_MOTHERBOARD),1701) else ifeq ($(HARDWARE_MOTHERBOARD),1701)
HARDWARE_VARIANT ?= Teensy HARDWARE_VARIANT ?= Teensy
MCU ?= at90usb1286 MCU ?= at90usb1286
PROG_MCU ?= usb1286
# Printrboard Revision F (AT90USB1286) # Printrboard Revision F (AT90USB1286)
else ifeq ($(HARDWARE_MOTHERBOARD),1702) else ifeq ($(HARDWARE_MOTHERBOARD),1702)
HARDWARE_VARIANT ?= Teensy HARDWARE_VARIANT ?= Teensy
MCU ?= at90usb1286 MCU ?= at90usb1286
PROG_MCU ?= usb1286
# Brainwave (AT90USB646) # Brainwave (AT90USB646)
else ifeq ($(HARDWARE_MOTHERBOARD),1703) else ifeq ($(HARDWARE_MOTHERBOARD),1703)
HARDWARE_VARIANT ?= Teensy HARDWARE_VARIANT ?= Teensy
MCU ?= at90usb646 MCU ?= at90usb646
PROG_MCU ?= usb646
# Brainwave Pro (AT90USB1286) # Brainwave Pro (AT90USB1286)
else ifeq ($(HARDWARE_MOTHERBOARD),1704) else ifeq ($(HARDWARE_MOTHERBOARD),1704)
HARDWARE_VARIANT ?= Teensy HARDWARE_VARIANT ?= Teensy
MCU ?= at90usb1286 MCU ?= at90usb1286
PROG_MCU ?= usb1286
# SAV Mk-I (AT90USB1286) # SAV Mk-I (AT90USB1286)
else ifeq ($(HARDWARE_MOTHERBOARD),1705) else ifeq ($(HARDWARE_MOTHERBOARD),1705)
HARDWARE_VARIANT ?= Teensy HARDWARE_VARIANT ?= Teensy
MCU ?= at90usb1286 MCU ?= at90usb1286
PROG_MCU ?= usb1286
# Teensy++2.0 (AT90USB1286) # Teensy++2.0 (AT90USB1286)
else ifeq ($(HARDWARE_MOTHERBOARD),1706) else ifeq ($(HARDWARE_MOTHERBOARD),1706)
HARDWARE_VARIANT ?= Teensy HARDWARE_VARIANT ?= Teensy
MCU ?= at90usb1286 MCU ?= at90usb1286
PROG_MCU ?= usb1286
# 5DPrint D8 Driver Board # 5DPrint D8 Driver Board
else ifeq ($(HARDWARE_MOTHERBOARD),1707) else ifeq ($(HARDWARE_MOTHERBOARD),1707)
HARDWARE_VARIANT ?= Teensy HARDWARE_VARIANT ?= Teensy
MCU ?= at90usb1286 MCU ?= at90usb1286
PROG_MCU ?= usb1286
# UltiMachine Archim1 (with DRV8825 drivers) # UltiMachine Archim1 (with DRV8825 drivers)
else ifeq ($(HARDWARE_MOTHERBOARD),3023) else ifeq ($(HARDWARE_MOTHERBOARD),3023)
HARDWARE_VARIANT ?= archim HARDWARE_VARIANT ?= archim
MCPU = cortex-m3 MCPU = cortex-m3
F_CPU = 84000000 F_CPU = 84000000L
IS_MCU = 0 IS_MCU = 0
# UltiMachine Archim2 (with TMC2130 drivers) # UltiMachine Archim2 (with TMC2130 drivers)
else ifeq ($(HARDWARE_MOTHERBOARD),3024) else ifeq ($(HARDWARE_MOTHERBOARD),3024)
HARDWARE_VARIANT ?= archim HARDWARE_VARIANT ?= archim
MCPU = cortex-m3 MCPU = cortex-m3
F_CPU = 84000000 F_CPU = 84000000L
IS_MCU = 0 IS_MCU = 0
endif endif
# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
# if you are setting this to something other than 16MHz # 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. # Set to 16Mhz if not yet set.
F_CPU ?= 16000000 F_CPU ?= 16000000
@ -579,8 +518,7 @@ IS_MCU ?= 1
ifeq ($(IS_MCU),1) ifeq ($(IS_MCU),1)
# Set to arduino, ATmega2560 if not yet set. # Set to arduino, ATmega2560 if not yet set.
HARDWARE_VARIANT ?= arduino HARDWARE_VARIANT ?= arduino
MCU ?= atmega2560 MCU ?= atmega2560
PROG_MCU ?= m2560
TOOL_PREFIX = avr TOOL_PREFIX = avr
MCU_FLAGS = -mmcu=$(MCU) MCU_FLAGS = -mmcu=$(MCU)
@ -611,36 +549,27 @@ VPATH += $(BUILD_DIR)
VPATH += $(HARDWARE_SRC) VPATH += $(HARDWARE_SRC)
ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino)) ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
# Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8) VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/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 endif
ifeq ($(IS_MCU),1) ifeq ($(IS_MCU),1)
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino 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/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/SPI/src
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
endif endif
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
ifeq ($(LIQUID_TWI2), 1) ifeq ($(LIQUID_TWI2), 1)
WIRE = 1 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
endif endif
ifeq ($(WIRE), 1) ifeq ($(WIRE), 1)
# Old libraries (avr-core 1.6.21 / Arduino < 1.6.8) VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
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 endif
ifeq ($(NEOPIXEL), 1) ifeq ($(NEOPIXEL), 1)
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
@ -712,23 +641,13 @@ ifeq ($(WIRE), 1)
LIB_CXXSRC += Wire.cpp LIB_CXXSRC += Wire.cpp
endif endif
ifeq ($(TONE), 1)
LIB_CXXSRC += Tone.cpp
endif
ifeq ($(U8GLIB), 1) ifeq ($(U8GLIB), 1)
LIB_CXXSRC += U8glib.cpp LIB_CXXSRC += U8glib.cpp
LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.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
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 endif
ifeq ($(TMC), 1) ifeq ($(TMC), 1)
LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.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
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 endif
ifeq ($(RELOC_WORKAROUND), 1) ifeq ($(RELOC_WORKAROUND), 1)
@ -770,23 +689,17 @@ REMOVE = rm -f
MV = mv -f MV = mv -f
# Place -D or -U options here # Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)UL ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION) CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
CXXDEFS = $(CDEFS) CXXDEFS = $(CDEFS)
ifeq ($(HARDWARE_VARIANT), Teensy) ifeq ($(HARDWARE_VARIANT), Teensy)
CDEFS += -DUSB_SERIAL CDEFS += -DUSB_SERIAL
LIB_SRC += usb.c pins_teensy.c LIB_SRC += usb.c pins_teensy.c
LIB_CXXSRC += usb_api.cpp LIB_CXXSRC += usb_api.cpp
else ifeq ($(HARDWARE_VARIANT), archim) else ifeq ($(HARDWARE_VARIANT), archim)
CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
CDEFS += -DUSB_VID=0x27B1 -DUSB_PID=0x0001 -DUSBCON 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 += '-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 LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
ifeq ($(U8GLIB), 1) ifeq ($(U8GLIB), 1)
@ -812,20 +725,16 @@ CTUNING = -fsigned-char -funsigned-bitfields -fno-exceptions \
ifneq ($(HARDWARE_MOTHERBOARD),) ifneq ($(HARDWARE_MOTHERBOARD),)
CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD} CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
endif endif
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst) #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD) CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD) CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
ASFLAGS := $(CDEFS) ASFLAGS := $(CDEFS)
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
ifeq ($(HARDWARE_VARIANT), archim) 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_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) 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 else
LD_PREFIX = -Wl,--gc-sections,--relax LD_PREFIX = -Wl,--gc-sections,--relax
LDFLAGS = -lm LDFLAGS = -lm
@ -841,7 +750,7 @@ else
AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
endif endif
AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \ AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
-p$(PROG_MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \ -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
-b$(UPLOAD_RATE) -b$(UPLOAD_RATE)
# Since Marlin 2.0, the source files may be distributed into several # Since Marlin 2.0, the source files may be distributed into several
@ -942,7 +851,7 @@ extcoff: $(TARGET).elf
.elf.eep: .elf.eep:
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create extended listing file from ELF output file. # Create extended listing file from ELF output file.
.elf.lss: .elf.lss:
@ -956,7 +865,7 @@ extcoff: $(TARGET).elf
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
$(Pecho) " CXX $@" $(Pecho) " CXX $@"
$P $(CXX) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX) $P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
# Object files that were found in "src" will be stored in $(BUILD_DIR) # Object files that were found in "src" will be stored in $(BUILD_DIR)
# in directories that mirror the structure of "src" # in directories that mirror the structure of "src"

View file

@ -28,7 +28,7 @@
/** /**
* Marlin release version identifier * Marlin release version identifier
*/ */
//#define SHORT_BUILD_VERSION "2.0.7.2" //#define SHORT_BUILD_VERSION "2.0.7"
/** /**
* Verbose version identifier which should contain a reference to the location * Verbose version identifier which should contain a reference to the location

View file

@ -25,7 +25,7 @@
#include "watchdog.h" #include "watchdog.h"
#include "math.h" #include "math.h"
#ifdef IS_AT90USB #ifdef USBCON
#include <HardwareSerial.h> #include <HardwareSerial.h>
#else #else
#define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion #define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion
@ -81,7 +81,7 @@ typedef int8_t pin_t;
//extern uint8_t MCUSR; //extern uint8_t MCUSR;
// Serial ports // Serial ports
#ifdef IS_AT90USB #ifdef USBCON
#define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial) #define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
#else #else
#if !WITHIN(SERIAL_PORT, -1, 3) #if !WITHIN(SERIAL_PORT, -1, 3)
@ -120,8 +120,6 @@ void HAL_init();
inline void HAL_clear_reset_source() { MCUSR = 0; } inline void HAL_clear_reset_source() { MCUSR = 0; }
inline uint8_t HAL_get_reset_source() { return MCUSR; } 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 push
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
extern "C" { extern "C" {

View file

@ -38,7 +38,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if !IS_AT90USB && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)) #if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
#include "MarlinSerial.h" #include "MarlinSerial.h"
#include "../../MarlinCore.h" #include "../../MarlinCore.h"
@ -792,10 +792,10 @@ MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
#endif #endif
#endif // !IS_AT90USB && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) #endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
// For AT90USB targets use the UART for BT interfacing // For AT90USB targets use the UART for BT interfacing
#if BOTH(IS_AT90USB, BLUETOOTH) #if defined(USBCON) && ENABLED(BLUETOOTH)
HardwareSerial bluetoothSerial; HardwareSerial bluetoothSerial;
#endif #endif

View file

@ -327,6 +327,6 @@
#endif #endif
// Use the UART for Bluetooth in AT90USB configurations // Use the UART for Bluetooth in AT90USB configurations
#if BOTH(IS_AT90USB, BLUETOOTH) #if defined(USBCON) && ENABLED(BLUETOOTH)
extern HardwareSerial bluetoothSerial; extern HardwareSerial bluetoothSerial;
#endif #endif

View file

@ -185,8 +185,8 @@ void set_pwm_frequency(const pin_t pin, int f_desired) {
res_temp_phase_correct = rtf / 2; res_temp_phase_correct = rtf / 2;
} }
LIMIT(res_temp_fast, 1U, size); LIMIT(res_temp_fast, 1u, size);
LIMIT(res_temp_phase_correct, 1U, size); LIMIT(res_temp_phase_correct, 1u, size);
// Calculate frequencies of test prescaler and resolution values // Calculate frequencies of test prescaler and resolution values
const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)), 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), f_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct),

View file

@ -19,7 +19,9 @@
*/ */
/** /**
* HAL for Arduino Due and compatible (SAM3X8E) * Description: HAL for Arduino Due and compatible (SAM3X8E)
*
* For ARDUINO_ARCH_SAM
*/ */
#ifdef ARDUINO_ARCH_SAM #ifdef ARDUINO_ARCH_SAM

View file

@ -22,7 +22,9 @@
#pragma once #pragma once
/** /**
* HAL for Arduino Due and compatible (SAM3X8E) * Description: HAL for Arduino Due and compatible (SAM3X8E)
*
* For ARDUINO_ARCH_SAM
*/ */
#define CPU_32_BIT #define CPU_32_BIT
@ -105,15 +107,13 @@ void sei(); // Enable interrupts
void HAL_clear_reset_source(); // clear reset reason void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get reset reason uint8_t HAL_get_reset_source(); // get reset reason
inline void HAL_reboot() {} // reboot the board or restart the bootloader
// //
// ADC // ADC
// //
extern uint16_t HAL_adc_result; // result of last ADC conversion extern uint16_t HAL_adc_result; // result of last ADC conversion
#ifndef analogInputToDigitalPin #ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1) #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
#endif #endif
#define HAL_ANALOG_SELECT(ch) #define HAL_ANALOG_SELECT(ch)

View file

@ -30,7 +30,7 @@
*/ */
/** /**
* HAL for Arduino Due and compatible (SAM3X8E) * Description: HAL for Arduino Due and compatible (SAM3X8E)
* *
* For ARDUINO_ARCH_SAM * For ARDUINO_ARCH_SAM
*/ */

View file

@ -60,7 +60,7 @@
#define EEPROMSize 4096 #define EEPROMSize 4096
#define PagesPerGroup 128 #define PagesPerGroup 128
#define GroupCount 2 #define GroupCount 2
#define PageSize 256U #define PageSize 256u
/* Flash storage */ /* Flash storage */
typedef struct FLASH_SECTOR { typedef struct FLASH_SECTOR {

View file

@ -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) NVIC_SetPriority(PWM_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module (can stand some jitter on the Vref signals)
} }
void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) { void Stepper::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 if (!(PWM->PWM_CH_NUM[0].PWM_CPRD == PWM_PERIOD_US)) digipot_init(); // Init PWM system if needed

View file

@ -21,7 +21,9 @@
*/ */
/** /**
* HAL Timers for Arduino Due and compatible (SAM3X8E) * Description: HAL for Arduino Due and compatible (SAM3X8E)
*
* For ARDUINO_ARCH_SAM
*/ */
#ifdef ARDUINO_ARCH_SAM #ifdef ARDUINO_ARCH_SAM

View file

@ -21,7 +21,9 @@
#pragma once #pragma once
/** /**
* HAL Timers for Arduino Due and compatible (SAM3X8E) * HAL for Arduino Due and compatible (SAM3X8E)
*
* For ARDUINO_ARCH_SAM
*/ */
#include <stdint.h> #include <stdint.h>

View file

@ -14,5 +14,5 @@ if current_OS == 'Windows':
# Use bossac.exe on Windows # Use bossac.exe on Windows
env.Replace( env.Replace(
UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot $SOURCE" UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot"
) )

View file

@ -609,37 +609,37 @@ typedef struct
# define clz(u) ((u) ? __CLZ(u) : 32) # define clz(u) ((u) ? __CLZ(u) : 32)
#else #else
# define clz(u) (((u) == 0) ? 32 : \ # define clz(u) (((u) == 0) ? 32 : \
((u) & (1UL << 31)) ? 0 : \ ((u) & (1ul << 31)) ? 0 : \
((u) & (1UL << 30)) ? 1 : \ ((u) & (1ul << 30)) ? 1 : \
((u) & (1UL << 29)) ? 2 : \ ((u) & (1ul << 29)) ? 2 : \
((u) & (1UL << 28)) ? 3 : \ ((u) & (1ul << 28)) ? 3 : \
((u) & (1UL << 27)) ? 4 : \ ((u) & (1ul << 27)) ? 4 : \
((u) & (1UL << 26)) ? 5 : \ ((u) & (1ul << 26)) ? 5 : \
((u) & (1UL << 25)) ? 6 : \ ((u) & (1ul << 25)) ? 6 : \
((u) & (1UL << 24)) ? 7 : \ ((u) & (1ul << 24)) ? 7 : \
((u) & (1UL << 23)) ? 8 : \ ((u) & (1ul << 23)) ? 8 : \
((u) & (1UL << 22)) ? 9 : \ ((u) & (1ul << 22)) ? 9 : \
((u) & (1UL << 21)) ? 10 : \ ((u) & (1ul << 21)) ? 10 : \
((u) & (1UL << 20)) ? 11 : \ ((u) & (1ul << 20)) ? 11 : \
((u) & (1UL << 19)) ? 12 : \ ((u) & (1ul << 19)) ? 12 : \
((u) & (1UL << 18)) ? 13 : \ ((u) & (1ul << 18)) ? 13 : \
((u) & (1UL << 17)) ? 14 : \ ((u) & (1ul << 17)) ? 14 : \
((u) & (1UL << 16)) ? 15 : \ ((u) & (1ul << 16)) ? 15 : \
((u) & (1UL << 15)) ? 16 : \ ((u) & (1ul << 15)) ? 16 : \
((u) & (1UL << 14)) ? 17 : \ ((u) & (1ul << 14)) ? 17 : \
((u) & (1UL << 13)) ? 18 : \ ((u) & (1ul << 13)) ? 18 : \
((u) & (1UL << 12)) ? 19 : \ ((u) & (1ul << 12)) ? 19 : \
((u) & (1UL << 11)) ? 20 : \ ((u) & (1ul << 11)) ? 20 : \
((u) & (1UL << 10)) ? 21 : \ ((u) & (1ul << 10)) ? 21 : \
((u) & (1UL << 9)) ? 22 : \ ((u) & (1ul << 9)) ? 22 : \
((u) & (1UL << 8)) ? 23 : \ ((u) & (1ul << 8)) ? 23 : \
((u) & (1UL << 7)) ? 24 : \ ((u) & (1ul << 7)) ? 24 : \
((u) & (1UL << 6)) ? 25 : \ ((u) & (1ul << 6)) ? 25 : \
((u) & (1UL << 5)) ? 26 : \ ((u) & (1ul << 5)) ? 26 : \
((u) & (1UL << 4)) ? 27 : \ ((u) & (1ul << 4)) ? 27 : \
((u) & (1UL << 3)) ? 28 : \ ((u) & (1ul << 3)) ? 28 : \
((u) & (1UL << 2)) ? 29 : \ ((u) & (1ul << 2)) ? 29 : \
((u) & (1UL << 1)) ? 30 : \ ((u) & (1ul << 1)) ? 30 : \
31) 31)
#endif #endif
#endif #endif
@ -654,38 +654,38 @@ typedef struct
#if (defined __GNUC__) || (defined __CC_ARM) #if (defined __GNUC__) || (defined __CC_ARM)
# define ctz(u) ((u) ? __builtin_ctz(u) : 32) # define ctz(u) ((u) ? __builtin_ctz(u) : 32)
#else #else
# define ctz(u) ((u) & (1UL << 0) ? 0 : \ # define ctz(u) ((u) & (1ul << 0) ? 0 : \
(u) & (1UL << 1) ? 1 : \ (u) & (1ul << 1) ? 1 : \
(u) & (1UL << 2) ? 2 : \ (u) & (1ul << 2) ? 2 : \
(u) & (1UL << 3) ? 3 : \ (u) & (1ul << 3) ? 3 : \
(u) & (1UL << 4) ? 4 : \ (u) & (1ul << 4) ? 4 : \
(u) & (1UL << 5) ? 5 : \ (u) & (1ul << 5) ? 5 : \
(u) & (1UL << 6) ? 6 : \ (u) & (1ul << 6) ? 6 : \
(u) & (1UL << 7) ? 7 : \ (u) & (1ul << 7) ? 7 : \
(u) & (1UL << 8) ? 8 : \ (u) & (1ul << 8) ? 8 : \
(u) & (1UL << 9) ? 9 : \ (u) & (1ul << 9) ? 9 : \
(u) & (1UL << 10) ? 10 : \ (u) & (1ul << 10) ? 10 : \
(u) & (1UL << 11) ? 11 : \ (u) & (1ul << 11) ? 11 : \
(u) & (1UL << 12) ? 12 : \ (u) & (1ul << 12) ? 12 : \
(u) & (1UL << 13) ? 13 : \ (u) & (1ul << 13) ? 13 : \
(u) & (1UL << 14) ? 14 : \ (u) & (1ul << 14) ? 14 : \
(u) & (1UL << 15) ? 15 : \ (u) & (1ul << 15) ? 15 : \
(u) & (1UL << 16) ? 16 : \ (u) & (1ul << 16) ? 16 : \
(u) & (1UL << 17) ? 17 : \ (u) & (1ul << 17) ? 17 : \
(u) & (1UL << 18) ? 18 : \ (u) & (1ul << 18) ? 18 : \
(u) & (1UL << 19) ? 19 : \ (u) & (1ul << 19) ? 19 : \
(u) & (1UL << 20) ? 20 : \ (u) & (1ul << 20) ? 20 : \
(u) & (1UL << 21) ? 21 : \ (u) & (1ul << 21) ? 21 : \
(u) & (1UL << 22) ? 22 : \ (u) & (1ul << 22) ? 22 : \
(u) & (1UL << 23) ? 23 : \ (u) & (1ul << 23) ? 23 : \
(u) & (1UL << 24) ? 24 : \ (u) & (1ul << 24) ? 24 : \
(u) & (1UL << 25) ? 25 : \ (u) & (1ul << 25) ? 25 : \
(u) & (1UL << 26) ? 26 : \ (u) & (1ul << 26) ? 26 : \
(u) & (1UL << 27) ? 27 : \ (u) & (1ul << 27) ? 27 : \
(u) & (1UL << 28) ? 28 : \ (u) & (1ul << 28) ? 28 : \
(u) & (1UL << 29) ? 29 : \ (u) & (1ul << 29) ? 29 : \
(u) & (1UL << 30) ? 30 : \ (u) & (1ul << 30) ? 30 : \
(u) & (1UL << 31) ? 31 : \ (u) & (1ul << 31) ? 31 : \
32) 32)
#endif #endif
#endif #endif

View file

@ -20,7 +20,7 @@
#pragma once #pragma once
/** /**
* HAL for Espressif ESP32 WiFi * Description: HAL for Espressif ESP32 WiFi
*/ */
#define CPU_32_BIT #define CPU_32_BIT
@ -96,8 +96,6 @@ void HAL_clear_reset_source();
// reset reason // reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader
void _delay_ms(int delay); void _delay_ms(int delay);
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -157,14 +155,14 @@ FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
if (stop >= start) { if (stop >= start) {
// no overflow, so only loop while in between start and stop: // no overflow, so only loop while in between start and stop:
// 0x00000000 -----------------start****stop-- 0xFFFFFFFF // 0x00000000 -----------------start****stop-- 0xffffffff
while (ccount >= start && ccount < stop) { while (ccount >= start && ccount < stop) {
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) ); __asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
} }
} }
else { else {
// stop did overflow, so only loop while outside of stop and start: // 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) { while (ccount >= start || ccount < stop) {
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) ); __asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
} }

View file

@ -34,7 +34,7 @@
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION) #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
#ifndef I2C_ADDRESS #ifndef I2C_ADDRESS
#define I2C_ADDRESS(A) uint8_t(A) #define I2C_ADDRESS(A) (A)
#endif #endif
// Needed for AVR sprintf_P PROGMEM extension // Needed for AVR sprintf_P PROGMEM extension

View file

@ -101,8 +101,6 @@ uint16_t HAL_adc_get_result();
inline void HAL_clear_reset_source(void) {} inline void HAL_clear_reset_source(void) {}
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } 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 */ /* ---------------- Delay in cycles */
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) { FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
Clock::delayCycles(x); Clock::delayCycles(x);

View file

@ -200,8 +200,6 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255,
void HAL_clear_reset_source(void); void HAL_clear_reset_source(void);
uint8_t HAL_get_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 // Add strcmp_P if missing
#ifndef strcmp_P #ifndef strcmp_P
#define strcmp_P(a, b) strcmp((a), (b)) #define strcmp_P(a, b) strcmp((a), (b))

View file

@ -24,3 +24,10 @@
#if HAS_FSMC_TFT #if HAS_FSMC_TFT
#error "Sorry! FSMC TFT displays are not current available for HAL/LPC1768." #error "Sorry! FSMC TFT displays are not current available for HAL/LPC1768."
#endif #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

View file

@ -191,7 +191,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
// //
// Flag any i2c pin conflicts // Flag any i2c pin conflicts
// //
#if ANY(HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM) #if ANY(HAS_I2C_DIGIPOT, DAC_STEPPER_CURRENT, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
#define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp #define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp
#if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1) #if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)

View file

@ -36,7 +36,7 @@
#define DATASIZE_8BIT SSP_DATABIT_8 #define DATASIZE_8BIT SSP_DATABIT_8
#define DATASIZE_16BIT SSP_DATABIT_16 #define DATASIZE_16BIT SSP_DATABIT_16
#define TFT_IO_DRIVER TFT_SPI #define TFT_IO TFT_SPI
#define DMA_MINC_ENABLE 1 #define DMA_MINC_ENABLE 1
#define DMA_MINC_DISABLE 0 #define DMA_MINC_DISABLE 0

View file

@ -35,8 +35,7 @@
// MYSERIAL0 required before MarlinSerial includes! // 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)) #define MSERIAL(X) _MSERIAL(INCREMENT(X))
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
@ -89,8 +88,6 @@ typedef int8_t pin_t;
void HAL_clear_reset_source(); // clear reset reason void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get reset reason uint8_t HAL_get_reset_source(); // get reset reason
inline void HAL_reboot() {} // reboot the board or restart the bootloader
// //
// ADC // ADC
// //

View file

@ -26,7 +26,7 @@
#include "QSPIFlash.h" #include "QSPIFlash.h"
#define INVALID_ADDR 0xFFFFFFFF #define INVALID_ADDR 0xffffffff
#define SECTOR_OF(a) (a & ~(SFLASH_SECTOR_SIZE - 1)) #define SECTOR_OF(a) (a & ~(SFLASH_SECTOR_SIZE - 1))
#define OFFSET_OF(a) (a & (SFLASH_SECTOR_SIZE - 1)) #define OFFSET_OF(a) (a & (SFLASH_SECTOR_SIZE - 1))

View file

@ -63,7 +63,7 @@ uint16_t HAL_adc_result;
void HAL_init() { void HAL_init() {
FastIO_init(); FastIO_init();
#if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT) && (defined(SDSS) && SDSS != -1) #if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT)
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
#endif #endif
@ -122,14 +122,9 @@ extern "C" {
// TODO: Make sure this doesn't cause any delay // TODO: Make sure this doesn't cause any delay
void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); } void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
uint16_t HAL_adc_get_result() { return HAL_adc_result; } uint16_t HAL_adc_get_result() { return HAL_adc_result; }
// Reset the system (to initiate a firmware flash)
void flashFirmware(const int16_t) { NVIC_SystemReset(); } void flashFirmware(const int16_t) { NVIC_SystemReset(); }
// Maple Compatibility
systickCallback_t systick_user_callback;
void systick_attach_callback(systickCallback_t cb) { systick_user_callback = cb; }
void HAL_SYSTICK_Callback() { if (systick_user_callback) systick_user_callback(); }
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

View file

@ -134,8 +134,6 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader
void _delay_ms(const int delay); void _delay_ms(const int delay);
extern "C" char* _sbrk(int incr); extern "C" char* _sbrk(int incr);
@ -179,8 +177,3 @@ uint16_t HAL_adc_get_result();
#define PLATFORM_M997_SUPPORT #define PLATFORM_M997_SUPPORT
void flashFirmware(const int16_t); void flashFirmware(const int16_t);
// Maple Compatibility
typedef void (*systickCallback_t)(void);
void systick_attach_callback(systickCallback_t cb);
void HAL_SYSTICK_Callback();

View file

@ -132,9 +132,11 @@ static SPISettings spiConfig;
* @details Only configures SS pin since stm32duino creates and initialize the SPI object * @details Only configures SS pin since stm32duino creates and initialize the SPI object
*/ */
void spiBegin() { void spiBegin() {
#if PIN_EXISTS(SS) #if !PIN_EXISTS(SS)
OUT_WRITE(SS_PIN, HIGH); #error "SS_PIN not defined!"
#endif #endif
OUT_WRITE(SS_PIN, HIGH);
} }
// Configure SPI for specified SPI speed // Configure SPI for specified SPI speed
@ -171,7 +173,9 @@ static SPISettings spiConfig;
* @details * @details
*/ */
uint8_t spiRec() { uint8_t spiRec() {
SPI.beginTransaction(spiConfig);
uint8_t returnByte = SPI.transfer(0xFF); uint8_t returnByte = SPI.transfer(0xFF);
SPI.endTransaction();
return returnByte; return returnByte;
} }
@ -187,7 +191,9 @@ static SPISettings spiConfig;
void spiRead(uint8_t* buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
if (nbyte == 0) return; if (nbyte == 0) return;
memset(buf, 0xFF, nbyte); memset(buf, 0xFF, nbyte);
SPI.beginTransaction(spiConfig);
SPI.transfer(buf, nbyte); SPI.transfer(buf, nbyte);
SPI.endTransaction();
} }
/** /**
@ -198,7 +204,9 @@ static SPISettings spiConfig;
* @details * @details
*/ */
void spiSend(uint8_t b) { void spiSend(uint8_t b) {
SPI.beginTransaction(spiConfig);
SPI.transfer(b); SPI.transfer(b);
SPI.endTransaction();
} }
/** /**
@ -211,8 +219,10 @@ static SPISettings spiConfig;
*/ */
void spiSendBlock(uint8_t token, const uint8_t* buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
uint8_t rxBuf[512]; uint8_t rxBuf[512];
SPI.beginTransaction(spiConfig);
SPI.transfer(token); SPI.transfer(token);
SPI.transfer((uint8_t*)buf, &rxBuf, 512); SPI.transfer((uint8_t*)buf, &rxBuf, 512);
SPI.endTransaction();
} }
#endif // SOFTWARE_SPI #endif // SOFTWARE_SPI

View file

@ -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) #if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
#define _WRITE(IO, V) do { \ #define _WRITE(IO, V) do { \
if (V) FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BSRR = _BV32(STM_PIN(digitalPinToPinName(IO))) ; \ if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \
else FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BRR = _BV32(STM_PIN(digitalPinToPinName(IO))) ; \ else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(STM_PIN(digitalPin[IO])) ; \
}while(0) }while(0)
#else #else
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BSRR = _BV32(STM_PIN(digitalPinToPinName(IO)) + ((V) ? 0 : 16))) #define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + ((V) ? 0 : 16)))
#endif #endif
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->IDR, _BV32(STM_PIN(digitalPinToPinName(IO))))) #define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(STM_PIN(digitalPin[IO]))))
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->ODR ^= _BV32(STM_PIN(digitalPinToPinName(IO)))) #define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(STM_PIN(digitalPin[IO])))
#define _GET_MODE(IO) #define _GET_MODE(IO)
#define _SET_MODE(IO,M) pinMode(IO, M) #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 _SET_OUTPUT_OD(IO) pinMode(IO, OUTPUT_OPEN_DRAIN)
#define WRITE(IO,V) _WRITE(IO,V) #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(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 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(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_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_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW) #define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#define SET_PWM(IO) _SET_MODE(IO, PWM) #define SET_PWM(IO) _SET_MODE(IO, PWM)

View file

@ -51,8 +51,8 @@
* It contains: * It contains:
* - name of the signal * - name of the signal
* - the Ard_num assigned by the pins_YOUR_BOARD.h file using the platform defines. * - 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 the * EXAMPLE: "#define KILL_PIN PB1" results in Ard_num of 57. 57 is then used as an
* argument to digitalPinToPinName(IO) to get the Port_pin number * index into digitalPin[] to get the Port_pin number
* - if it is a digital or analog signal. PWMs are considered digital here. * - 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 * pin_xref is a structure generated by this header file. It is generated by the
@ -68,6 +68,8 @@
* signal. The Arduino pin number is listed by the M43 I command. * 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 // make a list of the Arduino pin numbers in the Port/Pin order
@ -135,7 +137,7 @@ const XrefInfo pin_xref[] PROGMEM = {
uint8_t get_pin_mode(const pin_t Ard_num) { uint8_t get_pin_mode(const pin_t Ard_num) {
uint32_t mode_all = 0; uint32_t mode_all = 0;
const PinName dp = digitalPinToPinName(Ard_num); const PinName dp = digitalPin[Ard_num];
switch (PORT_ALPHA(dp)) { switch (PORT_ALPHA(dp)) {
case 'A' : mode_all = GPIOA->MODER; break; case 'A' : mode_all = GPIOA->MODER; break;
case 'B' : mode_all = GPIOB->MODER; break; case 'B' : mode_all = GPIOB->MODER; break;
@ -216,7 +218,7 @@ bool pwm_status(const pin_t Ard_num) {
void pwm_details(const pin_t Ard_num) { void pwm_details(const pin_t Ard_num) {
if (pwm_status(Ard_num)) { if (pwm_status(Ard_num)) {
uint32_t alt_all = 0; uint32_t alt_all = 0;
const PinName dp = digitalPinToPinName(Ard_num); const PinName dp = digitalPin[Ard_num];
pin_t pin_number = uint8_t(PIN_NUM(dp)); pin_t pin_number = uint8_t(PIN_NUM(dp));
const bool over_7 = pin_number >= 8; const bool over_7 = pin_number >= 8;
const uint8_t ind = over_7 ? 1 : 0; const uint8_t ind = over_7 ? 1 : 0;

View file

@ -38,7 +38,7 @@
#define DATASIZE_8BIT SPI_DATASIZE_8BIT #define DATASIZE_8BIT SPI_DATASIZE_8BIT
#define DATASIZE_16BIT SPI_DATASIZE_16BIT #define DATASIZE_16BIT SPI_DATASIZE_16BIT
#define TFT_IO_DRIVER TFT_FSMC #define TFT_IO TFT_FSMC
#ifdef STM32F1xx #ifdef STM32F1xx
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN) #define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)

View file

@ -38,7 +38,7 @@
#define DATASIZE_8BIT SPI_DATASIZE_8BIT #define DATASIZE_8BIT SPI_DATASIZE_8BIT
#define DATASIZE_16BIT SPI_DATASIZE_16BIT #define DATASIZE_16BIT SPI_DATASIZE_16BIT
#define TFT_IO_DRIVER TFT_SPI #define TFT_IO TFT_SPI
class TFT_SPI { class TFT_SPI {
private: private:

View file

@ -30,11 +30,7 @@
#include "watchdog.h" #include "watchdog.h"
#include <IWatchdog.h> #include <IWatchdog.h>
void watchdog_init() { void watchdog_init() { IWatchdog.begin(4000000); } // 4 sec timeout
#if DISABLED(DISABLE_WATCHDOG_INIT)
IWatchdog.begin(4000000); // 4 sec timeout
#endif
}
void HAL_watchdog_refresh() { void HAL_watchdog_refresh() {
IWatchdog.reload(); IWatchdog.reload();

View file

@ -97,9 +97,6 @@ const uint8_t adc_pins[] = {
#if HAS_TEMP_ADC_0 #if HAS_TEMP_ADC_0
TEMP_0_PIN, TEMP_0_PIN,
#endif #endif
#if HAS_TEMP_ADC_PROBE
TEMP_PROBE_PIN,
#endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
TEMP_BED_PIN, TEMP_BED_PIN,
#endif #endif
@ -154,9 +151,6 @@ enum TempPinIndex : char {
#if HAS_TEMP_ADC_0 #if HAS_TEMP_ADC_0
TEMP_0, TEMP_0,
#endif #endif
#if HAS_TEMP_ADC_PROBE
TEMP_PROBE,
#endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
TEMP_BED, TEMP_BED,
#endif #endif
@ -347,9 +341,6 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
#if HAS_TEMP_ADC_0 #if HAS_TEMP_ADC_0
case TEMP_0_PIN: pin_index = TEMP_0; break; case TEMP_0_PIN: pin_index = TEMP_0; break;
#endif #endif
#if HAS_TEMP_ADC_PROBE
case TEMP_PROBE_PIN: pin_index = TEMP_PROBE; break;
#endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
case TEMP_BED_PIN: pin_index = TEMP_BED; break; case TEMP_BED_PIN: pin_index = TEMP_BED; break;
#endif #endif

View file

@ -185,8 +185,6 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader
void _delay_ms(const int delay); void _delay_ms(const int delay);
#pragma GCC diagnostic push #pragma GCC diagnostic push

View file

@ -24,6 +24,9 @@
/** /**
* Software SPI functions originally from Arduino Sd2Card Library * Software SPI functions originally from Arduino Sd2Card Library
* Copyright (c) 2009 by William Greiman * Copyright (c) 2009 by William Greiman
*/
/**
* Adapted to the STM32F1 HAL * Adapted to the STM32F1 HAL
*/ */
@ -110,7 +113,7 @@ void spiInit(uint8_t spiRate) {
* @details * @details
*/ */
uint8_t spiRec() { uint8_t spiRec() {
uint8_t returnByte = SPI.transfer(0xFF); uint8_t returnByte = SPI.transfer(ff);
return returnByte; return returnByte;
} }
@ -154,7 +157,7 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) {
#if ENABLED(SPI_EEPROM) #if ENABLED(SPI_EEPROM)
// Read single byte from specified SPI channel // Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan) { return SPI.transfer(0xFF); } uint8_t spiRec(uint32_t chan) { return SPI.transfer(ff); }
// Write single byte to specified SPI channel // Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b) { SPI.send(b); } void spiSend(uint32_t chan, byte b) { SPI.send(b); }

View file

@ -22,6 +22,7 @@
#if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI) #if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
#include "../HAL.h"
#include <U8glib.h> #include <U8glib.h>
#undef SPI_SPEED #undef SPI_SPEED
@ -160,5 +161,5 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
return 1; return 1;
} }
#endif // HAS_MARLINUI_U8GLIB && FORCE_SOFT_SPI #endif // HAS_MARLINUI_U8GLIB
#endif // STM32F1 #endif // STM32F1

View file

@ -25,8 +25,6 @@
* with simple implementations supplied by Marlin. * with simple implementations supplied by Marlin.
*/ */
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM) #if ENABLED(IIC_BL24CXX_EEPROM)
@ -81,4 +79,3 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
} }
#endif // IIC_BL24CXX_EEPROM #endif // IIC_BL24CXX_EEPROM
#endif // __STM32F1__

View file

@ -25,8 +25,6 @@
* Enable USE_SHARED_EEPROM if not supplied by the framework. * Enable USE_SHARED_EEPROM if not supplied by the framework.
*/ */
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM) #if ENABLED(IIC_BL24CXX_EEPROM)
@ -51,4 +49,3 @@ uint8_t eeprom_read_byte(uint8_t *pos) {
} }
#endif // IIC_BL24CXX_EEPROM #endif // IIC_BL24CXX_EEPROM
#endif // __STM32F1__

View file

@ -17,17 +17,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
/**
* HAL PersistentStore for STM32F1
*/
#ifdef __STM32F1__ #ifdef __STM32F1__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM #if USE_WIRED_EEPROM
/**
* PersistentStore for Arduino-style EEPROM interface
* with simple implementations supplied by Marlin.
*/
#include "../shared/eeprom_if.h" #include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"

View file

@ -25,3 +25,10 @@
//#warning "SD_CHECK_AND_RETRY isn't needed with USE_USB_COMPOSITE." //#warning "SD_CHECK_AND_RETRY isn't needed with USE_USB_COMPOSITE."
#undef SD_CHECK_AND_RETRY #undef SD_CHECK_AND_RETRY
#endif #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

View file

@ -13,7 +13,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
#if defined(__STM32F1__) && defined(USE_USB_COMPOSITE) #ifdef USE_USB_COMPOSITE
#include "msc_sd.h" #include "msc_sd.h"
#include "SPI.h" #include "SPI.h"
@ -77,4 +77,4 @@ void MSC_SD_init() {
#endif #endif
} }
#endif // __STM32F1__ && USE_USB_COMPOSITE #endif // USE_USB_COMPOSITE

View file

@ -11,8 +11,6 @@
* Redistributions of source code must retain the above copyright notice. * Redistributions of source code must retain the above copyright notice.
*/ */
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if SD_CONNECTION_IS(ONBOARD) #if SD_CONNECTION_IS(ONBOARD)
@ -555,4 +553,3 @@ DRESULT disk_read (
#endif // _DISKIO_IOCTL #endif // _DISKIO_IOCTL
#endif // SD_CONNECTION_IS(ONBOARD) #endif // SD_CONNECTION_IS(ONBOARD)
#endif // __STM32F1__

View file

@ -89,12 +89,25 @@ void TFT_FSMC::Init() {
uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN; uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN;
uint32_t controllerAddress; uint32_t controllerAddress;
#if PIN_EXISTS(TFT_BACKLIGHT)
OUT_WRITE(TFT_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT));
#endif
#if ENABLED(LCD_USE_DMA_FSMC) #if ENABLED(LCD_USE_DMA_FSMC)
dma_init(FSMC_DMA_DEV); dma_init(FSMC_DMA_DEV);
dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
dma_set_priority(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, DMA_PRIORITY_MEDIUM); dma_set_priority(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, DMA_PRIORITY_MEDIUM);
#endif #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; struct fsmc_nor_psram_reg_map* fsmcPsramRegion;
if (fsmcInit) return; if (fsmcInit) return;

View file

@ -32,7 +32,7 @@
#define DATASIZE_8BIT DMA_SIZE_8BITS #define DATASIZE_8BIT DMA_SIZE_8BITS
#define DATASIZE_16BIT DMA_SIZE_16BITS #define DATASIZE_16BIT DMA_SIZE_16BITS
#define TFT_IO_DRIVER TFT_FSMC #define TFT_IO TFT_FSMC
typedef struct { typedef struct {
__IO uint16_t REG; __IO uint16_t REG;

View file

@ -34,7 +34,7 @@
#define DATASIZE_8BIT DATA_SIZE_8BIT #define DATASIZE_8BIT DATA_SIZE_8BIT
#define DATASIZE_16BIT DATA_SIZE_16BIT #define DATASIZE_16BIT DATA_SIZE_16BIT
#define TFT_IO_DRIVER TFT_SPI #define TFT_IO TFT_SPI
#define DMA_MINC_ENABLE 1 #define DMA_MINC_ENABLE 1
#define DMA_MINC_DISABLE 0 #define DMA_MINC_DISABLE 0

View file

@ -52,9 +52,7 @@ 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) * @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() { void watchdog_init() {
#if DISABLED(DISABLE_WATCHDOG_INIT) //iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD);
#endif
} }
#endif // USE_WATCHDOG #endif // USE_WATCHDOG

View file

@ -142,8 +142,6 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader
void _delay_ms(const int delay); void _delay_ms(const int delay);
/* /*

View file

@ -45,8 +45,8 @@
#define DEFAULT_MICROSTEPPING_VALUE 32 #define DEFAULT_MICROSTEPPING_VALUE 32
//TMC26X register definitions //TMC26X register definitions
#define DRIVER_CONTROL_REGISTER 0x0UL #define DRIVER_CONTROL_REGISTER 0x0ul
#define CHOPPER_CONFIG_REGISTER 0x80000UL #define CHOPPER_CONFIG_REGISTER 0x80000ul
#define COOL_STEP_REGISTER 0xA0000ul #define COOL_STEP_REGISTER 0xA0000ul
#define STALL_GUARD2_LOAD_MEASURE_REGISTER 0xC0000ul #define STALL_GUARD2_LOAD_MEASURE_REGISTER 0xC0000ul
#define DRIVER_CONFIG_REGISTER 0xE0000ul #define DRIVER_CONFIG_REGISTER 0xE0000ul
@ -55,58 +55,58 @@
//definitions for the driver control register //definitions for the driver control register
#define MICROSTEPPING_PATTERN 0xFul #define MICROSTEPPING_PATTERN 0xFul
#define STEP_INTERPOLATION 0x200UL #define STEP_INTERPOLATION 0x200ul
#define DOUBLE_EDGE_STEP 0x100UL #define DOUBLE_EDGE_STEP 0x100ul
#define VSENSE 0x40UL #define VSENSE 0x40ul
#define READ_MICROSTEP_POSTION 0x0UL #define READ_MICROSTEP_POSTION 0x0ul
#define READ_STALL_GUARD_READING 0x10UL #define READ_STALL_GUARD_READING 0x10ul
#define READ_STALL_GUARD_AND_COOL_STEP 0x20UL #define READ_STALL_GUARD_AND_COOL_STEP 0x20ul
#define READ_SELECTION_PATTERN 0x30UL #define READ_SELECTION_PATTERN 0x30ul
//definitions for the chopper config register //definitions for the chopper config register
#define CHOPPER_MODE_STANDARD 0x0UL #define CHOPPER_MODE_STANDARD 0x0ul
#define CHOPPER_MODE_T_OFF_FAST_DECAY 0x4000UL #define CHOPPER_MODE_T_OFF_FAST_DECAY 0x4000ul
#define T_OFF_PATTERN 0xFul #define T_OFF_PATTERN 0xFul
#define RANDOM_TOFF_TIME 0x2000UL #define RANDOM_TOFF_TIME 0x2000ul
#define BLANK_TIMING_PATTERN 0x18000UL #define BLANK_TIMING_PATTERN 0x18000ul
#define BLANK_TIMING_SHIFT 15 #define BLANK_TIMING_SHIFT 15
#define HYSTERESIS_DECREMENT_PATTERN 0x1800UL #define HYSTERESIS_DECREMENT_PATTERN 0x1800ul
#define HYSTERESIS_DECREMENT_SHIFT 11 #define HYSTERESIS_DECREMENT_SHIFT 11
#define HYSTERESIS_LOW_VALUE_PATTERN 0x780UL #define HYSTERESIS_LOW_VALUE_PATTERN 0x780ul
#define HYSTERESIS_LOW_SHIFT 7 #define HYSTERESIS_LOW_SHIFT 7
#define HYSTERESIS_START_VALUE_PATTERN 0x78UL #define HYSTERESIS_START_VALUE_PATTERN 0x78ul
#define HYSTERESIS_START_VALUE_SHIFT 4 #define HYSTERESIS_START_VALUE_SHIFT 4
#define T_OFF_TIMING_PATERN 0xFul #define T_OFF_TIMING_PATERN 0xFul
//definitions for cool step register //definitions for cool step register
#define MINIMUM_CURRENT_FOURTH 0x8000UL #define MINIMUM_CURRENT_FOURTH 0x8000ul
#define CURRENT_DOWN_STEP_SPEED_PATTERN 0x6000UL #define CURRENT_DOWN_STEP_SPEED_PATTERN 0x6000ul
#define SE_MAX_PATTERN 0xF00ul #define SE_MAX_PATTERN 0xF00ul
#define SE_CURRENT_STEP_WIDTH_PATTERN 0x60UL #define SE_CURRENT_STEP_WIDTH_PATTERN 0x60ul
#define SE_MIN_PATTERN 0xFul #define SE_MIN_PATTERN 0xFul
//definitions for StallGuard2 current register //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 STALL_GUARD_TRESHHOLD_VALUE_PATTERN 0x17F00ul
#define CURRENT_SCALING_PATTERN 0x1Ful #define CURRENT_SCALING_PATTERN 0x1Ful
#define STALL_GUARD_CONFIG_PATTERN 0x17F00ul #define STALL_GUARD_CONFIG_PATTERN 0x17F00ul
#define STALL_GUARD_VALUE_PATTERN 0x7F00ul #define STALL_GUARD_VALUE_PATTERN 0x7F00ul
//definitions for the input from the TMC2660 //definitions for the input from the TMC2660
#define STATUS_STALL_GUARD_STATUS 0x1UL #define STATUS_STALL_GUARD_STATUS 0x1ul
#define STATUS_OVER_TEMPERATURE_SHUTDOWN 0x2UL #define STATUS_OVER_TEMPERATURE_SHUTDOWN 0x2ul
#define STATUS_OVER_TEMPERATURE_WARNING 0x4UL #define STATUS_OVER_TEMPERATURE_WARNING 0x4ul
#define STATUS_SHORT_TO_GROUND_A 0x8UL #define STATUS_SHORT_TO_GROUND_A 0x8ul
#define STATUS_SHORT_TO_GROUND_B 0x10UL #define STATUS_SHORT_TO_GROUND_B 0x10ul
#define STATUS_OPEN_LOAD_A 0x20UL #define STATUS_OPEN_LOAD_A 0x20ul
#define STATUS_OPEN_LOAD_B 0x40UL #define STATUS_OPEN_LOAD_B 0x40ul
#define STATUS_STAND_STILL 0x80UL #define STATUS_STAND_STILL 0x80ul
#define READOUT_VALUE_PATTERN 0xFFC00ul #define READOUT_VALUE_PATTERN 0xFFC00ul
#define CPU_32_BIT #define CPU_32_BIT
//default values //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); SPIClass SPI_6(SPI6, SPI6_MOSI_PIN, SPI6_MISO_PIN, SPI6_SCK_PIN);

View file

@ -20,8 +20,9 @@
* *
*/ */
/** /**
* HAL for Teensy 3.2 (MK20DX256) * Description: HAL for Teensy32 (MK20DX256)
*/ */
#ifdef __MK20DX256__ #ifdef __MK20DX256__

View file

@ -22,7 +22,7 @@
#pragma once #pragma once
/** /**
* HAL for Teensy 3.2 (MK20DX256) * Description: HAL for Teensy 3.5 and Teensy 3.6
*/ */
#define CPU_32_BIT #define CPU_32_BIT
@ -44,9 +44,8 @@
//#undef MOTHERBOARD //#undef MOTHERBOARD
//#define MOTHERBOARD BOARD_TEENSY31_32 //#define MOTHERBOARD BOARD_TEENSY31_32
#define IS_32BIT_TEENSY 1 #ifdef __MK20DX256__
#define IS_TEENSY_31_32 1 #define IS_32BIT_TEENSY 1
#ifndef IS_TEENSY31
#define IS_TEENSY32 1 #define IS_TEENSY32 1
#endif #endif
@ -65,7 +64,7 @@
typedef int8_t pin_t; typedef int8_t pin_t;
#ifndef analogInputToDigitalPin #ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1) #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
#endif #endif
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq() #define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
@ -93,8 +92,6 @@ void HAL_clear_reset_source();
// Get the reason for the reset // Get the reason for the reset
uint8_t HAL_get_reset_source(); 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); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push #pragma GCC diagnostic push

View file

@ -51,4 +51,5 @@ void libServo::move(const int value) {
} }
#endif // HAS_SERVOS #endif // HAS_SERVOS
#endif // __MK20DX256__ #endif // __MK20DX256__

View file

@ -23,7 +23,8 @@
#if USE_WIRED_EEPROM #if USE_WIRED_EEPROM
/** /**
* HAL PersistentStore for Teensy 3.2 (MK20DX256) * PersistentStore for Arduino-style EEPROM interface
* with implementations supplied by the framework.
*/ */
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"

View file

@ -21,7 +21,7 @@
*/ */
/** /**
* HAL Timers for Teensy 3.2 (MK20DX256) * Teensy3.2 __MK20DX256__
*/ */
#ifdef __MK20DX256__ #ifdef __MK20DX256__

View file

@ -22,7 +22,8 @@
#pragma once #pragma once
/** /**
* HAL Timers for Teensy 3.2 (MK20DX256) * Description: HAL for
* Teensy3.2 (__MK20DX256__)
*/ */
#include <stdint.h> #include <stdint.h>

View file

@ -21,7 +21,7 @@
*/ */
/** /**
* HAL for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0) * Description: HAL for Teensy35 (MK64FX512)
*/ */
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #if defined(__MK64FX512__) || defined(__MK66FX1M0__)

View file

@ -22,7 +22,7 @@
#pragma once #pragma once
/** /**
* HAL for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0) * Description: HAL for Teensy 3.5 and Teensy 3.6
*/ */
#define CPU_32_BIT #define CPU_32_BIT
@ -45,13 +45,14 @@
// Defines // Defines
// ------------------------ // ------------------------
#define IS_32BIT_TEENSY 1 #ifdef __MK64FX512__
#define IS_TEENSY_35_36 1 #define IS_32BIT_TEENSY 1
#ifdef __MK66FX1M0__
#define IS_TEENSY36 1
#else // __MK64FX512__
#define IS_TEENSY35 1 #define IS_TEENSY35 1
#endif #endif
#ifdef __MK66FX1M0__
#define IS_32BIT_TEENSY 1
#define IS_TEENSY36 1
#endif
#define _MSERIAL(X) Serial##X #define _MSERIAL(X) Serial##X
#define MSERIAL(X) _MSERIAL(X) #define MSERIAL(X) _MSERIAL(X)
@ -68,7 +69,7 @@
typedef int8_t pin_t; typedef int8_t pin_t;
#ifndef analogInputToDigitalPin #ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1) #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
#endif #endif
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq() #define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()
@ -99,8 +100,6 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); 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); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push #pragma GCC diagnostic push

View file

@ -19,11 +19,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
/**
* HAL SPI for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
*/
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
#include "HAL.h" #include "HAL.h"

View file

@ -19,11 +19,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
/**
* HAL Servo for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
*/
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
@ -56,4 +51,5 @@ void libServo::move(const int value) {
} }
#endif // HAS_SERVOS #endif // HAS_SERVOS
#endif // __MK64FX512__ || __MK66FX1M0__ #endif // __MK64FX512__ || __MK66FX1M0__

View file

@ -21,10 +21,6 @@
*/ */
#pragma once #pragma once
/**
* HAL Servo for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
*/
#include <Servo.h> #include <Servo.h>
// Inherit and expand on core Servo library // Inherit and expand on core Servo library

View file

@ -22,14 +22,15 @@
*/ */
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
/**
* HAL PersistentStore for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
*/
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM #if USE_WIRED_EEPROM
/**
* PersistentStore for Arduino-style EEPROM interface
* with implementations supplied by the framework.
*/
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <avr/eeprom.h> #include <avr/eeprom.h>

View file

@ -22,7 +22,7 @@
#pragma once #pragma once
/** /**
* HAL Endstop Interrupts for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0) * Endstop Interrupts
* *
* Without endstop interrupts the endstop pins must be polled continually in * Without endstop interrupts the endstop pins must be polled continually in
* the temperature-ISR via endstops.update(), most of the time finding no change. * the temperature-ISR via endstops.update(), most of the time finding no change.

View file

@ -18,10 +18,6 @@
*/ */
#pragma once #pragma once
/**
* HAL Pins Debugging for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
*/
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin

View file

@ -21,10 +21,6 @@
*/ */
#pragma once #pragma once
/**
* HAL SPI Pins for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
*/
#define SCK_PIN 13 #define SCK_PIN 13
#define MISO_PIN 12 #define MISO_PIN 12
#define MOSI_PIN 11 #define MOSI_PIN 11

View file

@ -21,7 +21,8 @@
*/ */
/** /**
* HAL Timers for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0) * Teensy3.5 __MK64FX512__
* Teensy3.6 __MK66FX1M0__
*/ */
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #if defined(__MK64FX512__) || defined(__MK66FX1M0__)

View file

@ -21,7 +21,9 @@
#pragma once #pragma once
/** /**
* HAL Timers for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0) * Description: HAL for
* Teensy3.5 (__MK64FX512__)
* Teensy3.6 (__MK66FX1M0__)
*/ */
#include <stdint.h> #include <stdint.h>

View file

@ -21,7 +21,7 @@
*/ */
/** /**
* HAL for Teensy 4.0 / 4.1 (IMXRT1062) * Description: HAL for Teensy40 (IMXRT1062)
*/ */
#ifdef __IMXRT1062__ #ifdef __IMXRT1062__

View file

@ -22,7 +22,7 @@
#pragma once #pragma once
/** /**
* HAL for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) * Description: HAL for Teensy 4.0 and Teensy 4.1
*/ */
#define CPU_32_BIT #define CPU_32_BIT
@ -45,9 +45,8 @@
// Defines // Defines
// ------------------------ // ------------------------
#define IS_32BIT_TEENSY 1 #ifdef __IMXRT1062__
#define IS_TEENSY_40_41 1 #define IS_32BIT_TEENSY 1
#ifndef IS_TEENSY40
#define IS_TEENSY41 1 #define IS_TEENSY41 1
#endif #endif
@ -78,7 +77,7 @@
typedef int8_t pin_t; typedef int8_t pin_t;
#ifndef analogInputToDigitalPin #ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1) #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
#endif #endif
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq() #define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()

View file

@ -19,11 +19,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
/**
* HAL SPI for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
*/
#ifdef __IMXRT1062__ #ifdef __IMXRT1062__
#include "HAL.h" #include "HAL.h"

View file

@ -19,11 +19,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
/**
* HAL Servo for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
*/
#ifdef __IMXRT1062__ #ifdef __IMXRT1062__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
@ -58,4 +53,5 @@ void libServo::detach() {
} }
#endif // HAS_SERVOS #endif // HAS_SERVOS
#endif // __IMXRT1062__ #endif // __IMXRT1062__

View file

@ -21,10 +21,6 @@
*/ */
#pragma once #pragma once
/**
* HAL Servo for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
*/
#include <PWMServo.h> #include <PWMServo.h>
// Inherit and expand on core Servo library // Inherit and expand on core Servo library

View file

@ -27,7 +27,8 @@
#if USE_WIRED_EEPROM #if USE_WIRED_EEPROM
/** /**
* HAL PersistentStore for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) * PersistentStore for Arduino-style EEPROM interface
* with implementations supplied by the framework.
*/ */
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"

View file

@ -22,7 +22,7 @@
#pragma once #pragma once
/** /**
* HAL Endstop Interrupts for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) * Endstop Interrupts
* *
* Without endstop interrupts the endstop pins must be polled continually in * Without endstop interrupts the endstop pins must be polled continually in
* the temperature-ISR via endstops.update(), most of the time finding no change. * the temperature-ISR via endstops.update(), most of the time finding no change.

View file

@ -23,7 +23,7 @@
#pragma once #pragma once
/** /**
* Fast I/O interfaces for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) * Fast I/O interfaces for Teensy 4
* These use GPIO functions instead of Direct Port Manipulation, as on AVR. * These use GPIO functions instead of Direct Port Manipulation, as on AVR.
*/ */

View file

@ -18,10 +18,6 @@
*/ */
#pragma once #pragma once
/**
* HAL Pins Debugging for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
*/
#warning "PINS_DEBUGGING is not fully supported for Teensy 4.0 / 4.1 so 'M43' may cause hangs." #warning "PINS_DEBUGGING is not fully supported for Teensy 4.0 / 4.1 so 'M43' may cause hangs."
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS

View file

@ -21,10 +21,6 @@
*/ */
#pragma once #pragma once
/**
* HAL SPI Pins for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
*/
#define SCK_PIN 13 #define SCK_PIN 13
#define MISO_PIN 12 #define MISO_PIN 12
#define MOSI_PIN 11 #define MOSI_PIN 11

View file

@ -21,7 +21,7 @@
*/ */
/** /**
* HAL Timers for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) * Teensy4.0/4.1 (__IMXRT1062__)
*/ */
#ifdef __IMXRT1062__ #ifdef __IMXRT1062__

View file

@ -21,7 +21,8 @@
#pragma once #pragma once
/** /**
* HAL Timers for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) * Description: HAL for
* Teensy4.0/4.1 (__IMXRT1062__)
*/ */
#include <stdint.h> #include <stdint.h>

View file

@ -19,11 +19,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
/**
* HAL Watchdog for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
*/
#ifdef __IMXRT1062__ #ifdef __IMXRT1062__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
@ -53,4 +48,5 @@ void HAL_watchdog_refresh() {
} }
#endif // USE_WATCHDOG #endif // USE_WATCHDOG
#endif // __IMXRT1062__ #endif // __IMXRT1062__

View file

@ -22,7 +22,7 @@
#pragma once #pragma once
/** /**
* HAL Watchdog for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) * Watchdog for Teensy4.0/4.1 (__IMXRT1062__)
*/ */
void watchdog_init(); void watchdog_init();

View file

@ -85,7 +85,7 @@
#define START_FLASH_ADDR 0x08000000 #define START_FLASH_ADDR 0x08000000
#define END_FLASH_ADDR 0x08100000 #define END_FLASH_ADDR 0x08100000
#elif MB(REMRAM_V1, NUCLEO_F767ZI) #elif MB(REMRAM_V1)
// For STM32F765VI in RemRam v1 // For STM32F765VI in RemRam v1
// SRAM (0x20000000 - 0x20080000) (512kb) // SRAM (0x20000000 - 0x20080000) (512kb)

View file

@ -97,7 +97,7 @@
#include "feature/closedloop.h" #include "feature/closedloop.h"
#endif #endif
#if HAS_MOTOR_CURRENT_I2C #if HAS_I2C_DIGIPOT
#include "feature/digipot/digipot.h" #include "feature/digipot/digipot.h"
#endif #endif
@ -125,7 +125,7 @@
#include "module/servo.h" #include "module/servo.h"
#endif #endif
#if ENABLED(HAS_MOTOR_CURRENT_DAC) #if ENABLED(DAC_STEPPER_CURRENT)
#include "feature/dac/stepper_dac.h" #include "feature/dac/stepper_dac.h"
#endif #endif
@ -1048,11 +1048,6 @@ void setup() {
SERIAL_ECHO_MSG("Compiled: " __DATE__); SERIAL_ECHO_MSG("Compiled: " __DATE__);
SERIAL_ECHO_MSG(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE)); SERIAL_ECHO_MSG(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE));
// Init buzzer pin(s)
#if USE_BEEPER
SETUP_RUN(buzzer.init());
#endif
// Set up LEDs early // Set up LEDs early
#if HAS_COLOR_LEDS #if HAS_COLOR_LEDS
SETUP_RUN(leds.setup()); SETUP_RUN(leds.setup());
@ -1137,12 +1132,12 @@ void setup() {
SETUP_RUN(enableStepperDrivers()); SETUP_RUN(enableStepperDrivers());
#endif #endif
#if HAS_MOTOR_CURRENT_I2C #if HAS_I2C_DIGIPOT
SETUP_RUN(digipot_i2c.init()); SETUP_RUN(digipot_i2c_init());
#endif #endif
#if ENABLED(HAS_MOTOR_CURRENT_DAC) #if ENABLED(DAC_STEPPER_CURRENT)
SETUP_RUN(stepper_dac.init()); SETUP_RUN(dac_init());
#endif #endif
#if EITHER(Z_PROBE_SLED, SOLENOID_PROBE) && HAS_SOLENOID_1 #if EITHER(Z_PROBE_SLED, SOLENOID_PROBE) && HAS_SOLENOID_1

View file

@ -320,7 +320,6 @@
#define BOARD_CREALITY_V4 4034 // Creality v4.x (STM32F103RE) #define BOARD_CREALITY_V4 4034 // Creality v4.x (STM32F103RE)
#define BOARD_CREALITY_V427 4035 // Creality v4.2.7 (STM32F103RE) #define BOARD_CREALITY_V427 4035 // Creality v4.2.7 (STM32F103RE)
#define BOARD_TRIGORILLA_PRO 4036 // Trigorilla Pro (STM32F103ZET6) #define BOARD_TRIGORILLA_PRO 4036 // Trigorilla Pro (STM32F103ZET6)
#define BOARD_FLY_MINI 4037 // FLY MINI (STM32F103RCT6)
// //
// ARM Cortex-M4F // ARM Cortex-M4F
@ -363,7 +362,6 @@
#define BOARD_REMRAM_V1 5001 // RemRam v1 #define BOARD_REMRAM_V1 5001 // RemRam v1
#define BOARD_TEENSY41 5002 // Teensy 4.1 #define BOARD_TEENSY41 5002 // Teensy 4.1
#define BOARD_T41U5XBB 5003 // T41U5XBB Teensy 4.1 breakout board #define BOARD_T41U5XBB 5003 // T41U5XBB Teensy 4.1 breakout board
#define BOARD_NUCLEO_F767ZI 5004 // ST NUCLEO-F767ZI Dev Board
// //
// Espressif ESP32 WiFi // Espressif ESP32 WiFi

View file

@ -303,7 +303,7 @@
#define LCD_STR_C STR_C #define LCD_STR_C STR_C
#define LCD_STR_E STR_E #define LCD_STR_E STR_E
#if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL) #if HAS_MARLINUI_HD44780
// Custom characters defined in the first 8 characters of the LCD // 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! #define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string!

View file

@ -215,7 +215,6 @@
#define WITHIN(N,L,H) ((N) >= (L) && (N) <= (H)) #define WITHIN(N,L,H) ((N) >= (L) && (N) <= (H))
#define NUMERIC(a) WITHIN(a, '0', '9') #define NUMERIC(a) WITHIN(a, '0', '9')
#define DECIMAL(a) (NUMERIC(a) || a == '.') #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 NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+')
#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+') #define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+')
#define COUNT(a) (sizeof(a)/sizeof(*a)) #define COUNT(a) (sizeof(a)/sizeof(*a))
@ -452,12 +451,6 @@
#define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)()) #define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)())
#define _END_OF_ARGUMENTS_() 0 #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. // REPEAT core macros. Recurse N times with ascending I.
// //

View file

@ -71,7 +71,7 @@ public:
inline void restore() { ref_ = val_; } 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() #define RESTORE(N) restorer_##N.restore()
// Converts from an uint8_t in the range of 0-255 to an uint8_t // Converts from an uint8_t in the range of 0-255 to an uint8_t

View file

@ -348,7 +348,7 @@ float bilinear_z_offset(const xy_pos_t &raw) {
* Prepare a bilinear-leveled linear move on Cartesian, * Prepare a bilinear-leveled linear move on Cartesian,
* splitting the move where it crosses grid borders. * splitting the move where it crosses grid borders.
*/ */
void bilinear_line_to_destination(const feedRate_t &scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) { void bilinear_line_to_destination(const feedRate_t scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) {
// Get current and destination cells for this line // Get current and destination cells for this line
xy_int_t c1 { CELL_INDEX(x, current_position.x), CELL_INDEX(y, current_position.y) }, xy_int_t c1 { CELL_INDEX(x, current_position.x), CELL_INDEX(y, current_position.y) },
c2 { CELL_INDEX(x, destination.x), CELL_INDEX(y, destination.y) }; c2 { CELL_INDEX(x, destination.x), CELL_INDEX(y, destination.y) };

View file

@ -1009,8 +1009,6 @@
lcd_mesh_edit_setup(new_z); lcd_mesh_edit_setup(new_z);
SET_SOFT_ENDSTOP_LOOSE(true);
do { do {
idle(); idle();
new_z = lcd_mesh_edit(); new_z = lcd_mesh_edit();
@ -1018,8 +1016,6 @@
SERIAL_FLUSH(); // Prevent host M105 buffer overrun. SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} while (!ui.button_pressed()); } 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 (!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 if (click_and_hold(abort_fine_tune)) break; // Button held down? Abort editing

View file

@ -32,18 +32,16 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ENABLED(HAS_MOTOR_CURRENT_DAC) #if ENABLED(DAC_STEPPER_CURRENT)
#include "dac_mcp4728.h" #include "dac_mcp4728.h"
MCP4728 mcp4728; xyze_uint_t mcp4728_values;
xyze_uint_t dac_values;
/** /**
* Begin I2C, get current values (input register and eeprom) of mcp4728 * Begin I2C, get current values (input register and eeprom) of mcp4728
*/ */
void MCP4728::init() { void mcp4728_init() {
Wire.begin(); Wire.begin();
Wire.requestFrom(I2C_ADDRESS(DAC_DEV_ADDRESS), uint8_t(24)); Wire.requestFrom(I2C_ADDRESS(DAC_DEV_ADDRESS), uint8_t(24));
while (Wire.available()) { while (Wire.available()) {
@ -52,7 +50,7 @@ void MCP4728::init() {
loByte = Wire.read(); loByte = Wire.read();
if (!(deviceID & 0x08)) if (!(deviceID & 0x08))
dac_values[(deviceID & 0x30) >> 4] = word((hiByte & 0x0F), loByte); mcp4728_values[(deviceID & 0x30) >> 4] = word((hiByte & 0x0F), loByte);
} }
} }
@ -60,9 +58,9 @@ void MCP4728::init() {
* Write input resister value to specified channel using fastwrite method. * Write input resister value to specified channel using fastwrite method.
* Channel : 0-3, Values : 0-4095 * Channel : 0-3, Values : 0-4095
*/ */
uint8_t MCP4728::analogWrite(const uint8_t channel, const uint16_t value) { uint8_t mcp4728_analogWrite(const uint8_t channel, const uint16_t value) {
dac_values[channel] = value; mcp4728_values[channel] = value;
return fastWrite(); return mcp4728_fastWrite();
} }
/** /**
@ -70,12 +68,12 @@ uint8_t MCP4728::analogWrite(const uint8_t channel, const uint16_t value) {
* This will update both input register and EEPROM value * This will update both input register and EEPROM value
* This will also write current Vref, PowerDown, Gain settings to EEPROM * 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.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
Wire.write(SEQWRITE); Wire.write(SEQWRITE);
LOOP_XYZE(i) { LOOP_XYZE(i) {
Wire.write(DAC_STEPPER_VREF << 7 | DAC_STEPPER_GAIN << 4 | highByte(dac_values[i])); Wire.write(DAC_STEPPER_VREF << 7 | DAC_STEPPER_GAIN << 4 | highByte(mcp4728_values[i]));
Wire.write(lowByte(dac_values[i])); Wire.write(lowByte(mcp4728_values[i]));
} }
return Wire.endTransmission(); return Wire.endTransmission();
} }
@ -83,7 +81,7 @@ uint8_t MCP4728::eepromWrite() {
/** /**
* Write Voltage reference setting to all input regiters * 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.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
Wire.write(VREFWRITE | (value ? 0x0F : 0x00)); Wire.write(VREFWRITE | (value ? 0x0F : 0x00));
return Wire.endTransmission(); return Wire.endTransmission();
@ -91,7 +89,7 @@ uint8_t MCP4728::setVref_all(const uint8_t value) {
/** /**
* Write Gain setting to all input regiters * 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.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
Wire.write(GAINWRITE | (value ? 0x0F : 0x00)); Wire.write(GAINWRITE | (value ? 0x0F : 0x00));
return Wire.endTransmission(); return Wire.endTransmission();
@ -100,16 +98,16 @@ uint8_t MCP4728::setGain_all(const uint8_t value) {
/** /**
* Return Input Register value * Return Input Register value
*/ */
uint16_t MCP4728::getValue(const uint8_t channel) { return dac_values[channel]; } uint16_t mcp4728_getValue(const uint8_t channel) { return mcp4728_values[channel]; }
#if 0 #if 0
/** /**
* Steph: Might be useful in the future * Steph: Might be useful in the future
* Return Vout * Return Vout
*/ */
uint16_t MCP4728::getVout(const uint8_t channel) { uint16_t mcp4728_getVout(const uint8_t channel) {
const uint32_t vref = 2048, const uint32_t vref = 2048,
vOut = (vref * dac_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096; vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096;
return _MIN(vOut, defaultVDD); return _MIN(vOut, defaultVDD);
} }
#endif #endif
@ -117,15 +115,15 @@ uint16_t MCP4728::getVout(const uint8_t channel) {
/** /**
* Returns DAC values as a 0-100 percentage of drive strength * Returns DAC values as a 0-100 percentage of drive strength
*/ */
uint8_t MCP4728::getDrvPct(const uint8_t channel) { return uint8_t(100.0 * dac_values[channel] / (DAC_STEPPER_MAX) + 0.5); } uint8_t mcp4728_getDrvPct(const uint8_t channel) { return uint8_t(100.0 * mcp4728_values[channel] / (DAC_STEPPER_MAX) + 0.5); }
/** /**
* Receives all Drive strengths as 0-100 percent values, updates * Receives all Drive strengths as 0-100 percent values, updates
* DAC Values array and calls fastwrite to update the DAC. * DAC Values array and calls fastwrite to update the DAC.
*/ */
void MCP4728::setDrvPct(xyze_uint8_t &pct) { void mcp4728_setDrvPct(xyze_uint8_t &pct) {
dac_values *= 0.01 * pct * (DAC_STEPPER_MAX); mcp4728_values *= 0.01 * pct * (DAC_STEPPER_MAX);
fastWrite(); mcp4728_fastWrite();
} }
/** /**
@ -133,11 +131,11 @@ void MCP4728::setDrvPct(xyze_uint8_t &pct) {
* DAC Input and PowerDown bits update. * DAC Input and PowerDown bits update.
* No EEPROM update * No EEPROM update
*/ */
uint8_t MCP4728::fastWrite() { uint8_t mcp4728_fastWrite() {
Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS)); Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS));
LOOP_XYZE(i) { LOOP_XYZE(i) {
Wire.write(highByte(dac_values[i])); Wire.write(highByte(mcp4728_values[i]));
Wire.write(lowByte(dac_values[i])); Wire.write(lowByte(mcp4728_values[i]));
} }
return Wire.endTransmission(); return Wire.endTransmission();
} }
@ -145,10 +143,10 @@ uint8_t MCP4728::fastWrite() {
/** /**
* Common function for simple general commands * 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.beginTransmission(I2C_ADDRESS(GENERALCALL));
Wire.write(simpleCommand); Wire.write(simpleCommand);
return Wire.endTransmission(); return Wire.endTransmission();
} }
#endif // HAS_MOTOR_CURRENT_DAC #endif // DAC_STEPPER_CURRENT

View file

@ -40,7 +40,7 @@
#endif #endif
#ifndef lowByte #ifndef lowByte
#define lowByte(w) ((uint8_t) ((w) & 0xFF)) #define lowByte(w) ((uint8_t) ((w) & 0xff))
#endif #endif
#ifndef highByte #ifndef highByte
@ -65,18 +65,13 @@
// DAC_OR_ADDRESS defined in pins_BOARD.h file // DAC_OR_ADDRESS defined in pins_BOARD.h file
#define DAC_DEV_ADDRESS (BASE_ADDR | DAC_OR_ADDRESS) #define DAC_DEV_ADDRESS (BASE_ADDR | DAC_OR_ADDRESS)
class MCP4728 { void mcp4728_init();
public: uint8_t mcp4728_analogWrite(const uint8_t channel, const uint16_t value);
static void init(); uint8_t mcp4728_eepromWrite();
static uint8_t analogWrite(const uint8_t channel, const uint16_t value); uint8_t mcp4728_setVref_all(const uint8_t value);
static uint8_t eepromWrite(); uint8_t mcp4728_setGain_all(const uint8_t value);
static uint8_t setVref_all(const uint8_t value); uint16_t mcp4728_getValue(const uint8_t channel);
static uint8_t setGain_all(const uint8_t value); uint8_t mcp4728_fastWrite();
static uint16_t getValue(const uint8_t channel); uint8_t mcp4728_simpleCommand(const byte simpleCommand);
static uint8_t fastWrite(); uint8_t mcp4728_getDrvPct(const uint8_t channel);
static uint8_t simpleCommand(const byte simpleCommand); void mcp4728_setDrvPct(xyze_uint8_t &pct);
static uint8_t getDrvPct(const uint8_t channel);
static void setDrvPct(xyze_uint8_t &pct);
};
extern MCP4728 mcp4728;

View file

@ -26,7 +26,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ENABLED(HAS_MOTOR_CURRENT_DAC) #if ENABLED(DAC_STEPPER_CURRENT)
#include "stepper_dac.h" #include "stepper_dac.h"
#include "../../MarlinCore.h" // for SP_X_LBL... #include "../../MarlinCore.h" // for SP_X_LBL...
@ -35,53 +35,56 @@ bool dac_present = false;
constexpr xyze_uint8_t dac_order = DAC_STEPPER_ORDER; constexpr xyze_uint8_t dac_order = DAC_STEPPER_ORDER;
xyze_uint8_t dac_channel_pct = DAC_MOTOR_CURRENT_DEFAULT; xyze_uint8_t dac_channel_pct = DAC_MOTOR_CURRENT_DEFAULT;
StepperDAC stepper_dac; int dac_init() {
int StepperDAC::init() {
#if PIN_EXISTS(DAC_DISABLE) #if PIN_EXISTS(DAC_DISABLE)
OUT_WRITE(DAC_DISABLE_PIN, LOW); // set pin low to enable DAC OUT_WRITE(DAC_DISABLE_PIN, LOW); // set pin low to enable DAC
#endif #endif
mcp4728.init(); mcp4728_init();
if (mcp4728.simpleCommand(RESET)) return -1; if (mcp4728_simpleCommand(RESET)) return -1;
dac_present = true; dac_present = true;
mcp4728.setVref_all(DAC_STEPPER_VREF); mcp4728_setVref_all(DAC_STEPPER_VREF);
mcp4728.setGain_all(DAC_STEPPER_GAIN); mcp4728_setGain_all(DAC_STEPPER_GAIN);
if (mcp4728.getDrvPct(0) < 1 || mcp4728.getDrvPct(1) < 1 || mcp4728.getDrvPct(2) < 1 || mcp4728.getDrvPct(3) < 1 ) { if (mcp4728_getDrvPct(0) < 1 || mcp4728_getDrvPct(1) < 1 || mcp4728_getDrvPct(2) < 1 || mcp4728_getDrvPct(3) < 1 ) {
mcp4728.setDrvPct(dac_channel_pct); mcp4728_setDrvPct(dac_channel_pct);
mcp4728.eepromWrite(); mcp4728_eepromWrite();
} }
return 0; return 0;
} }
void StepperDAC::set_current_value(const uint8_t channel, uint16_t val) { 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) {
if (!dac_present) return; if (!dac_present) return;
NOMORE(val, uint16_t(DAC_STEPPER_MAX)); NOMORE(val, uint16_t(DAC_STEPPER_MAX));
mcp4728.analogWrite(dac_order[channel], val); mcp4728_analogWrite(dac_order[channel], val);
mcp4728.simpleCommand(UPDATE); mcp4728_simpleCommand(UPDATE);
} }
void StepperDAC::set_current_percent(const uint8_t channel, float val) { static float dac_perc(int8_t n) { return 100.0 * mcp4728_getValue(dac_order[n]) * RECIPROCAL(DAC_STEPPER_MAX); }
set_current_value(channel, _MIN(val, 100.0f) * (DAC_STEPPER_MAX) / 100.0f); static float dac_amps(int8_t n) { return mcp4728_getDrvPct(dac_order[n]) * (DAC_STEPPER_MAX) * 0.125 * RECIPROCAL(DAC_STEPPER_SENSE); }
}
static float dac_perc(int8_t n) { return 100.0 * mcp4728.getValue(dac_order[n]) * RECIPROCAL(DAC_STEPPER_MAX); } uint8_t dac_current_get_percent(const AxisEnum axis) { return mcp4728_getDrvPct(dac_order[axis]); }
static float dac_amps(int8_t n) { return mcp4728.getDrvPct(dac_order[n]) * (DAC_STEPPER_MAX) * 0.125 * RECIPROCAL(DAC_STEPPER_SENSE); } void dac_current_set_percents(xyze_uint8_t &pct) {
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]]; LOOP_XYZE(i) dac_channel_pct[i] = pct[dac_order[i]];
mcp4728.setDrvPct(dac_channel_pct); mcp4728_setDrvPct(dac_channel_pct);
} }
void StepperDAC::print_values() { void dac_print_values() {
if (!dac_present) return; if (!dac_present) return;
SERIAL_ECHO_MSG("Stepper current values in % (Amps):"); SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
SERIAL_ECHO_START(); SERIAL_ECHO_START();
@ -91,9 +94,9 @@ void StepperDAC::print_values() {
SERIAL_ECHOLNPAIR_P(SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")")); SERIAL_ECHOLNPAIR_P(SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")"));
} }
void StepperDAC::commit_eeprom() { void dac_commit_eeprom() {
if (!dac_present) return; if (!dac_present) return;
mcp4728.eepromWrite(); mcp4728_eepromWrite();
} }
#endif // HAS_MOTOR_CURRENT_DAC #endif // DAC_STEPPER_CURRENT

View file

@ -27,15 +27,10 @@
#include "dac_mcp4728.h" #include "dac_mcp4728.h"
class StepperDAC { int dac_init();
public: void dac_current_percent(uint8_t channel, float val);
static int init(); void dac_current_raw(uint8_t channel, uint16_t val);
static void set_current_percent(const uint8_t channel, float val); void dac_print_values();
static void set_current_value(const uint8_t channel, uint16_t val); void dac_commit_eeprom();
static void print_values(); uint8_t dac_current_get_percent(AxisEnum axis);
static void commit_eeprom(); void dac_current_set_percents(xyze_uint8_t &pct);
static uint8_t get_current_percent(AxisEnum axis);
static void set_current_percents(xyze_uint8_t &pct);
};
extern StepperDAC stepper_dac;

View file

@ -21,13 +21,5 @@
*/ */
#pragma once #pragma once
// void digipot_i2c_set_current(const uint8_t channel, const float current);
// Header for MCP4018 and MCP4451 current control i2c devices void digipot_i2c_init();
//
class DigipotI2C {
public:
static void init();
static void set_current(const uint8_t channel, const float current);
};
DigipotI2C digipot_i2c;

View file

@ -24,8 +24,6 @@
#if ENABLED(DIGIPOT_MCP4018) #if ENABLED(DIGIPOT_MCP4018)
#include "digipot.h"
#include <Stream.h> #include <Stream.h>
#include <SlowSoftI2CMaster.h> // https://github.com/stawel/SlowSoftI2CMaster #include <SlowSoftI2CMaster.h> // https://github.com/stawel/SlowSoftI2CMaster
@ -70,7 +68,7 @@ static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = {
#endif #endif
}; };
static void digipot_i2c_send(const uint8_t channel, const byte v) { static void i2c_send(const uint8_t channel, const byte v) {
if (WITHIN(channel, 0, DIGIPOT_I2C_NUM_CHANNELS - 1)) { if (WITHIN(channel, 0, DIGIPOT_I2C_NUM_CHANNELS - 1)) {
pots[channel].i2c_start(((DIGIPOT_I2C_ADDRESS_A) << 1) | I2C_WRITE); pots[channel].i2c_start(((DIGIPOT_I2C_ADDRESS_A) << 1) | I2C_WRITE);
pots[channel].i2c_write(v); pots[channel].i2c_write(v);
@ -79,12 +77,12 @@ static void digipot_i2c_send(const uint8_t channel, const byte v) {
} }
// This is for the MCP4018 I2C based digipot // This is for the MCP4018 I2C based digipot
void DigipotI2C::set_current(const uint8_t channel, const float current) { void digipot_i2c_set_current(const uint8_t channel, const float current) {
const float ival = _MIN(_MAX(current, 0), float(DIGIPOT_MCP4018_MAX_VALUE)); const float ival = _MIN(_MAX(current, 0), float(DIGIPOT_MCP4018_MAX_VALUE));
digipot_i2c_send(channel, current_to_wiper(ival)); i2c_send(channel, current_to_wiper(ival));
} }
void DigipotI2C::init() { void digipot_i2c_init() {
LOOP_L_N(i, DIGIPOT_I2C_NUM_CHANNELS) pots[i].i2c_init(); LOOP_L_N(i, DIGIPOT_I2C_NUM_CHANNELS) pots[i].i2c_init();
// Init currents according to Configuration_adv.h // Init currents according to Configuration_adv.h
@ -96,7 +94,7 @@ void DigipotI2C::init() {
#endif #endif
; ;
LOOP_L_N(i, COUNT(digipot_motor_current)) LOOP_L_N(i, COUNT(digipot_motor_current))
set_current(i, pgm_read_float(&digipot_motor_current[i])); digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
} }
#endif // DIGIPOT_MCP4018 #endif // DIGIPOT_MCP4018

View file

@ -24,8 +24,6 @@
#if ENABLED(DIGIPOT_MCP4451) #if ENABLED(DIGIPOT_MCP4451)
#include "digipot.h"
#include <Stream.h> #include <Stream.h>
#include <Wire.h> #include <Wire.h>
@ -63,7 +61,7 @@ static void digipot_i2c_send(const byte addr, const byte a, const byte b) {
} }
// This is for the MCP4451 I2C based digipot // This is for the MCP4451 I2C based digipot
void DigipotI2C::set_current(const uint8_t channel, const float current) { void digipot_i2c_set_current(const uint8_t channel, const float current) {
// These addresses are specific to Azteeg X3 Pro, can be set to others. // 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 // 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 const byte addr = channel < 4 ? DIGIPOT_I2C_ADDRESS_A : DIGIPOT_I2C_ADDRESS_B; // channel 0-3 vs 4-7
@ -77,7 +75,7 @@ void DigipotI2C::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))); digipot_i2c_send(addr, addresses[channel & 0x3], current_to_wiper(_MIN(float(_MAX(current, 0)), DIGIPOT_I2C_MAX_CURRENT)));
} }
void DigipotI2C::init() { void digipot_i2c_init() {
#if MB(MKS_SBASE) #if MB(MKS_SBASE)
configure_i2c(16); // Set clock_option to 16 ensure I2C is initialized at 400kHz configure_i2c(16); // Set clock_option to 16 ensure I2C is initialized at 400kHz
#else #else
@ -92,7 +90,7 @@ void DigipotI2C::init() {
#endif #endif
; ;
LOOP_L_N(i, COUNT(digipot_motor_current)) LOOP_L_N(i, COUNT(digipot_motor_current))
set_current(i, pgm_read_float(&digipot_motor_current[i])); digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
} }
#endif // DIGIPOT_MCP4451 #endif // DIGIPOT_MCP4451

View file

@ -88,8 +88,10 @@ public:
case EP_N: case EP_N:
switch (c) { switch (c) {
case '0' ... '9': case '0': case '1': case '2':
case '-': case ' ': break; case '3': case '4': case '5':
case '6': case '7': case '8':
case '9': case '-': case ' ': break;
case 'M': state = EP_M; break; case 'M': state = EP_M; break;
default: state = EP_IGNORE; default: state = EP_IGNORE;
} }
@ -151,7 +153,10 @@ public:
case EP_M876S: case EP_M876S:
switch (c) { switch (c) {
case ' ': break; case ' ': break;
case '0' ... '9': case '0': case '1': case '2':
case '3': case '4': case '5':
case '6': case '7': case '8':
case '9':
state = EP_M876SN; state = EP_M876SN;
M876_reason = (uint8_t)(c - '0'); M876_reason = (uint8_t)(c - '0');
break; break;

View file

@ -340,17 +340,17 @@ void MMU2::mmu_loop() {
#endif #endif
if (rx_ok()) { if (rx_ok()) {
// Response to C0 mmu command in PRUSA_MMU2_S_MODE // response to C0 mmu command in PRUSA_MMU2_S_MODE
bool can_reset = true; bool can_reset = true;
#if ENABLED(PRUSA_MMU2_S_MODE) if (ENABLED(PRUSA_MMU2_S_MODE) && last_cmd == MMU_CMD_C0) {
if (!mmu2s_triggered && last_cmd == MMU_CMD_C0) { if (!mmu2s_triggered) {
can_reset = false; can_reset = false;
// MMU ok received but filament sensor not triggered, retrying... // MMU ok received but filament sensor not triggered, retrying...
DEBUG_ECHOLNPGM("MMU => 'ok' (filament not present in gears)"); DEBUG_ECHOLNPGM("MMU => 'ok' (filament not present in gears)");
DEBUG_ECHOLNPGM("MMU <= 'C0' (keep trying)"); DEBUG_ECHOLNPGM("MMU <= 'C0' (keep trying)");
MMU2_COMMAND("C0"); MMU2_COMMAND("C0");
} }
#endif }
if (can_reset) { if (can_reset) {
DEBUG_ECHOLNPGM("MMU => 'ok'"); DEBUG_ECHOLNPGM("MMU => 'ok'");
ready = true; ready = true;

View file

@ -61,10 +61,6 @@
#include "../libs/buzzer.h" #include "../libs/buzzer.h"
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "powerloss.h"
#endif
#include "../libs/nozzle.h" #include "../libs/nozzle.h"
#include "pause.h" #include "pause.h"
@ -616,13 +612,11 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
// Retract to prevent oozing // Retract to prevent oozing
unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE)); unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
if (!axes_should_home()) { // Move XY to starting position, then Z
// Move XY to starting position, then Z do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
// Move Z_AXIS to saved position // Move Z_AXIS to saved position
do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE)); do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
}
// Unretract // Unretract
unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE)); unscaled_e_move(PAUSE_PARK_RETRACT_LENGTH, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
@ -644,9 +638,6 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
// Set extruder to saved position // Set extruder to saved position
planner.set_e_position_mm((destination.e = current_position.e = resume_position.e)); 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)); TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
#ifdef ACTION_ON_RESUMED #ifdef ACTION_ON_RESUMED

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