Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f3f269fdf3 | |||
| 79bc5be06d | |||
| 2eb3ff66a9 | |||
| c7c87aacce | |||
| 1fa264a9d8 | |||
| 683ccc8faa | |||
| 352e41bad7 | |||
| c674286de2 | |||
| 364684f60e | |||
| 9f81c7622b | |||
| f344131699 | |||
| 9b27abdb09 | |||
| c8ee607092 | |||
| a130e08b3c | |||
| dc0cf5861a | |||
| 0196385a92 | |||
| 0df276d871 | |||
| baf8b6288c | |||
| e6d3289dba | |||
| 37b1725a65 | |||
| 43ad3cb6a0 | |||
| 22fda76fdc | |||
| e62e389bec | |||
| 6052988f6f | |||
| 38581acb15 | |||
| 6dc6ff8e30 | |||
| b1c20a6aa7 | |||
| 831e72453d | |||
| ecd9c1370b | |||
| a5886798be | |||
| 5b7e2f7055 | |||
| 5b8f71b846 | |||
| ac7dae7b49 | |||
| 2fd98ab17c | |||
| c1e57e3a9b | |||
| 7232bdd883 | |||
| e4cad11951 | |||
| d923c018b8 | |||
| e3f6f1b12c | |||
| ec2c721ca2 | |||
| 919d7f8999 | |||
| 8573625fab | |||
| 900bb1aba3 | |||
| 5927818234 | |||
| 8be2aa0ef4 | |||
| 6284eaf17d | |||
| 5094b167d4 | |||
| 42e9e85282 | |||
| eb0bf22d09 | |||
| 57e51e0d7d | |||
| 3358333e22 | |||
| a7a6503917 | |||
| acbe72c239 | |||
| dbac603128 |
@@ -0,0 +1,274 @@
|
||||
# Python CircleCI 2.0 configuration file
|
||||
#
|
||||
# Check https://circleci.com/docs/2.0/language-python/ for more details
|
||||
#
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
# specify the version you desire here
|
||||
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
|
||||
- image: circleci/python:2.7.13
|
||||
|
||||
# Specify service dependencies here if necessary
|
||||
# CircleCI maintains a library of pre-built images
|
||||
# documented at https://circleci.com/docs/2.0/circleci-images/
|
||||
# - image: circleci/postgres:9.4
|
||||
environment:
|
||||
TEST_PLATFORM: "-e megaatmega2560"
|
||||
|
||||
working_directory: ~/Marlin
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
- restore_cache:
|
||||
paths:
|
||||
- ~/.platformio
|
||||
- ~/Marlin/.piolibdeps
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "~/Marlin/platformio.ini" }}
|
||||
# fallback to using the latest cache if no exact match is found
|
||||
- v1-dependencies-
|
||||
|
||||
- run:
|
||||
name: install dependencies
|
||||
command: |
|
||||
sudo pip install -U platformio
|
||||
|
||||
# run tests!
|
||||
- run:
|
||||
name: run tests
|
||||
command: |
|
||||
#
|
||||
#
|
||||
# Fetch the tag information for the current branch
|
||||
ls -la
|
||||
git fetch origin --tags
|
||||
#
|
||||
# Publish the buildroot script folder
|
||||
chmod +x buildroot/bin/*
|
||||
export PATH=`pwd`/buildroot/bin/:${PATH}
|
||||
|
||||
# Generate custom version include
|
||||
generate_version ./Marlin/
|
||||
cat ./Marlin/Version.h
|
||||
#
|
||||
# Back up pins_RAMPS.h
|
||||
#
|
||||
backup_ramps
|
||||
|
||||
env_backup
|
||||
|
||||
#################################
|
||||
# Build all sample configurations
|
||||
#################################
|
||||
|
||||
echo testing megaatmega2560 targets...
|
||||
export TEST_PLATFORM="-e megaatmega2560"
|
||||
echo use_example_configs adafruit/ST7565
|
||||
use_example_configs adafruit/ST7565
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs BQ/Hephestos
|
||||
use_example_configs BQ/Hephestos
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs BQ/Hephestos_2
|
||||
use_example_configs BQ/Hephestos_2
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs BQ/WITBOX
|
||||
use_example_configs BQ/WITBOX
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs AliExpress/CL-260
|
||||
use_example_configs AliExpress/CL-260
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
#echo use_example_configs Cartesio
|
||||
#use_example_configs Cartesio
|
||||
#build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
#restore_configs
|
||||
echo use_example_configs delta/FLSUN/auto_calibrate
|
||||
use_example_configs delta/FLSUN/auto_calibrate
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs delta/FLSUN/kossel_mini
|
||||
use_example_configs delta/FLSUN/kossel_mini
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs delta/generic
|
||||
use_example_configs delta/generic
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs delta/kossel_mini
|
||||
use_example_configs delta/kossel_mini
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs delta/kossel_xl
|
||||
use_example_configs delta/kossel_xl
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Felix
|
||||
use_example_configs Felix
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Felix/DUAL
|
||||
use_example_configs Felix/DUAL
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs FolgerTech/i3-2020
|
||||
use_example_configs FolgerTech/i3-2020
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs gCreate/gMax1.5+
|
||||
use_example_configs gCreate/gMax1.5+
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Geeetech/GT2560
|
||||
use_example_configs Geeetech/GT2560
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
#echo use_example_configs Geeetech/I3_Pro_X-GT2560
|
||||
#use_example_configs Geeetech/I3_Pro_X-GT2560
|
||||
#build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
#restore_configs
|
||||
echo use_example_configs Infitary/i3-M508
|
||||
use_example_configs Infitary/i3-M508
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
use_example_configs Malyan/M200
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Micromake/C1/basic
|
||||
use_example_configs Micromake/C1/basic
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Micromake/C1/enhanced
|
||||
use_example_configs Micromake/C1/enhanced
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs RepRapWorld/Megatronics
|
||||
use_example_configs RepRapWorld/Megatronics
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs RigidBot
|
||||
use_example_configs RigidBot
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs SCARA
|
||||
use_example_configs SCARA
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Velleman/K8200
|
||||
use_example_configs Velleman/K8200
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Velleman/K8400/Dual-head
|
||||
use_example_configs Velleman/K8400/Dual-head
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Velleman/K8400
|
||||
use_example_configs Velleman/K8400
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Wanhao/Duplicator6
|
||||
use_example_configs Wanhao/Duplicator6
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
# Requires manual load of https://github.com/stawel/SlowSoftI2CMaster
|
||||
#use_example_configs wt150
|
||||
#build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
#restore_configs
|
||||
echo testing melzi targets...
|
||||
export TEST_PLATFORM="-e melzi"
|
||||
echo use_example_configs Anet/A6
|
||||
use_example_configs Anet/A6
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Anet/A8
|
||||
use_example_configs Anet/A8
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Creality/CR-10
|
||||
use_example_configs Creality/CR-10
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Malyan/M150
|
||||
use_example_configs Malyan/M150
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs Sanguinololu
|
||||
use_example_configs Sanguinololu
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs TinyBoy2
|
||||
use_example_configs TinyBoy2
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
|
||||
echo testing rambo targets...
|
||||
export TEST_PLATFORM="-e rambo"
|
||||
echo use_example_configs AlephObjects/TAZ4
|
||||
use_example_configs AlephObjects/TAZ4
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
|
||||
echo testing at90usb1286_* targets...
|
||||
export TEST_PLATFORM="-e at90usb1286_dfu"
|
||||
#echo se_example_configs delta/kossel_pro
|
||||
#use_example_configs delta/kossel_pro
|
||||
#build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
#restore_configs
|
||||
echo use_example_configs makibox
|
||||
use_example_configs makibox
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
|
||||
echo testing sanguino_atmega644p targets...
|
||||
export TEST_PLATFORM="-e sanguino_atmega644p"
|
||||
echo use_example_configs tvrrug/Round2
|
||||
use_example_configs tvrrug/Round2
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
|
||||
echo testing LPC1768 targets...
|
||||
export TEST_PLATFORM="-e LPC1768"
|
||||
echo use_example_configs Mks/Sbase
|
||||
use_example_configs Mks/Sbase
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo testing STM32F1 targets...
|
||||
export TEST_PLATFORM="-e STM32F103RE"
|
||||
restore_configs
|
||||
echo use_example_configs STM32/STM32F103RE
|
||||
use_example_configs STM32/STM32F103RE
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs STM32/stm32f103ret6
|
||||
use_example_configs STM32/stm32f103ret6
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
|
||||
echo testing DUE targets...
|
||||
export TEST_PLATFORM="-e DUE"
|
||||
#echo use_example_configs UltiMachine/Archim2
|
||||
#use_example_configs UltiMachine/Archim2
|
||||
#build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
#restore_configs
|
||||
|
||||
#
|
||||
# Remove temp files from dependencies tree prior to caching
|
||||
rm -rf ~/Marlin/.piolibdeps/_tmp_*
|
||||
|
||||
#
|
||||
# Restore the environment
|
||||
#
|
||||
env_restore
|
||||
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.platformio
|
||||
- ~/Marlin/.piolibdeps
|
||||
key: v1-dependencies-{{ checksum "~/Marlin/platformio.ini" }}
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# bump-date.yml
|
||||
# Bump the distribution date once per day
|
||||
#
|
||||
|
||||
name: Bump Distribution Date
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
bump_date:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: Check out bugfix-2.0.x
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: bugfix-2.0.x
|
||||
|
||||
- name: Bump Distribution Date
|
||||
run: source ./buildroot/bin/bump_date
|
||||
@@ -1,100 +0,0 @@
|
||||
#
|
||||
# test-builds.yml
|
||||
# Do test builds to catch compile errors
|
||||
#
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- bugfix-2.0.x
|
||||
- dev-2.1.x
|
||||
paths-ignore:
|
||||
- config/**
|
||||
- data/**
|
||||
- docs/**
|
||||
- '**/*.md'
|
||||
|
||||
jobs:
|
||||
test_builds:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
test-platform:
|
||||
# Base Environments
|
||||
|
||||
- DUE
|
||||
- esp32
|
||||
- linux_native
|
||||
- megaatmega2560
|
||||
- teensy31
|
||||
- teensy35
|
||||
|
||||
# Extended AVR Environments
|
||||
|
||||
- FYSETC_F6_13
|
||||
- megaatmega1280
|
||||
- rambo
|
||||
- sanguino_atmega1284p
|
||||
- sanguino_atmega644p
|
||||
|
||||
# Extended STM32 Environments
|
||||
|
||||
- STM32F103RC_bigtree
|
||||
- STM32F103RC_bigtree_USB
|
||||
- STM32F103RE_bigtree
|
||||
- STM32F103RE_bigtree_USB
|
||||
- STM32F103RC_fysetc
|
||||
- jgaurora_a5s_a1
|
||||
- STM32F103VE_longer
|
||||
- STM32F407VE_black
|
||||
- BIGTREE_SKR_PRO
|
||||
- mks_robin
|
||||
- ARMED
|
||||
|
||||
# Put lengthy tests last
|
||||
|
||||
- LPC1768
|
||||
- LPC1769
|
||||
|
||||
# STM32 with non-STM framework. both broken for now. they should use HAL_STM32 which is working.
|
||||
|
||||
#- STM32F4
|
||||
#- STM32F7
|
||||
|
||||
# Non-working environment tests
|
||||
|
||||
#- BIGTREE_BTT002
|
||||
#- at90usb1286_cdc
|
||||
#- at90usb1286_dfu
|
||||
#- STM32F103CB_malyan
|
||||
#- mks_robin_lite
|
||||
#- mks_robin_mini
|
||||
#- mks_robin_nano
|
||||
#- SAMD51_grandcentral_m4
|
||||
|
||||
steps:
|
||||
|
||||
- name: Select Python 3.7
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.7' # Version range or exact version of a Python version to use, using semvers version range syntax.
|
||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
pip install -U https://github.com/platformio/platformio-core/archive/master.zip
|
||||
platformio update
|
||||
|
||||
- name: Check out the PR
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run ${{ matrix.test-platform }} Tests
|
||||
run: |
|
||||
chmod +x buildroot/bin/*
|
||||
chmod +x buildroot/share/tests/*
|
||||
export PATH=./buildroot/bin/:./buildroot/share/tests/:${PATH}
|
||||
run_tests . ${{ matrix.test-platform }}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
dist: bionic
|
||||
sudo: false
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "3.7"
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
env:
|
||||
# Base Environments
|
||||
- TEST_PLATFORM="DUE"
|
||||
- TEST_PLATFORM="esp32"
|
||||
- TEST_PLATFORM="linux_native"
|
||||
- TEST_PLATFORM="megaatmega2560"
|
||||
- TEST_PLATFORM="STM32F103RE"
|
||||
- TEST_PLATFORM="teensy31"
|
||||
- TEST_PLATFORM="teensy35"
|
||||
|
||||
# Extended AVR Environments
|
||||
- TEST_PLATFORM="fysetc_f6_13"
|
||||
- TEST_PLATFORM="megaatmega1280"
|
||||
- TEST_PLATFORM="rambo"
|
||||
- TEST_PLATFORM="sanguino_atmega1284p"
|
||||
- TEST_PLATFORM="sanguino_atmega644p"
|
||||
|
||||
# Extended STM32 Environments
|
||||
- TEST_PLATFORM="ARMED"
|
||||
- TEST_PLATFORM="BIGTREE_BTT002"
|
||||
- TEST_PLATFORM="BIGTREE_SKR_PRO"
|
||||
- TEST_PLATFORM="STM32F103RC_bigtree"
|
||||
- TEST_PLATFORM="jgaurora_a5s_a1"
|
||||
- TEST_PLATFORM="STM32F103VE_longer"
|
||||
- TEST_PLATFORM="STM32F407VE_black"
|
||||
- TEST_PLATFORM="mks_robin"
|
||||
|
||||
# Put lengthy tests last
|
||||
- TEST_PLATFORM="LPC1768"
|
||||
- TEST_PLATFORM="LPC1769"
|
||||
|
||||
# Non-working environment tests
|
||||
#- TEST_PLATFORM="at90usb1286_cdc"
|
||||
#- TEST_PLATFORM="at90usb1286_dfu"
|
||||
#- TEST_PLATFORM="STM32F103CB_malyan"
|
||||
#- TEST_PLATFORM="mks_robin_lite"
|
||||
#- TEST_PLATFORM="mks_robin_mini"
|
||||
#- TEST_PLATFORM="mks_robin_nano"
|
||||
#- TEST_PLATFORM="SAMD51_grandcentral_m4"
|
||||
#- TEST_PLATFORM="STM32F103RC_bigtree"
|
||||
#- TEST_PLATFORM="STM32F103RC_bigtree_USB"
|
||||
#- TEST_PLATFORM="STM32F103RC_fysetc"
|
||||
#- TEST_PLATFORM="STM32F4"
|
||||
#- TEST_PLATFORM="STM32F7"
|
||||
|
||||
before_install:
|
||||
#
|
||||
# Fetch the tag information for the current branch
|
||||
- git fetch origin --tags
|
||||
#
|
||||
# Publish the buildroot script folder
|
||||
- chmod +x ${TRAVIS_BUILD_DIR}/buildroot/bin/*
|
||||
- chmod +x ${TRAVIS_BUILD_DIR}/buildroot/share/tests/*
|
||||
- export PATH=${TRAVIS_BUILD_DIR}/buildroot/bin/:${TRAVIS_BUILD_DIR}/buildroot/share/tests/:${PATH}
|
||||
|
||||
install:
|
||||
#- pip install -U platformio
|
||||
- pip install -U https://github.com/platformio/platformio-core/archive/master.zip
|
||||
|
||||
before_script:
|
||||
# Update PlatformIO packages
|
||||
- platformio update
|
||||
#
|
||||
# Change current working directory to the build dir
|
||||
- cd ${TRAVIS_BUILD_DIR}
|
||||
#
|
||||
# Generate custom version include
|
||||
- generate_version ${TRAVIS_BUILD_DIR}/Marlin/
|
||||
- cat ${TRAVIS_BUILD_DIR}/Marlin/Version.h
|
||||
#
|
||||
script:
|
||||
- run_tests ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
|
||||
+230
-96
@@ -1,3 +1,23 @@
|
||||
//#define PetsfangMicroswiss
|
||||
//#define BondtechBMG
|
||||
#define CR10SPro_GearedExtruder
|
||||
//#define E3DV6
|
||||
|
||||
//#define FilamentSensorStd
|
||||
//#define FilamentSensorLerdge
|
||||
|
||||
#define STOCK_2208 // V2 Stock Board with TMC2208 Drivers
|
||||
//#define SKR13 // 32 bit board - assumes 2208 drivers
|
||||
//#define SKR13_2209
|
||||
//#define E_8825
|
||||
//#define SKR13_UART // Configure SKR board with drivers in UART mode
|
||||
|
||||
#define SX2 // Small formfactor 200mm machine
|
||||
|
||||
#define DUAL_Z
|
||||
//#define GRAPHICSLCD
|
||||
//#define UBL
|
||||
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
@@ -21,6 +41,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if DISABLED(SKR13)
|
||||
#define Y_STOP_PIN 14
|
||||
#endif
|
||||
/**
|
||||
* Configuration.h
|
||||
*
|
||||
@@ -71,8 +94,8 @@
|
||||
// @section info
|
||||
|
||||
// Author info of this build printed to the host during boot and M115
|
||||
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
|
||||
//#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes)
|
||||
#define STRING_CONFIG_H_AUTHOR "Tinymachines3D" // Who made the changes.
|
||||
#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes)
|
||||
|
||||
/**
|
||||
* *** VENDORS PLEASE READ ***
|
||||
@@ -88,12 +111,13 @@
|
||||
// Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION **
|
||||
#define SHOW_BOOTSCREEN
|
||||
|
||||
#if ENABLED(GRAPHICSLCD)
|
||||
// Show the bitmap in Marlin/_Bootscreen.h on startup.
|
||||
//#define SHOW_CUSTOM_BOOTSCREEN
|
||||
#define SHOW_CUSTOM_BOOTSCREEN
|
||||
|
||||
// Show the bitmap in Marlin/_Statusscreen.h on the status screen.
|
||||
//#define CUSTOM_STATUS_SCREEN_IMAGE
|
||||
|
||||
#define CUSTOM_STATUS_SCREEN_IMAGE
|
||||
#endif
|
||||
// @section machine
|
||||
|
||||
/**
|
||||
@@ -112,8 +136,9 @@
|
||||
*
|
||||
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
|
||||
*/
|
||||
//#define SERIAL_PORT_2 -1
|
||||
|
||||
#if ENABLED(SKR13)
|
||||
#define SERIAL_PORT_2 -1
|
||||
#endif
|
||||
/**
|
||||
* This setting determines the communication speed of the printer.
|
||||
*
|
||||
@@ -130,11 +155,20 @@
|
||||
|
||||
// Choose the name from boards.h that matches your setup
|
||||
#ifndef MOTHERBOARD
|
||||
#define MOTHERBOARD BOARD_MKS_GEN_13
|
||||
#if ENABLED(SKR13)
|
||||
#define MOTHERBOARD BOARD_BIGTREE_SKR_V1_3
|
||||
#else
|
||||
#define MOTHERBOARD BOARD_RAMPS_14_EFB
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Name displayed in the LCD "Ready" message and Info menu
|
||||
//#define CUSTOM_MACHINE_NAME "Trex+"
|
||||
#if ENABLED(SX2)
|
||||
#define CUSTOM_MACHINE_NAME "TM3D SX2"
|
||||
#else
|
||||
#define CUSTOM_MACHINE_NAME "TM3D SX4"
|
||||
#endif
|
||||
|
||||
|
||||
// Printer's unique ID, used by some programs to differentiate between machines.
|
||||
// Choose your own or use a service like http://www.uuidgenerator.net/version4
|
||||
@@ -144,7 +178,7 @@
|
||||
|
||||
// This defines the number of extruders
|
||||
// :[1, 2, 3, 4, 5, 6]
|
||||
#define EXTRUDERS 2
|
||||
#define EXTRUDERS 1
|
||||
|
||||
// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc.
|
||||
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75
|
||||
@@ -309,7 +343,7 @@
|
||||
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
|
||||
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
|
||||
// For the other hotends it is their distance from the extruder 0 hotend.
|
||||
//#define HOTEND_OFFSET_X { 0.0, -34.00 } // (mm) relative X-offset for each nozzle
|
||||
//#define HOTEND_OFFSET_X { 0.0, 20.00 } // (mm) relative X-offset for each nozzle
|
||||
//#define HOTEND_OFFSET_Y { 0.0, 5.00 } // (mm) relative Y-offset for each nozzle
|
||||
//#define HOTEND_OFFSET_Z { 0.0, 0.00 } // (mm) relative Z-offset for each nozzle
|
||||
|
||||
@@ -325,14 +359,13 @@
|
||||
//#define PSU_NAME "Power Supply"
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
#define PSU_ACTIVE_HIGH false // Set 'false' for ATX, 'true' for X-Box
|
||||
#define PSU_ACTIVE_HIGH false // Set 'false' for ATX (1), 'true' for X-Box (2)
|
||||
|
||||
//#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80
|
||||
//#define PSU_POWERUP_DELAY 100 // (ms) Delay for the PSU to warm up to full power
|
||||
//#define PS_DEFAULT_OFF // Keep power off until enabled directly with M80
|
||||
|
||||
//#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin
|
||||
//#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#define AUTO_POWER_FANS // Turn on PSU if fans need power
|
||||
#define AUTO_POWER_FANS // Turn on PSU if fans need power
|
||||
#define AUTO_POWER_E_FANS
|
||||
#define AUTO_POWER_CONTROLLERFAN
|
||||
#define AUTO_POWER_CHAMBER_FAN
|
||||
@@ -353,10 +386,9 @@
|
||||
*
|
||||
* Temperature sensors available:
|
||||
*
|
||||
* -5 : PT100 / PT1000 with MAX31865 (only for sensors 0-1)
|
||||
* -3 : thermocouple with MAX31855 (only for sensors 0-1)
|
||||
* -2 : thermocouple with MAX6675 (only for sensors 0-1)
|
||||
* -4 : thermocouple with AD8495
|
||||
* -3 : thermocouple with MAX31855 (only for sensor 0)
|
||||
* -2 : thermocouple with MAX6675 (only for sensor 0)
|
||||
* -1 : thermocouple with AD595
|
||||
* 0 : not used
|
||||
* 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
|
||||
@@ -405,13 +437,17 @@
|
||||
* 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
|
||||
* 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
|
||||
*/
|
||||
#define TEMP_SENSOR_0 1
|
||||
#define TEMP_SENSOR_1 1
|
||||
#if ENABLED(E3DV6)
|
||||
#define TEMP_SENSOR_0 5
|
||||
#else
|
||||
#define TEMP_SENSOR_0 1
|
||||
#endif
|
||||
#define TEMP_SENSOR_1 0
|
||||
#define TEMP_SENSOR_2 0
|
||||
#define TEMP_SENSOR_3 0
|
||||
#define TEMP_SENSOR_4 0
|
||||
#define TEMP_SENSOR_5 0
|
||||
#define TEMP_SENSOR_BED 1
|
||||
#define TEMP_SENSOR_BED 11
|
||||
#define TEMP_SENSOR_CHAMBER 0
|
||||
|
||||
// Dummy thermistor constant temperature readings, for use with 998 and 999
|
||||
@@ -423,7 +459,7 @@
|
||||
//#define TEMP_SENSOR_1_AS_REDUNDANT
|
||||
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
|
||||
|
||||
#define TEMP_RESIDENCY_TIME 5 // (seconds) Time to wait for hotend to "settle" in M109
|
||||
#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109
|
||||
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
|
||||
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
|
||||
|
||||
@@ -444,13 +480,13 @@
|
||||
// Above this temperature the heater will be switched off.
|
||||
// This can protect components from overheating, but NOT from shorts and failures.
|
||||
// (Use MINTEMP for thermistor short/failure protection.)
|
||||
#define HEATER_0_MAXTEMP 315
|
||||
#define HEATER_1_MAXTEMP 315
|
||||
#define HEATER_0_MAXTEMP 305
|
||||
#define HEATER_1_MAXTEMP 275
|
||||
#define HEATER_2_MAXTEMP 275
|
||||
#define HEATER_3_MAXTEMP 275
|
||||
#define HEATER_4_MAXTEMP 275
|
||||
#define HEATER_5_MAXTEMP 275
|
||||
#define BED_MAXTEMP 135
|
||||
#define BED_MAXTEMP 125
|
||||
|
||||
//===========================================================================
|
||||
//============================= PID Settings ================================
|
||||
@@ -476,10 +512,15 @@
|
||||
// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
|
||||
|
||||
// Ultimaker
|
||||
#define DEFAULT_Kp 22.2
|
||||
#define DEFAULT_Ki 1.08
|
||||
#define DEFAULT_Kd 114
|
||||
|
||||
#if ENABLED(PetsfangMicroswiss)
|
||||
#define DEFAULT_Kp 18.74
|
||||
#define DEFAULT_Ki 0.71
|
||||
#define DEFAULT_Kd 123.56
|
||||
#else
|
||||
#define DEFAULT_Kp 10.59
|
||||
#define DEFAULT_Ki 0.37
|
||||
#define DEFAULT_Kd 75.24
|
||||
#endif
|
||||
// MakerGear
|
||||
//#define DEFAULT_Kp 7.0
|
||||
//#define DEFAULT_Ki 0.1
|
||||
@@ -509,7 +550,7 @@
|
||||
* heater. If your configuration is significantly different than this and you don't understand
|
||||
* the issues involved, don't use bed PID until someone else verifies that your hardware works.
|
||||
*/
|
||||
#define PIDTEMPBED
|
||||
//#define PIDTEMPBED
|
||||
|
||||
//#define BED_LIMIT_SWITCHING
|
||||
|
||||
@@ -588,7 +629,7 @@
|
||||
|
||||
// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
|
||||
// either in the usual order or reversed
|
||||
//#define COREXY
|
||||
#define COREXY
|
||||
//#define COREXZ
|
||||
//#define COREYZ
|
||||
//#define COREYX
|
||||
@@ -605,7 +646,7 @@
|
||||
// Almost all printers will be using one per axis. Probes will use one or more of the
|
||||
// extra connectors. Leave undefined any used for non-endstop and non-probe purposes.
|
||||
#define USE_XMIN_PLUG
|
||||
#define USE_YMIN_PLUG
|
||||
//#define USE_YMIN_PLUG
|
||||
#define USE_ZMIN_PLUG
|
||||
//#define USE_XMAX_PLUG
|
||||
#define USE_YMAX_PLUG
|
||||
@@ -643,7 +684,7 @@
|
||||
#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
|
||||
#define X_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
|
||||
#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
|
||||
#define Z_MAX_ENDSTOP_INVERTING true= // set to true to invert the logic of the endstop.
|
||||
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
|
||||
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe.
|
||||
|
||||
/**
|
||||
@@ -661,15 +702,63 @@
|
||||
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
|
||||
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
||||
*/
|
||||
//#define X_DRIVER_TYPE A4988
|
||||
//#define Y_DRIVER_TYPE A4988
|
||||
//#define Z_DRIVER_TYPE A4988
|
||||
|
||||
#if ENABLED(SKR13, E_8825)
|
||||
#define E0_DRIVER_TYPE DRV8825
|
||||
#define E1_DRIVER_TYPE DRV8825
|
||||
#endif
|
||||
|
||||
#if ANY(SKR13, STOCK_2208) && DISABLED(SKR13_UART)
|
||||
#if ENABLED(SKR13_2209)
|
||||
#define X_DRIVER_TYPE TMC2209_STANDALONE
|
||||
#define Y_DRIVER_TYPE TMC2209_STANDALONE
|
||||
#define Z_DRIVER_TYPE TMC2209_STANDALONE
|
||||
#define Z2_DRIVER_TYPE TMC2209_STANDALONE
|
||||
#if DISABLED(E_8825)
|
||||
#define E0_DRIVER_TYPE TMC2209_STANDALONE
|
||||
#define E1_DRIVER_TYPE TMC2209_STANDALONE
|
||||
#endif
|
||||
#else
|
||||
#define X_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#define Y_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#define Z_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#define Z2_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#if DISABLED(E_8825)
|
||||
#define E0_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#define E1_DRIVER_TYPE TMC2208_STANDALONE
|
||||
#endif
|
||||
#endif
|
||||
#elif ENABLED(SKR13, SKR13_UART)
|
||||
#if ENABLED(SKR13_2209)
|
||||
#define X_DRIVER_TYPE TMC2209
|
||||
#define Y_DRIVER_TYPE TMC2209
|
||||
#define Z_DRIVER_TYPE TMC2209
|
||||
#define Z2_DRIVER_TYPE TMC2209
|
||||
#if DISABLED(E_8825)
|
||||
#define E0_DRIVER_TYPE TMC2209
|
||||
#define E1_DRIVER_TYPE TMC2209
|
||||
#endif
|
||||
#else
|
||||
#define X_DRIVER_TYPE TMC2208
|
||||
#define Y_DRIVER_TYPE TMC2208
|
||||
#define Z_DRIVER_TYPE TMC2208
|
||||
#define Z2_DRIVER_TYPE TMC2208
|
||||
#if DISABLED(E_8825)
|
||||
#define E0_DRIVER_TYPE TMC2208
|
||||
#define E1_DRIVER_TYPE TMC2208
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define X_DRIVER_TYPE A4988
|
||||
#define Y_DRIVER_TYPE A4988
|
||||
#define Z_DRIVER_TYPE A4988
|
||||
#define Z2_DRIVER_TYPE A4988
|
||||
#define E0_DRIVER_TYPE A4988
|
||||
#define E1_DRIVER_TYPE A4988
|
||||
#endif
|
||||
//#define X2_DRIVER_TYPE A4988
|
||||
//#define Y2_DRIVER_TYPE A4988
|
||||
//#define Z2_DRIVER_TYPE A4988
|
||||
//#define Z3_DRIVER_TYPE A4988
|
||||
//#define E0_DRIVER_TYPE A4988
|
||||
//#define E1_DRIVER_TYPE A4988
|
||||
//#define E2_DRIVER_TYPE A4988
|
||||
//#define E3_DRIVER_TYPE A4988
|
||||
//#define E4_DRIVER_TYPE A4988
|
||||
@@ -691,7 +780,7 @@
|
||||
*
|
||||
* :[2,3,4,5,6,7]
|
||||
*/
|
||||
//#define ENDSTOP_NOISE_THRESHOLD 2
|
||||
#define ENDSTOP_NOISE_THRESHOLD 2
|
||||
|
||||
//=============================================================================
|
||||
//============================== Movement Settings ============================
|
||||
@@ -716,33 +805,41 @@
|
||||
/**
|
||||
* Default Axis Steps Per Unit (steps/mm)
|
||||
* Override with M92
|
||||
* X, Y, Z, E0 [, E1[, E2...]]
|
||||
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
|
||||
*/
|
||||
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 4000, 125.4 }
|
||||
#if ENABLED(BondtechBMG)
|
||||
#define EStepsmm 415
|
||||
#elif ENABLED(CR10SPro_GearedExtruder)
|
||||
#define EStepsmm 140
|
||||
#else
|
||||
#define EStepsmm 100.3
|
||||
#endif
|
||||
|
||||
|
||||
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, EStepsmm }
|
||||
/**
|
||||
* Default Max Feed Rate (mm/s)
|
||||
* Override with M203
|
||||
* X, Y, Z, E0 [, E1[, E2...]]
|
||||
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
|
||||
*/
|
||||
#define DEFAULT_MAX_FEEDRATE { 150, 150, 5, 75 }
|
||||
#define DEFAULT_MAX_FEEDRATE { 500, 500, 5, 70 }
|
||||
|
||||
//#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2
|
||||
#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2
|
||||
#if ENABLED(LIMITED_MAX_FR_EDITING)
|
||||
#define MAX_FEEDRATE_EDIT_VALUES { 600, 600, 10, 50 } // ...or, set your own edit limits
|
||||
#define MAX_FEEDRATE_EDIT_VALUES { 1000, 1000, 10, 150 } // ...or, set your own edit limits
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Default Max Acceleration (change/s) change = mm/s
|
||||
* (Maximum start speed for accelerated moves)
|
||||
* Override with M201
|
||||
* X, Y, Z, E0 [, E1[, E2...]]
|
||||
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
|
||||
*/
|
||||
#define DEFAULT_MAX_ACCELERATION { 800, 500, 400, 4000 }
|
||||
#define DEFAULT_MAX_ACCELERATION { 1500, 1500, 50, 2000 }
|
||||
|
||||
//#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2
|
||||
#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2
|
||||
#if ENABLED(LIMITED_MAX_ACCEL_EDITING)
|
||||
#define MAX_ACCEL_EDIT_VALUES { 6000, 6000, 200, 20000 } // ...or, set your own edit limits
|
||||
#define MAX_ACCEL_EDIT_VALUES { 2500, 2500, 125, 5000 } // ...or, set your own edit limits
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -753,9 +850,9 @@
|
||||
* M204 R Retract Acceleration
|
||||
* M204 T Travel Acceleration
|
||||
*/
|
||||
#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves
|
||||
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
|
||||
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves
|
||||
#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration for printing moves
|
||||
#define DEFAULT_RETRACT_ACCELERATION 1500 // E acceleration for retracts
|
||||
#define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration for travel (non printing) moves
|
||||
|
||||
/**
|
||||
* Default Jerk limits (mm/s)
|
||||
@@ -787,7 +884,7 @@
|
||||
* http://blog.kyneticcnc.com/2018/10/computing-junction-deviation-for-marlin.html
|
||||
*/
|
||||
#if DISABLED(CLASSIC_JERK)
|
||||
#define JUNCTION_DEVIATION_MM 0.04 // (mm) Distance from real junction edge
|
||||
#define JUNCTION_DEVIATION_MM 0.06 // (mm) Distance from real junction edge
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -855,12 +952,6 @@
|
||||
*/
|
||||
//#define FIX_MOUNTED_PROBE
|
||||
|
||||
/**
|
||||
* Use the nozzle as the probe, as with a conductive
|
||||
* nozzle system or a piezo-electric smart effector.
|
||||
*/
|
||||
//#define NOZZLE_AS_PROBE
|
||||
|
||||
/**
|
||||
* Z Servo Probe, such as an endstop switch on a rotating arm.
|
||||
*/
|
||||
@@ -927,13 +1018,19 @@
|
||||
*
|
||||
* Specify a Probe position as { X, Y, Z }
|
||||
*/
|
||||
#define NOZZLE_TO_PROBE_OFFSET { -28, 8, -1.50 }
|
||||
#if ENABLED(PetsfangMicroswiss)
|
||||
#define NOZZLE_TO_PROBE_OFFSET { -48, -10, 0 }
|
||||
#elif ENABLED(E3DV6)
|
||||
#define NOZZLE_TO_PROBE_OFFSET { 36, 15, 0 }
|
||||
#else
|
||||
#define NOZZLE_TO_PROBE_OFFSET { 37, -10, 0 }
|
||||
#endif
|
||||
|
||||
// Certain types of probes need to stay away from edges
|
||||
#define MIN_PROBE_EDGE 10
|
||||
#define MIN_PROBE_EDGE 5
|
||||
|
||||
// X and Y axis travel speed (mm/m) between probes
|
||||
#define XY_PROBE_SPEED 8000
|
||||
#define XY_PROBE_SPEED 5000
|
||||
|
||||
// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2)
|
||||
#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z
|
||||
@@ -967,12 +1064,12 @@
|
||||
* Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle.
|
||||
* But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle.
|
||||
*/
|
||||
#define Z_CLEARANCE_DEPLOY_PROBE 5 // Z Clearance for Deploy/Stow
|
||||
#define Z_CLEARANCE_DEPLOY_PROBE 10 // Z Clearance for Deploy/Stow
|
||||
#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points
|
||||
#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes
|
||||
//#define Z_AFTER_PROBING 5 // Z position after probing is done
|
||||
|
||||
#define Z_PROBE_LOW_POINT -5 // Farthest distance below the trigger-point to go before stopping
|
||||
#define Z_PROBE_LOW_POINT -3 // Farthest distance below the trigger-point to go before stopping
|
||||
|
||||
// For M851 give a range for adjusting the Z probe offset
|
||||
#define Z_PROBE_OFFSET_RANGE_MIN -20
|
||||
@@ -1026,14 +1123,24 @@
|
||||
// @section machine
|
||||
|
||||
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
|
||||
#define INVERT_X_DIR false
|
||||
#define INVERT_Y_DIR false
|
||||
#define INVERT_Z_DIR true
|
||||
#if ANY(SKR13, STOCK_2208)
|
||||
#define INVERT_X_DIR true
|
||||
#define INVERT_Y_DIR true
|
||||
#define INVERT_Z_DIR true
|
||||
#else
|
||||
#define INVERT_X_DIR false
|
||||
#define INVERT_Y_DIR false
|
||||
#define INVERT_Z_DIR false
|
||||
#endif
|
||||
|
||||
// @section extruder
|
||||
|
||||
// For direct drive extruder v9 set to true, for geared extruder set to false.
|
||||
#define INVERT_E0_DIR true
|
||||
#if (ENABLED(BondtechBMG, CR10SPro_GearedExtruder) && DISABLED(SKR13)) || (DISABLED(BondtechBM, CR10SPro_GearedExtruderG) && ANY(SKR13, STOCK_2208))
|
||||
#define INVERT_E0_DIR true
|
||||
#else
|
||||
#define INVERT_E0_DIR false
|
||||
#endif
|
||||
#define INVERT_E1_DIR false
|
||||
#define INVERT_E2_DIR false
|
||||
#define INVERT_E3_DIR false
|
||||
@@ -1052,14 +1159,19 @@
|
||||
// Direction of endstops when homing; 1=MAX, -1=MIN
|
||||
// :[-1,1]
|
||||
#define X_HOME_DIR -1
|
||||
#define Y_HOME_DIR 1
|
||||
#define Y_HOME_DIR 1
|
||||
#define Z_HOME_DIR -1
|
||||
|
||||
// @section machine
|
||||
|
||||
// The size of the print bed
|
||||
#define X_BED_SIZE 400
|
||||
#define Y_BED_SIZE 400
|
||||
#if ENABLED(SX2)
|
||||
#define X_BED_SIZE 248
|
||||
#define Y_BED_SIZE 238
|
||||
#else
|
||||
#define X_BED_SIZE 398
|
||||
#define Y_BED_SIZE 390
|
||||
#endif
|
||||
|
||||
// Travel limits (mm) after homing, corresponding to endstop positions.
|
||||
#define X_MIN_POS 0
|
||||
@@ -1067,8 +1179,11 @@
|
||||
#define Z_MIN_POS 0
|
||||
#define X_MAX_POS X_BED_SIZE
|
||||
#define Y_MAX_POS Y_BED_SIZE
|
||||
#define Z_MAX_POS 450
|
||||
|
||||
#if ENABLED(SX2)
|
||||
#define Z_MAX_POS 500
|
||||
#else
|
||||
#define Z_MAX_POS 250
|
||||
#endif
|
||||
/**
|
||||
* Software Endstops
|
||||
*
|
||||
@@ -1106,13 +1221,21 @@
|
||||
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
|
||||
* By default the firmware assumes HIGH=FILAMENT PRESENT.
|
||||
*/
|
||||
//#define FILAMENT_RUNOUT_SENSOR
|
||||
#if ENABLED(FilamentSensorStd) || ENABLED(FilamentSensorLerdge)
|
||||
#define FILAMENT_RUNOUT_SENSOR
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
|
||||
#define FIL_RUNOUT_INVERTING false // Set to true to invert the logic of the sensor.
|
||||
|
||||
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
|
||||
#if ENABLED(FilamentSensorLerdge)
|
||||
#define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor.
|
||||
#else
|
||||
#define FIL_RUNOUT_INVERTING true // set to true to invert the logic of the sensor.
|
||||
#endif
|
||||
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
|
||||
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
|
||||
|
||||
#define FIL_RUNOUT_PIN 2
|
||||
// Set one or more commands to execute on filament runout.
|
||||
// (After 'M412 H' Marlin will ask the host to handle the process.)
|
||||
#define FILAMENT_RUNOUT_SCRIPT "M600"
|
||||
@@ -1120,7 +1243,7 @@
|
||||
// After a runout is detected, continue printing this length of filament
|
||||
// before executing the runout script. Useful for a sensor at the end of
|
||||
// a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
|
||||
//#define FILAMENT_RUNOUT_DISTANCE_MM 25
|
||||
#define FILAMENT_RUNOUT_DISTANCE_MM 5
|
||||
|
||||
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
|
||||
// Enable this option to use an encoder disc that toggles the runout pin
|
||||
@@ -1170,8 +1293,11 @@
|
||||
*/
|
||||
//#define AUTO_BED_LEVELING_3POINT
|
||||
//#define AUTO_BED_LEVELING_LINEAR
|
||||
//#define AUTO_BED_LEVELING_BILINEAR
|
||||
#define AUTO_BED_LEVELING_UBL
|
||||
#if DISABLED(UBL)
|
||||
#define AUTO_BED_LEVELING_BILINEAR
|
||||
#else
|
||||
#define AUTO_BED_LEVELING_UBL
|
||||
#endif
|
||||
//#define MESH_BED_LEVELING
|
||||
|
||||
/**
|
||||
@@ -1216,7 +1342,11 @@
|
||||
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
|
||||
|
||||
// Set the number of grid points per dimension.
|
||||
#define GRID_MAX_POINTS_X 3
|
||||
#if ENABLED(SX2)
|
||||
#define GRID_MAX_POINTS_X 5
|
||||
#else
|
||||
#define GRID_MAX_POINTS_X 10
|
||||
#endif
|
||||
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
|
||||
|
||||
// Probe along the Y axis, advancing X after each column
|
||||
@@ -1248,7 +1378,7 @@
|
||||
|
||||
//#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh
|
||||
|
||||
#define MESH_INSET 5 // Set Mesh bounds as an inset region of the bed
|
||||
#define MESH_INSET 1 // Set Mesh bounds as an inset region of the bed
|
||||
#define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited.
|
||||
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
|
||||
|
||||
@@ -1285,7 +1415,7 @@
|
||||
#endif
|
||||
|
||||
// Add a menu item to move between bed corners for manual bed adjustment
|
||||
#define LEVEL_BED_CORNERS
|
||||
//#define LEVEL_BED_CORNERS
|
||||
|
||||
#if ENABLED(LEVEL_BED_CORNERS)
|
||||
#define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling
|
||||
@@ -1329,8 +1459,8 @@
|
||||
#endif
|
||||
|
||||
// Homing speeds (mm/m)
|
||||
#define HOMING_FEEDRATE_XY (50*60)
|
||||
#define HOMING_FEEDRATE_Z (4*60)
|
||||
#define HOMING_FEEDRATE_XY 6000
|
||||
#define HOMING_FEEDRATE_Z 360
|
||||
|
||||
// Validate that endstops are triggered on homing moves
|
||||
#define VALIDATE_HOMING_ENDSTOPS
|
||||
@@ -1467,7 +1597,7 @@
|
||||
|
||||
#if ENABLED(NOZZLE_PARK_FEATURE)
|
||||
// Specify a park position as { X, Y, Z_raise }
|
||||
#define NOZZLE_PARK_POINT { (X_MIN_POS + 30), (Y_MIN_POS + 10), 5 }
|
||||
#define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MIN_POS + 30), 10 }
|
||||
#define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis)
|
||||
#define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers)
|
||||
#endif
|
||||
@@ -1566,7 +1696,7 @@
|
||||
*
|
||||
* View the current statistics with M78.
|
||||
*/
|
||||
//#define PRINTCOUNTER
|
||||
#define PRINTCOUNTER
|
||||
|
||||
//=============================================================================
|
||||
//============================= LCD and SD support ============================
|
||||
@@ -1633,7 +1763,7 @@
|
||||
* This may be required to resolve "volume init" errors.
|
||||
*/
|
||||
//#define SPI_SPEED SPI_HALF_SPEED
|
||||
//#define SPI_SPEED SPI_QUARTER_SPEED
|
||||
#define SPI_SPEED SPI_QUARTER_SPEED
|
||||
//#define SPI_SPEED SPI_EIGHTH_SPEED
|
||||
|
||||
/**
|
||||
@@ -1735,7 +1865,9 @@
|
||||
//
|
||||
// Note: Usually sold with a white PCB.
|
||||
//
|
||||
#define REPRAP_DISCOUNT_SMART_CONTROLLER
|
||||
#if DISABLED(GRAPHICSLCD)
|
||||
#define REPRAP_DISCOUNT_SMART_CONTROLLER
|
||||
#endif
|
||||
|
||||
//
|
||||
// Original RADDS LCD Display+Encoder+SDCardReader
|
||||
@@ -1775,7 +1907,7 @@
|
||||
|
||||
//
|
||||
// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller
|
||||
// https://www.aliexpress.com/item/32765887917.html
|
||||
// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html
|
||||
//
|
||||
//#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602
|
||||
|
||||
@@ -1875,7 +2007,9 @@
|
||||
// RepRapDiscount FULL GRAPHIC Smart Controller
|
||||
// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller
|
||||
//
|
||||
//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
|
||||
#if ENABLED(GRAPHICSLCD)
|
||||
#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
|
||||
#endif
|
||||
|
||||
//
|
||||
// ReprapWorld Graphical LCD
|
||||
@@ -1949,7 +2083,7 @@
|
||||
|
||||
//
|
||||
// Factory display for Creality CR-10
|
||||
// https://www.aliexpress.com/item/32833148327.html
|
||||
// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html
|
||||
//
|
||||
// This is RAMPS-compatible using a single 10-pin connector.
|
||||
// (For CR-10 owners who want to replace the Melzi Creality board but retain the display)
|
||||
@@ -1967,7 +2101,7 @@
|
||||
|
||||
//
|
||||
// AZSMZ 12864 LCD with SD
|
||||
// https://www.aliexpress.com/item/32837222770.html
|
||||
// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html
|
||||
//
|
||||
//#define AZSMZ_12864
|
||||
|
||||
@@ -2034,10 +2168,10 @@
|
||||
//#define MALYAN_LCD
|
||||
|
||||
//
|
||||
// Touch UI for FTDI EVE (FT800/FT810) displays
|
||||
// LulzBot Color Touch UI for FTDI EVE (FT800/FT810) displays
|
||||
// See Configuration_adv.h for all configuration options.
|
||||
//
|
||||
//#define TOUCH_UI_FTDI_EVE
|
||||
//#define LULZBOT_TOUCH_UI
|
||||
|
||||
//
|
||||
// Third-party or vendor-customized controller interfaces.
|
||||
|
||||
+164
-217
@@ -137,8 +137,8 @@
|
||||
* THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
|
||||
*/
|
||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
|
||||
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
|
||||
#define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius
|
||||
#define THERMAL_PROTECTION_PERIOD 120 // Seconds
|
||||
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
|
||||
|
||||
#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
|
||||
#if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP)
|
||||
@@ -157,22 +157,22 @@
|
||||
* and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set
|
||||
* below 2.
|
||||
*/
|
||||
#define WATCH_TEMP_PERIOD 20 // Seconds
|
||||
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius
|
||||
#define WATCH_TEMP_PERIOD 120 // Seconds
|
||||
#define WATCH_TEMP_INCREASE 4 // Degrees Celsius
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thermal Protection parameters for the bed are just as above for hotends.
|
||||
*/
|
||||
#if ENABLED(THERMAL_PROTECTION_BED)
|
||||
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
|
||||
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
|
||||
#define THERMAL_PROTECTION_BED_PERIOD 240 // Seconds
|
||||
#define THERMAL_PROTECTION_BED_HYSTERESIS 4 // Degrees Celsius
|
||||
|
||||
/**
|
||||
* As described above, except for the bed (M140/M190/M303).
|
||||
*/
|
||||
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
|
||||
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
|
||||
#define WATCH_BED_TEMP_PERIOD 240 // Seconds
|
||||
#define WATCH_BED_TEMP_INCREASE 4 // Degrees Celsius
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -197,56 +197,6 @@
|
||||
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
|
||||
#define LPQ_MAX_LEN 50
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Add an experimental additional term to the heater power, proportional to the fan speed.
|
||||
* A well-chosen Kf value should add just enough power to compensate for power-loss from the cooling fan.
|
||||
* You can either just add a constant compensation with the DEFAULT_Kf value
|
||||
* or follow the instruction below to get speed-dependent compensation.
|
||||
*
|
||||
* Constant compensation (use only with fanspeeds of 0% and 100%)
|
||||
* ---------------------------------------------------------------------
|
||||
* A good starting point for the Kf-value comes from the calculation:
|
||||
* kf = (power_fan * eff_fan) / power_heater * 255
|
||||
* where eff_fan is between 0.0 and 1.0, based on fan-efficiency and airflow to the nozzle / heater.
|
||||
*
|
||||
* Example:
|
||||
* Heater: 40W, Fan: 0.1A * 24V = 2.4W, eff_fan = 0.8
|
||||
* Kf = (2.4W * 0.8) / 40W * 255 = 12.24
|
||||
*
|
||||
* Fan-speed dependent compensation
|
||||
* --------------------------------
|
||||
* 1. To find a good Kf value, set the hotend temperature, wait for it to settle, and enable the fan (100%).
|
||||
* Make sure PID_FAN_SCALING_LIN_FACTOR is 0 and PID_FAN_SCALING_ALTERNATIVE_DEFINITION is not enabled.
|
||||
* If you see the temperature drop repeat the test, increasing the Kf value slowly, until the temperature
|
||||
* drop goes away. If the temperature overshoots after enabling the fan, the Kf value is too big.
|
||||
* 2. Note the Kf-value for fan-speed at 100%
|
||||
* 3. Determine a good value for PID_FAN_SCALING_MIN_SPEED, which is around the speed, where the fan starts moving.
|
||||
* 4. Repeat step 1. and 2. for this fan speed.
|
||||
* 5. Enable PID_FAN_SCALING_ALTERNATIVE_DEFINITION and enter the two identified Kf-values in
|
||||
* PID_FAN_SCALING_AT_FULL_SPEED and PID_FAN_SCALING_AT_MIN_SPEED. Enter the minimum speed in PID_FAN_SCALING_MIN_SPEED
|
||||
*/
|
||||
//#define PID_FAN_SCALING
|
||||
#if ENABLED(PID_FAN_SCALING)
|
||||
//#define PID_FAN_SCALING_ALTERNATIVE_DEFINITION
|
||||
#if ENABLED(PID_FAN_SCALING_ALTERNATIVE_DEFINITION)
|
||||
// The alternative definition is used for an easier configuration.
|
||||
// Just figure out Kf at fullspeed (255) and PID_FAN_SCALING_MIN_SPEED.
|
||||
// DEFAULT_Kf and PID_FAN_SCALING_LIN_FACTOR are calculated accordingly.
|
||||
|
||||
#define PID_FAN_SCALING_AT_FULL_SPEED 13.0 //=PID_FAN_SCALING_LIN_FACTOR*255+DEFAULT_Kf
|
||||
#define PID_FAN_SCALING_AT_MIN_SPEED 6.0 //=PID_FAN_SCALING_LIN_FACTOR*PID_FAN_SCALING_MIN_SPEED+DEFAULT_Kf
|
||||
#define PID_FAN_SCALING_MIN_SPEED 10.0 // Minimum fan speed at which to enable PID_FAN_SCALING
|
||||
|
||||
#define DEFAULT_Kf (255.0*PID_FAN_SCALING_AT_MIN_SPEED-PID_FAN_SCALING_AT_FULL_SPEED*PID_FAN_SCALING_MIN_SPEED)/(255.0-PID_FAN_SCALING_MIN_SPEED)
|
||||
#define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0
|
||||
|
||||
#else
|
||||
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed)
|
||||
#define DEFAULT_Kf 10 // A constant value added to the PID-tuner
|
||||
#define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -340,9 +290,6 @@
|
||||
// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
|
||||
//#define FAN_KICKSTART_TIME 100
|
||||
|
||||
// Some coolers may require a non-zero "off" state.
|
||||
//#define FAN_OFF_PWM 1
|
||||
|
||||
/**
|
||||
* PWM Fan Scaling
|
||||
*
|
||||
@@ -493,7 +440,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define Z_DUAL_STEPPER_DRIVERS
|
||||
#if ENABLED(DUAL_Z)
|
||||
#define Z_DUAL_STEPPER_DRIVERS
|
||||
#endif
|
||||
#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
|
||||
//#define Z_DUAL_ENDSTOPS
|
||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||
@@ -571,16 +520,16 @@
|
||||
// Homing hits each endstop, retracts by these distances, then does a slower bump.
|
||||
#define X_HOME_BUMP_MM 5
|
||||
#define Y_HOME_BUMP_MM 5
|
||||
#define Z_HOME_BUMP_MM 2
|
||||
#define Z_HOME_BUMP_MM 5
|
||||
#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate)
|
||||
#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially
|
||||
//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially
|
||||
//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing
|
||||
|
||||
// When G28 is called, this option will make Y home before X
|
||||
//#define HOME_Y_BEFORE_X
|
||||
|
||||
// Enable this if X or Y can't home without homing the other axis first.
|
||||
//#define CODEPENDENT_XY_HOMING
|
||||
#define CODEPENDENT_XY_HOMING
|
||||
|
||||
#if ENABLED(BLTOUCH)
|
||||
/**
|
||||
@@ -653,10 +602,16 @@
|
||||
* Z Steppers Auto-Alignment
|
||||
* Add the G34 command to align multiple Z steppers using a bed probe.
|
||||
*/
|
||||
//#define Z_STEPPER_AUTO_ALIGN
|
||||
#if ENABLED(DUAL_Z)
|
||||
#define Z_STEPPER_AUTO_ALIGN
|
||||
#endif
|
||||
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
// Define probe X and Y positions for Z1, Z2 [, Z3]
|
||||
#define Z_STEPPER_ALIGN_XY { { 10, 190 }, { 100, 10 }, { 190, 190 } }
|
||||
#if ENABLED(SX2)
|
||||
#define Z_STEPPER_ALIGN_XY { { 42, 100 }, { 225, 100 } }
|
||||
#else
|
||||
#define Z_STEPPER_ALIGN_XY { { 50, 200 }, { 350, 200 } }
|
||||
#endif
|
||||
|
||||
// Provide Z stepper positions for more rapid convergence in bed alignment.
|
||||
// Currently requires triple stepper drivers.
|
||||
@@ -674,13 +629,12 @@
|
||||
#endif
|
||||
|
||||
// Set number of iterations to align
|
||||
#define Z_STEPPER_ALIGN_ITERATIONS 3
|
||||
|
||||
#define Z_STEPPER_ALIGN_ITERATIONS 6
|
||||
// Enable to restore leveling setup after operation
|
||||
#define RESTORE_LEVELING_AFTER_G34
|
||||
|
||||
// On a 300mm bed a 5% grade would give a misalignment of ~1.5cm
|
||||
#define G34_MAX_GRADE 5 // (%) Maximum incline G34 will handle
|
||||
#define G34_MAX_GRADE 15 // (%) Maximum incline G34 will handle
|
||||
|
||||
// Stop criterion. If the accuracy is better than this stop iterating early
|
||||
#define Z_STEPPER_ALIGN_ACC 0.02
|
||||
@@ -691,7 +645,7 @@
|
||||
#define AXIS_RELATIVE_MODES { false, false, false, false }
|
||||
|
||||
// Add a Duplicate option for well-separated conjoined nozzles
|
||||
#define MULTI_NOZZLE_DUPLICATION
|
||||
//#define MULTI_NOZZLE_DUPLICATION
|
||||
|
||||
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
|
||||
#define INVERT_X_STEP_PIN false
|
||||
@@ -821,8 +775,9 @@
|
||||
* vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the
|
||||
* lowest stepping frequencies.
|
||||
*/
|
||||
//#define ADAPTIVE_STEP_SMOOTHING
|
||||
|
||||
#if ENABLED(SKR13)
|
||||
#define ADAPTIVE_STEP_SMOOTHING
|
||||
#endif
|
||||
/**
|
||||
* Custom Microstepping
|
||||
* Override as-needed for your setup. Up to 3 MS pins are supported.
|
||||
@@ -916,7 +871,7 @@
|
||||
#if HAS_LCD_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)
|
||||
//#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages
|
||||
#endif
|
||||
@@ -944,7 +899,7 @@
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
// Scroll a longer status message into view
|
||||
//#define STATUS_MESSAGE_SCROLLING
|
||||
#define STATUS_MESSAGE_SCROLLING
|
||||
|
||||
// On the Info Screen, display XY with one decimal place when possible
|
||||
//#define LCD_DECIMAL_SMALL_XY
|
||||
@@ -953,22 +908,15 @@
|
||||
//#define LCD_TIMEOUT_TO_STATUS 15000
|
||||
|
||||
// Add an 'M73' G-code to set the current percentage
|
||||
#define LCD_SET_PROGRESS_MANUALLY
|
||||
//#define LCD_SET_PROGRESS_MANUALLY
|
||||
|
||||
// Show the E position (filament used) during printing
|
||||
//#define LCD_SHOW_E_TOTAL
|
||||
|
||||
#if HAS_GRAPHICAL_LCD && HAS_PRINT_PROGRESS
|
||||
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
|
||||
//#define SHOW_REMAINING_TIME // Display estimated time to completion
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
|
||||
//#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
|
||||
#endif
|
||||
#if HAS_PRINT_PROGRESS
|
||||
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits (Graphical LCD only)
|
||||
//#define SHOW_REMAINING_TIME // Display estimated time to completion (Graphical LCD only)
|
||||
#endif
|
||||
|
||||
#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS
|
||||
#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing
|
||||
//#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
#define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar
|
||||
#define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message
|
||||
@@ -1008,10 +956,10 @@
|
||||
* an option on the LCD screen to continue the print from the last-known
|
||||
* point in the file.
|
||||
*/
|
||||
//#define POWER_LOSS_RECOVERY
|
||||
#if ENABLED(SKR13)
|
||||
#define POWER_LOSS_RECOVERY
|
||||
#endif
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
|
||||
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
|
||||
//#define POWER_LOSS_PIN 44 // Pin to detect power loss
|
||||
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
|
||||
//#define POWER_LOSS_PULL // Set pullup / pulldown as appropriate
|
||||
@@ -1062,10 +1010,10 @@
|
||||
#endif
|
||||
|
||||
// This allows hosts to request long names for files and folders with M33
|
||||
//#define LONG_FILENAME_HOST_SUPPORT
|
||||
#define LONG_FILENAME_HOST_SUPPORT
|
||||
|
||||
// Enable this option to scroll long filenames in the SD card menu
|
||||
//#define SCROLL_LONG_FILENAMES
|
||||
#define SCROLL_LONG_FILENAMES
|
||||
|
||||
// Leave the heaters on after Stop Print (not recommended!)
|
||||
//#define SD_ABORT_NO_COOLDOWN
|
||||
@@ -1087,7 +1035,7 @@
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Support for USB thumb drives using an Arduino USB Host Shield or
|
||||
@@ -1175,7 +1123,7 @@
|
||||
*/
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
// Show SD percentage next to the progress bar
|
||||
//#define DOGM_SD_PERCENT
|
||||
#define DOGM_SD_PERCENT
|
||||
|
||||
// Enable to save many cycles by drawing a hollow frame on the Info Screen
|
||||
#define XYZ_HOLLOW_FRAME
|
||||
@@ -1185,7 +1133,7 @@
|
||||
|
||||
// A bigger font is available for edit items. Costs 3120 bytes of PROGMEM.
|
||||
// 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 2300 bytes of PROGMEM.
|
||||
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
||||
@@ -1236,17 +1184,18 @@
|
||||
//#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of PROGMEM.
|
||||
|
||||
// Frivolous Game Options
|
||||
//#define MARLIN_BRICKOUT
|
||||
//#define MARLIN_INVADERS
|
||||
//#define MARLIN_SNAKE
|
||||
//#define GAMES_EASTER_EGG // Add extra blank lines above the "Games" sub-menu
|
||||
#if ENABLED(SKR13)
|
||||
#define MARLIN_BRICKOUT
|
||||
#define MARLIN_INVADERS
|
||||
#define MARLIN_SNAKE
|
||||
#endif
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
|
||||
//
|
||||
// Touch UI for the FTDI Embedded Video Engine (EVE)
|
||||
// Lulzbot Touch UI
|
||||
//
|
||||
#if ENABLED(TOUCH_UI_FTDI_EVE)
|
||||
#if ENABLED(LULZBOT_TOUCH_UI)
|
||||
// Display board used
|
||||
//#define LCD_FTDI_VM800B35A // FTDI 3.5" with FT800 (320x240)
|
||||
//#define LCD_4DSYSTEMS_4DLCD_FT843 // 4D Systems 4.3" (480x272)
|
||||
@@ -1324,9 +1273,6 @@
|
||||
|
||||
// Output extra debug info for Touch UI events
|
||||
//#define TOUCH_UI_DEBUG
|
||||
|
||||
// Developer menu (accessed by touching "About Printer" copyright text)
|
||||
//#define TOUCH_UI_DEVELOPER_MENU
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -1371,10 +1317,9 @@
|
||||
//#define BABYSTEP_WITHOUT_HOMING
|
||||
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
|
||||
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
|
||||
#define BABYSTEP_MULTIPLICATOR_Z 10 // Babysteps are very small. Increase for faster motion.
|
||||
#define BABYSTEP_MULTIPLICATOR_XY 1
|
||||
#define BABYSTEP_MULTIPLICATOR 10 // Babysteps are very small. Increase for faster motion.
|
||||
|
||||
#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
|
||||
#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
|
||||
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
|
||||
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
|
||||
// Note: Extra time may be added to mitigate controller latency.
|
||||
@@ -1389,8 +1334,10 @@
|
||||
|
||||
#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
|
||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
|
||||
//#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
|
||||
//#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
|
||||
#if ENABLED(GRAPHICSLCD)
|
||||
#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1412,10 +1359,12 @@
|
||||
* See http://marlinfw.org/docs/features/lin_advance.html for full instructions.
|
||||
* Mention @Sebastianv650 on GitHub to alert the author of any issues.
|
||||
*/
|
||||
//#define LIN_ADVANCE
|
||||
#if E0_DRIVER_TYPE != TMC2208_STANDALONE
|
||||
#define LIN_ADVANCE
|
||||
#endif
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
|
||||
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
|
||||
#define LIN_ADVANCE_K 0.0 // Unit: mm compression per 1mm/s extruder speed
|
||||
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
|
||||
#endif
|
||||
|
||||
@@ -1469,7 +1418,9 @@
|
||||
* Repeatedly attempt G29 leveling until it succeeds.
|
||||
* Stop after G29_MAX_RETRIES attempts.
|
||||
*/
|
||||
//#define G29_RETRY_AND_RECOVER
|
||||
#if DISABLED(UBL)
|
||||
#define G29_RETRY_AND_RECOVER
|
||||
#endif
|
||||
#if ENABLED(G29_RETRY_AND_RECOVER)
|
||||
#define G29_MAX_RETRIES 3
|
||||
#define G29_HALT_ON_FAILURE
|
||||
@@ -1478,7 +1429,7 @@
|
||||
* between attempts, and after the maximum number of retries have been tried.
|
||||
*/
|
||||
#define G29_SUCCESS_COMMANDS "M117 Bed leveling done."
|
||||
#define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0"
|
||||
#define G29_RECOVER_COMMANDS "M117 Probe failed.\nG28\n"
|
||||
#define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1"
|
||||
|
||||
#endif
|
||||
@@ -1498,7 +1449,7 @@
|
||||
#endif
|
||||
|
||||
// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
|
||||
//#define BEZIER_CURVE_SUPPORT
|
||||
#define BEZIER_CURVE_SUPPORT
|
||||
|
||||
/**
|
||||
* G38 Probe Target
|
||||
@@ -1548,12 +1499,12 @@
|
||||
/**
|
||||
* Maximum stepping rate (in Hz) the stepper driver allows
|
||||
* If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE)
|
||||
* 5000000 : Maximum for TMC2xxx stepper drivers
|
||||
* 1000000 : Maximum for LV8729 stepper driver
|
||||
* 500000 : Maximum for A4988 stepper driver
|
||||
* 250000 : Maximum for DRV8825 stepper driver
|
||||
* 150000 : Maximum for TB6600 stepper driver
|
||||
* 15000 : Maximum for TB6560 stepper driver
|
||||
* 500000 : Maximum for A4988 stepper driver
|
||||
* 400000 : Maximum for TMC2xxx stepper drivers
|
||||
* 250000 : Maximum for DRV8825 stepper driver
|
||||
* 200000 : Maximum for LV8729 stepper driver
|
||||
* 150000 : Maximum for TB6600 stepper driver
|
||||
* 15000 : Maximum for TB6560 stepper driver
|
||||
*
|
||||
* Override the default value based on the driver type set in Configuration.h.
|
||||
*/
|
||||
@@ -1628,7 +1579,7 @@
|
||||
// Therefore some clients abort after 30 seconds in a timeout.
|
||||
// Some other clients start sending commands while receiving a 'wait'.
|
||||
// This "wait" is only sent when the buffer is empty. 1 second is a good value here.
|
||||
//#define NO_TIMEOUTS 1000 // Milliseconds
|
||||
#define NO_TIMEOUTS 1000 // Milliseconds
|
||||
|
||||
// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
|
||||
#define ADVANCED_OK
|
||||
@@ -1663,7 +1614,7 @@
|
||||
* Note that M207 / M208 / M209 settings are saved to EEPROM.
|
||||
*
|
||||
*/
|
||||
//#define FWRETRACT
|
||||
#define FWRETRACT
|
||||
#if ENABLED(FWRETRACT)
|
||||
#define FWRETRACT_AUTORETRACT // Override slicer retractions
|
||||
#if ENABLED(FWRETRACT_AUTORETRACT)
|
||||
@@ -1690,12 +1641,12 @@
|
||||
#if EXTRUDERS > 1
|
||||
// Z raise distance for tool-change, as needed for some extruders
|
||||
#define TOOLCHANGE_ZRAISE 2 // (mm)
|
||||
#define TOOLCHANGE_NO_RETURN // Never return to the previous position on tool-change
|
||||
//#define TOOLCHANGE_NO_RETURN // Never return to the previous position on tool-change
|
||||
|
||||
// Retract and prime filament on tool-change
|
||||
#define TOOLCHANGE_FILAMENT_SWAP
|
||||
//#define TOOLCHANGE_FILAMENT_SWAP
|
||||
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
||||
#define TOOLCHANGE_FIL_SWAP_LENGTH 6 // (mm)
|
||||
#define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm)
|
||||
#define TOOLCHANGE_FIL_EXTRA_PRIME 2 // (mm)
|
||||
#define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m)
|
||||
#define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m)
|
||||
@@ -1722,7 +1673,7 @@
|
||||
* Requires NOZZLE_PARK_FEATURE.
|
||||
* This feature is required for the default FILAMENT_RUNOUT_SCRIPT.
|
||||
*/
|
||||
//#define ADVANCED_PAUSE_FEATURE
|
||||
#define ADVANCED_PAUSE_FEATURE
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
|
||||
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
|
||||
@@ -1748,22 +1699,22 @@
|
||||
// Filament can be extruded repeatedly from the Filament Change menu
|
||||
// until extrusion is consistent, and to purge old filament.
|
||||
#define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park.
|
||||
//#define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused.
|
||||
#define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused.
|
||||
|
||||
// Filament Unload does a Retract, Delay, and Purge first:
|
||||
#define FILAMENT_UNLOAD_PURGE_RETRACT 13 // (mm) Unload initial retract length.
|
||||
#define FILAMENT_UNLOAD_PURGE_DELAY 5000 // (ms) Delay for the filament to cool after retract.
|
||||
#define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length.
|
||||
#define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract.
|
||||
#define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged.
|
||||
|
||||
#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
|
||||
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
|
||||
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.
|
||||
|
||||
//#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
|
||||
//#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change
|
||||
#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
|
||||
#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change
|
||||
|
||||
//#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
|
||||
//#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
|
||||
#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
|
||||
#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
|
||||
#endif
|
||||
|
||||
// @section tmc
|
||||
@@ -1880,101 +1831,94 @@
|
||||
#define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
|
||||
|
||||
#if AXIS_IS_TMC(X)
|
||||
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
|
||||
#define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing
|
||||
#define X_MICROSTEPS 16 // 0..256
|
||||
#define X_RSENSE 0.11
|
||||
#define X_CHAIN_POS -1 // <=0 : Not chained. 1 : MCU MOSI connected. 2 : Next in chain, ...
|
||||
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
|
||||
#define X_MICROSTEPS 16 // 0..256
|
||||
#define X_RSENSE 0.11
|
||||
#define X_CHAIN_POS -1 // <=0 : Not chained. 1 : MCU MOSI connected. 2 : Next in chain, ...
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(X2)
|
||||
#define X2_CURRENT 800
|
||||
#define X2_CURRENT_HOME X2_CURRENT
|
||||
#define X2_MICROSTEPS 16
|
||||
#define X2_RSENSE 0.11
|
||||
#define X2_CHAIN_POS -1
|
||||
#define X2_CURRENT 800
|
||||
#define X2_MICROSTEPS 16
|
||||
#define X2_RSENSE 0.11
|
||||
#define X2_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Y)
|
||||
#define Y_CURRENT 800
|
||||
#define Y_CURRENT_HOME Y_CURRENT
|
||||
#define Y_MICROSTEPS 16
|
||||
#define Y_RSENSE 0.11
|
||||
#define Y_CHAIN_POS -1
|
||||
#define Y_CURRENT 800
|
||||
#define Y_MICROSTEPS 16
|
||||
#define Y_RSENSE 0.11
|
||||
#define Y_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Y2)
|
||||
#define Y2_CURRENT 800
|
||||
#define Y2_CURRENT_HOME Y2_CURRENT
|
||||
#define Y2_MICROSTEPS 16
|
||||
#define Y2_RSENSE 0.11
|
||||
#define Y2_CHAIN_POS -1
|
||||
#define Y2_CURRENT 800
|
||||
#define Y2_MICROSTEPS 16
|
||||
#define Y2_RSENSE 0.11
|
||||
#define Y2_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z)
|
||||
#define Z_CURRENT 800
|
||||
#define Z_CURRENT_HOME Z_CURRENT
|
||||
#define Z_MICROSTEPS 16
|
||||
#define Z_RSENSE 0.11
|
||||
#define Z_CHAIN_POS -1
|
||||
#define Z_CURRENT 800
|
||||
#define Z_MICROSTEPS 16
|
||||
#define Z_RSENSE 0.11
|
||||
#define Z_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
#define Z2_CURRENT 800
|
||||
#define Z2_CURRENT_HOME Z2_CURRENT
|
||||
#define Z2_MICROSTEPS 16
|
||||
#define Z2_RSENSE 0.11
|
||||
#define Z2_CHAIN_POS -1
|
||||
#define Z2_CURRENT 800
|
||||
#define Z2_MICROSTEPS 16
|
||||
#define Z2_RSENSE 0.11
|
||||
#define Z2_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
#define Z3_CURRENT 800
|
||||
#define Z3_CURRENT_HOME Z3_CURRENT
|
||||
#define Z3_MICROSTEPS 16
|
||||
#define Z3_RSENSE 0.11
|
||||
#define Z3_CHAIN_POS -1
|
||||
#define Z3_CURRENT 800
|
||||
#define Z3_MICROSTEPS 16
|
||||
#define Z3_RSENSE 0.11
|
||||
#define Z3_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E0)
|
||||
#define E0_CURRENT 800
|
||||
#define E0_MICROSTEPS 16
|
||||
#define E0_RSENSE 0.11
|
||||
#define E0_CHAIN_POS -1
|
||||
#define E0_CURRENT 800
|
||||
#define E0_MICROSTEPS 16
|
||||
#define E0_RSENSE 0.11
|
||||
#define E0_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E1)
|
||||
#define E1_CURRENT 800
|
||||
#define E1_MICROSTEPS 16
|
||||
#define E1_RSENSE 0.11
|
||||
#define E1_CHAIN_POS -1
|
||||
#define E1_CURRENT 800
|
||||
#define E1_MICROSTEPS 16
|
||||
#define E1_RSENSE 0.11
|
||||
#define E1_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E2)
|
||||
#define E2_CURRENT 800
|
||||
#define E2_MICROSTEPS 16
|
||||
#define E2_RSENSE 0.11
|
||||
#define E2_CHAIN_POS -1
|
||||
#define E2_CURRENT 800
|
||||
#define E2_MICROSTEPS 16
|
||||
#define E2_RSENSE 0.11
|
||||
#define E2_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E3)
|
||||
#define E3_CURRENT 800
|
||||
#define E3_MICROSTEPS 16
|
||||
#define E3_RSENSE 0.11
|
||||
#define E3_CHAIN_POS -1
|
||||
#define E3_CURRENT 800
|
||||
#define E3_MICROSTEPS 16
|
||||
#define E3_RSENSE 0.11
|
||||
#define E3_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E4)
|
||||
#define E4_CURRENT 800
|
||||
#define E4_MICROSTEPS 16
|
||||
#define E4_RSENSE 0.11
|
||||
#define E4_CHAIN_POS -1
|
||||
#define E4_CURRENT 800
|
||||
#define E4_MICROSTEPS 16
|
||||
#define E4_RSENSE 0.11
|
||||
#define E4_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
#if AXIS_IS_TMC(E5)
|
||||
#define E5_CURRENT 800
|
||||
#define E5_MICROSTEPS 16
|
||||
#define E5_RSENSE 0.11
|
||||
#define E5_CHAIN_POS -1
|
||||
#define E5_CURRENT 800
|
||||
#define E5_MICROSTEPS 16
|
||||
#define E5_RSENSE 0.11
|
||||
#define E5_CHAIN_POS -1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2062,7 +2006,7 @@
|
||||
* Define you own with
|
||||
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
|
||||
*/
|
||||
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V
|
||||
#define CHOPPER_TIMING CHOPPER_DEFAULT_24V
|
||||
|
||||
/**
|
||||
* Monitor Trinamic drivers for error conditions,
|
||||
@@ -2090,7 +2034,7 @@
|
||||
* STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD.
|
||||
* M913 X/Y/Z/E to live tune the setting
|
||||
*/
|
||||
//#define HYBRID_THRESHOLD
|
||||
#define HYBRID_THRESHOLD
|
||||
|
||||
#define X_HYBRID_THRESHOLD 100 // [mm/s]
|
||||
#define X2_HYBRID_THRESHOLD 100
|
||||
@@ -2168,8 +2112,8 @@
|
||||
*
|
||||
* Example:
|
||||
* #define TMC_ADV() { \
|
||||
* stepperX.diag0_otpw(1); \
|
||||
* stepperY.intpol(0); \
|
||||
* stepperX.diag0_temp_prewarn(1); \
|
||||
* stepperY.interpolate(0); \
|
||||
* }
|
||||
*/
|
||||
#define TMC_ADV() { }
|
||||
@@ -2584,27 +2528,37 @@
|
||||
/**
|
||||
* User-defined menu items that execute custom GCode
|
||||
*/
|
||||
//#define CUSTOM_USER_MENUS
|
||||
#define CUSTOM_USER_MENUS
|
||||
#if ENABLED(CUSTOM_USER_MENUS)
|
||||
//#define CUSTOM_USER_MENU_TITLE "Custom Commands"
|
||||
#define USER_SCRIPT_DONE "M117 User Script Done"
|
||||
//#define USER_SCRIPT_DONE "M117 User Script Done"
|
||||
#define USER_SCRIPT_AUDIBLE_FEEDBACK
|
||||
//#define USER_SCRIPT_RETURN // Return to status screen after a script
|
||||
#define USER_SCRIPT_RETURN // Return to status screen after a script
|
||||
#define CUSTOM_USER_MENU_TITLE "Leveling Tools"
|
||||
|
||||
#define USER_DESC_1 "Home & UBL Info"
|
||||
#define USER_GCODE_1 "G28\nG29 W"
|
||||
#define CommBedTmp "65"
|
||||
#if ENABLED(DUAL_Z)
|
||||
#define ALIGN_CMD "G34I20\n"
|
||||
#else
|
||||
#define ALIGN_CMD ""
|
||||
#endif
|
||||
#define USER_DESC_1 "Setup"
|
||||
#if (ENABLED(UBL))
|
||||
#define USER_GCODE_1 "M190S" CommBedTmp"\nG28\n" ALIGN_CMD "G29P1\nG29S1\nG29S0\n G29F0.0\nG29A\nG28\nM109S225\nG1X150Y150\nG1Z0\nM500\nM400\nM77\nM117 Set Z Offset"
|
||||
#else
|
||||
#define USER_GCODE_1 "M190S" CommBedTmp"\n M117 Probing....\nM104S225\nG28\n" ALIGN_CMD "G29\nM400\nG28\nM420S1\nM109S225\nG1X100Y100\nG1Z0\nM500\nM400\nM77\nM117 Set Z Offset"
|
||||
#endif
|
||||
|
||||
#define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL
|
||||
#define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
|
||||
#define USER_DESC_2 "PID Tune"
|
||||
#define USER_GCODE_2 "M106 S128 \n M303 C8 S225 E0 U \n M500 \n M117 PID Tune Done"
|
||||
|
||||
#define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL
|
||||
#define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
|
||||
#define USER_DESC_3 "Prep for Z Adjust"
|
||||
#define USER_GCODE_3 "M190 S" CommBedTmp" \n M104 S235 \n G28 \n G29 L1 \n G1 X100 Y 100 \n G1 Z0"
|
||||
|
||||
#define USER_DESC_4 "Heat Bed/Home/Level"
|
||||
#define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
|
||||
#define USER_DESC_4 "Store Settings"
|
||||
#define USER_GCODE_4 "M500\nM117 Settings Stored"
|
||||
|
||||
#define USER_DESC_5 "Home & Info"
|
||||
#define USER_GCODE_5 "G28\nM503"
|
||||
//#define USER_DESC_5 "Run Mesh Validation"
|
||||
//#define USER_GCODE_5 "G26"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2626,13 +2580,6 @@
|
||||
#define HOST_PROMPT_SUPPORT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Cancel Objects
|
||||
*
|
||||
* Implement M486 to allow Marlin to skip objects
|
||||
*/
|
||||
#define CANCEL_OBJECTS
|
||||
|
||||
/**
|
||||
* I2C position encoders for closed loop control.
|
||||
* Developed by Chris Barr at Aus3D.
|
||||
|
||||
+1
-8
@@ -92,9 +92,6 @@ U8GLIB ?= 1
|
||||
# this defines whether to include the Trinamic TMCStepper library
|
||||
TMC ?= 1
|
||||
|
||||
# this defines whether to include the AdaFruit NeoPixel library
|
||||
NEOPIXEL ?= 0
|
||||
|
||||
############
|
||||
# Try to automatically determine whether RELOC_WORKAROUND is needed based
|
||||
# on GCC versions:
|
||||
@@ -188,7 +185,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1109)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1110)
|
||||
# zrib V2.0 control board (Chinese knock off RAMPS replica)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1111)
|
||||
# BigTreeTech or BIQU KFB2.0
|
||||
# Bigtreetech or BIQU KFB2.0
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1112)
|
||||
# Felix 2.0+ Electronics Board (RAMPS like)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1113)
|
||||
@@ -258,10 +255,6 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1143)
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1144)
|
||||
# ADIMLab Gantry v2
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1145)
|
||||
# BIQU Tango V1
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1146)
|
||||
# MKS GEN L V2
|
||||
else ifeq ($(HARDWARE_MOTHERBOARD),1147)
|
||||
|
||||
#
|
||||
# RAMBo and derivatives
|
||||
|
||||
+6
-6
@@ -28,25 +28,25 @@
|
||||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
//#define SHORT_BUILD_VERSION "bugfix-2.0.x"
|
||||
#define SHORT_BUILD_VERSION "2.0.x_SX4I"
|
||||
|
||||
/**
|
||||
* Verbose version identifier which should contain a reference to the location
|
||||
* from where the binary was downloaded or the source code was compiled.
|
||||
*/
|
||||
//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (Github)"
|
||||
#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " TM3D"
|
||||
|
||||
/**
|
||||
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
//#define STRING_DISTRIBUTION_DATE "2019-07-10"
|
||||
#define STRING_DISTRIBUTION_DATE "2019-10-19"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
*/
|
||||
//#define MACHINE_NAME "3D Printer"
|
||||
#define MACHINE_NAME "TM3D SX4"
|
||||
|
||||
/**
|
||||
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
|
||||
@@ -54,7 +54,7 @@
|
||||
* has a distinct Github fork— the Source Code URL should just be the main
|
||||
* Marlin repository.
|
||||
*/
|
||||
//#define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin"
|
||||
#define SOURCE_CODE_URL "https://github.com/InsanityAutomation/Marlin/tree/TM_SX4_2.0"
|
||||
|
||||
/**
|
||||
* Default generic printer UUID.
|
||||
@@ -65,7 +65,7 @@
|
||||
* The WEBSITE_URL is the location where users can get more information such as
|
||||
* documentation about a specific Marlin release.
|
||||
*/
|
||||
//#define WEBSITE_URL "http://marlinfw.org"
|
||||
#define WEBSITE_URL "tinymachines3d.com"
|
||||
|
||||
/**
|
||||
* Set the vendor info the serial USB interface, if changable
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Custom Bitmap for splashscreen
|
||||
*
|
||||
* You may use one of the following tools to generate the C++ bitmap array from
|
||||
* a black and white image:
|
||||
*
|
||||
* - http://www.marlinfw.org/tools/u8glib/converter.html
|
||||
* - http://www.digole.com/tools/PicturetoC_Hex_converter.php
|
||||
*/
|
||||
|
||||
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500
|
||||
#define CUSTOM_BOOTSCREEN_BMPWIDTH 128
|
||||
#define CUSTOM_BOOTSCREEN_INVERTED
|
||||
|
||||
const unsigned char custom_start_bmp[] PROGMEM = {
|
||||
B11111101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,
|
||||
B11111110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,
|
||||
B11111100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11111100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000000,B00000001,B11110000,B00111111,
|
||||
B11111110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000000,B00000010,B00001000,B00011111,
|
||||
B11111100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000000,B00000101,B00000100,B00111111,
|
||||
B11111110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000000,B00001010,B00000010,B00011111,
|
||||
B11111100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000000,B00010101,B00000001,B00111111,
|
||||
B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000000,B00011000,B00000001,B00011111,
|
||||
B11111100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000000,B00010100,B00000001,B00111111,
|
||||
B11111110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000000,B00011000,B00000001,B00011111,
|
||||
B11111100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B00010101,B00000001,B00111111,
|
||||
B11111110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101010,B00001010,B00000010,B00011111,
|
||||
B11111100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010001,B00000101,B00000100,B00111111,
|
||||
B11111110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100001,B00000010,B10001000,B00011111,
|
||||
B11111100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010001,B00000001,B11110000,B00111111,
|
||||
B11111110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101010,B00000000,B00000000,B00011111,
|
||||
B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00000000,B00000000,B00111111,
|
||||
B11111110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11111100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111111,B11111111,B11111111,B10011111,
|
||||
B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010101,B01010101,B01010101,B10111111,
|
||||
B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000001,B00000100,B00010001,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000001,B00000100,B00010001,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010101,B01010101,B01010101,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111111,B11111111,B11111111,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11100000,B00101110,B11111011,B01111101,B11111011,B11111011,B11001111,B11000001,B11011111,B10111011,B00111110,B11000000,B11100001,B11111110,B00111100,B00011111,
|
||||
B11111101,B11101110,B01111011,B00111001,B11111001,B11110011,B11001111,B10011110,B11011111,B10111011,B00111110,B11011111,B11011110,B11111100,B11011101,B11100111,
|
||||
B11111101,B11101110,B00111011,B10111011,B11111001,B11101011,B11010111,B10111111,B01011111,B10111011,B01011110,B11011111,B11011110,B11111101,B11101101,B11110111,
|
||||
B11111101,B11101110,B10111011,B11010011,B11111010,B11101011,B10110111,B00111111,B11011111,B10111011,B01001110,B11011111,B11011111,B11111111,B11001101,B11110011,
|
||||
B11111101,B11101110,B11011011,B11000111,B11111010,B11101011,B10111011,B01111111,B11000000,B00111011,B01101110,B11000000,B11100011,B11111111,B00011101,B11110011,
|
||||
B11111101,B11101110,B11001011,B11101111,B11111010,B11011011,B10111011,B01111111,B11011111,B10111011,B01100110,B11011111,B11111000,B11111111,B11001101,B11110011,
|
||||
B11111101,B11101110,B11101011,B11101111,B11111011,B01011011,B00000011,B00111111,B01011111,B10111011,B01110110,B11011111,B11111110,B01111111,B11101101,B11110011,
|
||||
B11111101,B11101110,B11110011,B11101111,B11111011,B01011011,B01111001,B10111110,B11011111,B10111011,B01111010,B11011111,B11011110,B01111101,B11101101,B11110111,
|
||||
B11111101,B11101110,B11110011,B11101111,B11111011,B10111010,B11111101,B10011110,B11011111,B10111011,B01111100,B11011111,B11011110,B11111101,B11001101,B11100111,
|
||||
B11111101,B11101110,B11111011,B11101111,B11111011,B10111010,B11111101,B11000001,B11011111,B10111011,B01111110,B11000000,B11100000,B11111110,B00011100,B00011111
|
||||
};
|
||||
Executable → Regular
+29
-25
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,26 +33,29 @@
|
||||
//
|
||||
// Status Screen Logo bitmap
|
||||
//
|
||||
#define STATUS_LOGO_Y 6
|
||||
#define STATUS_LOGO_WIDTH 40
|
||||
#define STATUS_LOGO_Y 3
|
||||
#define STATUS_LOGO_WIDTH 24
|
||||
|
||||
const unsigned char status_logo_bmp[] PROGMEM = {
|
||||
B00011110,B00000000,B10000000,B00000000,B01111000,
|
||||
B00010000,B00000000,B10000000,B00000000,B01000000,
|
||||
B00010000,B10100011,B10011001,B01100000,B01110000,
|
||||
B00011100,B11010100,B10100101,B10000000,B00001000,
|
||||
B00010000,B10010100,B10111101,B00001111,B00001000,
|
||||
B00010000,B10010100,B10100001,B00000000,B01001000,
|
||||
B00011110,B10010011,B10011101,B00000000,B00110000,
|
||||
B00000000,B00000000,B00000000,B00000000,B00000000,
|
||||
B00000000,B00000000,B00000000,B00000000,B00000000,
|
||||
B00000000,B00000011,B10000000,B00000000,B00000000,
|
||||
B00000000,B00000010,B01000000,B00000000,B00000000,
|
||||
B00000000,B00000010,B01010110,B01100000,B00000000,
|
||||
B00000000,B00000011,B10011000,B10010000,B00000000,
|
||||
B00000000,B00000010,B00010000,B10010000,B00000000,
|
||||
B00000000,B00000010,B00010000,B10010000,B00000000,
|
||||
B00000000,B00000010,B00010000,B01100000,B00000000
|
||||
B11111111,B11111111,B11111111,
|
||||
B10000000,B00000000,B00000001,
|
||||
B10001110,B00000000,B11100001,
|
||||
B10011111,B00000001,B11110001,
|
||||
B10010011,B10000001,B00111001,
|
||||
B10011111,B10000001,B11111001,
|
||||
B10011111,B10000001,B11111001,
|
||||
B10011111,B10111001,B11111001,
|
||||
B10001111,B00101000,B11110001,
|
||||
B10000000,B00111000,B00000001,
|
||||
B10000000,B00000000,B00000001,
|
||||
B10011111,B11111111,B11111001,
|
||||
B10010001,B01110100,B10011001,
|
||||
B10011011,B00000110,B10101001,
|
||||
B10011011,B01010100,B10101001,
|
||||
B10011011,B01010110,B10101001,
|
||||
B10011011,B01010100,B10011001,
|
||||
B10011111,B11111111,B11111001,
|
||||
B11111111,B11111111,B11111111
|
||||
};
|
||||
|
||||
//
|
||||
@@ -60,11 +63,12 @@ const unsigned char status_logo_bmp[] PROGMEM = {
|
||||
//
|
||||
#define STATUS_HOTEND_ANIM
|
||||
#define STATUS_BED_ANIM
|
||||
#define STATUS_HEATERS_XSPACE 20
|
||||
#if HOTENDS < 2
|
||||
#define STATUS_HEATERS_X 48
|
||||
#define STATUS_BED_X 73
|
||||
#else
|
||||
#define STATUS_LOGO_X 8
|
||||
#define STATUS_HEATERS_X 40
|
||||
#define STATUS_BED_X 81
|
||||
#define STATUS_BED_X 72
|
||||
#else
|
||||
#define STATUS_LOGO_X 0
|
||||
#define STATUS_HEATERS_X 32
|
||||
#define STATUS_BED_X 80
|
||||
#endif
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include HAL_PATH(.,HAL.h)
|
||||
|
||||
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
||||
|
||||
inline void watchdog_refresh() {
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
HAL_watchdog_refresh();
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "math.h"
|
||||
|
||||
#ifdef USBCON
|
||||
#include <HardwareSerial.h>
|
||||
#include "HardwareSerial.h"
|
||||
#else
|
||||
#define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion
|
||||
#include "MarlinSerial.h"
|
||||
@@ -38,14 +38,6 @@
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#ifndef pgm_read_ptr
|
||||
// Compatibility for avr-libc 1.8.0-4.1 included with Ubuntu for
|
||||
// Windows Subsystem for Linux on Windows 10 as of 10/18/2019
|
||||
#define pgm_read_ptr_far(address_long) (void*)__ELPM_word((uint32_t)(address_long))
|
||||
#define pgm_read_ptr_near(address_short) (void*)__LPM_word((uint16_t)(address_short))
|
||||
#define pgm_read_ptr(address_short) pgm_read_ptr_near(address_short)
|
||||
#endif
|
||||
|
||||
// ------------------------
|
||||
// Defines
|
||||
// ------------------------
|
||||
@@ -365,7 +357,6 @@ inline void HAL_adc_init() {
|
||||
#define HAL_START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
|
||||
#endif
|
||||
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() ADC
|
||||
#define HAL_ADC_READY() !TEST(ADCSRA, ADSC)
|
||||
|
||||
|
||||
@@ -46,55 +46,39 @@ void endstop_ISR() { endstops.update(); }
|
||||
/**
|
||||
* Patch for pins_arduino.h (...\Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h)
|
||||
*
|
||||
* These macros for the Arduino MEGA do not include the two connected pins on Port J (D14, D15).
|
||||
* These macros for the Arduino MEGA do not include the two connected pins on Port J (D13, D14).
|
||||
* So we extend them here because these are the normal pins for Y_MIN and Y_MAX on RAMPS.
|
||||
* There are more PCI-enabled processor pins on Port J, but they are not connected to Arduino MEGA.
|
||||
*/
|
||||
#if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
|
||||
|
||||
#define digitalPinHasPCICR(p) (WITHIN(p, 10, 15) || WITHIN(p, 50, 53) || WITHIN(p, 62, 69))
|
||||
|
||||
#undef digitalPinToPCICR
|
||||
#define digitalPinToPCICR(p) (digitalPinHasPCICR(p) ? (&PCICR) : nullptr)
|
||||
|
||||
#define digitalPinToPCICR(p) ( WITHIN(p, 10, 15) || \
|
||||
WITHIN(p, 50, 53) || \
|
||||
WITHIN(p, 62, 69) ? &PCICR : nullptr )
|
||||
#undef digitalPinToPCICRbit
|
||||
#define digitalPinToPCICRbit(p) (WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? 0 : \
|
||||
WITHIN(p, 14, 15) ? 1 : \
|
||||
WITHIN(p, 62, 69) ? 2 : \
|
||||
0)
|
||||
|
||||
#define digitalPinToPCICRbit(p) ( WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? 0 : \
|
||||
WITHIN(p, 14, 15) ? 1 : \
|
||||
WITHIN(p, 62, 69) ? 2 : \
|
||||
0 )
|
||||
#undef digitalPinToPCMSK
|
||||
#define digitalPinToPCMSK(p) (WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? (&PCMSK0) : \
|
||||
WITHIN(p, 14, 15) ? (&PCMSK1) : \
|
||||
WITHIN(p, 62, 69) ? (&PCMSK2) : \
|
||||
nullptr)
|
||||
|
||||
#define digitalPinToPCMSK(p) ( WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? &PCMSK0 : \
|
||||
WITHIN(p, 14, 15) ? &PCMSK1 : \
|
||||
WITHIN(p, 62, 69) ? &PCMSK2 : \
|
||||
nullptr )
|
||||
#undef digitalPinToPCMSKbit
|
||||
#define digitalPinToPCMSKbit(p) (WITHIN(p, 10, 13) ? ((p) - 6) : \
|
||||
(p) == 14 || (p) == 51 ? 2 : \
|
||||
(p) == 15 || (p) == 52 ? 1 : \
|
||||
(p) == 50 ? 3 : \
|
||||
(p) == 53 ? 0 : \
|
||||
WITHIN(p, 62, 69) ? ((p) - 62) : \
|
||||
0)
|
||||
|
||||
#elif defined(__AVR_ATmega164A__) || defined(__AVR_ATmega164P__) || defined(__AVR_ATmega324A__) || \
|
||||
defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega324PB__) || \
|
||||
defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || \
|
||||
defined(__AVR_ATmega1284P__)
|
||||
|
||||
#define digitalPinHasPCICR(p) WITHIN(p, 0, NUM_DIGITAL_PINS)
|
||||
|
||||
#else
|
||||
|
||||
#error "Unsupported AVR variant!"
|
||||
|
||||
#define digitalPinToPCMSKbit(p) ( WITHIN(p, 10, 13) ? ((p) - 6) : \
|
||||
(p) == 14 || (p) == 51 ? 2 : \
|
||||
(p) == 15 || (p) == 52 ? 1 : \
|
||||
(p) == 50 ? 3 : \
|
||||
(p) == 53 ? 0 : \
|
||||
WITHIN(p, 62, 69) ? ((p) - 62) : \
|
||||
0 )
|
||||
#endif
|
||||
|
||||
|
||||
// Install Pin change interrupt for a pin. Can be called multiple times.
|
||||
void pciSetup(const int8_t pin) {
|
||||
if (digitalPinHasPCICR(pin)) {
|
||||
if (digitalPinToPCMSK(pin) != nullptr) {
|
||||
SBI(*digitalPinToPCMSK(pin), digitalPinToPCMSKbit(pin)); // enable pin
|
||||
SBI(PCIFR, digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
|
||||
SBI(PCICR, digitalPinToPCICRbit(pin)); // enable interrupt for the group
|
||||
@@ -124,7 +108,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(X_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(X_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -132,7 +116,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(X_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(X_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(X_MIN_PIN), "X_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(X_MIN_PIN), "X_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(X_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -140,7 +124,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Y_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Y_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Y_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -148,7 +132,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Y_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Y_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Y_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -156,7 +140,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Z_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -164,7 +148,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Z_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -172,7 +156,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(X2_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(X2_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(X2_MAX_PIN), "X2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(X2_MAX_PIN), "X2_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(X2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -180,7 +164,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(X2_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(X2_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(X2_MIN_PIN), "X2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(X2_MIN_PIN), "X2_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(X2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -188,7 +172,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Y2_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Y2_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Y2_MAX_PIN), "Y2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Y2_MAX_PIN), "Y2_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Y2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -196,7 +180,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Y2_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Y2_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Y2_MIN_PIN), "Y2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Y2_MIN_PIN), "Y2_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Y2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -204,7 +188,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z2_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z2_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z2_MAX_PIN), "Z2_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z2_MAX_PIN), "Z2_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Z2_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -212,7 +196,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z2_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z2_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z2_MIN_PIN), "Z2_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z2_MIN_PIN), "Z2_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Z2_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -220,7 +204,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z3_MAX_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z3_MAX_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z3_MAX_PIN), "Z3_MAX_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z3_MAX_PIN), "Z3_MAX_PIN is not interrupt-capable");
|
||||
pciSetup(Z3_MAX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -228,7 +212,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z3_MIN_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z3_MIN_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z3_MIN_PIN), "Z3_MIN_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z3_MIN_PIN), "Z3_MIN_PIN is not interrupt-capable");
|
||||
pciSetup(Z3_MIN_PIN);
|
||||
#endif
|
||||
#endif
|
||||
@@ -236,7 +220,7 @@ void setup_endstop_interrupts() {
|
||||
#if (digitalPinToInterrupt(Z_MIN_PROBE_PIN) != NOT_AN_INTERRUPT)
|
||||
_ATTACH(Z_MIN_PROBE_PIN);
|
||||
#else
|
||||
static_assert(digitalPinHasPCICR(Z_MIN_PROBE_PIN), "Z_MIN_PROBE_PIN is not interrupt-capable");
|
||||
static_assert(digitalPinToPCICR(Z_MIN_PROBE_PIN), "Z_MIN_PROBE_PIN is not interrupt-capable");
|
||||
pciSetup(Z_MIN_PROBE_PIN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
* Checks for FAST PWM
|
||||
*/
|
||||
#if ENABLED(FAST_PWM_FAN) && (ENABLED(USE_OCR2A_AS_TOP) && defined(TCCR2))
|
||||
#error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2"
|
||||
#error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,10 +26,7 @@
|
||||
|
||||
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
||||
|
||||
#define AVR_ATmega2560_FAMILY_PLUS_70 MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H)
|
||||
|
||||
#if AVR_AT90USB1286_FAMILY
|
||||
|
||||
// Working with Teensyduino extension so need to re-define some things
|
||||
#include "pinsDebug_Teensyduino.h"
|
||||
// Can't use the "digitalPinToPort" function from the Teensyduino type IDEs
|
||||
@@ -38,9 +35,7 @@
|
||||
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
|
||||
#define digitalPinToPort_DEBUG(p) digitalPinToPort_Teensy(p)
|
||||
#define GET_PINMODE(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin))
|
||||
|
||||
#elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70
|
||||
|
||||
#include "pinsDebug_plus_70.h"
|
||||
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer_plus_70(p)
|
||||
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask_plus_70(p)
|
||||
@@ -48,13 +43,11 @@
|
||||
bool GET_PINMODE(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); }
|
||||
|
||||
#else
|
||||
|
||||
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p)
|
||||
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
|
||||
#define digitalPinToPort_DEBUG(p) digitalPinToPort(p)
|
||||
bool GET_PINMODE(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); }
|
||||
#define GET_ARRAY_PIN(p) pgm_read_byte(&pin_array[p].pin)
|
||||
|
||||
#endif
|
||||
|
||||
#define VALID_PIN(pin) (pin >= 0 && pin < NUM_DIGITAL_PINS ? 1 : 0)
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
// Define MYSERIAL0/1 before MarlinSerial includes!
|
||||
#if SERIAL_PORT == -1
|
||||
#define MYSERIAL0 customizedSerial1
|
||||
#define MYSERIAL0 Serial1
|
||||
#elif SERIAL_PORT == 0
|
||||
#define MYSERIAL0 Serial
|
||||
#elif SERIAL_PORT == 1
|
||||
@@ -58,7 +58,7 @@
|
||||
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
|
||||
#endif
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#define MYSERIAL1 customizedSerial2
|
||||
#define MYSERIAL1 Serial1
|
||||
#elif SERIAL_PORT_2 == 0
|
||||
#define MYSERIAL1 Serial
|
||||
#elif SERIAL_PORT_2 == 1
|
||||
@@ -133,7 +133,6 @@ extern uint16_t HAL_adc_result; // result of last ADC conversion
|
||||
inline void HAL_adc_init() {}//todo
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
|
||||
@@ -444,8 +444,8 @@ typedef struct
|
||||
#define ENABLE 1
|
||||
#ifndef __cplusplus
|
||||
#ifndef __bool_true_false_are_defined
|
||||
#define false (1==0)
|
||||
#define true (1==1)
|
||||
#define false 0
|
||||
#define true 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef PASS
|
||||
|
||||
@@ -19,9 +19,6 @@ void sd_mmc_spi_mem_init() {
|
||||
}
|
||||
|
||||
Ctrl_status sd_mmc_spi_test_unit_ready() {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
||||
return CTRL_NO_PRESENT;
|
||||
return CTRL_GOOD;
|
||||
@@ -58,9 +55,6 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE];
|
||||
// #define DEBUG_MMC
|
||||
|
||||
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
||||
return CTRL_NO_PRESENT;
|
||||
|
||||
@@ -98,9 +92,6 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
||||
}
|
||||
|
||||
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
||||
return CTRL_NO_PRESENT;
|
||||
|
||||
|
||||
@@ -45,11 +45,10 @@
|
||||
|
||||
#ifdef ARDUINO_ARCH_SAM
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Reset.h>
|
||||
|
||||
#include "conf_usb.h"
|
||||
#include "udc.h"
|
||||
#include <Arduino.h>
|
||||
#include <Reset.h>
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static volatile bool main_b_msc_enable = false;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#if EITHER(EEPROM_SETTINGS, WEBSUPPORT)
|
||||
#include "spiffs.h"
|
||||
#endif
|
||||
|
||||
@@ -83,7 +83,7 @@ void HAL_init() {
|
||||
}
|
||||
|
||||
void HAL_init_board() {
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#if EITHER(EEPROM_SETTINGS, WEBSUPPORT)
|
||||
spiffs_init();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -111,7 +111,6 @@ void eeprom_update_block (const void *__src, void *__dst, size_t __n);
|
||||
void HAL_adc_init();
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
|
||||
@@ -23,18 +23,16 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include <Stream.h>
|
||||
#include "Stream.h"
|
||||
|
||||
#ifndef RX_BUFFER_SIZE
|
||||
#define RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef TX_BUFFER_SIZE
|
||||
#define TX_BUFFER_SIZE 32
|
||||
#endif
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#ifndef RX_BUFFER_SIZE
|
||||
#define RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#if TX_BUFFER_SIZE <= 0
|
||||
#error "TX_BUFFER_SIZE is required for the WebSocket."
|
||||
#endif
|
||||
#if TX_BUFFER_SIZE <= 0
|
||||
#error "TX_BUFFER_SIZE is required for the WebSocket."
|
||||
#endif
|
||||
|
||||
typedef uint16_t ring_buffer_pos_t;
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
#include "i2s.h"
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include <driver/periph_ctrl.h>
|
||||
#include <rom/lldesc.h>
|
||||
#include <soc/i2s_struct.h>
|
||||
#include <freertos/queue.h>
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "rom/lldesc.h"
|
||||
#include "soc/i2s_struct.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "../../module/stepper.h"
|
||||
|
||||
#define DMA_BUF_COUNT 8 // number of DMA buffers to store data
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <ESPmDNS.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include <driver/timer.h>
|
||||
#include "driver/timer.h"
|
||||
|
||||
void OTA_init() {
|
||||
ArduinoOTA
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
#include "EEPROM.h"
|
||||
|
||||
#define EEPROM_SIZE 4096
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
return EEPROM.begin(EEPROM_SIZE);
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
EEPROM.end();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
EEPROM.write(pos++, value[i]);
|
||||
crc16(crc, &value[i], 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
uint8_t c = EEPROM.read(pos++);
|
||||
if (writing) value[i] = c;
|
||||
crc16(crc, &c, 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
#include <SPIFFS.h>
|
||||
#include <FS.h>
|
||||
#include "spiffs.h"
|
||||
|
||||
#define HAL_ESP32_EEPROM_SIZE 4096
|
||||
#define HAL_ESP32_EEPROM_FILE_PATH "/eeprom.dat"
|
||||
|
||||
File eeprom_file;
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
if (spiffs_initialized) {
|
||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "r+");
|
||||
|
||||
size_t file_size = eeprom_file.size();
|
||||
if (file_size < HAL_ESP32_EEPROM_SIZE) {
|
||||
SERIAL_ECHO_MSG("SPIFFS EEPROM settings file " HAL_ESP32_EEPROM_FILE_PATH " is too small or did not exist, expanding.");
|
||||
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" file size: ", file_size, ", required size: ", HAL_ESP32_EEPROM_SIZE);
|
||||
|
||||
// mode r+ does not allow to expand the file (at least on ESP32 SPIFFS9, so we close, reopen "a", append, close, reopen "r+"
|
||||
eeprom_file.close();
|
||||
|
||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "a");
|
||||
for (size_t i = eeprom_file.size(); i < HAL_ESP32_EEPROM_SIZE; i++)
|
||||
eeprom_file.write(0xFF);
|
||||
eeprom_file.close();
|
||||
|
||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "r+");
|
||||
file_size = eeprom_file.size();
|
||||
if (file_size < HAL_ESP32_EEPROM_SIZE) {
|
||||
SERIAL_ERROR_MSG("Failed to expand " HAL_ESP32_EEPROM_FILE_PATH " to required size. SPIFFS partition full?");
|
||||
SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(" file size: ", file_size, ", required size: ", HAL_ESP32_EEPROM_SIZE);
|
||||
SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(" SPIFFS used bytes: ", SPIFFS.usedBytes(), ", total bytes: ", SPIFFS.totalBytes());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
eeprom_file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
if (!eeprom_file.seek(pos)) return true; // return true for any error
|
||||
if (eeprom_file.write(value, size) != size) return true;
|
||||
|
||||
crc16(crc, value, size);
|
||||
pos += size;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
if (!eeprom_file.seek(pos)) return true; // return true for any error
|
||||
|
||||
if (writing) {
|
||||
if (eeprom_file.read(value, size) != size) return true;
|
||||
crc16(crc, value, size);
|
||||
}
|
||||
else {
|
||||
uint8_t tmp[size];
|
||||
if (eeprom_file.read(tmp, size) != size) return true;
|
||||
crc16(crc, tmp, size);
|
||||
}
|
||||
|
||||
pos += size;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return HAL_ESP32_EEPROM_SIZE; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#if EITHER(WEBSUPPORT, EEPROM_SETTINGS)
|
||||
|
||||
#include "../../core/serial.h"
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include <stdio.h>
|
||||
#include <esp_types.h>
|
||||
#include <soc/timer_group_struct.h>
|
||||
#include <driver/periph_ctrl.h>
|
||||
#include <driver/timer.h>
|
||||
#include "esp_types.h"
|
||||
#include "soc/timer_group_struct.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "driver/timer.h"
|
||||
|
||||
#include "HAL.h"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <driver/timer.h>
|
||||
#include "driver/timer.h"
|
||||
|
||||
// Includes needed to get I2S_STEPPER_STREAM. Note that pins.h
|
||||
// is included in case this header is being included early.
|
||||
@@ -51,8 +51,8 @@ typedef uint64_t hal_timer_t;
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs // wrong would be 0.25
|
||||
#else
|
||||
#define STEPPER_TIMER_PRESCALE 40
|
||||
#define STEPPER_TIMER_RATE ((HAL_TIMER_RATE) / (STEPPER_TIMER_PRESCALE)) // frequency of stepper timer, 2MHz
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
||||
#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer, 2MHz
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
||||
#endif
|
||||
|
||||
#define STEP_TIMER_MIN_INTERVAL 8 // minimum time in µs between stepper interrupts
|
||||
|
||||
@@ -21,18 +21,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
esp_err_t esp_task_wdt_reset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize watchdog with a 4 second interrupt time
|
||||
void watchdog_init();
|
||||
|
||||
// Reset watchdog.
|
||||
inline void HAL_watchdog_refresh() { esp_task_wdt_reset(); }
|
||||
inline void HAL_watchdog_refresh() {}
|
||||
|
||||
@@ -89,7 +89,6 @@ int freeMemory();
|
||||
// ADC
|
||||
#define HAL_ANALOG_SELECT(pin) HAL_adc_enable_channel(pin)
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_get_result()
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include "watchdog.h"
|
||||
#endif
|
||||
|
||||
uint32_t HAL_adc_reading = 0;
|
||||
|
||||
// U8glib required functions
|
||||
extern "C" void u8g_xMicroDelay(uint16_t val) {
|
||||
DELAY_US(val);
|
||||
@@ -63,7 +61,7 @@ int freeMemory() {
|
||||
// return dval if not found or not a valid pin.
|
||||
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
|
||||
const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100;
|
||||
const int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? ((port << 5) | pin) : -2;
|
||||
const int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? GET_PIN_MAP_INDEX((port << 5) | pin) : -2;
|
||||
return ind > -1 ? ind : dval;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,43 +131,12 @@ int freeMemory();
|
||||
// K = 6, 565 samples, 500Hz sample rate, 1.13s convergence on full range step
|
||||
// Memory usage per ADC channel (bytes): 4 (32 Bytes for 8 channels)
|
||||
|
||||
#define HAL_ADC_RESOLUTION 12 // 15 bit maximum, raw temperature is stored as int16_t
|
||||
#define HAL_ADC_FILTERED // Disable oversampling done in Marlin as ADC values already filtered in HAL
|
||||
|
||||
using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
|
||||
extern uint32_t HAL_adc_reading;
|
||||
[[gnu::always_inline]] inline void HAL_start_adc(const pin_t pin) {
|
||||
HAL_adc_reading = FilteredADC::read(pin) >> (16 - HAL_ADC_RESOLUTION); // returns 16bit value, reduce to required bits
|
||||
}
|
||||
[[gnu::always_inline]] inline uint16_t HAL_read_adc() {
|
||||
return HAL_adc_reading;
|
||||
}
|
||||
|
||||
#define HAL_adc_init()
|
||||
#define HAL_adc_init() FilteredADC::init()
|
||||
#define HAL_ANALOG_SELECT(pin) FilteredADC::enable_channel(pin)
|
||||
#define HAL_START_ADC(pin) HAL_start_adc(pin)
|
||||
#define HAL_READ_ADC() HAL_read_adc()
|
||||
#define HAL_ADC_READY() (true)
|
||||
|
||||
// Test whether the pin is valid
|
||||
constexpr bool VALID_PIN(const pin_t pin) {
|
||||
return LPC176x::pin_is_valid(pin);
|
||||
}
|
||||
|
||||
// Get the analog index for a digital pin
|
||||
constexpr int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t pin) {
|
||||
return (LPC176x::pin_is_valid(pin) && LPC176x::pin_has_adc(pin)) ? pin : -1;
|
||||
}
|
||||
|
||||
// Return the index of a pin number
|
||||
constexpr int16_t GET_PIN_MAP_INDEX(const pin_t pin) {
|
||||
return LPC176x::pin_index(pin);
|
||||
}
|
||||
|
||||
// Get the pin number at the given index
|
||||
constexpr pin_t GET_PIN_MAP_PIN(const int16_t index) {
|
||||
return LPC176x::pin_index(index);
|
||||
}
|
||||
#define HAL_START_ADC(pin) FilteredADC::start_conversion(pin)
|
||||
#define HAL_READ_ADC() FilteredADC::get_result()
|
||||
#define HAL_ADC_READY() FilteredADC::finished_conversion()
|
||||
|
||||
// Parse a G-code word into a pin index
|
||||
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
// ------------------------
|
||||
#if ENABLED(LPC_SOFTWARE_SPI)
|
||||
|
||||
#include <SoftwareSPI.h>
|
||||
#include "SoftwareSPI.h"
|
||||
|
||||
// Software SPI
|
||||
|
||||
@@ -125,18 +125,18 @@
|
||||
PinCfg.Funcnum = 2;
|
||||
PinCfg.OpenDrain = 0;
|
||||
PinCfg.Pinmode = 0;
|
||||
PinCfg.Pinnum = LPC176x::pin_bit(SCK_PIN);
|
||||
PinCfg.Portnum = LPC176x::pin_port(SCK_PIN);
|
||||
PinCfg.Pinnum = LPC1768_PIN_PIN(SCK_PIN);
|
||||
PinCfg.Portnum = LPC1768_PIN_PORT(SCK_PIN);
|
||||
PINSEL_ConfigPin(&PinCfg);
|
||||
SET_OUTPUT(SCK_PIN);
|
||||
|
||||
PinCfg.Pinnum = LPC176x::pin_bit(MISO_PIN);
|
||||
PinCfg.Portnum = LPC176x::pin_port(MISO_PIN);
|
||||
PinCfg.Pinnum = LPC1768_PIN_PIN(MISO_PIN);
|
||||
PinCfg.Portnum = LPC1768_PIN_PORT(MISO_PIN);
|
||||
PINSEL_ConfigPin(&PinCfg);
|
||||
SET_INPUT(MISO_PIN);
|
||||
|
||||
PinCfg.Pinnum = LPC176x::pin_bit(MOSI_PIN);
|
||||
PinCfg.Portnum = LPC176x::pin_port(MOSI_PIN);
|
||||
PinCfg.Pinnum = LPC1768_PIN_PIN(MOSI_PIN);
|
||||
PinCfg.Portnum = LPC1768_PIN_PORT(MOSI_PIN);
|
||||
PINSEL_ConfigPin(&PinCfg);
|
||||
SET_OUTPUT(MOSI_PIN);
|
||||
// divide PCLK by 2 for SSP0
|
||||
@@ -42,8 +42,6 @@ void endstop_ISR() { endstops.update(); }
|
||||
|
||||
void setup_endstop_interrupts() {
|
||||
#define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
|
||||
#define LPC1768_PIN_INTERRUPT_M(pin) ((pin >> 0x5 & 0x7) == 0 || (pin >> 0x5 & 0x7) == 2)
|
||||
|
||||
#if HAS_X_MAX
|
||||
#if !LPC1768_PIN_INTERRUPT_M(X_MAX_PIN)
|
||||
#error "X_MAX_PIN is not INTERRUPT-capable."
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
#include <pwm.h>
|
||||
|
||||
void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||
LPC176x::pwm_set_frequency(pin, f_desired);
|
||||
pwm_set_frequency(pin, f_desired);
|
||||
}
|
||||
|
||||
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
|
||||
LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size);
|
||||
pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size);
|
||||
}
|
||||
|
||||
#endif // FAST_PWM_FAN || SPINDLE_LASER_PWM
|
||||
|
||||
@@ -37,19 +37,19 @@
|
||||
|
||||
#define PWM_PIN(P) true // all pins are PWM capable
|
||||
|
||||
#define LPC_PIN(pin) LPC176x::gpio_pin(pin)
|
||||
#define LPC_GPIO(port) LPC176x::gpio_port(port)
|
||||
#define LPC_PIN(pin) gpio_pin(pin)
|
||||
#define LPC_GPIO(port) gpio_port(port)
|
||||
|
||||
#define SET_DIR_INPUT(IO) LPC176x::gpio_set_input(IO)
|
||||
#define SET_DIR_OUTPUT(IO) LPC176x::gpio_set_output(IO)
|
||||
#define SET_DIR_INPUT(IO) gpio_set_input(IO)
|
||||
#define SET_DIR_OUTPUT(IO) gpio_set_output(IO)
|
||||
|
||||
#define SET_MODE(IO, mode) pinMode(IO, mode)
|
||||
|
||||
#define WRITE_PIN_SET(IO) LPC176x::gpio_set(IO)
|
||||
#define WRITE_PIN_CLR(IO) LPC176x::gpio_clear(IO)
|
||||
#define WRITE_PIN_SET(IO) gpio_set(IO)
|
||||
#define WRITE_PIN_CLR(IO) gpio_clear(IO)
|
||||
|
||||
#define READ_PIN(IO) LPC176x::gpio_get(IO)
|
||||
#define WRITE_PIN(IO,V) LPC176x::gpio_set(IO, V)
|
||||
#define READ_PIN(IO) gpio_get(IO)
|
||||
#define WRITE_PIN(IO,V) gpio_set(IO, V)
|
||||
|
||||
/**
|
||||
* Magic I/O routines
|
||||
@@ -81,10 +81,10 @@
|
||||
#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
|
||||
|
||||
/// check if pin is an input
|
||||
#define _IS_INPUT(IO) (!LPC176x::gpio_get_dir(IO))
|
||||
#define _IS_INPUT(IO) (!gpio_get_dir(IO))
|
||||
|
||||
/// check if pin is an output
|
||||
#define _IS_OUTPUT(IO) (LPC176x::gpio_get_dir(IO))
|
||||
#define _IS_OUTPUT(IO) (gpio_get_dir(IO))
|
||||
|
||||
/// Read a pin wrapper
|
||||
#define READ(IO) _READ(IO)
|
||||
|
||||
@@ -21,42 +21,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if PIO_PLATFORM_VERSION < 1001
|
||||
#error "nxplpc-arduino-lpc176x package is out of date, Please update the PlatformIO platforms, frameworks and libraries. You may need to remove the platform and let it reinstall automatically."
|
||||
#endif
|
||||
#if PIO_FRAMEWORK_VERSION < 2002
|
||||
#error "framework-arduino-lpc176x package is out of date, Please update the PlatformIO platforms, frameworks and libraries."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Detect an old pins file by checking for old ADC pins values.
|
||||
*/
|
||||
#define _OLD_TEMP_PIN(P) PIN_EXISTS(P) && _CAT(P,_PIN) <= 7 && _CAT(P,_PIN) != 2 && _CAT(P,_PIN) != 3
|
||||
#if _OLD_TEMP_PIN(TEMP_BED)
|
||||
#error "TEMP_BED_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_0)
|
||||
#error "TEMP_0_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_1)
|
||||
#error "TEMP_1_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_2)
|
||||
#error "TEMP_2_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_3)
|
||||
#error "TEMP_3_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_4)
|
||||
#error "TEMP_4_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#elif _OLD_TEMP_PIN(TEMP_5)
|
||||
#error "TEMP_5_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
|
||||
#endif
|
||||
#undef _OLD_TEMP_PIN
|
||||
|
||||
/**
|
||||
* Because PWM hardware channels all share the same frequency, along with the
|
||||
* fallback software channels, FAST_PWM_FAN is incompatible with Servos.
|
||||
*/
|
||||
#if NUM_SERVOS > 0 && ENABLED(FAST_PWM_FAN)
|
||||
#error "BLTOUCH and Servos are incompatible with FAST_PWM_FAN on LPC176x boards."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Test LPC176x-specific configuration values for errors at compile-time.
|
||||
*/
|
||||
@@ -68,7 +32,3 @@
|
||||
#if IS_RE_ARM_BOARD && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
|
||||
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 require TMC_USE_SW_SPI"
|
||||
#endif
|
||||
|
||||
#if ENABLED(BAUD_RATE_GCODE)
|
||||
#error "BAUD_RATE_GCODE is not yet supported on LPC176x."
|
||||
#endif
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
extern "C" {
|
||||
#include <lpc17xx_iap.h>
|
||||
#include "lpc17xx_iap.h"
|
||||
}
|
||||
|
||||
#define SECTOR_START(sector) ((sector < 16) ? (sector * 0x1000) : ((sector - 14) * 0x8000))
|
||||
|
||||
@@ -33,21 +33,52 @@
|
||||
#define PRINT_PORT(p)
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%d.%02d"), LPC176x::pin_port(p), LPC176x::pin_bit(p)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%d.%02d"), LPC1768_PIN_PORT(p), LPC1768_PIN_PIN(p)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
|
||||
// uses pin index
|
||||
#ifndef M43_NEVER_TOUCH
|
||||
#define M43_NEVER_TOUCH(Q) ((Q) == P0_29 || (Q) == P0_30 || (Q) == P2_09) // USB pins
|
||||
#define M43_NEVER_TOUCH(Q) ((Q) == 29 || (Q) == 30 || (Q) == 73) // USB pins
|
||||
#endif
|
||||
|
||||
bool GET_PINMODE(const pin_t pin) {
|
||||
if (!LPC176x::pin_is_valid(pin) || LPC176x::pin_adc_enabled(pin)) // found an invalid pin or active analog pin
|
||||
// active ADC function/mode/code values for PINSEL registers
|
||||
constexpr int8_t ADC_pin_mode(pin_t pin) {
|
||||
return (LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 2 ? 2 :
|
||||
LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 3 ? 2 :
|
||||
LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 23 ? 1 :
|
||||
LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 24 ? 1 :
|
||||
LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 25 ? 1 :
|
||||
LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 26 ? 1 :
|
||||
LPC1768_PIN_PORT(pin) == 1 && LPC1768_PIN_PIN(pin) == 30 ? 3 :
|
||||
LPC1768_PIN_PORT(pin) == 1 && LPC1768_PIN_PIN(pin) == 31 ? 3 : -1);
|
||||
}
|
||||
|
||||
int8_t get_pin_mode(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return -1;
|
||||
uint8_t pin_port = LPC1768_PIN_PORT(pin);
|
||||
uint8_t pin_port_pin = LPC1768_PIN_PIN(pin);
|
||||
//get appropriate PINSEL register
|
||||
volatile uint32_t * pinsel_reg = (pin_port == 0 && pin_port_pin <= 15) ? &LPC_PINCON->PINSEL0 :
|
||||
(pin_port == 0) ? &LPC_PINCON->PINSEL1 :
|
||||
(pin_port == 1 && pin_port_pin <= 15) ? &LPC_PINCON->PINSEL2 :
|
||||
pin_port == 1 ? &LPC_PINCON->PINSEL3 :
|
||||
pin_port == 2 ? &LPC_PINCON->PINSEL4 :
|
||||
pin_port == 3 ? &LPC_PINCON->PINSEL7 : &LPC_PINCON->PINSEL9;
|
||||
uint8_t pinsel_start_bit = pin_port_pin > 15 ? 2 * (pin_port_pin - 16) : 2 * pin_port_pin;
|
||||
int8_t pin_mode = (int8_t) ((*pinsel_reg >> pinsel_start_bit) & 0x3);
|
||||
return pin_mode;
|
||||
}
|
||||
|
||||
bool GET_PINMODE(pin_t pin) {
|
||||
int8_t pin_mode = get_pin_mode(pin);
|
||||
if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // found an invalid pin or active analog pin
|
||||
return false;
|
||||
|
||||
return LPC176x::gpio_direction(pin);
|
||||
uint32_t * FIO_reg[5] PROGMEM = {(uint32_t*) 0x2009C000,(uint32_t*) 0x2009C020,(uint32_t*) 0x2009C040,(uint32_t*) 0x2009C060,(uint32_t*) 0x2009C080};
|
||||
return ((*FIO_reg[LPC1768_PIN_PORT(pin)] >> LPC1768_PIN_PIN(pin) & 1) != 0); //input/output state
|
||||
}
|
||||
|
||||
bool GET_ARRAY_IS_DIGITAL(const pin_t pin) {
|
||||
return (!LPC176x::pin_has_adc(pin) || !LPC176x::pin_adc_enabled(pin));
|
||||
bool GET_ARRAY_IS_DIGITAL(pin_t pin) {
|
||||
return (!IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin));
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
typedef uint32_t hal_timer_t;
|
||||
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
|
||||
|
||||
#define HAL_TIMER_RATE ((F_CPU) / 4) // frequency of timers peripherals
|
||||
#define HAL_TIMER_RATE ((SystemCoreClock) / 4) // frequency of timers peripherals
|
||||
|
||||
#define STEP_TIMER_NUM 0 // Timer Index for Stepper
|
||||
#define TEMP_TIMER_NUM 1 // Timer Index for Temperature
|
||||
|
||||
+3
-5
@@ -25,8 +25,6 @@
|
||||
|
||||
#ifdef TARGET_LPC1768
|
||||
|
||||
extern int millis();
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -37,7 +35,6 @@ extern int millis();
|
||||
|
||||
#include "../../../core/millis_t.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to
|
||||
@@ -154,13 +151,14 @@ void u8g_i2c_init(uint8_t clock_option) {
|
||||
u8g_i2c_start(0); // send slave address and write bit
|
||||
}
|
||||
|
||||
volatile extern millis_t _millis;
|
||||
uint8_t u8g_i2c_send_byte(uint8_t data) {
|
||||
#define I2C_TIMEOUT 3
|
||||
LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data
|
||||
LPC_I2C1->I2CONSET = I2C_I2CONSET_AA;
|
||||
LPC_I2C1->I2CONCLR = I2C_I2CONCLR_SIC;
|
||||
const millis_t timeout = millis() + I2C_TIMEOUT;
|
||||
while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK) && PENDING(millis(), timeout)); // wait for xmit to finish
|
||||
const millis_t timeout = _millis + I2C_TIMEOUT;
|
||||
while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK) && PENDING(_millis, timeout)); // wait for xmit to finish
|
||||
// had hangs with SH1106 so added time out - have seen temporary screen corruption when this happens
|
||||
return 1;
|
||||
}
|
||||
@@ -60,7 +60,7 @@
|
||||
#if ENABLED(U8GLIB_ST7920)
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <SoftwareSPI.h>
|
||||
#include "SoftwareSPI.h"
|
||||
#include "../../shared/Delay.h"
|
||||
|
||||
#undef SPI_SPEED
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#if HAS_GRAPHICAL_LCD && DISABLED(U8GLIB_ST7920)
|
||||
|
||||
#include <SoftwareSPI.h>
|
||||
#include "SoftwareSPI.h"
|
||||
|
||||
#undef SPI_SPEED
|
||||
#define SPI_SPEED 2 // About 2 MHz
|
||||
@@ -75,25 +75,25 @@ uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck
|
||||
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
if (spi_speed == 0) {
|
||||
LPC176x::gpio_set(mosi_pin, !!(b & 0x80));
|
||||
LPC176x::gpio_set(sck_pin, HIGH);
|
||||
gpio_set(mosi_pin, !!(b & 0x80));
|
||||
gpio_set(sck_pin, HIGH);
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && LPC176x::gpio_get(miso_pin)) b |= 1;
|
||||
LPC176x::gpio_set(sck_pin, LOW);
|
||||
if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
|
||||
gpio_set(sck_pin, LOW);
|
||||
}
|
||||
else {
|
||||
const uint8_t state = (b & 0x80) ? HIGH : LOW;
|
||||
for (uint8_t j = 0; j < spi_speed; j++)
|
||||
LPC176x::gpio_set(mosi_pin, state);
|
||||
gpio_set(mosi_pin, state);
|
||||
|
||||
for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
|
||||
LPC176x::gpio_set(sck_pin, HIGH);
|
||||
gpio_set(sck_pin, HIGH);
|
||||
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && LPC176x::gpio_get(miso_pin)) b |= 1;
|
||||
if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
|
||||
|
||||
for (uint8_t j = 0; j < spi_speed; j++)
|
||||
LPC176x::gpio_set(sck_pin, LOW);
|
||||
gpio_set(sck_pin, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,23 +105,23 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
const uint8_t state = (b & 0x80) ? HIGH : LOW;
|
||||
if (spi_speed == 0) {
|
||||
LPC176x::gpio_set(sck_pin, LOW);
|
||||
LPC176x::gpio_set(mosi_pin, state);
|
||||
LPC176x::gpio_set(mosi_pin, state); // need some setup time
|
||||
LPC176x::gpio_set(sck_pin, HIGH);
|
||||
gpio_set(sck_pin, LOW);
|
||||
gpio_set(mosi_pin, state);
|
||||
gpio_set(mosi_pin, state); // need some setup time
|
||||
gpio_set(sck_pin, HIGH);
|
||||
}
|
||||
else {
|
||||
for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
|
||||
LPC176x::gpio_set(sck_pin, LOW);
|
||||
gpio_set(sck_pin, LOW);
|
||||
|
||||
for (uint8_t j = 0; j < spi_speed; j++)
|
||||
LPC176x::gpio_set(mosi_pin, state);
|
||||
gpio_set(mosi_pin, state);
|
||||
|
||||
for (uint8_t j = 0; j < spi_speed; j++)
|
||||
LPC176x::gpio_set(sck_pin, HIGH);
|
||||
gpio_set(sck_pin, HIGH);
|
||||
}
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && LPC176x::gpio_get(miso_pin)) b |= 1;
|
||||
if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
|
||||
}
|
||||
|
||||
return b;
|
||||
@@ -130,7 +130,7 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck
|
||||
static uint8_t SPI_speed = 0;
|
||||
|
||||
static void u8g_sw_spi_HAL_LPC1768_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
|
||||
#if EITHER(FYSETC_MINI_12864, MKS_MINI_12864)
|
||||
#if ENABLED(FYSETC_MINI_12864)
|
||||
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
|
||||
#else
|
||||
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
|
||||
@@ -158,10 +158,10 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if EITHER(FYSETC_MINI_12864, MKS_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0
|
||||
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
|
||||
// the next chip select goes active
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
|
||||
#if ENABLED(FYSETC_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0
|
||||
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
|
||||
// the next chip select goes active
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
else {
|
||||
|
||||
Executable → Regular
+3
-5
@@ -31,11 +31,9 @@ try:
|
||||
#
|
||||
import subprocess
|
||||
# typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
|
||||
driveStr = str(subprocess.check_output("fsutil fsinfo drives"))
|
||||
driveStr = subprocess.check_output("fsutil fsinfo drives").decode('utf8')
|
||||
# typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
|
||||
# driveStr = driveStr.strip().lstrip('Drives: ') <- Doesn't work in other Languages as English. In German is "Drives:" = "Laufwerke:"
|
||||
FirstFound = driveStr.find(':',0,-1) # Find the first ":" and
|
||||
driveStr = driveStr[FirstFound + 1 : -1] # truncate to the rest
|
||||
driveStr = driveStr.strip().lstrip('Drives: ')
|
||||
# typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\',
|
||||
# 'G:\\', 'H:\\', 'I:\\', 'J:\\', 'K:\\', 'L:\\', 'M:\\', 'Y:\\', 'Z:\\']
|
||||
drives = driveStr.split()
|
||||
@@ -46,7 +44,7 @@ try:
|
||||
for drive in drives:
|
||||
final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:'
|
||||
try:
|
||||
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
|
||||
volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT).decode('utf8')
|
||||
except Exception as e:
|
||||
continue
|
||||
else:
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
|
||||
#include <lpc17xx_wdt.h>
|
||||
#include "lpc17xx_wdt.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
void watchdog_init() {
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#ifdef __SAMD51__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include <Adafruit_ZeroDMA.h>
|
||||
#include <wiring_private.h>
|
||||
#include "Adafruit_ZeroDMA.h"
|
||||
#include "wiring_private.h"
|
||||
|
||||
// ------------------------
|
||||
// Local defines
|
||||
@@ -442,11 +442,9 @@ void HAL_adc_init() {
|
||||
// Preloaded data (fixed for all ADC instances hence not loaded by DMA)
|
||||
adc->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA_Val; // VRefA pin
|
||||
SYNC(adc->SYNCBUSY.bit.REFCTRL);
|
||||
adc->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_12BIT_Val;
|
||||
adc->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_10BIT_Val;
|
||||
SYNC(adc->SYNCBUSY.bit.CTRLB);
|
||||
adc->SAMPCTRL.bit.SAMPLEN = (6 - 1); // Sampling clocks
|
||||
adc->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_16 | ADC_AVGCTRL_ADJRES(4); // 16 Accumulated conversions and shift 4 to get oversampled 12 bits result
|
||||
SYNC(adc->SYNCBUSY.bit.AVGCTRL);
|
||||
// Registers loaded by DMA
|
||||
adc->DSEQCTRL.bit.INPUTCTRL = true;
|
||||
|
||||
|
||||
@@ -109,8 +109,6 @@ extern uint16_t HAL_adc_result; // result of last ADC conversion
|
||||
|
||||
void HAL_adc_init();
|
||||
|
||||
#define HAL_ADC_FILTERED // Disable oversampling done in Marlin as ADC values already filtered in HAL
|
||||
#define HAL_ADC_RESOLUTION 12
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDIO_SUPPORT)
|
||||
#error "SDIO_SUPPORT is not supported on SAMD51."
|
||||
#error "SDIO_SUPPORT is not supported."
|
||||
#endif
|
||||
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
|
||||
@@ -99,7 +99,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
SYNC(tc->COUNT32.SYNCBUSY.bit.CTRLB);
|
||||
|
||||
// Set compare value
|
||||
tc->COUNT32.COUNT.reg = tc->COUNT32.CC[0].reg = (HAL_TIMER_RATE) / frequency;
|
||||
tc->COUNT32.COUNT.reg = tc->COUNT32.CC[0].reg = HAL_TIMER_RATE / frequency;
|
||||
|
||||
// And start timer
|
||||
tc->COUNT32.CTRLA.bit.ENABLE = true;
|
||||
|
||||
@@ -28,21 +28,11 @@
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
#if (__cplusplus == 201703L) && defined(__has_include)
|
||||
#define HAS_SWSERIAL __has_include(<SoftwareSerial.h>)
|
||||
#else
|
||||
#define HAS_SWSERIAL HAS_TMC220x
|
||||
#endif
|
||||
|
||||
#if HAS_SWSERIAL
|
||||
#include "SoftwareSerial.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(SRAM_EEPROM_EMULATION)
|
||||
#if STM32F7xx
|
||||
#include <stm32f7xx_ll_pwr.h>
|
||||
#include "stm32f7xx_ll_pwr.h"
|
||||
#elif STM32F4xx
|
||||
#include <stm32f4xx_ll_pwr.h>
|
||||
#include "stm32f4xx_ll_pwr.h"
|
||||
#else
|
||||
#error "SRAM_EEPROM_EMULATION is currently only supported for STM32F4xx and STM32F7xx"
|
||||
#endif
|
||||
@@ -92,10 +82,6 @@ void HAL_init() {
|
||||
// Wait until backup regulator is initialized
|
||||
while (!LL_PWR_IsActiveFlag_BRR());
|
||||
#endif // EEPROM_EMULATED_SRAM
|
||||
|
||||
#if HAS_SWSERIAL
|
||||
SoftwareSerial::setInterruptPriority(SWSERIAL_TIMER_IRQ_PRIO, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void HAL_clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
||||
|
||||
@@ -188,7 +188,6 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n);
|
||||
inline void HAL_adc_init() {}
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
|
||||
@@ -83,13 +83,6 @@ void spiInit(uint8_t spiRate) {
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
|
||||
#if ENABLED(CUSTOM_SPI_PINS)
|
||||
SPI.setMISO(MISO_PIN);
|
||||
SPI.setMOSI(MOSI_PIN);
|
||||
SPI.setSCLK(SCK_PIN);
|
||||
SPI.setSSEL(SS_PIN);
|
||||
#endif
|
||||
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,30 +28,25 @@
|
||||
|
||||
#include "Servo.h"
|
||||
|
||||
static uint_fast8_t servoCount = 0;
|
||||
constexpr millis_t servoDelay[] = SERVO_DELAY;
|
||||
static_assert(COUNT(servoDelay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
|
||||
|
||||
libServo::libServo()
|
||||
: delay(servoDelay[servoCount++])
|
||||
{}
|
||||
uint8_t servoPin[MAX_SERVOS] = { 0 };
|
||||
|
||||
int8_t libServo::attach(const int pin) {
|
||||
if (servoCount >= MAX_SERVOS) return -1;
|
||||
if (pin > 0) servo_pin = pin;
|
||||
return super::attach(servo_pin);
|
||||
if (servoIndex >= MAX_SERVOS) return -1;
|
||||
if (pin > 0) servoPin[servoIndex] = pin;
|
||||
return super::attach(servoPin[servoIndex]);
|
||||
}
|
||||
|
||||
int8_t libServo::attach(const int pin, const int min, const int max) {
|
||||
if (servoCount >= MAX_SERVOS) return -1;
|
||||
if (pin > 0) servo_pin = pin;
|
||||
return super::attach(servo_pin, min, max);
|
||||
if (pin > 0) servoPin[servoIndex] = pin;
|
||||
return super::attach(servoPin[servoIndex], min, max);
|
||||
}
|
||||
|
||||
void libServo::move(const int value) {
|
||||
constexpr uint16_t servo_delay[] = SERVO_DELAY;
|
||||
static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
|
||||
if (attach(0) >= 0) {
|
||||
write(value);
|
||||
safe_delay(delay);
|
||||
safe_delay(servo_delay[servoIndex]);
|
||||
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
|
||||
detach();
|
||||
#endif
|
||||
|
||||
@@ -27,13 +27,11 @@
|
||||
// Inherit and expand on the official library
|
||||
class libServo : public Servo {
|
||||
public:
|
||||
libServo();
|
||||
int8_t attach(const int pin);
|
||||
int8_t attach(const int pin, const int min, const int max);
|
||||
void move(const int value);
|
||||
private:
|
||||
typedef Servo super;
|
||||
|
||||
int servo_pin = 0;
|
||||
millis_t delay = 0;
|
||||
uint16_t min_ticks, max_ticks;
|
||||
uint8_t servoIndex; // index into the channel data for this servo
|
||||
};
|
||||
|
||||
@@ -1,395 +0,0 @@
|
||||
/*
|
||||
* SoftwareSerial.cpp (formerly NewSoftSerial.cpp)
|
||||
*
|
||||
* Multi-instance software serial library for Arduino/Wiring
|
||||
* -- Interrupt-driven receive and other improvements by ladyada
|
||||
* (http://ladyada.net)
|
||||
* -- Tuning, circular buffer, derivation from class Print/Stream,
|
||||
* multi-instance support, porting to 8MHz processors,
|
||||
* various optimizations, PROGMEM delay tables, inverse logic and
|
||||
* direct port writing by Mikal Hart (http://www.arduiniana.org)
|
||||
* -- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com)
|
||||
* -- 20MHz processor support by Garrett Mace (http://www.macetech.com)
|
||||
* -- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.com/)
|
||||
* -- STM32 support by Armin van der Togt
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The latest version of this library can always be found at
|
||||
* http://arduiniana.org.
|
||||
*/
|
||||
|
||||
//
|
||||
// Includes
|
||||
//
|
||||
#if defined(PLATFORMIO) && defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
|
||||
#include "SoftwareSerial.h"
|
||||
#include "timers.h"
|
||||
|
||||
#define OVERSAMPLE 3 // in RX, Timer will generate interruption OVERSAMPLE time during a bit. Thus OVERSAMPLE ticks in a bit. (interrupt not synchonized with edge).
|
||||
|
||||
// defined in bit-periods
|
||||
#define HALFDUPLEX_SWITCH_DELAY 5
|
||||
// It's best to define TIMER_SERIAL in variant.h. If not defined, we choose one here
|
||||
// The order is based on (lack of) features and compare channels, we choose the simplest available
|
||||
// because we only need an update interrupt
|
||||
#if !defined(TIMER_SERIAL)
|
||||
#if defined (TIM18_BASE)
|
||||
#define TIMER_SERIAL TIM18
|
||||
#elif defined (TIM7_BASE)
|
||||
#define TIMER_SERIAL TIM7
|
||||
#elif defined (TIM6_BASE)
|
||||
#define TIMER_SERIAL TIM6
|
||||
#elif defined (TIM22_BASE)
|
||||
#define TIMER_SERIAL TIM22
|
||||
#elif defined (TIM21_BASE)
|
||||
#define TIMER_SERIAL TIM21
|
||||
#elif defined (TIM17_BASE)
|
||||
#define TIMER_SERIAL TIM17
|
||||
#elif defined (TIM16_BASE)
|
||||
#define TIMER_SERIAL TIM16
|
||||
#elif defined (TIM15_BASE)
|
||||
#define TIMER_SERIAL TIM15
|
||||
#elif defined (TIM14_BASE)
|
||||
#define TIMER_SERIAL TIM14
|
||||
#elif defined (TIM13_BASE)
|
||||
#define TIMER_SERIAL TIM13
|
||||
#elif defined (TIM11_BASE)
|
||||
#define TIMER_SERIAL TIM11
|
||||
#elif defined (TIM10_BASE)
|
||||
#define TIMER_SERIAL TIM10
|
||||
#elif defined (TIM12_BASE)
|
||||
#define TIMER_SERIAL TIM12
|
||||
#elif defined (TIM19_BASE)
|
||||
#define TIMER_SERIAL TIM19
|
||||
#elif defined (TIM9_BASE)
|
||||
#define TIMER_SERIAL TIM9
|
||||
#elif defined (TIM5_BASE)
|
||||
#define TIMER_SERIAL TIM5
|
||||
#elif defined (TIM4_BASE)
|
||||
#define TIMER_SERIAL TIM4
|
||||
#elif defined (TIM3_BASE)
|
||||
#define TIMER_SERIAL TIM3
|
||||
#elif defined (TIM2_BASE)
|
||||
#define TIMER_SERIAL TIM2
|
||||
#elif defined (TIM20_BASE)
|
||||
#define TIMER_SERIAL TIM20
|
||||
#elif defined (TIM8_BASE)
|
||||
#define TIMER_SERIAL TIM8
|
||||
#elif defined (TIM1_BASE)
|
||||
#define TIMER_SERIAL TIM1
|
||||
#else
|
||||
#error No suitable timer found for SoftwareSerial, define TIMER_SERIAL in variant.h
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
// Statics
|
||||
//
|
||||
HardwareTimer SoftwareSerial::timer(TIMER_SERIAL);
|
||||
const IRQn_Type SoftwareSerial::timer_interrupt_number = static_cast<IRQn_Type>(getTimerUpIrq(TIMER_SERIAL));
|
||||
uint32_t SoftwareSerial::timer_interrupt_priority = NVIC_EncodePriority(NVIC_GetPriorityGrouping(), TIM_IRQ_PRIO, TIM_IRQ_SUBPRIO);
|
||||
SoftwareSerial *SoftwareSerial::active_listener = nullptr;
|
||||
SoftwareSerial *volatile SoftwareSerial::active_out = nullptr;
|
||||
SoftwareSerial *volatile SoftwareSerial::active_in = nullptr;
|
||||
int32_t SoftwareSerial::tx_tick_cnt = 0; // OVERSAMPLE ticks needed for a bit
|
||||
int32_t volatile SoftwareSerial::rx_tick_cnt = 0; // OVERSAMPLE ticks needed for a bit
|
||||
uint32_t SoftwareSerial::tx_buffer = 0;
|
||||
int32_t SoftwareSerial::tx_bit_cnt = 0;
|
||||
uint32_t SoftwareSerial::rx_buffer = 0;
|
||||
int32_t SoftwareSerial::rx_bit_cnt = -1; // rx_bit_cnt = -1 : waiting for start bit
|
||||
uint32_t SoftwareSerial::cur_speed = 0;
|
||||
|
||||
void SoftwareSerial::setInterruptPriority(uint32_t preemptPriority, uint32_t subPriority) {
|
||||
timer_interrupt_priority = NVIC_EncodePriority(NVIC_GetPriorityGrouping(), preemptPriority, subPriority);
|
||||
}
|
||||
|
||||
//
|
||||
// Private methods
|
||||
//
|
||||
|
||||
void SoftwareSerial::setSpeed(uint32_t speed) {
|
||||
if (speed != cur_speed) {
|
||||
timer.pause();
|
||||
if (speed != 0) {
|
||||
// Disable the timer
|
||||
uint32_t clock_rate, cmp_value;
|
||||
// Get timer clock
|
||||
clock_rate = timer.getTimerClkFreq();
|
||||
int pre = 1;
|
||||
// Calculate prescale an compare value
|
||||
do {
|
||||
cmp_value = clock_rate / (speed * OVERSAMPLE);
|
||||
if (cmp_value >= UINT16_MAX) {
|
||||
clock_rate /= 2;
|
||||
pre *= 2;
|
||||
}
|
||||
} while (cmp_value >= UINT16_MAX);
|
||||
timer.setPrescaleFactor(pre);
|
||||
timer.setOverflow(cmp_value);
|
||||
timer.setCount(0);
|
||||
timer.attachInterrupt(&handleInterrupt);
|
||||
timer.resume();
|
||||
NVIC_SetPriority(timer_interrupt_number, timer_interrupt_priority);
|
||||
}
|
||||
else
|
||||
timer.detachInterrupt();
|
||||
cur_speed = speed;
|
||||
}
|
||||
}
|
||||
|
||||
// This function sets the current object as the "listening"
|
||||
// one and returns true if it replaces another
|
||||
bool SoftwareSerial::listen() {
|
||||
if (active_listener != this) {
|
||||
// wait for any transmit to complete as we may change speed
|
||||
while (active_out);
|
||||
active_listener->stopListening();
|
||||
rx_tick_cnt = 1; // 1 : next interrupt will decrease rx_tick_cnt to 0 which means RX pin level will be considered.
|
||||
rx_bit_cnt = -1; // rx_bit_cnt = -1 : waiting for start bit
|
||||
setSpeed(_speed);
|
||||
active_listener = this;
|
||||
if (!_half_duplex) active_in = this;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Stop listening. Returns true if we were actually listening.
|
||||
bool SoftwareSerial::stopListening() {
|
||||
if (active_listener == this) {
|
||||
// wait for any output to complete
|
||||
while (active_out);
|
||||
if (_half_duplex) setRXTX(false);
|
||||
active_listener = nullptr;
|
||||
active_in = nullptr;
|
||||
// turn off ints
|
||||
setSpeed(0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void SoftwareSerial::setTX() {
|
||||
if (_inverse_logic)
|
||||
LL_GPIO_ResetOutputPin(_transmitPinPort, _transmitPinNumber);
|
||||
else
|
||||
LL_GPIO_SetOutputPin(_transmitPinPort, _transmitPinNumber);
|
||||
pinMode(_transmitPin, OUTPUT);
|
||||
}
|
||||
|
||||
inline void SoftwareSerial::setRX() {
|
||||
pinMode(_receivePin, _inverse_logic ? INPUT_PULLDOWN : INPUT_PULLUP); // pullup for normal logic!
|
||||
}
|
||||
|
||||
inline void SoftwareSerial::setRXTX(bool input) {
|
||||
if (_half_duplex) {
|
||||
if (input) {
|
||||
if (active_in != this) {
|
||||
setRX();
|
||||
rx_bit_cnt = -1; // rx_bit_cnt = -1 : waiting for start bit
|
||||
rx_tick_cnt = 2; // 2 : next interrupt will be discarded. 2 interrupts required to consider RX pin level
|
||||
active_in = this;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (active_in == this) {
|
||||
setTX();
|
||||
active_in = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void SoftwareSerial::send() {
|
||||
if (--tx_tick_cnt <= 0) { // if tx_tick_cnt > 0 interrupt is discarded. Only when tx_tick_cnt reaches 0 is TX pin set.
|
||||
if (tx_bit_cnt++ < 10) { // tx_bit_cnt < 10 transmission is not finished (10 = 1 start +8 bits + 1 stop)
|
||||
// Send data (including start and stop bits)
|
||||
if (tx_buffer & 1)
|
||||
LL_GPIO_SetOutputPin(_transmitPinPort, _transmitPinNumber);
|
||||
else
|
||||
LL_GPIO_ResetOutputPin(_transmitPinPort, _transmitPinNumber);
|
||||
tx_buffer >>= 1;
|
||||
tx_tick_cnt = OVERSAMPLE; // Wait OVERSAMPLE ticks to send next bit
|
||||
}
|
||||
else { // Transmission finished
|
||||
tx_tick_cnt = 1;
|
||||
if (_output_pending) {
|
||||
active_out = nullptr;
|
||||
|
||||
// In half-duplex mode wait HALFDUPLEX_SWITCH_DELAY bit-periods after the byte has
|
||||
// been transmitted before allowing the switch to RX mode
|
||||
}
|
||||
else if (tx_bit_cnt > 10 + OVERSAMPLE * HALFDUPLEX_SWITCH_DELAY) {
|
||||
if (_half_duplex && active_listener == this) setRXTX(true);
|
||||
active_out = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// The receive routine called by the interrupt handler
|
||||
//
|
||||
inline void SoftwareSerial::recv() {
|
||||
if (--rx_tick_cnt <= 0) { // if rx_tick_cnt > 0 interrupt is discarded. Only when rx_tick_cnt reaches 0 is RX pin considered
|
||||
bool inbit = LL_GPIO_IsInputPinSet(_receivePinPort, _receivePinNumber) ^ _inverse_logic;
|
||||
if (rx_bit_cnt == -1) { // rx_bit_cnt = -1 : waiting for start bit
|
||||
if (!inbit) {
|
||||
// got start bit
|
||||
rx_bit_cnt = 0; // rx_bit_cnt == 0 : start bit received
|
||||
rx_tick_cnt = OVERSAMPLE + 1; // Wait 1 bit (OVERSAMPLE ticks) + 1 tick in order to sample RX pin in the middle of the edge (and not too close to the edge)
|
||||
rx_buffer = 0;
|
||||
}
|
||||
else
|
||||
rx_tick_cnt = 1; // Waiting for start bit, but wrong level. Wait for next Interrupt to check RX pin level
|
||||
}
|
||||
else if (rx_bit_cnt >= 8) { // rx_bit_cnt >= 8 : waiting for stop bit
|
||||
if (inbit) {
|
||||
// Stop-bit read complete. Add to buffer.
|
||||
uint8_t next = (_receive_buffer_tail + 1) % _SS_MAX_RX_BUFF;
|
||||
if (next != _receive_buffer_head) {
|
||||
// save new data in buffer: tail points to byte destination
|
||||
_receive_buffer[_receive_buffer_tail] = rx_buffer; // save new byte
|
||||
_receive_buffer_tail = next;
|
||||
}
|
||||
else // rx_bit_cnt = x with x = [0..7] correspond to new bit x received
|
||||
_buffer_overflow = true;
|
||||
}
|
||||
// Full trame received. Restart waiting for start bit at next interrupt
|
||||
rx_tick_cnt = 1;
|
||||
rx_bit_cnt = -1;
|
||||
}
|
||||
else {
|
||||
// data bits
|
||||
rx_buffer >>= 1;
|
||||
if (inbit) rx_buffer |= 0x80;
|
||||
rx_bit_cnt++; // Prepare for next bit
|
||||
rx_tick_cnt = OVERSAMPLE; // Wait OVERSAMPLE ticks before sampling next bit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Interrupt handling
|
||||
//
|
||||
|
||||
/* static */
|
||||
inline void SoftwareSerial::handleInterrupt(HardwareTimer*) {
|
||||
if (active_in) active_in->recv();
|
||||
if (active_out) active_out->send();
|
||||
}
|
||||
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
SoftwareSerial::SoftwareSerial(uint16_t receivePin, uint16_t transmitPin, bool inverse_logic /* = false */) :
|
||||
_receivePin(receivePin),
|
||||
_transmitPin(transmitPin),
|
||||
_receivePinPort(digitalPinToPort(receivePin)),
|
||||
_receivePinNumber(STM_LL_GPIO_PIN(digitalPinToPinName(receivePin))),
|
||||
_transmitPinPort(digitalPinToPort(transmitPin)),
|
||||
_transmitPinNumber(STM_LL_GPIO_PIN(digitalPinToPinName(transmitPin))),
|
||||
_speed(0),
|
||||
_buffer_overflow(false),
|
||||
_inverse_logic(inverse_logic),
|
||||
_half_duplex(receivePin == transmitPin),
|
||||
_output_pending(0),
|
||||
_receive_buffer_tail(0),
|
||||
_receive_buffer_head(0)
|
||||
{
|
||||
if ((receivePin < NUM_DIGITAL_PINS) || (transmitPin < NUM_DIGITAL_PINS)) {
|
||||
/* Enable GPIO clock for tx and rx pin*/
|
||||
set_GPIO_Port_Clock(STM_PORT(digitalPinToPinName(transmitPin)));
|
||||
set_GPIO_Port_Clock(STM_PORT(digitalPinToPinName(receivePin)));
|
||||
}
|
||||
else
|
||||
_Error_Handler("ERROR: invalid pin number\n", -1);
|
||||
}
|
||||
|
||||
//
|
||||
// Destructor
|
||||
//
|
||||
SoftwareSerial::~SoftwareSerial() { end(); }
|
||||
|
||||
//
|
||||
// Public methods
|
||||
//
|
||||
|
||||
void SoftwareSerial::begin(long speed) {
|
||||
#ifdef FORCE_BAUD_RATE
|
||||
speed = FORCE_BAUD_RATE;
|
||||
#endif
|
||||
_speed = speed;
|
||||
if (!_half_duplex) {
|
||||
setTX();
|
||||
setRX();
|
||||
listen();
|
||||
}
|
||||
else
|
||||
setTX();
|
||||
}
|
||||
|
||||
void SoftwareSerial::end() {
|
||||
stopListening();
|
||||
}
|
||||
|
||||
// Read data from buffer
|
||||
int SoftwareSerial::read() {
|
||||
// Empty buffer?
|
||||
if (_receive_buffer_head == _receive_buffer_tail) return -1;
|
||||
|
||||
// Read from "head"
|
||||
uint8_t d = _receive_buffer[_receive_buffer_head]; // grab next byte
|
||||
_receive_buffer_head = (_receive_buffer_head + 1) % _SS_MAX_RX_BUFF;
|
||||
return d;
|
||||
}
|
||||
|
||||
int SoftwareSerial::available() {
|
||||
return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF;
|
||||
}
|
||||
|
||||
size_t SoftwareSerial::write(uint8_t b) {
|
||||
// wait for previous transmit to complete
|
||||
_output_pending = 1;
|
||||
while (active_out) { /* nada */ }
|
||||
// add start and stop bits.
|
||||
tx_buffer = b << 1 | 0x200;
|
||||
if (_inverse_logic) tx_buffer = ~tx_buffer;
|
||||
tx_bit_cnt = 0;
|
||||
tx_tick_cnt = OVERSAMPLE;
|
||||
setSpeed(_speed);
|
||||
if (_half_duplex) setRXTX(false);
|
||||
_output_pending = 0;
|
||||
// make us active
|
||||
active_out = this;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void SoftwareSerial::flush() {
|
||||
noInterrupts();
|
||||
_receive_buffer_head = _receive_buffer_tail = 0;
|
||||
interrupts();
|
||||
}
|
||||
|
||||
int SoftwareSerial::peek() {
|
||||
// Empty buffer?
|
||||
if (_receive_buffer_head == _receive_buffer_tail) return -1;
|
||||
|
||||
// Read from "head"
|
||||
return _receive_buffer[_receive_buffer_head];
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
@@ -1,119 +0,0 @@
|
||||
/**
|
||||
* SoftwareSerial.h (formerly NewSoftSerial.h)
|
||||
*
|
||||
* Multi-instance software serial library for Arduino/Wiring
|
||||
* -- Interrupt-driven receive and other improvements by ladyada
|
||||
* (http://ladyada.net)
|
||||
* -- Tuning, circular buffer, derivation from class Print/Stream,
|
||||
* multi-instance support, porting to 8MHz processors,
|
||||
* various optimizations, PROGMEM delay tables, inverse logic and
|
||||
* direct port writing by Mikal Hart (http://www.arduiniana.org)
|
||||
* -- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com)
|
||||
* -- 20MHz processor support by Garrett Mace (http://www.macetech.com)
|
||||
* -- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.com/)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The latest version of this library can always be found at
|
||||
* http://arduiniana.org.
|
||||
*/
|
||||
|
||||
#ifndef SOFTWARESERIAL_H
|
||||
#define SOFTWARESERIAL_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
/******************************************************************************
|
||||
* Definitions
|
||||
******************************************************************************/
|
||||
|
||||
#define _SS_MAX_RX_BUFF 64 // RX buffer size
|
||||
|
||||
class SoftwareSerial : public Stream {
|
||||
private:
|
||||
// per object data
|
||||
uint16_t _receivePin;
|
||||
uint16_t _transmitPin;
|
||||
GPIO_TypeDef *_receivePinPort;
|
||||
uint32_t _receivePinNumber;
|
||||
GPIO_TypeDef *_transmitPinPort;
|
||||
uint32_t _transmitPinNumber;
|
||||
uint32_t _speed;
|
||||
|
||||
uint16_t _buffer_overflow: 1;
|
||||
uint16_t _inverse_logic: 1;
|
||||
uint16_t _half_duplex: 1;
|
||||
uint16_t _output_pending: 1;
|
||||
|
||||
unsigned char _receive_buffer[_SS_MAX_RX_BUFF];
|
||||
volatile uint8_t _receive_buffer_tail;
|
||||
volatile uint8_t _receive_buffer_head;
|
||||
|
||||
uint32_t delta_start = 0;
|
||||
|
||||
// static data
|
||||
static bool initialised;
|
||||
static HardwareTimer timer;
|
||||
static const IRQn_Type timer_interrupt_number;
|
||||
static uint32_t timer_interrupt_priority;
|
||||
static SoftwareSerial *active_listener;
|
||||
static SoftwareSerial *volatile active_out;
|
||||
static SoftwareSerial *volatile active_in;
|
||||
static int32_t tx_tick_cnt;
|
||||
static volatile int32_t rx_tick_cnt;
|
||||
static uint32_t tx_buffer;
|
||||
static int32_t tx_bit_cnt;
|
||||
static uint32_t rx_buffer;
|
||||
static int32_t rx_bit_cnt;
|
||||
static uint32_t cur_speed;
|
||||
|
||||
// private methods
|
||||
void send();
|
||||
void recv();
|
||||
void setTX();
|
||||
void setRX();
|
||||
void setSpeed(uint32_t speed);
|
||||
void setRXTX(bool input);
|
||||
static void handleInterrupt(HardwareTimer *timer);
|
||||
|
||||
public:
|
||||
// public methods
|
||||
|
||||
SoftwareSerial(uint16_t receivePin, uint16_t transmitPin, bool inverse_logic = false);
|
||||
virtual ~SoftwareSerial();
|
||||
void begin(long speed);
|
||||
bool listen();
|
||||
void end();
|
||||
bool isListening() { return active_listener == this; }
|
||||
bool stopListening();
|
||||
bool overflow() {
|
||||
bool ret = _buffer_overflow;
|
||||
if (ret) _buffer_overflow = false;
|
||||
return ret;
|
||||
}
|
||||
int peek();
|
||||
|
||||
virtual size_t write(uint8_t byte);
|
||||
virtual int read();
|
||||
virtual int available();
|
||||
virtual void flush();
|
||||
operator bool() { return true; }
|
||||
|
||||
static void setInterruptPriority(uint32_t preemptPriority, uint32_t subPriority);
|
||||
|
||||
using Print::write;
|
||||
};
|
||||
|
||||
#endif // SOFTWARESERIAL_H
|
||||
@@ -1,265 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
|
||||
// Only STM32F4 can support wear leveling at this time
|
||||
#ifndef STM32F4xx
|
||||
#undef FLASH_EEPROM_LEVELING
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The STM32 HAL supports chips that deal with "pages" and some with "sectors" and some that
|
||||
* even have multiple "banks" of flash.
|
||||
*
|
||||
* This code is a bit of a mashup of
|
||||
* framework-arduinoststm32/cores/arduino/stm32/stm32_eeprom.c
|
||||
* hal/hal_lpc1768/persistent_store_flash.cpp
|
||||
*
|
||||
* This has only be written against those that use a single "sector" design.
|
||||
*
|
||||
* Those that deal with "pages" could be made to work. Looking at the STM32F07 for example, there are
|
||||
* 128 "pages", each 2kB in size. If we continued with our EEPROM being 4Kb, we'd always need to operate
|
||||
* on 2 of these pages. Each write, we'd use 2 different pages from a pool of pages until we are done.
|
||||
*/
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
|
||||
#include "stm32_def.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
|
||||
#include "src/core/debug_out.h"
|
||||
|
||||
#ifndef EEPROM_SIZE
|
||||
#define EEPROM_SIZE 0x1000 // 4kB
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_SECTOR
|
||||
#define FLASH_SECTOR (FLASH_SECTOR_TOTAL - 1)
|
||||
#endif
|
||||
#ifndef FLASH_UNIT_SIZE
|
||||
#define FLASH_UNIT_SIZE 0x20000 // 128kB
|
||||
#endif
|
||||
|
||||
#define FLASH_ADDRESS_START (FLASH_END - ((FLASH_SECTOR_TOTAL - FLASH_SECTOR) * FLASH_UNIT_SIZE) + 1)
|
||||
#define FLASH_ADDRESS_END (FLASH_ADDRESS_START + FLASH_UNIT_SIZE - 1)
|
||||
|
||||
#define EEPROM_SLOTS (FLASH_UNIT_SIZE/EEPROM_SIZE)
|
||||
#define SLOT_ADDRESS(slot) (FLASH_ADDRESS_START + (slot * EEPROM_SIZE))
|
||||
|
||||
#define UNLOCK_FLASH() if (!flash_unlocked) { \
|
||||
HAL_FLASH_Unlock(); \
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | \
|
||||
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR); \
|
||||
flash_unlocked = true; \
|
||||
}
|
||||
#define LOCK_FLASH() if (flash_unlocked) { HAL_FLASH_Lock(); flash_unlocked = false; }
|
||||
|
||||
#define EMPTY_UINT32 ((uint32_t)-1)
|
||||
#define EMPTY_UINT8 ((uint8_t)-1)
|
||||
|
||||
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0};
|
||||
static int current_slot = -1;
|
||||
|
||||
static_assert(0 == EEPROM_SIZE % 4, "EEPROM_SIZE must be a multiple of 4"); // Ensure copying as uint32_t is safe
|
||||
static_assert(0 == FLASH_UNIT_SIZE % EEPROM_SIZE, "EEPROM_SIZE must divide evenly into your FLASH_UNIT_SIZE");
|
||||
static_assert(FLASH_UNIT_SIZE >= EEPROM_SIZE, "FLASH_UNIT_SIZE must be greater than or equal to your EEPROM_SIZE");
|
||||
static_assert(IS_FLASH_SECTOR(FLASH_SECTOR), "FLASH_SECTOR is invalid");
|
||||
static_assert(IS_POWER_OF_2(FLASH_UNIT_SIZE), "FLASH_UNIT_SIZE should be a power of 2, please check your chip's spec sheet");
|
||||
|
||||
#endif
|
||||
|
||||
static bool eeprom_data_written = false;
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
|
||||
if (current_slot == -1 || eeprom_data_written) {
|
||||
// This must be the first time since power on that we have accessed the storage, or someone
|
||||
// loaded and called write_data and never called access_finish.
|
||||
// Lets go looking for the slot that holds our configuration.
|
||||
if (eeprom_data_written) DEBUG_ECHOLN("Dangling EEPROM write_data");
|
||||
uint32_t address = FLASH_ADDRESS_START;
|
||||
while (address <= FLASH_ADDRESS_END) {
|
||||
uint32_t address_value = (*(__IO uint32_t*)address);
|
||||
if (address_value != EMPTY_UINT32) {
|
||||
current_slot = (address - FLASH_ADDRESS_START) / EEPROM_SIZE;
|
||||
break;
|
||||
}
|
||||
address += sizeof(uint32_t);
|
||||
}
|
||||
if (current_slot == -1) {
|
||||
// We didn't find anything, so we'll just intialize to empty
|
||||
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = EMPTY_UINT8;
|
||||
current_slot = EEPROM_SLOTS;
|
||||
}
|
||||
else {
|
||||
// load current settings
|
||||
uint8_t *eeprom_data = (uint8_t *)SLOT_ADDRESS(current_slot);
|
||||
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = eeprom_data[i];
|
||||
DEBUG_ECHOLNPAIR("EEPROM loaded from slot ", current_slot, ".");
|
||||
}
|
||||
eeprom_data_written = false;
|
||||
}
|
||||
|
||||
#else
|
||||
eeprom_buffer_fill();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
|
||||
if (eeprom_data_written) {
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
|
||||
HAL_StatusTypeDef status = HAL_ERROR;
|
||||
bool flash_unlocked = false;
|
||||
|
||||
if (--current_slot < 0) {
|
||||
// all slots have been used, erase everything and start again
|
||||
|
||||
FLASH_EraseInitTypeDef EraseInitStruct;
|
||||
uint32_t SectorError = 0;
|
||||
|
||||
EraseInitStruct.TypeErase = FLASH_TYPEERASE_SECTORS;
|
||||
EraseInitStruct.VoltageRange = FLASH_VOLTAGE_RANGE_3;
|
||||
EraseInitStruct.Sector = FLASH_SECTOR;
|
||||
EraseInitStruct.NbSectors = 1;
|
||||
|
||||
current_slot = EEPROM_SLOTS - 1;
|
||||
UNLOCK_FLASH();
|
||||
|
||||
status = HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError);
|
||||
if (status != HAL_OK) {
|
||||
DEBUG_ECHOLNPAIR("HAL_FLASHEx_Erase=", status);
|
||||
DEBUG_ECHOLNPAIR("GetError=", HAL_FLASH_GetError());
|
||||
DEBUG_ECHOLNPAIR("SectorError=", SectorError);
|
||||
LOCK_FLASH();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
UNLOCK_FLASH();
|
||||
|
||||
uint32_t offset = 0;
|
||||
uint32_t address = SLOT_ADDRESS(current_slot);
|
||||
uint32_t address_end = address + EEPROM_SIZE;
|
||||
uint32_t data = 0;
|
||||
|
||||
bool success = true;
|
||||
|
||||
while (address < address_end) {
|
||||
memcpy(&data, ram_eeprom + offset, sizeof(uint32_t));
|
||||
status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, address, data);
|
||||
if (status == HAL_OK) {
|
||||
address += sizeof(uint32_t);
|
||||
offset += sizeof(uint32_t);
|
||||
}
|
||||
else {
|
||||
DEBUG_ECHOLNPAIR("HAL_FLASH_Program=", status);
|
||||
DEBUG_ECHOLNPAIR("GetError=", HAL_FLASH_GetError());
|
||||
DEBUG_ECHOLNPAIR("address=", address);
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LOCK_FLASH();
|
||||
|
||||
if (success) {
|
||||
eeprom_data_written = false;
|
||||
DEBUG_ECHOLNPAIR("EEPROM saved to slot ", current_slot, ".");
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
#else
|
||||
eeprom_buffer_flush();
|
||||
eeprom_data_written = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
while (size--) {
|
||||
uint8_t v = *value;
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
if (v != ram_eeprom[pos]) {
|
||||
ram_eeprom[pos] = v;
|
||||
eeprom_data_written = true;
|
||||
}
|
||||
#else
|
||||
if (v != eeprom_buffered_read_byte(pos)) {
|
||||
eeprom_buffered_write_byte(pos, v);
|
||||
eeprom_data_written = true;
|
||||
}
|
||||
#endif
|
||||
crc16(crc, &v, 1);
|
||||
pos++;
|
||||
value++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
const uint8_t c = (
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
ram_eeprom[pos]
|
||||
#else
|
||||
eeprom_buffered_read_byte(pos)
|
||||
#endif
|
||||
);
|
||||
if (writing) *value = c;
|
||||
crc16(crc, &c, 1);
|
||||
pos++;
|
||||
value++;
|
||||
} while (--size);
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() {
|
||||
return (
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
EEPROM_SIZE
|
||||
#else
|
||||
E2END + 1
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#endif // EEPROM_SETTINGS && FLASH_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
@@ -24,15 +24,29 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && ANY(SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
||||
#if ENABLED(EEPROM_SETTINGS) && ANY(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
#include <EEPROM.h>
|
||||
static bool eeprom_data_written = false;
|
||||
#endif
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
eeprom_buffer_fill();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
if (eeprom_data_written) {
|
||||
eeprom_buffer_flush();
|
||||
eeprom_data_written = false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,6 +66,8 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#elif ENABLED(FLASH_EEPROM_EMULATION)
|
||||
eeprom_buffered_write_byte(pos, v);
|
||||
#else
|
||||
*(__IO uint8_t *)(BKPSRAM_BASE + (uint8_t * const)pos) = v;
|
||||
#endif
|
||||
@@ -60,6 +76,9 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||
pos++;
|
||||
value++;
|
||||
};
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
eeprom_data_written = true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -70,6 +89,8 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
||||
const uint8_t c = (
|
||||
#if EITHER(SPI_EEPROM, I2C_EEPROM)
|
||||
eeprom_read_byte((uint8_t*)pos)
|
||||
#elif ENABLED(FLASH_EEPROM_EMULATION)
|
||||
eeprom_buffered_read_byte(pos)
|
||||
#else
|
||||
(*(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)))
|
||||
#endif
|
||||
@@ -93,5 +114,5 @@ size_t PersistentStore::capacity() {
|
||||
);
|
||||
}
|
||||
|
||||
#endif // EEPROM_SETTINGS && (SRAM_EEPROM_EMULATION || SPI_EEPROM || I2C_EEPROM)
|
||||
#endif // EEPROM_SETTINGS && (FLASH_EEPROM_EMULATION || SRAM_EEPROM_EMULATION || SPI_EEPROM || I2C_EEPROM)
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
|
||||
@@ -32,108 +32,62 @@
|
||||
|
||||
#define NUM_HARDWARE_TIMERS 2
|
||||
|
||||
#define __TIMER_DEV(X) TIM##X
|
||||
#define _TIMER_DEV(X) __TIMER_DEV(X)
|
||||
#define STEP_TIMER_DEV _TIMER_DEV(STEP_TIMER)
|
||||
#define TEMP_TIMER_DEV _TIMER_DEV(TEMP_TIMER)
|
||||
|
||||
// ------------------------
|
||||
// Private Variables
|
||||
// ------------------------
|
||||
|
||||
HardwareTimer *timer_instance[NUM_HARDWARE_TIMERS] = { NULL };
|
||||
bool timer_enabled[NUM_HARDWARE_TIMERS] = { false };
|
||||
stm32_timer_t TimerHandle[NUM_HARDWARE_TIMERS];
|
||||
|
||||
// ------------------------
|
||||
// Public functions
|
||||
// ------------------------
|
||||
|
||||
// frequency is in Hertz
|
||||
bool timers_initialized[NUM_HARDWARE_TIMERS] = { false };
|
||||
|
||||
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
if (!HAL_timer_initialized(timer_num)) {
|
||||
switch (timer_num) {
|
||||
case STEP_TIMER_NUM: // STEPPER TIMER - use a 32bit timer if possible
|
||||
timer_instance[timer_num] = new HardwareTimer(STEP_TIMER_DEV);
|
||||
/* Set the prescaler to the final desired value.
|
||||
* This will change the effective ISR callback frequency but when
|
||||
* HAL_timer_start(timer_num=0) is called in the core for the first time
|
||||
* the real frequency isn't important as long as, after boot, the ISR
|
||||
* gets called with the correct prescaler and count register. So here
|
||||
* we set the prescaler to the correct, final value and ignore the frequency
|
||||
* asked. We will call back the ISR in 1 second to start at full speed.
|
||||
*
|
||||
* The proper fix, however, would be a correct initialization OR a
|
||||
* HAL_timer_change(const uint8_t timer_num, const uint32_t frequency)
|
||||
* which changes the prescaler when an IRQ frequency change is needed
|
||||
* (for example when steppers are turned on)
|
||||
*/
|
||||
timer_instance[timer_num]->setPrescaleFactor(STEPPER_TIMER_PRESCALE); //the -1 is done internally
|
||||
timer_instance[timer_num]->setOverflow(_MIN(hal_timer_t(HAL_TIMER_TYPE_MAX), (HAL_TIMER_RATE) / (STEPPER_TIMER_PRESCALE) /* /frequency */), TICK_FORMAT);
|
||||
break;
|
||||
case TEMP_TIMER_NUM: // TEMP TIMER - any available 16bit timer
|
||||
timer_instance[timer_num] = new HardwareTimer(TEMP_TIMER_DEV);
|
||||
// The prescale factor is computed automatically for HERTZ_FORMAT
|
||||
timer_instance[timer_num]->setOverflow(frequency, HERTZ_FORMAT);
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_timer_enable_interrupt(timer_num);
|
||||
|
||||
/*
|
||||
* Initializes (and unfortunately starts) the timer.
|
||||
* This is needed to set correct IRQ priority at the moment but causes
|
||||
* no harm since every call to HAL_timer_start() is actually followed by
|
||||
* a call to HAL_timer_enable_interrupt() which means that there isn't
|
||||
* a case in which you want the timer to run without a callback.
|
||||
*/
|
||||
timer_instance[timer_num]->resume(); // First call to resume() MUST follow the attachInterrupt()
|
||||
|
||||
// This is fixed in Arduino_Core_STM32 1.8.
|
||||
// These calls can be removed and replaced with
|
||||
// timer_instance[timer_num]->setInterruptPriority
|
||||
if (!timers_initialized[timer_num]) {
|
||||
uint32_t step_prescaler = STEPPER_TIMER_PRESCALE - 1,
|
||||
temp_prescaler = TEMP_TIMER_PRESCALE - 1;
|
||||
switch (timer_num) {
|
||||
case STEP_TIMER_NUM:
|
||||
// STEPPER TIMER - use a 32bit timer if possible
|
||||
TimerHandle[timer_num].timer = STEP_TIMER_DEV;
|
||||
TimerHandle[timer_num].irqHandle = Step_Handler;
|
||||
TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / step_prescaler) / frequency) - 1, step_prescaler);
|
||||
HAL_NVIC_SetPriority(STEP_TIMER_IRQ_NAME, STEP_TIMER_IRQ_PRIO, 0);
|
||||
break;
|
||||
|
||||
case TEMP_TIMER_NUM:
|
||||
// TEMP TIMER - any available 16bit Timer
|
||||
TimerHandle[timer_num].timer = TEMP_TIMER_DEV;
|
||||
TimerHandle[timer_num].irqHandle = Temp_Handler;
|
||||
TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / temp_prescaler) / frequency) - 1, temp_prescaler);
|
||||
HAL_NVIC_SetPriority(TEMP_TIMER_IRQ_NAME, TEMP_TIMER_IRQ_PRIO, 0);
|
||||
break;
|
||||
}
|
||||
timers_initialized[timer_num] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_timer_enable_interrupt(const uint8_t timer_num) {
|
||||
if (HAL_timer_initialized(timer_num) && !timer_enabled[timer_num]) {
|
||||
timer_enabled[timer_num] = true;
|
||||
switch (timer_num) {
|
||||
case STEP_TIMER_NUM:
|
||||
timer_instance[timer_num]->attachInterrupt(Step_Handler);
|
||||
break;
|
||||
case TEMP_TIMER_NUM:
|
||||
timer_instance[timer_num]->attachInterrupt(Temp_Handler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const IRQn_Type IRQ_Id = IRQn_Type(getTimerIrq(TimerHandle[timer_num].timer));
|
||||
HAL_NVIC_EnableIRQ(IRQ_Id);
|
||||
}
|
||||
|
||||
void HAL_timer_disable_interrupt(const uint8_t timer_num) {
|
||||
if (HAL_timer_interrupt_enabled(timer_num)) {
|
||||
timer_instance[timer_num]->detachInterrupt();
|
||||
timer_enabled[timer_num] = false;
|
||||
}
|
||||
const IRQn_Type IRQ_Id = IRQn_Type(getTimerIrq(TimerHandle[timer_num].timer));
|
||||
HAL_NVIC_DisableIRQ(IRQ_Id);
|
||||
|
||||
// We NEED memory barriers to ensure Interrupts are actually disabled!
|
||||
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
|
||||
__DSB();
|
||||
__ISB();
|
||||
}
|
||||
|
||||
bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
|
||||
return HAL_timer_initialized(timer_num) && timer_enabled[timer_num];
|
||||
}
|
||||
|
||||
// Only for use within the HAL
|
||||
TIM_TypeDef * HAL_timer_device(const uint8_t timer_num) {
|
||||
switch (timer_num) {
|
||||
case STEP_TIMER_NUM: return STEP_TIMER_DEV;
|
||||
case TEMP_TIMER_NUM: return TEMP_TIMER_DEV;
|
||||
}
|
||||
return nullptr;
|
||||
const uint32_t IRQ_Id = getTimerIrq(TimerHandle[timer_num].timer);
|
||||
return NVIC->ISER[IRQ_Id >> 5] & _BV32(IRQ_Id & 0x1F);
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#define hal_timer_t uint32_t
|
||||
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF // Timers can be 16 or 32 bit
|
||||
|
||||
|
||||
#ifdef STM32F0xx
|
||||
|
||||
#define HAL_TIMER_RATE (F_CPU) // frequency of timer peripherals
|
||||
@@ -67,30 +66,27 @@
|
||||
#endif
|
||||
|
||||
#ifndef TEMP_TIMER
|
||||
#define TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
|
||||
#define TEMP_TIMER 7
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef SWSERIAL_TIMER_IRQ_PRIO
|
||||
#define SWSERIAL_TIMER_IRQ_PRIO 1
|
||||
#endif
|
||||
|
||||
#ifndef STEP_TIMER_IRQ_PRIO
|
||||
#define STEP_TIMER_IRQ_PRIO 2
|
||||
#define STEP_TIMER_IRQ_PRIO 1
|
||||
#endif
|
||||
|
||||
#ifndef TEMP_TIMER_IRQ_PRIO
|
||||
#define TEMP_TIMER_IRQ_PRIO 14 //14 = after hardware ISRs
|
||||
#define TEMP_TIMER_IRQ_PRIO 2
|
||||
#endif
|
||||
|
||||
#define STEP_TIMER_NUM 0 // index of timer to use for stepper
|
||||
#define TEMP_TIMER_NUM 1 // index of timer to use for temperature
|
||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||
|
||||
#define TEMP_TIMER_FREQUENCY 1000 //Temperature::isr() is expected to be called at around 1kHz
|
||||
#define TEMP_TIMER_RATE 72000 // 72 Khz
|
||||
#define TEMP_TIMER_PRESCALE ((HAL_TIMER_RATE)/(TEMP_TIMER_RATE))
|
||||
#define TEMP_TIMER_FREQUENCY 1000
|
||||
|
||||
//TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
||||
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
|
||||
#define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE))
|
||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
||||
@@ -99,6 +95,17 @@
|
||||
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
||||
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
|
||||
|
||||
#define __TIMER_DEV(X) TIM##X
|
||||
#define _TIMER_DEV(X) __TIMER_DEV(X)
|
||||
#define STEP_TIMER_DEV _TIMER_DEV(STEP_TIMER)
|
||||
#define TEMP_TIMER_DEV _TIMER_DEV(TEMP_TIMER)
|
||||
|
||||
#define __TIMER_CALLBACK(X) TIM##X##_IRQHandler
|
||||
#define _TIMER_CALLBACK(X) __TIMER_CALLBACK(X)
|
||||
|
||||
#define STEP_TIMER_CALLBACK _TIMER_CALLBACK(STEP_TIMER)
|
||||
#define TEMP_TIMER_CALLBACK _TIMER_CALLBACK(TEMP_TIMER)
|
||||
|
||||
#define __TIMER_IRQ_NAME(X) TIM##X##_IRQn
|
||||
#define _TIMER_IRQ_NAME(X) __TIMER_IRQ_NAME(X)
|
||||
|
||||
@@ -112,16 +119,22 @@
|
||||
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
|
||||
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
|
||||
|
||||
extern void Step_Handler(HardwareTimer *htim);
|
||||
extern void Temp_Handler(HardwareTimer *htim);
|
||||
#define HAL_STEP_TIMER_ISR() void Step_Handler(HardwareTimer *htim)
|
||||
#define HAL_TEMP_TIMER_ISR() void Temp_Handler(HardwareTimer *htim)
|
||||
extern void Step_Handler(stimer_t *htim);
|
||||
extern void Temp_Handler(stimer_t *htim);
|
||||
#define HAL_STEP_TIMER_ISR() void Step_Handler(stimer_t *htim)
|
||||
#define HAL_TEMP_TIMER_ISR() void Temp_Handler(stimer_t *htim)
|
||||
|
||||
// ------------------------
|
||||
// Types
|
||||
// ------------------------
|
||||
|
||||
typedef stimer_t stm32_timer_t;
|
||||
|
||||
// ------------------------
|
||||
// Public Variables
|
||||
// ------------------------
|
||||
|
||||
extern HardwareTimer *timer_instance[];
|
||||
extern stm32_timer_t TimerHandle[];
|
||||
|
||||
// ------------------------
|
||||
// Public functions
|
||||
@@ -132,26 +145,18 @@ void HAL_timer_enable_interrupt(const uint8_t timer_num);
|
||||
void HAL_timer_disable_interrupt(const uint8_t timer_num);
|
||||
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
|
||||
|
||||
//TIM_TypeDef* HAL_timer_device(const uint8_t timer_num); no need to be public for now. not public = not used externally
|
||||
|
||||
// FORCE_INLINE because these are used in performance-critical situations
|
||||
FORCE_INLINE bool HAL_timer_initialized(const uint8_t timer_num) {
|
||||
return timer_instance[timer_num] != NULL;
|
||||
}
|
||||
FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
|
||||
return HAL_timer_initialized(timer_num) ? timer_instance[timer_num]->getCount() : 0;
|
||||
FORCE_INLINE static uint32_t HAL_timer_get_count(const uint8_t timer_num) {
|
||||
return __HAL_TIM_GET_COUNTER(&TimerHandle[timer_num].handle);
|
||||
}
|
||||
|
||||
// NOTE: Method name may be misleading.
|
||||
// STM32 has an Auto-Reload Register (ARR) as opposed to a "compare" register
|
||||
FORCE_INLINE static void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t overflow) {
|
||||
if (HAL_timer_initialized(timer_num)) {
|
||||
timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow()
|
||||
// wiki: "force all registers (Autoreload, prescaler, compare) to be taken into account"
|
||||
// So, if the new overflow value is less than the count it will trigger a rollover interrupt.
|
||||
if (overflow < timer_instance[timer_num]->getCount()) // Added 'if' here because reports say it won't boot without it
|
||||
timer_instance[timer_num]->refresh();
|
||||
}
|
||||
FORCE_INLINE static void HAL_timer_set_compare(const uint8_t timer_num, const uint32_t compare) {
|
||||
__HAL_TIM_SET_AUTORELOAD(&TimerHandle[timer_num].handle, compare);
|
||||
if (HAL_timer_get_count(timer_num) >= compare)
|
||||
TimerHandle[timer_num].handle.Instance->EGR |= TIM_EGR_UG; // Generate an immediate update interrupt
|
||||
}
|
||||
|
||||
FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) {
|
||||
return __HAL_TIM_GET_AUTORELOAD(&TimerHandle[timer_num].handle);
|
||||
}
|
||||
|
||||
#define HAL_timer_isr_prologue(TIMER_NUM)
|
||||
|
||||
@@ -121,9 +121,6 @@ const uint8_t adc_pins[] = {
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH_PIN,
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
ADC_KEYPAD_PIN,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
JOY_X_PIN,
|
||||
#endif
|
||||
@@ -163,9 +160,6 @@ enum TEMP_PINS : char {
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
FILWIDTH,
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
ADC_KEY,
|
||||
#endif
|
||||
#if HAS_JOY_ADC_X
|
||||
JOY_X,
|
||||
#endif
|
||||
@@ -278,7 +272,7 @@ extern "C" {
|
||||
// return free memory between end of heap (or end bss) and whatever is current
|
||||
|
||||
/*
|
||||
#include <wirish/syscalls.c>
|
||||
#include "wirish/syscalls.c"
|
||||
//extern caddr_t _sbrk(int incr);
|
||||
#ifndef CONFIG_HEAP_END
|
||||
extern char _lm_heap_end;
|
||||
@@ -358,9 +352,6 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
case FILWIDTH_PIN: pin_index = FILWIDTH; break;
|
||||
#endif
|
||||
#if ENABLED(ADC_KEYPAD)
|
||||
case ADC_KEYPAD_PIN: pin_index = ADC_KEY; break;
|
||||
#endif
|
||||
}
|
||||
HAL_adc_result = (HAL_adc_results[(int)pin_index] >> 2) & 0x3FF; // shift to get 10 bits only.
|
||||
}
|
||||
|
||||
@@ -51,14 +51,6 @@
|
||||
// Defines
|
||||
// ------------------------
|
||||
|
||||
#ifndef STM32_FLASH_SIZE
|
||||
#ifdef MCU_STM32F103RE
|
||||
#define STM32_FLASH_SIZE 512
|
||||
#else
|
||||
#define STM32_FLASH_SIZE 256
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_USB
|
||||
#ifndef USE_USB_COMPOSITE
|
||||
#define UsbSerial Serial
|
||||
@@ -246,7 +238,6 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n);
|
||||
void HAL_adc_init();
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ static const spi_pins* dev_to_spi_pins(spi_dev *dev);
|
||||
static void configure_gpios(spi_dev *dev, bool as_master);
|
||||
static spi_baud_rate determine_baud_rate(spi_dev *dev, uint32_t freq);
|
||||
|
||||
#if BOARD_NR_SPI >= 3 && !defined(STM32_HIGH_DENSITY)
|
||||
#if (BOARD_NR_SPI >= 3) && !defined(STM32_HIGH_DENSITY)
|
||||
#error "The SPI library is misconfigured: 3 SPI ports only available on high density STM32 devices"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef HAVE_SW_SERIAL
|
||||
#define SW_SERIAL_PLACEHOLDER 1
|
||||
#endif
|
||||
#define SW_SERIAL_PLACEHOLDER 1
|
||||
|
||||
class SoftwareSerial {
|
||||
public:
|
||||
|
||||
Executable → Regular
@@ -29,33 +29,32 @@
|
||||
|
||||
#include <libmaple/gpio.h>
|
||||
|
||||
#define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
|
||||
#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << ((V) ? 0 : 16))
|
||||
#define TOGGLE(IO) (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit))
|
||||
#define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
|
||||
#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << ((V) ? 0 : 16))
|
||||
#define TOGGLE(IO) (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit))
|
||||
|
||||
#define _GET_MODE(IO) gpio_get_mode(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit)
|
||||
#define _SET_MODE(IO,M) gpio_set_mode(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit, M)
|
||||
#define _SET_OUTPUT(IO) _SET_MODE(IO, GPIO_OUTPUT_PP)
|
||||
#define _SET_OUTPUT_OD(IO) _SET_MODE(IO, GPIO_OUTPUT_OD)
|
||||
#define _GET_MODE(IO) gpio_get_mode(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit)
|
||||
#define _SET_MODE(IO,M) gpio_set_mode(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit, M)
|
||||
#define _SET_OUTPUT(IO) _SET_MODE(IO, GPIO_OUTPUT_PP)
|
||||
#define _SET_OUTPUT_OD(IO) _SET_MODE(IO, GPIO_OUTPUT_OD)
|
||||
|
||||
#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(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
||||
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
|
||||
|
||||
#define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING)
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU)
|
||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, GPIO_INPUT_PD)
|
||||
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
||||
#define SET_PWM(IO) pinMode(IO, PWM) // do{ gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, GPIO_AF_OUTPUT_PP); timer_set_mode(PIN_MAP[pin].timer_device, PIN_MAP[pin].timer_channel, TIMER_PWM); }while(0)
|
||||
#define SET_PWM_OD(IO) pinMode(IO, PWM_OPEN_DRAIN)
|
||||
#define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING)
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU)
|
||||
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
||||
#define SET_PWM(IO) pinMode(IO, PWM) // do{ gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, GPIO_AF_OUTPUT_PP); timer_set_mode(PIN_MAP[pin].timer_device, PIN_MAP[pin].timer_channel, TIMER_PWM); }while(0)
|
||||
#define SET_PWM_OD(IO) pinMode(IO, PWM_OPEN_DRAIN)
|
||||
|
||||
#define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
|
||||
#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP || _GET_MODE(IO) == GPIO_OUTPUT_OD)
|
||||
#define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
|
||||
#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP || _GET_MODE(IO) == GPIO_OUTPUT_OD)
|
||||
|
||||
#define PWM_PIN(IO) (PIN_MAP[IO].timer_device != nullptr)
|
||||
#define PWM_PIN(IO) (PIN_MAP[IO].timer_device != nullptr)
|
||||
|
||||
// digitalRead/Write wrappers
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
|
||||
|
||||
//
|
||||
// Pins Definitions
|
||||
|
||||
@@ -36,8 +36,3 @@
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SW_SERIAL) && HAS_TMC220x
|
||||
#warning "With TMC2208/9 consider using SoftwareSerialM with HAVE_SW_SERIAL and appropriate SS_TIMER."
|
||||
#error "Missing SoftwareSerial implementation."
|
||||
#endif
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
#define SPI_CLOCK_MAX SPI_BAUD_PCLK_DIV_2
|
||||
#endif
|
||||
|
||||
#define CS_LOW() WRITE(ONBOARD_SD_CS_PIN, LOW) /* Set OnBoardSPI cs low */
|
||||
#define CS_HIGH() WRITE(ONBOARD_SD_CS_PIN, HIGH) /* Set OnBoardSPI cs high */
|
||||
#define CS_LOW() {WRITE(ONBOARD_SD_CS_PIN, LOW);} /* Set OnBoardSPI cs low */
|
||||
#define CS_HIGH() {WRITE(ONBOARD_SD_CS_PIN, HIGH);} /* Set OnBoardSPI cs high */
|
||||
|
||||
#define FCLK_FAST() ONBOARD_SD_SPI.setClockDivider(SPI_CLOCK_MAX)
|
||||
#define FCLK_SLOW() ONBOARD_SD_SPI.setClockDivider(SPI_BAUD_PCLK_DIV_256)
|
||||
|
||||
@@ -40,73 +40,53 @@
|
||||
#include <EEPROM.h>
|
||||
|
||||
// Store settings in the last two pages
|
||||
#define EEPROM_SIZE (EEPROM_PAGE_SIZE * 2)
|
||||
#define ACCESS_FINISHED(TF) do{ FLASH_Lock(); eeprom_dirty = false; return TF; }while(0)
|
||||
|
||||
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0};
|
||||
static bool eeprom_dirty = false;
|
||||
// Flash pages must be erased before writing, so keep track.
|
||||
bool firstWrite = false;
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
const uint32_t* source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
|
||||
uint32_t* destination = reinterpret_cast<uint32_t*>(ram_eeprom);
|
||||
|
||||
static_assert(0 == EEPROM_SIZE % 4, "EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe
|
||||
constexpr size_t eeprom_size_u32 = EEPROM_SIZE / 4;
|
||||
|
||||
for (size_t i = 0; i < eeprom_size_u32; ++i, ++destination, ++source)
|
||||
*destination = *source;
|
||||
|
||||
eeprom_dirty = false;
|
||||
firstWrite = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
|
||||
if (eeprom_dirty) {
|
||||
FLASH_Status status;
|
||||
|
||||
// Instead of erasing all (both) pages, maybe in the loop we check what page we are in, and if the
|
||||
// data has changed in that page. We then erase the first time we "detect" a change. In theory, if
|
||||
// nothing changed in a page, we wouldn't need to erase/write it.
|
||||
// Or, instead of checking at this point, turn eeprom_dirty into an array of bool the size of number
|
||||
// of pages. Inside write_data, we set the flag to true at that time if something in that
|
||||
// page changes...either way, something to look at later.
|
||||
FLASH_Unlock();
|
||||
|
||||
status = FLASH_ErasePage(EEPROM_PAGE0_BASE);
|
||||
if (status != FLASH_COMPLETE) ACCESS_FINISHED(true);
|
||||
status = FLASH_ErasePage(EEPROM_PAGE1_BASE);
|
||||
if (status != FLASH_COMPLETE) ACCESS_FINISHED(true);
|
||||
|
||||
const uint16_t *source = reinterpret_cast<const uint16_t*>(ram_eeprom);
|
||||
for (size_t i = 0; i < EEPROM_SIZE; i += 2, ++source) {
|
||||
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + i, *source) != FLASH_COMPLETE)
|
||||
ACCESS_FINISHED(false);
|
||||
}
|
||||
|
||||
ACCESS_FINISHED(true);
|
||||
}
|
||||
|
||||
FLASH_Lock();
|
||||
firstWrite = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
for (size_t i = 0; i < size; ++i) ram_eeprom[pos + i] = value[i];
|
||||
eeprom_dirty = true;
|
||||
FLASH_Status status;
|
||||
|
||||
if (firstWrite) {
|
||||
FLASH_Unlock();
|
||||
status = FLASH_ErasePage(EEPROM_PAGE0_BASE);
|
||||
if (status != FLASH_COMPLETE) return true;
|
||||
status = FLASH_ErasePage(EEPROM_PAGE1_BASE);
|
||||
if (status != FLASH_COMPLETE) return true;
|
||||
firstWrite = false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + (pos + i) * 2, value[i]) != FLASH_COMPLETE)
|
||||
return true;
|
||||
}
|
||||
|
||||
crc16(crc, value, size);
|
||||
pos += size;
|
||||
return false; // return true for any error
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
|
||||
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
|
||||
crc16(crc, buff, size);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
uint8_t v = *(uint16_t *)(EEPROM_PAGE0_BASE + (pos + i) * 2);
|
||||
if (writing) value[i] = v;
|
||||
crc16(crc, &v, 1);
|
||||
}
|
||||
pos += size;
|
||||
return false; // return true for any error
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
|
||||
size_t PersistentStore::capacity() { return size_t(E2END + 1); }
|
||||
|
||||
#endif // EEPROM_SETTINGS && EEPROM FLASH
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -57,7 +57,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
case 3: irq_num = NVIC_TIMER3; break;
|
||||
case 4: irq_num = NVIC_TIMER4; break;
|
||||
case 5: irq_num = NVIC_TIMER5; break;
|
||||
#ifdef STM32_HIGH_DENSITY
|
||||
#if ENABLED(STM32_HIGH_DENSITY)
|
||||
// 6 & 7 are basic timers, avoid them
|
||||
case 8: irq_num = NVIC_TIMER8_CC; break;
|
||||
#endif
|
||||
@@ -82,7 +82,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
timer_set_prescaler(STEP_TIMER_DEV, (uint16_t)(STEPPER_TIMER_PRESCALE - 1));
|
||||
timer_set_reload(STEP_TIMER_DEV, 0xFFFF);
|
||||
timer_oc_set_mode(STEP_TIMER_DEV, STEP_TIMER_CHAN, TIMER_OC_MODE_FROZEN, TIMER_OC_NO_PRELOAD); // no output pin change
|
||||
timer_set_compare(STEP_TIMER_DEV, STEP_TIMER_CHAN, _MIN(hal_timer_t(HAL_TIMER_TYPE_MAX), (STEPPER_TIMER_RATE) / frequency));
|
||||
timer_set_compare(STEP_TIMER_DEV, STEP_TIMER_CHAN, _MIN(hal_timer_t(HAL_TIMER_TYPE_MAX), (STEPPER_TIMER_RATE / frequency)));
|
||||
timer_no_ARR_preload_ARPE(STEP_TIMER_DEV); // Need to be sure no preload on ARR register
|
||||
timer_attach_interrupt(STEP_TIMER_DEV, STEP_TIMER_CHAN, stepTC_Handler);
|
||||
nvic_irq_set_priority(irq_num, STEP_TIMER_IRQ_PRIO);
|
||||
@@ -95,7 +95,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
timer_set_count(TEMP_TIMER_DEV, 0);
|
||||
timer_set_prescaler(TEMP_TIMER_DEV, (uint16_t)(TEMP_TIMER_PRESCALE - 1));
|
||||
timer_set_reload(TEMP_TIMER_DEV, 0xFFFF);
|
||||
timer_set_compare(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, _MIN(hal_timer_t(HAL_TIMER_TYPE_MAX), (F_CPU) / (TEMP_TIMER_PRESCALE) / frequency));
|
||||
timer_set_compare(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, _MIN(hal_timer_t(HAL_TIMER_TYPE_MAX), ((F_CPU / TEMP_TIMER_PRESCALE) / frequency)));
|
||||
timer_attach_interrupt(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, tempTC_Handler);
|
||||
nvic_irq_set_priority(irq_num, TEMP_TIMER_IRQ_PRIO);
|
||||
timer_generate_update(TEMP_TIMER_DEV);
|
||||
|
||||
@@ -47,20 +47,6 @@ typedef uint16_t hal_timer_t;
|
||||
#define STEP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
|
||||
#define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
|
||||
|
||||
/**
|
||||
* Note: Timers may be used by platforms and libraries
|
||||
*
|
||||
* FAN PWMs:
|
||||
* With FAN_SOFT_PWM disabled the Temperature class uses
|
||||
* FANx_PIN timers to generate FAN PWM signals.
|
||||
*
|
||||
* Speaker:
|
||||
* When SPEAKER is enabled, one timer is allocated by maple/tone.cpp.
|
||||
* - If BEEPER_PIN has a timer channel (and USE_PIN_TIMER is
|
||||
* defined in tone.cpp) it uses the pin's own timer.
|
||||
* - Otherwise it uses Timer 8 on boards with STM32_HIGH_DENSITY
|
||||
* or Timer 4 on other boards.
|
||||
*/
|
||||
#if defined(MCU_STM32F103CB) || defined(MCU_STM32F103C8)
|
||||
#define STEP_TIMER_NUM 4 // For C8/CB boards, use timer 4
|
||||
#else
|
||||
@@ -70,13 +56,9 @@ typedef uint16_t hal_timer_t;
|
||||
//#define TEMP_TIMER_NUM 4 // 2->4, Timer 2 for Stepper Current PWM
|
||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||
|
||||
#if MB(BTT_SKR_MINI_E3_V1_0, BIGTREE_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE)
|
||||
#if MB(BIGTREE_SKR_MINI_E3, BIGTREE_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE)
|
||||
// SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM.
|
||||
#ifdef STM32_HIGH_DENSITY
|
||||
#define SERVO0_TIMER_NUM 8 // tone.cpp uses Timer 4
|
||||
#else
|
||||
#define SERVO0_TIMER_NUM 3 // tone.cpp uses Timer 8
|
||||
#endif
|
||||
#define SERVO0_TIMER_NUM 8
|
||||
#else
|
||||
#define SERVO0_TIMER_NUM 1 // SERVO0 or BLTOUCH
|
||||
#endif
|
||||
|
||||
@@ -64,7 +64,7 @@ extern "C" {
|
||||
// return free memory between end of heap (or end bss) and whatever is current
|
||||
|
||||
/*
|
||||
#include <wirish/syscalls.c>
|
||||
#include "wirish/syscalls.c"
|
||||
//extern caddr_t _sbrk(int incr);
|
||||
#ifndef CONFIG_HEAP_END
|
||||
extern char _lm_heap_end;
|
||||
|
||||
@@ -24,16 +24,17 @@
|
||||
|
||||
#define CPU_32_BIT
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
#include "fastio.h"
|
||||
#include "timers.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
#include "timers.h"
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(STM32F4) && USBCON
|
||||
@@ -207,7 +208,6 @@ void eeprom_update_block (const void *__src, void *__dst, size_t __n);
|
||||
inline void HAL_adc_init() {}
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_result
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
//Error_Handler();
|
||||
}
|
||||
else {
|
||||
#if PIN_EXISTS(LED) && DISABLED(PINS_DEBUGGING)
|
||||
#if PIN_EXISTS(LED) && !ENABLED(PINS_DEBUGGING)
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -109,7 +109,6 @@ extern "C" {
|
||||
void HAL_adc_init();
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_get_result()
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
FTM0_SC = 0x00; // Set this to zero before changing the modulus
|
||||
FTM0_CNT = 0x0000; // Reset the count to zero
|
||||
FTM0_MOD = 0xFFFF; // max modulus = 65535
|
||||
FTM0_C0V = (FTM0_TIMER_RATE) / frequency; // Initial FTM Channel 0 compare value
|
||||
FTM0_C0V = FTM0_TIMER_RATE / frequency; // Initial FTM Channel 0 compare value
|
||||
FTM0_SC = (FTM_SC_CLKS(0b1) & FTM_SC_CLKS_MASK) | (FTM_SC_PS(FTM0_TIMER_PRESCALE_BITS) & FTM_SC_PS_MASK); // Bus clock 60MHz divided by prescaler 8
|
||||
FTM0_C0SC = FTM_CSC_CHIE | FTM_CSC_MSA | FTM_CSC_ELSA;
|
||||
break;
|
||||
@@ -62,7 +62,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
FTM1_SC = 0x00; // Set this to zero before changing the modulus
|
||||
FTM1_CNT = 0x0000; // Reset the count to zero
|
||||
FTM1_MOD = 0xFFFF; // max modulus = 65535
|
||||
FTM1_C0V = (FTM1_TIMER_RATE) / frequency; // Initial FTM Channel 0 compare value 65535
|
||||
FTM1_C0V = FTM1_TIMER_RATE / frequency; // Initial FTM Channel 0 compare value 65535
|
||||
FTM1_SC = (FTM_SC_CLKS(0b1) & FTM_SC_CLKS_MASK) | (FTM_SC_PS(FTM1_TIMER_PRESCALE_BITS) & FTM_SC_PS_MASK); // Bus clock 60MHz divided by prescaler 4
|
||||
FTM1_C0SC = FTM_CSC_CHIE | FTM_CSC_MSA | FTM_CSC_ELSA;
|
||||
break;
|
||||
|
||||
@@ -115,7 +115,6 @@ extern "C" {
|
||||
void HAL_adc_init();
|
||||
|
||||
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
#define HAL_READ_ADC() HAL_adc_get_result()
|
||||
#define HAL_ADC_READY() true
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
FTM0_SC = 0x00; // Set this to zero before changing the modulus
|
||||
FTM0_CNT = 0x0000; // Reset the count to zero
|
||||
FTM0_MOD = 0xFFFF; // max modulus = 65535
|
||||
FTM0_C0V = (FTM0_TIMER_RATE) / frequency; // Initial FTM Channel 0 compare value
|
||||
FTM0_C0V = FTM0_TIMER_RATE / frequency; // Initial FTM Channel 0 compare value
|
||||
FTM0_SC = (FTM_SC_CLKS(0b1) & FTM_SC_CLKS_MASK) | (FTM_SC_PS(FTM0_TIMER_PRESCALE_BITS) & FTM_SC_PS_MASK); // Bus clock 60MHz divided by prescaler 8
|
||||
FTM0_C0SC = FTM_CSC_CHIE | FTM_CSC_MSA | FTM_CSC_ELSA;
|
||||
break;
|
||||
@@ -63,7 +63,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
FTM1_SC = 0x00; // Set this to zero before changing the modulus
|
||||
FTM1_CNT = 0x0000; // Reset the count to zero
|
||||
FTM1_MOD = 0xFFFF; // max modulus = 65535
|
||||
FTM1_C0V = (FTM1_TIMER_RATE) / frequency; // Initial FTM Channel 0 compare value 65535
|
||||
FTM1_C0V = FTM1_TIMER_RATE / frequency; // Initial FTM Channel 0 compare value 65535
|
||||
FTM1_SC = (FTM_SC_CLKS(0b1) & FTM_SC_CLKS_MASK) | (FTM_SC_PS(FTM1_TIMER_PRESCALE_BITS) & FTM_SC_PS_MASK); // Bus clock 60MHz divided by prescaler 4
|
||||
FTM1_C0SC = FTM_CSC_CHIE | FTM_CSC_MSA | FTM_CSC_ELSA;
|
||||
break;
|
||||
|
||||
@@ -36,15 +36,14 @@
|
||||
|
||||
#if __CORTEX_M == 7
|
||||
|
||||
// Cortex-M3 through M7 can use the cycle counter of the DWT unit
|
||||
// Cortex-M7 can use the cycle counter of the DWT unit
|
||||
// http://www.anthonyvh.com/2017/05/18/cortex_m-cycle_counter/
|
||||
|
||||
FORCE_INLINE static void enableCycleCounter() {
|
||||
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||
|
||||
#if __CORTEX_M == 7
|
||||
DWT->LAR = 0xC5ACCE55; // Unlock DWT on the M7
|
||||
#endif
|
||||
// Unlock DWT.
|
||||
DWT->LAR = 0xC5ACCE55;
|
||||
|
||||
DWT->CYCCNT = 0;
|
||||
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "backtrace.h"
|
||||
|
||||
#if defined(__arm__) || defined(__thumb__)
|
||||
|
||||
#include "backtrace.h"
|
||||
#include "unwinder.h"
|
||||
#include "unwmemaccess.h"
|
||||
|
||||
|
||||
+79
-89
@@ -110,7 +110,7 @@
|
||||
#include "feature/I2CPositionEncoder.h"
|
||||
#endif
|
||||
|
||||
#if HAS_TRINAMIC && DISABLED(PSU_DEFAULT_OFF)
|
||||
#if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF)
|
||||
#include "feature/tmc_util.h"
|
||||
#endif
|
||||
|
||||
@@ -145,10 +145,6 @@
|
||||
#include "feature/power_loss_recovery.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
#include "feature/cancel_object.h"
|
||||
#endif
|
||||
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
#include "feature/runout.h"
|
||||
#endif
|
||||
@@ -181,16 +177,6 @@
|
||||
#include "libs/L6470/L6470_Marlin.h"
|
||||
#endif
|
||||
|
||||
const char NUL_STR[] PROGMEM = "",
|
||||
G28_STR[] PROGMEM = "G28",
|
||||
M21_STR[] PROGMEM = "M21",
|
||||
M23_STR[] PROGMEM = "M23 %s",
|
||||
M24_STR[] PROGMEM = "M24",
|
||||
SP_X_STR[] PROGMEM = " X",
|
||||
SP_Y_STR[] PROGMEM = " Y",
|
||||
SP_Z_STR[] PROGMEM = " Z",
|
||||
SP_E_STR[] PROGMEM = " E";
|
||||
|
||||
bool Running = true;
|
||||
|
||||
// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
|
||||
@@ -231,10 +217,10 @@ void setup_killpin() {
|
||||
|
||||
void setup_powerhold() {
|
||||
#if HAS_SUICIDE
|
||||
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
|
||||
OUT_WRITE(SUICIDE_PIN, HIGH);
|
||||
#endif
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
#if ENABLED(PSU_DEFAULT_OFF)
|
||||
#if HAS_POWER_SWITCH
|
||||
#if ENABLED(PS_DEFAULT_OFF)
|
||||
powersupply_on = true; PSU_OFF();
|
||||
#else
|
||||
powersupply_on = false; PSU_ON();
|
||||
@@ -290,8 +276,7 @@ void quickstop_stepper() {
|
||||
}
|
||||
|
||||
void enable_e_steppers() {
|
||||
#define _ENA_E(N) enable_E##N();
|
||||
REPEAT(E_STEPPERS, _ENA_E)
|
||||
enable_E0(); enable_E1(); enable_E2(); enable_E3(); enable_E4(); enable_E5();
|
||||
}
|
||||
|
||||
void enable_all_steppers() {
|
||||
@@ -305,14 +290,17 @@ void enable_all_steppers() {
|
||||
}
|
||||
|
||||
void disable_e_steppers() {
|
||||
#define _DIS_E(N) disable_E##N();
|
||||
REPEAT(E_STEPPERS, _DIS_E)
|
||||
disable_E0(); disable_E1(); disable_E2(); disable_E3(); disable_E4(); disable_E5();
|
||||
}
|
||||
|
||||
void disable_e_stepper(const uint8_t e) {
|
||||
#define _CASE_DIS_E(N) case N: disable_E##N(); break;
|
||||
switch (e) {
|
||||
REPEAT(EXTRUDERS, _CASE_DIS_E)
|
||||
case 0: disable_E0(); break;
|
||||
case 1: disable_E1(); break;
|
||||
case 2: disable_E2(); break;
|
||||
case 3: disable_E3(); break;
|
||||
case 4: disable_E4(); break;
|
||||
case 5: disable_E5(); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,67 +342,20 @@ void disable_all_steppers() {
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
#include "feature/pause.h"
|
||||
#else
|
||||
constexpr bool did_pause_print = false;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Printing is active when the print job timer is running
|
||||
*/
|
||||
bool printingIsActive() {
|
||||
return !did_pause_print && (print_job_timer.isRunning() || IS_SD_PRINTING());
|
||||
return print_job_timer.isRunning() || IS_SD_PRINTING();
|
||||
}
|
||||
|
||||
/**
|
||||
* Printing is paused according to SD or host indicators
|
||||
*/
|
||||
bool printingIsPaused() {
|
||||
return did_pause_print || print_job_timer.isPaused() || IS_SD_PAUSED();
|
||||
return print_job_timer.isPaused() || IS_SD_PAUSED();
|
||||
}
|
||||
|
||||
void startOrResumeJob() {
|
||||
if (!printingIsPaused()) {
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
cancelable.reset();
|
||||
#endif
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
e_move_accumulator = 0;
|
||||
#endif
|
||||
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
|
||||
ui.reset_remaining_time();
|
||||
#endif
|
||||
}
|
||||
print_job_timer.start();
|
||||
}
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
void abortSDPrinting() {
|
||||
card.stopSDPrint(
|
||||
#if SD_RESORT
|
||||
true
|
||||
#endif
|
||||
);
|
||||
queue.clear();
|
||||
quickstop_stepper();
|
||||
print_job_timer.stop();
|
||||
#if DISABLED(SD_ABORT_NO_COOLDOWN)
|
||||
thermalManager.disable_all_heaters();
|
||||
#endif
|
||||
thermalManager.zero_fan_speeds();
|
||||
wait_for_heatup = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
card.removeJobRecoveryFile();
|
||||
#endif
|
||||
#ifdef EVENT_GCODE_SD_STOP
|
||||
queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Manage several activities:
|
||||
* - Check for Filament Runout
|
||||
@@ -520,7 +461,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
if (ELAPSED(ms, next_home_key_ms)) {
|
||||
next_home_key_ms = ms + HOME_DEBOUNCE_DELAY;
|
||||
LCD_MESSAGEPGM(MSG_AUTO_HOME);
|
||||
queue.enqueue_now_P(G28_STR);
|
||||
queue.enqueue_now_P(PSTR("G28"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -552,11 +493,24 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
#else // !SWITCHING_EXTRUDER
|
||||
bool oldstatus;
|
||||
switch (active_extruder) {
|
||||
default:
|
||||
#define _CASE_EN(N) case N: oldstatus = E##N##_ENABLE_READ(); enable_E##N(); break;
|
||||
REPEAT(E_STEPPERS, _CASE_EN);
|
||||
default: oldstatus = E0_ENABLE_READ(); enable_E0(); break;
|
||||
#if E_STEPPERS > 1
|
||||
case 1: oldstatus = E1_ENABLE_READ(); enable_E1(); break;
|
||||
#if E_STEPPERS > 2
|
||||
case 2: oldstatus = E2_ENABLE_READ(); enable_E2(); break;
|
||||
#if E_STEPPERS > 3
|
||||
case 3: oldstatus = E3_ENABLE_READ(); enable_E3(); break;
|
||||
#if E_STEPPERS > 4
|
||||
case 4: oldstatus = E4_ENABLE_READ(); enable_E4(); break;
|
||||
#if E_STEPPERS > 5
|
||||
case 5: oldstatus = E5_ENABLE_READ(); enable_E5(); break;
|
||||
#endif // E_STEPPERS > 5
|
||||
#endif // E_STEPPERS > 4
|
||||
#endif // E_STEPPERS > 3
|
||||
#endif // E_STEPPERS > 2
|
||||
#endif // E_STEPPERS > 1
|
||||
}
|
||||
#endif
|
||||
#endif // !SWITCHING_EXTRUDER
|
||||
|
||||
const float olde = current_position.e;
|
||||
current_position.e += EXTRUDER_RUNOUT_EXTRUDE;
|
||||
@@ -577,8 +531,22 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
}
|
||||
#else // !SWITCHING_EXTRUDER
|
||||
switch (active_extruder) {
|
||||
#define _CASE_RESTORE(N) case N: E##N##_ENABLE_WRITE(oldstatus); break;
|
||||
REPEAT(E_STEPPERS, _CASE_RESTORE);
|
||||
case 0: E0_ENABLE_WRITE(oldstatus); break;
|
||||
#if E_STEPPERS > 1
|
||||
case 1: E1_ENABLE_WRITE(oldstatus); break;
|
||||
#if E_STEPPERS > 2
|
||||
case 2: E2_ENABLE_WRITE(oldstatus); break;
|
||||
#if E_STEPPERS > 3
|
||||
case 3: E3_ENABLE_WRITE(oldstatus); break;
|
||||
#if E_STEPPERS > 4
|
||||
case 4: E4_ENABLE_WRITE(oldstatus); break;
|
||||
#if E_STEPPERS > 5
|
||||
case 5: E5_ENABLE_WRITE(oldstatus); break;
|
||||
#endif // E_STEPPERS > 5
|
||||
#endif // E_STEPPERS > 4
|
||||
#endif // E_STEPPERS > 3
|
||||
#endif // E_STEPPERS > 2
|
||||
#endif // E_STEPPERS > 1
|
||||
}
|
||||
#endif // !SWITCHING_EXTRUDER
|
||||
|
||||
@@ -601,7 +569,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
monitor_tmc_drivers();
|
||||
monitor_tmc_driver();
|
||||
#endif
|
||||
|
||||
#if ENABLED(MONITOR_L6470_DRIVER_STATUS)
|
||||
@@ -724,7 +692,7 @@ void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr
|
||||
SERIAL_ERROR_MSG(MSG_ERR_KILLED);
|
||||
|
||||
#if HAS_DISPLAY
|
||||
ui.kill_screen(lcd_error ?: GET_TEXT(MSG_KILLED), lcd_component ?: NUL_STR);
|
||||
ui.kill_screen(lcd_error ?: GET_TEXT(MSG_KILLED), lcd_component);
|
||||
#else
|
||||
UNUSED(lcd_error);
|
||||
UNUSED(lcd_component);
|
||||
@@ -753,7 +721,7 @@ void minkill(const bool steppers_off/*=false*/) {
|
||||
// Power off all steppers (for M112) or just the E steppers
|
||||
steppers_off ? disable_all_steppers() : disable_e_steppers();
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
#if HAS_POWER_SWITCH
|
||||
PSU_OFF();
|
||||
#endif
|
||||
|
||||
@@ -933,6 +901,8 @@ void setup() {
|
||||
#endif
|
||||
|
||||
ui.init();
|
||||
ui.reset_status();
|
||||
|
||||
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
|
||||
ui.show_bootscreen();
|
||||
#endif
|
||||
@@ -961,8 +931,6 @@ void setup() {
|
||||
|
||||
print_job_timer.init(); // Initial setup of print job timer
|
||||
|
||||
ui.reset_status(); // Print startup message after print statistics are loaded
|
||||
|
||||
endstops.init(); // Init endstops and pullups
|
||||
|
||||
stepper.init(); // Init stepper. This enables interrupts!
|
||||
@@ -1110,7 +1078,7 @@ void setup() {
|
||||
host_action_prompt_end();
|
||||
#endif
|
||||
|
||||
#if HAS_TRINAMIC && DISABLED(PSU_DEFAULT_OFF)
|
||||
#if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF)
|
||||
test_tmc_connection(true, true, true, true);
|
||||
#endif
|
||||
|
||||
@@ -1134,12 +1102,34 @@ void loop() {
|
||||
idle(); // Do an idle first so boot is slightly faster
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
card.checkautostart();
|
||||
if (card.flag.abort_sd_printing) abortSDPrinting();
|
||||
#endif
|
||||
|
||||
if (card.flag.abort_sd_printing) {
|
||||
card.stopSDPrint(
|
||||
#if SD_RESORT
|
||||
true
|
||||
#endif
|
||||
);
|
||||
queue.clear();
|
||||
quickstop_stepper();
|
||||
print_job_timer.stop();
|
||||
#if DISABLED(SD_ABORT_NO_COOLDOWN)
|
||||
thermalManager.disable_all_heaters();
|
||||
#endif
|
||||
thermalManager.zero_fan_speeds();
|
||||
wait_for_heatup = false;
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
card.removeJobRecoveryFile();
|
||||
#endif
|
||||
#ifdef EVENT_GCODE_SD_STOP
|
||||
queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
queue.advance();
|
||||
|
||||
endstops.event_handler();
|
||||
}
|
||||
}
|
||||
|
||||
+108
-112
@@ -51,96 +51,96 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
//
|
||||
#if AXIS_DRIVER_TYPE_X(L6470)
|
||||
extern L6470 stepperX;
|
||||
#define X_enable() NOOP
|
||||
#define X_disable() stepperX.free()
|
||||
#define X_enable NOOP
|
||||
#define X_disable stepperX.free()
|
||||
#elif HAS_X_ENABLE
|
||||
#define X_enable() X_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X_disable() X_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#define X_enable X_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X_disable X_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define X_enable() NOOP
|
||||
#define X_disable() NOOP
|
||||
#define X_enable NOOP
|
||||
#define X_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_X2(L6470)
|
||||
extern L6470 stepperX2;
|
||||
#define X2_enable() NOOP
|
||||
#define X2_disable() stepperX2.free()
|
||||
#define X2_enable NOOP
|
||||
#define X2_disable stepperX2.free()
|
||||
#elif HAS_X2_ENABLE
|
||||
#define X2_enable() X2_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X2_disable() X2_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#define X2_enable X2_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#define X2_disable X2_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define X2_enable() NOOP
|
||||
#define X2_disable() NOOP
|
||||
#define X2_enable NOOP
|
||||
#define X2_disable NOOP
|
||||
#endif
|
||||
|
||||
#define enable_X() do{ X_enable(); X2_enable(); }while(0)
|
||||
#define disable_X() do{ X_disable(); X2_disable(); CBI(axis_known_position, X_AXIS); }while(0)
|
||||
#define enable_X() do{ X_enable; X2_enable; }while(0)
|
||||
#define disable_X() do{ X_disable; X2_disable; CBI(axis_known_position, X_AXIS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y(L6470)
|
||||
extern L6470 stepperY;
|
||||
#define Y_enable() NOOP
|
||||
#define Y_disable() stepperY.free()
|
||||
#define Y_enable NOOP
|
||||
#define Y_disable stepperY.free()
|
||||
#elif HAS_Y_ENABLE
|
||||
#define Y_enable() Y_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y_disable() Y_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#define Y_enable Y_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y_disable Y_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define Y_enable() NOOP
|
||||
#define Y_disable() NOOP
|
||||
#define Y_enable NOOP
|
||||
#define Y_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Y2(L6470)
|
||||
extern L6470 stepperY2;
|
||||
#define Y2_enable() NOOP
|
||||
#define Y2_disable() stepperY2.free()
|
||||
#define Y2_enable NOOP
|
||||
#define Y2_disable stepperY2.free()
|
||||
#elif HAS_Y2_ENABLE
|
||||
#define Y2_enable() Y2_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y2_disable() Y2_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#define Y2_enable Y2_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#define Y2_disable Y2_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define Y2_enable() NOOP
|
||||
#define Y2_disable() NOOP
|
||||
#define Y2_enable NOOP
|
||||
#define Y2_disable NOOP
|
||||
#endif
|
||||
|
||||
#define enable_Y() do{ Y_enable(); Y2_enable(); }while(0)
|
||||
#define disable_Y() do{ Y_disable(); Y2_disable(); CBI(axis_known_position, Y_AXIS); }while(0)
|
||||
#define enable_Y() do{ Y_enable; Y2_enable; }while(0)
|
||||
#define disable_Y() do{ Y_disable; Y2_disable; CBI(axis_known_position, Y_AXIS); }while(0)
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z(L6470)
|
||||
extern L6470 stepperZ;
|
||||
#define Z_enable() NOOP
|
||||
#define Z_disable() stepperZ.free()
|
||||
#define Z_enable NOOP
|
||||
#define Z_disable stepperZ.free()
|
||||
#elif HAS_Z_ENABLE
|
||||
#define Z_enable() Z_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z_disable() Z_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#define Z_enable Z_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z_disable Z_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z_enable() NOOP
|
||||
#define Z_disable() NOOP
|
||||
#define Z_enable NOOP
|
||||
#define Z_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z2(L6470)
|
||||
extern L6470 stepperZ2;
|
||||
#define Z2_enable() NOOP
|
||||
#define Z2_disable() stepperZ2.free()
|
||||
#define Z2_enable NOOP
|
||||
#define Z2_disable stepperZ2.free()
|
||||
#elif HAS_Z2_ENABLE
|
||||
#define Z2_enable() Z2_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z2_disable() Z2_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#define Z2_enable Z2_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z2_disable Z2_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z2_enable() NOOP
|
||||
#define Z2_disable() NOOP
|
||||
#define Z2_enable NOOP
|
||||
#define Z2_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_Z3(L6470)
|
||||
extern L6470 stepperZ3;
|
||||
#define Z3_enable() NOOP
|
||||
#define Z3_disable() stepperZ3.free()
|
||||
#define Z3_enable NOOP
|
||||
#define Z3_disable stepperZ3.free()
|
||||
#elif HAS_Z3_ENABLE
|
||||
#define Z3_enable() Z3_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z3_disable() Z3_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#define Z3_enable Z3_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#define Z3_disable Z3_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define Z3_enable() NOOP
|
||||
#define Z3_disable() NOOP
|
||||
#define Z3_enable NOOP
|
||||
#define Z3_disable NOOP
|
||||
#endif
|
||||
|
||||
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)
|
||||
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)
|
||||
#define enable_Z() do{ Z_enable; Z2_enable; Z3_enable; }while(0)
|
||||
#define disable_Z() do{ Z_disable; Z2_disable; Z3_disable; CBI(axis_known_position, Z_AXIS); }while(0)
|
||||
|
||||
//
|
||||
// Extruder Stepper enable / disable
|
||||
@@ -149,74 +149,74 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
// define the individual enables/disables
|
||||
#if AXIS_DRIVER_TYPE_E0(L6470)
|
||||
extern L6470 stepperE0;
|
||||
#define E0_enable() NOOP
|
||||
#define E0_disable() do{ stepperE0.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#define E0_enable NOOP
|
||||
#define E0_disable do{ stepperE0.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif HAS_E0_ENABLE
|
||||
#define E0_enable() E0_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E0_disable() E0_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#define E0_enable E0_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E0_disable E0_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E0_enable() NOOP
|
||||
#define E0_disable() NOOP
|
||||
#define E0_enable NOOP
|
||||
#define E0_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E1(L6470)
|
||||
extern L6470 stepperE1;
|
||||
#define E1_enable() NOOP
|
||||
#define E1_disable() do{ stepperE1.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#define E1_enable NOOP
|
||||
#define E1_disable do{ stepperE1.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 1 && HAS_E1_ENABLE
|
||||
#define E1_enable() E1_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E1_disable() E1_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#define E1_enable E1_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E1_disable E1_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E1_enable() NOOP
|
||||
#define E1_disable() NOOP
|
||||
#define E1_enable NOOP
|
||||
#define E1_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E2(L6470)
|
||||
extern L6470 stepperE2;
|
||||
#define E2_enable() NOOP
|
||||
#define E2_disable() do{ stepperE2.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#define E2_enable NOOP
|
||||
#define E2_disable do{ stepperE2.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 2 && HAS_E2_ENABLE
|
||||
#define E2_enable() E2_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E2_disable() E2_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#define E2_enable E2_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E2_disable E2_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E2_enable() NOOP
|
||||
#define E2_disable() NOOP
|
||||
#define E2_enable NOOP
|
||||
#define E2_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E3(L6470)
|
||||
extern L6470 stepperE3;
|
||||
#define E3_enable() NOOP
|
||||
#define E3_disable() do{ stepperE3.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#define E3_enable NOOP
|
||||
#define E3_disable do{ stepperE3.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 3 && HAS_E3_ENABLE
|
||||
#define E3_enable() E3_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E3_disable() E3_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#define E3_enable E3_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E3_disable E3_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E3_enable() NOOP
|
||||
#define E3_disable() NOOP
|
||||
#define E3_enable NOOP
|
||||
#define E3_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E4(L6470)
|
||||
extern L6470 stepperE4;
|
||||
#define E4_enable() NOOP
|
||||
#define E4_disable() do{ stepperE4.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#define E4_enable NOOP
|
||||
#define E4_disable do{ stepperE4.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 4 && HAS_E4_ENABLE
|
||||
#define E4_enable() E4_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E4_disable() E4_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#define E4_enable E4_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E4_disable E4_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E4_enable() NOOP
|
||||
#define E4_disable() NOOP
|
||||
#define E4_enable NOOP
|
||||
#define E4_disable NOOP
|
||||
#endif
|
||||
|
||||
#if AXIS_DRIVER_TYPE_E5(L6470)
|
||||
extern L6470 stepperE5;
|
||||
#define E5_enable() NOOP
|
||||
#define E5_disable() do{ stepperE5.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#define E5_enable NOOP
|
||||
#define E5_disable do{ stepperE5.free(); CBI(axis_known_position, E_AXIS); }while(0)
|
||||
#elif E_STEPPERS > 5 && HAS_E5_ENABLE
|
||||
#define E5_enable() E5_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E5_disable() E5_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#define E5_enable E5_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#define E5_disable E5_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define E5_enable() NOOP
|
||||
#define E5_disable() NOOP
|
||||
#define E5_enable NOOP
|
||||
#define E5_disable NOOP
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
@@ -225,20 +225,20 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
* Mixing steppers synchronize their enable (and direction) together
|
||||
*/
|
||||
#if MIXING_STEPPERS > 5
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); E4_enable(); E5_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); E4_disable(); E5_disable(); }
|
||||
#define enable_E0() { E0_enable; E1_enable; E2_enable; E3_enable; E4_enable; E5_enable; }
|
||||
#define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; E4_disable; E5_disable; }
|
||||
#elif MIXING_STEPPERS > 4
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); E4_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); E4_disable(); }
|
||||
#define enable_E0() { E0_enable; E1_enable; E2_enable; E3_enable; E4_enable; }
|
||||
#define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; E4_disable; }
|
||||
#elif MIXING_STEPPERS > 3
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); E3_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); E3_disable(); }
|
||||
#define enable_E0() { E0_enable; E1_enable; E2_enable; E3_enable; }
|
||||
#define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; }
|
||||
#elif MIXING_STEPPERS > 2
|
||||
#define enable_E0() { E0_enable(); E1_enable(); E2_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); E2_disable(); }
|
||||
#define enable_E0() { E0_enable; E1_enable; E2_enable; }
|
||||
#define disable_E0() { E0_disable; E1_disable; E2_disable; }
|
||||
#else
|
||||
#define enable_E0() { E0_enable(); E1_enable(); }
|
||||
#define disable_E0() { E0_disable(); E1_disable(); }
|
||||
#define enable_E0() { E0_enable; E1_enable; }
|
||||
#define disable_E0() { E0_disable; E1_disable; }
|
||||
#endif
|
||||
#define enable_E1() NOOP
|
||||
#define disable_E1() NOOP
|
||||
@@ -254,48 +254,48 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
#else // !MIXING_EXTRUDER
|
||||
|
||||
#if HAS_E0_ENABLE
|
||||
#define enable_E0() E0_enable()
|
||||
#define disable_E0() E0_disable()
|
||||
#define enable_E0() E0_enable
|
||||
#define disable_E0() E0_disable
|
||||
#else
|
||||
#define enable_E0() NOOP
|
||||
#define disable_E0() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 1 && HAS_E1_ENABLE
|
||||
#define enable_E1() E1_enable()
|
||||
#define disable_E1() E1_disable()
|
||||
#define enable_E1() E1_enable
|
||||
#define disable_E1() E1_disable
|
||||
#else
|
||||
#define enable_E1() NOOP
|
||||
#define disable_E1() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 2 && HAS_E2_ENABLE
|
||||
#define enable_E2() E2_enable()
|
||||
#define disable_E2() E2_disable()
|
||||
#define enable_E2() E2_enable
|
||||
#define disable_E2() E2_disable
|
||||
#else
|
||||
#define enable_E2() NOOP
|
||||
#define disable_E2() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 3 && HAS_E3_ENABLE
|
||||
#define enable_E3() E3_enable()
|
||||
#define disable_E3() E3_disable()
|
||||
#define enable_E3() E3_enable
|
||||
#define disable_E3() E3_disable
|
||||
#else
|
||||
#define enable_E3() NOOP
|
||||
#define disable_E3() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 4 && HAS_E4_ENABLE
|
||||
#define enable_E4() E4_enable()
|
||||
#define disable_E4() E4_disable()
|
||||
#define enable_E4() E4_enable
|
||||
#define disable_E4() E4_disable
|
||||
#else
|
||||
#define enable_E4() NOOP
|
||||
#define disable_E4() NOOP
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS > 5 && HAS_E5_ENABLE
|
||||
#define enable_E5() E5_enable()
|
||||
#define disable_E5() E5_disable()
|
||||
#define enable_E5() E5_enable
|
||||
#define disable_E5() E5_disable
|
||||
#else
|
||||
#define enable_E5() NOOP
|
||||
#define disable_E5() NOOP
|
||||
@@ -333,7 +333,6 @@ inline bool IsStopped() { return !Running; }
|
||||
|
||||
bool printingIsActive();
|
||||
bool printingIsPaused();
|
||||
void startOrResumeJob();
|
||||
|
||||
extern bool wait_for_heatup;
|
||||
|
||||
@@ -352,7 +351,7 @@ extern millis_t max_inactive_time, stepper_inactive_time;
|
||||
extern uint8_t controllerfan_speed;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
#if HAS_POWER_SWITCH
|
||||
extern bool powersupply_on;
|
||||
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_HIGH); powersupply_on = true; }while(0)
|
||||
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_HIGH); powersupply_on = false; }while(0)
|
||||
@@ -369,13 +368,10 @@ bool pin_is_protected(const pin_t pin);
|
||||
void protected_pin_err();
|
||||
|
||||
#if HAS_SUICIDE
|
||||
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
|
||||
inline void suicide() { OUT_WRITE(SUICIDE_PIN, LOW); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(G29_RETRY_AND_RECOVER)
|
||||
void event_probe_recover();
|
||||
void event_probe_failure();
|
||||
#endif
|
||||
|
||||
extern const char NUL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
|
||||
SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];
|
||||
|
||||
+19
-34
@@ -64,7 +64,7 @@
|
||||
#define BOARD_MKS_BASE_HEROIC 1108 // MKS BASE 1.0 with Heroic HR4982 stepper drivers
|
||||
#define BOARD_MKS_GEN_13 1109 // MKS GEN v1.3 or 1.4
|
||||
#define BOARD_MKS_GEN_L 1110 // MKS GEN L
|
||||
#define BOARD_KFB_2 1111 // BigTreeTech or BIQU KFB2.0
|
||||
#define BOARD_KFB_2 1111 // Bigtreetech or BIQU KFB2.0
|
||||
#define BOARD_ZRIB_V20 1112 // zrib V2.0 control board (Chinese knock off RAMPS replica)
|
||||
#define BOARD_FELIX2 1113 // Felix 2.0+ Electronics Board (RAMPS like)
|
||||
#define BOARD_RIGIDBOARD 1114 // Invent-A-Part RigidBoard
|
||||
@@ -99,8 +99,6 @@
|
||||
#define BOARD_OVERLORD 1143 // Overlord/Overlord Pro
|
||||
#define BOARD_HJC2560C_REV1 1144 // ADIMLab Gantry v1
|
||||
#define BOARD_HJC2560C_REV2 1145 // ADIMLab Gantry v2
|
||||
#define BOARD_TANGO 1146 // BIQU Tango V1
|
||||
#define BOARD_MKS_GEN_L_V2 1147 // MKS GEN L V2
|
||||
|
||||
//
|
||||
// RAMBo and derivatives
|
||||
@@ -208,15 +206,14 @@
|
||||
#define BOARD_COHESION3D_MINI 2011 // Cohesion3D Mini
|
||||
#define BOARD_SMOOTHIEBOARD 2012 // Smoothieboard
|
||||
#define BOARD_AZTEEG_X5_MINI_WIFI 2013 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_BIQU_B300_V1_0 2014 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
|
||||
#define BOARD_AZTEEG_X5_MINI 2015 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_MKS_SGEN 2016 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_MKS_SGEN_L 2017 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_TH3D_EZBOARD 2018 // TH3D EZBoard v1.0
|
||||
#define BOARD_GMARSH_X6_REV1 2019 // GMARSH X6 board, revision 1 prototype
|
||||
#define BOARD_BIGTREE_SKR_V1_1 2020 // BigTreeTech SKR v1.1 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_BIGTREE_SKR_V1_3 2021 // BigTreeTech SKR v1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_BIGTREE_SKR_V1_4 2022 // BigTreeTech SKR v1.4 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_BIGTREE_SKR_V1_1 2014 // BIGTREE SKR_V1.1 (Power outputs: Hotend0,Hotend1, Fan, Bed)
|
||||
#define BOARD_BIQU_B300_V1_0 2015 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
|
||||
#define BOARD_BIGTREE_SKR_V1_3 2016 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
|
||||
#define BOARD_AZTEEG_X5_MINI 2017 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
|
||||
#define BOARD_MKS_SGEN 2018 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_MKS_SGEN_L 2019 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan)
|
||||
#define BOARD_TH3D_EZBOARD 2020 // TH3D EZBoard v1.0
|
||||
#define BOARD_GMARSH_X6_REV1 2021 // GMARSH X6 board, revision 1 prototype
|
||||
|
||||
//
|
||||
// SAM3X8E ARM Cortex M3
|
||||
@@ -270,21 +267,15 @@
|
||||
#define BOARD_MKS_ROBIN_MINI 4007 // MKS Robin Mini (STM32F103VET6)
|
||||
#define BOARD_MKS_ROBIN_NANO 4008 // MKS Robin Nano (STM32F103VET6)
|
||||
#define BOARD_MKS_ROBIN_LITE 4009 // MKS Robin Lite/Lite2 (STM32F103RCT6)
|
||||
#define BOARD_MKS_ROBIN_LITE3 4010 // MKS Robin Lite3 (STM32F103RCT6)
|
||||
#define BOARD_MKS_ROBIN_PRO 4011 // MKS Robin Pro (STM32F103ZET6)
|
||||
#define BOARD_BIGTREE_SKR_MINI_V1_1 4012 // BigTreeTech SKR Mini v1.1 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_MINI_E3_V1_0 4013 // BigTreeTech SKR Mini E3 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_MINI_E3_V1_2 4014 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
|
||||
#define BOARD_BIGTREE_SKR_E3_DIP 4015 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
|
||||
#define BOARD_JGAURORA_A5S_A1 4016 // JGAurora A5S A1 (STM32F103ZET6)
|
||||
#define BOARD_FYSETC_AIO_II 4017 // FYSETC AIO_II
|
||||
#define BOARD_FYSETC_CHEETAH 4018 // FYSETC Cheetah
|
||||
#define BOARD_FYSETC_CHEETAH_V12 4019 // FYSETC Cheetah V1.2
|
||||
#define BOARD_LONGER3D_LK 4020 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
|
||||
#define BOARD_GTM32_MINI 4021 // STM32F103VET6 controller
|
||||
#define BOARD_GTM32_MINI_A30 4022 // STM32F103VET6 controller
|
||||
#define BOARD_GTM32_REV_B 4023 // STM32F103VET6 controller
|
||||
|
||||
#define BOARD_BIGTREE_SKR_MINI_V1_1 4010 // BigTreeTech SKR Mini v1.1 (STM32F103RC)
|
||||
#define BOARD_BIGTREE_SKR_MINI_E3 4011 // BigTreeTech SKR Mini E3 (STM32F103RC)
|
||||
#define BOARD_BIGTREE_SKR_E3_DIP 4012 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC)
|
||||
#define BOARD_BTT_SKR_MINI_E3_V1_2 4013 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
|
||||
#define BOARD_JGAURORA_A5S_A1 4014 // JGAurora A5S A1 (STM32F103ZET6)
|
||||
#define BOARD_FYSETC_AIO_II 4015 // FYSETC AIO_II
|
||||
#define BOARD_FYSETC_CHEETAH 4016 // FYSETC Cheetah
|
||||
#define BOARD_FYSETC_CHEETAH_V12 4017 // FYSETC Cheetah V1.2
|
||||
#define BOARD_LONGER3D_LK 4018 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
|
||||
|
||||
//
|
||||
// ARM Cortex-M4F
|
||||
@@ -298,7 +289,7 @@
|
||||
//
|
||||
|
||||
#define BOARD_BEAST 4200 // STM32F4xxVxT6 Libmaple-based STM32F4 controller
|
||||
#define BOARD_GENERIC_STM32F4 4201 // STM32 STM32GENERIC-based STM32F4 controller
|
||||
#define BOARD_STM32F4 4201 // STM32 STM32GENERIC-based STM32F4 controller
|
||||
#define BOARD_ARMED 4202 // Arm'ed STM32F4-based controller
|
||||
#define BOARD_RUMBA32 4203 // RUMBA32 STM32F4-based controller
|
||||
#define BOARD_BLACK_STM32F407VE 4204 // BLACK_STM32F407VE
|
||||
@@ -308,10 +299,6 @@
|
||||
#define BOARD_BIGTREE_BTT002_V1_0 4208 // BigTreeTech BTT002 v1.0 (STM32F407VE)
|
||||
#define BOARD_LERDGE_K 4209 // Lerdge K (STM32F407ZG)
|
||||
#define BOARD_LERDGE_X 4210 // Lerdge X (STM32F407VE)
|
||||
#define BOARD_VAKE403D 4211 // VAkE 403D (STM32F446VET6)
|
||||
#define BOARD_FYSETC_S6 4212 // FYSETC S6 board
|
||||
#define BOARD_FLYF407ZG 4213 // FLYF407ZG board (STM32F407ZG)
|
||||
#define BOARD_MKS_ROBIN2 4214 // MKS_ROBIN2 (STM32F407ZE)
|
||||
|
||||
//
|
||||
// ARM Cortex M7
|
||||
@@ -324,8 +311,6 @@
|
||||
// Espressif ESP32 WiFi
|
||||
//
|
||||
#define BOARD_ESPRESSIF_ESP32 6000
|
||||
#define BOARD_MRR_ESPA 6001
|
||||
#define BOARD_MRR_ESPE 6002
|
||||
|
||||
//
|
||||
// Simulations
|
||||
|
||||
+20
-31
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
//
|
||||
// Serial aliases for debugging.
|
||||
@@ -36,13 +37,9 @@
|
||||
#undef DEBUG_ECHOPGM
|
||||
#undef DEBUG_ECHOLNPGM
|
||||
#undef DEBUG_ECHOPAIR
|
||||
#undef DEBUG_ECHOPAIR_P
|
||||
#undef DEBUG_ECHOPAIR_F
|
||||
#undef DEBUG_ECHOPAIR_F_P
|
||||
#undef DEBUG_ECHOLNPAIR
|
||||
#undef DEBUG_ECHOLNPAIR_P
|
||||
#undef DEBUG_ECHOLNPAIR_F
|
||||
#undef DEBUG_ECHOLNPAIR_F_P
|
||||
#undef DEBUG_ECHO_MSG
|
||||
#undef DEBUG_ERROR_MSG
|
||||
#undef DEBUG_EOL
|
||||
@@ -61,13 +58,9 @@
|
||||
#define DEBUG_ECHOPGM SERIAL_ECHOPGM
|
||||
#define DEBUG_ECHOLNPGM SERIAL_ECHOLNPGM
|
||||
#define DEBUG_ECHOPAIR SERIAL_ECHOPAIR
|
||||
#define DEBUG_ECHOPAIR_P SERIAL_ECHOPAIR_P
|
||||
#define DEBUG_ECHOPAIR_F SERIAL_ECHOPAIR_F
|
||||
#define DEBUG_ECHOPAIR_F_P SERIAL_ECHOPAIR_F_P
|
||||
#define DEBUG_ECHOLNPAIR SERIAL_ECHOLNPAIR
|
||||
#define DEBUG_ECHOLNPAIR_P SERIAL_ECHOLNPAIR_P
|
||||
#define DEBUG_ECHOLNPAIR_F SERIAL_ECHOLNPAIR_F
|
||||
#define DEBUG_ECHOLNPAIR_F_P SERIAL_ECHOLNPAIR_F_P
|
||||
#define DEBUG_ECHO_MSG SERIAL_ECHO_MSG
|
||||
#define DEBUG_ERROR_MSG SERIAL_ERROR_MSG
|
||||
#define DEBUG_EOL SERIAL_EOL
|
||||
@@ -75,29 +68,25 @@
|
||||
#define DEBUG_XYZ SERIAL_XYZ
|
||||
#define DEBUG_DELAY(ms) serial_delay(ms)
|
||||
#else
|
||||
#define DEBUG_PRINT_P(P) NOOP
|
||||
#define DEBUG_ECHO_START() NOOP
|
||||
#define DEBUG_ERROR_START() NOOP
|
||||
#define DEBUG_CHAR(...) NOOP
|
||||
#define DEBUG_ECHO(...) NOOP
|
||||
#define DEBUG_ECHO_F(...) NOOP
|
||||
#define DEBUG_ECHOLN(...) NOOP
|
||||
#define DEBUG_ECHOPGM(...) NOOP
|
||||
#define DEBUG_ECHOLNPGM(...) NOOP
|
||||
#define DEBUG_ECHOPAIR(...) NOOP
|
||||
#define DEBUG_ECHOPAIR_P(...) NOOP
|
||||
#define DEBUG_ECHOPAIR_F(...) NOOP
|
||||
#define DEBUG_ECHOPAIR_F_P(...) NOOP
|
||||
#define DEBUG_ECHOLNPAIR(...) NOOP
|
||||
#define DEBUG_ECHOLNPAIR_P(...) NOOP
|
||||
#define DEBUG_ECHOLNPAIR_F(...) NOOP
|
||||
#define DEBUG_ECHOLNPAIR_F_P(...) NOOP
|
||||
#define DEBUG_ECHO_MSG(...) NOOP
|
||||
#define DEBUG_ERROR_MSG(...) NOOP
|
||||
#define DEBUG_EOL() NOOP
|
||||
#define DEBUG_POS(...) NOOP
|
||||
#define DEBUG_XYZ(...) NOOP
|
||||
#define DEBUG_DELAY(...) NOOP
|
||||
#define DEBUG_PRINT_P(P) NOOP
|
||||
#define DEBUG_ECHO_START() NOOP
|
||||
#define DEBUG_ERROR_START() NOOP
|
||||
#define DEBUG_CHAR(...) NOOP
|
||||
#define DEBUG_ECHO(...) NOOP
|
||||
#define DEBUG_ECHO_F(...) NOOP
|
||||
#define DEBUG_ECHOLN(...) NOOP
|
||||
#define DEBUG_ECHOPGM(...) NOOP
|
||||
#define DEBUG_ECHOLNPGM(...) NOOP
|
||||
#define DEBUG_ECHOPAIR(...) NOOP
|
||||
#define DEBUG_ECHOPAIR_F(...) NOOP
|
||||
#define DEBUG_ECHOLNPAIR(...) NOOP
|
||||
#define DEBUG_ECHOLNPAIR_F(...) NOOP
|
||||
#define DEBUG_ECHO_MSG(...) NOOP
|
||||
#define DEBUG_ERROR_MSG(...) NOOP
|
||||
#define DEBUG_EOL() NOOP
|
||||
#define DEBUG_POS(...) NOOP
|
||||
#define DEBUG_XYZ(...) NOOP
|
||||
#define DEBUG_DELAY(...) NOOP
|
||||
#endif
|
||||
|
||||
#undef DEBUG_OUT
|
||||
|
||||
@@ -121,19 +121,6 @@
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|
||||
|| AXIS_DRIVER_TYPE(A,TMC5160) )
|
||||
|
||||
#define HAS_TMC_E_DRIVER ( HAS_E_DRIVER(TMC2130) \
|
||||
|| HAS_E_DRIVER(TMC2160) \
|
||||
|| HAS_E_DRIVER(TMC2660) \
|
||||
|| HAS_E_DRIVER(TMC2209) \
|
||||
|| HAS_E_DRIVER(TMC5130) \
|
||||
|| HAS_E_DRIVER(TMC5160) )
|
||||
|
||||
#define HAS_TMC_STANDALONE_E_DRIVER ( HAS_E_DRIVER(TMC2130_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC2160_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC2660_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC2209_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC5130_STANDALONE) \
|
||||
|| HAS_E_DRIVER(TMC5160_STANDALONE) )
|
||||
//
|
||||
// Stretching 'drivers.h' to include LPC/SAMD51 SD options
|
||||
//
|
||||
|
||||
@@ -252,15 +252,15 @@
|
||||
#define MSG_FILAMENT_CHANGE_INSERT_M108 "Insert filament and send M108"
|
||||
#define MSG_FILAMENT_CHANGE_WAIT_M108 "Send M108 to resume"
|
||||
|
||||
#define MSG_STOP_BLTOUCH "!! STOP called because of BLTouch error - restart with M999"
|
||||
#define MSG_STOP_UNHOMED "!! STOP called because of unhomed error - restart with M999"
|
||||
#define MSG_KILL_INACTIVE_TIME "!! KILL caused by too much inactive time - current command: "
|
||||
#define MSG_KILL_BUTTON "!! KILL caused by KILL button/pin"
|
||||
#define MSG_STOP_BLTOUCH "STOP called because of BLTouch error - restart with M999"
|
||||
#define MSG_STOP_UNHOMED "STOP called because of unhomed error - restart with M999"
|
||||
#define MSG_KILL_INACTIVE_TIME "KILL caused by too much inactive time - current command: "
|
||||
#define MSG_KILL_BUTTON "KILL caused by KILL button/pin"
|
||||
|
||||
// temperature.cpp strings
|
||||
#define MSG_PID_AUTOTUNE_PREFIX "PID Autotune"
|
||||
#define MSG_PID_AUTOTUNE_START MSG_PID_AUTOTUNE_PREFIX " start"
|
||||
#define MSG_PID_AUTOTUNE_FAILED MSG_PID_AUTOTUNE_PREFIX " failed!"
|
||||
#define MSG_PID_AUTOTUNE "PID Autotune"
|
||||
#define MSG_PID_AUTOTUNE_START MSG_PID_AUTOTUNE " start"
|
||||
#define MSG_PID_AUTOTUNE_FAILED MSG_PID_AUTOTUNE " failed!"
|
||||
#define MSG_PID_BAD_EXTRUDER_NUM MSG_PID_AUTOTUNE_FAILED " Bad extruder number"
|
||||
#define MSG_PID_TEMP_TOO_HIGH MSG_PID_AUTOTUNE_FAILED " Temperature too high"
|
||||
#define MSG_PID_TIMEOUT MSG_PID_AUTOTUNE_FAILED " timeout"
|
||||
@@ -275,7 +275,7 @@
|
||||
#define MSG_KI " Ki: "
|
||||
#define MSG_KD " Kd: "
|
||||
#define MSG_AT " @:"
|
||||
#define MSG_PID_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE_PREFIX " finished! Put the last Kp, Ki and Kd constants from below into Configuration.h"
|
||||
#define MSG_PID_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from below into Configuration.h"
|
||||
#define MSG_PID_DEBUG " PID_DEBUG "
|
||||
#define MSG_PID_DEBUG_INPUT ": Input "
|
||||
#define MSG_PID_DEBUG_OUTPUT " Output "
|
||||
@@ -349,7 +349,6 @@
|
||||
*
|
||||
*/
|
||||
#if ENABLED(NUMBER_TOOLS_FROM_0)
|
||||
#define LCD_FIRST_TOOL '0'
|
||||
#define LCD_STR_N0 "0"
|
||||
#define LCD_STR_N1 "1"
|
||||
#define LCD_STR_N2 "2"
|
||||
@@ -357,7 +356,6 @@
|
||||
#define LCD_STR_N4 "4"
|
||||
#define LCD_STR_N5 "5"
|
||||
#else
|
||||
#define LCD_FIRST_TOOL '1'
|
||||
#define LCD_STR_N0 "1"
|
||||
#define LCD_STR_N1 "2"
|
||||
#define LCD_STR_N2 "3"
|
||||
|
||||
+27
-127
@@ -165,7 +165,6 @@
|
||||
|
||||
// Macros to support option testing
|
||||
#define _CAT(a,V...) a##V
|
||||
#define CAT(a,V...) _CAT(a,V)
|
||||
#define SWITCH_ENABLED_false 0
|
||||
#define SWITCH_ENABLED_true 1
|
||||
#define SWITCH_ENABLED_0 0
|
||||
@@ -230,6 +229,32 @@
|
||||
#define _JOIN_1(O) (O)
|
||||
#define JOIN_N(N,C,V...) (DO(JOIN,C,LIST_N(N,V)))
|
||||
|
||||
// Macros for adding
|
||||
#define INC_0 1
|
||||
#define INC_1 2
|
||||
#define INC_2 3
|
||||
#define INC_3 4
|
||||
#define INC_4 5
|
||||
#define INC_5 6
|
||||
#define INC_6 7
|
||||
#define INC_7 8
|
||||
#define INC_8 9
|
||||
#define INCREMENT_(n) INC_##n
|
||||
#define INCREMENT(n) INCREMENT_(n)
|
||||
|
||||
// Macros for subtracting
|
||||
#define DEC_1 0
|
||||
#define DEC_2 1
|
||||
#define DEC_3 2
|
||||
#define DEC_4 3
|
||||
#define DEC_5 4
|
||||
#define DEC_6 5
|
||||
#define DEC_7 6
|
||||
#define DEC_8 7
|
||||
#define DEC_9 8
|
||||
#define DECREMENT_(n) DEC_##n
|
||||
#define DECREMENT(n) DECREMENT_(n)
|
||||
|
||||
#define NOOP (void(0))
|
||||
|
||||
#define CEILING(x,y) (((x) + (y) - 1) / (y))
|
||||
@@ -251,11 +276,10 @@
|
||||
//
|
||||
// Maths macros that can be overridden by HAL
|
||||
//
|
||||
#define ACOS(x) acosf(x)
|
||||
#define ATAN2(y, x) atan2f(y, x)
|
||||
#define POW(x, y) powf(x, y)
|
||||
#define SQRT(x) sqrtf(x)
|
||||
#define RSQRT(x) (1.0f / sqrtf(x))
|
||||
#define RSQRT(x) (1 / sqrtf(x))
|
||||
#define CEIL(x) ceilf(x)
|
||||
#define FLOOR(x) floorf(x)
|
||||
#define LROUND(x) lroundf(x)
|
||||
@@ -322,127 +346,3 @@
|
||||
#define _MAX(V...) _MAX_N(NUM_ARGS(V), V)
|
||||
|
||||
#endif
|
||||
|
||||
// Macros for adding
|
||||
#define INC_0 1
|
||||
#define INC_1 2
|
||||
#define INC_2 3
|
||||
#define INC_3 4
|
||||
#define INC_4 5
|
||||
#define INC_5 6
|
||||
#define INC_6 7
|
||||
#define INC_7 8
|
||||
#define INC_8 9
|
||||
#define INCREMENT_(n) INC_##n
|
||||
#define INCREMENT(n) INCREMENT_(n)
|
||||
|
||||
#define ADD0(N) N
|
||||
#define ADD1(N) INCREMENT_(N)
|
||||
#define ADD2(N) ADD1(ADD1(N))
|
||||
#define ADD3(N) ADD1(ADD2(N))
|
||||
#define ADD4(N) ADD2(ADD2(N))
|
||||
#define ADD5(N) ADD2(ADD3(N))
|
||||
#define ADD6(N) ADD3(ADD3(N))
|
||||
#define ADD7(N) ADD3(ADD4(N))
|
||||
#define ADD8(N) ADD4(ADD4(N))
|
||||
#define ADD9(N) ADD4(ADD5(N))
|
||||
#define ADD10(N) ADD5(ADD5(N))
|
||||
|
||||
// Macros for subtracting
|
||||
#define DEC_0 0
|
||||
#define DEC_1 0
|
||||
#define DEC_2 1
|
||||
#define DEC_3 2
|
||||
#define DEC_4 3
|
||||
#define DEC_5 4
|
||||
#define DEC_6 5
|
||||
#define DEC_7 6
|
||||
#define DEC_8 7
|
||||
#define DEC_9 8
|
||||
#define DECREMENT_(n) DEC_##n
|
||||
#define DECREMENT(n) DECREMENT_(n)
|
||||
|
||||
#define SUB0(N) N
|
||||
#define SUB1(N) DECREMENT_(N)
|
||||
#define SUB2(N) SUB1(SUB1(N))
|
||||
#define SUB3(N) SUB1(SUB2(N))
|
||||
#define SUB4(N) SUB2(SUB2(N))
|
||||
#define SUB5(N) SUB2(SUB3(N))
|
||||
#define SUB6(N) SUB3(SUB3(N))
|
||||
#define SUB7(N) SUB3(SUB4(N))
|
||||
#define SUB8(N) SUB4(SUB4(N))
|
||||
#define SUB9(N) SUB4(SUB5(N))
|
||||
#define SUB10(N) SUB5(SUB5(N))
|
||||
|
||||
//
|
||||
// Primitives supporting precompiler REPEAT
|
||||
//
|
||||
#define FIRST(a,...) a
|
||||
#define SECOND(a,b,...) b
|
||||
|
||||
// Defer expansion
|
||||
#define EMPTY()
|
||||
#define DEFER(M) M EMPTY()
|
||||
#define DEFER2(M) M EMPTY EMPTY()()
|
||||
#define DEFER3(M) M EMPTY EMPTY EMPTY()()()
|
||||
#define DEFER4(M) M EMPTY EMPTY EMPTY EMPTY()()()()
|
||||
|
||||
// Force define expansion
|
||||
#define EVAL(V...) EVAL16(V)
|
||||
#define EVAL1024(V...) EVAL512(EVAL512(V))
|
||||
#define EVAL512(V...) EVAL256(EVAL256(V))
|
||||
#define EVAL256(V...) EVAL128(EVAL128(V))
|
||||
#define EVAL128(V...) EVAL64(EVAL64(V))
|
||||
#define EVAL64(V...) EVAL32(EVAL32(V))
|
||||
#define EVAL32(V...) EVAL16(EVAL16(V))
|
||||
#define EVAL16(V...) EVAL8(EVAL8(V))
|
||||
#define EVAL8(V...) EVAL4(EVAL4(V))
|
||||
#define EVAL4(V...) EVAL2(EVAL2(V))
|
||||
#define EVAL2(V...) EVAL1(EVAL1(V))
|
||||
#define EVAL1(V...) V
|
||||
|
||||
#define IS_PROBE(V...) SECOND(V, 0) // Get the second item passed, or 0
|
||||
#define PROBE() ~, 1 // Second item will be 1 if this is passed
|
||||
#define _NOT_0 PROBE()
|
||||
#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'.
|
||||
#define _BOOL(x) NOT(NOT(x)) // NOT('0') gets '0'. Anything else gets '1'.
|
||||
|
||||
#define IF_ELSE(TF) _IF_ELSE(_BOOL(TF))
|
||||
#define _IF_ELSE(TF) _CAT(_IF_, TF)
|
||||
|
||||
#define _IF_1(V...) V _IF_1_ELSE
|
||||
#define _IF_0(...) _IF_0_ELSE
|
||||
|
||||
#define _IF_1_ELSE(...)
|
||||
#define _IF_0_ELSE(V...) V
|
||||
|
||||
#define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)())
|
||||
#define _END_OF_ARGUMENTS_() 0
|
||||
|
||||
//
|
||||
// REPEAT core macros. Recurse N times with ascending I.
|
||||
//
|
||||
|
||||
// Call OP(I) N times with ascending counter.
|
||||
#define _REPEAT(_RPT_I,_RPT_N,_RPT_OP) \
|
||||
_RPT_OP(_RPT_I) \
|
||||
IF_ELSE(SUB1(_RPT_N)) \
|
||||
( DEFER2(__REPEAT)()(ADD1(_RPT_I),SUB1(_RPT_N),_RPT_OP) ) \
|
||||
( /* Do nothing */ )
|
||||
#define __REPEAT() _REPEAT
|
||||
|
||||
// Call OP(I, ...) N times with ascending counter.
|
||||
#define _REPEAT2(_RPT_I,_RPT_N,_RPT_OP,V...) \
|
||||
_RPT_OP(_RPT_I,V) \
|
||||
IF_ELSE(SUB1(_RPT_N)) \
|
||||
( DEFER2(__REPEAT2)()(ADD1(_RPT_I),SUB1(_RPT_N),_RPT_OP,V) ) \
|
||||
( /* Do nothing */ )
|
||||
#define __REPEAT2() _REPEAT2
|
||||
|
||||
// Repeat a macro passing S...N-1.
|
||||
#define REPEAT_S(S,N,OP) EVAL(_REPEAT(S,SUB##S(N),OP))
|
||||
#define REPEAT(N,OP) REPEAT_S(0,N,OP)
|
||||
|
||||
// Repeat a macro passing 0...N-1 plus additional arguments.
|
||||
#define REPEAT2_S(S,N,OP,V...) EVAL(_REPEAT2(S,SUB##S(N),OP,V))
|
||||
#define REPEAT2(N,OP,V...) REPEAT2_S(0,N,OP,V)
|
||||
|
||||
@@ -67,10 +67,8 @@ void print_bin(const uint16_t val) {
|
||||
}
|
||||
}
|
||||
|
||||
extern const char SP_X_STR[], SP_Y_STR[], SP_Z_STR[];
|
||||
|
||||
void print_xyz(const float &x, const float &y, const float &z, PGM_P const prefix/*=nullptr*/, PGM_P const suffix/*=nullptr*/) {
|
||||
serialprintPGM(prefix);
|
||||
SERIAL_ECHOPAIR_P(SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z);
|
||||
SERIAL_ECHOPAIR(" " MSG_X, x, " " MSG_Y, y, " " MSG_Z, z);
|
||||
if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ extern uint8_t marlin_debug_flags;
|
||||
#define SERIAL_PRINTF(V...) SERIAL_OUT(printf, V)
|
||||
#define SERIAL_FLUSH() SERIAL_OUT(flush)
|
||||
|
||||
#ifdef ARDUINO_ARCH_STM32
|
||||
#ifdef __STM32F1__
|
||||
#define SERIAL_FLUSHTX() SERIAL_OUT(flush)
|
||||
#elif TX_BUFFER_SIZE > 0
|
||||
#define SERIAL_FLUSHTX() SERIAL_OUT(flushTX)
|
||||
@@ -83,7 +83,7 @@ extern uint8_t marlin_debug_flags;
|
||||
#define SERIAL_FLUSHTX()
|
||||
#endif
|
||||
|
||||
// Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR().
|
||||
// Print up to 12 pairs of values
|
||||
#define __SEP_N(N,V...) _SEP_##N(V)
|
||||
#define _SEP_N(N,V...) __SEP_N(N,V)
|
||||
#define _SEP_1(PRE) SERIAL_ECHOPGM(PRE)
|
||||
@@ -113,36 +113,6 @@ extern uint8_t marlin_debug_flags;
|
||||
|
||||
#define SERIAL_ECHOPAIR(V...) _SEP_N(NUM_ARGS(V),V)
|
||||
|
||||
// Print up to 12 pairs of values. Odd elements must be PSTR pointers.
|
||||
#define __SEP_N_P(N,V...) _SEP_##N##_P(V)
|
||||
#define _SEP_N_P(N,V...) __SEP_N_P(N,V)
|
||||
#define _SEP_1_P(PRE) serialprintPGM(PRE)
|
||||
#define _SEP_2_P(PRE,V) serial_echopair_PGM(PRE,V)
|
||||
#define _SEP_3_P(a,b,c) do{ _SEP_2_P(a,b); serialprintPGM(c); }while(0)
|
||||
#define _SEP_4_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_2_P(V); }while(0)
|
||||
#define _SEP_5_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_3_P(V); }while(0)
|
||||
#define _SEP_6_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_4_P(V); }while(0)
|
||||
#define _SEP_7_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_5_P(V); }while(0)
|
||||
#define _SEP_8_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_6_P(V); }while(0)
|
||||
#define _SEP_9_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_7_P(V); }while(0)
|
||||
#define _SEP_10_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_8_P(V); }while(0)
|
||||
#define _SEP_11_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_9_P(V); }while(0)
|
||||
#define _SEP_12_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_10_P(V); }while(0)
|
||||
#define _SEP_13_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_11_P(V); }while(0)
|
||||
#define _SEP_14_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_12_P(V); }while(0)
|
||||
#define _SEP_15_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_13_P(V); }while(0)
|
||||
#define _SEP_16_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_14_P(V); }while(0)
|
||||
#define _SEP_17_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_15_P(V); }while(0)
|
||||
#define _SEP_18_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_16_P(V); }while(0)
|
||||
#define _SEP_19_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_17_P(V); }while(0)
|
||||
#define _SEP_20_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_18_P(V); }while(0)
|
||||
#define _SEP_21_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_19_P(V); }while(0)
|
||||
#define _SEP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_20_P(V); }while(0)
|
||||
#define _SEP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_21_P(V); }while(0)
|
||||
#define _SEP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_22_P(V); }while(0)
|
||||
|
||||
#define SERIAL_ECHOPAIR_P(V...) _SEP_N_P(NUM_ARGS(V),V)
|
||||
|
||||
// Print up to 12 pairs of values followed by newline
|
||||
#define __SELP_N(N,V...) _SELP_##N(V)
|
||||
#define _SELP_N(N,V...) __SELP_N(N,V)
|
||||
@@ -169,40 +139,10 @@ extern uint8_t marlin_debug_flags;
|
||||
#define _SELP_21(a,b,V...) do{ _SEP_2(a,b); _SELP_19(V); }while(0)
|
||||
#define _SELP_22(a,b,V...) do{ _SEP_2(a,b); _SELP_20(V); }while(0)
|
||||
#define _SELP_23(a,b,V...) do{ _SEP_2(a,b); _SELP_21(V); }while(0)
|
||||
#define _SELP_24(a,b,V...) do{ _SEP_2(a,b); _SELP_22(V); }while(0) // Eat two args, pass the rest up
|
||||
#define _SELP_24(a,b,V...) do{ _SEP_2(a,b); _SELP_22(V); }while(0) // Use up two, pass the rest up
|
||||
|
||||
#define SERIAL_ECHOLNPAIR(V...) _SELP_N(NUM_ARGS(V),V)
|
||||
|
||||
// Print up to 12 pairs of values followed by newline
|
||||
#define __SELP_N_P(N,V...) _SELP_##N##_P(V)
|
||||
#define _SELP_N_P(N,V...) __SELP_N_P(N,V)
|
||||
#define _SELP_1_P(PRE) serialprintPGM(PRE)
|
||||
#define _SELP_2_P(PRE,V) do{ serial_echopair_PGM(PRE,V); SERIAL_EOL(); }while(0)
|
||||
#define _SELP_3_P(a,b,c) do{ _SEP_2_P(a,b); serialprintPGM(c); }while(0)
|
||||
#define _SELP_4_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_2_P(V); }while(0)
|
||||
#define _SELP_5_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_3_P(V); }while(0)
|
||||
#define _SELP_6_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_4_P(V); }while(0)
|
||||
#define _SELP_7_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_5_P(V); }while(0)
|
||||
#define _SELP_8_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_6_P(V); }while(0)
|
||||
#define _SELP_9_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_7_P(V); }while(0)
|
||||
#define _SELP_10_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_8_P(V); }while(0)
|
||||
#define _SELP_11_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_9_P(V); }while(0)
|
||||
#define _SELP_12_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_10_P(V); }while(0)
|
||||
#define _SELP_13_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_11_P(V); }while(0)
|
||||
#define _SELP_14_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_12_P(V); }while(0)
|
||||
#define _SELP_15_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_13_P(V); }while(0)
|
||||
#define _SELP_16_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_14_P(V); }while(0)
|
||||
#define _SELP_17_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_15_P(V); }while(0)
|
||||
#define _SELP_18_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_16_P(V); }while(0)
|
||||
#define _SELP_19_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_17_P(V); }while(0)
|
||||
#define _SELP_20_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_18_P(V); }while(0)
|
||||
#define _SELP_21_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_19_P(V); }while(0)
|
||||
#define _SELP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_20_P(V); }while(0)
|
||||
#define _SELP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_21_P(V); }while(0)
|
||||
#define _SELP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_22_P(V); }while(0) // Eat two args, pass the rest up
|
||||
|
||||
#define SERIAL_ECHOLNPAIR_P(V...) _SELP_N_P(NUM_ARGS(V),V)
|
||||
|
||||
// Print up to 20 comma-separated pairs of values
|
||||
#define __SLST_N(N,V...) _SLST_##N(V)
|
||||
#define _SLST_N(N,V...) __SLST_N(N,V)
|
||||
@@ -225,20 +165,15 @@ extern uint8_t marlin_debug_flags;
|
||||
#define _SLST_17(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_15(V); }while(0)
|
||||
#define _SLST_18(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_16(V); }while(0)
|
||||
#define _SLST_19(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_17(V); }while(0)
|
||||
#define _SLST_20(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_18(V); }while(0) // Eat two args, pass the rest up
|
||||
#define _SLST_20(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_18(V); }while(0) // Use up two, pass the rest up
|
||||
|
||||
#define SERIAL_ECHOLIST(pre,V...) do{ SERIAL_ECHOPGM(pre); _SLST_N(NUM_ARGS(V),V); }while(0)
|
||||
#define SERIAL_ECHOLIST_N(N,V...) _SLST_N(N,LIST_N(N,V))
|
||||
|
||||
#define SERIAL_ECHO_P(P) (serialprintPGM(P))
|
||||
#define SERIAL_ECHOPGM(S) (serialprintPGM(PSTR(S)))
|
||||
#define SERIAL_ECHOLNPGM(S) (serialprintPGM(PSTR(S "\n")))
|
||||
|
||||
#define SERIAL_ECHOPGM(S) (SERIAL_ECHO_P(PSTR(S)))
|
||||
#define SERIAL_ECHOLNPGM(S) (SERIAL_ECHO_P(PSTR(S "\n")))
|
||||
|
||||
#define SERIAL_ECHOPAIR_F_P(P,V...) do{ serialprintPGM(P); SERIAL_ECHO_F(V); }while(0)
|
||||
#define SERIAL_ECHOLNPAIR_F_P(V...) do{ SERIAL_ECHOPAIR_F_P(V); SERIAL_EOL(); }while(0)
|
||||
|
||||
#define SERIAL_ECHOPAIR_F(S,V...) SERIAL_ECHOPAIR_F_P(PSTR(S),V)
|
||||
#define SERIAL_ECHOPAIR_F(S,V...) do{ SERIAL_ECHOPGM(S); SERIAL_ECHO_F(V); }while(0)
|
||||
#define SERIAL_ECHOLNPAIR_F(V...) do{ SERIAL_ECHOPAIR_F(V); SERIAL_EOL(); }while(0)
|
||||
|
||||
#define SERIAL_ECHO_START() serial_echo_start()
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
|
||||
#include "millis_t.h"
|
||||
|
||||
class __FlashStringHelper;
|
||||
typedef const __FlashStringHelper *progmem_str;
|
||||
|
||||
//
|
||||
// Enumerated axis indices
|
||||
//
|
||||
|
||||
@@ -59,8 +59,6 @@ void safe_delay(millis_t ms) {
|
||||
SERIAL_ECHOLNPGM("Probe: "
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
"PROBE_MANUALLY"
|
||||
#elif ENABLED(NOZZLE_AS_PROBE)
|
||||
"NOZZLE_AS_PROBE"
|
||||
#elif ENABLED(FIX_MOUNTED_PROBE)
|
||||
"FIX_MOUNTED_PROBE"
|
||||
#elif ENABLED(BLTOUCH)
|
||||
@@ -81,7 +79,7 @@ void safe_delay(millis_t ms) {
|
||||
);
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
|
||||
SERIAL_ECHOPAIR("Probe Offset X", probe_offset.x, " Y", probe_offset.y, " Z", probe_offset.z);
|
||||
if (probe_offset.x > 0)
|
||||
SERIAL_ECHOPGM(" (Right");
|
||||
else if (probe_offset.x < 0)
|
||||
|
||||
@@ -47,9 +47,9 @@ inline void serial_delay(const millis_t ms) {
|
||||
void unmark(const uint8_t x, const uint8_t y) { CBI(bits[y], x); }
|
||||
void mark(const uint8_t x, const uint8_t y) { SBI(bits[y], x); }
|
||||
bool marked(const uint8_t x, const uint8_t y) { return TEST(bits[y], x); }
|
||||
inline void unmark(const xy_int8_t &xy) { unmark(xy.x, xy.y); }
|
||||
inline void mark(const xy_int8_t &xy) { mark(xy.x, xy.y); }
|
||||
inline bool marked(const xy_int8_t &xy) { return marked(xy.x, xy.y); }
|
||||
inline void unmark(const xy_int8_t &xy) { unmark(xy.y, xy.x); }
|
||||
inline void mark(const xy_int8_t &xy) { mark(xy.y, xy.x); }
|
||||
inline bool marked(const xy_int8_t &xy) { return marked(xy.y, xy.x); }
|
||||
};
|
||||
|
||||
typedef FlagBits<GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y> MeshFlags;
|
||||
|
||||
@@ -455,19 +455,15 @@ void Max7219::register_setup() {
|
||||
#ifdef MAX7219_INIT_TEST
|
||||
#if MAX7219_INIT_TEST == 2
|
||||
|
||||
#define MAX7219_LEDS (MAX7219_X_LEDS * MAX7219_Y_LEDS)
|
||||
|
||||
void Max7219::spiral(const bool on, const uint16_t del) {
|
||||
constexpr int8_t way[][2] = { { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } };
|
||||
constexpr int8_t way[] = { 1, 0, 0, 1, -1, 0, 0, -1 };
|
||||
int8_t px = 0, py = 0, dir = 0;
|
||||
for (IF<(MAX7219_LEDS > 255), uint16_t, uint8_t>::type i = MAX7219_LEDS; i--;) {
|
||||
for (uint8_t i = MAX7219_X_LEDS * MAX7219_Y_LEDS; i--;) {
|
||||
led_set(px, py, on);
|
||||
delay(del);
|
||||
const int8_t x = px + way[dir][0], y = py + way[dir][1];
|
||||
if (!WITHIN(x, 0, MAX7219_X_LEDS - 1) || !WITHIN(y, 0, MAX7219_Y_LEDS - 1) || BIT_7219(x, y) == on)
|
||||
dir = (dir + 1) & 0x3;
|
||||
px += way[dir][0];
|
||||
py += way[dir][1];
|
||||
const int8_t x = px + way[dir], y = py + way[dir + 1];
|
||||
if (!WITHIN(x, 0, MAX7219_X_LEDS - 1) || !WITHIN(y, 0, MAX7219_Y_LEDS - 1) || BIT_7219(x, y) == on) dir = (dir + 2) & 0x7;
|
||||
px += way[dir]; py += way[dir + 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "../../../lcd/extensible_ui/ui_api.h"
|
||||
#endif
|
||||
|
||||
xy_pos_t bilinear_grid_spacing, bilinear_start;
|
||||
xy_int_t bilinear_grid_spacing, bilinear_start;
|
||||
xy_float_t bilinear_grid_factor;
|
||||
bed_mesh_t z_values;
|
||||
|
||||
@@ -153,7 +153,7 @@ void print_bilinear_leveling_grid() {
|
||||
#define ABL_TEMP_POINTS_X (GRID_MAX_POINTS_X + 2)
|
||||
#define ABL_TEMP_POINTS_Y (GRID_MAX_POINTS_Y + 2)
|
||||
float z_values_virt[ABL_GRID_POINTS_VIRT_X][ABL_GRID_POINTS_VIRT_Y];
|
||||
xy_pos_t bilinear_grid_spacing_virt;
|
||||
xy_int_t bilinear_grid_spacing_virt;
|
||||
xy_float_t bilinear_grid_factor_virt;
|
||||
|
||||
void print_bilinear_leveling_grid_virt() {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
extern xy_pos_t bilinear_grid_spacing, bilinear_start;
|
||||
extern xy_int_t bilinear_grid_spacing, bilinear_start;
|
||||
extern xy_float_t bilinear_grid_factor;
|
||||
extern bed_mesh_t z_values;
|
||||
float bilinear_z_offset(const xy_pos_t &raw);
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
if (!isnan(z_values[x][y])) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR(" M421 I", int(x), " J", int(y));
|
||||
SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z_values[x][y], 4);
|
||||
SERIAL_ECHOLNPAIR_F(" Z", z_values[x][y], 4);
|
||||
serial_delay(75); // Prevent Printrun from exploding
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@
|
||||
}
|
||||
z_values[cpos.x][cpos.y] = NAN;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(cpos, 0.0f);
|
||||
ExtUI::onMeshUpdate(closest, 0);
|
||||
#endif
|
||||
cnt++;
|
||||
}
|
||||
@@ -541,7 +541,7 @@
|
||||
else {
|
||||
z_values[cpos.x][cpos.y] = g29_constant;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(cpos, g29_constant);
|
||||
ExtUI::onMeshUpdate(closest, g29_constant);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -741,13 +741,13 @@
|
||||
* This attempts to fill in locations closest to the nozzle's start location first.
|
||||
*/
|
||||
void unified_bed_leveling::probe_entire_mesh(const xy_pos_t &near, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) {
|
||||
DEPLOY_PROBE(); // Deploy before ui.capture() to allow for PAUSE_BEFORE_DEPLOY_STOW
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
|
||||
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
|
||||
DEPLOY_PROBE();
|
||||
|
||||
uint8_t count = GRID_MAX_POINTS;
|
||||
|
||||
mesh_index_pair best;
|
||||
@@ -764,10 +764,10 @@
|
||||
if (ui.button_pressed()) {
|
||||
ui.quick_feedback(false); // Preserve button state for click-and-hold
|
||||
SERIAL_ECHOLNPGM("\nMesh only partially populated.\n");
|
||||
STOW_PROBE();
|
||||
ui.wait_for_release();
|
||||
ui.quick_feedback();
|
||||
ui.release();
|
||||
STOW_PROBE(); // Release UI before stow to allow for PAUSE_BEFORE_DEPLOY_STOW
|
||||
return restore_ubl_active_state_and_leave();
|
||||
}
|
||||
#endif
|
||||
@@ -783,20 +783,14 @@
|
||||
);
|
||||
z_values[best.pos.x][best.pos.y] = measured_z;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(best.pos, measured_z);
|
||||
ExtUI::onMeshUpdate(best, measured_z);
|
||||
#endif
|
||||
}
|
||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||
|
||||
} while (best.pos.x >= 0 && --count);
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
ui.release();
|
||||
#endif
|
||||
STOW_PROBE(); // Release UI during stow to allow for PAUSE_BEFORE_DEPLOY_STOW
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
STOW_PROBE();
|
||||
|
||||
#ifdef Z_AFTER_PROBING
|
||||
move_z_after_probing();
|
||||
@@ -855,9 +849,7 @@
|
||||
static void echo_and_take_a_measurement() { SERIAL_ECHOLNPGM(" and take a measurement."); }
|
||||
|
||||
float unified_bed_leveling::measure_business_card_thickness(float in_height) {
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
ui.capture();
|
||||
save_ubl_active_state_and_disable(); // Disable bed level correction for probing
|
||||
|
||||
do_blocking_move_to(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)), in_height);
|
||||
@@ -896,9 +888,8 @@
|
||||
}
|
||||
|
||||
void unified_bed_leveling::manually_probe_remaining_mesh(const xy_pos_t &pos, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) {
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
|
||||
ui.capture();
|
||||
|
||||
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
|
||||
do_blocking_move_to_xy_z(current_position, z_clearance);
|
||||
@@ -926,9 +917,7 @@
|
||||
do_blocking_move_to_z(z_clearance);
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture();
|
||||
#endif
|
||||
ui.capture();
|
||||
|
||||
if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing
|
||||
|
||||
@@ -995,9 +984,8 @@
|
||||
save_ubl_active_state_and_disable();
|
||||
|
||||
LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH);
|
||||
#if HAS_LCD_MENU
|
||||
ui.capture(); // Take over control of the LCD encoder
|
||||
#endif
|
||||
ui.capture(); // Take over control of the LCD encoder
|
||||
|
||||
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance
|
||||
|
||||
#if ENABLED(UBL_MESH_EDIT_MOVES_Z)
|
||||
@@ -1347,7 +1335,7 @@
|
||||
if (!isnan(v2)) {
|
||||
z_values[x][y] = v1 < v2 ? v1 : v1 + v1 - v2;
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMeshUpdate(x, y, z_values[x][y]);
|
||||
ExtUI::onMeshUpdate(x, y, z_values[pos.x][pos.y]);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
@@ -1397,8 +1385,17 @@
|
||||
dx = (x_max - x_min) / (g29_grid_size - 1),
|
||||
dy = (y_max - y_min) / (g29_grid_size - 1);
|
||||
|
||||
xy_float_t points[3];
|
||||
get_three_probe_points(points);
|
||||
const vector_3 points[3] = {
|
||||
#if ENABLED(HAS_FIXED_3POINT)
|
||||
{ PROBE_PT_1_X, PROBE_PT_1_Y, 0 },
|
||||
{ PROBE_PT_2_X, PROBE_PT_2_Y, 0 },
|
||||
{ PROBE_PT_3_X, PROBE_PT_3_Y, 0 }
|
||||
#else
|
||||
{ x_min, y_min, 0 },
|
||||
{ x_max, y_min, 0 },
|
||||
{ (x_max - x_min) / 2, y_max, 0 }
|
||||
#endif
|
||||
};
|
||||
|
||||
float measured_z;
|
||||
bool abort_flag = false;
|
||||
@@ -1507,20 +1504,18 @@
|
||||
|
||||
abort_flag = isnan(measured_z);
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
const xy_pos_t lpos = rpos.asLogical();
|
||||
DEBUG_CHAR('(');
|
||||
DEBUG_ECHO_F(rpos.x, 7);
|
||||
DEBUG_CHAR(',');
|
||||
DEBUG_ECHO_F(rpos.y, 7);
|
||||
DEBUG_ECHOPAIR_F(") logical: (", lpos.x, 7);
|
||||
DEBUG_CHAR(',');
|
||||
DEBUG_ECHO_F(lpos.y, 7);
|
||||
DEBUG_ECHOPAIR_F(") measured: ", measured_z, 7);
|
||||
DEBUG_ECHOPAIR_F(" correction: ", get_z_correction(rpos), 7);
|
||||
}
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
const xy_pos_t lpos = rpos.asLogical();
|
||||
DEBUG_CHAR('(');
|
||||
DEBUG_ECHO_F(rpos.x, 7);
|
||||
DEBUG_CHAR(',');
|
||||
DEBUG_ECHO_F(rpos.y, 7);
|
||||
DEBUG_ECHOPAIR_F(") logical: (", lpos.x, 7);
|
||||
DEBUG_CHAR(',');
|
||||
DEBUG_ECHO_F(lpos.y, 7);
|
||||
DEBUG_ECHOPAIR_F(") measured: ", measured_z, 7);
|
||||
DEBUG_ECHOPAIR_F(" correction: ", get_z_correction(rpos), 7);
|
||||
}
|
||||
|
||||
measured_z -= get_z_correction(rpos) /* + probe_offset.z */ ;
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
static bool file_open(char* filename) {
|
||||
if (!dummy_transfer) {
|
||||
card.mount();
|
||||
card.openFileWrite(filename);
|
||||
card.openFile(filename, false);
|
||||
if (!card.isFileOpen()) return false;
|
||||
}
|
||||
transfer_active = true;
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
|
||||
#include "cancel_object.h"
|
||||
#include "../gcode/gcode.h"
|
||||
#include "../lcd/ultralcd.h"
|
||||
|
||||
CancelObject cancelable;
|
||||
|
||||
int8_t CancelObject::object_count, // = 0
|
||||
CancelObject::active_object = -1;
|
||||
uint32_t CancelObject::canceled; // = 0x0000
|
||||
bool CancelObject::skipping; // = false
|
||||
|
||||
void CancelObject::set_active_object(const int8_t obj) {
|
||||
active_object = obj;
|
||||
if (WITHIN(obj, 0, 31)) {
|
||||
if (obj >= object_count) object_count = obj + 1;
|
||||
skipping = TEST(canceled, obj);
|
||||
}
|
||||
else
|
||||
skipping = false;
|
||||
|
||||
#if HAS_DISPLAY
|
||||
if (active_object >= 0)
|
||||
ui.status_printf_P(0, PSTR(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object + 1));
|
||||
else
|
||||
ui.reset_status();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CancelObject::cancel_object(const int8_t obj) {
|
||||
if (WITHIN(obj, 0, 31)) {
|
||||
SBI(canceled, obj);
|
||||
if (obj == active_object) skipping = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CancelObject::uncancel_object(const int8_t obj) {
|
||||
if (WITHIN(obj, 0, 31)) {
|
||||
CBI(canceled, obj);
|
||||
if (obj == active_object) skipping = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CancelObject::report() {
|
||||
if (active_object >= 0) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Active Object: ", int(active_object));
|
||||
}
|
||||
|
||||
if (canceled) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM("Canceled:");
|
||||
for (int i = 0; i < object_count; i++)
|
||||
if (TEST(canceled, i)) { SERIAL_CHAR(' '); SERIAL_ECHO(i); }
|
||||
SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CANCEL_OBJECTS
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user