Compare commits

..

1 Commits

Author SHA1 Message Date
3d-gussner ba9e18c730
Revert "M850 add possibility to set sheet as active" 2023-09-11 13:25:39 +02:00
207 changed files with 20249 additions and 19672 deletions

34
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]<Enter comprehensive title>"
labels: bug
assignees: ''
---
<!--
Please, before you create a new bug report, please make sure you searched in open and closed issues and couldn't find anything that matches.
-->
**Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2]
**Printer firmware version** - [e.g. 3.8.1, 3.8.1-RC1, ...]
**MMU upgrade** - [e.g. MMU2S, MMU2, MMU1]
**MMU upgrade firmware version** - [e.g. 1.0.6, 1.0.6-RC2, ...]
**SD card or USB/Octoprint**
Please let us know if you print via SD card or USB/Octoprint
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Please describe steps to reproduce the behavior.
**Expected behavior**
A clear and concise description of what you expected to happen.
**G-code**
Please attach a G-code. This will make it easier for us to replicate the error.
**Video**
Please attach a video. It usually helps to solve the problem.

View File

@ -1,96 +0,0 @@
name: Bug report
description: File a bug report
title: '[BUG] '
labels:
- bug
body:
- type: markdown
attributes:
value: |
Before you create a new bug report, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page. If it does, comment there. Even if it's closed, we can reopen it based on your comment.
- type: dropdown
id: printer_model
attributes:
label: Printer model
description: Enter the printer model(s) where you encountered the issue
options:
- MK3S/+
- MK3
- MK2.5S
- MK2.5
validations:
required: true
- type: dropdown
id: mmu_model
attributes:
label: MMU model
description: Enter the MMU model(s) where you encountered the issue
multiple: false
options:
- No-MMU
- MMU3
- MMU2S
validations:
required: true
- type: input
id: firmware_version
attributes:
label: Firmware versions
description: |
If you're using a custom firmware (not downloaded from Prusa), please note that!
placeholder: '3.14.0, 3.12.0-RC1, 3.14.0 and 3.0.2...'
validations:
required: true
- type: input
id: optional_upgrades
attributes:
label: Upgrades and modifications
description: 'If your printer has upgrades or was modified, please note that! If not, please write None or leave blank.'
placeholder: |
None, custom extruder/hotend (which), different frame, ...
- type: dropdown
id: printing_from
attributes:
label: Printing from...
multiple: false
options:
- SD Card
- PrusaLink
- PrusaConnect
- OctoPrint
- Other host software
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the bug
description: Write a concise description of the bug.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: How to reproduce
description: |
If you are able to reproduce the issue - meaning that you can trigger it yourself by following certain steps - please describe the step-by-step process in as much detail as possible!
- type: textarea
id: expected_behavior
attributes:
label: Expected behavior
description: |
If the printer did something unexpected, or if the procedure is missing a step that would resolve the issue, please provide a step-by-step process of how it should behave.
- type: textarea
id: files
attributes:
label: Files
description: |
Provide at least one of these (ideally as many as you can) to help developers track down the bug.
*To upload files, compress them into a .zip file and drag them to the text area to upload.* Images and videos can be uploaded directly.
- **gcode** file
- **3mf project** which includes the model and printer settings
- **video** or **photos** of the issue happening
**Crash dump: Do not share the file publicly**, as the crash dump contains a raw snapshot of the printer's memory and may include unencrypted sensitive information.
Please send the crash dump file to Prusa by emailing it to reports@prusa3d.com and referencing this issue. In reply to the email, you will be automatically assigned a reference code to be mentioned in the issue. Sharing this file is important and helps us investigate the bug.

17
.github/ISSUE_TEMPLATE/community.md vendored Normal file
View File

@ -0,0 +1,17 @@
---
name: Community
about: Related to "Community made" features
title: "[Community made] <Enter comprehensive title>"
labels: community_made
assignees: ''
---
Prusa Research will NOT follow up these issues!
The maintainers of the "Community made" feature should/will react.
Please, before you create a new "Community made" ticket, please make sure you searched in open and closed issues and couldn't find anything that matches.
**Which Community made feature do you want to address?**
**What is your request/question/suggestion?**

View File

@ -1,25 +0,0 @@
name: Community
description: Related to "Community made" features
title: '[Community made] '
labels:
- community_made
body:
- type: markdown
attributes:
value: >
Prusa Research will NOT follow up these issues!
The maintainers of the "Community made" feature should/will react.
Please, before you create a new "Community made" ticket, please make sure you searched in open and closed issues and couldn't find anything that matches.
- type: textarea
id: which_community
attributes:
label: Which Community made feature do you want to address?
validations:
required: true
- type: textarea
id: What_about_community
attributes:
label: What is your request/question/suggestion?
validations:
required: true

View File

@ -1,11 +0,0 @@
contact_links:
- name: Do you need Support?
url: https://help.prusa3d.com/article/customer-support_2287
about: If you are not sure whether what you are reporting is a bug, please contact our support team first. We are providing full 24/7 customer support.
- name: Knowledge Base
url: https://help.prusa3d.com/
about: We have a comprehensive help documentation that could be helpful for troubleshooting.
- name: Prusa Forum
url: https://forum.prusa3d.com/
about: Please get in touch on our Prusa Forum! (Not an official support channel)
blank_issues_enabled: false

20
.github/ISSUE_TEMPLATE/enhancement.md vendored Normal file
View File

@ -0,0 +1,20 @@
---
name: Enhancement
about: Suggest an idea for this project
title: " [ENHANCEMENT]<Enter comprehensive title>"
labels: enhancement
assignees: ''
---
Please, before you create a new feature request, please make sure you searched in open and closed issues and couldn't find anything that matches.
Enter what type of printer or upgrade the enhancement applies to.
**Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2]
**MMU Upgrade** - [e.g. MMU2S, MMU2, MMU1]
**Is your enhancement related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.

View File

@ -1,35 +0,0 @@
name: Enhancement
description: Suggest an improvement of the existing functionality
title: '[ENHANCEMENT] '
labels:
- enhancement
body:
- type: markdown
attributes:
value: |
Before you create a new enhancement, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page.
- type: checkboxes
id: printer_model
attributes:
label: Printer model
description: Select the printer model(s) where you would like this enhancement
options:
- label: MK3S/+
- label: MK3
- label: MK2.5S
- label: MK2.5
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the enhancement
description: How would this enhancement improve your experience? Do you have a specific use case where this enhancemnet is especially needed?
validations:
required: true
- type: textarea
id: expected_functionality
attributes:
label: Expected functionality
description: |
Describe the way the enhancement would change existing functionality. You can also describe it in a step-by-step basis if applicable.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE REQUEST]<Enter comprehensive title>"
labels: feature request
assignees: ''
---
Please, before you create a new feature request, please make sure you searched in open and closed issues and couldn't find anything that matches.
If it makes sense, enter what type of printer or upgrade the feature request applies to.
**Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2]
**MMU Upgrade** - [e.g. MMU2S, MMU2, MMU1]
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.

View File

@ -1,35 +0,0 @@
name: Feature request
description: Suggest new functionality
title: '[FEATURE REQUEST] '
labels:
- feature request
body:
- type: markdown
attributes:
value: |
Before you create a new feature request, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page.
- type: checkboxes
id: printer_model
attributes:
label: Printer model
description: Select the printer model(s) where you would like this feature
options:
- label: MK3S/+
- label: MK3
- label: MK2.5S
- label: MK2.5
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the feature
description: How would this feature improve the printer? Are there specific use cases where this would be beneficial? Describe how you would use it.
validations:
required: true
- type: textarea
id: expected_functionality
attributes:
label: Expected functionality
description: |
Describe the way the feature would work. You can also describe it in a step-by-step basis if applicable.

12
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@ -0,0 +1,12 @@
---
name: Question
about: What do you want to know?
title: "[QUESTION]<Enter comprehensive title>"
labels: question
assignees: ''
---
Please, before you create a new question, please make sure you searched in open and closed issues and couldn't find anything that matches.
**What is your question?**

View File

@ -1,16 +0,0 @@
name: Question
description: Ask a firmware specific question
title: '[QUESTION] '
labels:
- question
body:
- type: markdown
attributes:
value: |
Before you create a new question, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page.
- type: textarea
id: question
attributes:
label: Question
validations:
required: true

10
.github/travis/cmake-build.sh vendored Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -xe
rm -rf build
mkdir build
cd build
cmake .. \
-DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" \
-DCMAKE_BUILD_TYPE=Release \
-G Ninja
ninja ALL_FIRMWARE

12
.github/travis/cmake-lang.sh vendored Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -xe
rm -rf build
mkdir build
cd build
cmake .. \
-DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" \
-DCMAKE_BUILD_TYPE=Release \
-G Ninja
# ignore all failures in order to show as much output as possible
ninja -k0 check_lang || true

8
.github/travis/cmake-test.sh vendored Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
set -xe
rm -rf build
mkdir build
cd build
cmake .. -G Ninja
ninja tests
ctest

34
.github/travis/legacy-build.sh vendored Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
set -xe
cp Firmware/variants/MK3S.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK3S variant failed" && false; }
bash -x build.sh EN_FARM || { echo "MK3S EN_FARM failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK3.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK3 variant failed" && false; }
bash -x build.sh EN_FARM || { echo "MK3 EN_FARM failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK25S-RAMBo13a.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK25S-RAMBo13a variant failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK25S-RAMBo10a.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK25S-RAMBo10a variant failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK25-RAMBo13a.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK25-RAMBo13a variant failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK25-RAMBo10a.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK25-RAMBo10a variant failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK3S-E3DREVO.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK3S-E3DREVO variant failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK3-E3DREVO.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK3-E3DREVO variant failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK3S-E3DREVO_HF_60W.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK3S-E3DREVO_HF_60W variant failed" && false; }
rm Firmware/Configuration_prusa.h
cp Firmware/variants/MK3-E3DREVO_HF_60W.h Firmware/Configuration_prusa.h
bash -x build.sh || { echo "MK3-E3DREVO_HF_60W variant failed" && false; }
rm Firmware/Configuration_prusa.h

View File

@ -1,178 +0,0 @@
name: ci-build
on:
pull_request:
branches:
- '*'
push:
branches: [ MK3, MK3_* ]
tags:
- 'v*'
- 't*'
- 'c*'
env:
GH_ANNOTATIONS: 1
jobs:
build:
runs-on: ubuntu-latest
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install cmake ninja-build python3-pyelftools python3-regex python3-polib
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v4
if: ${{ github.event.pull_request }}
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
fetch-depth: 0
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v4
if: ${{ !github.event.pull_request }}
with:
ref: ${{ github.event.ref }}
submodules: true
fetch-depth: 0
- name: Cache Dependencies
uses: actions/cache@v4
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Build
run: |
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" -DCMAKE_BUILD_TYPE=Release -G Ninja
ninja
- name: Upload artifacts
if: ${{ !github.event.pull_request }}
uses: actions/upload-artifact@v4
with:
name: Firmware
path: build/*.hex
- name: RELEASE THE KRAKEN
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/t') || startsWith(github.ref, 'refs/tags/c')
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ github.ref_name }}
draft: true
files: |
${{ github.workspace }}/build/release/*.hex
${{ github.workspace }}/build/release/*.zip
check-lang:
runs-on: ubuntu-latest
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-11 g++11 lcov cmake ninja-build python3-pyelftools python3-regex python3-polib
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v4
if: ${{ github.event.pull_request }}
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
fetch-depth: 0
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v4
if: ${{ !github.event.pull_request }}
with:
ref: ${{ github.event.ref }}
submodules: true
fetch-depth: 0
- name: Cache Dependencies
uses: actions/cache@v4
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Run check
run: |
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" -DCMAKE_BUILD_TYPE=Release -G Ninja
ninja check_lang
tests:
runs-on: ubuntu-latest
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-11 g++11 lcov cmake ninja-build python3-pyelftools python3-regex python3-polib
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v4
if: ${{ github.event.pull_request }}
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
fetch-depth: 0
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v4
if: ${{ !github.event.pull_request }}
with:
ref: ${{ github.event.ref }}
submodules: true
fetch-depth: 0
- name: Cache Dependencies
uses: actions/cache@v4
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Run check
run: |
mkdir build
cd build
cmake .. -G Ninja
ninja test_run_all

View File

@ -24,15 +24,9 @@ avr_ram()
}
cat <<EOF > "$MESSAGE"
All values in bytes. Δ Delta to base
| Target| ΔFlash | ΔSRAM | Used Flash | Used SRAM | Free Flash | Free SRAM |
| ------| ------ | ----- | -----------| --------- | ---------- | --------- |
| Target | ΔFlash (bytes) | ΔSRAM (bytes) |
| ------ | -------------- | ------------- |
EOF
einsy_max_upload_size=$(grep "prusa_einsy_rambo.upload.maximum_size" .dependencies/prusa3dboards-*/boards.txt | cut -d "=" -f2)
einsy_max_upload_data_size=8192
for TARGET in $@
do
# strip the multilang prefix
@ -49,8 +43,5 @@ do
flash_d=$(($pr_flash - $base_flash))
ram_d=$(($pr_ram - $base_ram))
flash_free=$(($einsy_max_upload_size - $pr_flash))
ram_free=$(($einsy_max_upload_data_size - $pr_ram))
echo "| \`$TARGET\` | $flash_d | $ram_d | $pr_flash | $pr_ram | $flash_free | $ram_free |" >> "$MESSAGE"
echo "| \`$TARGET\` | $flash_d | $ram_d |" >> "$MESSAGE"
done

View File

@ -18,27 +18,16 @@ jobs:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install cmake ninja-build python3-pyelftools python3-regex python3-polib
# build the base branch
- name: Checkout base
uses: actions/checkout@v4
- name: Cache Dependencies
uses: actions/cache@v4
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
uses: actions/checkout@v3
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Build base
run: |
rm -rf build-base
@ -54,7 +43,7 @@ jobs:
# build the PR branch
- name: Checkout PR
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
clean: false
ref: ${{ github.event.pull_request.head.sha }}

View File

@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
- uses: actions/stale@v8
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Don't ever mark PRs as stale.
days-before-pr-stale: -1
stale-issue-message: 'Thank you for your contribution to our project. This issue has not received any updates for 60 days and may be considered "stale." If this issue is still important to you, please add an update within the next 7 days to keep it open. Administrators can manually reopen the issue if necessary.'
close-issue-message: 'This issue has been closed due to lack of recent activity. Please consider opening a new one if needed.'
stale-issue-message: 'This issue has been flagged as stale because it has been open for 60 days with no activity. The issue will be closed in 7 days unless someone removes the "stale" label or adds a comment.'
close-issue-message: 'This issue has been closed due to lack of recent activity.'
# Don't act on things assigned to a milestone or assigned to someone.
exempt-all-milestones: true
exempt-all-assignees: true

55
.travis.yml Normal file
View File

@ -0,0 +1,55 @@
dist: focal
language: minimal
cache:
directories:
# cmake project dependencies
- .dependencies/
# legacy PF-build dependencies
- ./../PF-build-env/
before_install:
# Prepare the dependencies for the old build environment
- sudo apt-get install -y python3-polib python3-pyelftools python3-regex
# Undo whatever *GARBAGE* travis is doing with python and restore the system version
- mkdir -p .dependencies/python3
- ln -sf /usr/bin/python3 .dependencies/python3/python3
- PATH=$PWD/.dependencies/python3:$PATH
# Bootstrap cmake/ninja for the new build environment
- ./utils/bootstrap.py
- PATH=$(./utils/bootstrap.py --print-dependency-directory "cmake")/bin:$PATH
- PATH=$(./utils/bootstrap.py --print-dependency-directory "ninja"):$PATH
# Arduino IDE adds a lot of noise caused by network traffic, firewall it off
- sudo iptables -P INPUT DROP
- sudo iptables -P FORWARD DROP
- sudo iptables -P OUTPUT ACCEPT
- sudo iptables -A INPUT -i lo -j ACCEPT
- sudo iptables -A OUTPUT -o lo -j ACCEPT
- sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
jobs:
include:
# legacy build.sh environment
- stage: legacy
script: ./.github/travis/legacy-build.sh
# cmake-based build
- stage: cmake
script: ./.github/travis/cmake-build.sh
# cmake tests
- stage: tests
script: ./.github/travis/cmake-test.sh
# language checks
- stage: lang
script: ./.github/travis/cmake-lang.sh
stages:
- cmake
- lang
- legacy
- tests

View File

@ -3,7 +3,7 @@
"name": "avr-gcc",
"toolchainFile": "${workspaceFolder}/cmake/AvrGcc.cmake",
"cmakeSettings": {
"CMAKE_MAKE_PROGRAM": "${workspaceFolder}/.dependencies/ninja-1.12.1/ninja",
"CMAKE_MAKE_PROGRAM": "${workspaceFolder}/.dependencies/ninja-1.10.2/ninja",
"CMAKE_BUILD_TYPE": "Release"
}
}

View File

@ -5,17 +5,14 @@ include(cmake/ReproducibleBuild.cmake)
include(cmake/ProjectVersion.cmake)
resolve_version_variables()
OPTION(ENFORCE_VERSION_MATCH "Enforce checking that configuration.h matches any parsed git tags" OFF)
OPTION(NO_TAG_IS_FATAL "If tag parsing fails, issue a fatal error" OFF)
set(PROJECT_VERSION_HASH
set(PROJECT_VERSION_SUFFIX
"<auto>"
CACHE
STRING
"Version suffix to be appended to the final filename (<ver+PROJECT_VERSION_HASH>). Overrides git hash if set."
"Version suffix to be appended to the final filename (<ver+PROJECT_VERSION_SUFFIX>). Overrides git hash if set."
)
if(PROJECT_VERSION_HASH STREQUAL "<auto>")
set(PROJECT_VERSION_HASH "${FW_COMMIT_HASH}")
if(PROJECT_VERSION_SUFFIX STREQUAL "<auto>")
set(PROJECT_VERSION_SUFFIX "${FW_COMMIT_HASH}")
endif()
set(PROJECT_VERSION_FULL
"<auto>"
@ -36,97 +33,12 @@ set(CUSTOM_COMPILE_OPTIONS
CACHE STRING "Allows adding custom C/C++ flags"
)
#set(FN_VERSION_SUFFIX "FW${PROJECT_VERSION}+${PROJECT_VERSION_HASH}")
set(FN_VERSION_SUFFIX "FW_${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_REV}")
if(PROJECT_VERSION_FLV AND PROJECT_VERSION_FLV_VER)
set (FN_VERSION_SUFFIX "${FN_VERSION_SUFFIX}-${PROJECT_VERSION_FLV}${PROJECT_VERSION_FLV_VER}")
endif()
set(FN_VERSION_DEBUG_SUFFIX "${FN_VERSION_SUFFIX}+${PROJECT_VERSION_COMMIT}")
set(FN_PREFIX "FW${PROJECT_VERSION}+${PROJECT_VERSION_SUFFIX}")
# Inform user about the resolved settings from Configuration.h
message(STATUS "Project version (Configuration.h): ${PROJECT_VERSION}")
#message(STATUS "Project version major............: ${PROJECT_VERSION_MAJOR}") #For debuging
#message(STATUS "Project version minor............: ${PROJECT_VERSION_MINOR}") #For debuging
#message(STATUS "Project version revision.........: ${PROJECT_VERSION_REV}") #For debuging
#message(STATUS "Project version flavor...........: ${PROJECT_VERSION_FLV}") #For debuging
#message(STATUS "Project version fla-revison......: ${PROJECT_VERSION_FLV_VER}") #For debuging
#message(STATUS "Project version commit number....: ${PROJECT_VERSION_COMMIT}") #For debuging
message(STATUS "Filename suffix..................: ${FN_VERSION_SUFFIX}")
message(STATUS "Filename debug suffix ...........: ${FN_VERSION_DEBUG_SUFFIX}")
#message(STATUS "Host OS .........................: ${CMAKE_HOST_SYSTEM_NAME}")
# testing
# SET(FW_COMMIT_DSC "v3.13.0-1234")
if(NOT "${PROJECT_VERSION_HASH}" STREQUAL "UNKNOWN" AND NOT "${FW_COMMIT_DSC}" MATCHES ".+NOTFOUND.+") # else -> no commit hash is known... likely no git.
string(REGEX MATCH "[v|t|c]([0-9]+)\.([0-9]+)\.([0-9]+)-?(${DEV_TAG_REGEX})?([0-9]+)?-([0-9]+)" TAG_VERSION "${FW_COMMIT_DSC}")
if (CMAKE_MATCH_4) # Do we have a build type?
decode_flavor_code(PROJECT_VER_TAG_FLV "${CMAKE_MATCH_4}" "${CMAKE_MATCH_5}")
else()
# No dev status found, it must be a final tag.
decode_flavor_code(PROJECT_VER_TAG_FLV "RELEASED" "0")
endif()
if(ENFORCE_VERSION_MATCH)
if(NOT ${CMAKE_MATCH_1} STREQUAL ${PROJECT_VERSION_MAJOR})
message(FATAL_ERROR "Major version of current tag disagrees with Configuration.h ${CMAKE_MATCH_1}!=${PROJECT_VERSION_MAJOR}")
endif()
if(NOT ${CMAKE_MATCH_2} STREQUAL ${PROJECT_VERSION_MINOR})
message(FATAL_ERROR "Minor version of current tag disagrees with Configuration.h ${CMAKE_MATCH_2}!=${PROJECT_VERSION_MINOR}")
endif()
if(NOT ${CMAKE_MATCH_3} STREQUAL ${PROJECT_VERSION_REV})
message(FATAL_ERROR "Rev version of current tag disagrees with Configuration.h ${CMAKE_MATCH_3}!=${PROJECT_VERSION_REV}")
endif()
if(NOT ${PROJECT_VER_TAG_FLV} STREQUAL ${PROJECT_VERSION_TWEAK})
message(FATAL_ERROR "Dev status of current tag disagrees with Configuration.h ${PROJECT_VER_TAG_FLV}!=${PROJECT_VERSION_TWEAK}")
endif()
# Note - we don't check the commit counter, that'd be too much of a headache. Maybe it
# should be an error only on a tagged build?
MESSAGE(STATUS "Configuration.h and tag match: OK (${PROJECT_VERSION}/${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${PROJECT_VER_TAG_FLV})")
else()
MESSAGE(STATUS "Configuration.h and tag (not enforced): (${PROJECT_VERSION}/${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${PROJECT_VER_TAG_FLV})")
endif()
MESSAGE(STATUS "Commit Nr: Configuration.h: ${PROJECT_VERSION_COMMIT} Tag: ${CMAKE_MATCH_6}")
MESSAGE(STATUS "These tag values will override Configuration.h")
SET(PROJECT_VERSION ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${PROJECT_VER_TAG_FLV})
SET(PROJECT_VERSION_COMMIT ${CMAKE_MATCH_6})
git_get_repository(PROJECT_REPOSITORY)
else(GIT_FOUND)
if (NO_TAG_IS_FATAL)
MESSAGE(FATAL_ERROR "Git was not found or an error occurred parsing the tag. This is a fatal error according to the settings.")
else()
MESSAGE(STATUS "Git was not found or an error occurred parsing the tag. Falling back to Configuration.h values (${PROJECT_VERSION}).")
endif()
set(FW_COMMIT_HASH ${FW_COMMIT_HASH_UNKNOWN}) # Clear it, the code expects a binary...
set(PROJECT_VERSION_TIMESTAMP "0")
endif()
if(CMAKE_MATCH_1 AND CMAKE_MATCH_2)
set(FN_VERSION_SUFFIX "FW_${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
endif()
if(CMAKE_MATCH_4 AND CMAKE_MATCH_5)
set (FN_VERSION_SUFFIX "${FN_VERSION_SUFFIX}-${CMAKE_MATCH_4}${CMAKE_MATCH_5}")
endif()
if(CMAKE_MATCH_6 AND PROJECT_VERSION_HASH)
set(FN_VERSION_DEBUG_SUFFIX "${FN_VERSION_SUFFIX}+${CMAKE_MATCH_6}_${PROJECT_VERSION_HASH}")
endif()
# Inform user about the resolved settings from github
message(STATUS "Project version git..............: ${PROJECT_VERSION}")
message(STATUS "Project version git hash.........: ${PROJECT_VERSION_HASH}")
message(STATUS "Project version git description..: ${PROJECT_VERSION_FULL}")
#message(STATUS "Project version git major........: ${CMAKE_MATCH_1}") #For debuging
#message(STATUS "Project version git minor........: ${CMAKE_MATCH_2}") #For debuging
#message(STATUS "Project version git revision.....: ${CMAKE_MATCH_3}") #For debuging
#message(STATUS "Project version git flavor.......: ${CMAKE_MATCH_4}") #For debuging
#message(STATUS "Project version git fla-revison..: ${CMAKE_MATCH_5}") #For debuging
#message(STATUS "Project version git commit number: ${CMAKE_MATCH_6}") #For debuging
message(STATUS "Filename suffix .................: ${FN_VERSION_SUFFIX}")
message(STATUS "Filename debug suffix ...........: ${FN_VERSION_DEBUG_SUFFIX}")
# Inform user about the resolved settings
message(STATUS "Project version ...........: ${PROJECT_VERSION}")
message(STATUS "Project version suffix ....: ${PROJECT_VERSION_SUFFIX}")
message(STATUS "Project version description: ${PROJECT_VERSION_FULL}")
# Language configuration
set(MAIN_LANGUAGES
@ -146,7 +58,7 @@ set(COMMUNITY_LANGUAGES
set(SELECTED_LANGUAGES ${MAIN_LANGUAGES} ${COMMUNITY_LANGUAGES})
get_dependency_directory(prusa3dboards PRUSA_BOARDS_DIR)
project(Prusa-Firmware VERSION ${PROJECT_VERSION})
project(Prusa-Firmware)
add_subdirectory(lib)
# Get LANG_MAX_SIZE from sources
@ -216,7 +128,6 @@ set(FW_SOURCES
Filament_sensor.cpp
first_lay_cal.cpp
heatbed_pwm.cpp
host.cpp
la10compat.cpp
language.c
lcd.cpp
@ -244,21 +155,21 @@ set(FW_SOURCES
pat9125.cpp
planner.cpp
power_panic.cpp
printer_state.cpp
Prusa_farm.cpp
qr_solve.cpp
rbuf.c
Sd2Card.cpp
SdBaseFile.cpp
SdFatUtil.cpp
SdFile.cpp
SdVolume.cpp
sm4.cpp
Servo.cpp
sm4.c
sound.cpp
speed_lookuptable.cpp
spi.c
SpoolJoin.cpp
stepper.cpp
stopwatch.cpp
strtod.c
swi2c.c
Tcodes.cpp
@ -268,9 +179,10 @@ set(FW_SOURCES
tmc2130.cpp
tone04.c
twi.cpp
uart2.cpp
uart2.c
ultralcd.cpp
util.cpp
vector_3.cpp
xflash.c
xflash_dump.cpp
xyzcal.cpp
@ -397,25 +309,12 @@ function(add_base_binary variant_name)
target_link_options(
${variant_name} PUBLIC -Wl,-Map=${CMAKE_CURRENT_BINARY_DIR}/${variant_name}.map
)
decode_tweak_version(PROJECT_VERSION_FLV PROJECT_VERSION_FLV_VER)
target_compile_definitions(
${variant_name}
PRIVATE CMAKE_CONTROL FW_REPOSITORY="${PROJECT_REPOSITORY}"
FW_COMMIT_HASH="${FW_COMMIT_HASH}"
FW_COMMIT_HASH_LENGTH=${FW_COMMIT_HASH_LENGTH}
FW_MAJOR=${PROJECT_VERSION_MAJOR}
FW_MINOR=${PROJECT_VERSION_MINOR}
FW_REVISION=${PROJECT_VERSION_REV}
FW_COMMITNR=${PROJECT_VERSION_COMMIT}
FW_VERSION_FULL="${PROJECT_VERSION_FULL}" FW_COMMIT_HASH=0x${FW_COMMIT_HASH}
)
if(NOT PROJECT_VERSION_FLV STREQUAL "RELEASED")
target_compile_definitions(
${variant_name}
PRIVATE
FW_FLAVERSION=${PROJECT_VERSION_FLV_VER}
FW_FLAVOR=${PROJECT_VERSION_FLV}
)
endif()
endfunction()
function(fw_add_variant variant_name)
@ -425,13 +324,7 @@ function(fw_add_variant variant_name)
# Single-language build
set(FW_EN "${variant_name}_ENGLISH")
#MK3S_MK3S+_FW_3.13.2-RC1_ENGLISH.hex
set(hex_variant_name "${variant_name}")
if(hex_variant_name STRGREATER_EQUAL "MK3S")
string(REPLACE "MK3S" "MK3S_MK3S+" hex_variant_name ${hex_variant_name})
endif()
set(FW_HEX "${CMAKE_BINARY_DIR}/${hex_variant_name}_${FN_VERSION_SUFFIX}_ENGLISH.hex")
#message(STATUS "Hex filename: ${FW_HEX}")
set(FW_HEX ${CMAKE_BINARY_DIR}/${FN_PREFIX}-${FW_EN}.hex)
add_base_binary(${FW_EN})
target_compile_definitions(${FW_EN} PUBLIC LANG_MODE=0 FW_VARIANT="${variant_header}")
@ -479,7 +372,7 @@ function(fw_add_variant variant_name)
add_custom_target(
check_lang_${variant_name}_${LANG}
COMMENT "Checking ${variant_name} language ${LANG}"
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/lang/lang-check.py --map ${LANG_MAP} ${PO_FILE}
COMMAND ${CMAKE_SOURCE_DIR}/lang/lang-check.py --map ${LANG_MAP} ${PO_FILE}
DEPENDS ${LANG_MAP} ${PO_FILE}
USES_TERMINAL
)
@ -505,15 +398,7 @@ function(fw_add_variant variant_name)
if(${HAS_XFLASH} GREATER_EQUAL 0)
# X-Flash based build (catalogs appended to patched binary)
set(FW_LANG_FINAL "${variant_name}_MULTILANG")
set(hex_variant_name "${variant_name}")
#MK3S_MK3S+_FW_3.13.2-RC1+7651_deadbeef_MULTILANG.hex
if(hex_variant_name STRGREATER_EQUAL "MK3S")
string(REPLACE "MK3S" "MK3S_MK3S+" hex_variant_name ${hex_variant_name})
endif()
set(LANG_HEX ${CMAKE_BINARY_DIR}/${hex_variant_name}_${FN_VERSION_SUFFIX}_MULTILANG.hex)
set(LANG_DEBUG_HEX ${CMAKE_BINARY_DIR}/${hex_variant_name}_${FN_VERSION_DEBUG_SUFFIX}_MULTILANG.hex)
#message(STATUS "Hex filename .....: ${LANG_HEX}")
#message(STATUS "Hex debug filename: ${LANG_DEBUG_HEX}")
set(LANG_HEX ${CMAKE_BINARY_DIR}/${FN_PREFIX}-${FW_LANG_FINAL}.hex)
set(LANG_CATBIN ${LANG_TMP_DIR}/${variant_name}_cat.bin)
set(LANG_CATHEX ${LANG_TMP_DIR}/${variant_name}_cat.hex)
@ -541,10 +426,6 @@ function(fw_add_variant variant_name)
COMMAND ${CMAKE_COMMAND} -E cat ${FW_LANG_PATCH}.hex ${LANG_CATHEX} > ${FW_LANG_FINAL}.hex
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_HEX}
BYPRODUCTS ${LANG_HEX}
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_DEBUG_HEX}
BYPRODUCTS ${LANG_DEBUG_HEX}
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${CMAKE_BINARY_DIR}/release/${hex_variant_name}_${FN_VERSION_SUFFIX}_MULTILANG.hex
BYPRODUCTS ${CMAKE_BINARY_DIR}/release/${hex_variant_name}_${FN_VERSION_SUFFIX}_MULTILANG.hex
DEPENDS ${FW_LANG_PATCH}.hex ${LANG_CATHEX}
COMMENT "Generating final ${FW_LANG_FINAL}.hex"
)
@ -555,18 +436,17 @@ function(fw_add_variant variant_name)
set(ALL_VARIANT_HEXES "")
# Non-xflash, e.g. MK2.5
foreach(LANG IN LISTS SELECTED_LANGUAGES)
set(FW_LANG_FINAL ${variant_name}_en-${LANG})
set(LANG_HEX ${CMAKE_BINARY_DIR}/${variant_name}_${FN_VERSION_SUFFIX}_en-${LANG}.hex)
set(LANG_DEBUG_HEX ${CMAKE_BINARY_DIR}/${variant_name}_${FN_VERSION_DEBUG_SUFFIX}_en-${LANG}.hex)
set(FW_LANG_FINAL ${variant_name}-en_${LANG})
set(LANG_HEX ${CMAKE_BINARY_DIR}/${FN_PREFIX}-${FW_LANG_FINAL}.hex)
set(LANG_BIN ${LANG_TMP_DIR}/${variant_name}_${LANG}.bin)
# Patched binary with pre-baked secondary language
add_custom_command(
OUTPUT ${FW_LANG_FINAL}.bin
COMMAND ${CMAKE_COMMAND} -E copy ${FW_LANG_PATCH}.bin ${FW_LANG_FINAL}.bin
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/lang/lang-patchsec.py ${FW_LANG_BASE} ${LANG_BIN}
COMMAND ${CMAKE_OBJCOPY} -O binary ${FW_LANG_BASE} ${FW_LANG_FINAL}.bin
COMMAND ${CMAKE_SOURCE_DIR}/lang/lang-patchsec.py ${FW_LANG_BASE} ${LANG_BIN}
${FW_LANG_FINAL}.bin
DEPENDS ${FW_LANG_BASE} ${FW_LANG_PATCH}.bin ${LANG_BIN}
DEPENDS ${FW_LANG_BASE} ${LANG_BIN}
COMMENT "Generating ${FW_LANG_FINAL}.bin"
)
@ -576,8 +456,6 @@ function(fw_add_variant variant_name)
COMMAND ${CMAKE_OBJCOPY} -I binary -O ihex ${FW_LANG_FINAL}.bin ${FW_LANG_FINAL}.hex
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_HEX}
BYPRODUCTS ${LANG_HEX}
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_DEBUG_HEX}
BYPRODUCTS ${LANG_DEBUG_HEX}
DEPENDS ${FW_LANG_FINAL}.bin
COMMENT "Creating ${FW_LANG_FINAL}.hex"
)
@ -586,15 +464,6 @@ function(fw_add_variant variant_name)
list(APPEND ALL_VARIANT_HEXES ${FW_LANG_FINAL})
endforeach()
add_custom_target("${variant_name}-All-Languages" DEPENDS ${ALL_VARIANT_HEXES})
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
add_custom_command(TARGET "${variant_name}-All-Languages"
POST_BUILD
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "release"
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "release/${variant_name}_${FN_VERSION_SUFFIX}.zip" --format=zip ${variant_name}_${FN_VERSION_SUFFIX}_en*.hex
BYPRODUCTS "${CMAKE_BINARY_DIR}/release/${variant_name}_${FN_VERSION_SUFFIX}.zip"
)
endif()
add_dependencies(ALL_MULTILANG "${variant_name}-All-Languages")
endif()
endfunction()
@ -631,24 +500,12 @@ if(CMAKE_CROSSCOMPILING)
set(DIR_NAME ${THIS_VAR})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build_gen/${DIR_NAME})
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/build_gen/${DIR_NAME}/CMakeLists.txt
"project(${DIR_NAME} VERSION ${PROJECT_VERSION})\nfw_add_variant(${THIS_VAR})"
"project(${DIR_NAME})\nfw_add_variant(${THIS_VAR})"
)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/build_gen/${DIR_NAME})
endforeach(THIS_VAR IN LISTS FW_VARIANTS)
endif()
SET(REVO_FW_ZIP_NAME "E3D_REVO_FW_MK3_MK3S_MK3S+_${FN_VERSION_SUFFIX}.zip")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
add_custom_command(TARGET ALL_MULTILANG
POST_BUILD
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/release
BYPRODUCTS ${CMAKE_BINARY_DIR}/release/${REVO_FW_ZIP_NAME}
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${REVO_FW_ZIP_NAME}" --format=zip *E3DREVO*.hex
COMMAND ${CMAKE_COMMAND} -E rm *E3DREVO*.hex
)
endif()
#
# Tests
#

View File

@ -1,13 +1,10 @@
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include <stdint.h>
#include "boards.h"
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#define _CONCAT(x,y) x##y
#define CONCAT(x,y) _CONCAT(x,y)
#include <avr/pgmspace.h>
extern const uint16_t _nPrinterType;
@ -15,34 +12,23 @@ extern const char _sPrinterName[] PROGMEM;
extern const uint16_t _nPrinterMmuType;
extern const char _sPrinterMmuName[] PROGMEM;
// Firmware version.
// NOTE: These are ONLY used if you are not building via cmake and/or not in a git repository.
// Otherwise the repository information takes precedence.
#ifndef CMAKE_CONTROL
// Firmware version
#define FW_MAJOR 3
#define FW_MINOR 14
#define FW_MINOR 13
#define FW_REVISION 1
#define FW_COMMITNR 8225
#define FW_FLAVOR RC //uncomment if DEV, ALPHA, BETA or RC
#define FW_FLAVOR RC //uncomment if DEBUG, DEVEL, ALPHA, BETA or RC
#define FW_FLAVERSION 1 //uncomment if FW_FLAVOR is defined and versioning is needed. Limited to max 8.
#endif
#ifndef FW_FLAVOR
#define FW_TWEAK (FIRMWARE_REVISION_RELEASED)
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION)
#define FW_VERSION_FULL STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) "-" STR(FW_COMMITNR)
#else
// Construct the TWEAK value as it is expected from the enum.
#define FW_TWEAK (CONCAT(FIRMWARE_REVISION_,FW_FLAVOR) + FW_FLAVERSION)
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) "-" STR(FW_FLAVOR) "" STR(FW_FLAVERSION)
#define FW_VERSION_FULL STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) "-" STR(FW_FLAVOR) "" STR(FW_FLAVERSION) "+" STR(FW_COMMITNR)
#endif
// The full version string and repository source are set via cmake
#ifndef CMAKE_CONTROL
#define FW_COMMIT_HASH_LENGTH 1
#define FW_COMMIT_HASH "0"
#define FW_COMMIT_HASH 0
#define FW_REPOSITORY "Unknown"
#define FW_VERSION_FULL FW_VERSION "-unknown"
#endif
// G-code language level
@ -71,7 +57,7 @@ extern const char _sPrinterMmuName[] PROGMEM;
// build by the user have been successfully uploaded into firmware.
#define STRING_VERSION_CONFIG_H SOURCE_DATE_EPOCH " " SOURCE_TIME_EPOCH // build date and time
#define STRING_CONFIG_H_AUTHOR FW_REPOSITORY // Who made the changes.
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
// SERIAL_PORT selects which serial port should be used for communication with the host.
// This allows the connection of wireless adapters (for instance) to non-default port pins.
@ -122,6 +108,13 @@ extern const char _sPrinterMmuName[] PROGMEM;
#define TEMP_HYSTERESIS 5 // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early.
// If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to reduce the
// average current. The value should be an integer and the heat bed will be turned on for 1 interval of
// HEATER_BED_DUTY_CYCLE_DIVIDER intervals.
//#define HEATER_BED_DUTY_CYCLE_DIVIDER 4
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=I^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=I^2/R
@ -284,6 +277,124 @@ your extruder heater takes 2 minutes to hit the target on heating.
#define HOME_Z_SEARCH_THRESHOLD 0.15f // Threshold of the Z height in calibration
//============================= Bed Auto Leveling ===========================
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
#define Z_PROBE_REPEATABILITY_TEST // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled.
#ifdef ENABLE_AUTO_BED_LEVELING
// There are 2 different ways to pick the X and Y locations to probe:
// - "grid" mode
// Probe every point in a rectangular grid
// You must specify the rectangle, and the density of sample points
// This mode is preferred because there are more measurements.
// It used to be called ACCURATE_BED_LEVELING but "grid" is more descriptive
// - "3-point" mode
// Probe 3 arbitrary points on the bed (that aren't colinear)
// You must specify the X & Y coordinates of all 3 points
#define AUTO_BED_LEVELING_GRID
// with AUTO_BED_LEVELING_GRID, the bed is sampled in a
// AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid
// and least squares solution is calculated
// Note: this feature occupies 10'206 byte
#ifdef AUTO_BED_LEVELING_GRID
// set the rectangle in which to probe
#define LEFT_PROBE_BED_POSITION 15
#define RIGHT_PROBE_BED_POSITION 170
#define BACK_PROBE_BED_POSITION 180
#define FRONT_PROBE_BED_POSITION 20
// set the number of grid points per dimension
// I wouldn't see a reason to go above 3 (=9 probing points on the bed)
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
// is used to esimate the plane of the print bed
#define ABL_PROBE_PT_1_X 15
#define ABL_PROBE_PT_1_Y 180
#define ABL_PROBE_PT_2_X 15
#define ABL_PROBE_PT_2_Y 20
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_LEVELING_GRID
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER -25
#define Y_PROBE_OFFSET_FROM_EXTRUDER -29
#define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
#define Z_RAISE_BEFORE_HOMING 5 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
#define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
//If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
//The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
// You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
// #define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!
//#define Z_SAFE_HOMING // This feature is meant to avoid Z homing with probe outside the bed area.
// When defined, it will:
// - Allow Z homing only after X and Y homing AND stepper drivers still enabled
// - If stepper drivers timeout, it will need X and Y homing again before Z homing
// - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
// - Block Z homing only when the probe is outside bed area.
#ifdef Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28)
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28)
#endif
#ifdef AUTO_BED_LEVELING_GRID // Check if Probe_Offset * Grid Points is greater than Probing Range
#if X_PROBE_OFFSET_FROM_EXTRUDER < 0
#if (-(X_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
#error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#else
#if ((X_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
#error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#endif
#if Y_PROBE_OFFSET_FROM_EXTRUDER < 0
#if (-(Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
#error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#else
#if ((Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
#error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#endif
#endif
#endif // ENABLE_AUTO_BED_LEVELING
// The position of the homing switches
//#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
@ -301,6 +412,17 @@ your extruder heater takes 2 minutes to hit the target on heating.
//=============================Additional Features===========================
//===========================================================================
// Custom M code points
#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#ifdef ENABLE_AUTO_BED_LEVELING
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15
#define Z_PROBE_OFFSET_RANGE_MAX -5
#endif // ENABLE_AUTO_BED_LEVELING
#endif // CUSTOM_M_CODES
// Host Keepalive
//
// When enabled Marlin will send a busy status message to the host
@ -324,10 +446,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
#define SDSUPPORT
#define LCD_WIDTH 20
#define LCD_HEIGHT 4
#define LCD_BACKLIGHT_LEVEL_HIGH 130
#define LCD_BACKLIGHT_LEVEL_LOW 50
#define LCD_BACKLIGHT_FORCE_ON 30
#define LCD_BACKLIGHT_TIMEOUT 15
// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
@ -358,12 +476,26 @@ your extruder heater takes 2 minutes to hit the target on heating.
//define BlinkM/CyzRgb Support
//#define BLINKM
/*********************************************************************\
* R/C SERVO support
* Sponsored by TrinityLabs, Reworked by codexmas
**********************************************************************/
// Number of servos
//
// If you select a configuration below, this will receive a default value and does not need to be set manually
// set it manually if you have more servos than extruders and wish to manually control some
// leaving it undefined or defining as 0 will disable the servo subsystem
// If unsure, leave commented / disabled
//
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm). Used by the volumetric extrusion.
// Try to maintain a minimum distance from the bed even when Z is
// unknown when doing the following operations
#define MIN_Z_FOR_LOAD 35 // lcd filament loading or autoload (values for load and unload have been unified to prevent movement between unload & load operations!)
#define MIN_Z_FOR_UNLOAD 35 // lcd filament unloading
#define MIN_Z_FOR_LOAD 50 // lcd filament loading or autoload
#define MIN_Z_FOR_UNLOAD 50 // lcd filament unloading
#define MIN_Z_FOR_SWAP 27 // filament change (including M600)
#define MIN_Z_FOR_PREHEAT 10 // lcd preheat

View File

@ -106,9 +106,6 @@ void Config_PrintSettings(uint8_t level)
#ifdef THERMAL_MODEL
thermal_model_report_settings();
#endif
printf_P(PSTR(
"%SStatistics:\n%S M78 S%lu T%lu\n"),
echomagic, echomagic, eeprom_read_dword((uint32_t *)EEPROM_FILAMENTUSED), eeprom_read_dword((uint32_t *)EEPROM_TOTALTIME));
}
#endif
@ -119,6 +116,10 @@ static_assert (EXTRUDERS == 1, "ConfigurationStore M500_conf not implemented for
static_assert (NUM_AXIS == 4, "ConfigurationStore M500_conf not implemented for more axis."
"Fix axis_steps_per_mm max_feedrate_normal max_acceleration_mm_per_s2_normal max_jerk max_feedrate_silent"
" max_acceleration_mm_per_s2_silent array size.");
#ifdef ENABLE_AUTO_BED_LEVELING
static_assert (false, "zprobe_zoffset was not initialized in printers in field to -(Z_PROBE_OFFSET_FROM_EXTRUDER), so it contains"
"0.0, if this is not acceptable, increment EEPROM_VERSION to force use default_conf");
#endif
static_assert (sizeof(M500_conf) == 209, "sizeof(M500_conf) has changed, ensure that EEPROM_VERSION has been incremented, "
"or if you added members in the end of struct, ensure that historically uninitialized values will be initialized."
@ -180,7 +181,7 @@ static const M500_conf default_conf PROGMEM =
void Config_StoreSettings()
{
strcpy_P(cs.version, default_conf.version);
eeprom_update_block_notify(reinterpret_cast<uint8_t*>(&cs), reinterpret_cast<uint8_t*>(EEPROM_M500_base), sizeof(cs));
eeprom_update_block(reinterpret_cast<uint8_t*>(&cs), reinterpret_cast<uint8_t*>(EEPROM_M500_base), sizeof(cs));
#ifdef THERMAL_MODEL
thermal_model_save_settings();
#endif
@ -213,10 +214,6 @@ bool Config_RetrieveSettings()
eeprom_init_default_block(&EEPROM_M500_base->max_feedrate_silent, sizeof(EEPROM_M500_base->max_feedrate_silent), default_conf.max_feedrate_silent);
eeprom_init_default_block(&EEPROM_M500_base->max_acceleration_mm_per_s2_silent, sizeof(EEPROM_M500_base->max_acceleration_mm_per_s2_silent), default_conf.max_acceleration_mm_per_s2_silent);
#ifdef TMC2130
eeprom_init_default_block(&EEPROM_M500_base->axis_ustep_resolution, sizeof(EEPROM_M500_base->axis_ustep_resolution), default_conf.axis_ustep_resolution);
#endif // TMC2130
// load the CS to RAM
eeprom_read_block(reinterpret_cast<uint8_t*>(&cs), reinterpret_cast<uint8_t*>(EEPROM_M500_base), sizeof(cs));
calculate_extruder_multipliers();
@ -234,6 +231,11 @@ bool Config_RetrieveSettings()
cs.max_acceleration_mm_per_s2_silent[j] = SILENT_MAX_ACCEL_XY;
}
if(cs.axis_ustep_resolution[X_AXIS] == 0xff){ cs.axis_ustep_resolution[X_AXIS] = TMC2130_USTEPS_XY; }
if(cs.axis_ustep_resolution[Y_AXIS] == 0xff){ cs.axis_ustep_resolution[Y_AXIS] = TMC2130_USTEPS_XY; }
if(cs.axis_ustep_resolution[Z_AXIS] == 0xff){ cs.axis_ustep_resolution[Z_AXIS] = TMC2130_USTEPS_Z; }
if(cs.axis_ustep_resolution[E_AXIS] == 0xff){ cs.axis_ustep_resolution[E_AXIS] = TMC2130_USTEPS_E; }
tmc2130_set_res(X_AXIS, cs.axis_ustep_resolution[X_AXIS]);
tmc2130_set_res(Y_AXIS, cs.axis_ustep_resolution[Y_AXIS]);
tmc2130_set_res(Z_AXIS, cs.axis_ustep_resolution[Z_AXIS]);

View File

@ -19,7 +19,7 @@ typedef struct
uint32_t min_segment_time_us; //!< (µs) M205 B
float max_jerk[4]; //!< Jerk is a maximum immediate velocity change.
float add_homing[3];
float zprobe_zoffset; //!< unused
float zprobe_zoffset; //!< Only used with define ENABLE_AUTO_BED_LEVELING
float Kp;
float Ki;
float Kd;

View File

@ -66,12 +66,6 @@
*/
#define AUTO_REPORT
// Keepalive period which is restarted with M79
#define M79_TIMEOUT 30 * 1000 // ms
// A timer which is restarted everytime a G-command is added to the command queue.
#define USB_TIMER_TIMEOUT 10 * 1000 // ms
//===========================================================================
//=============================Mechanical Settings===========================
//===========================================================================
@ -125,6 +119,34 @@
#endif //End auto min/max positions
//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
// A single Z stepper driver is usually used to drive 2 stepper motors.
// Uncomment this define to utilize a separate stepper driver for each Z axis motor.
// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used
// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards.
// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
//#define Z_DUAL_STEPPER_DRIVERS
#ifdef Z_DUAL_STEPPER_DRIVERS
#undef EXTRUDERS
#define EXTRUDERS 1
#endif
// Same again but for Y Axis.
//#define Y_DUAL_STEPPER_DRIVERS
// Define if the two Y drives need to rotate in opposite directions
#define INVERT_Y2_VS_Y_DIR 1
#ifdef Y_DUAL_STEPPER_DRIVERS
#undef EXTRUDERS
#define EXTRUDERS 1
#endif
#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
#error "You cannot have dual drivers for both Y and Z"
#endif
//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
#define X_HOME_RETRACT_MM 5
#define Y_HOME_RETRACT_MM 5

View File

@ -120,7 +120,7 @@ void write_mem(uint16_t address, uint16_t count, const uint8_t* data, const dcod
switch (type)
{
case dcode_mem_t::sram: *((uint8_t*)address) = data[i]; break;
case dcode_mem_t::eeprom: eeprom_write_byte_notify((uint8_t*)address, data[i]); break;
case dcode_mem_t::eeprom: eeprom_write_byte((uint8_t*)address, data[i]); break;
case dcode_mem_t::progmem: break;
case dcode_mem_t::xflash: break;
}
@ -191,6 +191,13 @@ void dcode_3()
#include <avr/wdt.h>
#include "bootapp.h"
#if 0
extern float current_temperature_pinda;
extern float axis_steps_per_mm[NUM_AXIS];
#define LOG(args...) printf(args)
#endif //0
#define LOG(args...)
/*!
@ -248,7 +255,7 @@ void dcode_1()
LOG("D1 - Clear EEPROM and RESET\n");
cli();
for (int i = 0; i < 8192; i++)
eeprom_write_byte_notify((unsigned char*)i, (unsigned char)0xff);
eeprom_write_byte((unsigned char*)i, (unsigned char)0xff);
softReset();
}
#endif
@ -341,6 +348,7 @@ void dcode_4()
- The hex address needs to be lowercase without the 0 before the x
- Count is decimal
- The hex data needs to be lowercase
*/
void dcode_5()
{
@ -479,12 +487,12 @@ void dcode_8()
else if (strchr_pointer[1+1] == '!')
{
cal_status = 1;
eeprom_write_byte_notify((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, cal_status);
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 0, 8); //40C - 20um - 8usteps
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 1, 24); //45C - 60um - 24usteps
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 2, 48); //50C - 120um - 48usteps
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 3, 80); //55C - 200um - 80usteps
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 4, 120); //60C - 300um - 120usteps
eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, cal_status);
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 0, 8); //40C - 20um - 8usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 1, 24); //45C - 60um - 24usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 2, 48); //50C - 120um - 48usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 3, 80); //55C - 200um - 80usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 4, 120); //60C - 300um - 120usteps
}
else
{

View File

@ -8,7 +8,6 @@
#include "language.h"
#include "menu.h"
#include "messages.h"
#include "mmu2.h"
#include "planner.h"
#include "temperature.h"
#include "ultralcd.h"
@ -42,7 +41,7 @@ FSensorBlockRunout::~FSensorBlockRunout() { }
#endif // FILAMENT_SENSOR
void Filament_sensor::setEnabled(bool enabled) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENSOR, enabled);
eeprom_update_byte((uint8_t *)EEPROM_FSENSOR, enabled);
if (enabled) {
fsensor.init();
} else {
@ -53,21 +52,21 @@ void Filament_sensor::setEnabled(bool enabled) {
void Filament_sensor::setAutoLoadEnabled(bool state, bool updateEEPROM) {
autoLoadEnabled = state;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENS_AUTOLOAD_ENABLED, state);
eeprom_update_byte((uint8_t *)EEPROM_FSENS_AUTOLOAD_ENABLED, state);
}
}
void Filament_sensor::setRunoutEnabled(bool state, bool updateEEPROM) {
runoutEnabled = state;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENS_RUNOUT_ENABLED, state);
eeprom_update_byte((uint8_t *)EEPROM_FSENS_RUNOUT_ENABLED, state);
}
}
void Filament_sensor::setActionOnError(SensorActionOnError state, bool updateEEPROM) {
sensorActionOnError = state;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENSOR_ACTION_NA, (uint8_t)state);
eeprom_update_byte((uint8_t *)EEPROM_FSENSOR_ACTION_NA, (uint8_t)state);
}
}
@ -149,7 +148,6 @@ void Filament_sensor::triggerFilamentRemoved() {
void Filament_sensor::filRunout() {
// SERIAL_ECHOLNPGM("filRunout");
sendHostNotification_P(MSG_FILAMENT_RUNOUT_DETECTED);
runoutEnabled = false;
autoLoadEnabled = false;
stop_and_save_print_to_ram(0, 0);
@ -290,7 +288,7 @@ const char *IR_sensor_analog::getIRVersionText() {
void IR_sensor_analog::setSensorRevision(SensorRevision rev, bool updateEEPROM) {
sensorRevision = rev;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENSOR_PCB, (uint8_t)rev);
eeprom_update_byte((uint8_t *)EEPROM_FSENSOR_PCB, (uint8_t)rev);
}
}
@ -313,7 +311,22 @@ bool IR_sensor_analog::checkVoltage(uint16_t raw) {
puts_P(PSTR("fsensor v0.4 in fault range 4.6-5V - unconnected"));
return false;
}
/// newer IR sensor cannot normally produce 0-0.3V, this is considered a failure
#if 0 // Disabled as it has to be decided if we gonna use this or not.
if(IRsensor_Hopen_TRESHOLD <= raw && raw <= IRsensor_VMax_TRESHOLD) {
puts_P(PSTR("fsensor v0.4 in fault range 0.0-0.3V - wrong IR sensor"));
return false;
}
#endif
}
/// If IR sensor is "uknown state" and filament is not loaded > 1.5V return false
#if 0
#error "I really think this code can't be enabled anymore because we are constantly checking this voltage."
if((sensorRevision == SensorRevision::_Undef) && (raw > IRsensor_Lmax_TRESHOLD)) {
puts_P(PSTR("Unknown IR sensor version and no filament loaded detected."));
return false;
}
#endif
// otherwise the IR fsensor is considered working correctly
return true;
}
@ -433,7 +446,7 @@ void PAT9125_sensor::setJamDetectionEnabled(bool state, bool updateEEPROM) {
resetStepCount();
jamErrCnt = 0;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENSOR_JAM_DETECTION, state);
eeprom_update_byte((uint8_t *)EEPROM_FSENSOR_JAM_DETECTION, state);
}
}

View File

@ -1,74 +0,0 @@
{0x3E, {0x0F, 0xA8, 0xAF, 0x00, }, 'H'}, // index=0x80, utf8='🄷'
{0x00, {0x69, 0x96, 0x00, 0x00, }, '\xdf'}, // index=0x81, utf8='°'
{0x60, {0x25, 0x55, 0x58, 0x87, }, 'h'}, // index=0x82, utf8='🌡'
{0x04, {0x27, 0xF2, 0xE0, 0x00, }, '^'}, // index=0x83, utf8='⬏'
{0x34, {0x03, 0xCC, 0x19, 0x60, }, '\xf3'}, // index=0x84, utf8='🔃'
{0x3C, {0x0E, 0xF8, 0x8F, 0x00, }, '\xdb'}, // index=0x85, utf8='🗀'
{0x08, {0x02, 0x94, 0x92, 0x00, }, '>'}, // index=0x86, utf8='»'
{0x1C, {0x07, 0x9A, 0x87, 0x00, }, '\xe5'}, // index=0x87, utf8='🕑'
{0x24, {0x00, 0x85, 0x28, 0x52, }, '\x7e'}, // index=0x88, utf8='⏬'
{0x06, {0x00, 0x1B, 0xE4, 0x00, }, '\x7e'}, // index=0x89, utf8='✔'
{0x78, {0x12, 0x70, 0x78, 0x70, }, 'a'}, // index=0x8A, utf8='á'
{0xF8, {0x12, 0x78, 0x8F, 0x88, }, 'A'}, // index=0x8B, utf8='Á'
{0x78, {0x42, 0x70, 0x78, 0x70, }, 'a'}, // index=0x8C, utf8='à'
{0x78, {0x25, 0x70, 0x78, 0x70, }, 'a'}, // index=0x8D, utf8='â'
{0xF8, {0x50, 0x78, 0x8F, 0x88, }, '\xd1'}, // index=0x8E, utf8='Ä'
{0xF0, {0x25, 0x27, 0x07, 0x87, }, 'a'}, // index=0x8F, utf8='å'
{0xF0, {0x25, 0x27, 0x8F, 0x88, }, 'A'}, // index=0x90, utf8='Å'
{0x2C, {0x0D, 0x27, 0xAA, 0x50, }, '\xd1'}, // index=0x91, utf8='æ'
{0xBC, {0x07, 0x07, 0x87, 0x11, }, 'a'}, // index=0x92, utf8='ą'
{0xBE, {0x78, 0x8F, 0x88, 0x11, }, 'A'}, // index=0x93, utf8='Ą'
{0x78, {0x52, 0x70, 0x78, 0x70, }, 'a'}, // index=0x94, utf8='ă'
{0xF8, {0x52, 0x78, 0x8F, 0x88, }, 'A'}, // index=0x95, utf8='Ă'
{0x20, {0x12, 0x78, 0x88, 0x70, }, 'c'}, // index=0x96, utf8='ć'
{0x20, {0x52, 0x78, 0x88, 0x70, }, 'c'}, // index=0x97, utf8='č'
{0x48, {0x52, 0x78, 0x88, 0x87, }, 'C'}, // index=0x98, utf8='Č'
{0x03, {0x11, 0x17, 0x99, 0x70, }, 'd'}, // index=0x99, utf8='ď'
{0x18, {0x12, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9A, utf8='é'
{0x44, {0x12, 0xF8, 0xF8, 0xF0, }, 'E'}, // index=0x9B, utf8='É'
{0x18, {0x42, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9C, utf8='è'
{0x18, {0x25, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9D, utf8='ê'
{0x18, {0x52, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9E, utf8='ě'
{0x18, {0x50, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9F, utf8='ë'
{0x0C, {0x07, 0x8F, 0x87, 0x23, }, 'e'}, // index=0xA0, utf8='ę'
{0xA2, {0x0F, 0x8F, 0x8F, 0x11, }, 'E'}, // index=0xA1, utf8='Ę'
{0x00, {0x12, 0x06, 0x22, 0x70, }, 'i'}, // index=0xA2, utf8='í'
{0x00, {0x12, 0x07, 0x22, 0x27, }, 'I'}, // index=0xA3, utf8='Í'
{0x00, {0x25, 0x06, 0x22, 0x70, }, 'i'}, // index=0xA4, utf8='î'
{0x00, {0x25, 0x07, 0x22, 0x27, }, 'I'}, // index=0xA5, utf8='Î'
{0x00, {0x12, 0x06, 0x22, 0x27, }, 'l'}, // index=0xA6, utf8='ĺ'
{0x02, {0x62, 0x36, 0xA2, 0x70, }, 'l'}, // index=0xA7, utf8='ł'
{0x40, {0x45, 0x6C, 0x44, 0x70, }, 'L'}, // index=0xA8, utf8='Ł'
{0x03, {0x62, 0x22, 0x22, 0x70, }, 'l'}, // index=0xA9, utf8='ľ'
{0x43, {0x88, 0x88, 0x88, 0xF0, }, 'L'}, // index=0xAA, utf8='Ľ'
{0x78, {0x12, 0xBC, 0x88, 0x80, }, 'n'}, // index=0xAB, utf8='ń'
{0x78, {0x52, 0xBC, 0x88, 0x80, }, 'n'}, // index=0xAC, utf8='ň'
{0x38, {0x12, 0x78, 0x88, 0x70, }, 'o'}, // index=0xAD, utf8='ó'
{0x78, {0x12, 0x78, 0x88, 0x87, }, 'O'}, // index=0xAE, utf8='Ó'
{0x38, {0x42, 0x78, 0x88, 0x70, }, 'o'}, // index=0xAF, utf8='ò'
{0x38, {0x25, 0x78, 0x88, 0x70, }, 'o'}, // index=0xB0, utf8='ô'
{0x3A, {0x00, 0x79, 0xAC, 0x78, }, 'o'}, // index=0xB1, utf8='ø'
{0x3D, {0x07, 0x9A, 0xAC, 0x78, }, 'o'}, // index=0xB2, utf8='Ø'
{0x78, {0x50, 0x78, 0x88, 0x87, }, '\xef'}, // index=0xB3, utf8='Ö'
{0x39, {0x49, 0x78, 0x88, 0x70, }, 'o'}, // index=0xB4, utf8='ő'
{0x08, {0x52, 0xBC, 0x88, 0x80, }, 'r'}, // index=0xB5, utf8='ř'
{0x98, {0x52, 0xF8, 0x8F, 0x98, }, 'R'}, // index=0xB6, utf8='Ř'
{0x20, {0x12, 0x78, 0x70, 0xF0, }, 's'}, // index=0xB7, utf8='ś'
{0x48, {0x12, 0x78, 0x63, 0x87, }, 'S'}, // index=0xB8, utf8='Ś'
{0x20, {0x52, 0x78, 0x70, 0xF0, }, 's'}, // index=0xB9, utf8='š'
{0x48, {0x52, 0x78, 0x63, 0x87, }, 'S'}, // index=0xBA, utf8='Š'
{0x10, {0x07, 0x87, 0x0F, 0x24, }, 's'}, // index=0xBB, utf8='ș'
{0x12, {0x78, 0x63, 0x87, 0x24, }, 'S'}, // index=0xBC, utf8='Ș'
{0x60, {0x69, 0x9A, 0x98, 0x8B, }, '\xe2'}, // index=0xBD, utf8='ß'
{0x23, {0x04, 0xE4, 0x44, 0x30, }, 't'}, // index=0xBE, utf8='ť'
{0x10, {0x4E, 0x44, 0x43, 0x24, }, 't'}, // index=0xBF, utf8='ț'
{0x7C, {0x12, 0x88, 0x89, 0x60, }, 'u'}, // index=0xC0, utf8='ú'
{0x3C, {0x50, 0x88, 0x88, 0x70, }, 'U'}, // index=0xC1, utf8='Ü'
{0x78, {0x25, 0x28, 0x89, 0x60, }, 'u'}, // index=0xC2, utf8='ů'
{0x79, {0x49, 0x08, 0x89, 0x60, }, 'u'}, // index=0xC3, utf8='ű'
{0x3C, {0x12, 0x88, 0x70, 0x70, }, 'y'}, // index=0xC4, utf8='ý'
{0x0C, {0x12, 0x88, 0x52, 0x22, }, 'Y'}, // index=0xC5, utf8='Ý'
{0x44, {0x12, 0xF1, 0x24, 0xF0, }, 'z'}, // index=0xC6, utf8='ź'
{0x44, {0x52, 0xF1, 0x24, 0xF0, }, 'z'}, // index=0xC7, utf8='ž'
{0x8C, {0x52, 0xF0, 0x36, 0x8F, }, 'Z'}, // index=0xC8, utf8='Ž'
{0x44, {0x20, 0xF1, 0x24, 0xF0, }, 'z'}, // index=0xC9, utf8='ż'

View File

@ -21,7 +21,8 @@
#include "Configuration.h"
#include "pins.h"
#include "Timer.h"
#include "printer_state.h"
#include "mmu2.h"
extern uint8_t mbl_z_probe_nr;
#ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
@ -63,6 +64,18 @@
#define MYSERIAL MSerial
#endif
#include "lcd.h"
#ifdef __cplusplus
extern "C" {
#endif
extern FILE _uartout;
#ifdef __cplusplus
}
#endif
#define uartout (&_uartout)
#define SERIAL_PROTOCOL(x) (MYSERIAL.print(x))
#define SERIAL_PROTOCOL_F(x,y) (MYSERIAL.print(x,y))
#define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x)))
@ -121,8 +134,13 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
#ifdef Y_DUAL_STEPPER_DRIVERS
#define enable_y() { WRITE(Y_ENABLE_PIN, Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, Y_ENABLE_ON); }
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, !Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#else
#define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#endif
#else
#define enable_y() ;
#define disable_y() ;
@ -130,12 +148,22 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
#if defined(Z_AXIS_ALWAYS_ON)
#ifdef Z_DUAL_STEPPER_DRIVERS
#define poweron_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
#define poweroff_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define poweron_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define poweroff_z() {}
#endif
#else
#ifdef Z_DUAL_STEPPER_DRIVERS
#define poweron_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
#define poweroff_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define poweron_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define poweroff_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#endif
#endif
#else
#define poweron_z() {}
#define poweroff_z() {}
@ -179,7 +207,6 @@ void kill(const char *full_screen_message = NULL);
void finishAndDisableSteppers();
void UnconditionalStop(); // Stop heaters, motion and clear current print status
void ConditionalStop(); // Similar to UnconditionalStop, but doesn't disable heaters
void ThermalStop(bool allow_pause = false); // Emergency stop used by overtemp functions which allows
// recovery (with pause=true)
bool IsStopped(); // Returns true if the print has been stopped
@ -209,7 +236,7 @@ enum class HeatingStatus : uint8_t
extern HeatingStatus heating_status;
extern bool fans_check_enabled;
constexpr float homing_feedrate[] = HOMING_FEEDRATE;
extern float homing_feedrate[];
extern uint8_t axis_relative_modes;
extern float feedrate;
extern int feedmultiply;
@ -235,7 +262,6 @@ uint16_t restore_interrupted_gcode();
float __attribute__((noinline)) get_feedrate_mm_s(const float feedrate_mm_min);
#ifdef TMC2130
void check_Z_crash(void);
void homeaxis(uint8_t axis, uint8_t cnt = 1, uint8_t* pstep = 0);
#else
void homeaxis(uint8_t axis, uint8_t cnt = 1);
@ -247,13 +273,18 @@ extern float retract_length_swap;
extern float retract_recover_length_swap;
#endif
extern uint32_t starttime; // milliseconds
extern uint32_t pause_time; // milliseconds
extern uint32_t start_pause_print; // milliseconds
extern ShortTimer usb_timer;
extern bool processing_tcode;
extern bool homing_flag;
extern uint32_t total_filament_used; // mm/100 or 10um
/// @brief Save print statistics to EEPROM
void save_statistics();
/// @param _total_filament_used has unit mm/100 or 10um
/// @param _total_print_time has unit minutes, for example 123 minutes
void save_statistics(uint32_t _total_filament_used, uint32_t _total_print_time);
extern int fan_edge_counter[2];
extern int fan_speed[2];
@ -263,12 +294,14 @@ extern int fan_speed[2];
#define active_extruder 0
extern bool mesh_bed_leveling_flag;
extern bool did_pause_print;
// save/restore printing
extern bool saved_printing;
extern uint32_t saved_sdpos;
extern uint8_t saved_printing_type;
#define PRINTING_TYPE_SD 0
#define PRINTING_TYPE_USB 1
#define PRINTING_TYPE_NONE 2
extern uint16_t saved_extruder_temperature; //!< Active extruder temperature
extern uint8_t saved_bed_temperature; //!< Bed temperature
@ -295,18 +328,8 @@ extern LongTimer safetyTimer;
// the print is paused, that still counts as a "running" print.
bool printJobOngoing();
// Make debug_printer_states available everywhere
#ifdef DEBUG_PRINTER_STATES
void debug_printer_states();
#endif //DEBUG_PRINTER_STATES
// Printing is paused according to SD or host indicators
bool printingIsPaused();
bool printer_active();
bool printer_recovering();
//! Beware - mcode_in_progress is set as soon as the command gets really processed,
//! which is not the same as posting the M600 command into the command queue
//! There can be a considerable lag between posting M600 and its real processing which might result
@ -349,6 +372,9 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y);
#endif //HEATBED_ANALYSIS
float temp_comp_interpolation(float temperature);
#if 0
void show_fw_version_warnings();
#endif
uint8_t check_printer_version();
#ifdef PINDA_THERMISTOR
@ -366,13 +392,8 @@ void save_print_file_state();
void restore_print_file_state();
void save_planner_global_state();
void refresh_print_state_in_ram();
/// Updates the feedrate multiplier when a print is saved such that
/// it is not overwritten when the print is later resumed
void refresh_saved_feedrate_multiplier_in_ram();
void clear_print_state_in_ram();
extern void stop_and_save_print_to_ram(float z_move, float e_move);
void restore_file_from_sd();
void restore_extruder_temperature_from_ram();
extern void restore_print_from_ram_and_continue(float e_move);
extern void cancel_saved_printing();
@ -396,7 +417,7 @@ extern uint8_t calc_percent_done();
/*enum MarlinBusyState {
NOT_BUSY, // Not in a handler
IN_HANDLER, // Processing a GCode
IN_PROCESS, // Known to be blocking command input
IN_PROCESS, // Known to be blocking command input (as in G29)
PAUSED_FOR_USER, // Blocking pending any input
PAUSED_FOR_INPUT // Blocking pending text input (concept)
};*/
@ -436,10 +457,10 @@ void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex);
#define UVLO !(PINE & (1<<4))
void M600_load_filament(const char* filament_name);
void M600_load_filament_movements(const char* filament_name);
void M600_wait_for_user();
bool M600_check_state_and_repeat(const char* filament_name);
void M600_load_filament();
void M600_load_filament_movements();
void M600_wait_for_user(float HotendTempBckp);
void M600_check_state(float nozzle_temp);
void load_filament_final_feed();
void marlin_wait_for_click();
float raise_z(float delta);
@ -449,4 +470,5 @@ extern "C" void softReset();
void stack_error();
extern uint32_t IP_address;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,6 @@
#include "ultralcd.h"
#include "Filament_sensor.h"
#include "language.h"
#include "lcd.h"
#include "stopwatch.h"
#ifdef PRUSA_FARM
uint8_t farm_mode = 0;
@ -94,8 +92,8 @@ static void prusa_stat_printinfo() {
SERIAL_ECHOPGM("][FNM:");
SERIAL_ECHO(card.longFilename[0] ? card.longFilename : card.filename);
SERIAL_ECHOPGM("][TIM:");
if (print_job_timer.isRunning()) {
SERIAL_ECHO(print_job_timer.duration());
if (starttime != 0) {
SERIAL_ECHO((_millis() - starttime) / 1000);
}
else {
SERIAL_ECHO(0);
@ -165,7 +163,9 @@ static void trace() {
}
void serial_read_stream() {
disable_heater();
setTargetHotend(0);
setTargetBed(0);
lcd_clear();
lcd_puts_P(PSTR(" Upload in progress"));
@ -239,7 +239,7 @@ void prusa_statistics(uint8_t _message) {
if (busy_state == PAUSED_FOR_USER) {
prusa_statistics_case0(15);
}
else if (printingIsPaused()) {
else if (isPrintPaused) {
prusa_statistics_case0(14);
}
else if (IS_SD_PRINTING || (eFilamentAction != FilamentAction::None)) {
@ -404,7 +404,7 @@ void farm_mode_init() {
fsensor.setAutoLoadEnabled(false);
#endif //FILAMENT_SENSOR
// ~ FanCheck -> on
eeprom_update_byte_notify((uint8_t*)EEPROM_FAN_CHECK_ENABLED, true);
eeprom_update_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED, true);
}
}
@ -448,9 +448,9 @@ bool farm_prusa_code_seen() {
void farm_gcode_g98() {
farm_mode = 1;
eeprom_update_byte_notify((unsigned char *)EEPROM_FARM_MODE, farm_mode);
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
SilentModeMenu = SILENT_MODE_OFF;
eeprom_update_byte_notify((unsigned char *)EEPROM_SILENT, SilentModeMenu);
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
fCheckModeInit(); // alternatively invoke printer reset
}
@ -462,7 +462,7 @@ void farm_gcode_g99() {
void farm_disable() {
farm_mode = false;
eeprom_update_byte_notify((uint8_t*)EEPROM_FARM_MODE, farm_mode);
eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode);
}
#else //PRUSA_FARM

344
Firmware/Servo.cpp Normal file
View File

@ -0,0 +1,344 @@
/*
Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
The servos are pulsed in the background using the value most recently written using the write() method
Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
The methods are:
Servo - Class for manipulating servo motors connected to Arduino pins.
attach(pin ) - Attaches a servo motor to an i/o pin.
attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
default min is 544, max is 2400
write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
writeMicroseconds() - Sets the servo pulse width in microseconds
read() - Gets the last written servo pulse width as an angle between 0 and 180.
readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
attached() - Returns true if there is a servo attached.
detach() - Stops an attached servos from pulsing its i/o pin.
*/
#include "Configuration.h"
#ifdef NUM_SERVOS
#include <avr/interrupt.h>
#include <Arduino.h>
#include "Servo.h"
#define usToTicks(_us) (( clockCyclesPerMicrosecond()* _us) / 8) // converts microseconds to tick (assumes prescale of 8) // 12 Aug 2009
#define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds
#define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays // 12 August 2009
//#define NBR_TIMERS (MAX_SERVOS / SERVOS_PER_TIMER)
static servo_t servos[MAX_SERVOS]; // static array of servo structures
static volatile int8_t Channel[_Nbr_16timers ]; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
uint8_t ServoCount = 0; // the total number of attached servos
// convenience macros
#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / SERVOS_PER_TIMER)) // returns the timer controlling this servo
#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % SERVOS_PER_TIMER) // returns the index of the servo on this timer
#define SERVO_INDEX(_timer,_channel) ((_timer*SERVOS_PER_TIMER) + _channel) // macro to access servo index by timer and channel
#define SERVO(_timer,_channel) (servos[SERVO_INDEX(_timer,_channel)]) // macro to access servo class by timer and channel
#define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4) // minimum value in uS for this servo
#define SERVO_MAX() (MAX_PULSE_WIDTH - this->max * 4) // maximum value in uS for this servo
/************ static functions common to all instances ***********************/
static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t *TCNTn, volatile uint16_t* OCRnA)
{
if( Channel[timer] < 0 )
*TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer
else{
if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && SERVO(timer,Channel[timer]).Pin.isActive == true )
digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,LOW); // pulse this channel low if activated
}
Channel[timer]++; // increment to the next channel
if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
*OCRnA = *TCNTn + SERVO(timer,Channel[timer]).ticks;
if(SERVO(timer,Channel[timer]).Pin.isActive == true) // check if activated
digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // its an active channel so pulse it high
}
else {
// finished all channels so wait for the refresh period to expire before starting over
if( ((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL) ) // allow a few ticks to ensure the next OCR1A not missed
*OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL);
else
*OCRnA = *TCNTn + 4; // at least REFRESH_INTERVAL has elapsed
Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel
}
}
#ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
// Interrupt handlers for Arduino
#if defined(_useTimer1)
SIGNAL (TIMER1_COMPA_vect)
{
handle_interrupts(_timer1, &TCNT1, &OCR1A);
}
#endif
#if defined(_useTimer3)
SIGNAL (TIMER3_COMPA_vect)
{
handle_interrupts(_timer3, &TCNT3, &OCR3A);
}
#endif
#if defined(_useTimer4)
SIGNAL (TIMER4_COMPA_vect)
{
handle_interrupts(_timer4, &TCNT4, &OCR4A);
}
#endif
#if defined(_useTimer5)
SIGNAL (TIMER5_COMPA_vect)
{
handle_interrupts(_timer5, &TCNT5, &OCR5A);
}
#endif
#elif defined WIRING
// Interrupt handlers for Wiring
#if defined(_useTimer1)
void Timer1Service()
{
handle_interrupts(_timer1, &TCNT1, &OCR1A);
}
#endif
#if defined(_useTimer3)
void Timer3Service()
{
handle_interrupts(_timer3, &TCNT3, &OCR3A);
}
#endif
#endif
static void initISR(timer16_Sequence_t timer)
{
#if defined (_useTimer1)
if(timer == _timer1) {
TCCR1A = 0; // normal counting mode
TCCR1B = _BV(CS11); // set prescaler of 8
TCNT1 = 0; // clear the timer count
#if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
TIFR |= _BV(OCF1A); // clear any pending interrupts;
TIMSK |= _BV(OCIE1A) ; // enable the output compare interrupt
#else
// here if not ATmega8 or ATmega128
TIFR1 |= _BV(OCF1A); // clear any pending interrupts;
TIMSK1 |= _BV(OCIE1A) ; // enable the output compare interrupt
#endif
#if defined(WIRING)
timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
#endif
}
#endif
#if defined (_useTimer3)
if(timer == _timer3) {
TCCR3A = 0; // normal counting mode
TCCR3B = _BV(CS31); // set prescaler of 8
TCNT3 = 0; // clear the timer count
#if defined(__AVR_ATmega128__)
TIFR |= _BV(OCF3A); // clear any pending interrupts;
ETIMSK |= _BV(OCIE3A); // enable the output compare interrupt
#else
TIFR3 = _BV(OCF3A); // clear any pending interrupts;
TIMSK3 = _BV(OCIE3A) ; // enable the output compare interrupt
#endif
#if defined(WIRING)
timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only
#endif
}
#endif
#if defined (_useTimer4)
if(timer == _timer4) {
TCCR4A = 0; // normal counting mode
TCCR4B = _BV(CS41); // set prescaler of 8
TCNT4 = 0; // clear the timer count
TIFR4 = _BV(OCF4A); // clear any pending interrupts;
TIMSK4 = _BV(OCIE4A) ; // enable the output compare interrupt
}
#endif
#if defined (_useTimer5)
if(timer == _timer5) {
TCCR5A = 0; // normal counting mode
TCCR5B = _BV(CS51); // set prescaler of 8
TCNT5 = 0; // clear the timer count
TIFR5 = _BV(OCF5A); // clear any pending interrupts;
TIMSK5 = _BV(OCIE5A) ; // enable the output compare interrupt
}
#endif
}
static void finISR(timer16_Sequence_t timer)
{
//disable use of the given timer
#if defined WIRING // Wiring
if(timer == _timer1) {
#if defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
TIMSK1 &= ~_BV(OCIE1A) ; // disable timer 1 output compare interrupt
#else
TIMSK &= ~_BV(OCIE1A) ; // disable timer 1 output compare interrupt
#endif
timerDetach(TIMER1OUTCOMPAREA_INT);
}
else if(timer == _timer3) {
#if defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
TIMSK3 &= ~_BV(OCIE3A); // disable the timer3 output compare A interrupt
#else
ETIMSK &= ~_BV(OCIE3A); // disable the timer3 output compare A interrupt
#endif
timerDetach(TIMER3OUTCOMPAREA_INT);
}
#else
//For arduino - in future: call here to a currently undefined function to reset the timer
#endif
}
static bool isTimerActive(timer16_Sequence_t timer)
{
// returns true if any servo is active on this timer
for(uint8_t channel=0; channel < SERVOS_PER_TIMER; channel++) {
if(SERVO(timer,channel).Pin.isActive == true)
return true;
}
return false;
}
/****************** end of static functions ******************************/
Servo::Servo()
{
if( ServoCount < MAX_SERVOS) {
this->servoIndex = ServoCount++; // assign a servo index to this instance
servos[this->servoIndex].ticks = usToTicks(DEFAULT_PULSE_WIDTH); // store default values - 12 Aug 2009
}
else
this->servoIndex = INVALID_SERVO ; // too many servos
}
uint8_t Servo::attach(int pin)
{
return this->attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
}
uint8_t Servo::attach(int pin, int min, int max)
{
if(this->servoIndex < MAX_SERVOS ) {
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
if (pin > 0) this->pin = pin; else pin = this->pin;
#endif
pinMode( pin, OUTPUT) ; // set servo pin to output
servos[this->servoIndex].Pin.nbr = pin;
// todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
this->min = (MIN_PULSE_WIDTH - min)/4; //resolution of min/max is 4 uS
this->max = (MAX_PULSE_WIDTH - max)/4;
// initialize the timer if it has not already been initialized
timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
if(isTimerActive(timer) == false)
initISR(timer);
servos[this->servoIndex].Pin.isActive = true; // this must be set after the check for isTimerActive
}
return this->servoIndex ;
}
void Servo::detach()
{
servos[this->servoIndex].Pin.isActive = false;
timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
if(isTimerActive(timer) == false) {
finISR(timer);
}
}
void Servo::write(int value)
{
if(value < MIN_PULSE_WIDTH)
{ // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
if(value < 0) value = 0;
if(value > 180) value = 180;
value = map(value, 0, 180, SERVO_MIN(), SERVO_MAX());
}
this->writeMicroseconds(value);
}
void Servo::writeMicroseconds(int value)
{
// calculate and store the values for the given channel
byte channel = this->servoIndex;
if( (channel < MAX_SERVOS) ) // ensure channel is valid
{
if( value < SERVO_MIN() ) // ensure pulse width is valid
value = SERVO_MIN();
else if( value > SERVO_MAX() )
value = SERVO_MAX();
value = value - TRIM_DURATION;
value = usToTicks(value); // convert to ticks after compensating for interrupt overhead - 12 Aug 2009
uint8_t oldSREG = SREG;
cli();
servos[channel].ticks = value;
SREG = oldSREG;
}
}
int Servo::read() // return the value as degrees
{
return map( this->readMicroseconds()+1, SERVO_MIN(), SERVO_MAX(), 0, 180);
}
int Servo::readMicroseconds()
{
unsigned int pulsewidth;
if( this->servoIndex != INVALID_SERVO )
pulsewidth = ticksToUs(servos[this->servoIndex].ticks) + TRIM_DURATION ; // 12 aug 2009
else
pulsewidth = 0;
return pulsewidth;
}
bool Servo::attached()
{
return servos[this->servoIndex].Pin.isActive ;
}
#endif

135
Firmware/Servo.h Normal file
View File

@ -0,0 +1,135 @@
/*
Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
The servos are pulsed in the background using the value most recently written using the write() method
Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
The sequence used to seize timers is defined in timers.h
The methods are:
Servo - Class for manipulating servo motors connected to Arduino pins.
attach(pin ) - Attaches a servo motor to an i/o pin.
attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
default min is 544, max is 2400
write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
writeMicroseconds() - Sets the servo pulse width in microseconds
read() - Gets the last written servo pulse width as an angle between 0 and 180.
readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
attached() - Returns true if there is a servo attached.
detach() - Stops an attached servos from pulsing its i/o pin.
*/
#ifndef Servo_h
#define Servo_h
#include <inttypes.h>
/*
* Defines for 16 bit timers used with Servo library
*
* If _useTimerX is defined then TimerX is a 16 bit timer on the current board
* timer16_Sequence_t enumerates the sequence that the timers should be allocated
* _Nbr_16timers indicates how many 16 bit timers are available.
*
*/
// Say which 16 bit timers can be used and in what order
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define _useTimer5
//#define _useTimer1
#define _useTimer3
#define _useTimer4
//typedef enum { _timer5, _timer1, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer5, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_ATmega32U4__)
//#define _useTimer1
#define _useTimer3
//typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#define _useTimer3
//#define _useTimer1
//typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_ATmega128__) ||defined(__AVR_ATmega1281__) || defined(__AVR_ATmega1284P__) ||defined(__AVR_ATmega2561__)
#define _useTimer3
//#define _useTimer1
//typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#else // everything else
//#define _useTimer1
//typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _Nbr_16timers } timer16_Sequence_t ;
#endif
#define Servo_VERSION 2 // software version of this library
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
#define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
#define MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)
#define INVALID_SERVO 255 // flag indicating an invalid servo index
typedef struct {
uint8_t nbr :6 ; // a pin number from 0 to 63
uint8_t isActive :1 ; // true if this channel is enabled, pin not pulsed if false
} ServoPin_t ;
typedef struct {
ServoPin_t Pin;
unsigned int ticks;
} servo_t;
class Servo
{
public:
Servo();
uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure
uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
void detach();
void write(int value); // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
void writeMicroseconds(int value); // Write pulse width in microseconds
int read(); // returns current pulse width as an angle between 0 and 180 degrees
int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
bool attached(); // return true if this servo is attached, otherwise false
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
int pin; // store the hardware pin of the servo
#endif
private:
uint8_t servoIndex; // index into the channel data for this servo
int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH
int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH
};
#endif

View File

@ -30,9 +30,9 @@ void SpoolJoin::toggleSpoolJoin()
{
if (eeprom_read_byte((uint8_t*)EEPROM_SPOOL_JOIN) == (uint8_t)EEPROM::Disabled)
{
eeprom_update_byte_notify((uint8_t*)EEPROM_SPOOL_JOIN, (uint8_t)EEPROM::Enabled);
eeprom_write_byte((uint8_t*)EEPROM_SPOOL_JOIN, (uint8_t)EEPROM::Enabled);
} else {
eeprom_update_byte_notify((uint8_t*)EEPROM_SPOOL_JOIN, (uint8_t)EEPROM::Disabled);
eeprom_write_byte((uint8_t*)EEPROM_SPOOL_JOIN, (uint8_t)EEPROM::Disabled);
}
}
@ -55,7 +55,7 @@ uint8_t SpoolJoin::nextSlot()
SERIAL_ECHOPGM("SpoolJoin: ");
SERIAL_ECHO((int)currentMMUSlot);
if (currentMMUSlot >= MMU_FILAMENT_COUNT-1) currentMMUSlot = 0;
if (currentMMUSlot >= 4) currentMMUSlot = 0;
else currentMMUSlot++;
SERIAL_ECHOPGM(" -> ");

View File

@ -31,7 +31,7 @@ void TCodes(char *const strchr_pointer, const uint8_t codeValue) {
} else if (strchr_pointer[index] == 'x' || strchr_pointer[index] == '?'){
// load to extruder gears; if mmu is not present do nothing
if (MMU2::mmu2.Enabled()) {
MMU2::mmu2.tool_change(strchr_pointer[index], choose_menu_P(_T(MSG_SELECT_FILAMENT), MSG_FILAMENT));
MMU2::mmu2.tool_change(strchr_pointer[index], choose_menu_P(_T(MSG_SELECT_FILAMENT), _T(MSG_FILAMENT)));
}
} else if (strchr_pointer[index] == 'c'){
// load from extruder gears to nozzle (nozzle should be preheated)

View File

@ -6,6 +6,17 @@
#include "Timer.h"
#include "system_timer.h"
/**
* @brief construct Timer
*
* It is guaranteed, that construction is equivalent with zeroing all members.
* This property can be exploited in menu_data.
*/
template<typename T>
Timer<T>::Timer() : m_isRunning(false), m_started()
{
}
/**
* @brief Start timer
*/

View File

@ -17,10 +17,7 @@ template <class T>
class Timer
{
public:
inline constexpr Timer()
: m_isRunning(false)
, m_started(0) {};
Timer();
void start();
void stop(){m_isRunning = false;}
bool running()const {return m_isRunning;}

View File

@ -17,7 +17,7 @@ bool backlightSupport = 0; //only if it's true will any of the settings be visib
uint8_t backlightLevel_HIGH = 0;
uint8_t backlightLevel_LOW = 0;
uint8_t backlightMode = BACKLIGHT_MODE_BRIGHT;
int16_t backlightTimer_period = LCD_BACKLIGHT_TIMEOUT;
int16_t backlightTimer_period = 10;
LongTimer backlightTimer;
static void backlightTimer_reset() //used for resetting the timer and waking the display. Triggered on user interactions.
@ -32,7 +32,7 @@ void force_bl_on(bool section_start)
if (section_start)
{
backlightMode = BACKLIGHT_MODE_BRIGHT;
if (backlightLevel_HIGH < LCD_BACKLIGHT_FORCE_ON) backlightLevel_HIGH = LCD_BACKLIGHT_FORCE_ON;
if (backlightLevel_HIGH < 30) backlightLevel_HIGH = 30;
}
else
{
@ -62,10 +62,10 @@ void backlight_wake(const uint8_t flashNo)
void backlight_save() //saves all backlight data to eeprom.
{
eeprom_update_byte_notify((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, backlightLevel_HIGH);
eeprom_update_byte_notify((uint8_t *)EEPROM_BACKLIGHT_LEVEL_LOW, backlightLevel_LOW);
eeprom_update_byte_notify((uint8_t *)EEPROM_BACKLIGHT_MODE, backlightMode);
eeprom_update_word_notify((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, backlightTimer_period);
eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, backlightLevel_HIGH);
eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_LOW, backlightLevel_LOW);
eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_MODE, backlightMode);
eeprom_update_word((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, backlightTimer_period);
}
void backlight_update()
@ -93,9 +93,9 @@ void backlight_init()
//initialize backlight
backlightMode = eeprom_init_default_byte((uint8_t *)EEPROM_BACKLIGHT_MODE, BACKLIGHT_MODE_AUTO);
backlightLevel_HIGH = eeprom_init_default_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, LCD_BACKLIGHT_LEVEL_HIGH);
backlightLevel_LOW = eeprom_init_default_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_LOW, LCD_BACKLIGHT_LEVEL_LOW);
backlightTimer_period = eeprom_init_default_word((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, LCD_BACKLIGHT_TIMEOUT); // in seconds
backlightLevel_HIGH = eeprom_init_default_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, 130);
backlightLevel_LOW = eeprom_init_default_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_LOW, 50);
backlightTimer_period = eeprom_init_default_word((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, 10); // in seconds
SET_OUTPUT(LCD_BL_PIN);
backlightTimer_reset();

View File

@ -24,11 +24,12 @@ void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size)
{
cli();
boot_app_magic = BOOT_APP_MAGIC;
boot_app_flags |= BOOT_APP_FLG_COPY | BOOT_APP_FLG_ERASE;
boot_app_flags |= BOOT_APP_FLG_COPY;
boot_app_flags |= BOOT_APP_FLG_ERASE;
boot_copy_size = (uint16_t)size;
boot_src_addr = (uint32_t)rptr;
boot_dst_addr = (uint32_t)fptr;
// bootapp_print_vars();
bootapp_print_vars();
softReset();
}
@ -37,8 +38,7 @@ void bootapp_reboot_user0(uint8_t reserved)
cli();
boot_app_magic = BOOT_APP_MAGIC;
boot_app_flags = BOOT_APP_FLG_USER0;
boot_copy_size = 0;
boot_reserved = reserved;
// bootapp_print_vars();
bootapp_print_vars();
softReset();
}

View File

@ -17,10 +17,11 @@
#define BOOT_APP_FLG_ERASE 0x01
#define BOOT_APP_FLG_COPY 0x02
#define BOOT_APP_FLG_FLASH 0x04
#define BOOT_APP_FLG_RUN 0x08
#define BOOT_APP_FLG_USER0 0x80
#define BOOT_APP_MAGIC 0x55aa55aaUL
#define BOOT_APP_MAGIC 0x55aa55aa
#if defined(__cplusplus)

View File

@ -7,8 +7,6 @@
#include "temperature.h"
#include "language.h"
#include "Prusa_farm.h"
#include "power_panic.h"
#include "stopwatch.h"
#ifdef SDSUPPORT
@ -24,7 +22,7 @@ CardReader::CardReader()
filesize = 0;
sdpos = 0;
sdprinting = false;
mounted = false;
cardOK = false;
saving = false;
logging = false;
workDirDepth = 0;
@ -198,9 +196,9 @@ void CardReader::ls(ls_param params)
}
void CardReader::mount(bool doPresort/* = true*/)
void CardReader::initsd(bool doPresort/* = true*/)
{
mounted = false;
cardOK = false;
if(root.isOpen())
root.close();
#ifdef SDSLOW
@ -226,21 +224,33 @@ void CardReader::mount(bool doPresort/* = true*/)
}
else
{
mounted = true;
cardOK = true;
SERIAL_ECHO_START;
SERIAL_ECHOLNRPGM(_n("SD card ok"));////MSG_SD_CARD_OK
}
workDir=root;
curDir=&root;
workDirDepth = 0;
if (mounted)
#ifdef SDCARD_SORT_ALPHA
if (doPresort)
presort();
#endif
/*
if(!workDir.openRoot(&volume))
{
cdroot(doPresort);
SERIAL_ECHOLNPGM(MSG_SD_WORKDIR_FAIL);
}
*/
}
void __attribute__((noinline)) CardReader::cdroot(bool doPresort)
void CardReader::setroot(bool doPresort)
{
workDir=root;
workDirDepth = 0;
curDir=&workDir;
#ifdef SDCARD_SORT_ALPHA
if (doPresort)
@ -252,17 +262,16 @@ void __attribute__((noinline)) CardReader::cdroot(bool doPresort)
void CardReader::release()
{
sdprinting = false;
mounted = false;
cardOK = false;
SERIAL_ECHO_START;
SERIAL_ECHOLNRPGM(_n("SD card released"));////MSG_SD_CARD_RELEASED
}
void CardReader::startFileprint()
{
if(mounted)
if(cardOK)
{
sdprinting = true;
SetPrinterState(PrinterState::IsSDPrinting); //set printer state to hide LCD menu
#ifdef SDCARD_SORT_ALPHA
//flush_presort();
#endif
@ -334,7 +343,7 @@ bool CardReader::diveSubfolder (const char *&fileName)
const char *dirname_start, *dirname_end;
if (fileName[0] == '/') // absolute path
{
cdroot(false);
setroot(false);
dirname_start = fileName + 1;
while (*dirname_start)
{
@ -384,7 +393,7 @@ static const char ofSDPrinting[] PROGMEM = "SD-PRINTING";
static const char ofWritingToFile[] PROGMEM = "Writing to file: ";
void CardReader::openFileReadFilteredGcode(const char* name, bool replace_current/* = false*/){
if(!mounted)
if(!cardOK)
return;
if(file.isOpen()){ //replacing current file by new file, or subfile call
@ -449,7 +458,7 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren
void CardReader::openFileWrite(const char* name)
{
if(!mounted)
if(!cardOK)
return;
if(file.isOpen()){ //replacing current file by new file, or subfile call
#if 0
@ -513,7 +522,7 @@ void CardReader::openFileWrite(const char* name)
void CardReader::removeFile(const char* name)
{
if(!mounted) return;
if(!cardOK) return;
file.close();
sdprinting = false;
@ -546,9 +555,9 @@ uint32_t CardReader::getFileSize()
void CardReader::getStatus(bool arg_P)
{
if (printingIsPaused())
if (isPrintPaused)
{
if (saved_printing && (saved_printing_type == PowerPanic::PRINT_TYPE_SD))
if (saved_printing && (saved_printing_type == PRINTING_TYPE_SD))
SERIAL_PROTOCOLLNPGM("SD print paused");
else
SERIAL_PROTOCOLLNPGM("Print saved");
@ -567,7 +576,7 @@ void CardReader::getStatus(bool arg_P)
SERIAL_PROTOCOL(sdpos);
SERIAL_PROTOCOL('/');
SERIAL_PROTOCOLLN(filesize);
uint16_t time = print_job_timer.duration() / 60;
uint16_t time = ( _millis() - starttime ) / 60000U;
SERIAL_PROTOCOL((int)(time / 60));
SERIAL_PROTOCOL(':');
SERIAL_PROTOCOLLN((int)(time % 60));
@ -614,10 +623,10 @@ void CardReader::checkautostart(bool force)
return;
}
autostart_stilltocheck = false;
if(!mounted)
if(!cardOK)
{
mount();
if(!mounted) //fail
initsd();
if(!cardOK) //fail
return;
}
@ -802,7 +811,7 @@ void CardReader::presort() {
// If you use folders to organize, 20 may be enough
if (fileCnt > SDSORT_LIMIT) {
if ((sdSort != SD_SORT_NONE) && !farm_mode) {
lcd_show_fullscreen_message_and_wait_P(_T(MSG_FILE_CNT));
lcd_show_fullscreen_message_and_wait_P(_i("Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100."));////MSG_FILE_CNT c=20 r=6
}
fileCnt = SDSORT_LIMIT;
}
@ -1008,7 +1017,6 @@ void CardReader::printingHasFinished()
else
{
sdprinting = false;
SetPrinterState(PrinterState::SDPrintingFinished); //set printer state to show LCD menu after finished SD print
if(SD_FINISHED_STEPPERRELEASE)
{
finishAndDisableSteppers();
@ -1027,17 +1035,4 @@ bool CardReader::ToshibaFlashAir_GetIP(uint8_t *ip)
return card.readExtMemory(1, 1, 0x400+0x150, 4, ip);
}
//Used for Reprint action
bool CardReader::FileExists(const char* filename)
{
bool exists = false;
if (file.open(curDir, filename, O_READ))
{
exists = true;
file.close();
}
return exists;
}
#endif //SDSUPPORT

View File

@ -27,7 +27,7 @@ public:
inline ls_param(bool LFN, bool timestamp):LFN(LFN), timestamp(timestamp) { }
} __attribute__((packed));
void mount(bool doPresort = true);
void initsd(bool doPresort = true);
void write_command(char *buf);
void write_command_no_newline(char *buf);
//files auto[0-9].g on the sd card are performed in a row
@ -55,10 +55,11 @@ public:
void getDirName(char* name, uint8_t level);
uint8_t getWorkDirDepth();
void ls(ls_param params);
bool chdir(const char * relpath, bool doPresort);
void updir();
void cdroot(bool doPresort);
void setroot(bool doPresort);
#ifdef SDCARD_SORT_ALPHA
void presort();
@ -83,14 +84,11 @@ public:
void ToshibaFlashAir_enable(bool enable) { card.setFlashAirCompatible(enable); }
bool ToshibaFlashAir_GetIP(uint8_t *ip);
//Reprint
bool FileExists(const char* filename);
public:
bool saving;
bool logging;
bool sdprinting;
bool mounted;
bool sdprinting ;
bool cardOK ;
char filename[FILENAME_LENGTH];
// There are scenarios when simple modification time is not enough (on MS Windows)
// Therefore these timestamps hold the most recent one of creation/modification date/times

View File

@ -7,8 +7,6 @@
#include "meatpack.h"
#include "messages.h"
#include "language.h"
#include "stopwatch.h"
#include "power_panic.h"
// Reserve BUFSIZE lines of length MAX_CMD_SIZE plus CMDBUFFER_RESERVE_FRONT.
char cmdbuffer[BUFSIZE * (MAX_CMD_SIZE + 1) + CMDBUFFER_RESERVE_FRONT];
@ -368,7 +366,7 @@ void get_command()
}
// start of serial line processing loop
while (((MYSERIAL.available() > 0 && !saved_printing) || (MYSERIAL.available() > 0 && printingIsPaused())) && !cmdqueue_serial_disabled) { //is print is saved (crash detection or filament detection), dont process data from serial line
while (((MYSERIAL.available() > 0 && !saved_printing) || (MYSERIAL.available() > 0 && isPrintPaused)) && !cmdqueue_serial_disabled) { //is print is saved (crash detection or filament detection), dont process data from serial line
#ifdef ENABLE_MEATPACK
// MeatPack Changes
@ -481,11 +479,9 @@ void get_command()
allow_when_stopped = true;
// Handle the USB timer
if ((*cmd_start == 'G') && (GetPrinterState() != PrinterState::IsSDPrinting)) {
if ((*cmd_start == 'G') && !(IS_SD_PRINTING))
usb_timer.start();
SetPrinterState(PrinterState::IsHostPrinting); //set printer state busy printing to hide LCD menu while USB printing
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
}
if (allow_when_stopped == false && Stopped == true) {
// Stopped can be set either during error states (thermal error: cannot continue), or
// when a printer-initiated action is processed. In such case the printer will send to
@ -662,17 +658,16 @@ void get_command()
SERIAL_PROTOCOLLNRPGM(_n("Done printing file"));////MSG_FILE_PRINTED
char time[30];
uint32_t t = print_job_timer.duration() / 60;
uint32_t t = (_millis() - starttime - pause_time) / 60000;
pause_time = 0;
int hours, minutes;
minutes = t % 60;
hours = t / 60;
save_statistics();
save_statistics(total_filament_used, t);
sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes);
SERIAL_ECHO_START;
SERIAL_ECHOLN(time);
#ifndef SHOW_FILENAME_AFTER_FINISH
lcd_setstatus(time);
#endif //SHOW_FILENAME_AFTER_FINISH
card.printingHasFinished();
card.checkautostart(true);

View File

@ -26,7 +26,7 @@ void eeprom_init()
eeprom_init_default_dword((uint32_t*)EEPROM_MMU_MATERIAL_CHANGES, 0);
if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == EEPROM_EMPTY_VALUE)
{
eeprom_update_byte_notify(&(EEPROM_Sheets_base->active_sheet), 0);
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0);
// When upgrading from version older version (before multiple sheets were implemented in v3.8.0)
// Sheet 1 uses the previous Live adjust Z (@EEPROM_BABYSTEP_Z)
int last_babystep = eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z);
@ -46,12 +46,6 @@ void eeprom_init()
}
check_babystep();
// initialize custom mendel name in eeprom
if (eeprom_read_byte((uint8_t*)EEPROM_CUSTOM_MENDEL_NAME) == EEPROM_EMPTY_VALUE) {
//SERIAL_ECHOLN("Init Custom Mendel Name");
eeprom_update_block_notify(CUSTOM_MENDEL_NAME, (uint8_t*)EEPROM_CUSTOM_MENDEL_NAME, sizeof(CUSTOM_MENDEL_NAME));
} //else SERIAL_ECHOLN("Found Custom Mendel Name");
#ifdef PINDA_TEMP_COMP
eeprom_init_default_byte((uint8_t*)EEPROM_PINDA_TEMP_COMPENSATION, 0);
#endif //PINDA_TEMP_COMP
@ -66,11 +60,11 @@ void eeprom_init()
}
void eeprom_adjust_bed_reset() {
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_VALID, 1);
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_LEFT, 0);
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_RIGHT, 0);
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_FRONT, 0);
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_REAR, 0);
eeprom_update_byte((uint8_t*)EEPROM_BED_CORRECTION_VALID, 1);
eeprom_update_byte((uint8_t*)EEPROM_BED_CORRECTION_LEFT, 0);
eeprom_update_byte((uint8_t*)EEPROM_BED_CORRECTION_RIGHT, 0);
eeprom_update_byte((uint8_t*)EEPROM_BED_CORRECTION_FRONT, 0);
eeprom_update_byte((uint8_t*)EEPROM_BED_CORRECTION_REAR, 0);
}
//! @brief Get default sheet name for index
@ -137,175 +131,12 @@ int8_t eeprom_next_initialized_sheet(int8_t sheet)
return -1;
}
#ifdef DEBUG_EEPROM_CHANGES
static void eeprom_byte_notify(uint8_t *dst, uint8_t previous_value, uint8_t value, bool write) {
printf_P(PSTR("EEPROMChng b %s %u %d -> %d\n"), write ? "write":"", dst , previous_value, value);
}
static void eeprom_word_notify(uint16_t *dst, uint16_t previous_value, uint16_t value, bool write) {
printf_P(PSTR("EEPROMChng w %s %u %u -> %u\n"), write ? "write":"", dst , previous_value, value);
}
static void eeprom_dword_notify(uint32_t *dst, uint32_t previous_value, uint32_t value, bool write) {
printf_P(PSTR("EEPROMChng d %s %u %x -> %x\n"), write ? "write":"", reinterpret_cast<const uint16_t>(dst) , previous_value, value);
}
static void eeprom_float_notify(float *dst, float previous_value, float value, bool write) {
printf_P(PSTR("EEPROMChng f %s %u %f -> %f\n"), write ? "write":"", reinterpret_cast<const uint16_t>(dst) , previous_value, value);
}
static void eeprom_block_notify(void *dst, const uint8_t *previous_values, const uint8_t *values, size_t size, bool write) {
for(size_t i = 0; i < size; ++i){
if (previous_values[i] != values[i] || write) {
printf_P(PSTR("EEPROMChng bl %s %u %x -> %x\n"), write ? "write":"", reinterpret_cast<const uint16_t>(dst) + i, previous_values[i], values[i]);
}
}
}
#endif //DEBUG_EEPROM_CHANGES
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_byte_notify(uint8_t *dst, uint8_t value){
#else
void eeprom_write_byte_notify(uint8_t *dst, uint8_t value, bool active){
if (active) {
uint8_t previous_value = eeprom_read_byte(dst);
eeprom_byte_notify(dst, previous_value, value, true);
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_write_byte(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_byte_notify(uint8_t *dst, uint8_t value){
#else
void eeprom_update_byte_notify(uint8_t *dst, uint8_t value, bool active){
if (active) {
uint8_t previous_value = eeprom_read_byte(dst);
if (previous_value != value) {
eeprom_byte_notify(dst, previous_value, value, false);
}
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_update_byte(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_word_notify(uint16_t *dst, uint16_t value){
#else
void eeprom_write_word_notify(uint16_t *dst, uint16_t value, bool active){
if (active) {
uint16_t previous_value = eeprom_read_word(dst);
eeprom_word_notify(dst, previous_value, value, true);
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_write_word(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_word_notify(uint16_t *dst, uint16_t value){
#else
void eeprom_update_word_notify(uint16_t *dst, uint16_t value, bool active){
if (active) {
uint16_t previous_value = eeprom_read_word(dst);
if (previous_value != value) {
eeprom_word_notify(dst, previous_value, value, false);
}
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_update_word(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_dword_notify(uint32_t *dst, uint32_t value){
#else
void eeprom_write_dword_notify(uint32_t *dst, uint32_t value, bool active){
if (active) {
uint32_t previous_value = eeprom_read_dword(dst);
eeprom_dword_notify(dst, previous_value, value, true);
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_write_dword(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_dword_notify(uint32_t *dst, uint32_t value){
#else
void eeprom_update_dword_notify(uint32_t *dst, uint32_t value, bool active){
if (active) {
uint32_t previous_value = eeprom_read_dword(dst);
if (previous_value != value) {
eeprom_dword_notify(dst, previous_value, value, false);
}
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_update_dword(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_float_notify(float *dst, float value){
#else
void eeprom_write_float_notify(float *dst, float value, bool active){
if (active) {
float previous_value = eeprom_read_float(dst);
eeprom_float_notify(dst, previous_value, value, true);
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_write_float(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_float_notify(float *dst, float value){
#else
void eeprom_update_float_notify(float *dst, float value, bool active){
if (active) {
float previous_value = eeprom_read_float(dst);
if (previous_value != value) {
eeprom_float_notify(dst, previous_value, value, false);
}
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_update_float(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_block_notify(const void *__src, void *__dst, size_t __n){
eeprom_write_block(__src, __dst, __n);
#else
void eeprom_write_block_notify(const void *__src, void *__dst, size_t __n, bool active){
if (active) {
uint8_t previous_values[__n];
uint8_t new_values[__n];
eeprom_read_block(previous_values, __dst, __n);
eeprom_write_block(__src, __dst, __n);
eeprom_read_block(new_values, __dst, __n);
eeprom_block_notify(__dst, previous_values, new_values, __n, true);
}
#endif //DEBUG_EEPROM_CHANGES
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_block_notify(const void *__src, void *__dst, size_t __n){
eeprom_update_block(__src, __dst, __n);
#else
void eeprom_update_block_notify(const void *__src, void *__dst, size_t __n, bool active){
if (active) {
uint8_t previous_values[__n];
uint8_t new_values[__n];
eeprom_read_block(previous_values, __dst, __n);
eeprom_update_block(__src, __dst, __n);
eeprom_read_block(new_values, __dst, __n);
eeprom_block_notify(__dst, previous_values, new_values, __n, false);
}
#endif //DEBUG_EEPROM_CHANGES
}
void eeprom_switch_to_next_sheet()
{
int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
sheet = eeprom_next_initialized_sheet(sheet);
if (sheet >= 0) eeprom_update_byte_notify(&(EEPROM_Sheets_base->active_sheet), sheet);
if (sheet >= 0) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet);
}
bool __attribute__((noinline)) eeprom_is_sheet_initialized(uint8_t sheet_num) {
@ -326,44 +157,44 @@ void eeprom_update_block_P(const void *__src, void *__dst, size_t __n) {
const uint8_t *src = (const uint8_t*)__src;
uint8_t *dst = (uint8_t*)__dst;
while (__n--) {
eeprom_update_byte_notify(dst++, pgm_read_byte(src++));
eeprom_update_byte(dst++, pgm_read_byte(src++));
}
}
void eeprom_toggle(uint8_t *__p) {
eeprom_write_byte_notify(__p, !eeprom_read_byte(__p));
eeprom_write_byte(__p, !eeprom_read_byte(__p));
}
void __attribute__((noinline)) eeprom_increment_byte(uint8_t *__p) {
eeprom_write_byte_notify(__p, eeprom_read_byte(__p) + 1);
eeprom_write_byte(__p, eeprom_read_byte(__p) + 1);
}
void __attribute__((noinline)) eeprom_increment_word(uint16_t *__p) {
eeprom_write_word_notify(__p, eeprom_read_word(__p) + 1);
eeprom_write_word(__p, eeprom_read_word(__p) + 1);
}
void __attribute__((noinline)) eeprom_increment_dword(uint32_t *__p) {
eeprom_write_dword_notify(__p, eeprom_read_dword(__p) + 1);
eeprom_write_dword(__p, eeprom_read_dword(__p) + 1);
}
void __attribute__((noinline)) eeprom_add_byte(uint8_t *__p, uint8_t add) {
eeprom_write_byte_notify(__p, eeprom_read_byte(__p) + add);
eeprom_write_byte(__p, eeprom_read_byte(__p) + add);
}
void __attribute__((noinline)) eeprom_add_word(uint16_t *__p, uint16_t add) {
eeprom_write_word_notify(__p, eeprom_read_word(__p) + add);
eeprom_write_word(__p, eeprom_read_word(__p) + add);
}
void __attribute__((noinline)) eeprom_add_dword(uint32_t *__p, uint32_t add) {
eeprom_write_dword_notify(__p, eeprom_read_dword(__p) + add);
eeprom_write_dword(__p, eeprom_read_dword(__p) + add);
}
uint8_t __attribute__((noinline)) eeprom_init_default_byte(uint8_t *__p, uint8_t def) {
uint8_t val = eeprom_read_byte(__p);
if (val == EEPROM_EMPTY_VALUE) {
eeprom_write_byte_notify(__p, def);
eeprom_write_byte(__p, def);
return def;
}
return val;
@ -372,7 +203,7 @@ uint8_t __attribute__((noinline)) eeprom_init_default_byte(uint8_t *__p, uint8_t
uint16_t __attribute__((noinline)) eeprom_init_default_word(uint16_t *__p, uint16_t def) {
uint16_t val = eeprom_read_word(__p);
if (val == EEPROM_EMPTY_VALUE16) {
eeprom_write_word_notify(__p, def);
eeprom_write_word(__p, def);
return def;
}
return val;
@ -381,7 +212,7 @@ uint16_t __attribute__((noinline)) eeprom_init_default_word(uint16_t *__p, uint1
uint32_t __attribute__((noinline)) eeprom_init_default_dword(uint32_t *__p, uint32_t def) {
uint32_t val = eeprom_read_dword(__p);
if (val == EEPROM_EMPTY_VALUE32) {
eeprom_write_dword_notify(__p, def);
eeprom_write_dword(__p, def);
return def;
}
return val;
@ -389,12 +220,12 @@ uint32_t __attribute__((noinline)) eeprom_init_default_dword(uint32_t *__p, uint
void __attribute__((noinline)) eeprom_init_default_float(float *__p, float def) {
if (eeprom_read_dword((uint32_t*)__p) == EEPROM_EMPTY_VALUE32)
eeprom_write_float_notify(__p, def);
eeprom_write_float(__p, def);
}
void __attribute__((noinline)) eeprom_init_default_block(void *__p, size_t __n, const void *def) {
if (!eeprom_is_initialized_block(__p, __n))
eeprom_update_block_notify(def, __p, __n);
eeprom_update_block(def, __p, __n);
}
void __attribute__((noinline)) eeprom_init_default_block_P(void *__p, size_t __n, const void *def) {

View File

@ -12,24 +12,13 @@
#define EEPROM_H
#include <stdint.h>
#include <stddef.h>
#include "Configuration_var.h"
// Custom Mendel Name
#ifndef CUSTOM_MENDEL_NAME
#define CUSTOM_MENDEL_NAME "Prusa i3"
#endif
#define MAX_CUSTOM_MENDEL_NAME_LENGTH 17
// Sheets
#define MAX_SHEETS 8
#define MAX_SHEET_NAME_LENGTH 7
typedef struct
{
unsigned char name[MAX_SHEET_NAME_LENGTH]; //!< Can be null terminated, doesn't need to be null terminated
char name[MAX_SHEET_NAME_LENGTH]; //!< Can be null terminated, doesn't need to be null terminated
int16_t z_offset; //!< Z_BABYSTEP_MIN .. Z_BABYSTEP_MAX = Z_BABYSTEP_MIN*2/1000 [mm] .. Z_BABYSTEP_MAX*2/1000 [mm]
uint8_t bed_temp; //!< 0 .. 254 [°C] NOTE: currently only written-to and never used
uint8_t pinda_temp; //!< 0 .. 254 [°C] NOTE: currently only written-to and never used
@ -84,7 +73,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
To convert hex to dec https://www.rapidtables.com/convert/number/hex-to-decimal.html
Version: 3.14.1
Version: 1.0.2
---------------------------------------------------------------------------------
@ -96,9 +85,9 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 02h 2 | ^ | miniRambo Auto mode | ^ | ^
| 0x0FFE 4094 | uchar | EEPROM_LANG | 00h 0 | ffh 255 __L__ | English / LANG_ID_PRI | LCD menu | D3 Ax0ffe C1
| ^ | ^ | ^ | 01h 1 | ^ | Other language LANG_ID_SEC | ^ | ^
| 0x0FFC 4092 | uint16 | _EEPROM_FREE_NR10_ | ??? | ff ffh 65535 | _Free EEPROM space_ | _free space_ | D3 Ax0ffc C2
| 0x0FFA 4090 | uint16 | _EEPROM_FREE_NR11_ | ??? | ff ffh 65535 | _Free EEPROM space_ | _free space_ | D3 Ax0ffa C2
| 0x0FF8 4088 | uint16 | EEPROM_BABYSTEP_Z | ??? | ff ffh 65535 | Babystep for Z axis _legacy_ | ??? | D3 Ax0ff8 C2
| 0x0FFC 4092 | uint16 | EEPROM_BABYSTEP_X | ??? | ff ffh 65535 | Babystep for X axis _unsued_ | ??? | D3 Ax0ffc C2
| 0x0FFA 4090 | uint16 | EEPROM_BABYSTEP_Y | ??? | ff ffh 65535 | Babystep for Y axis _unsued_ | ^ | D3 Ax0ffa C2
| 0x0FF8 4088 | uint16 | EEPROM_BABYSTEP_Z | ??? | ff ffh 65535 | Babystep for Z axis _lagacy_ | ^ | D3 Ax0ff8 C2
| ^ | ^ | ^ | ^ | ^ | multiple values stored now in EEPROM_Sheets_base | ^ | ^
| 0x0FF7 4087 | uint8 | EEPROM_CALIBRATION_STATUS_V1 | ffh 255 | ffh 255 | Calibration status (<v3.12) | ??? | D3 Ax0ff7 C1
| ^ | ^ | ^ | 01h 1 | ^ | Calibrated | ^ | ^
@ -107,8 +96,8 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | f0h 240 | ^ __P__ | needs Z calibration | ^ | ^
| ^ | ^ | ^ | fah 250 | ^ | needs XYZ calibration | ^ | ^
| ^ | ^ | ^ | 00h 0 | ^ | Unknown (legacy) | ^ | ^
| 0x0FF5 4085 | uint16 | _EEPROM_FREE_NR12_ | ??? | ff ffh 65535 | _Free EEPROM space_ | _free space_ | D3 Ax0ff5 C2
| 0x0FF1 4081 | uint32 | EEPROM_FILAMENTUSED | ??? | 00 00 00 00h 0 __S/P__| Filament used in centimeters | ??? | D3 Ax0ff1 C4
| 0x0FF5 4085 | uint16 | EEPROM_BABYSTEP_Z0 | ??? | ff ffh 65535 | Babystep for Z ??? | ??? | D3 Ax0ff5 C2
| 0x0FF1 4081 | uint32 | EEPROM_FILAMENTUSED | ??? | 00 00 00 00h 0 __S/P__| Filament used in meters | ??? | D3 Ax0ff1 C4
| 0x0FED 4077 | uint32 | EEPROM_TOTALTIME | ??? | 00 00 00 00h 0 __S/P__| Total print time in minutes | ??? | D3 Ax0fed C4
| 0x0FE5 4069 | float | EEPROM_BED_CALIBRATION_CENTER | ??? | ff ff ff ffh | ??? | ??? | D3 Ax0fe5 C8
| 0x0FDD 4061 | float | EEPROM_BED_CALIBRATION_VEC_X | ??? | ff ff ff ffh | ??? | ??? | D3 Ax0fdd C8
@ -117,9 +106,9 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| 0x0FC4 4036 | bool | EEPROM_FARM_MODE | 00h 0 | ffh 255 __P__ | Prusa farm mode: __off__ | G99 | D3 Ax0fc4 C1
| ^ | ^ | ^ | 01h 1 | ^ | Prusa farm mode: __on__ | G98 | ^
| 0x0FC3 4035 | free | _EEPROM_FREE_NR1_ | ??? | ffh 255 | _Free EEPROM space_ | _free space_ | D3 Ax0fc3 C1
| 0x0FC1 4033 | ??? | _EEPROM_FREE_NR2_ | ??? | ff ffh 65535 | _Free EEPROM space_ | _free space_ | D3 Ax0fc1 C2
| 0x0FC0 4032 | bool | EEPROM_BED_CORRECTION_VALID | 00h 0 | 00h 0 | Bed correction: __invalid__ | ??? | D3 Ax0fc0 C1
| ^ | ^ | ^ | ffh 255 | ^ | Bed correction: __valid__ | ??? | ^
| 0x0FC1 4033 | ??? | EEPROM_FARM_NUMBER | 000-999 | ff ffh / 000 __P__ | Prusa farm number _only 0-9 are allowed: 000-999_ | LCD menu | D3 Ax0fc1 C2
| 0x0FC0 4032 | bool | EEPROM_BED_CORRECTION_VALID | 00h 0 | 00h 0 | Bed correction invalid | ??? | D3 Ax0fc0 C1
| ^ | ^ | ^ | ffh 255 | ^ | Bed correction valid | ??? | ^
| 0x0FBF 4031 | char | EEPROM_BED_CORRECTION_LEFT | 00h ffh | 00h 0 | Bed manual correction left | LCD menu | D3 Ax0fbf C1
| ^ | ^ | ^ | ^ | ^ | At this moment limited to +-100um | G80 Lxxx | ^
| 0x0FBE 4030 | char | EEPROM_BED_CORRECTION_RIGHT | 00h ffh | 00h 0 | Bed manual correction right | LCD menu | D3 Ax0fbe C1
@ -130,46 +119,42 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | ^ | ^ | At this moment limited to +-100um | G80 Bxxx | ^
| 0x0FBB 4027 | bool | EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY | 00h 0 | ffh 255 | Toshiba Air: __off__ | LCD menu | D3 Ax0fbb C1
| ^ | ^ | ^ | 01h 1 | ^ | Toshiba Air: __on__ | ^ | ^
| 0x0FBA 4026 | uint8 | _EEPROM_FREE_NR3_ | ??? | ??? | _Free EEPROM space_ | _free space_ | D3 Ax0fba C1
| 0x0FBA 4026 | uchar | EEPROM_PRINT_FLAG | ??? | ??? | _unsued_ | ??? | D3 Ax0fba C1
| 0x0FB0 4016 | int16 | EEPROM_PROBE_TEMP_SHIFT | ??? | ??? | ??? | ??? | D3 Ax0fb0 C10
| 0x0FAF 4015 | bool | EEPROM_TEMP_CAL_ACTIVE | 00h 0 | 00h 0 | PINDA Temp cal.: __inactive__ | LCD menu | D3 Ax0faf C1
| ^ | ^ | ^ | ffh 255 | ^ | PINDA Temp cal.: __active__ | ^ | ^
| 0x0FA7 4007 | ??? | _EEPROM_FREE_NR6_ | ??? | ffh 255 | _Free EEPROM space_ | _free space_ | D3 Ax0fae C8
| 0x0FA7 4007 | ??? | _EEPROM_FREE_NR6_ | ??? | ffh 255 | _Free EEPROM space_ | ??? | D3 Ax0fae C8
| ^ | ^ | ^ | ^ | 00 00 00 00h | ^ | ^ | ^
| 0x0FA6 4006 | uint8 | EEPROM_CALIBRATION_STATUS_PINDA | 00h 0 | ffh 255 | PINDA Temp: __not calibrated__ | ??? | D3 Ax0fa6 C1
| ^ | ^ | ^ | 01h 1 | ^ | PINDA Temp: __calibrated__ | ^ | ^
| 0x0FA5 4005 | uint8 | EEPROM_UVLO | 00h 0 | ffh 255 | No print job recovery is pending | Power panic | D3 Ax0fa5 C1
| ^ | ^ | ^ | 01h 1 | ^ | Print job recovery is pending | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | Print job recovery retry is pending | ^ | ^
| 0x0F9D 3997 | float | EEPROM_UVLO_CURRENT_POSITION | ??? | ffh 255 | Saved machine position (X and Y axis) | Power Panic | D3 Ax0f9d C8
| ^ | ^ | ^ | ??? | ^ | Y-axis | ^ | D3 Ax0fa1 C4
| ^ | ^ | ^ | ??? | ^ | X-axis | ^ | D3 Ax0f9d C4
| 0x0F95 3989 | char[8] | EEPROM_FILENAME | ??? | ffh 255 | SD print SFN without extension | Power Panic | D3 Ax0f95 C8
| 0x0F91 3985 | uint32 | EEPROM_FILE_POSITION | ??? | ff ff ff ffh | SD: file position, USB/Serial: last line number | Power Panic | D3 Ax0f91 C4
| 0x0F8D 3981 | float | EEPROM_UVLO_CURRENT_POSITION_Z | ??? | ff ff ff ffh | Saved machine position (Z axis) without MBL applied| Power Panic | D3 Ax0f8d C4
| 0x0F8C 3980 | uint8 | EEPROM_UVLO_PRINT_TYPE | 00h 0 | ffh 255 | print type: SD | Power Panic | D3 Ax0f8c C1
| ^ | ^ | ^ | 01h 1 | ^ | print type: USB / Serial | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | print type: None | ^ | ^
| 0x0F8B 3979 | uint8 | EEPROM_UVLO_TARGET_BED | ??? | ffh 255 | Saved bed target temperature | Power Panic | D3 Ax0f8b C1
| 0x0F89 3977 | uint16 | EEPROM_UVLO_FEEDRATE | ??? | ff ffh 65535 | Saved Feedrate | Power Panic | D3 Ax0f89 C2
| 0x0F88 3976 | uint8 | EEPROM_UVLO_FAN_SPEED | ??? | ffh 255 | Saved Fan speed | Power Panic | D3 Ax0f88 C1
| 0x0FA5 4005 | uint8 | EEPROM_UVLO | 00h 0 | ffh 255 | Power Panic flag: __inactive__ | ??? | D3 Ax0fa5 C1
| ^ | ^ | ^ | 01h 1 | ^ | Power Panic flag: __active__ | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | Power Panic flag: __???__ | ^ | ^
| 0x0F9D 3997 | float | EEPROM_UVLO_CURRENT_POSITION | ??? | ffh 255 | Power Panic position | ??? | D3 Ax0f9d C8
| 0x0F95 3989 | char | EEPROM_FILENAME | ??? | ffh 255 | Power Panic Filename | ??? | D3 Ax0f95 C8
| 0x0F91 3985 | unint32 | EEPROM_FILE_POSITION | ??? | ff ff ff ffh | Power Panic File Position | ??? | D3 Ax0f91 C4
| 0x0F8D 3981 | float | EEPROM_UVLO_CURRENT_POSITION_Z | ??? | ff ff ff ffh | Power Panic Z Position | ^ | D3 Ax0f8d C4
| 0x0F8C 3980 | ??? | EEPROM_UVLO_UNUSED_001 | ??? | ffh 255 | Power Panic _unused_ | ^ | D3 Ax0f8c C1
| 0x0F8B 3979 | uint8 | EEPROM_UVLO_TARGET_BED | ??? | ffh 255 | Power Panic Bed temperature | ^ | D3 Ax0f8b C1
| 0x0F89 3977 | uint16 | EEPROM_UVLO_FEEDRATE | ??? | ff ffh 65535 | Power Panic Feedrate | ^ | D3 Ax0f89 C2
| 0x0F88 3976 | uint8 | EEPROM_UVLO_FAN_SPEED | ??? | ffh 255 | Power Panic Fan speed | ^ | D3 Ax0f88 C1
| 0x0F87 3975 | uint8 | EEPROM_FAN_CHECK_ENABLED | 00h 0 | ??? | Fan Check __disabled__ | LCD menu | D3 Ax0f87 C1
| ^ | ^ | ^ | 01h 1 | ffh 255 | Fan Check __enabled__ | ^ | ^
| 0x0F75 3957 | uint16 | _EEPROM_FREE_NR7_ | ??? | ff ffh 65535 | _Free EEPROM space_ | _free space_ | D3 Ax0f75 C18
| 0x0F73 3955 | uint16 | _EEPROM_FREE_NR8_ | ??? | ff ffh 65535 | _Free EEPROM space_ | _free space_ | D3 Ax0f73 C2
| 0x0F72 3954 | uint8 | EEPROM_UVLO_E_ABS | ??? | ffh 0 | E axis was in relative mode (M83) | Power Panic | D3 Ax0f72 C1
| 0x0F72 3954 | uint8 | ^ | ??? | ffh 1 | E axis was in absolute mode (M82) | Power Panic | ^
| 0x0F6E 3950 | float | EEPROM_UVLO_CURRENT_POSITION_E | ??? | ff ff ff ffh | Saved machine position (E axis) | Power Panic | D3 Ax0f6e C4
| 0x0F6C 3948 | uint16 | EEPROM_UVLO_SAVED_SEGMENT_IDX | all | ff ffh 65535 | Saved index of multi-segment move | Power Panic | D3 Ax0f6c C2
| 0x0F75 3957 | uint16 | EEPROM_UVLO_MESH_BED_LEVELING | ??? | ff ffh 65535 | Power Panic Mesh Bed Leveling | ??? | D3 Ax0f75 C18
| 0x0F73 3955 | uint16 | EEPROM_UVLO_Z_MICROSTEPS | ??? | ff ffh 65535 | Power Panic Z microsteps | ??? | D3 Ax0f73 C2
| 0x0F72 3954 | uint8 | EEPROM_UVLO_E_ABS | ??? | ffh 255 | Power Panic ??? position | ??? | D3 Ax0f72 C1
| 0x0F6E 3950 | float | EEPROM_UVLO_CURRENT_POSITION_E | ??? | ff ff ff ffh | Power Panic E position | ??? | D3 Ax0f6e C4
| 0x0F6C 3948 | uint16 | EEPROM_UVLO_SAVED_SEGMENT_IDX | all | ff ffh 65535 | Power Panic index of multi-segment move | ??? | D3 Ax0f6c C2
| 0x0F6B 3947 | ??? | _EEPROM_FREE_NR4_ | ??? | ffh 255 | _Free EEPROM space_ | _free space_ | D3 Ax0f6b C1
| 0x0F6A 3946 | ??? | _EEPROM_FREE_NR5_ | ??? | ffh 255 | _Free EEPROM space_ | _free space_ | D3 Ax0f6a C1
| 0x0F69 3945 | uint8 | EEPROM_CRASH_DET | ffh 255 | ffh 255 | Crash detection: __enabled__ | LCD menu | D3 Ax0f69 C1
| ^ | ^ | ^ | 00h 0 | ^ | Crash detection: __disabled__ | LCD menu | ^
| 0x0F68 3944 | uint8 | EEPROM_CRASH_COUNT_Y | 00h-ffh 0-255| ffh 255 __S/P__ | Crash detection counter Y (last print) | Statistics | D3 Ax0f68 C1
| 0x0F68 3944 | uint8 | EEPROM_CRASH_COUNT_Y | 00h-ffh 0-255| ffh 255 __S/P__ | Crashes detected on y axis | ??? | D3 Ax0f68 C1
| 0x0F67 3943 | uint8 | EEPROM_FSENSOR | 01h 1 | ffh 255 __P__ | Filament sensor: __enabled__ | LCD menu | D3 Ax0f67 C1
| ^ | ^ | ^ | 00h 0 | ^ | Filament sensor: __disabled__ | LCD menu | ^
| 0x0F65 3942 | uint8 | EEPROM_CRASH_COUNT_X | 00h-ffh 0-255| ffh 255 __S/P__ | Crash detection counter X (last print) | Statistics | D3 Ax0f66 C1
| 0x0F65 3941 | uint8 | EEPROM_FERROR_COUNT | 00h-ffh 0-255| ffh 255 __S/P__ | Filament runout/error counter (last print) | Statistics | D3 Ax0f65 C1
| 0x0F64 3940 | uint8 | EEPROM_POWER_COUNT | 00h-ffh 0-255| ffh 255 __S/P__ | Power loss errors (last print) | Statistics | D3 Ax0f64 C1
| 0x0F65 3942 | uint8 | EEPROM_CRASH_COUNT_X | 00h-ffh 0-255| ffh 255 __S/P__ | Crashes detected on x axis | ??? | D3 Ax0f66 C1
| 0x0F65 3941 | uint8 | EEPROM_FERROR_COUNT | 00h-ffh 0-255| ffh 255 __S/P__ | Filament sensor error counter | ??? | D3 Ax0f65 C1
| 0x0F64 3940 | uint8 | EEPROM_POWER_COUNT | 00h-ffh 0-255| ffh 255 __S/P__ | Power failure counter | ??? | D3 Ax0f64 C1
| 0x0F60 3936 | float | EEPROM_XYZ_CAL_SKEW | ??? | ff ff ff ffh | XYZ skew value | ??? | D3 Ax0f60 C4
| 0x0F5F 3935 | uint8 | EEPROM_WIZARD_ACTIVE | 01h 1 | 01h 1 __P__ | Wizard __active__ | ??? | D3 Ax0f5f C1
| ^ | ^ | ^ | 00h 0 | ^ | Wizard __inactive__ | ^ | ^
@ -185,10 +170,10 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 01h 1 | ^ | RPi Port: __enabled__ | LCD menu | ^
| 0x0F07 3847 | uint8 | EEPROM_FSENS_AUTOLOAD_ENABLED | 01h 1 | ffh 255 __P__ | Filament autoload: __enabled__ | LCD menu | D3 Ax0f07 C1
| ^ | ^ | ^ | 00h 0 | ^ | Filament autoload: __disabled__ | LCD menu | ^
| 0x0F05 3845 | uint16 | EEPROM_CRASH_COUNT_X_TOT | 0000-fffe | ff ffh __S/P__ | Total crashes on x axis | Statistics | D3 Ax0f05 C2
| 0x0F03 3843 | uint16 | EEPROM_CRASH_COUNT_Y_TOT | 0000-fffe | ff ffh __S/P__ | Total crashes on y axis | Statistics | D3 Ax0f03 C2
| 0x0F01 3841 | uint16 | EEPROM_FERROR_COUNT_TOT | 0000-fffe | ff ffh __S/P__ | Total filament sensor errors | Statistics | D3 Ax0f01 C2
| 0x0EFF 3839 | uint16 | EEPROM_POWER_COUNT_TOT | 0000-fffe | ff ffh __S/P__ | Total power failures | Statistics | D3 Ax0eff C2
| 0x0F05 3845 | uint16 | EEPROM_CRASH_COUNT_X_TOT | 0000-fffe | ff ffh __S/P__ | Total crashes on x axis | ??? | D3 Ax0f05 C2
| 0x0F03 3843 | uint16 | EEPROM_CRASH_COUNT_Y_TOT | 0000-fffe | ff ffh __S/P__ | Total crashes on y axis | ??? | D3 Ax0f03 C2
| 0x0F01 3841 | uint16 | EEPROM_FERROR_COUNT_TOT | 0000-fffe | ff ffh __S/P__ | Total filament sensor errors | ??? | D3 Ax0f01 C2
| 0x0EFF 3839 | uint16 | EEPROM_POWER_COUNT_TOT | 0000-fffe | ff ffh __S/P__ | Total power failures | ??? | D3 Ax0eff C2
| 0x0EFE 3838 | uint8 | EEPROM_TMC2130_HOME_X_ORIGIN | ??? | ffh 255 | ??? | ??? | D3 Ax0efe C1
| 0x0EFD 3837 | uint8 | EEPROM_TMC2130_HOME_X_BSTEPS | ??? | ffh 255 | ??? | ??? | D3 Ax0efd C1
| 0x0EFC 3836 | uint8 | EEPROM_TMC2130_HOME_X_FSTEPS | ??? | ffh 255 | ??? | ??? | D3 Ax0efc C1
@ -224,29 +209,29 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | c8 00h 200 | ^ | BOARD_RAMBO_MINI_1_0 | ??? | ^
| ^ | ^ | ^ | cb 00h 203 | ^ | BOARD_RAMBO_MINI_1_3 | ??? | ^
| ^ | ^ | ^ | 36 01h 310 | ^ | BOARD_EINSY_1_0a | ??? | ^
| 0x0EE8 3816 | float | EEPROM_EXTRUDER_MULTIPLIER_0 | ??? | ff ff ff ffh | Extruder 0 multiplier | Power Panic | D3 Ax0ee8 C4
| 0x0EE4 3812 | float | EEPROM_EXTRUDER_MULTIPLIER_1 | ??? | ff ff ff ffh | Extruder 1 multiplier | Power Panic | D3 Ax0ee4 C4
| 0x0EE0 3808 | float | EEPROM_EXTRUDER_MULTIPLIER_2 | ??? | ff ff ff ffh | Extruder 2 multiplier | Power Panic | D3 Ax0ee0 C4
| 0x0EDE 3806 | uint16 | EEPROM_EXTRUDEMULTIPLY | ??? | ff ffh 65535 | Extruder multiplier | Power Panic | D3 Ax0ede C2
| 0x0EDA 3802 | float | EEPROM_UVLO_TINY_CURRENT_POSITION_Z | ??? | ff ff ff ffh | Saved Z-axis position when recovering print failed| Power Panic | D3 Ax0eda C4
| 0x0ED8 3800 | uint16 | EEPROM_UVLO_TARGET_HOTEND | ??? | ff ffh 65535 | Saved hotend target temperature | Power Panic | D3 Ax0ed8 C2
| 0x0EE8 3816 | float | EEPROM_EXTRUDER_MULTIPLIER_0 | ??? | ff ff ff ffh | Power panic Extruder 0 multiplier | ??? | D3 Ax0ee8 C4
| 0x0EE4 3812 | float | EEPROM_EXTRUDER_MULTIPLIER_1 | ??? | ff ff ff ffh | Power panic Extruder 1 multiplier | ??? | D3 Ax0ee4 C4
| 0x0EE0 3808 | float | EEPROM_EXTRUDER_MULTIPLIER_2 | ??? | ff ff ff ffh | Power panic Extruder 2 multiplier | ??? | D3 Ax0ee0 C4
| 0x0EDE 3806 | uint16 | EEPROM_EXTRUDEMULTIPLY | ??? | ff ffh 65535 | Power panic Extruder multiplier | ??? | D3 Ax0ede C2
| 0x0EDA 3802 | float | EEPROM_UVLO_TINY_CURRENT_POSITION_Z | ??? | ff ff ff ffh | Power panic Z position | ??? | D3 Ax0eda C4
| 0x0ED8 3800 | uint16 | EEPROM_UVLO_TARGET_HOTEND | ??? | ff ffh 65535 | Power panic target Hotend temperature | ??? | D3 Ax0ed8 C2
| 0x0ED7 3799 | uint8 | EEPROM_SOUND_MODE | 00h 0 | ffh 255 | Sound mode: __loud__ | ??? | D3 Ax0ed7 C1
| ^ | ^ | ^ | 01h 1 | ^ | Sound mode: __once__ | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | Sound mode: __silent__ | ^ | ^
| ^ | ^ | ^ | 03h 3 | ^ | Sound mode: __assist__ | ^ | ^
| 0x0ED6 3798 | bool | EEPROM_SPOOL_JOIN | 01h 1 | ffh 255 | SpoolJoin: __on__ | MMU | D3 Ax0ed6 C1
| ^ | ^ | ^ | 00h 0 | ^ | SpoolJoin: __off__ | ^ | ^
| 0x0ED6 3798 | bool | EEPROM_SPOOL_JOIN | 01h 1 | ffh 255 | MMU2/s autodeplete: __on__ | ??? | D3 Ax0ed6 C1
| ^ | ^ | ^ | 00h 0 | ^ | MMU2/s autodeplete: __off__ | ^ | ^
| 0x0ED5 3797 | bool | EEPROM_FSENS_RUNOUT_ENABLED | 01h 1 | ffh 255 __P__ | Filament runout: __enabled__ | LCD menu | D3 Ax0ed5 C1
| ^ | ^ | ^ | 00h 0 | ^ | Filament runout: __disabled__ | ^ | ^
| 0x0ED3 3795 | uint16 | EEPROM_MMU_FAIL_TOT | ??? | ff ffh 65535 __S/P__ | MMU total failures | LCD menu | D3 Ax0ed3 C2
| 0x0ED2 3794 | uint8 | EEPROM_MMU_FAIL | ??? | ffh 255 __S/P__ | MMU fails during print | LCD menu | D3 Ax0ed2 C1
| 0x0ED0 3792 | uint16 | EEPROM_MMU_LOAD_FAIL_TOT | ??? | ff ffh 65535 __S/P__ | MMU total load failures | LCD menu | D3 Ax0ed0 C2
| 0x0ECF 3791 | uint8 | EEPROM_MMU_LOAD_FAIL | ??? | ffh 255 __S/P__ | MMU load failures during print | LCD menu | D3 Ax0ecf C1
| 0x0ECE 3790 | uint8 | EEPROM_MMU_CUTTER_ENABLED | 00h 0 | ffh 255 | MMU cutter: __disabled__ | LCD menu | D3 Ax0ece C1
| ^ | ^ | ^ | 01h 1 | ^ | MMU cutter: __enabled__ | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | MMU cutter: __always__ | ^ | ^
| 0x0DAE 3502 | uint16 | EEPROM_UVLO_MESH_BED_LEVELING_FULL | ??? | ff ffh 65535 | Saved MBL points | Power Panic | D3 Ax0dae C288
| 0x0DAD 3501 | uint8 | _EEPROM_FREE_NR9_ | ??? | ffh 255 | _Free EEPROM space_ | _free space_ | D3 Ax0dad C1
| ^ | ^ | ^ | 00h 0 | ^ | Filament runout: __disabled__ | LCD menu | ^
| 0x0ED3 3795 | uint16 | EEPROM_MMU_FAIL_TOT | ??? | ff ffh 65535 __S/P__ | MMU2/s total failures | ??? | D3 Ax0ed3 C2
| 0x0ED2 3794 | uint8 | EEPROM_MMU_FAIL | ??? | ffh 255 __S/P__ | MMU2/s fails during print | ??? | D3 Ax0ed2 C1
| 0x0ED0 3792 | uint16 | EEPROM_MMU_LOAD_FAIL_TOT | ??? | ff ffh 65535 __S/P__ | MMU2/s total load failures | ??? | D3 Ax0ed0 C2
| 0x0ECF 3791 | uint8 | EEPROM_MMU_LOAD_FAIL | ??? | ffh 255 __S/P__ | MMU2/s load failures during print | ??? | D3 Ax0ecf C1
| 0x0ECE 3790 | uint8 | EEPROM_MMU_CUTTER_ENABLED | 00h 0 | ffh 255 | MMU2/s cutter: __disabled__ | LCD menu | D3 Ax0ece C1
| ^ | ^ | ^ | 01h 1 | ^ | MMU2/s cutter: __enabled__ | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | MMU2/s cutter: __always__ | ^ | ^
| 0x0DAE 3502 | uint16 | EEPROM_UVLO_MESH_BED_LEVELING_FULL | ??? | ff ffh 65535 | Power panic Mesh bed leveling points | ??? | D3 Ax0dae C288
| 0x0DAD 3501 | uint8 | EEPROM_MBL_TYPE | ??? | ffh 255 | Mesh bed leveling precision _unused atm_ | ??? | D3 Ax0dad C1
| 0x0DAC 3500 | bool | EEPROM_MBL_MAGNET_ELIMINATION | 01h 1 | ffh 255 | Mesh bed leveling does: __ignores__ magnets | LCD menu | D3 Ax0dac C1
| ^ | ^ | ^ | 00h 0 | ^ | Mesh bed leveling does: __NOT ignores__ magnets | ^ | ^
| 0x0DAB 3499 | uint8 | EEPROM_MBL_POINTS_NR | 03h 3 | ffh 255 | Mesh bed leveling points: __3x3__ | LCD menu | D3 Ax0dab C1
@ -254,8 +239,8 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| 0x0DAA 3498 | uint8 | EEPROM_MBL_PROBE_NR | 03h 3 | ffh 255 | MBL times measurements for each point: __3__ | LCD menu | D3 Ax0daa C1
| ^ | ^ | ^ | 05h 5 | ^ | MBL times measurements for each point: __5__ | ^ | ^
| ^ | ^ | ^ | 01h 1 | ^ | MBL times measurements for each point: __1__ | ^ | ^
| 0x0DA9 3497 | uint8 | EEPROM_MMU_STEALTH | 01h 1 | ffh 255 | MMU Silent mode: __on__ | LCD menu | D3 Ax0da9 C1
| ^ | ^ | ^ | 00h 0 | ^ | MMU Silent mode: __off__ | ^ | ^
| 0x0DA9 3497 | uint8 | EEPROM_MMU_STEALTH | 01h 1 | ffh 255 | MMU2/s Silent mode: __on__ | ??? | D3 Ax0da9 C1
| ^ | ^ | ^ | 00h 0 | ^ | MMU2/s Silent mode: __off__ | ^ | ^
| 0x0DA8 3496 | uint8 | EEPROM_CHECK_MODE | 01h 1 | ffh 255 | Check mode for nozzle is: __warn__ | LCD menu | D3 Ax0da8 C1
| ^ | ^ | ^ | 02h 2 | ^ | Check mode for nozzle is: __strict__ | ^ | ^
| ^ | ^ | ^ | 00h 0 | ^ | Check mode for nozzle is: __none__ | ^ | ^
@ -315,19 +300,19 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 01h 1 | ^ | Filament Sensor type IR 0.4 or newer | ^ | ^
| 0x0D47 3399 | uint8 | EEPROM_FSENSOR_ACTION_NA | 00h 0 | ffh 255 | Filament Sensor action: __Continue__ | LCD menu | D3 Ax0d47 C1
| ^ | ^ | ^ | 01h 1 | ^ | Filament Sensor action: __Pause__ | ^ | ^
| 0x0D37 3383 | float | EEPROM_UVLO_SAVED_START_POSITION | ??? | ff ff ff ffh | Saved start position all-axis | Power Panic | D3 Ax0d37 C16
| ^ | ^ | ^ | ??? | ^ | E-axis | ^ | D3 Ax0d43 C4
| ^ | ^ | ^ | ??? | ^ | Z-axis | ^ | D3 Ax0d3f C4
| ^ | ^ | ^ | ??? | ^ | Y-axis | ^ | D3 Ax0d3b C4
| ^ | ^ | ^ | ??? | ^ | X-axis | ^ | D3 Ax0d37 C4
| 0x0D35 3381 | uint16 | EEPROM_UVLO_FEEDMULTIPLY | ??? | ff ffh 65355 | Saved feed multiplier | Power Panic | D3 Ax0d35 C2
| 0x0D37 3383 | float | EEPROM_UVLO_SAVED_START_POSITION | ??? | ff ff ff ffh | Power panic saved start position all-axis | ??? | D3 Ax0d37 C16
| ^ | ^ | ^ | ??? | ^ | Power panic saved start position e-axis | ^ | D3 Ax0d43 C4
| ^ | ^ | ^ | ??? | ^ | Power panic saved start position z-axis | ^ | D3 Ax0d3f C4
| ^ | ^ | ^ | ??? | ^ | Power panic saved start position y-axis | ^ | D3 Ax0d3b C4
| ^ | ^ | ^ | ??? | ^ | Power panic saved start position x-axis | ^ | D3 Ax0d37 C4
| 0x0D35 3381 | uint16 | EEPROM_UVLO_FEEDMULTIPLY | ??? | ff ffh 65355 | Power panic saved feed multiplier | ??? | D3 Ax0d35 C2
| 0x0D34 3380 | uint8 | EEPROM_BACKLIGHT_LEVEL_HIGH | 00h - ffh | 82h 130 | LCD backlight bright: __128__ Dim value to 255 | LCD menu | D3 Ax0d34 C1
| 0x0D33 3379 | uint8 | EEPROM_BACKLIGHT_LEVEL_LOW | 00h - ffh | 32h 50 | LCD backlight dim: __50__ 0 to Bright value | LCD menu | D3 Ax0d33 C1
| 0x0D32 3378 | uint8 | EEPROM_BACKLIGHT_MODE | 02h 2 | ffh 255 | LCD backlight mode: __Auto__ | LCD menu | D3 Ax0d32 C1
| ^ | ^ | ^ | 01h 1 | ^ | LCD backlight mode: __Bright__ | ^ | ^
| ^ | ^ | ^ | 00h 0 | ^ | LCD backlight mode: __Dim__ | ^ | ^
| 0x0D30 3376 | uint16 | EEPROM_BACKLIGHT_TIMEOUT | 01 00 - ff ff| 0a 00h 65535 | LCD backlight timeout: __10__ seconds | LCD menu | D3 Ax0d30 C2
| 0x0D2C 3372 | float | EEPROM_UVLO_LA_K | ??? | ff ff ff ffh | Saved Linear Advanced K value | Power Panic | D3 Ax0d2c C4
| 0x0D2C 3372 | float | EEPROM_UVLO_LA_K | ??? | ff ff ff ffh | Power panic saved Linear Advanced K value | ??? | D3 Ax0d2c C4
| 0x0D2B 3371 | uint8 | EEPROM_ALTFAN_OVERRIDE | ffh 255 | ffh 255 | ALTFAN override unknown state | LCD menu | D3 Ax0d2b C1
| ^ | ^ | ^ | 00h 0 | ^ | ALTFAN override deactivated | ^ | ^
| ^ | ^ | ^ | 01h 1 | ^ | ALTFAN override activated | ^ | ^
@ -338,9 +323,9 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 00h 0 | ^ | PINDA has no temp compensation PINDA v1/2 | ^ | ^
| ^ | ^ | ^ | 01h 1 | ^ | PINDA has temp compensation aka SuperPINDA | ^ | ^
| 0x0D15 3349 | char[20]| EEPROM_PRUSA_SN | SN[19] == 0 | ffffffffffffffff... | PRUSA Serial number string | PRUSA SN | D3 Ax0d15 C20
| 0x0D11 3345 | float | EEPROM_UVLO_ACCELL | ??? | ff ff ff ffh | Saved print acceleration | Power Panic | D3 Ax0d11 C4
| 0x0D0D 3341 | float | EEPROM_UVLO_RETRACT_ACCELL | ??? | ff ff ff ffh | Saved retract acceleration | Power Panic | D3 Ax0d0d C4
| 0x0D09 3337 | float | EEPROM_UVLO_TRAVEL_ACCELL | ??? | ff ff ff ffh | Saved travel acceleration | Power Panic | D3 Ax0d09 C4
| 0x0D11 3345 | float | EEPROM_UVLO_ACCELL | ??? | ff ff ff ffh | Power panic saved normal acceleration | ??? | D3 Ax0d11 C4
| 0x0D0D 3341 | float | EEPROM_UVLO_RETRACT_ACCELL | ??? | ff ff ff ffh | Power panic saved retract acceleration | ??? | D3 Ax0d0d C4
| 0x0D09 3337 | float | EEPROM_UVLO_TRAVEL_ACCELL | ??? | ff ff ff ffh | Power panic saved travel acceleration | ??? | D3 Ax0d09 C4
| 0x0D05 3333 | unint32 | EEPROM_JOB_ID | ??? | 00 00 00 00h | Job ID used by host software | D3 only | D3 Ax0d05 C4
| 0x0D04 3332 | uint8 | EEPROM_ECOOL_ENABLE | ffh 255 | ^ | Disable extruder motor scaling for non-farm print | LCD menu | D3 Ax0d04 C1
| ^ | ^ | ^ | 2ah 42 | ^ | Enable extruder motor scaling for non-farm print | ^ | D3 Ax0d04 C1
@ -381,43 +366,6 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| 0x0C97 3223 | uint8 | EEPROM_THERMAL_MODEL_VER | 0-255 | ffh | Thermal Model Version | Thermal Model| D3 Ax0c97 C1
| 0x0C95 3221 | PGM_P | EEPROM_KILL_MESSAGE | 0-65535 | ff ffh | Kill message PGM pointer | kill() | D3 Ax0c95 C2
| 0x0C94 3220 | uint8 | EEPROM_KILL_PENDING_FLAG | 42h, ffh | ffh | Kill pending flag (0x42 magic value) | kill() | D3 Ax0c94 C1
| 0x0C91 3217 | char[3] | EEPROM_FILENAME_EXTENSION | ??? | ffffffffh | DOS 8.3 filename extension | Power Panic | D3 Ax0c91 C1
| 0x0C80 3200 | char[17]| EEPROM_CUSTOM_MENDEL_NAME | Prusa i3 MK3S| ffffffffffffffffff... | Custom Printer Name | | D3 Ax0c80 C17
| 0x0C7F 3199 | bool | EEPROM_UVLO_Z_LIFTED | 00h 0 | 00h | Power Panic Z axis NOT lifted | Power Panic | D3 Ax0c7f C1
| ^ | ^ | ^ | 01h 1 | 01h | Power Panic Z axis lifted | ^ | ^
| 0x0C7d 3197 | uint16 | EEPROM_UVLO_EXTRUDE_MINTEMP | 0-305 | afh 175 | Power Panic Extrude mintemp | Power Panic | D3 Ax0c7d C2
| 0x0C6D 3181 | uint32 | EEPROM_UVLO_ACCELL_MM_S2_NORMAL | ??? | ff ff ff ffh | Power Panic acceleration mm per s2 normal | Power Panic | D3 Ax0c6d C16
| ^ | ^ | ^ | ??? | ^ | E-axis | ^ | D3 Ax0c79 C4
| ^ | ^ | ^ | ??? | ^ | Z-axis | ^ | D3 Ax0c75 C4
| ^ | ^ | ^ | ??? | ^ | Y-axis | ^ | D3 Ax0c71 C4
| ^ | ^ | ^ | ??? | ^ | X-axis | ^ | D3 Ax0c6d C4
| 0x0C5D 3165 | uint32 | EEPROM_UVLO_ACCELL_MM_S2_SILENT | ??? | ff ff ff ffh | Power Panic acceleration mm per s2 silent | Power Panic | D3 Ax0c5d C16
| ^ | ^ | ^ | ??? | ^ | E-axis | ^ | D3 Ax0c69 C4
| ^ | ^ | ^ | ??? | ^ | Z-axis | ^ | D3 Ax0c65 C4
| ^ | ^ | ^ | ??? | ^ | Y-axis | ^ | D3 Ax0c61 C4
| ^ | ^ | ^ | ??? | ^ | X-axis | ^ | D3 Ax0c5d C4
| 0x0C4D 3149 | float | EEPROM_UVLO_MAX_FEEDRATE_NORMAL | ??? | ff ff ff ffh | Power Panic max feedrate normal | Power Panic | D3 Ax0c4d C16
| ^ | ^ | ^ | ??? | ^ | E-axis | ^ | D3 Ax0d59 C4
| ^ | ^ | ^ | ??? | ^ | Z-axis | ^ | D3 Ax0d55 C4
| ^ | ^ | ^ | ??? | ^ | Y-axis | ^ | D3 Ax0d51 C4
| ^ | ^ | ^ | ??? | ^ | X-axis | ^ | D3 Ax0c4d C4
| 0x0C3D 3133 | float | EEPROM_UVLO_MAX_FEEDRATE_SILENT | ??? | ff ff ff ffh | Power Panic max feedrate silent | Power Panic | D3 Ax0c3d C16
| ^ | ^ | ^ | ??? | ^ | E-axis | ^ | D3 Ax0d49 C4
| ^ | ^ | ^ | ??? | ^ | Z-axis | ^ | D3 Ax0d45 C4
| ^ | ^ | ^ | ??? | ^ | Y-axis | ^ | D3 Ax0d41 C4
| ^ | ^ | ^ | ??? | ^ | X-axis | ^ | D3 Ax0c3d C4
| 0x0C39 3129 | float | EEPROM_UVLO_MIN_FEEDRATE | ??? | ff ff ff ffh | Power Panic min feedrate | Power Panic | D3 Ax0c39 C4
| 0x0C35 3125 | float | EEPROM_UVLO_MIN_TRAVEL_FEEDRATE | ??? | ff ff ff ffh | Power Panic min travel feedrate | Power Panic | D3 Ax0c35 C4
| 0x0C31 3121 | uint32 | EEPROM_UVLO_MIN_SEGMENT_TIME_US | ??? | ff ff ff ffh | Power Panic min segment time us | Power Panic | D3 Ax0c31 C4
| 0x0C21 3105 | float | EEPROM_UVLO_MAX_JERK | ??? | ff ff ff ffh | Power Panic max jerk | Power Panic | D3 Ax0c21 C16
| ^ | ^ | ^ | ??? | ^ | E-axis | ^ | D3 Ax0d2d C4
| ^ | ^ | ^ | ??? | ^ | Z-axis | ^ | D3 Ax0d29 C4
| ^ | ^ | ^ | ??? | ^ | Y-axis | ^ | D3 Ax0d25 C4
| ^ | ^ | ^ | ??? | ^ | X-axis | ^ | D3 Ax0c21 C4
| 0x0C11 3089 | uint8 | EEPROM_CHECK_FILAMENT | 01h 1 | ffh 255 | Check mode for filament is: __warn__ | LCD menu | D3 Ax0c11 C1
| ^ | ^ | ^ | 02h 2 | ^ | Check mode for filament is: __strict__ | ^ | ^
| ^ | ^ | ^ | 00h 0 | ^ | Check mode for filament is: __none__ | ^ | ^
|Address begin|Bit/Type | Name | Valid values | Default/FactoryReset | Description |Gcode/Function| Debug code
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:
@ -437,11 +385,11 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
#define EEPROM_TOP 4096
#define EEPROM_SILENT 4095
#define EEPROM_LANG 4094
#define _EEPROM_FREE_NR10_ 4092 // uint16_t
#define _EEPROM_FREE_NR11_ 4090 // uint16_t
#define EEPROM_BABYSTEP_X 4092 //unused
#define EEPROM_BABYSTEP_Y 4090 //unused
#define EEPROM_BABYSTEP_Z 4088 //legacy, multiple values stored now in EEPROM_Sheets_base
#define EEPROM_CALIBRATION_STATUS_V1 4087 // legacy, used up to v3.11
#define _EEPROM_FREE_NR12_ (EEPROM_CALIBRATION_STATUS_V1 - 2) // uint16_t
#define EEPROM_BABYSTEP_Z0 4085
#define EEPROM_FILAMENTUSED 4081
// uint32_t
#define EEPROM_TOTALTIME 4077
@ -454,53 +402,54 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
// The offsets are saved as 16bit signed int, scaled to tenths of microns.
#define EEPROM_BED_CALIBRATION_Z_JITTER (EEPROM_BED_CALIBRATION_VEC_Y-2*8)
#define EEPROM_FARM_MODE (EEPROM_BED_CALIBRATION_Z_JITTER-1)
#define EEPROM_FREE_NR1 (EEPROM_FARM_MODE-1) // uint8_t
#define _EEPROM_FREE_NR2_ (EEPROM_FREE_NR1 - 2) // int16_t
#define EEPROM_FREE_NR1 (EEPROM_FARM_MODE-1)
#define EEPROM_FARM_NUMBER (EEPROM_FREE_NR1-2)
// Correction of the bed leveling, in micrometers.
// Maximum 50 micrometers allowed.
// Bed correction is valid if set to 1. If set to zero or 255, the successive 4 bytes are invalid.
#define EEPROM_BED_CORRECTION_VALID (_EEPROM_FREE_NR2_ - 1)
#define EEPROM_BED_CORRECTION_VALID (EEPROM_FARM_NUMBER-1)
#define EEPROM_BED_CORRECTION_LEFT (EEPROM_BED_CORRECTION_VALID-1)
#define EEPROM_BED_CORRECTION_RIGHT (EEPROM_BED_CORRECTION_LEFT-1)
#define EEPROM_BED_CORRECTION_FRONT (EEPROM_BED_CORRECTION_RIGHT-1)
#define EEPROM_BED_CORRECTION_REAR (EEPROM_BED_CORRECTION_FRONT-1)
#define EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY (EEPROM_BED_CORRECTION_REAR-1) // bool
#define _EEPROM_FREE_NR3_ (EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY - 1) // uint8_t
#define EEPROM_PROBE_TEMP_SHIFT (_EEPROM_FREE_NR3_ - 2*5) //5 x int for storing pinda probe temp shift relative to 50 C; unit: motor steps
#define EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY (EEPROM_BED_CORRECTION_REAR-1)
#define EEPROM_PRINT_FLAG (EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY-1)
#define EEPROM_PROBE_TEMP_SHIFT (EEPROM_PRINT_FLAG - 2*5) //5 x int for storing pinda probe temp shift relative to 50 C; unit: motor steps
#define EEPROM_TEMP_CAL_ACTIVE (EEPROM_PROBE_TEMP_SHIFT - 1)
#define _EEPROM_FREE_NR6_ (EEPROM_TEMP_CAL_ACTIVE - 2*4) //4 x int
#define _EEPROM_FREE_NR6_ (EEPROM_TEMP_CAL_ACTIVE - 2*4) //4 x int (used to be for bowden lengths for SNMM)
#define EEPROM_CALIBRATION_STATUS_PINDA (_EEPROM_FREE_NR6_ - 1) //0 - not calibrated; 1 - calibrated
#define EEPROM_UVLO (EEPROM_CALIBRATION_STATUS_PINDA - 1) // uint8_t
#define EEPROM_UVLO (EEPROM_CALIBRATION_STATUS_PINDA - 1) //1 - uvlo during print
#define EEPROM_UVLO_CURRENT_POSITION (EEPROM_UVLO-2*4) // 2 x float for current_position in X and Y axes
#define EEPROM_FILENAME (EEPROM_UVLO_CURRENT_POSITION - 8) //8chars to store filename without extension
#define EEPROM_FILE_POSITION (EEPROM_FILENAME - 4) //32 bit for uint32_t file position
#define EEPROM_UVLO_CURRENT_POSITION_Z (EEPROM_FILE_POSITION - 4) //float for current position in Z
#define EEPROM_UVLO_PRINT_TYPE (EEPROM_UVLO_CURRENT_POSITION_Z - 1) // uint8_t
#define EEPROM_UVLO_TARGET_BED (EEPROM_UVLO_PRINT_TYPE - 1)
#define EEPROM_UVLO_UNUSED_001 (EEPROM_UVLO_CURRENT_POSITION_Z - 1) // uint8_t (unused)
#define EEPROM_UVLO_TARGET_BED (EEPROM_UVLO_UNUSED_001 - 1)
#define EEPROM_UVLO_FEEDRATE (EEPROM_UVLO_TARGET_BED - 2) //uint16_t
#define EEPROM_UVLO_FAN_SPEED (EEPROM_UVLO_FEEDRATE - 1)
#define EEPROM_FAN_CHECK_ENABLED (EEPROM_UVLO_FAN_SPEED - 1)
#define _EEPROM_FREE_NR7_ (EEPROM_FAN_CHECK_ENABLED - 9*2) // 9 x uint16_t
#define _EEPROM_FREE_NR8_ (_EEPROM_FREE_NR7_ - 2) // uint16_t
#define EEPROM_UVLO_E_ABS (_EEPROM_FREE_NR8_ - 1) // uint8_t
#define EEPROM_UVLO_CURRENT_POSITION_E (EEPROM_UVLO_E_ABS - 4) // float
#define EEPROM_UVLO_MESH_BED_LEVELING (EEPROM_FAN_CHECK_ENABLED - 9*2)
#define EEPROM_UVLO_Z_MICROSTEPS (EEPROM_UVLO_MESH_BED_LEVELING - 2) // uint16_t (unused)
#define EEPROM_UVLO_E_ABS (EEPROM_UVLO_Z_MICROSTEPS - 1)
#define EEPROM_UVLO_CURRENT_POSITION_E (EEPROM_UVLO_E_ABS - 4) //float for current position in E
#define EEPROM_UVLO_SAVED_SEGMENT_IDX (EEPROM_UVLO_CURRENT_POSITION_E - 2) //uint16_t
#define EEPROM_FREE_NR4 (EEPROM_UVLO_SAVED_SEGMENT_IDX - 1) // uint8_t
#define EEPROM_FREE_NR5 (EEPROM_FREE_NR4 - 1) // uint8_t
#define EEPROM_FREE_NR4 (EEPROM_UVLO_SAVED_SEGMENT_IDX - 1) // FREE EEPROM SPACE
#define EEPROM_FREE_NR5 (EEPROM_FREE_NR4 - 1) // FREE EEPROM SPACE
#define EEPROM_CRASH_DET (EEPROM_FREE_NR5 - 1) // uint8_t
#define EEPROM_CRASH_COUNT_Y (EEPROM_CRASH_DET - 1) // uint8_t
#define EEPROM_FSENSOR (EEPROM_CRASH_COUNT_Y - 1) // uint8_t
#define EEPROM_CRASH_COUNT_X (EEPROM_FSENSOR - 1) // uint8_t
#define EEPROM_FERROR_COUNT (EEPROM_CRASH_COUNT_X - 1) // uint8_t
#define EEPROM_POWER_COUNT (EEPROM_FERROR_COUNT - 1) // uint8_t
// Crash detection mode EEPROM setting
#define EEPROM_CRASH_DET (EEPROM_FREE_NR5 - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-12)
// Crash detection counter Y (last print)
#define EEPROM_CRASH_COUNT_Y (EEPROM_CRASH_DET - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-15)
// Filament sensor on/off EEPROM setting
#define EEPROM_FSENSOR (EEPROM_CRASH_COUNT_Y - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-14)
// Crash detection counter X (last print)
#define EEPROM_CRASH_COUNT_X (EEPROM_FSENSOR - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-15)
// Filament runout/error coutner (last print)
#define EEPROM_FERROR_COUNT (EEPROM_CRASH_COUNT_X - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-16)
// Power loss errors (last print)
#define EEPROM_POWER_COUNT (EEPROM_FERROR_COUNT - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-17)
#define EEPROM_XYZ_CAL_SKEW (EEPROM_POWER_COUNT - 4) // float for skew backup
#define EEPROM_WIZARD_ACTIVE (EEPROM_XYZ_CAL_SKEW - 1) // 0: wizard not active, 1: wizard active, 2: wizard active without yes/no = forced calibrate Z after shipping/service prep.
@ -583,18 +532,17 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
#define EEPROM_MMU_FAIL_TOT (EEPROM_FSENS_RUNOUT_ENABLED - 2) //uint16_t
#define EEPROM_MMU_FAIL (EEPROM_MMU_FAIL_TOT - 1) //uint8_t
#define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) // uint16_t
#define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) // uint8_t
#define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1) // bool
#define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t
#define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t
#define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1)
#define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_CUTTER_ENABLED - 12*12*2) //allow 12 calibration points for future expansion
#define _EEPROM_FREE_NR9_ (EEPROM_UVLO_MESH_BED_LEVELING_FULL-1) // uint8_t
#define EEPROM_MBL_MAGNET_ELIMINATION (_EEPROM_FREE_NR9_ - 1)
#define EEPROM_MBL_TYPE (EEPROM_UVLO_MESH_BED_LEVELING_FULL-1) //uint8_t for mesh bed leveling precision
#define EEPROM_MBL_MAGNET_ELIMINATION (EEPROM_MBL_TYPE -1)
#define EEPROM_MBL_POINTS_NR (EEPROM_MBL_MAGNET_ELIMINATION -1) //uint8_t number of points in one exis for mesh bed leveling
#define EEPROM_MBL_PROBE_NR (EEPROM_MBL_POINTS_NR-1) //number of measurements for each point
#define EEPROM_MMU_STEALTH (EEPROM_MBL_PROBE_NR-1) // bool
#define EEPROM_MMU_STEALTH (EEPROM_MBL_PROBE_NR-1)
#define EEPROM_CHECK_MODE (EEPROM_MMU_STEALTH-1) // uint8
#define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8
@ -655,21 +603,9 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
#define EEPROM_KILL_MESSAGE (EEPROM_THERMAL_MODEL_VER-2) //PGM_P
#define EEPROM_KILL_PENDING_FLAG (EEPROM_KILL_MESSAGE-1) //uint8
#define EEPROM_FILENAME_EXTENSION (EEPROM_KILL_PENDING_FLAG - 3) // 3 x char
#define EEPROM_CUSTOM_MENDEL_NAME (EEPROM_FILENAME_EXTENSION-17) //char[17]
#define EEPROM_UVLO_Z_LIFTED (EEPROM_CUSTOM_MENDEL_NAME-1) //bool
#define EEPROM_UVLO_EXTRUDE_MINTEMP (EEPROM_UVLO_Z_LIFTED-2) //uint16_t
#define EEPROM_UVLO_ACCELL_MM_S2_NORMAL (EEPROM_UVLO_EXTRUDE_MINTEMP-4*4) // 4 x float
#define EEPROM_UVLO_ACCELL_MM_S2_SILENT (EEPROM_UVLO_ACCELL_MM_S2_NORMAL-4*4) // 4 x uint32_t
#define EEPROM_UVLO_MAX_FEEDRATE_NORMAL (EEPROM_UVLO_ACCELL_MM_S2_SILENT-4*4) // 4 x uint32_t
#define EEPROM_UVLO_MAX_FEEDRATE_SILENT (EEPROM_UVLO_MAX_FEEDRATE_NORMAL-4*4) // 4 x float
#define EEPROM_UVLO_MIN_FEEDRATE (EEPROM_UVLO_MAX_FEEDRATE_SILENT-4) //float
#define EEPROM_UVLO_MIN_TRAVEL_FEEDRATE (EEPROM_UVLO_MIN_FEEDRATE-4) //float
#define EEPROM_UVLO_MIN_SEGMENT_TIME_US (EEPROM_UVLO_MIN_TRAVEL_FEEDRATE-4) //uint32_t
#define EEPROM_UVLO_MAX_JERK (EEPROM_UVLO_MIN_SEGMENT_TIME_US-4*4) // 4 x float
#define EEPROM_CHECK_FILAMENT (EEPROM_UVLO_MAX_JERK-1) // uint8_t
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
#define EEPROM_LAST_ITEM EEPROM_CHECK_FILAMENT
#define EEPROM_LAST_ITEM EEPROM_KILL_PENDING_FLAG
// !!!!!
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
// !!!!!
@ -730,30 +666,6 @@ uint32_t eeprom_init_default_dword(uint32_t *__p, uint32_t def);
void eeprom_init_default_float(float *__p, float def);
void eeprom_init_default_block(void *__p, size_t __n, const void *def);
void eeprom_init_default_block_P(void *__p, size_t __n, const void *def);
/// Updates eeprom byte and notifies the changed eeprom address (just the address!) onto the serial line
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_byte_notify(uint8_t *dst, uint8_t value);
void eeprom_update_byte_notify(uint8_t *dst, uint8_t value);
void eeprom_write_word_notify(uint16_t *dst, uint16_t value);
void eeprom_update_word_notify(uint16_t *dst, uint16_t value);
void eeprom_write_dword_notify(uint32_t *dst, uint32_t value);
void eeprom_update_dword_notify(uint32_t *dst, uint32_t value);
void eeprom_write_float_notify(float *dst, float value);
void eeprom_update_float_notify(float *dst, float value);
void eeprom_write_block_notify(const void *__src, void *__dst , size_t __size);
void eeprom_update_block_notify(const void *__src, void *__dst, size_t __size);
#else
void eeprom_write_byte_notify(uint8_t *dst, uint8_t value, bool active = true);
void eeprom_update_byte_notify(uint8_t *dst, uint8_t value, bool active = true);
void eeprom_write_word_notify(uint16_t *dst, uint16_t value, bool active = true);
void eeprom_update_word_notify(uint16_t *dst, uint16_t value, bool active = true);
void eeprom_write_dword_notify(uint32_t *dst, uint32_t value, bool active = true);
void eeprom_update_dword_notify(uint32_t *dst, uint32_t value, bool active = true);
void eeprom_write_float_notify(float *dst, float value, bool active = true);
void eeprom_update_float_notify(float *dst, float value, bool active = true);
void eeprom_write_block_notify(const void *__src, void *__dst , size_t __size, bool active = true);
void eeprom_update_block_notify(const void *__src, void *__dst, size_t __size , bool active = true);
#endif //DEBUG_EEPROM_CHANGES
#endif
#endif // EEPROM_H

View File

@ -5,7 +5,6 @@
#include "messages.h"
#include "temperature.h"
#include "stepper.h"
#include "stopwatch.h"
#define FAN_CHECK_PERIOD 5000 //5s
#define FAN_CHECK_DURATION 100 //100ms
@ -94,7 +93,7 @@ void fanSpeedError(unsigned char _fan) {
if (printJobOngoing()) {
// A print is ongoing, pause the print normally
if(!printingIsPaused()) {
if(!isPrintPaused) {
if (usb_timer.running())
lcd_pause_usb_print();
else
@ -147,9 +146,8 @@ void checkFanSpeed()
if ((fan_check_error == EFCE_FIXED) && !printer_active()){
fan_check_error = EFCE_OK; //if the issue is fixed while the printer is doing nothing, reenable processing immediately.
lcd_reset_alert_level(); //for another fan speed error
lcd_setstatuspgm(MSG_WELCOME); // Reset the status line message to visually show the error is gone
}
if (fans_check_enabled && (fan_check_error != EFCE_REPORTED))
if (fans_check_enabled && (fan_check_error == EFCE_OK))
{
for (uint8_t fan = 0; fan < 2; fan++)
{
@ -238,7 +236,7 @@ bool extruder_altfan_detect()
void altfanOverride_toggle()
{
altfanStatus.altfanOverride = !altfanStatus.altfanOverride;
eeprom_update_byte_notify((uint8_t *)EEPROM_ALTFAN_OVERRIDE, altfanStatus.altfanOverride);
eeprom_update_byte((uint8_t *)EEPROM_ALTFAN_OVERRIDE, altfanStatus.altfanOverride);
}
bool altfanOverride_get()

View File

@ -37,31 +37,12 @@ static constexpr float spacing(float layer_height, float extrusion_width, float
static void lay1cal_common_enqueue_loop(const char * const * cmd_sequence, const uint8_t steps) {
for (uint8_t i = 0; i < steps; ++i)
{
void * const pgm_ptr = pgm_read_ptr(cmd_sequence + i);
// M702 is currently only used with MMU enabled
if (pgm_ptr == MSG_M702 && !MMU2::mmu2.Enabled()) {
continue;
}
enquecommand_P(static_cast<char*>(pgm_ptr));
enquecommand_P(static_cast<char*>(pgm_read_ptr(cmd_sequence + i)));
}
}
static const char extrude_fmt_X[] PROGMEM = "G1X%.4fE%.4f";
static const char extrude_fmt_Y[] PROGMEM = "G1Y%.4fE%.4f";
static const char zero_extrusion[] PROGMEM = "G92E0";
static const char feedrate_F1080[] PROGMEM = "G1F1080";
#ifndef NEW_FIRST_LAYER_CAL
static constexpr int8_t invert = 1;
static constexpr float short_length = 20;
static constexpr float square_width = short_length;
#else
static constexpr int8_t invert = -1;
static constexpr float short_length = 13.2812; //max_pos[1]/2 / meander * 2
static constexpr float square_width = short_length*2;
#endif //NEW_FIRST_LAYER_CAL
static constexpr float long_length = 150;
static const char extrude_fmt[] PROGMEM = "G1 X%d Y%d E%-.5f";
static const char zero_extrusion[] PROGMEM = "G92 E0";
//! @brief Wait for preheat
void lay1cal_wait_preheat()
@ -91,8 +72,8 @@ bool lay1cal_load_filament(uint8_t filament)
if (MMU2::mmu2.Enabled())
{
enquecommand_P(MSG_M83);
enquecommand_P(PSTR("G1Y-3F1000"));
enquecommand_P(PSTR("G1Z0.4"));
enquecommand_P(PSTR("G1 Y-3 F1000"));
enquecommand_P(PSTR("G1 Z0.4 F1000"));
uint8_t currentTool = MMU2::mmu2.get_current_tool();
if(currentTool == filament ){
@ -115,19 +96,22 @@ bool lay1cal_load_filament(uint8_t filament)
//! @param extrusion_width the width of the extrusion layer
void lay1cal_intro_line(bool extraPurgeNeeded, float layer_height, float extrusion_width)
{
static const char cmd_intro_mmu_3[] PROGMEM = "G1X55E29F1073";
static const char cmd_intro_mmu_4[] PROGMEM = "G1X5E29F1800";
static const char cmd_intro_mmu_5[] PROGMEM = "G1X55E8F2000";
static const char cmd_intro_mmu_6[] PROGMEM = "G1Z0.3F1000";
static const char cmd_intro_mmu_8[] PROGMEM = "G1X240E25F2200";
static const char cmd_intro_mmu_9[] PROGMEM = "G1Y-2F1000";
static const char cmd_intro_mmu_10[] PROGMEM = "G1X202.5E8F1400";
static const char cmd_intro_mmu_11[] PROGMEM = "G1Z0.2";
static const char * const cmd_intro_mmu[] PROGMEM =
static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55 E29 F1073";
static const char cmd_intro_mmu_4[] PROGMEM = "G1 X5 E29 F1800";
static const char cmd_intro_mmu_5[] PROGMEM = "G1 X55 E8 F2000";
static const char cmd_intro_mmu_6[] PROGMEM = "G1 Z0.3 F1000";
static const char cmd_intro_mmu_8[] PROGMEM = "G1 X240 E25 F2200";
static const char cmd_intro_mmu_9[] PROGMEM = "G1 Y-2 F1000";
static const char cmd_intro_mmu_10[] PROGMEM = "G1 X55 E25 F1400";
static const char cmd_intro_mmu_11[] PROGMEM = "G1 Z0.2 F1000";
static const char cmd_intro_mmu_12[] PROGMEM = "G1 X5 E4 F1000";
static const char * const intro_mmu_cmd[] PROGMEM =
{
// first 2 items are only relevant if filament was not loaded - i.e. extraPurgeNeeded == true
cmd_intro_mmu_3,
cmd_intro_mmu_4,
cmd_intro_mmu_5,
cmd_intro_mmu_6,
zero_extrusion,
@ -135,42 +119,42 @@ void lay1cal_intro_line(bool extraPurgeNeeded, float layer_height, float extrusi
cmd_intro_mmu_9,
cmd_intro_mmu_10,
cmd_intro_mmu_11,
cmd_intro_mmu_12,
};
if (MMU2::mmu2.Enabled())
{
for (uint8_t i = (extraPurgeNeeded ? 0 : 2); i < (sizeof(cmd_intro_mmu)/sizeof(cmd_intro_mmu[0])); ++i)
for (uint8_t i = (extraPurgeNeeded ? 0 : 2); i < (sizeof(intro_mmu_cmd)/sizeof(intro_mmu_cmd[0])); ++i)
{
enquecommand_P(static_cast<char*>(pgm_read_ptr(&cmd_intro_mmu[i])));
enquecommand_P(static_cast<char*>(pgm_read_ptr(&intro_mmu_cmd[i])));
}
}
else
{
enquecommand_P(feedrate_F1080); //fixed velocity for the intro line
enquecommandf_P(extrude_fmt_X, 60.f, count_e(layer_height, extrusion_width * 4.f, 60));
enquecommandf_P(extrude_fmt_X, 202.5f, count_e(layer_height, extrusion_width * 8.f, 142.5));
static const char fmt1[] PROGMEM = "G1 X%d E%-.3f F1000";
enquecommandf_P(fmt1, 60, count_e(layer_height, extrusion_width * 4.f, 60));
enquecommandf_P(fmt1, 100, count_e(layer_height, extrusion_width * 8.f, 40));
}
}
//! @brief Setup for printing meander
void lay1cal_before_meander()
{
#ifndef NEW_FIRST_LAYER_CAL
static const char cmd_pre_meander_4[] PROGMEM = "G1E-1.5F2100";
static const char cmd_pre_meander_5[] PROGMEM = "G1Z5F7200";
#endif //NEW_FIRST_LAYER_CAL
static const char cmd_pre_meander_6[] PROGMEM = "M204S1000"; //set acceleration
static const char cmd_pre_meander_2[] PROGMEM = "G90"; //use absolute coordinates
static const char cmd_pre_meander_4[] PROGMEM = "G1 E-1.5 F2100";
static const char cmd_pre_meander_5[] PROGMEM = "G1 Z5 F7200";
static const char cmd_pre_meander_6[] PROGMEM = "M204 S1000"; //set acceleration
static const char cmd_pre_meander_7[] PROGMEM = "G1 F4000";
static const char * const cmd_pre_meander[] PROGMEM =
{
zero_extrusion,
MSG_G90,
cmd_pre_meander_2,
MSG_M83, // use relative distances for extrusion
#ifndef NEW_FIRST_LAYER_CAL
cmd_pre_meander_4,
cmd_pre_meander_5,
#endif //NEW_FIRST_LAYER_CAL
cmd_pre_meander_6,
cmd_pre_meander_7,
};
lay1cal_common_enqueue_loop(cmd_pre_meander, (sizeof(cmd_pre_meander)/sizeof(cmd_pre_meander[0])));
@ -179,86 +163,88 @@ void lay1cal_before_meander()
//! @brief Print meander start
void lay1cal_meander_start(float layer_height, float extrusion_width)
{
#ifndef NEW_FIRST_LAYER_CAL
enquecommand_P(PSTR("G1X50Y155"));
#endif //_NEW_FIRST_LAYER_CAL
static const char fmt1[] PROGMEM = "G1Z%.2f";
enquecommand_P(PSTR("G1 X50 Y155"));
static const char fmt1[] PROGMEM = "G1 Z%-.3f F7200";
enquecommandf_P(fmt1, layer_height);
enquecommand_P(feedrate_F1080);
enquecommand_P(MSG_G91); //enable relative XYZ
#ifdef NEW_FIRST_LAYER_CAL
enquecommandf_P(extrude_fmt_Y, short_length, count_e(layer_height, extrusion_width, short_length));
enquecommandf_P(extrude_fmt_X, long_length*invert, count_e(layer_height, extrusion_width, long_length));
enquecommandf_P(extrude_fmt_Y, -short_length*invert, count_e(layer_height, extrusion_width, short_length));
#else
enquecommandf_P(extrude_fmt_X, 25.f*invert, count_e(layer_height, extrusion_width * 4.f, 25));
enquecommandf_P(extrude_fmt_X, 25.f*invert, count_e(layer_height, extrusion_width * 2.f, 25));
enquecommandf_P(extrude_fmt_X, 100.f*invert, count_e(layer_height, extrusion_width, 100));
enquecommandf_P(extrude_fmt_Y, -20.f*invert, count_e(layer_height, extrusion_width, 20));
#endif //_NEW_FIRST_LAYER_CAL
enquecommand_P(PSTR("G1 F1080"));
enquecommandf_P(extrude_fmt, 75, 155, count_e(layer_height, extrusion_width * 4.f, 25));
enquecommandf_P(extrude_fmt, 100, 155, count_e(layer_height, extrusion_width * 2.f, 25));
enquecommandf_P(extrude_fmt, 200, 155, count_e(layer_height, extrusion_width, 100));
enquecommandf_P(extrude_fmt, 200, 135, count_e(layer_height, extrusion_width, 20));
}
//! @brief Print meander
//! @param cmd_buffer character buffer needed to format gcodes
void lay1cal_meander(float layer_height, float extrusion_width)
{
const float short_length = 20;
float long_length = 150;
const float long_extrusion = count_e(layer_height, extrusion_width, long_length);
const float short_extrusion = count_e(layer_height, extrusion_width, short_length);
for(int8_t i = 0, xdir = -invert; i <= 4; i++, xdir = -xdir)
uint8_t y_pos = 135;
uint8_t x_pos = 50;
for(uint8_t i = 0; i <= 4; ++i)
{
enquecommandf_P(extrude_fmt_X, xdir * long_length, long_extrusion);
enquecommandf_P(extrude_fmt_Y, invert * -short_length, short_extrusion);
enquecommandf_P(extrude_fmt, x_pos, y_pos, long_extrusion);
y_pos -= short_length;
enquecommandf_P(extrude_fmt, x_pos, y_pos, short_extrusion);
x_pos += long_length;
long_length = -long_length;
}
#ifdef NEW_FIRST_LAYER_CAL
constexpr float mid_length = 0.5f * long_length - 0.5f * square_width;
const float mid_extrusion = count_e(layer_height, extrusion_width, mid_length);
enquecommandf_P(extrude_fmt_X, -mid_length, mid_extrusion); //~Middle of bed X125
enquecommandf_P(extrude_fmt_Y, short_length, short_extrusion); //~Middle of bed Y105
#endif //NEW_FIRST_LAYER_CAL
}
//! @brief Print square
//!
//! This function enqueues 4 lines of the square, so it needs to be called multiple times
//! This function needs to be called 4 times with step of 0,4,8,12
//!
//! @param cmd_buffer character buffer needed to format gcodes
void lay1cal_square(float layer_height, float extrusion_width)
//! @param i iteration
void lay1cal_square(uint8_t step, float layer_height, float extrusion_width)
{
const float Y_spacing = spacing(layer_height, extrusion_width);
const float long_extrusion = count_e(layer_height, extrusion_width, square_width);
const float short_extrusion = count_e(layer_height, extrusion_width, Y_spacing);
const float long_length = 20;
const float short_length = spacing(layer_height, extrusion_width);
const float long_extrusion = count_e(layer_height, extrusion_width, long_length);
const float short_extrusion = count_e(layer_height, extrusion_width, short_length);
static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f";
for (uint8_t i = 0; i < 4; i++)
for (uint8_t i = step; i < step+4; ++i)
{
enquecommandf_P(extrude_fmt_X, square_width*invert, long_extrusion);
enquecommandf_P(extrude_fmt_Y, -Y_spacing*invert, short_extrusion);
enquecommandf_P(extrude_fmt_X, -square_width*invert, long_extrusion);
enquecommandf_P(extrude_fmt_Y, -Y_spacing*invert, short_extrusion);
enquecommandf_P(fmt1, 70, (35 - i*short_length * 2), long_extrusion);
enquecommandf_P(fmt1, 70, (35 - (2 * i + 1)*short_length), short_extrusion);
enquecommandf_P(fmt1, 50, (35 - (2 * i + 1)*short_length), long_extrusion);
enquecommandf_P(fmt1, 50, (35 - (i + 1)*short_length * 2), short_extrusion);
}
}
void lay1cal_finish()
void lay1cal_finish(bool mmu_enabled)
{
static const char cmd_cal_finish_3[] PROGMEM = "G1E-0.075F2100"; // Retract
static const char cmd_cal_finish_4[] PROGMEM = "M140S0"; // Turn off bed heater
static const char cmd_cal_finish_5[] PROGMEM = "G1Z10F1300"; // Lift Z
static const char cmd_cal_finish_6[] PROGMEM = "G1X10Y180F4000"; // Go to parking position
static const char cmd_cal_finish_8[] PROGMEM = "M104S0"; // Turn off hotend heater
static const char cmd_cal_finish_1[] PROGMEM = "G1 E-0.075 F2100"; //retract
static const char cmd_cal_finish_2[] PROGMEM = "M104 S0"; // turn off temperature
static const char cmd_cal_finish_3[] PROGMEM = "M140 S0"; // turn off heatbed
static const char cmd_cal_finish_4[] PROGMEM = "G1 Z10 F1300"; //lift Z
static const char cmd_cal_finish_5[] PROGMEM = "G1 X10 Y180 F4000"; //Go to parking position
static const char * const cmd_cal_finish[] PROGMEM =
{
MSG_G90, // Set to Absolute Positioning
MSG_M107, // Turn off printer fan
cmd_cal_finish_3, // Retract
cmd_cal_finish_4, // Turn off bed heater
cmd_cal_finish_5, // Lift Z
cmd_cal_finish_6, // Go to parking position
MSG_M702, // Unload filament (MMU only)
cmd_cal_finish_8, // Turn off hotend heater
MSG_M84 // Disable stepper motors
MSG_M107, // turn off printer fan
cmd_cal_finish_1,
cmd_cal_finish_2,
cmd_cal_finish_3,
cmd_cal_finish_4,
cmd_cal_finish_5
};
lay1cal_common_enqueue_loop(cmd_cal_finish, (sizeof(cmd_cal_finish)/sizeof(cmd_cal_finish[0])));
if (mmu_enabled) enquecommand_P(MSG_M702); //unload from nozzle
enquecommand_P(MSG_M84);// disable motors
}

View File

@ -12,7 +12,7 @@ void lay1cal_intro_line(bool skipExtraPurge, float layer_height, float extrusion
void lay1cal_before_meander();
void lay1cal_meander_start(float layer_height, float extrusion_width);
void lay1cal_meander(float layer_height, float extrusion_width);
void lay1cal_square(float layer_height, float extrusion_width);
void lay1cal_finish();
void lay1cal_square(uint8_t step, float layer_height, float extrusion_width);
void lay1cal_finish(bool mmu_enabled);
#endif /* FIRMWARE_FIRST_LAY_CAL_H_ */

View File

@ -1,32 +0,0 @@
#include <string.h>
#include "Configuration_adv.h"
#include "host.h"
#include "Timer.h"
static LongTimer M79_timer;
static char host_status_screen_name[3];
void SetHostStatusScreenName(const char * name) {
strncpy(host_status_screen_name, name, 2);
host_status_screen_name[2] = '\0';
}
char * GetHostStatusScreenName() {
return host_status_screen_name;
}
void ResetHostStatusScreenName() {
memset(host_status_screen_name, 0, sizeof(host_status_screen_name));
}
void M79_timer_restart() {
M79_timer.start();
}
bool M79_timer_get_status() {
return M79_timer.running();
}
void M79_timer_update_status() {
M79_timer.expired(M79_TIMEOUT);
}

View File

@ -1,22 +0,0 @@
#pragma once
/// Assigns host name with up to two characters which will be shown on
/// the UI when printing. The function forces the third byte to be null delimiter.
void SetHostStatusScreenName(const char * name);
/// Returns a pointer to the host name
char * GetHostStatusScreenName();
/// Reset the memory to NULL when the host name should not be used
void ResetHostStatusScreenName();
/// Restart the M79 timer
void M79_timer_restart();
/// Get the current M79 timer status
/// @returns true if running, false otherwise
bool M79_timer_get_status();
/// Checks if the timer period has expired. If the timer
/// has expired, the timer is stopped
void M79_timer_update_status();

View File

@ -13,6 +13,14 @@
#define PROTOCOL_VERSION "1.0"
#ifndef CUSTOM_MENDEL_NAME
#define MACHINE_NAME "Mendel"
#endif
#ifndef MACHINE_UUID
#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
#endif
#if (LANG_MODE == 0) //primary language only
#define PROGMEM_I2 __attribute__((section(".progmem0")))
#define PROGMEM_I1 __attribute__((section(".progmem1")))

View File

@ -22,6 +22,8 @@
#define LCD_8BIT
#endif
// #define VT100
// commands
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02
@ -68,29 +70,35 @@ constexpr uint8_t row_offsets[] PROGMEM = { 0x00, 0x40, 0x14, 0x54 };
FILE _lcdout; // = {0}; Global variable is always zero initialized, no need to explicitly state that.
static uint8_t lcd_displayfunction = 0;
static uint8_t lcd_displaycontrol = 0;
static uint8_t lcd_displaymode = 0;
uint8_t lcd_displayfunction = 0;
uint8_t lcd_displaycontrol = 0;
uint8_t lcd_displaymode = 0;
uint8_t lcd_currline;
static uint8_t lcd_ddram_address; // no need for preventing ddram overflow
struct CustomCharacter {
uint8_t colByte;
uint8_t rowData[4];
char alternate;
};
static uint8_t lcd_custom_characters[8] = {0};
static const CustomCharacter Font[] PROGMEM = {
#include "FontTable.h"
};
#define CUSTOM_CHARACTERS_CNT (sizeof(Font) / sizeof(Font[0]))
#ifdef VT100
uint8_t lcd_escape[8];
#endif
static void lcd_display(void);
static void lcd_print_custom(uint8_t c);
static void lcd_invalidate_custom_characters();
#if 0
static void lcd_no_display(void);
static void lcd_no_cursor(void);
static void lcd_cursor(void);
static void lcd_no_blink(void);
static void lcd_blink(void);
static void lcd_scrollDisplayLeft(void);
static void lcd_scrollDisplayRight(void);
static void lcd_leftToRight(void);
static void lcd_rightToLeft(void);
static void lcd_autoscroll(void);
static void lcd_no_autoscroll(void);
#endif
#ifdef VT100
void lcd_escape_write(uint8_t chr);
#endif
static void lcd_pulseEnable(void)
{
@ -136,23 +144,24 @@ static void lcd_command(uint8_t value, uint16_t duration = LCD_DEFAULT_DELAY)
static void lcd_write(uint8_t value)
{
if (value == '\n') {
if (value == '\n')
{
if (lcd_currline > 3) lcd_currline = -1;
lcd_set_cursor(0, lcd_currline + 1); // LF
} else if ((value >= 0x80) && (value < (0x80 + CUSTOM_CHARACTERS_CNT))) {
lcd_print_custom(value);
} else {
lcd_send(value, HIGH);
lcd_ddram_address++; // no need for preventing ddram overflow
return;
}
#ifdef VT100
if (lcd_escape[0] || (value == 0x1b)){
lcd_escape_write(value);
return;
}
#endif
lcd_send(value, HIGH);
}
static void lcd_begin(uint8_t clear)
{
lcd_currline = 0;
lcd_ddram_address = 0;
lcd_invalidate_custom_characters();
lcd_send(LCD_FUNCTIONSET | LCD_8BITMODE, LOW | LCD_HALF_FLAG, 4500); // wait min 4.1ms
// second try
@ -175,6 +184,10 @@ static void lcd_begin(uint8_t clear)
lcd_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
// set the entry mode
lcd_command(LCD_ENTRYMODESET | lcd_displaymode);
#ifdef VT100
lcd_escape[0] = 0;
#endif
}
static int lcd_putchar(char c, FILE *)
@ -212,27 +225,25 @@ void lcd_init(void)
void lcd_refresh(void)
{
lcd_begin(1);
lcd_set_custom_characters();
}
void lcd_refresh_noclear(void)
{
lcd_begin(0);
lcd_set_custom_characters();
}
// Clear display, set cursor position to zero and unshift the display. It also invalidates all custom characters
void lcd_clear(void)
{
lcd_command(LCD_CLEARDISPLAY, 1600);
lcd_command(LCD_CLEARDISPLAY, 1600); // clear display, set cursor position to zero
lcd_currline = 0;
lcd_ddram_address = 0;
lcd_invalidate_custom_characters();
}
// Set cursor position to zero and in DDRAM. It does not unshift the display.
void lcd_home(void)
{
lcd_set_cursor(0, 0);
lcd_ddram_address = 0;
lcd_command(LCD_RETURNHOME, 1600); // set cursor position to zero
lcd_currline = 0;
}
// Turn the display on/off (quickly)
@ -242,6 +253,83 @@ void lcd_display(void)
lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol);
}
#if 0
void lcd_no_display(void)
{
lcd_displaycontrol &= ~LCD_DISPLAYON;
lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol);
}
#endif
#ifdef VT100 //required functions for VT100
// Turns the underline cursor on/off
void lcd_no_cursor(void)
{
lcd_displaycontrol &= ~LCD_CURSORON;
lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol);
}
void lcd_cursor(void)
{
lcd_displaycontrol |= LCD_CURSORON;
lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol);
}
#endif
#if 0
// Turn on and off the blinking cursor
void lcd_no_blink(void)
{
lcd_displaycontrol &= ~LCD_BLINKON;
lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol);
}
void lcd_blink(void)
{
lcd_displaycontrol |= LCD_BLINKON;
lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol);
}
// These commands scroll the display without changing the RAM
void lcd_scrollDisplayLeft(void)
{
lcd_command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
}
void lcd_scrollDisplayRight(void)
{
lcd_command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
}
// This is for text that flows Left to Right
void lcd_leftToRight(void)
{
lcd_displaymode |= LCD_ENTRYLEFT;
lcd_command(LCD_ENTRYMODESET | lcd_displaymode);
}
// This is for text that flows Right to Left
void lcd_rightToLeft(void)
{
lcd_displaymode &= ~LCD_ENTRYLEFT;
lcd_command(LCD_ENTRYMODESET | lcd_displaymode);
}
// This will 'right justify' text from the cursor
void lcd_autoscroll(void)
{
lcd_displaymode |= LCD_ENTRYSHIFTINCREMENT;
lcd_command(LCD_ENTRYMODESET | lcd_displaymode);
}
// This will 'left justify' text from the cursor
void lcd_no_autoscroll(void)
{
lcd_displaymode &= ~LCD_ENTRYSHIFTINCREMENT;
lcd_command(LCD_ENTRYMODESET | lcd_displaymode);
}
#endif
/// @brief set the current LCD row
/// @param row LCD row number, ranges from 0 to LCD_HEIGHT - 1
static void FORCE_INLINE lcd_set_current_row(uint8_t row)
@ -260,76 +348,162 @@ static uint8_t __attribute__((noinline)) lcd_get_row_offset(uint8_t row)
void lcd_set_cursor(uint8_t col, uint8_t row)
{
lcd_set_current_row(row);
uint8_t addr = col + lcd_get_row_offset(lcd_currline);
lcd_ddram_address = addr;
lcd_command(LCD_SETDDRAMADDR | addr);
lcd_command(LCD_SETDDRAMADDR | (col + lcd_get_row_offset(lcd_currline)));
}
void lcd_set_cursor_column(uint8_t col)
{
uint8_t addr = col + lcd_get_row_offset(lcd_currline);
lcd_ddram_address = addr;
lcd_command(LCD_SETDDRAMADDR | addr);
lcd_command(LCD_SETDDRAMADDR | (col + lcd_get_row_offset(lcd_currline)));
}
// Allows us to fill the first 8 CGRAM locations
// with custom characters
void lcd_createChar_P(uint8_t location, const CustomCharacter *char_p)
void lcd_createChar_P(uint8_t location, const uint8_t* charmap)
{
uint8_t charmap[8]; // unpacked font data
// The LCD expects the CGRAM data to be sent as pixel data, row by row. Since there are 8 rows per character, 8 bytes need to be sent.
// However, storing the data in the flash as the LCD expects it is wasteful since 3 bits per row are don't care and are not used.
// Therefore, flash can be saved if the character data is packed. For the AVR to unpack efficiently and quickly, the following scheme was used:
//
// colbyte data0 data1 data2 data3
// a b c d e
//
// ** ** ** b7 b6 b5 b4 a0
// ** ** ** b3 b2 b1 b0 a1
// ** ** ** c7 c6 c5 c4 a2
// ** ** ** c3 c2 c1 c0 a3
// ** ** ** d7 d6 d5 d4 a4
// ** ** ** d3 d2 d1 d0 a5
// ** ** ** e7 e6 e5 e4 a6
// ** ** ** e3 e2 e1 e0 a7
//
// The bits marked as ** in the unpacked data are don't care and they will contain garbage.
uint8_t temp;
uint8_t colByte;
__asm__ __volatile__ (
// load colByte
"lpm %1, Z+" "\n\t"
// begin for loop
"ldi %0, 8" "\n\t"
"mov __zero_reg__, %0" "\n\t" // use zero_reg as loop counter
"forBegin_%=: " "\n\t"
"sbrs __zero_reg__, 0" "\n\t" // test LSB of counter. Fetch new data if counter is even
"lpm __tmp_reg__, Z+" "\n\t" // load next data byte from progmem, increment
"swap __tmp_reg__" "\n\t" // swap the nibbles
"mov %0, __tmp_reg__" "\n\t" // copy row data to temp
// "andi %0, 0xF" "\n\t" // mask lower nibble - Not needed since bits 7-5 of the CGRAM are don't care, so they can contain garbage
"ror %1" "\n\t" // consume LSB of colByte and push it to the carry
"rol %0" "\n\t" // insert the column LSB from carry
"st %a3+, %0" "\n\t" // push the generated row data to the output
// end for loop
"dec __zero_reg__" "\n\t"
"brne forBegin_%=" "\n\t"
: "=&d" (temp), "=&r" (colByte)
: "z" (char_p), "e" (charmap)
);
location &= 0x7; // we only have 8 locations 0-7
lcd_command(LCD_SETCGRAMADDR | (location << 3));
for (uint8_t i = 0; i < 8; i++) {
lcd_send(charmap[i], HIGH);
}
lcd_command(LCD_SETDDRAMADDR | lcd_ddram_address); // no need for masking the address
for (uint8_t i = 0; i < 8; i++)
lcd_send(pgm_read_byte(&charmap[i]), HIGH);
}
#ifdef VT100
//Supported VT100 escape codes:
//EraseScreen "\x1b[2J"
//CursorHome "\x1b[%d;%dH"
//CursorShow "\x1b[?25h"
//CursorHide "\x1b[?25l"
void lcd_escape_write(uint8_t chr)
{
#define escape_cnt (lcd_escape[0]) //escape character counter
#define is_num_msk (lcd_escape[1]) //numeric character bit mask
#define chr_is_num (is_num_msk & 0x01) //current character is numeric
#define e_2_is_num (is_num_msk & 0x04) //escape char 2 is numeric
#define e_3_is_num (is_num_msk & 0x08) //...
#define e_4_is_num (is_num_msk & 0x10)
#define e_5_is_num (is_num_msk & 0x20)
#define e_6_is_num (is_num_msk & 0x40)
#define e_7_is_num (is_num_msk & 0x80)
#define e2_num (lcd_escape[2] - '0') //number from character 2
#define e3_num (lcd_escape[3] - '0') //number from character 3
#define e23_num (10*e2_num+e3_num) //number from characters 2 and 3
#define e4_num (lcd_escape[4] - '0') //number from character 4
#define e5_num (lcd_escape[5] - '0') //number from character 5
#define e45_num (10*e4_num+e5_num) //number from characters 4 and 5
#define e6_num (lcd_escape[6] - '0') //number from character 6
#define e56_num (10*e5_num+e6_num) //number from characters 5 and 6
if (escape_cnt > 1) // escape length > 1 = "\x1b["
{
lcd_escape[escape_cnt] = chr; // store current char
if ((chr >= '0') && (chr <= '9')) // char is numeric
is_num_msk |= (1 | (1 << escape_cnt)); //set mask
else
is_num_msk &= ~1; //clear mask
}
switch (escape_cnt++)
{
case 0:
if (chr == 0x1b) return; // escape = "\x1b"
break;
case 1:
is_num_msk = 0x00; // reset 'is number' bit mask
if (chr == '[') return; // escape = "\x1b["
break;
case 2:
switch (chr)
{
case '2': return; // escape = "\x1b[2"
case '?': return; // escape = "\x1b[?"
default:
if (chr_is_num) return; // escape = "\x1b[%1d"
}
break;
case 3:
switch (lcd_escape[2])
{
case '?': // escape = "\x1b[?"
if (chr == '2') return; // escape = "\x1b[?2"
break;
case '2':
if (chr == 'J') // escape = "\x1b[2J"
{ lcd_clear(); lcd_currline = 0; break; } // EraseScreen
default:
if (e_2_is_num && // escape = "\x1b[%1d"
((chr == ';') || // escape = "\x1b[%1d;"
chr_is_num)) // escape = "\x1b[%2d"
return;
}
break;
case 4:
switch (lcd_escape[2])
{
case '?': // "\x1b[?"
if ((lcd_escape[3] == '2') && (chr == '5')) return; // escape = "\x1b[?25"
break;
default:
if (e_2_is_num) // escape = "\x1b[%1d"
{
if ((lcd_escape[3] == ';') && chr_is_num) return; // escape = "\x1b[%1d;%1d"
else if (e_3_is_num && (chr == ';')) return; // escape = "\x1b[%2d;"
}
}
break;
case 5:
switch (lcd_escape[2])
{
case '?':
if ((lcd_escape[3] == '2') && (lcd_escape[4] == '5')) // escape = "\x1b[?25"
switch (chr)
{
case 'h': // escape = "\x1b[?25h"
lcd_cursor(); // CursorShow
break;
case 'l': // escape = "\x1b[?25l"
lcd_no_cursor(); // CursorHide
break;
}
break;
default:
if (e_2_is_num) // escape = "\x1b[%1d"
{
if ((lcd_escape[3] == ';') && e_4_is_num) // escape = "\x1b%1d;%1dH"
{
if (chr == 'H') // escape = "\x1b%1d;%1dH"
lcd_set_cursor(e4_num, e2_num); // CursorHome
else if (chr_is_num)
return; // escape = "\x1b%1d;%2d"
}
else if (e_3_is_num && (lcd_escape[4] == ';') && chr_is_num)
return; // escape = "\x1b%2d;%1d"
}
}
break;
case 6:
if (e_2_is_num) // escape = "\x1b[%1d"
{
if ((lcd_escape[3] == ';') && e_4_is_num && e_5_is_num && (chr == 'H')) // escape = "\x1b%1d;%2dH"
lcd_set_cursor(e45_num, e2_num); // CursorHome
else if (e_3_is_num && (lcd_escape[4] == ';') && e_5_is_num) // escape = "\x1b%2d;%1d"
{
if (chr == 'H') // escape = "\x1b%2d;%1dH"
lcd_set_cursor(e5_num, e23_num); // CursorHome
else if (chr_is_num) // "\x1b%2d;%2d"
return;
}
}
break;
case 7:
if (e_2_is_num && e_3_is_num && (lcd_escape[4] == ';')) // "\x1b[%2d;"
if (e_5_is_num && e_6_is_num && (chr == 'H')) // "\x1b[%2d;%2dH"
lcd_set_cursor(e56_num, e23_num); // CursorHome
break;
}
escape_cnt = 0; // reset escape
}
#endif //VT100
int lcd_putc(char c)
{
return fputc(c, lcdout);
@ -635,84 +809,151 @@ void lcd_buttons_update(void)
////////////////////////////////////////////////////////////////////////////////
// Custom character data
// #define DEBUG_CUSTOM_CHARACTERS
const uint8_t lcd_chardata_bedTemp[8] PROGMEM = {
0b00000,
0b11111,
0b10101,
0b10001,
0b10101,
0b11111,
0b00000,
0b00000}; //thanks Sonny Mounicou
static void lcd_print_custom(uint8_t c) {
uint8_t charToSend = pgm_read_byte(&Font[c - 0x80].alternate); // in case no empty slot is found, use the alternate character.
int8_t slotToUse = -1;
const uint8_t lcd_chardata_degree[8] PROGMEM = {
0b01100,
0b10010,
0b10010,
0b01100,
0b00000,
0b00000,
0b00000,
0b00000};
for (uint8_t i = 0; i < 8; i++) {
// first check if we already have the character in the lcd memory
if ((lcd_custom_characters[i] & 0x7F) == (c & 0x7F)) {
lcd_custom_characters[i] = c; // mark the custom character as used
charToSend = i; // send the found custom character id
#ifdef DEBUG_CUSTOM_CHARACTERS
printf_P(PSTR("found char %02x at slot %u\n"), c, i);
#endif // DEBUG_CUSTOM_CHARACTERS
goto sendChar;
} else if (lcd_custom_characters[i] == 0x7F) { //found an empty slot. create a new custom character and send it
lcd_custom_characters[i] = c; // mark the custom character as used
slotToUse = i;
goto createChar;
} else if (!(lcd_custom_characters[i] & 0x80)) { // found potentially unused slot. Remember it in case it's needed
slotToUse = i;
}
}
const uint8_t lcd_chardata_thermometer[8] PROGMEM = {
0b00100,
0b01010,
0b01010,
0b01010,
0b01010,
0b10001,
0b10001,
0b01110};
// If this point was reached, then there is no empty slot available.
// If there exists any potentially unused slot, then use that one instead.
// Otherwise, use the alternate form of the character.
if (slotToUse < 0) {
#ifdef DEBUG_CUSTOM_CHARACTERS
printf_P(PSTR("used alternate for char %02x\n"), c);
#endif // DEBUG_CUSTOM_CHARACTERS
goto sendChar;
}
const uint8_t lcd_chardata_uplevel[8] PROGMEM = {
0b00100,
0b01110,
0b11111,
0b00100,
0b11100,
0b00000,
0b00000,
0b00000}; //thanks joris
#ifdef DEBUG_CUSTOM_CHARACTERS
printf_P(PSTR("replaced char %02x at slot %u\n"), lcd_custom_characters[slotToUse], slotToUse);
#endif // DEBUG_CUSTOM_CHARACTERS
const uint8_t lcd_chardata_refresh[8] PROGMEM = {
0b00000,
0b00110,
0b11001,
0b11000,
0b00011,
0b10011,
0b01100,
0b00000}; //thanks joris
createChar:
charToSend = slotToUse;
lcd_createChar_P(slotToUse, &Font[c - 0x80]);
#ifdef DEBUG_CUSTOM_CHARACTERS
printf_P(PSTR("created char %02x at slot %u\n"), c, slotToUse);
#endif // DEBUG_CUSTOM_CHARACTERS
const uint8_t lcd_chardata_folder[8] PROGMEM = {
0b00000,
0b11100,
0b11111,
0b10001,
0b10001,
0b11111,
0b00000,
0b00000}; //thanks joris
sendChar:
lcd_send(charToSend, HIGH);
lcd_ddram_address++; // no need for preventing ddram overflow
/*const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
0b11100,
0b10000,
0b11000,
0b10111,
0b00101,
0b00110,
0b00101,
0b00000};*/ //thanks Sonny Mounicou
/*const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
0b11100,
0b10100,
0b11000,
0b10100,
0b00000,
0b00111,
0b00010,
0b00010};*/
/*const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
0b01100,
0b10011,
0b00000,
0b01100,
0b10011,
0b00000,
0b01100,
0b10011};*/
const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
0b00000,
0b00100,
0b10010,
0b01001,
0b10010,
0b00100,
0b00000,
0b00000};
const uint8_t lcd_chardata_clock[8] PROGMEM = {
0b00000,
0b01110,
0b10011,
0b10101,
0b10001,
0b01110,
0b00000,
0b00000}; //thanks Sonny Mounicou
void lcd_set_custom_characters(void)
{
lcd_createChar_P(LCD_STR_BEDTEMP[0], lcd_chardata_bedTemp);
lcd_createChar_P(LCD_STR_DEGREE[0], lcd_chardata_degree);
lcd_createChar_P(LCD_STR_THERMOMETER[0], lcd_chardata_thermometer);
lcd_createChar_P(LCD_STR_UPLEVEL[0], lcd_chardata_uplevel);
lcd_createChar_P(LCD_STR_REFRESH[0], lcd_chardata_refresh);
lcd_createChar_P(LCD_STR_FOLDER[0], lcd_chardata_folder);
lcd_createChar_P(LCD_STR_FEEDRATE[0], lcd_chardata_feedrate);
lcd_createChar_P(LCD_STR_CLOCK[0], lcd_chardata_clock);
}
static void lcd_invalidate_custom_characters() {
memset(lcd_custom_characters, 0x7F, sizeof(lcd_custom_characters));
const uint8_t lcd_chardata_arr2down[8] PROGMEM = {
0b00000,
0b00000,
0b10001,
0b01010,
0b00100,
0b10001,
0b01010,
0b00100};
const uint8_t lcd_chardata_confirm[8] PROGMEM = {
0b00000,
0b00001,
0b00011,
0b10110,
0b11100,
0b01000,
0b00000,
0b00000};
void lcd_set_custom_characters_nextpage(void)
{
lcd_createChar_P(LCD_STR_ARROW_2_DOWN[0], lcd_chardata_arr2down);
lcd_createChar_P(LCD_STR_CONFIRM[0], lcd_chardata_confirm);
}
void lcd_frame_start() {
// check all custom characters and discard unused ones
for (uint8_t i = 0; i < 8; i++) {
uint8_t c = lcd_custom_characters[i];
if (c == 0x7F) { //slot empty
continue;
}
else if (c & 0x80) { //slot was used on the last frame update, mark it as potentially unused this time
lcd_custom_characters[i] = c & 0x7F;
}
else { //character is no longer used (or invalid?), mark it as unused
#ifdef DEBUG_CUSTOM_CHARACTERS
printf_P(PSTR("discarded char %02x at slot %u\n"), c, i);
#endif // DEBUG_CUSTOM_CHARACTERS
lcd_custom_characters[i] = 0x7F;
}
}
#ifdef DEBUG_CUSTOM_CHARACTERS
printf_P(PSTR("frame start:"));
for (uint8_t i = 0; i < 8; i++) {
printf_P(PSTR(" %02x"), lcd_custom_characters[i]);
}
printf_P(PSTR("\n"));
#endif // DEBUG_CUSTOM_CHARACTERS
}

View File

@ -22,6 +22,19 @@ extern void lcd_clear(void);
extern void lcd_home(void);
/*extern void lcd_no_display(void);
extern void lcd_display(void);
extern void lcd_no_blink(void);
extern void lcd_blink(void);
extern void lcd_no_cursor(void);
extern void lcd_cursor(void);
extern void lcd_scrollDisplayLeft(void);
extern void lcd_scrollDisplayRight(void);
extern void lcd_leftToRight(void);
extern void lcd_rightToLeft(void);
extern void lcd_autoscroll(void);
extern void lcd_no_autoscroll(void);*/
extern void lcd_set_cursor(uint8_t col, uint8_t row);
/// @brief Change the cursor column position while preserving the current row position
@ -57,6 +70,19 @@ extern void lcd_print(unsigned int, int = 10);
extern void lcd_print(long, int = 10);
extern void lcd_print(unsigned long, int = 10);
//! @brief Clear screen
#define ESC_2J "\x1b[2J"
//! @brief Show cursor
#define ESC_25h "\x1b[?25h"
//! @brief Hide cursor
#define ESC_25l "\x1b[?25l"
//! @brief Set cursor to
//! @param c column
//! @param r row
#define ESC_H(c,r) "\x1b["#r";"#c"H"
#define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 30000ul //!< Generic timeout to status screen in ms, when no user action.
#define LCD_TIMEOUT_TO_STATUS_BABYSTEP_Z 90000ul //!< Specific timeout for lcd_babystep_z screen in ms.
@ -111,18 +137,18 @@ extern void lcd_buttons_update(void);
//! When constructed (on stack), original state state of lcd_update_enabled is stored
//! and LCD updates are disabled.
//! When destroyed (gone out of scope), original state of LCD update is restored.
//! Do not call lcd_update_enable() to prevent calling lcd_update() in sensitive code.
//! in certain scenarios it will cause recursion e.g. in the menus.
//! It has zero overhead compared to storing bool saved = lcd_update_enabled
//! and calling lcd_update_enable(false) and lcd_update_enable(saved).
class LcdUpdateDisabler
{
public:
LcdUpdateDisabler(): m_updateEnabled(lcd_update_enabled)
{
lcd_update_enabled = false;
lcd_update_enable(false);
}
~LcdUpdateDisabler()
{
lcd_update_enabled = m_updateEnabled;
lcd_update_enable(m_updateEnabled);
}
private:
@ -145,21 +171,21 @@ private:
////////////////////////////////////
//Custom characters defined in the first 8 characters of the LCD
#define LCD_STR_BEDTEMP "\x00"
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_ARROW_2_DOWN "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_CONFIRM "\x07"
#define LCD_STR_ARROW_RIGHT "\x7E" //from the default character set
#define LCD_STR_ARROW_LEFT "\x7F" //from the default character set
#define LCD_STR_BEDTEMP "\x80"
#define LCD_STR_DEGREE "\x81"
#define LCD_STR_THERMOMETER "\x82"
#define LCD_STR_UPLEVEL "\x83"
#define LCD_STR_REFRESH "\x84"
#define LCD_STR_FOLDER "\x85"
#define LCD_STR_FEEDRATE "\x86"
#define LCD_STR_CLOCK "\x87"
#define LCD_STR_ARROW_2_DOWN "\x88"
#define LCD_STR_CONFIRM "\x89"
#define LCD_STR_SOLID_BLOCK "\xFF" //from the default character set
extern void lcd_frame_start();
extern void lcd_set_custom_characters(void);
extern void lcd_set_custom_characters_nextpage(void);
//! @brief Consume click and longpress event
inline void lcd_consume_click()

View File

@ -475,8 +475,10 @@ static void _menu_edit_P()
// disable after first use and/or if the initial value is not minEditValue
_md->minJumpValue = 0;
}
_md->currentValue += lcd_encoder;
lcd_encoder = 0; // Consume knob rotation event
// Constrain the value in case it's outside the allowed limits
_md->currentValue = constrain(_md->currentValue, _md->minEditValue, _md->maxEditValue);
lcd_set_cursor(0, 1);

View File

@ -2,7 +2,6 @@
#include "ConfigurationStore.h"
#include "util.h"
#include "language.h"
#include "lcd.h"
#include "mesh_bed_calibration.h"
#include "mesh_bed_leveling.h"
#include "stepper.h"
@ -374,7 +373,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
angleDiff = fabs(a2 - a1);
/// XY skew and Y-bed skew
DBG(_n("Measured skews: %f %f\n"), degrees(a2 - a1), degrees(a2));
eeprom_update_float_notify((float *)(EEPROM_XYZ_CAL_SKEW), angleDiff); //storing xyz cal. skew to be able to show in support menu later
eeprom_update_float((float *)(EEPROM_XYZ_CAL_SKEW), angleDiff); //storing xyz cal. skew to be able to show in support menu later
if (angleDiff > bed_skew_angle_mild)
result = (angleDiff > bed_skew_angle_extreme) ?
BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME :
@ -500,6 +499,19 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
}
#endif // SUPPORT_VERBOSITY
#if 0
if (result == BED_SKEW_OFFSET_DETECTION_PERFECT && fabs(a1) < bed_skew_angle_mild && fabs(a2) < bed_skew_angle_mild) {
#ifdef SUPPORT_VERBOSITY
if (verbosity_level > 0)
SERIAL_ECHOLNPGM("Very little skew detected. Disabling skew correction.");
#endif // SUPPORT_VERBOSITY
// Just disable the skew correction.
vec_x[0] = MACHINE_AXIS_SCALE_X;
vec_x[1] = 0.f;
vec_y[0] = 0.f;
vec_y[1] = MACHINE_AXIS_SCALE_Y;
}
#else
if (result == BED_SKEW_OFFSET_DETECTION_PERFECT) {
#ifdef SUPPORT_VERBOSITY
if (verbosity_level > 0)
@ -571,6 +583,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
}
#endif // SUPPORT_VERBOSITY
}
#endif
// Invert the transformation matrix made of vec_x, vec_y and cntr.
{
@ -656,27 +669,27 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
*/
void reset_bed_offset_and_skew()
{
eeprom_update_dword_notify((uint32_t*)(EEPROM_BED_CALIBRATION_CENTER+0), 0x0FFFFFFFF);
eeprom_update_dword_notify((uint32_t*)(EEPROM_BED_CALIBRATION_CENTER+4), 0x0FFFFFFFF);
eeprom_update_dword_notify((uint32_t*)(EEPROM_BED_CALIBRATION_VEC_X +0), 0x0FFFFFFFF);
eeprom_update_dword_notify((uint32_t*)(EEPROM_BED_CALIBRATION_VEC_X +4), 0x0FFFFFFFF);
eeprom_update_dword_notify((uint32_t*)(EEPROM_BED_CALIBRATION_VEC_Y +0), 0x0FFFFFFFF);
eeprom_update_dword_notify((uint32_t*)(EEPROM_BED_CALIBRATION_VEC_Y +4), 0x0FFFFFFFF);
eeprom_update_dword((uint32_t*)(EEPROM_BED_CALIBRATION_CENTER+0), 0x0FFFFFFFF);
eeprom_update_dword((uint32_t*)(EEPROM_BED_CALIBRATION_CENTER+4), 0x0FFFFFFFF);
eeprom_update_dword((uint32_t*)(EEPROM_BED_CALIBRATION_VEC_X +0), 0x0FFFFFFFF);
eeprom_update_dword((uint32_t*)(EEPROM_BED_CALIBRATION_VEC_X +4), 0x0FFFFFFFF);
eeprom_update_dword((uint32_t*)(EEPROM_BED_CALIBRATION_VEC_Y +0), 0x0FFFFFFFF);
eeprom_update_dword((uint32_t*)(EEPROM_BED_CALIBRATION_VEC_Y +4), 0x0FFFFFFFF);
// Reset the 8 16bit offsets.
for (int8_t i = 0; i < 4; ++ i)
eeprom_update_dword_notify((uint32_t*)(EEPROM_BED_CALIBRATION_Z_JITTER+i*4), 0x0FFFFFFFF);
eeprom_update_dword((uint32_t*)(EEPROM_BED_CALIBRATION_Z_JITTER+i*4), 0x0FFFFFFFF);
}
bool is_bed_z_jitter_data_valid()
// offsets of the Z heiths of the calibration points from the first point are saved as 16bit signed int, scaled to tenths of microns
// if at least one 16bit integer has different value then -1 (0x0FFFF), data are considered valid and function returns true, otherwise it returns false
{
bool data_valid = false;
for (int8_t i = 0; i < 8; ++i) {
if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + i * 2)) != 0x0FFFF)
return true;
if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + i * 2)) != 0x0FFFF) data_valid = true;
}
return false;
return data_valid;
}
static void world2machine_update(const float vec_x[2], const float vec_y[2], const float cntr[2])
@ -763,7 +776,7 @@ void world2machine_revert_to_uncorrected()
static inline bool vec_undef(const float v[2])
{
const uint32_t *vx = (const uint32_t*)v;
return vx[0] == 0xFFFFFFFF || vx[1] == 0xFFFFFFFF;
return vx[0] == 0x0FFFFFFFF || vx[1] == 0x0FFFFFFFF;
}
@ -780,9 +793,12 @@ static inline bool vec_undef(const float v[2])
*/
void world2machine_read_valid(float vec_x[2], float vec_y[2], float cntr[2])
{
eeprom_read_block(&vec_x[0], (float*)(EEPROM_BED_CALIBRATION_VEC_X), 8);
eeprom_read_block(&vec_y[0], (float*)(EEPROM_BED_CALIBRATION_VEC_Y), 8);
eeprom_read_block(&cntr[0], (float*)(EEPROM_BED_CALIBRATION_CENTER), 8);
vec_x[0] = eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +0));
vec_x[1] = eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +4));
vec_y[0] = eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +0));
vec_y[1] = eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +4));
cntr[0] = eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+0));
cntr[1] = eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+4));
bool reset = false;
if (vec_undef(cntr) || vec_undef(vec_x) || vec_undef(vec_y))
@ -1186,6 +1202,8 @@ BedSkewOffsetDetectionResultType find_bed_induction_sensor_point_xy(int
MYSERIAL.println(current_position[Z_AXIS]);
}
#endif //SUPPORT_VERBOSITY
//lcd_show_fullscreen_message_and_wait_P(PSTR("First hit"));
//lcd_update_enable(true);
float init_x_position = current_position[X_AXIS];
float init_y_position = current_position[Y_AXIS];
@ -2166,16 +2184,6 @@ inline void scan_bed_induction_sensor_point()
#define MESH_BED_CALIBRATION_SHOW_LCD
float __attribute__((noinline)) BED_X(const uint8_t col)
{
return ((float)col * x_mesh_density + BED_X0);
}
float __attribute__((noinline)) BED_Y(const uint8_t row)
{
return ((float)row * y_mesh_density + BED_Y0);
}
BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level, uint8_t &too_far_mask)
{
// Don't let the manage_inactivity() function remove power from the motors.
@ -2426,12 +2434,15 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
if (result >= 0) {
DBG(_n("Calibration success.\n"));
world2machine_update(vec_x, vec_y, cntr);
#if 1
// Fearlessly store the calibration values into the eeprom.
eeprom_update_block_notify(&cntr[0], (float*)(EEPROM_BED_CALIBRATION_CENTER), 8);
eeprom_update_block_notify(&vec_x[0], (float*)(EEPROM_BED_CALIBRATION_VEC_X), 8);
eeprom_update_block_notify(&vec_y[0], (float*)(EEPROM_BED_CALIBRATION_VEC_Y), 8);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 0), cntr[0]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 4), cntr[1]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_X + 0), vec_x[0]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_X + 4), vec_x[1]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y + 0), vec_y[0]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y + 4), vec_y[1]);
#endif
#ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 10) {
// Length of the vec_x
@ -2470,8 +2481,8 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1
uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS;
if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix;
current_position[X_AXIS] = BED_X(ix * 3);
current_position[Y_AXIS] = BED_Y(iy * 3);
current_position[X_AXIS] = BED_X(ix, MESH_MEAS_NUM_X_POINTS);
current_position[Y_AXIS] = BED_Y(iy, MESH_MEAS_NUM_Y_POINTS);
go_to_current(homing_feedrate[X_AXIS] / 60);
delay_keep_alive(3000);
}
@ -2522,7 +2533,7 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8
bool endstop_z_enabled = enable_z_endstop(false);
#ifdef MESH_BED_CALIBRATION_SHOW_LCD
lcd_display_message_fullscreen_P(_T(MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1));
lcd_display_message_fullscreen_P(_i("Improving bed calibration point"));////MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=20 r=4
#endif /* MESH_BED_CALIBRATION_SHOW_LCD */
// Collect a matrix of 9x9 points.
@ -2714,11 +2725,15 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8
}
world2machine_update(vec_x, vec_y, cntr);
#if 1
// Fearlessly store the calibration values into the eeprom.
eeprom_update_block_notify(&cntr[0], (float*)(EEPROM_BED_CALIBRATION_CENTER), 8);
eeprom_update_block_notify(&vec_x[0], (float*)(EEPROM_BED_CALIBRATION_VEC_X), 8);
eeprom_update_block_notify(&vec_y[0], (float*)(EEPROM_BED_CALIBRATION_VEC_Y), 8);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_CENTER+0), cntr [0]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_CENTER+4), cntr [1]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +0), vec_x[0]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +4), vec_x[1]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +0), vec_y[0]);
eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +4), vec_y[1]);
#endif
// Correct the current_position to match the transformed coordinate system after world2machine_rotation_and_skew and world2machine_shift were set.
world2machine_update_current();
@ -2805,16 +2820,16 @@ void go_home_with_z_lift()
// Go home.
// First move up to a safe height.
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
go_to_current(homing_feedrate[Z_AXIS] / 60);
go_to_current(homing_feedrate[Z_AXIS]/60);
// Second move to XY [0, 0].
current_position[X_AXIS] = X_MIN_POS + 0.2;
current_position[Y_AXIS] = Y_MIN_POS + 0.2;
current_position[X_AXIS] = X_MIN_POS+0.2;
current_position[Y_AXIS] = Y_MIN_POS+0.2;
// Clamp to the physical coordinates.
world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
go_to_current((3 * homing_feedrate[X_AXIS]) / 60);
go_to_current(homing_feedrate[X_AXIS]/20);
// Third move up to a safe height.
current_position[Z_AXIS] = Z_MIN_POS;
go_to_current(homing_feedrate[Z_AXIS] / 60);
go_to_current(homing_feedrate[Z_AXIS]/60);
}
// Sample the 9 points of the bed and store them into the EEPROM as a reference.
@ -2823,10 +2838,6 @@ void go_home_with_z_lift()
// Returns false if the reference values are more than 3mm far away.
bool sample_mesh_and_store_reference()
{
bool result = false;
#ifdef TMC2130
tmc2130_home_enter(Z_AXIS_MASK);
#endif
bool endstops_enabled = enable_endstops(false);
bool endstop_z_enabled = enable_z_endstop(false);
@ -2842,25 +2853,30 @@ bool sample_mesh_and_store_reference()
// Sample Z heights for the mesh bed leveling.
// In addition, store the results into an eeprom, to be used later for verification of the bed leveling process.
{
// Lower Z to the mesh search height with stall detection
enable_endstops(true);
// The first point defines the reference.
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
go_to_current(homing_feedrate[Z_AXIS]/60);
#ifdef TMC2130
check_Z_crash();
#endif
enable_endstops(false);
// Move XY to first point
current_position[X_AXIS] = BED_X0;
current_position[Y_AXIS] = BED_Y0;
world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
go_to_current(homing_feedrate[X_AXIS]/60);
set_destination_to_current();
enable_endstops(true);
homeaxis(Z_AXIS);
#ifdef TMC2130
if (!axis_known_position[Z_AXIS] && (!READ(Z_TMC2130_DIAG))) //Z crash
{
kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
return false;
}
#endif //TMC2130
enable_endstops(false);
if (!find_bed_induction_sensor_point_z()) //Z crash or deviation > 50um
{
kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
return false;
}
mbl.set_z(0, 0, current_position[Z_AXIS]);
}
@ -2874,8 +2890,8 @@ bool sample_mesh_and_store_reference()
uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS;
uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS;
if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; // Zig zag
current_position[X_AXIS] = BED_X(ix * 3);
current_position[Y_AXIS] = BED_Y(iy * 3);
current_position[X_AXIS] = BED_X(ix, MESH_MEAS_NUM_X_POINTS);
current_position[Y_AXIS] = BED_Y(iy, MESH_MEAS_NUM_Y_POINTS);
world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
go_to_current(homing_feedrate[X_AXIS]/60);
#ifdef MESH_BED_CALIBRATION_SHOW_LCD
@ -2886,6 +2902,7 @@ bool sample_mesh_and_store_reference()
if (!find_bed_induction_sensor_point_z()) //Z crash or deviation > 50um
{
kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
return false;
}
// Get cords of measuring point
@ -2904,7 +2921,7 @@ bool sample_mesh_and_store_reference()
// The span of the Z offsets is extreme. Give up.
// Homing failed on some of the points.
SERIAL_PROTOCOLLNPGM("Exreme span of the Z values!");
goto end;
return false;
}
}
@ -2919,7 +2936,7 @@ bool sample_mesh_and_store_reference()
continue;
float dif = mbl.z_values[j][i] - mbl.z_values[0][0];
int16_t dif_quantized = int16_t(floor(dif * 100.f + 0.5f));
eeprom_update_word_notify((uint16_t*)addr, *reinterpret_cast<uint16_t*>(&dif_quantized));
eeprom_update_word((uint16_t*)addr, *reinterpret_cast<uint16_t*>(&dif_quantized));
#if 0
{
uint16_t z_offset_u = eeprom_read_word((uint16_t*)addr);
@ -2940,18 +2957,14 @@ bool sample_mesh_and_store_reference()
}
}
mbl.reset();
mbl.upsample_3x3();
mbl.active = true;
go_home_with_z_lift();
result = true;
end:
enable_endstops(endstops_enabled);
enable_z_endstop(endstop_z_enabled);
#ifdef TMC2130
tmc2130_home_exit();
#endif
return result;
return true;
}
#ifndef NEW_XYZCAL
@ -2997,8 +3010,8 @@ bool scan_bed_induction_points(int8_t verbosity_level)
uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1
uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS;
if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix;
float bedX = BED_X(ix * 3);
float bedY = BED_Y(iy * 3);
float bedX = BED_X(ix, MESH_MEAS_NUM_X_POINTS);
float bedY = BED_Y(iy, MESH_MEAS_NUM_Y_POINTS);
current_position[X_AXIS] = vec_x[0] * bedX + vec_y[0] * bedY + cntr[0];
current_position[Y_AXIS] = vec_x[1] * bedX + vec_y[1] * bedY + cntr[1];
// The calibration points are very close to the min Y.
@ -3027,12 +3040,9 @@ bool scan_bed_induction_points(int8_t verbosity_level)
// To replace loading of the babystep correction.
static void shift_z(float delta)
{
const float curpos_z = current_position[Z_AXIS];
current_position[Z_AXIS] -= delta;
plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] - delta, current_position[E_AXIS], homing_feedrate[Z_AXIS]/40);
st_synchronize();
current_position[Z_AXIS] = curpos_z;
plan_set_z_position(curpos_z);
plan_set_z_position(current_position[Z_AXIS]);
}
// Number of baby steps applied
@ -3080,13 +3090,23 @@ void babystep_reset()
}
void count_xyz_details(float (&distanceMin)[2]) {
float cntr[2];
float vec_x[2];
float vec_y[2];
eeprom_read_block(&cntr[0], (float*)(EEPROM_BED_CALIBRATION_CENTER), 8);
eeprom_read_block(&vec_x[0], (float*)(EEPROM_BED_CALIBRATION_VEC_X), 8);
eeprom_read_block(&vec_y[0], (float*)(EEPROM_BED_CALIBRATION_VEC_Y), 8);
float cntr[2] = {
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 0)),
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 4))
};
float vec_x[2] = {
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X + 0)),
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X + 4))
};
float vec_y[2] = {
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y + 0)),
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y + 4))
};
#if 0
a2 = -1 * asin(vec_y[0] / MACHINE_AXIS_SCALE_Y);
a1 = asin(vec_x[1] / MACHINE_AXIS_SCALE_X);
angleDiff = fabs(a2 - a1);
#endif
for (uint8_t mesh_point = 0; mesh_point < 2; ++mesh_point) {
float y = vec_x[1] * pgm_read_float(bed_ref_points_4 + mesh_point * 2) + vec_y[1] * pgm_read_float(bed_ref_points_4 + mesh_point * 2 + 1) + cntr[1];
distanceMin[mesh_point] = (y - Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH);
@ -3098,19 +3118,20 @@ void mbl_settings_init() {
//magnet elimination: use aaproximate Z-coordinate instead of measured values for points which are near magnets
eeprom_init_default_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION, 1);
eeprom_init_default_byte((uint8_t*)EEPROM_MBL_POINTS_NR, 3);
eeprom_init_default_byte((uint8_t*)EEPROM_MBL_PROBE_NR, 3);
mbl_z_probe_nr = eeprom_init_default_byte((uint8_t*)EEPROM_MBL_PROBE_NR, 3);
}
//parameter ix: index of mesh bed leveling point in X-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 )
//parameter iy: index of mesh bed leveling point in Y-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 )
//parameter meas_points: number of mesh bed leveling points in one axis; currently designed and tested for values 3 and 7
//parameter zigzag: false if ix is considered 0 on left side of bed and ix rises with rising X coordinate; true if ix is considered 0 on the right side of heatbed for odd iy values (zig zag mesh bed leveling movements)
//function returns true if point is considered valid (typicaly in safe distance from magnet or another object which inflences PINDA measurements)
bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy) {
bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag) {
//"human readable" heatbed plan
//magnet proximity influence Z coordinate measurements significantly (40 - 100 um)
//0 - measurement point is above magnet and Z coordinate can be influenced negatively
//1 - we should be in safe distance from magnets, measurement should be accurate
if ((ix >= MESH_NUM_X_POINTS) || (iy >= MESH_NUM_Y_POINTS))
return false;
if ((ix >= meas_points) || (iy >= meas_points)) return false;
uint8_t valid_points_mask[7] = {
//[X_MAX,Y_MAX]
@ -3124,26 +3145,36 @@ bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy) {
0b1111111,//0
//[0,0]
};
if (meas_points == 3) {
ix *= 3;
iy *= 3;
}
if (zigzag) {
if ((iy % 2) == 0) return (valid_points_mask[6 - iy] & (1 << (6 - ix)));
else return (valid_points_mask[6 - iy] & (1 << ix));
}
else {
return (valid_points_mask[6 - iy] & (1 << (6 - ix)));
}
}
void mbl_single_point_interpolation(uint8_t x, uint8_t y) {
void mbl_single_point_interpolation(uint8_t x, uint8_t y, uint8_t meas_points) {
//printf_P(PSTR("x = %d; y = %d \n"), x, y);
uint8_t count = 0;
float z = 0;
if (mbl_point_measurement_valid(x, y + 1)) { z += mbl.z_values[y + 1][x]; /*printf_P(PSTR("x; y+1: Z = %f \n"), mbl.z_values[y + 1][x]);*/ count++; }
if (mbl_point_measurement_valid(x, y - 1)) { z += mbl.z_values[y - 1][x]; /*printf_P(PSTR("x; y-1: Z = %f \n"), mbl.z_values[y - 1][x]);*/ count++; }
if (mbl_point_measurement_valid(x + 1, y)) { z += mbl.z_values[y][x + 1]; /*printf_P(PSTR("x+1; y: Z = %f \n"), mbl.z_values[y][x + 1]);*/ count++; }
if (mbl_point_measurement_valid(x - 1, y)) { z += mbl.z_values[y][x - 1]; /*printf_P(PSTR("x-1; y: Z = %f \n"), mbl.z_values[y][x - 1]);*/ count++; }
if (mbl_point_measurement_valid(x, y + 1, meas_points, false)) { z += mbl.z_values[y + 1][x]; /*printf_P(PSTR("x; y+1: Z = %f \n"), mbl.z_values[y + 1][x]);*/ count++; }
if (mbl_point_measurement_valid(x, y - 1, meas_points, false)) { z += mbl.z_values[y - 1][x]; /*printf_P(PSTR("x; y-1: Z = %f \n"), mbl.z_values[y - 1][x]);*/ count++; }
if (mbl_point_measurement_valid(x + 1, y, meas_points, false)) { z += mbl.z_values[y][x + 1]; /*printf_P(PSTR("x+1; y: Z = %f \n"), mbl.z_values[y][x + 1]);*/ count++; }
if (mbl_point_measurement_valid(x - 1, y, meas_points, false)) { z += mbl.z_values[y][x - 1]; /*printf_P(PSTR("x-1; y: Z = %f \n"), mbl.z_values[y][x - 1]);*/ count++; }
if(count != 0) mbl.z_values[y][x] = z / count; //if we have at least one valid point in surrounding area use average value, otherwise use inaccurately measured Z-coordinate
//printf_P(PSTR("result: Z = %f \n\n"), mbl.z_values[y][x]);
}
void mbl_magnet_elimination() {
for (uint8_t y = 0; y < MESH_NUM_Y_POINTS; y++) {
for (uint8_t x = 0; x < MESH_NUM_X_POINTS; x++) {
if (!mbl_point_measurement_valid(x, y)) {
mbl_single_point_interpolation(x, y);
void mbl_interpolation(uint8_t meas_points) {
for (uint8_t x = 0; x < meas_points; x++) {
for (uint8_t y = 0; y < meas_points; y++) {
if (!mbl_point_measurement_valid(x, y, meas_points, false)) {
mbl_single_point_interpolation(x, y, meas_points);
}
}
}

View File

@ -1,6 +1,6 @@
#pragma once
#include <avr/pgmspace.h>
#include "Marlin.h"
#define BED_ZERO_REF_X (- 22.f + X_PROBE_OFFSET_FROM_EXTRUDER) // -22 + 23 = 1
#define BED_ZERO_REF_Y (- 0.6f + Y_PROBE_OFFSET_FROM_EXTRUDER + 4.f) // -0.6 + 5 + 4 = 8.4
@ -21,8 +21,8 @@
#endif //not HEATBED_V2
constexpr float x_mesh_density = (BED_Xn - BED_X0) / (MESH_NUM_X_POINTS - 1);
constexpr float y_mesh_density = (BED_Yn - BED_Y0) / (MESH_NUM_Y_POINTS - 1);
#define BED_X(i, n) ((float)i * (BED_Xn - BED_X0) / (n - 1) + BED_X0)
#define BED_Y(i, n) ((float)i * (BED_Yn - BED_Y0) / (n - 1) + BED_Y0)
// Exact positions of the print head above the bed reference points, in the world coordinates.
// The world coordinates match the machine coordinates only in case, when the machine
@ -145,17 +145,6 @@ inline bool world2machine_clamp(float &x, float &y)
machine2world(tmpx, tmpy, x, y);
return clamped;
}
/// @brief For a given column on the mesh calculate the bed X coordinate
/// @param col column index on mesh
/// @return Bed X coordinate
float BED_X(const uint8_t col);
/// @brief For a given row on the mesh calculate the bed Y coordinate
/// @param row row index on mesh
/// @return Bed Y coordinate
float BED_Y(const uint8_t row);
/**
* @brief Bed skew and offest detection result
*
@ -163,7 +152,7 @@ float BED_Y(const uint8_t row);
* Negative: failed
*/
enum BedSkewOffsetDetectionResultType : int8_t {
enum BedSkewOffsetDetectionResultType {
// Detection failed, some point was not found.
BED_SKEW_OFFSET_DETECTION_POINT_FOUND = 0, //!< Point found
BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND = -1, //!< Point not found.
@ -214,5 +203,6 @@ extern void count_xyz_details(float (&distanceMin)[2]);
extern bool sample_z();
extern void mbl_settings_init();
extern bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy);
extern void mbl_magnet_elimination();
extern bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag);
extern void mbl_interpolation(uint8_t meas_points);

View File

@ -6,44 +6,23 @@
mesh_bed_leveling mbl;
mesh_bed_leveling::mesh_bed_leveling() { reset(); }
void mesh_bed_leveling::reset() {
active = 0;
memset(z_values, 0, sizeof(z_values));
memset(z_values, 0, sizeof(float) * MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS);
}
float mesh_bed_leveling::get_z(float x, float y) {
int i, j;
float s, t;
i = int(floor((x - (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER)) / x_mesh_density));
if (i < 0) {
i = 0;
s = (x - (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER)) / x_mesh_density;
} else {
if (i > MESH_NUM_X_POINTS - 2) {
i = MESH_NUM_X_POINTS - 2;
}
s = (x - get_x(i)) / x_mesh_density;
}
j = int(floor((y - (BED_Y0 + Y_PROBE_OFFSET_FROM_EXTRUDER)) / y_mesh_density));
if (j < 0) {
j = 0;
t = (y - (BED_Y0 + Y_PROBE_OFFSET_FROM_EXTRUDER)) / y_mesh_density;
} else {
if (j > MESH_NUM_Y_POINTS - 2) {
j = MESH_NUM_Y_POINTS - 2;
}
t = (y - get_y(j)) / y_mesh_density;
}
float si = 1.f-s;
float z0 = si * z_values[j ][i] + s * z_values[j ][i+1];
float z1 = si * z_values[j+1][i] + s * z_values[j+1][i+1];
return (1.f-t) * z0 + t * z1;
static inline bool vec_undef(const float v[2])
{
const uint32_t *vx = (const uint32_t*)v;
return vx[0] == 0x0FFFFFFFF || vx[1] == 0x0FFFFFFFF;
}
#if MESH_NUM_X_POINTS>=5 && MESH_NUM_Y_POINTS>=5 && (MESH_NUM_X_POINTS&1)==1 && (MESH_NUM_Y_POINTS&1)==1
// Works for an odd number of MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS
// #define MBL_BILINEAR
void mesh_bed_leveling::upsample_3x3()
{
int idx0 = 0;
@ -51,53 +30,76 @@ void mesh_bed_leveling::upsample_3x3()
int idx2 = MESH_NUM_X_POINTS - 1;
{
// First interpolate the points in X axis.
static const float x0 = (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER);
static const float x1 = 0.5f * float(BED_X0 + BED_Xn) + X_PROBE_OFFSET_FROM_EXTRUDER;
static const float x2 = BED_Xn + X_PROBE_OFFSET_FROM_EXTRUDER;
for (int j = 0; j < MESH_NUM_Y_POINTS; ++ j) {
// Interpolate the remaining values by Largrangian polynomials.
for (int i = 0; i < MESH_NUM_X_POINTS; ++ i) {
if (!isnan(z_values[j][i]))
static const float x0 = MESH_MIN_X;
static const float x1 = 0.5f * float(MESH_MIN_X + MESH_MAX_X);
static const float x2 = MESH_MAX_X;
for (int j = 0; j < 3; ++ j) {
// 1) Copy the source points to their new destination.
z_values[j][idx2] = z_values[j][2];
z_values[j][idx1] = z_values[j][1];
// 2) Interpolate the remaining values by Largrangian polynomials.
for (int i = idx0 + 1; i < idx2; ++ i) {
if (i == idx1)
continue;
float x = get_x(i);
#ifdef MBL_BILINEAR
z_values[j][i] = (x < x1) ?
((z_values[j][idx0] * (x - x0) + z_values[j][idx1] * (x1 - x)) / (x1 - x0)) :
((z_values[j][idx1] * (x - x1) + z_values[j][idx2] * (x2 - x)) / (x2 - x1));
#else
z_values[j][i] =
z_values[j][idx0] * (x - x1) * (x - x2) / ((x0 - x1) * (x0 - x2)) +
z_values[j][idx1] * (x - x0) * (x - x2) / ((x1 - x0) * (x1 - x2)) +
z_values[j][idx2] * (x - x0) * (x - x1) / ((x2 - x0) * (x2 - x1));
#endif
}
}
}
{
// Second interpolate the points in Y axis.
static const float y0 = (BED_Y0 + Y_PROBE_OFFSET_FROM_EXTRUDER);
static const float y1 = 0.5f * float(BED_Y0 + BED_Yn) + Y_PROBE_OFFSET_FROM_EXTRUDER;
static const float y2 = BED_Yn + Y_PROBE_OFFSET_FROM_EXTRUDER;
static const float y0 = MESH_MIN_Y;
static const float y1 = 0.5f * float(MESH_MIN_Y + MESH_MAX_Y);
static const float y2 = MESH_MAX_Y;
for (int i = 0; i < MESH_NUM_X_POINTS; ++ i) {
// Interpolate the remaining values by Largrangian polynomials.
// 1) Copy the intermediate points to their new destination.
z_values[idx2][i] = z_values[2][i];
z_values[idx1][i] = z_values[1][i];
// 2) Interpolate the remaining values by Largrangian polynomials.
for (int j = 1; j + 1 < MESH_NUM_Y_POINTS; ++ j) {
if (!isnan(z_values[j][i]))
if (j == idx1)
continue;
float y = get_y(j);
#ifdef MBL_BILINEAR
z_values[j][i] = (y < y1) ?
((z_values[idx0][i] * (y - y0) + z_values[idx1][i] * (y1 - y)) / (y1 - y0)) :
((z_values[idx1][i] * (y - y1) + z_values[idx2][i] * (y2 - y)) / (y2 - y1));
#else
z_values[j][i] =
z_values[idx0][i] * (y - y1) * (y - y2) / ((y0 - y1) * (y0 - y2)) +
z_values[idx1][i] * (y - y0) * (y - y2) / ((y1 - y0) * (y1 - y2)) +
z_values[idx2][i] * (y - y0) * (y - y1) / ((y2 - y0) * (y2 - y1));
#endif
}
}
}
}
void mesh_bed_leveling::print() {
SERIAL_PROTOCOLLNPGM("Num X,Y: " STRINGIFY(MESH_NUM_X_POINTS) "," STRINGIFY(MESH_NUM_Y_POINTS));
SERIAL_PROTOCOLLNPGM("Z search height: " STRINGIFY(MESH_HOME_Z_SEARCH));
SERIAL_PROTOCOLLNPGM("Measured points:");
for (uint8_t y = MESH_NUM_Y_POINTS; y-- > 0;) {
for (uint8_t x = 0; x < MESH_NUM_X_POINTS; x++) {
SERIAL_PROTOCOLPGM(" ");
SERIAL_PROTOCOL_F(z_values[y][x], 5);
/*
// Relax the non-measured points.
const float weight = 0.2f;
for (uint8_t iter = 0; iter < 20; ++ iter) {
for (int8_t j = 1; j < 6; ++ j) {
for (int8_t i = 1; i < 6; ++ i) {
if (i == 3 || j == 3)
continue;
if ((i % 3) == 0 && (j % 3) == 0)
continue;
float avg = 0.25f * (z_values[j][i-1]+z_values[j][i+1]+z_values[j-1][i]+z_values[j+1][i]);
z_values[j][i] = (1.f-weight)*z_values[j][i] + weight*avg;
}
SERIAL_PROTOCOLLN();
}
}
*/
}
#endif
#endif // MESH_BED_LEVELING

View File

@ -1,23 +1,118 @@
#include "Marlin.h"
#include "mesh_bed_calibration.h"
#ifdef MESH_BED_LEVELING
#define MEAS_NUM_X_DIST (float(MESH_MAX_X - MESH_MIN_X)/float(MESH_MEAS_NUM_X_POINTS - 1))
#define MEAS_NUM_Y_DIST (float(MESH_MAX_Y - MESH_MIN_Y)/float(MESH_MEAS_NUM_Y_POINTS - 1))
#define MESH_X_DIST (float(MESH_MAX_X - MESH_MIN_X)/float(MESH_NUM_X_POINTS - 1))
#define MESH_Y_DIST (float(MESH_MAX_Y - MESH_MIN_Y)/float(MESH_NUM_Y_POINTS - 1))
class mesh_bed_leveling {
public:
uint8_t active;
float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS];
mesh_bed_leveling() { reset(); }
mesh_bed_leveling();
void reset();
static float get_x(int i) { return BED_X(i) + X_PROBE_OFFSET_FROM_EXTRUDER; }
static float get_y(int i) { return BED_Y(i) + Y_PROBE_OFFSET_FROM_EXTRUDER; }
float get_z(float x, float y);
void set_z(uint8_t ix, uint8_t iy, float z) { z_values[iy][ix] = z; }
#if MESH_NUM_X_POINTS>=5 && MESH_NUM_Y_POINTS>=5 && (MESH_NUM_X_POINTS&1)==1 && (MESH_NUM_Y_POINTS&1)==1
void upsample_3x3();
void print();
#endif
static float get_x(int i) { return float(MESH_MIN_X) + float(MESH_X_DIST) * float(i); }
static float get_y(int i) { return float(MESH_MIN_Y) + float(MESH_Y_DIST) * float(i); }
void set_z(uint8_t ix, uint8_t iy, float z) { z_values[iy][ix] = z; }
int select_x_index(float x) {
int i = 1;
while (x > get_x(i) && i < MESH_NUM_X_POINTS - 1) i++;
return i - 1;
}
int select_y_index(float y) {
int i = 1;
while (y > get_y(i) && i < MESH_NUM_Y_POINTS - 1) i++;
return i - 1;
}
float get_z(float x, float y) {
int i, j;
float s, t;
#if MESH_NUM_X_POINTS==3 && MESH_NUM_Y_POINTS==3
#define MESH_MID_X (0.5f*(MESH_MIN_X+MESH_MAX_X))
#define MESH_MID_Y (0.5f*(MESH_MIN_Y+MESH_MAX_Y))
if (x < MESH_MID_X) {
i = 0;
s = (x - MESH_MIN_X) / MESH_X_DIST;
if (s > 1.f)
s = 1.f;
} else {
i = 1;
s = (x - MESH_MID_X) / MESH_X_DIST;
if (s < 0)
s = 0;
}
if (y < MESH_MID_Y) {
j = 0;
t = (y - MESH_MIN_Y) / MESH_Y_DIST;
if (t > 1.f)
t = 1.f;
} else {
j = 1;
t = (y - MESH_MID_Y) / MESH_Y_DIST;
if (t < 0)
t = 0;
}
#else
i = int(floor((x - MESH_MIN_X) / MESH_X_DIST));
if (i < 0) {
i = 0;
s = (x - MESH_MIN_X) / MESH_X_DIST;
if (s > 1.f)
s = 1.f;
}
else if (i > MESH_NUM_X_POINTS - 2) {
i = MESH_NUM_X_POINTS - 2;
s = (x - get_x(i)) / MESH_X_DIST;
if (s < 0)
s = 0;
} else {
s = (x - get_x(i)) / MESH_X_DIST;
if (s < 0)
s = 0;
else if (s > 1.f)
s = 1.f;
}
j = int(floor((y - MESH_MIN_Y) / MESH_Y_DIST));
if (j < 0) {
j = 0;
t = (y - MESH_MIN_Y) / MESH_Y_DIST;
if (t > 1.f)
t = 1.f;
} else if (j > MESH_NUM_Y_POINTS - 2) {
j = MESH_NUM_Y_POINTS - 2;
t = (y - get_y(j)) / MESH_Y_DIST;
if (t < 0)
t = 0;
} else {
t = (y - get_y(j)) / MESH_Y_DIST;
if (t < 0)
t = 0;
else if (t > 1.f)
t = 1.f;
}
#endif /* MESH_NUM_X_POINTS==3 && MESH_NUM_Y_POINTS==3 */
float si = 1.f-s;
float z0 = si * z_values[j ][i] + s * z_values[j ][i+1];
float z1 = si * z_values[j+1][i] + s * z_values[j+1][i+1];
return (1.f-t) * z0 + t * z1;
}
};
extern mesh_bed_leveling mbl;

View File

@ -4,9 +4,6 @@
//this is because we need CUSTOM_MENDEL_NAME
#include "Configuration_var.h"
// For the custom characters
#include "lcd.h"
//internationalized messages
const char MSG_ALWAYS[] PROGMEM_I1 = ISTR("Always"); ////MSG_ALWAYS c=6
const char MSG_AUTO_HOME[] PROGMEM_I1 = ISTR("Auto home"); ////MSG_AUTO_HOME c=18
@ -18,8 +15,7 @@ const char MSG_BED_HEATING[] PROGMEM_I1 = ISTR("Bed Heating"); ////MSG_BED_HEATI
const char MSG_BED_LEVELING_FAILED_POINT_LOW[] PROGMEM_I1 = ISTR("Bed leveling failed. Sensor didn't trigger. Debris on nozzle? Waiting for reset."); ////MSG_BED_LEVELING_FAILED_POINT_LOW c=20 r=6
const char MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED[] PROGMEM_I1 = ISTR("XYZ calibration failed. Please consult the manual."); ////MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED c=20 r=8
const char MSG_BELT_STATUS[] PROGMEM_I1 = ISTR("Belt status");////MSG_BELT_STATUS c=18
const char MSG_EJECT[] PROGMEM_I1 = ISTR("Eject"); ////MSG_EJECT c=9
const char MSG_CANCEL[] PROGMEM_I1 = ISTR("Cancel");////MSG_CANCEL c=9
const char MSG_CANCEL[] PROGMEM_I1 = ISTR(">Cancel");////MSG_CANCEL c=10
const char MSG_CALIBRATE_Z_AUTO[] PROGMEM_I1 = ISTR("Calibrating Z"); ////MSG_CALIBRATE_Z_AUTO c=20 r=2
const char MSG_CARD_MENU[] PROGMEM_I1 = ISTR("Print from SD"); ////MSG_CARD_MENU c=18
const char MSG_CHECKING_X[] PROGMEM_I1 = ISTR("Checking X axis"); ////MSG_CHECKING_X c=20
@ -35,6 +31,7 @@ const char MSG_ERROR[] PROGMEM_I1 = ISTR("ERROR:"); ////MSG_ERROR c=10
const char MSG_EXTRUDER[] PROGMEM_I1 = ISTR("Extruder"); ////MSG_EXTRUDER c=17
const char MSG_FANS_CHECK[] PROGMEM_I1 = ISTR("Fans check"); ////MSG_FANS_CHECK c=13
const char MSG_FIL_RUNOUTS[] PROGMEM_I1 = ISTR("Fil. runouts"); ////MSG_FIL_RUNOUTS c=15
const char MSG_FILAMENT[] PROGMEM_I1 = ISTR("Filament"); ////MSG_FILAMENT c=17
const char MSG_FAN_SPEED[] PROGMEM_I1 = ISTR("Fan speed"); ////MSG_FAN_SPEED c=14
const char MSG_HOTEND_FAN_SPEED[] PROGMEM_I1 = ISTR("Hotend fan:");////MSG_HOTEND_FAN_SPEED c=15
const char MSG_PRINT_FAN_SPEED[] PROGMEM_I1 = ISTR("Print fan:"); ////MSG_PRINT_FAN_SPEED c=15
@ -76,7 +73,6 @@ const char MSG_NO[] PROGMEM_I1 = ISTR("No"); ////MSG_NO c=4
const char MSG_NOZZLE[] PROGMEM_I1 = ISTR("Nozzle"); ////MSG_NOZZLE c=10
const char MSG_PAPER[] PROGMEM_I1 = ISTR("Place a sheet of paper under the nozzle during the calibration of first 4 points. If the nozzle catches the paper, power off the printer immediately."); ////MSG_PAPER c=20 r=8
const char MSG_PAUSE_PRINT[] PROGMEM_I1 = ISTR("Pause print");////MSG_PAUSE_PRINT c=18
const char MSG_PRINT_PAUSED[] PROGMEM_I1 = ISTR("Print paused");////MSG_PRINT_PAUSED c=20
const char MSG_PLACE_STEEL_SHEET[] PROGMEM_I1 = ISTR("Please place steel sheet on heatbed."); ////MSG_PLACE_STEEL_SHEET c=20 r=4
const char MSG_PLEASE_WAIT[] PROGMEM_I1 = ISTR("Please wait"); ////MSG_PLEASE_WAIT c=20
const char MSG_POWER_FAILURES[] PROGMEM_I1 = ISTR("Power failures"); ////MSG_POWER_FAILURES c=15
@ -85,7 +81,7 @@ const char MSG_PRESS_TO_UNLOAD[] PROGMEM_I1 = ISTR("Please press the knob to unl
const char MSG_PRINT_ABORTED[] PROGMEM_I1 = ISTR("Print aborted"); ////MSG_PRINT_ABORTED c=20
const char MSG_PULL_OUT_FILAMENT[] PROGMEM_I1 = ISTR("Please pull out filament immediately"); ////MSG_PULL_OUT_FILAMENT c=20 r=4
const char MSG_RECOVER_PRINT[] PROGMEM_I1 = ISTR("Blackout occurred. Recover print?"); ////MSG_RECOVER_PRINT c=20 r=3
const char MSG_REFRESH[] PROGMEM_I1 = ISTR(LCD_STR_REFRESH "Refresh"); ////MSG_REFRESH c=18
const char MSG_REFRESH[] PROGMEM_I1 = ISTR("\x04Refresh"); ////MSG_REFRESH c=18
const char MSG_REMOVE_STEEL_SHEET[] PROGMEM_I1 = ISTR("Please remove steel sheet from heatbed."); ////MSG_REMOVE_STEEL_SHEET c=20 r=4
const char MSG_RESET[] PROGMEM_I1 = ISTR("Reset"); ////MSG_RESET c=14
const char MSG_RESUME_PRINT[] PROGMEM_I1 = ISTR("Resume print"); ////MSG_RESUME_PRINT c=18
@ -102,15 +98,6 @@ const char MSG_SELFTEST_MOTOR[] PROGMEM_I1 = ISTR("Motor"); ////MSG_SELFTEST_MOT
const char MSG_SELFTEST_FILAMENT_SENSOR[] PROGMEM_I1 = ISTR("Filament sensor"); ////MSG_SELFTEST_FILAMENT_SENSOR c=17
const char MSG_SELFTEST_WIRINGERROR[] PROGMEM_I1 = ISTR("Wiring error"); ////MSG_SELFTEST_WIRINGERROR c=18
const char MSG_SETTINGS[] PROGMEM_I1 = ISTR("Settings"); ////MSG_SETTINGS c=18
#ifndef REPLACE_SETREADY
const char MSG_SET_READY[] PROGMEM_I1 = ISTR("Set Ready"); ////MSG_SET_READY c=18
const char MSG_SET_NOT_READY[] PROGMEM_I1 = ISTR("Set not Ready"); ////MSG_SET_NOT_READY c=18
#else
const char MSG_HOSTPRINT[] PROGMEM_I1 = ISTR("Print from host"); ////MSG_HOSTPRINT c=18
#endif //REPLACE_SETREADY
#ifdef HOST_SHUTDOWN
const char MSG_SHUTDOWN_HOST[] PROGMEM_I1 = ISTR("Shutdown host"); ////MSG_SHUTDOWN_HOST c=18
#endif //HOST_SHUTOWN
const char MSG_SELECT_LANGUAGE[] PROGMEM_I1 = ISTR("Select language"); ////MSG_SELECT_LANGUAGE c=18
const char MSG_SORTING_FILES[] PROGMEM_I1 = ISTR("Sorting files"); ////MSG_SORTING_FILES c=20
const char MSG_TOTAL[] PROGMEM_I1 = ISTR("Total"); ////MSG_TOTAL c=6
@ -125,12 +112,11 @@ const char MSG_SILENT[] PROGMEM_I1 = ISTR("Silent"); ////MSG_SILENT c=7
const char MSG_NORMAL[] PROGMEM_I1 = ISTR("Normal"); ////MSG_NORMAL c=7
const char MSG_STEALTH[] PROGMEM_I1 = ISTR("Stealth"); ////MSG_STEALTH c=7
const char MSG_STEEL_SHEET_CHECK[] PROGMEM_I1 = ISTR("Is steel sheet on heatbed?"); ////MSG_STEEL_SHEET_CHECK c=20 r=3
const char MSG_Z_CALIBRATION_PROMPT[] PROGMEM_I1 = ISTR("Z calibration recommended. Run it now?"); ////MSG_Z_CALIBRATION_PROMPT c=20 r=3
const char MSG_STOP_PRINT[] PROGMEM_I1 = ISTR("Stop print"); ////MSG_STOP_PRINT c=18
const char MSG_STOPPED[] PROGMEM_I1 = ISTR("STOPPED."); ////MSG_STOPPED c=20
const char MSG_PINDA_CALIBRATION[] PROGMEM_I1 = ISTR("PINDA cal."); ////MSG_PINDA_CALIBRATION c=13
const char MSG_PINDA_CALIBRATION_DONE[] PROGMEM_I1 = ISTR("PINDA calibration is finished and active. It can be disabled in menu Settings->PINDA cal."); ////MSG_PINDA_CALIBRATION_DONE c=20 r=8
const char MSG_UNLOAD_FILAMENT[] PROGMEM_I1 = ISTR("Unload filament"); ////MSG_UNLOAD_FILAMENT c=18
const char MSG_UNLOAD_FILAMENT[] PROGMEM_I1 = ISTR("Unload filament"); ////MSG_UNLOAD_FILAMENT c=16
const char MSG_UNLOADING_FILAMENT[] PROGMEM_I1 = ISTR("Unloading filament"); ////MSG_UNLOADING_FILAMENT c=20
const char MSG_INFO_SCREEN[] PROGMEM_I1 = ISTR("Info screen"); ////MSG_INFO_SCREEN c=18
const char MSG_WIZARD_CALIBRATION_FAILED[] PROGMEM_I1 = ISTR("Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer."); ////MSG_WIZARD_CALIBRATION_FAILED c=20 r=8
@ -149,15 +135,14 @@ const char MSG_NONE[] PROGMEM_I1 = ISTR("None"); ////MSG_NONE c=8
const char MSG_WARN[] PROGMEM_I1 = ISTR("Warn"); ////MSG_WARN c=8
const char MSG_STRICT[] PROGMEM_I1 = ISTR("Strict"); ////MSG_STRICT c=8
const char MSG_MODEL[] PROGMEM_I1 = ISTR("Model"); ////MSG_MODEL c=8
const char MSG_GCODE_DIFF_PRINTER_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a different printer type."); ////MSG_GCODE_DIFF_PRINTER_CONTINUE c=20 r=3
const char MSG_GCODE_DIFF_PRINTER_CANCELLED[] PROGMEM_I1 =ISTR("G-code sliced for a different printer type. Please re-slice the model again."); ////MSG_GCODE_DIFF_PRINTER_CANCELLED c=20 r=8
const char MSG_GCODE_NEWER_FIRMWARE_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a newer firmware."); ////MSG_GCODE_NEWER_FIRMWARE_CONTINUE c=20 r=3
const char MSG_GCODE_NEWER_FIRMWARE_CANCELLED[] PROGMEM_I1 = ISTR("G-code sliced for a newer firmware. Please update the firmware."); ////MSG_GCODE_NEWER_FIRMWARE_CANCELLED c=20 r=8
const char MSG_GCODE_DIFF_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a different level."); ////MSG_GCODE_DIFF_CONTINUE c=20 r=3
const char MSG_GCODE_DIFF_CANCELLED[] PROGMEM_I1 = ISTR("G-code sliced for a different level. Please re-slice the model again."); ////MSG_GCODE_DIFF_CANCELLED c=20 r=8
const char MSG_MISSING_FILAMENT[] PROGMEM_I1 = ISTR("There is no filament loaded."); ////MSG_MISSING_FILAMENT c=20 r=3
const char MSG_NOZZLE_DIFFERS_CONTINUE[] PROGMEM_I1 = ISTR("Nozzle diameter differs from the G-code."); ////MSG_NOZZLE_DIFFERS_CONTINUE c=20 r=3
const char MSG_NOZZLE_DIFFERS_CANCELLED[] PROGMEM_I1 = ISTR("Nozzle diameter differs from the G-code. Please check the value in settings."); ////MSG_NOZZLE_DIFFERS_CANCELLED c=20 r=8
const char MSG_GCODE_DIFF_PRINTER_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a different printer type. Continue?"); ////MSG_GCODE_DIFF_PRINTER_CONTINUE c=20 r=3
const char MSG_GCODE_DIFF_PRINTER_CANCELLED[] PROGMEM_I1 =ISTR("G-code sliced for a different printer type. Please re-slice the model again. Print cancelled."); ////MSG_GCODE_DIFF_PRINTER_CANCELLED c=20 r=8
const char MSG_GCODE_NEWER_FIRMWARE_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a newer firmware. Continue?"); ////MSG_GCODE_NEWER_FIRMWARE_CONTINUE c=20 r=3
const char MSG_GCODE_NEWER_FIRMWARE_CANCELLED[] PROGMEM_I1 = ISTR("G-code sliced for a newer firmware. Please update the firmware. Print cancelled."); ////MSG_GCODE_NEWER_FIRMWARE_CANCELLED c=20 r=8
const char MSG_GCODE_DIFF_CONTINUE[] PROGMEM_I1 = ISTR("G-code sliced for a different level. Continue?"); ////MSG_GCODE_DIFF_CONTINUE c=20 r=3
const char MSG_GCODE_DIFF_CANCELLED[] PROGMEM_I1 = ISTR("G-code sliced for a different level. Please re-slice the model again. Print cancelled."); ////MSG_GCODE_DIFF_CANCELLED c=20 r=8
const char MSG_NOZZLE_DIFFERS_CONTINUE[] PROGMEM_I1 = ISTR("Nozzle diameter differs from the G-code. Continue?"); ////MSG_NOZZLE_DIFFERS_CONTINUE c=20 r=3
const char MSG_NOZZLE_DIFFERS_CANCELLED[] PROGMEM_I1 = ISTR("Nozzle diameter differs from the G-code. Please check the value in settings. Print cancelled."); ////MSG_NOZZLE_DIFFERS_CANCELLED c=20 r=8
const char MSG_NOZZLE_DIAMETER[] PROGMEM_I1 = ISTR("Nozzle d."); ////MSG_NOZZLE_DIAMETER c=10
const char MSG_MMU_MODE[] PROGMEM_I1 = ISTR("MMU Mode"); ////MSG_MMU_MODE c=8
const char MSG_SD_CARD[] PROGMEM_I1 = ISTR("SD card"); ////MSG_SD_CARD c=8
@ -198,203 +183,34 @@ extern const char MSG_TM_ACK_ERROR[] PROGMEM_I1 = ISTR("Clear TM error");////MSG
extern const char MSG_LOAD_ALL[] PROGMEM_I1 = ISTR("Load All"); ////MSG_LOAD_ALL c=18
extern const char MSG_NOZZLE_CNG_MENU [] PROGMEM_I1 = ISTR("Nozzle change");////MSG_NOZZLE_CNG_MENU c=18
extern const char MSG_NOZZLE_CNG_READ_HELP [] PROGMEM_I1 = ISTR("For a Nozzle change please read\nprusa.io/nozzle-mk3s");////MSG_NOZZLE_CNG_READ_HELP c=20 r=4
#ifdef QUICK_NOZZLE_CHANGE
extern const char MSG_NOZZLE_CNG_COOLDOWN [] PROGMEM_I1 = ISTR("Nozzle is hot! Wait for cooldown.");////MSG_NOZZLE_CNG_COOLDOWN c=20 r=3
extern const char MSG_NOZZLE_CNG_CHANGED [] PROGMEM_I1 = ISTR("Nozzle changed?");////MSG_NOZZLE_CNG_CHANGED_QUICK c=20 r=3
#else
extern const char MSG_NOZZLE_CNG_CHANGED [] PROGMEM_I1 = ISTR("Hotend at 280C! Nozzle changed and tightened to specs?");////MSG_NOZZLE_CNG_CHANGED c=20 r=6
#endif //QUICK_NOZZLE_CHANGE
extern const char MSG_REPRINT [] PROGMEM_I1 = ISTR("Reprint"); ////MSG_REPRINT c=18
extern const char MSG_FILE_CNT [] PROGMEM_I1 = ISTR("Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100."); ////MSG_FILE_CNT c=20 r=6
extern const char MSG_CHANGED_MOTHERBOARD [] PROGMEM_I1 = ISTR("Warning: motherboard type changed."); ////MSG_CHANGED_MOTHERBOARD c=20 r=4
extern const char MSG_CHANGED_PRINTER [] PROGMEM_I1 = ISTR("Warning: printer type changed."); ////MSG_CHANGED_PRINTER c=20 r=4
extern const char MSG_CHANGED_BOTH [] PROGMEM_I1 = ISTR("Warning: both printer type and motherboard type changed."); ////MSG_CHANGED_BOTH c=20 r=4
extern const char MSG_DEFAULT_SETTINGS_LOADED [] PROGMEM_I1 = ISTR("Old settings found. Default PID, Esteps etc. will be set."); ////MSG_DEFAULT_SETTINGS_LOADED c=20 r=6
extern const char MSG_FORCE_SELFTEST [] PROGMEM_I1 = ISTR("Selftest will be run to calibrate accurate sensorless rehoming."); ////MSG_FORCE_SELFTEST c=20 r=8
extern const char MSG_MBL_FAILED [] PROGMEM_I1 = ISTR("Mesh bed leveling failed. Print canceled."); ////MSG_MBL_FAILED c=20 r=4
extern const char MSG_ZLEVELING_ENFORCED [] PROGMEM_I1 = ISTR("Some problem encountered, Z-leveling enforced ..."); ////MSG_ZLEVELING_ENFORCED c=20 r=4
extern const char MSG_UNLOAD_SUCCESSFUL [] PROGMEM_I1 = ISTR("Was filament unload successful?"); ////MSG_UNLOAD_SUCCESSFUL c=20 r=3
extern const char MSG_CHECK_IDLER [] PROGMEM_I1 = ISTR("Please open idler and remove filament manually."); ////MSG_CHECK_IDLER c=20 r=4
extern const char MSG_RUN_XYZ [] PROGMEM_I1 = ISTR("Please run XYZ calibration first."); ////MSG_RUN_XYZ c=20 r=4
extern const char MSG_TEMP_CAL_WARNING [] PROGMEM_I1 = ISTR("Stable ambient temperature 21-26C is needed a rigid stand is required."); ////MSG_TEMP_CAL_WARNING c=20 r=4
extern const char MSG_USERWAIT [] PROGMEM_I1 = ISTR("Wait for user..."); ////MSG_USERWAIT c=20
extern const char MSG_NO_MOVE [] PROGMEM_I1 = ISTR("No move."); ////MSG_NO_MOVE c=20
extern const char MSG_BED_HEATING_SAFETY_DISABLED [] PROGMEM_I1 = ISTR("Heating disabled by safety timer."); ////MSG_BED_HEATING_SAFETY_DISABLED c=20 r=4
extern const char MSG_PRESS_TO_PREHEAT [] PROGMEM_I1 = ISTR("Press the knob to preheat nozzle and continue."); ////MSG_PRESS_TO_PREHEAT c=20 r=4
extern const char MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 [] PROGMEM_I1 = ISTR("Improving bed calibration point"); ////MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 c=20 r=4
extern const char MSG_MMU_RESTORE_TEMP [] PROGMEM_I1 = ISTR("MMU Retry: Restoring temperature..."); ////MSG_MMU_RESTORE_TEMP c=20 r=4
extern const char MSG_MMU_SENSITIVITY [] PROGMEM_I1 = ISTR("Sensitivity"); ////MSG_MMU_SENSITIVITY c=18
extern const char MSG_RECOVERING_PRINT [] PROGMEM_I1 = ISTR("Recovering print"); ////MSG_RECOVERING_PRINT c=20
extern const char MSG_HOMEYZ_DONE [] PROGMEM_I1 = ISTR("Calibration done"); ////MSG_HOMEYZ_DONE c=20
extern const char MSG_PINDA_PREHEAT [] PROGMEM_I1 = ISTR("PINDA Heating"); ////MSG_PINDA_PREHEAT c=20
extern const char MSG_PID_RUNNING [] PROGMEM_I1 = ISTR("PID cal."); ////MSG_PID_RUNNING c=20
extern const char MSG_PID_FINISHED [] PROGMEM_I1 = ISTR("PID cal. finished"); ////MSG_PID_FINISHED c=20
extern const char MSG_AMBIENT [] PROGMEM_I1 = ISTR("Ambient"); ////MSG_AMBIENT c=14
extern const char MSG_DATE [] PROGMEM_I1 = ISTR("Date:"); ////MSG_DATE c=17
extern const char MSG_MMU_CONNECTED [] PROGMEM_I1 = ISTR("MMU connected"); ////MSG_MMU_CONNECTED c=18
extern const char MSG_UNKNOWN [] PROGMEM_I1 = ISTR("unknown"); ////MSG_UNKNOWN c=13
extern const char MSG_PRINTER_IP [] PROGMEM_I1 = ISTR("Printer IP Addr:"); ////MSG_PRINTER_IP c=18
extern const char MSG_XYZ_DETAILS [] PROGMEM_I1 = ISTR("XYZ cal. details"); ////MSG_XYZ_DETAILS c=18
extern const char MSG_INFO_EXTRUDER [] PROGMEM_I1 = ISTR("Extruder info"); ////MSG_INFO_EXTRUDER c=18
extern const char MSG_INFO_SENSORS [] PROGMEM_I1 = ISTR("Sensor info"); ////MSG_INFO_SENSORS c=18
extern const char MSG_MENU_TEMPERATURES [] PROGMEM_I1 = ISTR("Temperatures"); ////MSG_MENU_TEMPERATURES c=18
extern const char MSG_MENU_VOLTAGES [] PROGMEM_I1 = ISTR("Voltages"); ////MSG_MENU_VOLTAGES c=18
extern const char MSG_PRESS_KNOB [] PROGMEM_I1 = ISTR("Press the knob"); ////MSG_PRESS_KNOB c=20
extern const char MSG_TO_LOAD_FIL [] PROGMEM_I1 = ISTR("to load filament"); ////MSG_TO_LOAD_FIL c=20
extern const char MSG_TO_UNLOAD_FIL [] PROGMEM_I1 = ISTR("to unload filament"); ////MSG_TO_UNLOAD_FIL c=20
extern const char MSG_PREHEATING_TO_LOAD [] PROGMEM_I1 = ISTR("Preheating to load"); ////MSG_PREHEATING_TO_LOAD c=20
extern const char MSG_PREHEATING_TO_UNLOAD [] PROGMEM_I1 = ISTR("Preheating to unload"); ////MSG_PREHEATING_TO_UNLOAD c=20
extern const char MSG_PREHEATING_TO_EJECT [] PROGMEM_I1 = ISTR("Preheating to eject"); ////MSG_PREHEATING_TO_EJECT c=20
extern const char MSG_PREHEATING_TO_CUT [] PROGMEM_I1 = ISTR("Preheating to cut"); ////MSG_PREHEATING_TO_CUT c=20
extern const char MSG_INSERT_FILAMENT [] PROGMEM_I1 = ISTR("Insert filament"); ////MSG_INSERT_FILAMENT c=20
extern const char MSG_PRESS [] PROGMEM_I1 = ISTR("and press the knob"); ////MSG_PRESS c=20 r=2
extern const char MSG_CHANGE_SUCCESS [] PROGMEM_I1 = ISTR("Change success!"); ////MSG_CHANGE_SUCCESS c=20
extern const char MSG_LOADING_COLOR [] PROGMEM_I1 = ISTR("Loading color"); ////MSG_LOADING_COLOR c=20
extern const char MSG_CORRECTLY [] PROGMEM_I1 = ISTR("Changed correctly"); ////MSG_CORRECTLY c=19
extern const char MSG_NOT_LOADED [] PROGMEM_I1 = ISTR("Filament not loaded"); ////MSG_NOT_LOADED c=19
extern const char MSG_NOT_COLOR [] PROGMEM_I1 = ISTR("Color not correct"); ////MSG_NOT_COLOR c=19
#ifndef REMOVE_AUTOLOAD_FILAMENT_MENU_ENTRY
extern const char MSG_AUTOLOADING_ENABLED [] PROGMEM_I1 = ISTR("Autoloading filament is active, just press the knob and insert filament..."); ////MSG_AUTOLOADING_ENABLED c=20 r=4
#endif //REMOVE_AUTOLOAD_FILAMENT_MENU_ENTRY
extern const char MSG_FILAMENT_USED [] PROGMEM_I1 = ISTR("Filament used"); ////MSG_FILAMENT_USED c=19
extern const char MSG_PRINT_TIME [] PROGMEM_I1 = ISTR("Print time"); ////MSG_PRINT_TIME c=19
extern const char MSG_TOTAL_FILAMENT [] PROGMEM_I1 = ISTR("Total filament"); ////MSG_TOTAL_FILAMENT c=19
extern const char MSG_TOTAL_PRINT_TIME [] PROGMEM_I1 = ISTR("Total print time"); ////MSG_TOTAL_PRINT_TIME c=19
extern const char MSG_Y_DIST_FROM_MIN [] PROGMEM_I1 = ISTR("Y distance from min"); ////MSG_Y_DIST_FROM_MIN c=20
extern const char MSG_LEFT [] PROGMEM_I1 = ISTR("Left"); ////MSG_LEFT c=10
extern const char MSG_RIGHT [] PROGMEM_I1 = ISTR("Right"); ////MSG_RIGHT c=10
extern const char MSG_MEASURED_SKEW [] PROGMEM_I1 = ISTR("Measured skew"); ////MSG_MEASURED_SKEW c=14
extern const char MSG_SLIGHT_SKEW [] PROGMEM_I1 = ISTR("Slight skew"); ////MSG_SLIGHT_SKEW c=14
extern const char MSG_SEVERE_SKEW [] PROGMEM_I1 = ISTR("Severe skew"); ////MSG_SEVERE_SKEW c=14
extern const char MSG_MEASURED_OFFSET [] PROGMEM_I1 = ISTR("[0;0] point offset"); ////MSG_MEASURED_OFFSET c=20
extern const char MSG_BABYSTEPPING_Z [] PROGMEM_I1 = ISTR("Adjusting Z"); ////MSG_BABYSTEPPING_Z c=13
extern const char MSG_BED_CORRECTION_LEFT [] PROGMEM_I1 = ISTR("Left side [\xe4m]"); ////MSG_BED_CORRECTION_LEFT c=14
extern const char MSG_BED_CORRECTION_RIGHT [] PROGMEM_I1 = ISTR("Right side[\xe4m]"); ////MSG_BED_CORRECTION_RIGHT c=14
extern const char MSG_BED_CORRECTION_FRONT [] PROGMEM_I1 = ISTR("Front side[\xe4m]"); ////MSG_BED_CORRECTION_FRONT c=14
extern const char MSG_BED_CORRECTION_REAR [] PROGMEM_I1 = ISTR("Rear side [\xe4m]"); ////MSG_BED_CORRECTION_REAR c=14
extern const char MSG_SET_TEMPERATURE [] PROGMEM_I1 = ISTR("Set temperature:"); ////MSG_SET_TEMPERATURE c=20
extern const char MSG_WAITING_TEMP_PINDA [] PROGMEM_I1 = ISTR("Waiting for PINDA probe cooling"); ////MSG_WAITING_TEMP_PINDA c=20 r=3
extern const char MSG_WAITING_TEMP [] PROGMEM_I1 = ISTR("Waiting for nozzle and bed cooling"); ////MSG_WAITING_TEMP c=20 r=4
extern const char MSG_MOVE_CARRIAGE_TO_THE_TOP_Z [] PROGMEM_I1 = ISTR("Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done."); ////MSG_MOVE_CARRIAGE_TO_THE_TOP_Z c=20 r=8
extern const char MSG_MOVE_CARRIAGE_TO_THE_TOP [] PROGMEM_I1 = ISTR("Calibrating XYZ. Rotate the knob to move the Z carriage up to the end stoppers. Click when done."); ////MSG_MOVE_CARRIAGE_TO_THE_TOP c=20 r=8
extern const char MSG_CONFIRM_CARRIAGE_AT_THE_TOP [] PROGMEM_I1 = ISTR("Are left and right Z-carriages all up?"); ////MSG_CONFIRM_CARRIAGE_AT_THE_TOP c=20 r=3
extern const char MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND [] PROGMEM_I1 = ISTR("XYZ calibration failed. Bed calibration point was not found."); ////MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND c=20 r=6
extern const char MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR [] PROGMEM_I1 = ISTR("XYZ calibration failed. Front calibration points not reachable."); ////MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR c=20 r=6
extern const char MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR [] PROGMEM_I1 = ISTR("XYZ calibration failed. Right front calibration point not reachable."); ////MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR c=20 r=6
extern const char MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_BOTH_FAR [] PROGMEM_I1 = ISTR("XYZ calibration compromised. Front calibration points not reachable."); ////MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_BOTH_FAR c=20 r=8
extern const char MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR [] PROGMEM_I1 = ISTR("XYZ calibration compromised. Right front calibration point not reachable."); ////MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR c=20 r=8
extern const char MSG_BED_SKEW_OFFSET_DETECTION_PERFECT [] PROGMEM_I1 = ISTR("XYZ calibration ok. X/Y axes are perpendicular. Congratulations!"); ////MSG_BED_SKEW_OFFSET_DETECTION_PERFECT c=20 r=8
extern const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_MILD [] PROGMEM_I1 = ISTR("XYZ calibration all right. X/Y axes are slightly skewed. Good job!"); ////MSG_BED_SKEW_OFFSET_DETECTION_SKEW_MILD c=20 r=8
extern const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME [] PROGMEM_I1 = ISTR("XYZ calibration all right. Skew will be corrected automatically."); ////MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME c=20 r=8
extern const char MSG_PINDA_CAL_FAILED [] PROGMEM_I1 = ISTR("PINDA calibration failed"); ////MSG_PINDA_CAL_FAILED c=20 r=4
extern const char MSG_MOVE_X [] PROGMEM_I1 = ISTR("Move X"); ////MSG_MOVE_X c=18
extern const char MSG_MOVE_Y [] PROGMEM_I1 = ISTR("Move Y"); ////MSG_MOVE_Y c=18
extern const char MSG_MOVE_Z [] PROGMEM_I1 = ISTR("Move Z"); ////MSG_MOVE_Z c=18
extern const char MSG_CRASH_DET_ONLY_IN_NORMAL [] PROGMEM_I1 = ISTR("Crash detection can\nbe turned on only in\nNormal mode"); ////MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4
extern const char MSG_CRASH_DET_STEALTH_FORCE_OFF [] PROGMEM_I1 = ISTR("WARNING:\nCrash detection\ndisabled in\nStealth mode"); ////MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4
extern const char MSG_MODE_CHANGE_IN_PROGRESS [] PROGMEM_I1 = ISTR("Mode change in progress..."); ////MSG_MODE_CHANGE_IN_PROGRESS c=20 r=3
extern const char MSG_COPY_SEL_LANG [] PROGMEM_I1 = ISTR("Copy selected language?"); ////MSG_COPY_SEL_LANG c=20 r=3
extern const char MSG_SHEET_OFFSET [] PROGMEM_I1 = ISTR("Sheet %.7s\nZ offset: %+1.3fmm\n%cContinue\n%cReset"); ////MSG_SHEET_OFFSET c=20 r=4
extern const char MSG_PLEASE_LOAD_PLA [] PROGMEM_I1 = ISTR("Please load filament first."); ////MSG_PLEASE_LOAD_PLA c=20 r=4
extern const char MSG_WIZARD_RERUN [] PROGMEM_I1 = ISTR("Running Wizard will delete current calibration results and start from the beginning."); ////MSG_WIZARD_RERUN c=20 r=7
extern const char MSG_MMU_INSERT_FILAMENT_FIRST_TUBE [] PROGMEM_I1 = ISTR("Please insert filament into the first tube of the MMU, then press the knob to load it."); ////MSG_MMU_INSERT_FILAMENT_FIRST_TUBE c=20 r=6
extern const char MSG_WIZARD_LOAD_FILAMENT [] PROGMEM_I1 = ISTR("Please insert filament into the extruder, then press the knob to load it."); ////MSG_WIZARD_LOAD_FILAMENT c=20 r=6
extern const char MSG_WIZARD_V2_CAL [] PROGMEM_I1 = ISTR("Now I will calibrate distance between tip of the nozzle and heatbed surface."); ////MSG_WIZARD_V2_CAL c=20 r=8
extern const char MSG_SELECT_FIL_1ST_LAYERCAL [] PROGMEM_I1 = ISTR("Select a filament for the First Layer Calibration and select it in the on-screen menu."); ////MSG_SELECT_FIL_1ST_LAYERCAL c=20 r=7
extern const char MSG_SELECT_TEMP_MATCHES_MATERIAL [] PROGMEM_I1 = ISTR("Select temperature which matches your material."); ////MSG_SELECT_TEMP_MATCHES_MATERIAL c=20 r=4
extern const char MSG_WIZARD_V2_CAL_2 [] PROGMEM_I1 = ISTR("The printer will start printing a zig-zag line. Rotate the knob until you reach the optimal height. Check the pictures in the handbook (Calibration chapter)."); ////MSG_WIZARD_V2_CAL_2 c=20 r=12
extern const char MSG_WIZARD_SELFTEST [] PROGMEM_I1 = ISTR("First, I will run the selftest to check most common assembly problems."); ////MSG_WIZARD_SELFTEST c=20 r=8
extern const char MSG_WIZARD_XYZ_CAL [] PROGMEM_I1 = ISTR("I will run xyz calibration now. It will take up to 24 mins."); ////MSG_WIZARD_XYZ_CAL c=20 r=8
extern const char MSG_REMOVE_SHIPPING_HELPERS [] PROGMEM_I1 = ISTR("Please remove shipping helpers first."); ////MSG_REMOVE_SHIPPING_HELPERS c=20 r=3
extern const char MSG_REMOVE_TEST_PRINT [] PROGMEM_I1 = ISTR("Now remove the test print from steel sheet."); ////MSG_REMOVE_TEST_PRINT c=20 r=4
extern const char MSG_WIZARD_Z_CAL [] PROGMEM_I1 = ISTR("I will run z calibration now."); ////MSG_WIZARD_Z_CAL c=20 r=8
extern const char MSG_WIZARD_WILL_PREHEAT [] PROGMEM_I1 = ISTR("Now I will preheat nozzle for PLA."); ////MSG_WIZARD_WILL_PREHEAT c=20 r=4
extern const char MSG_TM_CAL [] PROGMEM_I1 = ISTR("Thermal model cal. takes approx. 12 mins. See\nprusa.io/tm-cal"); ////MSG_TM_CAL c=20 r=4
extern const char MSG_SEL_PREHEAT_TEMP [] PROGMEM_I1 = ISTR("Select nozzle preheat temperature which matches your material."); ////MSG_SEL_PREHEAT_TEMP c=20 r=6
extern const char MSG_WIZARD_REPEAT_V2_CAL [] PROGMEM_I1 = ISTR("Do you want to repeat last step to readjust distance between nozzle and heatbed?"); ////MSG_WIZARD_REPEAT_V2_CAL c=20 r=7
extern const char MSG_WIZARD_CLEAN_HEATBED [] PROGMEM_I1 = ISTR("Please clean heatbed and then press the knob."); ////MSG_WIZARD_CLEAN_HEATBED c=20 r=8
extern const char MSG_ADDITIONAL_SHEETS [] PROGMEM_I1 = ISTR("If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets."); ////MSG_ADDITIONAL_SHEETS c=20 r=8
extern const char MSG_X_CORRECTION [] PROGMEM_I1 = ISTR("X-correct"); ////MSG_X_CORRECTION c=13
extern const char MSG_Y_CORRECTION [] PROGMEM_I1 = ISTR("Y-correct"); ////MSG_Y_CORRECTION c=13
extern const char MSG_Z_CORRECTION [] PROGMEM_I1 = ISTR("Z-correct"); ////MSG_Z_CORRECTION c=13
extern const char MSG_EXTRUDER_CORRECTION [] PROGMEM_I1 = ISTR("E-correct"); ////MSG_EXTRUDER_CORRECTION c=13
extern const char MSG_CHECKS [] PROGMEM_I1 = ISTR("Checks"); ////MSG_CHECKS c=18
extern const char MSG_TEMPERATURE [] PROGMEM_I1 = ISTR("Temperature"); ////MSG_TEMPERATURE c=18
extern const char MSG_MOVE_AXIS [] PROGMEM_I1 = ISTR("Move axis"); ////MSG_MOVE_AXIS c=18
extern const char MSG_DISABLE_STEPPERS [] PROGMEM_I1 = ISTR("Disable steppers"); ////MSG_DISABLE_STEPPERS c=18
extern const char MSG_LIN_CORRECTION [] PROGMEM_I1 = ISTR("Lin. correction"); ////MSG_LIN_CORRECTION c=18
extern const char MSG_WIZARD [] PROGMEM_I1 = ISTR("Wizard"); ////MSG_WIZARD c=17
extern const char MSG_BELTTEST [] PROGMEM_I1 = ISTR("Belt test"); ////MSG_BELTTEST c=18
extern const char MSG_SELFTEST [] PROGMEM_I1 = ISTR("Selftest"); ////MSG_SELFTEST c=18
extern const char MSG_CALIBRATE_BED [] PROGMEM_I1 = ISTR("Calibrate XYZ"); ////MSG_CALIBRATE_BED c=18
extern const char MSG_BED_CORRECTION_MENU [] PROGMEM_I1 = ISTR("Bed level correct"); ////MSG_BED_CORRECTION_MENU c=18
extern const char MSG_PID_EXTRUDER [] PROGMEM_I1 = ISTR("PID calibration"); ////MSG_PID_EXTRUDER c=17
extern const char MSG_SHOW_END_STOPS [] PROGMEM_I1 = ISTR("Show end stops"); ////MSG_SHOW_END_STOPS c=18
extern const char MSG_CALIBRATE_BED_RESET [] PROGMEM_I1 = ISTR("Reset XYZ calibr."); ////MSG_CALIBRATE_BED_RESET c=18
extern const char MSG_SELECT [] PROGMEM_I1 = ISTR("Select"); ////MSG_SELECT c=18
extern const char MSG_RENAME [] PROGMEM_I1 = ISTR("Rename"); ////MSG_RENAME c=18
extern const char MSG_PREHEAT [] PROGMEM_I1 = ISTR("Preheat"); ////MSG_PREHEAT c=18
extern const char MSG_CNG_SDCARD [] PROGMEM_I1 = ISTR("Change SD card"); ////MSG_CNG_SDCARD c=18
extern const char MSG_NO_CARD [] PROGMEM_I1 = ISTR("No SD card"); ////MSG_NO_CARD c=18
extern const char MSG_INIT_SDCARD [] PROGMEM_I1 = ISTR("Init. SD card"); ////MSG_INIT_SDCARD c=18
extern const char MSG_LOAD_TO_NOZZLE [] PROGMEM_I1 = ISTR("Load to nozzle"); ////MSG_LOAD_TO_NOZZLE c=18
extern const char MSG_AUTOLOAD_FILAMENT [] PROGMEM_I1 = ISTR("AutoLoad filament"); ////MSG_AUTOLOAD_FILAMENT c=18
extern const char MSG_STATISTICS [] PROGMEM_I1 = ISTR("Statistics"); ////MSG_STATISTICS c=18
extern const char MSG_FAIL_STATS [] PROGMEM_I1 = ISTR("Fail stats"); ////MSG_FAIL_STATS c=18
extern const char MSG_MMU_FAIL_STATS [] PROGMEM_I1 = ISTR("Fail stats MMU"); ////MSG_MMU_FAIL_STATS c=18
extern const char MSG_SUPPORT [] PROGMEM_I1 = ISTR("Support"); ////MSG_SUPPORT c=18
extern const char MSG_SPEED [] PROGMEM_I1 = ISTR("Speed"); ////MSG_SPEED c=15
extern const char MSG_FLOW [] PROGMEM_I1 = ISTR("Flow"); ////MSG_FLOW c=15
extern const char MSG_INSERT_FIL [] PROGMEM_I1 = ISTR("Insert the filament (do not load it) into the extruder and then press the knob."); ////MSG_INSERT_FIL c=20 r=6
extern const char MSG_UNLOAD_FILAMENT_REPEAT [] PROGMEM_I1 = ISTR("Please unload the filament first, then repeat this action."); ////MSG_UNLOAD_FILAMENT_REPEAT c=20 r=4
extern const char MSG_CHECK_IR_CONNECTION [] PROGMEM_I1 = ISTR("Please check the IR sensor connection, unload filament if present."); ////MSG_CHECK_IR_CONNECTION c=20 r=4
extern const char MSG_FS_VERIFIED [] PROGMEM_I1 = ISTR("Sensor verified, remove the filament now."); ////MSG_FS_VERIFIED c=20 r=3
extern const char MSG_FIL_FAILED [] PROGMEM_I1 = ISTR("Verification failed, remove the filament and try again."); ////MSG_FIL_FAILED c=20 r=4
extern const char MSG_SELFTEST_START [] PROGMEM_I1 = ISTR("Selftest start"); ////MSG_SELFTEST_START c=20
extern const char MSG_SELFTEST_OK [] PROGMEM_I1 = ISTR("Selftest OK"); ////MSG_SELFTEST_OK c=20
extern const char MSG_SELFTEST_ERROR [] PROGMEM_I1 = ISTR("Selftest error!"); ////MSG_SELFTEST_ERROR c=20
extern const char MSG_SELFTEST_PLEASECHECK [] PROGMEM_I1 = ISTR("Please check:"); ////MSG_SELFTEST_PLEASECHECK c=20
extern const char MSG_SELFTEST_HEATERTHERMISTOR [] PROGMEM_I1 = ISTR("Heater/Thermistor"); ////MSG_SELFTEST_HEATERTHERMISTOR c=20
extern const char MSG_SELFTEST_NOTCONNECTED [] PROGMEM_I1 = ISTR("Not connected"); ////MSG_SELFTEST_NOTCONNECTED c=20
extern const char MSG_SELFTEST_BEDHEATER [] PROGMEM_I1 = ISTR("Bed/Heater"); ////MSG_SELFTEST_BEDHEATER c=20
extern const char MSG_SELFTEST_ENDSTOPS [] PROGMEM_I1 = ISTR("Endstops"); ////MSG_SELFTEST_ENDSTOPS c=20
extern const char MSG_SELFTEST_ENDSTOP [] PROGMEM_I1 = ISTR("Endstop"); ////MSG_SELFTEST_ENDSTOP c=16
extern const char MSG_SELFTEST_ENDSTOP_NOTHIT [] PROGMEM_I1 = ISTR("Endstop not hit"); ////MSG_SELFTEST_ENDSTOP_NOTHIT c=20
extern const char MSG_LOOSE_PULLEY [] PROGMEM_I1 = ISTR("Loose pulley"); ////MSG_LOOSE_PULLEY c=20
extern const char MSG_SELFTEST_AXIS_LENGTH [] PROGMEM_I1 = ISTR("Axis length"); ////MSG_SELFTEST_AXIS_LENGTH c=20
extern const char MSG_SELFTEST_AXIS [] PROGMEM_I1 = ISTR("Axis"); ////MSG_SELFTEST_AXIS c=16
extern const char MSG_SELFTEST_FANS [] PROGMEM_I1 = ISTR("Front/left fans"); ////MSG_SELFTEST_FANS c=20
extern const char MSG_SELFTEST_SWAPPED [] PROGMEM_I1 = ISTR("Swapped"); ////MSG_SELFTEST_SWAPPED c=16
extern const char MSG_FALSE_TRIGGERING [] PROGMEM_I1 = ISTR("False triggering"); ////MSG_FALSE_TRIGGERING c=20
extern const char MSG_SELFTEST_FS_LEVEL [] PROGMEM_I1 = ISTR("%s level expected"); ////MSG_SELFTEST_FS_LEVEL c=20
extern const char MSG_SELFTEST_CHECK_ENDSTOPS [] PROGMEM_I1 = ISTR("Checking endstops"); ////MSG_SELFTEST_CHECK_ENDSTOPS c=20
extern const char MSG_SELFTEST_CHECK_Z [] PROGMEM_I1 = ISTR("Checking Z axis"); ////MSG_SELFTEST_CHECK_Z c=20
extern const char MSG_SELFTEST_CHECK_HOTEND [] PROGMEM_I1 = ISTR("Checking hotend"); ////MSG_SELFTEST_CHECK_HOTEND c=20
extern const char MSG_SELFTEST_CHECK_ALLCORRECT [] PROGMEM_I1 = ISTR("All correct"); ////MSG_SELFTEST_CHECK_ALLCORRECT c=20
extern const char MSG_CALIBRATING_HOME [] PROGMEM_I1 = ISTR("Calibrating home"); ////MSG_CALIBRATING_HOME c=20
extern const char MSG_CHECKING_FILE [] PROGMEM_I1 = ISTR("Checking file"); ////MSG_CHECKING_FILE c=17
extern const char MSG_FILE_INCOMPLETE [] PROGMEM_I1 = ISTR("File incomplete."); ////MSG_FILE_INCOMPLETE c=20 r=3
extern const char MSG_SD_REMOVED [] PROGMEM_I1 = ISTR("Card removed"); ////MSG_SD_REMOVED c=20
extern const char MSG_NEW_FIRMWARE_AVAILABLE [] PROGMEM_I1 = ISTR("New firmware version available:"); ////MSG_NEW_FIRMWARE_AVAILABLE c=20 r=2
extern const char MSG_NEW_FIRMWARE_PLEASE_UPGRADE [] PROGMEM_I1 = ISTR("Please upgrade."); ////MSG_NEW_FIRMWARE_PLEASE_UPGRADE c=20
extern const char MSG_FW_MK3_DETECTED [] PROGMEM_I1 = ISTR(PRINTER_NAME " firmware detected on " PRINTER_NAME_ALTERNATE " printer"); ////MSG_FW_MK3_DETECTED c=20 r=4
//not internationalized messages
#if 0
const char MSG_FW_VERSION_BETA[] PROGMEM_N1 = "You are using a BETA firmware version! It is in a development state! Use this version with CAUTION as it may DAMAGE the printer!"; ////MSG_FW_VERSION_BETA c=20 r=8
#endif
const char MSG_SPOOL_JOIN[] PROGMEM_N1 = "SpoolJoin"; ////MSG_SPOOL_JOIN c=13
const char MSG_FIRMWARE[] PROGMEM_N1 = "Firmware"; ////MSG_FIRMWARE c=8
const char MSG_FILAMENT[] PROGMEM_N1 = "Filament"; ////MSG_FILAMENT c=8
const char MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY[] PROGMEM_N1 = "FlashAir"; ////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY c=8
const char MSG_PINDA[] PROGMEM_N1 = "PINDA"; ////MSG_PINDA c=5
const char MSG_WELCOME[] PROGMEM_N1 = WELCOME_MSG;
const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; ////
const char MSG_BROWNOUT_RESET[] PROGMEM_N1 = " Brown out Reset"; ////
const char MSG_EXTERNAL_RESET[] PROGMEM_N1 = " External Reset"; ////
const char MSG_FILE_SAVED[] PROGMEM_N1 = "Done saving file."; ////
const char MSG_POSITION_UNKNOWN[] PROGMEM_N1 = "Home X/Y before Z"; ////
const char MSG_SOFTWARE_RESET[] PROGMEM_N1 = " Software Reset"; ////
const char MSG_UNKNOWN_COMMAND[] PROGMEM_N1 = "Unknown command: \""; ////
const char MSG_WATCHDOG_RESET[] PROGMEM_N1 = " Watchdog Reset"; ////
const char MSG_Z_MAX[] PROGMEM_N1 = "z_max: "; ////
const char MSG_Z_MIN[] PROGMEM_N1 = "z_min: "; ////
const char MSG_ZPROBE_OUT[] PROGMEM_N1 = "Z probe out. bed"; ////
#ifdef ENABLE_AUTO_BED_LEVELING
const char MSG_ZPROBE_ZOFFSET[] PROGMEM_N1 = "Z Offset"; ////
#endif
const char MSG_TMC_OVERTEMP[] PROGMEM_N1 = "TMC DRIVER OVERTEMP"; ////
const char MSG_Enqueing[] PROGMEM_N1 = "enqueing \""; ////
const char MSG_ENDSTOPS_HIT[] PROGMEM_N1 = "endstops hit: "; ////
const char MSG_SD_ERR_WRITE_TO_FILE[] PROGMEM_N1 = "error writing to file"; ////
const char MSG_OK[] PROGMEM_N1 = "ok"; ////
const char MSG_OK_CAPS[] PROGMEM_N1 = "OK"; ////
@ -403,20 +219,11 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; ////
const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; ////
const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Supervision required."; ////
const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; ////
const char MSG_HOST_ACTION_ASK_PAUSE[] PROGMEM_N1 = "//action:pause"; ////
const char MSG_HOST_ACTION_PAUSED[] PROGMEM_N1 = "//action:paused"; ////
const char MSG_HOST_ACTION_ASK_RESUME[] PROGMEM_N1 = "//action:resume"; ////
const char MSG_HOST_ACTION_RESUMED[] PROGMEM_N1 = "//action:resumed"; ////
const char MSG_HOST_ACTION_CANCEL[] PROGMEM_N1 = "//action:cancel"; ////
const char MSG_HOST_ACTION_READY[] PROGMEM_N1 = "//action:ready"; ////
const char MSG_HOST_ACTION_NOT_READY[] PROGMEM_N1 = "//action:not_ready"; ////
const char MSG_HOST_ACTION_START[] PROGMEM_N1 = "//action:start"; ////
const char MSG_HOST_ACTION_UVLO_RECOVERY_READY[] PROGMEM_N1 = "//action:uvlo_recovery_ready"; ////
const char MSG_HOST_ACTION_UVLO_AUTO_RECOVERY_READY[] PROGMEM_N1 = "//action:uvlo_auto_recovery_ready"; ////
const char MSG_HOST_ACTION_NOTIFICATION[] PROGMEM_N1 = "//action:notification %S\n"; ////
#ifdef HOST_SHUTDOWN
const char MSG_HOST_ACTION_SHUTDOWN[] PROGMEM_N1 = "//action:shutdown"; ////
#endif //HOST_SHUTOWN
const char MSG_OCTOPRINT_ASK_PAUSE[] PROGMEM_N1 = "// action:pause"; ////
const char MSG_OCTOPRINT_PAUSED[] PROGMEM_N1 = "// action:paused"; ////
const char MSG_OCTOPRINT_ASK_RESUME[] PROGMEM_N1 = "// action:resume"; ////
const char MSG_OCTOPRINT_RESUMED[] PROGMEM_N1 = "// action:resumed"; ////
const char MSG_OCTOPRINT_CANCEL[] PROGMEM_N1 = "// action:cancel"; ////
const char MSG_FANCHECK_HOTEND[] PROGMEM_N1 = "Err:HOTEND FAN ERROR"; ////c=20
const char MSG_FANCHECK_PRINT[] PROGMEM_N1 = "Err:PRINT FAN ERROR"; ////c=20
const char MSG_M112_KILL[] PROGMEM_N1 = "M112 called. Emergency Stop."; ////c=20
@ -424,13 +231,10 @@ const char MSG_ADVANCE_K[] PROGMEM_N1 = "Advance K:"; ////c=13
const char MSG_POWERPANIC_DETECTED[] PROGMEM_N1 = "POWER PANIC DETECTED"; ////c=20
const char MSG_LCD_STATUS_CHANGED[] PROGMEM_N1 = "LCD status changed";
const char MSG_UNKNOWN_CODE[] PROGMEM_N1 = "Unknown %c code: %s\n";
const char MSG_FILAMENT_RUNOUT_DETECTED[] PROGMEM_N1 = "Filament runout detected!"; ////c=20 r=2
// Common G-gcodes
const char G1_E_F2700[] PROGMEM_N1 = "G1 E%-.3f F2700";
const char G28W[] PROGMEM_N1 = "G28 W";
const char MSG_G90[] PROGMEM_N1 = "G90";
const char MSG_G91[] PROGMEM_N1 = "G91";
const char MSG_M23[] PROGMEM_N1 = "M23 %s";
const char MSG_M24[] PROGMEM_N1 = "M24";
const char MSG_M83[] PROGMEM_N1 = "M83";

View File

@ -21,7 +21,6 @@ extern const char MSG_BED_HEATING[];
extern const char MSG_BED_LEVELING_FAILED_POINT_LOW[];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED[];
extern const char MSG_BELT_STATUS[];
extern const char MSG_EJECT[];
extern const char MSG_CANCEL[];
extern const char MSG_CALIBRATE_Z_AUTO[];
extern const char MSG_CARD_MENU[];
@ -38,6 +37,7 @@ extern const char MSG_ERROR[];
extern const char MSG_EXTRUDER[];
extern const char MSG_FANS_CHECK[];
extern const char MSG_FIL_RUNOUTS[];
extern const char MSG_FILAMENT[];
extern const char MSG_FAN_SPEED[];
extern const char MSG_HOTEND_FAN_SPEED[];
extern const char MSG_PRINT_FAN_SPEED[];
@ -78,7 +78,6 @@ extern const char MSG_NO[];
extern const char MSG_NOZZLE[];
extern const char MSG_PAPER[];
extern const char MSG_PAUSE_PRINT[];
extern const char MSG_PRINT_PAUSED[];
extern const char MSG_PLACE_STEEL_SHEET[];
extern const char MSG_PLEASE_WAIT[];
extern const char MSG_POWER_FAILURES[];
@ -104,15 +103,6 @@ extern const char MSG_SELFTEST_MOTOR[];
extern const char MSG_SELFTEST_FILAMENT_SENSOR[];
extern const char MSG_SELFTEST_WIRINGERROR[];
extern const char MSG_SETTINGS[];
#ifndef REPLACE_SETREADY
extern const char MSG_SET_READY[];
extern const char MSG_SET_NOT_READY[];
#else
extern const char MSG_HOSTPRINT[];
#endif
#ifdef HOST_SHUTDOWN
extern const char MSG_SHUTDOWN_HOST[];
#endif //HOST_SHUTOWN
extern const char MSG_SELECT_LANGUAGE[];
extern const char MSG_SORTING_FILES[];
extern const char MSG_TOTAL[];
@ -127,7 +117,6 @@ extern const char MSG_SILENT[];
extern const char MSG_NORMAL[];
extern const char MSG_STEALTH[];
extern const char MSG_STEEL_SHEET_CHECK[];
extern const char MSG_Z_CALIBRATION_PROMPT[];
extern const char MSG_STOP_PRINT[];
extern const char MSG_STOPPED[];
extern const char MSG_PINDA_CALIBRATION[];
@ -157,7 +146,6 @@ extern const char MSG_GCODE_NEWER_FIRMWARE_CONTINUE[];
extern const char MSG_GCODE_NEWER_FIRMWARE_CANCELLED[];
extern const char MSG_GCODE_DIFF_CONTINUE[];
extern const char MSG_GCODE_DIFF_CANCELLED[];
extern const char MSG_MISSING_FILAMENT[];
extern const char MSG_NOZZLE_DIFFERS_CONTINUE[];
extern const char MSG_NOZZLE_DIFFERS_CANCELLED[];
extern const char MSG_NOZZLE_DIAMETER[];
@ -200,201 +188,33 @@ extern const char MSG_LOAD_ALL[];
extern const char MSG_NOZZLE_CNG_MENU [];
extern const char MSG_NOZZLE_CNG_READ_HELP [];
extern const char MSG_NOZZLE_CNG_CHANGED [];
#ifdef QUICK_NOZZLE_CHANGE
extern const char MSG_NOZZLE_CNG_COOLDOWN [];
#endif //QUICK_NOZZLE_CHANGE
extern const char MSG_REPRINT [];
extern const char MSG_FILE_CNT [];
extern const char MSG_CHANGED_MOTHERBOARD [];
extern const char MSG_CHANGED_PRINTER [];
extern const char MSG_CHANGED_BOTH [];
extern const char MSG_DEFAULT_SETTINGS_LOADED [];
extern const char MSG_FORCE_SELFTEST [];
extern const char MSG_MBL_FAILED [];
extern const char MSG_ZLEVELING_ENFORCED [];
extern const char MSG_UNLOAD_SUCCESSFUL [];
extern const char MSG_CHECK_IDLER [];
extern const char MSG_RUN_XYZ [];
extern const char MSG_TEMP_CAL_WARNING [];
extern const char MSG_USERWAIT [];
extern const char MSG_NO_MOVE [];
extern const char MSG_BED_HEATING_SAFETY_DISABLED [];
extern const char MSG_PRESS_TO_PREHEAT [];
extern const char MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1 [];
extern const char MSG_MMU_RESTORE_TEMP [];
extern const char MSG_MMU_SENSITIVITY [];
extern const char MSG_RECOVERING_PRINT [];
extern const char MSG_HOMEYZ_DONE [];
extern const char MSG_PINDA_PREHEAT [];
extern const char MSG_PID_RUNNING [];
extern const char MSG_PID_FINISHED [];
extern const char MSG_AMBIENT [];
extern const char MSG_DATE [];
extern const char MSG_MMU_CONNECTED [];
extern const char MSG_UNKNOWN [];
extern const char MSG_PRINTER_IP [];
extern const char MSG_XYZ_DETAILS [];
extern const char MSG_INFO_EXTRUDER [];
extern const char MSG_INFO_SENSORS [];
extern const char MSG_MENU_TEMPERATURES [];
extern const char MSG_MENU_VOLTAGES [];
extern const char MSG_PRESS_KNOB [];
extern const char MSG_TO_LOAD_FIL [];
extern const char MSG_TO_UNLOAD_FIL [];
extern const char MSG_PREHEATING_TO_LOAD [];
extern const char MSG_PREHEATING_TO_UNLOAD [];
extern const char MSG_PREHEATING_TO_EJECT [];
extern const char MSG_PREHEATING_TO_CUT [];
extern const char MSG_INSERT_FILAMENT [];
extern const char MSG_PRESS [];
extern const char MSG_CHANGE_SUCCESS [];
extern const char MSG_LOADING_COLOR [];
extern const char MSG_CORRECTLY [];
extern const char MSG_NOT_LOADED [];
extern const char MSG_NOT_COLOR [];
#ifndef REMOVE_AUTOLOAD_FILAMENT_MENU_ENTRY
extern const char MSG_AUTOLOADING_ENABLED [];
#endif //REMOVE_AUTOLOAD_FILAMENT_MENU_ENTRY
extern const char MSG_FILAMENT_USED [];
extern const char MSG_PRINT_TIME [];
extern const char MSG_TOTAL_FILAMENT [];
extern const char MSG_TOTAL_PRINT_TIME [];
extern const char MSG_Y_DIST_FROM_MIN [];
extern const char MSG_LEFT [];
extern const char MSG_RIGHT [];
extern const char MSG_MEASURED_SKEW [];
extern const char MSG_SLIGHT_SKEW [];
extern const char MSG_SEVERE_SKEW [];
extern const char MSG_MEASURED_OFFSET [];
extern const char MSG_BABYSTEPPING_Z [];
extern const char MSG_BED_CORRECTION_LEFT [];
extern const char MSG_BED_CORRECTION_RIGHT [];
extern const char MSG_BED_CORRECTION_FRONT [];
extern const char MSG_BED_CORRECTION_REAR [];
extern const char MSG_SET_TEMPERATURE [];
extern const char MSG_WAITING_TEMP_PINDA [];
extern const char MSG_WAITING_TEMP [];
extern const char MSG_MOVE_CARRIAGE_TO_THE_TOP_Z [];
extern const char MSG_MOVE_CARRIAGE_TO_THE_TOP [];
extern const char MSG_CONFIRM_CARRIAGE_AT_THE_TOP [];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND [];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR [];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR [];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_BOTH_FAR [];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR [];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_PERFECT [];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_MILD [];
extern const char MSG_BED_SKEW_OFFSET_DETECTION_SKEW_EXTREME [];
extern const char MSG_PINDA_CAL_FAILED [];
extern const char MSG_MOVE_X [];
extern const char MSG_MOVE_Y [];
extern const char MSG_MOVE_Z [];
extern const char MSG_CRASH_DET_ONLY_IN_NORMAL [];
extern const char MSG_CRASH_DET_STEALTH_FORCE_OFF [];
extern const char MSG_MODE_CHANGE_IN_PROGRESS [];
extern const char MSG_COPY_SEL_LANG [];
extern const char MSG_SHEET_OFFSET [];
extern const char MSG_PLEASE_LOAD_PLA [];
extern const char MSG_WIZARD_RERUN [];
extern const char MSG_MMU_INSERT_FILAMENT_FIRST_TUBE [];
extern const char MSG_WIZARD_LOAD_FILAMENT [];
extern const char MSG_WIZARD_V2_CAL [];
extern const char MSG_SELECT_FIL_1ST_LAYERCAL [];
extern const char MSG_SELECT_TEMP_MATCHES_MATERIAL [];
extern const char MSG_WIZARD_V2_CAL_2 [];
extern const char MSG_WIZARD_SELFTEST [];
extern const char MSG_WIZARD_XYZ_CAL [];
extern const char MSG_REMOVE_SHIPPING_HELPERS [];
extern const char MSG_REMOVE_TEST_PRINT [];
extern const char MSG_WIZARD_Z_CAL [];
extern const char MSG_WIZARD_WILL_PREHEAT [];
extern const char MSG_TM_CAL [];
extern const char MSG_SEL_PREHEAT_TEMP [];
extern const char MSG_WIZARD_REPEAT_V2_CAL [];
extern const char MSG_WIZARD_CLEAN_HEATBED [];
extern const char MSG_ADDITIONAL_SHEETS [];
extern const char MSG_X_CORRECTION [];
extern const char MSG_Y_CORRECTION [];
extern const char MSG_Z_CORRECTION [];
extern const char MSG_EXTRUDER_CORRECTION [];
extern const char MSG_CHECKS [];
extern const char MSG_TEMPERATURE [];
extern const char MSG_MOVE_AXIS [];
extern const char MSG_DISABLE_STEPPERS [];
extern const char MSG_LIN_CORRECTION [];
extern const char MSG_WIZARD [];
extern const char MSG_BELTTEST [];
extern const char MSG_SELFTEST [];
extern const char MSG_CALIBRATE_BED [];
extern const char MSG_BED_CORRECTION_MENU [];
extern const char MSG_PID_EXTRUDER [];
extern const char MSG_SHOW_END_STOPS [];
extern const char MSG_CALIBRATE_BED_RESET [];
extern const char MSG_SELECT [];
extern const char MSG_RENAME [];
extern const char MSG_PREHEAT [];
extern const char MSG_CNG_SDCARD [];
extern const char MSG_NO_CARD [];
extern const char MSG_INIT_SDCARD [];
extern const char MSG_LOAD_TO_NOZZLE [];
extern const char MSG_AUTOLOAD_FILAMENT [];
extern const char MSG_STATISTICS [];
extern const char MSG_FAIL_STATS [];
extern const char MSG_MMU_FAIL_STATS [];
extern const char MSG_SUPPORT [];
extern const char MSG_SPEED [];
extern const char MSG_FLOW [];
extern const char MSG_INSERT_FIL [];
extern const char MSG_UNLOAD_FILAMENT_REPEAT [];
extern const char MSG_CHECK_IR_CONNECTION [];
extern const char MSG_FS_VERIFIED [];
extern const char MSG_FIL_FAILED [];
extern const char MSG_SELFTEST_START [];
extern const char MSG_SELFTEST_OK [];
extern const char MSG_SELFTEST_ERROR [];
extern const char MSG_SELFTEST_PLEASECHECK [];
extern const char MSG_SELFTEST_HEATERTHERMISTOR [];
extern const char MSG_SELFTEST_NOTCONNECTED [];
extern const char MSG_SELFTEST_BEDHEATER [];
extern const char MSG_SELFTEST_ENDSTOPS [];
extern const char MSG_SELFTEST_ENDSTOP [];
extern const char MSG_SELFTEST_ENDSTOP_NOTHIT [];
extern const char MSG_LOOSE_PULLEY [];
extern const char MSG_SELFTEST_AXIS_LENGTH [];
extern const char MSG_SELFTEST_AXIS [];
extern const char MSG_SELFTEST_FANS [];
extern const char MSG_SELFTEST_SWAPPED [];
extern const char MSG_FALSE_TRIGGERING [];
extern const char MSG_SELFTEST_FS_LEVEL [];
extern const char MSG_SELFTEST_CHECK_ENDSTOPS [];
extern const char MSG_SELFTEST_CHECK_Z [];
extern const char MSG_SELFTEST_CHECK_HOTEND [];
extern const char MSG_SELFTEST_CHECK_ALLCORRECT [];
extern const char MSG_CALIBRATING_HOME [];
extern const char MSG_CHECKING_FILE [];
extern const char MSG_FILE_INCOMPLETE [];
extern const char MSG_SD_REMOVED [];
extern const char MSG_NEW_FIRMWARE_AVAILABLE [];
extern const char MSG_NEW_FIRMWARE_PLEASE_UPGRADE [];
extern const char MSG_FW_MK3_DETECTED [];
//not internationalized messages
#if 0
extern const char MSG_FW_VERSION_BETA[];
#endif
extern const char MSG_SPOOL_JOIN[];
extern const char MSG_FIRMWARE[];
extern const char MSG_FILAMENT[];
extern const char MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY[];
extern const char MSG_PINDA[];
extern const char MSG_WELCOME[];
extern const char MSG_SD_WORKDIR_FAIL[];
extern const char MSG_BROWNOUT_RESET[];
extern const char MSG_EXTERNAL_RESET[];
extern const char MSG_FILE_SAVED[];
extern const char MSG_POSITION_UNKNOWN[];
extern const char MSG_SOFTWARE_RESET[];
extern const char MSG_UNKNOWN_COMMAND[];
extern const char MSG_WATCHDOG_RESET[];
extern const char MSG_Z_MAX[];
extern const char MSG_Z_MIN[];
extern const char MSG_ZPROBE_OUT[];
#ifdef ENABLE_AUTO_BED_LEVELING
extern const char MSG_ZPROBE_ZOFFSET[];
#endif
extern const char MSG_TMC_OVERTEMP[];
extern const char MSG_Enqueing[];
extern const char MSG_ENDSTOPS_HIT[];
extern const char MSG_SD_ERR_WRITE_TO_FILE[];
extern const char MSG_OK[];
extern const char MSG_OK_CAPS[];
@ -405,20 +225,11 @@ extern const char MSG_ERR_STOPPED[];
extern const char MSG_ENDSTOP_HIT[];
extern const char MSG_EJECT_FROM_MMU[];
extern const char MSG_CUT_FILAMENT[];
extern const char MSG_HOST_ACTION_ASK_PAUSE[];
extern const char MSG_HOST_ACTION_PAUSED[];
extern const char MSG_HOST_ACTION_ASK_RESUME[];
extern const char MSG_HOST_ACTION_RESUMED[];
extern const char MSG_HOST_ACTION_CANCEL[];
extern const char MSG_HOST_ACTION_READY[];
extern const char MSG_HOST_ACTION_NOT_READY[];
extern const char MSG_HOST_ACTION_START[];
extern const char MSG_HOST_ACTION_UVLO_RECOVERY_READY[];
extern const char MSG_HOST_ACTION_UVLO_AUTO_RECOVERY_READY[];
extern const char MSG_HOST_ACTION_NOTIFICATION[];
#ifdef HOST_SHUTDOWN
extern const char MSG_HOST_ACTION_SHUTDOWN[];
#endif //HOST_SHUTOWN
extern const char MSG_OCTOPRINT_ASK_PAUSE[];
extern const char MSG_OCTOPRINT_PAUSED[];
extern const char MSG_OCTOPRINT_ASK_RESUME[];
extern const char MSG_OCTOPRINT_RESUMED[];
extern const char MSG_OCTOPRINT_CANCEL[];
extern const char MSG_FANCHECK_HOTEND[];
extern const char MSG_FANCHECK_PRINT[];
extern const char MSG_M112_KILL[];
@ -426,13 +237,10 @@ extern const char MSG_ADVANCE_K[];
extern const char MSG_POWERPANIC_DETECTED[];
extern const char MSG_LCD_STATUS_CHANGED[];
extern const char MSG_UNKNOWN_CODE[];
extern const char MSG_FILAMENT_RUNOUT_DETECTED[];
// Common G-gcodes
extern const char G1_E_F2700[];
extern const char G28W[];
extern const char MSG_G90[];
extern const char MSG_G91[];
extern const char MSG_M23[];
extern const char MSG_M24[];
extern const char MSG_M83[];

View File

@ -12,9 +12,6 @@
#include "strlen_cx.h"
#include "SpoolJoin.h"
#include "messages.h"
#include "language.h"
#ifdef __AVR__
// As of FW 3.12 we only support building the FW with only one extruder, all the multi-extruder infrastructure will be removed.
// Saves at least 800B of code size
@ -34,7 +31,7 @@ void waitForHotendTargetTemp(uint16_t delay, F f) {
}
void WaitForHotendTargetTempBeep() {
waitForHotendTargetTemp(200, [] {});
waitForHotendTargetTemp(3000, []{ });
MakeSound(Prompt);
}
@ -55,38 +52,24 @@ MMU2::MMU2()
, tmcFailures(0) {
}
void MMU2::Status() {
// Useful information to see during bootup and change state
SERIAL_ECHOPGM("MMU is ");
uint8_t status = eeprom_init_default_byte((uint8_t*)EEPROM_MMU_ENABLED, 0);
if (status == 1) {
SERIAL_ECHOLNRPGM(_O(MSG_ON));
} else {
SERIAL_ECHOLNRPGM(_O(MSG_OFF));
}
}
void MMU2::Start() {
mmu2Serial.begin(MMU_BAUD);
PowerOn();
PowerOn(); // I repurposed this to serve as our EEPROM disable toggle.
mmu2Serial.flush(); // make sure the UART buffer is clear before starting communication
SetCurrentTool(MMU2_NO_TOOL);
extruder = MMU2_NO_TOOL;
state = xState::Connecting;
// start the communication
logic.ResetRetryAttempts();
logic.ResetCommunicationTimeoutAttempts();
state = xState::Connecting;
logic.Start();
}
MMU2::~MMU2() {}
logic.ResetRetryAttempts();
}
void MMU2::Stop() {
StopKeepPowered();
PowerOff();
PowerOff(); // This also disables the MMU in the EEPROM.
}
void MMU2::StopKeepPowered() {
@ -98,7 +81,8 @@ void MMU2::StopKeepPowered() {
void MMU2::Tune() {
switch (lastErrorCode) {
case ErrorCode::HOMING_SELECTOR_FAILED:
case ErrorCode::HOMING_IDLER_FAILED: {
case ErrorCode::HOMING_IDLER_FAILED:
{
// Prompt a menu for different values
tuneIdlerStallguardThreshold();
break;
@ -131,7 +115,7 @@ void MMU2::ResetX0() {
logic.ResetMMU(); // Send soft reset
}
void MMU2::ResetX42() {
void MMU2::ResetX42(){
logic.ResetMMU(42);
}
@ -142,9 +126,11 @@ void MMU2::TriggerResetPin() {
void MMU2::PowerCycle() {
// cut the power to the MMU and after a while restore it
// Sadly, MK3/S/+ cannot do this
Stop();
// NOTE: the below will toggle the EEPROM var. Should we
// assert this function is never called in the MK3 FW? Do we even care?
PowerOff();
safe_delay_keep_alive(1000);
Start();
PowerOn();
}
void MMU2::PowerOff() {
@ -156,9 +142,8 @@ void MMU2::PowerOn() {
}
bool MMU2::ReadRegister(uint8_t address) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
do {
logic.ReadRegister(address); // we may signal the accepted/rejected status of the response as return value of this function
} while (!manage_response(false, false));
@ -169,9 +154,8 @@ bool MMU2::ReadRegister(uint8_t address) {
}
bool __attribute__((noinline)) MMU2::WriteRegister(uint8_t address, uint16_t data) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
// special cases - intercept requests of registers which influence the printer's behaviour too + perform the change even on the printer's side
switch (address) {
@ -197,24 +181,30 @@ void MMU2::mmu_loop() {
// Atomic compare_exchange would have been the most appropriate solution here, but this gets called only in Marlin's task,
// so thread safety should be kept
static bool avoidRecursion = false;
if (avoidRecursion) {
if (avoidRecursion)
return;
}
avoidRecursion = true;
mmu_loop_inner(true);
avoidRecursion = false;
}
void __attribute__((noinline)) MMU2::mmu_loop_inner(bool reportErrors) {
logicStepLastStatus = LogicStep(reportErrors); // it looks like the mmu_loop doesn't need to be a blocking call
CheckErrorScreenUserInput();
if (isErrorScreenRunning()) {
// Call this every iteration to keep the knob rotation responsive
// This includes when mmu_loop is called within manage_response
ReportErrorHook((CommandInProgress)logic.CommandInProgress(), (uint16_t)lastErrorCode, uint8_t(lastErrorSource));
}
}
void MMU2::CheckFINDARunout() {
// Check for FINDA filament runout
if (!FindaDetectsFilament() && check_fsensor()) { // Check if we have filament runout detected from sensors
if (!FindaDetectsFilament() && check_fsensor()) {
SERIAL_ECHOLNPGM("FINDA filament runout!");
marlin_stop_and_save_print_to_ram();
stop_and_save_print_to_ram(0, 0);
restore_print_from_ram_and_continue(0);
if (SpoolJoin::spooljoin.isSpoolJoinEnabled() && get_current_tool() != (uint8_t)FILAMENT_UNKNOWN){ // Can't auto if F=?
enquecommand_front_P(PSTR("M600 AUTO")); // save print and run M600 command
@ -228,10 +218,10 @@ struct ReportingRAII {
CommandInProgress cip;
explicit inline __attribute__((always_inline)) ReportingRAII(CommandInProgress cip)
: cip(cip) {
BeginReport(cip, ProgressCode::EngagingIdler);
BeginReport(cip, (uint16_t)ProgressCode::EngagingIdler);
}
inline __attribute__((always_inline)) ~ReportingRAII() {
EndReport(cip, ProgressCode::OK);
EndReport(cip, (uint16_t)ProgressCode::OK);
}
};
@ -247,11 +237,11 @@ bool MMU2::WaitForMMUReady() {
}
}
bool MMU2::RetryIfPossible(ErrorCode ec) {
bool MMU2::RetryIfPossible(uint16_t ec) {
if (logic.RetryAttempts()) {
SetButtonResponse(ButtonOperations::Retry);
// check, that Retry is actually allowed on that operation
if (ButtonAvailable(ec) != Buttons::NoButton) {
if (ButtonAvailable(ec) != NoButton) {
logic.SetInAutoRetry(true);
SERIAL_ECHOLNPGM("RetryButtonPressed");
// We don't decrement until the button is acknowledged by the MMU.
@ -266,13 +256,23 @@ bool MMU2::RetryIfPossible(ErrorCode ec) {
bool MMU2::VerifyFilamentEnteredPTFE() {
planner_synchronize();
if (WhereIsFilament() != FilamentState::AT_FSENSOR)
if (WhereIsFilament() == FilamentState::NOT_PRESENT)
return false;
uint8_t fsensorState = 0;
uint8_t fsensorStateLCD = 0;
uint8_t lcd_cursor_col = 0;
// MMU has finished its load, push the filament further by some defined constant length
// If the filament sensor reads 0 at any moment, then report FAILURE
const float tryload_length = MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH - logic.ExtraLoadDistance();
TryLoadUnloadReporter tlur(tryload_length);
const float delta_mm = MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH - logic.ExtraLoadDistance();
// The total length is twice delta_mm. Divide that length by number of pixels
// available to get length per pixel.
// Note: Below is the reciprocal of (2 * delta_mm) / LCD_WIDTH [mm/pixel]
const float pixel_per_mm = 0.5f * float(LCD_WIDTH) / (delta_mm);
TryLoadUnloadProgressbarInit();
/* The position is a triangle wave
// current position is not zero, it is an offset
@ -284,7 +284,7 @@ bool MMU2::VerifyFilamentEnteredPTFE() {
// in the slope's sign or check the last machine position.
// y(x)
// ▲
// │ ^◄────────── tryload_length + current_position
// │ ^◄────────── delta_mm + current_position
// machine / \
// position │ / \◄────────── stepper_position_mm + current_position
// (mm) / \
@ -295,28 +295,42 @@ bool MMU2::VerifyFilamentEnteredPTFE() {
// pixel #
*/
bool filament_inserted = true; // expect success
// Pixel index will go from 0 to 10, then back from 10 to 0
// The change in this number is used to indicate a new pixel
// should be drawn on the display
uint8_t dpixel1 = 0;
uint8_t dpixel0 = 0;
for (uint8_t move = 0; move < 2; move++) {
extruder_move(move == 0 ? tryload_length : -tryload_length, MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE);
MoveE(move == 0 ? delta_mm : -delta_mm, MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE);
while (planner_any_moves()) {
filament_inserted = filament_inserted && (WhereIsFilament() == FilamentState::AT_FSENSOR);
tlur.Progress(filament_inserted);
safe_delay_keep_alive(0);
if (planner_draining()) {
return false; // power panic or a similar issue happened, bail out fast
// Wait for move to finish and monitor the fsensor the entire time
// A single 0 reading will set the bit.
fsensorStateLCD |= (WhereIsFilament() == FilamentState::NOT_PRESENT);
fsensorState |= fsensorStateLCD; // No need to do the above comparison twice, just bitwise OR
// Always round up, you can only have 'whole' pixels. (floor is also an option)
dpixel1 = ceil((stepper_get_machine_position_E_mm() - planner_get_current_position_E()) * pixel_per_mm);
if (dpixel1 - dpixel0) {
dpixel0 = dpixel1;
if (lcd_cursor_col > (LCD_WIDTH - 1)) lcd_cursor_col = LCD_WIDTH - 1;
TryLoadUnloadProgressbar(lcd_cursor_col++, fsensorStateLCD);
fsensorStateLCD = 0; // Clear temporary bit
}
safe_delay_keep_alive(0);
}
}
Disable_E0();
if (!filament_inserted) {
TryLoadUnloadProgressbarEcho();
TryLoadUnloadProgressbarDeinit();
if (fsensorState) {
IncrementLoadFails();
return false;
} else {
// else, happy printing! :)
return true;
}
tlur.DumpToSerial();
return filament_inserted;
}
bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
@ -326,9 +340,8 @@ bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
Disable_E0(); // it may seem counterintuitive to disable the E-motor, but it gets enabled in the planner whenever the E-motor is to move
tool_change_extruder = slot;
logic.ToolChange(slot); // let the MMU pull the filament out and push a new one in
if (manage_response(true, true)) {
if (manage_response(true, true))
break;
}
// otherwise: failed to perform the command - unload first and then let it run again
IncrementMMUFails();
@ -342,6 +355,8 @@ bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
// but honestly - if the MMU restarts during every toolchange,
// something else is seriously broken and stopping a print is probably our best option.
}
// reset current position to whatever the planner thinks it is
planner_set_current_position_E(planner_get_current_position_E());
if (VerifyFilamentEnteredPTFE()) {
return true; // success
} else { // Prepare a retry attempt
@ -356,9 +371,6 @@ bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
void MMU2::ToolChangeCommon(uint8_t slot) {
while (!ToolChangeCommonOnce(slot)) { // while not successfully fed into extruder's PTFE tube
if (planner_draining()) {
return; // power panic happening, pretend the G-code finished ok
}
// failed autoretry, report an error by forcing a "printer" error into the MMU infrastructure - it is a hack to leverage existing code
// @@TODO theoretically logic layer may not need to be spoiled with the printer error - may be just the manage_response needs it...
logic.SetPrinterError(ErrorCode::LOAD_TO_EXTRUDER_FAILED);
@ -369,16 +381,15 @@ void MMU2::ToolChangeCommon(uint8_t slot) {
static_cast<void>(manage_response(true, true)); // yes, I'd like to silence [[nodiscard]] warning at this spot by casting to void
}
SetCurrentTool(slot); // filament change is finished
extruder = slot; //filament change is finished
SpoolJoin::spooljoin.setSlot(slot);
++toolchange_counter;
}
bool MMU2::tool_change(uint8_t slot) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
if (slot != extruder) {
if (/*FindaDetectsFilament()*/
@ -403,9 +414,8 @@ bool MMU2::tool_change(uint8_t slot) {
///- Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
///- Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
bool MMU2::tool_change(char code, uint8_t slot) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
FSensorBlockRunout blockRunout;
@ -442,16 +452,9 @@ uint8_t MMU2::get_tool_change_tool() const {
return tool_change_extruder == MMU2_NO_TOOL ? (uint8_t)FILAMENT_UNKNOWN : tool_change_extruder;
}
void MMU2::SetCurrentTool(uint8_t ex){
extruder = ex;
MMU2_ECHO_MSGRPGM(PSTR("MMU2tool="));
SERIAL_ECHOLN((int)ex);
}
bool MMU2::set_filament_type(uint8_t /*slot*/, uint8_t /*type*/) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
// @@TODO - this is not supported in the new MMU yet
// slot = slot; // @@TODO
@ -476,31 +479,26 @@ void MMU2::UnloadInner() {
for (;;) {
Disable_E0();
logic.UnloadFilament();
if (manage_response(false, true)) {
if (manage_response(false, true))
break;
}
IncrementMMUFails();
}
MakeSound(Confirm);
// no active tool
SetCurrentTool(MMU2_NO_TOOL);
extruder = MMU2_NO_TOOL;
tool_change_extruder = MMU2_NO_TOOL;
}
bool MMU2::unload() {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
WaitForHotendTargetTempBeep();
{
ReportingRAII rep(CommandInProgress::UnloadFilament);
UnloadInner();
}
ScreenUpdateEnable();
return true;
}
@ -508,17 +506,15 @@ void MMU2::CutFilamentInner(uint8_t slot) {
for (;;) {
Disable_E0();
logic.CutFilament(slot);
if (manage_response(false, true)) {
if (manage_response(false, true))
break;
}
IncrementMMUFails();
}
}
bool MMU2::cut_filament(uint8_t slot, bool enableFullScreenMsg /*= true*/) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
if (enableFullScreenMsg) {
FullScreenMsgCut(slot);
@ -530,10 +526,10 @@ bool MMU2::cut_filament(uint8_t slot, bool enableFullScreenMsg /*= true*/) {
ReportingRAII rep(CommandInProgress::CutFilament);
CutFilamentInner(slot);
SetCurrentTool(MMU2_NO_TOOL);
}
extruder = MMU2_NO_TOOL;
tool_change_extruder = MMU2_NO_TOOL;
MakeSound(SoundType::Confirm);
}
ScreenUpdateEnable();
return true;
}
@ -548,31 +544,30 @@ bool MMU2::loading_test(uint8_t slot) {
}
bool MMU2::load_filament(uint8_t slot) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
FullScreenMsgLoad(slot);
{
ReportingRAII rep(CommandInProgress::LoadFilament);
for (;;) {
Disable_E0();
logic.LoadFilament(slot);
if (manage_response(false, false)) {
if (manage_response(false, false))
break;
}
IncrementMMUFails();
}
MakeSound(SoundType::Confirm);
}
ScreenUpdateEnable();
return true;
}
bool MMU2::load_filament_to_nozzle(uint8_t slot) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
WaitForHotendTargetTempBeep();
@ -597,9 +592,8 @@ bool MMU2::load_filament_to_nozzle(uint8_t slot) {
}
bool MMU2::eject_filament(uint8_t slot, bool enableFullScreenMsg /* = true */) {
if (!WaitForMMUReady()) {
if (!WaitForMMUReady())
return false;
}
if (enableFullScreenMsg) {
FullScreenMsgEject(slot);
@ -613,16 +607,14 @@ bool MMU2::eject_filament(uint8_t slot, bool enableFullScreenMsg /* = true */) {
for (;;) {
Disable_E0();
logic.EjectFilament(slot);
if (manage_response(false, true)) {
if (manage_response(false, true))
break;
}
IncrementMMUFails();
}
SetCurrentTool(MMU2_NO_TOOL);
}
extruder = MMU2_NO_TOOL;
tool_change_extruder = MMU2_NO_TOOL;
MakeSound(Confirm);
}
ScreenUpdateEnable();
return true;
}
@ -636,9 +628,8 @@ void MMU2::Home(uint8_t mode) {
}
void MMU2::SaveHotendTemp(bool turn_off_nozzle) {
if (mmu_print_saved & SavedState::Cooldown) {
if (mmu_print_saved & SavedState::Cooldown)
return;
}
if (turn_off_nozzle && !(mmu_print_saved & SavedState::CooldownPending)) {
Disable_E0();
@ -656,14 +647,14 @@ void MMU2::SaveAndPark(bool move_axes) {
// In case a power panic happens while waiting for the user
// take a partial back up of print state into RAM (current position, etc.)
marlin_refresh_print_state_in_ram();
refresh_print_state_in_ram();
if (move_axes) {
mmu_print_saved |= SavedState::ParkExtruder;
resume_position = planner_current_position(); // save current pos
// lift Z
move_raise_z(MMU_ERR_Z_PAUSE_LIFT);
MoveRaiseZ(MMU_ERR_Z_PAUSE_LIFT);
// move XY aside
if (all_axes_homed()) {
@ -671,6 +662,9 @@ void MMU2::SaveAndPark(bool move_axes) {
}
}
}
// keep the motors powered forever (until some other strategy is chosen)
// @@TODO do we need that in 8bit?
gcode_reset_stepper_timeout();
}
void MMU2::ResumeHotendTemp() {
@ -712,14 +706,14 @@ void MMU2::ResumeUnpark() {
// From this point forward, power panic should not use
// the partial backup in RAM since the extruder is no
// longer in parking position
marlin_clear_print_state_in_ram();
clear_print_state_in_ram();
mmu_print_saved &= ~(SavedState::ParkExtruder);
}
}
void MMU2::CheckUserInput() {
auto btn = ButtonPressed(lastErrorCode);
auto btn = ButtonPressed((uint16_t)lastErrorCode);
// Was a button pressed on the MMU itself instead of the LCD?
if (btn == Buttons::NoButton && lastButton != Buttons::NoButton) {
@ -727,7 +721,8 @@ void MMU2::CheckUserInput() {
lastButton = Buttons::NoButton; // Clear it.
}
if (mmu2.MMULastErrorSource() == ErrorSourcePrinter && btn != Buttons::NoButton) {
if (mmu2.MMULastErrorSource() == MMU2::ErrorSourcePrinter && btn != Buttons::NoButton)
{
// When the printer has raised an error screen, and a button was selected
// the error screen should always be dismissed.
ClearPrinterError();
@ -738,16 +733,16 @@ void MMU2::CheckUserInput() {
}
switch (btn) {
case Buttons::Left:
case Buttons::Middle:
case Buttons::Right:
case Left:
case Middle:
case Right:
SERIAL_ECHOPGM("CheckUserInput-btnLMR ");
SERIAL_ECHOLN((int)buttons_to_uint8t(btn));
SERIAL_ECHOLN(btn);
ResumeHotendTemp(); // Recover the hotend temp before we attempt to do anything else...
if (mmu2.MMULastErrorSource() == ErrorSourceMMU) {
if (mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) {
// Do not send a button to the MMU unless the MMU is in error state
Button(buttons_to_uint8t(btn));
Button(btn);
}
// A quick hack: for specific error codes move the E-motor every time.
@ -762,23 +757,22 @@ void MMU2::CheckUserInput() {
break;
}
break;
case Buttons::TuneMMU:
case TuneMMU:
Tune();
break;
case Buttons::Load:
case Buttons::Eject:
case Load:
case Eject:
// High level operation
SetPrinterButtonOperation(btn);
setPrinterButtonOperation(btn);
break;
case Buttons::ResetMMU:
case ResetMMU:
Reset(ResetPin); // we cannot do power cycle on the MK3
// ... but mmu2_power.cpp knows this and triggers a soft-reset instead.
break;
case Buttons::DisableMMU:
Stop();
DisableMMUInSettings();
case DisableMMU:
Stop(); // Poweroff handles updating the EEPROM shutoff.
break;
case Buttons::StopPrint:
case StopPrint:
// @@TODO not sure if we shall handle this high level operation at this spot
break;
default:
@ -807,7 +801,6 @@ bool MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
// - failed -> then do the safety moves on the printer like before
// - finished ok -> proceed with reading other commands
safe_delay_keep_alive(0); // calls LogicStep() and remembers its return status
// also disables stepper motor unlocking
if (mmu_print_saved & SavedState::CooldownPending) {
if (!nozzleTimeout.running()) {
@ -830,7 +823,8 @@ bool MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
// the E may have some more moves to finish - wait for them
ResumeHotendTemp();
ResumeUnpark(); // We can now travel back to the tower or wherever we were when we saved.
if (!TuneMenuEntered()) {
if (!TuneMenuEntered())
{
// If the error screen is sleeping (running 'Tune' menu)
// then don't reset retry attempts because we this will trigger
// an automatic retry attempt when 'Tune' button is selected. We want the
@ -876,58 +870,45 @@ bool MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
}
StepStatus MMU2::LogicStep(bool reportErrors) {
// Process any buttons before proceeding with another MMU Query
CheckUserInput();
const StepStatus ss = logic.Step();
CheckUserInput(); // Process any buttons before proceeding with another MMU Query
StepStatus ss = logic.Step();
switch (ss) {
case Finished:
// At this point it is safe to trigger a runout and not interrupt the MMU protocol
CheckFINDARunout();
break;
case Processing:
OnMMUProgressMsg(logic.Progress());
break;
case ButtonPushed:
lastButton = logic.Button();
LogEchoEvent_P(PSTR("MMU Button pushed"));
CheckUserInput(); // Process the button immediately
break;
case Interrupted:
// can be silently handed over to a higher layer, no processing necessary at this spot
break;
default:
if (reportErrors) {
switch (ss) {
case CommandError:
ReportError(logic.Error(), ErrorSourceMMU);
break;
case CommunicationTimeout:
state = xState::Connecting;
ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter);
break;
case ProtocolError:
state = xState::Connecting;
ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter);
break;
case VersionMismatch:
StopKeepPowered();
ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter);
break;
case PrinterError:
ReportError(logic.PrinterError(), ErrorSourcePrinter);
break;
default:
break;
}
@ -937,7 +918,6 @@ StepStatus MMU2::LogicStep(bool reportErrors) {
if (logic.Running()) {
state = xState::Active;
}
return ss;
}
@ -945,19 +925,15 @@ void MMU2::filament_ramming() {
execute_extruder_sequence(ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step));
}
void MMU2::execute_extruder_sequence(const E_Step *sequence, uint8_t stepCount) {
void MMU2::execute_extruder_sequence(const E_Step *sequence, uint8_t steps) {
planner_synchronize();
// Plan the moves
const E_Step *step = sequence;
for (uint8_t i = stepCount; i > 0; --i) {
extruder_move(pgm_read_float(&(step->extrude)), pgm_read_float(&(step->feedRate)));
for (uint8_t i = steps; i ; --i) {
MoveE(pgm_read_float(&(step->extrude)), pgm_read_float(&(step->feedRate)));
step++;
}
// Wait for the moves to finish
// it looks like it's better to sync the moves at the end - smoother move (if the sequence is not too long).
planner_synchronize();
planner_synchronize(); // it looks like it's better to sync the moves at the end - smoother move (if the sequence is not too long).
Disable_E0();
}
@ -1000,13 +976,12 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
if (ec != lastErrorCode) { // deduplicate: only report changes in error codes into the log
lastErrorCode = ec;
lastErrorSource = res;
LogErrorEvent_P(_O(PrusaErrorTitle(PrusaErrorCodeIndex(ec))));
LogErrorEvent_P(_O(PrusaErrorTitle(PrusaErrorCodeIndex((uint16_t)ec))));
if (ec != ErrorCode::OK && ec != ErrorCode::FILAMENT_EJECTED && ec != ErrorCode::FILAMENT_CHANGE) {
IncrementMMUFails();
// check if it is a "power" failure - we consider TMC-related errors as power failures
// clang-format off
static constexpr uint16_t tmcMask =
( (uint16_t)ErrorCode::TMC_IOIN_MISMATCH
| (uint16_t)ErrorCode::TMC_RESET
@ -1015,7 +990,6 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
| (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN
| (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR
| (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION ) & 0x7fffU; // skip the top bit
// clang-format on
static_assert(tmcMask == 0x7e00); // just make sure we fail compilation if any of the TMC error codes change
if ((uint16_t)ec & tmcMask) { // @@TODO can be optimized to uint8_t operation
@ -1025,11 +999,11 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
}
}
if (!mmu2.RetryIfPossible(ec)) {
if (!mmu2.RetryIfPossible((uint16_t)ec)) {
// If retry attempts are all used up
// or if 'Retry' operation is not available
// raise the MMU error screen and wait for user input
ReportErrorHook((CommandInProgress)logic.CommandInProgress(), ec, uint8_t(lastErrorSource));
// raise the MMU error sceen and wait for user input
ReportErrorHook((CommandInProgress)logic.CommandInProgress(), (uint16_t)ec, uint8_t(lastErrorSource));
}
static_assert(mmu2Magic[0] == 'M'
@ -1042,8 +1016,8 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
}
void MMU2::ReportProgress(ProgressCode pc) {
ReportProgressHook((CommandInProgress)logic.CommandInProgress(), pc);
LogEchoEvent_P(_O(ProgressCodeToText(pc)));
ReportProgressHook((CommandInProgress)logic.CommandInProgress(), (uint16_t)pc);
LogEchoEvent_P(_O(ProgressCodeToText((uint16_t)pc)));
}
void MMU2::OnMMUProgressMsg(ProgressCode pc) {
@ -1084,7 +1058,7 @@ void MMU2::OnMMUProgressMsgChanged(ProgressCode pc) {
}
void __attribute__((noinline)) MMU2::HelpUnloadToFinda() {
extruder_move(-MMU2_RETRY_UNLOAD_TO_FINDA_LENGTH, MMU2_RETRY_UNLOAD_TO_FINDA_FEED_RATE);
MoveE(-MMU2_RETRY_UNLOAD_TO_FINDA_LENGTH, MMU2_RETRY_UNLOAD_TO_FINDA_FEED_RATE);
}
void MMU2::OnMMUProgressMsgSame(ProgressCode pc) {
@ -1108,10 +1082,14 @@ void MMU2::OnMMUProgressMsgSame(ProgressCode pc) {
case FilamentState::AT_FSENSOR:
// fsensor triggered, finish FeedingToExtruder state
loadFilamentStarted = false;
// Abort any excess E-move from the planner queue
planner_abort_queued_moves();
{
extruder_move(logic.ExtraLoadDistance() + 2, logic.PulleySlowFeedRate());
}
// After the MMU knows the FSENSOR is triggered it will:
// 1. Push the filament by additional 30mm (see fsensorToNozzle)
// 2. Disengage the idler and push another 2mm.
MoveE(logic.ExtraLoadDistance() + 2, logic.PulleySlowFeedRate());
break;
case FilamentState::NOT_PRESENT:
// fsensor not triggered, continue moving extruder
@ -1121,7 +1099,7 @@ void MMU2::OnMMUProgressMsgSame(ProgressCode pc) {
// than 450mm because the firmware will ignore too long extrusions
// for safety reasons. See PREVENT_LENGTHY_EXTRUDE.
// Use 350mm to be safely away from the prevention threshold
extruder_move(350.0f, logic.PulleySlowFeedRate());
MoveE(350.0f, logic.PulleySlowFeedRate());
}
break;
default:

View File

@ -5,13 +5,15 @@
#include "mmu2_marlin.h"
#ifdef __AVR__
#include "mmu2_protocol_logic.h"
#include "mmu2_protocol_logic.h"
typedef float feedRate_t;
#else
#include "protocol_logic.h"
#include "../../Marlin/src/core/macros.h"
#include "../../Marlin/src/core/types.h"
#include <atomic>
#include <memory>
#endif
struct E_Step;
@ -33,7 +35,6 @@ struct Version {
class MMU2 {
public:
MMU2();
~MMU2();
/// Powers ON the MMU, then initializes the UART and protocol logic
void Start();
@ -41,9 +42,6 @@ public:
/// Stops the protocol logic, closes the UART, powers OFF the MMU
void Stop();
/// Serial output of MMU state
void Status();
inline xState State() const { return state; }
inline bool Enabled() const { return State() == xState::Active; }
@ -165,15 +163,9 @@ public:
/// @returns Current error code
inline ErrorCode MMUCurrentErrorCode() const { return logic.Error(); }
/// @returns Command in progress
inline uint8_t GetCommandInProgress() const { return logic.CommandInProgress(); }
/// @returns Last error source
inline ErrorSource MMULastErrorSource() const { return lastErrorSource; }
/// @returns Last error code
inline ErrorCode GetLastErrorCode() const { return lastErrorCode; }
/// @returns the version of the connected MMU FW.
/// In the future we'll return the trully detected FW version
Version GetMMUFWVersion() const {
@ -190,7 +182,7 @@ public:
/// Automagically "press" a Retry button if we have any retry attempts left
/// @param ec ErrorCode enum value
/// @returns true if auto-retry is ongoing, false when retry is unavailable or retry attempts are all used up
bool RetryIfPossible(ErrorCode ec);
bool RetryIfPossible(uint16_t ec);
/// @return count for toolchange in current print
inline uint16_t ToolChangeCounter() const { return toolchange_counter; };
@ -209,7 +201,7 @@ public:
};
inline void InvokeErrorScreen(ErrorCode ec) {
// The printer may not raise an error when the MMU is busy
if (!logic.CommandInProgress() // MMU must not be busy
if ( !logic.CommandInProgress() // MMU must not be busy
&& MMUCurrentErrorCode() == ErrorCode::OK // The protocol must not be in error state
&& lastErrorCode != ec) // The error code is not a duplicate
{
@ -225,23 +217,21 @@ public:
/// @brief Queue a button operation which the printer can act upon
/// @param btn Button operation
inline void SetPrinterButtonOperation(Buttons btn) {
inline void setPrinterButtonOperation(Buttons btn) {
printerButtonOperation = btn;
}
/// @brief Get the printer button operation
/// @return currently set printer button operation, it can be NoButton if nothing is queued
inline Buttons GetPrinterButtonOperation() {
inline Buttons getPrinterButtonOperation() {
return printerButtonOperation;
}
inline void ClearPrinterButtonOperation() {
inline void clearPrinterButtonOperation() {
printerButtonOperation = Buttons::NoButton;
}
#ifndef UNITTEST
private:
#endif
/// Perform software self-reset of the MMU (sends an X0 command)
void ResetX0();
@ -275,9 +265,7 @@ private:
StepStatus LogicStep(bool reportErrors);
void filament_ramming();
void execute_extruder_sequence(const E_Step *sequence, uint8_t stepCount);
void execute_extruder_sequence(const E_Step *sequence, uint8_t steps);
void execute_load_to_nozzle_sequence();
/// Reports an error into attached ExtUIs
@ -291,11 +279,6 @@ private:
/// Responds to a change of MMU's progress
/// - plans additional steps, e.g. starts the E-motor after fsensor trigger
/// The function is quite complex, because it needs to handle asynchronnous
/// progress and error reports coming from the MMU without an explicit command
/// - typically after MMU's start or after some HW issue on the MMU.
/// It must ensure, that calls to @ref ReportProgress and/or @ref ReportError are
/// only executed after @ref BeginReport has been called first.
void OnMMUProgressMsg(ProgressCode pc);
/// Progress code changed - act accordingly
void OnMMUProgressMsgChanged(ProgressCode pc);
@ -344,10 +327,7 @@ private:
void UnloadInner();
void CutFilamentInner(uint8_t slot);
void SetCurrentTool(uint8_t ex);
ProtocolLogic logic; ///< implementation of the protocol logic layer
uint8_t extruder; ///< currently active slot in the MMU ... somewhat... not sure where to get it from yet
uint8_t tool_change_extruder; ///< only used for UI purposes

View File

@ -2,8 +2,8 @@
#include <stdint.h>
// Helper macros to parse the operations from Btns()
#define BUTTON_OP_RIGHT(X) ((X & 0xF0) >> 4)
#define BUTTON_OP_MIDDLE(X) (X & 0x0F)
#define BUTTON_OP_RIGHT(X) ( ( X & 0xF0 ) >> 4 )
#define BUTTON_OP_MIDDLE(X) ( X & 0x0F )
namespace MMU2 {
@ -23,7 +23,7 @@ enum class ButtonOperations : uint8_t {
};
/// Button codes + extended actions performed on the printer's side
enum class Buttons : uint_least8_t {
enum Buttons : uint8_t {
Right = 0,
Middle,
Left,
@ -39,8 +39,5 @@ enum class Buttons : uint_least8_t {
NoButton = 0xff // shall be kept last
};
constexpr uint_least8_t buttons_to_uint8t(Buttons b) {
return static_cast<uint8_t>(b);
}
} // namespace MMU2

View File

@ -4,7 +4,6 @@
#pragma once
#include "inttypes.h"
#include "../language.h"
#include "../lcd.h"
#include <avr/pgmspace.h>
#include "buttons.h"
#include "../strlen_cx.h"
@ -287,7 +286,7 @@ static const char MSG_DESC_FILAMENT_CHANGE[] PROGMEM_I1 = ISTR("M600 Filament Ch
static const char MSG_DESC_UNKNOWN_ERROR[] PROGMEM_I1 = ISTR("Unexpected error occurred."); ////MSG_DESC_UNKNOWN_ERROR c=20 r=8
// Read explanation in mmu2_protocol_logic.cpp -> supportedMmuFWVersion
static constexpr char MSG_DESC_FW_UPDATE_NEEDED[] PROGMEM_I1 = ISTR("MMU FW version is incompatible with printer FW.Update to version 3.0.3."); ////MSG_DESC_FW_UPDATE_NEEDED c=20 r=8
static constexpr char MSG_DESC_FW_UPDATE_NEEDED[] PROGMEM_I1 = ISTR("MMU FW version is incompatible with printer FW.Update to version 3.0.1."); ////MSG_DESC_FW_UPDATE_NEEDED c=20 r=8
static constexpr uint8_t szFWUN = sizeof(MSG_DESC_FW_UPDATE_NEEDED);
// at least check the individual version characters in MSG_DESC_FW_UPDATE_NEEDED
static_assert(MSG_DESC_FW_UPDATE_NEEDED[szFWUN - 7] == ('0' + mmuVersionMajor));
@ -355,11 +354,11 @@ static const char MSG_BTN_RETRY[] PROGMEM_I1 = ISTR("Retry"); ////MSG_BTN_RETRY
static const char MSG_BTN_RESET_MMU[] PROGMEM_I1 = ISTR("ResetMMU"); ////MSG_BTN_RESET_MMU c=8
static const char MSG_BTN_UNLOAD[] PROGMEM_I1 = ISTR("Unload"); ////MSG_BTN_UNLOAD c=8
static const char MSG_BTN_LOAD[] PROGMEM_I1 = ISTR("Load"); ////MSG_BTN_LOAD c=8
//static const char MSG_BTN_EJECT[] PROGMEM_I1 = ISTR("Eject"); //Reuse MSG_EJECT c=9
static const char MSG_BTN_EJECT[] PROGMEM_I1 = ISTR("Eject"); ////MSG_BTN_EJECT c=8
//static const char MSG_BTN_TUNE_MMU[] PROGMEM_I1 = ISTR("Tune"); //Reuse MSG_TUNE c=8
static const char MSG_BTN_STOP[] PROGMEM_I1 = ISTR("Stop"); ////MSG_BTN_STOP c=8
static const char MSG_BTN_DISABLE_MMU[] PROGMEM_I1 = ISTR("Disable"); ////MSG_BTN_DISABLE_MMU c=8
static const char MSG_BTN_MORE[] PROGMEM_N1 = LCD_STR_ARROW_2_DOWN;
static const char MSG_BTN_MORE[] PROGMEM_N1 = "\x06";
// Used to parse the buttons from Btns().
static const char * const btnOperation[] PROGMEM = {
@ -368,7 +367,7 @@ static const char * const btnOperation[] PROGMEM = {
_R(MSG_BTN_RESET_MMU),
_R(MSG_BTN_UNLOAD),
_R(MSG_BTN_LOAD),
_R(MSG_EJECT),
_R(MSG_BTN_EJECT),
_R(MSG_TUNE),
_R(MSG_BTN_STOP),
_R(MSG_BTN_DISABLE_MMU),

View File

@ -1,10 +1,8 @@
#pragma once
namespace MMU2 {
// Register map for MMU
enum class Register : uint8_t {
enum class Register : uint8_t
{
Project_Major = 0x00,
Project_Minor = 0x01,
Project_Revision = 0x02,
@ -40,5 +38,3 @@ enum class Register : uint8_t {
Set_Get_Idler_iRun = 0x20,
Reserved = 0x21,
};
} // namespace MMU2

View File

@ -2,12 +2,12 @@
#include "mmu2_crc.h"
#ifdef __AVR__
#include <util/crc16.h>
#include <util/crc16.h>
#endif
namespace modules {
// clang-format off
namespace crc {
#ifdef __AVR__
uint8_t CRC8::CCITT_update(uint8_t crc, uint8_t b) {
return _crc8_ccitt_update(crc, b);
@ -17,6 +17,6 @@ uint8_t CRC8::CCITT_update(uint8_t crc, uint8_t b) {
return CCITT_updateCX(crc, b);
}
#endif
} // namespace crc
// clang-format on
} // namespace modules

View File

@ -4,9 +4,6 @@
namespace modules {
// clang-format off
// prevent silly indenting of the whole file
/// Contains all the necessary functions for computation of CRC
namespace crc {
@ -43,6 +40,4 @@ public:
} // namespace crc
// clang-format on
} // namespace modules

View File

@ -29,196 +29,171 @@ static constexpr uint8_t FindErrorIndex(uint16_t pec) {
return (i != errorCodesEnd) ? (i-errorCodes) : (errorCodesSize - 1);
}
// check that the searching algorithm works
static_assert(FindErrorIndex(ERR_MECHANICAL_FINDA_DIDNT_TRIGGER) == 0);
static_assert(FindErrorIndex(ERR_MECHANICAL_FINDA_FILAMENT_STUCK) == 1);
static_assert(FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER) == 2);
static_assert(FindErrorIndex(ERR_MECHANICAL_FSENSOR_FILAMENT_STUCK) == 3);
// check that the searching algoritm works
static_assert( FindErrorIndex(ERR_MECHANICAL_FINDA_DIDNT_TRIGGER) == 0);
static_assert( FindErrorIndex(ERR_MECHANICAL_FINDA_FILAMENT_STUCK) == 1);
static_assert( FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER) == 2);
static_assert( FindErrorIndex(ERR_MECHANICAL_FSENSOR_FILAMENT_STUCK) == 3);
constexpr ErrorCode operator&(ErrorCode a, ErrorCode b) {
return (ErrorCode)((uint16_t)a & (uint16_t)b);
}
constexpr bool ContainsBit(ErrorCode ec, ErrorCode mask) {
return (uint16_t)ec & (uint16_t)mask;
}
uint8_t PrusaErrorCodeIndex(ErrorCode ec) {
uint8_t PrusaErrorCodeIndex(uint16_t ec) {
switch (ec) {
case ErrorCode::FINDA_DIDNT_SWITCH_ON:
case (uint16_t)ErrorCode::FINDA_DIDNT_SWITCH_ON:
return FindErrorIndex(ERR_MECHANICAL_FINDA_DIDNT_TRIGGER);
case ErrorCode::FINDA_DIDNT_SWITCH_OFF:
case (uint16_t)ErrorCode::FINDA_DIDNT_SWITCH_OFF:
return FindErrorIndex(ERR_MECHANICAL_FINDA_FILAMENT_STUCK);
case ErrorCode::FSENSOR_DIDNT_SWITCH_ON:
case (uint16_t)ErrorCode::FSENSOR_DIDNT_SWITCH_ON:
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER);
case ErrorCode::FSENSOR_DIDNT_SWITCH_OFF:
case (uint16_t)ErrorCode::FSENSOR_DIDNT_SWITCH_OFF:
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_FILAMENT_STUCK);
case ErrorCode::FSENSOR_TOO_EARLY:
case (uint16_t)ErrorCode::FSENSOR_TOO_EARLY:
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_TOO_EARLY);
case ErrorCode::FINDA_FLICKERS:
case (uint16_t)ErrorCode::FINDA_FLICKERS:
return FindErrorIndex(ERR_MECHANICAL_INSPECT_FINDA);
case ErrorCode::LOAD_TO_EXTRUDER_FAILED:
case (uint16_t)ErrorCode::LOAD_TO_EXTRUDER_FAILED:
return FindErrorIndex(ERR_MECHANICAL_LOAD_TO_EXTRUDER_FAILED);
case ErrorCode::FILAMENT_EJECTED:
case (uint16_t)ErrorCode::FILAMENT_EJECTED:
return FindErrorIndex(ERR_SYSTEM_FILAMENT_EJECTED);
case ErrorCode::FILAMENT_CHANGE:
case (uint16_t)ErrorCode::FILAMENT_CHANGE:
return FindErrorIndex(ERR_SYSTEM_FILAMENT_CHANGE);
case ErrorCode::STALLED_PULLEY:
case ErrorCode::MOVE_PULLEY_FAILED:
case (uint16_t)ErrorCode::STALLED_PULLEY:
case (uint16_t)ErrorCode::MOVE_PULLEY_FAILED:
return FindErrorIndex(ERR_MECHANICAL_PULLEY_CANNOT_MOVE);
case ErrorCode::HOMING_SELECTOR_FAILED:
case (uint16_t)ErrorCode::HOMING_SELECTOR_FAILED:
return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_HOME);
case ErrorCode::MOVE_SELECTOR_FAILED:
case (uint16_t)ErrorCode::MOVE_SELECTOR_FAILED:
return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_MOVE);
case ErrorCode::HOMING_IDLER_FAILED:
case (uint16_t)ErrorCode::HOMING_IDLER_FAILED:
return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_HOME);
case ErrorCode::MOVE_IDLER_FAILED:
case (uint16_t)ErrorCode::MOVE_IDLER_FAILED:
return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_MOVE);
case ErrorCode::MMU_NOT_RESPONDING:
case (uint16_t)ErrorCode::MMU_NOT_RESPONDING:
return FindErrorIndex(ERR_CONNECT_MMU_NOT_RESPONDING);
case ErrorCode::PROTOCOL_ERROR:
case (uint16_t)ErrorCode::PROTOCOL_ERROR:
return FindErrorIndex(ERR_CONNECT_COMMUNICATION_ERROR);
case ErrorCode::FILAMENT_ALREADY_LOADED:
case (uint16_t)ErrorCode::FILAMENT_ALREADY_LOADED:
return FindErrorIndex(ERR_SYSTEM_FILAMENT_ALREADY_LOADED);
case ErrorCode::INVALID_TOOL:
case (uint16_t)ErrorCode::INVALID_TOOL:
return FindErrorIndex(ERR_SYSTEM_INVALID_TOOL);
case ErrorCode::QUEUE_FULL:
case (uint16_t)ErrorCode::QUEUE_FULL:
return FindErrorIndex(ERR_SYSTEM_QUEUE_FULL);
case ErrorCode::VERSION_MISMATCH:
case (uint16_t)ErrorCode::VERSION_MISMATCH:
return FindErrorIndex(ERR_SYSTEM_FW_UPDATE_NEEDED);
case ErrorCode::INTERNAL:
case (uint16_t)ErrorCode::INTERNAL:
return FindErrorIndex(ERR_SYSTEM_FW_RUNTIME_ERROR);
case ErrorCode::FINDA_VS_EEPROM_DISREPANCY:
case (uint16_t)ErrorCode::FINDA_VS_EEPROM_DISREPANCY:
return FindErrorIndex(ERR_SYSTEM_UNLOAD_MANUALLY);
case ErrorCode::MCU_UNDERVOLTAGE_VCC:
case (uint16_t)ErrorCode::MCU_UNDERVOLTAGE_VCC:
return FindErrorIndex(ERR_ELECTRICAL_MMU_MCU_ERROR);
default:
break;
}
// Electrical issues which can be detected somehow.
// Need to be placed before TMC-related errors in order to process couples of error bits between single ones
// and to keep the code size down.
if (ContainsBit(ec, ErrorCode::TMC_PULLEY_BIT)) {
if ((ec & ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) {
if (ec & (uint16_t)ErrorCode::TMC_PULLEY_BIT) {
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
return FindErrorIndex(ERR_ELECTRICAL_MMU_PULLEY_SELFTEST_FAILED);
}
} else if (ContainsBit(ec, ErrorCode::TMC_SELECTOR_BIT)) {
if ((ec & ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) {
} else if (ec & (uint16_t)ErrorCode::TMC_SELECTOR_BIT) {
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
return FindErrorIndex(ERR_ELECTRICAL_MMU_SELECTOR_SELFTEST_FAILED);
}
} else if (ContainsBit(ec, ErrorCode::TMC_IDLER_BIT)) {
if ((ec & ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) {
} else if (ec & (uint16_t)ErrorCode::TMC_IDLER_BIT) {
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
return FindErrorIndex(ERR_ELECTRICAL_MMU_IDLER_SELFTEST_FAILED);
}
}
// TMC-related errors - multiple of these can occur at once
// - in such a case we report the first which gets found/converted into Prusa-Error-Codes (usually the fact, that one TMC has an issue is serious enough)
// By carefully ordering the checks here we can prioritize the errors being reported to the user.
if (ContainsBit(ec, ErrorCode::TMC_PULLEY_BIT)) {
if (ContainsBit(ec, ErrorCode::TMC_IOIN_MISMATCH)) {
if (ec & (uint16_t)ErrorCode::TMC_PULLEY_BIT) {
if (ec & (uint16_t)ErrorCode::TMC_IOIN_MISMATCH)
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_ERROR);
}
if (ContainsBit(ec, ErrorCode::TMC_RESET)) {
if (ec & (uint16_t)ErrorCode::TMC_RESET)
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_RESET);
}
if (ContainsBit(ec, ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)) {
if (ec & (uint16_t)ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_UNDERVOLTAGE_ERROR);
}
if (ContainsBit(ec, ErrorCode::TMC_SHORT_TO_GROUND)) {
if (ec & (uint16_t)ErrorCode::TMC_SHORT_TO_GROUND)
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_SHORTED);
}
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_WARN)) {
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN)
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_PULLEY_TOO_HOT);
}
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_ERROR)) {
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR)
return FindErrorIndex(ERR_TEMPERATURE_TMC_PULLEY_OVERHEAT_ERROR);
}
} else if (ContainsBit(ec, ErrorCode::TMC_SELECTOR_BIT)) {
if (ContainsBit(ec, ErrorCode::TMC_IOIN_MISMATCH)) {
} else if (ec & (uint16_t)ErrorCode::TMC_SELECTOR_BIT) {
if (ec & (uint16_t)ErrorCode::TMC_IOIN_MISMATCH)
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_ERROR);
}
if (ContainsBit(ec, ErrorCode::TMC_RESET)) {
if (ec & (uint16_t)ErrorCode::TMC_RESET)
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_RESET);
}
if (ContainsBit(ec, ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)) {
if (ec & (uint16_t)ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_UNDERVOLTAGE_ERROR);
}
if (ContainsBit(ec, ErrorCode::TMC_SHORT_TO_GROUND)) {
if (ec & (uint16_t)ErrorCode::TMC_SHORT_TO_GROUND)
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_SHORTED);
}
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_WARN)) {
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN)
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_SELECTOR_TOO_HOT);
}
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_ERROR)) {
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR)
return FindErrorIndex(ERR_TEMPERATURE_TMC_SELECTOR_OVERHEAT_ERROR);
}
} else if (ContainsBit(ec, ErrorCode::TMC_IDLER_BIT)) {
if (ContainsBit(ec, ErrorCode::TMC_IOIN_MISMATCH)) {
} else if (ec & (uint16_t)ErrorCode::TMC_IDLER_BIT) {
if (ec & (uint16_t)ErrorCode::TMC_IOIN_MISMATCH)
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_ERROR);
}
if (ContainsBit(ec, ErrorCode::TMC_RESET)) {
if (ec & (uint16_t)ErrorCode::TMC_RESET)
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_RESET);
}
if (ContainsBit(ec, ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)) {
if (ec & (uint16_t)ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_UNDERVOLTAGE_ERROR);
}
if (ContainsBit(ec, ErrorCode::TMC_SHORT_TO_GROUND)) {
if (ec & (uint16_t)ErrorCode::TMC_SHORT_TO_GROUND)
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_SHORTED);
}
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_WARN)) {
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN)
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_IDLER_TOO_HOT);
}
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_ERROR)) {
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR)
return FindErrorIndex(ERR_TEMPERATURE_TMC_IDLER_OVERHEAT_ERROR);
}
}
// if nothing got caught, return a generic error
// if nothing got caught, return a generic runtime error
return FindErrorIndex(ERR_OTHER_UNKNOWN_ERROR);
}
uint16_t PrusaErrorCode(uint8_t i) {
uint16_t PrusaErrorCode(uint8_t i){
return pgm_read_word(errorCodes + i);
}
const char *PrusaErrorTitle(uint8_t i) {
const char * PrusaErrorTitle(uint8_t i){
return (const char *)pgm_read_ptr(errorTitles + i);
}
const char *PrusaErrorDesc(uint8_t i) {
const char * PrusaErrorDesc(uint8_t i){
return (const char *)pgm_read_ptr(errorDescs + i);
}
uint8_t PrusaErrorButtons(uint8_t i) {
uint8_t PrusaErrorButtons(uint8_t i){
return pgm_read_byte(errorButtons + i);
}
const char *PrusaErrorButtonTitle(uint8_t bi) {
const char * PrusaErrorButtonTitle(uint8_t bi){
// -1 represents the hidden NoOperation button which is not drawn in any way
return (const char *)pgm_read_ptr(btnOperation + bi - 1);
}
const char *PrusaErrorButtonMore() {
const char * PrusaErrorButtonMore(){
return MSG_BTN_MORE;
}
Buttons ButtonPressed(ErrorCode ec) {
struct ResetOnExit {
ResetOnExit() = default;
~ResetOnExit(){
buttonSelectedOperation = ButtonOperations::NoOperation;
}
};
Buttons ButtonPressed(uint16_t ec) {
if (buttonSelectedOperation == ButtonOperations::NoOperation) {
return Buttons::NoButton; // no button
return NoButton; // no button
}
const auto result = ButtonAvailable(ec);
buttonSelectedOperation = ButtonOperations::NoOperation; // Reset operation
return result;
ResetOnExit ros; // clear buttonSelectedOperation on exit from this call
return ButtonAvailable(ec);
}
Buttons ButtonAvailable(ErrorCode ec) {
Buttons ButtonAvailable(uint16_t ec) {
uint8_t ei = PrusaErrorCodeIndex(ec);
// The list of responses which occur in mmu error dialogs
@ -239,7 +214,7 @@ Buttons ButtonAvailable(ErrorCode ec) {
switch (buttonSelectedOperation) {
// may be allow move selector right and left in the future
case ButtonOperations::Retry: // "Repeat action"
return Buttons::Middle;
return Middle;
default:
break;
}
@ -249,9 +224,9 @@ Buttons ButtonAvailable(ErrorCode ec) {
switch (buttonSelectedOperation) {
// may be allow move selector right and left in the future
case ButtonOperations::Tune: // Tune Stallguard threshold
return Buttons::TuneMMU;
return TuneMMU;
case ButtonOperations::Retry: // "Repeat action"
return Buttons::Middle;
return Middle;
default:
break;
}
@ -260,7 +235,7 @@ Buttons ButtonAvailable(ErrorCode ec) {
case ERR_SYSTEM_FILAMENT_EJECTED:
switch (buttonSelectedOperation) {
case ButtonOperations::Continue: // User solved the serious mechanical problem by hand - there is no other way around
return Buttons::Middle;
return Middle;
default:
break;
}
@ -268,9 +243,9 @@ Buttons ButtonAvailable(ErrorCode ec) {
case ERR_SYSTEM_FILAMENT_CHANGE:
switch (buttonSelectedOperation) {
case ButtonOperations::Load:
return Buttons::Load;
return Load;
case ButtonOperations::Eject:
return Buttons::Eject;
return Eject;
default:
break;
}
@ -280,9 +255,9 @@ Buttons ButtonAvailable(ErrorCode ec) {
case ERR_TEMPERATURE_WARNING_TMC_IDLER_TOO_HOT:
switch (buttonSelectedOperation) {
case ButtonOperations::Continue: // "Continue"
return Buttons::Left;
return Left;
case ButtonOperations::ResetMMU: // "Reset MMU"
return Buttons::ResetMMU;
return ResetMMU;
default:
break;
}
@ -317,7 +292,7 @@ Buttons ButtonAvailable(ErrorCode ec) {
case ERR_ELECTRICAL_MMU_MCU_ERROR:
switch (buttonSelectedOperation) {
case ButtonOperations::ResetMMU: // "Reset MMU"
return Buttons::ResetMMU;
return ResetMMU;
default:
break;
}
@ -327,9 +302,9 @@ Buttons ButtonAvailable(ErrorCode ec) {
case ERR_SYSTEM_FW_UPDATE_NEEDED:
switch (buttonSelectedOperation) {
case ButtonOperations::DisableMMU: // "Disable"
return Buttons::DisableMMU;
return DisableMMU;
case ButtonOperations::ResetMMU: // "ResetMMU"
return Buttons::ResetMMU;
return ResetMMU;
default:
break;
}
@ -337,9 +312,9 @@ Buttons ButtonAvailable(ErrorCode ec) {
case ERR_SYSTEM_FILAMENT_ALREADY_LOADED:
switch (buttonSelectedOperation) {
case ButtonOperations::Unload: // "Unload"
return Buttons::Left;
return Left;
case ButtonOperations::Continue: // "Proceed/Continue"
return Buttons::Right;
return Right;
default:
break;
}
@ -348,9 +323,9 @@ Buttons ButtonAvailable(ErrorCode ec) {
case ERR_SYSTEM_INVALID_TOOL:
switch (buttonSelectedOperation) {
case ButtonOperations::StopPrint: // "Stop print"
return Buttons::StopPrint;
return StopPrint;
case ButtonOperations::ResetMMU: // "Reset MMU"
return Buttons::ResetMMU;
return ResetMMU;
default:
break;
}
@ -360,10 +335,10 @@ Buttons ButtonAvailable(ErrorCode ec) {
break;
}
return Buttons::NoButton;
return NoButton;
}
void SetButtonResponse(ButtonOperations rsp) {
void SetButtonResponse(ButtonOperations rsp){
buttonSelectedOperation = rsp;
}

View File

@ -1,20 +1,13 @@
#pragma once
#include <stdint.h>
#include <stddef.h>
#ifdef __AVR__
#include "mmu2/buttons.h"
#include "mmu2/error_codes.h"
#else
#include "buttons.h"
#include "../../../../../../Prusa-Error-Codes/include/button_operations.h"
#include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
#endif
#include "mmu2/buttons.h"
namespace MMU2 {
/// Translates MMU2::ErrorCode into an index of Prusa-Error-Codes
/// Basically this is the way to obtain an index into all other functions in this API
uint8_t PrusaErrorCodeIndex(ErrorCode ec);
uint8_t PrusaErrorCodeIndex(uint16_t ec);
/// @returns pointer to a PROGMEM string representing the Title of the Prusa-Error-Codes error
/// @param i index of the error - obtained by calling ErrorCodeIndex
@ -45,11 +38,11 @@ void SetButtonResponse(ButtonOperations rsp);
/// @returns button index/code based on currently processed error/screen
/// Clears the "pressed" button upon exit
Buttons ButtonPressed(ErrorCode ec);
Buttons ButtonPressed(uint16_t ec);
/// @returns button index/code based on currently processed error/screen
/// Used as a subfunction of ButtonPressed.
/// Does not clear the "pressed" button upon exit
Buttons ButtonAvailable(ErrorCode ec);
Buttons ButtonAvailable(uint16_t ec);
} // namespace MMU2

View File

@ -1,7 +1,7 @@
#pragma once
#ifdef __AVR__
#include <avr/pgmspace.h>
#endif
#ifndef UNITTEST
#include "Marlin.h"
// Beware - before changing this prefix, think twice
// you'd need to change appmain.cpp app_marlin_serial_output_write_hook
@ -14,22 +14,16 @@ namespace MMU2 {
/// @param msg pointer to a string in PROGMEM
/// On the AVR platform this variant reads the input string from PROGMEM.
/// On the ARM platform it calls LogErrorEvent directly (silently expecting the compiler to optimize it away)
void LogErrorEvent_P(const char *msg_P);
void LogErrorEvent_P(const char *msg);
/// Report the msg into the general logging subsystem (through Marlin's SERIAL_ECHO stuff)
/// @param msg pointer to a string in PROGMEM
/// On the AVR platform this variant reads the input string from PROGMEM.
/// On the ARM platform it calls LogErrorEvent directly (silently expecting the compiler to optimize it away)
void LogEchoEvent_P(const char *msg_P);
void LogEchoEvent_P(const char *msg);
} // namespace MMU2
} // namespace
#ifndef UNITTEST
#ifdef __AVR__
#include "Marlin.h"
#else
#include "../../core/serial.h"
#endif
#define SERIAL_MMU2() \
{ serialprintPGM(mmu2Magic); }
@ -56,13 +50,10 @@ void LogEchoEvent_P(const char *msg_P);
#define MMU2_ERROR_MSG(S) MMU2_ECHO_MSG(S) //!@todo Decide MMU errors on serial line
#else // #ifndef UNITTEST
#include "stubs/stub_interfaces.h"
#define MMU2_ECHO_MSGLN(S) marlinLogSim.AppendLine(S)
#define MMU2_ERROR_MSGLN(S) marlinLogSim.AppendLine(S)
#define MMU2_ECHO_MSGRPGM(S) /*marlinLogSim.AppendLine(S)*/
#define MMU2_ERROR_MSGRPGM(S) /*marlinLogSim.AppendLine(S)*/
#define SERIAL_ECHOLNPGM(S) /*marlinLogSim.AppendLine(S)*/
#define SERIAL_ECHOPGM(S) /* */
#define SERIAL_ECHOLN(S) /*marlinLogSim.AppendLine(S)*/
#define MMU2_ECHO_MSGLN(S) /* */
#define MMU2_ERROR_MSGLN(S) /* */
#define MMU2_ECHO_MSGRPGM(S) /* */
#define MMU2_ERROR_MSGRPGM(S) /* */
#endif // #ifndef UNITTEST

View File

@ -14,26 +14,27 @@ struct pos3d {
pos3d() = default;
inline constexpr pos3d(float x, float y, float z)
: xyz { x, y, z } {}
pos3d operator=(const float *newP) {
for (uint8_t i = 0; i < 3; ++i) {
pos3d operator=(const float *newP){
for(uint8_t i = 0; i < 3; ++i){
xyz[i] = newP[i];
}
return *this;
}
};
void extruder_move(float distance, float feed_rate);
void extruder_schedule_turning(float feed_rate);
void MoveE(float delta, float feedRate);
float move_raise_z(float delta);
float MoveRaiseZ(float delta);
void planner_abort_queued_moves();
bool planner_draining();
void planner_synchronize();
bool planner_any_moves();
float planner_get_machine_position_E_mm();
float stepper_get_machine_position_E_mm();
float planner_get_current_position_E();
void planner_set_current_position_E(float e);
void planner_line_to_current_position(float feedRate_mm_s);
void planner_line_to_current_position_sync(float feedRate_mm_s);
pos3d planner_current_position();
void motion_do_blocking_move_to_xy(float rx, float ry, float feedRate_mm_s);
@ -43,11 +44,8 @@ void nozzle_park();
bool marlin_printingIsActive();
void marlin_manage_heater();
void marlin_manage_inactivity(bool ignore_stepper_queue);
void marlin_idle(bool ignore_stepper_queue);
void marlin_refresh_print_state_in_ram();
void marlin_clear_print_state_in_ram();
void marlin_stop_and_save_print_to_ram();
void marlin_manage_inactivity(bool b);
void marlin_idle(bool b);
int16_t thermal_degTargetHotend();
int16_t thermal_degHotend();
@ -61,4 +59,8 @@ void Disable_E0();
bool all_axes_homed();
void gcode_reset_stepper_timeout();
bool cutter_enabled();
} // namespace MMU2

View File

@ -9,21 +9,12 @@
namespace MMU2 {
static void planner_line_to_current_position(float feedRate_mm_s){
plan_buffer_line_curposXYZE(feedRate_mm_s);
}
static void planner_line_to_current_position_sync(float feedRate_mm_s){
planner_line_to_current_position(feedRate_mm_s);
planner_synchronize();
}
void extruder_move(float delta, float feedRate) {
void MoveE(float delta, float feedRate) {
current_position[E_AXIS] += delta;
planner_line_to_current_position(feedRate);
}
float move_raise_z(float delta) {
float MoveRaiseZ(float delta) {
return raise_z(delta);
}
@ -38,10 +29,6 @@ void planner_abort_queued_moves() {
planner_aborted = false;
}
bool planner_draining() {
return planner_aborted;
}
void planner_synchronize() {
st_synchronize();
}
@ -50,33 +37,42 @@ bool planner_any_moves() {
return blocks_queued();
}
float planner_get_machine_position_E_mm() {
float planner_get_machine_position_E_mm(){
return current_position[E_AXIS];
}
float stepper_get_machine_position_E_mm() {
float stepper_get_machine_position_E_mm(){
return st_get_position_mm(E_AXIS);
}
float planner_get_current_position_E() {
float planner_get_current_position_E(){
return current_position[E_AXIS];
}
void planner_set_current_position_E(float e) {
void planner_set_current_position_E(float e){
current_position[E_AXIS] = e;
}
pos3d planner_current_position() {
void planner_line_to_current_position(float feedRate_mm_s){
plan_buffer_line_curposXYZE(feedRate_mm_s);
}
void planner_line_to_current_position_sync(float feedRate_mm_s){
planner_line_to_current_position(feedRate_mm_s);
planner_synchronize();
}
pos3d planner_current_position(){
return pos3d(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
}
void motion_do_blocking_move_to_xy(float rx, float ry, float feedRate_mm_s) {
void motion_do_blocking_move_to_xy(float rx, float ry, float feedRate_mm_s){
current_position[X_AXIS] = rx;
current_position[Y_AXIS] = ry;
planner_line_to_current_position_sync(feedRate_mm_s);
}
void motion_do_blocking_move_to_z(float z, float feedRate_mm_s) {
void motion_do_blocking_move_to_z(float z, float feedRate_mm_s){
current_position[Z_AXIS] = z;
planner_line_to_current_position_sync(feedRate_mm_s);
}
@ -88,32 +84,21 @@ void nozzle_park() {
}
bool marlin_printingIsActive() {
// return IS_SD_PRINTING || usb_timer_running();
return printer_active();
}
void marlin_manage_heater() {
void marlin_manage_heater(){
manage_heater();
}
void marlin_manage_inactivity(bool ignore_stepper_queue) {
manage_inactivity(ignore_stepper_queue);
void marlin_manage_inactivity(bool b){
manage_inactivity(b);
}
void marlin_idle(bool ignore_stepper_queue) {
void marlin_idle(bool b){
manage_heater();
manage_inactivity(ignore_stepper_queue);
}
void marlin_refresh_print_state_in_ram() {
refresh_print_state_in_ram();
}
void marlin_clear_print_state_in_ram() {
clear_print_state_in_ram();
}
void marlin_stop_and_save_print_to_ram() {
stop_and_save_print_to_ram(0,0);
manage_inactivity(b);
}
int16_t thermal_degTargetHotend() {
@ -136,16 +121,19 @@ void safe_delay_keep_alive(uint16_t t) {
delay_keep_alive(t);
}
void Enable_E0() {
enable_e0();
void gcode_reset_stepper_timeout(){
// empty
}
void Disable_E0() {
disable_e0();
}
void Enable_E0(){ enable_e0(); }
void Disable_E0(){ disable_e0(); }
bool all_axes_homed() {
bool all_axes_homed(){
return axis_known_position[X_AXIS] && axis_known_position[Y_AXIS];
}
bool cutter_enabled(){
return eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED) == EEPROM_MMU_CUTTER_ENABLED_enabled;
}
} // namespace MMU2

View File

@ -8,10 +8,6 @@
// brings _O and _T macros into MMU
#include "language.h"
#define MARLIN_KEEPALIVE_STATE_IN_PROCESS KEEPALIVE_STATE(IN_PROCESS)
#elif defined(UNITTEST)
#define _O(x) x
#define _T(x) x
#define MARLIN_KEEPALIVE_STATE_IN_PROCESS /*KEEPALIVE_STATE(IN_PROCESS) TODO*/
#else
#include "../../gcode/gcode.h"
#define _O(x) x

View File

@ -4,20 +4,25 @@
#include "fastio.h"
#include <util/delay.h>
#include "mmu2.h"
#include "eeprom.h"
namespace MMU2 {
// On MK3 we cannot do actual power cycle on HW. Instead trigger a hardware reset.
// sadly, on MK3 we cannot do actual power cycle on HW...
// so we just block the MMU via EEPROM var instead.
void power_on() {
#ifdef MMU_HWRESET
WRITE(MMU_RST_PIN, 1);
SET_OUTPUT(MMU_RST_PIN); // setup reset pin
#endif //MMU_HWRESET
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, true);
reset();
}
void power_off() {
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false);
}
void reset() {

View File

@ -30,7 +30,7 @@ static const char MSG_PROGRESS_HOMING[] PROGMEM_I1 = ISTR("Homing"); /
static const char MSG_PROGRESS_MOVING_SELECTOR[] PROGMEM_I1 = ISTR("Moving selector"); ////MSG_PROGRESS_MOVING_SELECTOR c=20
static const char MSG_PROGRESS_FEED_FSENSOR[] PROGMEM_I1 = ISTR("Feeding to FSensor"); ////MSG_PROGRESS_FEED_FSENSOR c=20
static const char *const progressTexts[] PROGMEM = {
static const char * const progressTexts[] PROGMEM = {
_R(MSG_PROGRESS_OK),
_R(MSG_PROGRESS_ENGAGE_IDLER),
_R(MSG_PROGRESS_DISENGAGE_IDLER),
@ -62,10 +62,10 @@ static const char *const progressTexts[] PROGMEM = {
_R(MSG_PROGRESS_FEED_FSENSOR)
};
const char *ProgressCodeToText(ProgressCode pc) {
const char * ProgressCodeToText(uint16_t pc){
// @@TODO ?? a better fallback option?
return ((uint16_t)pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])))
? static_cast<const char *>(pgm_read_ptr(&progressTexts[(uint16_t)pc]))
return ( pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])) )
? static_cast<const char *>(pgm_read_ptr(&progressTexts[pc]))
: static_cast<const char *>(pgm_read_ptr(&progressTexts[0]));
}

View File

@ -1,14 +1,9 @@
#pragma once
#include <stdint.h>
#include <stddef.h>
#ifdef __AVR__
#include "mmu2/progress_codes.h"
#else
#include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
#endif
namespace MMU2 {
const char *ProgressCodeToText(ProgressCode pc);
const char * ProgressCodeToText(uint16_t pc);
}

View File

@ -1,4 +1,4 @@
/// @file mmu2_protocol.cpp
/// @file
#include "mmu2_protocol.h"
// protocol definition
@ -112,8 +112,11 @@ DecodeStatus Protocol::DecodeRequest(uint8_t c) {
rqState = RequestStates::Code;
return DecodeStatus::MessageCompleted;
}
} else {
requestMsg.code = RequestMsgCodes::unknown;
rqState = RequestStates::Error;
return DecodeStatus::Error;
}
[[fallthrough]];
default: //case error:
if (IsNewLine(c)) {
rqState = RequestStates::Code;

View File

@ -1,4 +1,4 @@
/// @file mmu2_protocol.h
/// @file protocol.h
#pragma once
#include <stdint.h>
#include "mmu2_crc.h"
@ -8,7 +8,6 @@ namespace modules {
/// @brief The MMU communication protocol implementation and related stuff.
///
/// See description of the new protocol in the MMU 2021 doc
namespace protocol {
/// Definition of request message codes
@ -180,9 +179,17 @@ public:
/// @returns number of bytes written into txbuff
static uint8_t EncodeResponseReadFINDA(const RequestMsg &msg, uint8_t findaValue, uint8_t *txbuff);
/// Encode response to Query operation status
/// @param msg source request message for this response
/// @param rcs status of operation (Processing, Error, Finished)
/// @param code status of operation (Processing, Error, Finished)
/// @param value related to status of operation(e.g. error code or progress)
/// @param txbuff where to format the message
/// @returns number of bytes written into txbuff
static uint8_t EncodeResponseQueryOperation(const RequestMsg &msg, ResponseCommandStatus rcs, uint8_t *txbuff);

View File

@ -6,14 +6,9 @@
// on MK3/S/+ we shuffle the timers a bit, thus "_millis" may not equal "millis"
#include "system_timer.h"
#else
// irrelevant on Buddy FW, just keep "_millis" as "millis"
// irrelevant on Buddy FW, just keep "_millis" as "millis"
#include <wiring_time.h>
#define _millis millis
#ifdef UNITTEST
#define strncmp_P strncmp
#else
#include <Marlin/src/core/serial.h>
#endif
#endif
#include <string.h>
@ -21,7 +16,7 @@
namespace MMU2 {
/// Beware - on AVR/MK3S:
/// Beware:
/// Changing the supportedMmuVersion numbers requires patching MSG_DESC_FW_UPDATE_NEEDED and all its related translations by hand.
///
/// The message reads:
@ -202,11 +197,7 @@ StepStatus ProtocolLogic::ExpectingMessage() {
}
void ProtocolLogic::SendMsg(RequestMsg rq) {
#ifdef __AVR__
// Buddy FW cannot use stack-allocated txbuff - DMA doesn't work with CCMRAM
// No restrictions on MK3/S/+ though
uint8_t txbuff[Protocol::MaxRequestSize()];
#endif
uint8_t len = Protocol::EncodeRequest(rq, txbuff);
uart->write(txbuff, len);
LogRequestMsg(txbuff, len);
@ -214,11 +205,7 @@ void ProtocolLogic::SendMsg(RequestMsg rq) {
}
void ProtocolLogic::SendWriteMsg(RequestMsg rq) {
#ifdef __AVR__
// Buddy FW cannot use stack-allocated txbuff - DMA doesn't work with CCMRAM
// No restrictions on MK3/S/+ though
uint8_t txbuff[Protocol::MaxRequestSize()];
#endif
uint8_t len = Protocol::EncodeWriteRequest(rq.value, rq.value2, txbuff);
uart->write(txbuff, len);
LogRequestMsg(txbuff, len);
@ -256,7 +243,7 @@ StepStatus ProtocolLogic::ProcessVersionResponse(uint8_t stage) {
SendVersion(stage);
}
} else {
ResetCommunicationTimeoutAttempts(); // got a meaningful response from the MMU, stop data layer timeout tracking
dataTO.Reset(); // got a meaningful response from the MMU, stop data layer timeout tracking
SendVersion(stage + 1);
}
}
@ -267,8 +254,6 @@ StepStatus ProtocolLogic::ScopeStep() {
if (!ExpectsResponse()) {
// we are waiting for something
switch (currentScope) {
case Scope::StartSeq:
return Processing;
case Scope::DelayedRestart:
return DelayedRestartWait();
case Scope::Idle:
@ -282,9 +267,8 @@ StepStatus ProtocolLogic::ScopeStep() {
}
} else {
// we are expecting a message
if (auto expmsg = ExpectingMessage(); expmsg != MessageReady) { // this whole statement takes 12B
if (auto expmsg = ExpectingMessage(); expmsg != MessageReady) // this whole statement takes 12B
return expmsg;
}
// process message
switch (currentScope) {
@ -365,7 +349,6 @@ StepStatus ProtocolLogic::ProcessCommandQueryResponse() {
return Processing;
case ResponseMsgParamCodes::Error:
// in case of an error the progress code remains as it has been before
progressCode = ProgressCode::ERRWaitingForUser;
errorCode = static_cast<ErrorCode>(rsp.paramValue);
// keep on reporting the state of fsensor regularly even in command error state
// - the MMU checks FINDA and fsensor even while recovering from errors
@ -486,11 +469,9 @@ StepStatus ProtocolLogic::IdleStep() {
case ResponseMsgParamCodes::Processing:
// @@TODO we may actually use this branch to report progress of manual operation on the MMU
// The MMU sends e.g. X0 P27 after its restart when the user presses an MMU button to move the Selector
progressCode = static_cast<ProgressCode>(rsp.paramValue);
errorCode = ErrorCode::OK;
break;
default:
progressCode = ProgressCode::ERRWaitingForUser;
errorCode = static_cast<ErrorCode>(rsp.paramValue);
StartReading8bitRegisters(); // continue Idle state without restarting the communication
return CommandError;
@ -551,7 +532,7 @@ ProtocolLogic::ProtocolLogic(MMU2Serial *uart, uint8_t extraLoadDistance, uint8_
, uart(uart)
, errorCode(ErrorCode::OK)
, progressCode(ProgressCode::OK)
, buttonCode(Buttons::NoButton)
, buttonCode(NoButton)
, lastFSensor((uint8_t)WhereIsFilament())
, regIndex(0)
, retryAttempts(MAX_RETRIES)
@ -726,9 +707,8 @@ void ProtocolLogic::FormatLastResponseMsgAndClearLRB(char *dst) {
for (uint8_t i = 0; i < lrb; ++i) {
uint8_t b = lastReceivedBytes[i];
// Check for printable character, including space
if (b < 32 || b > 127) {
if (b < 32 || b > 127)
b = '.';
}
*dst++ = b;
}
*dst = 0; // terminate properly
@ -742,9 +722,8 @@ void ProtocolLogic::LogRequestMsg(const uint8_t *txbuff, uint8_t size) {
for (uint8_t i = 0; i < size; ++i) {
uint8_t b = txbuff[i];
// Check for printable character, including space
if (b < 32 || b > 127) {
if (b < 32 || b > 127)
b = '.';
}
tmp[i + 1] = b;
}
tmp[size + 1] = 0;
@ -779,7 +758,6 @@ void ProtocolLogic::LogResponse() {
StepStatus ProtocolLogic::SuppressShortDropOuts(const char *msg_P, StepStatus ss) {
if (dataTO.Record(ss)) {
LogError(msg_P);
ResetCommunicationTimeoutAttempts(); // prepare for another run of consecutive retries before firing an error
return dataTO.InitialCause();
} else {
return Processing; // suppress short drop outs of communication
@ -814,12 +792,15 @@ StepStatus ProtocolLogic::Step() {
// We are ok, switching to Idle if there is no potential next request planned.
// But the trouble is we must report a finished command if the previous command has just been finished
// i.e. only try to find some planned command if we just finished the Idle cycle
bool previousCommandFinished = currentScope == Scope::Command; // @@TODO this is a nasty hack :(
if (!ActivatePlannedRequest()) { // if nothing is planned, switch to Idle
SwitchToIdle();
} else if (ExpectsResponse()) {
} else {
// if the previous cycle was Idle and now we have planned a new command -> avoid returning Finished
if (!previousCommandFinished && currentScope == Scope::Command) {
currentStatus = Processing;
}
}
} break;
case CommandRejected:
// we have to repeat it - that's the only thing we can do
@ -850,9 +831,8 @@ StepStatus ProtocolLogic::Step() {
}
uint8_t ProtocolLogic::CommandInProgress() const {
if (currentScope != Scope::Command) {
if (currentScope != Scope::Command)
return 0;
}
return (uint8_t)ReqMsg().code;
}
@ -868,11 +848,6 @@ void ProtocolLogic::ResetRetryAttempts() {
retryAttempts = MAX_RETRIES;
}
void ProtocolLogic::ResetCommunicationTimeoutAttempts() {
SERIAL_ECHOLNPGM("RSTCommTimeout");
dataTO.Reset();
}
bool DropOutFilter::Record(StepStatus ss) {
if (occurrences == maxOccurrences) {
cause = ss;

View File

@ -3,39 +3,37 @@
#include <avr/pgmspace.h>
#ifdef __AVR__
#include "mmu2/error_codes.h"
#include "mmu2/progress_codes.h"
#include "mmu2/buttons.h"
#include "mmu2/registers.h"
#include "mmu2_protocol.h"
#include "mmu2/error_codes.h"
#include "mmu2/progress_codes.h"
#include "mmu2/buttons.h"
#include "mmu2/registers.h"
#include "mmu2_protocol.h"
// #include <array> std array is not available on AVR ... we need to "fake" it
namespace std {
template <typename T, uint8_t N>
template<typename T, uint8_t N>
class array {
T data[N];
public:
array() = default;
inline constexpr T *begin() const { return data; }
inline constexpr T *end() const { return data + N; }
inline constexpr T* begin()const { return data; }
inline constexpr T* end()const { return data + N; }
static constexpr uint8_t size() { return N; }
inline T &operator[](uint8_t i) {
inline T &operator[](uint8_t i){
return data[i];
}
};
} // namespace std
}
#else
#include <array>
#include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
#include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
#include <array>
#include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
#include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
// prevent ARM HAL macros from breaking our code
#undef CRC
#include "../../../../../../Prusa-Firmware-MMU/src/modules/protocol.h"
#include "buttons.h"
#include "registers.h"
// prevent ARM HAL macros from breaking our code
#undef CRC
#include "../../../../../../Prusa-Firmware-MMU/src/modules/protocol.h"
#include "buttons.h"
#endif
#include "mmu2_serial.h"
@ -65,14 +63,16 @@ enum StepStatus : uint_fast8_t {
ButtonPushed, ///< The MMU reported the user pushed one of its three buttons.
};
inline constexpr uint32_t linkLayerTimeout = 2000; ///< default link layer communication timeout
inline constexpr uint32_t dataLayerTimeout = linkLayerTimeout * 3; ///< data layer communication timeout
inline constexpr uint32_t heartBeatPeriod = linkLayerTimeout / 2; ///< period of heart beat messages (Q0)
static constexpr uint32_t linkLayerTimeout = 2000; ///< default link layer communication timeout
static constexpr uint32_t dataLayerTimeout = linkLayerTimeout * 3; ///< data layer communication timeout
static constexpr uint32_t heartBeatPeriod = linkLayerTimeout / 2; ///< period of heart beat messages (Q0)
static_assert(heartBeatPeriod < linkLayerTimeout && linkLayerTimeout < dataLayerTimeout, "Incorrect ordering of timeouts");
///< Filter of short consecutive drop outs which are recovered instantly
class DropOutFilter {
StepStatus cause;
uint8_t occurrences;
public:
static constexpr uint8_t maxOccurrences = 10; // ideally set this to >8 seconds -> 12x heartBeatPeriod
static_assert(maxOccurrences > 1, "we should really silently ignore at least 1 comm drop out if recovered immediately afterwards");
@ -86,10 +86,6 @@ public:
/// Rearms the object for further processing - basically call this once the MMU responds with something meaningful (e.g. S0 A2)
inline void Reset() { occurrences = maxOccurrences; }
private:
StepStatus cause;
uint8_t occurrences = maxOccurrences;
};
/// Logic layer of the MMU vs. printer communication protocol
@ -119,11 +115,11 @@ public:
/// Sets the extra load distance to be reported to the MMU.
/// Beware - this call doesn't send anything to the MMU.
/// The MMU gets the newly set value either by a communication restart or via an explicit WriteRegister call
inline void PlanExtraLoadDistance(uint8_t eld_mm) {
inline void PlanExtraLoadDistance(uint8_t eld_mm){
initRegs8[0] = eld_mm;
}
/// @returns the currently preset extra load distance
inline uint8_t ExtraLoadDistance() const {
inline uint8_t ExtraLoadDistance()const {
return initRegs8[0];
}
@ -186,20 +182,18 @@ public:
/// Reset the retryAttempts back to the default value
void ResetRetryAttempts();
void ResetCommunicationTimeoutAttempts();
constexpr bool InAutoRetry() const { return inAutoRetry; }
void SetInAutoRetry(bool iar) {
inAutoRetry = iar;
}
inline void SetPrinterError(ErrorCode ec) {
inline void SetPrinterError(ErrorCode ec){
explicitPrinterError = ec;
}
inline void ClearPrinterError() {
inline void ClearPrinterError(){
explicitPrinterError = ErrorCode::OK;
}
inline bool IsPrinterError() const {
inline bool IsPrinterError()const {
return explicitPrinterError != ErrorCode::OK;
}
inline ErrorCode PrinterError() const {
@ -234,6 +228,15 @@ private:
Running ///< normal operation - Idle + Command processing
};
// individual sub-state machines - may be they can be combined into a union since only one is active at once
// or we can blend them into ProtocolLogic at the cost of a less nice code (but hopefully shorter)
// Stopped stopped;
// StartSeq startSeq;
// DelayedRestart delayedRestart;
// Idle idle;
// Command command;
// ProtocolLogicPartBase *currentState; ///< command currently being processed
enum class Scope : uint_fast8_t {
Stopped,
StartSeq,
@ -367,11 +370,6 @@ private:
uint8_t lastFSensor; ///< last state of filament sensor
#ifndef __AVR__
uint8_t txbuff[Protocol::MaxRequestSize()]; ///< In Buddy FW - a static transmit buffer needs to exist as DMA cannot be used from CCMRAM.
///< On MK3/S/+ the transmit buffer is allocated on the stack without restrictions
#endif
// 8bit registers
static constexpr uint8_t regs8Count = 3;
static_assert(regs8Count > 0); // code is not ready for empty lists of registers

View File

@ -1,28 +1,27 @@
#include <avr/pgmspace.h>
#include "eeprom.h"
#include "mmu2.h"
#include "mmu2_log.h"
#include "mmu2_reporting.h"
#include "mmu2_error_converter.h"
#include "mmu2_progress_converter.h"
#include "mmu2/error_codes.h"
#include "mmu2/buttons.h"
#include "menu.h"
#include "ultralcd.h"
#include "Filament_sensor.h"
#include "language.h"
#include "lcd.h"
#include "temperature.h"
#include "sound.h"
namespace MMU2 {
void BeginReport(CommandInProgress /*cip*/, ProgressCode ec) {
const char * ProgressCodeToText(uint16_t pc); // we may join progress convertor and reporter together
void BeginReport(CommandInProgress /*cip*/, uint16_t ec) {
custom_message_type = CustomMsg::MMUProgress;
lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
}
void EndReport(CommandInProgress /*cip*/, ProgressCode /*ec*/) {
void EndReport(CommandInProgress /*cip*/, uint16_t /*ec*/) {
// clear the status msg line - let the printed filename get visible again
if (!printJobOngoing()) {
lcd_setstatuspgm(MSG_WELCOME);
@ -73,6 +72,7 @@ static void ReportErrorHookStaticRender(uint8_t ei) {
two_choices = true;
}
lcd_set_custom_characters_nextpage();
lcd_update_enable(false);
lcd_clear();
@ -223,19 +223,15 @@ static bool is_mmu_error_monitor_active;
// Set to false to allow the error screen to render again.
static bool putErrorScreenToSleep;
void CheckErrorScreenUserInput() {
if (is_mmu_error_monitor_active) {
// Call this every iteration to keep the knob rotation responsive
// This includes when mmu_loop is called within manage_response
ReportErrorHook((CommandInProgress)mmu2.GetCommandInProgress(), mmu2.GetLastErrorCode(), mmu2.MMULastErrorSource());
}
bool isErrorScreenRunning() {
return is_mmu_error_monitor_active;
}
bool TuneMenuEntered() {
return putErrorScreenToSleep;
}
void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) {
void ReportErrorHook(CommandInProgress /*cip*/, uint16_t ec, uint8_t /*es*/) {
if (putErrorScreenToSleep) return;
if (mmu2.MMUCurrentErrorCode() == ErrorCode::OK && mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) {
@ -245,11 +241,10 @@ void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) {
ReportErrorHookState = ReportErrorHookStates::DISMISS_ERROR_SCREEN;
}
const uint8_t ei = PrusaErrorCodeIndex((ErrorCode)ec);
const uint8_t ei = PrusaErrorCodeIndex(ec);
switch ((uint8_t)ReportErrorHookState) {
case (uint8_t)ReportErrorHookStates::RENDER_ERROR_SCREEN:
KEEPALIVE_STATE(PAUSED_FOR_USER);
ReportErrorHookStaticRender(ei);
ReportErrorHookState = ReportErrorHookStates::MONITOR_SELECTION;
[[fallthrough]];
@ -267,12 +262,12 @@ void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) {
break;
case 2:
// Exit error screen and enable lcd updates
lcd_set_custom_characters();
lcd_update_enable(true);
lcd_return_to_status();
sound_wait_for_user_reset();
// Reset the state in case a new error is reported
is_mmu_error_monitor_active = false;
KEEPALIVE_STATE(IN_HANDLER);
ReportErrorHookState = ReportErrorHookStates::RENDER_ERROR_SCREEN;
break;
default:
@ -281,12 +276,12 @@ void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) {
return; // Always return to loop() to let MMU trigger a call to ReportErrorHook again
break;
case (uint8_t)ReportErrorHookStates::DISMISS_ERROR_SCREEN:
lcd_set_custom_characters();
lcd_update_enable(true);
lcd_return_to_status();
sound_wait_for_user_reset();
// Reset the state in case a new error is reported
is_mmu_error_monitor_active = false;
KEEPALIVE_STATE(IN_HANDLER);
ReportErrorHookState = ReportErrorHookStates::RENDER_ERROR_SCREEN;
break;
default:
@ -294,61 +289,37 @@ void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) {
}
}
void ReportProgressHook(CommandInProgress cip, ProgressCode ec) {
void ReportProgressHook(CommandInProgress cip, uint16_t ec) {
if (cip != CommandInProgress::NoCommand) {
custom_message_type = CustomMsg::MMUProgress;
lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
}
}
TryLoadUnloadReporter::TryLoadUnloadReporter(float delta_mm)
: dpixel0(0)
, dpixel1(0)
, lcd_cursor_col(0)
, pixel_per_mm(0.5F * float(LCD_WIDTH) / (delta_mm))
{
void TryLoadUnloadProgressbarInit() {
lcd_clearstatus();
}
TryLoadUnloadReporter::~TryLoadUnloadReporter() {
void TryLoadUnloadProgressbarDeinit() {
// Delay the next status message just so
// the user can see the results clearly
lcd_reset_status_message_timeout();
}
void TryLoadUnloadReporter::Render(uint8_t col, bool sensorState) {
// Set the cursor position each time in case some other
// part of the firmware changes the cursor position
lcd_insert_char_into_status(col, sensorState ? LCD_STR_SOLID_BLOCK[0] : '-');
if (!lcd_update_enabled) lcdui_print_status_line();
}
void TryLoadUnloadReporter::Progress(bool sensorState){
// Always round up, you can only have 'whole' pixels. (floor is also an option)
dpixel1 = ceil((stepper_get_machine_position_E_mm() - planner_get_current_position_E()) * pixel_per_mm);
if (dpixel1 - dpixel0) {
dpixel0 = dpixel1;
if (lcd_cursor_col > (LCD_WIDTH - 1)) lcd_cursor_col = LCD_WIDTH - 1;
Render(lcd_cursor_col++, sensorState);
}
}
void TryLoadUnloadReporter::DumpToSerial(){
char buf[LCD_WIDTH + 1];
void TryLoadUnloadProgressbarEcho() {
char buf[LCD_WIDTH];
lcd_getstatus(buf);
for (uint8_t i = 0; i < sizeof(buf); i++) {
// 0xFF is -1 when converting from unsigned to signed char
// If the number is negative, that means filament is present
buf[i] = (buf[i] < 0) ? '1' : '0';
}
buf[LCD_WIDTH] = 0;
MMU2_ECHO_MSGLN(buf);
}
/// Disables MMU in EEPROM
void DisableMMUInSettings() {
eeprom_update_byte_notify((uint8_t *)EEPROM_MMU_ENABLED, false);
mmu2.Status();
void TryLoadUnloadProgressbar(uint8_t col, bool sensorState) {
lcd_insert_char_into_status(col, sensorState ? '-' : LCD_STR_SOLID_BLOCK[0]);
if (!lcd_update_enabled) lcdui_print_status_line();
}
void IncrementLoadFails(){
@ -361,10 +332,6 @@ void IncrementMMUFails(){
eeprom_increment_word((uint16_t *)EEPROM_MMU_FAIL_TOT);
}
bool cutter_enabled(){
return eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED) == EEPROM_MMU_CUTTER_ENABLED_enabled;
}
void MakeSound(SoundType s){
Sound_MakeSound( (eSOUND_TYPE)s);
}
@ -394,7 +361,7 @@ void FullScreenMsgLoad(uint8_t slot){
}
void FullScreenMsgRestoringTemperature(){
lcd_display_message_fullscreen_P(_T(MSG_MMU_RESTORE_TEMP));
lcd_display_message_fullscreen_P(_i("MMU Retry: Restoring temperature...")); ////MSG_MMU_RESTORE_TEMP c=20 r=4
}
void ScreenUpdateEnable(){
@ -413,7 +380,7 @@ struct TuneItem {
static const TuneItem TuneItems[] PROGMEM = {
{ (uint8_t)Register::Selector_sg_thrs_R, 1, 4},
{ (uint8_t)Register::Idler_sg_thrs_R, 2, 10},
{ (uint8_t)Register::Idler_sg_thrs_R, 4, 7},
};
static_assert(sizeof(TuneItems)/sizeof(TuneItem) == 2);
@ -456,7 +423,7 @@ void tuneIdlerStallguardThresholdMenu() {
);
MENU_ITEM_BACK_P(_T(MSG_DONE));
MENU_ITEM_EDIT_int3_P(
_T(MSG_MMU_SENSITIVITY),
_i("Sensitivity"), ////MSG_MMU_SENSITIVITY c=18
&_md->currentValue,
_md->item.minValue,
_md->item.maxValue
@ -465,15 +432,6 @@ void tuneIdlerStallguardThresholdMenu() {
}
void tuneIdlerStallguardThreshold() {
if ((CommandInProgress)mmu2.GetCommandInProgress() != NoCommand)
{
// Workaround to mitigate an issue where the Tune menu doesn't
// work if the MMU is running a command. For example the Idler
// homing fails during toolchange.
// To save the print, make the Tune button unresponsive for now.
return;
}
putErrorScreenToSleep = true;
menu_submenu(tuneIdlerStallguardThresholdMenu);
}

View File

@ -2,19 +2,12 @@
#pragma once
#include <stdint.h>
#ifdef __AVR__
#include "mmu2/error_codes.h"
#include "mmu2/progress_codes.h"
#else
#include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
#include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
#endif
namespace MMU2 {
enum CommandInProgress : uint8_t {
NoCommand = 0,
CutFilament = 'K',
CutFilament = 'C',
EjectFilament = 'E',
Homing = 'H',
LoadFilament = 'L',
@ -24,13 +17,13 @@ enum CommandInProgress : uint8_t {
};
/// Called at the begin of every MMU operation
void BeginReport(CommandInProgress cip, ProgressCode ec);
void BeginReport(CommandInProgress cip, uint16_t ec);
/// Called at the end of every MMU operation
void EndReport(CommandInProgress cip, ProgressCode ec);
void EndReport(CommandInProgress cip, uint16_t ec);
/// Checks for error screen user input, if the error screen is open
void CheckErrorScreenUserInput();
/// Return true if the printer's LCD is drawing the error screen
bool isErrorScreenRunning();
/// Return true if the error screen is sleeping in the background
/// Error screen sleeps when the firmware is rendering complementary
@ -42,31 +35,24 @@ bool TuneMenuEntered();
/// and allow the MMU and printer to communicate with each other.
/// @param[in] ec error code
/// @param[in] es error source
void ReportErrorHook(CommandInProgress cip, ErrorCode ec, uint8_t es);
void ReportErrorHook(CommandInProgress cip, uint16_t ec, uint8_t es);
/// Called when the MMU sends operation progress update
void ReportProgressHook(CommandInProgress cip, ProgressCode ec);
void ReportProgressHook(CommandInProgress cip, uint16_t ec);
struct TryLoadUnloadReporter {
TryLoadUnloadReporter(float delta_mm);
~TryLoadUnloadReporter();
void Progress(bool sensorState);
void DumpToSerial();
/// @brief Clear the status line and setup the LCD cursor
void TryLoadUnloadProgressbarInit();
private:
/// @brief Add one block to the progress bar
/// @param col pixel position on the LCD status line, should range from 0 to (LCD_WIDTH - 1)
/// @param sensorState if true, filament is not present, else filament is present. This controls which character to render
void Render(uint8_t col, bool sensorState);
/// @brief Clear the status line and setup the LCD cursor
void TryLoadUnloadProgressbarDeinit();
uint8_t dpixel0;
uint8_t dpixel1;
uint8_t lcd_cursor_col;
// The total length is twice delta_mm. Divide that length by number of pixels
// available to get length per pixel.
// Note: Below is the reciprocal of (2 * delta_mm) / LCD_WIDTH [mm/pixel]
float pixel_per_mm;
};
/// @brief Report the results to serial
void TryLoadUnloadProgressbarEcho();
/// @brief Add one block to the progress bar
/// @param col pixel position on the LCD status line, should range from 0 to (LCD_WIDTH - 1)
/// @param sensorState if true, filament is not present, else filament is present. This controls which character to render
void TryLoadUnloadProgressbar(uint8_t col, bool sensorState);
/// Remders the sensor status line. Also used by the "resume temperature" screen.
void ReportErrorHookDynamicRender();
@ -81,9 +67,6 @@ bool MMUAvailable();
/// Global Enable/Disable use MMU (to be stored in EEPROM)
bool UseMMU();
/// Disables MMU in EEPROM
void DisableMMUInSettings();
/// Increments EEPROM cell - number of failed loads into the nozzle
/// Note: technically, this is not an MMU error but an error of the printer.
void IncrementLoadFails();
@ -91,9 +74,6 @@ void IncrementLoadFails();
/// Increments EEPROM cell - number of MMU errors
void IncrementMMUFails();
/// @returns true when Cutter is enabled in the menus
bool cutter_enabled();
// Beware: enum values intentionally chosen to match the 8bit FW to save code size
enum SoundType {
Prompt = 2,
@ -113,4 +93,4 @@ void ScreenClear();
void tuneIdlerStallguardThreshold();
} // namespace MMU2
} // namespace

View File

@ -13,12 +13,9 @@ namespace MMU2 {
/// When the printer's FW starts, the MMU mode is either Stopped or NotResponding (based on user's preference).
/// When the MMU successfully establishes communication, the state changes to Active.
enum class xState : uint_fast8_t {
/// The user doesn't want the printer to work with the MMU. The MMU itself is not powered and does not work at all.
/// !!! Must be 0 !!! marlin_vars.mmu2_state is set to 0 if not active
Stopped,
Active, ///< MMU has been detected, connected, communicates and is ready to be worked with.
Connecting, ///< MMU is connected but it doesn't communicate (yet). The user wants the MMU, but it is not ready to be worked with.
Stopped ///< The user doesn't want the printer to work with the MMU. The MMU itself is not powered and does not work at all.
};
} // namespace MMU2

View File

@ -5,6 +5,6 @@ namespace MMU2 {
static constexpr uint8_t mmuVersionMajor = 3;
static constexpr uint8_t mmuVersionMinor = 0;
static constexpr uint8_t mmuVersionPatch = 3;
static constexpr uint8_t mmuVersionPatch = 1;
} // namespace MMU2

View File

@ -56,7 +56,7 @@ void mc_arc(const float* position, float* target, const float* offset, float fee
if (cs.arc_segments_per_sec > 0)
{
// 20200417 - FormerLurker - Implement MIN_ARC_SEGMENTS if it is defined - from Marlin 2.0 implementation
float mm_per_arc_segment_sec = feed_rate / (60.f * float(cs.arc_segments_per_sec));
float mm_per_arc_segment_sec = (feed_rate / 60.0f) * (1.0f / cs.arc_segments_per_sec);
if (mm_per_arc_segment_sec < mm_per_arc_segment)
mm_per_arc_segment = mm_per_arc_segment_sec;
}

View File

@ -161,8 +161,6 @@ uint8_t optiboot_xflash_enter()
lcd_clear();
lcd_puts_at_P(0, 1, PSTR(" Upgrading xflash\n Do not disconnect!"));
boot_app_magic = 0; //disable the bootapp if a watchdog reset is going to be used
/* Forever loop: exits by causing WDT reset */
for (;;) {
/* get character from UART */

View File

@ -3,6 +3,8 @@
#include "boards.h"
#define LARGE_FLASH true
/*****************************************************************
* Rambo Pin Assignments 1.3
******************************************************************/

View File

@ -57,7 +57,6 @@
#include "temperature.h"
#include "fancheck.h"
#include "ultralcd.h"
#include "lcd.h"
#include "language.h"
#include "ConfigurationStore.h"
@ -85,6 +84,15 @@ float* max_feedrate = cs.max_feedrate_normal;
uint32_t* max_acceleration_mm_per_s2 = cs.max_acceleration_mm_per_s2_normal;
uint32_t max_acceleration_steps_per_s2[NUM_AXIS];
#ifdef ENABLE_AUTO_BED_LEVELING
// this holds the required transform to compensate for bed level
matrix_3x3 plan_bed_level_matrix = {
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
};
#endif // #ifdef ENABLE_AUTO_BED_LEVELING
// The current position of the tool in absolute steps
long position[NUM_AXIS]; //rescaled from extern when axis_steps_per_mm are changed by gcode
static float previous_speed[NUM_AXIS]; // Speed of previous path line segment
@ -115,7 +123,7 @@ static uint8_t g_cntr_planner_queue_min = 0;
//===========================================================================
#ifdef PREVENT_DANGEROUS_EXTRUDE
int extrude_min_temp = EXTRUDE_MINTEMP;
#endif //PREVENT_DANGEROUS_EXTRUDE
#endif
#ifdef LIN_ADVANCE
float extruder_advance_K = LA_K_DEF;
@ -749,9 +757,54 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate
plan_reset_next_e_sched = true;
}
#ifdef ENABLE_AUTO_BED_LEVELING
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif // ENABLE_AUTO_BED_LEVELING
// Apply the machine correction matrix.
{
#if 0
SERIAL_ECHOPGM("Planner, current position - servos: ");
MYSERIAL.print(st_get_position_mm(X_AXIS), 5);
SERIAL_ECHOPGM(", ");
MYSERIAL.print(st_get_position_mm(Y_AXIS), 5);
SERIAL_ECHOPGM(", ");
MYSERIAL.print(st_get_position_mm(Z_AXIS), 5);
SERIAL_ECHOLNPGM("");
SERIAL_ECHOPGM("Planner, target position, initial: ");
MYSERIAL.print(x, 5);
SERIAL_ECHOPGM(", ");
MYSERIAL.print(y, 5);
SERIAL_ECHOLNPGM("");
SERIAL_ECHOPGM("Planner, world2machine: ");
MYSERIAL.print(world2machine_rotation_and_skew[0][0], 5);
SERIAL_ECHOPGM(", ");
MYSERIAL.print(world2machine_rotation_and_skew[0][1], 5);
SERIAL_ECHOPGM(", ");
MYSERIAL.print(world2machine_rotation_and_skew[1][0], 5);
SERIAL_ECHOPGM(", ");
MYSERIAL.print(world2machine_rotation_and_skew[1][1], 5);
SERIAL_ECHOLNPGM("");
SERIAL_ECHOPGM("Planner, offset: ");
MYSERIAL.print(world2machine_shift[0], 5);
SERIAL_ECHOPGM(", ");
MYSERIAL.print(world2machine_shift[1], 5);
SERIAL_ECHOLNPGM("");
#endif
world2machine(x, y);
#if 0
SERIAL_ECHOPGM("Planner, target position, corrected: ");
MYSERIAL.print(x, 5);
SERIAL_ECHOPGM(", ");
MYSERIAL.print(y, 5);
SERIAL_ECHOLNPGM("");
#endif
}
// The target position of the tool in absolute steps
// Calculate target position in absolute steps
//this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
@ -803,7 +856,7 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate
}
#endif
}
#endif //PREVENT_DANGEROUS_EXTRUDE
#endif
// Number of steps for each axis
#ifndef COREXY
@ -1238,8 +1291,27 @@ Having the real displacement of the head, we can calculate the total movement le
ENABLE_STEPPER_DRIVER_INTERRUPT();
}
#ifdef ENABLE_AUTO_BED_LEVELING
vector_3 plan_get_position() {
vector_3 position = vector_3(st_get_position_mm(X_AXIS), st_get_position_mm(Y_AXIS), st_get_position_mm(Z_AXIS));
//position.debug("in plan_get position");
//plan_bed_level_matrix.debug("in plan_get bed_level");
matrix_3x3 inverse = matrix_3x3::transpose(plan_bed_level_matrix);
//inverse.debug("in plan_get inverse");
position.apply_rotation(inverse);
//position.debug("after rotation");
return position;
}
#endif // ENABLE_AUTO_BED_LEVELING
void plan_set_position(float x, float y, float z, const float &e)
{
#ifdef ENABLE_AUTO_BED_LEVELING
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif // ENABLE_AUTO_BED_LEVELING
world2machine(x, y);
position[X_AXIS] = lround(x*cs.axis_steps_per_mm[X_AXIS]);
@ -1292,7 +1364,7 @@ void set_extrude_min_temp(int temp)
{
extrude_min_temp = temp;
}
#endif //PREVENT_DANGEROUS_EXTRUDE
#endif
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s
void reset_acceleration_rates()

View File

@ -26,6 +26,10 @@
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_LEVELING
#include "vector_3.h"
#endif // ENABLE_AUTO_BED_LEVELING
enum BlockFlag {
// Planner flag to recalculate trapezoids on entry junction.
// This flag has an optimization purpose only.
@ -126,9 +130,24 @@ typedef struct {
extern float extruder_advance_K; // Linear-advance K factor
#endif
#ifdef ENABLE_AUTO_BED_LEVELING
// this holds the required transform to compensate for bed level
extern matrix_3x3 plan_bed_level_matrix;
#endif // #ifdef ENABLE_AUTO_BED_LEVELING
// Initialize the motion plan subsystem
void plan_init();
// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in
// millimaters. Feed rate specifies the speed of the motion.
#ifdef ENABLE_AUTO_BED_LEVELING
void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate);
// Get the position applying the bed level matrix if enabled
vector_3 plan_get_position();
#else
/// Extracting common call of
/// plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], ...
/// saves almost 5KB.
@ -140,9 +159,15 @@ void plan_buffer_line_destinationXYZE(float feed_rate);
void plan_set_position_curposXYZE();
void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const float* gcode_start_position = NULL, uint16_t segment_idx = 0);
//void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
#endif // ENABLE_AUTO_BED_LEVELING
// Set position. Used for G92 instructions.
//#ifdef ENABLE_AUTO_BED_LEVELING
void plan_set_position(float x, float y, float z, const float &e);
//#else
//void plan_set_position(const float &x, const float &y, const float &z, const float &e);
//#endif // ENABLE_AUTO_BED_LEVELING
void plan_set_z_position(const float &z);
void plan_set_e_position(const float &e);
@ -241,7 +266,7 @@ extern bool planner_aborted;
#ifdef PREVENT_DANGEROUS_EXTRUDE
extern int extrude_min_temp;
void set_extrude_min_temp(int temp);
#endif //PREVENT_DANGEROUS_EXTRUDE
#endif
void reset_acceleration_rates();
#endif

View File

@ -41,7 +41,10 @@ void uvlo_() {
unsigned long time_start = _millis();
// True if a print is already saved to RAM
const bool print_saved_in_ram = saved_printing && (saved_printing_type != PowerPanic::PRINT_TYPE_NONE);
bool sd_print_saved_in_ram = saved_printing && (saved_printing_type == PRINTING_TYPE_SD);
// Flag to decide whether or not to set EEPROM_UVLO bit
bool sd_print = card.sdprinting || sd_print_saved_in_ram;
const bool pos_invalid = mesh_bed_leveling_flag || homing_flag;
// Conserve as much power as soon as possible
@ -66,7 +69,7 @@ void uvlo_() {
tmc2130_setup_chopper(E_AXIS, tmc2130_mres[E_AXIS]);
#endif //TMC2130
if (!print_saved_in_ram && !isPartialBackupAvailable)
if (!sd_print_saved_in_ram && !isPartialBackupAvailable)
{
saved_bed_temperature = target_temperature_bed;
saved_extruder_temperature = target_temperature[active_extruder];
@ -75,10 +78,11 @@ void uvlo_() {
}
// Stop all heaters before continuing
disable_heater();
setTargetHotend(0);
setTargetBed(0);
// Fetch data not included in a partial back-up
if (!print_saved_in_ram) {
if (!sd_print_saved_in_ram) {
// Calculate the file position, from which to resume this print.
save_print_file_state();
@ -99,7 +103,7 @@ void uvlo_() {
// When there is no position already saved, then we must grab whatever the current position is.
// This is most likely a position where the printer is in the middle of a G-code move
if (!print_saved_in_ram && !isPartialBackupAvailable)
if (!sd_print_saved_in_ram && !isPartialBackupAvailable)
{
memcpy(saved_pos, current_position, sizeof(saved_pos));
if (pos_invalid) saved_pos[X_AXIS] = X_COORD_INVALID;
@ -113,11 +117,11 @@ void uvlo_() {
// mesh bed leveling offset value.
logical_z -= mbl.get_z(saved_pos[X_AXIS], saved_pos[Y_AXIS]);
}
eeprom_update_float_notify((float*)EEPROM_UVLO_CURRENT_POSITION_Z, logical_z);
eeprom_update_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z, logical_z);
// Store the print E position before we lose track
eeprom_update_float_notify((float*)(EEPROM_UVLO_CURRENT_POSITION_E), saved_pos[E_AXIS]);
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_E_ABS, !saved_extruder_relative_mode);
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E), saved_pos[E_AXIS]);
eeprom_update_byte((uint8_t*)EEPROM_UVLO_E_ABS, !saved_extruder_relative_mode);
// Clean the input command queue, inhibit serial processing using saved_printing
cmdqueue_reset();
@ -149,7 +153,7 @@ void uvlo_() {
poweroff_z();
// Write the file position.
eeprom_update_dword_notify((uint32_t*)(EEPROM_FILE_POSITION), saved_sdpos);
eeprom_update_dword((uint32_t*)(EEPROM_FILE_POSITION), saved_sdpos);
// Store the mesh bed leveling offsets. This is 2*7*7=98 bytes, which takes 98*3.4us=333us in worst case.
for (uint8_t mesh_point = 0; mesh_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS; ++ mesh_point)
@ -158,56 +162,43 @@ void uvlo_() {
uint8_t iy = mesh_point / MESH_NUM_X_POINTS;
// Scale the z value to 1u resolution.
int16_t v = mbl_was_active ? int16_t(floor(mbl.z_values[iy][ix] * 1000.f + 0.5f)) : 0;
eeprom_update_word_notify((uint16_t*)(EEPROM_UVLO_MESH_BED_LEVELING_FULL +2*mesh_point), *reinterpret_cast<uint16_t*>(&v));
eeprom_update_word((uint16_t*)(EEPROM_UVLO_MESH_BED_LEVELING_FULL +2*mesh_point), *reinterpret_cast<uint16_t*>(&v));
}
// Write the _final_ Z position
eeprom_update_float_notify((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z, current_position[Z_AXIS]);
eeprom_update_float((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z, current_position[Z_AXIS]);
// Store the current position.
eeprom_update_float_notify((float*)(EEPROM_UVLO_CURRENT_POSITION + 0), saved_pos[X_AXIS]);
eeprom_update_float_notify((float*)(EEPROM_UVLO_CURRENT_POSITION + 4), saved_pos[Y_AXIS]);
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0), saved_pos[X_AXIS]);
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4), saved_pos[Y_AXIS]);
// Store the current feed rate, temperatures, fan speed and extruder multipliers (flow rates)
eeprom_update_word_notify((uint16_t*)EEPROM_UVLO_FEEDRATE, saved_feedrate2);
eeprom_update_word_notify((uint16_t*)EEPROM_UVLO_FEEDMULTIPLY, feedmultiply);
eeprom_update_word_notify((uint16_t*)EEPROM_UVLO_TARGET_HOTEND, saved_extruder_temperature);
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_TARGET_BED, saved_bed_temperature);
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_FAN_SPEED, saved_fan_speed);
eeprom_update_float_notify((float*)(EEPROM_EXTRUDER_MULTIPLIER_0), extruder_multiplier[0]);
eeprom_update_word_notify((uint16_t*)(EEPROM_EXTRUDEMULTIPLY), (uint16_t)extrudemultiply);
eeprom_update_word((uint16_t*)EEPROM_UVLO_FEEDRATE, saved_feedrate2);
eeprom_update_word((uint16_t*)EEPROM_UVLO_FEEDMULTIPLY, feedmultiply);
eeprom_update_word((uint16_t*)EEPROM_UVLO_TARGET_HOTEND, saved_extruder_temperature);
eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_BED, saved_bed_temperature);
eeprom_update_byte((uint8_t*)EEPROM_UVLO_FAN_SPEED, saved_fan_speed);
eeprom_update_float((float*)(EEPROM_EXTRUDER_MULTIPLIER_0), extruder_multiplier[0]);
eeprom_update_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY), (uint16_t)extrudemultiply);
eeprom_update_float_notify((float*)(EEPROM_UVLO_ACCELL), cs.acceleration);
eeprom_update_float_notify((float*)(EEPROM_UVLO_RETRACT_ACCELL), cs.retract_acceleration);
eeprom_update_float_notify((float*)(EEPROM_UVLO_TRAVEL_ACCELL), cs.travel_acceleration);
eeprom_update_float((float*)(EEPROM_UVLO_ACCELL), cs.acceleration);
eeprom_update_float((float*)(EEPROM_UVLO_RETRACT_ACCELL), cs.retract_acceleration);
eeprom_update_float((float*)(EEPROM_UVLO_TRAVEL_ACCELL), cs.travel_acceleration);
// Store the saved target
eeprom_update_block_notify(saved_start_position, (float *)EEPROM_UVLO_SAVED_START_POSITION, sizeof(saved_start_position));
eeprom_update_block(saved_start_position, (float *)EEPROM_UVLO_SAVED_START_POSITION, sizeof(saved_start_position));
eeprom_update_word_notify((uint16_t*)EEPROM_UVLO_SAVED_SEGMENT_IDX, saved_segment_idx);
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_PRINT_TYPE, saved_printing_type);
eeprom_update_word((uint16_t*)EEPROM_UVLO_SAVED_SEGMENT_IDX, saved_segment_idx);
#ifdef LIN_ADVANCE
eeprom_update_float_notify((float*)(EEPROM_UVLO_LA_K), extruder_advance_K);
eeprom_update_float((float*)(EEPROM_UVLO_LA_K), extruder_advance_K);
#endif
#ifdef PREVENT_DANGEROUS_EXTRUDE
eeprom_update_word_notify((uint16_t*)EEPROM_UVLO_EXTRUDE_MINTEMP, extrude_min_temp);
#endif //PREVENT_DANGEROUS_EXTRUDE
eeprom_update_block_notify(cs.max_acceleration_mm_per_s2_normal, (uint32_t *)EEPROM_UVLO_ACCELL_MM_S2_NORMAL, sizeof(cs.max_acceleration_mm_per_s2_normal));
eeprom_update_block_notify(cs.max_acceleration_mm_per_s2_silent, (uint32_t *)EEPROM_UVLO_ACCELL_MM_S2_SILENT, sizeof(cs.max_acceleration_mm_per_s2_silent));
eeprom_update_block_notify(cs.max_feedrate_normal, (float *)EEPROM_UVLO_MAX_FEEDRATE_NORMAL, sizeof(cs.max_feedrate_normal));
eeprom_update_block_notify(cs.max_feedrate_silent, (float *)EEPROM_UVLO_MAX_FEEDRATE_SILENT, sizeof(cs.max_feedrate_silent));
eeprom_update_float_notify((float *)(EEPROM_UVLO_MIN_FEEDRATE), cs.minimumfeedrate);
eeprom_update_float_notify((float *)(EEPROM_UVLO_MIN_TRAVEL_FEEDRATE), cs.mintravelfeedrate);
eeprom_update_dword_notify((uint32_t *)(EEPROM_UVLO_MIN_SEGMENT_TIME_US), cs.min_segment_time_us);
eeprom_update_block_notify(cs.max_jerk, (float *)EEPROM_UVLO_MAX_JERK, sizeof(cs.max_jerk));
// Finally store the "power outage" flag.
if (did_pause_print) {
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_Z_LIFTED, 1);
}
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::PENDING_RECOVERY);
// Note: Recovering a print from EEPROM currently assumes the user
// is printing from an SD card, this is why this EEPROM byte is only set
// when SD card print is detected
if(sd_print) eeprom_update_byte((uint8_t*)EEPROM_UVLO, PENDING_RECOVERY);
// Increment power failure counter
eeprom_increment_byte((uint8_t*)EEPROM_POWER_COUNT);
@ -242,7 +233,8 @@ static void uvlo_tiny() {
#endif //TMC2130
// Stop all heaters
disable_heater();
setTargetHotend(0);
setTargetBed(0);
// When power is interrupted on the _first_ recovery an attempt can be made to raise the
// extruder, causing the Z position to change. Similarly, when recovering, the Z position is
@ -275,11 +267,11 @@ static void uvlo_tiny() {
poweroff_z();
// Update Z position
eeprom_update_float_notify((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]);
eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]);
}
// Update the the "power outage" flag.
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::PENDING_RECOVERY_RETRY);
eeprom_update_byte((uint8_t*)EEPROM_UVLO, PENDING_RECOVERY_RETRY);
// Increment power failure counter
eeprom_increment_byte((uint8_t*)EEPROM_POWER_COUNT);
@ -301,7 +293,7 @@ void setup_uvlo_interrupt() {
EIMSK |= (1 << 4);
// check if power was lost before we armed the interrupt
if(!(PINE & (1 << 4)) && printer_recovering())
if(!(PINE & (1 << 4)) && eeprom_read_byte((uint8_t*)EEPROM_UVLO) != NO_PENDING_RECOVERY)
{
SERIAL_ECHOLNRPGM(MSG_INT4);
uvlo_drain_reset();
@ -311,7 +303,7 @@ void setup_uvlo_interrupt() {
ISR(INT4_vect) {
EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once
SERIAL_ECHOLNRPGM(MSG_INT4);
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == PowerPanic::NO_PENDING_RECOVERY)
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == NO_PENDING_RECOVERY)
{
if(printer_active()) {
uvlo_();
@ -325,22 +317,18 @@ ISR(INT4_vect) {
}
void recover_print(uint8_t automatic) {
lcd_setstatuspgm(_T(MSG_RECOVERING_PRINT));
lcd_update_enable(true);
lcd_update(2);
lcd_setstatuspgm(_i("Recovering print"));////MSG_RECOVERING_PRINT c=20
// Recover position, temperatures and extrude_multipliers
bool mbl_was_active = recover_machine_state_after_power_panic();
// Undo PP Z Lift by setting current Z pos to + Z_PAUSE_LIFT
// With first PP or Pause + PP the Z has been already lift.
// After a reboot the printer doesn't know the Z height and we have to set its previous value
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO_Z_LIFTED) == 1 ) {
current_position[Z_AXIS] += Z_PAUSE_LIFT;
}
// Lift the print head ONCE plus Z_PAUSE_LIFT first to avoid collisions with oozed material with the print,
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO_Z_LIFTED) == 0) {
enquecommandf_P(PSTR("G1 Z%.3f F800"), current_position[Z_AXIS] + Z_PAUSE_LIFT);
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_Z_LIFTED, 1);
// Lift the print head 25mm, first to avoid collisions with oozed material with the print,
// and second also so one may remove the excess priming material.
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO) == PENDING_RECOVERY)
{
enquecommandf_P(PSTR("G1 Z%.3f F800"), current_position[Z_AXIS] + 25);
}
// Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine
@ -349,10 +337,7 @@ void recover_print(uint8_t automatic) {
// Set the target bed and nozzle temperatures and wait.
enquecommandf_P(PSTR("M104 S%d"), target_temperature[active_extruder]);
enquecommandf_P(PSTR("M140 S%d"), target_temperature_bed);
//No need to wait for hotend heatup while host printing, as print will pause and wait for host.
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_SD) {
enquecommandf_P(PSTR("M109 S%d"), target_temperature[active_extruder]);
}
enquecommand_P(MSG_M83); //E axis relative mode
// If not automatically recoreverd (long power loss)
@ -434,17 +419,6 @@ bool recover_machine_state_after_power_panic() {
extruder_advance_K = eeprom_read_float((float*)EEPROM_UVLO_LA_K);
#endif
#ifdef PREVENT_DANGEROUS_EXTRUDE
extrude_min_temp = eeprom_read_word((uint16_t*)EEPROM_UVLO_EXTRUDE_MINTEMP);
#endif //PREVENT_DANGEROUS_EXTRUDE
eeprom_read_block(cs.max_acceleration_mm_per_s2_normal, (uint32_t *)EEPROM_UVLO_ACCELL_MM_S2_NORMAL, sizeof(cs.max_acceleration_mm_per_s2_normal));
eeprom_read_block(cs.max_acceleration_mm_per_s2_silent, (uint32_t *)EEPROM_UVLO_ACCELL_MM_S2_SILENT, sizeof(cs.max_acceleration_mm_per_s2_silent));
eeprom_read_block(cs.max_feedrate_normal, (float *)EEPROM_UVLO_MAX_FEEDRATE_NORMAL, sizeof(cs.max_feedrate_normal));
eeprom_read_block(cs.max_feedrate_silent, (float *)EEPROM_UVLO_MAX_FEEDRATE_SILENT, sizeof(cs.max_feedrate_silent));
cs.minimumfeedrate = eeprom_read_float((float *)EEPROM_UVLO_MIN_FEEDRATE);
cs.mintravelfeedrate = eeprom_read_float((float *)EEPROM_UVLO_MIN_TRAVEL_FEEDRATE);
cs.min_segment_time_us = eeprom_read_dword((uint32_t *)EEPROM_UVLO_MIN_SEGMENT_TIME_US);
eeprom_read_block(cs.max_jerk, (float *)EEPROM_UVLO_MAX_JERK, sizeof(cs.max_jerk));
return mbl_was_active;
}
@ -452,6 +426,9 @@ void restore_print_from_eeprom(bool mbl_was_active) {
int feedrate_rec;
int feedmultiply_rec;
uint8_t fan_speed_rec;
char filename[FILENAME_LENGTH];
uint8_t depth = 0;
char dir_name[9];
fan_speed_rec = eeprom_read_byte((uint8_t*)EEPROM_UVLO_FAN_SPEED);
feedrate_rec = eeprom_read_word((uint16_t*)EEPROM_UVLO_FEEDRATE);
@ -461,10 +438,29 @@ void restore_print_from_eeprom(bool mbl_was_active) {
SERIAL_ECHOPGM(", feedmultiply:");
MYSERIAL.println(feedmultiply_rec);
if (saved_printing_type == PowerPanic::PRINT_TYPE_SD)
{ // M23
restore_file_from_sd();
depth = eeprom_read_byte((uint8_t*)EEPROM_DIR_DEPTH);
MYSERIAL.println(int(depth));
for (uint8_t i = 0; i < depth; i++) {
for (uint8_t j = 0; j < 8; j++) {
dir_name[j] = eeprom_read_byte((uint8_t*)EEPROM_DIRS + j + 8 * i);
}
dir_name[8] = '\0';
MYSERIAL.println(dir_name);
card.chdir(dir_name, false);
}
for (uint8_t i = 0; i < 8; i++) {
filename[i] = eeprom_read_byte((uint8_t*)EEPROM_FILENAME + i);
}
filename[8] = '\0';
MYSERIAL.print(filename);
strcat_P(filename, PSTR(".gco"));
enquecommandf_P(MSG_M23, filename);
uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION));
SERIAL_ECHOPGM("Position read from eeprom:");
MYSERIAL.println(position);
// Move to the XY print position in logical coordinates, where the print has been killed, but
// without shifting Z along the way. This requires performing the move without mbl.
@ -501,21 +497,9 @@ void restore_print_from_eeprom(bool mbl_was_active) {
// Set the fan speed saved at the power panic.
enquecommandf_P(PSTR("M106 S%u"), fan_speed_rec);
// SD: Position in file, USB: g-code line number
uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION));
if (saved_printing_type == PowerPanic::PRINT_TYPE_SD)
{
// Set a position in the file.
enquecommandf_P(PSTR("M26 S%lu"), position);
}
else if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST)
{
// Set line number
enquecommandf_P(PSTR("M110 N%lu"), position);
}
enquecommand_P(PSTR("G4 S0"));
enquecommand_P(PSTR("PRUSA uvlo"));
}
#endif //UVLO_SUPPORT

View File

@ -1,20 +1,11 @@
#pragma once
namespace PowerPanic {
enum PowerPanicFlag : uint8_t {
NO_PENDING_RECOVERY = 0,
PENDING_RECOVERY = 1, // First power panic, print state is saved in EEPROM
PENDING_RECOVERY_RETRY = 2, // Power outage occured during recovery, print is still saved in EEPROM
};
// Types of printjobs possible when power panic is triggered
enum PrintType : uint8_t {
PRINT_TYPE_SD = 0,
PRINT_TYPE_HOST = 1,
PRINT_TYPE_NONE = 2,
};
} // namespace PowerPanic
void uvlo_();
void recover_print(uint8_t automatic);
void setup_uvlo_interrupt();

View File

@ -1,16 +0,0 @@
//! @file
//! @brief Printer State
//! @param GetPrinterState get current printer state
//! @param SetPrinterState set printer state
#include "printer_state.h"
static PrinterState printer_state;
PrinterState GetPrinterState() {
return printer_state;
}
PrinterState SetPrinterState(PrinterState status) {
return printer_state = status;
}

View File

@ -1,29 +0,0 @@
//! @file
//! @brief Printer States
//! @param NotReady
//! @param IsReady
//! @param Idle
//! @param SDPrintingFinished
//! @param HostPrintingFinished
//! @param IsSDPrinting
//! @param IsHostPrinting
//! @todo Pause/Resume states, Heating states and more
#pragma once
#include "macros.h"
// The order of the states is important as we check
// - LCD menu only shown when lower than "IsSDPrinting"
enum class PrinterState : uint8_t
{
NotReady = 0, //Lowest state to simplify queries
IsReady = 1, //
Idle = 2,
SDPrintingFinished = 3,
HostPrintingFinished = 4,
IsSDPrinting = 5,
IsHostPrinting = 6,
};
PrinterState GetPrinterState();
PrinterState SetPrinterState(PrinterState status);

1930
Firmware/qr_solve.cpp Normal file

File diff suppressed because it is too large Load Diff

22
Firmware/qr_solve.h Normal file
View File

@ -0,0 +1,22 @@
#include "Configuration.h"
#ifdef AUTO_BED_LEVELING_GRID
void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
double ddot ( int n, double dx[], int incx, double dy[], int incy );
double dnrm2 ( int n, double x[], int incx );
void dqrank ( double a[], int lda, int m, int n, double tol, int *kr,
int jpvt[], double qraux[] );
void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[],
double work[], int job );
int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[],
double x[], double rsd[], int jpvt[], double qraux[], int itask );
void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[],
double rsd[], int jpvt[], double qraux[] );
int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[],
double qy[], double qty[], double b[], double rsd[], double ab[], int job );
void dscal ( int n, double sa, double x[], int incx );
void dswap ( int n, double x[], int incx, double y[], int incy );
double *qr_solve ( int m, int n, double a[], double b[] );
#endif

View File

@ -1,4 +1,5 @@
//sm4.cpp - simple 4-axis stepper control
//sm4.c - simple 4-axis stepper control
#include "sm4.h"
#include <avr/io.h>
#include <avr/pgmspace.h>
@ -48,6 +49,28 @@ sm4_update_pos_cb_t sm4_update_pos_cb = 0;
sm4_calc_delay_cb_t sm4_calc_delay_cb = 0;
uint16_t sm4_cpu_time = 0;
uint8_t sm4_get_dir(uint8_t axis)
{
switch (axis)
{
#if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3))
case 0: return (PORTL & 2)?XDIR;
case 1: return (PORTL & 1)?YDIR;
case 2: return (PORTL & 4)?ZDIR;
case 3: return (PORTL & 64)?EDIR;
#elif ((MOTHERBOARD == BOARD_EINSY_1_0a))
case 0: return (PORTL & 1)?XDIR;
case 1: return (PORTL & 2)?YDIR;
case 2: return (PORTL & 4)?ZDIR;
case 3: return (PORTL & 64)?EDIR;
#endif
}
return 0;
}
void sm4_set_dir(uint8_t axis, uint8_t dir)
{
switch (axis)
@ -67,9 +90,30 @@ void sm4_set_dir(uint8_t axis, uint8_t dir)
asm("nop");
}
uint8_t sm4_get_dir_bits(void)
{
register uint8_t dir_bits = 0;
register uint8_t portL = PORTL;
//TODO -optimize in asm
#if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3))
if (portL & 2) dir_bits |= 1;
if (portL & 1) dir_bits |= 2;
if (portL & 4) dir_bits |= 4;
if (portL & 64) dir_bits |= 8;
dir_bits ^= dir_mask;
#elif ((MOTHERBOARD == BOARD_EINSY_1_0a))
if (portL & 1) dir_bits |= 1;
if (portL & 2) dir_bits |= 2;
if (portL & 4) dir_bits |= 4;
if (portL & 64) dir_bits |= 8;
dir_bits ^= dir_mask;
#endif
return dir_bits;
}
void sm4_set_dir_bits(uint8_t dir_bits)
{
uint8_t portL = PORTL;
register uint8_t portL = PORTL;
portL &= 0xb8; //set direction bits to zero
//TODO -optimize in asm
#if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3))
@ -95,7 +139,7 @@ void sm4_do_step(uint8_t axes_mask)
#ifdef TMC2130_DEDGE_STEPPING
PINC = (axes_mask & 0x0f); // toggle step signals by mask
#else
uint8_t portC = PORTC & 0xf0;
register uint8_t portC = PORTC & 0xf0;
PORTC = portC | (axes_mask & 0x0f); //set step signals by mask
asm("nop");
PORTC = portC; //set step signals to zero
@ -104,6 +148,60 @@ void sm4_do_step(uint8_t axes_mask)
#endif //((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3) || (MOTHERBOARD == BOARD_EINSY_1_0a))
}
uint16_t sm4_line_xyze_ui(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de)
{
uint16_t dd = (uint16_t)(sqrt((float)(((uint32_t)dx)*dx + ((uint32_t)dy*dy) + ((uint32_t)dz*dz) + ((uint32_t)de*de))) + 0.5);
uint16_t nd = dd;
uint16_t cx = dd;
uint16_t cy = dd;
uint16_t cz = dd;
uint16_t ce = dd;
uint16_t x = 0;
uint16_t y = 0;
uint16_t z = 0;
uint16_t e = 0;
while (nd)
{
if (sm4_stop_cb && (*sm4_stop_cb)()) break;
uint8_t sm = 0; //step mask
if (cx <= dx)
{
sm |= 1;
cx += dd;
x++;
}
if (cy <= dy)
{
sm |= 2;
cy += dd;
y++;
}
if (cz <= dz)
{
sm |= 4;
cz += dd;
z++;
}
if (ce <= de)
{
sm |= 8;
ce += dd;
e++;
}
cx -= dx;
cy -= dy;
cz -= dz;
ce -= de;
sm4_do_step(sm);
uint16_t delay = SM4_DEFDELAY;
if (sm4_calc_delay_cb) delay = (*sm4_calc_delay_cb)(nd, dd);
if (delay) delayMicroseconds(delay);
nd--;
}
if (sm4_update_pos_cb) (*sm4_update_pos_cb)(x, y, z, e);
return nd;
}
uint16_t sm4_line_xyz_ui(uint16_t dx, uint16_t dy, uint16_t dz){
uint16_t dd = (uint16_t)(sqrt((float)(((uint32_t)dx)*dx + ((uint32_t)dy*dy) + ((uint32_t)dz*dz))) + 0.5);
uint16_t nd = dd;

View File

@ -5,6 +5,12 @@
#include <inttypes.h>
#include "config.h"
#if defined(__cplusplus)
extern "C" {
#endif //defined(__cplusplus)
// callback prototype for stop condition (return 0 - continue, return 1 - stop)
typedef uint8_t (*sm4_stop_cb_t)();
@ -24,9 +30,16 @@ extern sm4_update_pos_cb_t sm4_update_pos_cb;
// callback pointer - calc_delay
extern sm4_calc_delay_cb_t sm4_calc_delay_cb;
// returns direction for single axis (0 - positive, 1 - negative)
extern uint8_t sm4_get_dir(uint8_t axis);
// set direction for single axis (0 - positive, 1 - negative)
extern void sm4_set_dir(uint8_t axis, uint8_t dir);
// returns direction of all axes as bitmask (0 - positive, 1 - negative)
extern uint8_t sm4_get_dir_bits(void);
// set direction for all axes as bitmask (0 - positive, 1 - negative)
extern void sm4_set_dir_bits(uint8_t dir_bits);
@ -34,6 +47,11 @@ extern void sm4_set_dir_bits(uint8_t dir_bits);
extern void sm4_do_step(uint8_t axes_mask);
// xyze linear-interpolated relative move, returns remaining diagonal steps (>0 means stoped)
extern uint16_t sm4_line_xyze_ui(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de);
extern uint16_t sm4_line_xyz_ui(uint16_t dx, uint16_t dy, uint16_t dz);
#if defined(__cplusplus)
}
#endif //defined(__cplusplus)
#endif //_SM4_H

View File

@ -30,7 +30,7 @@ void Sound_Init(void)
void Sound_SaveMode(void)
{
eeprom_update_byte_notify((uint8_t*)EEPROM_SOUND_MODE,(uint8_t)eSoundMode);
eeprom_update_byte((uint8_t*)EEPROM_SOUND_MODE,(uint8_t)eSoundMode);
}
void Sound_CycleState(void)

View File

@ -26,7 +26,6 @@
#include "planner.h"
#include "temperature.h"
#include "ultralcd.h"
#include "lcd.h"
#include "cardreader.h"
#include "speed_lookuptable.h"
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
@ -59,6 +58,14 @@ uint16_t SP_min = 0x21FF;
#ifdef DEBUG_YSTEP_DUP_PIN
#define _STEP_PIN_Y_DUP_AXIS DEBUG_YSTEP_DUP_PIN
#endif
#ifdef Y_DUAL_STEPPER_DRIVERS
#error Y_DUAL_STEPPER_DRIVERS not fully implemented
#define _STEP_PIN_Y2_AXIS Y2_STEP_PIN
#endif
#ifdef Z_DUAL_STEPPER_DRIVERS
#error Z_DUAL_STEPPER_DRIVERS not fully implemented
#define _STEP_PIN_Z2_AXIS Z2_STEP_PIN
#endif
#ifdef TMC2130
#define STEPPER_MINIMUM_PULSE TMC2130_MINIMUM_PULSE
@ -104,7 +111,11 @@ block_t *current_block; // A pointer to the block currently being traced
// Variables used by The Stepper Driver Interrupt
static unsigned char out_bits; // The next stepping-bits to be output
static dda_isteps_t counter[NUM_AXIS]; // Counter variables for the bresenham line tracer
static dda_isteps_t
counter_x, // Counter variables for the bresenham line tracer
counter_y,
counter_z,
counter_e;
volatile dda_usteps_t step_events_completed; // The number of step events executed in the current block
static uint32_t acceleration_time, deceleration_time;
static uint16_t acc_step_rate; // needed for deccelaration start point
@ -179,15 +190,18 @@ void checkHitEndstops()
if(endstop_hit) {
#ifdef VERBOSE_CHECK_HIT_ENDSTOPS
SERIAL_ECHO_START;
SERIAL_ECHORPGM(PSTR("Endstops Hit"));
for (uint8_t axis = 0; axis < E_AXIS; axis++) // XYZ
{
if(endstop_hit & _BV(axis)) {
SERIAL_ECHO(' ');
SERIAL_ECHO(char('X' + axis));
SERIAL_ECHO(':');
SERIAL_ECHO(float(endstops_trigsteps[axis]) / cs.axis_steps_per_mm[axis]);
SERIAL_ECHORPGM(MSG_ENDSTOPS_HIT);
if(endstop_hit & _BV(X_AXIS)) {
SERIAL_ECHOPAIR(" X:",(float)endstops_trigsteps[X_AXIS]/cs.axis_steps_per_mm[X_AXIS]);
// LCD_MESSAGERPGM(CAT2((MSG_ENDSTOPS_HIT), PSTR("X")));
}
if(endstop_hit & _BV(Y_AXIS)) {
SERIAL_ECHOPAIR(" Y:",(float)endstops_trigsteps[Y_AXIS]/cs.axis_steps_per_mm[Y_AXIS]);
// LCD_MESSAGERPGM(CAT2((MSG_ENDSTOPS_HIT), PSTR("Y")));
}
if(endstop_hit & _BV(Z_AXIS)) {
SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/cs.axis_steps_per_mm[Z_AXIS]);
// LCD_MESSAGERPGM(CAT2((MSG_ENDSTOPS_HIT),PSTR("Z")));
}
SERIAL_ECHOLN("");
#endif //VERBOSE_CHECK_HIT_ENDSTOPS
@ -382,20 +396,18 @@ FORCE_INLINE void stepper_next_block()
}
if (current_block->flag & BLOCK_FLAG_DDA_LOWRES) {
const int16_t value = -(current_block->step_event_count.lo >> 1);
for (uint8_t axis = 0; axis < NUM_AXIS; axis++)
{
counter[axis].lo = value;
}
counter_x.lo = -(current_block->step_event_count.lo >> 1);
counter_y.lo = counter_x.lo;
counter_z.lo = counter_x.lo;
counter_e.lo = counter_x.lo;
#ifdef LIN_ADVANCE
e_extruding = current_block->steps[E_AXIS].lo != 0;
#endif
} else {
const int32_t value = -(current_block->step_event_count.wide >> 1);
for (uint8_t axis = 0; axis < NUM_AXIS; axis++)
{
counter[axis].wide = value;
}
counter_x.wide = -(current_block->step_event_count.wide >> 1);
counter_y.wide = counter_x.wide;
counter_z.wide = counter_x.wide;
counter_e.wide = counter_x.wide;
#ifdef LIN_ADVANCE
e_extruding = current_block->steps[E_AXIS].wide != 0;
#endif
@ -634,13 +646,13 @@ FORCE_INLINE void stepper_tick_lowres()
for (uint8_t i=0; i < step_loops; ++ i) { // Take multiple steps per interrupt (For high speed moves)
MSerial.checkRx(); // Check for serial chars.
// Step in X axis
counter[X_AXIS].lo += current_block->steps[X_AXIS].lo;
if (counter[X_AXIS].lo > 0) {
counter_x.lo += current_block->steps[X_AXIS].lo;
if (counter_x.lo > 0) {
STEP_NC_HI(X_AXIS);
#ifdef DEBUG_XSTEP_DUP_PIN
STEP_NC_HI(X_DUP_AXIS);
#endif //DEBUG_XSTEP_DUP_PIN
counter[X_AXIS].lo -= current_block->step_event_count.lo;
counter_x.lo -= current_block->step_event_count.lo;
count_position[X_AXIS]+=count_direction[X_AXIS];
STEP_NC_LO(X_AXIS);
#ifdef DEBUG_XSTEP_DUP_PIN
@ -648,13 +660,13 @@ FORCE_INLINE void stepper_tick_lowres()
#endif //DEBUG_XSTEP_DUP_PIN
}
// Step in Y axis
counter[Y_AXIS].lo += current_block->steps[Y_AXIS].lo;
if (counter[Y_AXIS].lo > 0) {
counter_y.lo += current_block->steps[Y_AXIS].lo;
if (counter_y.lo > 0) {
STEP_NC_HI(Y_AXIS);
#ifdef DEBUG_YSTEP_DUP_PIN
STEP_NC_HI(Y_DUP_AXIS);
#endif //DEBUG_YSTEP_DUP_PIN
counter[Y_AXIS].lo -= current_block->step_event_count.lo;
counter_y.lo -= current_block->step_event_count.lo;
count_position[Y_AXIS]+=count_direction[Y_AXIS];
STEP_NC_LO(Y_AXIS);
#ifdef DEBUG_YSTEP_DUP_PIN
@ -662,20 +674,20 @@ FORCE_INLINE void stepper_tick_lowres()
#endif //DEBUG_YSTEP_DUP_PIN
}
// Step in Z axis
counter[Z_AXIS].lo += current_block->steps[Z_AXIS].lo;
if (counter[Z_AXIS].lo > 0) {
counter_z.lo += current_block->steps[Z_AXIS].lo;
if (counter_z.lo > 0) {
STEP_NC_HI(Z_AXIS);
counter[Z_AXIS].lo -= current_block->step_event_count.lo;
counter_z.lo -= current_block->step_event_count.lo;
count_position[Z_AXIS]+=count_direction[Z_AXIS];
STEP_NC_LO(Z_AXIS);
}
// Step in E axis
counter[E_AXIS].lo += current_block->steps[E_AXIS].lo;
if (counter[E_AXIS].lo > 0) {
counter_e.lo += current_block->steps[E_AXIS].lo;
if (counter_e.lo > 0) {
#ifndef LIN_ADVANCE
STEP_NC_HI(E_AXIS);
#endif /* LIN_ADVANCE */
counter[E_AXIS].lo -= current_block->step_event_count.lo;
counter_e.lo -= current_block->step_event_count.lo;
count_position[E_AXIS] += count_direction[E_AXIS];
#ifdef LIN_ADVANCE
e_steps += count_direction[E_AXIS];
@ -696,13 +708,13 @@ FORCE_INLINE void stepper_tick_highres()
for (uint8_t i=0; i < step_loops; ++ i) { // Take multiple steps per interrupt (For high speed moves)
MSerial.checkRx(); // Check for serial chars.
// Step in X axis
counter[X_AXIS].wide += current_block->steps[X_AXIS].wide;
if (counter[X_AXIS].wide > 0) {
counter_x.wide += current_block->steps[X_AXIS].wide;
if (counter_x.wide > 0) {
STEP_NC_HI(X_AXIS);
#ifdef DEBUG_XSTEP_DUP_PIN
STEP_NC_HI(X_DUP_AXIS);
#endif //DEBUG_XSTEP_DUP_PIN
counter[X_AXIS].wide -= current_block->step_event_count.wide;
counter_x.wide -= current_block->step_event_count.wide;
count_position[X_AXIS]+=count_direction[X_AXIS];
STEP_NC_LO(X_AXIS);
#ifdef DEBUG_XSTEP_DUP_PIN
@ -710,13 +722,13 @@ FORCE_INLINE void stepper_tick_highres()
#endif //DEBUG_XSTEP_DUP_PIN
}
// Step in Y axis
counter[Y_AXIS].wide += current_block->steps[Y_AXIS].wide;
if (counter[Y_AXIS].wide > 0) {
counter_y.wide += current_block->steps[Y_AXIS].wide;
if (counter_y.wide > 0) {
STEP_NC_HI(Y_AXIS);
#ifdef DEBUG_YSTEP_DUP_PIN
STEP_NC_HI(Y_DUP_AXIS);
#endif //DEBUG_YSTEP_DUP_PIN
counter[Y_AXIS].wide -= current_block->step_event_count.wide;
counter_y.wide -= current_block->step_event_count.wide;
count_position[Y_AXIS]+=count_direction[Y_AXIS];
STEP_NC_LO(Y_AXIS);
#ifdef DEBUG_YSTEP_DUP_PIN
@ -724,21 +736,21 @@ FORCE_INLINE void stepper_tick_highres()
#endif //DEBUG_YSTEP_DUP_PIN
}
// Step in Z axis
counter[Z_AXIS].wide += current_block->steps[Z_AXIS].wide;
if (counter[Z_AXIS].wide > 0) {
counter_z.wide += current_block->steps[Z_AXIS].wide;
if (counter_z.wide > 0) {
STEP_NC_HI(Z_AXIS);
counter[Z_AXIS].wide -= current_block->step_event_count.wide;
counter_z.wide -= current_block->step_event_count.wide;
count_position[Z_AXIS]+=count_direction[Z_AXIS];
STEP_NC_LO(Z_AXIS);
}
// Step in E axis
counter[E_AXIS].wide += current_block->steps[E_AXIS].wide;
if (counter[E_AXIS].wide > 0) {
counter_e.wide += current_block->steps[E_AXIS].wide;
if (counter_e.wide > 0) {
#ifndef LIN_ADVANCE
STEP_NC_HI(E_AXIS);
#endif /* LIN_ADVANCE */
counter[E_AXIS].wide -= current_block->step_event_count.wide;
count_position[E_AXIS] += count_direction[E_AXIS];
counter_e.wide -= current_block->step_event_count.wide;
count_position[E_AXIS]+=count_direction[E_AXIS];
#ifdef LIN_ADVANCE
e_steps += count_direction[E_AXIS];
#else
@ -1071,9 +1083,17 @@ void st_init()
#endif
#if defined(Y_DIR_PIN) && Y_DIR_PIN > -1
SET_OUTPUT(Y_DIR_PIN);
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_DIR_PIN) && (Y2_DIR_PIN > -1)
SET_OUTPUT(Y2_DIR_PIN);
#endif
#endif
#if defined(Z_DIR_PIN) && Z_DIR_PIN > -1
SET_OUTPUT(Z_DIR_PIN);
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_DIR_PIN) && (Z2_DIR_PIN > -1)
SET_OUTPUT(Z2_DIR_PIN);
#endif
#endif
#if defined(E0_DIR_PIN) && E0_DIR_PIN > -1
SET_OUTPUT(E0_DIR_PIN);
@ -1092,10 +1112,20 @@ void st_init()
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
SET_OUTPUT(Y_ENABLE_PIN);
if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_ENABLE_PIN) && (Y2_ENABLE_PIN > -1)
SET_OUTPUT(Y2_ENABLE_PIN);
if(!Y_ENABLE_ON) WRITE(Y2_ENABLE_PIN,HIGH);
#endif
#endif
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
SET_OUTPUT(Z_ENABLE_PIN);
if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_ENABLE_PIN) && (Z2_ENABLE_PIN > -1)
SET_OUTPUT(Z2_ENABLE_PIN);
if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
#endif
#endif
#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
SET_OUTPUT(E0_ENABLE_PIN);
@ -1175,11 +1205,19 @@ void st_init()
SET_OUTPUT(DEBUG_YSTEP_DUP_PIN);
WRITE(DEBUG_YSTEP_DUP_PIN,INVERT_Y_STEP_PIN);
#endif //DEBUG_YSTEP_DUP_PIN
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_STEP_PIN) && (Y2_STEP_PIN > -1)
SET_OUTPUT(Y2_STEP_PIN);
WRITE(Y2_STEP_PIN,INVERT_Y_STEP_PIN);
#endif
disable_y();
#endif
#if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1)
SET_OUTPUT(Z_STEP_PIN);
WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && (Z2_STEP_PIN > -1)
SET_OUTPUT(Z2_STEP_PIN);
WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
#endif
#ifdef PSU_Delta
init_force_z();
#endif // PSU_Delta
@ -1339,7 +1377,7 @@ void babystep(const uint8_t axis,const bool direction)
case X_AXIS:
{
enable_x();
uint8_t old_x_dir_pin = READ(X_DIR_PIN);
uint8_t old_x_dir_pin = READ(X_DIR_PIN); //if dualzstepper, both point to same direction.
uint8_t new_x_dir_pin = (INVERT_X_DIR)^direction;
//setup new step
@ -1367,7 +1405,7 @@ void babystep(const uint8_t axis,const bool direction)
case Y_AXIS:
{
enable_y();
uint8_t old_y_dir_pin = READ(Y_DIR_PIN);
uint8_t old_y_dir_pin = READ(Y_DIR_PIN); //if dualzstepper, both point to same direction.
uint8_t new_y_dir_pin = (INVERT_Y_DIR)^direction;
//setup new step
@ -1395,23 +1433,35 @@ void babystep(const uint8_t axis,const bool direction)
case Z_AXIS:
{
enable_z();
uint8_t old_z_dir_pin = READ(Z_DIR_PIN);
uint8_t old_z_dir_pin = READ(Z_DIR_PIN); //if dualzstepper, both point to same direction.
uint8_t new_z_dir_pin = (INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z;
//setup new step
if (new_z_dir_pin != old_z_dir_pin) {
WRITE_NC(Z_DIR_PIN, new_z_dir_pin);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE_NC(Z2_DIR_PIN, new_z_dir_pin);
#endif
delayMicroseconds(STEPPER_SET_DIR_DELAY);
}
//perform step
STEP_NC_HI(Z_AXIS);
#ifdef Z_DUAL_STEPPER_DRIVERS
STEP_NC_HI(Z2_AXIS);
#endif
STEPPER_MINIMUM_DELAY;
STEP_NC_LO(Z_AXIS);
#ifdef Z_DUAL_STEPPER_DRIVERS
STEP_NC_LO(Z2_AXIS);
#endif
//get old pin state back.
if (new_z_dir_pin != old_z_dir_pin) {
WRITE_NC(Z_DIR_PIN, old_z_dir_pin);
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE_NC(Z2_DIR_PIN, old_z_dir_pin);
#endif
}
}
break;

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