Compare commits

..

78 Commits

Author SHA1 Message Date
InsanityAutomation d46cf60548 btt stm32 CR6 Fixes 2024-06-26 10:26:47 -04:00
InsanityAutomation e94a1b16c4 Upstream fixes 2024-06-18 15:46:57 -04:00
InsanityAutomation b44c03c203 SKR2/3 2024-06-03 14:40:38 -04:00
InsanityAutomation 67cdaa89cf Merge branch 'bugfix-2.1.x' into CrealityDwin2.0_Bleeding 2024-04-16 10:05:38 -04:00
InsanityAutomation db9763c65f Merge branch 'Tenlog_DWIN' into CrealityDwin2.0_Bleeding 2024-04-16 10:05:17 -04:00
thinkyhead 1f84f50fd8 [cron] Bump distribution date (2024-04-15) 2024-04-15 02:38:10 +00:00
Scott Lahteine 3326c749f8 📝 Minor README changes 2024-04-14 16:36:56 -05:00
Scott Lahteine 0269106066 🎨 Dagoma D6 followup 2024-04-14 16:24:51 -05:00
Sophist 95d38a8e54 Add Dagoma D6 as found in DiscoUltimate v2 TMC (#26874)
* Add Dagoma D6 board as used in their DiscoUltimate v2 TMC.

Taken from the Dagoma fork of Marlin DU_MC branch where it is called FYSETC_DAGOMA_F5 and explicitly confirmed by Dagoma as being the D6:

"the BOARD_FYSETC_DAGOMA_F5 is effectively the definition for the D6"

---------

Co-authored-by: thisiskeithb <13375512+thisiskeithb@users.noreply.github.com>
Co-authored-by: Orel <37673727+0r31@users.noreply.github.com>
2024-04-14 13:04:52 -07:00
Chris dca6afc26e 🐛 HC32 - Add SERIAL_DMA, fix SDIO and MEATPACK (#26845)
* fix meatpack on hc32

* add support for SERIAL_DMA on HC32

* add additional checks in HC32 HAL

* migrate HC32 HAL to use app_config.h

* fix memory leak in HC32 sdio HAL
https://github.com/MarlinFirmware/Marlin/pull/26845#issuecomment-1980218771

* hc32: fail if both EMERGENCY_PARSER and SERIAL_DMA are enabled
2024-04-14 11:42:57 -07:00
Jason Smith 19684f23bc Add unit tests for macros.h (#26968) 2024-04-13 17:49:08 -07:00
Keith Bennett 52a561399e ️ Revert unintended README changes (#26967)
* Revert all the changes that went in with the unit test framework
This restored broken links and other changes. Restoring to the prior revision seems the most appropriate action until the intentions of those file changes are known.
---------

Co-authored-by: Jason Smith <jason.inet@gmail.com>
2024-04-13 17:47:16 -07:00
thinkyhead 0683e8a9a3 [cron] Bump distribution date (2024-04-14) 2024-04-14 00:24:15 +00:00
Jason Smith 1bb4a042e2 Unit test improvements (#26965)
* Do not warn about display in unit tests

* Treat warnings as errors in unit tests

* Report actual filenames with unit tests
2024-04-13 14:11:51 -07:00
Jason Smith d10861e478 Add unit testing framework (#26948)
- Add a framework to build and execute unit tests for Marlin.
- Enable unit test execution as part of PR checks.

---------

Co-authored-by: Costas Basdekis <costas.basdekis@gmail.com>
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-04-13 12:06:08 -07:00
Andrew cf7c86d581 🔧Fix M936 in features.ini (#26957) 2024-04-13 11:59:59 -07:00
David Buezas d99e150097 ️Reduce DISPLAY_SLEEP_MINUTES overhead (#26964) 2024-04-13 09:54:25 -07:00
thinkyhead 9e88eb6100 [cron] Bump distribution date (2024-04-13) 2024-04-13 12:06:36 +00:00
Vovodroid 71d9a3e1df 🩹 Fix M413 report (#26846) 2024-04-13 00:04:34 -07:00
InsanityAutomation 6575dcc803 🩹 Reduce Kill Pin Wait (#26945)
Reduce kill pin wait time, and allow override by setting KILL_DELAY
2024-04-12 23:40:59 -07:00
InsanityAutomation 2715e5ba1b 🐛Fix IDEX X2 Direction (#26958)
* Fix IDEX X2 Direction

* Sanity Check IDEX X1_MAX_POS
2024-04-12 23:29:59 -07:00
thinkyhead 9a570b23a3 [cron] Bump distribution date (2024-04-11) 2024-04-11 12:07:54 +00:00
Andrew 1b091ecb87 ✏️Minor style and typo fixups (#26947)
* tweaks from PR, whitespace, wording in pause.h

* Update Marlin/src/feature/pause.h
2024-04-10 23:13:54 -07:00
thinkyhead a75a5f8b2a [cron] Bump distribution date (2024-04-10) 2024-04-10 06:13:36 +00:00
ellensp 80dd02fbdb 📝 Update RGB565 color picker url (#26951) 2024-04-09 23:02:32 -07:00
Keith Bennett e6755450df 🩹 Fix ESP3D WiFi Support (#26822) 2024-04-09 22:58:13 -07:00
ellensp 9215bf791b 🔨 MarlinSimUI updates (#26955) 2024-04-09 22:50:21 -07:00
InsanityAutomation 30ba2241e3 Fix icons 2024-01-29 14:56:35 -05:00
InsanityAutomation 6bb17e68c1 Update vars 2024-01-28 16:12:30 -05:00
InsanityAutomation 7a7f723eb6 Update Version.h 2024-01-28 16:12:16 -05:00
InsanityAutomation 1daa885dbc More g30 2023-09-28 09:16:58 -04:00
InsanityAutomation b436a19f23 Update Creality_DWIN.cpp 2023-09-24 22:14:08 -04:00
InsanityAutomation 97179ddad3 tweaks to probe tramming 2023-09-24 21:51:22 -04:00
InsanityAutomation 57815d2d65 Enable tramming with probe 2023-09-17 17:12:09 -04:00
InsanityAutomation 67aa28f0c1 Allow bed tramming with probe to automatically calculate points by probe limits 2023-09-17 17:11:39 -04:00
InsanityAutomation b5d7f3ef12 Runout sensor fixes 2023-08-27 13:17:01 -04:00
InsanityAutomation e0ff391eba Build fixes for stm32 2023-08-26 14:31:18 -04:00
InsanityAutomation 8d44b6c427 Merge branch 'Tenlog_DWIN' into CrealityDwin2.0_Bleeding 2023-08-24 11:11:07 -04:00
InsanityAutomation 97e0ed7393 fix touch ui for stm32 2023-05-31 23:32:39 -04:00
InsanityAutomation 7862493991 Build tweaks 2023-05-31 19:14:39 -04:00
InsanityAutomation 63e91dc0af Purge old / tenlog imported 2023-05-30 11:16:24 -04:00
InsanityAutomation e713d5ee2b Version bump and notes 2023-05-29 15:17:44 -04:00
InsanityAutomation 52f1474281 More dwin serial throttling 2023-05-29 13:28:31 -04:00
InsanityAutomation 911093a28c Restore Ver file, remove broken sanity check 2023-05-19 18:17:57 -04:00
InsanityAutomation b05b35ece9 Restore files killed by branch merge 2023-05-14 13:17:03 -04:00
InsanityAutomation 0fa6605b49 Merge branch 'Tenlog_DWIN' into CrealityDwin2.0_Bleeding 2023-05-13 14:21:47 -04:00
InsanityAutomation b007343710 purge stale binaries 2023-05-13 14:19:41 -04:00
InsanityAutomation 0766fcd082 Update CombinedLandscapeDwin_TM3D_V8.7z 2023-03-08 17:44:55 -05:00
InsanityAutomation f2060b5c34 Add V8 screen files 2023-03-08 17:38:15 -05:00
InsanityAutomation 056db1c3ae update binaries, couple small fixes 2023-03-02 20:43:57 -05:00
InsanityAutomation 57e4fe6381 Add debug message, reduce ram usage to avoid comm corruption from stack 2023-03-01 22:25:01 -05:00
InsanityAutomation 6531db383c Update Configuration.h 2023-02-28 18:31:31 -05:00
InsanityAutomation 278c49e9de Merge branch 'CrealityDwin2.0_Bleeding' of https://github.com/InsanityAutomation/Marlin into CrealityDwin2.0_Bleeding 2023-02-19 19:17:49 -05:00
InsanityAutomation 0ed4727767 Merge pull request #295 from bob-anthony/DGUS_DISPLAY_FIXES
Fix compiling errors for DGUS displays
2023-02-19 18:30:31 -05:00
Tom Brazier fcbc6a929c MIN_ISR_LOOP_CYCLES already includes ISR_[XY]_STEPPER_CYCLES and more, it should not be counted 2023-02-19 18:01:46 -05:00
Tom Brazier 3c9b927291 Don't include MIN_ISR_LOOP_CYCLES in calculation for ISR_SHAPING_LOOP_CYCLES if input shaping is disabled 2023-02-19 18:01:44 -05:00
Tom Brazier aa3cd470da Also implement 2 cycle saving in MultiU24X32toH16() 2023-02-19 17:58:41 -05:00
Tom Brazier 004fd179d1 Fixed rounding of fractional part of multiplication results (a bug inherited from Sprinter). Cleaned up comments and function naming. Minor optimisation of MultiU8X16toH16(). 2023-02-19 17:58:39 -05:00
InsanityAutomation eab01ba183 circle around as upstream never merged 2023-02-19 17:54:52 -05:00
InsanityAutomation 42bd6e74a7 Slightly more robust pause resume and faster serial event handling 2023-02-19 17:54:51 -05:00
Bob Anthony 3a1f3a4ba3 Remove junk files 2023-02-18 04:01:15 -06:00
Bob Anthony 9697434981 Fix compiling errors for the dgus display
Handler code section needed for any leveling not just probe.

Fix for renamed variables upstream.

Added default to switch statement to resolve compile warning.
2023-02-18 03:45:50 -06:00
Bob Anthony 6dec98e54c Merge pull request #4 from InsanityAutomation/CrealityDwin2.0_Bleeding
Merge bleeding branch changes
2023-02-18 03:12:38 -06:00
Bob Anthony 39201418ce Merge remote-tracking branch 'origin/CR-X-Config-with-Purge-Bucket' into CrealityDwin_2.0 2023-02-18 02:37:36 -06:00
InsanityAutomation a1c5735d6f Update README.md 2023-02-17 17:24:44 -05:00
InsanityAutomation b02badf25e Remove obsolete bins from devel repo 2023-02-17 17:06:25 -05:00
InsanityAutomation 3b7871005a Update Creality_DWIN.cpp 2023-02-10 16:26:46 -05:00
InsanityAutomation 0bd0b3df80 tweak readme, remove conflicting sanity check 2023-02-05 14:17:38 -05:00
InsanityAutomation 549619995f Update stm32f1-maple.ini 2023-02-05 13:55:27 -05:00
InsanityAutomation 237ad14388 Merge branch 'CrealityDwin2.0_Bleeding' into CrealityDwin_2.0 2022-05-16 17:45:12 -04:00
InsanityAutomation 71d530e594 Create firmware_Ender7_BLT_DW7.4.5.bin.zip 2022-02-26 18:43:58 -05:00
InsanityAutomation 0821c72d39 Add CR5Pro 2022-02-26 16:00:44 -05:00
BDScripting 5c59a3d7c7 CR-X Configuration for purge bucket 2022-02-26 09:51:19 -06:00
InsanityAutomation a9e7df859c Merge branch 'CrealityDwin2.0_Bleeding' into CrealityDwin_2.0 2022-02-25 10:31:00 -05:00
InsanityAutomation 2d651fc785 Merge branch 'CrealityDwin2.0_Bleeding' into CrealityDwin_2.0 2022-02-23 11:23:12 -05:00
InsanityAutomation 7f5f9724de Merge branch 'CrealityDwin2.0_Bleeding' into CrealityDwin_2.0 2021-11-26 13:31:02 -05:00
InsanityAutomation b589cac5ff Merge branch 'CrealityDwin2.0_Bleeding' into CrealityDwin_2.0 2021-10-23 08:58:41 -04:00
InsanityAutomation 3801d831d4 Minor tweaks 2021-07-16 12:23:55 -04:00
60 changed files with 8349 additions and 921 deletions
@@ -1,9 +1,9 @@
#
# test-builds.yml
# ci-build-tests.yml
# Do test builds to catch compile errors
#
name: CI
name: CI - Build Tests
on:
pull_request:
@@ -27,7 +27,7 @@ on:
jobs:
test_builds:
name: Run All Tests
name: Build Test
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
+73
View File
@@ -0,0 +1,73 @@
#
# ci-unit-tests.yml
# Build and execute unit tests to catch functional issues in code
#
name: CI - Unit Tests
on:
pull_request:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths-ignore:
- config/**
- data/**
- docs/**
- '**/*.md'
push:
branches:
- bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths-ignore:
- config/**
- data/**
- docs/**
- '**/*.md'
jobs:
# This runs all unit tests as a single job. While it should be possible to break this up into
# multiple jobs, they currently run quickly and finish long before the compilation tests.
run_unit_tests:
name: Unit Test
# These tests will only be able to run on the bugfix-2.1.x branch, until the next release
# pulls them into additional branches.
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
steps:
- name: Check out the PR
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Select Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- name: Install PlatformIO
run: |
pip install -U platformio
pio upgrade --dev
pio pkg update --global
- name: Run All Unit Tests
run: |
make unit-test-all-local
Binary file not shown.
Binary file not shown.
+30 -4
View File
@@ -12,7 +12,12 @@ help:
@echo "make tests-single-local-docker : Run a single test locally, using docker"
@echo "make tests-all-local : Run all tests locally"
@echo "make tests-all-local-docker : Run all tests locally, using docker"
@echo "make setup-local-docker : Build the local docker image"
# @echo "make unit-test-single-ci : Run a single code test from inside the CI"
# @echo "make unit-test-single-local : Run a single code test locally"
# @echo "make unit-test-single-local-docker : Run a single code test locally, using docker-compose"
@echo "make unit-test-all-local : Run all code tests locally"
@echo "make unit-test-all-local-docker : Run all code tests locally, using docker-compose"
@echo "make setup-local-docker : Setup local docker-compose"
@echo ""
@echo "Options for testing:"
@echo " TEST_TARGET Set when running tests-single-*, to select the"
@@ -43,7 +48,7 @@ tests-single-local:
tests-single-local-docker:
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
tests-all-local:
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
@@ -52,10 +57,31 @@ tests-all-local:
tests-all-local-docker:
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
#unit-test-single-ci:
# export GIT_RESET_HARD=true
# $(MAKE) unit-test-single-local TEST_TARGET=$(TEST_TARGET)
# TODO: How can we limit tests with ONLY_TEST with platformio?
#unit-test-single-local:
# @if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make unit-test-all-local" ; return 1; fi
# platformio run -t marlin_$(TEST_TARGET)
#unit-test-single-local-docker:
# @if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make unit-test-all-local-docker" ; return 1; fi
# @if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
# $(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-single-local TEST_TARGET=$(TEST_TARGET) ONLY_TEST="$(ONLY_TEST)"
unit-test-all-local:
platformio run -t test-marlin -e linux_native_test
unit-test-all-local-docker:
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-all-local
setup-local-docker:
$(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
$(CONTAINER_RT_BIN) buildx build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
+1804 -351
View File
File diff suppressed because it is too large Load Diff
+395 -249
View File
File diff suppressed because it is too large Load Diff
+140 -36
View File
@@ -28,55 +28,103 @@
/**
* Marlin release version identifier
*/
#define SHORT_BUILD_VERSION "2.1.2_Beta3"
#define SHORT_BUILD_VERSION "DW7.4.9"
/**
* Verbose version identifier which should contain a reference to the location
* from where the binary was downloaded or the source code was compiled.
*/
#if(ENABLED(DriverA4988))
#define VerChar1 "A"
#elif(ENABLED(Driver2209))
#define VerChar1 "T"
#if(ENABLED(MachineMini))
#define VerChar1 "M"
#elif(ENABLED(MachineEnder2))
#define VerChar1 "E2"
#elif(ENABLED(MachineEnder2Pro))
#define VerChar1 "E2P"
#elif(ENABLED(MachineEnder3))
#define VerChar1 "E3"
#elif ENABLED(MachineEnder3V2)
#define VerChar1 "E3V2"
#elif ENABLED(MachineEnder3S1)
#define VerChar1 "E3S1"
#elif ENABLED(MachineEnder3Max)
#define VerChar1 "E3M"
#elif(ENABLED(MachineEnder4))
#define VerChar1 "E4"
#elif(ENABLED(MachineEnder5))
#define VerChar1 "E5"
#elif(ENABLED(MachineEnder6))
#define VerChar1 "E6"
#elif(ENABLED(MachineEnder7))
#define VerChar1 "E7"
#elif(ENABLED(MachineSermoonD1))
#define VerChar1 "D1"
#elif(ENABLED(MachineEnder5Plus))
#define VerChar1 "E5P"
#elif(ENABLED(MachineCR20))
#define VerChar1 "2"
#elif(ENABLED(MachineCR10Orig))
#define VerChar1 "O"
#elif(ENABLED(MachineCR10Std))
#define VerChar1 "S"
#elif(ENABLED(MachineCRX))
#define VerChar1 "X"
#elif(ENABLED(MachineCR6))
#define VerChar1 "CR6"
#elif(ENABLED(MachineCR5))
#define VerChar1 "CR5"
#elif(ENABLED(MachineCR6Max))
#define VerChar1 "CR6M"
#elif(ENABLED(MachineS4))
#define VerChar1 "4"
#elif(ENABLED(MachineS5) || ENABLED(MachineCR10Max))
#define VerChar1 "5"
#elif ENABLED(MachineCR2020)
#define VerChar1 "20"
#elif(ENABLED(MachineCR30))
#define VerChar1 "CR30"
#endif
#if(ENABLED(BL_Touch))
#define VerChar2 "B"
#if(ENABLED(HotendStock))
#define VerChar2 "S"
#elif(ENABLED(HotendE3D))
#define VerChar2 "E"
#elif ENABLED(HotendMosquito)
#define VerChar2 "M"
#endif
#if(ENABLED(HotendAllMetal))
#define VerChar3 "M"
#else
#define VerChar2 "E"
#endif
#if(ENABLED(LOWRES_DWIN))
#define VerChar3 "L"
#else
#define VerChar3 "H"
#define VerChar3 "S"
#endif
#if(ENABLED(ACBed))
#define VerChar4 "A"
#if(ENABLED(BedAC))
#define VerChar4 "A"
#elif(ENABLED(BedDC))
#define VerChar4 "D"
#else
#define VerChar4 "D"
#define VerChar4 "N"
#endif
#if(ENABLED(OpticalY))
#define VerChar5 "O"
#if(ENABLED(ABL_EZABL))
#define VerChar5 "A"
#elif(ENABLED(ABL_BLTOUCH))
#define VerChar5 "B"
#else
#define VerChar5 "M"
#define VerChar5 "N"
#endif
#if(ENABLED(TitanExtruder))
#define VerChar6 "T"
#elif ANY(BMGExtruderV2, BMGExtruderV3)
#define VerChar6 "B"
#elif ENABLED(BondtechLGX)
#define VerChar6 "L"
#if(ENABLED(ABL_UBL))
#define VerChar6 "U"
#elif(ENABLED(ABL_BI))
#define VerChar6 "B"
#else
#define VerChar6 "S"
#define VerChar6 "N"
#endif
#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION "_" VerChar1 VerChar2 VerChar3 VerChar4 VerChar5 VerChar6
#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " TM3D " VerChar1 VerChar2 VerChar3 VerChar4 VerChar5 VerChar6
/**
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
@@ -88,12 +136,68 @@
/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
*/
#if(ENABLED(MachineTLD3P))
#define CUSTOM_MACHINE_NAME "LNL D3Pro"
#elif(ENABLED(MachineTLD5))
#define CUSTOM_MACHINE_NAME "LNL D5Pro"
#elif(ENABLED(MachineTLD6))
#define CUSTOM_MACHINE_NAME "LNL D6Pro"
#if(ENABLED(MachineMini))
#define CUSTOM_MACHINE_NAME "Mini SuPeR"
#elif(ENABLED(MachineCR10Smart))
#define CUSTOM_MACHINE_NAME "TM3D CR10Smart"
#elif(ENABLED(MachineCR10SmartPro))
#define CUSTOM_MACHINE_NAME "TM3D CR10SmartPro"
#elif(ENABLED(MachineEnder2))
#define CUSTOM_MACHINE_NAME "TM3D Ender2"
#elif(ENABLED(MachineEnder2Pro))
#define CUSTOM_MACHINE_NAME "TM3D Ender2 Pro"
#elif(ENABLED(MachineEnder3))
#define CUSTOM_MACHINE_NAME "TM3D Ender3"
#elif(ENABLED(MachineEnder3Max))
#define CUSTOM_MACHINE_NAME "TM3D E3Max"
#elif(ENABLED(MachineEnder6))
#define CUSTOM_MACHINE_NAME "TM3D Ender6"
#elif(ENABLED(MachineEnder7))
#define CUSTOM_MACHINE_NAME "TM3D Ender7"
#elif(ENABLED(MachineEnder3V2))
#define CUSTOM_MACHINE_NAME "TM3D Ender3V2"
#elif(ENABLED(MachineEnder3S1))
#define CUSTOM_MACHINE_NAME "TM3D Ender3S1"
#elif(ENABLED(MachineEnder4))
#define CUSTOM_MACHINE_NAME "TM3D Ender4"
#elif(ENABLED(MachineEnder5))
#define CUSTOM_MACHINE_NAME "TM3D Ender5"
#elif(ENABLED(MachineEnder5Plus))
#define CUSTOM_MACHINE_NAME "TM3D E5 Plus"
#elif(ENABLED(MachineCR20))
#define CUSTOM_MACHINE_NAME "SuPeR CR-20"
#elif(ENABLED(MachineCR10Orig))
#define CUSTOM_MACHINE_NAME "SuPeR CR-10"
#elif(ENABLED(MachineCRX))
#define CUSTOM_MACHINE_NAME "TM3D CR-X"
#elif ENABLED(MachineCR10SProV2)
#define CUSTOM_MACHINE_NAME "TM3D 10SProV2"
#elif(ENABLED(MachineCR10SPro))
#define CUSTOM_MACHINE_NAME "TM3D 10S Pro"
#elif(ENABLED(MachineCR10Max))
#define CUSTOM_MACHINE_NAME "TM3D Max"
#elif(ENABLED(MachineCR10SV3))
#define CUSTOM_MACHINE_NAME "TM3D CR10V3"
#elif(ENABLED(MachineCR10SV2))
#define CUSTOM_MACHINE_NAME "TM3D CR10V2"
#elif(ENABLED(MachineCR10Std))
#define CUSTOM_MACHINE_NAME "300 SuPeR"
#elif(ENABLED(MachineS4))
#define CUSTOM_MACHINE_NAME "400 SuPeR"
#elif(ENABLED(MachineS5))
#define CUSTOM_MACHINE_NAME "500 SuPeR"
#elif ENABLED(MachineCR2020)
#define CUSTOM_MACHINE_NAME "TM3D 2020"
#elif ENABLED(MachineSermoonD1)
#define CUSTOM_MACHINE_NAME "SermoonD1"
#elif ENABLED(MachineCR5)
#define CUSTOM_MACHINE_NAME "CR5 Pro"
#elif ENABLED(MachineCR6)
#define CUSTOM_MACHINE_NAME "CR6"
#elif ENABLED(MachineCR6Max)
#define CUSTOM_MACHINE_NAME "CR6 Max"
#elif ENABLED(MachineCR30)
#define CUSTOM_MACHINE_NAME "CR30 Printmill"
#endif
/**
@@ -102,7 +206,7 @@
* has a distinct Github fork— the Source Code URL should just be the main
* Marlin repository.
*/
#define SOURCE_CODE_URL "https://github.com/InsanityAutomation/Marlin/tree/Tenlog_DWIN"
#define SOURCE_CODE_URL "https://github.com/InsanityAutomation/Marlin/tree/CrealityDwin_2.0"
/**
* Default generic printer UUID.
@@ -113,7 +217,7 @@
* The WEBSITE_URL is the location where users can get more information such as
* documentation about a specific Marlin release.
*/
#define WEBSITE_URL "http://www.lnl3d.com "
#define WEBSITE_URL "tinymachines3d.com"
/**
* Set the vendor info the serial USB interface, if changable
+2 -2
View File
@@ -141,8 +141,8 @@ typedef Servo hal_servo_t;
#error "LCD_SERIAL_PORT must be from 0 to 3."
#endif
#define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(DWINOS_4)
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
#endif
#endif
+1 -1
View File
@@ -629,7 +629,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(DWINOS_4)
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
template<typename Cfg>
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
+1 -1
View File
@@ -205,7 +205,7 @@
static ring_buffer_pos_t available();
static void write(const uint8_t c);
static void flushTX();
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(DWINOS_4)
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
static ring_buffer_pos_t get_tx_buffer_free();
#endif
+30 -1
View File
@@ -123,6 +123,11 @@ void MarlinHAL::init() {
// Register min serial
TERN_(POSTMORTEM_DEBUGGING, install_min_serial());
// warn if low memory after init
if (freeMemory() < 1024) {
SERIAL_WARN_MSG("HAL: low memory after init!\n");
}
}
void MarlinHAL::init_board() {}
@@ -147,7 +152,31 @@ void MarlinHAL::delay_ms(const int ms) {
delay(ms);
}
void MarlinHAL::idletask() {}
void MarlinHAL::idletask() {
#if ENABLED(MARLIN_DEV_MODE)
// check & print serial RX errors
MSerialT *serials[] = { &MSerial1, &MSerial2 };
for (int serial = 0; serial < 2; serial++) {
usart_receive_error_t err = serials[serial]->getReceiveError();
if (err != usart_receive_error_t::None) {
// "Warning: MSerial[n] RX [Framing|Parity|Overrun] Error"
SERIAL_WARN_START();
SERIAL_ECHOPGM(" MSerial");
SERIAL_ECHO(serial + 1);
SERIAL_ECHOPGM(" RX ");
switch(err) {
case usart_receive_error_t::FramingError: SERIAL_ECHOPGM("Framing"); break;
case usart_receive_error_t::ParityError: SERIAL_ECHOPGM("Parity"); break;
case usart_receive_error_t::OverrunError: SERIAL_ECHOPGM("Overrun"); break;
case usart_receive_error_t::RxDataDropped: SERIAL_ECHOPGM("DataDropped"); break;
default: break;
}
SERIAL_ECHOPGM(" Error");
SERIAL_EOL();
}
}
#endif
}
uint8_t MarlinHAL::get_reset_source() {
// Query reset cause from RMU
+23 -3
View File
@@ -46,14 +46,34 @@ constexpr bool serial_handles_emergency(int port) {
//
// Define serial ports
//
#define DEFINE_HWSERIAL_MARLIN(name, n) \
// serial port where RX and TX use IRQs
#define DEFINE_IRQ_SERIAL_MARLIN(name, n) \
MSerialT name(serial_handles_emergency(n), \
&USART##n##_config, \
BOARD_USART##n##_TX_PIN, \
BOARD_USART##n##_RX_PIN);
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
// serial port where RX uses DMA and TX uses IRQs
// all serial ports use DMA1
// since there are 4 USARTs and 4 DMA channels, we can use the USART number as the DMA channel
#define DEFINE_DMA_SERIAL_MARLIN(name, n) \
MSerialT name(serial_handles_emergency(n), \
&USART##n##_config, \
BOARD_USART##n##_TX_PIN, \
BOARD_USART##n##_RX_PIN, \
M4_DMA1, \
((en_dma_channel_t)(n - 1))); // map USART1 to DMA channel 0, USART2 to DMA channel 1, etc.
#define DEFINE_SERIAL_MARLIN(name, n) TERN(SERIAL_DMA, DEFINE_DMA_SERIAL_MARLIN(name, n), DEFINE_IRQ_SERIAL_MARLIN(name, n))
DEFINE_SERIAL_MARLIN(MSerial1, 1);
DEFINE_SERIAL_MARLIN(MSerial2, 2);
// TODO: remove this warning when SERIAL_DMA has been tested some more
#if ENABLED(SERIAL_DMA)
#warning "SERIAL_DMA may be unstable on HC32F460."
#endif
//
// Serial port assertions
+38 -8
View File
@@ -25,17 +25,42 @@
#include <drivers/usart/Usart.h>
// Optionally set uart IRQ priority to reduce overflow errors
// #define UART_IRQ_PRIO 1
//#define UART_RX_IRQ_PRIO 1
//#define UART_TX_IRQ_PRIO 1
//#define UART_RX_DMA_IRQ_PRIO 1
struct MarlinSerial : public Usart {
MarlinSerial(struct usart_config_t *usart_device, gpio_pin_t tx_pin, gpio_pin_t rx_pin) : Usart(usart_device, tx_pin, rx_pin) {}
MarlinSerial(
struct usart_config_t *usart_device,
gpio_pin_t tx_pin,
gpio_pin_t rx_pin
#if ENABLED(SERIAL_DMA)
, M4_DMA_TypeDef *dma_unit = nullptr,
en_dma_channel_t rx_dma_channel = DmaCh0
#endif
) : Usart(usart_device, tx_pin, rx_pin) {
#if ENABLED(SERIAL_DMA)
if (dma_unit != nullptr) {
enableRxDma(dma_unit, rx_dma_channel);
}
#endif
}
#ifdef UART_IRQ_PRIO
#if defined(UART_RX_IRQ_PRIO) || defined(UART_TX_IRQ_PRIO) || defined(UART_RX_DMA_IRQ_PRIO)
void setPriority() {
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_IRQ_PRIO);
#if defined(UART_RX_IRQ_PRIO)
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_RX_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_RX_IRQ_PRIO);
#endif
#if defined(UART_TX_IRQ_PRIO)
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_TX_IRQ_PRIO);
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_TX_IRQ_PRIO);
#endif
#if defined(UART_RX_DMA_IRQ_PRIO) && ENABLED(SERIAL_DMA)
NVIC_SetPriority(c_dev()->dma.rx.rx_data_available_dma_btc.interrupt_number, UART_RX_DMA_IRQ_PRIO);
#endif
}
void begin(uint32_t baud) {
@@ -47,7 +72,12 @@ struct MarlinSerial : public Usart {
Usart::begin(baud, config);
setPriority();
}
#endif
void begin(uint32_t baud, const stc_usart_uart_init_t *config, const bool rxNoiseFilter = true) {
Usart::begin(baud, config, rxNoiseFilter);
setPriority();
}
#endif // UART_RX_IRQ_PRIO || UART_TX_IRQ_PRIO || UART_RX_DMA_IRQ_PRIO
};
typedef Serial1Class<MarlinSerial> MSerialT;
+70
View File
@@ -0,0 +1,70 @@
/**
* app_config.h is included by the hc32f460 arduino build script for every source file.
* it is used to configure the arduino core (and ddl) automatically according
* to the settings in Configuration.h and Configuration_adv.h.
*/
#pragma once
#ifndef _HC32_APP_CONFIG_H_
#define _HC32_APP_CONFIG_H_
#include "../../inc/MarlinConfigPre.h"
//
// dev mode
//
#if ENABLED(MARLIN_DEV_MODE)
#define __DEBUG 1
#define __CORE_DEBUG 1
#endif
//
// Fault Handlers and Panic
//
#if ENABLED(POSTMORTEM_DEBUGGING)
// disable arduino core fault handler, as we define our own
#define CORE_DISABLE_FAULT_HANDLER 1
#endif
// force-enable panic handler so that we can use our custom one (in MinSerial)
#define PANIC_ENABLE 1
// use short filenames in ddl debug and core panic output
#define __DEBUG_SHORT_FILENAMES 1
#define __PANIC_SHORT_FILENAMES 1
// omit panic messages in core panic output
#define __OMIT_PANIC_MESSAGE 1
//
// Usart
//
// disable serial globals (Serial1, Serial2, ...), as we define our own
#define DISABLE_SERIAL_GLOBALS 1
// increase the size of the Usart buffers (both RX and TX)
// NOTE:
// the heap usage will increase by (SERIAL_BUFFER_SIZE - 64) * "number of serial ports used"
// if running out of heap, the system may become unstable
//#define SERIAL_BUFFER_SIZE 256
// enable support for Usart Clock Divider / Oversampling auto config
#define USART_AUTO_CLKDIV_OS_CONFIG 1
// enable USART_RX_DMA_SUPPORT core option when SERIAL_DMA is enabled
#if ENABLED(SERIAL_DMA)
#define USART_RX_DMA_SUPPORT 1
#endif
//
// Misc.
//
// redirect printf to host serial
#define REDIRECT_PRINTF_TO_SERIAL 1
// FIXME override F_CPU to PCLK1, as marlin freaks out otherwise
#define F_CPU (SYSTEM_CLOCK_FREQUENCIES.pclk1)
#endif // _HC32_APP_CONFIG_H_
+29
View File
@@ -20,6 +20,20 @@
*
*/
#pragma once
#include <core_util.h>
#if !defined(ARDUINO_CORE_VERSION_INT) || !defined(GET_VERSION_INT)
// version macros were introduced in arduino core version 1.1.0
// below that version, we polyfill them
#define GET_VERSION_INT(major, minor, patch) ((major * 100000) + (minor * 1000) + patch)
#define ARDUINO_CORE_VERSION_INT GET_VERSION_INT(1, 0, 0)
#endif
#if ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 1, 0)
// because we use app_config.h introduced in arduino core version 1.1.0, the
// HAL is not compatible with older versions
#error "The HC32 HAL is not compatible with Arduino Core versions < 1.1.0. Consider updating the Arduino Core."
#endif
#ifndef BOARD_XTAL_FREQUENCY
#error "BOARD_XTAL_FREQUENCY is required for HC32F460."
@@ -74,3 +88,18 @@
#error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN."
#endif
#endif
#if ENABLED(SERIAL_DMA)
#if !defined(USART_RX_DMA_SUPPORT)
#error "SERIAL_DMA requires USART_RX_DMA_SUPPORT to be enabled in the arduino core."
#endif
// USART_RX_DMA_SUPPORT does not implement core_hook_usart_rx_irq, which is required for the emergency parser
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not supported with SERIAL_DMA. Please disable either SERIAL_DMA or EMERGENCY_PARSER."
#endif
#if ARDUINO_CORE_VERSION_INT < GET_VERSION_INT(1, 1, 0)
#error "SERIAL_DMA is not supported with arduino core version < 1.1.0."
#endif
#endif
+26 -17
View File
@@ -54,7 +54,7 @@
fn \
}
stc_sd_handle_t *handle;
stc_sd_handle_t *handle = nullptr;
bool SDIO_Init() {
// Configure SDIO pins
@@ -66,36 +66,45 @@ bool SDIO_Init() {
GPIO_SetFunc(BOARD_SDIO_CMD, Func_Sdio);
GPIO_SetFunc(BOARD_SDIO_DET, Func_Sdio);
// If a handle is already initialized, free it before creating a new one
// otherwise, we will leak memory, which will eventually crash the system
if (handle != nullptr) {
delete handle->pstcDmaInitCfg;
delete handle->pstcCardInitCfg;
delete handle;
handle = nullptr;
}
// Create DMA configuration
stc_sdcard_dma_init_t *dmaConf = new stc_sdcard_dma_init_t;
dmaConf->DMAx = SDIO_DMA_PERIPHERAL;
dmaConf->enDmaCh = SDIO_DMA_CHANNEL;
// Create card configuration
// This should be a fairly safe configuration for most cards
stc_sdcard_init_t *cardConf = new stc_sdcard_init_t;
cardConf->enBusWidth = SdiocBusWidth4Bit;
cardConf->enClkFreq = SdiocClk400K;
cardConf->enSpeedMode = SdiocNormalSpeedMode;
cardConf->pstcInitCfg = nullptr;
// Create handle in DMA mode
handle = new stc_sd_handle_t;
handle->SDIOCx = SDIO_PERIPHERAL;
handle->enDevMode = SdCardDmaMode;
handle->pstcDmaInitCfg = dmaConf;
// Create card configuration
// This should be a fairly safe configuration for most cards
stc_sdcard_init_t cardConf = {
.enBusWidth = SdiocBusWidth4Bit,
.enClkFreq = SdiocClk400K,
.enSpeedMode = SdiocNormalSpeedMode,
//.pstcInitCfg = NULL,
};
//handle->pstcCardInitCfg = cardConf; // assigned in SDCARD_Init
// Initialize sd card
en_result_t rc = SDCARD_Init(handle, &cardConf);
en_result_t rc = SDCARD_Init(handle, cardConf);
if (rc != Ok) printf("SDIO_Init() error (rc=%u)\n", rc);
return rc == Ok;
}
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
CORE_ASSERT(handle != NULL, "SDIO not initialized");
CORE_ASSERT(dst != NULL, "SDIO_ReadBlock dst is NULL");
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
CORE_ASSERT(dst != nullptr, "SDIO_ReadBlock dst is NULL", return false);
WITH_RETRY(SDIO_READ_RETRIES, {
en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT);
@@ -107,8 +116,8 @@ bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
}
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
CORE_ASSERT(handle != NULL, "SDIO not initialized");
CORE_ASSERT(src != NULL, "SDIO_WriteBlock src is NULL");
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
CORE_ASSERT(src != nullptr, "SDIO_WriteBlock src is NULL", return false);
WITH_RETRY(SDIO_WRITE_RETRIES, {
en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT);
@@ -120,12 +129,12 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
}
bool SDIO_IsReady() {
CORE_ASSERT(handle != NULL, "SDIO not initialized");
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return false);
return bool(handle->stcCardStatus.READY_FOR_DATA);
}
uint32_t SDIO_GetCardSize() {
CORE_ASSERT(handle != NULL, "SDIO not initialized");
CORE_ASSERT(handle != nullptr, "SDIO not initialized", return 0);
// Multiply number of blocks with block size to get size in bytes
const uint64_t cardSizeBytes = uint64_t(handle->stcSdCardInfo.u32LogBlockNbr) * uint64_t(handle->stcSdCardInfo.u32LogBlockSize);
+4 -1
View File
@@ -37,7 +37,10 @@ Timer::Timer() {
}
Timer::~Timer() {
timer_delete(timerid);
if (timerid != 0) {
timer_delete(timerid);
timerid = 0;
}
}
void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) {
+2
View File
@@ -21,6 +21,7 @@
*/
#ifdef __PLAT_LINUX__
#ifndef UNIT_TEST
//#define GPIO_LOGGING // Full GPIO and Positional Logging
@@ -135,4 +136,5 @@ int main() {
read_serial.join();
}
#endif // UNIT_TEST
#endif // __PLAT_LINUX__
+1 -1
View File
@@ -112,7 +112,7 @@
#else
#error "LCD_SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
#endif
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(DWINOS_4)
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
#endif
#endif
+3
View File
@@ -43,6 +43,7 @@
#else // Arduino non-DMA
FORCE_INLINE static uint8_t buffer_overruns() { return 0; }
typedef void (*usart_rx_callback_t)(serial_t * obj);
struct MarlinSerial : public HardwareSerial {
@@ -53,6 +54,8 @@
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
void _rx_complete_irq(serial_t *obj);
FORCE_INLINE static uint8_t buffer_overruns() { return 0; } // Not implemented. Void to avoid platform-dependent code.
FORCE_INLINE uint32_t dropped() { return 0; }
protected:
usart_rx_callback_t _rx_callback;
+8 -3
View File
@@ -474,11 +474,16 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
#if HAS_KILL
// Check if the kill button was pressed and wait just in case it was an accidental
// key kill key press
// Check if the kill button was pressed and wait to ensure the signal is not noise
// typically caused by poor insulation and grounding on LCD cables.
// Lower numbers here will increase response time and therefore safety rating.
// It is recommended to set this as low as possibe without false triggers.
// -------------------------------------------------------------------------------
#ifndef KILL_DELAY
#define KILL_DELAY 250
#endif
static int killCount = 0; // make the inactivity button a bit less responsive
const int KILL_DELAY = 750;
if (kill_state())
killCount++;
else if (killCount > 0)
+1
View File
@@ -131,6 +131,7 @@
#define BOARD_PXMALION_CORE_I3 1164 // Pxmalion Core I3
#define BOARD_PANOWIN_CUTLASS 1165 // Panowin Cutlass (as found in the Panowin F1)
#define BOARD_KODAMA_BARDO 1166 // Kodama Bardo V1.x (as found in the Kodama Trinus)
#define BOARD_DAGOMA_D6 1167 // Dagoma D6 (as found in the Dagoma DiscoUltimate V2 TMC)
//
// RAMBo and derivatives
+3 -5
View File
@@ -57,9 +57,7 @@ enum PauseMessage : char {
};
#if M600_PURGE_MORE_RESUMABLE
/**
* Input methods can Purge More, Resume, or request input
*/
// Input methods can Purge More, Resume, or request input
enum PauseMenuResponse : char {
PAUSE_RESPONSE_WAIT_FOR,
PAUSE_RESPONSE_EXTRUDE_MORE,
@@ -109,7 +107,7 @@ void wait_for_confirmation(
void resume_print(
const_float_t slow_load_length=0, // (mm) Slow Load Length for finishing move
const_float_t fast_load_length=0, // (mm) Fast Load Length for initial move
const_float_t extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, // (mm) Purge length
const_float_t purge_length=ADVANCED_PAUSE_PURGE_LENGTH, // (mm) Purge length
const int8_t max_beep_count=0, // Beep alert for attention
const celsius_t targetTemp=0 // (°C) A target temperature for the hotend
DXC_PARAMS // Dual-X-Carriage extruder index
@@ -118,7 +116,7 @@ void resume_print(
bool load_filament(
const_float_t slow_load_length=0, // (mm) Slow Load Length for finishing move
const_float_t fast_load_length=0, // (mm) Fast Load Length for initial move
const_float_t extrude_length=0, // (mm) Purge length
const_float_t purge_length=0, // (mm) Purge length
const int8_t max_beep_count=0, // Beep alert for attention
const bool show_lcd=false, // Set LCD status messages?
const bool pause_for_user=false, // Pause for user before returning?
-4
View File
@@ -35,10 +35,6 @@
#include "../../../module/probe.h"
#include "../../queue.h"
#if HAS_MULTI_HOTEND
#include "../../../module/tool_change.h"
#endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
#include "../../../libs/least_squares_fit.h"
#endif
+1 -1
View File
@@ -66,7 +66,7 @@ void GcodeSuite::M111() {
SERIAL_ECHOPGM(STR_DEBUG_OFF);
#if !(defined(__AVR__) && defined(USBCON))
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
SERIAL_ECHOPGM("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns());
//SERIAL_ECHOPGM("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns());
#endif
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
SERIAL_ECHOPGM("\nFraming Errors: ", MYSERIAL1.framing_errors());
@@ -72,6 +72,7 @@ void GcodeSuite::M413_report(const bool forReplay/*=true*/) {
, " B", recovery.bed_temp_threshold
#endif
);
SERIAL_ECHO(" ; ");
serialprintln_onoff(recovery.enabled);
}
+10 -8
View File
@@ -235,9 +235,11 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
#endif
// Serial DMA is only available for some STM32 MCUs
// Serial DMA is only available for some STM32 MCUs and HC32
#if ENABLED(SERIAL_DMA)
#if !HAL_STM32 || NONE(STM32F0xx, STM32F1xx, STM32F2xx, STM32F4xx, STM32F7xx)
#if defined(ARDUINO_ARCH_HC32)
// checks for HC32 are located in HAL/HC32/inc/SanityCheck.h
#elif !HAL_STM32 || NONE(STM32F0xx, STM32F1xx, STM32F2xx, STM32F4xx, STM32F7xx)
#error "SERIAL_DMA is only available for some STM32 MCUs and requires HAL/STM32."
#elif !defined(HAL_UART_MODULE_ENABLED) || defined(HAL_UART_MODULE_ONLY)
#error "SERIAL_DMA requires STM32 platform HAL UART (without HAL_UART_MODULE_ONLY)."
@@ -3633,9 +3635,9 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive."
#error "LED_CONTROL_MENU requires an LCD controller that implements the menu."
#endif
#if ENABLED(CUSTOM_MENU_MAIN) && NONE(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, TFT_LVGL_UI)
#error "CUSTOM_MENU_MAIN requires an LCD controller that implements the menu."
#endif
//#if ENABLED(CUSTOM_MENU_MAIN) && NONE(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, TFT_LVGL_UI)
//#error "CUSTOM_MENU_MAIN requires an LCD controller that implements the menu."
//#endif
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL) && DISABLED(NEOPIXEL_LED)
#error "CASE_LIGHT_USE_NEOPIXEL requires NEOPIXEL_LED."
@@ -4000,11 +4002,11 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive."
#if !(defined(WIFI_SSID) && defined(WIFI_PWD))
#error "ESP32 motherboard with WIFISUPPORT requires WIFI_SSID and WIFI_PWD."
#endif
#elif ENABLED(WIFI_CUSTOM_COMMAND)
#elif ENABLED(WIFI_CUSTOM_COMMAND) && NONE(ESP3D_WIFISUPPORT, WIFISUPPORT)
#error "WIFI_CUSTOM_COMMAND requires an ESP32 motherboard and WIFISUPPORT."
#elif ENABLED(OTASUPPORT)
#elif ENABLED(OTASUPPORT) && NONE(ESP3D_WIFISUPPORT, WIFISUPPORT)
#error "OTASUPPORT requires an ESP32 motherboard and WIFISUPPORT."
#elif defined(WIFI_SSID) || defined(WIFI_PWD)
#elif (defined(WIFI_SSID) || defined(WIFI_PWD)) && NONE(ESP3D_WIFISUPPORT, WIFISUPPORT)
#error "WIFI_SSID and WIFI_PWD only apply to ESP32 motherboard with WIFISUPPORT."
#endif
+1 -1
View File
@@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2024-04-08"
#define STRING_DISTRIBUTION_DATE "2024-04-15"
#endif
/**
+1 -1
View File
@@ -99,7 +99,7 @@
#warning "Warning! Don't use dummy thermistors (998/999) for final build!"
#endif
#if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT)
#if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT, UNIT_TEST)
#warning "Your Configuration provides no method to acquire user feedback!"
#endif
+1 -1
View File
@@ -1169,7 +1169,7 @@ void MarlinUI::draw_status_screen() {
lcd_moveto(LCD_WIDTH - 9, 2);
lcd_put_lchar('S');
#endif // LCD_INFO_SCREEN_STYLE
+7 -1
View File
@@ -377,7 +377,13 @@ void MarlinUI::draw_kill_screen() {
void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
#if HAS_DISPLAY_SLEEP
void MarlinUI::sleep_display(const bool sleep/*=true*/) { sleep ? u8g.sleepOn() : u8g.sleepOff(); }
void MarlinUI::sleep_display(const bool sleep/*=true*/) {
static bool asleep = false;
if (asleep != sleep){
sleep ? u8g.sleepOn() : u8g.sleepOff();
asleep = sleep;
}
}
#endif
#if HAS_LCD_BRIGHTNESS
@@ -84,7 +84,7 @@ TFT_IO tftio;
#define X_HI (UPSCALE(TFT_PIXEL_OFFSET_X, WIDTH) - 1)
#define Y_HI (UPSCALE(TFT_PIXEL_OFFSET_Y, HEIGHT) - 1)
// RGB565 color picker: https://embeddednotepad.com/page/rgb565-color-picker
// RGB565 color picker: https://rgbcolorpicker.com/565
// Hex code to color name: https://www.color-name.com/
#define COLOR_BLACK 0x0000 // #000000
+1 -1
View File
@@ -109,7 +109,7 @@ void MarlinUI::clear_lcd() {
#define VERSION_Y 84
#endif
dwinJPGShowAndCache(0); // Ensure DACAI stays on boot screen
dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, 230, S(dwin_string.string()));
dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, 230, S(dwin_string.string()));
TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT));
clear_lcd();
+15 -8
View File
@@ -790,7 +790,7 @@ void RTSSHOW::RTS_SndData(const char *str, unsigned long addr, unsigned char cmd
uint8_t expected_tx = 6 + len; // 6 bytes header + payload.
const millis_t try_until = ExtUI::safe_millis() + 1000;
while (expected_tx > DWIN_SERIAL.get_tx_buffer_free()) {
while (expected_tx > LCD_SERIAL_TX_BUFFER_FREE()) {
if (ELAPSED(ExtUI::safe_millis(), try_until)) return; // Stop trying after 1 second
#ifdef ARDUINO_ARCH_STM32
@@ -920,7 +920,7 @@ void RTSSHOW::WriteVariable(uint16_t adr, const void* values, uint8_t valueslen,
uint8_t expected_tx = 6 + valueslen; // 6 bytes header + payload.
const millis_t try_until = ExtUI::safe_millis() + 1000;
while (expected_tx > DWIN_SERIAL.get_tx_buffer_free()) {
while (expected_tx > LCD_SERIAL_TX_BUFFER_FREE()) {
if (ELAPSED(ExtUI::safe_millis(), try_until)) return; // Stop trying after 1 second
#ifdef ARDUINO_ARCH_STM32
@@ -1052,7 +1052,7 @@ void RTSSHOW::RTS_HandleData()
#endif
//SERIAL_ECHOLNPGM_P(PSTR("BeginSwitch"));
float tmp_zprobe_offset = 0.0f;
switch (Checkkey)
{
case Printfile:
@@ -1205,7 +1205,6 @@ void RTSSHOW::RTS_HandleData()
break;
case Zoffset:
float tmp_zprobe_offset;
if (recdat.data[0] >= 32768)
{
tmp_zprobe_offset = ((float)recdat.data[0] - 65536) / 100;
@@ -1215,7 +1214,7 @@ void RTSSHOW::RTS_HandleData()
tmp_zprobe_offset = ((float)recdat.data[0]) / 100;
}
SERIAL_ECHOLNPGM("Requested Offset ", tmp_zprobe_offset);
if (WITHIN((tmp_zprobe_offset), PROBE_OFFSET_Z_MIN, PROBE_OFFSET_Z_MAX))
if (WITHIN((tmp_zprobe_offset), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX))
{
int16_t tmpSteps = mmToWholeSteps(getZOffset_mm() - tmp_zprobe_offset, (axis_t)Z);
if(tmpSteps==0)
@@ -1672,7 +1671,7 @@ void RTSSHOW::RTS_HandleData()
case 2: // Z-axis to Up
{
SERIAL_ECHOLNPGM("Requested Offset ", tmp_zprobe_offset);
if (WITHIN((getZOffset_mm()+tmp_zprobe_adjust), PROBE_OFFSET_Z_MIN, PROBE_OFFSET_Z_MAX))
if (WITHIN((getZOffset_mm()+tmp_zprobe_adjust), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX))
{
int16_t tmpSteps = mmToWholeSteps(tmp_zprobe_adjust, (axis_t)Z);
if(tmpSteps==0)
@@ -1697,7 +1696,7 @@ void RTSSHOW::RTS_HandleData()
case 3: // Z-axis to Down
{
SERIAL_ECHOLNPGM("Requested Offset ", tmp_zprobe_offset);
if (WITHIN((getZOffset_mm()-tmp_zprobe_adjust), PROBE_OFFSET_Z_MIN, PROBE_OFFSET_Z_MAX))
if (WITHIN((getZOffset_mm()-tmp_zprobe_adjust), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX))
{
int16_t tmpSteps = mmToWholeSteps((tmp_zprobe_adjust), (axis_t)Z);
if(tmpSteps==0)
@@ -2002,7 +2001,7 @@ void RTSSHOW::RTS_HandleData()
case Filement:
if (recdat.addr == Exchfilement)
{
extruder_t tmpTool;
extruder_t tmpTool = E0;
if (recdat.data[0]<=2)
tmpTool = E0;
else if (recdat.data[0]<=4)
@@ -2968,6 +2967,14 @@ void onMaxTempError(signed char){}
void onPauseMode(PauseMessage, PauseMode, unsigned char) {}
void onSetMinExtrusionTemp(short){}
void onFirmwareFlash(){};
void onMaxTempError(int){};
void onMinTempError(int){};
void onHeatingError(int){};
void onStartM303(int, int, short){};
} // namespace ExtUI
#endif
+1 -1
View File
@@ -1668,7 +1668,7 @@ void MarlinUI::host_notify(const char * const cstr) {
card.abortFilePrintSoon();
else if (card.isMounted())
card.closefile();
#endif
#endif
#ifdef ACTION_ON_CANCEL
hostui.cancel();
#endif
+1 -1
View File
@@ -30,7 +30,7 @@
#define COLOR(color) RGB(((color >> 16) & 0xFF), ((color >> 8) & 0xFF), (color & 0xFF))
#define HALF(color) RGB(RED(color) >> 1, GREEN(color) >> 1, BLUE(color) >> 1)
// RGB565 color picker: https://embeddednotepad.com/page/rgb565-color-picker
// RGB565 color picker: https://rgbcolorpicker.com/565
// Hex code to color name: https://www.color-name.com/
#define COLOR_BLACK 0x0000 // #000000
+2
View File
@@ -224,6 +224,8 @@
#include "ramps/pins_RAMPS_CREALITY.h" // ATmega2560 env:mega2560
#elif MB(DAGOMA_F5)
#include "ramps/pins_DAGOMA_F5.h" // ATmega2560 env:mega2560
#elif MB(DAGOMA_D6)
#include "ramps/pins_DAGOMA_D6.h" // ATmega2560 env:mega2560ext
#elif MB(FYSETC_F6_13)
#include "ramps/pins_FYSETC_F6_13.h" // ATmega2560 env:FYSETC_F6
#elif MB(FYSETC_F6_14)
+119
View File
@@ -0,0 +1,119 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#if HOTENDS > 2 || E_STEPPERS > 2
#error "Dagoma3D D6 supports up to 2 hotends / E-steppers."
#endif
#define BOARD_INFO_NAME "Dagoma3D D6"
//
// Trinamic Stallguard pins
//
#define X_DIAG_PIN 43
#define Y_DIAG_PIN 41
#define Z_DIAG_PIN 47
#define E0_DIAG_PIN 21
#define E1_DIAG_PIN 20
//
// Endstops
//
#define X_STOP_PIN 2
#define Y_STOP_PIN 3
#define Z_STOP_PIN 15
//
// Filament Runout Sensor
//
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN 39
#endif
#if EXTRUDERS > 1 && !defined(FIL_RUNOUT2_PIN)
#define FIL_RUNOUT2_PIN 14
#endif
// Alter timing for graphical display
#if IS_U8GLIB_ST7920
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 0
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 250
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 250
#endif
#endif
#define KILL_PIN -1 // NC
#define LCD_CONTRAST_DEFAULT 255
//
// Sensorless homing DIAG pin is not directly connected to the MCU. Close
// the jumper next to the limit switch socket when using sensorless homing.
//
#if HAS_TMC_UART
/**
* TMC2208/TMC2209 stepper drivers
*/
#define X_SERIAL_RX_PIN 73
#define X_SERIAL_TX_PIN 73
#define Y_SERIAL_RX_PIN 73
#define Y_SERIAL_TX_PIN 73
#define Z_SERIAL_RX_PIN 73
#define Z_SERIAL_TX_PIN 73
#define E0_SERIAL_RX_PIN 73
#define E0_SERIAL_TX_PIN 73
#define E1_SERIAL_RX_PIN 12
#define E1_SERIAL_TX_PIN 12
// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 1
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 2
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#endif
#ifndef E1_SLAVE_ADDRESS
#define E1_SLAVE_ADDRESS 3
#endif
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_DAGOMA_D6.");
static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_DAGOMA_D6.");
static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_DAGOMA_D6.");
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_DAGOMA_D6.");
static_assert(E1_SLAVE_ADDRESS == 3, "E1_SLAVE_ADDRESS must be 3 for BOARD_DAGOMA_D6.");
#endif
//
// Import default RAMPS 1.4 pins
//
#include "pins_RAMPS.h"
@@ -105,6 +105,11 @@
#define BEEPER_PIN -1
#endif
#if ENABLED(MINIPANEL)
#undef DOGLCD_CS
#define DOGLCD_CS 28
#endif
/**
PIN: 0 Port: B0 E0_DIR_PIN protected
PIN: 1 Port: B1 E0_STEP_PIN protected
+1 -1
View File
@@ -495,7 +495,7 @@ void CardReader::mount() {
else {
flag.mounted = true;
SERIAL_ECHO_MSG(STR_SD_CARD_OK);
TERN_(EXTENSIBLE_UI, ExtUI::onMediaInserted()); // ExtUI response
TERN_(EXTENSIBLE_UI, ExtUI::isMediaInserted()); // ExtUI response
}
if (flag.mounted)
-35
View File
@@ -37,41 +37,6 @@
// Startup tests are run at the end of setup()
void runStartupTests() {
// Call post-setup tests here to validate behaviors.
// String with cutoff at 20 chars:
// "F-string, 1234.50, 2"
SString<20> str20;
str20 = F("F-string, ");
str20.append(1234.5f).append(',').append(' ')
.append(2345.67).append(',').append(' ')
.echoln();
// Truncate to "F-string"
str20.trunc(8).echoln();
// 100 dashes, but chopped down to DEFAULT_MSTRING_SIZE (20)
TSS(repchr_t('-', 100)).echoln();
// Hello World!-123456------ <spaces!33
// ^ eol! ... 1234.50*2345.602 = 2895645.67
SString<100> str(F("Hello"));
str.append(F(" World!"));
str += '-';
str += uint8_t(123);
str += F("456");
str += repchr_t('-', 6);
str += Spaces(3);
str += "< spaces!";
str += int8_t(33);
str.eol();
str += "^ eol!";
str.append("...", 1234.5f, '*', p_float_t(2345.602, 3), F(" = "), 1234.5 * 2345.602).echoln();
// Print it again with SERIAL_ECHOLN
auto print_char_ptr = [](char * const str) { SERIAL_ECHOLN(str); };
print_char_ptr(str);
}
// Periodic tests are run from within loop()
+5
View File
@@ -0,0 +1,5 @@
These test files are executed by the unit-tests built from the `<root>/test` folder.
These are placed outside of the main PlatformIO test folder so we can collect all test files and compile them into multiple PlatformIO test binaries. This enables tests to be executed against a variety of Marlin configurations.
To execute these tests, refer to the top-level Makefile.
File diff suppressed because it is too large Load Diff
+58
View File
@@ -0,0 +1,58 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../test/unit_tests.h"
#include <src/gcode/gcode.h>
#include <src/gcode/parser.h>
MARLIN_TEST(gcode, process_parsed_command) {
GcodeSuite suite;
parser.command_letter = 'G';
parser.codenum = 0;
suite.process_parsed_command(false);
}
MARLIN_TEST(gcode, parse_g1_xz) {
char current_command[] = "G0 X10 Z30";
parser.command_letter = -128;
parser.codenum = -1;
parser.parse(current_command);
TEST_ASSERT_EQUAL('G', parser.command_letter);
TEST_ASSERT_EQUAL(0, parser.codenum);
TEST_ASSERT_TRUE(parser.seen('X'));
TEST_ASSERT_FALSE(parser.seen('Y'));
TEST_ASSERT_TRUE(parser.seen('Z'));
TEST_ASSERT_FALSE(parser.seen('E'));
}
MARLIN_TEST(gcode, parse_g1_nxz) {
char current_command[] = "N123 G0 X10 Z30";
parser.command_letter = -128;
parser.codenum = -1;
parser.parse(current_command);
TEST_ASSERT_EQUAL('G', parser.command_letter);
TEST_ASSERT_EQUAL(0, parser.codenum);
TEST_ASSERT_TRUE(parser.seen('X'));
TEST_ASSERT_FALSE(parser.seen('Y'));
TEST_ASSERT_TRUE(parser.seen('Z'));
TEST_ASSERT_FALSE(parser.seen('E'));
}
@@ -0,0 +1,36 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../test/unit_tests.h"
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#include <src/feature/runout.h>
MARLIN_TEST(runout, poll_runout_states) {
FilamentSensorBase sensor;
// Expected default value is one bit set for each extruder
uint8_t expected = static_cast<uint8_t>(~(~0u << NUM_RUNOUT_SENSORS));
TEST_ASSERT_EQUAL(expected, sensor.poll_runout_states());
}
#endif
+160
View File
@@ -0,0 +1,160 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../test/unit_tests.h"
#include "src/core/types.h"
MARLIN_TEST(types, XYval_const_as_bools) {
const XYval<int> xy_const_true = {1, 2};
TEST_ASSERT_TRUE(xy_const_true);
const XYval<int> xy_const_false = {0, 0};
TEST_ASSERT_FALSE(xy_const_false);
}
MARLIN_TEST(types, XYval_non_const_as_bools) {
XYval<int> xy_true = {1, 2};
TEST_ASSERT_TRUE(xy_true);
XYval<int> xy_false = {0, 0};
TEST_ASSERT_FALSE(xy_false);
}
MARLIN_TEST(types, XYZval_const_as_bools) {
const XYZval<int> xyz_const_true = {1, 2, 3};
TEST_ASSERT_TRUE(xyz_const_true);
const XYZval<int> xyz_const_false = {0, 0, 0};
TEST_ASSERT_FALSE(xyz_const_false);
}
MARLIN_TEST(types, XYZval_non_const_as_bools) {
XYZval<int> xyz_true = {1, 2, 3};
TEST_ASSERT_TRUE(xyz_true);
XYZval<int> xyz_false = {0, 0, 0};
TEST_ASSERT_FALSE(xyz_false);
}
MARLIN_TEST(types, XYZEval_const_as_bools) {
const XYZEval<int> xyze_const_true = {1, 2, 3, 4};
TEST_ASSERT_TRUE(xyze_const_true);
const XYZEval<int> xyze_const_false = {0, 0, 0, 0};
TEST_ASSERT_FALSE(xyze_const_false);
}
MARLIN_TEST(types, XYZEval_non_const_as_bools) {
XYZEval<int> xyze_true = {1, 2, 3, 4};
TEST_ASSERT_TRUE(xyze_true);
XYZEval<int> xyze_false = {0, 0, 0, 0};
TEST_ASSERT_FALSE(xyze_false);
}
MARLIN_TEST(types, Flags_const_as_bools) {
const Flags<32> flags_const_false = {0};
TEST_ASSERT_FALSE(flags_const_false);
const Flags<32> flags_const_true = {1};
TEST_ASSERT_TRUE(flags_const_true);
}
MARLIN_TEST(types, Flags_non_const_as_bools) {
Flags<32> flags_false = {0};
TEST_ASSERT_FALSE(flags_false);
Flags<32> flags_true = {1};
TEST_ASSERT_TRUE(flags_true);
}
MARLIN_TEST(types, AxisFlags_const_as_bools) {
const AxisFlags axis_flags_const_false = {0};
TEST_ASSERT_FALSE(axis_flags_const_false);
const AxisFlags axis_flags_const_true = {1};
TEST_ASSERT_TRUE(axis_flags_const_true);
}
MARLIN_TEST(types, AxisFlags_non_const_as_bools) {
AxisFlags axis_flags_false = {0};
TEST_ASSERT_FALSE(axis_flags_false);
AxisFlags axis_flags_true = {1};
TEST_ASSERT_TRUE(axis_flags_true);
}
MARLIN_TEST(types, AxisBits_const_as_bools) {
const AxisBits axis_bits_const_false = {0};
TEST_ASSERT_FALSE(axis_bits_const_false);
const AxisBits axis_bits_const_true = {1};
TEST_ASSERT_TRUE(axis_bits_const_true);
}
MARLIN_TEST(types, AxisBits_non_const_as_bools) {
AxisBits axis_bits_false = {0};
TEST_ASSERT_FALSE(axis_bits_false);
AxisBits axis_bits_true = {1};
TEST_ASSERT_TRUE(axis_bits_true);
}
MARLIN_TEST(types, MString1) {
// String with cutoff at 20 chars:
// "F-string, 1234.50, 2"
MString<20> str20;
str20 = F("F-string, ");
str20.append(1234.5f).append(',').append(' ')
.append(2345.67).append(',').append(' ');
TEST_ASSERT_TRUE(strcmp_P(str20, PSTR("F-string, 1234.50, 2")) == 0);
// Truncate to "F-string"
str20.trunc(8);
TEST_ASSERT_FALSE(strcmp_P(&str20, PSTR("F-string")) != 0);
}
MARLIN_TEST(types, MString2) {
// 100 dashes, but chopped down to DEFAULT_MSTRING_SIZE (20)
TEST_ASSERT_TRUE(TSS(repchr_t('-', 100)).length() == 20);
}
MARLIN_TEST(types, SString) {
// Hello World!-123456------ < spaces!33
// ^ eol! ... 1234.50*2345.602 = 2895645.67
SString<100> str(F("Hello"));
str.append(F(" World!"));
str += '-';
str += uint8_t(123);
str += F("456");
str += repchr_t('-', 6);
str += Spaces(3);
str += "< spaces!";
str += int8_t(33);
str.eol();
str += "^ eol!";
str.append(" ... ", 1234.5f, '*', p_float_t(2345.602, 3), F(" = "), 1234.5 * 2345.602);
TEST_ASSERT_TRUE(strcmp_P(str, PSTR("Hello World!-123456------ < spaces!33\n^ eol! ... 1234.50*2345.602 = 2895645.67")) == 0);
}
+71 -11
View File
@@ -1,16 +1,69 @@
## Dwin Touch/TFT Screen supported firmware
## Creality Touch/TFT Screen supported firmware
- Info screen Version Code Reference
- - Char 1 - Driver (A-4988, T-TMC220X)
- - Char 2 - Z Stop(B-BLTouch, E-Endstop)
- - Char 3 - Screen(L-LowRes, H-THighRes)
- - Char 4 - Bed (A-AC, D-DC)
- - Char 5 - Endstop(O-Optical Y, M-Mechanical Y)
- - Char 6 - Extruder (T-Titan, B-BMG, L-LGX, S-Basic)
This branch adds support for the Creality touchscreen machines and was split off from the standard Creality branches due to specific custom changes not found upstream. This includes extensions to the EXTui framework among other smaller tweaks that we have been working towards getting submitted upstream. Machines supported here are :
- [CR10S Pro / V2](https://www.tinymachines3d.com/products/cr-10s-pro-v2-3d-printer?rfsn=3419592.cc302fe)
- [CR10 Max](https://www.tinymachines3d.com/products/creality-cr-10-max-3d-printer?rfsn=3419592.cc302fe)
- [Ender 5 Plus](https://www.tinymachines3d.com/products/ender-5-plus-silent-board-custom-dual-z-3d-printer?rfsn=3419592.cc302fe)
- [Ender 6](https://amzn.to/3JRyOhi)
- [CR-X / Pro](https://www.tinymachines3d.com/products/creality-cr-x-pro-3d-printer-with-dual-extruder-and-bl-touch?rfsn=3419592.cc302fe)
- [CR10 V2 ](https://www.tinymachines3d.com/products/creality-cr-10-v2-3d-printer?rfsn=3419592.cc302fe)
- [CR10 V3 ](https://www.tinymachines3d.com/products/creality-cr-10-v3-plus-3d-printer-with-genuine-e3d-direct-drive-extruder-and-bl-touch?rfsn=3419592.cc302fe)
- [Ender 3 / Pro 4.2.2 and 4.2.7](https://amzn.to/3BRHlxY)
- [Ender 3 V2](https://www.tinymachines3d.com/products/ender-3-v2?rfsn=3419592.cc302fe)
- [Ender 3 Max](https://www.tinymachines3d.com/products/ender-3-max-3d-printer?rfsn=3419592.cc302fe)
- [Ender 5 / Pro 4.2.2 and 4.2.7](https://amzn.to/3gMb2Yu)
- [CR10S5 500mm](https://www.tinymachines3d.com/products/creality-cr-10-s5-3d-printer?rfsn=3419592.cc302fe)
- [CR6 SE](https://www.tinymachines3d.com/products/creality-cr-6-se-3d-printer?rfsn=3419592.cc302fe)
- [CR6 Max](https://www.tinymachines3d.com/products/creality-cr-6-max-3d-printer?rfsn=3419592.cc302fe)
- [CR10 Smart](https://www.tinymachines3d.com/products/creality-cr-10-smart-3d-printer?rfsn=3419592.cc302fe)
- [Ender 7](https://www.tinymachines3d.com/products/ender-7-3d-printer?rfsn=3419592.cc302fe)
- [CR30](https://www.tinymachines3d.com/products/cr-30-infinite-z-belt-3d-printer?rfsn=3419592.cc302fe)
- [Sermoon D1](https://amzn.to/3LXfZeD)
- [CR5 / Pro HT](https://amzn.to/3gWvpBt)
- [Ender 3 S1](https://www.tinymachines3d.com/products/ender-3-s1-3d-printer?rfsn=3419592.cc302fe)
- [Ender 2 Pro](https://www.tinymachines3d.com/products/ender-2-pro-3d-printer?rfsn=3419592.cc302fe)
- CR10S, CR10S4, CR20 and Pro, CR10, CR10Mini, CR2020, Ender 4, Ender 2 - Legacy support
- These configurations exist however due to age and product availability are no longer actively tested
## Coming Soon
- [CR10 Smart Pro](https://www.tinymachines3d.com/products/cr-10-smart-pro-3d-printer?rfsn=3419592.cc302fe)
- [CR200B]()
## Resin machines below from Tiny Machines are listed simply as an additional way to help support the project. If youre considering buying one, please do so through the following links :
- [Halot One CL-60](https://www.tinymachines3d.com/products/halot-one-cl-60-resin-3d-printer?rfsn=3419592.cc302fe)
- [LD-002R](https://www.tinymachines3d.com/products/ld-002r-resin-printer?rfsn=3419592.cc302fe)
- [LD-002H](https://www.tinymachines3d.com/products/ld-002h-resin-3d-printer?rfsn=3419592.cc302fe)
- [LD-006](https://www.tinymachines3d.com/products/ld-006-resin-3d-printer?rfsn=3419592.cc302fe)
- [UW-02 Washer](https://www.tinymachines3d.com/products/uw-02-washing-curing-machine?rfsn=3419592.cc302fe)
Ender 3V2 has a dedicated file set. CR10 Smart has a dedicated high resolution screen set. Portrait displays use the CR6/E3 Touch variant and landscape use the combined set.
Screen files are archived with [7-Zip](https://www.7-zip.org/) simply because it came out 1/5 the file size of a zip file. That added up fast!
There is a limitation with Windows systems and path depth so the file names need to be shorter than we would prefer. If you get an error compiling due to the path limit, move the folder to the root of your hard drive. Here is a legend to help decode the files:
- BLT = BLTouch
- BIL = Bilinear Leveling
- UBL - Unified Bed Leveling
- DZ = Dual Z Steppers
- Fil = FilamentRunout
- Slnt = Creality Silent Board
- H = E3D Hemera Extruder
- MC = Mosquito Creality mount
- ME = Mosquito E3D mount
- Melzi Host option disables local SD card to allow more features and buffer for Octoprint control
- NF = Noise filtering for machines with cable extensions - reduces homing accuracy!
- LR = Stock runout replaced with Lerdge
- ZM = BLTouch connected to ZMin port instead of Probe pin 5 connector harness
## Support
This firmware is provided to the public as-is with no warranty or guarantee. It's based on a large open source project and there is no entitlement to support. That said, LNL Solutions customers may obtain support through their normal support queue. I will provide support to Patreons as I am able. Aside from this, we are active on many discord channels and typically help anyone we can when we come across them.
This firmware is provided to the public as-is with no warranty or guarantee. It's based on a large open source project and there is no entitlement to support. That said, Tiny Machines 3D customers may obtain
support through their normal support queue. I will provide support to Patreons as I am able. If you require more immediate support and are not a Tiny Machines 3D customer, you may contact them at
support@tinymachines3d.com about purchasing support hours. Aside from this, we are active on many Facebook groups as well as several discord channels and typically help anyone we can when we come across them.
We have now created a dedicated Discord server to handle support and archive relevant guides and instructions. Patreon supporters will get priority assistance.
@@ -26,9 +79,16 @@ Shout out to Tom Brazier, as nearly all notable improvements to the Marlin core
Insanity Automation Discord - https://discord.gg/TKmJ85PyG4
## Primary Notes for DW7.4.8
- Added Linear Adv and Input Shaping Screens
- Signifigant improvement in response times following changes to new generation machines
-- The DWIN OS 3.5 had an option to enable NOACK with an addon bin file. 4.0 has a specific throttled response OS revision. 4.5 needed a totally different UI image flashed. No way it could all live together without completely confusing users so we set about figuring out how to keep universal support and found a balance in data send cycles that the 2560 buffers could still handle the replies without overunning.
- Added support for changing runout sensor type on the LCD
- Added toggle to change babystepping increment on the LCD
- Thanks to EvilGremlin for some of the icon and display graphics work
## Primary Notes for DW7.4.7
- Added IDEX screens
- Added Branch / support for Tenlog IDEX machines with LNL Solutions
- Fan adjustment now numeric instead of simple on/off
- Tap Z offset on adjustment screen to type numeric value
- Sync to 2.1.2 with LA now on for all builds, Silent specific builds eliminated
@@ -175,4 +235,4 @@ This is just one of many forks of Marlin. We don't try to bury that behind fancy
Marlin is published under the [GPL license](/LICENSE) because we believe in open development. The GPL comes with both rights and obligations. Whether you use Marlin firmware as the driver for your open or closed-source product, you must keep Marlin open, and you must provide your compatible Marlin source code to end users upon request. The most straightforward way to comply with the Marlin license is to make a fork of Marlin on Github, perform your modifications, and direct users to your modified fork.
While we can't prevent the use of this code in products (3D printers, CNC, etc.) that are closed source or crippled by a patent, we would prefer that you choose another firmware or, better yet, make your own.
While we can't prevent the use of this code in products (3D printers, CNC, etc.) that are closed source or crippled by a patent, we would prefer that you choose another firmware or, better yet, make your own.
+1 -1
View File
@@ -7,5 +7,5 @@ if [[ $1 == '-d' || $1 == '--default' ]]; then
else
git checkout Marlin/Configuration.h 2>/dev/null
git checkout Marlin/Configuration_adv.h 2>/dev/null
git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null
git checkout Marlin/src/pins/*/pins_*.h 2>/dev/null
fi
@@ -0,0 +1,59 @@
#
# collect-code-tests.py
# Convenience script to collect all code tests. Used by env:linux_native_test in native.ini.
#
import pioutil
if pioutil.is_pio_build():
import os, re
Import("env")
Import("projenv")
os.environ['PATH'] = f"./buildroot/bin/:./buildroot/tests/:{os.environ['PATH']}"
def collect_test_suites():
"""Get all the test suites"""
from pathlib import Path
return sorted(list(Path("./test").glob("*.ini")))
def register_test_suites():
"""Register all the test suites"""
targets = []
test_suites = collect_test_suites()
for path in test_suites:
name = re.sub(r'^\d+-|\.ini$', '', path.name)
targets += [name];
env.AddCustomTarget(
name = f"marlin_{name}",
dependencies = None,
actions = [
f"echo ====== Configuring for marlin_{name} ======",
"restore_configs",
f"cp -f {path} ./Marlin/config.ini",
"python ./buildroot/share/PlatformIO/scripts/configuration.py",
f"platformio test -e linux_native_test -f {name}",
"restore_configs",
],
title = "Marlin: {}".format(name.lower().title().replace("_", " ")),
description = (
f"Run a Marlin test suite, with the appropriate configuration, "
f"that sits in {path}"
)
)
env.AddCustomTarget(
name = "test-marlin",
dependencies = None,
actions = [
f"platformio run -t marlin_{name} -e linux_native_test"
for name in targets
],
title = "Marlin: Test all code test suites",
description = (
f"Run all Marlin code test suites ({len(targets)} found)."
),
)
register_test_suites()
+1 -1
View File
@@ -315,7 +315,6 @@ HAS_ZV_SHAPING = build_src_filter=+<src/gcode/feature/in
GCODE_MACROS = build_src_filter=+<src/gcode/feature/macro>
GRADIENT_MIX = build_src_filter=+<src/gcode/feature/mixing/M166.cpp>
NONLINEAR_EXTRUSION = build_src_filter=+<src/gcode/feature/nonlinear>
OTA_FIRMWARE_UPDATE = build_src_filter=+<src/gcode/feature/ota>
HAS_SAVED_POSITIONS = build_src_filter=+<src/gcode/feature/pause/G60.cpp> +<src/gcode/feature/pause/G61.cpp>
PARK_HEAD_ON_PAUSE = build_src_filter=+<src/gcode/feature/pause/M125.cpp>
FILAMENT_LOAD_UNLOAD_GCODES = build_src_filter=+<src/gcode/feature/pause/M701_M702.cpp>
@@ -341,6 +340,7 @@ TOUCH_SCREEN_CALIBRATION = build_src_filter=+<src/gcode/lcd/M995.c
ARC_SUPPORT = build_src_filter=+<src/gcode/motion/G2_G3.cpp>
GCODE_MOTION_MODES = build_src_filter=+<src/gcode/motion/G80.cpp>
BABYSTEPPING = build_src_filter=+<src/gcode/motion/M290.cpp> +<src/feature/babystep.cpp>
OTA_FIRMWARE_UPDATE = build_src_filter=+<src/gcode/ota/M936.cpp>
Z_PROBE_SLED = build_src_filter=+<src/gcode/probe/G31_G32.cpp>
G38_PROBE_TARGET = build_src_filter=+<src/gcode/probe/G38.cpp>
MAGNETIC_PARKING_EXTRUDER = build_src_filter=+<src/gcode/probe/M951.cpp>
+12 -15
View File
@@ -33,22 +33,14 @@ build_src_filter = ${common.default_src_filter} +<src/HAL/HC32> +<src/HAL/shared
build_type = release
build_flags =
-D ARDUINO_ARCH_HC32
-D REDIRECT_PRINTF_TO_SERIAL # Redirect core-provided printf to host serial
-D F_CPU=SYSTEM_CLOCK_FREQUENCIES.pclk1 # Override F_CPU to PCLK1, as marlin freaks out otherwise...
-D PLATFORM_M997_SUPPORT # Enable M997 command
-D PLATFORM_M997_SUPPORT # Enable M997 command
# note: ddl and arduino debug mode are
# automatically enabled with MARLIN_DEV_MODE
#-D __DEBUG # force DDL debug mode
#-D __CORE_DEBUG # force Arduino core debug mode
# DDL / Arduino Configuration
-D DISABLE_SERIAL_GLOBALS # Disable global Serial objects, we use our own
-D CORE_DISABLE_FAULT_HANDLER # Disable arduino core fault handler (we use our own)
# DDL / Arduino Debug Options
#-D __DEBUG # DDL debug mode
#-D __CORE_DEBUG # Arduino core debug mode
-D PANIC_ENABLE # enable custom panic handlers (in MinSerial)
# options to reduce debug mode footprint (-16K; messages are less verbose)
-D __DEBUG_SHORT_FILENAMES # Use short filenames in DDL debug output
-D __PANIC_SHORT_FILENAMES # Use short filenames in core panic output
-D __OMIT_PANIC_MESSAGE # Omit panic messages in core panic output
# hc32 app configuration file
board_build.app_config = Marlin/src/HAL/HC32/app_config.h
# Drivers and Middleware required by the HC32 HAL
board_build.ddl.ots = true
@@ -58,6 +50,11 @@ board_build.ddl.timer0 = true
board_build.ddl.timera = true
board_build.mw.sd_card = true
# extra build flags
board_build.flags.common =
-g3 # Force emit debug symbols to elf. this does not affect the final binary size
-fno-signed-char # Force unsigned chars. this is required for meatpack to work
# Additional flags to reduce binary size
board_build.flags.cpp =
-fno-threadsafe-statics # Disable thread-safe statics (only one core anyway)
+16 -3
View File
@@ -15,13 +15,26 @@
[env:linux_native]
platform = native
framework =
build_flags = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined
build_flags = ${common.build_flags} -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined
build_src_flags = -Wall -IMarlin/src/HAL/LINUX/include
build_unflags = -Wall
lib_ldf_mode = off
lib_deps =
build_src_filter = ${common.default_src_filter} +<src/HAL/LINUX>
# Environment specifically for unit testing through the Makefile
# This is somewhat unorthodox, in that it uses the PlatformIO Unity testing framework,
# but actual targets are dynamically generated during the build. This seems to prevent
# Unity from being automatically included, so it is added here.
[env:linux_native_test]
extends = env:linux_native
extra_scripts = ${common.extra_scripts}
post:buildroot/share/PlatformIO/scripts/collect-code-tests.py
build_src_filter = ${env:linux_native.build_src_filter} +<tests>
lib_deps = throwtheswitch/Unity@^2.5.2
test_build_src = true
build_unflags =
build_flags = ${env:linux_native.build_flags} -Werror
#
# Native Simulation
# Builds with a small subset of available features
@@ -44,7 +57,7 @@ debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
lib_compat_mode = off
build_src_filter = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
lib_deps = ${common.lib_deps}
MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/8791f3ff43.zip
MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/66a2b82c8f.zip
Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip
LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip
extra_scripts = ${common.extra_scripts}
+3635 -139
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
# This file should remain empty except for the motherboard.
# If changes are needed by tests, it should be performed in another configuration.
[config:base]
ini_use_config = base
# Unit tests must use BOARD_SIMULATED to run natively in Linux
motherboard = BOARD_SIMULATED
+18
View File
@@ -0,0 +1,18 @@
#
# Test configuration with a single extruder and a filament runout sensor
#
[config:base]
ini_use_config = base
# Unit tests must use BOARD_SIMULATED to run natively in Linux
motherboard = BOARD_SIMULATED
# Options to support runout sensors test
filament_runout_sensor = on
fil_runout_pin = 4 # dummy
advanced_pause_feature = on
emergency_parser = on
nozzle_park_feature = on
# Option to support testing parsing with parentheses comments enabled
paren_comments = on
+32
View File
@@ -0,0 +1,32 @@
#
# Test configuration with three extruders and filament runout sensors
#
[config:base]
ini_use_config = base
# Unit tests must use BOARD_SIMULATED to run natively in Linux
motherboard = BOARD_SIMULATED
# Options to support runout sensor tests on three extruders.
# Options marked "dummy" are simply required to pass sanity checks.
extruders = 3
temp_sensor_1 = 1
temp_sensor_2 = 1
temp_2_pin = 4 # dummy
temp_3_pin = 4 # dummy
heater_2_pin = 4 # dummy
e2_step_pin = 4 # dummy
e2_dir_pin = 4 # dummy
e2_enable_pin = 4 # dummy
e3_step_pin = 4 # dummy
e3_dir_pin = 4 # dummy
e3_enable_pin = 4 # dummy
num_runout_sensors = 3
filament_runout_sensor = on
fil_runout_pin = 4 # dummy
fil_runout2_pin = 4 # dummy
fil_runout3_pin = 4 # dummy
filament_runout_script = "M600 %%c"
advanced_pause_feature = on
emergency_parser = on
nozzle_park_feature = on
+40
View File
@@ -0,0 +1,40 @@
# Testing Marlin
Marlin included two types of automated tests:
- [Build Tests](../buildroot/tests) to catch syntax and code build errors.
- Unit Tests (this folder) to catch implementation errors.
This document focuses on Unit tests.
## Unit tests
Unit testing allows for functional testing of Marlin logic on a local machine. This strategy is available to all developers, and will be able to be used on generic GitHub workers to automate testing. While PlatformIO does support the execution of unit tests on target controllers, that is not yet implemented and not really practical. This would require dedicated testing labs, and would be less broadly usable than testing directly on the development or build machine.
Unit tests verify the behavior of small discrete sections of Marlin code. By thoroughly unit testing important parts of Marlin code, we effectively provide "guard rails" which will prevent major regressions in behavior. As long as all submissions go through the Pull Request process and execute automated checks, it is possible to catch most major issues prior to completion of a PR.
## What unit tests can and can't do
Unit tests can be used to validate the logic of single functions or whole features, as long as that function or feature doesn't depend on real hardware. So, for example, we can test whether a G-code command is parsed correctly and produces all the expected state changes, but we can't test whether a G-code triggered an endstop or the filament runout sensor without adding a new layer to simulate pins.
Generally speaking, the types of errors caught by unit tests are most often caught in the initial process of writing the tests, and thereafter they shore up the codebase against regressions, especially in core classes and types, which can be very useful for refactoring.
### Unit test FAQ
#### Q: Isn't writing unit tests a lot of work?
A: Yes, and it can be especially difficult with existing code that wasn't designed for unit testing. Some common sense should be used to decide where to employ unit testing, and at what level to perform it. While unit testing takes effort, it pays dividends in preventing regressions, and helping to pinpoint the source of failures when they do occur.
#### Q: Will this make refactoring harder?
A: Yes and No. Of course if you refactor code that unit tests use directly, it will have to be reworked as well. It actually can make refactoring more efficient, by providing assurance that the mechanism still works as intended.
#### Q: How can I debug one of these failing unit tests?
A: That's a great question, without a known immediate answer. It is likely possible to debug them interactively through PlatformIO, but that can at times take some creativity to configure. Unit tests are generally extremely small, so even without interactive debugging it can get you fairly close to the cause of the problem.
### Unit test architecture
We are currently using [PlatformIO unit tests](https://docs.platformio.org/en/latest/plus/unit-testing.html).
Since Marlin only compiles code required by the configuration, a separate test binary must be generated for any configuration change. The following process is used to unit test a variety of configurations:
1. This folder contains a set of INI configuration files (See `config.ini`), each containing a distinct set of configuration options for unit testing. All applicable unit tests will be run for each of these configurations.
2. The `Marlin/tests` folder contains the CPP code for all Unit Tests. Marlin macros (`ENABLED(feature)`, `TERN(FEATURE, A, B)`, etc.) are used to determine which tests should be registered and to alter test behavior.
3. The `linux_native_test` PlatformIO environment specifies a script to collect all the tests from this folder and add them to PlatformIO's list of test targets.
4. Tests are built and executed by the `Makefile` commands `unit-test-all-local` or `unit-test-all-local-docker`.
+53
View File
@@ -0,0 +1,53 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* Provide the main() function used for all compiled unit test binaries.
* It collects all the tests defined in the code and runs them through Unity.
*/
#include "unit_tests.h"
static std::list<MarlinTest*> all_marlin_tests;
MarlinTest::MarlinTest(const std::string _name, const void(*_test)(), const char *_file, const int _line)
: name(_name), test(_test), file(_file), line(_line) {
all_marlin_tests.push_back(this);
}
void MarlinTest::run() {
Unity.TestFile = file.c_str();
UnityDefaultTestRun((UnityTestFunction)test, name.c_str(), line);
}
void run_all_marlin_tests() {
for (const auto registration : all_marlin_tests) {
registration->run();
}
}
int main(int argc, char **argv) {
UNITY_BEGIN();
run_all_marlin_tests();
UNITY_END();
return 0;
}
+74
View File
@@ -0,0 +1,74 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <list>
#include <string>
#include <unity.h>
// Include MarlinConfig so configurations are available to all tests
#include "src/inc/MarlinConfig.h"
/**
* Class that allows us to dynamically collect tests
*/
class MarlinTest {
public:
MarlinTest(const std::string name, const void(*test)(), const char *_file, const int line);
/**
* Run the test via Unity
*/
void run();
/**
* The name, a pointer to the function, and the line number. These are
* passed to the Unity test framework.
*/
const std::string name;
const void(*test)();
const std::string file;
const int line;
};
/**
* Internal macros used by MARLIN_TEST
*/
#define _MARLIN_TEST_CLASS_NAME(SUITE, NAME) MarlinTestClass_##SUITE##_##NAME
#define _MARLIN_TEST_INSTANCE_NAME(SUITE, NAME) MarlinTestClass_##SUITE##_##NAME##_instance
/**
* Macro to define a test. This will create a class with the test body and
* register it with the global list of tests.
*
* Usage:
* MARLIN_TEST(test_suite_name, test_name) {
* // Test body
* }
*/
#define MARLIN_TEST(SUITE, NAME) \
class _MARLIN_TEST_CLASS_NAME(SUITE, NAME) : public MarlinTest { \
public: \
_MARLIN_TEST_CLASS_NAME(SUITE, NAME)() : MarlinTest(#SUITE "___" #NAME, (const void(*)())&TestBody, __FILE__, __LINE__) {} \
static void TestBody(); \
}; \
const _MARLIN_TEST_CLASS_NAME(SUITE, NAME) _MARLIN_TEST_INSTANCE_NAME(SUITE, NAME); \
void _MARLIN_TEST_CLASS_NAME(SUITE, NAME)::TestBody()