Compare commits

..

1 Commits

Author SHA1 Message Date
InsanityAutomation 0eeaa2389f Update power.cpp 2024-01-31 08:46:27 -05:00
1087 changed files with 20283 additions and 41113 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ contact_links:
url: https://www.facebook.com/groups/1049718498464482 url: https://www.facebook.com/groups/1049718498464482
about: Please ask and answer questions here. about: Please ask and answer questions here.
- name: 🕹 Marlin on Discord - name: 🕹 Marlin on Discord
url: https://discord.com/servers/marlin-firmware-461605380783472640 url: https://discord.gg/n5NJ59y
about: Join the Discord server for support and discussion. about: Join the Discord server for support and discussion.
- name: 🔗 Marlin Discussion Forum - name: 🔗 Marlin Discussion Forum
url: https://reprap.org/forum/list.php?415 url: https://reprap.org/forum/list.php?415
+1 -1
View File
@@ -43,7 +43,7 @@ We have a Message Board and a Facebook group where our knowledgable user communi
If chat is more your speed, you can join the MarlinFirmware Discord server: If chat is more your speed, you can join the MarlinFirmware Discord server:
* Use the link https://discord.com/servers/marlin-firmware-461605380783472640 to join up as a General User. * Use the link https://discord.gg/n5NJ59y to join up as a General User.
* Even though our Discord is pretty active, it may take a while for community members to respond — please be patient! * Even though our Discord is pretty active, it may take a while for community members to respond — please be patient!
* Use the `#general` channel for general questions or discussion about Marlin. * Use the `#general` channel for general questions or discussion about Marlin.
* Other channels exist for certain topics or are limited to Patrons. Check the channel list. * Other channels exist for certain topics or are limited to Patrons. Check the channel list.
+40
View File
@@ -0,0 +1,40 @@
#
# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app
#
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 60
# Skip issues and pull requests created before a given timestamp. Timestamp must
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
skipCreatedBefore: false
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
exemptLabels: [ 'no-locking' ]
# Label to add before locking, such as `outdated`. Set to `false` to disable
lockLabel: false
# Comment to post before locking. Set to `false` to disable
lockComment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.
# Assign `resolved` as the reason for locking. Set to `false` to disable
setLockReason: true
# Limit to only `issues` or `pulls`
# only: issues
# Optionally, specify configuration settings just for `issues` or `pulls`
# issues:
# exemptLabels:
# - help-wanted
# lockLabel: outdated
# pulls:
# daysUntilLock: 30
# Repository to extend settings from
# _extends: repo
+2 -2
View File
@@ -19,7 +19,7 @@ jobs:
steps: steps:
- name: Check out bugfix-2.0.x - name: Check out bugfix-2.0.x
uses: actions/checkout@v4 uses: actions/checkout@v3
with: with:
ref: bugfix-2.0.x ref: bugfix-2.0.x
@@ -39,7 +39,7 @@ jobs:
exit 0 exit 0
- name: Check out bugfix-2.1.x - name: Check out bugfix-2.1.x
uses: actions/checkout@v4 uses: actions/checkout@v3
with: with:
ref: bugfix-2.1.x ref: bugfix-2.1.x
-73
View File
@@ -1,73 +0,0 @@
#
# ci-unit-tests.yml
# Build and execute unit tests to catch functional issues in code
#
name: CI - Unit Tests
on:
pull_request:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths-ignore:
- config/**
- data/**
- docs/**
- '**/*.md'
push:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths-ignore:
- config/**
- data/**
- docs/**
- '**/*.md'
jobs:
# This runs all unit tests as a single job. While it should be possible to break this up into
# multiple jobs, they currently run quickly and finish long before the compilation tests.
run_unit_tests:
name: Unit Test
# These tests will only be able to run on the bugfix-2.1.x branch, until the next release
# pulls them into additional branches.
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
steps:
- name: Check out the PR
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Select Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- name: Install PlatformIO
run: |
pip install -U platformio
pio upgrade --dev
pio pkg update --global
- name: Run All Unit Tests
run: |
make unit-test-all-local
-48
View File
@@ -1,48 +0,0 @@
#
# ci-validate-boards.yml
# Validate boards.h to make sure it's all set up correctly
#
name: CI - Validate boards.h
# We can do the on: section as two items, one for pull requests and one for pushes...
on:
pull_request:
branches:
- bugfix-2.1.x
paths:
- 'Marlin/src/core/boards.h'
push:
branches:
- bugfix-2.1.x
paths:
- 'Marlin/src/core/boards.h'
jobs:
validate_pins_files:
name: Validate boards.h
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
steps:
- name: Check out the PR
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Select Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- name: Validate core/boards.h
run: |
make validate-boards -j
-51
View File
@@ -1,51 +0,0 @@
#
# ci-validate-pins.yml
# Validate that all of the pins files are unchanged by pinsformat.py
#
name: CI - Validate Pins Files
on:
pull_request:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths:
- 'Marlin/src/pins/*/**'
push:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths:
- 'Marlin/src/pins/*/**'
jobs:
validate_pins_files:
name: Validate Pins Files
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
steps:
- name: Check out the PR
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Select Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- name: Validate all pins files
run: |
make validate-pins -j
+1 -1
View File
@@ -32,7 +32,7 @@ jobs:
- "Needs: Work" - "Needs: Work"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Remove Labels - name: Remove Labels
uses: actions-ecosystem/action-remove-labels@v1 uses: actions-ecosystem/action-remove-labels@v1
with: with:
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v9 - uses: actions/stale@v8
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: | stale-issue-message: |
+6 -6
View File
@@ -17,15 +17,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: dessant/lock-threads@v5 - uses: dessant/lock-threads@v2
with: with:
github-token: ${{ github.token }} github-token: ${{ github.token }}
process-only: 'issues' process-only: 'issues'
issue-inactive-days: '60' issue-lock-inactive-days: '60'
exclude-issue-created-before: '' issue-exclude-created-before: ''
exclude-any-issue-labels: 'no-locking' issue-exclude-labels: 'no-locking'
add-issue-labels: '' issue-lock-labels: ''
issue-comment: > issue-lock-comment: >
This issue has been automatically locked since there This issue has been automatically locked since there
has not been any recent activity after it was closed. has not been any recent activity after it was closed.
Please open a new issue for related bugs. Please open a new issue for related bugs.
@@ -1,9 +1,9 @@
# #
# ci-build-tests.yml # test-builds.yml
# Do test builds to catch compile errors # Do test builds to catch compile errors
# #
name: CI - Build Tests name: CI
on: on:
pull_request: pull_request:
@@ -14,8 +14,6 @@ on:
- config/** - config/**
- data/** - data/**
- docs/** - docs/**
- test/**
- Marlin/tests/**
- '**/*.md' - '**/*.md'
push: push:
branches: branches:
@@ -25,25 +23,21 @@ on:
- config/** - config/**
- data/** - data/**
- docs/** - docs/**
- test/**
- Marlin/tests/**
- '**/*.md' - '**/*.md'
jobs: jobs:
test_builds: test_builds:
name: Build Test name: Run All Tests
if: github.repository == 'MarlinFirmware/Marlin' if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: true
matrix: matrix:
test-platform: test-platform:
# Native # Native
- linux_native - linux_native
- simulator_linux_release
# AVR # AVR
- mega2560 - mega2560
@@ -106,9 +100,9 @@ jobs:
# STM32F4 # STM32F4
- ARMED - ARMED
- BTT_BTT002 - BIGTREE_BTT002
- BTT_GTR_V1_0 - BIGTREE_GTR_V1_0
- BTT_SKR_PRO - BIGTREE_SKR_PRO
- FLYF407ZG - FLYF407ZG
- FYSETC_S6 - FYSETC_S6
- LERDGEK - LERDGEK
@@ -158,7 +152,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Cache pip - name: Cache pip
uses: actions/cache@v4 uses: actions/cache@v3
with: with:
path: ~/.cache/pip path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -166,13 +160,13 @@ jobs:
${{ runner.os }}-pip- ${{ runner.os }}-pip-
- name: Cache PlatformIO - name: Cache PlatformIO
uses: actions/cache@v4 uses: actions/cache@v3
with: with:
path: ~/.platformio path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Select Python 3.9 - name: Select Python 3.9
uses: actions/setup-python@v5 uses: actions/setup-python@v4
with: with:
python-version: '3.9' python-version: '3.9'
architecture: 'x64' architecture: 'x64'
@@ -183,13 +177,6 @@ jobs:
pio upgrade --dev pio upgrade --dev
pio pkg update --global pio pkg update --global
- name: Install Simulator dependencies
run: |
sudo apt-get install build-essential
sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-net-dev
sudo apt-get install libglm-dev
- name: Run ${{ matrix.test-platform }} Tests - name: Run ${{ matrix.test-platform }} Tests
run: | run: |
make tests-single-ci TEST_TARGET=${{ matrix.test-platform }} make tests-single-ci TEST_TARGET=${{ matrix.test-platform }}
-1
View File
@@ -125,7 +125,6 @@ vc-fileutils.settings
# Visual Studio Code # Visual Studio Code
.vscode/* .vscode/*
!.vscode/extensions.json !.vscode/extensions.json
*.code-workspace
# Simulation files # Simulation files
imgui.ini imgui.ini
-16
View File
@@ -1,16 +0,0 @@
/**
* Marlin-specific settings for Zed
*
* For a full list of overridable settings, and general information on folder-specific settings,
* see the documentation: https://zed.dev/docs/configuring-zed#settings-files
*/
{
"languages": {
"C": {
"enable_language_server": false
},
"C++": {
"enable_language_server": false
}
}
}
+8 -56
View File
@@ -2,24 +2,17 @@ SCRIPTS_DIR := buildroot/share/scripts
CONTAINER_RT_BIN := docker CONTAINER_RT_BIN := docker
CONTAINER_RT_OPTS := --rm -v $(PWD):/code -v platformio-cache:/root/.platformio CONTAINER_RT_OPTS := --rm -v $(PWD):/code -v platformio-cache:/root/.platformio
CONTAINER_IMAGE := marlin-dev CONTAINER_IMAGE := marlin-dev
UNIT_TEST_CONFIG ?= default
help: help:
@echo "Tasks for local development:" @echo "Tasks for local development:"
@echo "make marlin : Build Marlin for the configured board" @echo "make marlin : Build marlin for the configured board"
@echo "make format-pins -j : Reformat all pins files (-j for parallel execution)" @echo "make format-pins : Reformat all pins files"
@echo "make validate-pins -j : Validate all pins files, fails if any require reformatting"
@echo "make validate-boards -j : Validate boards.h and pins.h for standards compliance"
@echo "make tests-single-ci : Run a single test from inside the CI" @echo "make tests-single-ci : Run a single test from inside the CI"
@echo "make tests-single-local : Run a single test locally" @echo "make tests-single-local : Run a single test locally"
@echo "make tests-single-local-docker : Run a single test locally, using docker" @echo "make tests-single-local-docker : Run a single test locally, using docker"
@echo "make tests-all-local : Run all tests locally" @echo "make tests-all-local : Run all tests locally"
@echo "make tests-all-local-docker : Run all tests locally, using docker" @echo "make tests-all-local-docker : Run all tests locally, using docker"
@echo "make unit-test-single-local : Run unit tests for a single config locally" @echo "make setup-local-docker : Build the local docker image"
@echo "make unit-test-single-local-docker : Run unit tests for a single config locally, using docker"
@echo "make unit-test-all-local : Run all code tests locally"
@echo "make unit-test-all-local-docker : Run all code tests locally, using docker"
@echo "make setup-local-docker : Setup local docker using buildx"
@echo "" @echo ""
@echo "Options for testing:" @echo "Options for testing:"
@echo " TEST_TARGET Set when running tests-single-*, to select the" @echo " TEST_TARGET Set when running tests-single-*, to select the"
@@ -29,9 +22,6 @@ help:
@echo " run on GitHub CI" @echo " run on GitHub CI"
@echo " ONLY_TEST Limit tests to only those that contain this, or" @echo " ONLY_TEST Limit tests to only those that contain this, or"
@echo " the index of the test (1-based)" @echo " the index of the test (1-based)"
@echo " UNIT_TEST_CONFIG Set the name of the config from the test folder, without"
@echo " the leading number. Default is 'default'". Used with the
@echo " unit-test-single-* tasks"
@echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value" @echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value"
@echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:" @echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:"
@echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!" @echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
@@ -53,61 +43,23 @@ tests-single-local:
tests-single-local-docker: tests-single-local-docker:
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi @if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi @if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)" $(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
tests-all-local: tests-all-local:
@python -c "import yaml" 2>/dev/null || (echo 'pyyaml module is not installed. Install it with "python -m pip install pyyaml"' && exit 1)
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \ export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \ && export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
&& for TEST_TARGET in $$(python $(SCRIPTS_DIR)/get_test_targets.py) ; do \ && for TEST_TARGET in $$($(SCRIPTS_DIR)/get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
if [ "$$TEST_TARGET" = "linux_native" ] && [ "$$(uname)" = "Darwin" ]; then \
echo "Skipping tests for $$TEST_TARGET on macOS" ; \
continue ; \
fi ; \
echo "Running tests for $$TEST_TARGET" ; \
run_tests . $$TEST_TARGET || exit 1 ; \
sleep 5; \
done
tests-all-local-docker: tests-all-local-docker:
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi @if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) $(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
unit-test-single-local:
platformio run -t marlin_$(UNIT_TEST_CONFIG) -e linux_native_test
unit-test-single-local-docker:
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-single-local UNIT_TEST_CONFIG=$(UNIT_TEST_CONFIG)
unit-test-all-local:
platformio run -t test-marlin -e linux_native_test
unit-test-all-local-docker:
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-all-local
setup-local-docker: setup-local-docker:
$(CONTAINER_RT_BIN) buildx build -t $(CONTAINER_IMAGE) -f docker/Dockerfile . $(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h') PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
.PHONY: $(PINS) format-pins validate-pins
$(PINS): %: $(PINS): %:
@echo "Formatting $@" @echo "Formatting $@" && node $(SCRIPTS_DIR)/pinsformat.js $@
@python $(SCRIPTS_DIR)/pinsformat.py $< $@
format-pins: $(PINS) format-pins: $(PINS)
validate-pins: format-pins
@echo "Validating pins files"
@git diff --exit-code || (git status && echo "\nError: Pins files are not formatted correctly. Run \"make format-pins\" to fix.\n" && exit 1)
BOARDS_FILE := Marlin/src/core/boards.h
.PHONY: validate-boards
validate-boards:
@echo "Validating boards.h file"
@python $(SCRIPTS_DIR)/validate_boards.py $(BOARDS_FILE) || (echo "\nError: boards.h file is not valid. Please check and correct it.\n" && exit 1)
+53 -123
View File
@@ -50,7 +50,7 @@
* *
* Calibration Guides: https://reprap.org/wiki/Calibration * Calibration Guides: https://reprap.org/wiki/Calibration
* https://reprap.org/wiki/Triffid_Hunter%27s_Calibration_Guide * https://reprap.org/wiki/Triffid_Hunter%27s_Calibration_Guide
* https://web.archive.org/web/20220907014303/sites.google.com/site/repraplogphase/calibration-of-your-reprap * https://web.archive.org/web/20220907014303/https://sites.google.com/site/repraplogphase/calibration-of-your-reprap
* https://youtu.be/wAL9d7FgInk * https://youtu.be/wAL9d7FgInk
* https://teachingtechyt.github.io/calibration.html * https://teachingtechyt.github.io/calibration.html
* *
@@ -61,7 +61,7 @@
// @section info // @section info
// Author info of this build printed to the host during boot and M115 // Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Original author or contributor. #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 CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes)
// @section machine // @section machine
@@ -77,7 +77,7 @@
* Serial port -1 is the USB emulated serial port, if available. * Serial port -1 is the USB emulated serial port, if available.
* Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader. * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader.
* *
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/ */
#define SERIAL_PORT 0 #define SERIAL_PORT 0
@@ -99,29 +99,19 @@
/** /**
* Select a secondary serial port on the board to use for communication with the host. * Select a secondary serial port on the board to use for communication with the host.
* Currently Ethernet (-2) is only supported on Teensy 4.1 boards. * Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] * :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
*/ */
//#define SERIAL_PORT_2 -1 //#define SERIAL_PORT_2 -1
//#define BAUDRATE_2 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE //#define BAUDRATE_2 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE
/** /**
* Select a third serial port on the board to use for communication with the host. * Select a third serial port on the board to use for communication with the host.
* Currently supported for AVR, DUE, SAMD51, LPC1768/9, STM32/STM32F1/HC32, and Teensy 4.x * Currently only supported for AVR, DUE, LPC1768/9 and STM32/STM32F1
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/ */
//#define SERIAL_PORT_3 1 //#define SERIAL_PORT_3 1
//#define BAUDRATE_3 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE //#define BAUDRATE_3 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE
/**
* Select a serial port to communicate with RS485 protocol
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
*/
//#define RS485_SERIAL_PORT 1
#ifdef RS485_SERIAL_PORT
//#define M485_PROTOCOL 1 // Check your host for protocol compatibility
//#define RS485_BUS_BUFFER_SIZE 128
#endif
// Enable the Bluetooth serial interface on AT90USB devices // Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH //#define BLUETOOTH
@@ -145,9 +135,9 @@
* Options: A4988, A5984, DRV8825, LV8729, TB6560, TB6600, TMC2100, * Options: A4988, A5984, DRV8825, LV8729, TB6560, TB6600, TMC2100,
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE, * TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE, * TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
* TMC2660, TMC2660_STANDALONE, TMC5130, TMC5130_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
* TMC5160, TMC5160_STANDALONE * TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE'] * :['A4988', 'A5984', 'DRV8825', 'LV8729', '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 X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988 #define Y_DRIVER_TYPE A4988
@@ -385,15 +375,14 @@
* PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version) * PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version)
* PRUSA_MMU2 : Průša MMU2 * PRUSA_MMU2 : Průša MMU2
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5) * PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
* PRUSA_MMU3 : Průša MMU3 (Requires MK3S extruder with motion sensor and MMU firmware version 3.x.x, EXTRUDERS = 5)
* EXTENDABLE_EMU_MMU2 : MMU with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware) * EXTENDABLE_EMU_MMU2 : MMU with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
* EXTENDABLE_EMU_MMU2S : MMUS with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware) * EXTENDABLE_EMU_MMU2S : MMUS with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
* *
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails. * Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
* See additional options in Configuration_adv.h. * See additional options in Configuration_adv.h.
* :["PRUSA_MMU1", "PRUSA_MMU2", "PRUSA_MMU2S", "PRUSA_MMU3", "EXTENDABLE_EMU_MMU2", "EXTENDABLE_EMU_MMU2S"] * :["PRUSA_MMU1", "PRUSA_MMU2", "PRUSA_MMU2S", "EXTENDABLE_EMU_MMU2", "EXTENDABLE_EMU_MMU2S"]
*/ */
//#define MMU_MODEL PRUSA_MMU3 //#define MMU_MODEL PRUSA_MMU2
// @section psu control // @section psu control
@@ -416,15 +405,6 @@
//#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power //#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power
//#define LED_POWEROFF_TIMEOUT 10000 // (ms) Turn off LEDs after power-off, with this amount of delay //#define LED_POWEROFF_TIMEOUT 10000 // (ms) Turn off LEDs after power-off, with this amount of delay
//#define PSU_OFF_REDUNDANT // Second pin for redundant power control
//#define PSU_OFF_REDUNDANT_INVERTED // Redundant pin state is the inverse of PSU_ACTIVE_STATE
//#define PS_ON1_PIN 6 // Redundant pin required to enable power in combination with PS_ON_PIN
//#define PS_ON_EDM_PIN 8 // External Device Monitoring pins for external power control relay feedback. Fault on mismatch.
//#define PS_ON1_EDM_PIN 9
#define PS_EDM_RESPONSE 250 // (ms) Time to allow for relay action
//#define POWER_OFF_TIMER // Enable M81 D<seconds> to power off after a delay //#define POWER_OFF_TIMER // Enable M81 D<seconds> to power off after a delay
//#define POWER_OFF_WAIT_FOR_COOLDOWN // Enable M81 S to power off only after cooldown //#define POWER_OFF_WAIT_FOR_COOLDOWN // Enable M81 S to power off only after cooldown
@@ -683,7 +663,7 @@
* MPCTEMP : Predictive Model temperature control. (~1.8K without auto-tune) * MPCTEMP : Predictive Model temperature control. (~1.8K without auto-tune)
*/ */
#define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning #define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning
//#define MPCTEMP // See https://marlinfw.org/docs/features/model_predictive_control.html //#define MPCTEMP // ** EXPERIMENTAL ** See https://marlinfw.org/docs/features/model_predictive_control.html
#define PID_MAX 255 // Limit hotend current while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_MAX 255 // Limit hotend current while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
#define PID_K1 0.95 // Smoothing factor within any PID loop #define PID_K1 0.95 // Smoothing factor within any PID loop
@@ -718,9 +698,6 @@
*/ */
#if ENABLED(MPCTEMP) #if ENABLED(MPCTEMP)
#define MPC_AUTOTUNE // Include a method to do MPC auto-tuning (~6.3K bytes of flash) #define MPC_AUTOTUNE // Include a method to do MPC auto-tuning (~6.3K bytes of flash)
#if ENABLED(MPC_AUTOTUNE)
//#define MPC_AUTOTUNE_DEBUG // Enable MPC debug logging (~870 bytes of flash)
#endif
//#define MPC_EDIT_MENU // Add MPC editing to the "Advanced Settings" menu. (~1.3K bytes of flash) //#define MPC_EDIT_MENU // Add MPC editing to the "Advanced Settings" menu. (~1.3K bytes of flash)
//#define MPC_AUTOTUNE_MENU // Add MPC auto-tuning to the "Advanced Settings" menu. (~350 bytes of flash) //#define MPC_AUTOTUNE_MENU // Add MPC auto-tuning to the "Advanced Settings" menu. (~350 bytes of flash)
@@ -802,40 +779,6 @@
//#define BED_LIMIT_SWITCHING // Keep the bed temperature within BED_HYSTERESIS of the target //#define BED_LIMIT_SWITCHING // Keep the bed temperature within BED_HYSTERESIS of the target
#endif #endif
/**
* Peltier Bed - Heating and Cooling
*
* A Peltier device transfers heat from one side to the other in proportion to the amount of
* current flowing through the device and the direction of current flow. So the same device
* can both heat and cool.
*
* When "cooling" in addition to rejecting the heat transferred from the hot side to the cold
* side, the dissipated power (voltage * current) must also be rejected. Be sure to set up a
* fan that can be powered in sync with the Peltier unit.
*
* This feature is only set up to run in bang-bang mode because Peltiers don't handle PWM
* well without filter circuitry.
*
* Since existing 3D printers are made to handle relatively high current for the heated bed,
* we can use the heated bed power pins to control the Peltier power using the same G-codes
* as the heated bed (M140, M190, etc.).
*
* A second GPIO pin is required to control current direction.
* Two configurations are possible: Relay and H-Bridge
*
* (At this time only relay is supported. H-bridge requires 4 MOS switches configured in H-Bridge.)
*
* Power is handled by the bang-bang control loop: 0 or 255.
* Cooling applications are more common than heating, so the pin states are commonly:
* LOW = Heating = Relay Energized
* HIGH = Cooling = Relay in "Normal" state
*/
//#define PELTIER_BED
#if ENABLED(PELTIER_BED)
#define PELTIER_DIR_PIN -1 // Relay control pin for Peltier
#define PELTIER_DIR_HEAT_STATE LOW // The relay pin state that causes the Peltier to heat
#endif
// Add 'M190 R T' for more gradual M190 R bed cooling. // Add 'M190 R T' for more gradual M190 R bed cooling.
//#define BED_ANNEALING_GCODE //#define BED_ANNEALING_GCODE
@@ -884,8 +827,6 @@
// FIND YOUR OWN: "M303 E-2 C8 S50" to run autotune on the chamber at 50 degreesC for 8 cycles. // FIND YOUR OWN: "M303 E-2 C8 S50" to run autotune on the chamber at 50 degreesC for 8 cycles.
#endif // PIDTEMPCHAMBER #endif // PIDTEMPCHAMBER
// @section pid temp
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER) #if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
//#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
@@ -1065,6 +1006,9 @@
// Radius around the center where the arm cannot reach // Radius around the center where the arm cannot reach
#define MIDDLE_DEAD_ZONE_R 0 // (mm) #define MIDDLE_DEAD_ZONE_R 0 // (mm)
#define THETA_HOMING_OFFSET 0 // Calculated from Calibration Guide and M360 / M114. See https://www.morgan3dp.com/morgan-calibration-guide/
#define PSI_HOMING_OFFSET 0 // Calculated from Calibration Guide and M364 / M114. See https://www.morgan3dp.com/morgan-calibration-guide/
#elif ENABLED(MP_SCARA) #elif ENABLED(MP_SCARA)
#define SCARA_OFFSET_THETA1 12 // degrees #define SCARA_OFFSET_THETA1 12 // degrees
@@ -1086,8 +1030,8 @@
#define TPARA_LINKAGE_1 120 // (mm) #define TPARA_LINKAGE_1 120 // (mm)
#define TPARA_LINKAGE_2 120 // (mm) #define TPARA_LINKAGE_2 120 // (mm)
// TPARA tower offset (position of Tower relative to bed zero position) // SCARA tower offset (position of Tower relative to bed zero position)
// This needs to be reasonably accurate as it defines the printbed position in the TPARA space. // This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
#define TPARA_OFFSET_X 0 // (mm) #define TPARA_OFFSET_X 0 // (mm)
#define TPARA_OFFSET_Y 0 // (mm) #define TPARA_OFFSET_Y 0 // (mm)
#define TPARA_OFFSET_Z 0 // (mm) #define TPARA_OFFSET_Z 0 // (mm)
@@ -1096,6 +1040,10 @@
// Radius around the center where the arm cannot reach // Radius around the center where the arm cannot reach
#define MIDDLE_DEAD_ZONE_R 0 // (mm) #define MIDDLE_DEAD_ZONE_R 0 // (mm)
// Calculated from Calibration Guide and M360 / M114. See https://www.morgan3dp.com/morgan-calibration-guide/
#define THETA_HOMING_OFFSET 0
#define PSI_HOMING_OFFSET 0
#endif #endif
// @section polar // @section polar
@@ -1504,8 +1452,7 @@
* A lightweight, solenoid-driven probe. * A lightweight, solenoid-driven probe.
* For information about this sensor https://github.com/bigtreetech/MicroProbe * For information about this sensor https://github.com/bigtreetech/MicroProbe
* *
* Also requires PROBE_ENABLE_DISABLE * Also requires: PROBE_ENABLE_DISABLE
* With FT_MOTION requires ENDSTOP_INTERRUPTS_FEATURE
*/ */
//#define BIQU_MICROPROBE_V1 // Triggers HIGH //#define BIQU_MICROPROBE_V1 // Triggers HIGH
//#define BIQU_MICROPROBE_V2 // Triggers LOW //#define BIQU_MICROPROBE_V2 // Triggers LOW
@@ -1644,8 +1591,7 @@
// with NOZZLE_AS_PROBE this can be negative for a wider probing area. // with NOZZLE_AS_PROBE this can be negative for a wider probing area.
#define PROBING_MARGIN 10 #define PROBING_MARGIN 10
// X and Y axis travel speed (mm/min) between probes. // X and Y axis travel speed (mm/min) between probes
// Leave undefined to use the average of the current XY homing feedrate.
#define XY_PROBE_FEEDRATE (133*60) #define XY_PROBE_FEEDRATE (133*60)
// Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2) // Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2)
@@ -1676,7 +1622,6 @@
#define PROBE_TARE_DELAY 200 // (ms) Delay after tare before #define PROBE_TARE_DELAY 200 // (ms) Delay after tare before
#define PROBE_TARE_STATE HIGH // State to write pin for tare #define PROBE_TARE_STATE HIGH // State to write pin for tare
//#define PROBE_TARE_PIN PA5 // Override default pin //#define PROBE_TARE_PIN PA5 // Override default pin
//#define PROBE_TARE_MENU // Display a menu item to tare the probe
#if ENABLED(PROBE_ACTIVATION_SWITCH) #if ENABLED(PROBE_ACTIVATION_SWITCH)
//#define PROBE_TARE_ONLY_WHILE_INACTIVE // Fail to tare/probe if PROBE_ACTIVATION_SWITCH is active //#define PROBE_TARE_ONLY_WHILE_INACTIVE // Fail to tare/probe if PROBE_ACTIVATION_SWITCH is active
#endif #endif
@@ -1714,8 +1659,8 @@
* probe Z Offset set with NOZZLE_TO_PROBE_OFFSET, M851, or the LCD. * probe Z Offset set with NOZZLE_TO_PROBE_OFFSET, M851, or the LCD.
* Only integer values >= 1 are valid here. * Only integer values >= 1 are valid here.
* *
* Example: 'M851 Z-5' with a CLEARANCE of 4 => 9mm from bed to nozzle. * 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. * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle.
*/ */
#define Z_CLEARANCE_DEPLOY_PROBE 10 // (mm) Z Clearance for Deploy/Stow #define Z_CLEARANCE_DEPLOY_PROBE 10 // (mm) Z Clearance for Deploy/Stow
#define Z_CLEARANCE_BETWEEN_PROBES 5 // (mm) Z Clearance between probe points #define Z_CLEARANCE_BETWEEN_PROBES 5 // (mm) Z Clearance between probe points
@@ -1766,8 +1711,6 @@
#define PROBING_BED_TEMP 50 #define PROBING_BED_TEMP 50
#endif #endif
// @section stepper drivers
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
// :{ 0:'Low', 1:'High' } // :{ 0:'Low', 1:'High' }
#define X_ENABLE_ON 0 #define X_ENABLE_ON 0
@@ -1941,8 +1884,6 @@
#endif #endif
/** /**
* @section filament runout sensors
*
* Filament Runout Sensors * Filament Runout Sensors
* Mechanical or opto endstops are used to check for the presence of filament. * Mechanical or opto endstops are used to check for the presence of filament.
* *
@@ -2275,7 +2216,7 @@
#if ENABLED(LCD_BED_TRAMMING) #if ENABLED(LCD_BED_TRAMMING)
#define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets #define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
#define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at tramming points #define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at tramming points
#define BED_TRAMMING_Z_HOP 4.0 // (mm) Z raise between tramming points #define BED_TRAMMING_Z_HOP 4.0 // (mm) Z height of nozzle between tramming points
//#define BED_TRAMMING_INCLUDE_CENTER // Move to the center after the last corner //#define BED_TRAMMING_INCLUDE_CENTER // Move to the center after the last corner
//#define BED_TRAMMING_USE_PROBE //#define BED_TRAMMING_USE_PROBE
#if ENABLED(BED_TRAMMING_USE_PROBE) #if ENABLED(BED_TRAMMING_USE_PROBE)
@@ -2339,9 +2280,6 @@
// Homing speeds (linear=mm/min, rotational=°/min) // Homing speeds (linear=mm/min, rotational=°/min)
#define HOMING_FEEDRATE_MM_M { (50*60), (50*60), (4*60) } #define HOMING_FEEDRATE_MM_M { (50*60), (50*60), (4*60) }
// Edit homing feedrates with M210 and MarlinUI menu items
//#define EDITABLE_HOMING_FEEDRATE
// Validate that endstops are triggered on homing moves // Validate that endstops are triggered on homing moves
#define VALIDATE_HOMING_ENDSTOPS #define VALIDATE_HOMING_ENDSTOPS
@@ -2468,9 +2406,9 @@
#define PREHEAT_2_TEMP_CHAMBER 35 #define PREHEAT_2_TEMP_CHAMBER 35
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
// @section motion
/** /**
* @section nozzle park
*
* Nozzle Park * Nozzle Park
* *
* Park the nozzle at the given XYZ position on idle or G27. * Park the nozzle at the given XYZ position on idle or G27.
@@ -2493,8 +2431,6 @@
#endif #endif
/** /**
* @section nozzle clean
*
* Clean Nozzle Feature * Clean Nozzle Feature
* *
* Adds the G12 command to perform a nozzle cleaning process. * Adds the G12 command to perform a nozzle cleaning process.
@@ -2655,24 +2591,9 @@
//#include "Configuration_Secure.h" // External file with PASSWORD_DEFAULT_VALUE //#include "Configuration_Secure.h" // External file with PASSWORD_DEFAULT_VALUE
#endif #endif
// @section media //=============================================================================
//============================= LCD and SD support ============================
/** //=============================================================================
* SD CARD
*
* SD Card support is disabled by default. If your controller has an SD slot,
* you must uncomment the following option or it won't work.
*/
//#define SDSUPPORT
/**
* SD CARD: ENABLE CRC
*
* Use CRC checks and retries on the SD communication.
*/
#if ENABLED(SDSUPPORT)
//#define SD_CHECK_AND_RETRY
#endif
// @section interface // @section interface
@@ -2713,12 +2634,27 @@
#define DISPLAY_CHARSET_HD44780 JAPANESE #define DISPLAY_CHARSET_HD44780 JAPANESE
/** /**
* Info Screen Style (0:Classic, 1:Průša, 2:CNC) * Info Screen Style (0:Classic, 1:Průša)
* *
* :[0:'Classic', 1:'Průša', 2:'CNC'] * :[0:'Classic', 1:'Průša']
*/ */
#define LCD_INFO_SCREEN_STYLE 0 #define LCD_INFO_SCREEN_STYLE 0
/**
* SD CARD
*
* SD Card support is disabled by default. If your controller has an SD slot,
* you must uncomment the following option or it won't work.
*/
//#define SDSUPPORT
/**
* SD CARD: ENABLE CRC
*
* Use CRC checks and retries on the SD communication.
*/
//#define SD_CHECK_AND_RETRY
/** /**
* LCD Menu Items * LCD Menu Items
* *
@@ -2847,7 +2783,7 @@
// //
// Original RADDS LCD Display+Encoder+SDCardReader // Original RADDS LCD Display+Encoder+SDCardReader
// https://web.archive.org/web/20200719145306/doku.radds.org/dokumentation/lcd-display/ // https://web.archive.org/web/20200719145306/http://doku.radds.org/dokumentation/lcd-display/
// //
//#define RADDS_DISPLAY //#define RADDS_DISPLAY
@@ -2913,7 +2849,7 @@
// //
// Elefu RA Board Control Panel // Elefu RA Board Control Panel
// https://web.archive.org/web/20140823033947/www.elefu.com/index.php?route=product/product&product_id=53 // https://web.archive.org/web/20140823033947/http://www.elefu.com/index.php?route=product/product&product_id=53
// //
//#define RA_CONTROL_PANEL //#define RA_CONTROL_PANEL
@@ -3045,7 +2981,7 @@
// //
// Cartesio UI // Cartesio UI
// https://web.archive.org/web/20180605050442/mauk.cc/webshop/cartesio-shop/electronics/user-interface // https://web.archive.org/web/20180605050442/http://mauk.cc/webshop/cartesio-shop/electronics/user-interface
// //
//#define CARTESIO_UI //#define CARTESIO_UI
@@ -3282,11 +3218,6 @@
// //
//#define ANYCUBIC_LCD_VYPER //#define ANYCUBIC_LCD_VYPER
//
// Sovol SV-06 Resistive Touch Screen
//
//#define SOVOL_SV06_RTS
// //
// 320x240 Nextion 2.8" serial TFT Resistive Touch Screen NX3224T028 // 320x240 Nextion 2.8" serial TFT Resistive Touch Screen NX3224T028
// //
@@ -3482,9 +3413,8 @@
#define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens #define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus #define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
#if ANY(TFT_CLASSIC_UI, TFT_COLOR_UI) //#define DISABLE_ENCODER // Disable the click encoder, if any
//#define NO_BACK_MENU_ITEM // Don't display a top menu item to go back to the parent menu //#define TOUCH_IDLE_SLEEP_MINS 5 // (minutes) Display Sleep after a period of inactivity. Set with M255 S.
#endif
#define TOUCH_SCREEN_CALIBRATION #define TOUCH_SCREEN_CALIBRATION
+117 -244
View File
@@ -47,9 +47,8 @@
* 2 = config.ini - File format for PlatformIO preprocessing. * 2 = config.ini - File format for PlatformIO preprocessing.
* 3 = schema.json - The entire configuration schema. (13 = pattern groups) * 3 = schema.json - The entire configuration schema. (13 = pattern groups)
* 4 = schema.yml - The entire configuration schema. * 4 = schema.yml - The entire configuration schema.
* 5 = Config.h - Minimal configuration by popular demand.
*/ */
//#define CONFIG_EXPORT 105 // :[1:'JSON', 2:'config.ini', 3:'schema.json', 4:'schema.yml', 5:'Config.h'] //#define CONFIG_EXPORT 2 // :[1:'JSON', 2:'config.ini', 3:'schema.json', 4:'schema.yml']
//=========================================================================== //===========================================================================
//============================= Thermal Settings ============================ //============================= Thermal Settings ============================
@@ -203,7 +202,7 @@
// //
#if DISABLED(PIDTEMPBED) #if DISABLED(PIDTEMPBED)
#define BED_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control #define BED_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control
#if ANY(BED_LIMIT_SWITCHING, PELTIER_BED) #if ENABLED(BED_LIMIT_SWITCHING)
#define BED_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > BED_HYSTERESIS #define BED_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > BED_HYSTERESIS
#endif #endif
#endif #endif
@@ -304,7 +303,7 @@
* If you get false positives for "Thermal Runaway", increase * If you get false positives for "Thermal Runaway", increase
* THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
*/ */
#if ALL(HAS_HOTEND, THERMAL_PROTECTION_HOTENDS) #if ENABLED(THERMAL_PROTECTION_HOTENDS)
#define THERMAL_PROTECTION_PERIOD 40 // (seconds) #define THERMAL_PROTECTION_PERIOD 40 // (seconds)
#define THERMAL_PROTECTION_HYSTERESIS 4 // (°C) #define THERMAL_PROTECTION_HYSTERESIS 4 // (°C)
@@ -335,7 +334,7 @@
/** /**
* Thermal Protection parameters for the bed are just as above for hotends. * Thermal Protection parameters for the bed are just as above for hotends.
*/ */
#if TEMP_SENSOR_BED && ENABLED(THERMAL_PROTECTION_BED) #if ENABLED(THERMAL_PROTECTION_BED)
#define THERMAL_PROTECTION_BED_PERIOD 20 // (seconds) #define THERMAL_PROTECTION_BED_PERIOD 20 // (seconds)
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // (°C) #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // (°C)
@@ -349,7 +348,7 @@
/** /**
* Thermal Protection parameters for the heated chamber. * Thermal Protection parameters for the heated chamber.
*/ */
#if TEMP_SENSOR_CHAMBER && ENABLED(THERMAL_PROTECTION_CHAMBER) #if ENABLED(THERMAL_PROTECTION_CHAMBER)
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // (seconds) #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // (seconds)
#define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // (°C) #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // (°C)
@@ -363,7 +362,7 @@
/** /**
* Thermal Protection parameters for the laser cooler. * Thermal Protection parameters for the laser cooler.
*/ */
#if TEMP_SENSOR_COOLER && ENABLED(THERMAL_PROTECTION_COOLER) #if ENABLED(THERMAL_PROTECTION_COOLER)
#define THERMAL_PROTECTION_COOLER_PERIOD 10 // (seconds) #define THERMAL_PROTECTION_COOLER_PERIOD 10 // (seconds)
#define THERMAL_PROTECTION_COOLER_HYSTERESIS 3 // (°C) #define THERMAL_PROTECTION_COOLER_HYSTERESIS 3 // (°C)
@@ -591,8 +590,6 @@
// Use TEMP_SENSOR_SOC as a trigger for enabling the controller fan // Use TEMP_SENSOR_SOC as a trigger for enabling the controller fan
//#define CONTROLLER_FAN_MIN_SOC_TEMP 40 // (°C) Turn on the fan if the SoC reaches this temperature //#define CONTROLLER_FAN_MIN_SOC_TEMP 40 // (°C) Turn on the fan if the SoC reaches this temperature
#define CONTROLLER_FAN_BED_HEATING // Turn on the fan when heating the bed
//#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings //#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings
#if ENABLED(CONTROLLER_FAN_EDITABLE) #if ENABLED(CONTROLLER_FAN_EDITABLE)
#define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu
@@ -607,8 +604,6 @@
*/ */
//#define FAN_KICKSTART_TIME 100 // (ms) //#define FAN_KICKSTART_TIME 100 // (ms)
//#define FAN_KICKSTART_POWER 180 // 64-255 //#define FAN_KICKSTART_POWER 180 // 64-255
//#define FAN_KICKSTART_LINEAR // Set kickstart time linearly based on the speed, e.g., for 20% (51) it will be FAN_KICKSTART_TIME * 0.2.
// Useful for quick speed up to low speed. Kickstart power must be set to 255.
// Some coolers may require a non-zero "off" state. // Some coolers may require a non-zero "off" state.
//#define FAN_OFF_PWM 1 //#define FAN_OFF_PWM 1
@@ -1084,11 +1079,9 @@
#define HOME_AFTER_G34 #define HOME_AFTER_G34
#endif #endif
/** //
* Assisted Tramming // Add the G35 command to read bed corners to help adjust screws. Requires a bed probe.
* //
* Add the G35 command to measure bed corners and help adjust screws. Requires a bed probe.
*/
//#define ASSISTED_TRAMMING //#define ASSISTED_TRAMMING
#if ENABLED(ASSISTED_TRAMMING) #if ENABLED(ASSISTED_TRAMMING)
@@ -1109,35 +1102,29 @@
//#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment //#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
/** /**
* Screw Thread. Use one of the following defines: * Screw thread:
* * M3: 30 = Clockwise, 31 = Counter-Clockwise
* M3_CW = M3 Clockwise, M3_CCW = M3 Counter-Clockwise * M4: 40 = Clockwise, 41 = Counter-Clockwise
* M4_CW = M4 Clockwise, M4_CCW = M4 Counter-Clockwise * M5: 50 = Clockwise, 51 = Counter-Clockwise
* M5_CW = M5 Clockwise, M5_CCW = M5 Counter-Clockwise
*
* :{'M3_CW':'M3 Clockwise','M3_CCW':'M3 Counter-Clockwise','M4_CW':'M4 Clockwise','M4_CCW':'M4 Counter-Clockwise','M5_CW':'M5 Clockwise','M5_CCW':'M5 Counter-Clockwise'}
*/ */
#define TRAMMING_SCREW_THREAD M3_CW #define TRAMMING_SCREW_THREAD 30
#endif #endif
// @section motion control // @section motion control
/** /**
* Fixed-time-based Motion Control -- BETA FEATURE * Fixed-time-based Motion Control -- EXPERIMENTAL
* Enable/disable and set parameters with G-code M493. * Enable/disable and set parameters with G-code M493.
* See ft_types.h for named values used by FTM options.
*/ */
//#define FT_MOTION //#define FT_MOTION
#if ENABLED(FT_MOTION) #if ENABLED(FT_MOTION)
//#define FTM_IS_DEFAULT_MOTION // Use FT Motion as the factory default? #define FTM_DEFAULT_MODE ftMotionMode_DISABLED // Default mode of fixed time control. (Enums in ft_types.h)
#define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (DISABLED, Z_BASED, MASS_BASED) #define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (Enums in ft_types.h)
#define FTM_DEFAULT_SHAPER_X ftMotionShaper_NONE // Default shaper mode on X axis (NONE, ZV, ZVD, ZVDD, ZVDDD, EI, 2HEI, 3HEI, MZV) #define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers
#define FTM_DEFAULT_SHAPER_Y ftMotionShaper_NONE // Default shaper mode on Y axis #define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers
#define FTM_SHAPING_DEFAULT_FREQ_X 37.0f // (Hz) Default peak frequency used by input shapers
#define FTM_SHAPING_DEFAULT_FREQ_Y 37.0f // (Hz) Default peak frequency used by input shapers
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false) #define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false)
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain. (Acceleration-based scaling factor.) #define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain
#define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis #define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis
#define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis #define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis
@@ -1160,13 +1147,18 @@
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS) #define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS)
#define FTM_TS 0.001f // (s) Time step for trajectory generation. (Reciprocal of FTM_FS) #define FTM_TS 0.001f // (s) Time step for trajectory generation. (Reciprocal of FTM_FS)
// These values may be configured to adjust the duration of loop().
#define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop()
#define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop()
#if DISABLED(COREXY) #if DISABLED(COREXY)
#define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update #define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update
// Use this to adjust the time required to consume the command buffer. // Use this to adjust the time required to consume the command buffer.
// Try increasing this value if stepper motion is choppy. // Try increasing this value if stepper motion is choppy.
#define FTM_STEPPERCMD_BUFF_SIZE 3000 // Size of the stepper command buffers #define FTM_STEPPERCMD_BUFF_SIZE 3000 // Size of the stepper command buffers
// (FTM_STEPS_PER_LOOP * FTM_POINTS_PER_LOOP) is a good start
// If you run out of memory, fall back to 3000 and increase progressively
#else #else
// CoreXY motion needs a larger buffer size. These values are based on our testing. // CoreXY motion needs a larger buffer size. These values are based on our testing.
#define FTM_STEPPER_FS 30000 #define FTM_STEPPER_FS 30000
@@ -1188,37 +1180,38 @@
#endif #endif
/** /**
* Input Shaping * Input Shaping -- EXPERIMENTAL
* *
* Zero Vibration (ZV) Input Shaping for X and/or Y movements. * Zero Vibration (ZV) Input Shaping for X and/or Y movements.
* *
* This option uses a lot of SRAM for the step buffer. The buffer size is * This option uses a lot of SRAM for the step buffer. The buffer size is
* calculated automatically from SHAPING_FREQ_[XYZ], DEFAULT_AXIS_STEPS_PER_UNIT, * calculated automatically from SHAPING_FREQ_[XY], DEFAULT_AXIS_STEPS_PER_UNIT,
* DEFAULT_MAX_FEEDRATE and ADAPTIVE_STEP_SMOOTHING. The default calculation can * DEFAULT_MAX_FEEDRATE and ADAPTIVE_STEP_SMOOTHING. The default calculation can
* be overridden by setting SHAPING_MIN_FREQ and/or SHAPING_MAX_FEEDRATE. * be overridden by setting SHAPING_MIN_FREQ and/or SHAPING_MAX_FEEDRATE.
* The higher the frequency and the lower the feedrate, the smaller the buffer. * The higher the frequency and the lower the feedrate, the smaller the buffer.
* If the buffer is too small at runtime, input shaping will have reduced * If the buffer is too small at runtime, input shaping will have reduced
* effectiveness during high speed movements. * effectiveness during high speed movements.
* *
* Tune with M593 D<factor> F<frequency> * Tune with M593 D<factor> F<frequency>:
*
* D<factor> Set the zeta/damping factor. If axes (X, Y, etc.) are not specified, set for all axes.
* F<frequency> Set the frequency. If axes (X, Y, etc.) are not specified, set for all axes.
* T[map] Input Shaping type, 0:ZV, 1:EI, 2:2H EI (not implemented yet)
* X<1> Set the given parameters only for the X axis.
* Y<1> Set the given parameters only for the Y axis.
*/ */
//#define INPUT_SHAPING_X //#define INPUT_SHAPING_X
//#define INPUT_SHAPING_Y //#define INPUT_SHAPING_Y
//#define INPUT_SHAPING_Z #if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y)
#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y, INPUT_SHAPING_Z)
#if ENABLED(INPUT_SHAPING_X) #if ENABLED(INPUT_SHAPING_X)
#define SHAPING_FREQ_X 40.0 // (Hz) The default dominant resonant frequency on the X axis. #define SHAPING_FREQ_X 40 // (Hz) The default dominant resonant frequency on the X axis.
#define SHAPING_ZETA_X 0.15 // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). #define SHAPING_ZETA_X 0.15f // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping).
#endif #endif
#if ENABLED(INPUT_SHAPING_Y) #if ENABLED(INPUT_SHAPING_Y)
#define SHAPING_FREQ_Y 40.0 // (Hz) The default dominant resonant frequency on the Y axis. #define SHAPING_FREQ_Y 40 // (Hz) The default dominant resonant frequency on the Y axis.
#define SHAPING_ZETA_Y 0.15 // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping). #define SHAPING_ZETA_Y 0.15f // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping).
#endif #endif
#if ENABLED(INPUT_SHAPING_Z) //#define SHAPING_MIN_FREQ 20 // By default the minimum of the shaping frequencies. Override to affect SRAM usage.
#define SHAPING_FREQ_Z 40.0 // (Hz) The default dominant resonant frequency on the Z axis.
#define SHAPING_ZETA_Z 0.15 // Damping ratio of the Z axis (range: 0.0 = no damping to 1.0 = critical damping).
#endif
//#define SHAPING_MIN_FREQ 20.0 // (Hz) By default the minimum of the shaping frequencies. Override to affect SRAM usage.
//#define SHAPING_MAX_STEPRATE 10000 // By default the maximum total step rate of the shaped axes. Override to affect SRAM usage. //#define SHAPING_MAX_STEPRATE 10000 // By default the maximum total step rate of the shaped axes. Override to affect SRAM usage.
//#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters. //#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters.
#endif #endif
@@ -1277,11 +1270,11 @@
* XY Frequency limit * XY Frequency limit
* Reduce resonance by limiting the frequency of small zigzag infill moves. * Reduce resonance by limiting the frequency of small zigzag infill moves.
* See https://hydraraptor.blogspot.com/2010/12/frequency-limit.html * See https://hydraraptor.blogspot.com/2010/12/frequency-limit.html
* Use M201 F<freq> S<min%> to change limits at runtime. * Use M201 F<freq> G<min%> to change limits at runtime.
*/ */
//#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F<hertz>. //#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F<hertz>.
#ifdef XY_FREQUENCY_LIMIT #ifdef XY_FREQUENCY_LIMIT
#define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 S<min%>. #define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 G<min%>.
#endif #endif
// //
@@ -1339,6 +1332,8 @@
//#define CALIBRATION_SCRIPT_PRE "M117 Starting Auto-Calibration\nT0\nG28\nG12\nM117 Calibrating..." //#define CALIBRATION_SCRIPT_PRE "M117 Starting Auto-Calibration\nT0\nG28\nG12\nM117 Calibrating..."
//#define CALIBRATION_SCRIPT_POST "M500\nM117 Calibration data saved" //#define CALIBRATION_SCRIPT_POST "M500\nM117 Calibration data saved"
#define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm
#define CALIBRATION_FEEDRATE_SLOW 60 // mm/min #define CALIBRATION_FEEDRATE_SLOW 60 // mm/min
#define CALIBRATION_FEEDRATE_FAST 1200 // mm/min #define CALIBRATION_FEEDRATE_FAST 1200 // mm/min
#define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/min #define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/min
@@ -1497,17 +1492,8 @@
#define FEEDRATE_CHANGE_BEEP_FREQUENCY 440 #define FEEDRATE_CHANGE_BEEP_FREQUENCY 440
#endif #endif
/**
* Probe Offset Wizard
* Add a Probe Z Offset calibration option to the LCD menu.
* Use this helper to get a perfect 'M851 Z' probe offset.
* When launched this powerful wizard:
* - Measures the bed height at the configured position with the probe.
* - Moves the nozzle to the same position for a "paper" measurement.
* - The difference is used to set the probe Z offset.
*/
#if HAS_BED_PROBE && ANY(HAS_MARLINUI_MENU, HAS_TFT_LVGL_UI) #if HAS_BED_PROBE && ANY(HAS_MARLINUI_MENU, HAS_TFT_LVGL_UI)
//#define PROBE_OFFSET_WIZARD //#define PROBE_OFFSET_WIZARD // Add a Probe Z Offset calibration option to the LCD menu
#if ENABLED(PROBE_OFFSET_WIZARD) #if ENABLED(PROBE_OFFSET_WIZARD)
/** /**
* Enable to init the Probe Z-Offset when starting the Wizard. * Enable to init the Probe Z-Offset when starting the Wizard.
@@ -1524,10 +1510,6 @@
#if HAS_MARLINUI_MENU #if HAS_MARLINUI_MENU
#if HAS_BED_PROBE #if HAS_BED_PROBE
// Show Deploy / Stow Probe options in the Motion menu.
#define PROBE_DEPLOY_STOW_MENU
// Add calibration in the Probe Offsets menu to compensate for X-axis twist. // Add calibration in the Probe Offsets menu to compensate for X-axis twist.
//#define X_AXIS_TWIST_COMPENSATION //#define X_AXIS_TWIST_COMPENSATION
#if ENABLED(X_AXIS_TWIST_COMPENSATION) #if ENABLED(X_AXIS_TWIST_COMPENSATION)
@@ -1542,6 +1524,8 @@
#define XATC_Z_OFFSETS { 0, 0, 0 } // Z offsets for X axis sample points #define XATC_Z_OFFSETS { 0, 0, 0 } // Z offsets for X axis sample points
#endif #endif
// Show Deploy / Stow Probe options in the Motion menu.
#define PROBE_DEPLOY_STOW_MENU
#endif #endif
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
@@ -1572,9 +1556,6 @@
// BACK menu items keep the highlight at the top // BACK menu items keep the highlight at the top
//#define TURBO_BACK_MENU_ITEM //#define TURBO_BACK_MENU_ITEM
// BACK menu items show "Back" instead of the previous menu name
//#define GENERIC_BACK_MENU_ITEM
// Insert a menu for preheating at the top level to allow for quick access // Insert a menu for preheating at the top level to allow for quick access
//#define PREHEAT_SHORTCUT_MENU_ITEM //#define PREHEAT_SHORTCUT_MENU_ITEM
@@ -1603,7 +1584,7 @@
#if HAS_MARLINUI_U8GLIB #if HAS_MARLINUI_U8GLIB
//#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash. //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash.
#endif #endif
#if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, HAS_MARLINUI_HD44780) #if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE)
//#define SHOW_CUSTOM_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup. //#define SHOW_CUSTOM_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup.
#endif #endif
#endif #endif
@@ -1989,6 +1970,17 @@
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
//#define USE_SMALL_INFOFONT //#define USE_SMALL_INFOFONT
/**
* Graphical Display Sleep
*
* The U8G library provides sleep / wake functions for SH1106, SSD1306,
* SSD1309, and some other DOGM displays.
* Enable this option to save energy and prevent OLED pixel burn-in.
* Adds the menu item Configuration > LCD Timeout (m) to set a wait period
* from 0 (disabled) to 99 minutes.
*/
//#define DISPLAY_SLEEP_MINUTES 2 // (minutes) Timeout before turning off the screen. Set with M255 S.
/** /**
* ST7920-based LCDs can emulate a 16 x 4 character display using * ST7920-based LCDs can emulate a 16 x 4 character display using
* the ST7920 character-generator for very fast screen updates. * the ST7920 character-generator for very fast screen updates.
@@ -2237,20 +2229,13 @@
//#define TFT_BTOKMENU_COLOR 0x145F // 00010 100010 11111 Cyan //#define TFT_BTOKMENU_COLOR 0x145F // 00010 100010 11111 Cyan
#endif #endif
/** //
* Display Sleep // LCD Backlight Timeout
* Enable this option to save energy and prevent OLED pixel burn-in. // Requires a display with a controllable backlight
*/ //
//#define DISPLAY_SLEEP_MINUTES 2 // (minutes) Timeout before turning off the screen
/**
* LCD Backlight Timeout
* Requires a display with a controllable backlight
*/
//#define LCD_BACKLIGHT_TIMEOUT_MINS 1 // (minutes) Timeout before turning off the backlight //#define LCD_BACKLIGHT_TIMEOUT_MINS 1 // (minutes) Timeout before turning off the backlight
#if defined(DISPLAY_SLEEP_MINUTES) || defined(LCD_BACKLIGHT_TIMEOUT_MINS) #if defined(DISPLAY_SLEEP_MINUTES) || defined(LCD_BACKLIGHT_TIMEOUT_MINS)
#define EDITABLE_DISPLAY_TIMEOUT // Edit sleep / backlight timeout with M255 S<minutes> and a menu item #define EDITABLE_DISPLAY_TIMEOUT // Edit timeout with M255 S<minutes> and a menu item
#endif #endif
// //
@@ -2349,7 +2334,6 @@
* *
* Control extrusion rate based on instantaneous extruder velocity. Can be used to correct for * Control extrusion rate based on instantaneous extruder velocity. Can be used to correct for
* underextrusion at high extruder speeds that are otherwise well-behaved (i.e., not skipping). * underextrusion at high extruder speeds that are otherwise well-behaved (i.e., not skipping).
* For better results also enable ADAPTIVE_STEP_SMOOTHING.
*/ */
//#define NONLINEAR_EXTRUSION //#define NONLINEAR_EXTRUSION
@@ -2577,22 +2561,21 @@
//#define MINIMUM_STEPPER_PRE_DIR_DELAY 650 //#define MINIMUM_STEPPER_PRE_DIR_DELAY 650
/** /**
* Minimum stepper driver pulse width (in ns) * Minimum stepper driver pulse width (in µs)
* If undefined, these defaults (from Conditionals-4-adv.h) apply: * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers
* 100 : Minimum for TMC2xxx stepper drivers * 0 : Minimum 500ns for LV8729, adjusted in stepper.h
* 500 : Minimum for LV8729 * 1 : Minimum for A4988 and A5984 stepper drivers
* 1000 : Minimum for A4988 and A5984 stepper drivers * 2 : Minimum for DRV8825 stepper drivers
* 2000 : Minimum for DRV8825 stepper drivers * 3 : Minimum for TB6600 stepper drivers
* 3000 : Minimum for TB6600 stepper drivers * 30 : Minimum for TB6560 stepper drivers
* 30000 : Minimum for TB6560 stepper drivers
* *
* Override the default value based on the driver type set in Configuration.h. * Override the default value based on the driver type set in Configuration.h.
*/ */
//#define MINIMUM_STEPPER_PULSE_NS 2000 //#define MINIMUM_STEPPER_PULSE 2
/** /**
* Maximum stepping rate (in Hz) the stepper driver allows * Maximum stepping rate (in Hz) the stepper driver allows
* If undefined, these defaults (from Conditionals-4-adv.h) apply: * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE)
* 5000000 : Maximum for TMC2xxx stepper drivers * 5000000 : Maximum for TMC2xxx stepper drivers
* 1000000 : Maximum for LV8729 stepper driver * 1000000 : Maximum for LV8729 stepper driver
* 500000 : Maximum for A4988 stepper driver * 500000 : Maximum for A4988 stepper driver
@@ -2719,14 +2702,14 @@
* This feature is EXPERIMENTAL so use with caution and test thoroughly. * This feature is EXPERIMENTAL so use with caution and test thoroughly.
* Enable this option to receive data on the serial ports via the onboard DMA * Enable this option to receive data on the serial ports via the onboard DMA
* controller for more stable and reliable high-speed serial communication. * controller for more stable and reliable high-speed serial communication.
* Support is currently limited to some STM32 MCUs and all HC32 MCUs. * Only some STM32 MCUs are currently supported.
* Note: This has no effect on emulated USB serial ports. * Note: This has no effect on emulated USB serial ports.
*/ */
//#define SERIAL_DMA //#define SERIAL_DMA
/** /**
* Set the number of proportional font spaces required to fill up a typical character space. * Set the number of proportional font spaces required to fill up a typical character space.
* This can help to better align the output of commands like 'G29 O' Mesh Output. * This can help to better align the output of commands like `G29 O` Mesh Output.
* *
* For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0.
* Otherwise, adjust according to your client and font. * Otherwise, adjust according to your client and font.
@@ -2974,12 +2957,15 @@
* Some boards have simple jumper connections! See your board's documentation. * Some boards have simple jumper connections! See your board's documentation.
* - These drivers can also be used with Hardware Serial. * - These drivers can also be used with Hardware Serial.
* *
* The TMC26XStepper library is required for TMC26X stepper drivers.
* https://github.com/MarlinFirmware/TMC26XStepper
*
* The TMCStepper library is required for other TMC stepper drivers. * The TMCStepper library is required for other TMC stepper drivers.
* https://github.com/teemuatlut/TMCStepper * https://github.com/teemuatlut/TMCStepper
* *
* @section tmc/config * @section tmc/config
*/ */
#if HAS_TRINAMIC_CONFIG #if HAS_TRINAMIC_CONFIG || HAS_TMC26X
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
@@ -2991,9 +2977,9 @@
#if AXIS_IS_TMC_CONFIG(X) #if AXIS_IS_TMC_CONFIG(X)
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
#define X_CURRENT_HOME X_CURRENT // (mA) RMS current for homing. (Typically lower than *_CURRENT.) #define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing
#define X_MICROSTEPS 16 // 0..256 #define X_MICROSTEPS 16 // 0..256
#define X_RSENSE 0.11 #define X_RSENSE 0.11 // Multiplied x1000 for TMC26X
#define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ... #define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ...
//#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis //#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis
//#define X_HOLD_MULTIPLIER 0.5 // Enable to override 'HOLD_MULTIPLIER' for the X axis //#define X_HOLD_MULTIPLIER 0.5 // Enable to override 'HOLD_MULTIPLIER' for the X axis
@@ -3201,13 +3187,6 @@
//#define E7_HOLD_MULTIPLIER 0.5 //#define E7_HOLD_MULTIPLIER 0.5
#endif #endif
/**
* Use the homing current for all probing. (e.g., Current may be reduced to the
* point where a collision makes the motor skip instead of damaging the bed,
* though this is unlikely to save delicate probes from being damaged.
*/
//#define PROBING_USE_CURRENT_HOME
// @section tmc/spi // @section tmc/spi
/** /**
@@ -3472,7 +3451,7 @@
/** /**
* Step on both rising and falling edge signals (as with a square wave). * Step on both rising and falling edge signals (as with a square wave).
*/ */
#define EDGE_STEPPING //#define EDGE_STEPPING
/** /**
* Enable M122 debugging command for TMC stepper drivers. * Enable M122 debugging command for TMC stepper drivers.
@@ -3493,7 +3472,7 @@
*/ */
#define TMC_ADV() { } #define TMC_ADV() { }
#endif // HAS_TRINAMIC_CONFIG #endif // HAS_TRINAMIC_CONFIG || HAS_TMC26X
// @section i2cbus // @section i2cbus
@@ -3554,7 +3533,7 @@
//#define PHOTOGRAPH_PIN 23 //#define PHOTOGRAPH_PIN 23
// Canon Hack Development Kit // Canon Hack Development Kit
// https://web.archive.org/web/20200920094805/captain-slow.dk/2014/03/09/3d-printing-timelapses/ // https://web.archive.org/web/20200920094805/https://captain-slow.dk/2014/03/09/3d-printing-timelapses/
//#define CHDK_PIN 4 //#define CHDK_PIN 4
// Optional second move with delay to trigger the camera shutter // Optional second move with delay to trigger the camera shutter
@@ -3586,7 +3565,7 @@
* Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and
* to set spindle speed, spindle direction, and laser power. * to set spindle speed, spindle direction, and laser power.
* *
* SuperPID is a router/spindle speed controller used in the CNC milling community. * SuperPid is a router/spindle speed controller used in the CNC milling community.
* Marlin can be used to turn the spindle on and off. It can also be used to set * Marlin can be used to turn the spindle on and off. It can also be used to set
* the spindle speed from 5,000 to 30,000 RPM. * the spindle speed from 5,000 to 30,000 RPM.
* *
@@ -4289,8 +4268,7 @@
/** /**
* Instant freeze / unfreeze functionality * Instant freeze / unfreeze functionality
* Potentially useful for rapid stop that allows being resumed. Halts stepper movement. * Potentially useful for emergency stop that allows being resumed.
* Note this does NOT pause spindles, lasers, fans, heaters or any other auxiliary device.
* @section interface * @section interface
*/ */
//#define FREEZE_FEATURE //#define FREEZE_FEATURE
@@ -4337,7 +4315,6 @@
// See class CodeProfiler. // See class CodeProfiler.
//#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multi-stepping 1 to 128 on this LED matrix row. //#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multi-stepping 1 to 128 on this LED matrix row.
//#define MAX7219_DEBUG_SLOWDOWN 6 // Count (mod 16) how many times SLOWDOWN has reduced print speed. //#define MAX7219_DEBUG_SLOWDOWN 6 // Count (mod 16) how many times SLOWDOWN has reduced print speed.
//#define MAX7219_REINIT_ON_POWERUP // Re-initialize MAX7129 when power supply turns on
#endif #endif
/** /**
@@ -4371,7 +4348,7 @@
* Extras for an ESP32-based motherboard with WIFISUPPORT * Extras for an ESP32-based motherboard with WIFISUPPORT
* These options don't apply to add-on WiFi modules based on ESP32 WiFi101. * These options don't apply to add-on WiFi modules based on ESP32 WiFi101.
*/ */
#if ANY(WIFISUPPORT, ESP3D_WIFISUPPORT) #if ENABLED(WIFISUPPORT)
//#define WEBSUPPORT // Start a webserver (which may include auto-discovery) using SPIFFS //#define WEBSUPPORT // Start a webserver (which may include auto-discovery) using SPIFFS
//#define OTASUPPORT // Support over-the-air firmware updates //#define OTASUPPORT // Support over-the-air firmware updates
//#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host //#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host
@@ -4407,37 +4384,31 @@
//#define E_MUX0_PIN 40 // Always Required //#define E_MUX0_PIN 40 // Always Required
//#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs
//#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs
#elif HAS_PRUSA_MMU2
// Serial port used for communication with MMU2.
#define MMU2_SERIAL_PORT 2
#elif HAS_PRUSA_MMU2 || HAS_PRUSA_MMU3 // Use hardware reset for MMU if a pin is defined for it
// Common settings for MMU2/MMU2S/MMU3 //#define MMU2_RST_PIN 23
// Serial port used for communication with MMU2/MMU2S/MMU3.
#define MMU_SERIAL_PORT 2
#define MMU_BAUD 115200
//#define MMU_RST_PIN 23 // Define this pin to use Hardware Reset for MMU2/MMU2S/MMU3
//#define MMU_MENUS // Add an LCD menu for MMU2/MMU2S/MMU3
//#define MMU_DEBUG // Write debug info to serial output
// Options pertaining to MMU2 and MMU2S
#if HAS_PRUSA_MMU2
// Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up) // Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up)
//#define MMU2_MODE_12V //#define MMU2_MODE_12V
// Settings for filament load / unload from the LCD menu.
// This is for Průša MK3-style extruders. Customize for your hardware.
#define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0
// G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout // G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout
#define MMU2_FILAMENT_RUNOUT_SCRIPT "M600" #define MMU2_FILAMENT_RUNOUT_SCRIPT "M600"
// MMU2 sequences use mm/min. Not compatible with MMU3, which use mm/sec. // Add an LCD menu for MMU2
//#define MMU2_MENUS
// Settings for filament load / unload from the LCD menu.
// This is for Průša MK3-style extruders. Customize for your hardware.
#define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0
#define MMU2_LOAD_TO_NOZZLE_SEQUENCE \ #define MMU2_LOAD_TO_NOZZLE_SEQUENCE \
{ 4.4, 871 }, \ { 7.2, 1145 }, \
{ 10.0, 1393 }, \ { 14.4, 871 }, \
{ 4.4, 871 }, \ { 36.0, 1393 }, \
{ 10.0, 198 } { 14.4, 871 }, \
{ 50.0, 198 }
#define MMU2_RAMMING_SEQUENCE \ #define MMU2_RAMMING_SEQUENCE \
{ 1.0, 1000 }, \ { 1.0, 1000 }, \
@@ -4452,36 +4423,19 @@
{ -10.0, 400 }, \ { -10.0, 400 }, \
{ -50.0, 2000 } { -50.0, 2000 }
#endif // HAS_PRUSA_MMU2
/** /**
* Options pertaining to MMU2S devices * Using a sensor like the MMU2S
* Requires the MK3S extruder with a sensor at the extruder idler, like the MMU2S. * This mode requires a MK3S extruder with a sensor at the extruder idler, like the MMU2S.
* See https://help.prusa3d.com/guide/3b-mk3s-mk2-5s-extruder-upgrade_41560#42048, step 11 * See https://help.prusa3d.com/guide/3b-mk3s-mk2-5s-extruder-upgrade_41560#42048, step 11
*/ */
#if HAS_PRUSA_MMU2S #if HAS_PRUSA_MMU2S
#define MMU2_C0_RETRY 5 // Number of retries (total time = timeout*retries) #define MMU2_C0_RETRY 5 // Number of retries (total time = timeout*retries)
/**
* This is called after the filament runout sensor is triggered to check if
* the filament has been loaded properly by moving the filament back and
* forth to see if the filament runout sensor is going to get triggered
* again, which should not occur if the filament is properly loaded.
*
* Thus, the MMU2_CAN_LOAD_SEQUENCE should contain some forward and
* backward moves. The forward moves should be greater than the backward
* moves.
*
* This is useless if your filament runout sensor is way behind the gears.
* In that case use {0, MMU2_CAN_LOAD_FEEDRATE}
*
* Adjust MMU2_CAN_LOAD_SEQUENCE according to your setup.
*/
#define MMU2_CAN_LOAD_FEEDRATE 800 // (mm/min) #define MMU2_CAN_LOAD_FEEDRATE 800 // (mm/min)
#define MMU2_CAN_LOAD_SEQUENCE \ #define MMU2_CAN_LOAD_SEQUENCE \
{ 5.0, MMU2_CAN_LOAD_FEEDRATE }, \ { 0.1, MMU2_CAN_LOAD_FEEDRATE }, \
{ 15.0, MMU2_CAN_LOAD_FEEDRATE }, \ { 60.0, MMU2_CAN_LOAD_FEEDRATE }, \
{ -10.0, MMU2_CAN_LOAD_FEEDRATE } { -52.0, MMU2_CAN_LOAD_FEEDRATE }
#define MMU2_CAN_LOAD_RETRACT 6.0 // (mm) Keep under the distance between Load Sequence values #define MMU2_CAN_LOAD_RETRACT 6.0 // (mm) Keep under the distance between Load Sequence values
#define MMU2_CAN_LOAD_DEVIATION 0.8 // (mm) Acceptable deviation #define MMU2_CAN_LOAD_DEVIATION 0.8 // (mm) Acceptable deviation
@@ -4492,90 +4446,10 @@
// Continue unloading if sensor detects filament after the initial unload move // Continue unloading if sensor detects filament after the initial unload move
//#define MMU_IR_UNLOAD_MOVE //#define MMU_IR_UNLOAD_MOVE
#else
#elif HAS_PRUSA_MMU3
// MMU3 settings
#define MMU3_HAS_CUTTER // Enable cutter related functionality
#define MMU3_MAX_RETRIES 3 // Number of retries (total time = timeout*retries)
// As discussed with our PrusaSlicer profile specialist
// - ToolChange shall not try to push filament into the very tip of the nozzle
// to have some space for additional G-code to tune the extruded filament length
// in the profile
// Beware - this value is used to initialize the MMU logic layer - it will be sent to the MMU upon line up (written into its 8bit register 0x0b)
// However - in the G-code we can get a request to set the extra load distance at runtime to something else (M708 A0xb Xsomething).
// The printer intercepts such a call and sets its extra load distance to match the new value as well.
#define MMU3_FILAMENT_SENSOR_E_POSITION 0 // (mm)
#define _MMU3_LOAD_DISTANCE_PAST_GEARS 5 // (mm)
#define MMU3_TOOL_CHANGE_LOAD_LENGTH (MMU3_FILAMENT_SENSOR_E_POSITION + _MMU3_LOAD_DISTANCE_PAST_GEARS) // (mm)
#define MMU3_LOAD_TO_NOZZLE_FEED_RATE 20.0 // (mm/s)
#define MMU3_VERIFY_LOAD_TO_NOZZLE_FEED_RATE 50.0 // (mm/s)
#define _MMU3_VERIFY_LOAD_TO_NOZZLE_TWEAK -5.0 // (mm) Amount to adjust the length for verifying load-to-nozzle
// The first thing the MMU does is initialize its axis.
// Meanwhile the E-motor will unload 20mm of filament in about 1 second.
#define MMU3_RETRY_UNLOAD_TO_FINDA_LENGTH 80.0 // (mm)
#define MMU3_RETRY_UNLOAD_TO_FINDA_FEED_RATE 80.0 // (mm/s)
// After loading a new filament, the printer will extrude this length of filament
// then retract to the original position. This is used to check if the filament sensor
// reading flickers or filament is jammed.
#define _MMU_EXTRUDER_PTFE_LENGTH 42.3 // (mm)
#define _MMU_EXTRUDER_HEATBREAK_LENGTH 17.7 // (mm)
#define MMU3_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH (MMU3_FILAMENT_SENSOR_E_POSITION + _MMU_EXTRUDER_PTFE_LENGTH + _MMU_EXTRUDER_HEATBREAK_LENGTH + _MMU3_VERIFY_LOAD_TO_NOZZLE_TWEAK) // (mm)
/** /**
* SpoolJoin Consumes All Filament -- EXPERIMENTAL * MMU1 Extruder Sensor
*
* SpoolJoin normally triggers when FINDA sensor untriggers while printing.
* This is the default behaviour and it doesn't consume all the filament
* before triggering a filament change. This leaves some filament in the
* current slot and before switching to the next slot it is unloaded.
*
* Enabling this option will trigger the filament change when both FINDA
* and Filament Runout Sensor triggers during the print and it allows the
* filament in the current slot to be completely consumed before doing the
* filament change. But this can cause problems as a little bit of filament
* will be left between the extruder gears (thinking that the filament
* sensor is triggered through the gears) and the end of the PTFE tube and
* can cause filament load issues.
*/
//#define MMU3_SPOOL_JOIN_CONSUMES_ALL_FILAMENT
// MMU3 sequences use mm/sec. Not compatible with MMU2 which use mm/min.
#define MMU3_LOAD_TO_NOZZLE_SEQUENCE \
{ _MMU_EXTRUDER_PTFE_LENGTH, MMM_TO_MMS(810) }, /* (13.5 mm/s) Fast load ahead of heatbreak */ \
{ _MMU_EXTRUDER_HEATBREAK_LENGTH, MMM_TO_MMS(198) } /* ( 3.3 mm/s) Slow load after heatbreak */
#define MMU3_RAMMING_SEQUENCE \
{ 0.2816, MMM_TO_MMS(1339.0) }, \
{ 0.3051, MMM_TO_MMS(1451.0) }, \
{ 0.3453, MMM_TO_MMS(1642.0) }, \
{ 0.3990, MMM_TO_MMS(1897.0) }, \
{ 0.4761, MMM_TO_MMS(2264.0) }, \
{ 0.5767, MMM_TO_MMS(2742.0) }, \
{ 0.5691, MMM_TO_MMS(3220.0) }, \
{ 0.1081, MMM_TO_MMS(3220.0) }, \
{ 0.7644, MMM_TO_MMS(3635.0) }, \
{ 0.8248, MMM_TO_MMS(3921.0) }, \
{ 0.8483, MMM_TO_MMS(4033.0) }, \
{ -15.0, MMM_TO_MMS(6000.0) }, \
{ -24.5, MMM_TO_MMS(1200.0) }, \
{ -7.0, MMM_TO_MMS( 600.0) }, \
{ -3.5, MMM_TO_MMS( 360.0) }, \
{ 20.0, MMM_TO_MMS( 454.0) }, \
{ -20.0, MMM_TO_MMS( 303.0) }, \
{ -35.0, MMM_TO_MMS(2000.0) }
#else // MMU2 (not MMU2S)
/**
* MMU2 Extruder Sensor
* *
* Support for a Průša (or other) IR Sensor to detect filament near the extruder * Support for a Průša (or other) IR Sensor to detect filament near the extruder
* and make loading more reliable. Suitable for an extruder equipped with a filament * and make loading more reliable. Suitable for an extruder equipped with a filament
@@ -4585,14 +4459,16 @@
* move up to the gears. If no filament is detected, the MMU2 can make some more attempts. * move up to the gears. If no filament is detected, the MMU2 can make some more attempts.
* If all attempts fail, a filament runout will be triggered. * If all attempts fail, a filament runout will be triggered.
*/ */
//#define MMU2_EXTRUDER_SENSOR //#define MMU_EXTRUDER_SENSOR
#if ENABLED(MMU2_EXTRUDER_SENSOR) #if ENABLED(MMU_EXTRUDER_SENSOR)
#define MMU2_LOADING_ATTEMPTS_NR 5 // Number of times to try loading filament before failure #define MMU_LOADING_ATTEMPTS_NR 5 // max. number of attempts to load filament if first load fail
#endif #endif
#endif #endif
#endif // HAS_PRUSA_MMU2 || HAS_PRUSA_MMU3 //#define MMU2_DEBUG // Write debug info to serial output
#endif // HAS_PRUSA_MMU2
/** /**
* Advanced Print Counter settings * Advanced Print Counter settings
@@ -4655,6 +4531,3 @@
// Report uncleaned reset reason from register r2 instead of MCUSR. Supported by Optiboot on AVR. // Report uncleaned reset reason from register r2 instead of MCUSR. Supported by Optiboot on AVR.
//#define OPTIBOOT_RESET_REASON //#define OPTIBOOT_RESET_REASON
// Shrink the build for smaller boards by sacrificing some serial feedback
//#define MARLIN_SMALL_BUILD
+73 -104
View File
@@ -187,17 +187,6 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1033)
# RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan) # RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan)
else ifeq ($(HARDWARE_MOTHERBOARD),1034) else ifeq ($(HARDWARE_MOTHERBOARD),1034)
# RAMPS 1.6+ (Power outputs: Hotend, Fan, Bed)
else ifeq ($(HARDWARE_MOTHERBOARD),1035)
# RAMPS 1.6+ (Power outputs: Hotend0, Hotend1, Bed)
else ifeq ($(HARDWARE_MOTHERBOARD),1036)
# RAMPS 1.6+ (Power outputs: Hotend, Fan0, Fan1)
else ifeq ($(HARDWARE_MOTHERBOARD),1037)
# RAMPS 1.6+ (Power outputs: Hotend0, Hotend1, Fan)
else ifeq ($(HARDWARE_MOTHERBOARD),1038)
# RAMPS 1.6+ (Power outputs: Spindle, Controller Fan)
else ifeq ($(HARDWARE_MOTHERBOARD),1039)
# #
# RAMPS Derivatives - ATmega1280, ATmega2560 # RAMPS Derivatives - ATmega1280, ATmega2560
# #
@@ -232,113 +221,108 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1112)
else ifeq ($(HARDWARE_MOTHERBOARD),1113) else ifeq ($(HARDWARE_MOTHERBOARD),1113)
# BigTreeTech or BIQU KFB2.0 # BigTreeTech or BIQU KFB2.0
else ifeq ($(HARDWARE_MOTHERBOARD),1114) else ifeq ($(HARDWARE_MOTHERBOARD),1114)
# Zonestar zrib V2.0 (Chinese RAMPS replica) # zrib V2.0 (Chinese RAMPS replica)
else ifeq ($(HARDWARE_MOTHERBOARD),1115) else ifeq ($(HARDWARE_MOTHERBOARD),1115)
# Zonestar zrib V5.2 (Chinese RAMPS replica) # zrib V5.2 (Chinese RAMPS replica)
else ifeq ($(HARDWARE_MOTHERBOARD),1116) else ifeq ($(HARDWARE_MOTHERBOARD),1116)
# Zonestar zrib V5.3 (Chinese RAMPS replica)
else ifeq ($(HARDWARE_MOTHERBOARD),1117)
# Felix 2.0+ Electronics Board (RAMPS like) # Felix 2.0+ Electronics Board (RAMPS like)
else ifeq ($(HARDWARE_MOTHERBOARD),1118) else ifeq ($(HARDWARE_MOTHERBOARD),1117)
# Invent-A-Part RigidBoard # Invent-A-Part RigidBoard
else ifeq ($(HARDWARE_MOTHERBOARD),1119) else ifeq ($(HARDWARE_MOTHERBOARD),1118)
# Invent-A-Part RigidBoard V2 # Invent-A-Part RigidBoard V2
else ifeq ($(HARDWARE_MOTHERBOARD),1120) else ifeq ($(HARDWARE_MOTHERBOARD),1119)
# Sainsmart 2-in-1 board # Sainsmart 2-in-1 board
else ifeq ($(HARDWARE_MOTHERBOARD),1121) else ifeq ($(HARDWARE_MOTHERBOARD),1120)
# Ultimaker # Ultimaker
else ifeq ($(HARDWARE_MOTHERBOARD),1122) else ifeq ($(HARDWARE_MOTHERBOARD),1121)
# Ultimaker (Older electronics. Pre 1.5.4. This is rare) # Ultimaker (Older electronics. Pre 1.5.4. This is rare)
else ifeq ($(HARDWARE_MOTHERBOARD),1123) else ifeq ($(HARDWARE_MOTHERBOARD),1122)
MCU ?= atmega1280 MCU ?= atmega1280
PROG_MCU ?= m1280 PROG_MCU ?= m1280
# Azteeg X3 # Azteeg X3
else ifeq ($(HARDWARE_MOTHERBOARD),1124) else ifeq ($(HARDWARE_MOTHERBOARD),1123)
# Azteeg X3 Pro # Azteeg X3 Pro
else ifeq ($(HARDWARE_MOTHERBOARD),1125) else ifeq ($(HARDWARE_MOTHERBOARD),1124)
# Ultimainboard 2.x (Uses TEMP_SENSOR 20) # Ultimainboard 2.x (Uses TEMP_SENSOR 20)
else ifeq ($(HARDWARE_MOTHERBOARD),1126) else ifeq ($(HARDWARE_MOTHERBOARD),1125)
# Rumba # Rumba
else ifeq ($(HARDWARE_MOTHERBOARD),1127) else ifeq ($(HARDWARE_MOTHERBOARD),1126)
# Raise3D N series Rumba derivative # Raise3D N series Rumba derivative
else ifeq ($(HARDWARE_MOTHERBOARD),1128) else ifeq ($(HARDWARE_MOTHERBOARD),1127)
# Rapide Lite 200 (v1, low-cost RUMBA clone with drv) # Rapide Lite 200 (v1, low-cost RUMBA clone with drv)
else ifeq ($(HARDWARE_MOTHERBOARD),1129) else ifeq ($(HARDWARE_MOTHERBOARD),1128)
# Formbot T-Rex 2 Plus # Formbot T-Rex 2 Plus
else ifeq ($(HARDWARE_MOTHERBOARD),1130) else ifeq ($(HARDWARE_MOTHERBOARD),1129)
# Formbot T-Rex 3 # Formbot T-Rex 3
else ifeq ($(HARDWARE_MOTHERBOARD),1131) else ifeq ($(HARDWARE_MOTHERBOARD),1130)
# Formbot Raptor # Formbot Raptor
else ifeq ($(HARDWARE_MOTHERBOARD),1132) else ifeq ($(HARDWARE_MOTHERBOARD),1131)
# Formbot Raptor 2 # Formbot Raptor 2
else ifeq ($(HARDWARE_MOTHERBOARD),1133) else ifeq ($(HARDWARE_MOTHERBOARD),1132)
# bq ZUM Mega 3D # bq ZUM Mega 3D
else ifeq ($(HARDWARE_MOTHERBOARD),1134) else ifeq ($(HARDWARE_MOTHERBOARD),1133)
# MakeBoard Mini v2.1.2 by MicroMake # MakeBoard Mini v2.1.2 by MicroMake
else ifeq ($(HARDWARE_MOTHERBOARD),1135) else ifeq ($(HARDWARE_MOTHERBOARD),1134)
# TriGorilla Anycubic version 1.3-based on RAMPS EFB # TriGorilla Anycubic version 1.3-based on RAMPS EFB
else ifeq ($(HARDWARE_MOTHERBOARD),1136) else ifeq ($(HARDWARE_MOTHERBOARD),1135)
# ... Ver 1.4 # ... Ver 1.4
else ifeq ($(HARDWARE_MOTHERBOARD),1137) else ifeq ($(HARDWARE_MOTHERBOARD),1136)
# ... Rev 1.1 (new servo pin order) # ... Rev 1.1 (new servo pin order)
else ifeq ($(HARDWARE_MOTHERBOARD),1138) else ifeq ($(HARDWARE_MOTHERBOARD),1137)
# Creality: Ender-4, CR-8 # Creality: Ender-4, CR-8
else ifeq ($(HARDWARE_MOTHERBOARD),1139) else ifeq ($(HARDWARE_MOTHERBOARD),1138)
# Creality: CR10S, CR20, CR-X # Creality: CR10S, CR20, CR-X
else ifeq ($(HARDWARE_MOTHERBOARD),1140) else ifeq ($(HARDWARE_MOTHERBOARD),1139)
# Dagoma F5 # Dagoma F5
else ifeq ($(HARDWARE_MOTHERBOARD),1141) else ifeq ($(HARDWARE_MOTHERBOARD),1140)
# Dagoma D6 (as found in the Dagoma DiscoUltimate V2 TMC)
else ifeq ($(HARDWARE_MOTHERBOARD),1142)
# FYSETC F6 1.3 # FYSETC F6 1.3
else ifeq ($(HARDWARE_MOTHERBOARD),1143) else ifeq ($(HARDWARE_MOTHERBOARD),1141)
# FYSETC F6 1.4 # FYSETC F6 1.4
else ifeq ($(HARDWARE_MOTHERBOARD),1144) else ifeq ($(HARDWARE_MOTHERBOARD),1142)
# Wanhao Duplicator i3 Plus # Wanhao Duplicator i3 Plus
else ifeq ($(HARDWARE_MOTHERBOARD),1145) else ifeq ($(HARDWARE_MOTHERBOARD),1143)
# VORON Design # VORON Design
else ifeq ($(HARDWARE_MOTHERBOARD),1146) else ifeq ($(HARDWARE_MOTHERBOARD),1144)
# Tronxy TRONXY-V3-1.0 # Tronxy TRONXY-V3-1.0
else ifeq ($(HARDWARE_MOTHERBOARD),1147) else ifeq ($(HARDWARE_MOTHERBOARD),1145)
# Z-Bolt X Series # Z-Bolt X Series
else ifeq ($(HARDWARE_MOTHERBOARD),1148) else ifeq ($(HARDWARE_MOTHERBOARD),1146)
# TT OSCAR # TT OSCAR
else ifeq ($(HARDWARE_MOTHERBOARD),1147)
# Overlord/Overlord Pro
else ifeq ($(HARDWARE_MOTHERBOARD),1148)
# ADIMLab Gantry v1
else ifeq ($(HARDWARE_MOTHERBOARD),1149) else ifeq ($(HARDWARE_MOTHERBOARD),1149)
# BIQU Tango V1 # ADIMLab Gantry v2
else ifeq ($(HARDWARE_MOTHERBOARD),1150) else ifeq ($(HARDWARE_MOTHERBOARD),1150)
# MKS GEN L V2 # BIQU Tango V1
else ifeq ($(HARDWARE_MOTHERBOARD),1151) else ifeq ($(HARDWARE_MOTHERBOARD),1151)
# MKS GEN L V2.1 # MKS GEN L V2
else ifeq ($(HARDWARE_MOTHERBOARD),1152) else ifeq ($(HARDWARE_MOTHERBOARD),1152)
# Copymaster 3D # MKS GEN L V2.1
else ifeq ($(HARDWARE_MOTHERBOARD),1153) else ifeq ($(HARDWARE_MOTHERBOARD),1153)
# Ortur 4 # Copymaster 3D
else ifeq ($(HARDWARE_MOTHERBOARD),1154) else ifeq ($(HARDWARE_MOTHERBOARD),1154)
# Tenlog D3 Hero IDEX printer # Ortur 4
else ifeq ($(HARDWARE_MOTHERBOARD),1155) else ifeq ($(HARDWARE_MOTHERBOARD),1155)
# Tenlog D3, D5, D6 IDEX Printer # Tenlog D3 Hero IDEX printer
else ifeq ($(HARDWARE_MOTHERBOARD),1156) else ifeq ($(HARDWARE_MOTHERBOARD),1156)
# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed) # Tenlog D3,5,6 Pro IDEX printers
else ifeq ($(HARDWARE_MOTHERBOARD),1157) else ifeq ($(HARDWARE_MOTHERBOARD),1157)
# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed) # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed)
else ifeq ($(HARDWARE_MOTHERBOARD),1158) else ifeq ($(HARDWARE_MOTHERBOARD),1158)
# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed) # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed)
else ifeq ($(HARDWARE_MOTHERBOARD),1159) else ifeq ($(HARDWARE_MOTHERBOARD),1159)
# Longer LK1 PRO / Alfawise U20 Pro (PRO version) # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed)
else ifeq ($(HARDWARE_MOTHERBOARD),1160) else ifeq ($(HARDWARE_MOTHERBOARD),1160)
# Longer LKx PRO / Alfawise Uxx Pro (PRO version) # Longer LK1 PRO / Alfawise U20 Pro (PRO version)
else ifeq ($(HARDWARE_MOTHERBOARD),1161) else ifeq ($(HARDWARE_MOTHERBOARD),1161)
# Pxmalion Core I3 # Longer LKx PRO / Alfawise Uxx Pro (PRO version)
else ifeq ($(HARDWARE_MOTHERBOARD),1162) else ifeq ($(HARDWARE_MOTHERBOARD),1162)
# Panowin Cutlass (as found in the Panowin F1) # Zonestar zrib V5.3 (Chinese RAMPS replica)
else ifeq ($(HARDWARE_MOTHERBOARD),1163) else ifeq ($(HARDWARE_MOTHERBOARD),1163)
# Kodama Bardo V1.x (as found in the Kodama Trinus) # Pxmalion Core I3
else ifeq ($(HARDWARE_MOTHERBOARD),1164) else ifeq ($(HARDWARE_MOTHERBOARD),1164)
# XTLW MFF V1.0
else ifeq ($(HARDWARE_MOTHERBOARD),1165)
# XTLW MFF V2.0
else ifeq ($(HARDWARE_MOTHERBOARD),1166)
# #
# RAMBo and derivatives # RAMBo and derivatives
@@ -356,7 +340,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1203)
else ifeq ($(HARDWARE_MOTHERBOARD),1204) else ifeq ($(HARDWARE_MOTHERBOARD),1204)
# abee Scoovo X9H # abee Scoovo X9H
else ifeq ($(HARDWARE_MOTHERBOARD),1205) else ifeq ($(HARDWARE_MOTHERBOARD),1205)
# ThinkerV2 # Rambo ThinkerV2
else ifeq ($(HARDWARE_MOTHERBOARD),1206) else ifeq ($(HARDWARE_MOTHERBOARD),1206)
# #
@@ -399,40 +383,30 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1315)
else ifeq ($(HARDWARE_MOTHERBOARD),1316) else ifeq ($(HARDWARE_MOTHERBOARD),1316)
# Geeetech GT2560 Rev B for A10(M/T/D) # Geeetech GT2560 Rev B for A10(M/T/D)
else ifeq ($(HARDWARE_MOTHERBOARD),1317) else ifeq ($(HARDWARE_MOTHERBOARD),1317)
# Geeetech GT2560 Rev B for Mecreator2
else ifeq ($(HARDWARE_MOTHERBOARD),1318)
# Geeetech GT2560 Rev B for A20(M/T/D)
else ifeq ($(HARDWARE_MOTHERBOARD),1319)
# Geeetech GT2560 Rev B for A10(M/T/D) # Geeetech GT2560 Rev B for A10(M/T/D)
else ifeq ($(HARDWARE_MOTHERBOARD),1320) else ifeq ($(HARDWARE_MOTHERBOARD),1318)
# Geeetech GT2560 Rev B for Mecreator2
else ifeq ($(HARDWARE_MOTHERBOARD),1319)
# Geeetech GT2560 Rev B for A20(M/T/D) # Geeetech GT2560 Rev B for A20(M/T/D)
else ifeq ($(HARDWARE_MOTHERBOARD),1321) else ifeq ($(HARDWARE_MOTHERBOARD),1320)
# Einstart retrofit # Einstart retrofit
else ifeq ($(HARDWARE_MOTHERBOARD),1322) else ifeq ($(HARDWARE_MOTHERBOARD),1321)
# Wanhao 0ne+ i3 Mini # Wanhao 0ne+ i3 Mini
else ifeq ($(HARDWARE_MOTHERBOARD),1323) else ifeq ($(HARDWARE_MOTHERBOARD),1322)
# Overlord/Overlord Pro
else ifeq ($(HARDWARE_MOTHERBOARD),1324)
# ADIMLab Gantry v1
else ifeq ($(HARDWARE_MOTHERBOARD),1325)
# ADIMLab Gantry v2
else ifeq ($(HARDWARE_MOTHERBOARD),1326)
# Leapfrog Xeed 2015 # Leapfrog Xeed 2015
else ifeq ($(HARDWARE_MOTHERBOARD),1327) else ifeq ($(HARDWARE_MOTHERBOARD),1323)
# PICA Shield (original version) # PICA Shield (original version)
else ifeq ($(HARDWARE_MOTHERBOARD),1328) else ifeq ($(HARDWARE_MOTHERBOARD),1324)
# PICA Shield (rev C or later) # PICA Shield (rev C or later)
else ifeq ($(HARDWARE_MOTHERBOARD),1329) else ifeq ($(HARDWARE_MOTHERBOARD),1325)
# Intamsys 4.0 (Funmat HT) # Intamsys 4.0 (Funmat HT)
else ifeq ($(HARDWARE_MOTHERBOARD),1330) else ifeq ($(HARDWARE_MOTHERBOARD),1326)
# Malyan M180 Mainboard Version 2 (no display function, direct G-code only) # Malyan M180 Mainboard Version 2 (no display function, direct G-code only)
else ifeq ($(HARDWARE_MOTHERBOARD),1331) else ifeq ($(HARDWARE_MOTHERBOARD),1327)
# Geeetech GT2560 Rev B for A20(M/T/D)
else ifeq ($(HARDWARE_MOTHERBOARD),1328)
# Mega controller & Protoneer CNC Shield V3.00 # Mega controller & Protoneer CNC Shield V3.00
else ifeq ($(HARDWARE_MOTHERBOARD),1332) else ifeq ($(HARDWARE_MOTHERBOARD),1329)
# WEEDO 62A board (TINA2, Monoprice Cadet, etc.)
else ifeq ($(HARDWARE_MOTHERBOARD),1333)
# Geeetech GT2560 V4.1B for A10(M/T/D)
else ifeq ($(HARDWARE_MOTHERBOARD),1334)
# #
# ATmega1281, ATmega2561 # ATmega1281, ATmega2561
@@ -466,7 +440,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1502)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega644p MCU ?= atmega644p
PROG_MCU ?= m644p PROG_MCU ?= m644p
# Melzi V2 # Melzi V2.0
else ifeq ($(HARDWARE_MOTHERBOARD),1503) else ifeq ($(HARDWARE_MOTHERBOARD),1503)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
@@ -476,38 +450,33 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1504)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p PROG_MCU ?= m1284p
# Melzi Creality3D (for CR-10 etc) # Melzi Creality3D board (for CR-10 etc)
else ifeq ($(HARDWARE_MOTHERBOARD),1505) else ifeq ($(HARDWARE_MOTHERBOARD),1505)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p PROG_MCU ?= m1284p
# Melzi Creality3D (for Ender-2) # Melzi Malyan M150 board
else ifeq ($(HARDWARE_MOTHERBOARD),1506) else ifeq ($(HARDWARE_MOTHERBOARD),1506)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p PROG_MCU ?= m1284p
# Melzi Malyan M150 # Tronxy X5S
else ifeq ($(HARDWARE_MOTHERBOARD),1507) else ifeq ($(HARDWARE_MOTHERBOARD),1507)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p PROG_MCU ?= m1284p
# Tronxy X5S # STB V1.1
else ifeq ($(HARDWARE_MOTHERBOARD),1508) else ifeq ($(HARDWARE_MOTHERBOARD),1508)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p PROG_MCU ?= m1284p
# STB V1.1 # Azteeg X1
else ifeq ($(HARDWARE_MOTHERBOARD),1509) else ifeq ($(HARDWARE_MOTHERBOARD),1509)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p PROG_MCU ?= m1284p
# Azteeg X1
else ifeq ($(HARDWARE_MOTHERBOARD),1510)
HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p
PROG_MCU ?= m1284p
# Anet 1.0 (Melzi clone) # Anet 1.0 (Melzi clone)
else ifeq ($(HARDWARE_MOTHERBOARD),1511) else ifeq ($(HARDWARE_MOTHERBOARD),1510)
HARDWARE_VARIANT ?= Sanguino HARDWARE_VARIANT ?= Sanguino
MCU ?= atmega1284p MCU ?= atmega1284p
PROG_MCU ?= m1284p PROG_MCU ?= m1284p
+1 -1
View File
@@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release * here we define this default string as the date where the latest release
* version was tagged. * version was tagged.
*/ */
//#define STRING_DISTRIBUTION_DATE "2024-10-17" //#define STRING_DISTRIBUTION_DATE "2024-01-31"
/** /**
* Defines a generic printer name to be output to the LCD after booting Marlin. * Defines a generic printer name to be output to the LCD after booting Marlin.
+6 -6
View File
@@ -129,11 +129,11 @@ typedef Servo hal_servo_t;
#endif #endif
#endif #endif
#ifdef MMU_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if !WITHIN(MMU_SERIAL_PORT, 0, 3) #if !WITHIN(MMU2_SERIAL_PORT, 0, 3)
#error "MMU_SERIAL_PORT must be from 0 to 3" #error "MMU2_SERIAL_PORT must be from 0 to 3"
#endif #endif
#define MMU_SERIAL mmuSerial #define MMU2_SERIAL mmuSerial
#endif #endif
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
@@ -141,7 +141,7 @@ typedef Servo hal_servo_t;
#error "LCD_SERIAL_PORT must be from 0 to 3." #error "LCD_SERIAL_PORT must be from 0 to 3."
#endif #endif
#define LCD_SERIAL lcdSerial #define LCD_SERIAL lcdSerial
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #if HAS_DGUS_LCD
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free() #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
#endif #endif
#endif #endif
@@ -159,7 +159,7 @@ typedef Servo hal_servo_t;
#define GET_PIN_MAP_INDEX(pin) pin #define GET_PIN_MAP_INDEX(pin) pin
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
#define HAL_SENSITIVE_PINS 0, 1 #define HAL_SENSITIVE_PINS 0, 1,
#ifdef __AVR_AT90USB1286__ #ifdef __AVR_AT90USB1286__
#define JTAG_DISABLE() do{ MCUCR = 0x80; MCUCR = 0x80; }while(0) #define JTAG_DISABLE() do{ MCUCR = 0x80; MCUCR = 0x80; }while(0)
+8 -8
View File
@@ -601,20 +601,20 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
#endif // SERIAL_PORT_3 #endif // SERIAL_PORT_3
#ifdef MMU_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
ISR(SERIAL_REGNAME(USART, MMU_SERIAL_PORT, _RX_vect)) { ISR(SERIAL_REGNAME(USART, MMU2_SERIAL_PORT, _RX_vect)) {
MarlinSerial<MMU2SerialCfg<MMU_SERIAL_PORT>>::store_rxd_char(); MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>>::store_rxd_char();
} }
ISR(SERIAL_REGNAME(USART, MMU_SERIAL_PORT, _UDRE_vect)) { ISR(SERIAL_REGNAME(USART, MMU2_SERIAL_PORT, _UDRE_vect)) {
MarlinSerial<MMU2SerialCfg<MMU_SERIAL_PORT>>::_tx_udr_empty_irq(); MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>>::_tx_udr_empty_irq();
} }
template class MarlinSerial< MMU2SerialCfg<MMU_SERIAL_PORT> >; template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >;
MSerialMMU2 mmuSerial(MSerialMMU2::HasEmergencyParser); MSerialMMU2 mmuSerial(MSerialMMU2::HasEmergencyParser);
#endif // MMU_SERIAL_PORT #endif // MMU2_SERIAL_PORT
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
@@ -629,7 +629,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >; template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser); MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #if HAS_DGUS_LCD
template<typename Cfg> template<typename Cfg>
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() { typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send. const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
+3 -3
View File
@@ -205,7 +205,7 @@
static ring_buffer_pos_t available(); static ring_buffer_pos_t available();
static void write(const uint8_t c); static void write(const uint8_t c);
static void flushTX(); static void flushTX();
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #if HAS_DGUS_LCD
static ring_buffer_pos_t get_tx_buffer_free(); static ring_buffer_pos_t get_tx_buffer_free();
#endif #endif
@@ -246,7 +246,7 @@
#endif // !USBCON #endif // !USBCON
#ifdef MMU_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
template <uint8_t serial> template <uint8_t serial>
struct MMU2SerialCfg { struct MMU2SerialCfg {
static constexpr int PORT = serial; static constexpr int PORT = serial;
@@ -260,7 +260,7 @@
static constexpr bool RX_OVERRUNS = false; static constexpr bool RX_OVERRUNS = false;
}; };
typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU_SERIAL_PORT> > > MSerialMMU2; typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialMMU2;
extern MSerialMMU2 mmuSerial; extern MSerialMMU2 mmuSerial;
#endif #endif
-8
View File
@@ -345,14 +345,6 @@ void setup_endstop_interrupts() {
pciSetup(Z_MIN_PROBE_PIN); pciSetup(Z_MIN_PROBE_PIN);
#endif #endif
#endif #endif
#if USE_CALIBRATION
#if (digitalPinToInterrupt(CALIBRATION_PIN) != NOT_AN_INTERRUPT)
_ATTACH(CALIBRATION_PIN);
#else
static_assert(digitalPinHasPCICR(CALIBRATION_PIN), "CALIBRATION_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
pciSetup(CALIBRATION_PIN);
#endif
#endif
// If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI. // If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI.
} }
+1 -1
View File
@@ -150,7 +150,7 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
else { else {
if (p == 32 || p == 128) continue; // Skip TIMER2 specific prescalers when not TIMER2 if (p == 32 || p == 128) continue; // Skip TIMER2 specific prescalers when not TIMER2
const uint16_t rft = (F_CPU) / (p * f_desired); const uint16_t rft = (F_CPU) / (p * f_desired);
DEBUG_ECHOLNPGM("(Not Timer 2) F_CPU=", STRINGIFY(F_CPU), " prescaler=", p, " f_desired=", f_desired); DEBUG_ECHOLNPGM("(Not Timer 2) F_CPU=" STRINGIFY(F_CPU), " prescaler=", p, " f_desired=", f_desired);
res_fast_temp = rft - 1; res_fast_temp = rft - 1;
res_pc_temp = rft / 2; res_pc_temp = rft / 2;
} }
+3
View File
@@ -28,6 +28,9 @@
* Port : E0 E1 E4 E5 G5 E3 H3 H4 H5 H6 B4 B5 B6 B7 J1 J0 H1 H0 D3 D2 D1 D0 A0 A1 A2 A3 A4 A5 A6 A7 C7 C6 C5 C4 C3 C2 C1 C0 D7 G2 G1 G0 L7 L6 L5 L4 L3 L2 L1 L0 B3 B2 B1 B0 F0 F1 F2 F3 F4 F5 F6 F7 K0 K1 K2 K3 K4 K5 K6 K7 | E2 E6 E7 xx xx H2 H7 G3 G4 xx xx xx xx xx D4 D5 D6 xx xx J2 J3 J4 J5 J6 J7 xx xx xx xx xx * Port : E0 E1 E4 E5 G5 E3 H3 H4 H5 H6 B4 B5 B6 B7 J1 J0 H1 H0 D3 D2 D1 D0 A0 A1 A2 A3 A4 A5 A6 A7 C7 C6 C5 C4 C3 C2 C1 C0 D7 G2 G1 G0 L7 L6 L5 L4 L3 L2 L1 L0 B3 B2 B1 B0 F0 F1 F2 F3 F4 F5 F6 F7 K0 K1 K2 K3 K4 K5 K6 K7 | E2 E6 E7 xx xx H2 H7 G3 G4 xx xx xx xx xx D4 D5 D6 xx xx J2 J3 J4 J5 J6 J7 xx xx xx xx xx
* Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 73 75 76 77 74 xx xx xx xx xx * Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 73 75 76 77 74 xx xx xx xx xx
* Analog Input : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 * Analog Input : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/ */
#include "../fastio.h" #include "../fastio.h"
+3
View File
@@ -26,6 +26,9 @@
* *
* Logical Pin: 38 39 40 41 42 43 44 45 16 10 11 12 06 07 08 09 30 31 32 33 34 35 36 37 17 18 19 20 21 22 23 24 00 01 13 05 02 03 14 15 46 47 48 49 50 51 52 53 25 26 27 28 29 04 * Logical Pin: 38 39 40 41 42 43 44 45 16 10 11 12 06 07 08 09 30 31 32 33 34 35 36 37 17 18 19 20 21 22 23 24 00 01 13 05 02 03 14 15 46 47 48 49 50 51 52 53 25 26 27 28 29 04
* Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5 * Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/ */
#include "../fastio.h" #include "../fastio.h"
+3
View File
@@ -26,6 +26,9 @@
* *
* Logical Pin: 08 09 10 11 12 13 14 15 16 17 18 19 20 21 00 01 02 03 04 05 06 07 * Logical Pin: 08 09 10 11 12 13 14 15 16 17 18 19 20 21 00 01 02 03 04 05 06 07
* Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 * Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/ */
#include "../fastio.h" #include "../fastio.h"
+3
View File
@@ -26,6 +26,9 @@
* *
* Logical Pin: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 * Logical Pin: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
* Port: B0 B1 B2 B3 B4 B5 B6 B7 D0 D1 D2 D3 D4 D5 D6 D7 C0 C1 C2 C3 C4 C5 C6 C7 A7 A6 A5 A4 A3 A2 A1 A0 * Port: B0 B1 B2 B3 B4 B5 B6 B7 D0 D1 D2 D3 D4 D5 D6 D7 C0 C1 C2 C3 C4 C5 C6 C7 A7 A6 A5 A4 A3 A2 A1 A0
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/ */
/** ATMega644 /** ATMega644
+4 -1
View File
@@ -26,7 +26,10 @@
* *
* Logical Pin: 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45 * Logical Pin: 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45
* Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 * Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7
* Logical pins 46-47 aren't supported by Teensyduino, but are supported below as E2 and E3 * The logical pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/ */
#include "../fastio.h" #include "../fastio.h"
+17 -17
View File
@@ -42,7 +42,7 @@
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p) #define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p)
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p) #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
#define digitalPinToPort_DEBUG(p) digitalPinToPort(p) #define digitalPinToPort_DEBUG(p) digitalPinToPort(p)
#define getValidPinMode(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin)) #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 #elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70
@@ -50,32 +50,32 @@
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer_plus_70(p) #define digitalPinToTimer_DEBUG(p) digitalPinToTimer_plus_70(p)
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask_plus_70(p) #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask_plus_70(p)
#define digitalPinToPort_DEBUG(p) digitalPinToPort_plus_70(p) #define digitalPinToPort_DEBUG(p) digitalPinToPort_plus_70(p)
bool getValidPinMode(pin_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); } bool GET_PINMODE(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); }
#else #else
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p) #define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p)
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p) #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
#define digitalPinToPort_DEBUG(p) digitalPinToPort(p) #define digitalPinToPort_DEBUG(p) digitalPinToPort(p)
bool getValidPinMode(pin_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); } bool GET_PINMODE(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); }
#define getPinByIndex(p) pgm_read_byte(&pin_array[p].pin) #define GET_ARRAY_PIN(p) pgm_read_byte(&pin_array[p].pin)
#endif #endif
#define isValidPin(pin) (pin >= 0 && pin < NUM_DIGITAL_PINS ? 1 : 0) #define VALID_PIN(pin) (pin >= 0 && pin < NUM_DIGITAL_PINS ? 1 : 0)
#if AVR_ATmega1284_FAMILY #if AVR_ATmega1284_FAMILY
#define isAnalogPin(P) WITHIN(P, analogInputToDigitalPin(7), analogInputToDigitalPin(0)) #define IS_ANALOG(P) WITHIN(P, analogInputToDigitalPin(7), analogInputToDigitalPin(0))
#define digitalPinToAnalogIndex(P) int(isAnalogPin(P) ? (P) - analogInputToDigitalPin(7) : -1) #define DIGITAL_PIN_TO_ANALOG_PIN(P) int(IS_ANALOG(P) ? (P) - analogInputToDigitalPin(7) : -1)
#else #else
#define _ANALOG1(P) WITHIN(P, analogInputToDigitalPin(0), analogInputToDigitalPin(7)) #define _ANALOG1(P) WITHIN(P, analogInputToDigitalPin(0), analogInputToDigitalPin(7))
#define _ANALOG2(P) WITHIN(P, analogInputToDigitalPin(8), analogInputToDigitalPin(15)) #define _ANALOG2(P) WITHIN(P, analogInputToDigitalPin(8), analogInputToDigitalPin(15))
#define isAnalogPin(P) (_ANALOG1(P) || _ANALOG2(P)) #define IS_ANALOG(P) (_ANALOG1(P) || _ANALOG2(P))
#define digitalPinToAnalogIndex(P) int(_ANALOG1(P) ? (P) - analogInputToDigitalPin(0) : _ANALOG2(P) ? (P) - analogInputToDigitalPin(8) + 8 : -1) #define DIGITAL_PIN_TO_ANALOG_PIN(P) int(_ANALOG1(P) ? (P) - analogInputToDigitalPin(0) : _ANALOG2(P) ? (P) - analogInputToDigitalPin(8) + 8 : -1)
#endif #endif
#define getPinByIndex(p) pgm_read_byte(&pin_array[p].pin) #define GET_ARRAY_PIN(p) pgm_read_byte(&pin_array[p].pin)
#define MULTI_NAME_PAD 26 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 26 // space needed to be pretty if not first name assigned to a pin
void printPinNameByIndex(uint8_t x) { void PRINT_ARRAY_NAME(uint8_t x) {
PGM_P const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name); PGM_P const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name);
for (uint8_t y = 0; y < MAX_NAME_LENGTH; ++y) { for (uint8_t y = 0; y < MAX_NAME_LENGTH; ++y) {
char temp_char = pgm_read_byte(name_mem_pointer + y); char temp_char = pgm_read_byte(name_mem_pointer + y);
@@ -88,7 +88,7 @@ void printPinNameByIndex(uint8_t x) {
} }
} }
#define getPinIsDigitalByIndex(x) pgm_read_byte(&pin_array[x].is_digital) #define GET_ARRAY_IS_DIGITAL(x) pgm_read_byte(&pin_array[x].is_digital)
#if defined(__AVR_ATmega1284P__) // 1284 IDE extensions set this to the number of #if defined(__AVR_ATmega1284P__) // 1284 IDE extensions set this to the number of
#undef NUM_DIGITAL_PINS // digital only pins while all other CPUs have it #undef NUM_DIGITAL_PINS // digital only pins while all other CPUs have it
@@ -276,7 +276,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
if (TEST(*TMSK, TOIE)) err_prob_interrupt(); if (TEST(*TMSK, TOIE)) err_prob_interrupt();
} }
void printPinPWM(uint8_t pin) { void pwm_details(uint8_t pin) {
switch (digitalPinToTimer_DEBUG(pin)) { switch (digitalPinToTimer_DEBUG(pin)) {
#if ABTEST(0) #if ABTEST(0)
@@ -347,7 +347,7 @@ void printPinPWM(uint8_t pin) {
#else #else
UNUSED(print_is_also_tied); UNUSED(print_is_also_tied);
#endif #endif
} // printPinPWM } // pwm_details
#ifndef digitalRead_mod // Use Teensyduino's version of digitalRead - it doesn't disable the PWMs #ifndef digitalRead_mod // Use Teensyduino's version of digitalRead - it doesn't disable the PWMs
int digitalRead_mod(const pin_t pin) { // same as digitalRead except the PWM stop section has been removed int digitalRead_mod(const pin_t pin) { // same as digitalRead except the PWM stop section has been removed
@@ -356,7 +356,7 @@ void printPinPWM(uint8_t pin) {
} }
#endif #endif
void printPinPort(const pin_t pin) { // print port number void print_port(const pin_t pin) { // print port number
#ifdef digitalPinToPort_DEBUG #ifdef digitalPinToPort_DEBUG
uint8_t x; uint8_t x;
SERIAL_ECHOPGM(" Port: "); SERIAL_ECHOPGM(" Port: ");
@@ -386,7 +386,7 @@ void printPinPort(const pin_t pin) { // print port number
#endif #endif
} }
#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
#undef ABTEST #undef ABTEST
@@ -120,7 +120,7 @@ void u8g_spiSend_sw_AVR_mode_3(uint8_t val) {
U8G_ATOMIC_END(); U8G_ATOMIC_END();
} }
#if U8G_SPI_USE_MODE_3 #if ENABLED(FYSETC_MINI_12864)
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3 #define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3
#else #else
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_0 #define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_0
@@ -143,7 +143,7 @@ uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
break; break;
case U8G_COM_MSG_CHIP_SELECT: case U8G_COM_MSG_CHIP_SELECT:
#if U8G_SPI_USE_MODE_3 // LCD SPI is running mode 3 while SD card is running mode 0 #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 if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active // the next chip select goes active
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
+5 -5
View File
@@ -81,11 +81,11 @@ extern DefaultSerial4 MSerial3;
#endif #endif
#endif #endif
#ifdef MMU_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if WITHIN(MMU_SERIAL_PORT, 0, 3) #if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU_SERIAL MSERIAL(MMU_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU_SERIAL_PORT must be from 0 to 3." #error "MMU2_SERIAL_PORT must be from 0 to 3."
#endif #endif
#endif #endif
@@ -127,7 +127,7 @@ typedef Servo hal_servo_t;
#define HAL_ADC_RESOLUTION 10 #define HAL_ADC_RESOLUTION 10
#ifndef analogInputToDigitalPin #ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) pin_t((p < 12U) ? (p) + 54U : -1) #define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
#endif #endif
// //
+1 -1
View File
@@ -50,7 +50,7 @@
static Flags<_Nbr_16timers> DisablePending; // ISR should disable the timer at the next timer reset static Flags<_Nbr_16timers> DisablePending; // ISR should disable the timer at the next timer reset
// ------------------------ // ------------------------
// Interrupt handler for the TC0 channel 1. /// Interrupt handler for the TC0 channel 1.
// ------------------------ // ------------------------
void Servo_Handler(const timer16_Sequence_t, Tc*, const uint8_t); void Servo_Handler(const timer16_Sequence_t, Tc*, const uint8_t);
-1
View File
@@ -64,7 +64,6 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN)); TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN)); TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN)); TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN)); TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN)); TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
+1 -1
View File
@@ -61,7 +61,7 @@
#else #else
#define G2_PWM_Z 0 #define G2_PWM_Z 0
#endif #endif
#if HAS_MOTOR_CURRENT_PWM_E #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
#define G2_PWM_E 1 #define G2_PWM_E 1
#else #else
#define G2_PWM_E 0 #define G2_PWM_E 0
+5 -4
View File
@@ -68,15 +68,16 @@
* Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time * Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time
* as the TMC2130 soft SPI the most common setup. * as the TMC2130 soft SPI the most common setup.
*/ */
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN)) #define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))
#if DISABLED(SOFTWARE_SPI) && ENABLED(TMC_USE_SW_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
#if ENABLED(TMC_USE_SW_SPI)
#if DISABLED(SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs." #error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
#endif #endif
#if ENABLED(SOFTWARE_SPI) && DISABLED(TMC_USE_SW_SPI) #elif ENABLED(SOFTWARE_SPI)
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix." #error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
#endif #endif
#undef _IS_HW_SPI
#endif #endif
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY #if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
+11 -11
View File
@@ -64,19 +64,19 @@
#define NUMBER_PINS_TOTAL PINS_COUNT #define NUMBER_PINS_TOTAL PINS_COUNT
#define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin #define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #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 printPinNumber(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0)
#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
#define getPinByIndex(p) pin_array[p].pin #define GET_ARRAY_PIN(p) pin_array[p].pin
#define getPinIsDigitalByIndex(p) pin_array[p].is_digital #define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
#define isValidPin(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL)) #define VALID_PIN(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
#define digitalPinToAnalogIndex(p) int(p - analogInputToDigitalPin(0)) #define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0))
#define isAnalogPin(P) WITHIN(P, pin_t(analogInputToDigitalPin(0)), pin_t(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1))) #define IS_ANALOG(P) WITHIN(P, char(analogInputToDigitalPin(0)), char(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1)))
#define pwm_status(pin) (((g_pinStatus[pin] & 0xF) == PIN_STATUS_PWM) && \ #define pwm_status(pin) (((g_pinStatus[pin] & 0xF) == PIN_STATUS_PWM) && \
((g_APinDescription[pin].ulPinAttribute & PIN_ATTR_PWM) == PIN_ATTR_PWM)) ((g_APinDescription[pin].ulPinAttribute & PIN_ATTR_PWM) == PIN_ATTR_PWM))
#define MULTI_NAME_PAD 14 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 14 // space needed to be pretty if not first name assigned to a pin
bool getValidPinMode(int8_t pin) { // 1: output, 0: input bool GET_PINMODE(int8_t pin) { // 1: output, 0: input
volatile Pio* port = g_APinDescription[pin].pPort; volatile Pio* port = g_APinDescription[pin].pPort;
uint32_t mask = g_APinDescription[pin].ulPin; uint32_t mask = g_APinDescription[pin].ulPin;
uint8_t pin_status = g_pinStatus[pin] & 0xF; uint8_t pin_status = g_pinStatus[pin] & 0xF;
@@ -85,14 +85,14 @@ bool getValidPinMode(int8_t pin) { // 1: output, 0: input
|| pwm_status(pin)); || pwm_status(pin));
} }
void printPinPWM(int32_t pin) { void pwm_details(int32_t pin) {
if (pwm_status(pin)) { if (pwm_status(pin)) {
uint32_t chan = g_APinDescription[pin].ulPWMChannel; uint32_t chan = g_APinDescription[pin].ulPWMChannel;
SERIAL_ECHOPGM("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY); SERIAL_ECHOPGM("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY);
} }
} }
void printPinPort(const pin_t) {} void print_port(const pin_t) {}
/** /**
* DUE Board pin | PORT | Label * DUE Board pin | PORT | Label
+1 -1
View File
@@ -24,7 +24,7 @@
/** /**
* Define SPI Pins: SCK, MISO, MOSI, SS * Define SPI Pins: SCK, MISO, MOSI, SS
* *
* Available chip select pins for HW SPI are 4 10 52 77 87 * Available chip select pins for HW SPI are 4 10 52 77
*/ */
#if SDSS == 4 || SDSS == 10 || SDSS == 52 || SDSS == 77 || SDSS == 87 #if SDSS == 4 || SDSS == 10 || SDSS == 52 || SDSS == 77 || SDSS == 87
#if SDSS == 4 #if SDSS == 4
@@ -66,7 +66,7 @@
#include <U8glib-HAL.h> #include <U8glib-HAL.h>
#if U8G_SPI_USE_MODE_3 #if ENABLED(FYSETC_MINI_12864)
#define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_3 #define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_3
#else #else
#define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_0 #define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_0
@@ -96,15 +96,15 @@ uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
break; break;
case U8G_COM_MSG_CHIP_SELECT: case U8G_COM_MSG_CHIP_SELECT:
#if U8G_SPI_USE_MODE_3 // LCD SPI is running mode 3 while SD card is running mode 0 #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 if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active // the next chip select goes active
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 1); //set SCK to mode 3 idle state before CS goes active
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, LOW); u8g_SetPILevel_DUE(u8g, U8G_PI_CS, LOW);
} }
else { else {
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, HIGH); u8g_SetPILevel_DUE(u8g, U8G_PI_CS, HIGH);
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0); //set SCK to mode 0 idle state after CS goes inactive
} }
#else #else
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, !arg_val); u8g_SetPILevel_DUE(u8g, U8G_PI_CS, !arg_val);
+1 -1
View File
@@ -11,7 +11,7 @@ if pioutil.is_pio_build():
if current_OS == 'Windows': if current_OS == 'Windows':
env = pioutil.env Import("env")
# Use bossac.exe on Windows # Use bossac.exe on Windows
env.Replace( env.Replace(
+16 -14
View File
@@ -18,32 +18,32 @@ extern "C" {
void sd_mmc_spi_mem_init() { void sd_mmc_spi_mem_init() {
} }
inline bool media_ready() {
return IS_SD_MOUNTED() && IS_SD_INSERTED() && !IS_SD_FILE_OPEN() && !IS_SD_PRINTING();
}
bool sd_mmc_spi_unload(bool) { return true; }
bool sd_mmc_spi_wr_protect() { return false; }
bool sd_mmc_spi_removal() { return !media_ready(); }
Ctrl_status sd_mmc_spi_test_unit_ready() { Ctrl_status sd_mmc_spi_test_unit_ready() {
#ifdef DISABLE_DUE_SD_MMC #ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT; return CTRL_NO_PRESENT;
#endif #endif
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT; if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
return CTRL_GOOD; return CTRL_GOOD;
} }
// NOTE: This function is defined as returning the address of the last block // NOTE: This function is defined as returning the address of the last block
// in the card, which is cardSize() - 1 // in the card, which is cardSize() - 1
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) { Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT; if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
*nb_sector = card.diskIODriver()->cardSize() - 1; *nb_sector = card.diskIODriver()->cardSize() - 1;
return CTRL_GOOD; return CTRL_GOOD;
} }
bool sd_mmc_spi_unload(bool) { return true; }
bool sd_mmc_spi_wr_protect() { return false; }
bool sd_mmc_spi_removal() {
return (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted());
}
#if ACCESS_USB == true #if ACCESS_USB == true
/** /**
* \name MEM <-> USB Interface * \name MEM <-> USB Interface
@@ -61,7 +61,8 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DISABLE_DUE_SD_MMC #ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT; return CTRL_NO_PRESENT;
#endif #endif
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT; if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC #ifdef DEBUG_MMC
{ {
@@ -100,7 +101,8 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DISABLE_DUE_SD_MMC #ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT; return CTRL_NO_PRESENT;
#endif #endif
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT; if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC #ifdef DEBUG_MMC
{ {
+8 -8
View File
@@ -74,7 +74,7 @@
//! //!
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI. //! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
//!/ //!/
void sd_mmc_spi_mem_init(); extern void sd_mmc_spi_mem_init(void);
//! //!
//! @brief This function tests the state of the SD_MMC memory and sends it to the Host. //! @brief This function tests the state of the SD_MMC memory and sends it to the Host.
@@ -87,7 +87,7 @@ void sd_mmc_spi_mem_init();
//! Media not present -> CTRL_NO_PRESENT //! Media not present -> CTRL_NO_PRESENT
//! Media has changed -> CTRL_BUSY //! Media has changed -> CTRL_BUSY
//!/ //!/
Ctrl_status sd_mmc_spi_test_unit_ready(); extern Ctrl_status sd_mmc_spi_test_unit_ready(void);
//! //!
//! @brief This function gives the address of the last valid sector. //! @brief This function gives the address of the last valid sector.
@@ -98,7 +98,7 @@ Ctrl_status sd_mmc_spi_test_unit_ready();
//! Media ready -> CTRL_GOOD //! Media ready -> CTRL_GOOD
//! Media not present -> CTRL_NO_PRESENT //! Media not present -> CTRL_NO_PRESENT
//!/ //!/
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector); extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
/*! \brief Unload/Load the SD/MMC card selected /*! \brief Unload/Load the SD/MMC card selected
* *
@@ -109,7 +109,7 @@ Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
* *
* \return \c true if unload/load done success. * \return \c true if unload/load done success.
*/ */
bool sd_mmc_spi_unload(bool unload); extern bool sd_mmc_spi_unload(bool unload);
//! //!
//! @brief This function returns the write protected status of the memory. //! @brief This function returns the write protected status of the memory.
@@ -120,14 +120,14 @@ bool sd_mmc_spi_unload(bool unload);
//! //!
//! @return false -> the memory is not write-protected (always) //! @return false -> the memory is not write-protected (always)
//!/ //!/
bool sd_mmc_spi_wr_protect(); extern bool sd_mmc_spi_wr_protect(void);
//! //!
//! @brief This function tells if the memory has been removed or not. //! @brief This function tells if the memory has been removed or not.
//! //!
//! @return false -> The memory isn't removed //! @return false -> The memory isn't removed
//! //!
bool sd_mmc_spi_removal(); extern bool sd_mmc_spi_removal(void);
//---- ACCESS DATA FUNCTIONS ---- //---- ACCESS DATA FUNCTIONS ----
@@ -147,7 +147,7 @@ bool sd_mmc_spi_removal();
//! It is ready -> CTRL_GOOD //! It is ready -> CTRL_GOOD
//! A error occur -> CTRL_FAIL //! A error occur -> CTRL_FAIL
//! //!
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector); extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
//! This function initializes the SD/MMC memory for a write operation //! This function initializes the SD/MMC memory for a write operation
//! //!
@@ -161,7 +161,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
//! It is ready -> CTRL_GOOD //! It is ready -> CTRL_GOOD
//! An error occurs -> CTRL_FAIL //! An error occurs -> CTRL_FAIL
//! //!
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector); extern Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector);
#endif // #if ACCESS_USB == true #endif // #if ACCESS_USB == true
+8 -9
View File
@@ -209,17 +209,16 @@ int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }
// ADC // ADC
// ------------------------ // ------------------------
// https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/peripherals/adc.html #define ADC1_CHANNEL(pin) ADC1_GPIO ## pin ## _CHANNEL
adc1_channel_t get_channel(int pin) { adc1_channel_t get_channel(int pin) {
switch (pin) { switch (pin) {
case 39: return ADC1_CHANNEL_3; case 39: return ADC1_CHANNEL(39);
case 36: return ADC1_CHANNEL_0; case 36: return ADC1_CHANNEL(36);
case 35: return ADC1_CHANNEL_7; case 35: return ADC1_CHANNEL(35);
case 34: return ADC1_CHANNEL_6; case 34: return ADC1_CHANNEL(34);
case 33: return ADC1_CHANNEL_5; case 33: return ADC1_CHANNEL(33);
case 32: return ADC1_CHANNEL_4; case 32: return ADC1_CHANNEL(32);
case 37: return ADC1_CHANNEL_1;
case 38: return ADC1_CHANNEL_2;
} }
return ADC1_CHANNEL_MAX; return ADC1_CHANNEL_MAX;
} }
@@ -59,7 +59,6 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN)); TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN)); TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN)); TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN)); TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN)); TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
+1 -1
View File
@@ -152,7 +152,7 @@ void stepperTask(void *parameter) {
xQueueReceive(dma.queue, &dma.current, portMAX_DELAY); xQueueReceive(dma.queue, &dma.current, portMAX_DELAY);
dma.rw_pos = 0; dma.rw_pos = 0;
const bool using_ftMotion = TERN0(FT_MOTION, ftMotion.cfg.active); const bool using_ftMotion = TERN0(FT_MOTION, ftMotion.cfg.mode);
while (dma.rw_pos < DMA_SAMPLE_COUNT) { while (dma.rw_pos < DMA_SAMPLE_COUNT) {
+1 -1
View File
@@ -90,7 +90,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
config.counter_en = TIMER_PAUSE; config.counter_en = TIMER_PAUSE;
config.alarm_en = TIMER_ALARM_EN; config.alarm_en = TIMER_ALARM_EN;
config.intr_type = TIMER_INTR_LEVEL; config.intr_type = TIMER_INTR_LEVEL;
config.auto_reload = TIMER_AUTORELOAD_EN; config.auto_reload = true;
// Select and initialize the timer // Select and initialize the timer
timer_init(timer.group, timer.idx, &config); timer_init(timer.group, timer.idx, &config);
+2 -1
View File
@@ -53,11 +53,12 @@ typedef uint64_t hal_timer_t;
#if ENABLED(I2S_STEPPER_STREAM) #if ENABLED(I2S_STEPPER_STREAM)
#define STEPPER_TIMER_PRESCALE 1 #define STEPPER_TIMER_PRESCALE 1
#define STEPPER_TIMER_RATE 250000 // 250khz, 4µs pulses of i2s word clock #define STEPPER_TIMER_RATE 250000 // 250khz, 4µs pulses of i2s word clock
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs // wrong would be 0.25
#else #else
#define STEPPER_TIMER_PRESCALE 40 #define STEPPER_TIMER_PRESCALE 40
#define STEPPER_TIMER_RATE ((HAL_TIMER_RATE) / (STEPPER_TIMER_PRESCALE)) // frequency of stepper timer, 2MHz #define STEPPER_TIMER_RATE ((HAL_TIMER_RATE) / (STEPPER_TIMER_PRESCALE)) // frequency of stepper timer, 2MHz
#endif
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs #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 #define STEP_TIMER_MIN_INTERVAL 8 // minimum time in µs between stepper interrupts
+14 -30
View File
@@ -114,19 +114,22 @@
// Misc. Functions // Misc. Functions
// //
#ifndef analogInputToDigitalPin #ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) pin_t(p) #define analogInputToDigitalPin(p) (p)
#endif #endif
#define CRITICAL_SECTION_START() \ #define CRITICAL_SECTION_START \
const bool irqon = !__get_PRIMASK(); \ uint32_t primask = __get_PRIMASK(); \
__disable_irq(); \ (void)__iCliRetVal()
__DSB();
#define CRITICAL_SECTION_END() \
__DSB(); \
if (irqon) __enable_irq();
#define cli() __disable_irq() #define CRITICAL_SECTION_END \
#define sei() __enable_irq() if (!primask) \
(void)__iSeiRetVal()
// Disable interrupts
#define cli() noInterrupts()
// Enable interrupts
#define sei() interrupts()
// bss_end alias // bss_end alias
#define __bss_end __bss_end__ #define __bss_end __bss_end__
@@ -139,31 +142,12 @@
// ADC // ADC
// //
#define HAL_ADC_VREF_MV 3300 #define HAL_ADC_VREF_MV 3300
#define HAL_ADC_RESOLUTION 12 #define HAL_ADC_RESOLUTION 10
#define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_PIN(index) index
#define GET_PIN_MAP_INDEX(pin) pin #define GET_PIN_MAP_INDEX(pin) pin
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
//
// Debug port disable
// JTMS / SWDIO = PA13
// JTCK / SWCLK = PA14
// JTDI = PA15
// JTDO = PB3
// NJTRST = PB4
//
#define DBG_SWCLK _BV(0)
#define DBG_SWDIO _BV(1)
#define DBG_TDO _BV(2)
#define DBG_TDI _BV(3)
#define DBG_TRST _BV(4)
#define DBG_ALL (DBG_SWCLK | DBG_SWDIO | DBG_TDO | DBG_TDI | DBG_TRST)
#define JTAGSWD_RESET() PORT_DebugPortSetting(DBG_ALL, Enable);
#define JTAG_DISABLE() PORT_DebugPortSetting(DBG_TDO | DBG_TDI | DBG_TRST, Disable);
#define JTAGSWD_DISABLE() PORT_DebugPortSetting(DBG_ALL, Disable);
// //
// MarlinHAL implementation // MarlinHAL implementation
// //
+2 -33
View File
@@ -123,11 +123,6 @@ void MarlinHAL::init() {
// Register min serial // Register min serial
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); TERN_(POSTMORTEM_DEBUGGING, install_min_serial());
// warn if low memory after init
if (freeMemory() < 1024) {
SERIAL_WARN_MSG("HAL: low memory after init!\n");
}
} }
void MarlinHAL::init_board() {} void MarlinHAL::init_board() {}
@@ -152,31 +147,7 @@ void MarlinHAL::delay_ms(const int ms) {
delay(ms); delay(ms);
} }
void MarlinHAL::idletask() { void MarlinHAL::idletask() {}
#if ENABLED(MARLIN_DEV_MODE)
// check & print serial RX errors
MSerialT *serials[] = { &MSerial1, &MSerial2 };
for (int serial = 0; serial < 2; serial++) {
usart_receive_error_t err = serials[serial]->getReceiveError();
if (err != usart_receive_error_t::None) {
// "Warning: MSerial[n] RX [Framing|Parity|Overrun] Error"
SERIAL_WARN_START();
SERIAL_ECHOPGM(" MSerial");
SERIAL_ECHO(serial + 1);
SERIAL_ECHOPGM(" RX ");
switch(err) {
case usart_receive_error_t::FramingError: SERIAL_ECHOPGM("Framing"); break;
case usart_receive_error_t::ParityError: SERIAL_ECHOPGM("Parity"); break;
case usart_receive_error_t::OverrunError: SERIAL_ECHOPGM("Overrun"); break;
case usart_receive_error_t::RxDataDropped: SERIAL_ECHOPGM("DataDropped"); break;
default: break;
}
SERIAL_ECHOPGM(" Error");
SERIAL_EOL();
}
}
#endif
}
uint8_t MarlinHAL::get_reset_source() { uint8_t MarlinHAL::get_reset_source() {
// Query reset cause from RMU // Query reset cause from RMU
@@ -232,9 +203,7 @@ int MarlinHAL::freeMemory() {
return &top - _sbrk(0); return &top - _sbrk(0);
} }
void MarlinHAL::adc_init() { void MarlinHAL::adc_init() {}
analogReadResolution(HAL_ADC_RESOLUTION);
}
void MarlinHAL::adc_enable(const pin_t pin) { void MarlinHAL::adc_enable(const pin_t pin) {
#if TEMP_SENSOR_SOC #if TEMP_SENSOR_SOC
+3 -23
View File
@@ -46,34 +46,14 @@ constexpr bool serial_handles_emergency(int port) {
// //
// Define serial ports // Define serial ports
// //
#define DEFINE_HWSERIAL_MARLIN(name, n) \
// serial port where RX and TX use IRQs
#define DEFINE_IRQ_SERIAL_MARLIN(name, n) \
MSerialT name(serial_handles_emergency(n), \ MSerialT name(serial_handles_emergency(n), \
&USART##n##_config, \ &USART##n##_config, \
BOARD_USART##n##_TX_PIN, \ BOARD_USART##n##_TX_PIN, \
BOARD_USART##n##_RX_PIN); BOARD_USART##n##_RX_PIN);
// serial port where RX uses DMA and TX uses IRQs DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
// all serial ports use DMA1 DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
// since there are 4 USARTs and 4 DMA channels, we can use the USART number as the DMA channel
#define DEFINE_DMA_SERIAL_MARLIN(name, n) \
MSerialT name(serial_handles_emergency(n), \
&USART##n##_config, \
BOARD_USART##n##_TX_PIN, \
BOARD_USART##n##_RX_PIN, \
M4_DMA1, \
((en_dma_channel_t)(n - 1))); // map USART1 to DMA channel 0, USART2 to DMA channel 1, etc.
#define DEFINE_SERIAL_MARLIN(name, n) TERN(SERIAL_DMA, DEFINE_DMA_SERIAL_MARLIN(name, n), DEFINE_IRQ_SERIAL_MARLIN(name, n))
DEFINE_SERIAL_MARLIN(MSerial1, 1);
DEFINE_SERIAL_MARLIN(MSerial2, 2);
// TODO: remove this warning when SERIAL_DMA has been tested some more
#if ENABLED(SERIAL_DMA)
#warning "SERIAL_DMA may be unstable on HC32F460."
#endif
// //
// Serial port assertions // Serial port assertions
+8 -38
View File
@@ -25,42 +25,17 @@
#include <drivers/usart/Usart.h> #include <drivers/usart/Usart.h>
// Optionally set uart IRQ priority to reduce overflow errors // Optionally set uart IRQ priority to reduce overflow errors
//#define UART_RX_IRQ_PRIO 1 // #define UART_IRQ_PRIO 1
//#define UART_TX_IRQ_PRIO 1
//#define UART_RX_DMA_IRQ_PRIO 1
struct MarlinSerial : public Usart { struct MarlinSerial : public Usart {
MarlinSerial( MarlinSerial(struct usart_config_t *usart_device, gpio_pin_t tx_pin, gpio_pin_t rx_pin) : Usart(usart_device, tx_pin, rx_pin) {}
struct usart_config_t *usart_device,
gpio_pin_t tx_pin,
gpio_pin_t rx_pin
#if ENABLED(SERIAL_DMA)
, M4_DMA_TypeDef *dma_unit = nullptr,
en_dma_channel_t rx_dma_channel = DmaCh0
#endif
) : Usart(usart_device, tx_pin, rx_pin) {
#if ENABLED(SERIAL_DMA)
if (dma_unit != nullptr) {
enableRxDma(dma_unit, rx_dma_channel);
}
#endif
}
#if defined(UART_RX_IRQ_PRIO) || defined(UART_TX_IRQ_PRIO) || defined(UART_RX_DMA_IRQ_PRIO) #ifdef UART_IRQ_PRIO
void setPriority() { void setPriority() {
#if defined(UART_RX_IRQ_PRIO) NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_RX_IRQ_PRIO); NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_RX_IRQ_PRIO); NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_IRQ_PRIO);
#endif NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_IRQ_PRIO);
#if defined(UART_TX_IRQ_PRIO)
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_TX_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_TX_IRQ_PRIO);
#endif
#if defined(UART_RX_DMA_IRQ_PRIO) && ENABLED(SERIAL_DMA)
NVIC_SetPriority(c_dev()->dma.rx.rx_data_available_dma_btc.interrupt_number, UART_RX_DMA_IRQ_PRIO);
#endif
} }
void begin(uint32_t baud) { void begin(uint32_t baud) {
@@ -72,12 +47,7 @@ struct MarlinSerial : public Usart {
Usart::begin(baud, config); Usart::begin(baud, config);
setPriority(); setPriority();
} }
#endif
void begin(uint32_t baud, const stc_usart_uart_init_t *config, const bool rxNoiseFilter = true) {
Usart::begin(baud, config, rxNoiseFilter);
setPriority();
}
#endif // UART_RX_IRQ_PRIO || UART_TX_IRQ_PRIO || UART_RX_DMA_IRQ_PRIO
}; };
typedef Serial1Class<MarlinSerial> MSerialT; typedef Serial1Class<MarlinSerial> MSerialT;
-75
View File
@@ -1,75 +0,0 @@
/**
* app_config.h is included by the hc32f460 arduino build script for every source file.
* it is used to configure the arduino core (and ddl) automatically according
* to the settings in Configuration.h and Configuration_adv.h.
*/
#pragma once
#ifndef _HC32_APP_CONFIG_H_
#define _HC32_APP_CONFIG_H_
#include "../../inc/MarlinConfigPre.h"
//
// dev mode
//
#if ENABLED(MARLIN_DEV_MODE)
#define __DEBUG 1
#define __CORE_DEBUG 1
#endif
//
// Fault Handlers and Panic
//
#if ENABLED(POSTMORTEM_DEBUGGING)
// disable arduino core fault handler, as we define our own
#define CORE_DISABLE_FAULT_HANDLER 1
#endif
// force-enable panic handler so that we can use our custom one (in MinSerial)
#define PANIC_ENABLE 1
// use short filenames in ddl debug and core panic output
#define __DEBUG_SHORT_FILENAMES 1
#define __PANIC_SHORT_FILENAMES 1
// omit panic messages in core panic output
#define __OMIT_PANIC_MESSAGE 1
//
// Usart
//
// disable serial globals (Serial1, Serial2, ...), as we define our own
#define DISABLE_SERIAL_GLOBALS 1
// increase the size of the Usart buffers (both RX and TX)
// NOTE:
// the heap usage will increase by (SERIAL_BUFFER_SIZE - 64) * "number of serial ports used"
// if running out of heap, the system may become unstable
//#define SERIAL_BUFFER_SIZE 256
// enable support for Usart Clock Divider / Oversampling auto config
#define USART_AUTO_CLKDIV_OS_CONFIG 1
// enable USART_RX_DMA_SUPPORT core option when SERIAL_DMA is enabled
#if ENABLED(SERIAL_DMA)
#define USART_RX_DMA_SUPPORT 1
#endif
//
// Misc.
//
// redirect printf to host serial
#define REDIRECT_PRINTF_TO_SERIAL 1
// F_CPU must be known at compile time, but on HC32F460 it's not.
// Thus we assume HCLK to be 200MHz, as that's what is configured in
// 'core_hook_sysclock_init' in 'sysclock.cpp'.
// If you face issues with this assumption, please double-check with the values
// printed by 'MarlinHAL::HAL_clock_frequencies_dump'.
// see also: HAL_TIMER_RATE in timers.h
#define F_CPU 200000000 // 200MHz HCLK
#endif // _HC32_APP_CONFIG_H_
+1 -21
View File
@@ -40,15 +40,9 @@ void endstopIRQHandler() {
CHECK(X_MAX); CHECK(X_MAX);
CHECK(X_MIN); CHECK(X_MIN);
CHECK(X2_MAX);
CHECK(X2_MIN);
CHECK(Y_MAX); CHECK(Y_MAX);
CHECK(Y_MIN); CHECK(Y_MIN);
CHECK(Y2_MAX);
CHECK(Y2_MIN);
CHECK(Z_MAX); CHECK(Z_MAX);
CHECK(Z_MIN); CHECK(Z_MIN);
@@ -58,9 +52,6 @@ void endstopIRQHandler() {
CHECK(Z3_MAX); CHECK(Z3_MAX);
CHECK(Z3_MIN); CHECK(Z3_MIN);
CHECK(Z4_MAX);
CHECK(Z4_MIN);
CHECK(Z_MIN_PROBE); CHECK(Z_MIN_PROBE);
// Update endstops // Update endstops
@@ -78,15 +69,9 @@ void setup_endstop_interrupts() {
SETUP(X_MAX); SETUP(X_MAX);
SETUP(X_MIN); SETUP(X_MIN);
SETUP(X2_MAX);
SETUP(X2_MIN);
SETUP(Y_MAX); SETUP(Y_MAX);
SETUP(Y_MIN); SETUP(Y_MIN);
SETUP(Y2_MAX);
SETUP(Y2_MIN);
SETUP(Z_MAX); SETUP(Z_MAX);
SETUP(Z_MIN); SETUP(Z_MIN);
@@ -96,19 +81,14 @@ void setup_endstop_interrupts() {
SETUP(Z3_MAX); SETUP(Z3_MAX);
SETUP(Z3_MIN); SETUP(Z3_MIN);
SETUP(Z4_MAX);
SETUP(Z4_MIN);
SETUP(Z_MIN_PROBE); SETUP(Z_MIN_PROBE);
SETUP(CALIBRATION);
#undef SETUP #undef SETUP
} }
// Ensure 1 - 10 IRQs are registered // Ensure 1 - 10 IRQs are registered
// Disable some endstops if you encounter this error // Disable some endstops if you encounter this error
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_X2_MAX, USE_X2_MIN, USE_Y_MAX, USE_Y_MIN, USE_Y2_MAX, USE_Y2_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z4_MAX, USE_Z4_MIN, USE_Z_MIN_PROBE, USE_CALIBRATION) #define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_Y_MAX, USE_Y_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z_MIN_PROBE)
#if ENDSTOPS_INTERRUPTS_COUNT > 10 #if ENDSTOPS_INTERRUPTS_COUNT > 10
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts." #error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
#elif ENDSTOPS_INTERRUPTS_COUNT == 0 #elif ENDSTOPS_INTERRUPTS_COUNT == 0
-31
View File
@@ -20,20 +20,6 @@
* *
*/ */
#pragma once #pragma once
#include <core_util.h>
#if !defined(ARDUINO_CORE_VERSION_INT) || !defined(GET_VERSION_INT)
// version macros were introduced in arduino core version 1.1.0
// below that version, we polyfill them
#define GET_VERSION_INT(major, minor, patch) ((major * 100000) + (minor * 1000) + patch)
#define ARDUINO_CORE_VERSION_INT GET_VERSION_INT(1, 0, 0)
#endif
#if ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 1, 0)
// because we use app_config.h introduced in arduino core version 1.1.0, the
// HAL is not compatible with older versions
#error "The HC32 HAL is not compatible with Arduino Core versions < 1.1.0. Consider updating the Arduino Core."
#endif
#ifndef BOARD_XTAL_FREQUENCY #ifndef BOARD_XTAL_FREQUENCY
#error "BOARD_XTAL_FREQUENCY is required for HC32F460." #error "BOARD_XTAL_FREQUENCY is required for HC32F460."
@@ -88,20 +74,3 @@
#error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN." #error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN."
#endif #endif
#endif #endif
#if ENABLED(SERIAL_DMA)
#if !defined(USART_RX_DMA_SUPPORT)
#error "SERIAL_DMA requires USART_RX_DMA_SUPPORT to be enabled in the arduino core."
#endif
// Before arduino core version 1.2.0, USART_RX_DMA_SUPPORT did not implement
// core_hook_usart_rx_irq, which is required for the emergency parser.
// With 1.2.0, this was fixed (see https://github.com/shadow578/framework-arduino-hc32f46x/pull/25).
#if ENABLED(EMERGENCY_PARSER) && ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 2, 0)
#error "EMERGENCY_PARSER is not supported with SERIAL_DMA. Please disable either SERIAL_DMA or EMERGENCY_PARSER."
#endif
#if ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 1, 0)
#error "SERIAL_DMA is not supported with arduino core version < 1.1.0."
#endif
#endif
+18 -18
View File
@@ -31,24 +31,24 @@
#define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS #define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS
#define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS #define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS
#define isValidPin(pin) IS_GPIO_PIN(pin) #define VALID_PIN(pin) IS_GPIO_PIN(pin)
// Note: pin_array is defined in `Marlin/src/pins/pinsDebug.h`, and since this file is included // Note: pin_array is defined in `Marlin/src/pins/pinsDebug.h`, and since this file is included
// after it, it is available in this file as well. // after it, it is available in this file as well.
#define getPinByIndex(p) pin_t(pin_array[p].pin) #define GET_ARRAY_PIN(p) pin_t(pin_array[p].pin)
#define digitalRead_mod(p) extDigitalRead(p) #define digitalRead_mod(p) extDigitalRead(p)
#define printPinNumber(p) \ #define PRINT_PIN(p) \
do { \ do { \
sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); \ sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); \
SERIAL_ECHO(buffer); \ SERIAL_ECHO(buffer); \
} while (0) } while (0)
#define printPinAnalog(p) \ #define PRINT_PIN_ANALOG(p) \
do { \ do { \
sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); \ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); \
SERIAL_ECHO(buffer); \ SERIAL_ECHO(buffer); \
} while (0) } while (0)
#define PRINT_PORT(p) printPinPort(p) #define PRINT_PORT(p) print_port(p)
#define printPinNameByIndex(x) \ #define PRINT_ARRAY_NAME(x) \
do { \ do { \
sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); \ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); \
SERIAL_ECHO(buffer); \ SERIAL_ECHO(buffer); \
@@ -71,14 +71,14 @@
#define M43_NEVER_TOUCH(Q) (IS_HOST_USART_PIN(Q) || IS_OSC_PIN(Q)) #define M43_NEVER_TOUCH(Q) (IS_HOST_USART_PIN(Q) || IS_OSC_PIN(Q))
#endif #endif
static int8_t digitalPinToAnalogIndex(pin_t pin) { static pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
if (!isValidPin(pin)) return -1; if (!VALID_PIN(pin)) return -1;
const int8_t adc_channel = int8_t(PIN_MAP[pin].adc_info.channel); const int8_t adc_channel = int8_t(PIN_MAP[pin].adc_info.channel);
return pin_t(adc_channel); return pin_t(adc_channel);
} }
static bool isAnalogPin(pin_t pin) { static bool IS_ANALOG(pin_t pin) {
if (!isValidPin(pin)) return false; if (!VALID_PIN(pin)) return false;
if (PIN_MAP[pin].adc_info.channel != ADC_PIN_INVALID) if (PIN_MAP[pin].adc_info.channel != ADC_PIN_INVALID)
return _GET_MODE(pin) == INPUT_ANALOG && !M43_NEVER_TOUCH(pin); return _GET_MODE(pin) == INPUT_ANALOG && !M43_NEVER_TOUCH(pin);
@@ -86,13 +86,13 @@ static bool isAnalogPin(pin_t pin) {
return false; return false;
} }
static bool getValidPinMode(const pin_t pin) { static bool GET_PINMODE(const pin_t pin) {
return isValidPin(pin) && !IS_INPUT(pin); return VALID_PIN(pin) && !IS_INPUT(pin);
} }
static bool getPinIsDigitalByIndex(const int16_t array_pin) { static bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {
const pin_t pin = getPinByIndex(array_pin); const pin_t pin = GET_ARRAY_PIN(array_pin);
return (!isAnalogPin(pin)); return (!IS_ANALOG(pin));
} }
/** /**
@@ -117,7 +117,7 @@ bool pwm_status(const pin_t pin) {
return timera_is_unit_initialized(unit) && timera_is_channel_active(unit, channel) && getPinMode(pin) == OUTPUT_PWM; return timera_is_unit_initialized(unit) && timera_is_channel_active(unit, channel) && getPinMode(pin) == OUTPUT_PWM;
} }
void printPinPWM(const pin_t pin) { void pwm_details(const pin_t pin) {
// Get timer assignment for pin // Get timer assignment for pin
timera_config_t *unit; timera_config_t *unit;
en_timera_channel_t channel; en_timera_channel_t channel;
@@ -161,7 +161,7 @@ void printPinPWM(const pin_t pin) {
} }
} }
void printPinPort(pin_t pin) { void print_port(pin_t pin) {
const char port = 'A' + char(pin >> 4); // Pin div 16 const char port = 'A' + char(pin >> 4); // Pin div 16
const int16_t gbit = PIN_MAP[pin].bit_pos; const int16_t gbit = PIN_MAP[pin].bit_pos;
char buffer[8]; char buffer[8];
+17 -26
View File
@@ -54,7 +54,7 @@
fn \ fn \
} }
stc_sd_handle_t *handle = nullptr; stc_sd_handle_t *handle;
bool SDIO_Init() { bool SDIO_Init() {
// Configure SDIO pins // Configure SDIO pins
@@ -66,45 +66,36 @@ bool SDIO_Init() {
GPIO_SetFunc(BOARD_SDIO_CMD, Func_Sdio); GPIO_SetFunc(BOARD_SDIO_CMD, Func_Sdio);
GPIO_SetFunc(BOARD_SDIO_DET, Func_Sdio); GPIO_SetFunc(BOARD_SDIO_DET, Func_Sdio);
// If a handle is already initialized, free it before creating a new one
// otherwise, we will leak memory, which will eventually crash the system
if (handle != nullptr) {
delete handle->pstcDmaInitCfg;
delete handle->pstcCardInitCfg;
delete handle;
handle = nullptr;
}
// Create DMA configuration // Create DMA configuration
stc_sdcard_dma_init_t *dmaConf = new stc_sdcard_dma_init_t; stc_sdcard_dma_init_t *dmaConf = new stc_sdcard_dma_init_t;
dmaConf->DMAx = SDIO_DMA_PERIPHERAL; dmaConf->DMAx = SDIO_DMA_PERIPHERAL;
dmaConf->enDmaCh = SDIO_DMA_CHANNEL; dmaConf->enDmaCh = SDIO_DMA_CHANNEL;
// Create card configuration
// This should be a fairly safe configuration for most cards
stc_sdcard_init_t *cardConf = new stc_sdcard_init_t;
cardConf->enBusWidth = SdiocBusWidth4Bit;
cardConf->enClkFreq = SdiocClk400K;
cardConf->enSpeedMode = SdiocNormalSpeedMode;
cardConf->pstcInitCfg = nullptr;
// Create handle in DMA mode // Create handle in DMA mode
handle = new stc_sd_handle_t; handle = new stc_sd_handle_t;
handle->SDIOCx = SDIO_PERIPHERAL; handle->SDIOCx = SDIO_PERIPHERAL;
handle->enDevMode = SdCardDmaMode; handle->enDevMode = SdCardDmaMode;
handle->pstcDmaInitCfg = dmaConf; handle->pstcDmaInitCfg = dmaConf;
//handle->pstcCardInitCfg = cardConf; // assigned in SDCARD_Init
// Create card configuration
// This should be a fairly safe configuration for most cards
stc_sdcard_init_t cardConf = {
.enBusWidth = SdiocBusWidth4Bit,
.enClkFreq = SdiocClk400K,
.enSpeedMode = SdiocNormalSpeedMode,
//.pstcInitCfg = NULL,
};
// Initialize sd card // Initialize sd card
en_result_t rc = SDCARD_Init(handle, cardConf); en_result_t rc = SDCARD_Init(handle, &cardConf);
if (rc != Ok) printf("SDIO_Init() error (rc=%u)\n", rc); if (rc != Ok) printf("SDIO_Init() error (rc=%u)\n", rc);
return rc == Ok; return rc == Ok;
} }
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) { bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false); CORE_ASSERT(handle != NULL, "SDIO not initialized");
CORE_ASSERT(dst != nullptr, "SDIO_ReadBlock dst is NULL", return false); CORE_ASSERT(dst != NULL, "SDIO_ReadBlock dst is NULL");
WITH_RETRY(SDIO_READ_RETRIES, { WITH_RETRY(SDIO_READ_RETRIES, {
en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT); en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT);
@@ -116,8 +107,8 @@ bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
} }
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) { bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false); CORE_ASSERT(handle != NULL, "SDIO not initialized");
CORE_ASSERT(src != nullptr, "SDIO_WriteBlock src is NULL", return false); CORE_ASSERT(src != NULL, "SDIO_WriteBlock src is NULL");
WITH_RETRY(SDIO_WRITE_RETRIES, { WITH_RETRY(SDIO_WRITE_RETRIES, {
en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT); en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT);
@@ -129,12 +120,12 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
} }
bool SDIO_IsReady() { bool SDIO_IsReady() {
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false); CORE_ASSERT(handle != NULL, "SDIO not initialized");
return bool(handle->stcCardStatus.READY_FOR_DATA); return bool(handle->stcCardStatus.READY_FOR_DATA);
} }
uint32_t SDIO_GetCardSize() { uint32_t SDIO_GetCardSize() {
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return 0); CORE_ASSERT(handle != NULL, "SDIO not initialized");
// Multiply number of blocks with block size to get size in bytes // Multiply number of blocks with block size to get size in bytes
const uint64_t cardSizeBytes = uint64_t(handle->stcSdCardInfo.u32LogBlockNbr) * uint64_t(handle->stcSdCardInfo.u32LogBlockSize); const uint64_t cardSizeBytes = uint64_t(handle->stcSdCardInfo.u32LogBlockNbr) * uint64_t(handle->stcSdCardInfo.u32LogBlockSize);
+9 -24
View File
@@ -96,44 +96,29 @@ void core_hook_sysclock_init() {
#endif #endif
#endif #endif
// sysclk is now configured according to F_CPU (i.e., 200MHz PLL output) // Setup clock divisors for sysclk = 200 MHz:
const uint32_t sysclock = F_CPU;
// Setup clock divisors for sysclk = 200 MHz
// Note: PCLK1 is used for step+temp timers, and need to be kept at 50 MHz (until there is a better solution) // Note: PCLK1 is used for step+temp timers, and need to be kept at 50 MHz (until there is a better solution)
constexpr stc_clk_sysclk_cfg_t sysClkConf = { stc_clk_sysclk_cfg_t sysClkConf = {
.enHclkDiv = ClkSysclkDiv1, // HCLK = 200 MHz (CPU) .enHclkDiv = ClkSysclkDiv1, // HCLK = 200 MHz (CPU)
.enExclkDiv = ClkSysclkDiv2, // EXCLK = 100 MHz (SDIO) .enExclkDiv = ClkSysclkDiv2, // EXCLK = 100 MHz (SDIO)
.enPclk0Div = ClkSysclkDiv2, // PCLK0 = 100 MHz (Timer6 (not used)) .enPclk0Div = ClkSysclkDiv1, // PCLK0 = 200 MHz (Timer6 (not used))
.enPclk1Div = ClkSysclkDiv4, // PCLK1 = 50 MHz (USART, SPI, I2S, Timer0 (step+temp), TimerA (Servo)) .enPclk1Div = ClkSysclkDiv4, // PCLK1 = 50 MHz (USART, SPI, I2S, Timer0 (step+temp), TimerA (Servo))
.enPclk2Div = ClkSysclkDiv8, // PCLK2 = 25 MHz (ADC) .enPclk2Div = ClkSysclkDiv4, // PCLK2 = 50 MHz (ADC)
.enPclk3Div = ClkSysclkDiv8, // PCLK3 = 25 MHz (I2C, WDT) .enPclk3Div = ClkSysclkDiv4, // PCLK3 = 50 MHz (I2C, WDT)
.enPclk4Div = ClkSysclkDiv2, // PCLK4 = 100 MHz (ADC ctl) .enPclk4Div = ClkSysclkDiv2, // PCLK4 = 100 MHz (ADC ctl)
}; };
#if ARDUINO_CORE_VERSION_INT >= GET_VERSION_INT(1, 2, 0)
assert_system_clocks_valid<
sysclock,
sysClkConf.enHclkDiv,
sysClkConf.enPclk0Div,
sysClkConf.enPclk1Div,
sysClkConf.enPclk2Div,
sysClkConf.enPclk3Div,
sysClkConf.enPclk4Div,
sysClkConf.enExclkDiv
>();
#endif
sysclock_set_clock_dividers(&sysClkConf); sysclock_set_clock_dividers(&sysClkConf);
// Set power mode // Set power mode
power_mode_update_pre(sysclock); #define POWER_MODE_SYSTEM_CLOCK 200000000 // 200 MHz
power_mode_update_pre(POWER_MODE_SYSTEM_CLOCK);
// Switch to MPLL as sysclk source // Switch to MPLL as sysclk source
CLK_SetSysClkSource(CLKSysSrcMPLL); CLK_SetSysClkSource(CLKSysSrcMPLL);
// Set power mode // Set power mode
power_mode_update_post(sysclock); power_mode_update_post(POWER_MODE_SYSTEM_CLOCK);
#undef POWER_MODE_SYSTEM_CLOCK
} }
#endif // ARDUINO_ARCH_HC32 #endif // ARDUINO_ARCH_HC32
+15 -19
View File
@@ -38,36 +38,32 @@ extern Timer0 step_timer;
// Timer Configurations // Timer Configurations
// //
/** // TODO: some calculations (step irq min_step_rate) require the timer rate to be known at compile time
* HAL_TIMER_RATE must be known at compile time since it's used to calculate // this is not possible with the HC32F460, as the timer rate depends on PCLK1
* STEPPER_TIMER_RATE, which is used in 'constexpr' calculations. // as a workaround, PCLK1 = 50MHz is assumed (check with clock dump in MarlinHAL::init())
* On the HC32F460 the timer rate depends on PCLK1, which is derived from the #define HAL_TIMER_RATE 50000000 // 50MHz
* system clock configured at runtime. As a workaround, we use the existing
* assumption of a 200MHz clock, defining F_CPU as 200000000, then configure PCLK1
* as F_CPU with a divider of 4 in 'sysclock.cpp::core_hook_sysclock_init'.
*
* If you face issues with this assumption, please double-check with the values
* printed by 'MarlinHAL::HAL_clock_frequencies_dump'.
*
* TODO: If the 'constexpr' requirement is ever lifted, use TIMER0_BASE_FREQUENCY instead
*/
#define HAL_TIMER_RATE (F_CPU / 4) // i.e., 50MHz
// #define HAL_TIMER_RATE TIMER0_BASE_FREQUENCY // #define HAL_TIMER_RATE TIMER0_BASE_FREQUENCY
// TODO: CYCLES_PER_MICROSECOND seems to be used by Marlin to calculate the number of cycles per microsecond in the timer ISRs
// by default, it uses F_CPU, but since that is not known at compile time for HC32, we overwrite it here
#undef CYCLES_PER_MICROSECOND
#define CYCLES_PER_MICROSECOND (HAL_TIMER_RATE / 1000000UL)
// Temperature timer // Temperature timer
#define TEMP_TIMER_NUM (&temp_timer) #define TEMP_TIMER_NUM (&temp_timer)
#define TEMP_TIMER_PRIORITY DDL_IRQ_PRIORITY_02 #define TEMP_TIMER_PRIORITY DDL_IRQ_PRIORITY_02
#define TEMP_TIMER_PRESCALE 16UL // 12.5MHz #define TEMP_TIMER_PRESCALE 16ul
#define TEMP_TIMER_RATE 1000 // 1kHz #define TEMP_TIMER_RATE 1000 // 1kHz
#define TEMP_TIMER_FREQUENCY TEMP_TIMER_RATE // 1kHz also #define TEMP_TIMER_FREQUENCY TEMP_TIMER_RATE // Alias for Marlin
// Stepper timer // Stepper timer
#define STEP_TIMER_NUM (&step_timer) #define STEP_TIMER_NUM (&step_timer)
#define STEP_TIMER_PRIORITY DDL_IRQ_PRIORITY_00 // Top priority, nothing else uses it #define STEP_TIMER_PRIORITY DDL_IRQ_PRIORITY_01
#define STEPPER_TIMER_PRESCALE 16UL // 12.5MHz #define STEPPER_TIMER_PRESCALE 16ul
// TODO: STEPPER_TIMER_RATE seems to work fine like this, but requires further testing...
#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // 50MHz / 16 = 3.125MHz #define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // 50MHz / 16 = 3.125MHz
#define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000UL) // Integer 3 #define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000)
// Pulse timer (== stepper timer) // Pulse timer (== stepper timer)
#define PULSE_TIMER_NUM STEP_TIMER_NUM #define PULSE_TIMER_NUM STEP_TIMER_NUM
@@ -82,7 +82,7 @@ static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, c
} }
static void u8g_sw_spi_shift_out(uint8_t val) { static void u8g_sw_spi_shift_out(uint8_t val) {
#if U8G_SPI_USE_MODE_3 #if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
swSpiTransfer_mode_3(val, SPI_speed); swSpiTransfer_mode_3(val, SPI_speed);
#else #else
swSpiTransfer_mode_0(val, SPI_speed); swSpiTransfer_mode_0(val, SPI_speed);
@@ -116,7 +116,7 @@ uint8_t u8g_com_HAL_HC32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, voi
break; break;
case U8G_COM_MSG_CHIP_SELECT: case U8G_COM_MSG_CHIP_SELECT:
#if U8G_SPI_USE_MODE_3 // This LCD SPI is running mode 3 while SD card is running mode 0 #if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // This 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 if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active // the next chip select goes active
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
+1 -1
View File
@@ -52,7 +52,7 @@ uint8_t MarlinHAL::active_ch = 0;
uint16_t MarlinHAL::adc_value() { uint16_t MarlinHAL::adc_value() {
const pin_t pin = analogInputToDigitalPin(active_ch); const pin_t pin = analogInputToDigitalPin(active_ch);
if (!isValidPin(pin)) return 0; if (!VALID_PIN(pin)) return 0;
return uint16_t((Gpio::get(pin) >> 2) & 0x3FF); // return 10bit value as Marlin expects return uint16_t((Gpio::get(pin) >> 2) & 0x3FF); // return 10bit value as Marlin expects
} }
+6 -6
View File
@@ -49,28 +49,28 @@ extern "C" void delay(const int msec) {
// IO functions // IO functions
// As defined by Arduino INPUT(0x0), OUTPUT(0x1), INPUT_PULLUP(0x2) // As defined by Arduino INPUT(0x0), OUTPUT(0x1), INPUT_PULLUP(0x2)
void pinMode(const pin_t pin, const uint8_t mode) { void pinMode(const pin_t pin, const uint8_t mode) {
if (!isValidPin(pin)) return; if (!VALID_PIN(pin)) return;
Gpio::setMode(pin, mode); Gpio::setMode(pin, mode);
} }
void digitalWrite(pin_t pin, uint8_t pin_status) { void digitalWrite(pin_t pin, uint8_t pin_status) {
if (!isValidPin(pin)) return; if (!VALID_PIN(pin)) return;
Gpio::set(pin, pin_status); Gpio::set(pin, pin_status);
} }
bool digitalRead(pin_t pin) { bool digitalRead(pin_t pin) {
if (!isValidPin(pin)) return false; if (!VALID_PIN(pin)) return false;
return Gpio::get(pin); return Gpio::get(pin);
} }
void analogWrite(pin_t pin, int pwm_value) { // 1 - 254: pwm_value, 0: LOW, 255: HIGH void analogWrite(pin_t pin, int pwm_value) { // 1 - 254: pwm_value, 0: LOW, 255: HIGH
if (!isValidPin(pin)) return; if (!VALID_PIN(pin)) return;
Gpio::set(pin, pwm_value); Gpio::set(pin, pwm_value);
} }
uint16_t analogRead(pin_t adc_pin) { uint16_t analogRead(pin_t adc_pin) {
if (!isValidPin(digitalPinToAnalogIndex(adc_pin))) return 0; if (!VALID_PIN(DIGITAL_PIN_TO_ANALOG_PIN(adc_pin))) return 0;
return Gpio::get(digitalPinToAnalogIndex(adc_pin)); return Gpio::get(DIGITAL_PIN_TO_ANALOG_PIN(adc_pin));
} }
char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s) { char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s) {
-3
View File
@@ -37,10 +37,7 @@ Timer::Timer() {
} }
Timer::~Timer() { Timer::~Timer() {
if (timerid != 0) {
timer_delete(timerid); timer_delete(timerid);
timerid = 0;
}
} }
void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) { void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) {
+2 -2
View File
@@ -42,7 +42,7 @@ constexpr pin_t analogInputToDigitalPin(const int8_t p) {
} }
// Get the analog index for a digital pin // Get the analog index for a digital pin
constexpr int8_t digitalPinToAnalogIndex(const pin_t p) { constexpr int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) {
return (WITHIN(p, analog_offset, NUM_DIGITAL_PINS) ? p - analog_offset : P_NC); return (WITHIN(p, analog_offset, NUM_DIGITAL_PINS) ? p - analog_offset : P_NC);
} }
@@ -50,7 +50,7 @@ constexpr int8_t digitalPinToAnalogIndex(const pin_t p) {
constexpr int16_t GET_PIN_MAP_INDEX(const pin_t pin) { return pin; } constexpr int16_t GET_PIN_MAP_INDEX(const pin_t pin) { return pin; }
// Test whether the pin is valid // Test whether the pin is valid
constexpr bool isValidPin(const pin_t p) { return WITHIN(p, 0, NUM_DIGITAL_PINS); } constexpr bool VALID_PIN(const pin_t p) { return WITHIN(p, 0, NUM_DIGITAL_PINS); }
// Test whether the pin is PWM // Test whether the pin is PWM
constexpr bool PWM_PIN(const pin_t p) { return false; } constexpr bool PWM_PIN(const pin_t p) { return false; }
-2
View File
@@ -21,7 +21,6 @@
*/ */
#ifdef __PLAT_LINUX__ #ifdef __PLAT_LINUX__
#ifndef UNIT_TEST
//#define GPIO_LOGGING // Full GPIO and Positional Logging //#define GPIO_LOGGING // Full GPIO and Positional Logging
@@ -136,5 +135,4 @@ int main() {
read_serial.join(); read_serial.join();
} }
#endif // UNIT_TEST
#endif // __PLAT_LINUX__ #endif // __PLAT_LINUX__
+11 -11
View File
@@ -29,20 +29,20 @@
*/ */
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0 ? 1 : 0) #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0)
#define digitalRead_mod(p) digitalRead(p) #define digitalRead_mod(p) digitalRead(p)
#define getPinByIndex(p) pin_array[p].pin #define GET_ARRAY_PIN(p) pin_array[p].pin
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #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 printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
// active ADC function/mode/code values for PINSEL registers // active ADC function/mode/code values for PINSEL registers
constexpr int8_t ADC_pin_mode(pin_t pin) { return -1; } constexpr int8_t ADC_pin_mode(pin_t pin) { return -1; }
int8_t get_pin_mode(const pin_t pin) { return isValidPin(pin) ? 0 : -1; } int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? 0 : -1; }
bool getValidPinMode(const pin_t pin) { bool GET_PINMODE(const pin_t pin) {
const int8_t pin_mode = get_pin_mode(pin); const int8_t pin_mode = get_pin_mode(pin);
if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin
return false; return false;
@@ -50,11 +50,11 @@ bool getValidPinMode(const pin_t pin) {
return (Gpio::getMode(pin) != 0); // Input/output state return (Gpio::getMode(pin) != 0); // Input/output state
} }
bool getPinIsDigitalByIndex(const pin_t pin) { bool GET_ARRAY_IS_DIGITAL(const pin_t pin) {
return (!isAnalogPin(pin) || get_pin_mode(pin) != ADC_pin_mode(pin)); return (!IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin));
} }
void printPinPWM(const pin_t pin) {} void pwm_details(const pin_t pin) {}
bool pwm_status(const pin_t) { return false; } bool pwm_status(const pin_t) { return false; }
void printPinPort(const pin_t) {} void print_port(const pin_t) {}
+6
View File
@@ -28,6 +28,12 @@
// spiBeginTransaction. // spiBeginTransaction.
#endif #endif
// Onboard SD
//#define SD_SCK_PIN P0_07
//#define SD_MISO_PIN P0_08
//#define SD_MOSI_PIN P0_09
//#define SD_SS_PIN P0_06
// External SD // External SD
#ifndef SD_SCK_PIN #ifndef SD_SCK_PIN
#define SD_SCK_PIN 50 #define SD_SCK_PIN 50
+10 -10
View File
@@ -82,13 +82,13 @@ extern DefaultSerial1 USBSerial;
#endif #endif
#endif #endif
#ifdef MMU_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if MMU_SERIAL_PORT == -1 #if MMU2_SERIAL_PORT == -1
#define MMU_SERIAL USBSerial #define MMU2_SERIAL USBSerial
#elif WITHIN(MMU_SERIAL_PORT, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU_SERIAL MSERIAL(MMU_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
#else #else
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #if HAS_DGUS_LCD
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available() #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available()
#endif #endif
#endif #endif
@@ -137,12 +137,12 @@ extern DefaultSerial1 USBSerial;
// //
// Test whether the pin is valid // Test whether the pin is valid
constexpr bool isValidPin(const pin_t pin) { constexpr bool VALID_PIN(const pin_t pin) {
return LPC176x::pin_is_valid(pin); return LPC176x::pin_is_valid(pin);
} }
// Get the analog index for a digital pin // Get the analog index for a digital pin
constexpr int8_t digitalPinToAnalogIndex(const pin_t 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 (LPC176x::pin_is_valid(pin) && LPC176x::pin_has_adc(pin)) ? pin : -1;
} }
@@ -159,7 +159,7 @@ constexpr pin_t GET_PIN_MAP_PIN(const int16_t index) {
// Parse a G-code word into a pin index // Parse a G-code word into a pin index
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval); int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
// P0.6 thru P0.9 are for the onboard SD card // P0.6 thru P0.9 are for the onboard SD card
#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09 #define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09,
// ------------------------ // ------------------------
// Defines // Defines
@@ -146,12 +146,6 @@ void setup_endstop_interrupts() {
#endif #endif
_ATTACH(Z_MIN_PROBE_PIN); _ATTACH(Z_MIN_PROBE_PIN);
#endif #endif
#if USE_CALIBRATION
#if !LPC1768_PIN_INTERRUPT_M(CALIBRATION_PIN)
#error "CALIBRATION_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
_ATTACH(CALIBRATION_PIN);
#endif
#if USE_I_MAX #if USE_I_MAX
#if !LPC1768_PIN_INTERRUPT_M(I_MAX_PIN) #if !LPC1768_PIN_INTERRUPT_M(I_MAX_PIN)
#error "I_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #error "I_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
+2 -4
View File
@@ -26,10 +26,8 @@
void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
if (!LPC176x::pin_is_valid(pin)) return; if (!LPC176x::pin_is_valid(pin)) return;
if (LPC176x::pwm_attach_pin(pin)) { if (LPC176x::pwm_attach_pin(pin))
const uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, LPC176x::pwm_get_period(pin)); LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size); // map 1-254 onto PWM range
LPC176x::pwm_write(pin, duty);
}
} }
void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) { void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
+1 -1
View File
@@ -66,7 +66,7 @@
#define _WRITE(IO,V) WRITE_PIN(IO,V) #define _WRITE(IO,V) WRITE_PIN(IO,V)
/// toggle a pin /// toggle a pin
#define _TOGGLE(IO) LPC176x::gpio_toggle(IO) #define _TOGGLE(IO) _WRITE(IO, !READ(IO))
/// set pin as input /// set pin as input
#define _SET_INPUT(IO) SET_DIR_INPUT(IO) #define _SET_INPUT(IO) SET_DIR_INPUT(IO)
+9 -9
View File
@@ -29,12 +29,12 @@
*/ */
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0 ? 1 : 0) #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0)
#define digitalRead_mod(p) extDigitalRead(p) #define digitalRead_mod(p) extDigitalRead(p)
#define getPinByIndex(p) pin_array[p].pin #define GET_ARRAY_PIN(p) pin_array[p].pin
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #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 printPinNumber(p) do{ sprintf_P(buffer, PSTR("P%d_%02d"), LPC176x::pin_port(p), LPC176x::pin_bit(p)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("P%d_%02d"), LPC176x::pin_port(p), LPC176x::pin_bit(p)); SERIAL_ECHO(buffer); }while(0)
#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR("_A%d "), LPC176x::pin_get_adc_channel(pin)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR("_A%d "), LPC176x::pin_get_adc_channel(pin)); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 17 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 17 // 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 // pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
@@ -42,15 +42,15 @@
#define M43_NEVER_TOUCH(Q) ((Q) == P0_29 || (Q) == P0_30 || (Q) == P2_09) // USB pins #define M43_NEVER_TOUCH(Q) ((Q) == P0_29 || (Q) == P0_30 || (Q) == P2_09) // USB pins
#endif #endif
bool getValidPinMode(const pin_t pin) { bool GET_PINMODE(const pin_t pin) {
if (!LPC176x::pin_is_valid(pin) || LPC176x::pin_adc_enabled(pin)) // Invalid pin or active analog pin if (!LPC176x::pin_is_valid(pin) || LPC176x::pin_adc_enabled(pin)) // Invalid pin or active analog pin
return false; return false;
return LPC176x::gpio_direction(pin); return LPC176x::gpio_direction(pin);
} }
#define getPinIsDigitalByIndex(x) ((bool) pin_array[x].is_digital) #define GET_ARRAY_IS_DIGITAL(x) ((bool) pin_array[x].is_digital)
void printPinPort(const pin_t) {} void print_port(const pin_t) {}
void printPinPWM(const pin_t) {} void pwm_details(const pin_t) {}
bool pwm_status(const pin_t) { return false; } bool pwm_status(const pin_t) { return false; }
+2 -3
View File
@@ -28,13 +28,12 @@
// spiBeginTransaction. // spiBeginTransaction.
#endif #endif
// Onboard SD /** onboard SD card */
//#define SD_SCK_PIN P0_07 //#define SD_SCK_PIN P0_07
//#define SD_MISO_PIN P0_08 //#define SD_MISO_PIN P0_08
//#define SD_MOSI_PIN P0_09 //#define SD_MOSI_PIN P0_09
//#define SD_SS_PIN P0_06 //#define SD_SS_PIN P0_06
/** external */
// External SD
#ifndef SD_SCK_PIN #ifndef SD_SCK_PIN
#define SD_SCK_PIN P0_15 #define SD_SCK_PIN P0_15
#endif #endif
@@ -132,7 +132,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 uint8_t SPI_speed = 0;
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) { static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
#if U8G_SPI_USE_MODE_3 #if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin); swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
#else #else
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin); swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
@@ -160,7 +160,7 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
break; break;
case U8G_COM_MSG_CHIP_SELECT: case U8G_COM_MSG_CHIP_SELECT:
#if U8G_SPI_USE_MODE_3 // LCD SPI is running mode 3 while SD card is running mode 0 #if ANY(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 if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active // 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_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
@@ -13,9 +13,9 @@ if pioutil.is_pio_build():
target_drive = "REARM" target_drive = "REARM"
import platform import platform
current_OS = platform.system()
env = pioutil.env current_OS = platform.system()
Import("env")
def print_error(e): def print_error(e):
print('\nUnable to find destination disk (%s)\n' \ print('\nUnable to find destination disk (%s)\n' \
+4 -4
View File
@@ -87,11 +87,11 @@ extern MSerialT serial_stream_3;
#endif #endif
#endif #endif
#ifdef MMU_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if WITHIN(MMU_SERIAL_PORT, 0, 3) #if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU_SERIAL MSERIAL(MMU_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU_SERIAL_PORT must be from 0 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3. Please update your configuration."
#endif #endif
#endif #endif
+6 -6
View File
@@ -27,9 +27,9 @@
int8_t ADC_pin_mode(pin_t pin) { return -1; } int8_t ADC_pin_mode(pin_t pin) { return -1; }
int8_t get_pin_mode(const pin_t pin) { return isValidPin(pin) ? 0 : -1; } int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? 0 : -1; }
bool getValidPinMode(const pin_t pin) { bool GET_PINMODE(const pin_t pin) {
const int8_t pin_mode = get_pin_mode(pin); const int8_t pin_mode = get_pin_mode(pin);
if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin
return false; return false;
@@ -37,12 +37,12 @@ bool getValidPinMode(const pin_t pin) {
return (Gpio::getMode(pin) != 0); // Input/output state return (Gpio::getMode(pin) != 0); // Input/output state
} }
bool getPinIsDigitalByIndex(const pin_t pin) { bool GET_ARRAY_IS_DIGITAL(const pin_t pin) {
return !isAnalogPin(pin) || get_pin_mode(pin) != ADC_pin_mode(pin); return !IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin);
} }
void printPinPort(const pin_t) {} void print_port(const pin_t) {}
void printPinPWM(const pin_t) {} void pwm_details(const pin_t) {}
bool pwm_status(const pin_t) { return false; } bool pwm_status(const pin_t) { return false; }
#endif #endif
+9 -9
View File
@@ -30,19 +30,19 @@
*/ */
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0 ? 1 : 0) #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0)
#define digitalRead_mod(p) digitalRead(p) #define digitalRead_mod(p) digitalRead(p)
#define getPinByIndex(p) pin_array[p].pin #define GET_ARRAY_PIN(p) pin_array[p].pin
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #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 printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
// Active ADC function/mode/code values for PINSEL registers // Active ADC function/mode/code values for PINSEL registers
int8_t ADC_pin_mode(pin_t pin); int8_t ADC_pin_mode(pin_t pin);
int8_t get_pin_mode(const pin_t pin); int8_t get_pin_mode(const pin_t pin);
bool getValidPinMode(const pin_t pin); bool GET_PINMODE(const pin_t pin);
bool getPinIsDigitalByIndex(const pin_t pin); bool GET_ARRAY_IS_DIGITAL(const pin_t pin);
void printPinPort(const pin_t); void print_port(const pin_t);
void printPinPWM(const pin_t); void pwm_details(const pin_t);
bool pwm_status(const pin_t); bool pwm_status(const pin_t);
@@ -131,7 +131,7 @@ static uint8_t swSpiInit(const uint8_t spi_speed, const uint8_t clk_pin, const u
} }
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) { static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
#if U8G_SPI_USE_MODE_3 #if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin); swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
#else #else
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin); swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
@@ -159,7 +159,7 @@ uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt
break; break;
case U8G_COM_MSG_CHIP_SELECT: case U8G_COM_MSG_CHIP_SELECT:
#if U8G_SPI_USE_MODE_3 // LCD SPI is running mode 3 while SD card is running mode 0 #if ANY(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 if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active // 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_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
+6 -6
View File
@@ -69,13 +69,13 @@ extern DefaultSerial3 MSerial1;
#endif #endif
#endif #endif
#ifdef MMU_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if WITHIN(MMU_SERIAL_PORT, 0, 1) #if WITHIN(MMU2_SERIAL_PORT, 0, 1)
#define MMU_SERIAL MSERIAL(SERIAL_PORT) #define MMU2_SERIAL MSERIAL(SERIAL_PORT)
#elif MMU_SERIAL_PORT == -1 #elif MMU2_SERIAL_PORT == -1
#define MMU_SERIAL MSerialUSB #define MMU2_SERIAL MSerialUSB
#else #else
#error "MMU_SERIAL_PORT must be -1 (Native USB only)." #error "MMU2_SERIAL_PORT must be -1 (Native USB only)."
#endif #endif
#endif #endif
+1 -9
View File
@@ -83,7 +83,6 @@
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN)) #define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN)) #define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN)) #define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN))
#define MATCH_CALIBRATION_EILINE(P) TERN0(USE_CALIBRATION, DEFER4(MATCH_EILINE)(P, CALIBRATION_PIN))
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \ #define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \
&& !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \ && !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \
@@ -100,8 +99,7 @@
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \ && !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \ && !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \ && !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \
&& !MATCH_Z_MIN_PROBE_EILINE(P) \ && !MATCH_Z_MIN_PROBE_EILINE(P) )
&& !MATCH_CALIBRATION_EILINE(P) )
// One ISR for all EXT-Interrupts // One ISR for all EXT-Interrupts
void endstop_ISR() { endstops.update(); } void endstop_ISR() { endstops.update(); }
@@ -210,12 +208,6 @@ void setup_endstop_interrupts() {
#endif #endif
_ATTACH(Z_MIN_PROBE_PIN); _ATTACH(Z_MIN_PROBE_PIN);
#endif #endif
#if USE_CALIBRATION
#if !AVAILABLE_EILINE(CALIBRATION_PIN)
#error "CALIBRATION_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
_ATTACH(CALIBRATION_PIN);
#endif
#if USE_I_MAX #if USE_I_MAX
#if !AVAILABLE_EILINE(I_MAX_PIN) #if !AVAILABLE_EILINE(I_MAX_PIN)
#error "I_MAX_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #error "I_MAX_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
+1 -1
View File
@@ -152,7 +152,7 @@
: ((P) == 14) ? ADC_INPUTCTRL_MUXPOS_PIN14 \ : ((P) == 14) ? ADC_INPUTCTRL_MUXPOS_PIN14 \
: ADC_INPUTCTRL_MUXPOS_PIN15) : ADC_INPUTCTRL_MUXPOS_PIN15)
#define digitalPinToAnalogIndex(P) (WITHIN(P, 67, 74) ? (P) - 67 : WITHIN(P, 54, 61) ? 8 + (P) - 54 : WITHIN(P, 12, 13) ? 16 + (P) - 12 : P == 9 ? 18 : -1) #define digitalPinToAnalogInput(P) (WITHIN(P, 67, 74) ? (P) - 67 : WITHIN(P, 54, 61) ? 8 + (P) - 54 : WITHIN(P, 12, 13) ? 16 + (P) - 12 : P == 9 ? 18 : -1)
/** /**
* pins * pins
+10 -9
View File
@@ -30,13 +30,14 @@
#define digitalRead_mod(p) extDigitalRead(p) #define digitalRead_mod(p) extDigitalRead(p)
#define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0) #define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0)
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #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 printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
#define getPinByIndex(p) pin_array[p].pin #define GET_ARRAY_PIN(p) pin_array[p].pin
#define getPinIsDigitalByIndex(p) pin_array[p].is_digital #define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
#define isValidPin(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL) #define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL)
#define isAnalogPin(P) (digitalPinToAnalogIndex(P)!=-1) #define DIGITAL_PIN_TO_ANALOG_PIN(p) digitalPinToAnalogInput(p)
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P)!=-1)
#define pwm_status(pin) digitalPinHasPWM(pin) #define pwm_status(pin) digitalPinHasPWM(pin)
#define MULTI_NAME_PAD 27 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 27 // space needed to be pretty if not first name assigned to a pin
@@ -44,13 +45,13 @@
// uses pin index // uses pin index
#define M43_NEVER_TOUCH(Q) ((Q) >= 75) #define M43_NEVER_TOUCH(Q) ((Q) >= 75)
bool getValidPinMode(int8_t pin) { // 1: output, 0: input bool GET_PINMODE(int8_t pin) { // 1: output, 0: input
const EPortType samdport = g_APinDescription[pin].ulPort; const EPortType samdport = g_APinDescription[pin].ulPort;
const uint32_t samdpin = g_APinDescription[pin].ulPin; const uint32_t samdpin = g_APinDescription[pin].ulPin;
return PORT->Group[samdport].DIR.reg & MASK(samdpin) || (PORT->Group[samdport].PINCFG[samdpin].reg & (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN)) == PORT_PINCFG_PULLEN; return PORT->Group[samdport].DIR.reg & MASK(samdpin) || (PORT->Group[samdport].PINCFG[samdpin].reg & (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN)) == PORT_PINCFG_PULLEN;
} }
void printPinPWM(int32_t pin) { void pwm_details(int32_t pin) {
if (pwm_status(pin)) { if (pwm_status(pin)) {
//uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative; //uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative;
//SERIAL_ECHOPGM("PWM = ", duty); //SERIAL_ECHOPGM("PWM = ", duty);
+6 -16
View File
@@ -69,23 +69,13 @@
#endif #endif
#endif #endif
#ifdef SERIAL_PORT_3 #ifdef MMU2_SERIAL_PORT
#if SERIAL_PORT_3 == -1 #if MMU2_SERIAL_PORT == -1
#define MYSERIAL3 MSerial0 #define MMU2_SERIAL MSerial0
#elif WITHIN(SERIAL_PORT_3, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "SERIAL_PORT_3 must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif
#ifdef MMU_SERIAL_PORT
#if MMU_SERIAL_PORT == -1
#define MMU_SERIAL MSerial0
#elif WITHIN(MMU_SERIAL_PORT, 0, 3)
#define MMU_SERIAL MSERIAL(MMU_SERIAL_PORT)
#else
#error "MMU_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
+1 -9
View File
@@ -82,7 +82,6 @@
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN)) #define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN)) #define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN)) #define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN))
#define MATCH_CALIBRATION_EILINE(P) TERN0(USE_CALIBRATION, DEFER4(MATCH_EILINE)(P, CALIBRATION_PIN))
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \ #define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \
&& !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \ && !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \
@@ -99,8 +98,7 @@
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \ && !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \ && !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \ && !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \
&& !MATCH_Z_MIN_PROBE_EILINE(P) \ && !MATCH_Z_MIN_PROBE_EILINE(P) )
&& !MATCH_CALIBRATION_EILINE(P) )
// One ISR for all EXT-Interrupts // One ISR for all EXT-Interrupts
void endstop_ISR() { endstops.update(); } void endstop_ISR() { endstops.update(); }
@@ -185,12 +183,6 @@ void setup_endstop_interrupts() {
#endif #endif
_ATTACH(Z_MIN_PROBE_PIN); _ATTACH(Z_MIN_PROBE_PIN);
#endif #endif
#if USE_CALIBRATION
#if !AVAILABLE_EILINE(CALIBRATION_PIN)
#error "CALIBRATION_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
_ATTACH(CALIBRATION_PIN);
#endif
#if USE_I_MAX #if USE_I_MAX
#if !AVAILABLE_EILINE(I_MAX_PIN) #if !AVAILABLE_EILINE(I_MAX_PIN)
#error "I_MAX_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #error "I_MAX_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
+1 -1
View File
@@ -174,7 +174,7 @@
: (P == 17) ? PIN_TO_SAMD_PIN(13) \ : (P == 17) ? PIN_TO_SAMD_PIN(13) \
: PIN_TO_SAMD_PIN(9)) : PIN_TO_SAMD_PIN(9))
#define digitalPinToAnalogIndex(P) (WITHIN(P, 67, 74) ? (P) - 67 : WITHIN(P, 54, 61) ? 8 + (P) - 54 : WITHIN(P, 12, 13) ? 16 + (P) - 12 : P == 9 ? 18 : -1) #define digitalPinToAnalogInput(P) (WITHIN(P, 67, 74) ? (P) - 67 : WITHIN(P, 54, 61) ? 8 + (P) - 54 : WITHIN(P, 12, 13) ? 16 + (P) - 12 : P == 9 ? 18 : -1)
/** /**
* pins * pins
+10 -9
View File
@@ -29,13 +29,14 @@
#define digitalRead_mod(p) extDigitalRead(p) #define digitalRead_mod(p) extDigitalRead(p)
#define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0) #define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0)
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #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 printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
#define getPinByIndex(p) pin_array[p].pin #define GET_ARRAY_PIN(p) pin_array[p].pin
#define getPinIsDigitalByIndex(p) pin_array[p].is_digital #define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
#define isValidPin(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL)) #define VALID_PIN(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
#define isAnalogPin(P) (digitalPinToAnalogIndex(P)!=-1) #define DIGITAL_PIN_TO_ANALOG_PIN(p) digitalPinToAnalogInput(p)
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P)!=-1)
#define pwm_status(pin) digitalPinHasPWM(pin) #define pwm_status(pin) digitalPinHasPWM(pin)
#define MULTI_NAME_PAD 27 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 27 // space needed to be pretty if not first name assigned to a pin
@@ -43,13 +44,13 @@
// uses pin index // uses pin index
#define M43_NEVER_TOUCH(Q) ((Q) >= 75) #define M43_NEVER_TOUCH(Q) ((Q) >= 75)
bool getValidPinMode(int8_t pin) { // 1: output, 0: input bool GET_PINMODE(int8_t pin) { // 1: output, 0: input
const EPortType samdport = g_APinDescription[pin].ulPort; const EPortType samdport = g_APinDescription[pin].ulPort;
const uint32_t samdpin = g_APinDescription[pin].ulPin; const uint32_t samdpin = g_APinDescription[pin].ulPin;
return PORT->Group[samdport].DIR.reg & MASK(samdpin) || (PORT->Group[samdport].PINCFG[samdpin].reg & (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN)) == PORT_PINCFG_PULLEN; return PORT->Group[samdport].DIR.reg & MASK(samdpin) || (PORT->Group[samdport].PINCFG[samdpin].reg & (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN)) == PORT_PINCFG_PULLEN;
} }
void printPinPWM(int32_t pin) { void pwm_details(int32_t pin) {
if (pwm_status(pin)) { if (pwm_status(pin)) {
//uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative; //uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative;
//SERIAL_ECHOPGM("PWM = ", duty); //SERIAL_ECHOPGM("PWM = ", duty);
+9 -17
View File
@@ -90,15 +90,15 @@
#endif #endif
#endif #endif
#ifdef MMU_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if WITHIN(MMU_SERIAL_PORT, 1, 9) #if WITHIN(MMU2_SERIAL_PORT, 1, 9)
#define MMU_SERIAL MSERIAL(MMU_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#elif !defined(USBCON) #elif !defined(USBCON)
#error "MMU_SERIAL_PORT must be from 1 to 9." #error "MMU2_SERIAL_PORT must be from 1 to 9."
#elif MMU_SERIAL_PORT == -1 #elif MMU2_SERIAL_PORT == -1
#define MMU_SERIAL MSerialUSB #define MMU2_SERIAL MSerialUSB
#else #else
#error "MMU_SERIAL_PORT must be from 1 to 9, or -1 for Native USB." #error "MMU2_SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
#endif #endif
#endif #endif
@@ -112,24 +112,16 @@
#else #else
#error "LCD_SERIAL_PORT must be from 1 to 9, or -1 for Native USB." #error "LCD_SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
#endif #endif
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #if HAS_DGUS_LCD
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
#endif #endif
#endif #endif
#ifdef RS485_SERIAL_PORT
#if WITHIN(RS485_SERIAL_PORT, 1, 9)
#define RS485_SERIAL MSERIAL(RS485_SERIAL_PORT)
#else
#error "RS485_SERIAL_PORT must be from 1 to 9."
#endif
#endif
/** /**
* TODO: review this to return 1 for pins that are not analog input * TODO: review this to return 1 for pins that are not analog input
*/ */
#ifndef analogInputToDigitalPin #ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) pin_t(p) #define analogInputToDigitalPin(p) (p)
#endif #endif
// //
+1 -1
View File
@@ -37,7 +37,7 @@ static SPISettings spiConfig;
// Public functions // Public functions
// ------------------------ // ------------------------
#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI) #if ENABLED(SOFTWARE_SPI)
// ------------------------ // ------------------------
// Software SPI // Software SPI
+4 -4
View File
@@ -126,7 +126,7 @@
void serialEvent2() __attribute__((weak)); void serialEvent2() __attribute__((weak));
#endif #endif
#ifdef USING_HW_SERIAL3 #ifdef USING_HW_SERIAL3
HAL_HardwareSerial HSerial3(USART3); HAL_HardwareSerial Serial3(USART3);
void serialEvent3() __attribute__((weak)); void serialEvent3() __attribute__((weak));
#endif #endif
#ifdef USING_HW_SERIAL4 #ifdef USING_HW_SERIAL4
@@ -147,11 +147,11 @@
#endif #endif
#ifdef USING_HW_SERIAL6 #ifdef USING_HW_SERIAL6
#ifdef USART6 #ifdef USART6
HAL_HardwareSerial HSerial6(USART6); HAL_HardwareSerial HSerial5(USART6);
#else #else
HAL_HardwareSerial HSerial6(UART6); HAL_HardwareSerial HSerial5(UART6);
#endif #endif
void serialEvent6() __attribute__((weak)); void serialEvent5() __attribute__((weak));
#endif #endif
// Constructors //////////////////////////////////////////////////////////////// // Constructors ////////////////////////////////////////////////////////////////
-3
View File
@@ -37,9 +37,6 @@
#ifndef USART5 #ifndef USART5
#define USART5 UART5 #define USART5 UART5
#endif #endif
#ifndef USART6
#define USART6 UART6
#endif
#ifndef USART7 #ifndef USART7
#define USART7 UART7 #define USART7 UART7
#endif #endif
-1
View File
@@ -53,7 +53,6 @@
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); } inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
void _rx_complete_irq(serial_t *obj); void _rx_complete_irq(serial_t *obj);
FORCE_INLINE static uint8_t buffer_overruns() { return 0; } // Not implemented. Void to avoid platform-dependent code.
protected: protected:
usart_rx_callback_t _rx_callback; usart_rx_callback_t _rx_callback;
@@ -1,136 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm / Ryan Power
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifdef HAL_STM32
#include "../../../inc/MarlinConfig.h"
#if ALL(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
#include <U8glib-HAL.h>
#include "../../shared/HAL_SPI.h"
#define nop asm volatile ("\tnop\n")
static inline uint8_t swSpiTransfer_mode_0(uint8_t b) {
for (uint8_t i = 0; i < 8; ++i) {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
WRITE(DOGLCD_SCK, HIGH);
WRITE(DOGLCD_MOSI, state);
b <<= 1;
WRITE(DOGLCD_SCK, LOW);
}
return b;
}
static inline uint8_t swSpiTransfer_mode_3(uint8_t b) {
for (uint8_t i = 0; i < 8; ++i) {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
WRITE(DOGLCD_SCK, LOW);
WRITE(DOGLCD_MOSI, state);
b <<= 1;
WRITE(DOGLCD_SCK, HIGH);
}
return b;
}
static void u8g_sw_spi_shift_out(uint8_t val) {
#if U8G_SPI_USE_MODE_3
swSpiTransfer_mode_3(val);
#else
swSpiTransfer_mode_0(val);
#endif
}
static void swSpiInit() {
#if PIN_EXISTS(LCD_RESET)
SET_OUTPUT(LCD_RESET_PIN);
#endif
SET_OUTPUT(DOGLCD_A0);
OUT_WRITE(DOGLCD_SCK, LOW);
OUT_WRITE(DOGLCD_MOSI, LOW);
OUT_WRITE(DOGLCD_CS, HIGH);
}
uint8_t u8g_com_HAL_STM32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
switch (msg) {
case U8G_COM_MSG_INIT:
swSpiInit();
break;
case U8G_COM_MSG_STOP:
break;
case U8G_COM_MSG_RESET:
#if PIN_EXISTS(LCD_RESET)
WRITE(LCD_RESET_PIN, arg_val);
#endif
break;
case U8G_COM_MSG_CHIP_SELECT:
#if U8G_SPI_USE_MODE_3 // This 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
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
WRITE(DOGLCD_CS, LOW);
nop; // hold SCK high for a few ns
nop;
}
else {
WRITE(DOGLCD_CS, HIGH);
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
}
#else
WRITE(DOGLCD_CS, !arg_val);
#endif
break;
case U8G_COM_MSG_WRITE_BYTE:
u8g_sw_spi_shift_out(arg_val);
break;
case U8G_COM_MSG_WRITE_SEQ: {
uint8_t *ptr = (uint8_t *)arg_ptr;
while (arg_val > 0) {
u8g_sw_spi_shift_out(*ptr++);
arg_val--;
}
} break;
case U8G_COM_MSG_WRITE_SEQ_P: {
uint8_t *ptr = (uint8_t *)arg_ptr;
while (arg_val > 0) {
u8g_sw_spi_shift_out(u8g_pgm_read(ptr));
ptr++;
arg_val--;
}
} break;
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
WRITE(DOGLCD_A0, arg_val);
break;
}
return 1;
}
#endif // HAS_MARLINUI_U8GLIB && FORCE_SOFT_SPI
#endif // HAL_STM32
@@ -45,7 +45,6 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN)); TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN)); TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN)); TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN)); TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN)); TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
@@ -30,3 +30,6 @@
#undef F_CPU #undef F_CPU
#define F_CPU BOARD_F_CPU #define F_CPU BOARD_F_CPU
#endif #endif
// The Sensitive Pins array is not optimizable
#define RUNTIME_ONLY_ANALOG_TO_DIGITAL
+2 -3
View File
@@ -58,9 +58,8 @@
* Check for common serial pin conflicts * Check for common serial pin conflicts
*/ */
#define _CHECK_SERIAL_PIN(N) (( \ #define _CHECK_SERIAL_PIN(N) (( \
BTN_EN1 == N || BTN_EN2 == N ||DOGLCD_CS == N || HEATER_BED_PIN == N || FAN0_PIN == N || \ BTN_EN1 == N || DOGLCD_CS == N || HEATER_BED_PIN == N || FAN0_PIN == N || \
SDIO_D2_PIN == N || SDIO_D3_PIN == N || SDIO_CK_PIN == N || SDIO_CMD_PIN == N || \ SDIO_D2_PIN == N || SDIO_D3_PIN == N || SDIO_CK_PIN == N || SDIO_CMD_PIN == N \
Y_STEP_PIN == N || Y_ENABLE_PIN == N || E0_ENABLE_PIN == N || POWER_LOSS_PIN == N \
)) ))
#define CHECK_SERIAL_PIN(T,N) defined(UART##N##_##T##_PIN) && _CHECK_SERIAL_PIN(UART##N##_##T##_PIN) #define CHECK_SERIAL_PIN(T,N) defined(UART##N##_##T##_PIN) && _CHECK_SERIAL_PIN(UART##N##_##T##_PIN)
#if SERIAL_IN_USE(1) #if SERIAL_IN_USE(1)
+13 -13
View File
@@ -115,16 +115,16 @@ const XrefInfo pin_xref[] PROGMEM = {
#define NUM_ANALOG_LAST ((NUM_ANALOG_FIRST) + (NUM_ANALOG_INPUTS) - 1) #define NUM_ANALOG_LAST ((NUM_ANALOG_FIRST) + (NUM_ANALOG_INPUTS) - 1)
#endif #endif
#define NUMBER_PINS_TOTAL ((NUM_DIGITAL_PINS) + TERN0(HAS_HIGH_ANALOG_PINS, NUM_ANALOG_INPUTS)) #define NUMBER_PINS_TOTAL ((NUM_DIGITAL_PINS) + TERN0(HAS_HIGH_ANALOG_PINS, NUM_ANALOG_INPUTS))
#define isValidPin(P) (WITHIN(P, 0, (NUM_DIGITAL_PINS) - 1) || TERN0(HAS_HIGH_ANALOG_PINS, WITHIN(P, NUM_ANALOG_FIRST, NUM_ANALOG_LAST))) #define VALID_PIN(P) (WITHIN(P, 0, (NUM_DIGITAL_PINS) - 1) || TERN0(HAS_HIGH_ANALOG_PINS, WITHIN(P, NUM_ANALOG_FIRST, NUM_ANALOG_LAST)))
#define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads #define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads
#define printPinNumber(Q) #define PRINT_PIN(Q)
#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
#define digitalPinToAnalogIndex(ANUM) -1 // will report analog pin number in the print port routine #define DIGITAL_PIN_TO_ANALOG_PIN(ANUM) -1 // will report analog pin number in the print port routine
// x is a variable used to search pin_array // x is a variable used to search pin_array
#define getPinIsDigitalByIndex(x) ((bool) pin_array[x].is_digital) #define GET_ARRAY_IS_DIGITAL(x) ((bool) pin_array[x].is_digital)
#define getPinByIndex(x) ((pin_t) pin_array[x].pin) #define GET_ARRAY_PIN(x) ((pin_t) pin_array[x].pin)
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #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 MULTI_NAME_PAD 33 // space needed to be pretty if not first name assigned to a pin #define MULTI_NAME_PAD 33 // space needed to be pretty if not first name assigned to a pin
// //
@@ -164,7 +164,7 @@ uint8_t get_pin_mode(const pin_t Ard_num) {
} }
} }
bool getValidPinMode(const pin_t Ard_num) { bool GET_PINMODE(const pin_t Ard_num) {
const uint8_t pin_mode = get_pin_mode(Ard_num); const uint8_t pin_mode = get_pin_mode(Ard_num);
return pin_mode == MODE_PIN_OUTPUT || pin_mode == MODE_PIN_ALT; // assume all alt definitions are PWM return pin_mode == MODE_PIN_OUTPUT || pin_mode == MODE_PIN_ALT; // assume all alt definitions are PWM
} }
@@ -173,11 +173,11 @@ int8_t digital_pin_to_analog_pin(const pin_t Ard_num) {
if (WITHIN(Ard_num, NUM_ANALOG_FIRST, NUM_ANALOG_LAST)) if (WITHIN(Ard_num, NUM_ANALOG_FIRST, NUM_ANALOG_LAST))
return Ard_num - NUM_ANALOG_FIRST; return Ard_num - NUM_ANALOG_FIRST;
const int8_t ind = digitalPinToAnalogIndex(Ard_num); const uint32_t ind = digitalPinToAnalogInput(Ard_num);
return (ind < NUM_ANALOG_INPUTS) ? ind : -1; return (ind < NUM_ANALOG_INPUTS) ? ind : -1;
} }
bool isAnalogPin(const pin_t Ard_num) { bool IS_ANALOG(const pin_t Ard_num) {
return get_pin_mode(Ard_num) == MODE_PIN_ANALOG; return get_pin_mode(Ard_num) == MODE_PIN_ANALOG;
} }
@@ -186,7 +186,7 @@ bool is_digital(const pin_t Ard_num) {
return pin_mode == MODE_PIN_INPUT || pin_mode == MODE_PIN_OUTPUT; return pin_mode == MODE_PIN_INPUT || pin_mode == MODE_PIN_OUTPUT;
} }
void printPinPort(const pin_t Ard_num) { void print_port(const pin_t Ard_num) {
char buffer[16]; char buffer[16];
pin_t Index; pin_t Index;
for (Index = 0; Index < NUMBER_PINS_TOTAL; Index++) for (Index = 0; Index < NUMBER_PINS_TOTAL; Index++)
@@ -226,7 +226,7 @@ bool pwm_status(const pin_t Ard_num) {
return get_pin_mode(Ard_num) == MODE_PIN_ALT; return get_pin_mode(Ard_num) == MODE_PIN_ALT;
} }
void printPinPWM(const pin_t Ard_num) { void pwm_details(const pin_t Ard_num) {
#ifndef STM32F1xx #ifndef STM32F1xx
if (pwm_status(Ard_num)) { if (pwm_status(Ard_num)) {
uint32_t alt_all = 0; uint32_t alt_all = 0;
@@ -285,4 +285,4 @@ void printPinPWM(const pin_t Ard_num) {
#else #else
// TODO: F1 doesn't support changing pins function, so we need to check the function of the PIN and if it's enabled // TODO: F1 doesn't support changing pins function, so we need to check the function of the PIN and if it's enabled
#endif #endif
} // printPinPWM } // pwm_details
+1 -1
View File
@@ -238,7 +238,7 @@ void HAL_SD_MspInit(SD_HandleTypeDef *hsd) {
hdma_sdio.Init.MemInc = DMA_MINC_ENABLE; hdma_sdio.Init.MemInc = DMA_MINC_ENABLE;
hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_sdio.Init.Priority = DMA_PRIORITY_MEDIUM; hdma_sdio.Init.Priority = DMA_PRIORITY_LOW;
__HAL_LINKDMA(&hsd, hdmarx, hdma_sdio); __HAL_LINKDMA(&hsd, hdmarx, hdma_sdio);
__HAL_LINKDMA(&hsd, hdmatx, hdma_sdio); __HAL_LINKDMA(&hsd, hdmatx, hdma_sdio);
+37 -44
View File
@@ -37,46 +37,39 @@ LCD_CONTROLLER_TypeDef *TFT_FSMC::LCD;
void TFT_FSMC::init() { void TFT_FSMC::init() {
uint32_t controllerAddress; uint32_t controllerAddress;
FMC_OR_FSMC(NORSRAM_TimingTypeDef) timing, extTiming; FSMC_NORSRAM_TimingTypeDef timing, extTiming;
uint32_t nsBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), pinMap_FSMC_CS); uint32_t nsBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), pinMap_FSMC_CS);
// Perform the SRAM1 memory initialization sequence // Perform the SRAM1 memory initialization sequence
SRAMx.Instance = FMC_OR_FSMC(NORSRAM_DEVICE); SRAMx.Instance = FSMC_NORSRAM_DEVICE;
SRAMx.Extended = FMC_OR_FSMC(NORSRAM_EXTENDED_DEVICE); SRAMx.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
// SRAMx.Init // SRAMx.Init
SRAMx.Init.NSBank = nsBank; SRAMx.Init.NSBank = nsBank;
SRAMx.Init.DataAddressMux = FMC_OR_FSMC(DATA_ADDRESS_MUX_DISABLE); SRAMx.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
SRAMx.Init.MemoryType = FMC_OR_FSMC(MEMORY_TYPE_SRAM); SRAMx.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
#ifdef STM32F446xx
SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FMC_8BIT, FMC_NORSRAM_MEM_BUS_WIDTH_8, FMC_NORSRAM_MEM_BUS_WIDTH_16);
#else
SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FSMC_8BIT, FSMC_NORSRAM_MEM_BUS_WIDTH_8, FSMC_NORSRAM_MEM_BUS_WIDTH_16); SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FSMC_8BIT, FSMC_NORSRAM_MEM_BUS_WIDTH_8, FSMC_NORSRAM_MEM_BUS_WIDTH_16);
SRAMx.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE;
SRAMx.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
SRAMx.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
SRAMx.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
SRAMx.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
SRAMx.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
SRAMx.Init.ExtendedMode = FSMC_EXTENDED_MODE_ENABLE;
SRAMx.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
SRAMx.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE;
#ifdef STM32F4xx
SRAMx.Init.PageSize = FSMC_PAGE_SIZE_NONE;
#endif #endif
SRAMx.Init.BurstAccessMode = FMC_OR_FSMC(BURST_ACCESS_MODE_DISABLE);
SRAMx.Init.WaitSignalPolarity = FMC_OR_FSMC(WAIT_SIGNAL_POLARITY_LOW);
SRAMx.Init.WrapMode = FMC_OR_FSMC(WRAP_MODE_DISABLE);
SRAMx.Init.WaitSignalActive = FMC_OR_FSMC(WAIT_TIMING_BEFORE_WS);
SRAMx.Init.WriteOperation = FMC_OR_FSMC(WRITE_OPERATION_ENABLE);
SRAMx.Init.WaitSignal = FMC_OR_FSMC(WAIT_SIGNAL_DISABLE);
SRAMx.Init.ExtendedMode = FMC_OR_FSMC(EXTENDED_MODE_ENABLE);
SRAMx.Init.AsynchronousWait = FMC_OR_FSMC(ASYNCHRONOUS_WAIT_DISABLE);
SRAMx.Init.WriteBurst = FMC_OR_FSMC(WRITE_BURST_DISABLE);
#if defined(STM32F446xx) || defined(STM32F4xx)
SRAMx.Init.PageSize = FMC_OR_FSMC(PAGE_SIZE_NONE);
#endif
// Read Timing - relatively slow to ensure ID information is correctly read from TFT controller // Read Timing - relatively slow to ensure ID information is correctly read from TFT controller
// Can be decreased from 15-15-24 to 4-4-8 with risk of stability loss // Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss
timing.AddressSetupTime = 15; timing.AddressSetupTime = 15;
timing.AddressHoldTime = 15; timing.AddressHoldTime = 15;
timing.DataSetupTime = 24; timing.DataSetupTime = 24;
timing.BusTurnAroundDuration = 0; timing.BusTurnAroundDuration = 0;
timing.CLKDivision = 16; timing.CLKDivision = 16;
timing.DataLatency = 17; timing.DataLatency = 17;
timing.AccessMode = FMC_OR_FSMC(ACCESS_MODE_A); timing.AccessMode = FSMC_ACCESS_MODE_A;
// Write Timing // Write Timing
// Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss // Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss
extTiming.AddressSetupTime = 8; extTiming.AddressSetupTime = 8;
@@ -85,13 +78,9 @@ void TFT_FSMC::init() {
extTiming.BusTurnAroundDuration = 0; extTiming.BusTurnAroundDuration = 0;
extTiming.CLKDivision = 16; extTiming.CLKDivision = 16;
extTiming.DataLatency = 17; extTiming.DataLatency = 17;
extTiming.AccessMode = FMC_OR_FSMC(ACCESS_MODE_A); extTiming.AccessMode = FSMC_ACCESS_MODE_A;
#ifdef STM32F446xx
__HAL_RCC_FMC_CLK_ENABLE();
#else
__HAL_RCC_FSMC_CLK_ENABLE(); __HAL_RCC_FSMC_CLK_ENABLE();
#endif
for (uint16_t i = 0; pinMap_FSMC[i].pin != NC; i++) for (uint16_t i = 0; pinMap_FSMC[i].pin != NC; i++)
pinmap_pinout(pinMap_FSMC[i].pin, pinMap_FSMC); pinmap_pinout(pinMap_FSMC[i].pin, pinMap_FSMC);
@@ -101,9 +90,9 @@ void TFT_FSMC::init() {
controllerAddress = FSMC_BANK1_1; controllerAddress = FSMC_BANK1_1;
#ifdef PF0 #ifdef PF0
switch (nsBank) { switch (nsBank) {
case FMC_OR_FSMC(NORSRAM_BANK2): controllerAddress = FSMC_BANK1_2; break; case FSMC_NORSRAM_BANK2: controllerAddress = FSMC_BANK1_2 ; break;
case FMC_OR_FSMC(NORSRAM_BANK3): controllerAddress = FSMC_BANK1_3; break; case FSMC_NORSRAM_BANK3: controllerAddress = FSMC_BANK1_3 ; break;
case FMC_OR_FSMC(NORSRAM_BANK4): controllerAddress = FSMC_BANK1_4; break; case FSMC_NORSRAM_BANK4: controllerAddress = FSMC_BANK1_4 ; break;
} }
#endif #endif
@@ -111,11 +100,11 @@ void TFT_FSMC::init() {
HAL_SRAM_Init(&SRAMx, &timing, &extTiming); HAL_SRAM_Init(&SRAMx, &timing, &extTiming);
__HAL_RCC_DMA2_CLK_ENABLE();
#ifdef STM32F1xx #ifdef STM32F1xx
DMAtx.Instance = DMA2_Channel1; __HAL_RCC_DMA1_CLK_ENABLE();
DMAtx.Instance = DMA1_Channel1;
#elif defined(STM32F4xx) #elif defined(STM32F4xx)
__HAL_RCC_DMA2_CLK_ENABLE();
DMAtx.Instance = DMA2_Stream0; DMAtx.Instance = DMA2_Stream0;
DMAtx.Init.Channel = DMA_CHANNEL_0; DMAtx.Init.Channel = DMA_CHANNEL_0;
DMAtx.Init.FIFOMode = DMA_FIFOMODE_ENABLE; DMAtx.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
@@ -135,20 +124,25 @@ void TFT_FSMC::init() {
} }
uint32_t TFT_FSMC::getID() { uint32_t TFT_FSMC::getID() {
uint32_t id;
writeReg(0); writeReg(0);
uint32_t id = LCD->RAM; id = LCD->RAM;
if (id == 0) id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) id = readID(LCD_READ_ID4); if (id == 0)
id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = readID(LCD_READ_ID4);
return id; return id;
} }
uint32_t TFT_FSMC::readID(tft_data_t inReg) { uint32_t TFT_FSMC::readID(const tft_data_t inReg) {
uint32_t id;
writeReg(inReg); writeReg(inReg);
uint32_t id = LCD->RAM; // dummy read id = LCD->RAM; // dummy read
id = inReg << 24; id = inReg << 24;
id |= (LCD->RAM & 0x00FF) << 16; id |= (LCD->RAM & 0x00FF) << 16;
id |= (LCD->RAM & 0x00FF) << 8; id |= (LCD->RAM & 0x00FF) << 8;
id |= (LCD->RAM & 0x00FF); id |= LCD->RAM & 0x00FF;
return id; return id;
} }
@@ -161,9 +155,7 @@ bool TFT_FSMC::isBusy() {
#define __IS_DMA_CONFIGURED(__HANDLE__) ((__HANDLE__)->Instance->PAR != 0) #define __IS_DMA_CONFIGURED(__HANDLE__) ((__HANDLE__)->Instance->PAR != 0)
#endif #endif
#ifdef __IS_DMA_CONFIGURED
if (!__IS_DMA_CONFIGURED(&DMAtx)) return false; if (!__IS_DMA_CONFIGURED(&DMAtx)) return false;
#endif
// Check if DMA transfer error or transfer complete flags are set // Check if DMA transfer error or transfer complete flags are set
if ((__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TE_FLAG_INDEX(&DMAtx)) == 0) && (__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TC_FLAG_INDEX(&DMAtx)) == 0)) return true; if ((__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TE_FLAG_INDEX(&DMAtx)) == 0) && (__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TC_FLAG_INDEX(&DMAtx)) == 0)) return true;
@@ -182,6 +174,7 @@ void TFT_FSMC::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t cou
DMAtx.Init.PeriphInc = memoryIncrease; DMAtx.Init.PeriphInc = memoryIncrease;
HAL_DMA_Init(&DMAtx); HAL_DMA_Init(&DMAtx);
HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(LCD->RAM), count); HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(LCD->RAM), count);
TERN_(TFT_SHARED_IO, while (isBusy())); TERN_(TFT_SHARED_IO, while (isBusy()));
} }
+28 -34
View File
@@ -28,7 +28,11 @@
#elif defined(STM32F4xx) #elif defined(STM32F4xx)
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
#else #else
#error "FSMC/FMC TFT is currently only supported on STM32F1 and STM32F4 hardware." #error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
#endif
#ifndef HAL_SRAM_MODULE_ENABLED
#error "SRAM module disabled for the STM32 framework (HAL_SRAM_MODULE_ENABLED)! Please consult the development team."
#endif #endif
#ifndef LCD_READ_ID #ifndef LCD_READ_ID
@@ -51,12 +55,6 @@ typedef struct {
__IO tft_data_t RAM; __IO tft_data_t RAM;
} LCD_CONTROLLER_TypeDef; } LCD_CONTROLLER_TypeDef;
#ifdef STM32F446xx
#define FMC_OR_FSMC(N) _CAT(FMC_, N)
#else
#define FMC_OR_FSMC(N) _CAT(FSMC_, N)
#endif
class TFT_FSMC { class TFT_FSMC {
private: private:
static SRAM_HandleTypeDef SRAMx; static SRAM_HandleTypeDef SRAMx;
@@ -64,7 +62,7 @@ class TFT_FSMC {
static LCD_CONTROLLER_TypeDef *LCD; static LCD_CONTROLLER_TypeDef *LCD;
static uint32_t readID(tft_data_t inReg); static uint32_t readID(const tft_data_t reg);
static void transmit(tft_data_t data) { LCD->RAM = data; __DSB(); } static void transmit(tft_data_t data) { LCD->RAM = data; __DSB(); }
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count); static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count); static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
@@ -96,11 +94,7 @@ class TFT_FSMC {
#ifdef STM32F1xx #ifdef STM32F1xx
#define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE) #define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE)
#elif defined(STM32F4xx) #elif defined(STM32F4xx)
#ifdef STM32F446xx
#define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_FMC)
#else
#define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_FSMC) #define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_FSMC)
#endif
#define FSMC_BANK1_1 0x60000000U #define FSMC_BANK1_1 0x60000000U
#define FSMC_BANK1_2 0x64000000U #define FSMC_BANK1_2 0x64000000U
#define FSMC_BANK1_3 0x68000000U #define FSMC_BANK1_3 0x68000000U
@@ -110,35 +104,35 @@ class TFT_FSMC {
#endif #endif
const PinMap pinMap_FSMC[] = { const PinMap pinMap_FSMC[] = {
{PD_14, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D00 {PD_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D00
{PD_15, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D01 {PD_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D01
{PD_0, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D02 {PD_0, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D02
{PD_1, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D03 {PD_1, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D03
{PE_7, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D04 {PE_7, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D04
{PE_8, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D05 {PE_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D05
{PE_9, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D06 {PE_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D06
{PE_10, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D07 {PE_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D07
#if DISABLED(TFT_INTERFACE_FSMC_8BIT) #if DISABLED(TFT_INTERFACE_FSMC_8BIT)
{PE_11, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D08 {PE_11, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D08
{PE_12, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D09 {PE_12, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D09
{PE_13, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D10 {PE_13, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D10
{PE_14, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D11 {PE_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D11
{PE_15, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D12 {PE_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D12
{PD_8, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D13 {PD_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D13
{PD_9, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D14 {PD_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D14
{PD_10, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_D15 {PD_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D15
#endif #endif
{PD_4, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_NOE {PD_4, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_NOE
{PD_5, FMC_OR_FSMC(NORSRAM_DEVICE), FSMC_PIN_DATA}, // FSMC_NWE {PD_5, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_NWE
{NC, NP, 0} {NC, NP, 0}
}; };
const PinMap pinMap_FSMC_CS[] = { const PinMap pinMap_FSMC_CS[] = {
{PD_7, (void *)FMC_OR_FSMC(NORSRAM_BANK1), FSMC_PIN_DATA}, // FSMC_NE1 {PD_7, (void *)FSMC_NORSRAM_BANK1, FSMC_PIN_DATA}, // FSMC_NE1
#ifdef PF0 #ifdef PF0
{PG_9, (void *)FMC_OR_FSMC(NORSRAM_BANK2), FSMC_PIN_DATA}, // FSMC_NE2 {PG_9, (void *)FSMC_NORSRAM_BANK2, FSMC_PIN_DATA}, // FSMC_NE2
{PG_10, (void *)FMC_OR_FSMC(NORSRAM_BANK3), FSMC_PIN_DATA}, // FSMC_NE3 {PG_10, (void *)FSMC_NORSRAM_BANK3, FSMC_PIN_DATA}, // FSMC_NE3
{PG_12, (void *)FMC_OR_FSMC(NORSRAM_BANK4), FSMC_PIN_DATA}, // FSMC_NE4 {PG_12, (void *)FSMC_NORSRAM_BANK4, FSMC_PIN_DATA}, // FSMC_NE4
#endif #endif
{NC, NP, 0} {NC, NP, 0}
}; };
+1 -1
View File
@@ -337,7 +337,7 @@ void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t coun
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
#endif #endif
TERN_(TFT_SHARED_IO, while (isBusy())); TERN_(TFT_SHARED_IO, while (isBusy()) { /* nada */ });
} }
void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
+3 -3
View File
@@ -25,8 +25,8 @@
* STM32 LCD-specific defines * STM32 LCD-specific defines
*/ */
uint8_t u8g_com_HAL_STM32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // u8g_com_stm32duino_swspi.cpp uint8_t u8g_com_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32_sw_spi_fn
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
#define U8G_COM_HAL_SW_SPI_FN u8g_com_std_sw_spi_fn
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn #define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn

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