diff --git a/.github/lock.yml b/.github/lock.yml deleted file mode 100644 index c5ceff66b0a7..000000000000 --- a/.github/lock.yml +++ /dev/null @@ -1,40 +0,0 @@ -# -# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app -# - -# Number of days of inactivity before a closed issue or pull request is locked -daysUntilLock: 60 - -# Skip issues and pull requests created before a given timestamp. Timestamp must -# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable -skipCreatedBefore: false - -# Issues and pull requests with these labels will be ignored. Set to `[]` to disable -exemptLabels: [ 'no-locking' ] - -# Label to add before locking, such as `outdated`. Set to `false` to disable -lockLabel: false - -# Comment to post before locking. Set to `false` to disable -lockComment: > - This thread has been automatically locked since there has not been - any recent activity after it was closed. Please open a new issue for - related bugs. - -# Assign `resolved` as the reason for locking. Set to `false` to disable -setLockReason: true - -# Limit to only `issues` or `pulls` -# only: issues - -# Optionally, specify configuration settings just for `issues` or `pulls` -# issues: -# exemptLabels: -# - help-wanted -# lockLabel: outdated - -# pulls: -# daysUntilLock: 30 - -# Repository to extend settings from -# _extends: repo diff --git a/.github/workflows/bump-date.yml b/.github/workflows/bump-date.yml index a08eeea561d7..2d3fd1f33dee 100644 --- a/.github/workflows/bump-date.yml +++ b/.github/workflows/bump-date.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Check out bugfix-2.0.x - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: bugfix-2.0.x @@ -39,7 +39,7 @@ jobs: exit 0 - name: Check out bugfix-2.1.x - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: bugfix-2.1.x diff --git a/.github/workflows/test-builds.yml b/.github/workflows/ci-build-tests.yml similarity index 93% rename from .github/workflows/test-builds.yml rename to .github/workflows/ci-build-tests.yml index 7c62b5af6c54..546faa5f38f6 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/ci-build-tests.yml @@ -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: @@ -14,6 +14,8 @@ on: - config/** - data/** - docs/** + - test/** + - Marlin/tests/** - '**/*.md' push: branches: @@ -23,11 +25,13 @@ on: - config/** - data/** - docs/** + - test/** + - Marlin/tests/** - '**/*.md' jobs: test_builds: - name: Run All Tests + name: Build Test if: github.repository == 'MarlinFirmware/Marlin' runs-on: ubuntu-latest @@ -152,7 +156,7 @@ jobs: uses: actions/checkout@v4 - name: Cache pip - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} @@ -160,13 +164,13 @@ jobs: ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Select Python 3.9 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.9' architecture: 'x64' diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/ci-unit-tests.yml new file mode 100644 index 000000000000..caed5b1fbc95 --- /dev/null +++ b/.github/workflows/ci-unit-tests.yml @@ -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 diff --git a/.github/workflows/ci-validate-pins.yml b/.github/workflows/ci-validate-pins.yml new file mode 100644 index 000000000000..e093eb92c7b9 --- /dev/null +++ b/.github/workflows/ci-validate-pins.yml @@ -0,0 +1,51 @@ +# +# ci-validate-pins.yml +# Validate that all of the pins files are unchanged by pinsformat.py +# + +name: CI - Validate Pins Files + +on: + pull_request: + branches: + - bugfix-2.1.x + # Cannot be enabled on 2.1.x until it contains the unit test framework + #- 2.1.x + paths: + - 'Marlin/src/pins/*/**' + push: + branches: + - bugfix-2.1.x + # Cannot be enabled on 2.1.x until it contains the unit test framework + #- 2.1.x + paths: + - 'Marlin/src/pins/*/**' + +jobs: + validate_pins_files: + name: Validate Pins Files + if: github.repository == 'MarlinFirmware/Marlin' + + runs-on: ubuntu-latest + + steps: + - name: Check out the PR + uses: actions/checkout@v4 + + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Select Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: '3.9' + architecture: 'x64' + + - name: Validate all pins files + run: | + make validate-pins -j diff --git a/.github/workflows/clean-closed.yml b/.github/workflows/clean-closed.yml index 318d083dfae3..3f370a4362d1 100644 --- a/.github/workflows/clean-closed.yml +++ b/.github/workflows/clean-closed.yml @@ -32,7 +32,7 @@ jobs: - "Needs: Work" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Remove Labels uses: actions-ecosystem/action-remove-labels@v1 with: diff --git a/.github/workflows/close-stale.yml b/.github/workflows/close-stale.yml index 397f9b5ea6c2..55e19de5669a 100644 --- a/.github/workflows/close-stale.yml +++ b/.github/workflows/close-stale.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/stale@v8 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: | diff --git a/.github/workflows/lock-closed.yml b/.github/workflows/lock-closed.yml index 8cdcd7a8369e..6392f244b593 100644 --- a/.github/workflows/lock-closed.yml +++ b/.github/workflows/lock-closed.yml @@ -17,15 +17,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v2 + - uses: dessant/lock-threads@v5 with: github-token: ${{ github.token }} process-only: 'issues' - issue-lock-inactive-days: '60' - issue-exclude-created-before: '' - issue-exclude-labels: 'no-locking' - issue-lock-labels: '' - issue-lock-comment: > + issue-inactive-days: '60' + exclude-issue-created-before: '' + exclude-any-issue-labels: 'no-locking' + add-issue-labels: '' + issue-comment: > This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. diff --git a/Makefile b/Makefile index bc26173aaf36..ce925a58438c 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,23 @@ SCRIPTS_DIR := buildroot/share/scripts CONTAINER_RT_BIN := docker CONTAINER_RT_OPTS := --rm -v $(PWD):/code -v platformio-cache:/root/.platformio CONTAINER_IMAGE := marlin-dev +UNIT_TEST_CONFIG ?= default help: @echo "Tasks for local development:" @echo "make marlin : Build marlin for the configured board" - @echo "make format-pins : Reformat all pins files" + @echo "make format-pins -j : Reformat all pins files (-j for parallel execution)" + @echo "make validate-pins -j : Validate all pins files, fails if any require reformatting" @echo "make tests-single-ci : Run a single test from inside the CI" @echo "make tests-single-local : Run a single test locally" @echo "make tests-single-local-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-local : Run unit tests for a single config locally" + @echo "make unit-test-single-local-docker : Run unit tests for a single config locally, using docker" + @echo "make unit-test-all-local : Run all code tests locally" + @echo "make unit-test-all-local-docker : Run all code tests locally, using docker" + @echo "make setup-local-docker : Setup local docker using buildx" @echo "" @echo "Options for testing:" @echo " TEST_TARGET Set when running tests-single-*, to select the" @@ -22,6 +28,9 @@ help: @echo " run on GitHub CI" @echo " ONLY_TEST Limit tests to only those that contain this, or" @echo " the index of the test (1-based)" + @echo " UNIT_TEST_CONFIG Set the name of the config from the test folder, without" + @echo " the leading number. Default is 'default'". Used with the + @echo " unit-test-single-* tasks" @echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value" @echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:" @echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!" @@ -43,7 +52,7 @@ tests-single-local: tests-single-local-docker: @if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET= 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,14 +61,35 @@ 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-local: + platformio run -t marlin_$(UNIT_TEST_CONFIG) -e linux_native_test + +unit-test-single-local-docker: + @if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi + $(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-single-local UNIT_TEST_CONFIG=$(UNIT_TEST_CONFIG) + +unit-test-all-local: + platformio run -t test-marlin -e linux_native_test + +unit-test-all-local-docker: + @if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi + $(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) make unit-test-all-local setup-local-docker: - $(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') +.PHONY: $(PINS) format-pins validate-pins + $(PINS): %: - @echo "Formatting $@" && node $(SCRIPTS_DIR)/pinsformat.js $@ + @echo "Formatting $@" + @python $(SCRIPTS_DIR)/pinsformat.py $< $@ format-pins: $(PINS) + +validate-pins: format-pins + @echo "Validating pins files" + @git diff --exit-code || (git status && echo "\nError: Pins files are not formatted correctly. Run \"make format-pins\" to fix.\n" && exit 1) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 5c39bd4e68f6..50cc7e6724bc 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -403,9 +403,18 @@ //#define PS_OFF_SOUND // Beep 1s when power off #define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box - //#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80 - //#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power - //#define LED_POWEROFF_TIMEOUT 10000 // (ms) Turn off LEDs after power-off, with this amount of delay + //#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80 + //#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power + //#define LED_POWEROFF_TIMEOUT 10000 // (ms) Turn off LEDs after power-off, with this amount of delay + + //#define PSU_OFF_REDUNDANT // Second pin for redundant power control + //#define PSU_OFF_REDUNDANT_INVERTED // Redundant pin state is the inverse of PSU_ACTIVE_STATE + + //#define PS_ON1_PIN 6 // Redundant pin required to enable power in combination with PS_ON_PIN + + //#define PS_ON_EDM_PIN 8 // External Device Monitoring pins for external power control relay feedback. Fault on mismatch. + //#define PS_ON1_EDM_PIN 9 + #define PS_EDM_RESPONSE 250 // (ms) Time to allow for relay action //#define POWER_OFF_TIMER // Enable M81 D to power off after a delay //#define POWER_OFF_WAIT_FOR_COOLDOWN // Enable M81 S to power off only after cooldown @@ -2630,9 +2639,9 @@ #define DISPLAY_CHARSET_HD44780 JAPANESE /** - * Info Screen Style (0:Classic, 1:Průša) + * Info Screen Style (0:Classic, 1:Průša, 2:CNC) * - * :[0:'Classic', 1:'Průša'] + * :[0:'Classic', 1:'Průša', 2:'CNC'] */ #define LCD_INFO_SCREEN_STYLE 0 diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b682c2e8ec83..dd6e11d06231 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1204,14 +1204,14 @@ #define INPUT_SHAPING_Y #if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y) #if ENABLED(INPUT_SHAPING_X) - #define SHAPING_FREQ_X 40 // (Hz) The default dominant resonant frequency on the X axis. - #define SHAPING_ZETA_X 0.15f // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). + #define SHAPING_FREQ_X 40.0 // (Hz) The default dominant resonant frequency on the X axis. + #define SHAPING_ZETA_X 0.15 // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). #endif #if ENABLED(INPUT_SHAPING_Y) - #define SHAPING_FREQ_Y 40 // (Hz) The default dominant resonant frequency on the Y axis. - #define SHAPING_ZETA_Y 0.15f // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping). + #define SHAPING_FREQ_Y 40.0 // (Hz) The default dominant resonant frequency on the Y axis. + #define SHAPING_ZETA_Y 0.15 // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping). #endif - //#define SHAPING_MIN_FREQ 20 // By default the minimum of the shaping frequencies. Override to affect SRAM usage. + //#define SHAPING_MIN_FREQ 20.0 // (Hz) By default the minimum of the shaping frequencies. Override to affect SRAM usage. //#define SHAPING_MAX_STEPRATE 10000 // By default the maximum total step rate of the shaped axes. Override to affect SRAM usage. //#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters. #endif @@ -1270,11 +1270,11 @@ * XY Frequency limit * Reduce resonance by limiting the frequency of small zigzag infill moves. * See https://hydraraptor.blogspot.com/2010/12/frequency-limit.html - * Use M201 F G to change limits at runtime. + * Use M201 F S to change limits at runtime. */ //#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F. #ifdef XY_FREQUENCY_LIMIT - #define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 G. + #define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 S. #endif // @@ -2698,7 +2698,7 @@ * This feature is EXPERIMENTAL so use with caution and test thoroughly. * Enable this option to receive data on the serial ports via the onboard DMA * controller for more stable and reliable high-speed serial communication. - * Only some STM32 MCUs are currently supported. + * Support is currently limited to some STM32 MCUs and all HC32 MCUs. * Note: This has no effect on emulated USB serial ports. */ //#define SERIAL_DMA @@ -3558,7 +3558,7 @@ * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and * to set spindle speed, spindle direction, and laser power. * - * SuperPid is a router/spindle speed controller used in the CNC milling community. + * SuperPID is a router/spindle speed controller used in the CNC milling community. * Marlin can be used to turn the spindle on and off. It can also be used to set * the spindle speed from 5,000 to 30,000 RPM. * @@ -4261,7 +4261,8 @@ /** * Instant freeze / unfreeze functionality - * Potentially useful for emergency stop that allows being resumed. + * Potentially useful for rapid stop that allows being resumed. Halts stepper movement. + * Note this does NOT pause spindles, lasers, fans, heaters or any other auxiliary device. * @section interface */ //#define FREEZE_FEATURE @@ -4308,6 +4309,7 @@ // See class CodeProfiler. //#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multi-stepping 1 to 128 on this LED matrix row. //#define MAX7219_DEBUG_SLOWDOWN 6 // Count (mod 16) how many times SLOWDOWN has reduced print speed. + //#define MAX7219_REINIT_ON_POWERUP // Re-initialize MAX7129 when power supply turns on #endif /** @@ -4341,7 +4343,7 @@ * Extras for an ESP32-based motherboard with WIFISUPPORT * These options don't apply to add-on WiFi modules based on ESP32 WiFi101. */ -#if ENABLED(WIFISUPPORT) +#if ANY(WIFISUPPORT, ESP3D_WIFISUPPORT) //#define WEBSUPPORT // Start a webserver (which may include auto-discovery) using SPIFFS //#define OTASUPPORT // Support over-the-air firmware updates //#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host diff --git a/Marlin/Version.h b/Marlin/Version.h index e3dc44bc9d06..0ebed0426e8e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2024-02-28" +//#define STRING_DISTRIBUTION_DATE "2024-04-25" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/HAL/HC32/MarlinHAL.cpp b/Marlin/src/HAL/HC32/MarlinHAL.cpp index 1ab374fbf15c..acb96dadc600 100644 --- a/Marlin/src/HAL/HC32/MarlinHAL.cpp +++ b/Marlin/src/HAL/HC32/MarlinHAL.cpp @@ -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 diff --git a/Marlin/src/HAL/HC32/MarlinSerial.cpp b/Marlin/src/HAL/HC32/MarlinSerial.cpp index eb203f79d3ba..11d4abfab969 100644 --- a/Marlin/src/HAL/HC32/MarlinSerial.cpp +++ b/Marlin/src/HAL/HC32/MarlinSerial.cpp @@ -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 diff --git a/Marlin/src/HAL/HC32/MarlinSerial.h b/Marlin/src/HAL/HC32/MarlinSerial.h index 08eeef43951e..bb4630eb1d52 100644 --- a/Marlin/src/HAL/HC32/MarlinSerial.h +++ b/Marlin/src/HAL/HC32/MarlinSerial.h @@ -25,17 +25,42 @@ #include // 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 MSerialT; diff --git a/Marlin/src/HAL/HC32/app_config.h b/Marlin/src/HAL/HC32/app_config.h new file mode 100644 index 000000000000..69d7f60646e9 --- /dev/null +++ b/Marlin/src/HAL/HC32/app_config.h @@ -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_ diff --git a/Marlin/src/HAL/HC32/inc/SanityCheck.h b/Marlin/src/HAL/HC32/inc/SanityCheck.h index ef8d9a997583..6b12e4d04718 100644 --- a/Marlin/src/HAL/HC32/inc/SanityCheck.h +++ b/Marlin/src/HAL/HC32/inc/SanityCheck.h @@ -20,6 +20,20 @@ * */ #pragma once +#include + +#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 diff --git a/Marlin/src/HAL/HC32/sdio.cpp b/Marlin/src/HAL/HC32/sdio.cpp index 4360d715ff19..3c4038f92d4f 100644 --- a/Marlin/src/HAL/HC32/sdio.cpp +++ b/Marlin/src/HAL/HC32/sdio.cpp @@ -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); diff --git a/Marlin/src/HAL/LINUX/hardware/Timer.cpp b/Marlin/src/HAL/LINUX/hardware/Timer.cpp index 9f0d6a8f3ae2..013690a404bf 100644 --- a/Marlin/src/HAL/LINUX/hardware/Timer.cpp +++ b/Marlin/src/HAL/LINUX/hardware/Timer.cpp @@ -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) { diff --git a/Marlin/src/HAL/LINUX/main.cpp b/Marlin/src/HAL/LINUX/main.cpp index f2af2ff33f52..27a066d619ce 100644 --- a/Marlin/src/HAL/LINUX/main.cpp +++ b/Marlin/src/HAL/LINUX/main.cpp @@ -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__ diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 53a74871efbb..2dba3944e5cf 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -77,8 +77,6 @@ #include "lcd/e3v2/common/encoder.h" #if ENABLED(DWIN_CREALITY_LCD) #include "lcd/e3v2/creality/dwin.h" - #elif ENABLED(DWIN_LCD_PROUI) - #include "lcd/e3v2/proui/dwin.h" #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) #include "lcd/e3v2/jyersui/dwin.h" #endif @@ -268,7 +266,7 @@ PGMSTR(M112_KILL_STR, "M112 Shutdown"); MarlinState marlin_state = MF_INITIALIZING; // For M109 and M190, this flag may be cleared (by M108) to exit the wait loop -bool wait_for_heatup = true; +bool wait_for_heatup = false; // For M0/M1, this flag may be cleared (by M108) to exit the wait-for-user loop #if HAS_RESUME_CONTINUE @@ -476,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) @@ -671,6 +674,12 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { TERN_(HOTEND_IDLE_TIMEOUT, hotend_idle.check()); + #if ANY(PSU_CONTROL, AUTO_POWER_CONTROL) && PIN_EXISTS(PS_ON_EDM) + if ( ELAPSED(ms, powerManager.last_state_change_ms + PS_EDM_RESPONSE) + && (READ(PS_ON_PIN) != READ(PS_ON_EDM_PIN) || TERN0(PSU_OFF_REDUNDANT, extDigitalRead(PS_ON1_PIN) != extDigitalRead(PS_ON1_EDM_PIN))) + ) kill(GET_TEXT_F(MSG_POWER_EDM_FAULT)); + #endif + #if ENABLED(EXTRUDER_RUNOUT_PREVENT) if (thermalManager.degHotend(active_extruder) > (EXTRUDER_RUNOUT_MINTEMP) && ELAPSED(ms, gcode.previous_move_ms + SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS)) @@ -1588,11 +1597,11 @@ void setup() { SERIAL_ECHO_TERNARY(err, "BL24CXX Check ", "failed", "succeeded", "!\n"); #endif - #if HAS_DWIN_E3V2_BASIC + #if ENABLED(DWIN_CREALITY_LCD) SETUP_RUN(dwinInitScreen()); #endif - #if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC + #if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD) SETUP_RUN(ui.reset_status(true)); // Show service messages or keep current status #endif diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 1dfcabdefb86..cef30c5cd226 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -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 diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index e67644e52fc6..85fd517b68d8 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -159,7 +159,7 @@ template struct IF { typedef L type; }; // General Flags for some number of states template struct Flags { - typedef uvalue_t(N) flagbits_t; + typedef bits_t(N) flagbits_t; typedef struct { bool b0:1, b1:1, b2:1, b3:1, b4:1, b5:1, b6:1, b7:1; } N8; typedef struct { bool b0:1, b1:1, b2:1, b3:1, b4:1, b5:1, b6:1, b7:1, b8:1, b9:1, b10:1, b11:1, b12:1, b13:1, b14:1, b15:1; } N16; typedef struct { bool b0:1, b1:1, b2:1, b3:1, b4:1, b5:1, b6:1, b7:1, b8:1, b9:1, b10:1, b11:1, b12:1, b13:1, b14:1, b15:1, @@ -449,7 +449,7 @@ struct XYval { // Length reduced to one dimension FI constexpr T magnitude() const { return (T)sqrtf(x*x + y*y); } // Pointer to the data as a simple array - FI operator T* () { return pos; } + explicit FI operator T* () { return pos; } // If any element is true then it's true FI constexpr operator bool() const { return x || y; } // Smallest element @@ -599,7 +599,7 @@ struct XYZval { // Length reduced to one dimension FI constexpr T magnitude() const { return (T)TERN(HAS_X_AXIS, sqrtf(NUM_AXIS_GANG(x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)), 0); } // Pointer to the data as a simple array - FI operator T* () { return pos; } + explicit FI operator T* () { return pos; } // If any element is true then it's true FI constexpr operator bool() const { return 0 NUM_AXIS_GANG(|| x, || y, || z, || i, || j, || k, || u, || v, || w); } // Smallest element @@ -747,7 +747,7 @@ struct XYZEval { // Length reduced to one dimension FI constexpr T magnitude() const { return (T)sqrtf(LOGICAL_AXIS_GANG(+ e*e, + x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)); } // Pointer to the data as a simple array - FI operator T* () { return pos; } + explicit FI operator T* () { return pos; } // If any element is true then it's true FI constexpr operator bool() const { return 0 LOGICAL_AXIS_GANG(|| e, || x, || y, || z, || i, || j, || k, || u, || v, || w); } // Smallest element diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp index f40cbccadd79..14216ac4244e 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp @@ -63,7 +63,7 @@ */ void mesh_bed_leveling::line_to_destination(const_feedRate_t scaled_fr_mm_s, uint8_t x_splits, uint8_t y_splits) { // Get current and destination cells for this line - xy_int8_t scel = cell_indexes(current_position), ecel = cell_indexes(destination); + xy_uint8_t scel = cell_indexes(current_position), ecel = cell_indexes(destination); NOMORE(scel.x, GRID_MAX_CELLS_X - 1); NOMORE(scel.y, GRID_MAX_CELLS_Y - 1); NOMORE(ecel.x, GRID_MAX_CELLS_X - 1); @@ -80,7 +80,7 @@ float normalized_dist; xyze_pos_t dest; - const int8_t gcx = _MAX(scel.x, ecel.x), gcy = _MAX(scel.y, ecel.y); + const uint8_t gcx = _MAX(scel.x, ecel.x), gcy = _MAX(scel.y, ecel.y); // Crosses on the X and not already split on this X? // The x_splits flags are insurance against rounding errors. diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 7377f7dfc03a..b08cb812f83c 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -95,7 +95,7 @@ class unified_bed_leveling { static void report_current_mesh(); static void report_state(); static void save_ubl_active_state_and_disable(); - static void restore_ubl_active_state_and_leave(); + static void restore_ubl_active_state(const bool is_done=true); static void display_map(const uint8_t) __O0; static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const xy_pos_t&, const bool=false, MeshFlags *done_flags=nullptr) __O0; static mesh_index_pair find_furthest_invalid_mesh_point() __O0; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 2e7ea743273f..fcf408b34ed1 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -309,7 +309,7 @@ void unified_bed_leveling::G29() { #if ALL(DWIN_LCD_PROUI, ZHOME_BEFORE_LEVELING) save_ubl_active_state_and_disable(); gcode.process_subcommands_now(F("G28Z")); - restore_ubl_active_state_and_leave(); + restore_ubl_active_state(false); // ...without telling ExtUI "done" #else // Send 'N' to force homing before G29 (internal only) if (axes_should_home() || parser.seen_test('N')) gcode.home_all_axes(); @@ -425,7 +425,7 @@ void unified_bed_leveling::G29() { if (parser.seen_test('J')) { save_ubl_active_state_and_disable(); tilt_mesh_based_on_probed_grid(param.J_grid_size == 0); // Zero size does 3-Point - restore_ubl_active_state_and_leave(); + restore_ubl_active_state(); #if ENABLED(UBL_G29_J_RECENTER) do_blocking_move_to_xy(0.5f * ((MESH_MIN_X) + (MESH_MAX_X)), 0.5f * ((MESH_MIN_Y) + (MESH_MAX_Y))); #endif @@ -754,7 +754,6 @@ void unified_bed_leveling::shift_mesh_height() { TERN_(HAS_MARLINUI_MENU, ui.capture()); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); - TERN_(DWIN_LCD_PROUI, dwinLevelingStart()); save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained grid_count_t count = GRID_MAX_POINTS; @@ -768,7 +767,6 @@ void unified_bed_leveling::shift_mesh_height() { SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, "."); TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS))); TERN_(HAS_BACKLIGHT_TIMEOUT, ui.refresh_backlight_timeout()); - TERN_(DWIN_LCD_PROUI, dwinRedrawScreen()); #if HAS_MARLINUI_MENU if (ui.button_pressed()) { @@ -778,8 +776,7 @@ void unified_bed_leveling::shift_mesh_height() { ui.quick_feedback(); ui.release(); probe.stow(); // Release UI before stow to allow for PAUSE_BEFORE_DEPLOY_STOW - TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); - return restore_ubl_active_state_and_leave(); + return restore_ubl_active_state(); } #endif @@ -815,15 +812,12 @@ void unified_bed_leveling::shift_mesh_height() { probe.move_z_after_probing(); - restore_ubl_active_state_and_leave(); - do_blocking_move_to_xy( constrain(nearby.x - probe.offset_xy.x, MESH_MIN_X, MESH_MAX_X), constrain(nearby.y - probe.offset_xy.y, MESH_MIN_Y, MESH_MAX_Y) ); - TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); - TERN_(DWIN_LCD_PROUI, dwinLevelingDone()); + restore_ubl_active_state(); } #endif // HAS_BED_PROBE @@ -932,7 +926,7 @@ void set_message_with_feedback(FSTR_P const fstr) { if (param.V_verbosity > 1) SERIAL_ECHOLNPGM("Business Card is ", p_float_t(thickness, 4), "mm thick."); - restore_ubl_active_state_and_leave(); + restore_ubl_active_state(); return thickness; } @@ -987,7 +981,7 @@ void set_message_with_feedback(FSTR_P const fstr) { if (_click_and_hold([]{ SERIAL_ECHOLNPGM("\nMesh only partially populated."); do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE); - })) return restore_ubl_active_state_and_leave(); + })) return restore_ubl_active_state(); // Store the Z position minus the shim height z_values[lpos.x][lpos.y] = current_position.z - thick; @@ -1002,10 +996,8 @@ void set_message_with_feedback(FSTR_P const fstr) { if (do_ubl_mesh_map) display_map(param.T_map_type); // show user where we're probing - restore_ubl_active_state_and_leave(); + restore_ubl_active_state(); do_blocking_move_to_xy_z(pos, Z_CLEARANCE_DEPLOY_PROBE); - - TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); } /** @@ -1111,7 +1103,7 @@ void set_message_with_feedback(FSTR_P const fstr) { } while (lpos.x >= 0 && --param.R_repetition > 0); if (do_ubl_mesh_map) display_map(param.T_map_type); - restore_ubl_active_state_and_leave(); + restore_ubl_active_state(); do_blocking_move_to_xy_z(pos, Z_TWEEN_SAFE_CLEARANCE); @@ -1263,17 +1255,20 @@ void unified_bed_leveling::save_ubl_active_state_and_disable() { set_bed_leveling_enabled(false); } -void unified_bed_leveling::restore_ubl_active_state_and_leave() { +void unified_bed_leveling::restore_ubl_active_state(const bool is_done/*=true*/) { TERN_(HAS_MARLINUI_MENU, ui.release()); #if ENABLED(UBL_DEVEL_DEBUGGING) if (--ubl_state_recursion_chk) { - SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times."); + SERIAL_ECHOLNPGM("restore_ubl_active_state() called too many times."); set_message_with_feedback(GET_TEXT_F(MSG_UBL_RESTORE_ERROR)); return; } #endif set_bed_leveling_enabled(ubl_state_at_invocation); - TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); + + if (is_done) { + TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); + } } mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() { diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index cc5face2594d..538aa92e91e7 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -186,13 +186,13 @@ void HostUI::action(FSTR_P const fstr, const bool eol) { switch (response) { case 0: // "Purge More" button - #if ALL(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE) + #if ENABLED(M600_PURGE_MORE_RESUMABLE) pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // Simulate menu selection (menu exits, doesn't extrude more) #endif break; case 1: // "Continue" / "Disable Runout" button - #if ALL(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE) + #if ENABLED(M600_PURGE_MORE_RESUMABLE) pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; // Simulate menu selection #endif #if HAS_FILAMENT_SENSOR diff --git a/Marlin/src/feature/leds/printer_event_leds.h b/Marlin/src/feature/leds/printer_event_leds.h index 3a037eba96e5..856826b969e3 100644 --- a/Marlin/src/feature/leds/printer_event_leds.h +++ b/Marlin/src/feature/leds/printer_event_leds.h @@ -56,7 +56,7 @@ class PrinterEventLEDs { #if HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER static void onHeatingDone() { leds.set_white(); } - static void onPidTuningDone(LEDColor c) { leds.set_color(c); } + static void onPIDTuningDone(LEDColor c) { leds.set_color(c); } #endif #if HAS_MEDIA diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index 6089b1a86e85..64960f1dfe73 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -72,6 +72,26 @@ uint16_t CodeProfiler::call_count = 0; #endif +#if defined(MAX7219_DEBUG_PLANNER_HEAD) && defined(MAX7219_DEBUG_PLANNER_TAIL) && MAX7219_DEBUG_PLANNER_HEAD == MAX7219_DEBUG_PLANNER_TAIL + static int16_t last_head_cnt = 0xF, last_tail_cnt = 0xF; +#else + #ifdef MAX7219_DEBUG_PLANNER_HEAD + static int16_t last_head_cnt = 0x1; + #endif + #ifdef MAX7219_DEBUG_PLANNER_TAIL + static int16_t last_tail_cnt = 0x1; + #endif +#endif +#ifdef MAX7219_DEBUG_PLANNER_QUEUE + static int16_t last_depth = 0; +#endif +#ifdef MAX7219_DEBUG_PROFILE + static uint8_t last_time_fraction = 0; +#endif +#ifdef MAX7219_DEBUG_MULTISTEPPING + static uint8_t last_multistepping = 0; +#endif + Max7219 max7219; uint8_t Max7219::led_line[MAX7219_LINES]; // = { 0 }; @@ -550,6 +570,29 @@ void Max7219::init() { #if MAX7219_INIT_TEST start_test_pattern(); #endif + + #ifdef MAX7219_REINIT_ON_POWERUP + #if defined(MAX7219_DEBUG_PLANNER_HEAD) && defined(MAX7219_DEBUG_PLANNER_TAIL) && MAX7219_DEBUG_PLANNER_HEAD == MAX7219_DEBUG_PLANNER_TAIL + last_head_cnt = 0xF; + last_tail_cnt = 0xF; + #else + #ifdef MAX7219_DEBUG_PLANNER_HEAD + last_head_cnt = 0x1; + #endif + #ifdef MAX7219_DEBUG_PLANNER_TAIL + last_tail_cnt = 0x1; + #endif + #endif + #ifdef MAX7219_DEBUG_PLANNER_QUEUE + last_depth = 0; + #endif + #ifdef MAX7219_DEBUG_PROFILE + last_time_fraction = 0; + #endif + #ifdef MAX7219_DEBUG_MULTISTEPPING + last_multistepping = 0; + #endif + #endif } /** @@ -676,8 +719,6 @@ void Max7219::idle_tasks() { #if defined(MAX7219_DEBUG_PLANNER_HEAD) && defined(MAX7219_DEBUG_PLANNER_TAIL) && MAX7219_DEBUG_PLANNER_HEAD == MAX7219_DEBUG_PLANNER_TAIL - static int16_t last_head_cnt = 0xF, last_tail_cnt = 0xF; - if (last_head_cnt != head || last_tail_cnt != tail) { range16(MAX7219_DEBUG_PLANNER_HEAD, last_tail_cnt, tail, last_head_cnt, head, &row_change_mask); last_head_cnt = head; @@ -687,7 +728,6 @@ void Max7219::idle_tasks() { #else #ifdef MAX7219_DEBUG_PLANNER_HEAD - static int16_t last_head_cnt = 0x1; if (last_head_cnt != head) { mark16(MAX7219_DEBUG_PLANNER_HEAD, last_head_cnt, head, &row_change_mask); last_head_cnt = head; @@ -695,7 +735,6 @@ void Max7219::idle_tasks() { #endif #ifdef MAX7219_DEBUG_PLANNER_TAIL - static int16_t last_tail_cnt = 0x1; if (last_tail_cnt != tail) { mark16(MAX7219_DEBUG_PLANNER_TAIL, last_tail_cnt, tail, &row_change_mask); last_tail_cnt = tail; @@ -714,7 +753,6 @@ void Max7219::idle_tasks() { #endif #ifdef MAX7219_DEBUG_PROFILE - static uint8_t last_time_fraction = 0; const uint8_t current_time_fraction = (uint16_t(CodeProfiler::get_time_fraction()) * MAX7219_NUMBER_UNITS + 8) / 16; if (current_time_fraction != last_time_fraction) { quantity(MAX7219_DEBUG_PROFILE, last_time_fraction, current_time_fraction, &row_change_mask); diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 8756c339e3c1..74a4f236c0a9 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -23,6 +23,8 @@ /** * feature/pause.cpp - Pause feature support functions * This may be combined with related G-codes if features are consolidated. + * + * Note: Calls to ui.pause_show_message are passed to either ExtUI or MarlinUI. */ #include "../inc/MarlinConfigPre.h" @@ -60,8 +62,6 @@ #if ENABLED(EXTENSIBLE_UI) #include "../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../lcd/e3v2/proui/dwin.h" #endif #include "../lcd/marlinui.h" @@ -148,7 +148,7 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder); #endif - ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode); UNUSED(mode); + ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode); if (wait) return thermalManager.wait_for_hotend(active_extruder); @@ -288,8 +288,8 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load // Show "Purge More" / "Resume" menu and wait for reply KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = false; - #if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) - ui.pause_show_message(PAUSE_MESSAGE_OPTION); // Also sets PAUSE_RESPONSE_WAIT_FOR + #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI) + ui.pause_show_message(PAUSE_MESSAGE_OPTION); // MarlinUI and MKS UI also set PAUSE_RESPONSE_WAIT_FOR #else pause_menu_response = PAUSE_RESPONSE_WAIT_FOR; #endif diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 304c8a611d13..4d968406c272 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -52,10 +52,12 @@ enum PauseMessage : char { PAUSE_MESSAGE_RESUME, PAUSE_MESSAGE_HEAT, PAUSE_MESSAGE_HEATING, - PAUSE_MESSAGE_STATUS + PAUSE_MESSAGE_STATUS, + PAUSE_MESSAGE_COUNT }; #if M600_PURGE_MORE_RESUMABLE + // Input methods can Purge More, Resume, or request input enum PauseMenuResponse : char { PAUSE_RESPONSE_WAIT_FOR, PAUSE_RESPONSE_EXTRUDE_MORE, @@ -105,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 @@ -114,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? diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp index a9655029fbeb..20eb63a6f160 100644 --- a/Marlin/src/feature/power.cpp +++ b/Marlin/src/feature/power.cpp @@ -34,6 +34,10 @@ #include "../module/temperature.h" #include "../MarlinCore.h" +#if ENABLED(MAX7219_REINIT_ON_POWERUP) + #include "max7219.h" +#endif + #if ENABLED(PS_OFF_SOUND) #include "../libs/buzzer.h" #endif @@ -60,6 +64,10 @@ bool Power::psu_on; millis_t Power::lastPowerOn; #endif +#if PSU_TRACK_STATE_MS + millis_t Power::last_state_change_ms = 0; +#endif + /** * Initialize pins & state for the power manager. * @@ -87,9 +95,18 @@ void Power::power_on() { #endif OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_STATE); + #if ENABLED(PSU_OFF_REDUNDANT) + OUT_WRITE(PS_ON1_PIN, TERN_(PSU_OFF_REDUNDANT_INVERTED, !)PSU_ACTIVE_STATE); + #endif + TERN_(PSU_TRACK_STATE_MS, last_state_change_ms = millis()); + psu_on = true; safe_delay(PSU_POWERUP_DELAY); + restore_stepper_drivers(); + + TERN_(MAX7219_REINIT_ON_POWERUP, max7219.init()); + TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY)); #ifdef PSU_POWERUP_GCODE @@ -117,6 +134,11 @@ void Power::power_off() { #endif OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_STATE); + #if ENABLED(PSU_OFF_REDUNDANT) + OUT_WRITE(PS_ON1_PIN, IF_DISABLED(PSU_OFF_REDUNDANT_INVERTED, !)PSU_ACTIVE_STATE); + #endif + TERN_(PSU_TRACK_STATE_MS, last_state_change_ms = millis()); + psu_on = false; #if ANY(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) diff --git a/Marlin/src/feature/power.h b/Marlin/src/feature/power.h index fdbb7126ceae..16f9dbcef54f 100644 --- a/Marlin/src/feature/power.h +++ b/Marlin/src/feature/power.h @@ -24,8 +24,11 @@ /** * power.h - power control */ +#if PIN_EXISTS(PS_ON_EDM) || (PIN_EXISTS(PS_ON1_EDM) && ENABLED(PSU_OFF_REDUNDANT)) + #define PSU_TRACK_STATE_MS 1 +#endif -#if ANY(AUTO_POWER_CONTROL, POWER_OFF_TIMER) +#if ANY(AUTO_POWER_CONTROL, POWER_OFF_TIMER, PSU_TRACK_STATE_MS) #include "../core/millis_t.h" #endif @@ -37,6 +40,10 @@ class Power { static void power_on(); static void power_off(); + #if PSU_TRACK_STATE_MS + static millis_t last_state_change_ms; + #endif + #if ANY(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) #if ENABLED(POWER_OFF_TIMER) static millis_t power_off_time; diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index 70fac66fce39..1867aba6ed25 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -48,8 +48,8 @@ uint8_t PrintJobRecovery::queue_index_r; uint32_t PrintJobRecovery::cmd_sdpos, // = 0 PrintJobRecovery::sdpos[BUFSIZE]; -#if HAS_DWIN_E3V2_BASIC - bool PrintJobRecovery::dwin_flag; // = false +#if HAS_PLR_UI_FLAG + bool PrintJobRecovery::ui_flag_resume; // = false #endif #include "../sd/cardreader.h" diff --git a/Marlin/src/feature/powerloss.h b/Marlin/src/feature/powerloss.h index 579731ffddcb..7de8450c9146 100644 --- a/Marlin/src/feature/powerloss.h +++ b/Marlin/src/feature/powerloss.h @@ -151,8 +151,8 @@ class PrintJobRecovery { static uint32_t cmd_sdpos, //!< SD position of the next command sdpos[BUFSIZE]; //!< SD positions of queued commands - #if HAS_DWIN_E3V2_BASIC - static bool dwin_flag; + #if HAS_PLR_UI_FLAG + static bool ui_flag_resume; //!< Flag the UI to show a dialog to Resume (M1000) or Cancel (M1000C) #endif static void init(); diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index 1d684c6b856a..2bcb47e99a83 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -68,8 +68,6 @@ bool FilamentMonitorBase::enabled = true, #if ENABLED(EXTENSIBLE_UI) #include "../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../lcd/e3v2/proui/dwin.h" #endif void event_filament_runout(const uint8_t extruder) { @@ -88,7 +86,6 @@ void event_filament_runout(const uint8_t extruder) { #endif TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder))); - TERN_(DWIN_LCD_PROUI, dwinFilamentRunout(extruder)); #if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR) const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder); diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index a0a72058aa2d..7ed070c9b8ca 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -144,15 +144,13 @@ class TMCMarlin : public TMC, public TMCStorage { #endif #endif - #if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) - void refresh_stepper_current() { rms_current(this->val_mA); } + void refresh_stepper_current() { rms_current(this->val_mA); } - #if ENABLED(HYBRID_THRESHOLD) - void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); } - #endif - #if USE_SENSORLESS - void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); } - #endif + #if ENABLED(HYBRID_THRESHOLD) + void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); } + #endif + #if USE_SENSORLESS + void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); } #endif static constexpr int8_t sgt_min = -64, @@ -207,12 +205,10 @@ class TMCMarlin : public TMC220 } #endif - #if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) - void refresh_stepper_current() { rms_current(this->val_mA); } + void refresh_stepper_current() { rms_current(this->val_mA); } - #if ENABLED(HYBRID_THRESHOLD) - void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); } - #endif + #if ENABLED(HYBRID_THRESHOLD) + void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); } #endif }; @@ -269,15 +265,13 @@ class TMCMarlin : public TMC220 } #endif - #if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) - void refresh_stepper_current() { rms_current(this->val_mA); } + void refresh_stepper_current() { rms_current(this->val_mA); } - #if ENABLED(HYBRID_THRESHOLD) - void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); } - #endif - #if USE_SENSORLESS - void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); } - #endif + #if ENABLED(HYBRID_THRESHOLD) + void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); } + #endif + #if USE_SENSORLESS + void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); } #endif static constexpr uint8_t sgt_min = 0, @@ -315,12 +309,10 @@ class TMCMarlin : public TMC266 } #endif - #if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) - void refresh_stepper_current() { rms_current(this->val_mA); } + void refresh_stepper_current() { rms_current(this->val_mA); } - #if USE_SENSORLESS - void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); } - #endif + #if USE_SENSORLESS + void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); } #endif static constexpr int8_t sgt_min = -64, diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 63a1491f9bb1..c1a329fb8ac0 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -95,9 +95,11 @@ void GcodeSuite::G35() { for (uint8_t i = 0; i < G35_PROBE_COUNT; ++i) { const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE); if (isnan(z_probed_height)) { - SERIAL_ECHO( - F("G35 failed at point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), C(')'), - FPSTR(SP_X_STR), tramming_points[i].x, FPSTR(SP_Y_STR), tramming_points[i].y + SERIAL_ECHOLN( + F("G35 failed at point "), i + 1, + F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), C(')'), + FPSTR(SP_X_STR), tramming_points[i].x, + FPSTR(SP_Y_STR), tramming_points[i].y ); err_break = true; break; diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 3126bee47f84..449c25fefdc3 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -51,8 +51,6 @@ #include "../../../lcd/extui/ui_api.h" #elif ENABLED(DWIN_CREALITY_LCD) #include "../../../lcd/e3v2/creality/dwin.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../../../lcd/e3v2/proui/dwin.h" #endif #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) @@ -77,7 +75,7 @@ static void pre_g29_return(const bool retry, const bool did) { TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false)); } if (did) { - TERN_(HAS_DWIN_E3V2_BASIC, dwinLevelingDone()); + TERN_(DWIN_CREALITY_LCD, dwinLevelingDone()); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); } } @@ -425,8 +423,6 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(AUTO_BED_LEVELING_3POINT) if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling"); points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points - #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - TERN_(DWIN_LCD_PROUI, dwinLevelingStart()); #endif TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); @@ -436,11 +432,7 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(PREHEAT_BEFORE_LEVELING) if (!abl.dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, - #if ALL(DWIN_LCD_PROUI, HAS_HEATED_BED) - hmiData.bedLevT - #else - LEVELING_BED_TEMP - #endif + TERN(EXTENSIBLE_UI, ExtUI::getLevelingBedTemp(), LEVELING_BED_TEMP) ); #endif } diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index b3f03d03ba43..c9c04b4f0ca0 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -40,8 +40,6 @@ #if ENABLED(EXTENSIBLE_UI) #include "../../../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../../../lcd/e3v2/proui/dwin.h" #endif #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) @@ -144,7 +142,6 @@ void GcodeSuite::G29() { queue.inject(F("G29S2")); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); - TERN_(DWIN_LCD_PROUI, dwinLevelingStart()); return; } @@ -170,7 +167,6 @@ void GcodeSuite::G29() { // Save Z for the previous mesh position bedlevel.set_zigzag_z(mbl_probe_index - 1, current_position.z); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z)); - TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z)); SET_SOFT_ENDSTOP_LOOSE(false); } // If there's another point to sample, move there with optional lift. @@ -237,7 +233,6 @@ void GcodeSuite::G29() { if (parser.seenval('Z')) { bedlevel.z_values[ix][iy] = parser.value_linear_units(); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); - TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); } else return echo_not_entered('Z'); diff --git a/Marlin/src/gcode/bedlevel/ubl/M421.cpp b/Marlin/src/gcode/bedlevel/ubl/M421.cpp index 3a5aa8cb038c..99ba3ce19b46 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/ubl/M421.cpp @@ -33,8 +33,6 @@ #if ENABLED(EXTENSIBLE_UI) #include "../../../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../../../lcd/e3v2/proui/dwin.h" #endif /** @@ -69,7 +67,6 @@ void GcodeSuite::M421() { float &zval = bedlevel.z_values[ij.x][ij.y]; // Altering this Mesh Point zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0); // N=NAN, Z=NEWVAL, or Q=ADDVAL TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval)); // Ping ExtUI in case it's showing the mesh - TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(ij.x, ij.y, zval)); } } diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 55698c942bd4..0ab1ca610578 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -52,8 +52,6 @@ #include "../../lcd/extui/ui_api.h" #elif ENABLED(DWIN_CREALITY_LCD) #include "../../lcd/e3v2/creality/dwin.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../../lcd/e3v2/proui/dwin.h" #endif #if ENABLED(LASER_FEATURE) @@ -223,7 +221,7 @@ void GcodeSuite::G28() { set_and_report_grblstate(M_HOMING); #endif - TERN_(HAS_DWIN_E3V2_BASIC, dwinHomingStart()); + TERN_(DWIN_CREALITY_LCD, dwinHomingStart()); TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart()); planner.synchronize(); // Wait for planner moves to finish! @@ -652,7 +650,7 @@ void GcodeSuite::G28() { ui.refresh(); - TERN_(HAS_DWIN_E3V2_BASIC, dwinHomingDone()); + TERN_(DWIN_CREALITY_LCD, dwinHomingDone()); TERN_(EXTENSIBLE_UI, ExtUI::onHomingDone()); report_current_position(); diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 8b94dd53921b..7a27a61b9d71 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -115,8 +115,8 @@ void GcodeSuite::G34() { } const float z_auto_align_accuracy = parser.floatval('T', Z_STEPPER_ALIGN_ACC); - if (!WITHIN(z_auto_align_accuracy, 0.01f, 1.0f)) { - SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(T)arget accuracy out of bounds (0.01-1.0).")); + if (!WITHIN(z_auto_align_accuracy, 0.001f, 1.0f)) { + SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(T)arget accuracy out of bounds (0.001-1.0).")); break; } diff --git a/Marlin/src/gcode/config/M302.cpp b/Marlin/src/gcode/config/M302.cpp index 3373e143251c..0648f3edca50 100644 --- a/Marlin/src/gcode/config/M302.cpp +++ b/Marlin/src/gcode/config/M302.cpp @@ -25,12 +25,13 @@ #if ENABLED(PREVENT_COLD_EXTRUSION) #include "../gcode.h" -#include "../../module/temperature.h" -#if ENABLED(DWIN_LCD_PROUI) - #include "../../lcd/e3v2/proui/dwin.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extui/ui_api.h" #endif +#include "../../module/temperature.h" + /** * M302: Allow cold extrudes, or set the minimum extrude temperature * @@ -50,13 +51,14 @@ void GcodeSuite::M302() { const bool seen_S = parser.seen('S'); if (seen_S) { thermalManager.extrude_min_temp = parser.value_celsius(); - thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0); - TERN_(DWIN_LCD_PROUI, hmiData.extMinT = thermalManager.extrude_min_temp); + TERN_(EXTENSIBLE_UI, ExtUI::onSetMinExtrusionTemp(thermalManager.extrude_min_temp)); } - if (parser.seen('P')) - thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0) || parser.value_bool(); - else if (!seen_S) { + const bool seen_P = parser.seen('P'); + if (seen_P || seen_S) { + thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0) || (seen_P && parser.value_bool()); + } + else { // Report current state SERIAL_ECHO_START(); SERIAL_ECHOLN(F("Cold extrudes are "), thermalManager.allow_cold_extrude ? F("en") : F("dis"), F("abled (min temp "), thermalManager.extrude_min_temp, F("C)")); diff --git a/Marlin/src/gcode/control/M10-M11.cpp b/Marlin/src/gcode/control/M10_M11.cpp similarity index 95% rename from Marlin/src/gcode/control/M10-M11.cpp rename to Marlin/src/gcode/control/M10_M11.cpp index d5a69dcfccfb..8fd299c5465b 100644 --- a/Marlin/src/gcode/control/M10-M11.cpp +++ b/Marlin/src/gcode/control/M10_M11.cpp @@ -20,6 +20,11 @@ * */ +/** + * gcode/control/M10_M11.cpp + * Air Evacuation + */ + #include "../../inc/MarlinConfig.h" #if ENABLED(AIR_EVACUATION) diff --git a/Marlin/src/gcode/control/M997.cpp b/Marlin/src/gcode/control/M997.cpp index 5ac0ba23bbca..c651961902f4 100644 --- a/Marlin/src/gcode/control/M997.cpp +++ b/Marlin/src/gcode/control/M997.cpp @@ -24,8 +24,8 @@ #if ENABLED(PLATFORM_M997_SUPPORT) -#if ENABLED(DWIN_LCD_PROUI) - #include "../../lcd/e3v2/proui/dwin.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extui/ui_api.h" #endif /** @@ -33,7 +33,7 @@ */ void GcodeSuite::M997() { - TERN_(DWIN_LCD_PROUI, dwinRebootScreen()); + TERN_(EXTENSIBLE_UI, ExtUI::onFirmwareFlash()); flashFirmware(parser.intval('S')); diff --git a/Marlin/src/gcode/feature/digipot/M907-M910.cpp b/Marlin/src/gcode/feature/digipot/M907-M910.cpp index 55d43f1b416f..e36cf76e88e1 100644 --- a/Marlin/src/gcode/feature/digipot/M907-M910.cpp +++ b/Marlin/src/gcode/feature/digipot/M907-M910.cpp @@ -133,7 +133,9 @@ void GcodeSuite::M907() { SERIAL_ECHOLNPGM_P( // PWM-based has 3 values: PSTR(" M907 X"), stepper.motor_current_setting[0] // X, Y, (I, J, K, U, V, W) , SP_Z_STR, stepper.motor_current_setting[1] // Z - , SP_E_STR, stepper.motor_current_setting[2] // E + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + , SP_E_STR, stepper.motor_current_setting[2] // E + #endif ); #elif HAS_MOTOR_CURRENT_SPI SERIAL_ECHOPGM(" M907"); // SPI-based has 5 values: diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp index c735b72cedbb..c70bf7667ff8 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -37,8 +37,6 @@ #include "../../../lcd/extui/ui_api.h" #elif ENABLED(DWIN_CREALITY_LCD) #include "../../../lcd/e3v2/creality/dwin.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../../../lcd/e3v2/proui/dwin.h" #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) #include "../../../lcd/e3v2/jyersui/dwin.h" // Temporary fix until it can be better implemented #endif @@ -76,12 +74,12 @@ void GcodeSuite::M1000() { if (!force_resume && parser.seen_test('S')) { #if HAS_MARLINUI_MENU ui.goto_screen(menu_job_recovery); - #elif HAS_DWIN_E3V2_BASIC - recovery.dwin_flag = true; - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented - jyersDWIN.popupHandler(Popup_Resume); #elif ENABLED(EXTENSIBLE_UI) ExtUI::onPowerLossResume(); + #elif HAS_PLR_UI_FLAG + recovery.ui_flag_resume = true; + #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented + jyersDWIN.popupHandler(Popup_Resume); #else SERIAL_ECHO_MSG("Resume requires LCD."); #endif diff --git a/Marlin/src/gcode/feature/powerloss/M413.cpp b/Marlin/src/gcode/feature/powerloss/M413.cpp index 733a34484cb7..b12257b4e55b 100644 --- a/Marlin/src/gcode/feature/powerloss/M413.cpp +++ b/Marlin/src/gcode/feature/powerloss/M413.cpp @@ -72,6 +72,7 @@ void GcodeSuite::M413_report(const bool forReplay/*=true*/) { , " B", recovery.bed_temp_threshold #endif ); + SERIAL_ECHO(" ; "); serialprintln_onoff(recovery.enabled); } diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index 626441f4e25c..cfdff51eba14 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -42,7 +42,7 @@ * G92 : Modify Workspace Offsets so the reported position shows the given X [Y [Z [A [B [C [U [V [W ]]]]]]]] [E]. * G92.1 : Zero XYZ Workspace Offsets (so the reported position = the native position). * - * With POWER_LOSS_RECOVERY: + * With POWER_LOSS_RECOVERY or with AXISn_ROTATES: * G92.9 : Set NATIVE Current Position to the given X [Y [Z [A [B [C [U [V [W ]]]]]]]] [E]. */ void GcodeSuite::G92() { @@ -67,7 +67,7 @@ void GcodeSuite::G92() { break; #endif - #if ENABLED(POWER_LOSS_RECOVERY) + #if ANY(POWER_LOSS_RECOVERY, HAS_ROTATIONAL_AXES) case 9: // G92.9 - Set Current Position directly (like Marlin 1.0) LOOP_LOGICAL_AXES(i) { if (parser.seenval(AXIS_CHAR(i))) { diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index b2f3496a6807..0d38d3147bea 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -63,11 +63,25 @@ */ void GcodeSuite::M115() { + // Hosts should match one of these + #define MACHINE_KINEMATICS "" \ + TERN_(COREXY, "COREXY") TERN_(COREYX, "COREYX") \ + TERN_(COREXZ, "COREXZ") TERN_(COREZX, "COREZX") \ + TERN_(COREYZ, "COREYZ") TERN_(COREZY, "COREZY") \ + TERN_(MARKFORGED_XY, "MARKFORGED_XY") TERN_(MARKFORGED_YX, "MARKFORGED_YX") \ + TERN_(POLARGRAPH, "POLARGRAPH") \ + TERN_(POLAR, "POLAR") \ + TERN_(DELTA, "DELTA") \ + TERN_(IS_SCARA, "SCARA") \ + TERN_(IS_CARTESIAN, "Cartesian") \ + TERN_(BELTPRINTER, " BELTPRINTER") + SERIAL_ECHOPGM("FIRMWARE_NAME:Marlin" " " DETAILED_BUILD_VERSION " (" __DATE__ " " __TIME__ ")" " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME + " KINEMATICS:" MACHINE_KINEMATICS " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) #if NUM_AXES != XYZ " AXIS_COUNT:" STRINGIFY(NUM_AXES) diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index fcab61b59d92..c600bd5da659 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -35,9 +35,6 @@ #include "../../lcd/marlinui.h" #elif ENABLED(EXTENSIBLE_UI) #include "../../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../../lcd/e3v2/proui/dwin_popup.h" - #include "../../lcd/e3v2/proui/dwin.h" #endif #if ENABLED(HOST_PROMPT_SUPPORT) @@ -66,16 +63,20 @@ void GcodeSuite::M0_M1() { #endif } + #elif ENABLED(DWIN_LCD_PROUI) // ExtUI with icon, string, button title + + if (parser.string_arg) + ExtUI::onUserConfirmRequired(ICON_Continue_1, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); + else + ExtUI::onUserConfirmRequired(ICON_Stop_1, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); + #elif ENABLED(EXTENSIBLE_UI) + if (parser.string_arg) ExtUI::onUserConfirmRequired(parser.string_arg); // String in an SRAM buffer else ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT)); - #elif ENABLED(DWIN_LCD_PROUI) - if (parser.string_arg) - dwinPopupConfirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); - else - dwinPopupConfirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); + #else if (parser.string_arg) { diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp index 5ac2839beb4e..6f7447624098 100644 --- a/Marlin/src/gcode/lcd/M73.cpp +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -29,10 +29,6 @@ #include "../../sd/cardreader.h" #include "../../libs/numtostr.h" -#if ENABLED(DWIN_LCD_PROUI) - #include "../../lcd/e3v2/proui/dwin.h" -#endif - /** * M73: Set percentage complete (for display on LCD) * diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index e83df544c863..3ce37bed05d3 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -34,6 +34,10 @@ #include "../../feature/probe_temp_comp.h" #endif +#if ANY(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + #define VERBOSE_SINGLE_PROBE +#endif + /** * G30: Do a single Z probe at the given XY (default: current) * @@ -66,9 +70,7 @@ void GcodeSuite::G30() { remember_feedrate_scaling_off(); - #if ANY(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) - process_subcommands_now(F("G28O")); - #endif + TERN_(VERBOSE_SINGLE_PROBE, process_subcommands_now(F("G28O"))); const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE; @@ -83,9 +85,7 @@ void GcodeSuite::G30() { F( " Z:"), p_float_t(measured_z, 3) ); msg.echoln(); - #if ANY(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) - ui.set_status(msg); - #endif + TERN_(VERBOSE_SINGLE_PROBE, ui.set_status(msg)); } restore_feedrate_and_scaling(); diff --git a/Marlin/src/gcode/sd/M524.cpp b/Marlin/src/gcode/sd/M524.cpp index a3c03e90bab6..61185b7e0bed 100644 --- a/Marlin/src/gcode/sd/M524.cpp +++ b/Marlin/src/gcode/sd/M524.cpp @@ -27,8 +27,8 @@ #include "../gcode.h" #include "../../sd/cardreader.h" -#if ENABLED(DWIN_LCD_PROUI) - #include "../../lcd/marlinui.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extui/ui_api.h" #endif /** @@ -36,9 +36,9 @@ */ void GcodeSuite::M524() { - #if ENABLED(DWIN_LCD_PROUI) + #if ENABLED(EXTENSIBLE_UI) - ui.abort_print(); + ExtUI::stopPrint(); // Calls ui.abort_print() which does the same as below #else diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index bced97351dac..03e76d531d60 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -35,10 +35,14 @@ /** * M75: Start print timer + * + * ProUI: If the print fails to start and any text is + * included in the command, print it in the header. */ void GcodeSuite::M75() { - startOrResumeJob(); + startOrResumeJob(); // ... ExtUI::onPrintTimerStarted() #if ENABLED(DWIN_LCD_PROUI) + // TODO: Remove if M75 is never used if (!IS_SD_PRINTING()) dwinPrintHeader(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); #endif } @@ -47,7 +51,7 @@ void GcodeSuite::M75() { * M76: Pause print timer */ void GcodeSuite::M76() { - TERN(DWIN_LCD_PROUI, ui.pause_print(), print_job_timer.pause()); + print_job_timer.pause(); // ... ExtUI::onPrintTimerPaused() TERN_(HOST_PAUSE_M76, hostui.pause()); } diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index f9f3abc5bd4e..730ec65ba439 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -31,8 +31,6 @@ #if ENABLED(EXTENSIBLE_UI) #include "../../lcd/extui/ui_api.h" -#elif ENABLED(PROUI_PID_TUNE) - #include "../../lcd/e3v2/proui/dwin.h" #endif /** @@ -68,8 +66,7 @@ void GcodeSuite::M303() { default: SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_HEATER_ID)); - TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_BAD_HEATER_ID)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::pidresult_t::PID_BAD_HEATER_ID)); return; } @@ -79,7 +76,7 @@ void GcodeSuite::M303() { const celsius_t temp = seenS ? parser.value_celsius() : default_temp; const bool u = parser.boolval('U'); - TERN_(PROUI_PID_TUNE, dwinStartM303(seenC, c, seenS, hid, temp)); + TERN_(EXTENSIBLE_UI, ExtUI::onStartM303(c, hid, temp)); IF_DISABLED(BUSY_WHILE_HEATING, KEEPALIVE_STATE(NOT_BUSY)); diff --git a/Marlin/src/gcode/temp/M86-M87.cpp b/Marlin/src/gcode/temp/M86_M87.cpp similarity index 98% rename from Marlin/src/gcode/temp/M86-M87.cpp rename to Marlin/src/gcode/temp/M86_M87.cpp index a64358d21278..502052e87be9 100644 --- a/Marlin/src/gcode/temp/M86-M87.cpp +++ b/Marlin/src/gcode/temp/M86_M87.cpp @@ -21,7 +21,7 @@ */ /** - * gcode/temp/M86-M87.cpp + * gcode/temp/M86_M87.cpp * * Hotend Idle Timeout */ diff --git a/Marlin/src/inc/Changes.h b/Marlin/src/inc/Changes.h index dd8acc1ce5c3..101963893189 100644 --- a/Marlin/src/inc/Changes.h +++ b/Marlin/src/inc/Changes.h @@ -691,6 +691,8 @@ #error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING is now CTC_A10S_A13." #elif defined(Z_PROBE_END_SCRIPT) #error "Z_PROBE_END_SCRIPT is now EVENT_GCODE_AFTER_G29." +#elif defined(WIFI_SERIAL) + #error "WIFI_SERIAL is now WIFI_SERIAL_PORT." #endif // Changes to Probe Temp Compensation (#17392) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index af2ea772c3db..a3756217e660 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1035,16 +1035,13 @@ #endif // Extensible UI serial touch screens. (See src/lcd/extui) -#if ANY(HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT, TOUCH_UI_FTDI_EVE) +#if ANY(HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT, TOUCH_UI_FTDI_EVE, DWIN_LCD_PROUI) #define IS_EXTUI 1 // Just for sanity check. #define EXTENSIBLE_UI #endif // Aliases for LCD features -#if ANY(DWIN_CREALITY_LCD, DWIN_LCD_PROUI) - #define HAS_DWIN_E3V2_BASIC 1 -#endif -#if ANY(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI) +#if ANY(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) #define HAS_DWIN_E3V2 1 #endif @@ -1058,6 +1055,7 @@ #if ENABLED(DWIN_LCD_PROUI) #define DO_LIST_BIN_FILES 1 #define LCD_BRIGHTNESS_DEFAULT 127 + #define STATUS_DO_CLEAR_EMPTY #endif // Serial Controllers require LCD_SERIAL_PORT @@ -1092,6 +1090,7 @@ * - draw_kill_screen * - kill_screen * - draw_status_message + * (calling advance_status_scroll, status_and_len for a scrolling status message) */ #define HAS_DISPLAY 1 #endif @@ -1853,10 +1852,6 @@ #if NONE(TFT_TOUCH_DEVICE_GT911, TFT_TOUCH_DEVICE_XPT2046) #define TFT_TOUCH_DEVICE_XPT2046 // ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8 #endif - #if ENABLED(TFT_TOUCH_DEVICE_GT911) // GT911 Capacitive touch screen such as BIQU_BX_TFT70 - #undef TOUCH_SCREEN_CALIBRATION - #undef TOUCH_CALIBRATION_AUTO_SAVE - #endif #if !HAS_GRAPHICAL_TFT #undef TOUCH_SCREEN #if ENABLED(TFT_CLASSIC_UI) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 4f74fa006718..78da97f67b96 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -323,6 +323,13 @@ #define HAS_LINEAR_E_JERK 1 #endif +// Some displays can toggle Adaptive Step Smoothing. +// The state is saved to EEPROM. +// In future this may be added to a G-code such as M205 A. +#if ALL(ADAPTIVE_STEP_SMOOTHING, DWIN_LCD_PROUI) + #define ADAPTIVE_STEP_SMOOTHING_TOGGLE +#endif + /** * Temperature Sensors; define what sensor(s) we have. */ @@ -947,6 +954,12 @@ #define HAS_MOTOR_CURRENT_I2C 1 #endif +#if ENABLED(DUAL_X_CARRIAGE) + #ifndef INVERT_X2_DIR + #define INVERT_X2_DIR INVERT_X_DIR + #endif +#endif + // X2 but not IDEX => Dual Synchronized X Steppers #if defined(X2_DRIVER_TYPE) && DISABLED(DUAL_X_CARRIAGE) #define HAS_SYNCED_X_STEPPERS 1 @@ -1298,7 +1311,7 @@ * currently HAL.h must be included ahead of pins.h. */ #if LCD_IS_SERIAL_HOST && !defined(LCD_SERIAL_PORT) - #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_MINI_E3_V3_0_1, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, AQUILA_V101) + #if MB(MKS_MONSTER8_V1, BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_MINI_E3_V3_0_1, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, AQUILA_V101) #define LCD_SERIAL_PORT 1 #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V423, CREALITY_CR4NTXXC10, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO) #define LCD_SERIAL_PORT 2 @@ -1381,6 +1394,11 @@ #endif // Power-Loss Recovery -#if ENABLED(POWER_LOSS_RECOVERY) && defined(PLR_BED_THRESHOLD) - #define HAS_PLR_BED_THRESHOLD 1 +#if ENABLED(POWER_LOSS_RECOVERY) + #ifdef PLR_BED_THRESHOLD + #define HAS_PLR_BED_THRESHOLD 1 + #endif + #if ANY(DWIN_CREALITY_LCD, DWIN_LCD_PROUI) + #define HAS_PLR_UI_FLAG 1 // recovery.ui_flag_resume + #endif #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index c64bde0bc04c..64c95fa6c413 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2487,9 +2487,6 @@ // PID heating #if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER) #define HAS_PID_HEATING 1 - #if ENABLED(DWIN_LCD_PROUI) && ANY(PIDTEMP, PIDTEMPBED) - #define PROUI_PID_TUNE 1 - #endif #endif // Thermal protection @@ -3047,8 +3044,8 @@ * Advanced Pause - Filament Change */ #if ENABLED(ADVANCED_PAUSE_FEATURE) - #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) - #define M600_PURGE_MORE_RESUMABLE 1 + #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI) || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) + #define M600_PURGE_MORE_RESUMABLE 1 // UI provides some way to Purge More / Resume #endif #ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 @@ -3279,7 +3276,7 @@ #endif // Add commands that need sub-codes to this list -#if ANY(G38_PROBE_TARGET, CNC_COORDINATE_SYSTEMS, POWER_LOSS_RECOVERY) +#if ANY(G38_PROBE_TARGET, CNC_COORDINATE_SYSTEMS, POWER_LOSS_RECOVERY, HAS_ROTATIONAL_AXES) #define USE_GCODE_SUBCODES 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index c70ac494328f..5f14c568ae24 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -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)." @@ -345,8 +347,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if LCD_INFO_SCREEN_STYLE > 0 #if HAS_MARLINUI_U8GLIB || LCD_WIDTH < 20 || LCD_HEIGHT < 4 #error "Alternative LCD_INFO_SCREEN_STYLE requires 20x4 Character LCD." - #elif LCD_INFO_SCREEN_STYLE > 1 - #error "LCD_INFO_SCREEN_STYLE only has options 0 and 1 at this time." + #elif LCD_INFO_SCREEN_STYLE > 2 + #error "LCD_INFO_SCREEN_STYLE only has options 0 (Classic), 1 (Průša), and 2 (CNC)." #endif #endif @@ -1837,6 +1839,8 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i #error "DUAL_X_CARRIAGE requires X2_HOME_POS, X2_MIN_POS, and X2_MAX_POS." #elif X_HOME_TO_MAX #error "DUAL_X_CARRIAGE requires X_HOME_DIR -1." + #elif (X2_HOME_POS <= X1_MAX_POS) || (X2_MAX_POS < X1_MAX_POS) + #error "DUAL_X_CARRIAGE will crash if X1 can meet or exceed X2 travel." #endif #endif @@ -3617,6 +3621,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #error "Z_STEPPER_ALIGN_STEPPER_XY requires 3 or 4 Z steppers." #endif #endif + static_assert(WITHIN(Z_STEPPER_ALIGN_ACC, 0.001, 1.0), "Z_STEPPER_ALIGN_ACC needs to be between 0.001 and 1.0"); #endif #if ENABLED(MECHANICAL_GANTRY_CALIBRATION) @@ -3740,6 +3745,8 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #error "POWER_OFF_DELAY must be a positive value." #elif ENABLED(POWER_OFF_WAIT_FOR_COOLDOWN) && !(defined(AUTO_POWER_E_TEMP) || defined(AUTO_POWER_CHAMBER_TEMP) || defined(AUTO_POWER_COOLER_TEMP)) #error "POWER_OFF_WAIT_FOR_COOLDOWN requires AUTO_POWER_E_TEMP, AUTO_POWER_CHAMBER_TEMP, and/or AUTO_POWER_COOLER_TEMP." + #elif ENABLED(PSU_OFF_REDUNDANT) && !PIN_EXISTS(PS_ON1) + #error "PSU_OFF_REDUNDANT requires PS_ON1_PIN." #endif #endif @@ -3916,6 +3923,11 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #error "TOUCH_CALIBRATION_[XY] and TOUCH_OFFSET_[XY] are required for resistive touch screens with TOUCH_SCREEN_CALIBRATION disabled." #endif +// GT911 Capacitive touch screen such as BIQU_BX_TFT70 +#if ALL(TFT_TOUCH_DEVICE_GT911, TOUCH_SCREEN_CALIBRATION) + #error "TOUCH_SCREEN_CALIBRATION is not supported by the selected LCD controller." +#endif + /** * Sanity check WiFi options */ @@ -3927,11 +3939,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 diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 75ed6a0fe5b3..6322ced40acd 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2024-02-28" + #define STRING_DISTRIBUTION_DATE "2024-04-25" #endif /** diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index f889ce38e05c..40a4c9452d2e 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -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 @@ -682,7 +682,8 @@ #endif #if ENABLED(EMIT_CREALITY_422_WARNING) && DISABLED(NO_CREALITY_422_DRIVER_WARNING) - #warning "Creality 4.2.2 boards come with a variety of stepper drivers. Check the board label (typically on SD Card module) and set the correct *_DRIVER_TYPE! (C=HR4988, E=A4988, A=TMC2208, B=TMC2209, H=TMC2225, H8=HR4988). (Define NO_CREALITY_422_DRIVER_WARNING to suppress this warning.)" + // Driver labels: A=TMC2208, B=TMC2209, C=HR4988, E=A4988, H=TMC2225, H8=HR4988 + #warning "Creality 4.2.2 boards come with a variety of stepper drivers. Check the board label (typically on SD Card module) and set the correct *_DRIVER_TYPE! (A/H: TMC2208_STANDALONE B: TMC2209_STANDALONE C/E/H8: A4988). (Define NO_CREALITY_422_DRIVER_WARNING to suppress this warning.)" #endif #if ENABLED(PRINTCOUNTER_SYNC) @@ -693,6 +694,10 @@ #error "Z_SAFE_HOMING is recommended when homing with a probe. Enable Z_SAFE_HOMING or comment out this line to continue." #endif +#if ENABLED(BIQU_MICROPROBE_V2) && NONE(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, NO_MICROPROBE_WARNING) + #warning "BIQU MicroProbe V2 detect signal requires a strong pull-up. Some processors have weak internal pull-up capabilities, so we recommended connecting MicroProbe SIGNAL / GND to Z-MIN / Z-STOP instead of the dedicated PROBE port. (Define NO_MICROPROBE_WARNING to suppress this warning.)" +#endif + // // Warn users of potential endstop/DIAG pin conflicts to prevent homing issues when not using sensorless homing // diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index 1126b4a4b62c..0ab045bda37a 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -1139,7 +1139,39 @@ void MarlinUI::draw_status_screen() { TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(LCD_WIDTH - 9, 2)); rotate_progress(); #endif - #endif // LCD_INFO_SCREEN_STYLE 1 + + #elif LCD_INFO_SCREEN_STYLE == 2 + + // ========== Line 1 ========== + + // + // X Coordinate + // + lcd_moveto(0, 0); + _draw_axis_value(X_AXIS, ftostr52sp(LOGICAL_X_POSITION(current_position.x)), blink); + + // + // Y Coordinate + // + lcd_moveto(LCD_WIDTH - 9, 0); + _draw_axis_value(Y_AXIS, ftostr52sp(LOGICAL_Y_POSITION(current_position.y)), blink); + + // ========== Line 2 ========== + lcd_moveto(0, 1); + _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink); + + lcd_moveto(LCD_WIDTH - 9, 1); + _draw_axis_value(I_AXIS, ftostr52sp(LOGICAL_I_POSITION(current_position.i)), blink); + + // ========== Line 3 ========== + lcd_moveto(0, 2); + lcd_put_lchar('F'); + + lcd_moveto(LCD_WIDTH - 9, 2); + lcd_put_lchar('S'); + + + #endif // LCD_INFO_SCREEN_STYLE // ========= Last Line ======== diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index cfff78ad40fe..1bc55630af38 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -140,7 +140,7 @@ bool MarlinUI::detected() { return true; } uint8_t *dst = (uint8_t*)bmp; auto rle_nybble = [&](const uint16_t i) -> uint8_t { - const uint8_t b = bmp_rle[i / 2]; + const uint8_t b = pgm_read_byte(&bmp_rle[i / 2]); return (i & 1 ? b & 0xF : b >> 4); }; @@ -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 diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.h b/Marlin/src/lcd/dogm/marlinui_DOGM.h index 59df915f496e..9025395f5600 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.h +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.h @@ -28,7 +28,7 @@ #include "../../inc/MarlinConfigPre.h" #include -#include "HAL_LCD_class_defines.h" +#include "u8g/HAL_LCD_class_defines.h" //#define ALTERNATIVE_LCD diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 24165019b473..747e462b1dac 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -323,7 +323,7 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co } // PAGE_CONTAINS - #if HAS_MULTI_EXTRUDER && DISABLED(SLIM_LCD_MENUS) + #if HAS_MULTI_EXTRUDER && NONE(SLIM_LCD_MENUS, STATUS_HOTEND_NUMBERLESS, SINGLENOZZLE) if (active_extruder == heater_id) u8g.drawBitmapP(_MAX(0, STATUS_HOTEND_X(heater_id) - 6), STATUS_HEATERS_Y + 3, 1, 5, status_active_extruder_indicator_bmp); #endif diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index 4eb031e5385a..a9e8bb564600 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -886,7 +886,7 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { * If STATUS_EXPIRE_SECONDS is zero, only the status is shown. */ if (forceUpdate || status_changed()) { - TERN_(STATUS_MESSAGE_SCROLLING, ui.status_scroll_offset = 0); + TERN_(STATUS_MESSAGE_SCROLLING, ui.reset_status_scroll()); #if STATUS_EXPIRE_SECONDS countdown = !ui.status_message.empty() ? STATUS_EXPIRE_SECONDS : 0; #endif diff --git a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h b/Marlin/src/lcd/dogm/u8g/HAL_LCD_class_defines.h similarity index 99% rename from Marlin/src/lcd/dogm/HAL_LCD_class_defines.h rename to Marlin/src/lcd/dogm/u8g/HAL_LCD_class_defines.h index f07064ea7165..907fa43c9bd7 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h +++ b/Marlin/src/lcd/dogm/u8g/HAL_LCD_class_defines.h @@ -21,7 +21,7 @@ */ #pragma once -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" // use this file to create the public interface for device drivers that are NOT in the U8G library diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/u8g/HAL_LCD_com_defines.h similarity index 97% rename from Marlin/src/lcd/dogm/HAL_LCD_com_defines.h rename to Marlin/src/lcd/dogm/u8g/HAL_LCD_com_defines.h index a70e2b7b8b66..e94c75380770 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/u8g/HAL_LCD_com_defines.h @@ -27,7 +27,7 @@ #include -#include HAL_PATH(../.., u8g/LCD_defines.h) +#include HAL_PATH(../../.., u8g/LCD_defines.h) #if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); diff --git a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp b/Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp similarity index 99% rename from Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp rename to Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp index 5865bb11873b..4cd9b8f3c06d 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp +++ b/Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp @@ -65,7 +65,7 @@ * beginning. */ -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if HAS_MARLINUI_U8GLIB diff --git a/Marlin/src/lcd/dogm/u8g_dev_ssd1309_12864.cpp b/Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1309_12864.cpp similarity index 99% rename from Marlin/src/lcd/dogm/u8g_dev_ssd1309_12864.cpp rename to Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1309_12864.cpp index 6d40ea0d4b47..4aa90d5e8e82 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_ssd1309_12864.cpp +++ b/Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1309_12864.cpp @@ -20,7 +20,7 @@ * */ -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if HAS_MARLINUI_U8GLIB diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp b/Marlin/src/lcd/dogm/u8g/u8g_dev_st7565_64128n_HAL.cpp similarity index 99% rename from Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp rename to Marlin/src/lcd/dogm/u8g/u8g_dev_st7565_64128n_HAL.cpp index 6c7066179eb0..61a1e214bd66 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g/u8g_dev_st7565_64128n_HAL.cpp @@ -53,7 +53,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if HAS_MARLINUI_U8GLIB diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp b/Marlin/src/lcd/dogm/u8g/u8g_dev_st7920_128x64_HAL.cpp similarity index 99% rename from Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp rename to Marlin/src/lcd/dogm/u8g/u8g_dev_st7920_128x64_HAL.cpp index d5f1be18ec95..fb9d4b7ad657 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g/u8g_dev_st7920_128x64_HAL.cpp @@ -53,7 +53,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if HAS_MARLINUI_U8GLIB && DISABLED(TFT_CLASSIC_UI) diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g/u8g_dev_tft_upscale_from_128x64.cpp similarity index 98% rename from Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp rename to Marlin/src/lcd/dogm/u8g/u8g_dev_tft_upscale_from_128x64.cpp index 51bbee78b9df..73b35b0ec2fa 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g/u8g_dev_tft_upscale_from_128x64.cpp @@ -53,12 +53,12 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if HAS_MARLINUI_U8GLIB && (PIN_EXISTS(FSMC_CS) || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT) #include "HAL_LCD_com_defines.h" -#include "marlinui_DOGM.h" +#include "../marlinui_DOGM.h" #include @@ -66,7 +66,7 @@ #define HAS_LCD_IO 1 #endif -#include "../tft_io/tft_io.h" +#include "../../tft_io/tft_io.h" TFT_IO tftio; #define WIDTH LCD_PIXEL_WIDTH @@ -74,17 +74,17 @@ TFT_IO tftio; #define PAGE_HEIGHT 8 #if ENABLED(TOUCH_SCREEN_CALIBRATION) - #include "../tft_io/touch_calibration.h" - #include "../marlinui.h" + #include "../../tft_io/touch_calibration.h" + #include "../../marlinui.h" #endif -#include "../touch/touch_buttons.h" -#include "../scaled_tft.h" +#include "../../touch/touch_buttons.h" +#include "../../scaled_tft.h" #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 diff --git a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp b/Marlin/src/lcd/dogm/u8g/u8g_dev_uc1701_mini12864_HAL.cpp similarity index 99% rename from Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp rename to Marlin/src/lcd/dogm/u8g/u8g_dev_uc1701_mini12864_HAL.cpp index 172afbd76647..95ae2810f256 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g/u8g_dev_uc1701_mini12864_HAL.cpp @@ -53,7 +53,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if HAS_MARLINUI_U8GLIB diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp b/Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.cpp similarity index 98% rename from Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp rename to Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.cpp index 11cd7b14ba55..cd7445e01997 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -23,11 +23,11 @@ // NOTE - the HAL version of the rrd device uses a generic ST7920 device. // See u8g_dev_st7920_128x64_HAL.cpp for the HAL version. -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if ANY(__AVR__, ARDUINO_ARCH_STM32, ARDUINO_ARCH_ESP32) -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if IS_U8GLIB_ST7920 @@ -184,7 +184,7 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_rrd_st7920_128x64_fn, &u8 #pragma GCC reset_options #if ENABLED(LIGHTWEIGHT_UI) - #include "../../HAL/shared/HAL_ST7920.h" + #include "../../../HAL/shared/HAL_ST7920.h" void ST7920_cs() { ST7920_CS(); } void ST7920_ncs() { ST7920_NCS(); } void ST7920_set_cmd() { ST7920_SET_CMD(); } diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h b/Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.h similarity index 96% rename from Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h rename to Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.h index 9a565fc2efb9..f965913341a7 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h +++ b/Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.h @@ -24,8 +24,8 @@ // NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the // file u8g_dev_st7920_128x64_HAL.cpp for the HAL version. -#include "../../inc/MarlinConfig.h" -#include "../../HAL/shared/Delay.h" +#include "../../../inc/MarlinConfig.h" +#include "../../../HAL/shared/Delay.h" #define ST7920_CLK_PIN LCD_PINS_D4 #define ST7920_DAT_PIN LCD_PINS_EN diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.cpp b/Marlin/src/lcd/e3v2/common/dwin_api.cpp index 342289e99329..1688b2423053 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.cpp +++ b/Marlin/src/lcd/e3v2/common/dwin_api.cpp @@ -153,21 +153,23 @@ void dwinFrameClear(const uint16_t color) { dwinSend(i); } -// Draw a point -// color: point color -// width: point width 0x01-0x0F -// height: point height 0x01-0x0F -// x,y: upper left point -void dwinDrawPoint(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) { - size_t i = 0; - dwinByte(i, 0x02); - dwinWord(i, color); - dwinByte(i, width); - dwinByte(i, height); - dwinWord(i, x); - dwinWord(i, y); - dwinSend(i); -} +#if DISABLED(TJC_DISPLAY) + // Draw a point + // color: point color + // width: point width 0x01-0x0F + // height: point height 0x01-0x0F + // x,y: upper left point + void dwinDrawPoint(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) { + size_t i = 0; + dwinByte(i, 0x02); + dwinWord(i, color); + dwinByte(i, width); + dwinByte(i, height); + dwinWord(i, x); + dwinWord(i, y); + dwinSend(i); + } +#endif // Draw a line // color: Line segment color diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.h b/Marlin/src/lcd/e3v2/common/dwin_api.h index fe2105baea07..48785150328f 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.h +++ b/Marlin/src/lcd/e3v2/common/dwin_api.h @@ -23,6 +23,12 @@ #include "../../../inc/MarlinConfig.h" +// +// e3v2/common/dwin_api.h +// +// Included by: e3v2/*/dwin_lcd.h +// + #if ENABLED(DWIN_MARLINUI_LANDSCAPE) #define DWIN_WIDTH 480 #define DWIN_HEIGHT 272 @@ -107,13 +113,6 @@ void dwinUpdateLCD(); // color: Clear screen color void dwinFrameClear(const uint16_t color); -// Draw a point -// color: point color -// width: point width 0x01-0x0F -// height: point height 0x01-0x0F -// x,y: upper left point -void dwinDrawPoint(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y); - // Draw a line // color: Line segment color // xStart/yStart: Start point @@ -152,6 +151,19 @@ inline void dwinDrawBox(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t dwinDrawRectangle(mode, color, xStart, yStart, xStart + xSize - 1, yStart + ySize - 1); } +// Draw a point +// color: point color +// width: point width 0x01-0x0F +// height: point height 0x01-0x0F +// x,y: upper left point +#if ENABLED(TJC_DISPLAY) + inline void dwinDrawPoint(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) { + dwinDrawBox(1, color, x, y, 1, 1); + } +#else + void dwinDrawPoint(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y); +#endif + // Move a screen area // mode: 0, circle shift; 1, translation // dir: 0=left, 1=right, 2=up, 3=down diff --git a/Marlin/src/lcd/e3v2/common/dwin_font.h b/Marlin/src/lcd/e3v2/common/dwin_font.h index b92bfcf99c9f..a0becfc32522 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_font.h +++ b/Marlin/src/lcd/e3v2/common/dwin_font.h @@ -21,6 +21,8 @@ */ #pragma once +#include + typedef uint8_t fontid_t; /** diff --git a/Marlin/src/lcd/e3v2/common/dwin_set.h b/Marlin/src/lcd/e3v2/common/dwin_set.h index ada7dec71fea..f32d0e6d9e43 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_set.h +++ b/Marlin/src/lcd/e3v2/common/dwin_set.h @@ -130,7 +130,7 @@ #define ICON_Folder ICON_More #define ICON_AdvSet ICON_Language -#define ICON_HomeOffset ICON_AdvSet +#define ICON_HomeOffset ICON_PrintSize #define ICON_HomeOffsetX ICON_StepX #define ICON_HomeOffsetY ICON_StepY #define ICON_HomeOffsetZ ICON_StepZ @@ -138,8 +138,8 @@ #define ICON_ProbeOffsetX ICON_StepX #define ICON_ProbeOffsetY ICON_StepY #define ICON_ProbeOffsetZ ICON_StepZ -#define ICON_PIDNozzle ICON_SetEndTemp -#define ICON_PIDBed ICON_SetBedTemp +#define ICON_PIDNozzle ICON_HotendTemp +#define ICON_PIDBed ICON_BedTemp #define ICON_FWRetract ICON_StepE #define ICON_FWRetLength ICON_StepE #define ICON_FWRetSpeed ICON_Setspeed diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index b2c08861d7d7..9ecfbfe1faed 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -1822,8 +1822,6 @@ void MarlinUI::update() { dwinHandleScreen(); // Rotary encoder update } -void MarlinUI::refresh() { /* Nothing to see here */ } - #if HAS_LCD_BRIGHTNESS void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); } #endif @@ -4171,8 +4169,8 @@ void eachMomentUpdate() { gotoMainMenu(); } #if ENABLED(POWER_LOSS_RECOVERY) - else if (DWIN_lcd_sd_status && recovery.dwin_flag) { // resume print before power off - recovery.dwin_flag = false; + else if (DWIN_lcd_sd_status && recovery.ui_flag_resume) { // Resume interrupted print + recovery.ui_flag_resume = false; auto update_selection = [&](const bool sel) { hmiFlag.select_flag = sel; @@ -4199,7 +4197,7 @@ void eachMomentUpdate() { if (encoder_diffState == ENCODER_DIFF_ENTER) { recovery_flag = false; if (hmiFlag.select_flag) break; - TERN_(POWER_LOSS_RECOVERY, queue.inject(F("M1000C"))); + queue.inject(F("M1000C")); hmiStartFrame(true); return; } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 856229b0d845..a29f5fc42fb5 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -5158,6 +5158,7 @@ void MarlinUI::init_lcd() { #if ENABLED(ADVANCED_PAUSE_FEATURE) void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { + if (mode != PAUSE_MODE_SAME) pause_mode = mode; switch (message) { case PAUSE_MESSAGE_INSERT: jyersDWIN.confirmHandler(Popup_FilInsert); break; case PAUSE_MESSAGE_PURGE: diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h index dc6c79bd2d0e..ef81a7df77c9 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h @@ -76,7 +76,3 @@ #include "../common/dwin_color.h" #define Color_Bg_Heading 0x3344 // Static Heading - -// Character matrix width x height -//#define LCD_WIDTH ((DWIN_WIDTH) / 8) -//#define LCD_HEIGHT ((DWIN_HEIGHT) / 12) diff --git a/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h b/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h index a91cd19f6e8f..b8913914dd74 100644 --- a/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h +++ b/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h @@ -72,6 +72,12 @@ extern dwin_font_t dwin_font; #define EXTRA_ROW_HEIGHT 8 #define MENU_LINE_HEIGHT (MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT) +// Character matrix width x height based on menu font +#define LCD_PIXEL_WIDTH DWIN_WIDTH +#define LCD_PIXEL_HEIGHT DWIN_HEIGHT +#define LCD_WIDTH ((LCD_PIXEL_WIDTH) / (MENU_FONT_WIDTH)) +#define LCD_HEIGHT ((LCD_PIXEL_HEIGHT) / (MENU_LINE_HEIGHT)) + #if DWIN_FONT_EDIT == font6x12 #define EDIT_FONT_WIDTH 6 #define EDIT_FONT_ASCENT 10 diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 6a4cb6afde5e..4a60f77c9dab 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -219,7 +219,7 @@ void MarlinUI::draw_status_message(const bool blink) { const char *stat = status_and_len(rlen); lcd_put_u8str_max(stat, max_status_chars); - // If the string doesn't completely fill the line... + // If the remaining string doesn't completely fill the line... if (rlen < max_status_chars) { lcd_put_u8str(F(".")); // Always at 1+ spaces left, draw a dot uint8_t chars = max_status_chars - rlen; // Amount of space left in characters diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 888d1f74928e..8aa4b90d1ef5 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -37,6 +37,7 @@ #include "../../utf8.h" #include "../../marlinui.h" +#include "../../extui/ui_api.h" #include "../../../MarlinCore.h" #include "../../../core/serial.h" #include "../../../core/macros.h" @@ -158,6 +159,8 @@ #define MAX_ETEMP thermalManager.hotend_max_target(0) #define MIN_BEDTEMP 0 #define MAX_BEDTEMP BED_MAX_TARGET +#define MIN_CHAMBERTEMP 0 +#define MAX_CHAMBERTEMP CHAMBER_MAX_TARGET #define DWIN_VAR_UPDATE_INTERVAL 500 #define DWIN_UPDATE_INTERVAL 1000 @@ -243,11 +246,16 @@ Menu *stepsMenu = nullptr; #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) Menu *hotendMPCMenu = nullptr; #endif -#if ENABLED(PIDTEMP) && ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) - Menu *hotendPIDMenu = nullptr; -#endif -#if ENABLED(PIDTEMPBED) && ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) - Menu *bedPIDMenu = nullptr; +#if ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) + #if ENABLED(PIDTEMP) + Menu *hotendPIDMenu = nullptr; + #endif + #if ENABLED(PIDTEMPBED) + Menu *bedPIDMenu = nullptr; + #endif + #if ENABLED(PIDTEMPCHAMBER) + Menu *chamberPIDMenu = nullptr; + #endif #endif #if CASELIGHT_USES_BRIGHTNESS Menu *caseLightMenu = nullptr; @@ -418,49 +426,50 @@ void popupPauseOrStop() { drawSelectHighlight(true); dwinUpdateLCD(); } - else - dwinPopupConfirmCancel(ICON_BLTouch, select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT)); -} - -#if HAS_HOTEND - - void popupETempTooLow() { - if (hmiIsChinese()) { - hmiSaveProcessID(ID_WaitResponse); - DWINUI::clearMainArea(); - drawPopupBkgd(); - DWINUI::drawIcon(ICON_TempTooLow, 102, 105); - dwinFrameAreaCopy(1, 103, 371, 136, 386, 69, 240); - dwinFrameAreaCopy(1, 170, 371, 270, 386, 102, 240); - DWINUI::drawIconWB(ICON_Confirm_C, 86, 280); - dwinUpdateLCD(); + else { + switch (select_print.now) { + case PRINT_PAUSE_RESUME: dwinPopupConfirmCancel(ICON_Pause_1, GET_TEXT_F(MSG_PAUSE_PRINT)); break; + case PRINT_STOP: dwinPopupConfirmCancel(ICON_Stop_1, GET_TEXT_F(MSG_STOP_PRINT)); break; + default: break; } - else - dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); } +} -#endif - -#if HAS_HOTEND || HAS_HEATED_BED - void dwinPopupTemperature(const bool toohigh) { +#if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER + void dwinPopupTemperature(const int_fast8_t heater_id, const uint8_t state) { hmiSaveProcessID(ID_WaitResponse); if (hmiIsChinese()) { DWINUI::clearMainArea(); drawPopupBkgd(); - if (toohigh) { + if (state == 1) { DWINUI::drawIcon(ICON_TempTooHigh, 102, 165); dwinFrameAreaCopy(1, 103, 371, 237, 386, 52, 285); dwinFrameAreaCopy(1, 151, 389, 185, 402, 187, 285); dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } - else { + else if (state == 0) { DWINUI::drawIcon(ICON_TempTooLow, 102, 165); dwinFrameAreaCopy(1, 103, 371, 270, 386, 52, 285); dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } + else { + // Chinese "Temp Error" + } + } + else { + FSTR_P heaterstr = nullptr; + if (TERN0(HAS_HEATED_BED, heater_id == H_BED)) heaterstr = F("Bed"); + else if (TERN0(HAS_HEATED_CHAMBER, heater_id == H_CHAMBER)) heaterstr = F("Chamber"); + else if (TERN0(HAS_HOTEND, heater_id >= 0)) heaterstr = F("Nozzle"); + FSTR_P errorstr; + uint8_t icon; + switch (state) { + case 0: errorstr = GET_TEXT_F(MSG_TEMP_TOO_LOW); icon = ICON_TempTooLow; break; + case 1: errorstr = GET_TEXT_F(MSG_TEMP_TOO_HIGH); icon = ICON_TempTooHigh; break; + default: errorstr = GET_TEXT_F(MSG_ERR_HEATING_FAILED); icon = ICON_Temperature; break; // May be thermal runaway, temp malfunction, etc. + } + dwinShowPopup(icon, heaterstr, errorstr, BTN_Continue); } - else - dwinShowPopup(toohigh ? ICON_TempTooHigh : ICON_TempTooLow, F("Nozzle or Bed temperature"), toohigh ? F("is too high") : F("is too low"), BTN_Continue); } #endif @@ -581,16 +590,17 @@ void ICON_ResumeOrPause() { if (checkkey == ID_PrintProcess) (print_job_timer.isPaused() || hmiFlag.pause_flag) ? ICON_Resume() : ICON_Pause(); } -// Update filename on print -void dwinPrintHeader(const char *text = nullptr) { +// Print a string (up to 30 characters) in the header, +// e.g., The filename or string sent with M75. +void dwinPrintHeader(const char * const cstr/*=nullptr*/) { static char headertxt[31] = ""; // Print header text - if (text) { - const int8_t size = _MIN(30U, strlen_P(text)); - for (uint8_t i = 0; i < size; ++i) headertxt[i] = text[i]; + if (cstr) { + const int8_t size = _MIN(30U, strlen(cstr)); + for (uint8_t i = 0; i < size; ++i) headertxt[i] = cstr[i]; headertxt[size] = '\0'; } if (checkkey == ID_PrintProcess || checkkey == ID_PrintDone) { - dwinDrawRectangle(1, hmiData.colorBackground, 0, 60, DWIN_WIDTH, 60+16); + dwinDrawRectangle(1, hmiData.colorBackground, 0, 60, DWIN_WIDTH, 60 + 16); DWINUI::drawCenteredString(60, headertxt); } } @@ -601,7 +611,7 @@ void drawPrintProcess() { else title.showCaption(GET_TEXT_F(MSG_PRINTING)); DWINUI::clearMainArea(); - dwinPrintHeader(nullptr); + dwinPrintHeader(); drawPrintLabels(); DWINUI::drawIcon(ICON_PrintTime, 15, 173); DWINUI::drawIcon(ICON_RemainTime, 150, 171); @@ -629,7 +639,7 @@ void drawPrintDone() { TERN_(SET_REMAINING_TIME, ui.reset_remaining_time()); title.showCaption(GET_TEXT_F(MSG_PRINT_DONE)); DWINUI::clearMainArea(); - dwinPrintHeader(nullptr); + dwinPrintHeader(); #if HAS_GCODE_PREVIEW const bool haspreview = preview.valid(); if (haspreview) { @@ -1031,7 +1041,7 @@ void hmiSDCardUpdate() { currentMenu = nullptr; drawPrintFileMenu(); } - if (!DWIN_lcd_sd_status && sdPrinting()) ui.abort_print(); // Media removed while printing + if (!DWIN_lcd_sd_status && sdPrinting()) ExtUI::stopPrint(); // Media removed while printing } } @@ -1060,7 +1070,7 @@ void dwinDrawDashboard() { #endif #if HAS_HEATED_BED - DWINUI::drawIcon(ICON_BedTemp, 10, 416); + DWINUI::drawIcon(ICON_SetBedTemp, 10, 416); DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 417, thermalManager.wholeDegBed()); DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); @@ -1155,8 +1165,8 @@ void hmiMainMenu() { // Pause or Stop popup void onClickPauseOrStop() { switch (select_print.now) { - case PRINT_PAUSE_RESUME: if (hmiFlag.select_flag) ui.pause_print(); break; // Confirm pause - case PRINT_STOP: if (hmiFlag.select_flag) ui.abort_print(); break; // Stop confirmed then abort print + case PRINT_PAUSE_RESUME: if (hmiFlag.select_flag) ExtUI::pausePrint(); break; // Confirm pause + case PRINT_STOP: if (hmiFlag.select_flag) ExtUI::stopPrint(); break; // Stop confirmed then abort print default: break; } return gotoPrintProcess(); @@ -1190,7 +1200,7 @@ void hmiPrinting() { case PRINT_SETUP: drawTuneMenu(); break; case PRINT_PAUSE_RESUME: if (printingIsPaused()) { // If printer is already in pause - ui.resume_print(); + ExtUI::resumePrint(); break; } else @@ -1213,6 +1223,20 @@ void drawMainArea() { #if HAS_ESDIAG case ID_ESDiagProcess: drawEndStopDiag(); break; #endif + #if ENABLED(PROUI_ITEM_PLOT) + case ID_PlotProcess: + switch (hmiValue.tempControl) { + #if ENABLED(PIDTEMP) + case PIDTEMP_START: drawHPlot(); break; + #endif + #if ENABLED(PIDTEMPBED) + case PIDTEMPBED_START: drawBPlot(); break; + #endif + #if ENABLED(PIDTEMPCHAMBER) + case PIDTEMPCHAMBER_START: drawCPlot(); break; + #endif + } break; + #endif case ID_Popup: popupDraw(); break; #if HAS_LOCKSCREEN case ID_Locked: lockScreen.draw(); break; @@ -1280,13 +1304,15 @@ void eachMomentUpdate() { if (checkkey == ID_PIDProcess) { TERN_(PIDTEMP, if (hmiValue.tempControl == PIDTEMP_START) plot.update(thermalManager.wholeDegHotend(0))); TERN_(PIDTEMPBED, if (hmiValue.tempControl == PIDTEMPBED_START) plot.update(thermalManager.wholeDegBed())); + TERN_(PIDTEMPCHAMBER, if (hmiValue.tempControl == PIDTEMPCHAMBER_START) plot.update(thermalManager.wholeDegChamber())); } TERN_(MPCTEMP, if (checkkey == ID_MPCProcess) plot.update(thermalManager.wholeDegHotend(0))); #if ENABLED(PROUI_ITEM_PLOT) if (checkkey == ID_PlotProcess) { TERN_(PIDTEMP, if (hmiValue.tempControl == PIDTEMP_START) { plot.update(thermalManager.wholeDegHotend(0)); }) TERN_(PIDTEMPBED, if (hmiValue.tempControl == PIDTEMPBED_START) { plot.update(thermalManager.wholeDegBed()); }) - TERN_(MPCTEMP, if (hmiValue.tempControl == MPCTEMP_START) { plot.update(thermalManager.wholeDegHotend(0)); }) + TERN_(PIDTEMPCHAMBER, if (hmiValue.tempControl == PIDTEMPCHAMBER_START) { plot.update(thermalManager.wholeDegChamber()); }) + TERN_(MPCTEMP, if (hmiValue.tempControl == MPC_STARTED) { plot.update(thermalManager.wholeDegHotend(0)); }) if (hmiFlag.abort_flag || hmiFlag.pause_flag || print_job_timer.isPaused()) { hmiReturnScreen(); } @@ -1357,8 +1383,8 @@ void eachMomentUpdate() { drawPrintProgressElapsed(); } } - #if ENABLED(POWER_LOSS_RECOVERY) - else if (DWIN_lcd_sd_status && recovery.dwin_flag) { // Resume print before power off + #if HAS_PLR_UI_FLAG + else if (DWIN_lcd_sd_status && recovery.ui_flag_resume) { // Resume interrupted print return gotoPowerLossRecovery(); } #endif @@ -1368,6 +1394,7 @@ void eachMomentUpdate() { } #if ENABLED(POWER_LOSS_RECOVERY) + void popupPowerLossRecovery() { DWINUI::clearMainArea(); drawPopupBkgd(); @@ -1407,7 +1434,7 @@ void eachMomentUpdate() { } void gotoPowerLossRecovery() { - recovery.dwin_flag = false; + recovery.ui_flag_resume = false; LCD_MESSAGE(MSG_CONTINUE_PRINT_JOB); gotoPopup(popupPowerLossRecovery, onClickPowerLossRecovery); } @@ -1435,7 +1462,8 @@ void dwinHandleScreen() { TERN_(HAS_BED_PROBE, case ID_Leveling:) case ID_Homing: - case ID_PIDProcess: + TERN_(HAS_PID_HEATING, case ID_PIDProcess:) + TERN_(MPCTEMP, case ID_MPCProcess:) case ID_NothingToDo: default: break; } @@ -1449,7 +1477,9 @@ bool idIsPopUp() { // If ID is popup... case ID_WaitResponse: case ID_Popup: case ID_Homing: - case ID_PIDProcess: + TERN_(HAS_PID_HEATING, case ID_PIDProcess:) + TERN_(MPCTEMP, case ID_MPCProcess:) + TERN_(PROUI_ITEM_PLOT, case ID_PlotProcess:) return true; default: break; } @@ -1482,7 +1512,11 @@ void dwinHomingStart() { hmiFlag.home_flag = true; hmiSaveProcessID(ID_Homing); title.showCaption(GET_TEXT_F(MSG_HOMING)); - dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); + #if ANY(TJC_DISPLAY, DACAI_DISPLAY) + dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); + #else + dwinShowPopup(ICON_Printer_0, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); + #endif } void dwinHomingDone() { @@ -1499,22 +1533,7 @@ void dwinLevelingStart() { title.showCaption(GET_TEXT_F(MSG_BED_LEVELING)); dwinShowPopup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT)); #if ALL(AUTO_BED_LEVELING_UBL, PREHEAT_BEFORE_LEVELING) - #if HAS_BED_PROBE - if (!DEBUGGING(DRYRUN)) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, hmiData.bedLevT); - #else - #if HAS_HOTEND - if (!DEBUGGING(DRYRUN) && thermalManager.degTargetHotend(0) < LEVELING_NOZZLE_TEMP) { - thermalManager.setTargetHotend(LEVELING_NOZZLE_TEMP, 0); - thermalManager.wait_for_hotend(0); - } - #endif - #if HAS_HEATED_BED - if (!DEBUGGING(DRYRUN) && thermalManager.degTargetBed() < hmiData.bedLevT) { - thermalManager.setTargetBed(hmiData.bedLevT); - thermalManager.wait_for_bed_heating(); - } - #endif - #endif + if (!DEBUGGING(DRYRUN)) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, hmiData.bedLevT); #endif #elif ENABLED(MESH_BED_LEVELING) drawManualMeshMenu(); @@ -1548,10 +1567,10 @@ void dwinLevelingDone() { switch (hmiValue.tempControl) { default: return; #if ENABLED(MPC_AUTOTUNE) - case MPCTEMP_START: + case MPC_STARTED: DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_MPC_AUTOTUNE)); DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); - DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, F("for NOZZLE is running.")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, GET_TEXT_F(MSG_PID_FOR_NOZZLE)); _maxtemp = thermalManager.hotend_maxtemp[0]; _target = 200; break; @@ -1560,18 +1579,27 @@ void dwinLevelingDone() { case PIDTEMP_START: DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_PID_AUTOTUNE)); DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); - DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, F("for NOZZLE is running.")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, GET_TEXT_F(MSG_PID_FOR_NOZZLE)); _maxtemp = thermalManager.hotend_maxtemp[0]; - _target = hmiData.hotendPidT; + _target = hmiData.hotendPIDT; break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_PID_AUTOTUNE)); DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); - DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, F("for BED is running.")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, GET_TEXT_F(MSG_PID_FOR_BED)); _maxtemp = BED_MAXTEMP; - _target = hmiData.bedPidT; + _target = hmiData.bedPIDT; + break; + #endif + #if ENABLED(PIDTEMPCHAMBER) + case PIDTEMPCHAMBER_START: + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, GET_TEXT_F(MSG_PID_FOR_CHAMBER)); + _maxtemp = CHAMBER_MAXTEMP; + _target = hmiData.chamberPIDT; break; #endif } @@ -1585,30 +1613,38 @@ void dwinLevelingDone() { void dwinDrawPlot(tempcontrol_t result) { hmiValue.tempControl = result; - constexpr frame_rect_t gfrm = {30, 135, DWIN_WIDTH - 60, 160}; + constexpr frame_rect_t gfrm = { 30, 135, DWIN_WIDTH - 60, 160 }; DWINUI::clearMainArea(); drawPopupBkgd(); hmiSaveProcessID(ID_PlotProcess); switch (result) { #if ENABLED(MPCTEMP) - case MPCTEMP_START: + case MPC_STARTED: #elif ENABLED(PIDTEMP) case PIDTEMP_START: #endif title.showCaption(GET_TEXT_F(MSG_HOTEND_TEMP_GRAPH)); - DWINUI::drawCenteredString(3, hmiData.colorPopupTxt, 75, F("Nozzle Temperature")); + DWINUI::drawCenteredString(3, hmiData.colorPopupTxt, 75, GET_TEXT_F(MSG_TEMP_NOZZLE)); _maxtemp = thermalManager.hotend_max_target(0); _target = thermalManager.degTargetHotend(0); break; #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: title.showCaption(GET_TEXT_F(MSG_BED_TEMP_GRAPH)); - DWINUI::drawCenteredString(3, hmiData.colorPopupTxt, 75, F("Bed Temperature")); + DWINUI::drawCenteredString(3, hmiData.colorPopupTxt, 75, GET_TEXT_F(MSG_TEMP_BED)); _maxtemp = BED_MAX_TARGET; _target = thermalManager.degTargetBed(); break; #endif + #if ENABLED(PIDTEMPCHAMBER) + case PIDTEMPCHAMBER_START: + title.showCaption(GET_TEXT_F(MSG_CHAMBER_TEMP_GRAPH)); + DWINUI::drawCenteredString(3, hmiData.colorPopupTxt, 75, GET_TEXT_F(MSG_TEMP_CHAMBER)); + _maxtemp = CHAMBER_MAX_TARGET; + _target = thermalManager.degTargetChamber(); + break; + #endif default: break; } @@ -1616,39 +1652,42 @@ void dwinLevelingDone() { plot.draw(gfrm, _maxtemp, _target); DWINUI::drawInt(false, 2, hmiData.colorStatusTxt, hmiData.colorPopupBg, 3, gfrm.x + 80, gfrm.y - DWINUI::fontHeight() - 4, _target); DWINUI::drawButton(BTN_Continue, 86, 305); - dwinUpdateLCD(); } void drawHPlot() { TERN_(PIDTEMP, dwinDrawPlot(PIDTEMP_START)); - TERN_(MPCTEMP, dwinDrawPlot(MPCTEMP_START)); + TERN_(MPCTEMP, dwinDrawPlot(MPC_STARTED)); } void drawBPlot() { TERN_(PIDTEMPBED, dwinDrawPlot(PIDTEMPBED_START)); } + void drawCPlot() { + TERN_(PIDTEMPCHAMBER, dwinDrawPlot(PIDTEMPCHAMBER_START)); + } #endif // PROUI_ITEM_PLOT #endif // PROUI_TUNING_GRAPH -#if PROUI_PID_TUNE +#if HAS_PID_HEATING - void dwinStartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp) { - if (seenC) hmiData.pidCycles = c; - if (seenS) { - switch (hid) { - #if ENABLED(PIDTEMP) - case 0 ... HOTENDS - 1: hmiData.hotendPidT = temp; break; - #endif - #if ENABLED(PIDTEMPBED) - case H_BED: hmiData.bedPidT = temp; break; - #endif - default: break; - } + void dwinStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + hmiData.pidCycles = count; + switch (hid) { + #if ENABLED(PIDTEMP) + case 0 ... HOTENDS - 1: hmiData.hotendPIDT = temp; break; + #endif + #if ENABLED(PIDTEMPBED) + case H_BED: hmiData.bedPIDT = temp; break; + #endif + #if ENABLED(PIDTEMPCHAMBER) + case H_CHAMBER: hmiData.chamberPIDT = temp; break; + #endif + default: break; } } - void dwinPidTuning(tempcontrol_t result) { + void dwinPIDTuning(tempcontrol_t result) { hmiValue.tempControl = result; switch (result) { #if ENABLED(PIDTEMP) @@ -1657,22 +1696,20 @@ void dwinLevelingDone() { #if PROUI_TUNING_GRAPH dwinDrawPIDMPCPopup(); #else - dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_NOZZLE)); #endif break; - case PID_TEMP_TOO_HIGH: - checkkey = last_checkkey; - dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); - break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: hmiSaveProcessID(ID_PIDProcess); - #if PROUI_TUNING_GRAPH - dwinDrawPIDMPCPopup(); - #else - dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); - #endif + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_BED)); + break; + #endif + #if ENABLED(PIDTEMPCHAMBER) + case PIDTEMPCHAMBER_START: + hmiSaveProcessID(ID_PIDProcess); + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_CHAMBER)); break; #endif case PID_BAD_HEATER_ID: @@ -1683,24 +1720,29 @@ void dwinLevelingDone() { checkkey = last_checkkey; dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT)); break; + case PID_TEMP_TOO_HIGH: + checkkey = last_checkkey; + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); + break; case AUTOTUNE_DONE: checkkey = last_checkkey; dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); break; default: checkkey = last_checkkey; + dwinPopupConfirm(ICON_Info_0, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_STOPPING)); break; } } -#endif // PROUI_PID_TUNE +#endif // HAS_PID_HEATING #if ENABLED(MPC_AUTOTUNE) void dwinMPCTuning(tempcontrol_t result) { hmiValue.tempControl = result; switch (result) { - case MPCTEMP_START: + case MPC_STARTED: hmiSaveProcessID(ID_MPCProcess); #if PROUI_TUNING_GRAPH dwinDrawPIDMPCPopup(); @@ -1808,12 +1850,14 @@ void dwinSetColorDefaults() { hmiData.colorCoordinate = defColorCoordinate; } +static_assert(ExtUI::eeprom_data_size >= sizeof(hmi_data_t), "Insufficient space in EEPROM for UI parameters"); + void dwinSetDataDefaults() { dwinSetColorDefaults(); DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); - TERN_(PIDTEMP, hmiData.hotendPidT = DEF_HOTENDPIDT); - TERN_(PIDTEMPBED, hmiData.bedPidT = DEF_BEDPIDT); - TERN_(PROUI_PID_TUNE, hmiData.pidCycles = DEF_PIDCYCLES); + TERN_(PIDTEMP, hmiData.hotendPIDT = DEF_HOTENDPIDT); + TERN_(PIDTEMPBED, hmiData.bedPIDT = DEF_BEDPIDT); + TERN_(HAS_PID_HEATING, hmiData.pidCycles = DEF_PIDCYCLES); #if ENABLED(PREVENT_COLD_EXTRUSION) hmiData.extMinT = EXTRUDE_MINTEMP; applyExtMinT(); @@ -1835,12 +1879,11 @@ void dwinSetDataDefaults() { TERN_(LED_COLOR_PRESETS, leds.set_default()); applyLEDColor(); #endif - TERN_(ADAPTIVE_STEP_SMOOTHING, hmiData.adaptiveStepSmoothing = true); TERN_(HAS_GCODE_PREVIEW, hmiData.enablePreview = true); } void dwinCopySettingsTo(char * const buff) { - memcpy(buff, &hmiData, eeprom_data_size); + memcpy(buff, &hmiData, sizeof(hmi_data_t)); } void dwinCopySettingsFrom(const char * const buff) { @@ -1890,14 +1933,16 @@ void MarlinUI::update() { dwinHandleScreen(); // Rotary encoder update } -void MarlinUI::refresh() { /* Nothing to see here */ } - #if HAS_LCD_BRIGHTNESS void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); } #endif void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const) { - dwinDrawPopup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); + #if ANY(TJC_DISPLAY, DACAI_DISPLAY) + dwinDrawPopup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); + #else + dwinDrawPopup(ICON_Printer_0, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); + #endif DWINUI::drawCenteredString(hmiData.colorPopupTxt, 270, GET_TEXT_F(MSG_TURN_OFF)); dwinUpdateLCD(); } @@ -1922,33 +1967,14 @@ void dwinRedrawScreen() { } #if ENABLED(ADVANCED_PAUSE_FEATURE) + void dwinPopupPause(FSTR_P const fmsg, uint8_t button/*=0*/) { hmiSaveProcessID(button ? ID_WaitResponse : ID_NothingToDo); - dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), fmsg, button); - } - - void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { - //if (mode == PAUSE_MODE_SAME) return; - pause_mode = mode; - switch (message) { - case PAUSE_MESSAGE_PARKING: dwinPopupPause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; // M125 - case PAUSE_MESSAGE_CHANGING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; // pause_print (M125, M600) - case PAUSE_MESSAGE_WAITING: dwinPopupPause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break; - case PAUSE_MESSAGE_INSERT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break; - case PAUSE_MESSAGE_LOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; - case PAUSE_MESSAGE_UNLOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; // Unload of pause and Unload of M702 - case PAUSE_MESSAGE_PURGE: dwinPopupPause(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; - case PAUSE_MESSAGE_OPTION: gotoFilamentPurge(); break; - case PAUSE_MESSAGE_RESUME: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; - case PAUSE_MESSAGE_HEAT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), BTN_Continue); break; - case PAUSE_MESSAGE_HEATING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; - case PAUSE_MESSAGE_STATUS: hmiReturnScreen(); break; // Exit from Pause, Load and Unload - default: break; - } + dwinShowPopup(ICON_Pause_1, GET_TEXT_F(MSG_ADVANCED_PAUSE), fmsg, button); } void drawPopupFilamentPurge() { - dwinDrawPopup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE_CONTINUE)); + dwinDrawPopup(ICON_AutoLeveling, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE_CONTINUE)); DWINUI::drawButton(BTN_Purge, 26, 280); DWINUI::drawButton(BTN_Continue, 146, 280); drawSelectHighlight(true); @@ -1973,7 +1999,7 @@ void dwinRedrawScreen() { #if HAS_MESH void dwinMeshViewer() { if (!leveling_is_valid()) - dwinPopupContinue(ICON_BLTouch, GET_TEXT_F(MSG_MESH_VIEWER), GET_TEXT_F(MSG_NO_VALID_MESH)); + dwinPopupContinue(ICON_Leveling_1, GET_TEXT_F(MSG_MESH_VIEWER), GET_TEXT_F(MSG_NO_VALID_MESH)); else { hmiSaveProcessID(ID_WaitResponse); meshViewer.draw(); @@ -3091,17 +3117,17 @@ void drawPrepareMenu() { if (SET_MENU(trammingMenu, MSG_BED_TRAMMING, 8)) { BACK_ITEM(drawPrepareMenu); #if HAS_BED_PROBE && HAS_MESH - MENU_ITEM(ICON_ProbeSet, MSG_TRAMMING_WIZARD, onDrawMenuItem, trammingwizard); - EDIT_ITEM(ICON_ProbeSet, MSG_BED_TRAMMING_MANUAL, onDrawChkbMenu, setManualTramming, &hmiData.fullManualTramming); + MENU_ITEM(ICON_Tram, MSG_TRAMMING_WIZARD, onDrawMenuItem, trammingwizard); + EDIT_ITEM(ICON_Version, MSG_BED_TRAMMING_MANUAL, onDrawChkbMenu, setManualTramming, &hmiData.fullManualTramming); #elif !HAS_BED_PROBE && HAS_ZOFFSET_ITEM MENU_ITEM_F(ICON_MoveZ0, "Home Z and disable", onDrawMenuItem, homeZAndDisable); #endif - MENU_ITEM(ICON_Axis, MSG_TRAM_FL, onDrawMenuItem, []{ (void)tram(0); }); - MENU_ITEM(ICON_Axis, MSG_TRAM_FR, onDrawMenuItem, []{ (void)tram(1); }); - MENU_ITEM(ICON_Axis, MSG_TRAM_BR, onDrawMenuItem, []{ (void)tram(2); }); - MENU_ITEM(ICON_Axis, MSG_TRAM_BL, onDrawMenuItem, []{ (void)tram(3); }); + MENU_ITEM(ICON_AxisBL, MSG_TRAM_FL, onDrawMenuItem, []{ (void)tram(0); }); + MENU_ITEM(ICON_AxisBR, MSG_TRAM_FR, onDrawMenuItem, []{ (void)tram(1); }); + MENU_ITEM(ICON_AxisTR, MSG_TRAM_BR, onDrawMenuItem, []{ (void)tram(2); }); + MENU_ITEM(ICON_AxisTL, MSG_TRAM_BL, onDrawMenuItem, []{ (void)tram(3); }); #if ENABLED(BED_TRAMMING_INCLUDE_CENTER) - MENU_ITEM(ICON_Axis, MSG_TRAM_C, onDrawMenuItem, []{ (void)tram(4); }); + MENU_ITEM(ICON_AxisC, MSG_TRAM_C, onDrawMenuItem, []{ (void)tram(4); }); #endif } updateMenu(trammingMenu); @@ -3120,7 +3146,7 @@ void drawControlMenu() { enableLiveCaseLightBrightness = true; // Allow live update of brightness in control menu MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawSubMenu, drawCaseLightMenu); #else - MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); + EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); #endif #endif #if ENABLED(LED_CONTROL_MENU) @@ -3147,13 +3173,13 @@ void drawAdvancedSettingsMenu() { MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); #endif #if HAS_MESH - MENU_ITEM(ICON_ProbeSet, MSG_MESH_LEVELING, onDrawSubMenu, drawMeshSetMenu); + MENU_ITEM(ICON_Mesh, MSG_MESH_LEVELING, onDrawSubMenu, drawMeshSetMenu); #endif #if HAS_BED_PROBE - MENU_ITEM(ICON_ProbeSet, MSG_ZPROBE_SETTINGS, onDrawSubMenu, drawProbeSetMenu); + MENU_ITEM(ICON_Probe, MSG_ZPROBE_SETTINGS, onDrawSubMenu, drawProbeSetMenu); #endif #if HAS_HOME_OFFSET - MENU_ITEM(ICON_ProbeSet, MSG_SET_HOME_OFFSETS, onDrawSubMenu, drawHomeOffsetMenu); + MENU_ITEM(ICON_HomeOffset, MSG_SET_HOME_OFFSETS, onDrawSubMenu, drawHomeOffsetMenu); #endif MENU_ITEM(ICON_FilSet, MSG_FILAMENT_SET, onDrawSubMenu, drawFilSetMenu); #if ENABLED(PIDTEMP) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) @@ -3179,7 +3205,7 @@ void drawAdvancedSettingsMenu() { MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, dwinLockScreen); #endif #if ENABLED(EDITABLE_DISPLAY_TIMEOUT) - EDIT_ITEM(ICON_Brightness, MSG_SCREEN_TIMEOUT, onDrawPIntMenu, setTimer, &ui.backlight_timeout_minutes); + EDIT_ITEM(ICON_RemainTime, MSG_SCREEN_TIMEOUT, onDrawPIntMenu, setTimer, &ui.backlight_timeout_minutes); #endif #if ENABLED(SOUND_MENU_ITEM) EDIT_ITEM(ICON_Sound, MSG_SOUND_ENABLE, onDrawChkbMenu, setEnableSound, &ui.sound_on); @@ -3199,7 +3225,7 @@ void drawAdvancedSettingsMenu() { #endif #if HAS_LCD_BRIGHTNESS EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, setBrightness, &ui.brightness); - MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); + MENU_ITEM(ICON_Box, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); #endif #if HAS_CUSTOM_COLORS MENU_ITEM(ICON_Scolor, MSG_COLORS_SELECT, onDrawSubMenu, drawSelectColorsMenu); @@ -3271,7 +3297,7 @@ void drawMoveMenu() { #if ENABLED(BLTOUCH) MENU_ITEM(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, probeStow); MENU_ITEM(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, probeDeploy); - MENU_ITEM(ICON_BltouchReset, MSG_BLTOUCH_RESET, onDrawMenuItem, bltouch._reset); + MENU_ITEM(ICON_BLTouchReset, MSG_BLTOUCH_RESET, onDrawMenuItem, bltouch._reset); #if HAS_BLTOUCH_HS_MODE EDIT_ITEM(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, setHSMode, &bltouch.high_speed_mode); #endif @@ -3400,10 +3426,10 @@ void drawTuneMenu() { #endif #if HAS_LCD_BRIGHTNESS EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, setBrightness, &ui.brightness); - MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); + MENU_ITEM(ICON_Box, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); #endif #if ENABLED(EDITABLE_DISPLAY_TIMEOUT) - EDIT_ITEM(ICON_Brightness, MSG_SCREEN_TIMEOUT, onDrawPIntMenu, setTimer, &ui.backlight_timeout_minutes); + EDIT_ITEM(ICON_RemainTime, MSG_SCREEN_TIMEOUT, onDrawPIntMenu, setTimer, &ui.backlight_timeout_minutes); #endif #if ALL(PROUI_TUNING_GRAPH, PROUI_ITEM_PLOT) MENU_ITEM(ICON_PIDNozzle, MSG_HOTEND_TEMP_GRAPH, onDrawMenuItem, drawHPlot); @@ -3428,9 +3454,9 @@ void drawTuneMenu() { updateMenu(tuneMenu); } -#if ENABLED(ADAPTIVE_STEP_SMOOTHING) +#if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) void setAdaptiveStepSmoothing() { - toggleCheckboxLine(hmiData.adaptiveStepSmoothing); + toggleCheckboxLine(stepper.adaptive_step_smoothing_enabled); } #endif @@ -3521,8 +3547,8 @@ void drawMotionMenu() { #if ENABLED(SHAPING_MENU) MENU_ITEM(ICON_InputShaping, MSG_INPUT_SHAPING, onDrawSubMenu, drawInputShaping_menu); #endif - #if ENABLED(ADAPTIVE_STEP_SMOOTHING) - EDIT_ITEM(ICON_UBLActive, MSG_STEP_SMOOTHING, onDrawChkbMenu, setAdaptiveStepSmoothing, &hmiData.adaptiveStepSmoothing); + #if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) + EDIT_ITEM(ICON_UBLActive, MSG_STEP_SMOOTHING, onDrawChkbMenu, setAdaptiveStepSmoothing, &stepper.adaptive_step_smoothing_enabled); #endif #if ENABLED(EDITABLE_STEPS_PER_UNIT) MENU_ITEM(ICON_Step, MSG_STEPS_PER_MM, onDrawSteps, drawStepsMenu); @@ -3592,10 +3618,10 @@ void drawFilamentManMenu() { if (notCurrent) { BACK_ITEM(drawTemperatureMenu); #if HAS_HOTEND - EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawSetPreheatHotend, setPreheatEndTemp, &ui.material_preset[hmiValue.select].hotend_temp); + EDIT_ITEM(ICON_HotendTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawSetPreheatHotend, setPreheatEndTemp, &ui.material_preset[hmiValue.select].hotend_temp); #endif #if HAS_HEATED_BED - EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawSetPreheatBed, setPreheatBedTemp, &ui.material_preset[hmiValue.select].bed_temp); + EDIT_ITEM(ICON_BedTemp, MSG_UBL_SET_TEMP_BED, onDrawSetPreheatBed, setPreheatBedTemp, &ui.material_preset[hmiValue.select].bed_temp); #endif #if HAS_FAN EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawSetPreheatFan, setPreheatFanSpeed, &ui.material_preset[hmiValue.select].fan_speed); @@ -3621,10 +3647,10 @@ void drawTemperatureMenu() { if (SET_MENU_R(temperatureMenu, selrect({236, 2, 28, 12}), MSG_TEMPERATURE, 4 + PREHEAT_COUNT)) { BACK_ITEM(drawControlMenu); #if HAS_HOTEND - hotendTargetItem = EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, setHotendTemp, &thermalManager.temp_hotend[0].target); + hotendTargetItem = EDIT_ITEM(ICON_HotendTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, setHotendTemp, &thermalManager.temp_hotend[0].target); #endif #if HAS_HEATED_BED - bedTargetItem = EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, setBedTemp, &thermalManager.temp_bed.target); + bedTargetItem = EDIT_ITEM(ICON_BedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, setBedTemp, &thermalManager.temp_bed.target); #endif #if HAS_FAN fanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, setFanSpeed, &thermalManager.fan_speed[0]); @@ -3847,101 +3873,137 @@ void drawMaxAccelMenu() { #endif // MPC_EDIT_MENU || MPC_AUTOTUNE_MENU -#if PROUI_PID_TUNE - void setPID(celsius_t t, heater_id_t h) { - gcode.process_subcommands_now( - MString<60>(F("G28OXY\nG0Z5F300\nG0X"), X_CENTER, F("Y"), Y_CENTER, F("F5000\nM84\nM400")) - ); - thermalManager.PID_autotune(t, h, hmiData.pidCycles, true); - } - void setPidCycles() { setPIntOnClick(3, 50); } -#endif +#if HAS_PID_HEATING -#if ALL(HAS_PID_HEATING, PID_EDIT_MENU) + #if ENABLED(PID_AUTOTUNE_MENU) + void setPID(celsius_t t, heater_id_t h) { + gcode.process_subcommands_now( + MString<60>(F("G28OXY\nG0Z5F300\nG0X"), X_CENTER, F("Y"), Y_CENTER, F("F5000\nM84\nM400")) + ); + thermalManager.PID_autotune(t, h, hmiData.pidCycles, true); + } + void setPIDCycles() { setPIntOnClick(3, 50); } + #endif - void setKp() { setPFloatOnClick(0, 1000, 2); } - void applyPIDi() { - *menuData.floatPtr = scalePID_i(menuData.value / POW(10, 2)); - TERN_(PIDTEMP, thermalManager.updatePID()); - } - void applyPIDd() { - *menuData.floatPtr = scalePID_d(menuData.value / POW(10, 2)); - TERN_(PIDTEMP, thermalManager.updatePID()); - } - void setKi() { - menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; - const float value = unscalePID_i(*menuData.floatPtr); - setFloatOnClick(0, 1000, 2, value, applyPIDi); - } - void setKd() { - menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; - const float value = unscalePID_d(*menuData.floatPtr); - setFloatOnClick(0, 1000, 2, value, applyPIDd); - } - void onDrawPIDi(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast(menuitem)->value)); } - void onDrawPIDd(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast(menuitem)->value)); } + #if ENABLED(PID_EDIT_MENU) + void setKp() { setPFloatOnClick(0, 1000, 2); } + void applyPIDi() { + *menuData.floatPtr = scalePID_i(menuData.value / POW(10, 2)); + TERN_(PIDTEMP, thermalManager.updatePID()); + } + void applyPIDd() { + *menuData.floatPtr = scalePID_d(menuData.value / POW(10, 2)); + TERN_(PIDTEMP, thermalManager.updatePID()); + } + void setKi() { + menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; + const float value = unscalePID_i(*menuData.floatPtr); + setFloatOnClick(0, 1000, 2, value, applyPIDi); + } + void setKd() { + menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; + const float value = unscalePID_d(*menuData.floatPtr); + setFloatOnClick(0, 1000, 2, value, applyPIDd); + } + void onDrawPIDi(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast(menuitem)->value)); } + void onDrawPIDd(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast(menuitem)->value)); } + #endif // PID_EDIT_MENU -#endif // HAS_PID_HEATING && PID_EDIT_MENU +#endif // HAS_PID_HEATING -#if ENABLED(PIDTEMP) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) +#if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - #if ENABLED(PID_AUTOTUNE_MENU) - void hotendPID() { setPID(hmiData.hotendPidT, H_E0); } - void setHotendPidT() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP); } - #endif + #if ENABLED(PIDTEMP) - void drawHotendPIDMenu() { - checkkey = ID_Menu; - if (SET_MENU_F(hotendPIDMenu, STR_HOTEND_PID " Settings", 8)) { - BACK_ITEM(drawAdvancedSettingsMenu); - #if ENABLED(PID_AUTOTUNE_MENU) - MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID, onDrawMenuItem, hotendPID); - EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setHotendPidT, &hmiData.hotendPidT); - EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPidCycles, &hmiData.pidCycles); - #endif - #if ENABLED(PID_EDIT_MENU) - EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KP, onDrawPFloat2Menu, setKp, &thermalManager.temp_hotend[0].pid.Kp); - EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KI, onDrawPIDi, setKi, &thermalManager.temp_hotend[0].pid.Ki); - EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KD, onDrawPIDd, setKd, &thermalManager.temp_hotend[0].pid.Kd); - #endif - #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); - #endif + #if ENABLED(PID_AUTOTUNE_MENU) + void hotendPID() { setPID(hmiData.hotendPIDT, H_E0); } + void setHotendPIDT() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP); } + #endif + + void drawHotendPIDMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(hotendPIDMenu, STR_HOTEND_PID " Settings", 8)) { + BACK_ITEM(drawAdvancedSettingsMenu); + #if ENABLED(PID_AUTOTUNE_MENU) + MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID, onDrawMenuItem, hotendPID); + EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setHotendPIDT, &hmiData.hotendPIDT); + EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPIDCycles, &hmiData.pidCycles); + #endif + #if ENABLED(PID_EDIT_MENU) + EDIT_ITEM_F(ICON_PIDValue, "Set Kp: ", onDrawPFloat2Menu, setKp, &thermalManager.temp_hotend[0].pid.Kp); + EDIT_ITEM_F(ICON_PIDValue, "Set Ki: ", onDrawPIDi, setKi, &thermalManager.temp_hotend[0].pid.Ki); + EDIT_ITEM_F(ICON_PIDValue, "Set Kd: ", onDrawPIDd, setKd, &thermalManager.temp_hotend[0].pid.Kd); + #endif + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); + #endif + } + updateMenu(hotendPIDMenu); } - updateMenu(hotendPIDMenu); - } -#endif // PIDTEMP && (PID_AUTOTUNE_MENU || PID_EDIT_MENU) + #endif // PIDTEMP -#if ENABLED(PIDTEMPBED) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) + #if ENABLED(PIDTEMPBED) - #if ENABLED(PID_AUTOTUNE_MENU) - void bedPID() { setPID(hmiData.bedPidT, H_BED); } - void setBedPidT() { setPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } - #endif + #if ENABLED(PID_AUTOTUNE_MENU) + void bedPID() { setPID(hmiData.bedPIDT, H_BED); } + void setBedPIDT() { setPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } + #endif - void drawBedPIDMenu() { - checkkey = ID_Menu; - if (SET_MENU_F(bedPIDMenu, STR_BED_PID " Settings", 8)) { - BACK_ITEM(drawAdvancedSettingsMenu); - #if ENABLED(PID_AUTOTUNE_MENU) - MENU_ITEM_F(ICON_PIDBed, STR_BED_PID, onDrawMenuItem,bedPID); - EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setBedPidT, &hmiData.bedPidT); - EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPidCycles, &hmiData.pidCycles); - #endif - #if ENABLED(PID_EDIT_MENU) - EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KP, onDrawPFloat2Menu, setKp, &thermalManager.temp_bed.pid.Kp); - EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KI, onDrawPIDi, setKi, &thermalManager.temp_bed.pid.Ki); - EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KD, onDrawPIDd, setKd, &thermalManager.temp_bed.pid.Kd); - #endif - #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); - #endif + void drawBedPIDMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(bedPIDMenu, STR_BED_PID " Settings", 8)) { + BACK_ITEM(drawAdvancedSettingsMenu); + #if ENABLED(PID_AUTOTUNE_MENU) + MENU_ITEM_F(ICON_PIDBed, STR_BED_PID, onDrawMenuItem,bedPID); + EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setBedPIDT, &hmiData.bedPIDT); + EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPIDCycles, &hmiData.pidCycles); + #endif + #if ENABLED(PID_EDIT_MENU) + EDIT_ITEM_F(ICON_PIDValue, "Set Kp: ", onDrawPFloat2Menu, setKp, &thermalManager.temp_bed.pid.Kp); + EDIT_ITEM_F(ICON_PIDValue, "Set Ki: ", onDrawPIDi, setKi, &thermalManager.temp_bed.pid.Ki); + EDIT_ITEM_F(ICON_PIDValue, "Set Kd: ", onDrawPIDd, setKd, &thermalManager.temp_bed.pid.Kd); + #endif + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); + #endif + } + updateMenu(bedPIDMenu); } - updateMenu(bedPIDMenu); - } -#endif // PIDTEMPBED && (PID_AUTOTUNE_MENU || PID_EDIT_MENU) + #endif // PIDTEMPBED + + #if ENABLED(PIDTEMPCHAMBER) + + #if ENABLED(PID_AUTOTUNE_MENU) + void chamberPID() { setPID(hmiData.chamberPIDT, H_CHAMBER); } + void setChamberPIDT() { setPIntOnClick(MIN_CHAMBERTEMP, MAX_CHAMBERTEMP); } + #endif + + void drawChamberPIDMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(chamberPIDMenu, STR_CHAMBER_PID " Settings", 8)) { + BACK_ITEM(drawAdvancedSettingsMenu); + #if ENABLED(PID_AUTOTUNE_MENU) + MENU_ITEM_F(ICON_PIDChamber, STR_CHAMBER_PID, onDrawMenuItem,chamberPID); + EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setChamberPIDT, &hmiData.chamberPIDT); + EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPIDCycles, &hmiData.pidCycles); + #endif + #if ENABLED(PID_EDIT_MENU) + EDIT_ITEM_F(ICON_PIDValue, "Set Kp: ", onDrawPFloat2Menu, setKp, &thermalManager.temp_chamber.pid.Kp); + EDIT_ITEM_F(ICON_PIDValue, "Set Ki: ", onDrawPIDi, setKi, &thermalManager.temp_chamber.pid.Ki); + EDIT_ITEM_F(ICON_PIDValue, "Set Kd: ", onDrawPIDd, setKd, &thermalManager.temp_chamber.pid.Kd); + #endif + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); + #endif + } + updateMenu(chamberPIDMenu); + } + + #endif // PIDTEMPCHAMBER + +#endif // PID_AUTOTUNE_MENU || PID_EDIT_MENU //============================================================================= @@ -3952,8 +4014,8 @@ void drawMaxAccelMenu() { if (SET_MENU(zOffsetWizMenu, MSG_PROBE_WIZARD, 4)) { BACK_ITEM(drawPrepareMenu); MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, autoHome); - MENU_ITEM(ICON_MoveZ0, MSG_MOVE_NOZZLE_TO_BED, onDrawMenuItem, setMoveZto0); - EDIT_ITEM(ICON_Zoffset, MSG_XATC_UPDATE_Z_OFFSET, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); + MENU_ITEM(ICON_AxisD, MSG_MOVE_NOZZLE_TO_BED, onDrawMenuItem, setMoveZto0); + EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); } updateMenu(zOffsetWizMenu); if (!axis_is_trusted(Z_AXIS)) LCD_MESSAGE_F("WARNING: Z position unknown, move Z to home"); diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index 94b949b5e780..9ec7b5442182 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -53,17 +53,16 @@ enum processID : uint8_t { ID_MainMenu, ID_Menu, ID_SetInt, - ID_SetPInt, - ID_SetIntNoDraw, ID_SetFloat, + ID_SetPInt, ID_SetPFloat, + ID_SetIntNoDraw, ID_PrintProcess, ID_Popup, ID_Leveling, ID_Locked, - ID_Reboot, - ID_PrintDone, ID_ESDiagProcess, + ID_PrintDone, ID_WaitResponse, ID_Homing, ID_PIDProcess, @@ -72,24 +71,34 @@ enum processID : uint8_t { ID_NothingToDo }; -#if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) +#if ANY(HAS_PID_HEATING, MPC_AUTOTUNE) - enum tempcontrol_t : uint8_t { - #if PROUI_PID_TUNE - PIDTEMP_START, - PIDTEMPBED_START, + enum TempControl { + AUTOTUNE_DONE, + #if HAS_PID_HEATING + #if ENABLED(PIDTEMP) + PIDTEMP_START, + #endif + #if ENABLED(PIDTEMPBED) + PIDTEMPBED_START, + #endif + #if ENABLED(PIDTEMPCHAMBER) + PIDTEMPCHAMBER_START, + #endif PID_BAD_HEATER_ID, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, #endif #if ENABLED(MPC_AUTOTUNE) - MPCTEMP_START, + MPC_STARTED, MPC_TEMP_ERROR, MPC_INTERRUPTED, #endif - AUTOTUNE_DONE + TEMPCONTROL_COUNT }; + typedef bits_t(TEMPCONTROL_COUNT) tempcontrol_t; + #endif #define DWIN_CHINESE 123 @@ -117,20 +126,23 @@ typedef struct { uint16_t colorCoordinate; // Temperatures - #if PROUI_PID_TUNE + #if HAS_PID_HEATING int16_t pidCycles = DEF_PIDCYCLES; #if ENABLED(PIDTEMP) - int16_t hotendPidT = DEF_HOTENDPIDT; + celsius_t hotendPIDT = DEF_HOTENDPIDT; #endif #if ENABLED(PIDTEMPBED) - int16_t bedPidT = DEF_BEDPIDT; + celsius_t bedPIDT = DEF_BEDPIDT; + #endif + #if ENABLED(PIDTEMPCHAMBER) + celsius_t chamberPIDT = DEF_CHAMBERPIDT; #endif #endif #if ENABLED(PREVENT_COLD_EXTRUSION) - int16_t extMinT = EXTRUDE_MINTEMP; + celsius_t extMinT = EXTRUDE_MINTEMP; #endif #if ENABLED(PREHEAT_BEFORE_LEVELING) - int16_t bedLevT = LEVELING_BED_TEMP; + celsius_t bedLevT = LEVELING_BED_TEMP; #endif #if ENABLED(BAUD_RATE_GCODE) bool baud115K = false; @@ -144,20 +156,19 @@ typedef struct { bool mediaAutoMount = ENABLED(HAS_SD_EXTENDER); #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) uint8_t zAfterHoming = DEF_Z_AFTER_HOMING; + #define Z_POST_CLEARANCE hmiData.zAfterHoming #endif #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) LEDColor ledColor = defColorLeds; #endif - #if ENABLED(ADAPTIVE_STEP_SMOOTHING) - bool adaptiveStepSmoothing = true; - #endif #if HAS_GCODE_PREVIEW bool enablePreview = true; #endif } hmi_data_t; extern hmi_data_t hmiData; -static constexpr size_t eeprom_data_size = sizeof(hmi_data_t); + +#define EXTUI_EEPROM_DATA_SIZE sizeof(hmi_data_t) typedef struct { int8_t r, g, b; @@ -174,7 +185,7 @@ typedef struct { typedef struct { rgb_t color; // Color - #if ANY(PROUI_PID_TUNE, MPCTEMP) + #if ANY(HAS_PID_HEATING, MPCTEMP) tempcontrol_t tempControl = AUTOTUNE_DONE; #endif uint8_t select = 0; // Auxiliary selector variable @@ -196,8 +207,8 @@ extern hmi_flag_t hmiFlag; extern uint8_t checkkey; // Popups -#if HAS_HOTEND || HAS_HEATED_BED - void dwinPopupTemperature(const bool toohigh); +#if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER + void dwinPopupTemperature(const int_fast8_t heater_id, const uint8_t state); #endif #if ENABLED(POWER_LOSS_RECOVERY) void popupPowerLossRecovery(); @@ -288,7 +299,7 @@ void dwinPrintAborted(); #if HAS_FILAMENT_SENSOR void dwinFilamentRunout(const uint8_t extruder); #endif -void dwinPrintHeader(const char *text); +void dwinPrintHeader(const char * const cstr=nullptr); void dwinSetColorDefaults(); void dwinCopySettingsTo(char * const buff); void dwinCopySettingsFrom(const char * const buff); @@ -313,6 +324,11 @@ void dwinRebootScreen(); #if HAS_ESDIAG void drawEndStopDiag(); #endif +#if ALL(PROUI_TUNING_GRAPH, PROUI_ITEM_PLOT) + void dwinDrawPlot(tempcontrol_t result); + void drawHPlot(); + void drawBPlot(); +#endif // Menu drawing functions void drawPrintFileMenu(); @@ -376,28 +392,29 @@ void drawMaxAccelMenu(); #endif // PID -#if PROUI_PID_TUNE +#if HAS_PID_HEATING #include "../../../module/temperature.h" - void dwinStartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp); - void dwinPidTuning(tempcontrol_t result); - #if PROUI_TUNING_GRAPH - void dwinDrawPIDMPCPopup(); - #endif -#endif -#if ENABLED(PIDTEMP) - #if ENABLED(PID_AUTOTUNE_MENU) - void hotendPID(); - #endif - #if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - void drawHotendPIDMenu(); - #endif -#endif -#if ENABLED(PIDTEMPBED) - #if ENABLED(PID_AUTOTUNE_MENU) - void bedPID(); - #endif + void dwinStartM303(const int count, const heater_id_t hid, const celsius_t temp); + void dwinPIDTuning(tempcontrol_t result); #if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - void drawBedPIDMenu(); + #if ENABLED(PIDTEMP) + #if ENABLED(PID_AUTOTUNE_MENU) + void hotendPID(); + #endif + void drawHotendPIDMenu(); + #endif + #if ENABLED(PIDTEMPBED) + #if ENABLED(PID_AUTOTUNE_MENU) + void bedPID(); + #endif + void drawBedPIDMenu(); + #endif + #if ENABLED(PIDTEMPCHAMBER) + #if ENABLED(PID_AUTOTUNE_MENU) + void chamberPID(); + #endif + void drawChamberPIDMenu(); + #endif #endif #endif @@ -410,3 +427,7 @@ void drawMaxAccelMenu(); void dwinMPCTuning(tempcontrol_t result); #endif #endif + +#if PROUI_TUNING_GRAPH + void dwinDrawPIDMPCPopup(); +#endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 87cb50b8183a..f09d2bd625ab 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -30,6 +30,10 @@ #include "../../../inc/MarlinConfigPre.h" +//#define TJC_DISPLAY // Enable for TJC display +//#define DACAI_DISPLAY // Enable for DACAI display +//#define TITLE_CENTERED // Center Menu Title Text + #if HAS_MESH #define PROUI_MESH_EDIT // Add a menu to edit mesh points #if ENABLED(PROUI_MESH_EDIT) @@ -79,13 +83,28 @@ #if CASELIGHT_USES_BRIGHTNESS #define defCaseLightBrightness 255 #endif + #ifdef Z_AFTER_HOMING #define DEF_Z_AFTER_HOMING Z_AFTER_HOMING #else #define DEF_Z_AFTER_HOMING 0 #endif -#define DEF_HOTENDPIDT TERN(PREHEAT_1_TEMP_BED, PREHEAT_1_TEMP_HOTEND, 195) -#define DEF_BEDPIDT TERN(PREHEAT_1_TEMP_BED, PREHEAT_1_TEMP_HOTEND, 60) + +#ifdef PREHEAT_1_TEMP_HOTEND + #define DEF_HOTENDPIDT PREHEAT_1_TEMP_HOTEND +#else + #define DEF_HOTENDPIDT 195 +#endif +#ifdef PREHEAT_1_TEMP_BED + #define DEF_BEDPIDT PREHEAT_1_TEMP_BED +#else + #define DEF_BEDPIDT 60 +#endif +#ifdef PREHEAT_1_TEMP_CHAMBER + #define DEF_CHAMBERPIDT PREHEAT_1_TEMP_CHAMBER +#else + #define DEF_CHAMBERPIDT 0 +#endif #define DEF_PIDCYCLES 5 /** @@ -103,7 +122,7 @@ #if ENABLED(LIN_ADVANCE) #define PROUI_ITEM_ADVK // Tune > Linear Advance #endif -#if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) +#if ANY(HAS_PID_HEATING, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) #define PROUI_TUNING_GRAPH 1 #endif #if PROUI_TUNING_GRAPH diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp index 7c71b8fc5974..10e53882748b 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp @@ -52,14 +52,6 @@ void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) { dwinSend(i); } -// Draw an Icon with transparent background -// libID: Icon library ID -// picID: Icon ID -// x/y: Upper-left point -void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { - dwinIconShow(false, false, true, libID, picID, x, y); -} - // Copy area from current virtual display area to current screen // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area @@ -134,21 +126,25 @@ void dwinWriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) } } -// Draw an Icon from SRAM without background transparency for DACAI Screens support -void DACAI_ICON_Show(uint16_t x, uint16_t y, uint16_t addr) { - NOMORE(x, DWIN_WIDTH - 1); - NOMORE(y, DWIN_HEIGHT - 1); - size_t i = 0; - dwinByte(i, 0x70); - dwinWord(i, x); - dwinWord(i, y); - dwinWord(i, addr); - dwinSend(i); -} +#if ENABLED(DACAI_DISPLAY) + + // Draw an Icon from SRAM without background transparency for DACAI Screens support + void dacaiIconShow(uint16_t x, uint16_t y, uint16_t addr) { + NOMORE(x, DWIN_WIDTH - 1); + NOMORE(y, DWIN_HEIGHT - 1); + size_t i = 0; + dwinByte(i, 0x70); + dwinWord(i, x); + dwinWord(i, y); + dwinWord(i, addr); + dwinSend(i); + } + +#endif void dwinIconShow(uint16_t x, uint16_t y, uint16_t addr) { #if ENABLED(DACAI_DISPLAY) - DACAI_ICON_Show(x, y, addr); + dacaiIconShow(x, y, addr); #else dwinIconShow(0, 0, 1, x, y, addr); #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.cpp b/Marlin/src/lcd/e3v2/proui/dwinui.cpp index 453e21a240f4..41eab7878588 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwinui.cpp @@ -209,7 +209,7 @@ void DWINUI::drawFloat(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t co // libID: Icon library ID // picID: Icon ID // x/y: Upper-left point -void DWINUI::ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y) { +void DWINUI::iconShow(bool BG, uint8_t icon, uint16_t x, uint16_t y) { const uint8_t libID = ICON TERN_(HAS_CUSTOMICONS, + (icon / 100)); const uint8_t picID = icon TERN_(HAS_CUSTOMICONS, % 100); dwinIconShow(BG, false, !BG, libID, picID, x, y); diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index b0ff00c527d9..27825b0869a0 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -36,14 +36,28 @@ #include "dwin_lcd.h" // Extra Icons +#define ICON_Printer_0 93 +#define ICON_Box 200 +#define ICON_Checkbox 201 +#define ICON_Fade 202 +#define ICON_Mesh 203 +#define ICON_Tilt 204 +#define ICON_Brightness 205 +#define ICON_Probe 206 +#define ICON_AxisD 249 +#define ICON_AxisBR 250 +#define ICON_AxisTR 251 +#define ICON_AxisBL 252 +#define ICON_AxisTL 253 +#define ICON_AxisC 254 + #define ICON_BedSizeX ICON_PrintSize #define ICON_BedSizeY ICON_PrintSize #define ICON_BedTramming ICON_SetHome #define ICON_Binary ICON_Contact -#define ICON_BltouchReset ICON_StockConfiguration -#define ICON_Brightness ICON_Motion +#define ICON_BLTouchReset ICON_ResetEEPROM #define ICON_Cancel ICON_StockConfiguration -#define ICON_CustomPreheat ICON_SetEndTemp +#define ICON_CustomPreheat ICON_BedTemp #define ICON_Error ICON_TempTooHigh #define ICON_esDiag ICON_Info #define ICON_ExtrudeMinT ICON_HotendTemp @@ -55,28 +69,27 @@ #define ICON_HomeX ICON_MoveX #define ICON_HomeY ICON_MoveY #define ICON_HomeZ ICON_MoveZ -#define ICON_HSMode ICON_StockConfiguration +#define ICON_HSMode ICON_MaxAccZ #define ICON_InputShaping ICON_MaxAccelerated #define ICON_JDmm ICON_MaxJerk -#define ICON_Tram ICON_SetEndTemp -#define ICON_Level ICON_HotendTemp -#define ICON_Lock ICON_Cool -#define ICON_ManualMesh ICON_HotendTemp +#define ICON_Level ICON_Mesh +#define ICON_Lock ICON_Checkbox +#define ICON_ManualMesh ICON_Mesh #define ICON_MaxPosX ICON_MoveX #define ICON_MaxPosY ICON_MoveY #define ICON_MaxPosZ ICON_MoveZ -#define ICON_MeshEdit ICON_Homing +#define ICON_MeshEdit ICON_Fade #define ICON_MeshEditX ICON_MoveX #define ICON_MeshEditY ICON_MoveY -#define ICON_MeshEditZ ICON_MoveZ -#define ICON_MeshNext ICON_Axis -#define ICON_MeshPoints ICON_SetEndTemp -#define ICON_MeshReset ICON_StockConfiguration +#define ICON_MeshEditZ ICON_Zoffset +#define ICON_MeshNext ICON_AxisD +#define ICON_MeshPoints ICON_HotendTemp +#define ICON_MeshReset ICON_ResetEEPROM #define ICON_MeshSave ICON_WriteEEPROM -#define ICON_MeshViewer ICON_HotendTemp -#define ICON_MoveZ0 ICON_HotendTemp -#define ICON_Park ICON_Motion -#define ICON_ParkPos ICON_AdvSet +#define ICON_MeshViewer ICON_Mesh +#define ICON_MoveZ0 ICON_CloseMotor +#define ICON_Park ICON_SetHome +#define ICON_ParkPos ICON_AxisC #define ICON_ParkPosX ICON_StepX #define ICON_ParkPosY ICON_StepY #define ICON_ParkPosZ ICON_StepZ @@ -95,18 +108,18 @@ #define ICON_Preheat8 ICON_CustomPreheat #define ICON_Preheat9 ICON_CustomPreheat #define ICON_Preheat10 ICON_CustomPreheat -#define ICON_ProbeDeploy ICON_SetEndTemp +#define ICON_ProbeDeploy ICON_Probe #define ICON_ProbeMargin ICON_PrintSize #define ICON_ProbeSet ICON_SetEndTemp -#define ICON_ProbeStow ICON_SetEndTemp -#define ICON_ProbeTest ICON_SetEndTemp +#define ICON_ProbeStow ICON_Tilt +#define ICON_ProbeTest ICON_Zoffset #define ICON_ProbeZSpeed ICON_MaxSpeedZ #define ICON_Pwrlossr ICON_Motion #define ICON_Reboot ICON_ResetEEPROM #define ICON_Runout ICON_MaxAccE #define ICON_Scolor ICON_MaxSpeed #define ICON_SetBaudRate ICON_Setspeed -#define ICON_SetCustomPreheat ICON_SetEndTemp +#define ICON_SetCustomPreheat ICON_BedTemp #define ICON_SetPreheat1 ICON_SetPLAPreheat #define ICON_SetPreheat2 ICON_SetABSPreheat #define ICON_SetPreheat3 ICON_SetCustomPreheat @@ -125,22 +138,24 @@ #define ICON_TMCYSet ICON_MoveY #define ICON_TMCZSet ICON_MoveZ #define ICON_TMCESet ICON_Extruder -#define ICON_UBLActive ICON_HotendTemp +#define ICON_Tram ICON_Step +#define ICON_UBLActive ICON_Fade #define ICON_UBLSlot ICON_ResetEEPROM #define ICON_UBLMeshSave ICON_WriteEEPROM #define ICON_UBLMeshLoad ICON_ReadEEPROM -#define ICON_UBLTiltGrid ICON_PrintSize #define ICON_UBLSmartFill ICON_StockConfiguration -#define ICON_ZAfterHome ICON_SetEndTemp +#define ICON_UBLTiltGrid ICON_Tilt +#define ICON_ZAfterHome ICON_Tilt +// LED Lights #define ICON_CaseLight ICON_Motion #define ICON_LedControl ICON_Motion // MPC -#define ICON_MPCNozzle ICON_SetEndTemp +#define ICON_MPCNozzle ICON_HotendTemp #define ICON_MPCValue ICON_Contact #define ICON_MPCHeater ICON_Temperature -#define ICON_MPCHeatCap ICON_SetBedTemp +#define ICON_MPCHeatCap ICON_BedTemp #define ICON_MPCFan ICON_FanSpeed // Buttons @@ -300,20 +315,20 @@ namespace DWINUI { // libID: Icon library ID // picID: Icon ID // x/y: Upper-left point - void ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y); + void iconShow(bool BG, uint8_t icon, uint16_t x, uint16_t y); // Draw an Icon with transparent background from the library ICON // icon: Icon ID // x/y: Upper-left point inline void drawIcon(uint8_t icon, uint16_t x, uint16_t y) { - ICON_Show(false, icon, x, y); + iconShow(false, icon, x, y); } // Draw an Icon from the library ICON with its background // icon: Icon ID // x/y: Upper-left point inline void drawIconWB(uint8_t icon, uint16_t x, uint16_t y) { - ICON_Show(true, icon, x, y); + iconShow(true, icon, x, y); } // Draw a numeric integer value @@ -486,6 +501,9 @@ namespace DWINUI { // y: Upper coordinate of the string // *string: The string void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); + inline void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string) { + drawCenteredString(bShow, fid, color, bColor, 2 * x, 0, y, string); + } inline void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { drawCenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string); } diff --git a/Marlin/src/lcd/e3v2/proui/proui_extui.cpp b/Marlin/src/lcd/e3v2/proui/proui_extui.cpp new file mode 100644 index 000000000000..d7aad208cccc --- /dev/null +++ b/Marlin/src/lcd/e3v2/proui/proui_extui.cpp @@ -0,0 +1,246 @@ +/** + * 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 . + * + */ + +/********************* + * proui_extui.cpp * + *********************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * * + * 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. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(DWIN_LCD_PROUI) + +#include "dwin_popup.h" + +#include "../../extui/ui_api.h" +#include "../../../module/stepper.h" + +#if ENABLED(PREVENT_COLD_EXTRUSION) + #include "../../../module/temperature.h" +#endif + +#if ENABLED(POWER_LOSS_RECOVERY) + #include "../../../feature/powerloss.h" +#endif + +namespace ExtUI { + + void onStartup() { dwinInitScreen(); } + + void onIdle() {} + void onPrinterKilled(FSTR_P const error, FSTR_P const component) {} + + void onMediaInserted() {} + void onMediaError() {} + void onMediaRemoved() {} + + void onHeatingError(const heater_id_t heater_id) { + dwinPopupTemperature(heater_id, 2); // "Heating failed" + } + void onMinTempError(const heater_id_t heater_id) { + dwinPopupTemperature(heater_id, 0); // "Too low" + } + void onMaxTempError(const heater_id_t heater_id) { + dwinPopupTemperature(heater_id, 1); // "Too high" + } + + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {} + void onPrintTimerStarted() {} + void onPrintTimerPaused() {} + void onPrintTimerStopped() {} + + #if HAS_FILAMENT_SENSOR + void onFilamentRunout(const extruder_t extruder) { + dwinFilamentRunout(extruder); + } + #endif + + void onUserConfirmRequired(const char * const cstr) { + // TODO: A version of this method that takes an icon and button title, + // or implement some kind of ExtUI enum. + onUserConfirmRequired(ICON_Continue_1, cstr, GET_TEXT_F(MSG_USERWAIT)); + } + + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + dwinPopupConfirm(icon, cstr, fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + dwinPopupConfirm(icon, fstr, fBtn); + } + + void onStatusChanged(const char * const) { dwinCheckStatusMessage(); } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { + if (mode != PAUSE_MODE_SAME) pause_mode = mode; + switch (message) { + case PAUSE_MESSAGE_PARKING: dwinPopupPause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; // M125 + case PAUSE_MESSAGE_CHANGING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; // pause_print (M125, M600) + case PAUSE_MESSAGE_WAITING: dwinPopupPause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break; + case PAUSE_MESSAGE_INSERT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break; + case PAUSE_MESSAGE_LOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; + case PAUSE_MESSAGE_UNLOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; // Unload of pause and Unload of M702 + case PAUSE_MESSAGE_PURGE: dwinPopupPause(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; + case PAUSE_MESSAGE_OPTION: gotoFilamentPurge(); break; + case PAUSE_MESSAGE_RESUME: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; + case PAUSE_MESSAGE_HEAT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), BTN_Continue); break; + case PAUSE_MESSAGE_HEATING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; + case PAUSE_MESSAGE_STATUS: hmiReturnScreen(); break; // Exit from Pause, Load and Unload + default: break; + } + } + #endif + + void onHomingStart() { dwinHomingStart(); } + void onHomingDone() { dwinHomingDone(); } + + void onPrintDone() {} + + void onFactoryReset() { dwinSetDataDefaults(); } + + // Copy settings to EEPROM buffer for write + void onStoreSettings(char *buff) { dwinCopySettingsTo(buff); } + + // Get settings from loaded EEPROM data + void onLoadSettings(const char *buff) { dwinCopySettingsFrom(buff); } + + void onPostprocessSettings() { + // Called after loading or resetting stored settings + } + + void onSettingsStored(const bool success) { + // Called after the entire EEPROM has been written, + // whether successful or not. + } + + void onSettingsLoaded(const bool success) { + // Called after the entire EEPROM has been read, + // whether successful or not. + } + + #if HAS_LEVELING + void onLevelingStart() { dwinLevelingStart(); } + void onLevelingDone() { dwinLevelingDone(); } + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return hmiData.bedLevT; } + #endif + #endif + + #if HAS_MESH + void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { + const int16_t idx = ypos * (GRID_MAX_POINTS_X) + xpos; + dwinMeshUpdate(_MIN(idx, GRID_MAX_POINTS), int(GRID_MAX_POINTS), zval); + dwinRedrawScreen(); + } + + void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { + // Called to indicate a special condition + } + #endif + + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t t) { hmiData.extMinT = t; } + #endif + + #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } + void onPowerLoss() { + // Called when power-loss state is detected + } + void onPowerLossResume() { + // Called on resume from power-loss + recovery.ui_flag_resume = true; + } + #endif + + #if HAS_PID_HEATING + void onPIDTuning(const pidresult_t rst) { + // Called for temperature PID tuning result + switch (rst) { + #if ENABLED(PIDTEMP) + case PID_STARTED: dwinPIDTuning(PIDTEMP_START); break; + #endif + #if ENABLED(PIDTEMPBED) + case PID_BED_STARTED: dwinPIDTuning(PIDTEMPBED_START); break; + #endif + #if ENABLED(PIDTEMPCHAMBER) + case PID_CHAMBER_STARTED: dwinPIDTuning(PIDTEMPCHAMBER_START); break; + #endif + case PID_BAD_HEATER_ID: dwinPIDTuning(tempcontrol_t(PID_BAD_HEATER_ID)); break; + case PID_TEMP_TOO_HIGH: dwinPIDTuning(tempcontrol_t(PID_TEMP_TOO_HIGH)); break; + case PID_TUNING_TIMEOUT: dwinPIDTuning(tempcontrol_t(PID_TUNING_TIMEOUT)); break; + case PID_DONE: dwinPIDTuning(AUTOTUNE_DONE); break; + + } + } + + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + dwinStartM303(count, hid, temp); + } + + #endif + + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature MPC tuning result + switch (rst) { + case MPC_STARTED: dwinMPCTuning(MPC_STARTED); break; + case MPC_TEMP_ERROR: dwinMPCTuning(MPC_TEMP_ERROR); break; + case MPC_INTERRUPTED: dwinMPCTuning(MPC_INTERRUPTED); break; + case MPC_DONE: dwinMPCTuning(AUTOTUNE_DONE); break; + } + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() { dwinRebootScreen(); } + #endif + + void onSteppersDisabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t axis) { + set_axis_untrusted(AxisEnum(axis)); // MRISCOC workaround: https://github.com/MarlinFirmware/Marlin/issues/23095 + } + void onAxisEnabled(const axis_t) {} + +} // ExtUI + +#endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index c29f165d2423..78a8ffa3a26d 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -49,6 +49,10 @@ namespace ExtUI { void onMediaError() { chiron.mediaEvent(AC_media_error); } void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); } + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { #if ENABLED(SPEAKER) ::tone(BEEPER_PIN, frequency, duration); @@ -58,12 +62,34 @@ namespace ExtUI { void onPrintTimerStarted() { chiron.timerEvent(AC_timer_started); } void onPrintTimerPaused() { chiron.timerEvent(AC_timer_paused); } void onPrintTimerStopped() { chiron.timerEvent(AC_timer_stopped); } + void onPrintDone() {} - void onFilamentRunout(const extruder_t) { chiron.filamentRunout(); } + void onFilamentRunout(const extruder_t) { chiron.filamentRunout(); } + + void onUserConfirmRequired(const char * const msg) { chiron.confirmationRequest(msg); } + + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(fstr); + UNUSED(icon); UNUSED(fBtn); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif - void onUserConfirmRequired(const char * const msg) { chiron.confirmationRequest(msg); } - void onStatusChanged(const char * const msg) { chiron.statusChange(msg); } + void onStatusChanged(const char * const msg) { chiron.statusChange(msg); } void onHomingStart() {} void onHomingDone() {} @@ -107,6 +133,9 @@ namespace ExtUI { #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH @@ -121,6 +150,10 @@ namespace ExtUI { } #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -133,13 +166,28 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } + #endif + + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature MPC tuning result + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // ANYCUBIC_LCD_CHIRON diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index 0006091cda2b..79738fab10ac 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -38,21 +38,50 @@ namespace ExtUI { void onStartup() { anycubicTFT.onSetup(); } void onIdle() { anycubicTFT.onCommandScan(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { anycubicTFT.onKillTFT(); } + void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); } void onMediaError() { anycubicTFT.onSDCardError(); } void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); } + + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { TERN_(SPEAKER, ::tone(BEEPER_PIN, frequency, duration)); } void onPrintTimerStarted() { anycubicTFT.onPrintTimerStarted(); } void onPrintTimerPaused() { anycubicTFT.onPrintTimerPaused(); } void onPrintTimerStopped() { anycubicTFT.onPrintTimerStopped(); } + void onFilamentRunout(const extruder_t extruder) { anycubicTFT.onFilamentRunout(); } void onUserConfirmRequired(const char * const msg) { anycubicTFT.onUserConfirmRequired(msg); } + + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(fstr); + UNUSED(icon); UNUSED(fBtn); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif + void onStatusChanged(const char * const msg) {} void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() {} @@ -94,6 +123,9 @@ namespace ExtUI { #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH @@ -106,6 +138,10 @@ namespace ExtUI { } #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -119,13 +155,28 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } + #endif + + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature MPC tuning result + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // ANYCUBIC_LCD_I3MEGA diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp index 709b54a6d76a..abd32aa88c8a 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -283,7 +283,7 @@ void AnycubicTFT::handleSpecialMenu() { break; case '9': // "<09HtBedPID>" - SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed Pid")); + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed PID")); injectCommands(F("M303 E-1 S65 C6 U1")); break; } @@ -328,7 +328,7 @@ void AnycubicTFT::handleSpecialMenu() { break; case '4': // "<04HtbedPID>" - SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed Pid")); + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed PID")); injectCommands(F("M303 E-1 S65 C6 U1")); break; @@ -822,8 +822,8 @@ void AnycubicTFT::getCommandFromTFT() { case 25: // A25 cool down if (!isPrinting()) { - setTargetTemp_celsius(0, (heater_t) BED); - setTargetTemp_celsius(0, (extruder_t) E0); + setTargetTemp_celsius(0, (heater_t)BED); + setTargetTemp_celsius(0, (extruder_t)E0); SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Cooling down... J12"); // J12 cool down } diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp index d4351a4dab6f..b21bee7a7a55 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -49,6 +49,10 @@ namespace ExtUI { void onMediaError() { dgus.mediaEvent(AC_media_error); } void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); } + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { #if ENABLED(SPEAKER) ::tone(BEEPER_PIN, frequency, duration); @@ -58,12 +62,34 @@ namespace ExtUI { void onPrintTimerStarted() { dgus.timerEvent(AC_timer_started); } void onPrintTimerPaused() { dgus.timerEvent(AC_timer_paused); } void onPrintTimerStopped() { dgus.timerEvent(AC_timer_stopped); } + void onPrintDone() {} - void onFilamentRunout(const extruder_t) { dgus.filamentRunout(); } + void onFilamentRunout(const extruder_t) { dgus.filamentRunout(); } void onUserConfirmRequired(const char * const msg) { dgus.confirmationRequest(msg); } - void onStatusChanged(const char * const msg) { dgus.statusChange(msg); } + + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(fstr); + UNUSED(icon); UNUSED(fBtn); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif + + void onStatusChanged(const char * const msg) { dgus.statusChange(msg); } void onHomingStart() { dgus.homingStart(); } void onHomingDone() { dgus.homingComplete(); } @@ -111,6 +137,9 @@ namespace ExtUI { #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH @@ -125,6 +154,10 @@ namespace ExtUI { } #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) // Called when power-loss is enabled/disabled void onSetPowerLoss(const bool) { dgus.powerLoss(); } @@ -135,20 +168,28 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result - switch (rst) { - case PID_STARTED: break; - case PID_BAD_HEATER_ID: break; - case PID_TEMP_TOO_HIGH: break; - case PID_TUNING_TIMEOUT: break; - case PID_DONE: break; - } } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } + #endif + + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature MPC tuning result + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // ANYCUBIC_LCD_VYPER diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index 4403716fff65..6b1632bfec9f 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -62,7 +62,7 @@ void (*DGUSScreenHandler::confirm_action_cb)() = nullptr; filament_data_t filament_data; #endif -void DGUSScreenHandler::sendInfoScreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) { +void DGUSScreenHandler::sendInfoScreen_P(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) { DGUS_VP_Variable ramcopy; if (populate_VPVar(VP_MSGSTR1, &ramcopy)) { ramcopy.memadr = (void*) line1; @@ -89,7 +89,7 @@ void DGUSScreenHandler::handleUserConfirmationPopUp(uint16_t VP, PGM_P const lin popToOldScreen(); confirmVP = VP; - sendInfoScreen(line1, line2, line3, line4, l1, l2, l3, l4); + sendInfoScreen_P(line1, line2, line3, line4, l1, l2, l3, l4); gotoScreen(DGUS_SCREEN_CONFIRM); } diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h index 3764920be1d0..8ee0fa68c8d5 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h @@ -37,12 +37,12 @@ class DGUSScreenHandler { // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen // The bools specifying whether the strings are in RAM or FLASH. - static void sendInfoScreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + static void sendInfoScreen_P(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); static void sendInfoScreen(FSTR_P const line1, FSTR_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { - sendInfoScreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); + sendInfoScreen_P(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); } static void sendInfoScreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { - sendInfoScreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); + sendInfoScreen_P(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); } static void handleUserConfirmationPopUp(uint16_t confirmVP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index b956d62b36fb..2bc6e0d4617a 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -52,6 +52,10 @@ namespace ExtUI { void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {} void onPrintTimerStarted() {} void onPrintTimerPaused() {} @@ -70,10 +74,31 @@ namespace ExtUI { } } + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(fstr); + UNUSED(icon); UNUSED(fBtn); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif + void onStatusChanged(const char * const msg) { screen.setStatusMessage(msg); } void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() {} @@ -115,6 +140,9 @@ namespace ExtUI { #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH @@ -127,6 +155,10 @@ namespace ExtUI { } #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -141,10 +173,12 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result switch (rst) { case PID_STARTED: + case PID_BED_STARTED: + case PID_CHAMBER_STARTED: screen.setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_HEATER_ID: @@ -162,10 +196,40 @@ namespace ExtUI { } screen.gotoScreen(DGUS_SCREEN_MAIN); } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } + #endif + + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature MPC tuning result + switch (rst) { + case MPC_STARTED: + screen.setStatusMessage(GET_TEXT_F(MSG_MPC_AUTOTUNE)); + break; + case MPC_TEMP_ERROR: + //screen.setStatusMessage(GET_TEXT_F(MSG_MPC_TEMP_ERROR)); + break; + case MPC_INTERRUPTED: + //screen.setStatusMessage(GET_TEXT_F(MSG_MPC_INTERRUPTED)); + break; + case MPC_DONE: + //screen.setStatusMessage(GET_TEXT_F(MSG_MPC_AUTOTUNE_DONE)); + break; + } + screen.gotoScreen(DGUS_SCREEN_MAIN); + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // HAS_DGUS_LCD_CLASSIC diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.cpp index 58313e433343..c88412fe2ccc 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.cpp @@ -369,7 +369,7 @@ void DGUSScreenHandler::addCurrentPageStringLength(size_t stringLength, size_t t #endif #if HAS_PID_HEATING - void DGUSScreenHandler::pidTuning(const ExtUI::result_t rst) { + void DGUSScreenHandler::pidTuning(const ExtUI::pidresult_t rst) { dgus.playSound(3); } #endif diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.h index a5f053043c7a..2f8c53f14d0e 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.h @@ -132,7 +132,7 @@ class DGUSScreenHandler { #endif #if HAS_PID_HEATING - static void pidTuning(const ExtUI::result_t rst); + static void pidTuning(const ExtUI::pidresult_t rst); #endif static void steppersStatusChanged(bool steppersEnabled); diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp index fbd8c994c7f8..f3f4ff961cc5 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp @@ -59,6 +59,10 @@ namespace ExtUI { void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { screen.playTone(frequency, duration); } @@ -83,6 +87,26 @@ namespace ExtUI { screen.userConfirmRequired(msg); } + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(fstr); + UNUSED(icon); UNUSED(fBtn); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif + void onStatusChanged(const char * const msg) { screen.setStatusMessage(msg); } @@ -117,22 +141,25 @@ namespace ExtUI { screen.configurationStoreRead(success); } - #if HAS_MESH - void onLevelingStart() { - screen.levelingStart(); - } - - void onLevelingDone() { - screen.levelingEnd(); - } + #if HAS_LEVELING + void onLevelingStart() { screen.levelingStart(); } + void onLevelingDone() { screen.levelingEnd(); } + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { screen.meshUpdate(xpos, ypos); } - void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { } #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -147,10 +174,23 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result screen.pidTuning(rst); } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } + #endif + + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature PID tuning result + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} #endif void onSteppersDisabled() { @@ -160,6 +200,9 @@ namespace ExtUI { void onSteppersEnabled() { screen.steppersStatusChanged(true); } + + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // DGUS_LCD_UI_RELOADED diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index c953b417a53a..b8ef8bcacc04 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -598,7 +598,7 @@ void DGUSRxHandler::filamentMove(DGUS_VP &vp, void *data_ptr) { } if (ExtUI::getActualTemp_celsius(extruder) < (float)EXTRUDE_MINTEMP) { - screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_TEMP_TOO_LOW)); + screen.setStatusMessage(GET_TEXT_F(MSG_TEMP_TOO_LOW)); return; } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 87a0f6ce1228..181d1ae34c04 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -305,9 +305,11 @@ void DGUSScreenHandler::filamentRunout(const ExtUI::extruder_t extruder) { #if HAS_PID_HEATING - void DGUSScreenHandler::pidTuning(const ExtUI::result_t rst) { + void DGUSScreenHandler::pidTuning(const ExtUI::pidresult_t rst) { switch (rst) { case ExtUI::PID_STARTED: + case ExtUI::PID_BED_STARTED: + case ExtUI::PID_CHAMBER_STARTED: setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case ExtUI::PID_BAD_HEATER_ID: diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 2cffd55e2319..ed8b163d870f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -66,7 +66,7 @@ class DGUSScreenHandler { #endif #if HAS_PID_HEATING - static void pidTuning(const ExtUI::result_t rst); + static void pidTuning(const ExtUI::pidresult_t rst); #endif static void setMessageLine(const char * const msg, const uint8_t line); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 3e4911f765ca..fad878a2124f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -54,6 +54,10 @@ namespace ExtUI { void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { screen.playTone(frequency, duration); } @@ -78,12 +82,33 @@ namespace ExtUI { screen.userConfirmRequired(msg); } + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(fstr); + UNUSED(icon); UNUSED(fBtn); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif + void onStatusChanged(const char * const msg) { screen.setStatusMessage(msg); } void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() { @@ -111,6 +136,9 @@ namespace ExtUI { #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH @@ -124,6 +152,10 @@ namespace ExtUI { } #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -138,14 +170,29 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result screen.pidTuning(rst); } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } + #endif + + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature PID tuning result + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // DGUS_LCD_UI_RELOADED diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index 46faa49868f5..fb033b965539 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -47,19 +47,44 @@ namespace ExtUI { } void onIdle() {} void onPrinterKilled(FSTR_P const error, FSTR_P const component) {} + void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} + + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {} + void onPrintTimerStarted() {} void onPrintTimerPaused() {} void onPrintTimerStopped() {} + void onFilamentRunout(const extruder_t extruder) {} + void onUserConfirmRequired(const char * const msg) {} + + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) {} + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) {} + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif + void onStatusChanged(const char * const msg) {} void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() {} @@ -101,6 +126,9 @@ namespace ExtUI { #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH @@ -113,6 +141,10 @@ namespace ExtUI { } #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -126,20 +158,43 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result switch (rst) { - case PID_STARTED: break; - case PID_BAD_HEATER_ID: break; - case PID_TEMP_TOO_HIGH: break; - case PID_TUNING_TIMEOUT: break; - case PID_DONE: break; + case PID_STARTED: + case PID_BED_STARTED: + case PID_CHAMBER_STARTED: break; + case PID_BAD_HEATER_ID: break; + case PID_TEMP_TOO_HIGH: break; + case PID_TUNING_TIMEOUT: break; + case PID_DONE: break; + } + } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } + #endif + + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature MPC tuning result + switch (rst) { + case MPC_STARTED: break; + case MPC_TEMP_ERROR: break; + case MPC_INTERRUPTED: break; + case MPC_DONE: break; } } #endif + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} + #endif + void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // EXTUI_EXAMPLE && EXTENSIBLE_UI diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp index d89e90ece1ea..48c136bd6e8e 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp @@ -51,6 +51,11 @@ namespace ExtUI { #endif } + void onMediaError() { + sound.play(sad_trombone, PLAY_ASYNCHRONOUS); + AlertDialogBox::showError(F("Unable to read media.")); + } + void onMediaRemoved() { #if HAS_MEDIA if (isPrintingFromMedia()) { @@ -65,10 +70,9 @@ namespace ExtUI { #endif } - void onMediaError() { - sound.play(sad_trombone, PLAY_ASYNCHRONOUS); - AlertDialogBox::showError(F("Unable to read media.")); - } + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} void onStatusChanged(const char *lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); } @@ -78,8 +82,8 @@ namespace ExtUI { void onPrintTimerStopped() { InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FINISHED); } - void onPrintTimerPaused() {} + void onPrintDone() {} void onFilamentRunout(const extruder_t extruder) { @@ -117,14 +121,45 @@ namespace ExtUI { ConfirmUserRequestAlertBox::hide(); } + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(fstr); + UNUSED(icon); UNUSED(fBtn); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH - void onMeshUpdate(const int8_t x, const int8_t y, const_float_t val) { BedMeshViewScreen::onMeshUpdate(x, y, val); } - void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { BedMeshViewScreen::onMeshUpdate(x, y, state); } + void onMeshUpdate(const int8_t x, const int8_t y, const_float_t val) { + BedMeshViewScreen::onMeshUpdate(x, y, val); + } + void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { + BedMeshViewScreen::onMeshUpdate(x, y, state); + } + #endif + + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} #endif #if ENABLED(POWER_LOSS_RECOVERY) @@ -140,11 +175,13 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result - //SERIAL_ECHOLNPGM("OnPidTuning:", rst); + //SERIAL_ECHOLNPGM("OnPIDTuning:", rst); switch (rst) { case PID_STARTED: + case PID_BED_STARTED: + case PID_CHAMBER_STARTED: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_HEATER_ID: @@ -162,10 +199,31 @@ namespace ExtUI { } GOTO_SCREEN(StatusScreen); } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } #endif // HAS_PID_HEATING + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature PID tuning result + switch (rst) { + case MPC_STARTED: + StatusScreen::setStatusMessage(GET_TEXT_F(MSG_MPC_AUTOTUNE)); + break; + } + GOTO_SCREEN(StatusScreen); + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} + #endif + void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp index 1c64df500f58..3440cf987daa 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp @@ -98,6 +98,10 @@ void onMediaRemoved() { } } +void onHeatingError(const heater_id_t header_id) {} +void onMinTempError(const heater_id_t header_id) {} +void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t, const uint16_t/*=0*/) { rts.sendData(StartSoundSet, SoundAddr); } @@ -228,6 +232,26 @@ void onUserConfirmRequired(const char *const msg) { lastPauseMsgState = ExtUI::pauseModeStatus; } +// For fancy LCDs include an icon ID, message, and translated button title +void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); +} +void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(fstr); + UNUSED(icon); UNUSED(fBtn); +} + +#if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } +#endif + void onStatusChanged(const char *const statMsg) { for (int16_t j = 0; j < 20; j++) // Clear old message rts.sendData(' ', StatusMessageString + j); @@ -249,41 +273,14 @@ void onFactoryReset() { show_status = true; } -void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {} - -void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { - if (waitway == 3) - if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1))) - rts.sendData(ExchangePageBase + 64, ExchangepageAddr); - #if HAS_MESH - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; // != ((PR_OUTER_END) & 1); - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - if (point.x == xpos && outer == ypos) - rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); - ++abl_probe_index; - } - #endif -} +static_assert(eeprom_data_size >= sizeof(creality_dwin_settings_t), "Insufficient space in EEPROM for UI parameters"); void onStoreSettings(char *buff) { - static_assert( - ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), - "Insufficient space in EEPROM for UI parameters" - ); - // Write to buffer memcpy(buff, &dwin_settings, sizeof(creality_dwin_settings_t)); } void onLoadSettings(const char *buff) { - static_assert( - ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), - "Insufficient space in EEPROM for UI parameters" - ); - creality_dwin_settings_t eepromSettings; memcpy(&eepromSettings, buff, sizeof(creality_dwin_settings_t)); @@ -305,7 +302,7 @@ void onLoadSettings(const char *buff) { } void onSettingsStored(const bool success) { - // This is called after the entire EEPROM has been written, + // Called after the entire EEPROM has been written, // whether successful or not. } @@ -334,6 +331,59 @@ void onSettingsLoaded(const bool success) { rts.setTouchScreenConfiguration(); } +void onPostprocessSettings() {} + +#if HAS_LEVELING + void onLevelingStart() {} + + void onLevelingDone() { + #if HAS_MESH + if (ExtUI::getLevelingIsValid()) { + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); + ++abl_probe_index; + } + + rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off + setLevelingActive(true); + } + else { + rts.sendData(2, AutoLevelIcon); /*Off*/ + setLevelingActive(false); + } + #endif + } +#endif + +#if HAS_MESH + void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {} + + void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { + if (waitway == 3) + if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1))) + rts.sendData(ExchangePageBase + 64, ExchangepageAddr); + #if HAS_MESH + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; // != ((PR_OUTER_END) & 1); + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + if (point.x == xpos && outer == ypos) + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); + ++abl_probe_index; + } + #endif + } +#endif + +#if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} +#endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -351,7 +401,7 @@ void onSettingsLoaded(const bool success) { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp); rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp); @@ -365,39 +415,31 @@ void onSettingsLoaded(const bool success) { #endif onStatusChanged(F("PID Tune Finished")); } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } #endif -void onLevelingStart() {} - -void onLevelingDone() { - #if HAS_MESH - if (ExtUI::getLevelingIsValid()) { - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); - ++abl_probe_index; - } +#if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature PID tuning result + } +#endif - rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off - setLevelingActive(true); - } - else { - rts.sendData(2, AutoLevelIcon); /*Off*/ - setLevelingActive(false); - } - #endif -} +#if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} +#endif -void onSteppersEnabled() {} -void onPrintDone() {} void onHomingStart() {} void onHomingDone() {} + +void onPrintDone() {} + void onSteppersDisabled() {} -void onPostprocessSettings() {} +void onSteppersEnabled() {} +void onAxisDisabled(const axis_t) {} +void onAxisEnabled(const axis_t) {} -} // namespace ExtUI +} // ExtUI #endif // DGUS_LCD_UI_IA_CREALITY diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp index 15810b67a570..15bbf3dc071c 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp @@ -163,21 +163,10 @@ void RTS::onIdle() { TERN_(HAS_MULTI_HOTEND, rts.sendData(uint8_t(getActiveTool() + 1), ActiveToolVP)); if (awaitingUserConfirm() && (lastPauseMsgState != ExtUI::pauseModeStatus || userConfValidation > 99)) { - switch (ExtUI::pauseModeStatus) { - case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; - case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; - case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; - case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break; - case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; - case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; - case PAUSE_MESSAGE_PURGE: ExtUI::onUserConfirmRequired(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; - case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; - case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break; - case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; - case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break; - case PAUSE_MESSAGE_STATUS: break; - default: onUserConfirmRequired(PSTR("Confirm Continue")); break; - } + if (ExtUI::pauseModeStatus < PAUSE_MESSAGE_COUNT) + ui.pause_show_message(ExtUI::pauseModeStatus); + else + ExtUI::onUserConfirmRequired(F("Confirm Continue")); userConfValidation = 0; } else if (pause_resume_selected && !awaitingUserConfirm()) { @@ -804,7 +793,7 @@ void RTS::handleData() { tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100; else tmp_zprobe_offset = float(recdat.data[0]) / 100; - if (WITHIN((tmp_zprobe_offset), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) { + 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) tmpSteps = getZOffset_mm() < tmp_zprobe_offset ? 1 : -1; smartAdjustAxis_steps(-tmpSteps, axis_t(Z), false); diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp index 4865f42354e0..9287091cfe60 100644 --- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp @@ -104,11 +104,13 @@ namespace ExtUI { #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result - //SERIAL_ECHOLNPGM("OnPidTuning:", rst); + //SERIAL_ECHOLNPGM("OnPIDTuning:", rst); switch (rst) { case PID_STARTED: + case PID_BED_STARTED: + case PID_CHAMBER_STARTED: set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_HEATER_ID: @@ -126,6 +128,10 @@ namespace ExtUI { } } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } + #endif void onPrintTimerStarted() { write_to_lcd(F("{SYS:BUILD}")); } @@ -134,16 +140,38 @@ namespace ExtUI { // Not needed for Malyan LCD void onStatusChanged(const char * const) {} + void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} + + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t, const uint16_t/*=0*/) {} + void onFilamentRunout(const extruder_t extruder) {} void onUserConfirmRequired(const char * const) {} + + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) {} + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) {} + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) {} + #endif + void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() {} + void onStoreSettings(char*) {} void onLoadSettings(const char*) {} void onPostprocessSettings() {} @@ -153,6 +181,9 @@ namespace ExtUI { #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH @@ -160,6 +191,10 @@ namespace ExtUI { void onMeshUpdate(const int8_t, const int8_t, const ExtUI::probe_state_t) {} #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -172,8 +207,20 @@ namespace ExtUI { } #endif + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature PID tuning result + } + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} + #endif + void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // MALYAN_LCD diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index eb9cac641ad8..f06ffcd89d7b 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -99,7 +99,9 @@ #define ESTATE(S) (READ(S##_PIN) == S##_ENDSTOP_HIT_STATE) void test_gpio_readlevel_L() { - WRITE(WIFI_IO0_PIN, HIGH); + #if PIN_EXISTS(WIFI_IO0) + WRITE(WIFI_IO0_PIN, HIGH); + #endif delay(10); pw_det_sta = (READ(MKS_TEST_POWER_LOSS_PIN) == LOW); pw_off_sta = (READ(MKS_TEST_PS_ON_PIN) == LOW); @@ -132,7 +134,9 @@ } void test_gpio_readlevel_H() { - WRITE(WIFI_IO0_PIN, LOW); + #if PIN_EXISTS(WIFI_IO0) + WRITE(WIFI_IO0_PIN, LOW); + #endif delay(10); pw_det_sta = (READ(MKS_TEST_POWER_LOSS_PIN) == HIGH); pw_off_sta = (READ(MKS_TEST_PS_ON_PIN) == HIGH); @@ -169,7 +173,9 @@ void init_test_gpio() { endstops.init(); - SET_OUTPUT(WIFI_IO0_PIN); + #if PIN_EXISTS(WIFI_IO0) + SET_OUTPUT(WIFI_IO0_PIN); + #endif #if PIN_EXISTS(MT_DET_1) SET_INPUT_PULLUP(MT_DET_1_PIN); diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index 122712e9e114..46ba86023918 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -1920,7 +1920,9 @@ void mks_esp_wifi_init() { SET_OUTPUT(WIFI_RESET_PIN); WIFI_SET(); SET_OUTPUT(WIFI_IO1_PIN); - SET_INPUT_PULLUP(WIFI_IO0_PIN); + #if PIN_EXISTS(WIFI_IO0) + SET_INPUT_PULLUP(WIFI_IO0_PIN); + #endif WIFI_IO1_SET(); esp_state = TRANSFER_IDLE; diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp index 2d4d19e7a23e..3ce8bb42ec9a 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp @@ -650,12 +650,14 @@ void resetWiFiForUpload(int begin_or_end) { //#if 0 uint32_t start = getWifiTick(); - if (begin_or_end == 0) { - SET_OUTPUT(WIFI_IO0_PIN); - WRITE(WIFI_IO0_PIN, LOW); - } - else - SET_INPUT_PULLUP(WIFI_IO0_PIN); + #if PIN_EXISTS(WIFI_IO0) + if (begin_or_end == 0) { + SET_OUTPUT(WIFI_IO0_PIN); + WRITE(WIFI_IO0_PIN, LOW); + } + else + SET_INPUT_PULLUP(WIFI_IO0_PIN); + #endif WIFI_RESET(); while (getWifiTickDiff(start, getWifiTick()) < 500) { /* nada */ } diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index e33268f3a375..e72167d38013 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -38,19 +38,48 @@ namespace ExtUI { void onStartup() { nextion.startup(); } void onIdle() { nextion.idleLoop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.printerKilled(error, component); } + void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} + + void onHeatingError(const heater_id_t header_id) {} + void onMinTempError(const heater_id_t header_id) {} + void onMaxTempError(const heater_id_t header_id) {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {} void onPrintTimerStarted() {} void onPrintTimerPaused() {} void onPrintTimerStopped() {} void onFilamentRunout(const extruder_t) {} + void onUserConfirmRequired(const char * const msg) { nextion.confirmationRequest(msg); } + + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + onUserConfirmRequired(cstr); + UNUSED(icon); UNUSED(fBtn); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void onPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + stdOnPauseMode(message, mode, extruder); + } + #endif + void onStatusChanged(const char * const msg) { nextion.statusChange(msg); } void onHomingStart() {} void onHomingDone() {} + void onPrintDone() { nextion.PrintFinished(); } void onFactoryReset() {} @@ -92,6 +121,9 @@ namespace ExtUI { #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } + #endif #endif #if HAS_MESH @@ -104,6 +136,10 @@ namespace ExtUI { } #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t) {} + #endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -117,15 +153,29 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result nextion.panelInfo(37); } + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { + // Called by M303 to update the UI + } #endif - void onSteppersDisabled() {} - void onSteppersEnabled() {} + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst) { + // Called for temperature PID tuning result + } + #endif + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash() {} + #endif + + void onSteppersDisabled() {} + void onSteppersEnabled() {} + void onAxisDisabled(const axis_t) {} + void onAxisEnabled(const axis_t) {} } #endif // NEXTION_TFT diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 2ba01a694d0e..ec9b05318c47 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -20,9 +20,9 @@ * */ -/************** - * ui_api.cpp * - **************/ +/************************************* + * ui_api.cpp - Shared ExtUI methods * + *************************************/ /**************************************************************************** * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * @@ -106,7 +106,7 @@ #include "../../feature/host_actions.h" #endif -#if M600_PURGE_MORE_RESUMABLE +#if ENABLED(ADVANCED_PAUSE_FEATURE) #include "../../feature/pause.h" #endif @@ -1116,10 +1116,39 @@ namespace ExtUI { } void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); } - #if M600_PURGE_MORE_RESUMABLE + #if ENABLED(ADVANCED_PAUSE_FEATURE) void setPauseMenuResponse(PauseMenuResponse response) { pause_menu_response = response; } + PauseMode getPauseMode() { return pause_mode; } + PauseMessage pauseModeStatus = PAUSE_MESSAGE_STATUS; - PauseMode getPauseMode() { return pause_mode;} + + void stdOnPauseMode( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + if (mode != PAUSE_MODE_SAME) pause_mode = mode; + pauseModeStatus = message; + switch (message) { + case PAUSE_MESSAGE_PARKING: onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; + case PAUSE_MESSAGE_CHANGING: onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; + case PAUSE_MESSAGE_UNLOAD: onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; + case PAUSE_MESSAGE_WAITING: onUserConfirmRequired(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break; + case PAUSE_MESSAGE_INSERT: onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; + case PAUSE_MESSAGE_LOAD: onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; + case PAUSE_MESSAGE_PURGE: onUserConfirmRequired( + GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE)) + ); + break; + case PAUSE_MESSAGE_RESUME: onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; + case PAUSE_MESSAGE_HEAT: onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break; + case PAUSE_MESSAGE_HEATING: onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; + case PAUSE_MESSAGE_OPTION: onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break; + case PAUSE_MESSAGE_STATUS: break; + default: break; + } + } + #endif void printFile(const char *filename) { @@ -1225,18 +1254,33 @@ namespace ExtUI { } // namespace ExtUI -// At the moment we hook into MarlinUI methods, but this could be cleaned up in the future +// +// MarlinUI passthroughs to ExtUI +// +#if DISABLED(HAS_DWIN_E3V2) + void MarlinUI::init_lcd() { ExtUI::onStartup(); } -void MarlinUI::init_lcd() { ExtUI::onStartup(); } + void MarlinUI::update() { ExtUI::onIdle(); } -void MarlinUI::update() { ExtUI::onIdle(); } + void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const component) { + using namespace ExtUI; + if (!flags.printer_killed) { + flags.printer_killed = true; + onPrinterKilled(error, component); + } + } +#endif -void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const component) { - using namespace ExtUI; - if (!flags.printer_killed) { - flags.printer_killed = true; - onPrinterKilled(error, component); +#if ENABLED(ADVANCED_PAUSE_FEATURE) + + void MarlinUI::pause_show_message( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ + ) { + ExtUI::onPauseMode(message, mode, extruder); } -} + +#endif #endif // EXTENSIBLE_UI diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 50ecd13d7553..8202f7be8d0a 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -46,8 +46,10 @@ #include "../marlinui.h" #include "../../gcode/gcode.h" +#include "../../module/temperature.h" -#if M600_PURGE_MORE_RESUMABLE +#if ENABLED(ADVANCED_PAUSE_FEATURE) + #include "../../module/motion.h" #include "../../feature/pause.h" #endif @@ -57,18 +59,41 @@ namespace ExtUI { // in the EEPROM when the methods onStoreSettings and // onLoadSettings are called. - static constexpr size_t eeprom_data_size = 48; + #ifndef EXTUI_EEPROM_DATA_SIZE + #define EXTUI_EEPROM_DATA_SIZE 48 + #endif + static constexpr size_t eeprom_data_size = EXTUI_EEPROM_DATA_SIZE; enum axis_t : uint8_t { X, Y, Z, I, J, K, U, V, W, X2, Y2, Z2, Z3, Z4 }; enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5, E6, E7 }; enum heater_t : uint8_t { H0, H1, H2, H3, H4, H5, BED, CHAMBER, COOLER }; enum fan_t : uint8_t { FAN0, FAN1, FAN2, FAN3, FAN4, FAN5, FAN6, FAN7 }; - enum result_t : uint8_t { PID_STARTED, PID_BAD_HEATER_ID, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE }; + #if HAS_PID_HEATING + enum pidresult_t : uint8_t { PID_STARTED, PID_BED_STARTED, PID_CHAMBER_STARTED, PID_BAD_HEATER_ID, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE }; + #endif + #if ENABLED(MPC_AUTOTUNE) + enum mpcresult_t : uint8_t { MPC_STARTED, MPC_TEMP_ERROR, MPC_INTERRUPTED, MPC_DONE }; + #endif constexpr uint8_t extruderCount = EXTRUDERS; constexpr uint8_t hotendCount = HOTENDS; constexpr uint8_t fanCount = FAN_COUNT; + inline const axis_t axis_to_axis_t(const AxisEnum a) { + switch (a) { + TERN_(HAS_X_AXIS, case X_AXIS:) + default: return X; + OPTCODE(HAS_Y_AXIS, case Y_AXIS: return Y) + OPTCODE(HAS_Z_AXIS, case Z_AXIS: return Z) + OPTCODE(HAS_I_AXIS, case I_AXIS: return I) + OPTCODE(HAS_J_AXIS, case J_AXIS: return J) + OPTCODE(HAS_K_AXIS, case K_AXIS: return K) + OPTCODE(HAS_U_AXIS, case U_AXIS: return U) + OPTCODE(HAS_V_AXIS, case V_AXIS: return V) + OPTCODE(HAS_W_AXIS, case W_AXIS: return W) + } + } + #if HAS_MESH typedef float bed_mesh_t[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; #endif @@ -209,6 +234,9 @@ namespace ExtUI { bool getLevelingIsValid(); void onLevelingStart(); void onLevelingDone(); + #if ENABLED(PREHEAT_BEFORE_LEVELING) + celsius_t getLevelingBedTemp(); + #endif #if HAS_MESH // Mesh data, utilities, events bed_mesh_t& getMeshArray(); @@ -287,10 +315,9 @@ namespace ExtUI { bool awaitingUserConfirm(); void setUserConfirmed(); - #if M600_PURGE_MORE_RESUMABLE + #if ENABLED(ADVANCED_PAUSE_FEATURE) // "Purge More" has a control screen void setPauseMenuResponse(PauseMenuResponse); - extern PauseMessage pauseModeStatus; PauseMode getPauseMode(); #endif @@ -458,38 +485,76 @@ namespace ExtUI { */ void onStartup(); void onIdle(); + void onMediaInserted(); void onMediaError(); void onMediaRemoved(); + + void onHeatingError(const heater_id_t header_id); + void onMinTempError(const heater_id_t header_id); + void onMaxTempError(const heater_id_t header_id); + void onPlayTone(const uint16_t frequency, const uint16_t duration=0); + void onPrinterKilled(FSTR_P const error, FSTR_P const component); void onSurviveInKilled(); + void onPrintTimerStarted(); void onPrintTimerPaused(); void onPrintTimerStopped(); void onPrintDone(); + void onFilamentRunout(const extruder_t extruder); + void onUserConfirmRequired(const char * const msg); void onUserConfirmRequired(FSTR_P const fstr); + + // For fancy LCDs include an icon ID, message, and translated button title + void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn); + void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn); + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + // Standard stdOnPauseMode sets pauseModeStatus and calls onUserConfirmRequired + extern PauseMessage pauseModeStatus; + void stdOnPauseMode(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder); + void onPauseMode(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder); + #endif + void onStatusChanged(const char * const msg); void onStatusChanged(FSTR_P const fstr); + void onHomingStart(); void onHomingDone(); + void onSteppersDisabled(); void onSteppersEnabled(); + void onAxisDisabled(const axis_t axis); + void onAxisEnabled(const axis_t axis); + void onFactoryReset(); void onStoreSettings(char *); void onLoadSettings(const char *); void onPostprocessSettings(); void onSettingsStored(const bool success); void onSettingsLoaded(const bool success); + + #if ENABLED(PREVENT_COLD_EXTRUSION) + void onSetMinExtrusionTemp(const celsius_t t); + #endif #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff); void onPowerLoss(); void onPowerLossResume(); #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst); + void onPIDTuning(const pidresult_t rst); + void onStartM303(const int count, const heater_id_t hid, const celsius_t temp); + #endif + #if ENABLED(MPC_AUTOTUNE) + void onMPCTuning(const mpcresult_t rst); + #endif + #if ENABLED(PLATFORM_M997_SUPPORT) + void onFirmwareFlash(); #endif }; diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 037beb2b3caa..6885da5ca6b3 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -328,7 +328,6 @@ namespace LanguageNarrow_de { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("PID Autotune fehlge.!"); LSTR MSG_BAD_HEATER_ID = _UxGT("ungültiger Extruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temperatur zu hoch."); - LSTR MSG_TIMEOUT = _UxGT("Timeout"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Autotune fehlge.! Ungültiger Extruder"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune fehlge.! Temperatur zu hoch."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune fehlge.! Timeout."); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 553d9013a243..1ecf65a57fe0 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -155,6 +155,7 @@ namespace LanguageNarrow_en { LSTR MSG_SPINDLE_REVERSE = _UxGT("Spindle Reverse"); LSTR MSG_SWITCH_PS_ON = _UxGT("Switch Power On"); LSTR MSG_SWITCH_PS_OFF = _UxGT("Switch Power Off"); + LSTR MSG_POWER_EDM_FAULT = _UxGT("Power EDM Fault"); LSTR MSG_EXTRUDE = _UxGT("Extrude"); LSTR MSG_RETRACT = _UxGT("Retract"); LSTR MSG_MOVE_AXIS = _UxGT("Move Axis"); @@ -349,19 +350,32 @@ namespace LanguageNarrow_en { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Fact"); LSTR MSG_AUTOTEMP = _UxGT("Autotemp"); + LSTR MSG_TIMEOUT = _UxGT("Timeout"); LSTR MSG_LCD_ON = _UxGT("On"); LSTR MSG_LCD_OFF = _UxGT("Off"); + LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("Autotune * PID"); LSTR MSG_PID_CYCLE = _UxGT("PID Cycles"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID tuning done"); LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Autotune failed!"); + + LSTR MSG_PID_FOR_NOZZLE = _UxGT("for Nozzle is running."); + LSTR MSG_PID_FOR_BED = _UxGT("for BED is running."); + LSTR MSG_PID_FOR_CHAMBER = _UxGT("for CHAMBER is running."); + + LSTR MSG_TEMP_NOZZLE = _UxGT("Nozzle Temperature"); + LSTR MSG_TEMP_BED = _UxGT("Bed Temperature"); + LSTR MSG_TEMP_CHAMBER = _UxGT("Chamber Temperature"); + LSTR MSG_BAD_HEATER_ID = _UxGT("Bad extruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temperature too high."); - LSTR MSG_TIMEOUT = _UxGT("Timeout"); + LSTR MSG_TEMP_TOO_LOW = _UxGT("Temperature too low"); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Autotune failed! Bad extruder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed! Temperature too high."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune failed! Timeout."); + LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Testing heat loss"); LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Heating to >200C"); LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Cooling to ambient"); @@ -377,6 +391,7 @@ namespace LanguageNarrow_en { LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Ambient Co. *"); LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN = _UxGT("Fan coeff."); LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Fan coeff. *"); + LSTR MSG_SELECT_E = _UxGT("Select *"); LSTR MSG_ACC = _UxGT("Accel"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -835,7 +850,7 @@ namespace LanguageNarrow_en { LSTR MSG_XATC = _UxGT("X-Twist Wizard"); LSTR MSG_XATC_DONE = _UxGT("X-Twist Wizard Done!"); - LSTR MSG_XATC_UPDATE_Z_OFFSET = _UxGT("Update Probe Z-Offset to "); + LSTR MSG_XATC_UPDATE_Z_OFFSET = _UxGT("Update Z-Offset to "); LSTR MSG_SOUND = _UxGT("Sound"); @@ -875,7 +890,6 @@ namespace LanguageNarrow_en { LSTR DGUS_MSG_NOT_WHILE_PRINTING = _UxGT("Not allowed during print"); LSTR DGUS_MSG_NOT_WHILE_IDLE = _UxGT("Not allowed while idle"); LSTR DGUS_MSG_NO_FILE_SELECTED = _UxGT("No file selected"); - LSTR DGUS_MSG_TEMP_TOO_LOW = _UxGT("Temperature too low"); LSTR DGUS_MSG_EXECUTING_COMMAND = _UxGT("Executing command..."); LSTR DGUS_MSG_BED_PID_DISABLED = _UxGT("Bed PID disabled"); LSTR DGUS_MSG_PID_DISABLED = _UxGT("PID disabled"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 0ac8f71d5874..09e7f949174f 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -255,12 +255,16 @@ namespace LanguageNarrow_fr { LSTR MSG_AUTOTEMP = _UxGT("Temp. Auto."); LSTR MSG_LCD_ON = _UxGT("Marche"); LSTR MSG_LCD_OFF = _UxGT("Arrêt"); + LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Tuning PID terminé"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Echec Autotune! E incorrect"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Echec Autotune! Temp. trop haute"); LSTR MSG_PID_TIMEOUT = _UxGT("Echec Autotune! Opér. expirée"); + + LSTR MSG_TEMP_TOO_LOW = _UxGT("Temperature trop basse"); + LSTR MSG_SELECT_E = _UxGT("Sélectionner *"); LSTR MSG_ACC = _UxGT("Accélération"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -596,7 +600,6 @@ namespace LanguageNarrow_fr { LSTR DGUS_MSG_NOT_WHILE_PRINTING = _UxGT("Impossible pendant une impression"); LSTR DGUS_MSG_NOT_WHILE_IDLE = _UxGT("Impossible tant que l'imprimante est en attente"); LSTR DGUS_MSG_NO_FILE_SELECTED = _UxGT("Aucun fichier selectionne"); - LSTR DGUS_MSG_TEMP_TOO_LOW = _UxGT("Temperature trop basse"); LSTR DGUS_MSG_EXECUTING_COMMAND = _UxGT("Execution de la commande..."); LSTR DGUS_MSG_BED_PID_DISABLED = _UxGT("Bed PID desactive"); LSTR DGUS_MSG_PID_DISABLED = _UxGT("PID desactive"); diff --git a/Marlin/src/lcd/language/language_fr_na.h b/Marlin/src/lcd/language/language_fr_na.h index 55737555030a..dc31af4fcb0e 100644 --- a/Marlin/src/lcd/language/language_fr_na.h +++ b/Marlin/src/lcd/language/language_fr_na.h @@ -255,12 +255,16 @@ namespace LanguageNarrow_fr_na { LSTR MSG_AUTOTEMP = _UxGT("Temp. Auto."); LSTR MSG_LCD_ON = _UxGT("Marche"); LSTR MSG_LCD_OFF = _UxGT("Arret"); + LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Tuning PID termine"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Echec Autotune! E incorrect"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Echec Autotune! Temp. trop haute"); LSTR MSG_PID_TIMEOUT = _UxGT("Echec Autotune! Oper. expiree"); + + LSTR MSG_TEMP_TOO_LOW = _UxGT("Temperature trop basse"); + LSTR MSG_SELECT_E = _UxGT("Selectionner *"); LSTR MSG_ACC = _UxGT("Acceleration"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -599,7 +603,6 @@ namespace LanguageNarrow_fr_na { LSTR DGUS_MSG_NOT_WHILE_PRINTING = _UxGT("Impossible pendant une impression"); LSTR DGUS_MSG_NOT_WHILE_IDLE = _UxGT("Impossible tant que l'imprimante est en attente"); LSTR DGUS_MSG_NO_FILE_SELECTED = _UxGT("Aucun fichier selectionne"); - LSTR DGUS_MSG_TEMP_TOO_LOW = _UxGT("Temperature trop basse"); LSTR DGUS_MSG_EXECUTING_COMMAND = _UxGT("Execution de la commande..."); LSTR DGUS_MSG_BED_PID_DISABLED = _UxGT("Bed PID desactive"); LSTR DGUS_MSG_PID_DISABLED = _UxGT("PID desactive"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index a1c0dda9d9c0..7a4f17d49b58 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -65,18 +65,18 @@ namespace LanguageNarrow_it { LSTR MSG_MEDIA_UPDATE = _UxGT("Aggiorna ") MEDIA_TYPE_IT; LSTR MSG_KILL_SUBCALL_OVERFLOW = _UxGT("Overflow sottochiamate"); LSTR MSG_LCD_ENDSTOPS = _UxGT("Finecor."); // Max 8 characters - LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Finecorsa Soft"); + LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Finecorsa soft"); LSTR MSG_MAIN_MENU = _UxGT("Menu principale"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Impostaz. avanzate"); LSTR MSG_CONFIGURATION = _UxGT("Configurazione"); LSTR MSG_RUN_AUTO_FILES = _UxGT("Esegui files auto"); - LSTR MSG_DISABLE_STEPPERS = _UxGT("Disabilita Motori"); + LSTR MSG_DISABLE_STEPPERS = _UxGT("Disabilita motori"); LSTR MSG_DEBUG_MENU = _UxGT("Menu di debug"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test barra avanzam."); - LSTR MSG_ENDSTOP_TEST = _UxGT("Test Finecorsa"); + LSTR MSG_ENDSTOP_TEST = _UxGT("Test finecorsa"); LSTR MSG_Z_PROBE = _UxGT("Sonda Z"); LSTR MSG_HOMING = _UxGT("Azzeramento"); - LSTR MSG_AUTO_HOME = _UxGT("Auto Home"); + LSTR MSG_AUTO_HOME = _UxGT("Auto home"); LSTR MSG_AUTO_HOME_A = _UxGT("Home @"); LSTR MSG_AUTO_HOME_X = _UxGT("Home X"); LSTR MSG_AUTO_HOME_Y = _UxGT("Home Y"); @@ -85,13 +85,13 @@ namespace LanguageNarrow_it { LSTR MSG_FILAMENT_SET = _UxGT("Impostaz.filamento"); LSTR MSG_FILAMENT_MAN = _UxGT("Gestione filamento"); LSTR MSG_MANUAL_LEVELING = _UxGT("Livel.manuale"); - LSTR MSG_TRAM_FL = _UxGT("Davanti Sinistra"); - LSTR MSG_TRAM_FR = _UxGT("Davanti Destra"); + LSTR MSG_TRAM_FL = _UxGT("Davanti sinistra"); + LSTR MSG_TRAM_FR = _UxGT("Davanti destra"); LSTR MSG_TRAM_C = _UxGT("Centro"); - LSTR MSG_TRAM_BL = _UxGT("Dietro Sinistra"); - LSTR MSG_TRAM_BR = _UxGT("Dietro Destra"); - LSTR MSG_MANUAL_MESH = _UxGT("Mesh Manuale"); - LSTR MSG_AUTO_MESH = _UxGT("Generaz.Autom.Mesh"); + LSTR MSG_TRAM_BL = _UxGT("Dietro sinistra"); + LSTR MSG_TRAM_BR = _UxGT("Dietro destra"); + LSTR MSG_MANUAL_MESH = _UxGT("Mesh manuale"); + LSTR MSG_AUTO_MESH = _UxGT("Generaz.autom.mesh"); LSTR MSG_AUTO_Z_ALIGN = _UxGT("Allineam.automat. Z"); LSTR MSG_ITERATION = _UxGT("Iterazione G34: %i"); LSTR MSG_DECREASING_ACCURACY = _UxGT("Precisione in calo!"); @@ -100,7 +100,7 @@ namespace LanguageNarrow_it { LSTR MSG_LEVEL_BED_WAITING = _UxGT("Premi per iniziare"); LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("Punto successivo"); LSTR MSG_LEVEL_BED_DONE = _UxGT("Livel. terminato!"); - LSTR MSG_Z_FADE_HEIGHT = _UxGT("Fade Height"); + LSTR MSG_Z_FADE_HEIGHT = _UxGT("Dissolvi altezza"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Imp. offset home"); LSTR MSG_HOME_OFFSET_X = _UxGT("Offset home X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Offset home Y"); @@ -113,21 +113,21 @@ namespace LanguageNarrow_it { LSTR MSG_PREHEAT_1 = _UxGT("Preriscalda ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Preriscalda ") PREHEAT_1_LABEL " ~"; - LSTR MSG_PREHEAT_1_END = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" Ugello"); - LSTR MSG_PREHEAT_1_END_E = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" Ugello ~"); - LSTR MSG_PREHEAT_1_ALL = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" Tutto"); - LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" Piatto"); + LSTR MSG_PREHEAT_1_END = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" ugello"); + LSTR MSG_PREHEAT_1_END_E = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" ugello ~"); + LSTR MSG_PREHEAT_1_ALL = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" tutto"); + LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" piatto"); LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" conf"); LSTR MSG_PREHEAT_M = _UxGT("Preriscalda $"); LSTR MSG_PREHEAT_M_H = _UxGT("Preriscalda $ ~"); - LSTR MSG_PREHEAT_M_END = _UxGT("Preris.$ Ugello"); - LSTR MSG_PREHEAT_M_END_E = _UxGT("Preris.$ Ugello ~"); - LSTR MSG_PREHEAT_M_ALL = _UxGT("Preris.$ Tutto"); - LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Preris.$ Piatto"); + LSTR MSG_PREHEAT_M_END = _UxGT("Preris.$ ugello"); + LSTR MSG_PREHEAT_M_END_E = _UxGT("Preris.$ ugello ~"); + LSTR MSG_PREHEAT_M_ALL = _UxGT("Preris.$ tutto"); + LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Preris.$ piatto"); LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Preris.$ conf"); - LSTR MSG_PREHEAT_HOTEND = _UxGT("Prerisc.Hotend"); + LSTR MSG_PREHEAT_HOTEND = _UxGT("Prerisc.ugello"); LSTR MSG_PREHEAT_CUSTOM = _UxGT("Prerisc.personal."); LSTR MSG_COOLDOWN = _UxGT("Raffredda"); @@ -136,7 +136,7 @@ namespace LanguageNarrow_it { LSTR MSG_SPINDLE_MENU = _UxGT("Controllo mandrino"); LSTR MSG_LASER_POWER = _UxGT("Potenza laser"); LSTR MSG_SPINDLE_POWER = _UxGT("Potenza mandrino"); - LSTR MSG_LASER_TOGGLE = _UxGT("Alterna Laser"); + LSTR MSG_LASER_TOGGLE = _UxGT("Alterna laser"); LSTR MSG_LASER_EVAC_TOGGLE = _UxGT("Alterna soffiatore"); LSTR MSG_LASER_ASSIST_TOGGLE = _UxGT("Alterna aria supp."); LSTR MSG_LASER_PULSE_MS = _UxGT("ms impulso di test"); @@ -150,27 +150,27 @@ namespace LanguageNarrow_it { LSTR MSG_SWITCH_PS_OFF = _UxGT("Spegni aliment."); LSTR MSG_EXTRUDE = _UxGT("Estrudi"); LSTR MSG_RETRACT = _UxGT("Ritrai"); - LSTR MSG_MOVE_AXIS = _UxGT("Muovi Asse"); - LSTR MSG_BED_LEVELING = _UxGT("Livella piano"); - LSTR MSG_LEVEL_BED = _UxGT("Livella piano"); - LSTR MSG_BED_TRAMMING = _UxGT("Tarat.fine piano"); - LSTR MSG_BED_TRAMMING_MANUAL = _UxGT("Tarat.fine Manuale"); - LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Regola la vite finché la sonda non rileva il piano."); - LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Tolleranza raggiunta su tutti gli angoli. Piano livellato!"); + LSTR MSG_MOVE_AXIS = _UxGT("Muovi asse"); + LSTR MSG_BED_LEVELING = _UxGT("Livellamento piatto"); + LSTR MSG_LEVEL_BED = _UxGT("Livella piatto"); + LSTR MSG_BED_TRAMMING = _UxGT("Tarat.fine piatto"); + LSTR MSG_BED_TRAMMING_MANUAL = _UxGT("Tarat.fine manuale"); + LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Regola la vite finché la sonda non rileva il piatto."); + LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Tolleranza raggiunta su tutti gli angoli. Piatto livellato!"); LSTR MSG_BED_TRAMMING_GOOD_POINTS = _UxGT("Punti buoni: "); LSTR MSG_BED_TRAMMING_LAST_Z = _UxGT("Ultimo Z: "); LSTR MSG_NEXT_CORNER = _UxGT("Prossimo punto"); - LSTR MSG_MESH_EDITOR = _UxGT("Editor Mesh"); - LSTR MSG_MESH_VIEWER = _UxGT("Visualiz. Mesh"); - LSTR MSG_EDIT_MESH = _UxGT("Modifica Mesh"); - LSTR MSG_MESH_VIEW = _UxGT("Visualizza Mesh"); - LSTR MSG_EDITING_STOPPED = _UxGT("Modif. Mesh Fermata"); + LSTR MSG_MESH_EDITOR = _UxGT("Editor mesh"); + LSTR MSG_MESH_VIEWER = _UxGT("Visualiz. mesh"); + LSTR MSG_EDIT_MESH = _UxGT("Modifica mesh"); + LSTR MSG_MESH_VIEW = _UxGT("Visualizza mesh"); + LSTR MSG_EDITING_STOPPED = _UxGT("Modif. mesh fermata"); LSTR MSG_NO_VALID_MESH = _UxGT("Mesh non valida"); LSTR MSG_ACTIVATE_MESH = _UxGT("Attiva livellamento"); LSTR MSG_PROBING_POINT = _UxGT("Punto sondato"); LSTR MSG_MESH_X = _UxGT("Indice X"); LSTR MSG_MESH_Y = _UxGT("Indice Y"); - LSTR MSG_MESH_INSET = _UxGT("Mesh Inset"); + LSTR MSG_MESH_INSET = _UxGT("Mesh inset"); LSTR MSG_MESH_MIN_X = _UxGT("Mesh X minimo"); LSTR MSG_MESH_MAX_X = _UxGT("Mesh X massimo"); LSTR MSG_MESH_MIN_Y = _UxGT("Mesh Y minimo"); @@ -186,7 +186,7 @@ namespace LanguageNarrow_it { LSTR MSG_M48_OUT_OF_BOUNDS = _UxGT("Sonda oltre i limiti"); LSTR MSG_M48_DEVIATION = _UxGT("Deviazione"); LSTR MSG_IDEX_MENU = _UxGT("Modo IDEX"); - LSTR MSG_OFFSETS_MENU = _UxGT("Strumenti Offsets"); + LSTR MSG_OFFSETS_MENU = _UxGT("Strumenti offsets"); LSTR MSG_IDEX_MODE_AUTOPARK = _UxGT("Auto-Park"); LSTR MSG_IDEX_MODE_DUPLICATE = _UxGT("Duplicazione"); LSTR MSG_IDEX_MODE_MIRRORED_COPY = _UxGT("Copia speculare"); @@ -197,10 +197,10 @@ namespace LanguageNarrow_it { LSTR MSG_UBL_DOING_G29 = _UxGT("G29 in corso"); LSTR MSG_UBL_TOOLS = _UxGT("Strumenti UBL"); LSTR MSG_LCD_TILTING_MESH = _UxGT("Punto inclinaz."); - LSTR MSG_UBL_TILT_MESH = _UxGT("Inclina Mesh"); + LSTR MSG_UBL_TILT_MESH = _UxGT("Inclina mesh"); LSTR MSG_UBL_TILTING_GRID = _UxGT("Dim.griglia inclin."); LSTR MSG_UBL_MESH_TILTED = _UxGT("Mesh inclinata"); - LSTR MSG_UBL_MANUAL_MESH = _UxGT("Mesh Manuale"); + LSTR MSG_UBL_MANUAL_MESH = _UxGT("Mesh manuale"); LSTR MSG_UBL_MESH_WIZARD = _UxGT("Creaz.guid.mesh UBL"); LSTR MSG_UBL_BC_INSERT = _UxGT("Metti spes. e misura"); LSTR MSG_UBL_BC_INSERT2 = _UxGT("Misura"); @@ -208,57 +208,57 @@ namespace LanguageNarrow_it { LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("Spostamento succes."); LSTR MSG_UBL_ACTIVATE_MESH = _UxGT("Attiva UBL"); LSTR MSG_UBL_DEACTIVATE_MESH = _UxGT("Disattiva UBL"); - LSTR MSG_UBL_SET_TEMP_BED = _UxGT("Temp. Piatto"); - LSTR MSG_UBL_BED_TEMP_CUSTOM = _UxGT("Temp. Piatto"); - LSTR MSG_UBL_SET_TEMP_HOTEND = _UxGT("Temp. Ugello"); - LSTR MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT("Temp. Ugello"); - LSTR MSG_UBL_MESH_EDIT = _UxGT("Modifica Mesh"); - LSTR MSG_UBL_EDIT_CUSTOM_MESH = _UxGT("Modif.Mesh personal."); - LSTR MSG_UBL_FINE_TUNE_MESH = _UxGT("Ritocca Mesh"); - LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Modif.Mesh fatta"); - LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Crea Mesh personal."); - LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Crea Mesh"); - LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Crea Mesh ($)"); - LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Valida Mesh ($)"); - LSTR MSG_UBL_BUILD_COLD_MESH = _UxGT("Crea Mesh a freddo"); - LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("Aggiusta Alt. Mesh"); + LSTR MSG_UBL_SET_TEMP_BED = _UxGT("Temp. piatto"); + LSTR MSG_UBL_BED_TEMP_CUSTOM = _UxGT("Temp. piatto"); + LSTR MSG_UBL_SET_TEMP_HOTEND = _UxGT("Temp. ugello"); + LSTR MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT("Temp. ugello"); + LSTR MSG_UBL_MESH_EDIT = _UxGT("Modifica mesh"); + LSTR MSG_UBL_EDIT_CUSTOM_MESH = _UxGT("Modif.mesh personal."); + LSTR MSG_UBL_FINE_TUNE_MESH = _UxGT("Ritocca mesh"); + LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Modif.mesh fatta"); + LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Crea mesh personal."); + LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Crea mesh"); + LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Crea mesh ($)"); + LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Valida mesh ($)"); + LSTR MSG_UBL_BUILD_COLD_MESH = _UxGT("Crea mesh a freddo"); + LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("Aggiusta alt. mesh"); LSTR MSG_UBL_MESH_HEIGHT_AMOUNT = _UxGT("Altezza"); - LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("Valida Mesh"); - LSTR MSG_G26_HEATING_BED = _UxGT("G26 riscald.letto"); + LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("Valida mesh"); + LSTR MSG_G26_HEATING_BED = _UxGT("G26 riscald.piatto"); LSTR MSG_G26_HEATING_NOZZLE = _UxGT("G26 riscald.ugello"); LSTR MSG_G26_MANUAL_PRIME = _UxGT("Priming manuale..."); LSTR MSG_G26_FIXED_LENGTH = _UxGT("Prime a lung.fissa"); LSTR MSG_G26_PRIME_DONE = _UxGT("Priming terminato"); - LSTR MSG_G26_CANCELED = _UxGT("G26 Annullato"); + LSTR MSG_G26_CANCELED = _UxGT("G26 annullato"); LSTR MSG_G26_LEAVING = _UxGT("Uscita da G26"); - LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("Valida Mesh pers."); - LSTR MSG_UBL_CONTINUE_MESH = _UxGT("Continua Mesh"); - LSTR MSG_UBL_MESH_LEVELING = _UxGT("Livell. Mesh"); + LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("Valida mesh pers."); + LSTR MSG_UBL_CONTINUE_MESH = _UxGT("Continua mesh"); + LSTR MSG_UBL_MESH_LEVELING = _UxGT("Livell. mesh"); LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("Livell. 3 Punti"); - LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("Livell. Griglia Mesh"); - LSTR MSG_UBL_MESH_LEVEL = _UxGT("Livella Mesh"); + LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("Livell. griglia mesh"); + LSTR MSG_UBL_MESH_LEVEL = _UxGT("Livella mesh"); LSTR MSG_UBL_SIDE_POINTS = _UxGT("Punti laterali"); - LSTR MSG_UBL_MAP_TYPE = _UxGT("Tipo di Mappa"); - LSTR MSG_UBL_OUTPUT_MAP = _UxGT("Esporta Mappa"); - LSTR MSG_UBL_OUTPUT_MAP_HOST = _UxGT("Esporta per Host"); + LSTR MSG_UBL_MAP_TYPE = _UxGT("Tipo di mappa"); + LSTR MSG_UBL_OUTPUT_MAP = _UxGT("Esporta mappa"); + LSTR MSG_UBL_OUTPUT_MAP_HOST = _UxGT("Esporta per host"); LSTR MSG_UBL_OUTPUT_MAP_CSV = _UxGT("Esporta in CSV"); LSTR MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT("Backup esterno"); - LSTR MSG_UBL_INFO_UBL = _UxGT("Esporta Info UBL"); + LSTR MSG_UBL_INFO_UBL = _UxGT("Esporta info UBL"); LSTR MSG_UBL_FILLIN_AMOUNT = _UxGT("Riempimento"); - LSTR MSG_UBL_MANUAL_FILLIN = _UxGT("Riempimento Manuale"); - LSTR MSG_UBL_SMART_FILLIN = _UxGT("Riempimento Smart"); - LSTR MSG_UBL_FILLIN_MESH = _UxGT("Riempimento Mesh"); + LSTR MSG_UBL_MANUAL_FILLIN = _UxGT("Riempimento manuale"); + LSTR MSG_UBL_SMART_FILLIN = _UxGT("Riempimento smart"); + LSTR MSG_UBL_FILLIN_MESH = _UxGT("Riempimento mesh"); LSTR MSG_UBL_MESH_FILLED = _UxGT("Pts mancanti riempiti"); LSTR MSG_UBL_MESH_INVALID = _UxGT("Mesh non valida"); - LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Invalida Tutto"); - LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Invalid.Punto Vicino"); - LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Ritocca Tutto"); - LSTR MSG_UBL_FINE_TUNE_CLOSEST = _UxGT("Ritocca Punto Vicino"); - LSTR MSG_UBL_STORAGE_MESH_MENU = _UxGT("Mesh Salvate"); + LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Invalida tutto"); + LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Invalid.punto vicino"); + LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Ritocca tutto"); + LSTR MSG_UBL_FINE_TUNE_CLOSEST = _UxGT("Ritocca punto vicino"); + LSTR MSG_UBL_STORAGE_MESH_MENU = _UxGT("Mesh salvate"); LSTR MSG_UBL_STORAGE_SLOT = _UxGT("Slot di memoria"); - LSTR MSG_UBL_LOAD_MESH = _UxGT("Carica Mesh Piatto"); - LSTR MSG_UBL_SAVE_MESH = _UxGT("Salva Mesh Piatto"); - LSTR MSG_UBL_INVALID_SLOT = _UxGT("Prima selez. uno slot Mesh"); + LSTR MSG_UBL_LOAD_MESH = _UxGT("Carica mesh piatto"); + LSTR MSG_UBL_SAVE_MESH = _UxGT("Salva mesh piatto"); + LSTR MSG_UBL_INVALID_SLOT = _UxGT("Prima selez. uno slot mesh"); LSTR MSG_MESH_LOADED = _UxGT("Mesh %i caricata"); LSTR MSG_MESH_SAVED = _UxGT("Mesh %i salvata"); LSTR MSG_MESH_ACTIVE = _UxGT("Mesh %i attiva"); @@ -266,15 +266,15 @@ namespace LanguageNarrow_it { LSTR MSG_UBL_SAVE_ERROR = _UxGT("Err: Salvataggio UBL"); LSTR MSG_UBL_RESTORE_ERROR = _UxGT("Err: Ripristino UBL"); LSTR MSG_UBL_Z_OFFSET = _UxGT("Z-Offset: "); - LSTR MSG_UBL_Z_OFFSET_STOPPED = _UxGT("Z-Offset Fermato"); + LSTR MSG_UBL_Z_OFFSET_STOPPED = _UxGT("Z-Offset fermato"); LSTR MSG_UBL_STEP_BY_STEP_MENU = _UxGT("UBL passo passo"); - LSTR MSG_UBL_1_BUILD_COLD_MESH = _UxGT("1.Crea Mesh a freddo"); - LSTR MSG_UBL_2_SMART_FILLIN = _UxGT("2.Riempimento Smart"); - LSTR MSG_UBL_3_VALIDATE_MESH_MENU = _UxGT("3.Valida Mesh"); - LSTR MSG_UBL_4_FINE_TUNE_ALL = _UxGT("4.Ritocca All"); - LSTR MSG_UBL_5_VALIDATE_MESH_MENU = _UxGT("5.Valida Mesh"); - LSTR MSG_UBL_6_FINE_TUNE_ALL = _UxGT("6.Ritocca All"); - LSTR MSG_UBL_7_SAVE_MESH = _UxGT("7.Salva Mesh Piatto"); + LSTR MSG_UBL_1_BUILD_COLD_MESH = _UxGT("1.Crea mesh a freddo"); + LSTR MSG_UBL_2_SMART_FILLIN = _UxGT("2.Riempimento smart"); + LSTR MSG_UBL_3_VALIDATE_MESH_MENU = _UxGT("3.Valida mesh"); + LSTR MSG_UBL_4_FINE_TUNE_ALL = _UxGT("4.Ritocca all"); + LSTR MSG_UBL_5_VALIDATE_MESH_MENU = _UxGT("5.Valida mesh"); + LSTR MSG_UBL_6_FINE_TUNE_ALL = _UxGT("6.Ritocca all"); + LSTR MSG_UBL_7_SAVE_MESH = _UxGT("7.Salva mesh piatto"); LSTR MSG_LED_CONTROL = _UxGT("Controllo LED"); LSTR MSG_LEDS = _UxGT("Luci"); @@ -311,7 +311,7 @@ namespace LanguageNarrow_it { LSTR MSG_MOVE_N_MM = _UxGT("Muovi di $mm"); LSTR MSG_MOVE_N_IN = _UxGT("Muovi di $in"); LSTR MSG_MOVE_N_DEG = _UxGT("Muovi di $") LCD_STR_DEGREE; - LSTR MSG_LIVE_MOVE = _UxGT("Modalità Live"); + LSTR MSG_LIVE_MOVE = _UxGT("Modalità live"); LSTR MSG_SPEED = _UxGT("Velocità"); LSTR MSG_MESH_Z_OFFSET = _UxGT("Piatto Z"); LSTR MSG_NOZZLE = _UxGT("Ugello"); @@ -342,6 +342,7 @@ namespace LanguageNarrow_it { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Fact"); LSTR MSG_AUTOTEMP = _UxGT("Autotemp"); + LSTR MSG_TIMEOUT = _UxGT("Tempo scaduto"); LSTR MSG_LCD_ON = _UxGT("On"); LSTR MSG_LCD_OFF = _UxGT("Off"); LSTR MSG_PID_AUTOTUNE = _UxGT("Calibrazione PID"); @@ -351,7 +352,6 @@ namespace LanguageNarrow_it { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Calibr.PID fallito!"); LSTR MSG_BAD_HEATER_ID = _UxGT("Estrusore invalido."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temp.troppo alta."); - LSTR MSG_TIMEOUT = _UxGT("Tempo scaduto"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Calibrazione fallita! Estrusore errato."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Calibrazione fallita! Temperatura troppo alta."); LSTR MSG_PID_TIMEOUT = _UxGT("Calibrazione fallita! Tempo scaduto."); @@ -364,8 +364,8 @@ namespace LanguageNarrow_it { LSTR MSG_MPC_POWER_E = _UxGT("Potenza *"); LSTR MSG_MPC_BLOCK_HEAT_CAPACITY = _UxGT("Capacità riscald."); LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Capac.riscald. *"); - LSTR MSG_SENSOR_RESPONSIVENESS = _UxGT("Reattiv.Sens."); - LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Reattiv.Sens. *"); + LSTR MSG_SENSOR_RESPONSIVENESS = _UxGT("Reattiv.sens."); + LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Reattiv.sens. *"); LSTR MSG_MPC_AMBIENT_XFER_COEFF = _UxGT("Coeff.ambiente"); LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Coeff.amb. *"); LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN = _UxGT("Coeff.ventola"); @@ -373,32 +373,32 @@ namespace LanguageNarrow_it { LSTR MSG_SELECT_E = _UxGT("Seleziona *"); LSTR MSG_ACC = _UxGT("Accel"); LSTR MSG_JERK = _UxGT("Jerk"); - LSTR MSG_VA_JERK = _UxGT("Max Jerk ") STR_A; - LSTR MSG_VB_JERK = _UxGT("Max Jerk ") STR_B; - LSTR MSG_VC_JERK = _UxGT("Max Jerk ") STR_C; - LSTR MSG_VN_JERK = _UxGT("Max Jerk @"); - LSTR MSG_VE_JERK = _UxGT("Max Jerk E"); + LSTR MSG_VA_JERK = _UxGT("Max jerk ") STR_A; + LSTR MSG_VB_JERK = _UxGT("Max jerk ") STR_B; + LSTR MSG_VC_JERK = _UxGT("Max jerk ") STR_C; + LSTR MSG_VN_JERK = _UxGT("Max jerk @"); + LSTR MSG_VE_JERK = _UxGT("Max jerk E"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Deviaz. giunzioni"); LSTR MSG_STEP_SMOOTHING = _UxGT("Leviga passo"); LSTR MSG_MAX_SPEED = _UxGT("Vel.massima (mm/s)"); - LSTR MSG_VMAX_A = _UxGT("Vel.Massima ") STR_A; - LSTR MSG_VMAX_B = _UxGT("Vel.Massima ") STR_B; - LSTR MSG_VMAX_C = _UxGT("Vel.Massima ") STR_C; - LSTR MSG_VMAX_N = _UxGT("Vel.Massima @"); - LSTR MSG_VMAX_E = _UxGT("Vel.Massima E"); - LSTR MSG_VMAX_EN = _UxGT("Vel.Massima *"); - LSTR MSG_VMIN = _UxGT("Vel.Minima"); - LSTR MSG_VTRAV_MIN = _UxGT("Vel.Min spostam."); + LSTR MSG_VMAX_A = _UxGT("Vel.massima ") STR_A; + LSTR MSG_VMAX_B = _UxGT("Vel.massima ") STR_B; + LSTR MSG_VMAX_C = _UxGT("Vel.massima ") STR_C; + LSTR MSG_VMAX_N = _UxGT("Vel.massima @"); + LSTR MSG_VMAX_E = _UxGT("Vel.massima E"); + LSTR MSG_VMAX_EN = _UxGT("Vel.massima *"); + LSTR MSG_VMIN = _UxGT("Vel.minima"); + LSTR MSG_VTRAV_MIN = _UxGT("Vel.min spostam."); LSTR MSG_ACCELERATION = _UxGT("Accelerazione"); - LSTR MSG_AMAX_A = _UxGT("Acc.Massima ") STR_A; - LSTR MSG_AMAX_B = _UxGT("Acc.Massima ") STR_B; - LSTR MSG_AMAX_C = _UxGT("Acc.Massima ") STR_C; - LSTR MSG_AMAX_N = _UxGT("Acc.Massima @"); - LSTR MSG_AMAX_E = _UxGT("Acc.Massima E"); - LSTR MSG_AMAX_EN = _UxGT("Acc.Massima *"); + LSTR MSG_AMAX_A = _UxGT("Acc.massima ") STR_A; + LSTR MSG_AMAX_B = _UxGT("Acc.massima ") STR_B; + LSTR MSG_AMAX_C = _UxGT("Acc.massima ") STR_C; + LSTR MSG_AMAX_N = _UxGT("Acc.massima @"); + LSTR MSG_AMAX_E = _UxGT("Acc.massima E"); + LSTR MSG_AMAX_EN = _UxGT("Acc.massima *"); LSTR MSG_A_RETRACT = _UxGT("A-Ritrazione"); LSTR MSG_A_TRAVEL = _UxGT("A-Spostamento"); - LSTR MSG_INPUT_SHAPING = _UxGT("Input Shaping"); + LSTR MSG_INPUT_SHAPING = _UxGT("Input shaping"); LSTR MSG_SHAPING_ENABLE = _UxGT("Abilita shaping @"); LSTR MSG_SHAPING_DISABLE = _UxGT("Disabil. shaping @"); LSTR MSG_SHAPING_FREQ = _UxGT("Frequenza @"); @@ -435,13 +435,15 @@ namespace LanguageNarrow_it { LSTR MSG_DRAW_MIN_Y = _UxGT("Min Y area disegno"); LSTR MSG_DRAW_MAX_Y = _UxGT("Max Y area disegno"); LSTR MSG_MAX_BELT_LEN = _UxGT("Lungh.max cinghia"); - LSTR MSG_LINEAR_ADVANCE = _UxGT("Avanzam.Lineare"); + LSTR MSG_LINEAR_ADVANCE = _UxGT("Avanzam.lineare"); LSTR MSG_ADVANCE_K = _UxGT("K Avanzamento"); LSTR MSG_ADVANCE_K_E = _UxGT("K Avanzamento *"); LSTR MSG_CONTRAST = _UxGT("Contrasto LCD"); LSTR MSG_BRIGHTNESS = _UxGT("Luminosità LCD"); LSTR MSG_SCREEN_TIMEOUT = _UxGT("Timeout LCD (m)"); - LSTR MSG_BRIGHTNESS_OFF = _UxGT("Spegni Retroillum."); + LSTR MSG_HOTEND_TEMP_GRAPH = _UxGT("Grafico temp.ugello"); + LSTR MSG_BED_TEMP_GRAPH = _UxGT("Grafico temp.piatto"); + LSTR MSG_BRIGHTNESS_OFF = _UxGT("Spegni retroillum."); LSTR MSG_STORE_EEPROM = _UxGT("Salva impostazioni"); LSTR MSG_LOAD_EEPROM = _UxGT("Carica impostazioni"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Ripristina imp."); @@ -488,15 +490,16 @@ namespace LanguageNarrow_it { LSTR MSG_BUTTON_PURGE = _UxGT("Spurga"); LSTR MSG_PAUSING = _UxGT("Messa in pausa..."); LSTR MSG_PAUSE_PRINT = _UxGT("Pausa stampa"); - LSTR MSG_ADVANCED_PAUSE = _UxGT("Pausa Avanzata"); + LSTR MSG_ADVANCED_PAUSE = _UxGT("Pausa avanzata"); LSTR MSG_RESUME_PRINT = _UxGT("Riprendi stampa"); - LSTR MSG_HOST_START_PRINT = _UxGT("Host Avvio"); + LSTR MSG_HOST_START_PRINT = _UxGT("Host avvio"); LSTR MSG_STOP_PRINT = _UxGT("Arresta stampa"); LSTR MSG_END_LOOPS = _UxGT("Fine cicli di rip."); - LSTR MSG_PRINTING_OBJECT = _UxGT("Stampa Oggetto"); - LSTR MSG_CANCEL_OBJECT = _UxGT("Cancella Oggetto"); - LSTR MSG_CANCEL_OBJECT_N = _UxGT("Canc. Oggetto {"); - LSTR MSG_OUTAGE_RECOVERY = _UxGT("Ripresa da PowerLoss"); + LSTR MSG_PRINTING_OBJECT = _UxGT("Stampa oggetto"); + LSTR MSG_CANCEL_OBJECT = _UxGT("Cancella oggetto"); + LSTR MSG_CANCEL_OBJECT_N = _UxGT("Canc. oggetto {"); + LSTR MSG_OUTAGE_RECOVERY = _UxGT("Ripresa da interruz."); + LSTR MSG_RESUME_BED_TEMP = _UxGT("Riprendi temp.piatto"); LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Cont.proc.stampa"); LSTR MSG_MEDIA_MENU = _UxGT("Stampa da ") MEDIA_TYPE_IT; LSTR MSG_NO_MEDIA = MEDIA_TYPE_IT _UxGT(" non presente"); @@ -506,22 +509,22 @@ namespace LanguageNarrow_it { LSTR MSG_PRINTING = _UxGT("Stampa..."); LSTR MSG_STOPPING = _UxGT("Fermata..."); LSTR MSG_REMAINING_TIME = _UxGT("Rimanente"); - LSTR MSG_PRINT_ABORTED = _UxGT("Stampa Annullata"); - LSTR MSG_PRINT_DONE = _UxGT("Stampa Eseguita"); + LSTR MSG_PRINT_ABORTED = _UxGT("Stampa annullata"); + LSTR MSG_PRINT_DONE = _UxGT("Stampa eseguita"); LSTR MSG_PRINTER_KILLED = _UxGT("Stampante uccisa!"); LSTR MSG_TURN_OFF = _UxGT("Spegni stampante"); - LSTR MSG_NO_MOVE = _UxGT("Nessun Movimento"); + LSTR MSG_NO_MOVE = _UxGT("Nessun movimento"); LSTR MSG_KILLED = _UxGT("UCCISO. "); LSTR MSG_STOPPED = _UxGT("ARRESTATO. "); LSTR MSG_FWRETRACT = _UxGT("Ritraz.da firmware"); LSTR MSG_CONTROL_RETRACT = _UxGT("Ritrai mm"); - LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Scamb. Ritrai mm"); - LSTR MSG_CONTROL_RETRACTF = _UxGT("Ritrai V"); + LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Scamb. ritrai mm"); + LSTR MSG_CONTROL_RETRACTF = _UxGT("Ritrai V"); LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Salta mm"); LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("Avanza mm"); LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("Scamb. Avanza mm"); LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("Avanza V"); - LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("Scamb. Avanza V"); + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("Scamb. avanza V"); LSTR MSG_AUTORETRACT = _UxGT("AutoRitrai"); LSTR MSG_FILAMENT_SWAP_LENGTH = _UxGT("Lunghezza scambio"); LSTR MSG_FILAMENT_SWAP_EXTRA = _UxGT("Extra scambio"); @@ -574,11 +577,11 @@ namespace LanguageNarrow_it { LSTR MSG_TOUCHMI_ZTEST = _UxGT("Test Z offset"); LSTR MSG_TOUCHMI_SAVE = _UxGT("Memorizzare"); LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Estendi TouchMI"); - LSTR MSG_MANUAL_DEPLOY = _UxGT("Estendi Sonda-Z"); + LSTR MSG_MANUAL_DEPLOY = _UxGT("Estendi sonda-Z"); LSTR MSG_MANUAL_PENUP = _UxGT("Penna su"); LSTR MSG_MANUAL_PENDOWN = _UxGT("Penna giù"); LSTR MSG_BLTOUCH_STOW = _UxGT("Ritrai BLTouch"); - LSTR MSG_MANUAL_STOW = _UxGT("Ritrai Sonda-Z"); + LSTR MSG_MANUAL_STOW = _UxGT("Ritrai sonda-Z"); LSTR MSG_HOME_FIRST = _UxGT("Home %s prima"); LSTR MSG_ZPROBE_SETTINGS = _UxGT("Impostazioni sonda"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Offsets sonda"); @@ -588,14 +591,14 @@ namespace LanguageNarrow_it { LSTR MSG_ZPROBE_MARGIN = _UxGT("Margine sonda"); LSTR MSG_Z_FEED_RATE = _UxGT("Velocità Z"); LSTR MSG_ENABLE_HS_MODE = _UxGT("Abilita modo HS"); - LSTR MSG_MOVE_NOZZLE_TO_BED = _UxGT("Muovi ugel.su letto"); + LSTR MSG_MOVE_NOZZLE_TO_BED = _UxGT("Muovi ugel.su piatto"); LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystep Z"); LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Totali"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Interrompi se FC"); - LSTR MSG_ERR_HEATING_FAILED = _UxGT("Risc.Fallito"); // Max 12 characters + LSTR MSG_ERR_HEATING_FAILED = _UxGT("Risc.fallito"); // Max 12 characters LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: TEMP RIDONDANTE"); LSTR MSG_ERR_THERMAL_RUNAWAY = _UxGT("TEMP FUORI CONTROLLO"); LSTR MSG_ERR_TEMP_MALFUNCTION = _UxGT("MALFUNZIONAMENTO TEMP"); @@ -610,29 +613,30 @@ namespace LanguageNarrow_it { LSTR MSG_COOLING = _UxGT("Raffreddamento..."); LSTR MSG_BED_HEATING = _UxGT("Risc. piatto..."); LSTR MSG_BED_COOLING = _UxGT("Raffr. piatto..."); + LSTR MSG_BED_ANNEALING = _UxGT("Ricottura..."); LSTR MSG_PROBE_HEATING = _UxGT("Risc. sonda..."); LSTR MSG_PROBE_COOLING = _UxGT("Raffr. sonda..."); LSTR MSG_CHAMBER_HEATING = _UxGT("Risc. camera..."); LSTR MSG_CHAMBER_COOLING = _UxGT("Raffr. camera..."); LSTR MSG_LASER_COOLING = _UxGT("Raffr. laser..."); LSTR MSG_DELTA_CALIBRATE = _UxGT("Calibraz. Delta"); - LSTR MSG_DELTA_CALIBRATION_IN_PROGRESS = _UxGT("Calibrazione Delta in corso"); + LSTR MSG_DELTA_CALIBRATION_IN_PROGRESS = _UxGT("Calibrazione delta in corso"); LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Calibra X"); LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Calibra Y"); LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("Calibra Z"); LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibra centro"); - LSTR MSG_DELTA_SETTINGS = _UxGT("Impostaz. Delta"); + LSTR MSG_DELTA_SETTINGS = _UxGT("Impostaz. delta"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto calibrazione"); - LSTR MSG_DELTA_DIAG_ROD = _UxGT("Barra Diagonale"); + LSTR MSG_DELTA_DIAG_ROD = _UxGT("Barra diagonale"); LSTR MSG_DELTA_HEIGHT = _UxGT("Altezza"); LSTR MSG_DELTA_RADIUS = _UxGT("Raggio"); LSTR MSG_INFO_MENU = _UxGT("Info su stampante"); LSTR MSG_INFO_PRINTER_MENU = _UxGT("Info. stampante"); LSTR MSG_3POINT_LEVELING = _UxGT("Livel. a 3 punti"); - LSTR MSG_LINEAR_LEVELING = _UxGT("Livel. Lineare"); - LSTR MSG_BILINEAR_LEVELING = _UxGT("Livel. Bilineare"); + LSTR MSG_LINEAR_LEVELING = _UxGT("Livel. lineare"); + LSTR MSG_BILINEAR_LEVELING = _UxGT("Livel. bilineare"); LSTR MSG_UBL_LEVELING = _UxGT("Livel.piatto unific."); - LSTR MSG_MESH_LEVELING = _UxGT("Livel. Mesh"); + LSTR MSG_MESH_LEVELING = _UxGT("Livel. mesh"); LSTR MSG_MESH_DONE = _UxGT("Sond.mesh eseguito"); LSTR MSG_INFO_STATS_MENU = _UxGT("Statistiche"); LSTR MSG_RESET_STATS = _UxGT("Reset stat.stampa?"); @@ -644,12 +648,12 @@ namespace LanguageNarrow_it { LSTR MSG_INFO_RUNAWAY_OFF = _UxGT("Controllo fuga: OFF"); LSTR MSG_INFO_RUNAWAY_ON = _UxGT("Controllo fuga: ON"); LSTR MSG_HOTEND_IDLE_TIMEOUT = _UxGT("Timeout inatt.ugello"); - LSTR MSG_HOTEND_IDLE_DISABLE = _UxGT("Disabilita Timeout"); + LSTR MSG_HOTEND_IDLE_DISABLE = _UxGT("Disabilita timeout"); LSTR MSG_HOTEND_IDLE_NOZZLE_TARGET = _UxGT("Temp.inatt.ugello"); - LSTR MSG_HOTEND_IDLE_BED_TARGET = _UxGT("Temp.inatt.letto"); + LSTR MSG_HOTEND_IDLE_BED_TARGET = _UxGT("Temp.inatt.piatto"); LSTR MSG_FAN_SPEED_FAULT = _UxGT("Err.vel.della ventola"); - LSTR MSG_CASE_LIGHT = _UxGT("Luci Case"); + LSTR MSG_CASE_LIGHT = _UxGT("Luci case"); LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Luminosità Luci"); LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("STAMPANTE ERRATA"); @@ -662,13 +666,13 @@ namespace LanguageNarrow_it { LSTR MSG_COLORS_WHITE = _UxGT("Bianco"); LSTR MSG_UI_LANGUAGE = _UxGT("Lingua UI"); LSTR MSG_SOUND_ENABLE = _UxGT("Abilita suono"); - LSTR MSG_LOCKSCREEN = _UxGT("Blocca Schermo"); + LSTR MSG_LOCKSCREEN = _UxGT("Blocca schermo"); LSTR MSG_LOCKSCREEN_LOCKED = _UxGT("Stamp. bloccata,"); LSTR MSG_LOCKSCREEN_UNLOCK = _UxGT("Scroll x sbloccare."); LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Attendere fino al riavvio."); - LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("No Supporto"); - LSTR MSG_PLEASE_PREHEAT = _UxGT("Prerisc. hot end."); + LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("No supporto"); + LSTR MSG_PLEASE_PREHEAT = _UxGT("Prerisc. ugello."); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Stampe"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Durata"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Più lungo"); @@ -678,7 +682,7 @@ namespace LanguageNarrow_it { LSTR MSG_INFO_MIN_TEMP = _UxGT("Temp min"); LSTR MSG_INFO_MAX_TEMP = _UxGT("Temp max"); LSTR MSG_INFO_PSU = _UxGT("Alimentatore"); - LSTR MSG_DRIVE_STRENGTH = _UxGT("Potenza Drive"); + LSTR MSG_DRIVE_STRENGTH = _UxGT("Potenza drive"); LSTR MSG_DAC_PERCENT_N = _UxGT("Driver @ %"); LSTR MSG_ERROR_TMC = _UxGT("ERR.CONNESSIONE TMC"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Scrivi DAC EEPROM"); @@ -793,21 +797,21 @@ namespace LanguageNarrow_it { LSTR MSG_FIXED_TIME_MOTION = _UxGT("Movimento a Tempo-Fisso"); LSTR MSG_FTM_MODE = _UxGT("Modo Movimento:"); - LSTR MSG_FTM_ZV = _UxGT("ZV"); - LSTR MSG_FTM_ZVD = _UxGT("ZVD"); - LSTR MSG_FTM_EI = _UxGT("EI"); - LSTR MSG_FTM_2HEI = _UxGT("2HEI"); - LSTR MSG_FTM_3HEI = _UxGT("3HEI"); - LSTR MSG_FTM_MZV = _UxGT("MZV"); - //LSTR MSG_FTM_ULENDO_FBS = _UxGT("Ulendo FBS"); - //LSTR MSG_FTM_DISCTF = _UxGT("DISCTF"); + //LSTR MSG_FTM_ZV = _UxGT("ZV"); + //LSTR MSG_FTM_ZVD = _UxGT("ZVD"); + //LSTR MSG_FTM_ZVDD = _UxGT("ZVDD"); + //LSTR MSG_FTM_ZVDDD = _UxGT("ZVDDD"); + //LSTR MSG_FTM_EI = _UxGT("EI"); + //LSTR MSG_FTM_2HEI = _UxGT("2HEI"); + //LSTR MSG_FTM_3HEI = _UxGT("3HEI"); + //LSTR MSG_FTM_MZV = _UxGT("MZV"); LSTR MSG_FTM_DYN_MODE = _UxGT("Modo DF:"); LSTR MSG_FTM_Z_BASED = _UxGT("Base-Z"); LSTR MSG_FTM_MASS_BASED = _UxGT("Base-Massa"); - LSTR MSG_FTM_BASE_FREQ_N = _UxGT("@ Freq. Base"); - LSTR MSG_FTM_DFREQ_K_N = _UxGT("@ Freq. Dinam."); - LSTR MSG_FTM_ZETA = _UxGT("Smorzamento"); - LSTR MSG_FTM_VTOL = _UxGT("Livello Vib."); + LSTR MSG_FTM_BASE_FREQ_N = _UxGT("@ Freq. base"); + LSTR MSG_FTM_DFREQ_K_N = _UxGT("@ Freq. dinam."); + LSTR MSG_FTM_ZETA_N = _UxGT("Smorzamento @"); + LSTR MSG_FTM_VTOL_N = _UxGT("Livello vib. @"); LSTR MSG_LEVEL_X_AXIS = _UxGT("Livello asse X"); LSTR MSG_AUTO_CALIBRATE = _UxGT("Auto Calibra"); @@ -845,9 +849,8 @@ namespace LanguageNarrow_it { LSTR DGUS_MSG_NOT_WHILE_PRINTING = _UxGT("Non ammesso durante la stampa"); LSTR DGUS_MSG_NOT_WHILE_IDLE = _UxGT("Non ammesso mentre è in riposo"); LSTR DGUS_MSG_NO_FILE_SELECTED = _UxGT("Nessun file selezionato"); - LSTR DGUS_MSG_TEMP_TOO_LOW = _UxGT("Temperatura troppo bassa"); LSTR DGUS_MSG_EXECUTING_COMMAND = _UxGT("Esecuzione del comando..."); - LSTR DGUS_MSG_BED_PID_DISABLED = _UxGT("PID letto disabilitato"); + LSTR DGUS_MSG_BED_PID_DISABLED = _UxGT("PID piatto disabilitato"); LSTR DGUS_MSG_PID_DISABLED = _UxGT("PID disabilitato"); LSTR DGUS_MSG_PID_AUTOTUNING = _UxGT("Calibrazione PID..."); LSTR DGUS_MSG_INVALID_RECOVERY_DATA = _UxGT("Dati di recupero non validi"); @@ -856,7 +859,7 @@ namespace LanguageNarrow_it { LSTR DGUS_MSG_BUSY = _UxGT("Occupato"); LSTR DGUS_MSG_HOMING = _UxGT("Azzeramento..."); LSTR DGUS_MSG_FW_OUTDATED = _UxGT("Richiesto aggiornamento DWIN GUI/OS"); - LSTR DGUS_MSG_ABL_REQUIRED = _UxGT("Richiesto autolivellamento letto"); + LSTR DGUS_MSG_ABL_REQUIRED = _UxGT("Richiesto autolivellamento piatto"); LSTR DGUS_MSG_PROBING_FAILED = _UxGT("Sondaggio fallito"); LSTR DGUS_MSG_PROBING_SUCCESS = _UxGT("Sondaggio effettuato"); LSTR DGUS_MSG_RESET_EEPROM = _UxGT("Reset EEPROM"); @@ -873,17 +876,18 @@ namespace LanguageWide_it { LSTR MSG_PRINTING_OBJECT = _UxGT("Sto stampando l'oggetto"); LSTR MSG_CANCEL_OBJECT = _UxGT("Cancella l'oggetto"); LSTR MSG_CANCEL_OBJECT_N = _UxGT("Cancella l'oggetto {"); - LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Continua il Job di stampa"); + LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Continua il job di stampa"); LSTR MSG_MEDIA_MENU = _UxGT("Selez.da supporto"); LSTR MSG_TURN_OFF = _UxGT("Spegni la stampante"); LSTR MSG_END_LOOPS = _UxGT("Termina i cicli di ripetizione"); LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("Nessun supporto inserito."); - LSTR MSG_PLEASE_PREHEAT = _UxGT("Si prega di preriscaldare l'hot end."); + LSTR MSG_PLEASE_PREHEAT = _UxGT("Si prega di preriscaldare l'ugello."); LSTR MSG_INFO_PRINT_COUNT_RESET = _UxGT("Azzera i contatori di stampa"); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Contatori di stampa"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Tempo totale"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Lavoro più lungo"); LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Totale estruso"); + LSTR MSG_TEMP_TOO_LOW = _UxGT("Temperatura troppo bassa"); #endif } diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index ffe2fb1ae5c7..851b4ffd0d9a 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -294,6 +294,7 @@ namespace LanguageNarrow_ru { LSTR MSG_MAX = " " LCD_STR_THERMOMETER ", " LCD_STR_DEGREE _UxGT("С макс"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Фактор"); LSTR MSG_AUTOTEMP = _UxGT("Автотемпература"); + LSTR MSG_TIMEOUT = _UxGT("Таймаут."); LSTR MSG_LCD_ON = _UxGT("Вкл"); LSTR MSG_LCD_OFF = _UxGT("Выкл"); @@ -707,7 +708,6 @@ namespace LanguageNarrow_ru { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Автонастройка PID не удалась!"); LSTR MSG_BAD_HEATER_ID = _UxGT("Неверный экструдер."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Слишком высокая температура."); - LSTR MSG_TIMEOUT = _UxGT("Таймаут."); LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Тест потери тепла"); LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Нагрев выше >200C"); LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Охлаждение до окружающей"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 73bf58d99110..dd64c29f2529 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -338,6 +338,7 @@ namespace LanguageNarrow_sk { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Fakt"); LSTR MSG_AUTOTEMP = _UxGT("Auto-teplota"); + LSTR MSG_TIMEOUT = _UxGT("Čas vypršal"); LSTR MSG_LCD_ON = _UxGT("Zap"); LSTR MSG_LCD_OFF = _UxGT("Vyp"); LSTR MSG_PID_AUTOTUNE = _UxGT("Kalibrácia PID"); @@ -347,7 +348,6 @@ namespace LanguageNarrow_sk { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Kal. PID zlyhala!"); LSTR MSG_BAD_HEATER_ID = _UxGT("Zlý extrudér"); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Príliš vysoká tepl."); - LSTR MSG_TIMEOUT = _UxGT("Čas vypršal"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Auto-kal. zlyhala! Zlý extrúder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-kal. zlyhala! Príliš vysoká tepl."); LSTR MSG_PID_TIMEOUT = _UxGT("Auto-kal. zlyhala! Čas vypršal."); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 86c39b344eb7..1a335bac3a92 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -341,6 +341,7 @@ namespace LanguageNarrow_tr { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Çarpan"); LSTR MSG_AUTOTEMP = _UxGT("Oto. Sıcaklık"); + LSTR MSG_TIMEOUT = _UxGT("Zaman aşımı"); LSTR MSG_LCD_ON = _UxGT("Açık"); LSTR MSG_LCD_OFF = _UxGT("Kapalı"); LSTR MSG_PID_AUTOTUNE = _UxGT("PID Kalibrasyonu"); @@ -350,7 +351,7 @@ namespace LanguageNarrow_tr { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Kalibrasyon başarısız!"); LSTR MSG_BAD_HEATER_ID = _UxGT("Kötü ekstruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Sıcaklık çok yüksek."); - LSTR MSG_TIMEOUT = _UxGT("Zaman aşımı"); + LSTR MSG_TEMP_TOO_LOW = _UxGT("Sıcaklık çok düşük"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Kalibrasyon başarısız! Kötü ekstruder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Kalibrasyon başarısız! Sıcaklık çok yüksek."); LSTR MSG_PID_TIMEOUT = _UxGT("Kalibrasyon başarısız! Zaman aşımı."); @@ -867,7 +868,6 @@ namespace LanguageNarrow_tr { LSTR DGUS_MSG_NOT_WHILE_PRINTING = _UxGT("Yazdırma sırasında izin verilmez"); LSTR DGUS_MSG_NOT_WHILE_IDLE = _UxGT("Boştayken izin verilmez"); LSTR DGUS_MSG_NO_FILE_SELECTED = _UxGT("Seçili dosya yok"); - LSTR DGUS_MSG_TEMP_TOO_LOW = _UxGT("Sıcaklık çok düşük"); LSTR DGUS_MSG_EXECUTING_COMMAND = _UxGT("Komut yürütülüyor..."); LSTR DGUS_MSG_BED_PID_DISABLED = _UxGT("Tabla PID pasif"); LSTR DGUS_MSG_PID_DISABLED = _UxGT("PID devre dışı"); diff --git a/Marlin/src/lcd/lcdprint.h b/Marlin/src/lcd/lcdprint.h index 87032201fb0c..a93e3adc6b14 100644 --- a/Marlin/src/lcd/lcdprint.h +++ b/Marlin/src/lcd/lcdprint.h @@ -38,11 +38,6 @@ #include "e3v2/marlinui/marlinui_dwin.h" - #define LCD_PIXEL_WIDTH DWIN_WIDTH - #define LCD_PIXEL_HEIGHT DWIN_HEIGHT - #define LCD_WIDTH ((LCD_PIXEL_WIDTH) / (MENU_FONT_WIDTH)) - #define LCD_HEIGHT ((LCD_PIXEL_HEIGHT) / (MENU_LINE_HEIGHT)) - // The DWIN lcd_moveto function uses row / column, not pixels #define LCD_COL_X(col) (col) #define LCD_ROW_Y(row) (row) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index f66b680bc1c8..dca18f2125ff 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -23,6 +23,7 @@ #include "../inc/MarlinConfig.h" #include "../MarlinCore.h" // for printingIsPaused +#include "../gcode/parser.h" // for axis_is_rotational, using_inch_units #if LED_POWEROFF_TIMEOUT > 0 || ALL(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) || (HAS_BACKLIGHT_TIMEOUT && defined(NEOPIXEL_BKGD_INDEX_FIRST)) #include "../feature/leds/leds.h" @@ -47,8 +48,6 @@ MarlinUI ui; #if ENABLED(DWIN_CREALITY_LCD) #include "e3v2/creality/dwin.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "e3v2/proui/dwin.h" #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) #include "e3v2/jyersui/dwin.h" #endif @@ -68,7 +67,7 @@ MarlinUI ui; constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if HAS_STATUS_MESSAGE - #if ENABLED(STATUS_MESSAGE_SCROLLING) && ANY(HAS_WIRED_LCD, DWIN_LCD_PROUI) + #if ENABLED(STATUS_MESSAGE_SCROLLING) uint8_t MarlinUI::status_scroll_offset; // = 0 #endif MString MarlinUI::status_message; @@ -824,6 +823,13 @@ void MarlinUI::init() { const feedRate_t fr_mm_s = (axis < LOGICAL_AXES) ? manual_feedrate_mm_s[axis] : XY_PROBE_FEEDRATE_MM_S; + /** + * For a rotational axis apply the "inch" to "mm" conversion factor. This mimics behaviour of the G-code G1 + * (see get_destination_from_command). For moves involving only rotational axes, the planner will convert + * back to the feedrate in degrees-per-time unit. + */ + const feedRate_t fr = parser.axis_is_rotational(axis) && parser.using_inch_units() ? IN_TO_MM(fr_mm_s) : fr_mm_s; + #if IS_KINEMATIC #if HAS_MULTI_EXTRUDER @@ -850,13 +856,13 @@ void MarlinUI::init() { // previous invocation is being blocked. Modifications to offset shouldn't be made while // processing is true or the planner will get out of sync. processing = true; - prepare_internal_move_to_destination(fr_mm_s); // will set current_position from destination + prepare_internal_move_to_destination(fr); // will set current_position from destination processing = false; #else // For Cartesian / Core motion simply move to the current_position - planner.buffer_line(current_position, fr_mm_s, + planner.buffer_line(current_position, fr, TERN_(MULTI_E_MANUAL, axis == E_AXIS ? e_index :) active_extruder ); @@ -1482,8 +1488,8 @@ void MarlinUI::host_notify(const char * const cstr) { else if (!no_welcome) msg = GET_TEXT_F(WELCOME_MSG); - else if (ENABLED(DWIN_LCD_PROUI)) - msg = F(""); + else if (ENABLED(STATUS_DO_CLEAR_EMPTY)) + msg = F(""); else return; @@ -1597,13 +1603,10 @@ void MarlinUI::host_notify(const char * const cstr) { #endif - #if ENABLED(STATUS_MESSAGE_SCROLLING) && ANY(HAS_WIRED_LCD, DWIN_LCD_PROUI) - status_scroll_offset = 0; - #endif + TERN_(STATUS_MESSAGE_SCROLLING, reset_status_scroll()); TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message)); TERN_(DWIN_CREALITY_LCD, dwinStatusChanged(status_message)); - TERN_(DWIN_LCD_PROUI, dwinCheckStatusMessage()); TERN_(DWIN_CREALITY_LCD_JYERSUI, jyersDWIN.updateStatus(status_message)); } @@ -1614,7 +1617,7 @@ void MarlinUI::host_notify(const char * const cstr) { if (status_scroll_offset < status_message.glyphs()) while (!START_OF_UTF8_CHAR(status_message[++status_scroll_offset])); else - status_scroll_offset = 0; + reset_status_scroll(); } char* MarlinUI::status_and_len(uint8_t &len) { @@ -1661,7 +1664,10 @@ void MarlinUI::host_notify(const char * const cstr) { void MarlinUI::abort_print() { #if HAS_MEDIA wait_for_heatup = wait_for_user = false; - card.abortFilePrintSoon(); + if (IS_SD_PRINTING()) + card.abortFilePrintSoon(); + else if (card.isMounted()) + card.closefile(); #endif #ifdef ACTION_ON_CANCEL hostui.cancel(); @@ -1690,6 +1696,16 @@ void MarlinUI::host_notify(const char * const cstr) { } #endif + /** + * - Synchronize and put up a wait screen + * - Wake the display + * - Tell the host to present a "Resume" option + * - Print "Paused" on the display + * - One of three possibilities follow: + * - If Parking, Print a message, send M125 P (which parks and waits), then M24 which will resume SD printing. + * - If media exists call M25 to pause the SD print. + * - For a host-only printer tell the host to pause the print in progress. + */ void MarlinUI::pause_print() { #if HAS_MARLINUI_MENU synchronize(GET_TEXT_F(MSG_PAUSING)); @@ -1869,36 +1885,6 @@ void MarlinUI::host_notify(const char * const cstr) { #endif -#if ALL(EXTENSIBLE_UI, ADVANCED_PAUSE_FEATURE) - - void MarlinUI::pause_show_message( - const PauseMessage message, - const PauseMode mode/*=PAUSE_MODE_SAME*/, - const uint8_t extruder/*=active_extruder*/ - ) { - pause_mode = mode; - ExtUI::pauseModeStatus = message; - switch (message) { - case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; - case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; - case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; - case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break; - case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; - case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; - case PAUSE_MESSAGE_PURGE: - ExtUI::onUserConfirmRequired(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); - break; - case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; - case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break; - case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; - case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break; - case PAUSE_MESSAGE_STATUS: break; - default: break; - } - } - -#endif - #if ENABLED(EEPROM_SETTINGS) #if HAS_MARLINUI_MENU diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index ff87852f119b..f21d2565bef6 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -53,6 +53,10 @@ #include "e3v2/proui/dwin.h" #endif +#if ALL(HAS_STATUS_MESSAGE, IS_DWIN_MARLINUI) + #include "e3v2/marlinui/marlinui_dwin.h" // for LCD_WIDTH +#endif + typedef bool (*statusResetFunc_t)(); #if HAS_WIRED_LCD @@ -297,14 +301,6 @@ class MarlinUI { static void sleep_display(const bool=true) IF_DISABLED(HAS_DISPLAY_SLEEP, {}); static void wake_display() { sleep_display(false); } - #if HAS_DWIN_E3V2_BASIC - static void refresh(); - #else - FORCE_INLINE static void refresh() { - TERN_(HAS_WIRED_LCD, refresh(LCDVIEW_CLEAR_CALL_REDRAW)); - } - #endif - #if HAS_PRINT_PROGRESS_PERMYRIAD typedef uint16_t progress_t; #define PROGRESS_SCALE 100U @@ -393,6 +389,7 @@ class MarlinUI { #if ENABLED(STATUS_MESSAGE_SCROLLING) static uint8_t status_scroll_offset; + static void reset_status_scroll() { status_scroll_offset = 0; } static void advance_status_scroll(); static char* status_and_len(uint8_t &len); #endif @@ -510,6 +507,11 @@ class MarlinUI { // Periodic or as-needed display update static void update() IF_DISABLED(HAS_UI_UPDATE, {}); + // Tell the screen to redraw on the next call + FORCE_INLINE static void refresh() { + TERN_(HAS_WIRED_LCD, refresh(LCDVIEW_CLEAR_CALL_REDRAW)); + } + #if HAS_DISPLAY static void abort_print(); @@ -755,7 +757,7 @@ class MarlinUI { static bool use_click() { return false; } #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI) static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder); #else static void _pause_show_message() {} diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 840b658d09c9..22c0823f2613 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -562,24 +562,24 @@ void menu_backlash(); #if ENABLED(INPUT_SHAPING_X) editable.decimal = stepper.get_shaping_frequency(X_AXIS); if (editable.decimal) { - ACTION_ITEM_N(X_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(X_AXIS, 0.0f); ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); }); + ACTION_ITEM_N(X_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(X_AXIS, 0.0f); ui.refresh(); }); EDIT_ITEM_FAST_N(float41, X_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(X_AXIS, editable.decimal); }); editable.decimal = stepper.get_shaping_damping_ratio(X_AXIS); EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(X_AXIS, editable.decimal); }); } else - ACTION_ITEM_N(X_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(X_AXIS, (SHAPING_FREQ_X) ?: (SHAPING_MIN_FREQ)); ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); }); + ACTION_ITEM_N(X_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(X_AXIS, (SHAPING_FREQ_X) ?: (SHAPING_MIN_FREQ)); ui.refresh(); }); #endif #if ENABLED(INPUT_SHAPING_Y) editable.decimal = stepper.get_shaping_frequency(Y_AXIS); if (editable.decimal) { - ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(Y_AXIS, 0.0f); ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); }); + ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(Y_AXIS, 0.0f); ui.refresh(); }); EDIT_ITEM_FAST_N(float41, Y_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(Y_AXIS, editable.decimal); }); editable.decimal = stepper.get_shaping_damping_ratio(Y_AXIS); EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(Y_AXIS, editable.decimal); }); } else - ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(Y_AXIS, (SHAPING_FREQ_Y) ?: (SHAPING_MIN_FREQ)); ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); }); + ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(Y_AXIS, (SHAPING_FREQ_Y) ?: (SHAPING_MIN_FREQ)); ui.refresh(); }); #endif END_MENU(); diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index 874b7dbd59f6..9015a9fe6d80 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -116,6 +116,7 @@ void menu_info_thermistors() { #if TEMP_SENSOR_1 != 0 #define THERMISTOR_ID TEMP_SENSOR_1 #include "../thermistornames.h" + #undef THERMISTOR_ID THERM_ITEMS(STR_E1, HEATER_1, WATCH_HOTENDS); #endif @@ -162,9 +163,9 @@ void menu_info_thermistors() { #endif #if HAS_HEATED_BED - #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_BED #include "../thermistornames.h" + #undef THERMISTOR_ID THERM_ITEMS("BED", BED, WATCH_BED); #endif diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 7277045baf6b..622b03379a5d 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -237,12 +237,11 @@ void menu_configuration(); #endif void menu_main() { - const bool busy = printingIsActive() - #if HAS_MEDIA - , card_detected = card.isMounted() - , card_open = card_detected && card.isFileOpen() - #endif - ; + const bool busy = printingIsActive(); + #if HAS_MEDIA + const bool card_detected = card.isMounted(), + card_open = card_detected && card.isFileOpen(); + #endif START_MENU(); BACK_ITEM(MSG_INFO_SCREEN); @@ -279,12 +278,12 @@ void menu_main() { else { #if ALL(HAS_MEDIA, MEDIA_MENU_AT_TOP) // BEGIN MEDIA MENU - #if ENABLED(MENU_ADDAUTOSTART) - ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin); // Run Auto Files - #endif - if (card_detected) { if (!card_open) { + #if ENABLED(MENU_ADDAUTOSTART) + ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin); // Run Auto Files + #endif + #if HAS_SD_DETECT GCODES_ITEM(MSG_CHANGE_MEDIA, F("M21" TERN_(MULTI_VOLUME, "S"))); // M21 Change Media #if ENABLED(MULTI_VOLUME) @@ -296,7 +295,7 @@ void menu_main() { #if ENABLED(TFT_COLOR_UI) // Menu display issue on item removal with multi language selection menu if (encoderTopLine > 0) encoderTopLine--; - ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); + ui.refresh(); #endif }); #endif @@ -396,12 +395,12 @@ void menu_main() { #if HAS_MEDIA && DISABLED(MEDIA_MENU_AT_TOP) // BEGIN MEDIA MENU - #if ENABLED(MENU_ADDAUTOSTART) - ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin); // Run Auto Files - #endif - if (card_detected) { if (!card_open) { + #if ENABLED(MENU_ADDAUTOSTART) + ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin); // Run Auto Files + #endif + #if HAS_SD_DETECT GCODES_ITEM(MSG_CHANGE_MEDIA, F("M21" TERN_(MULTI_VOLUME, "S"))); // M21 Change Media #if ENABLED(MULTI_VOLUME) @@ -413,7 +412,7 @@ void menu_main() { #if ENABLED(TFT_COLOR_UI) // Menu display issue on item removal with multi language selection menu if (encoderTopLine > 0) encoderTopLine--; - ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); + ui.refresh(); #endif }); #endif diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 239d03d9777a..ebc809fef8f5 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -78,8 +78,8 @@ void lcd_move_axis(const AxisEnum axis) { if (ui.should_draw()) { MenuEditItemBase::itemIndex = axis; const float pos = ui.manual_move.axis_value(axis); - if (parser.using_inch_units()) { - const float imp_pos = LINEAR_UNIT(pos); + if (parser.using_inch_units() && !parser.axis_is_rotational(axis)) { + const float imp_pos = parser.per_axis_value(axis, pos); MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_MOVE_N), ftostr63(imp_pos)); } else diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 701d2ae97a54..64c9cc382b4d 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -144,7 +144,7 @@ void _lcd_ubl_custom_mesh() { * UBL Adjust Mesh Height Command */ void _lcd_ubl_adjust_height_cmd() { - char ubl_lcd_gcode[13]; + char ubl_lcd_gcode[14]; const int ind = ubl_height_amount > 0 ? 6 : 7; strcpy_P(ubl_lcd_gcode, PSTR("G29P6C-")); sprintf_P(&ubl_lcd_gcode[ind], PSTR(".%i"), ABS(ubl_height_amount)); diff --git a/Marlin/src/lcd/tft/tft_color.h b/Marlin/src/lcd/tft/tft_color.h index cd03224615a9..ef0d2fa5b5be 100644 --- a/Marlin/src/lcd/tft/tft_color.h +++ b/Marlin/src/lcd/tft/tft_color.h @@ -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 diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index 944be77ab5c9..c1c14c3bb510 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -71,12 +71,16 @@ void moveAxis(const AxisEnum axis, const int8_t direction) { } #endif - const float diff = motionAxisState.currentStepSize * direction; + float diff = motionAxisState.currentStepSize * direction; #if HAS_BED_PROBE if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + + diff = 0; + const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0; const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment, @@ -92,12 +96,12 @@ void moveAxis(const AxisEnum axis, const int8_t direction) { else TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); drawMessage_P(NUL_STR); // Clear the error - drawAxisValue(axis); } else drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); - #else + #else // !BABYSTEP_ZPROBE_OFFSET + // Only change probe.offset.z probe.offset.z += diff; if (direction < 0 && current_position.z < PROBE_OFFSET_ZMIN) { @@ -111,13 +115,12 @@ void moveAxis(const AxisEnum axis, const int8_t direction) { else drawMessage_P(NUL_STR); // Clear the error - drawAxisValue(axis); - #endif + #endif // !BABYSTEP_ZPROBE_OFFSET } #endif // HAS_BED_PROBE - if (!ui.manual_move.processing) { + if (diff && !ui.manual_move.processing) { // Get motion limit from software endstops, if any float min, max; soft_endstop.get_manual_axis_limits(axis, min, max); diff --git a/Marlin/src/lcd/thermistornames.h b/Marlin/src/lcd/thermistornames.h index 71f48775bdbe..0454b48fcec0 100644 --- a/Marlin/src/lcd/thermistornames.h +++ b/Marlin/src/lcd/thermistornames.h @@ -104,6 +104,10 @@ #define THERMISTOR_NAME "100k Dagoma NTC" #elif THERMISTOR_ID == 18 #define THERMISTOR_NAME "ATC Semitec 204GT-2" +#elif THERMISTOR_ID == 22 + #define THERMISTOR_NAME "GTM32 Pro vB (hotend)" +#elif THERMISTOR_ID == 23 + #define THERMISTOR_NAME "GTM32 Pro vB (bed)" #elif THERMISTOR_ID == 60 #define THERMISTOR_NAME "Makers Tool" #elif THERMISTOR_ID == 70 @@ -156,6 +160,8 @@ #define THERMISTOR_NAME "Dyze / TL 4.7M" #elif THERMISTOR_ID == 67 #define THERMISTOR_NAME "SliceEng 450°C" +#elif THERMISTOR_ID == 68 + #define THERMISTOR_NAME "PT-100 + Dyze amp" // Dummies for dev testing #elif THERMISTOR_ID == 998 diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index c6b093644755..e4e419dd767f 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -689,6 +689,17 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f* fr_mm_s ); } + void do_blocking_move_to_xy(const_float_t rx, const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_xy(", rx, ", ", ry, ", ", fr_mm_s, ")"); + do_blocking_move_to( + NUM_AXIS_LIST_(rx, ry, current_position.z, current_position.i, current_position.j, current_position.k, + current_position.u, current_position.v, current_position.w) + fr_mm_s + ); + } + void do_blocking_move_to_xy(const xy_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) { + do_blocking_move_to_xy(raw.x, raw.y, fr_mm_s); + } #endif #if HAS_Z_AXIS @@ -696,122 +707,105 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f* if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_z(", rz, ", ", fr_mm_s, ")"); do_blocking_move_to_xy_z(current_position, rz, fr_mm_s); } + void do_blocking_move_to_xy_z(const xy_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s/*=0.0f*/) { + do_blocking_move_to( + NUM_AXIS_LIST_(raw.x, raw.y, z, current_position.i, current_position.j, current_position.k, + current_position.u, current_position.v, current_position.w) + fr_mm_s + ); + } + void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) { + UNUSED(with_probe); + float zdest = zclear; + TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z); + NOMORE(zdest, Z_MAX_POS); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, " [", current_position.z, " to ", zdest, "], ", lower_allowed, ")"); + if ((!lower_allowed && zdest < current_position.z) || zdest == current_position.z) return; + do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS))); + } + void do_z_clearance_by(const_float_t zclear) { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")"); + do_z_clearance(current_position.z + zclear, false); + } + void do_move_after_z_homing() { + DEBUG_SECTION(mzah, "do_move_after_z_homing", DEBUGGING(LEVELING)); + #if defined(Z_AFTER_HOMING) || ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) + do_z_clearance(Z_POST_CLEARANCE, true, true); + #elif ENABLED(USE_PROBE_FOR_Z_HOMING) + probe.move_z_after_probing(); + #endif + } #endif #if HAS_I_AXIS - void do_blocking_move_to_i(const_float_t ri, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyz_i(current_position, ri, fr_mm_s); - } void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const_float_t i, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, i, raw.j, raw.k, raw.u, raw.v, raw.w) fr_mm_s ); } + void do_blocking_move_to_i(const_float_t ri, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyz_i(current_position, ri, fr_mm_s); + } #endif #if HAS_J_AXIS - void do_blocking_move_to_j(const_float_t rj, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzi_j(current_position, rj, fr_mm_s); - } void do_blocking_move_to_xyzi_j(const xyze_pos_t &raw, const_float_t j, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, j, raw.k, raw.u, raw.v, raw.w) fr_mm_s ); } + void do_blocking_move_to_j(const_float_t rj, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzi_j(current_position, rj, fr_mm_s); + } #endif #if HAS_K_AXIS - void do_blocking_move_to_k(const_float_t rk, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzij_k(current_position, rk, fr_mm_s); - } void do_blocking_move_to_xyzij_k(const xyze_pos_t &raw, const_float_t k, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, k, raw.u, raw.v, raw.w) fr_mm_s ); } + void do_blocking_move_to_k(const_float_t rk, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzij_k(current_position, rk, fr_mm_s); + } #endif #if HAS_U_AXIS - void do_blocking_move_to_u(const_float_t ru, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzijk_u(current_position, ru, fr_mm_s); - } void do_blocking_move_to_xyzijk_u(const xyze_pos_t &raw, const_float_t u, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, u, raw.v, raw.w) fr_mm_s ); } + void do_blocking_move_to_u(const_float_t ru, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzijk_u(current_position, ru, fr_mm_s); + } #endif #if HAS_V_AXIS - void do_blocking_move_to_v(const_float_t rv, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzijku_v(current_position, rv, fr_mm_s); - } void do_blocking_move_to_xyzijku_v(const xyze_pos_t &raw, const_float_t v, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, raw.u, v, raw.w) fr_mm_s ); } + void do_blocking_move_to_v(const_float_t rv, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzijku_v(current_position, rv, fr_mm_s); + } #endif #if HAS_W_AXIS - void do_blocking_move_to_w(const_float_t rw, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzijkuv_w(current_position, rw, fr_mm_s); - } void do_blocking_move_to_xyzijkuv_w(const xyze_pos_t &raw, const_float_t w, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, raw.u, raw.v, w) fr_mm_s ); } -#endif - -#if HAS_Y_AXIS - void do_blocking_move_to_xy(const_float_t rx, const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_xy(", rx, ", ", ry, ", ", fr_mm_s, ")"); - do_blocking_move_to( - NUM_AXIS_LIST_(rx, ry, current_position.z, current_position.i, current_position.j, current_position.k, - current_position.u, current_position.v, current_position.w) - fr_mm_s - ); - } - void do_blocking_move_to_xy(const xy_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) { - do_blocking_move_to_xy(raw.x, raw.y, fr_mm_s); - } -#endif - -#if HAS_Z_AXIS - void do_blocking_move_to_xy_z(const xy_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s/*=0.0f*/) { - do_blocking_move_to( - NUM_AXIS_LIST_(raw.x, raw.y, z, current_position.i, current_position.j, current_position.k, - current_position.u, current_position.v, current_position.w) - fr_mm_s - ); - } - void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) { - UNUSED(with_probe); - float zdest = zclear; - TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z); - NOMORE(zdest, Z_MAX_POS); - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, " [", current_position.z, " to ", zdest, "], ", lower_allowed, ")"); - if ((!lower_allowed && zdest < current_position.z) || zdest == current_position.z) return; - do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS))); - } - void do_z_clearance_by(const_float_t zclear) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")"); - do_z_clearance(current_position.z + zclear, false); - } - void do_move_after_z_homing() { - DEBUG_SECTION(mzah, "do_move_after_z_homing", DEBUGGING(LEVELING)); - #if defined(Z_AFTER_HOMING) || ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - do_z_clearance(Z_POST_CLEARANCE, true, true); - #elif ENABLED(USE_PROBE_FOR_Z_HOMING) - probe.move_z_after_probing(); - #endif + void do_blocking_move_to_w(const_float_t rw, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzijkuv_w(current_position, rw, fr_mm_s); } #endif @@ -1153,10 +1147,13 @@ float get_move_distance(const xyze_pos_t &diff OPTARG(HAS_ROTATIONAL_AXES, bool #if HAS_ROTATIONAL_AXES if (UNEAR_ZERO(distance_sqr)) { - // Move involves only rotational axes. Calculate angular distance in accordance with LinuxCNC - is_cartesian_move = false; + // Move involves no linear axes. Calculate angular distance in accordance with LinuxCNC distance_sqr = ROTATIONAL_AXIS_GANG(sq(diff.i), + sq(diff.j), + sq(diff.k), + sq(diff.u), + sq(diff.v), + sq(diff.w)); } + if (!UNEAR_ZERO(distance_sqr)) { + // Move involves rotational axes, not just the extruder + is_cartesian_move = false; + } #endif #endif @@ -2180,6 +2177,7 @@ void prepare_line_to_destination() { do_homing_move(axis, -bump, TERN(HOMING_Z_WITH_PROBE, (axis == Z_AXIS ? z_probe_fast_mm_s : 0), 0), false); #if ENABLED(DETECT_BROKEN_ENDSTOP) + // Check for a broken endstop EndstopEnum es; switch (axis) { @@ -2187,11 +2185,20 @@ void prepare_line_to_destination() { MAIN_AXIS_MAP(_ESCASE) default: break; } + + #if ENABLED(DUAL_X_CARRIAGE) + if (axis == X_AXIS && axis_home_dir > 0) { + es = X_MAX; + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("DUAL_X_CARRIAGE: Homing to X_MAX"); + } + #endif + if (TEST(endstops.state(), es)) { SERIAL_ECHO_MSG("Bad ", C(AXIS_CHAR(axis)), " Endstop?"); kill(GET_TEXT_F(MSG_KILL_HOMING_FAILED)); } - #endif + + #endif // DETECT_BROKEN_ENDSTOP #if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) if (axis == Z_AXIS && !bltouch.high_speed_mode && bltouch.deploy()) diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index c7558db43fc4..f9748871f5c8 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -31,7 +31,7 @@ #include "../inc/MarlinConfig.h" #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - #include "../lcd/e3v2/proui/dwin.h" + #include "../lcd/e3v2/proui/dwin.h" // for Z_POST_CLEARANCE #endif #if IS_SCARA @@ -413,12 +413,12 @@ void remember_feedrate_scaling_off(); void restore_feedrate_and_scaling(); #if HAS_Z_AXIS - #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - #define Z_POST_CLEARANCE hmiData.zAfterHoming - #elif defined(Z_AFTER_HOMING) - #define Z_POST_CLEARANCE Z_AFTER_HOMING - #else - #define Z_POST_CLEARANCE Z_CLEARANCE_FOR_HOMING + #ifndef Z_POST_CLEARANCE // May be set by proui/dwin.h :-P + #ifdef Z_AFTER_HOMING + #define Z_POST_CLEARANCE Z_AFTER_HOMING + #else + #define Z_POST_CLEARANCE Z_CLEARANCE_FOR_HOMING + #endif #endif void do_z_clearance(const_float_t zclear, const bool with_probe=true, const bool lower_allowed=false); void do_z_clearance_by(const_float_t zclear); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 0ace6e32ced8..c21230f662b3 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2079,11 +2079,11 @@ bool Planner::_populate_block( /** * This part of the code calculates the total length of the movement. - * For cartesian bots, the X_AXIS is the real X movement and same for Y_AXIS. - * But for corexy bots, that is not true. The "X_AXIS" and "Y_AXIS" motors (that should be named to A_AXIS - * and B_AXIS) cannot be used for X and Y length, because A=X+Y and B=X-Y. - * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head. - * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed. + * For cartesian bots, the distance along the X axis equals the X_AXIS joint displacement and same holds true for Y_AXIS. + * But for geometries like CORE_XY that is not true. For these machines we need to create 2 additional variables, named X_HEAD and Y_HEAD, to store the displacent of the head along the X and Y axes in a cartesian coordinate system. + * The displacement of the head along the axes of the cartesian coordinate system has to be calculated from "X_AXIS" and "Y_AXIS" (should be renamed to A_JOINT and B_JOINT) + * displacements in joints space using forward kinematics (A=X+Y and B=X-Y in the case of CORE_XY). + * Next we can calculate the total movement length and apply the desired speed. */ struct DistanceMM : abce_float_t { #if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX) @@ -2308,6 +2308,10 @@ bool Planner::_populate_block( // Example 2: At 120°/s a 60° move involving only rotational axes takes 0.5s. So this will give 2.0. float inverse_secs = inverse_millimeters * ( #if ALL(HAS_ROTATIONAL_AXES, INCH_MODE_SUPPORT) + /** + * Workaround for premature feedrate conversion + * from in/s to mm/s by get_distance_from_command. + */ cartesian_move ? fr_mm_s : LINEAR_UNIT(fr_mm_s) #else fr_mm_s @@ -2458,11 +2462,7 @@ bool Planner::_populate_block( #if ENABLED(LIN_ADVANCE) bool use_advance_lead = false; #endif - if (true NUM_AXIS_GANG( - && !block->steps.a, && !block->steps.b, && !block->steps.c, - && !block->steps.i, && !block->steps.j, && !block->steps.k, - && !block->steps.u, && !block->steps.v, && !block->steps.w) - ) { // Is this a retract / recover move? + if (!ANY_AXIS_MOVES(block)) { // Is this a retract / recover move? accel = CEIL(settings.retract_acceleration * steps_per_mm); // Convert to: acceleration steps/sec^2 } else { diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 856e70e5821a..b7b1abbb6153 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -1123,4 +1123,10 @@ class Planner { #define PLANNER_XY_FEEDRATE() _MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) +#define ANY_AXIS_MOVES(BLOCK) \ + (false NUM_AXIS_GANG( \ + || BLOCK->steps.a, || BLOCK->steps.b, || BLOCK->steps.c, \ + || BLOCK->steps.i, || BLOCK->steps.j, || BLOCK->steps.k, \ + || BLOCK->steps.u, || BLOCK->steps.v, || BLOCK->steps.w)) + extern Planner planner; diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 2fec098b8aaa..342ce2bb3af3 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -96,8 +96,6 @@ #if ENABLED(EXTENSIBLE_UI) #include "../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../lcd/e3v2/proui/dwin_popup.h" #endif #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) @@ -376,8 +374,11 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { #endif TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_fstr)); - TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_fstr)); - TERN_(DWIN_LCD_PROUI, dwinPopupConfirm(ICON_BLTouch, ds_fstr, FPSTR(CONTINUE_STR))); + #if ENABLED(DWIN_LCD_PROUI) + ExtUI::onUserConfirmRequired(ICON_BLTouch, ds_fstr, FPSTR(CONTINUE_STR)); + #elif ENABLED(EXTENSIBLE_UI) + ExtUI::onUserConfirmRequired(ds_fstr); + #endif TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); ui.reset_status(); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index b382f80d5149..17b8ae4d72fa 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -75,11 +75,13 @@ #include "../feature/z_stepper_align.h" #endif -#if ENABLED(EXTENSIBLE_UI) - #include "../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) +#if ENABLED(DWIN_LCD_PROUI) #include "../lcd/e3v2/proui/dwin.h" #include "../lcd/e3v2/proui/bedlevel_tools.h" +#endif + +#if ENABLED(EXTENSIBLE_UI) + #include "../lcd/extui/ui_api.h" #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) #include "../lcd/e3v2/jyersui/dwin.h" #endif @@ -490,6 +492,13 @@ typedef struct SettingsDataStruct { #endif uint32_t motor_current_setting[MOTOR_CURRENT_COUNT]; // M907 X Z E ... + // + // Adaptive Step Smoothing state + // + #if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) + bool adaptive_step_smoothing_enabled; // G-code pending + #endif + // // CNC_COORDINATE_SYSTEMS // @@ -537,9 +546,7 @@ typedef struct SettingsDataStruct { // // Ender-3 V2 DWIN // - #if ENABLED(DWIN_LCD_PROUI) - uint8_t dwin_data[eeprom_data_size]; - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #if ENABLED(DWIN_CREALITY_LCD_JYERSUI) uint8_t dwin_settings[jyersDWIN.eeprom_data_size]; #endif @@ -1530,6 +1537,14 @@ void MarlinSettings::postprocess() { #endif } + // + // Adaptive Step Smoothing state + // + #if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) + _FIELD_TEST(adaptive_step_smoothing_enabled); + EEPROM_WRITE(stepper.adaptive_step_smoothing_enabled); + #endif + // // CNC Coordinate Systems // @@ -1606,17 +1621,8 @@ void MarlinSettings::postprocess() { #endif // - // Creality DWIN User Data + // JyersUI DWIN User Data // - #if ENABLED(DWIN_LCD_PROUI) - { - _FIELD_TEST(dwin_data); - char dwin_data[eeprom_data_size] = { 0 }; - dwinCopySettingsTo(dwin_data); - EEPROM_WRITE(dwin_data); - } - #endif - #if ENABLED(DWIN_CREALITY_LCD_JYERSUI) { _FIELD_TEST(dwin_settings); @@ -1934,7 +1940,7 @@ void MarlinSettings::postprocess() { _FIELD_TEST(runout_sensor_enabled); EEPROM_READ(runout_sensor_enabled); #if HAS_FILAMENT_SENSOR - runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled; + if (!validating) runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled; #endif TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset()); @@ -2115,7 +2121,7 @@ void MarlinSettings::postprocess() { #if ENABLED(PTC_HOTEND) EEPROM_READ(ptc.z_offsets_hotend); #endif - ptc.reset_index(); + if (!validating) ptc.reset_index(); #else // No placeholder data for this feature #endif @@ -2599,6 +2605,13 @@ void MarlinSettings::postprocess() { #endif } + // + // Adaptive Step Smoothing state + // + #if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) + EEPROM_READ(stepper.adaptive_step_smoothing_enabled); + #endif + // // CNC Coordinate System // @@ -2668,11 +2681,13 @@ void MarlinSettings::postprocess() { EEPROM_READ(backlash_smoothing_mm); #if ENABLED(BACKLASH_GCODE) + if (!validating) { LOOP_NUM_AXES(axis) backlash.set_distance_mm((AxisEnum)axis, backlash_distance_mm[axis]); backlash.set_correction_uint8(backlash_correction); #ifdef BACKLASH_SMOOTHING_MM backlash.set_smoothing_mm(backlash_smoothing_mm); #endif + } #endif } #endif // NUM_AXES @@ -2690,16 +2705,9 @@ void MarlinSettings::postprocess() { #endif // - // DWIN User Data + // JyersUI User Data // - #if ENABLED(DWIN_LCD_PROUI) - { - const char dwin_data[eeprom_data_size] = { 0 }; - _FIELD_TEST(dwin_data); - EEPROM_READ(dwin_data); - if (!validating) dwinCopySettingsFrom(dwin_data); - } - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #if ENABLED(DWIN_CREALITY_LCD_JYERSUI) { const char dwin_settings[jyersDWIN.eeprom_data_size] = { 0 }; _FIELD_TEST(dwin_settings); @@ -2781,7 +2789,7 @@ void MarlinSettings::postprocess() { uint8_t ui_language; EEPROM_READ(ui_language); if (ui_language >= NUM_LANGUAGES) ui_language = 0; - ui.set_language(ui_language); + if (!validating) ui.set_language(ui_language); } #endif @@ -2807,8 +2815,10 @@ void MarlinSettings::postprocess() { { float _data[2]; EEPROM_READ(_data); - stepper.set_shaping_frequency(X_AXIS, _data[0]); - stepper.set_shaping_damping_ratio(X_AXIS, _data[1]); + if (!validating) { + stepper.set_shaping_frequency(X_AXIS, _data[0]); + stepper.set_shaping_damping_ratio(X_AXIS, _data[1]); + } } #endif @@ -2816,8 +2826,10 @@ void MarlinSettings::postprocess() { { float _data[2]; EEPROM_READ(_data); - stepper.set_shaping_frequency(Y_AXIS, _data[0]); - stepper.set_shaping_damping_ratio(Y_AXIS, _data[1]); + if (!validating) { + stepper.set_shaping_frequency(Y_AXIS, _data[0]); + stepper.set_shaping_damping_ratio(Y_AXIS, _data[1]); + } } #endif @@ -3544,6 +3556,13 @@ void MarlinSettings::reset() { DEBUG_ECHOLNPGM("Digipot Written"); #endif + // + // Adaptive Step Smoothing state + // + #if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) + stepper.adaptive_step_smoothing_enabled = true; + #endif + // // CNC Coordinate System // @@ -3589,11 +3608,6 @@ void MarlinSettings::reset() { // TERN_(DGUS_LCD_UI_MKS, MKS_reset_settings()); - // - // Ender-3 V2 with ProUI - // - TERN_(DWIN_LCD_PROUI, dwinSetDataDefaults()); - // // Model predictive control // diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 0ae6ccb9a75c..6426c7f4a2e3 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -203,12 +203,22 @@ uint32_t Stepper::acceleration_time, Stepper::deceleration_time; hal_timer_t Stepper::time_spent_in_isr = 0, Stepper::time_spent_out_isr = 0; #endif +#if ENABLED(ADAPTIVE_STEP_SMOOTHING) + #if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) + bool Stepper::adaptive_step_smoothing_enabled; // Initialized by settings.load() + #else + constexpr bool Stepper::adaptive_step_smoothing_enabled; // = true + #endif + // Oversampling factor (log2(multiplier)) to increase temporal resolution of axis + uint8_t Stepper::oversampling_factor; +#else + constexpr uint8_t Stepper::oversampling_factor; // = 0 +#endif + #if ENABLED(FREEZE_FEATURE) bool Stepper::frozen; // = false #endif -IF_DISABLED(ADAPTIVE_STEP_SMOOTHING, constexpr) uint8_t Stepper::oversampling_factor; - xyze_long_t Stepper::delta_error{0}; xyze_long_t Stepper::advance_dividend{0}; @@ -542,12 +552,30 @@ void Stepper::enable_axis(const AxisEnum axis) { default: break; } mark_axis_enabled(axis); + + TERN_(EXTENSIBLE_UI, ExtUI::onAxisEnabled(ExtUI::axis_to_axis_t(axis))); } +/** + * Mark an axis as disabled and power off its stepper(s). + * If one of the axis steppers is still in use by a non-disabled axis the axis will remain powered. + * DISCUSSION: It's basically just stepper ENA pins that are shared across axes, not whole steppers. + * Used on MCUs with a shortage of pins. We already track the overlap of ENA pins, so now + * we just need stronger logic to track which ENA pins are being set more than once. + * + * It would be better to use a bit mask (i.e., Flags). + * While the method try_to_disable in gcode/control/M17_M18_M84.cpp does use the + * bit mask, it is still only at the axis level. + * TODO: Power off steppers that don't share another axis. Currently axis-based steppers turn off as a unit. + * So we'd need to power off the off axis, then power on the on axis (for a microsecond). + * A global solution would keep a usage count when enabling or disabling a stepper, but this partially + * defeats the purpose of an on/off mask. + */ bool Stepper::disable_axis(const AxisEnum axis) { mark_axis_disabled(axis); - TERN_(DWIN_LCD_PROUI, set_axis_untrusted(axis)); // MRISCOC workaround: https://github.com/MarlinFirmware/Marlin/issues/23095 + // This scheme prevents shared steppers being disabled. It should consider several axes at once + // and keep a count of how many times each ENA pin has been set. // If all the axes that share the enabled bit are disabled const bool can_disable = can_axis_disable(axis); @@ -557,7 +585,9 @@ bool Stepper::disable_axis(const AxisEnum axis) { MAIN_AXIS_MAP(_CASE_DISABLE) default: break; } + TERN_(EXTENSIBLE_UI, ExtUI::onAxisDisabled(ExtUI::axis_to_axis_t(axis))); } + return can_disable; } @@ -2456,7 +2486,8 @@ hal_timer_t Stepper::block_phase_isr() { */ if (cutter.cutter_mode == CUTTER_MODE_DYNAMIC && planner.laser_inline.status.isPowered // isPowered flag set on any parsed G1, G2, G3, or G5 move; cleared on any others. - && cutter.last_block_power != current_block->laser.power // Prevent constant update without change + && current_block // Block may not be available if steps completed (see discard_current_block() above) + && cutter.last_block_power != current_block->laser.power // Only update if the power changed ) { cutter.apply_power(current_block->laser.power); cutter.last_block_power = current_block->laser.power; @@ -2618,7 +2649,7 @@ hal_timer_t Stepper::block_phase_isr() { oversampling_factor = TERN(NONLINEAR_EXTRUSION, 1, 0); // Decide if axis smoothing is possible - if (TERN1(DWIN_LCD_PROUI, hmiData.adaptiveStepSmoothing)) { + if (stepper.adaptive_step_smoothing_enabled) { uint32_t max_rate = current_block->nominal_rate; // Get the step event rate while (max_rate < MIN_STEP_ISR_FREQUENCY) { // As long as more ISRs are possible... max_rate <<= 1; // Try to double the rate @@ -2739,7 +2770,7 @@ hal_timer_t Stepper::block_phase_isr() { ne_edividend = advance_dividend.e; const float scale = (float(ne_edividend) / advance_divisor) * planner.mm_per_step[E_AXIS_N(current_block->extruder)]; ne_scale = (1L << 24) * scale; - if (current_block->direction_bits.e) { + if (current_block->direction_bits.e && ANY_AXIS_MOVES(current_block)) { ne_fix.A = (1L << 24) * ne.A; ne_fix.B = (1L << 24) * ne.B; ne_fix.C = (1L << 24) * ne.C; @@ -4118,22 +4149,22 @@ void Stepper::report_positions() { break; #endif #if HAS_I_MS_PINS - case I_AXIS: WRITE(I_MS1_PIN, ms1); break + case I_AXIS: WRITE(I_MS1_PIN, ms1); break; #endif #if HAS_J_MS_PINS - case J_AXIS: WRITE(J_MS1_PIN, ms1); break + case J_AXIS: WRITE(J_MS1_PIN, ms1); break; #endif #if HAS_K_MS_PINS - case K_AXIS: WRITE(K_MS1_PIN, ms1); break + case K_AXIS: WRITE(K_MS1_PIN, ms1); break; #endif #if HAS_U_MS_PINS - case U_AXIS: WRITE(U_MS1_PIN, ms1); break + case U_AXIS: WRITE(U_MS1_PIN, ms1); break; #endif #if HAS_V_MS_PINS - case V_AXIS: WRITE(V_MS1_PIN, ms1); break + case V_AXIS: WRITE(V_MS1_PIN, ms1); break; #endif #if HAS_W_MS_PINS - case W_AXIS: WRITE(W_MS1_PIN, ms1); break + case W_AXIS: WRITE(W_MS1_PIN, ms1); break; #endif #if HAS_E0_MS_PINS case E_AXIS: WRITE(E0_MS1_PIN, ms1); break; @@ -4198,22 +4229,22 @@ void Stepper::report_positions() { break; #endif #if HAS_I_MS_PINS - case I_AXIS: WRITE(I_MS2_PIN, ms2); break + case I_AXIS: WRITE(I_MS2_PIN, ms2); break; #endif #if HAS_J_MS_PINS - case J_AXIS: WRITE(J_MS2_PIN, ms2); break + case J_AXIS: WRITE(J_MS2_PIN, ms2); break; #endif #if HAS_K_MS_PINS - case K_AXIS: WRITE(K_MS2_PIN, ms2); break + case K_AXIS: WRITE(K_MS2_PIN, ms2); break; #endif #if HAS_U_MS_PINS - case U_AXIS: WRITE(U_MS2_PIN, ms2); break + case U_AXIS: WRITE(U_MS2_PIN, ms2); break; #endif #if HAS_V_MS_PINS - case V_AXIS: WRITE(V_MS2_PIN, ms2); break + case V_AXIS: WRITE(V_MS2_PIN, ms2); break; #endif #if HAS_W_MS_PINS - case W_AXIS: WRITE(W_MS2_PIN, ms2); break + case W_AXIS: WRITE(W_MS2_PIN, ms2); break; #endif #if HAS_E0_MS_PINS case E_AXIS: WRITE(E0_MS2_PIN, ms2); break; @@ -4277,23 +4308,23 @@ void Stepper::report_positions() { #endif break; #endif - #if HAS_I_MS_PINS - case I_AXIS: WRITE(I_MS3_PIN, ms3); break + #if HAS_I_MS_PINS && PIN_EXISTS(I_MS3) + case I_AXIS: WRITE(I_MS3_PIN, ms3); break; #endif - #if HAS_J_MS_PINS - case J_AXIS: WRITE(J_MS3_PIN, ms3); break + #if HAS_J_MS_PINS && PIN_EXISTS(J_MS3) + case J_AXIS: WRITE(J_MS3_PIN, ms3); break; #endif - #if HAS_K_MS_PINS - case K_AXIS: WRITE(K_MS3_PIN, ms3); break + #if HAS_K_MS_PINS && PIN_EXISTS(K_MS3) + case K_AXIS: WRITE(K_MS3_PIN, ms3); break; #endif - #if HAS_U_MS_PINS - case U_AXIS: WRITE(U_MS3_PIN, ms3); break + #if HAS_U_MS_PINS && PIN_EXISTS(U_MS3) + case U_AXIS: WRITE(U_MS3_PIN, ms3); break; #endif - #if HAS_V_MS_PINS - case V_AXIS: WRITE(V_MS3_PIN, ms3); break + #if HAS_V_MS_PINS && PIN_EXISTS(V_MS3) + case V_AXIS: WRITE(V_MS3_PIN, ms3); break; #endif - #if HAS_W_MS_PINS - case W_AXIS: WRITE(W_MS3_PIN, ms3); break + #if HAS_W_MS_PINS && PIN_EXISTS(W_MS3) + case W_AXIS: WRITE(W_MS3_PIN, ms3); break; #endif #if HAS_E0_MS_PINS && PIN_EXISTS(E0_MS3) case E_AXIS: WRITE(E0_MS3_PIN, ms3); break; diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 99fd2d293609..84f85391d2bf 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -159,10 +159,10 @@ constexpr ena_mask_t enable_overlap[] = { #endif #ifndef SHAPING_MIN_FREQ - #define SHAPING_MIN_FREQ _MIN(0x7FFFFFFFL OPTARG(INPUT_SHAPING_X, SHAPING_FREQ_X) OPTARG(INPUT_SHAPING_Y, SHAPING_FREQ_Y)) + #define SHAPING_MIN_FREQ _MIN(__FLT_MAX__ OPTARG(INPUT_SHAPING_X, SHAPING_FREQ_X) OPTARG(INPUT_SHAPING_Y, SHAPING_FREQ_Y)) #endif - constexpr uint16_t shaping_min_freq = SHAPING_MIN_FREQ, - shaping_echoes = max_step_rate / shaping_min_freq / 2 + 3; + constexpr float shaping_min_freq = SHAPING_MIN_FREQ; + constexpr uint16_t shaping_echoes = FLOOR(max_step_rate / shaping_min_freq / 2) + 3; typedef hal_timer_t shaping_time_t; enum shaping_echo_t { ECHO_NONE = 0, ECHO_FWD = 1, ECHO_BWD = 2 }; @@ -336,6 +336,12 @@ class Stepper { static ne_coeff_t ne; #endif + #if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) + static bool adaptive_step_smoothing_enabled; + #else + static constexpr bool adaptive_step_smoothing_enabled = true; + #endif + private: static block_t* current_block; // A pointer to the block currently being traced @@ -377,7 +383,7 @@ class Stepper { #if ENABLED(ADAPTIVE_STEP_SMOOTHING) static uint8_t oversampling_factor; // Oversampling factor (log2(multiplier)) to increase temporal resolution of axis #else - static constexpr uint8_t oversampling_factor = 0; + static constexpr uint8_t oversampling_factor = 0; // Without smoothing apply no shift #endif // Delta error variables for the Bresenham line tracer diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 9b071ecc3650..1fa7eaae0df3 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -52,8 +52,6 @@ #if ENABLED(DWIN_CREALITY_LCD) #include "../lcd/e3v2/creality/dwin.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../lcd/e3v2/proui/dwin.h" #endif #if ENABLED(EXTENSIBLE_UI) @@ -723,13 +721,11 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(HAS_FAN_LOGIC, fan_update_ms = next_temp_ms + fan_update_interval_ms); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED)); - TERN_(PROUI_PID_TUNE, dwinPidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ischamber ? ExtUI::pidresult_t::PID_CHAMBER_STARTED : isbed ? ExtUI::pidresult_t::PID_BED_STARTED : ExtUI::pidresult_t::PID_STARTED)); if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, hotend_max_target(heater_id))) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); - TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::pidresult_t::PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); return; } @@ -822,8 +818,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); - TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::pidresult_t::PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); break; } @@ -860,8 +855,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif if ((ms - _MIN(t1, t2)) > MIN_TO_MS(PID_AUTOTUNE_MAX_CYCLE_MINS)) { TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); - TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TUNING_TIMEOUT)); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::pidresult_t::PID_TUNING_TIMEOUT)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT))); SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); break; @@ -918,9 +912,8 @@ volatile bool Temperature::raw_temps_ready = false; disable_all_heaters(); EXIT_M303: - TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(oldcolor)); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); - TERN_(PROUI_PID_TUNE, dwinPidTuning(AUTOTUNE_DONE)); + TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPIDTuningDone(oldcolor)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::pidresult_t::PID_DONE)); TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); return; } @@ -1137,7 +1130,7 @@ volatile bool Temperature::raw_temps_ready = false; // Ensure we don't drift too far from the window between the last sampled temp and the target temperature if (!WITHIN(current_temp, get_sample_3_temp() - 15.0f, hotend.target + 15.0f)) { SERIAL_ECHOLNPGM(STR_MPC_TEMPERATURE_ERROR); - TERN_(DWIN_LCD_PROUI, dwinMPCTuning(MPC_TEMP_ERROR)); + TERN_(EXTENSIBLE_UI, ExtUI::onMPCTuning(ExtUI::mpcresult_t::MPC_TEMP_ERROR)); wait_for_heatup = false; return FAILED; } @@ -1175,7 +1168,7 @@ volatile bool Temperature::raw_temps_ready = false; if (!wait_for_heatup) { SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED); - TERN_(DWIN_LCD_PROUI, dwinMPCTuning(MPC_INTERRUPTED)); + TERN_(EXTENSIBLE_UI, ExtUI::onMPCTuning(ExtUI::mpcresult_t::MPC_INTERRUPTED)); return MeasurementState::CANCELLED; } @@ -1202,12 +1195,8 @@ volatile bool Temperature::raw_temps_ready = false; // Determine ambient temperature. SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT); - #if ENABLED(DWIN_LCD_PROUI) - dwinMPCTuning(MPCTEMP_START); - LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT); - #else - LCD_MESSAGE(MSG_COOLING); - #endif + TERN_(EXTENSIBLE_UI, ExtUI::onMPCTuning(ExtUI::mpcresult_t::MPC_STARTED)); + TERN(DWIN_LCD_PROUI, LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT), LCD_MESSAGE(MSG_COOLING)); if (tuner.measure_ambient_temp() != MPC_autotuner::MeasurementState::SUCCESS) return; hotend.modeled_ambient_temp = tuner.get_ambient_temp(); @@ -1293,7 +1282,7 @@ volatile bool Temperature::raw_temps_ready = false; } SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED); - TERN_(DWIN_LCD_PROUI, dwinMPCTuning(AUTOTUNE_DONE)); + TERN_(EXTENSIBLE_UI, ExtUI::onMPCTuning(ExtUI::mpcresult_t::MPC_DONE)); SERIAL_ECHOLNPGM("MPC_BLOCK_HEAT_CAPACITY ", mpc.block_heat_capacity); SERIAL_ECHOLNPGM("MPC_SENSOR_RESPONSIVENESS ", p_float_t(mpc.sensor_responsiveness, 4)); @@ -1532,15 +1521,17 @@ void Temperature::_temp_error( } void Temperature::maxtemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg)) { - #if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED) - dwinPopupTemperature(1); + #if HAS_HOTEND || HAS_HEATED_BED + TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(1)); + TERN_(EXTENSIBLE_UI, ExtUI::onMaxTempError(heater_id)); #endif _TEMP_ERROR(heater_id, F(STR_T_MAXTEMP), MSG_ERR_MAXTEMP, deg); } void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_TEMP, const celsius_float_t deg)) { - #if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED) - dwinPopupTemperature(0); + #if HAS_HOTEND || HAS_HEATED_BED + TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); + TERN_(EXTENSIBLE_UI, ExtUI::onMinTempError(heater_id)); #endif _TEMP_ERROR(heater_id, F(STR_T_MINTEMP), MSG_ERR_MINTEMP, deg); } @@ -1765,7 +1756,8 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T if (watch_hotend[e].check(temp)) // Increased enough? start_watching_hotend(e); // If temp reached, turn off elapsed check else { - TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0)); + TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); + TERN_(EXTENSIBLE_UI, ExtUI::onHeatingError(e)); _TEMP_ERROR(e, FPSTR(str_t_heating_failed), MSG_ERR_HEATING_FAILED, temp); } } @@ -1795,7 +1787,8 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T if (watch_bed.check(deg)) // Increased enough? start_watching_bed(); // If temp reached, turn off elapsed check else { - TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0)); + TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); + TERN_(EXTENSIBLE_UI, ExtUI::onHeatingError(H_BED)); _TEMP_ERROR(H_BED, FPSTR(str_t_heating_failed), MSG_ERR_HEATING_FAILED, deg); } } @@ -3247,13 +3240,15 @@ void Temperature::init() { } // fall through case TRRunaway: - TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0)); + TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); + TERN_(EXTENSIBLE_UI, ExtUI::onHeatingError(heater_id)); _TEMP_ERROR(heater_id, FPSTR(str_t_thermal_runaway), MSG_ERR_THERMAL_RUNAWAY, current); break; #if ENABLED(THERMAL_PROTECTION_VARIANCE_MONITOR) case TRMalfunction: - TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0)); + TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); + TERN_(EXTENSIBLE_UI, ExtUI::onHeatingError(heater_id)); _TEMP_ERROR(heater_id, F(STR_T_THERMAL_MALFUNCTION), MSG_ERR_TEMP_MALFUNCTION, current); break; #endif @@ -4424,6 +4419,7 @@ void Temperature::isr() { #if ENABLED(AUTO_REPORT_TEMPERATURES) AutoReporter Temperature::auto_reporter; void Temperature::AutoReportTemp::report() { + if (wait_for_heatup) return; print_heater_states(active_extruder OPTARG(HAS_TEMP_REDUNDANT, ENABLED(AUTO_REPORT_REDUNDANT))); SERIAL_EOL(); } diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 088a17ec1b99..16d4a38e0811 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -204,31 +204,35 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; float get_pid_output(const float target, const float current) { const float pid_error = target - current; + float output_pow; if (!target || pid_error < -(PID_FUNCTIONAL_RANGE)) { pid_reset = true; - return 0; + output_pow = 0; } else if (pid_error > PID_FUNCTIONAL_RANGE) { pid_reset = true; - return MAX_POW; + output_pow = MAX_POW; } + else { + if (pid_reset) { + pid_reset = false; + temp_iState = 0.0; + work_d = 0.0; + } - if (pid_reset) { - pid_reset = false; - temp_iState = 0.0; - work_d = 0.0; - } + const float max_power_over_i_gain = float(MAX_POW) / Ki - float(MIN_POW); + temp_iState = constrain(temp_iState + pid_error, 0, max_power_over_i_gain); - const float max_power_over_i_gain = float(MAX_POW) / Ki - float(MIN_POW); - temp_iState = constrain(temp_iState + pid_error, 0, max_power_over_i_gain); + work_p = Kp * pid_error; + work_i = Ki * temp_iState; + work_d = work_d + PID_K2 * (Kd * (temp_dState - current) - work_d); - work_p = Kp * pid_error; - work_i = Ki * temp_iState; - work_d = work_d + PID_K2 * (Kd * (temp_dState - current) - work_d); + output_pow = constrain(work_p + work_i + work_d + float(MIN_POW), 0, MAX_POW); + } temp_dState = current; - return constrain(work_p + work_i + work_d + float(MIN_POW), 0, MAX_POW); + return output_pow; } }; diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index 9164d60ab4f0..6a8187d79207 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -35,7 +35,7 @@ #endif #define BOARD_INFO_NAME "MKS TinyBee" -#define BOARD_WEBSITE_URL "https://github.com/makerbase-mks" +#define BOARD_WEBSITE_URL "github.com/makerbase-mks/MKS-TinyBee" #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME // MAX_EXPANDER_BITS is defined for MKS TinyBee in HAL/ESP32/inc/Conditionals_adv.h @@ -43,21 +43,22 @@ // // Servos // -#define SERVO0_PIN 2 +#define SERVO0_PIN 2 // 3D TOUCH // // Limit Switches // -#define X_STOP_PIN 33 -#define Y_STOP_PIN 32 -#define Z_STOP_PIN 22 -//#define FIL_RUNOUT_PIN 35 - +#define X_STOP_PIN 33 // X +#define Y_STOP_PIN 32 // Y +#define Z_STOP_PIN 22 // Z +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 35 // MT_DET +#endif // // Probe enable // #if ENABLED(PROBE_ENABLE_DISABLE) && !defined(PROBE_ENABLE_PIN) - #define PROBE_ENABLE_PIN SERVO0_PIN + #define PROBE_ENABLE_PIN SERVO0_PIN // 3D TOUCH #endif // @@ -75,49 +76,44 @@ // // Steppers // -#define X_STEP_PIN 129 +#define X_STEP_PIN 129 // X #define X_DIR_PIN 130 #define X_ENABLE_PIN 128 -#define Y_STEP_PIN 132 +#define Y_STEP_PIN 132 // Y #define Y_DIR_PIN 133 #define Y_ENABLE_PIN 131 -#define Z_STEP_PIN 135 +#define Z_STEP_PIN 135 // Z1 #define Z_DIR_PIN 136 #define Z_ENABLE_PIN 134 -#define E0_STEP_PIN 138 +#define E0_STEP_PIN 138 // E0 #define E0_DIR_PIN 139 #define E0_ENABLE_PIN 137 -#define E1_STEP_PIN 141 +#define E1_STEP_PIN 141 // E1 #define E1_DIR_PIN 142 #define E1_ENABLE_PIN 140 -#define Z2_STEP_PIN 141 -#define Z2_DIR_PIN 142 -#define Z2_ENABLE_PIN 140 - // // Temperature Sensors // -#define TEMP_0_PIN 36 // Analog Input -#define TEMP_1_PIN 34 // Analog Input, you need set R6=0Ω and R7=NC -#define TEMP_BED_PIN 39 // Analog Input +#define TEMP_0_PIN 36 // TH1 / Analog Input +#define TEMP_1_PIN 34 // TH2 / Analog Input, you need set R6=0Ω and R7=NC +#define TEMP_BED_PIN 39 // TB / Analog Input // // Heaters / Fans // -#define HEATER_0_PIN 145 -#define HEATER_1_PIN 146 -#define FAN0_PIN 147 -#define FAN1_PIN 148 -#define HEATER_BED_PIN 144 +#define HEATER_0_PIN 145 // HE0 +#define HEATER_1_PIN 146 // HE1 +#define FAN0_PIN 147 // FAN1 +#define FAN1_PIN 148 // FAN2 +#define HEATER_BED_PIN 144 // H-BED -//#define CONTROLLER_FAN_PIN 148 -//#define E0_AUTO_FAN_PIN 148 // need to update Configuration_adv.h @section extruder -//#define E1_AUTO_FAN_PIN 149 // need to update Configuration_adv.h @section extruder +//#define CONTROLLER_FAN_PIN 148 // FAN2 +//#define E0_AUTO_FAN_PIN 148 // FAN2 // // ADC Reference Voltage diff --git a/Marlin/src/pins/hc32f4/env_validate.h b/Marlin/src/pins/hc32f4/env_validate.h index 9bbc999fd6ee..b2db5e8b83e4 100644 --- a/Marlin/src/pins/hc32f4/env_validate.h +++ b/Marlin/src/pins/hc32f4/env_validate.h @@ -22,7 +22,7 @@ #ifndef ENV_VALIDATE_H #define ENV_VALIDATE_H -#ifndef ARDUINO_ARCH_HC32 +#if NOT_TARGET(ARDUINO_ARCH_HC32) #error "Oops! Select an HC32F460 board in 'Tools > Board.'" #endif diff --git a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h index 64b013d9993e..89c313662023 100644 --- a/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h +++ b/Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h @@ -183,20 +183,20 @@ /** ------ * PC6 | 1 2 | PC7 - * PA2 | 3 4 | PC1 + * PA2 | 3 4 | PA3 * PB13 5 6 | PB14 - * PB15 | 7 8 | PB12 - * GND | 9 10 | 5V + * N/C | 7 8 | PB12 + * GND | 9 10 | 5V * ------ * EXP1 */ #define EXP1_01_PIN PC6 #define EXP1_02_PIN PC7 #define EXP1_03_PIN PA2 -#define EXP1_04_PIN PC1 +#define EXP1_04_PIN PA3 #define EXP1_05_PIN PB13 #define EXP1_06_PIN PB14 -#define EXP1_07_PIN PB15 +#define EXP1_07_PIN -1 #define EXP1_08_PIN PB12 #if ENABLED(CR10_STOCKDISPLAY) // LCD used for C2 diff --git a/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h b/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h index 569c9781d270..6d5a3c70b5a2 100644 --- a/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h +++ b/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h @@ -23,7 +23,6 @@ /** * AZSMZ MINI pin assignments - * Schematic: http://green-candy.osdn.jp/external/MarlinFW/board_schematics/AZSMZ%20MINI/AZSMZ.svg * Source: https://raw.githubusercontent.com/Rose-Fish/AZSMZ-mini/master/AZSMZ.sch */ diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h index 008fc3d4a0b3..be6da885df10 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h @@ -23,8 +23,7 @@ /** * BigTreeTech SKR 1.1 pin assignments - * Schematic: http://green-candy.osdn.jp/external/MarlinFW/board_schematics/BTT%20SKR%20V1.1/SKR-V1.1SchDoc.pdf - * Origin: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.1/blob/master/hardware/SKR-V1.1SchDoc.pdf + * Schematic: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.1/blob/master/hardware/SKR-V1.1SchDoc.pdf */ #define BOARD_INFO_NAME "BTT SKR V1.1" diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index 63496c407daa..664a179c1a90 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -23,8 +23,7 @@ /** * BigTreeTech SKR 1.3 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/BTT%20SKR%20V1.3/SKR-V1.3-SCH.pdf - * Origin: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.3/hardware/SKR-V1.3-SCH.pdf + * Schematic: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.3/hardware/SKR-V1.3-SCH.pdf */ #define BOARD_INFO_NAME "BTT SKR V1.3" diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index 909760c219d5..c4a7f4ca3f0d 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -23,8 +23,7 @@ /** * BigTreeTech SKR 1.4 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/BTT%20SKR%20V1.4%20+%20Turbo/BTT%20SKR%20V1.4-SCH.pdf - * Origin: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/Hardware/BTT%20SKR%20V1.4-SCH.pdf + * Schematic: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/Hardware/BTT%20SKR%20V1.4-SCH.pdf */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h b/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h index 5c4e8d40e85b..52bf4b0abb82 100644 --- a/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h +++ b/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h @@ -23,8 +23,7 @@ /** * eMotion-Tech eMotronic pin assignments - * Schematic: http://green-candy.osdn.jp/external/MarlinFW/board_schematics/eMotion-Tech%20eMotronic/eMotronic_brd_sources_1.0.4/eMotronic_sch.pdf - * Origin: https://data.emotion-tech.com/ftp/Datasheets_et_sources/Sources/eMotronic_brd_sources_1.0.4.zip + * Schematic: https://data.emotion-tech.com/ftp/Datasheets_et_sources/Sources/eMotronic_brd_sources_1.0.4.zip * * Board pins<->features assignments are based on the * Micro-Delta Rework printer default connections. diff --git a/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h b/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h index 7aa4aa642349..f785d3b7378c 100644 --- a/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h +++ b/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h @@ -23,8 +23,7 @@ /** * GMARSH X6 Rev.1 pin assignments - * Schematic: http://green-candy.osdn.jp/external/MarlinFW/board_schematics/GMARSH%20X6%20Rev.1/armprinter_2208_1heater.pdf - * Origin: https://github.com/gmarsh/gmarsh_x6/blob/master/armprinter_2208_1heater.pdf + * Schematic: https://github.com/gmarsh/gmarsh_x6/blob/master/armprinter_2208_1heater.pdf */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h index 039d906efcad..dbacb0fa26f8 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h @@ -23,8 +23,6 @@ /** * Makerbase MKS SBASE pin assignments - * Schematic (V1.3): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/MKS%20SBASE%20V1.3/MKS%20SBASE%20V1.3_002%20SCH.pdf - * Origin (V1.3): http://green-candy.osdn.jp/external/MarlinFW/board_schematics/MKS%20SBASE%20V1.3/MKS%20SBASE%20V1.3_002%20SCH.pdf */ #include "env_validate.h" @@ -213,19 +211,19 @@ * ------ ------ * EXP1 EXP2 */ -#define EXP1_01_PIN P1_31 -#define EXP1_02_PIN P1_30 -#define EXP1_03_PIN P0_18 -#define EXP1_04_PIN P0_16 -#define EXP1_05_PIN P0_15 - -#define EXP2_01_PIN P0_08 -#define EXP2_02_PIN P0_07 -#define EXP2_03_PIN P3_25 -#define EXP2_04_PIN P0_28 -#define EXP2_05_PIN P3_26 -#define EXP2_06_PIN P0_09 -#define EXP2_07_PIN P0_27 +#define EXP1_01_PIN P1_31 +#define EXP1_02_PIN P1_30 +#define EXP1_03_PIN P0_18 +#define EXP1_04_PIN P0_16 +#define EXP1_05_PIN P0_15 + +#define EXP2_01_PIN P0_08 +#define EXP2_02_PIN P0_07 +#define EXP2_03_PIN P3_25 +#define EXP2_04_PIN P0_28 +#define EXP2_05_PIN P3_26 +#define EXP2_06_PIN P0_09 +#define EXP2_07_PIN P0_27 // // LCD / Controller diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index 8e87ce4d886d..38c7cac3d4b7 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -23,8 +23,7 @@ /** * Makerbase MKS SGEN-L pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/MKS_GEN_L_V1_0/MKS%20Gen_L%20V1.0_008%20SCH.pdf - * Origin: https://github.com/makerbase-mks/SGEN_L/blob/master/Hardware/MKS%20SGEN_L%20V1.0_001/MKS%20SGEN_L%20V1.0_001%20SCH.pdf + * Schematic: https://github.com/makerbase-mks/SGEN_L/blob/master/Hardware/MKS%20SGEN_L%20V1.0_001/MKS%20SGEN_L%20V1.0_001%20SCH.pdf */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index 84c2eca91984..8cbe9a7e7e9f 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -23,8 +23,7 @@ /** * Re-ARM with RAMPS v1.4 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Re-ARM%20RAMPS%201.4/Re_ARM_Schematic.pdf - * Origin: https://reprap.org/mediawiki/images/f/fa/Re_ARM_Schematic.pdf + * Schematic: https://reprap.org/mediawiki/images/f/fa/Re_ARM_Schematic.pdf * * Applies to the following boards: * diff --git a/Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h b/Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h index 16858c0b566a..2d27b8e0f6ba 100644 --- a/Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h +++ b/Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h @@ -23,8 +23,7 @@ /** * Selena Compact pin assignments - * Pinout: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Selena%20Compact/Compact%20Pinout.pdf - * Origin: https://github.com/f61/Selena/blob/master/Compact%20Pinout.pdf + * Schematic: https://github.com/f61/Selena/blob/master/Compact%20Pinout.pdf */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h index 8412f1c12d3b..26f0ff39cec6 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h @@ -23,8 +23,7 @@ /** * Azteeg X5 GT pin assignments - * Wiring diagram: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Azteeg%20X5%20GT/X5%20GT%20Wiring%20Diagram.pdf - * Origin: https://panucattdevices.freshdesk.com/support/solutions/articles/1000244740-support-files + * Schematic: https://panucattdevices.freshdesk.com/support/solutions/articles/1000244740-support-files */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h index f1753d0e2b95..5256da2ef22f 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h @@ -23,10 +23,7 @@ /** * Azteeg X5 MINI pin assignments - * Schematic (V1): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Azteeg%20X5%20MINI/x5mini_design_files/X5mini_design_files/V1/X5%20Mini%20PUB%20v1.0.pdf - * Schematic (V2): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Azteeg%20X5%20MINI/x5mini_design_files/X5mini_design_files/V2/X5%20Mini%20V2%20SCH%20Pub.pdf - * Schematic (V3): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Azteeg%20X5%20MINI/x5mini_design_files/X5mini_design_files/V3/X5%20Mini%20V3%20SCH%20Pub.pdf - * Origin: http://files.panucatt.com/datasheets/x5mini_design_files.zip + * Schematic: http://files.panucatt.com/datasheets/x5mini_design_files.zip */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI_WIFI.h b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI_WIFI.h index 74439e4f3d27..fd69efa8e879 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI_WIFI.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI_WIFI.h @@ -23,8 +23,7 @@ /** * Azteeg X5 MINI WIFI pin assignments - * Wiring diagram: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Azteeg%20X5%20MINI%20WIFI/x5mini_wifi_wiring.pdf - * Origin: http://files.panucatt.com/datasheets/x5mini_wifi_wiring.pdf + * Schematic: http://files.panucatt.com/datasheets/x5mini_wifi_wiring.pdf */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h index f329636f2b30..a3754a391c37 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h @@ -23,8 +23,7 @@ /** * BigTreeTech SKR E3 Turbo pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/BTT%20SKR%20E3%20Turbo/BTT%20SKR%20E3%20Turbo-SCH.pdf - * Origin: https://github.com/bigtreetech/BIGTREETECH-SKR-E3-Turbo/blob/master/Hardware/BTT%20SKR%20E3%20Turbo-SCH.pdf + * Schematic: https://github.com/bigtreetech/BIGTREETECH-SKR-E3-Turbo/blob/master/Hardware/BTT%20SKR%20E3%20Turbo-SCH.pdf */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h b/Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h index 1bd70d8fb598..2e24197106bd 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h @@ -23,8 +23,7 @@ /** * BigTreeTech SKR 1.4 Turbo pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/BTT%20SKR%20V1.4%20+%20Turbo/BTT%20SKR%20V1.4-SCH.pdf - * Origin: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/Hardware/BTT%20SKR%20V1.4-SCH.pdf + * Schematic: https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/Hardware/BTT%20SKR%20V1.4-SCH.pdf */ #define BOARD_INFO_NAME "BTT SKR V1.4 TURBO" diff --git a/Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h b/Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h index 70781cb0b588..485b3109ad03 100644 --- a/Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h +++ b/Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h @@ -23,8 +23,7 @@ /** * Cohesion3D Mini pin assignments - * Pinout: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Cohesion3D%20Mini/c3d-pinout.jpg - * Origin: https://lasergods.com/cohesion3d-mini-pinout-diagram/ + * Schematic: https://lasergods.com/cohesion3d-mini-pinout-diagram/ */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h index a6acde35ffe3..d1ecb0e7dd03 100644 --- a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h +++ b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h @@ -23,8 +23,7 @@ /** * Cohesion3D ReMix pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Cohesion3D%20ReMix/C3D%20ReMix%20rev2.svg - * Origin: https://github.com/Cohesion3D/Cohesion3D-ReMix/blob/master/C3D%20ReMix%20rev2.sch + * Schematic: https://github.com/Cohesion3D/Cohesion3D-ReMix/blob/master/C3D%20ReMix%20rev2.sch */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_FLY_CDY.h b/Marlin/src/pins/lpc1769/pins_FLY_CDY.h index d5a7a38c234d..9b22214a7a1c 100644 --- a/Marlin/src/pins/lpc1769/pins_FLY_CDY.h +++ b/Marlin/src/pins/lpc1769/pins_FLY_CDY.h @@ -23,8 +23,7 @@ /** * FLYmaker FLY-CDY pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/FLYmaker%20FLY-CDY%20V1/FLY_CDY%20SCH.pdf - * Origin: https://github.com/Mellow-3D/FLY-CDY/blob/master/Motherboard%20information/FLY_CDY%20SCH.pdf + * Schematic: https://github.com/Mellow-3D/FLY-CDY/blob/master/Motherboard%20information/FLY_CDY%20SCH.pdf */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN.h index 5e552353cd31..64abf5212f66 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN.h @@ -23,8 +23,7 @@ /** * MKS SGen pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/MKS%20SGEN/MKS%20SGEN%20V1.0_001%20SCH.pdf - * Origin: https://github.com/makerbase-mks/MKS-SGen/blob/master/Hardware/MKS%20SGEN%20V1.0_001/MKS%20SGEN%20V1.0_001%20SCH.pdf + * Schematic: https://github.com/makerbase-mks/MKS-SGen/blob/master/Hardware/MKS%20SGEN%20V1.0_001/MKS%20SGEN%20V1.0_001%20SCH.pdf * * Pins diagram: * https://github.com/makerbase-mks/MKS-SGen/blob/master/Hardware/MKS%20SGEN%20V1.0_001/MKS%20SGEN%20V1.0_001%20PIN.pdf diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h index 613ba19e15ae..aec4240276e7 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -23,8 +23,7 @@ /** * MKS SGen-L V2 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/MKS%20SGEN_L%20V2/MKS%20SGEN_L%20V2.0_003%20SCH.pdf - * Origin: https://github.com/makerbase-mks/MKS-SGEN_L-V2/blob/master/Hardware/MKS%20SGEN_L%20V2.0_003/MKS%20SGEN_L%20V2.0_003%20SCH.pdf + * Schematic: https://github.com/makerbase-mks/MKS-SGEN_L-V2/blob/master/Hardware/MKS%20SGEN_L%20V2.0_003/MKS%20SGEN_L%20V2.0_003%20SCH.pdf */ #include "env_validate.h" diff --git a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h index 0134e936319d..8856d69720f7 100644 --- a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h @@ -23,8 +23,7 @@ /** * Smoothieware Smoothieboard pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Smoothieware%20Smoothieboard%20V1/http.i.imgur.com.oj4zqs3.png - * Origin: http://smoothieware.org/_media///external/http.i.imgur.com.oj4zqs3.png + * Schematic: http://smoothieware.org/_media///external/http.i.imgur.com.oj4zqs3.png */ #include "env_validate.h" diff --git a/Marlin/src/pins/mega/pins_ELEFU_3.h b/Marlin/src/pins/mega/pins_ELEFU_3.h index 71797a30fff8..623b7a0d4335 100644 --- a/Marlin/src/pins/mega/pins_ELEFU_3.h +++ b/Marlin/src/pins/mega/pins_ELEFU_3.h @@ -23,8 +23,7 @@ /** * Elefu RA Board Pin Assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Elefu%20Ra%20v3/schematic.pdf - * Origin: https://github.com/kiyoshigawa/Elefu-RAv3/blob/master/RA_Circuits.zip + * Schematic: https://github.com/kiyoshigawa/Elefu-RAv3/blob/master/RA_Circuits.zip * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_GT2560_REV_A.h b/Marlin/src/pins/mega/pins_GT2560_REV_A.h index 55632e97bff4..96e3e5c36ff6 100644 --- a/Marlin/src/pins/mega/pins_GT2560_REV_A.h +++ b/Marlin/src/pins/mega/pins_GT2560_REV_A.h @@ -25,8 +25,7 @@ * Geeetech GT2560 Revision A board pin assignments, based on the work of * George Robles (https://georges3dprinters.com) and * Richard Smith - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Geeetech%20GT2560%20Revision%20A/GT2560_sch.pdf - * Origin: https://www.geeetech.com/wiki/images/9/90/GT2560_sch.pdf + * Schematic: https://www.geeetech.com/wiki/images/9/90/GT2560_sch.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h b/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h index a90c075be57f..a593393f08a7 100644 --- a/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h +++ b/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h @@ -23,8 +23,7 @@ /** * Geeetech GT2560 Revision A+ board pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Geeetech%20GT2560%20Revision%20A+/Hardware_GT2560_RevA+.pdf - * Origin: https://www.geeetech.com/wiki/images/d/d3/Hardware_GT2560_RevA%2B.pdf + * Schematic: https://www.geeetech.com/wiki/images/d/d3/Hardware_GT2560_RevA%2B.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_GT2560_REV_B.h b/Marlin/src/pins/mega/pins_GT2560_REV_B.h index 0702d14eb8d2..24915ce395e6 100644 --- a/Marlin/src/pins/mega/pins_GT2560_REV_B.h +++ b/Marlin/src/pins/mega/pins_GT2560_REV_B.h @@ -23,8 +23,7 @@ /** * Geeetech GT2560 Rev B Pins - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Geeetech%20GT2560%20Rev%20B/GT2560_REVB.pdf - * Origin: https://www.geeetech.com/wiki/images/7/72/GT2560_REVB.pdf + * Schematic: https://www.geeetech.com/wiki/images/7/72/GT2560_REVB.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_GT2560_V3.h b/Marlin/src/pins/mega/pins_GT2560_V3.h index b684214c6964..1323ae3c8e24 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3.h @@ -23,8 +23,7 @@ /** * Geeetech GT2560 3.0/3.1 pin assignments - * Schematic (3.0): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Geeetech%20GT2560%203.0/GT2560_V3.0_SCH.pdf - * Origin (3.0): https://github.com/Geeetech3D/Diagram/blob/master/GT2560_V3.0_SCH.pdf + * Schematic (3.0): https://github.com/Geeetech3D/Diagram/blob/master/GT2560_V3.0_SCH.pdf * ATmega2560 * * Also GT2560 RevB and GT2560 4.0/4.1 diff --git a/Marlin/src/pins/mega/pins_GT2560_V4.h b/Marlin/src/pins/mega/pins_GT2560_V4.h index 98f503886f89..f931238f9245 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V4.h +++ b/Marlin/src/pins/mega/pins_GT2560_V4.h @@ -23,9 +23,7 @@ /** * Geeetech GT2560 V4.X Pins - * Schematic (4.0): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Geeetech%20GT2560%20V4.x%20+%20A20/GT2560V4.0SCHA20T.pdf - * Schematic (4.1B): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Geeetech%20GT2560%20V4.x%20+%20A20/GT2560V4.1BSCHA20T.pdf - * Origin: https://www.geeetech.com/download.html?spm=a2g0s.imconversation.0.0.22d23e5fXlQBWv&download_id=45 + * Schematic: https://www.geeetech.com/download.html?spm=a2g0s.imconversation.0.0.22d23e5fXlQBWv&download_id=45 */ #define BOARD_INFO_NAME "GT2560 4.x" diff --git a/Marlin/src/pins/mega/pins_GT2560_V41b.h b/Marlin/src/pins/mega/pins_GT2560_V41b.h index 12d45be9853d..3ffaaabef49e 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V41b.h +++ b/Marlin/src/pins/mega/pins_GT2560_V41b.h @@ -23,8 +23,7 @@ /** * Geeetech GT2560 V4.1b Pins - * Schematic (4.1B): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Geeetech%20GT2560%20V4.x%20+%20A20/GT2560V4.1BSCHA20T.pdf - * Origin: https://www.geeetech.com/download.html?spm=a2g0s.imconversation.0.0.22d23e5fXlQBWv&download_id=45 + * Schematic: https://www.geeetech.com/download.html?spm=a2g0s.imconversation.0.0.22d23e5fXlQBWv&download_id=45 * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h index 688c147a6890..514f7b255efb 100644 --- a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h @@ -23,8 +23,7 @@ /** * Mega controller pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Mega%20Controller/Mega_controller.pdf - * Origin: https://reprap.org/mediawiki/images/b/ba/Mega_controller.pdf + * Schematic: https://reprap.org/mediawiki/images/b/ba/Mega_controller.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS.h b/Marlin/src/pins/mega/pins_MEGATRONICS.h index 066b577c629b..90d128c9fc02 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS.h @@ -23,8 +23,7 @@ /** * MegaTronics pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/MegaTronics/Megatronics_1_0_sch.pdf - * Origin: https://reprap.org/mediawiki/images/a/a3/Megatronics_1_0_sch.pdf + * Schematic: https://reprap.org/mediawiki/images/a/a3/Megatronics_1_0_sch.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS_2.h b/Marlin/src/pins/mega/pins_MEGATRONICS_2.h index ff118e732315..285a77b6361a 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS_2.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS_2.h @@ -23,8 +23,7 @@ /** * MegaTronics v2.0 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Megatronics%20v2.0/megatronics%20-%20Project.pdf - * Origin: https://reprap.org/wiki/File:Megatronicsv2PDF.zip + * Schematic: https://reprap.org/wiki/File:Megatronicsv2PDF.zip * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS_3.h b/Marlin/src/pins/mega/pins_MEGATRONICS_3.h index 5e571d5a3fa2..5a7199406306 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS_3.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS_3.h @@ -23,7 +23,7 @@ /** * MegaTronics v3.0 / v3.1 / v3.2 pin assignments - * Schematic Origin: https://github.com/brupje/Megatronics_3/blob/master/Design%20Files/megatronics.sch + * Schematic: https://github.com/brupje/Megatronics_3/blob/master/Design%20Files/megatronics.sch * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h index 22c14fc5e89e..fb7366081591 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h @@ -23,8 +23,7 @@ /** * Mightyboard Rev.E pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Mightyboard%20Rev.E/MakerBot%20MightyBoard%20REVE%20Schematic.pdf - * Origin: https://github.com/sciguy14/HelioWatcher/blob/master/HelioWatcher%20Circuit/MakerBot%20MightyBoard%20REVE%20Schematic.pdf + * Schematic: https://github.com/sciguy14/HelioWatcher/blob/master/HelioWatcher%20Circuit/MakerBot%20MightyBoard%20REVE%20Schematic.pdf * also works for Rev D boards. It's all rev E despite what the silk screen says */ diff --git a/Marlin/src/pins/mega/pins_MINITRONICS.h b/Marlin/src/pins/mega/pins_MINITRONICS.h index c8828faea7ab..e6e24f8886bf 100644 --- a/Marlin/src/pins/mega/pins_MINITRONICS.h +++ b/Marlin/src/pins/mega/pins_MINITRONICS.h @@ -23,10 +23,8 @@ /** * Minitronics v1.0/1.1 pin assignments - * Schematic (1.0): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Minitronics%20v1.0/minitronics%20-%20Project.pdf - * Origin (1.0): https://reprap.org/wiki/File:MinitronicsPDF.zip - * Datasheet (1.1): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Minitronics%20v1.1/datasheet%20minitronics%20v1.1.pdf - * Origin (1.1): https://reprapworld.nl/documentation/datasheet%20minitronics%20v1.1.pdf + * Schematic (1.0): https://reprap.org/wiki/File:MinitronicsPDF.zip + * Schematic (1.1): https://reprapworld.nl/documentation/datasheet%20minitronics%20v1.1.pdf * ATmega1281 */ diff --git a/Marlin/src/pins/mega/pins_OVERLORD.h b/Marlin/src/pins/mega/pins_OVERLORD.h index 332d7d4cb4dc..804aa38e59d6 100644 --- a/Marlin/src/pins/mega/pins_OVERLORD.h +++ b/Marlin/src/pins/mega/pins_OVERLORD.h @@ -23,8 +23,7 @@ /** * Dreammaker Overlord v1.1 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Dreammaker%20Overlord%20v1.1/Schematic.pdf - * Origin: https://github.com/jdpiercy/Overlord-Pro/blob/master/Motherboard/Schematic.pdf + * Schematic: https://github.com/jdpiercy/Overlord-Pro/blob/master/Motherboard/Schematic.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/mega/pins_PICA.h b/Marlin/src/pins/mega/pins_PICA.h index 0a6478439c58..63e14d9bf2d2 100644 --- a/Marlin/src/pins/mega/pins_PICA.h +++ b/Marlin/src/pins/mega/pins_PICA.h @@ -23,8 +23,7 @@ /** * Arduino Mega with PICA pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/PICA/pica_schematic.pdf - * Origin: https://github.com/mjrice/PICA/blob/master/pica_schematic.pdf + * Schematic: https://github.com/mjrice/PICA/blob/master/pica_schematic.pdf * ATmega2560 * * PICA is Power, Interface, and Control Adapter and is open source hardware. diff --git a/Marlin/src/pins/mega/pins_PICAOLD.h b/Marlin/src/pins/mega/pins_PICAOLD.h index 3654a45d3fdd..4a9ab4e6fcf3 100644 --- a/Marlin/src/pins/mega/pins_PICAOLD.h +++ b/Marlin/src/pins/mega/pins_PICAOLD.h @@ -21,8 +21,7 @@ */ #pragma once -// Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/PICAOLD/pica_schematic.pdf -// Origin: https://github.com/mjrice/PICA/blob/97ab9e7771a8e5eef97788f3adcc17a9fa9de9b9/pica_schematic.pdf +// Schematic: https://github.com/mjrice/PICA/blob/97ab9e7771a8e5eef97788f3adcc17a9fa9de9b9/pica_schematic.pdf // ATmega2560 #define HEATER_0_PIN 9 // E0 diff --git a/Marlin/src/pins/mega/pins_PROTONEER_CNC_SHIELD_V3.h b/Marlin/src/pins/mega/pins_PROTONEER_CNC_SHIELD_V3.h index 962fddc19248..4b7d1007be2a 100644 --- a/Marlin/src/pins/mega/pins_PROTONEER_CNC_SHIELD_V3.h +++ b/Marlin/src/pins/mega/pins_PROTONEER_CNC_SHIELD_V3.h @@ -23,8 +23,7 @@ /** * Protoneer v3.00 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Protoneer%20CNC%20Shield%20v3.00/Arduino-CNC-Shield-Scematics-V3.XX_.webp - * Origin: https://i0.wp.com/blog.protoneer.co.nz/wp-content/uploads/2013/07/Arduino-CNC-Shield-Scematics-V3.XX_.jpg + * Schematic: https://i0.wp.com/blog.protoneer.co.nz/wp-content/uploads/2013/07/Arduino-CNC-Shield-Scematics-V3.XX_.jpg * ATmega2560 * * This CNC shield has an UNO pinout and fits all Arduino-compatibles. diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 53d31c016819..cdc4fdb7a406 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -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) diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index fa6cbf49b945..58f42598a06f 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -901,6 +901,9 @@ #if PIN_EXISTS(PS_ON) REPORT_NAME_DIGITAL(__LINE__, PS_ON_PIN) #endif +#if PIN_EXISTS(PS_ON1) + REPORT_NAME_DIGITAL(__LINE__, PS_ON1_PIN) +#endif // // LCD diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 411faa4ddf2e..ac81eb3f25ba 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -477,6 +477,10 @@ #undef PS_ON_PIN #define PS_ON_PIN -1 #endif +#if DISABLED(PSU_OFF_REDUNDANT) || !defined(PS_ON1_PIN) + #undef PS_ON1_PIN + #define PS_ON1_PIN -1 +#endif #ifndef KILL_PIN #define KILL_PIN -1 #endif @@ -1243,7 +1247,7 @@ #define J_STEP_PIN _EPIN(J_E_INDEX, STEP) #define J_DIR_PIN _EPIN(J_E_INDEX, DIR) #define J_ENABLE_PIN _EPIN(J_E_INDEX, ENABLE) - #if I_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(J_STEP) + #if J_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(J_STEP) #error "No E stepper plug left for J!" #else #define AUTO_ASSIGNED_J_STEPPER 1 @@ -1413,7 +1417,7 @@ #define U_STEP_PIN _EPIN(U_E_INDEX, STEP) #define U_DIR_PIN _EPIN(U_E_INDEX, DIR) #define U_ENABLE_PIN _EPIN(U_E_INDEX, ENABLE) - #if M_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(U_STEP) + #if U_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(U_STEP) #error "No E stepper plug left for U!" #else #define AUTO_ASSIGNED_U_STEPPER 1 diff --git a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h index ada4885752a3..8315de6ee30b 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h @@ -23,8 +23,7 @@ /** * Einsy-Rambo pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Einsy-Rambo/Schematic%20Prints_Einsy%20Rambo_1.1a.PDF - * Origin: https://github.com/ultimachine/Einsy-Rambo/blob/1.1a/board/Project%20Outputs/Schematic%20Prints_Einsy%20Rambo_1.1a.PDF + * Schematic: https://github.com/ultimachine/Einsy-Rambo/blob/1.1a/board/Project%20Outputs/Schematic%20Prints_Einsy%20Rambo_1.1a.PDF */ #include "env_validate.h" diff --git a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h index 75d0974b0a36..1f5061d4ce15 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h @@ -23,10 +23,8 @@ /** * Einsy-Retro pin assignments - * Schematic (1.0b): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Einsy-Retro/Schematic%20Prints_EinsyRetro_1.0b.PDF - * Origin (1.0b): https://github.com/ultimachine/EinsyRetro/blob/master/board/Project%20Outputs/Schematic%20Prints_EinsyRetro_1.0b.PDF - * Schematic (1.0c): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Einsy-Retro/Schematic%20Prints_EinsyRetro_1.0c.PDF - * Origin (1.0c): https://github.com/ultimachine/EinsyRetro/blob/master/board/Project%20Outputs/Schematic%20Prints_EinsyRetro_1.0c.PDF + * Schematic (1.0b): https://github.com/ultimachine/EinsyRetro/blob/master/board/Project%20Outputs/Schematic%20Prints_EinsyRetro_1.0b.PDF + * Schematic (1.0c): https://github.com/ultimachine/EinsyRetro/blob/master/board/Project%20Outputs/Schematic%20Prints_EinsyRetro_1.0c.PDF */ #include "env_validate.h" diff --git a/Marlin/src/pins/rambo/pins_MINIRAMBO.h b/Marlin/src/pins/rambo/pins_MINIRAMBO.h index f176efcc7111..18f73a81d562 100644 --- a/Marlin/src/pins/rambo/pins_MINIRAMBO.h +++ b/Marlin/src/pins/rambo/pins_MINIRAMBO.h @@ -23,18 +23,18 @@ /** * Mini-RAMBo pin assignments - * Schematic (1.3a): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Mini%20RAMBo/Mini-Rambo.PDF - * Origin (1.3a): https://github.com/ultimachine/Mini-Rambo/blob/1.3a/board/Project%20Outputs%20for%20Mini-Rambo/Mini-Rambo.PDF - * Schematic (1.0a): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Mini%20RAMBo%201.0a/Mini-Rambo.PDF - * Origin (1.0a): https://github.com/ultimachine/Mini-Rambo/blob/v1.1b/board/Project%20Outputs%20for%20Mini-Rambo/Mini-Rambo.PDF + * Schematic (1.3a): https://github.com/ultimachine/Mini-Rambo/blob/1.3a/board/Project%20Outputs%20for%20Mini-Rambo/Mini-Rambo.PDF + * Schematic (1.0a): https://github.com/ultimachine/Mini-Rambo/blob/v1.1b/board/Project%20Outputs%20for%20Mini-Rambo/Mini-Rambo.PDF */ #include "env_validate.h" -#if MB(MINIRAMBO_10A) - #define BOARD_INFO_NAME "Mini RAMBo 1.0a" -#else - #define BOARD_INFO_NAME "Mini RAMBo" +#ifndef BOARD_INFO_NAME + #if MB(MINIRAMBO_10A) + #define BOARD_INFO_NAME "Mini RAMBo 1.0a" + #else + #define BOARD_INFO_NAME "Mini RAMBo" + #endif #endif // @@ -47,6 +47,10 @@ #define Z_MIN_PIN 10 #define Z_MAX_PIN 23 +#if HAS_I_AXIS + #define I_STOP_PIN 30 // X_MAX (for now) +#endif + // // Z Probe (when not Z_MIN_PIN) // @@ -128,9 +132,15 @@ // #if HAS_CUTTER // Use P1 connector for spindle pins - #define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM - #define SPINDLE_LASER_ENA_PIN 18 // Pullup! - #define SPINDLE_DIR_PIN 19 + #ifndef SPINDLE_LASER_PWM_PIN + #define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM + #endif + #ifndef SPINDLE_LASER_ENA_PIN + #define SPINDLE_LASER_ENA_PIN 18 // Pullup! + #endif + #ifndef SPINDLE_DIR_PIN + #define SPINDLE_DIR_PIN 19 + #endif #endif // diff --git a/Marlin/src/pins/rambo/pins_RAMBO.h b/Marlin/src/pins/rambo/pins_RAMBO.h index 8ea3c15b4620..7e46b171512e 100644 --- a/Marlin/src/pins/rambo/pins_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_RAMBO.h @@ -39,8 +39,7 @@ /** * Rambo pin assignments - * Schematic (1.1b): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMBo/Rambo1-1-schematic.png - * Origin (1.1b): https://www.reprap.org/wiki/File:Rambo1-1-schematic.png + * Schematic (1.1b): https://www.reprap.org/wiki/File:Rambo1-1-schematic.png */ #include "env_validate.h" diff --git a/Marlin/src/pins/ramps/pins_3DRAG.h b/Marlin/src/pins/ramps/pins_3DRAG.h index 3a2d7ea19561..de4b3cfeb9ac 100644 --- a/Marlin/src/pins/ramps/pins_3DRAG.h +++ b/Marlin/src/pins/ramps/pins_3DRAG.h @@ -24,8 +24,7 @@ /** * 3DRAG (and K8200 / K8400) Arduino Mega with RAMPS v1.4 pin assignments * This may be compatible with the standalone Controller variant. - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/3DRAG%20+%20Controller/Schema_base.jpg - * Origin: https://reprap.org/wiki/File:Schema_base.jpg + * Schematic: https://reprap.org/wiki/File:Schema_base.jpg * ATmega2560, ATmega1280 */ diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h index 17581dca6241..39c25a7fd131 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h @@ -23,8 +23,7 @@ /** * AZTEEG_X3 Arduino Mega with RAMPS v1.4 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/AZTEEG_X3/AZTEEG%20X3%20PUB%20v1.12.pdf - * Origin: http://files.panucatt.com/datasheets/azteegx3_designfiles.zip + * Schematic: http://files.panucatt.com/datasheets/azteegx3_designfiles.zip * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h index ddd56b28e859..76a29930b0ae 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h @@ -23,8 +23,7 @@ /** * AZTEEG_X3_PRO (Arduino Mega) pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/AZTEEG_X3_PRO/AZTEEG%20X3%20PRO%201.0%20PUB.pdf - * Origin: http://files.panucatt.com/datasheets/x3pro_sch_v1.0.zip + * Schematic: http://files.panucatt.com/datasheets/x3pro_sch_v1.0.zip * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h b/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h index cf237fb9c11e..4f4e31f9a141 100644 --- a/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h +++ b/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h @@ -23,8 +23,7 @@ /** * BAM&DICE Due (Arduino Mega) pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/BAM&DICE%20Due/2PRINTBETA-BAM&DICE-DUE-V1.1-sch.pdf - * Origin: http://www.2printbeta.de/download/2PRINTBETA-BAM&DICE-DUE-V1.1-sch.pdf + * Schematic: http://www.2printbeta.de/download/2PRINTBETA-BAM&DICE-DUE-V1.1-sch.pdf * ATmega2560, ATmega1280 */ diff --git a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h index 08d4492ccb5e..fb6689c0ce01 100644 --- a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h @@ -23,8 +23,7 @@ /** * bq ZUM Mega 3D board definition - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/bq%20ZUM%20Mega%203D/Zum%20Mega%203D.PDF - * Origin: https://github.com/bq/zum/blob/master/zum-mega3d/Zum%20Mega%203D.PDF + * Schematic: https://github.com/bq/zum/blob/master/zum-mega3d/Zum%20Mega%203D.PDF * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_DAGOMA_D6.h b/Marlin/src/pins/ramps/pins_DAGOMA_D6.h new file mode 100644 index 000000000000..2a89647376e1 --- /dev/null +++ b/Marlin/src/pins/ramps/pins_DAGOMA_D6.h @@ -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 . + * + */ +#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" diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h index 102595363377..59c4c7988421 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h @@ -23,8 +23,7 @@ // // FYSETC F6 1.3 (and 1.4) pin assignments -// Schematic (1.3): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/FYSETC%20F6%201.3/F6_V13.pdf -// Origin: https://github.com/FYSETC/FYSETC-F6/blob/master/Hardware/V1.3/F6_V13.pdf +// Schematic: https://github.com/FYSETC/FYSETC-F6/blob/master/Hardware/V1.3/F6_V13.pdf // ATmega2560 // diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_14.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_14.h index 9604d0ecbfc1..5fdaa1941959 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_14.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_14.h @@ -23,8 +23,7 @@ // // FYSETC F6 v1.4 pin assignments -// Schematic (1.4): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/FYSETC%20F6%20v1.4/F6%20V1.4%20Sch.pdf -// Origin (1.4): https://github.com/FYSETC/FYSETC-F6/blob/master/Hardware/V1.4/F6%20V1.4%20Sch.pdf +// Schematic (1.4): https://github.com/FYSETC/FYSETC-F6/blob/master/Hardware/V1.4/F6%20V1.4%20Sch.pdf // ATmega2560 // diff --git a/Marlin/src/pins/ramps/pins_K8200.h b/Marlin/src/pins/ramps/pins_K8200.h index d2557b26c3ee..b6bed2dc556b 100644 --- a/Marlin/src/pins/ramps/pins_K8200.h +++ b/Marlin/src/pins/ramps/pins_K8200.h @@ -24,8 +24,7 @@ /** * K8200 Arduino Mega with RAMPS v1.3 pin assignments * Identical to 3DRAG - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Velleman%20K8200/K8200diagram.jpg - * Origin: https://www.velleman.eu/images/tmp/K8200diagram.jpg + * Schematic: https://www.velleman.eu/images/tmp/K8200diagram.jpg * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_K8400.h b/Marlin/src/pins/ramps/pins_K8400.h index 048b9656c4af..31912064d061 100644 --- a/Marlin/src/pins/ramps/pins_K8400.h +++ b/Marlin/src/pins/ramps/pins_K8400.h @@ -24,8 +24,7 @@ /** * Velleman K8400 (Vertex) * 3DRAG clone - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Velleman%20K8400/k8400-schema-electronique.jpg - * Origin: https://filimprimante3d.fr/documents/k8400-schema-electronique.jpg + * Schematic: https://filimprimante3d.fr/documents/k8400-schema-electronique.jpg * ATmega2560, ATmega1280 * * K8400 has some minor differences over a normal 3Drag: diff --git a/Marlin/src/pins/ramps/pins_K8800.h b/Marlin/src/pins/ramps/pins_K8800.h index 826e1b206aad..1f477300de73 100644 --- a/Marlin/src/pins/ramps/pins_K8800.h +++ b/Marlin/src/pins/ramps/pins_K8800.h @@ -23,8 +23,7 @@ /** * Velleman K8800 (Vertex) - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Velleman%20K8800/K8800-schematic-V1.4.pdf - * Origin: https://www.velleman.eu/downloads/files/vertex-delta/schematics/K8800-schematic-V1.4.pdf + * Schematic: https://www.velleman.eu/downloads/files/vertex-delta/schematics/K8800-schematic-V1.4.pdf * ATmega2560, ATmega1280 */ diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_10.h b/Marlin/src/pins/ramps/pins_MKS_BASE_10.h index 8d46ac36fa6e..3d58d8ba912d 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_10.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_10.h @@ -24,10 +24,7 @@ /** * MKS BASE 1.0 – Arduino Mega2560 with RAMPS v1.4 pin assignments * Schematics: - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/MKS%20BASE%201.0/PAGE1.pdf - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/MKS%20BASE%201.0/PAGE2.pdf - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/MKS%20BASE%201.0/PAGE3.pdf - * Origin: https://reprap.org/wiki/File:MKS_Base_V1.0_source.zip + * Schematic: https://reprap.org/wiki/File:MKS_Base_V1.0_source.zip * ATmega2560 * * Rev B - Override pin definitions for CASE_LIGHT and M3/M4/M5 spindle control diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_16.h b/Marlin/src/pins/ramps/pins_MKS_BASE_16.h index bb6def5ca46f..e5797493116b 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_16.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_16.h @@ -23,8 +23,7 @@ /** * MKS BASE v1.6 with A4982 stepper drivers and digital micro-stepping - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/MKS%20BASE%201.6/MKS%20Base%20V1.6_004%20SCH.pdf - * Origin: https://github.com/makerbase-mks/MKS-BASE/blob/master/hardware/MKS%20Base%20V1.6_004/MKS%20Base%20V1.6_004%20SCH.pdf + * Schematic: https://github.com/makerbase-mks/MKS-BASE/blob/master/hardware/MKS%20Base%20V1.6_004/MKS%20Base%20V1.6_004%20SCH.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_13.h b/Marlin/src/pins/ramps/pins_MKS_GEN_13.h index 6ef77909d163..5797424c66c9 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_13.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_13.h @@ -23,8 +23,7 @@ /** * Arduino Mega with RAMPS v1.4 adjusted pin assignments - * Schematic (1.4): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/MKS%20GEN%20v1.4/MKS%20GEN%20V1.4_004%20SCH.pdf - * Origin (1.4): https://github.com/makerbase-mks/MKS-GEN/blob/master/hardware/MKS%20GEN%20V1.4_004/MKS%20GEN%20V1.4_004%20SCH.pdf + * Schematic (1.4): https://github.com/makerbase-mks/MKS-GEN/blob/master/hardware/MKS%20GEN%20V1.4_004/MKS%20GEN%20V1.4_004%20SCH.pdf * ATmega2560, ATmega1280 * * MKS GEN v1.3 (Extruder, Fan, Bed) diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L.h index 73e7aa577d50..dfd8736c81fe 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L.h @@ -23,8 +23,7 @@ /** * MKS GEN L – Arduino Mega2560 with RAMPS v1.4 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/MKS%20GEN%20L%20v1.0/MKS%20Gen_L%20V1.0_008%20SCH.pdf - * Origin: https://github.com/makerbase-mks/MKS-GEN_L/blob/master/hardware/MKS%20Gen_L%20V1.0_008/MKS%20Gen_L%20V1.0_008%20SCH.pdf + * Schematic: https://github.com/makerbase-mks/MKS-GEN_L/blob/master/hardware/MKS%20Gen_L%20V1.0_008/MKS%20Gen_L%20V1.0_008%20SCH.pdf * ATmega2560, ATmega1280 */ diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h index 931843de7c73..54c739326653 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h @@ -23,8 +23,7 @@ /** * MKS GEN L V2 – Arduino Mega2560 with RAMPS v1.4 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/MKS%20GEN%20L%20V2.0/MKS%20Gen_L%20V2.0_001%20SCH.pdf - * Origin: https://github.com/makerbase-mks/MKS-GEN_L/blob/master/hardware/MKS%20Gen_L%20V2.0_001/MKS%20Gen_L%20V2.0_001%20SCH.pdf + * Schematic: https://github.com/makerbase-mks/MKS-GEN_L/blob/master/hardware/MKS%20Gen_L%20V2.0_001/MKS%20Gen_L%20V2.0_001%20SCH.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h index 6cea92c15b78..594be3c5df1d 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h @@ -23,8 +23,7 @@ /** * MKS GEN L V2 – Arduino Mega2560 with RAMPS v1.4 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/MKS%20GEN%20L%20V2.1/MKS%20GEN_L%20V2.1_001%20SCH.pdf - * Origin: https://github.com/makerbase-mks/MKS-GEN_L/blob/master/hardware/MKS%20Gen_L%20V2.1_001/MKS%20GEN_L%20V2.1_001%20SCH.pdf + * Schematic: https://github.com/makerbase-mks/MKS-GEN_L/blob/master/hardware/MKS%20Gen_L%20V2.1_001/MKS%20GEN_L%20V2.1_001%20SCH.pdf * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 0195f3a1bc9a..38684391021b 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -320,17 +320,29 @@ #endif // -// TMC software SPI +// TMC SPI // #if HAS_TMC_SPI - #ifndef TMC_SPI_MOSI - #define TMC_SPI_MOSI AUX2_09 - #endif - #ifndef TMC_SPI_MISO - #define TMC_SPI_MISO AUX2_07 - #endif - #ifndef TMC_SPI_SCK - #define TMC_SPI_SCK AUX2_05 + #if ENABLED(TMC_USE_SW_SPI) + #ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI AUX2_09 + #endif + #ifndef TMC_SPI_MISO + #define TMC_SPI_MISO AUX2_07 + #endif + #ifndef TMC_SPI_SCK + #define TMC_SPI_SCK AUX2_05 + #endif + #else + #ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI AUX3_04 + #endif + #ifndef TMC_SPI_MISO + #define TMC_SPI_MISO AUX3_03 + #endif + #ifndef TMC_SPI_SCK + #define TMC_SPI_SCK AUX3_05 + #endif #endif #endif diff --git a/Marlin/src/pins/ramps/pins_RUMBA.h b/Marlin/src/pins/ramps/pins_RUMBA.h index 9a4a384e4ab5..24cc2bada089 100644 --- a/Marlin/src/pins/ramps/pins_RUMBA.h +++ b/Marlin/src/pins/ramps/pins_RUMBA.h @@ -23,8 +23,7 @@ /** * RUMBA pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/RUMBA/RRD-RUMBA_SCHEMATICS.png - * Origin: https://reprap.org/wiki/File:RRD-RUMBA_SCHEMATICS.png + * Schematic: https://reprap.org/wiki/File:RRD-RUMBA_SCHEMATICS.png * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_TANGO.h b/Marlin/src/pins/ramps/pins_TANGO.h index 54dd4433998f..0f8aaca0e2c8 100644 --- a/Marlin/src/pins/ramps/pins_TANGO.h +++ b/Marlin/src/pins/ramps/pins_TANGO.h @@ -23,8 +23,7 @@ /** * BIQU Tango pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/BIQU%20Tango/schematic.png - * Origin: https://github.com/bigtreetech/Tango-3D-Printer-Motherboard/blob/master/Schematic/Tango%20V1.0.SchDoc + * Schematic: https://github.com/bigtreetech/Tango-3D-Printer-Motherboard/blob/master/Schematic/Tango%20V1.0.SchDoc * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h index 049e8bc5d80c..ca1b4b883b3a 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h @@ -24,11 +24,6 @@ /** * Ultiboard v2.0 pin assignments * Schematics (2.1.4): - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%202.1.4/schema1.png - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%202.1.4/schema2.png - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%202.1.4/schema3.png - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%202.1.4/schema4.png - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%202.1.4/schema5.png * Origins (2.1.4): * - https://github.com/Ultimaker/Ultimaker2/blob/master/1546%20ultimainboard%20V2.1.4/schema1.SchDoc * - https://github.com/Ultimaker/Ultimaker2/blob/master/1546%20ultimainboard%20V2.1.4/schema2.SchDoc @@ -36,11 +31,7 @@ * - https://github.com/Ultimaker/Ultimaker2/blob/master/1546%20ultimainboard%20V2.1.4/schema4.SchDoc * - https://github.com/Ultimaker/Ultimaker2/blob/master/1546%20ultimainboard%20V2.1.4/schema5.SchDoc * Schematics (Original+): - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%20Original+/Ultimainboard%20rev.%202.1.1%20altium/schema1.png - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%20Original+/Ultimainboard%20rev.%202.1.1%20altium/schema2.png - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%20Original+/Ultimainboard%20rev.%202.1.1%20altium/schema3.png - * - https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%20Original+/Ultimainboard%20rev.%202.1.1%20altium/schema4.png - * Origin (Original+): https://github.com/Ultimaker/Ultimaker-Original-Plus/blob/master/1091_Main_board_v2.1.1_(x1)/Ultimainboard%20rev.%202.1.1%20altium.zip + * Schematic (Original+): https://github.com/Ultimaker/Ultimaker-Original-Plus/blob/master/1091_Main_board_v2.1.1_(x1)/Ultimainboard%20rev.%202.1.1%20altium.zip * ATmega2560 */ diff --git a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h index 5cf143a09cf6..c366b152961b 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h @@ -23,8 +23,6 @@ /** * Ultimaker pin assignments (Old electronics) - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%201.0/ultipanel%20rev1.1.sch.pdf - * Origin: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/Ultimaker%201.0/ultipanel%20rev1.1.sch.pdf * ATmega2560, ATmega1280 */ diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V20.h b/Marlin/src/pins/ramps/pins_ZRIB_V20.h index d1c80f6a4afc..8218ba12c544 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V20.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V20.h @@ -24,10 +24,8 @@ /** * ZONESTAR ZRIB V2.0 & V3.0 pin assignments * V2 and V3 Boards only differ in USB controller, nothing affecting the pins. - * Schematic (2.0): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/ZONESTAR%20ZRIB%20V2.0/ZRIB_V2_Schematic.pdf - * Origin (2.0): https://github.com/ZONESTAR3D/Control-Board/blob/main/8bit/ZRIB/ZRIB_V2/ZRIB_V2_Schematic.pdf - * Schematic (3.0): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/ZONESTAR%20ZRIB%20V3.0/ZRIB_V3_Schematic.pdf - * Origin (3.0): https://github.com/ZONESTAR3D/Control-Board/blob/main/8bit/ZRIB/ZRIB_V3/ZRIB_V3_Schematic.pdf + * Schematic (2.0): https://github.com/ZONESTAR3D/Control-Board/blob/main/8bit/ZRIB/ZRIB_V2/ZRIB_V2_Schematic.pdf + * Schematic (3.0): https://github.com/ZONESTAR3D/Control-Board/blob/main/8bit/ZRIB/ZRIB_V3/ZRIB_V3_Schematic.pdf * ATmega2560, ATmega1280 */ diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V52.h b/Marlin/src/pins/ramps/pins_ZRIB_V52.h index 5eada31c9cf9..016501241ae9 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V52.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V52.h @@ -23,8 +23,7 @@ /** * ZONESTAR ZRIB V5.2 Based on MKS BASE v1.4 with A4982 stepper drivers and digital micro-stepping - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/RAMPS/ZONESTAR%20ZRIB%20V5.2/ZRIB_V52_Schematic.pdf - * Origin: https://github.com/ZONESTAR3D/Control-Board/blob/main/8bit/ZRIB/ZRIB_V5/ZRIB_V52_Schematic.pdf + * Schematic: https://github.com/ZONESTAR3D/Control-Board/blob/main/8bit/ZRIB/ZRIB_V5/ZRIB_V52_Schematic.pdf * ATmega2560, ATmega1280 */ diff --git a/Marlin/src/pins/sanguino/pins_ANET_10.h b/Marlin/src/pins/sanguino/pins_ANET_10.h index 8abf0c07e735..ee9fa327742f 100644 --- a/Marlin/src/pins/sanguino/pins_ANET_10.h +++ b/Marlin/src/pins/sanguino/pins_ANET_10.h @@ -23,8 +23,7 @@ /** * Anet V1.0 board pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Anet%20V1.0/ANET3D_Board_Schematic.pdf - * Origin: https://github.com/ralf-e/ANET-3D-Board-V1.0/blob/master/ANET3D_Board_Schematic.pdf + * Schematic: https://github.com/ralf-e/ANET-3D-Board-V1.0/blob/master/ANET3D_Board_Schematic.pdf */ /** diff --git a/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h b/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h index 1cbafab432c4..c88b666f6c1c 100644 --- a/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h +++ b/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h @@ -23,8 +23,7 @@ /** * Azteeg X1 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Azteeg%20X1/Azteeg_X1_schematics.pdf - * Origin: https://reprap.org/mediawiki/images/0/07/Azteeg_X1_schematics.pdf + * Schematic: https://reprap.org/mediawiki/images/0/07/Azteeg_X1_schematics.pdf */ #define BOARD_INFO_NAME "Azteeg X1" diff --git a/Marlin/src/pins/sanguino/pins_GEN6.h b/Marlin/src/pins/sanguino/pins_GEN6.h index 4a6136e0810a..3fb1671b7342 100644 --- a/Marlin/src/pins/sanguino/pins_GEN6.h +++ b/Marlin/src/pins/sanguino/pins_GEN6.h @@ -23,8 +23,7 @@ /** * Gen6 pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Gen6/GEN6_Mendel_Circuit.pdf - * Origin: https://reprap.org/mediawiki/images/0/0f/GEN6_Mendel_Circuit.pdf + * Schematic: https://reprap.org/mediawiki/images/0/0f/GEN6_Mendel_Circuit.pdf */ /** diff --git a/Marlin/src/pins/sanguino/pins_GEN7_12.h b/Marlin/src/pins/sanguino/pins_GEN7_12.h index 0bf65c37cd38..503066624523 100644 --- a/Marlin/src/pins/sanguino/pins_GEN7_12.h +++ b/Marlin/src/pins/sanguino/pins_GEN7_12.h @@ -23,14 +23,10 @@ /** * Gen7 v1.1, v1.2, v1.3 pin assignments - * Schematic (1.1): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Gen7%20v1.1/Gen7Board%20Schematic.pdf - * Origin (1.1): https://github.com/Traumflug/Generation_7_Electronics/blob/release-1.1/release%20documents/Gen7Board%20Schematic.pdf - * Schematic (1.2): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Gen7%20v1.2/Gen7Board%20Schematic.pdf - * Origin (1.2): https://github.com/Traumflug/Generation_7_Electronics/blob/release-1.2/release%20documents/Gen7Board%20Schematic.pdf - * Schematic (1.3): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Gen7%20v1.3/Gen7Board%20Schematic.pdf - * Origin (1.3): https://github.com/Traumflug/Generation_7_Electronics/blob/release-1.3/release%20documents/Gen7Board%20Schematic.pdf - * Schematic (1.3.1): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Gen7%20v1.3.1/Gen7Board%20Schematic.pdf - * Origin (1.3.1): https://github.com/Traumflug/Generation_7_Electronics/blob/release-1.3.1/release%20documents/Gen7Board%20Schematic.pdf + * Schematic (1.1): https://github.com/Traumflug/Generation_7_Electronics/blob/release-1.1/release%20documents/Gen7Board%20Schematic.pdf + * Schematic (1.2): https://github.com/Traumflug/Generation_7_Electronics/blob/release-1.2/release%20documents/Gen7Board%20Schematic.pdf + * Schematic (1.3): https://github.com/Traumflug/Generation_7_Electronics/blob/release-1.3/release%20documents/Gen7Board%20Schematic.pdf + * Schematic (1.3.1): https://github.com/Traumflug/Generation_7_Electronics/blob/release-1.3.1/release%20documents/Gen7Board%20Schematic.pdf */ /** diff --git a/Marlin/src/pins/sanguino/pins_GEN7_14.h b/Marlin/src/pins/sanguino/pins_GEN7_14.h index db80c45eeefe..10e578496616 100644 --- a/Marlin/src/pins/sanguino/pins_GEN7_14.h +++ b/Marlin/src/pins/sanguino/pins_GEN7_14.h @@ -23,10 +23,8 @@ /** * Gen7 v1.4 pin assignments - * Schematic (1.4): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Gen7%20v1.4/Gen7Board%201.4%20Schematic.pdf - * Origin (1.4): https://github.com/Traumflug/Generation_7_Electronics/blob/Gen7Board-1.4/release%20documents/Gen7Board%201.4%20Schematic.pdf - * Schematic (1.4.1): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Gen7%20v1.4.1/Gen7Board%201.4.1%20Schematic.pdf - * Origin (1.4.1): https://github.com/Traumflug/Generation_7_Electronics/blob/Gen7Board-1.4.1/release%20documents/Gen7Board%201.4.1%20Schematic.pdf + * Schematic (1.4): https://github.com/Traumflug/Generation_7_Electronics/blob/Gen7Board-1.4/release%20documents/Gen7Board%201.4%20Schematic.pdf + * Schematic (1.4.1): https://github.com/Traumflug/Generation_7_Electronics/blob/Gen7Board-1.4.1/release%20documents/Gen7Board%201.4.1%20Schematic.pdf */ /** diff --git a/Marlin/src/pins/sanguino/pins_MELZI.h b/Marlin/src/pins/sanguino/pins_MELZI.h index a0c7050a9111..27df72d92226 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI.h +++ b/Marlin/src/pins/sanguino/pins_MELZI.h @@ -23,8 +23,7 @@ /** * Melzi pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Melzi/schematic.pdf - * Origin: https://github.com/mosfet/melzi/blob/master/melzi.sch + * Schematic: https://github.com/mosfet/melzi/blob/master/melzi.sch */ #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h index f441523322e3..ba3c6767b261 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h @@ -23,8 +23,7 @@ /** * Melzi (Creality) pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Melzi%20(Creality)/CR-10%20Schematic.pdf - * Origin: https://github.com/Creality3DPrinting/CR10-Melzi-1.1.2/blob/master/Circuit%20diagram/Motherboard/CR-10%20Schematic.pdf + * Schematic: https://github.com/Creality3DPrinting/CR10-Melzi-1.1.2/blob/master/Circuit%20diagram/Motherboard/CR-10%20Schematic.pdf * ATmega1284P * * The Creality board needs a bootloader installed before Marlin can be uploaded. @@ -102,7 +101,7 @@ #endif #if PIN_EXISTS(BEEPER) && (SERVO0_PIN == BEEPER_PIN || FIL_RUNOUT_PIN == BEEPER_PIN) #undef BEEPER_PIN - #define BEEPER_PIN -1 + #define BEEPER_PIN -1 #endif /** diff --git a/Marlin/src/pins/sanguino/pins_MELZI_V2.h b/Marlin/src/pins/sanguino/pins_MELZI_V2.h index b48e77a5c367..d90cd01af2c8 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_V2.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_V2.h @@ -23,8 +23,7 @@ /** * Melzi V2.0 as found at https://www.reprap.org/wiki/Melzi - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Melzi%20V2/Melzi-circuit.png - * Origin: https://www.reprap.org/mediawiki/images/7/7d/Melzi-circuit.png + * Schematic: https://www.reprap.org/mediawiki/images/7/7d/Melzi-circuit.png * * ATmega644P */ diff --git a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h index bee2a30e44ab..74d2b5549bc5 100644 --- a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h @@ -23,16 +23,11 @@ /** * Sanguinololu board pin assignments - * Schematic (0.1): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Sanguinololu%20v0.1/schematic.png - * Origin (0.1): https://github.com/mosfet/Sanguinololu/blob/master/rev0.1/sanguinololu.sch - * Schematic (0.6): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Sanguinololu%20v0.6/schematic.jpg - * Origin (0.6): https://github.com/mosfet/Sanguinololu/blob/master/rev0.6/images/schematic.jpg - * Schematic (0.7): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Sanguinololu%20v0.7/schematic.jpg - * Origin (0.7): https://github.com/mosfet/Sanguinololu/blob/master/rev0.7/images/schematic.jpg - * Schematic (1.0): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Sanguinololu%20v1.0/Sanguinololu-schematic.jpg - * Origin (1.0): https://reprap.org/wiki/File:Sanguinololu-schematic.jpg - * Schematic (1.1): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Sanguinololu%20v1.1/schematic.png - * Origin (1.1): https://github.com/mosfet/Sanguinololu/blob/master/rev1.1/sanguinololu.sch + * Schematic (0.1): https://github.com/mosfet/Sanguinololu/blob/master/rev0.1/sanguinololu.sch + * Schematic (0.6): https://github.com/mosfet/Sanguinololu/blob/master/rev0.6/images/schematic.jpg + * Schematic (0.7): https://github.com/mosfet/Sanguinololu/blob/master/rev0.7/images/schematic.jpg + * Schematic (1.0): https://reprap.org/wiki/File:Sanguinololu-schematic.jpg + * Schematic (1.1): https://github.com/mosfet/Sanguinololu/blob/master/rev1.1/sanguinololu.sch */ /** @@ -113,7 +108,7 @@ #endif #define E0_ENABLE_PIN 4 #else - #if !HAS_CUTTER && !ALL(HAS_WIRED_LCD, IS_NEWPANEL) // Use IO Header + #if !HAS_CUTTER && !ALL(HAS_WIRED_LCD, IS_NEWPANEL) // Use IO Header #define CASE_LIGHT_PIN 4 // Hardware PWM - see if IO Header is available #endif #endif diff --git a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_12.h b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_12.h index 37d1e7030b42..a86f2382dbc2 100644 --- a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_12.h +++ b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_12.h @@ -23,12 +23,9 @@ /** * Sanguinololu V1.2 pin assignments - * Schematic (1.2): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Sanguinololu%20v1.2/schematic.png - * Origin (1.2): https://github.com/mosfet/Sanguinololu/blob/master/rev1.2/sanguinololu.sch - * Schematic (1.3): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Sanguinololu%20v1.3/schematic.png - * Origin (1.3): https://github.com/mosfet/Sanguinololu/blob/master/rev1.3/sanguinololu.sch - * Schematic (1.3a): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Sanguinololu%20v1.3a/schematic.png - * Origin (1.3a): https://github.com/mosfet/Sanguinololu/blob/master/rev1.3a/sanguinololu.sch + * Schematic (1.2): https://github.com/mosfet/Sanguinololu/blob/master/rev1.2/sanguinololu.sch + * Schematic (1.3): https://github.com/mosfet/Sanguinololu/blob/master/rev1.3/sanguinololu.sch + * Schematic (1.3a): https://github.com/mosfet/Sanguinololu/blob/master/rev1.3a/sanguinololu.sch * * Applies to the following boards: * diff --git a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h index ade9c08aa045..39d55d1b2831 100644 --- a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h +++ b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h @@ -31,8 +31,7 @@ /** * ZMIB pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/ZONESTAR%20ZMIB%20V2/ZMIB_V2_Schmatic.pdf - * Origin: https://github.com/ZONESTAR3D/Control-Board/blob/main/8bit/ZMIB/ZMIB%20V2/ZMIB_V2_Schmatic.pdf + * Schematic: https://github.com/ZONESTAR3D/Control-Board/blob/main/8bit/ZMIB/ZMIB%20V2/ZMIB_V2_Schmatic.pdf * * The ZMIB board needs a bootloader installed before Marlin can be uploaded. * If you don't have a chip programmer you can use a spare Arduino plus a few diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index b8ff3262c8f9..ae4ee3268eb7 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -201,10 +201,14 @@ #define WIFI_IO1_PIN PC7 #define WIFI_RESET_PIN PE9 + // + // MKS Testing for code in lcd/extui/mks_ui + // #if ENABLED(MKS_TEST) #define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET #define MKS_TEST_PS_ON_PIN PB0 // PW_OFF #endif + #else //#define POWER_LOSS_PIN PA2 // PW_DET //#define PS_ON_PIN PB2 // PW_OFF diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 0738afd80ee8..ea82c13fba88 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -228,10 +228,14 @@ #define WIFI_IO1_PIN PC7 #define WIFI_RESET_PIN PE9 + // + // MKS Testing for code in lcd/extui/mks_ui + // #if ENABLED(MKS_TEST) #define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF #endif + #else //#define POWER_LOSS_PIN PA2 // PW_DET //#define PS_ON_PIN PB2 // PW_OFF diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index 545b73cf021c..d5689c1e71da 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -41,6 +41,15 @@ // #define DISABLE_DEBUG +// +// Onboard I2C EEPROM +// +#define IIC_BL24CXX_EEPROM // Use I2C EEPROM onboard IC (AT24C04C, Size 4K, PageSize 16B) +#define MARLIN_EEPROM_SIZE 0x1000 // 4K +#define IIC_EEPROM_SDA PB7 +#define IIC_EEPROM_SCL PB6 +#define EEPROM_DEVICE_ADDRESS 0xA0 + // // SPI // @@ -403,3 +412,13 @@ #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_MOSI_PIN PB15 #endif + +// +// MKS WIFI pins +// +#if ENABLED(MKS_WIFI_MODULE) + #define WIFI_RESET_PIN PA5 + #define WIFI_SERIAL_PORT 1 // USART1 + #define WIFI_IO1_PIN PC7 + #define WIFI_IO0_PIN -1 // N.C. +#endif diff --git a/Marlin/src/pins/stm32f4/pins_BLACKBEEZMINI.h b/Marlin/src/pins/stm32f4/pins_BLACKBEEZMINI.h index 886dd092fb84..ead1ee5e05ba 100644 --- a/Marlin/src/pins/stm32f4/pins_BLACKBEEZMINI.h +++ b/Marlin/src/pins/stm32f4/pins_BLACKBEEZMINI.h @@ -29,8 +29,8 @@ #include "env_validate.h" -#ifndef DEFAULT_MACHINE_NAME - #define DEFAULT_MACHINE_NAME "I3DBEE BP_01" +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "I3DBEE BP_01" #endif #define TEMP_TIMER 5 @@ -97,7 +97,7 @@ #define HEATER_0_PIN PA2 // HOTEND MOSFET #define HEATER_BED_PIN PA0 // BED MOSFET -#define FAN1_PIN PA1 // FAN1 header on board - PRINT FAN +#define FAN0_PIN PA1 // FAN1 header on board - PRINT FAN // // SD Card diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index 169cc9d8322a..294782029658 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -21,7 +21,13 @@ */ #pragma once -#include "env_validate.h" +// The Octopus Pro V1 has shipped with both STM32F4 and STM32H7 MCUs. +// Ensure the correct env_validate.h file is included based on the build environment used. +#if NOT_TARGET(STM32H7) + #include "env_validate.h" +#else + #include "../stm32h7/env_validate.h" +#endif #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support #define USES_DIAG_JUMPERS diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h index c5c79311e30e..12d3947b9934 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h @@ -51,7 +51,7 @@ // // MKS WIFI MODULE // -//#define WIFI_SERIAL 1// USART1 +//#define WIFI_SERIAL_PORT 1 // USART1 #if ENABLED(MKS_WIFI_MODULE) #define WIFI_IO0_PIN PB14 // MKS ESP WIFI IO0 PIN #define WIFI_IO1_PIN PB15 // MKS ESP WIFI IO1 PIN diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h index 49650299276a..e96a6793603b 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h @@ -217,9 +217,6 @@ #define KILL_PIN_STATE HIGH #endif -// Random Info -#define USB_SERIAL -1 // USB Serial - /** * ------ ------ * (BEEPER) PB2 | 1 2 | PE10 (BTN_ENC) (SPI1 MISO) PA6 | 1 2 | PA5 (SPI1 SCK) diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index 0b3673046797..050c8f242462 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -195,25 +195,27 @@ #define KILL_PIN_STATE HIGH #endif -// Random Info -#define USB_SERIAL -1 // USB Serial -#define WIFI_SERIAL 3 // USART3 -#define MKS_WIFI_MODULE_SERIAL 1 // USART1 -#define MKS_WIFI_MODULE_SPI 2 // SPI2 - #ifndef SDCARD_CONNECTION #define SDCARD_CONNECTION ONBOARD #endif -// MKS WIFI MODULE +// +// MKS WiFi Module +// #if ENABLED(MKS_WIFI_MODULE) #define WIFI_IO0_PIN PC13 #define WIFI_IO1_PIN PC7 #define WIFI_RESET_PIN PE9 + #define MKS_WIFI_MODULE_SERIAL 1 // USART1 + #define MKS_WIFI_MODULE_SPI 2 // SPI2 +#else + #define WIFI_SERIAL_PORT 3 // USART3 #endif -// MKS TEST -#if ENABLED(MKS_TEST) +// +// MKS Testing for code in lcd/extui/mks_ui +// +#if ALL(TFT_LVGL_UI, MKS_TEST) #define MKS_TEST_POWER_LOSS_PIN PA13 // PW_DET #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF #endif diff --git a/Marlin/src/pins/stm32f4/pins_TRONXY_CXY_446_V10.h b/Marlin/src/pins/stm32f4/pins_TRONXY_CXY_446_V10.h index 00bf9de93401..7e35bfd08fa9 100644 --- a/Marlin/src/pins/stm32f4/pins_TRONXY_CXY_446_V10.h +++ b/Marlin/src/pins/stm32f4/pins_TRONXY_CXY_446_V10.h @@ -219,7 +219,7 @@ #define TOUCH_ORIENTATION TOUCH_LANDSCAPE #endif #endif - + #if ENABLED(MKS_ROBIN_TFT43) #ifndef TOUCH_CALIBRATION_X #define TOUCH_CALIBRATION_X 17184 @@ -237,7 +237,7 @@ #define TOUCH_ORIENTATION TOUCH_LANDSCAPE #endif #endif -#else +#else #error "TRONXY CXY 446 V10 only supports TFT with FSMC interface." #endif diff --git a/Marlin/src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h b/Marlin/src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h index 1840e441f8e6..4a4c47de2c1c 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h @@ -516,6 +516,9 @@ #define DOGLCD_CS EXP1_03_PIN #define DOGLCD_A0 EXP1_04_PIN //#define LCD_BACKLIGHT_PIN -1 + + #define FORCE_SOFT_SPI + #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally. #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_common.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_common.h index fd9aa53a9471..7314ccc825d4 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_common.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_common.h @@ -23,8 +23,11 @@ #include "env_validate.h" +#define BOARD_WEBSITE_URL "github.com/bigtreetech/BIQU-BX" #define DEFAULT_MACHINE_NAME "BIQU BX" +#define USES_DIAG_JUMPERS + // Onboard I2C EEPROM #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x1000 // 4K (24C32) @@ -32,18 +35,27 @@ #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support //#define SWD_DEBUG // Use pins PA13 and PA14 on STM32H7 for the SWD debugger +// +// Trinamic Stallguard pins +// +#define X_DIAG_PIN PB11 // X- +#define Y_DIAG_PIN PB12 // Y- +#define Z_DIAG_PIN PD12 // Z- +#define E0_DIAG_PIN PD13 // X+ +#define E1_DIAG_PIN PB13 // Y+ + // // Limit Switches // -#define X_MIN_PIN PB11 -#define X_MAX_PIN PD13 -#define Y_MIN_PIN PB12 -#define Y_MAX_PIN PB13 -#define Z_MIN_PIN PD12 -#define Z_MAX_PIN PD11 +#define X_MIN_PIN X_DIAG_PIN // X- +#define X_MAX_PIN E0_DIAG_PIN // X+ +#define Y_MIN_PIN Y_DIAG_PIN // Y- +#define Y_MAX_PIN E1_DIAG_PIN // Y+ +#define Z_MIN_PIN Z_DIAG_PIN // Z- +#define Z_MAX_PIN PD11 // Z+ -#define FIL_RUNOUT_PIN PD13 -#define FIL_RUNOUT2_PIN PB13 +#define FIL_RUNOUT_PIN E0_DIAG_PIN // X+ +#define FIL_RUNOUT2_PIN E1_DIAG_PIN // Y+ #ifndef SWD_DEBUG #define LED_PIN PA13 @@ -53,13 +65,13 @@ #define POWER_MONITOR_PIN PB0 #define RPI_POWER_PIN PE5 -#define SERVO0_PIN PA2 +#define SERVO0_PIN PA2 // PROBE // // Z Probe (when not Z_MIN_PIN) // #ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN PH2 // Probe + #define Z_MIN_PROBE_PIN PH2 // PROBE #endif // @@ -72,30 +84,44 @@ // // Steppers // -#define X_STEP_PIN PG13 +#define X_STEP_PIN PG13 // X #define X_DIR_PIN PG12 #define X_ENABLE_PIN PG14 #define X_CS_PIN PG10 -#define Y_STEP_PIN PB3 +#define Y_STEP_PIN PB3 // Y #define Y_DIR_PIN PD3 #define Y_ENABLE_PIN PB4 #define Y_CS_PIN PD4 -#define Z_STEP_PIN PD7 -#define Z_DIR_PIN PD6 -#define Z_ENABLE_PIN PG9 -#define Z_CS_PIN PD5 +#ifdef BX_SWAP_ZM_E1M + #define Z_STEP_PIN PA8 // E1 + #define Z_DIR_PIN PC9 + #define Z_ENABLE_PIN PD2 + #define Z_CS_PIN PC8 +#else + #define Z_STEP_PIN PD7 // Z1 + #define Z_DIR_PIN PD6 + #define Z_ENABLE_PIN PG9 + #define Z_CS_PIN PD5 +#endif -#define E0_STEP_PIN PC14 +#define E0_STEP_PIN PC14 // E0 #define E0_DIR_PIN PC13 #define E0_ENABLE_PIN PC15 #define E0_CS_PIN PI8 -#define E1_STEP_PIN PA8 -#define E1_DIR_PIN PC9 -#define E1_ENABLE_PIN PD2 -#define E1_CS_PIN PC8 +#ifdef BX_SWAP_ZM_E1M + #define E1_STEP_PIN PD7 // Z1 + #define E1_DIR_PIN PD6 + #define E1_ENABLE_PIN PG9 + #define E1_CS_PIN PD5 +#else + #define E1_STEP_PIN PA8 // E1 + #define E1_DIR_PIN PC9 + #define E1_ENABLE_PIN PD2 + #define E1_CS_PIN PC8 +#endif // // SPI pins for TMC2130 stepper drivers @@ -138,14 +164,24 @@ #define Y_SERIAL_TX_PIN PD4 #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN - #define Z_SERIAL_TX_PIN PD5 - #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + #ifdef BX_SWAP_ZM_E1M + #define Z_SERIAL_TX_PIN PC8 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + #else + #define Z_SERIAL_TX_PIN PD5 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + #endif #define E0_SERIAL_TX_PIN PI8 #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN - #define E1_SERIAL_TX_PIN PC8 - #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + #ifdef BX_SWAP_ZM_E1M + #define E1_SERIAL_TX_PIN PD5 + #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + #else + #define E1_SERIAL_TX_PIN PC8 + #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + #endif // Reduce baud rate to improve software serial reliability #ifndef TMC_BAUD_RATE @@ -164,15 +200,15 @@ // // Heaters / Fans // -#define HEATER_0_PIN PC4 -#define HEATER_1_PIN PC5 -#define HEATER_BED_PIN PA4 +#define HEATER_0_PIN PC4 // HE0 +#define HEATER_1_PIN PC5 // HE1 +#define HEATER_BED_PIN PA4 // BED -#define FAN0_PIN PA5 // "FAN0" -#define FAN1_PIN PA6 // "FAN1" -#define FAN2_PIN PA7 // "FAN2" +#define FAN0_PIN PA5 // FAN0 +#define FAN1_PIN PA6 // FAN1 +#define FAN2_PIN PA7 // FAN2 / DCOT -#define BOARD_NEOPIXEL_PIN PH3 +#define BOARD_NEOPIXEL_PIN PH3 // RGB #define NEOPIXEL2_PIN PB1 #if HAS_LTDC_TFT @@ -238,3 +274,25 @@ #define SD_MISO_PIN PC11 #define SD_MOSI_PIN PC12 #define SD_DETECT_PIN PI3 + +#if ENABLED(WIFISUPPORT) + // + // WIFI + // + + /** + * ----- + * (ESP-RX4) PA1 | 1 8 | GND + * (ESP-EN) -- | 2 7 | -- (ESP-IO2) + * (ESP-RST) -- | 3 6 | -- (ESP-IO0) + * 3.3V | 4 5 | PA0 (ESP-TX4) + * ----- + * WIFI-ESP01 + */ + #define ESP_WIFI_MODULE_COM 4 // Must also set either SERIAL_PORT / SERIAL_PORT_2 / SERIAL_PORT_3 to this + #define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT / SERIAL_PORT_2 / SERIAL_PORT_3 + #define ESP_WIFI_MODULE_RESET_PIN -1 + #define ESP_WIFI_MODULE_ENABLE_PIN -1 + #define ESP_WIFI_MODULE_GPIO0_PIN -1 + #define ESP_WIFI_MODULE_GPIO2_PIN -1 +#endif diff --git a/Marlin/src/pins/teensy2/pins_5DPRINT.h b/Marlin/src/pins/teensy2/pins_5DPRINT.h index 798f98dae509..1b1bbf122d87 100644 --- a/Marlin/src/pins/teensy2/pins_5DPRINT.h +++ b/Marlin/src/pins/teensy2/pins_5DPRINT.h @@ -64,8 +64,7 @@ /** * 5DPrint D8 Driver board pin assignments - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/5DPrint%20D8/5DPD8_v1.0_OS_schematics.PDF - * Origin: https://bitbucket.org/makible/5dprint-d8-controller-board/src/master/5DPD8_v1.0_OS_schematics.PDF + * Schematic: https://bitbucket.org/makible/5dprint-d8-controller-board/src/master/5DPD8_v1.0_OS_schematics.PDF * * https://bitbucket.org/makible/5dprint-d8-controller-board */ diff --git a/Marlin/src/pins/teensy2/pins_BRAINWAVE.h b/Marlin/src/pins/teensy2/pins_BRAINWAVE.h index 900eae6dd49e..8bdd926dda2d 100644 --- a/Marlin/src/pins/teensy2/pins_BRAINWAVE.h +++ b/Marlin/src/pins/teensy2/pins_BRAINWAVE.h @@ -28,8 +28,7 @@ * Requires hardware bundle for Arduino: * https://github.com/unrepentantgeek/brainwave-arduino * - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Brainwave/schematic.pdf - * Origin: https://github.com/unrepentantgeek/Brainwave/blob/master/brainwave/brainwave.sch + * Schematic: https://github.com/unrepentantgeek/Brainwave/blob/master/brainwave/brainwave.sch */ /** diff --git a/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h b/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h index ab4427a8892d..f36ea66cf7a3 100644 --- a/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h +++ b/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h @@ -26,14 +26,10 @@ * * Converted to Arduino pin numbering * - * Schematic (RevA): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.A/schematic.png - * Origin (RevA): https://raw.githubusercontent.com/lwalkera/printrboard/revA/Printrboard.sch - * Schematic (RevB): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.B/schematic.png - * Origin (RevB): https://raw.githubusercontent.com/lwalkera/printrboard/revB/Printrboard.sch - * Schematic (RevC): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.C/schematic.png - * Origin (RevC): https://raw.githubusercontent.com/lwalkera/printrboard/revC/Printrboard.sch - * Schematic (RevD): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.D/schematic.png - * Origin (RevD): https://raw.githubusercontent.com/lwalkera/printrboard/RevD/Printrboard.sch + * Schematic (RevA): https://raw.githubusercontent.com/lwalkera/printrboard/revA/Printrboard.sch + * Schematic (RevB): https://raw.githubusercontent.com/lwalkera/printrboard/revB/Printrboard.sch + * Schematic (RevC): https://raw.githubusercontent.com/lwalkera/printrboard/revC/Printrboard.sch + * Schematic (RevD): https://raw.githubusercontent.com/lwalkera/printrboard/RevD/Printrboard.sch */ /** diff --git a/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h b/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h index 62922399d827..ef70d1a2cba2 100644 --- a/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h +++ b/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h @@ -26,18 +26,12 @@ * * Converted to Arduino pin numbering * - * Schematic (RevF): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.F/schematic.png - * Origin (RevF): https://github.com/lwalkera/printrboard/raw/revF/Printrboard.sch - * Schematic (RevF2): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.F2/schematic.png - * Origin (RevF2): https://raw.githubusercontent.com/lwalkera/printrboard/revF2/Printrboard.sch - * Schematic (RevF3): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.F3/schematic.png - * Origin (RevF3): https://raw.githubusercontent.com/lwalkera/printrboard/revF3/Printrboard.sch - * Schematic (RevF4): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.F4/schematic.png - * Origin (RevF4): https://raw.githubusercontent.com/lwalkera/printrboard/revF4/Printrboard.sch - * Schematic (RevF5): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.F5/schematic.png - * Origin (RevF5): https://raw.githubusercontent.com/lwalkera/printrboard/revF5/Printrboard.sch - * Schematic (RevF6): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Printrboard%20Rev.F6/schematic.png - * Origin (RevF6): https://raw.githubusercontent.com/lwalkera/printrboard/revF6/Printrboard.sch + * Schematic (RevF): https://github.com/lwalkera/printrboard/raw/revF/Printrboard.sch + * Schematic (RevF2): https://raw.githubusercontent.com/lwalkera/printrboard/revF2/Printrboard.sch + * Schematic (RevF3): https://raw.githubusercontent.com/lwalkera/printrboard/revF3/Printrboard.sch + * Schematic (RevF4): https://raw.githubusercontent.com/lwalkera/printrboard/revF4/Printrboard.sch + * Schematic (RevF5): https://raw.githubusercontent.com/lwalkera/printrboard/revF5/Printrboard.sch + * Schematic (RevF6): https://raw.githubusercontent.com/lwalkera/printrboard/revF6/Printrboard.sch */ /** diff --git a/Marlin/src/pins/teensy2/pins_SAV_MKI.h b/Marlin/src/pins/teensy2/pins_SAV_MKI.h index 9f590cbbb4e0..a0d056f85014 100644 --- a/Marlin/src/pins/teensy2/pins_SAV_MKI.h +++ b/Marlin/src/pins/teensy2/pins_SAV_MKI.h @@ -26,8 +26,7 @@ * * Converted to Arduino pin numbering * - * Schematic: https://green-candy.osdn.jp/external/MarlinFW/board_schematics/SAV%20MkI/SAV_MK-I.pdf - * Origin: https://reprap.org/mediawiki/images/3/3c/SAV_MK-I.pdf + * Schematic: https://reprap.org/mediawiki/images/3/3c/SAV_MK-I.pdf */ /** diff --git a/Marlin/src/pins/teensy2/pins_TEENSYLU.h b/Marlin/src/pins/teensy2/pins_TEENSYLU.h index a6a16f2be158..454aff91fcd8 100644 --- a/Marlin/src/pins/teensy2/pins_TEENSYLU.h +++ b/Marlin/src/pins/teensy2/pins_TEENSYLU.h @@ -25,8 +25,7 @@ * * Converted to Arduino pin numbering * - * Schematic (1.0): https://green-candy.osdn.jp/external/MarlinFW/board_schematics/Teensylu%20v1.0/schematic.png - * Origin (1.0): https://raw.githubusercontent.com/StephS/Teensylu/master/working/Teensylu-1.0.sch + * Schematic (1.0): https://raw.githubusercontent.com/StephS/Teensylu/master/working/Teensylu-1.0.sch * (*) Other versions are discouraged by creator. */ diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index ae7415548213..25a30585f81f 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -34,8 +34,6 @@ #if ENABLED(DWIN_CREALITY_LCD) #include "../lcd/e3v2/creality/dwin.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../lcd/e3v2/proui/dwin.h" #endif #include "../module/planner.h" // for synchronize diff --git a/Marlin/src/tests/marlin_tests.cpp b/Marlin/src/tests/marlin_tests.cpp index f61f840176f2..89e5664345d8 100644 --- a/Marlin/src/tests/marlin_tests.cpp +++ b/Marlin/src/tests/marlin_tests.cpp @@ -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------ 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() diff --git a/Marlin/tests/README.md b/Marlin/tests/README.md new file mode 100644 index 000000000000..883069f044bd --- /dev/null +++ b/Marlin/tests/README.md @@ -0,0 +1,5 @@ +These test files are executed by the unit-tests built from the `/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. diff --git a/Marlin/tests/core/test_macros.cpp b/Marlin/tests/core/test_macros.cpp new file mode 100644 index 000000000000..bb269dec2b40 --- /dev/null +++ b/Marlin/tests/core/test_macros.cpp @@ -0,0 +1,1215 @@ +/** + * 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 . + * + */ + +#include "../test/unit_tests.h" +#include + +// These represent enabled and disabled configuration options for testing. +// They will be used by multiple tests. +#define OPTION_ENABLED 1 +#define OPTION_DISABLED 0 + +MARLIN_TEST(macros_bitwise_8, TEST) { + uint8_t odd_set = 0xAA; + uint8_t even_set = 0x55; + for (uint8_t b = 0; b < 8; ++b) { + TEST_ASSERT_EQUAL((b % 2) != 0, TEST(odd_set, b)); + TEST_ASSERT_EQUAL((b % 2) == 0, TEST(even_set, b)); + } +} + +MARLIN_TEST(macros_bitwise_8, SET_BIT_TO) { + uint8_t n = 0x00; + + // Test LSB + SET_BIT_TO(n, 0, true); + TEST_ASSERT_EQUAL(0x01, n); + SET_BIT_TO(n, 0, false); + TEST_ASSERT_EQUAL(0x00, n); + + // Test MSB + SET_BIT_TO(n, 7, true); + TEST_ASSERT_EQUAL(0x80, n); + SET_BIT_TO(n, 7, false); + TEST_ASSERT_EQUAL(0x00, n); + + // Test a bit in the middle + SET_BIT_TO(n, 3, true); + TEST_ASSERT_EQUAL(0x08, n); + SET_BIT_TO(n, 3, false); + TEST_ASSERT_EQUAL(0x00, n); +} + +MARLIN_TEST(macros_bitwise_8, SBI) { + uint8_t n; + + // Test LSB + n = 0x00; + SBI(n, 0); + TEST_ASSERT_EQUAL(0x01, n); + + // Test MSB + n = 0x00; + SBI(n, 7); + TEST_ASSERT_EQUAL(0x80, n); + + // Test a bit in the middle + n = 0x00; + SBI(n, 3); + TEST_ASSERT_EQUAL(0x08, n); +} + +MARLIN_TEST(macros_bitwise_8, CBI) { + uint8_t n; + + // Test LSB + n = 0xFF; + CBI(n, 0); + TEST_ASSERT_EQUAL(0xFE, n); + + // Test MSB + n = 0xFF; + CBI(n, 7); + TEST_ASSERT_EQUAL(0x7F, n); + + // Test a bit in the middle + n = 0xFF; + CBI(n, 3); + TEST_ASSERT_EQUAL(0xF7, n); +} + +MARLIN_TEST(macros_bitwise_8, TBI) { + uint8_t n; + + // Test LSB + n = 0xAA; + TBI(n, 0); + TEST_ASSERT_EQUAL(0xAB, n); + + // Test MSB + n = 0xAA; + TBI(n, 7); + TEST_ASSERT_EQUAL(0x2A, n); + + // Test a bit in the middle + n = 0xAA; + TBI(n, 3); + TEST_ASSERT_EQUAL(0xA2, n); +} + +// 32-bit BIT operation tests +// These verify the above macros, but specifically with the MSB of a uint32_t. +// This ensures that the macros are not limited to 8-bit operations. + +MARLIN_TEST(macros_bitwise_32, TEST_32bit) { + uint32_t odd_set = 0x80000000; + uint32_t even_set = 0x00000000; + TEST_ASSERT_EQUAL(true, TEST(odd_set, 31)); + TEST_ASSERT_EQUAL(false, TEST(even_set, 31)); +} + +MARLIN_TEST(macros_bitwise_32, SET_BIT_TO_32bit) { + uint32_t n = 0x00000000; + + // Test MSB + SET_BIT_TO(n, 31, true); + TEST_ASSERT_EQUAL(0x80000000, n); + SET_BIT_TO(n, 31, false); + TEST_ASSERT_EQUAL(0x00000000, n); +} + +MARLIN_TEST(macros_bitwise_32, SBI_32bit) { + uint32_t n = 0x00000000; + + // Test MSB + SBI(n, 31); + TEST_ASSERT_EQUAL(0x80000000, n); +} + +MARLIN_TEST(macros_bitwise_32, CBI_32bit) { + uint32_t n = 0xFFFFFFFF; + + // Test MSB + CBI(n, 31); + TEST_ASSERT_EQUAL(0x7FFFFFFF, n); +} + +MARLIN_TEST(macros_bitwise_32, TBI_32bit) { + uint32_t n = 0x7FFFFFFF; + + // Test MSB + TBI(n, 31); + TEST_ASSERT_EQUAL(0xFFFFFFFF, n); +} + +// Geometry macros +MARLIN_TEST(macros_geometry, cu_int) { + TEST_ASSERT_EQUAL(8, cu(2)); + TEST_ASSERT_EQUAL(27, cu(3)); +} + +MARLIN_TEST(macros_geometry, cu_float) { + TEST_ASSERT_FLOAT_WITHIN(0.001f, 8.615f, cu(2.05f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 28.094f, cu(3.04f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 13.998f, cu(2.41f)); +} + +MARLIN_TEST(macros_geometry, RADIANS) { + TEST_ASSERT_FLOAT_WITHIN(0.001f, float(M_PI), RADIANS(180.0f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 0.0f, RADIANS(0.0f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, float(M_PI) / 4, RADIANS(45.0f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, float(M_PI) / 2, RADIANS(90.0f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 3 * float(M_PI) / 2, RADIANS(270.0f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 4 * float(M_PI), RADIANS(720.0f)); +} + +MARLIN_TEST(macros_geometry, DEGREES) { + TEST_ASSERT_FLOAT_WITHIN(0.001f, 180.0f, DEGREES(float(M_PI))); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 0.0f, DEGREES(0.0f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 45.0f, DEGREES(float(M_PI) / 4)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 90.0f, DEGREES(float(M_PI) / 2)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 270.0f, DEGREES(3 * float(M_PI) / 2)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 720.0f, DEGREES(4 * float(M_PI))); +} + +MARLIN_TEST(macros_geometry, HYPOT2) { + TEST_ASSERT_EQUAL(25, HYPOT2(3, 4)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 13.0f, HYPOT2(2.0f, 3.0f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 18.72f, HYPOT2(2.4f, 3.6f)); +} + +MARLIN_TEST(macros_geometry, NORMSQ) { + TEST_ASSERT_EQUAL(14, NORMSQ(1, 2, 3)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 14.0f, NORMSQ(1.0f, 2.0f, 3.0f)); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 20.16f, NORMSQ(1.2f, 2.4f, 3.6f)); +} + +MARLIN_TEST(macros_geometry, CIRCLE_AREA) { + TEST_ASSERT_EQUAL(float(M_PI) * 4, CIRCLE_AREA(2)); +} + +MARLIN_TEST(macros_geometry, CIRCLE_CIRC) { + TEST_ASSERT_EQUAL(2 * float(M_PI) * 3, CIRCLE_CIRC(3)); +} + +MARLIN_TEST(macros_numeric, SIGN) { + TEST_ASSERT_EQUAL(1, SIGN(100)); + TEST_ASSERT_EQUAL(-1, SIGN(-100)); + TEST_ASSERT_EQUAL(0, SIGN(0)); +} + +MARLIN_TEST(macros_numeric, IS_POWER_OF_2) { + TEST_ASSERT_EQUAL(false, IS_POWER_OF_2(0)); + TEST_ASSERT_EQUAL(true, IS_POWER_OF_2(1)); + TEST_ASSERT_EQUAL(true, IS_POWER_OF_2(4)); + TEST_ASSERT_EQUAL(false, IS_POWER_OF_2(5)); + TEST_ASSERT_EQUAL(false, IS_POWER_OF_2(0x80000001)); + TEST_ASSERT_EQUAL(true, IS_POWER_OF_2(0x80000000)); +} + +// Numeric constraints +MARLIN_TEST(macros_numeric, NOLESS_int) { + // Scenario 1: Input was already acceptable + int a = 8; + NOLESS(a, 5); + TEST_ASSERT_EQUAL(8, a); + + // Original scenario: Input was less than the limit + a = 5; + NOLESS(a, 10); + TEST_ASSERT_EQUAL(10, a); + + // Scenario 2: Input is negative, and coerces to a positive number + a = -5; + NOLESS(a, 0); + TEST_ASSERT_EQUAL(0, a); + + // Scenario 3: Input is negative, and coerces to another negative number + a = -10; + NOLESS(a, -5); + TEST_ASSERT_EQUAL(-5, a); +} + +MARLIN_TEST(macros_numeric, NOLESS_uint) { + // Scenario 1: Input was already acceptable + unsigned int b = 8u; + NOLESS(b, 5u); + TEST_ASSERT_EQUAL(8u, b); + + // Original scenario: Input was less than the limit + b = 5u; + NOLESS(b, 10u); + TEST_ASSERT_EQUAL(10u, b); +} + +MARLIN_TEST(macros_numeric, NOLESS_float) { + // Scenario 1: Input was already acceptable + float c = 8.5f; + NOLESS(c, 5.5f); + TEST_ASSERT_EQUAL_FLOAT(8.5f, c); + + // Original scenario: Input was less than the limit + c = 5.5f; + NOLESS(c, 10.5f); + TEST_ASSERT_EQUAL_FLOAT(10.5f, c); + + // Scenario 2: Input is negative, and coerces to a positive number + c = -5.5f; + NOLESS(c, 5.0f); + TEST_ASSERT_EQUAL_FLOAT(5.0f, c); + + // Scenario 3: Input is negative, and coerces to another negative number + c = -10.5f; + NOLESS(c, -5.5f); + TEST_ASSERT_EQUAL_FLOAT(-5.5f, c); + c = -5.5f; + NOLESS(c, -10.5f); + TEST_ASSERT_EQUAL_FLOAT(-5.5f, c); +} + +MARLIN_TEST(macros_numeric, NOMORE_int) { + // Scenario 1: Input was already acceptable + int a = 8; + NOMORE(a, 10); + TEST_ASSERT_EQUAL(8, a); + + // Original scenario: Input was more than the limit + a = 15; + NOMORE(a, 10); + TEST_ASSERT_EQUAL(10, a); + + // Scenario 2: Input is positive, and coerces to a negative number + a = 5; + NOMORE(a, -2); + TEST_ASSERT_EQUAL(-2, a); + + // Scenario 3: Input is negative, and coerces to another negative number + a = -5; + NOMORE(a, -10); + TEST_ASSERT_EQUAL(-10, a); +} + +MARLIN_TEST(macros_numeric, NOMORE_uint) { + // Scenario 1: Input was already acceptable + unsigned int b = 8u; + NOMORE(b, 10u); + TEST_ASSERT_EQUAL(8u, b); + + // Original scenario: Input was more than the limit + b = 15u; + NOMORE(b, 10u); + TEST_ASSERT_EQUAL(10u, b); +} + +MARLIN_TEST(macros_numeric, NOMORE_float) { + // Scenario 1: Input was already acceptable + float c = 8.5f; + NOMORE(c, 10.5f); + TEST_ASSERT_EQUAL_FLOAT(8.5f, c); + + // Original scenario: Input was more than the limit + c = 15.5f; + NOMORE(c, 10.5f); + TEST_ASSERT_EQUAL_FLOAT(10.5f, c); + + // Scenario 2: Input is positive, and coerces to a negative number + c = 5.5f; + NOMORE(c, -1.7f); + TEST_ASSERT_EQUAL_FLOAT(-1.7f, c); + + // Scenario 3: Input is negative, and coerces to another negative number + c = -5.5f; + NOMORE(c, -10.5f); + TEST_ASSERT_EQUAL_FLOAT(-10.5f, c); +} + +MARLIN_TEST(macros_numeric, LIMIT_int) { + int a = 15; + LIMIT(a, 10, 20); + TEST_ASSERT_EQUAL(15, a); + + a = 5; + LIMIT(a, 10, 20); + TEST_ASSERT_EQUAL(10, a); + + a = 25; + LIMIT(a, 10, 20); + TEST_ASSERT_EQUAL(20, a); + + // Scenario: Range is [-10, -5] + a = -8; + LIMIT(a, -10, -5); + TEST_ASSERT_EQUAL(-8, a); + + a = -12; + LIMIT(a, -10, -5); + TEST_ASSERT_EQUAL(-10, a); + + a = -3; + LIMIT(a, -10, -5); + TEST_ASSERT_EQUAL(-5, a); + + // Scenario: Range is [-10, 5] + a = 0; + LIMIT(a, -10, 5); + TEST_ASSERT_EQUAL(0, a); + + a = -12; + LIMIT(a, -10, 5); + TEST_ASSERT_EQUAL(-10, a); + + a = 6; + LIMIT(a, -10, 5); + TEST_ASSERT_EQUAL(5, a); +} + +MARLIN_TEST(macros_numeric, LIMIT_uint) { + unsigned int b = 15u; + LIMIT(b, 10u, 20u); + TEST_ASSERT_EQUAL(15u, b); + + b = 5u; + LIMIT(b, 10u, 20u); + TEST_ASSERT_EQUAL(10u, b); + + b = 25u; + LIMIT(b, 10u, 20u); + TEST_ASSERT_EQUAL(20u, b); +} + +MARLIN_TEST(macros_numeric, LIMIT_float) { + float c = 15.5f; + LIMIT(c, 10.5f, 20.5f); + TEST_ASSERT_EQUAL_FLOAT(15.5f, c); + + c = 5.5f; + LIMIT(c, 10.5f, 20.5f); + TEST_ASSERT_EQUAL_FLOAT(10.5f, c); + + c = 25.5f; + LIMIT(c, 10.5f, 20.5f); + TEST_ASSERT_EQUAL_FLOAT(20.5f, c); + + // Scenario: Range is [-10.5, -5.5] + c = -8.5f; + LIMIT(c, -10.5f, -5.5f); + TEST_ASSERT_EQUAL_FLOAT(-8.5f, c); + + c = -12.5f; + LIMIT(c, -10.5f, -5.5f); + TEST_ASSERT_EQUAL_FLOAT(-10.5f, c); + + c = -3.5f; + LIMIT(c, -10.5f, -5.5f); + TEST_ASSERT_EQUAL_FLOAT(-5.5f, c); + + // Scenario: Range is [-10.5, 5.5] + c = 0.0f; + LIMIT(c, -10.5f, 5.5f); + TEST_ASSERT_EQUAL_FLOAT(0.0f, c); + + c = -12.5f; + LIMIT(c, -10.5f, 5.5f); + TEST_ASSERT_EQUAL_FLOAT(-10.5f, c); + + c = 6.5f; + LIMIT(c, -10.5f, 5.5f); + TEST_ASSERT_EQUAL_FLOAT(5.5f, c); +} + + +// Looping macros +MARLIN_TEST(macros_looping, DO_macro) { + #define _M_1(A) (A) + int sum = DO(M, +, 1, 2, 3, 4, 5); + TEST_ASSERT_EQUAL(15, sum); + + // Test with maximum number of arguments + sum = DO(M, +, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40); + TEST_ASSERT_EQUAL(820, sum); + #undef _M_1 +} + +// Configuration Options +MARLIN_TEST(macros_options, ENABLED_DISABLED) { + #define OPTION_A + #define OPTION_B 1 + #define OPTION_C true + #define OPTION_D 0 + #define OPTION_E false + // #define OPTION_F + + // Test ENABLED macro + TEST_ASSERT_TRUE(ENABLED(OPTION_A)); + TEST_ASSERT_TRUE(ENABLED(OPTION_B)); + TEST_ASSERT_TRUE(ENABLED(OPTION_C)); + TEST_ASSERT_FALSE(ENABLED(OPTION_D)); + TEST_ASSERT_FALSE(ENABLED(OPTION_E)); + TEST_ASSERT_FALSE(ENABLED(OPTION_F)); + + // Test DISABLED macro + TEST_ASSERT_FALSE(DISABLED(OPTION_A)); + TEST_ASSERT_FALSE(DISABLED(OPTION_B)); + TEST_ASSERT_FALSE(DISABLED(OPTION_C)); + TEST_ASSERT_TRUE(DISABLED(OPTION_D)); + TEST_ASSERT_TRUE(DISABLED(OPTION_E)); + TEST_ASSERT_TRUE(DISABLED(OPTION_F)); + + #undef OPTION_A + #undef OPTION_B + #undef OPTION_C + #undef OPTION_D + #undef OPTION_E +} + +MARLIN_TEST(macros_options, ANY) { + TEST_ASSERT_TRUE(ANY(OPTION_DISABLED, OPTION_ENABLED, OPTION_DISABLED)); // Enabled option in the middle + TEST_ASSERT_TRUE(ANY(OPTION_ENABLED, OPTION_DISABLED, OPTION_DISABLED)); // Enabled option at the beginning + TEST_ASSERT_TRUE(ANY(OPTION_DISABLED, OPTION_DISABLED, OPTION_ENABLED)); // Enabled option at the end + TEST_ASSERT_FALSE(ANY(OPTION_DISABLED, OPTION_DISABLED, OPTION_DISABLED)); // All options disabled +} + +MARLIN_TEST(macros_options, ALL) { + TEST_ASSERT_TRUE(ALL(OPTION_ENABLED, OPTION_ENABLED, OPTION_ENABLED)); // All options enabled + TEST_ASSERT_FALSE(ALL(OPTION_ENABLED, OPTION_DISABLED, OPTION_ENABLED)); // Disabled option in the middle + TEST_ASSERT_FALSE(ALL(OPTION_DISABLED, OPTION_ENABLED, OPTION_ENABLED)); // Disabled option at the beginning + TEST_ASSERT_FALSE(ALL(OPTION_ENABLED, OPTION_ENABLED, OPTION_DISABLED)); // Disabled option at the end + TEST_ASSERT_FALSE(ALL(OPTION_DISABLED, OPTION_DISABLED, OPTION_DISABLED)); // All options disabled +} + +MARLIN_TEST(macros_options, NONE) { + TEST_ASSERT_FALSE(NONE(OPTION_ENABLED, OPTION_ENABLED, OPTION_ENABLED)); // All options enabled + TEST_ASSERT_FALSE(NONE(OPTION_ENABLED, OPTION_DISABLED, OPTION_ENABLED)); // Disabled option in the middle + TEST_ASSERT_FALSE(NONE(OPTION_DISABLED, OPTION_ENABLED, OPTION_ENABLED)); // Disabled option at the beginning + TEST_ASSERT_FALSE(NONE(OPTION_ENABLED, OPTION_ENABLED, OPTION_DISABLED)); // Disabled option at the end + TEST_ASSERT_TRUE(NONE(OPTION_DISABLED, OPTION_DISABLED, OPTION_DISABLED)); // All options disabled +} + +MARLIN_TEST(macros_options, COUNT_ENABLED) { + TEST_ASSERT_EQUAL(3, COUNT_ENABLED(OPTION_ENABLED, OPTION_ENABLED, OPTION_ENABLED)); // All options enabled + TEST_ASSERT_EQUAL(2, COUNT_ENABLED(OPTION_ENABLED, OPTION_DISABLED, OPTION_ENABLED)); // Disabled option in the middle + TEST_ASSERT_EQUAL(2, COUNT_ENABLED(OPTION_DISABLED, OPTION_ENABLED, OPTION_ENABLED)); // Disabled option at the beginning + TEST_ASSERT_EQUAL(2, COUNT_ENABLED(OPTION_ENABLED, OPTION_ENABLED, OPTION_DISABLED)); // Disabled option at the end + TEST_ASSERT_EQUAL(0, COUNT_ENABLED(OPTION_DISABLED, OPTION_DISABLED, OPTION_DISABLED)); // All options disabled +} + +MARLIN_TEST(macros_options, MANY) { + TEST_ASSERT_FALSE(MANY(OPTION_ENABLED, OPTION_DISABLED, OPTION_DISABLED)); // Only one option enabled + TEST_ASSERT_TRUE(MANY(OPTION_ENABLED, OPTION_ENABLED, OPTION_DISABLED)); // Two options enabled + TEST_ASSERT_TRUE(MANY(OPTION_ENABLED, OPTION_ENABLED, OPTION_ENABLED)); // All options enabled + TEST_ASSERT_FALSE(MANY(OPTION_DISABLED, OPTION_DISABLED, OPTION_DISABLED)); // No options enabled +} + + +// Ternary macros +MARLIN_TEST(macros_options, TERN) { + TEST_ASSERT_EQUAL(1, TERN(OPTION_ENABLED, 1, 0)); // OPTION_ENABLED is enabled, so it should return '1' + TEST_ASSERT_EQUAL(0, TERN(OPTION_DISABLED, 1, 0)); // OPTION_DISABLED is disabled, so it should return '0' +} + +MARLIN_TEST(macros_options, TERN0) { + TEST_ASSERT_EQUAL(1, TERN0(OPTION_ENABLED, 1)); // OPTION_ENABLED is enabled, so it should return '1' + TEST_ASSERT_EQUAL(0, TERN0(OPTION_DISABLED, 1)); // OPTION_DISABLED is disabled, so it should return '0' +} + +MARLIN_TEST(macros_options, TERN1) { + TEST_ASSERT_EQUAL(0, TERN1(OPTION_ENABLED, 0)); // OPTION_ENABLED is enabled, so it should return '0' + TEST_ASSERT_EQUAL(1, TERN1(OPTION_DISABLED, 0)); // OPTION_DISABLED is disabled, so it should return '1' +} + +MARLIN_TEST(macros_options, TERN_) { + TEST_ASSERT_EQUAL(-1, TERN_(OPTION_ENABLED, -)1); // OPTION_ENABLED is enabled, so it should return '1' + TEST_ASSERT_EQUAL(1, TERN_(OPTION_DISABLED, -)1); // OPTION_DISABLED is disabled, so it should return nothing +} + +MARLIN_TEST(macros_options, IF_DISABLED) { + TEST_ASSERT_EQUAL(1, IF_DISABLED(OPTION_ENABLED, -)1); // OPTION_ENABLED is enabled, so it should return nothing + TEST_ASSERT_EQUAL(-1, IF_DISABLED(OPTION_DISABLED, -)1); // OPTION_DISABLED is disabled, so it should return '1' +} + +MARLIN_TEST(macros_options, OPTITEM) { + int enabledArray[] = {OPTITEM(OPTION_ENABLED, 1, 2)}; + int disabledArray[] = {OPTITEM(OPTION_DISABLED, 1, 2)}; + TEST_ASSERT_EQUAL(2, sizeof(enabledArray) / sizeof(int)); // OPTION_ENABLED is enabled, so it should return an array of size 2 + TEST_ASSERT_EQUAL(0, sizeof(disabledArray) / sizeof(int)); // OPTION_DISABLED is disabled, so it should return an array of size 0 +} + +MARLIN_TEST(macros_options, OPTARG) { + int enabledArgs[] = {0 OPTARG(OPTION_ENABLED, 1, 2)}; + int disabledArgs[] = {0 OPTARG(OPTION_DISABLED, 1, 2)}; + + int sumEnabledArgs = 0; + for (const auto& arg : enabledArgs) { + sumEnabledArgs += arg; + } + + int sumDisabledArgs = 0; + for (const auto& arg : disabledArgs) { + sumDisabledArgs += arg; + } + + TEST_ASSERT_EQUAL(3, sumEnabledArgs); // OPTION_ENABLED is enabled, so it should return 3 + TEST_ASSERT_EQUAL(0, sumDisabledArgs); // OPTION_DISABLED is disabled, so it should return 0 +} + +MARLIN_TEST(macros_options, OPTCODE) { + int enabledCode = 0; OPTCODE(OPTION_ENABLED, enabledCode = 1); + int disabledCode = 0; OPTCODE(OPTION_DISABLED, disabledCode = 1); + TEST_ASSERT_EQUAL(1, enabledCode); // OPTION_ENABLED is enabled, so it should return 1 + TEST_ASSERT_EQUAL(0, disabledCode); // OPTION_DISABLED is disabled, so it should return 0 +} + +MARLIN_TEST(macros_optional_math, PLUS_TERN0) { + int enabledPlus = 5 PLUS_TERN0(OPTION_ENABLED, 2); + int disabledPlus = 5 PLUS_TERN0(OPTION_DISABLED, 2); + TEST_ASSERT_EQUAL(7, enabledPlus); // OPTION_ENABLED is enabled, so it should return 7 + TEST_ASSERT_EQUAL(5, disabledPlus); // OPTION_DISABLED is disabled, so it should return 5 +} + +MARLIN_TEST(macros_optional_math, MINUS_TERN0) { + int enabledMinus = 5 MINUS_TERN0(OPTION_ENABLED, 2); + int disabledMinus = 5 MINUS_TERN0(OPTION_DISABLED, 2); + TEST_ASSERT_EQUAL(3, enabledMinus); // OPTION_ENABLED is enabled, so it should return 3 + TEST_ASSERT_EQUAL(5, disabledMinus); // OPTION_DISABLED is disabled, so it should return 5 +} + +MARLIN_TEST(macros_optional_math, MUL_TERN1) { + int enabledMul = 5 MUL_TERN1(OPTION_ENABLED, 2); + int disabledMul = 5 MUL_TERN1(OPTION_DISABLED, 2); + TEST_ASSERT_EQUAL(10, enabledMul); // OPTION_ENABLED is enabled, so it should return 10 + TEST_ASSERT_EQUAL(5, disabledMul); // OPTION_DISABLED is disabled, so it should return 5 +} + +MARLIN_TEST(macros_optional_math, DIV_TERN1) { + int enabledDiv = 10 DIV_TERN1(OPTION_ENABLED, 2); + int disabledDiv = 10 DIV_TERN1(OPTION_DISABLED, 2); + TEST_ASSERT_EQUAL(5, enabledDiv); // OPTION_ENABLED is enabled, so it should return 5 + TEST_ASSERT_EQUAL(10, disabledDiv); // OPTION_DISABLED is disabled, so it should return 10 +} + +MARLIN_TEST(macros_optional_math, SUM_TERN) { + int enabledSum = SUM_TERN(OPTION_ENABLED, 5, 2); + int disabledSum = SUM_TERN(OPTION_DISABLED, 5, 2); + TEST_ASSERT_EQUAL(7, enabledSum); // OPTION_ENABLED is enabled, so it should return 7 + TEST_ASSERT_EQUAL(5, disabledSum); // OPTION_DISABLED is disabled, so it should return 5 +} + +MARLIN_TEST(macros_optional_math, DIFF_TERN) { + int enabledDiff = DIFF_TERN(OPTION_ENABLED, 5, 2); + int disabledDiff = DIFF_TERN(OPTION_DISABLED, 5, 2); + TEST_ASSERT_EQUAL(3, enabledDiff); // OPTION_ENABLED is enabled, so it should return 3 + TEST_ASSERT_EQUAL(5, disabledDiff); // OPTION_DISABLED is disabled, so it should return 5 +} + +MARLIN_TEST(macros_optional_math, MUL_TERN) { + int enabledMul = MUL_TERN(OPTION_ENABLED, 5, 2); + int disabledMul = MUL_TERN(OPTION_DISABLED, 5, 2); + TEST_ASSERT_EQUAL(10, enabledMul); // OPTION_ENABLED is enabled, so it should return 10 + TEST_ASSERT_EQUAL(5, disabledMul); // OPTION_DISABLED is disabled, so it should return 5 +} + +MARLIN_TEST(macros_optional_math, DIV_TERN) { + int enabledDiv = DIV_TERN(OPTION_ENABLED, 10, 2); + int disabledDiv = DIV_TERN(OPTION_DISABLED, 10, 2); + TEST_ASSERT_EQUAL(5, enabledDiv); // OPTION_ENABLED is enabled, so it should return 5 + TEST_ASSERT_EQUAL(10, disabledDiv); // OPTION_DISABLED is disabled, so it should return 10 +} + +// Mock pin definitions +#define PIN1_PIN 1 +#define PIN2_PIN 2 +#define PIN3_PIN -1 + +MARLIN_TEST(macros_pins, PIN_EXISTS) { + // Test PIN_EXISTS macro + int pin1_exists, pin2_exists, pin3_exists, pin4_exists; + + #if PIN_EXISTS(PIN1) + pin1_exists = 1; + #else + pin1_exists = 0; + #endif + + #if PIN_EXISTS(PIN2) + pin2_exists = 1; + #else + pin2_exists = 0; + #endif + + #if PIN_EXISTS(PIN3) + pin3_exists = 1; + #else + pin3_exists = 0; + #endif + + #if PIN_EXISTS(PIN4) + pin4_exists = 1; + #else + pin4_exists = 0; + #endif + + TEST_ASSERT_TRUE(pin1_exists); + TEST_ASSERT_TRUE(pin2_exists); + TEST_ASSERT_FALSE(pin3_exists); + TEST_ASSERT_FALSE(pin4_exists); +} + +MARLIN_TEST(macros_pins, PINS_EXIST) { + // Test PINS_EXIST macro + int pins1_2_exist, pins1_3_exist; + + #if PINS_EXIST(PIN1, PIN2) + pins1_2_exist = 1; + #else + pins1_2_exist = 0; + #endif + + #if PINS_EXIST(PIN1, PIN3) + pins1_3_exist = 1; + #else + pins1_3_exist = 0; + #endif + + TEST_ASSERT_TRUE(pins1_2_exist); + TEST_ASSERT_FALSE(pins1_3_exist); +} + +MARLIN_TEST(macros_pins, ANY_PIN) { + // Test ANY_PIN macro + int any_pin1_3, any_pin3_4; + + #if ANY_PIN(PIN1, PIN3) + any_pin1_3 = 1; + #else + any_pin1_3 = 0; + #endif + + #if ANY_PIN(PIN3, PIN4) + any_pin3_4 = 1; + #else + any_pin3_4 = 0; + #endif + + TEST_ASSERT_TRUE(any_pin1_3); + TEST_ASSERT_FALSE(any_pin3_4); +} + +// Undefine mock pin definitions +#undef PIN1_PIN +#undef PIN2_PIN +#undef PIN3_PIN + + +// Mock button definitions +#define BTN_BUTTON1 1 +#define BTN_BUTTON2 2 +#define BTN_BUTTON3 -1 + +MARLIN_TEST(macros_buttons, BUTTON_EXISTS) { + // Test BUTTON_EXISTS macro + int button1_exists, button2_exists, button3_exists, button4_exists; + + #if BUTTON_EXISTS(BUTTON1) + button1_exists = 1; + #else + button1_exists = 0; + #endif + + #if BUTTON_EXISTS(BUTTON2) + button2_exists = 1; + #else + button2_exists = 0; + #endif + + #if BUTTON_EXISTS(BUTTON3) + button3_exists = 1; + #else + button3_exists = 0; + #endif + + #if BUTTON_EXISTS(BUTTON4) + button4_exists = 1; + #else + button4_exists = 0; + #endif + + TEST_ASSERT_TRUE(button1_exists); + TEST_ASSERT_TRUE(button2_exists); + TEST_ASSERT_FALSE(button3_exists); + TEST_ASSERT_FALSE(button4_exists); +} + +MARLIN_TEST(macros_buttons, BUTTONS_EXIST) { + // Test BUTTONS_EXIST macro + int buttons1_2_exist, buttons1_3_exist; + + #if BUTTONS_EXIST(BUTTON1, BUTTON2) + buttons1_2_exist = 1; + #else + buttons1_2_exist = 0; + #endif + + #if BUTTONS_EXIST(BUTTON1, BUTTON3) + buttons1_3_exist = 1; + #else + buttons1_3_exist = 0; + #endif + + TEST_ASSERT_TRUE(buttons1_2_exist); + TEST_ASSERT_FALSE(buttons1_3_exist); +} + +MARLIN_TEST(macros_buttons, ANY_BUTTON) { + // Test ANY_BUTTON macro + int any_button1_3, any_button3_4; + + #if ANY_BUTTON(BUTTON1, BUTTON3) + any_button1_3 = 1; + #else + any_button1_3 = 0; + #endif + + #if ANY_BUTTON(BUTTON3, BUTTON4) + any_button3_4 = 1; + #else + any_button3_4 = 0; + #endif + + TEST_ASSERT_TRUE(any_button1_3); + TEST_ASSERT_FALSE(any_button3_4); +} + +// Undefine mock button definitions +#undef BTN_BUTTON1 +#undef BTN_BUTTON2 +#undef BTN_BUTTON3 + + +MARLIN_TEST(macros_value_functions, WITHIN) { + // Test WITHIN macro + TEST_ASSERT_TRUE(WITHIN(5, 1, 10)); // 5 is within 1 and 10 + TEST_ASSERT_TRUE(WITHIN(1, 1, 10)); // Edge case: 1 is the lower limit + TEST_ASSERT_TRUE(WITHIN(10, 1, 10)); // Edge case: 10 is the upper limit + TEST_ASSERT_FALSE(WITHIN(0, 1, 10)); // Edge case: 0 is just below the lower limit + TEST_ASSERT_FALSE(WITHIN(11, 1, 10)); // Edge case: 11 is just above the upper limit + TEST_ASSERT_FALSE(WITHIN(15, 1, 10)); // 15 is not within 1 and 10 +} + +MARLIN_TEST(macros_value_functions, ISEOL) { + // Test ISEOL macro + TEST_ASSERT_TRUE(ISEOL('\n')); // '\n' is an end-of-line character + TEST_ASSERT_TRUE(ISEOL('\r')); // '\r' is an end-of-line character + TEST_ASSERT_FALSE(ISEOL('a')); // 'a' is not an end-of-line character +} + +MARLIN_TEST(macros_value_functions, NUMERIC) { + // Test NUMERIC macro + TEST_ASSERT_TRUE(NUMERIC('0')); // Edge case: '0' is the lowest numeric character + TEST_ASSERT_TRUE(NUMERIC('5')); // '5' is a numeric character + TEST_ASSERT_TRUE(NUMERIC('9')); // Edge case: '9' is the highest numeric character + TEST_ASSERT_FALSE(NUMERIC('0' - 1)); // Edge case: '/' is just before '0' in ASCII + TEST_ASSERT_FALSE(NUMERIC('9' + 1)); // Edge case: ':' is just after '9' in ASCII + TEST_ASSERT_FALSE(NUMERIC('a')); // 'a' is not a numeric character +} + +MARLIN_TEST(macros_value_functions, DECIMAL) { + // Test DECIMAL macro + TEST_ASSERT_TRUE(DECIMAL('0')); // Edge case: '0' is the lowest numeric character + TEST_ASSERT_TRUE(DECIMAL('5')); // '5' is a numeric character + TEST_ASSERT_TRUE(DECIMAL('9')); // Edge case: '9' is the highest numeric character + TEST_ASSERT_TRUE(DECIMAL('.')); // '.' is a decimal character + TEST_ASSERT_FALSE(DECIMAL('0' - 1)); // Edge case: '/' is just before '0' in ASCII + TEST_ASSERT_FALSE(DECIMAL('9' + 1)); // Edge case: ':' is just after '9' in ASCII + TEST_ASSERT_FALSE(DECIMAL('-')); // '-' is not a decimal character, but can appear in numbers + TEST_ASSERT_FALSE(DECIMAL('+')); // '+' is not a decimal character, but can appear in numbers + TEST_ASSERT_FALSE(DECIMAL('e')); // 'e' is not a decimal character, but can appear in scientific notation +} + +MARLIN_TEST(macros_value_functions, HEXCHR) { + // Test HEXCHR macro + TEST_ASSERT_EQUAL(0, HEXCHR('0')); // Edge case: '0' is the lowest numeric character + TEST_ASSERT_EQUAL(9, HEXCHR('9')); // Edge case: '9' is the highest numeric character + TEST_ASSERT_EQUAL(10, HEXCHR('a')); // 'a' is a hex character with value 10 + TEST_ASSERT_EQUAL(10, HEXCHR('A')); // 'A' is a hex character with value 10 + TEST_ASSERT_EQUAL(15, HEXCHR('f')); // Edge case: 'f' is the highest lowercase hex character + TEST_ASSERT_EQUAL(15, HEXCHR('F')); // Edge case: 'F' is the highest uppercase hex character + TEST_ASSERT_EQUAL(-1, HEXCHR('g')); // 'g' is not a hex character +} + +MARLIN_TEST(macros_value_functions, NUMERIC_SIGNED) { + // Test NUMERIC_SIGNED macro + TEST_ASSERT_TRUE(NUMERIC_SIGNED('0')); // Edge case: '0' is the lowest numeric character + TEST_ASSERT_TRUE(NUMERIC_SIGNED('5')); // '5' is a numeric character + TEST_ASSERT_TRUE(NUMERIC_SIGNED('9')); // Edge case: '9' is the highest numeric character + TEST_ASSERT_TRUE(NUMERIC_SIGNED('-')); // '-' is not a numeric character, but can appear in signed numbers + TEST_ASSERT_TRUE(NUMERIC_SIGNED('+')); // '+' is not a numeric character, but can appear in signed numbers + TEST_ASSERT_FALSE(NUMERIC_SIGNED('.')); // '.' is not a numeric character + TEST_ASSERT_FALSE(NUMERIC_SIGNED('0' - 1)); // Edge case: '/' is just before '0' in ASCII + TEST_ASSERT_FALSE(NUMERIC_SIGNED('9' + 1)); // Edge case: ':' is just after '9' in ASCII + TEST_ASSERT_FALSE(NUMERIC_SIGNED('e')); // 'e' is not a numeric character, but can appear in scientific notation +} + +MARLIN_TEST(macros_value_functions, DECIMAL_SIGNED) { + // Test DECIMAL_SIGNED macro + TEST_ASSERT_TRUE(DECIMAL_SIGNED('0')); // Edge case: '0' is the lowest numeric character + TEST_ASSERT_TRUE(DECIMAL_SIGNED('5')); // '5' is a decimal character + TEST_ASSERT_TRUE(DECIMAL_SIGNED('9')); // Edge case: '9' is the highest numeric character + TEST_ASSERT_TRUE(DECIMAL_SIGNED('-')); // '-' is not a numeric character, but can appear in signed numbers + TEST_ASSERT_TRUE(DECIMAL_SIGNED('+')); // '+' is not a numeric character, but can appear in signed numbers + TEST_ASSERT_TRUE(DECIMAL_SIGNED('.')); // '.' is a decimal character + TEST_ASSERT_FALSE(DECIMAL_SIGNED('0' - 1)); // Edge case: '/' is just before '0' in ASCII + TEST_ASSERT_FALSE(DECIMAL_SIGNED('9' + 1)); // Edge case: ':' is just after '9' in ASCII + TEST_ASSERT_FALSE(DECIMAL_SIGNED('e')); // 'e' is not a decimal character, but can appear in scientific notation +} + +MARLIN_TEST(macros_array, COUNT) { + // Test COUNT macro + int array[10]; + TEST_ASSERT_EQUAL(10, COUNT(array)); // The array has 10 elements +} + +MARLIN_TEST(macros_array, ZERO) { + // Test ZERO macro + int array[5] = {1, 2, 3, 4, 5}; + ZERO(array); + for (auto& element : array) { + TEST_ASSERT_EQUAL(0, element); + } +} + +MARLIN_TEST(macros_array, COPY) { + int array1[5] = {1, 2, 3, 4, 5}; + int array2[5] = {0}; + COPY(array2, array1); + for (const auto& element : array1) { + TEST_ASSERT_EQUAL(element, array2[&element - &array1[0]]); // All elements should be equal + } +} + +MARLIN_TEST(macros_expansion, CODE_N) { + int a = 0; + CODE_N(0, a+=1, a+=2, a+=3, a+=4, a+=5, a+=6, a+=7, a+=8, a+=9, a+=10, a+=11, a+=12, a+=13, a+=14, a+=15, a+=16); + TEST_ASSERT_EQUAL(0, a); + + a = 0; + CODE_N(1, a+=1, a+=2, a+=3, a+=4, a+=5, a+=6, a+=7, a+=8, a+=9, a+=10, a+=11, a+=12, a+=13, a+=14, a+=15, a+=16); + TEST_ASSERT_EQUAL(1, a); + + a = 0; + CODE_N(2, a+=1, a+=2, a+=3, a+=4, a+=5, a+=6, a+=7, a+=8, a+=9, a+=10, a+=11, a+=12, a+=13, a+=14, a+=15, a+=16); + TEST_ASSERT_EQUAL(3, a); + + a = 0; + CODE_N(16, a+=1, a+=2, a+=3, a+=4, a+=5, a+=6, a+=7, a+=8, a+=9, a+=10, a+=11, a+=12, a+=13, a+=14, a+=15, a+=16); + TEST_ASSERT_EQUAL(136, a); + + // 16 is the highest number supported by the CODE_N macro +} + +MARLIN_TEST(macros_expansion, GANG_N) { + TEST_ASSERT_EQUAL(0, 0 GANG_N(0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16)); + TEST_ASSERT_EQUAL(1, 0 GANG_N(1, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16)); + TEST_ASSERT_EQUAL(3, 0 GANG_N(2, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16)); + TEST_ASSERT_EQUAL(136, 0 GANG_N(16, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16)); + + // 16 is the highest number supported by the GANG_N macro +} + +MARLIN_TEST(macros_expansion, GANG_N_1) { + // Count by twos to be sure it can't bass by returning N + TEST_ASSERT_EQUAL(0, 0 GANG_N_1(0, +2)); + TEST_ASSERT_EQUAL(2, 0 GANG_N_1(1, +2)); + TEST_ASSERT_EQUAL(4, 0 GANG_N_1(2, +2)); + TEST_ASSERT_EQUAL(32, 0 GANG_N_1(16, +2)); +} + +MARLIN_TEST(macros_expansion, LIST_N) { + std::vector expected, result; + int compare_size; + + expected = {}; + result = {LIST_N(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)}; + TEST_ASSERT_EQUAL(expected.size(), result.size()); + compare_size = _MIN(expected.size(), result.size()); + for (int i = 0; i < compare_size; i++) { + TEST_ASSERT_EQUAL(expected[i], result[i]); + } + + expected = {1}; + result = {LIST_N(1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)}; + TEST_ASSERT_EQUAL(expected.size(), result.size()); + compare_size = _MIN(expected.size(), result.size()); + for (int i = 0; i < compare_size; i++) { + TEST_ASSERT_EQUAL(expected[i], result[i]); + } + + expected = {1, 2}; + result = {LIST_N(2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)}; + TEST_ASSERT_EQUAL(expected.size(), result.size()); + compare_size = _MIN(expected.size(), result.size()); + for (int i = 0; i < compare_size; i++) { + TEST_ASSERT_EQUAL(expected[i], result[i]); + } + + expected = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + result = {LIST_N(16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)}; + TEST_ASSERT_EQUAL(expected.size(), result.size()); + compare_size = _MIN(expected.size(), result.size()); + for (int i = 0; i < compare_size; i++) { + TEST_ASSERT_EQUAL(expected[i], result[i]); + } +} + +MARLIN_TEST(macros_expansion, LIST_N_1) { + std::vector expected, result; + int compare_size; + + expected = {}; + result = {LIST_N_1(0, 1)}; + TEST_ASSERT_EQUAL(expected.size(), result.size()); + compare_size = _MIN(expected.size(), result.size()); + for (int i = 0; i < compare_size; i++) { + TEST_ASSERT_EQUAL(expected[i], result[i]); + } + + expected = {2}; + result = {LIST_N_1(1, 2)}; + TEST_ASSERT_EQUAL(expected.size(), result.size()); + compare_size = _MIN(expected.size(), result.size()); + for (int i = 0; i < compare_size; i++) { + TEST_ASSERT_EQUAL(expected[i], result[i]); + } + + expected = {1, 1}; + result = {LIST_N_1(2, 1)}; + TEST_ASSERT_EQUAL(expected.size(), result.size()); + compare_size = _MIN(expected.size(), result.size()); + for (int i = 0; i < compare_size; i++) { + TEST_ASSERT_EQUAL(expected[i], result[i]); + } + + expected = std::vector(16, 1); + result = {LIST_N_1(16, 1)}; + TEST_ASSERT_EQUAL(expected.size(), result.size()); + compare_size = _MIN(expected.size(), result.size()); + for (int i = 0; i < compare_size; i++) { + TEST_ASSERT_EQUAL(expected[i], result[i]); + } +} + +MARLIN_TEST(macros_expansion, ARRAY_N) { + // Test ARRAY_N macro + std::array expected = {1, 2, 3, 4, 5}; + std::array result = ARRAY_N(5, 1, 2, 3, 4, 5); + TEST_ASSERT_EQUAL(expected.size(), result.size()); + + std::array expected2 = {1, 2, 3}; + std::array result2 = ARRAY_N(3, 1, 2, 3); + TEST_ASSERT_EQUAL(expected2.size(), result2.size()); +} + +MARLIN_TEST(macros_expansion, ARRAY_N_1) { + // Test ARRAY_N_1 macro + std::array expected = {2, 2, 2, 2, 2}; + std::array result = ARRAY_N_1(5, 2); + TEST_ASSERT_EQUAL(expected.size(), result.size()); + + std::array expected2 = {1, 1, 1}; + std::array result2 = ARRAY_N_1(3, 1); + TEST_ASSERT_EQUAL(expected2.size(), result2.size()); +} + +MARLIN_TEST(macros_math, CEILING) { + TEST_ASSERT_EQUAL(2, CEILING(3, 2)); + TEST_ASSERT_EQUAL(5, CEILING(10, 2)); + TEST_ASSERT_EQUAL(0, CEILING(0, 2)); +} + +MARLIN_TEST(macros_math, ABS) { + TEST_ASSERT_EQUAL(5, ABS(-5)); + TEST_ASSERT_EQUAL(5, ABS(5)); + TEST_ASSERT_EQUAL_FLOAT(5.5, ABS(-5.5)); + TEST_ASSERT_EQUAL_FLOAT(5.5, ABS(5.5)); +} + +MARLIN_TEST(macros_float, UNEAR_ZERO) { + TEST_ASSERT_TRUE(UNEAR_ZERO(0.0000009f)); + TEST_ASSERT_FALSE(UNEAR_ZERO(0.000001f)); +} + +MARLIN_TEST(macros_float, NEAR_ZERO) { + TEST_ASSERT_TRUE(NEAR_ZERO(0.0000001f)); + TEST_ASSERT_TRUE(NEAR_ZERO(-0.0000001f)); + TEST_ASSERT_FALSE(NEAR_ZERO(0.0000011f)); + TEST_ASSERT_FALSE(NEAR_ZERO(-0.0000011f)); +} + +MARLIN_TEST(macros_float, NEAR) { + TEST_ASSERT_TRUE(NEAR(0.000001f, 0.000002f)); + TEST_ASSERT_FALSE(NEAR(0.0000009f, 0.000002f)); +} + +MARLIN_TEST(macros_float, RECIPROCAL) { + TEST_ASSERT_EQUAL_FLOAT(1.0f, RECIPROCAL(1.0f)); + TEST_ASSERT_EQUAL_FLOAT(0.0f, RECIPROCAL(0.0f)); + TEST_ASSERT_EQUAL_FLOAT(2.0f, RECIPROCAL(0.5f)); + TEST_ASSERT_EQUAL_FLOAT(-2.0f, RECIPROCAL(-0.5f)); + TEST_ASSERT_EQUAL_FLOAT(0.0f, RECIPROCAL(0.0000001f)); + TEST_ASSERT_EQUAL_FLOAT(0.0f, RECIPROCAL(-0.0000001f)); +} + +MARLIN_TEST(macros_float, FIXFLOAT) { + TEST_ASSERT_EQUAL(0.0000005f, FIXFLOAT(0.0f)); + TEST_ASSERT_EQUAL(-0.0000005f, FIXFLOAT(-0.0f)); +} + +MARLIN_TEST(macros_math, MATH_MACROS) { + // Sanity check of macros typically mapped to compiler functions + TEST_ASSERT_EQUAL_FLOAT(0.0f, ACOS(1.0f)); + TEST_ASSERT_EQUAL_FLOAT(0.785398f, ATAN2(1.0f, 1.0f)); + TEST_ASSERT_EQUAL_FLOAT(8.0f, POW(2.0f, 3.0f)); + TEST_ASSERT_EQUAL_FLOAT(2.0f, SQRT(4.0f)); + TEST_ASSERT_EQUAL_FLOAT(0.5f, RSQRT(4.0f)); + TEST_ASSERT_EQUAL_FLOAT(2.0f, CEIL(1.5f)); + TEST_ASSERT_EQUAL_FLOAT(1.0f, FLOOR(1.5f)); + TEST_ASSERT_EQUAL_FLOAT(1.0f, TRUNC(1.5f)); + TEST_ASSERT_EQUAL(2, LROUND(1.5f)); + TEST_ASSERT_EQUAL_FLOAT(1.0f, FMOD(5.0f, 2.0f)); + TEST_ASSERT_EQUAL_FLOAT(5.0f, HYPOT(3.0f, 4.0f)); +} + +MARLIN_TEST(macros_math, MIN_MAX) { + // _MIN tests + TEST_ASSERT_EQUAL(-1, _MIN(-1, 0)); + TEST_ASSERT_EQUAL(-1, _MIN(0, -1)); + TEST_ASSERT_EQUAL(-1, _MIN(-1, 1)); + TEST_ASSERT_EQUAL(-1, _MIN(1, -1)); + TEST_ASSERT_EQUAL(-1, _MIN(-1, -1)); + TEST_ASSERT_EQUAL(1, _MIN(1, 1)); + TEST_ASSERT_EQUAL_FLOAT(-1.5f, _MIN(-1.5f, 0.5f)); + TEST_ASSERT_EQUAL_FLOAT(-1.5f, _MIN(0.5f, -1.5f)); + + // _MAX tests + TEST_ASSERT_EQUAL(0, _MAX(-1, 0)); + TEST_ASSERT_EQUAL(0, _MAX(0, -1)); + TEST_ASSERT_EQUAL(1, _MAX(-1, 1)); + TEST_ASSERT_EQUAL(1, _MAX(1, -1)); + TEST_ASSERT_EQUAL(-1, _MAX(-1, -1)); + TEST_ASSERT_EQUAL(1, _MAX(1, 1)); + TEST_ASSERT_EQUAL_FLOAT(0.5f, _MAX(-1.5f, 0.5f)); + TEST_ASSERT_EQUAL_FLOAT(0.5f, _MAX(0.5f, -1.5f)); +} + +MARLIN_TEST(macros_math, INCREMENT) { + TEST_ASSERT_EQUAL(1, INCREMENT(0)); + TEST_ASSERT_EQUAL(21, INCREMENT(20)); + // 20 is the highest number supported by the INCREMENT macro +} + +MARLIN_TEST(macros_math, ADD) { + // Test smallest add + TEST_ASSERT_EQUAL(0, ADD0(0)); + TEST_ASSERT_EQUAL(10, ADD0(10)); + + // Test largest add + TEST_ASSERT_EQUAL(10, ADD10(0)); + TEST_ASSERT_EQUAL(20, ADD10(10)); +} + +MARLIN_TEST(macros_math, SUM) { + // Test smallest sum + TEST_ASSERT_EQUAL(3, SUM(0, 3)); + TEST_ASSERT_EQUAL(7, SUM(3, 4)); + + // Test largest sum + TEST_ASSERT_EQUAL(15, SUM(10, 5)); + TEST_ASSERT_EQUAL(19, SUM(9, 10)); +} + +MARLIN_TEST(macros_math, DOUBLE) { + // Test double + TEST_ASSERT_EQUAL(0, DOUBLE(0)); + TEST_ASSERT_EQUAL(2, DOUBLE(1)); + TEST_ASSERT_EQUAL(4, DOUBLE(2)); + TEST_ASSERT_EQUAL(20, DOUBLE(10)); +} + +MARLIN_TEST(macros_math, DECREMENT) { + TEST_ASSERT_EQUAL(0, DECREMENT(1)); + TEST_ASSERT_EQUAL(14, DECREMENT(15)); +} + +MARLIN_TEST(macros_math, SUB) { + // Test smallest subtraction + TEST_ASSERT_EQUAL(0, SUB0(0)); + TEST_ASSERT_EQUAL(10, SUB0(10)); + + // Test subtracting 1 + TEST_ASSERT_EQUAL(0, SUB1(1)); + TEST_ASSERT_EQUAL(5, SUB1(6)); + + // Test largest subtraction + TEST_ASSERT_EQUAL(0, SUB10(10)); + TEST_ASSERT_EQUAL(5, SUB10(15)); +} + + +// Define a helper macro for testing +#define TEST_OP(i) ++counter; +#define TEST_OP2(i, j) counter += j; + +MARLIN_TEST(macros_repeat, REPEAT) { + int counter = 0; + REPEAT(5, TEST_OP); + TEST_ASSERT_EQUAL(5, counter); +} + +MARLIN_TEST(macros_repeat, REPEAT_1) { + int counter = 0; + REPEAT_1(5, TEST_OP); + TEST_ASSERT_EQUAL(5, counter); +} + +MARLIN_TEST(macros_repeat, REPEAT2) { + int counter = 0; + REPEAT2(5, TEST_OP2, 1); + TEST_ASSERT_EQUAL(5, counter); +} + +MARLIN_TEST(macros_repeat, RREPEAT) { + int counter = 0; + RREPEAT(5, TEST_OP); + TEST_ASSERT_EQUAL(5, counter); +} + +MARLIN_TEST(macros_repeat, RREPEAT_1) { + int counter = 0; + RREPEAT_1(5, TEST_OP); + TEST_ASSERT_EQUAL(5, counter); +} + +MARLIN_TEST(macros_repeat, RREPEAT2) { + int counter = 0; + RREPEAT2(5, TEST_OP2, 1); + TEST_ASSERT_EQUAL(5, counter); +} diff --git a/Marlin/tests/core/test_types.cpp b/Marlin/tests/core/test_types.cpp new file mode 100644 index 000000000000..865d35de158c --- /dev/null +++ b/Marlin/tests/core/test_types.cpp @@ -0,0 +1,605 @@ +/** + * 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 . + * + */ + +#include "../test/unit_tests.h" +#include "src/core/types.h" + +MARLIN_TEST(types, XYval_const_as_bools) { + const XYval xy_const_true = {1, 2}; + TEST_ASSERT_TRUE(xy_const_true); + + const XYval xy_const_false = {0, 0}; + TEST_ASSERT_FALSE(xy_const_false); +} + +MARLIN_TEST(types, XYval_non_const_as_bools) { + XYval xy_true = {1, 2}; + TEST_ASSERT_TRUE(xy_true); + + XYval xy_false = {0, 0}; + TEST_ASSERT_FALSE(xy_false); +} + +MARLIN_TEST(types, XYval_reset) { + XYval xy = {1, 2}; + xy.reset(); + TEST_ASSERT_EQUAL(0, xy.x); + TEST_ASSERT_EQUAL(0, xy.y); +} + +MARLIN_TEST(types, XYval_set) { + XYval xy; + xy.set(3, 4); + TEST_ASSERT_EQUAL(3, xy.x); + TEST_ASSERT_EQUAL(4, xy.y); +} + +MARLIN_TEST(types, XYval_magnitude) { + XYval xy; + + xy.set(3, 4); + TEST_ASSERT_EQUAL(5, xy.magnitude()); + + xy.set(-3, -4); + TEST_ASSERT_EQUAL(5, xy.magnitude()); + + xy.set(-3, 4); + TEST_ASSERT_EQUAL(5, xy.magnitude()); + + xy.set(3, -4); + TEST_ASSERT_EQUAL(5, xy.magnitude()); +} + +MARLIN_TEST(types, XYval_small_large) { + XYval xy; + + xy.set(3, 4); + TEST_ASSERT_EQUAL(3, xy.small()); + TEST_ASSERT_EQUAL(4, xy.large()); + + xy.set(4, 3); + TEST_ASSERT_EQUAL(3, xy.small()); + TEST_ASSERT_EQUAL(4, xy.large()); + + // BUG?: Is this behavior actually correct? + // Does small mean "less than", or should it mean + // "closer to zero"? If the latter, then the following + // tests are incorrect. + xy.set(-3, -4); + TEST_ASSERT_EQUAL(-4, xy.small()); + TEST_ASSERT_EQUAL(-3, xy.large()); + + xy.set(-3, 2); + TEST_ASSERT_EQUAL(-3, xy.small()); + TEST_ASSERT_EQUAL(2, xy.large()); + + xy.set(2, -3); + TEST_ASSERT_EQUAL(-3, xy.small()); + TEST_ASSERT_EQUAL(2, xy.large()); +} + +MARLIN_TEST(types, XYval_operators) { + XYval xy1 = {2, 3}, xy2 = {6, 12}; + XYval xy3 = xy1 + xy2; + TEST_ASSERT_EQUAL(8, xy3.x); + TEST_ASSERT_EQUAL(15, xy3.y); + xy3 = xy1 - xy2; + TEST_ASSERT_EQUAL(-4, xy3.x); + TEST_ASSERT_EQUAL(-9, xy3.y); + xy3 = xy1 * xy2; + TEST_ASSERT_EQUAL(12, xy3.x); + TEST_ASSERT_EQUAL(36, xy3.y); + xy3 = xy2 / xy1; + TEST_ASSERT_EQUAL(3, xy3.x); + TEST_ASSERT_EQUAL(4, xy3.y); +} + +MARLIN_TEST(types, XYval_ABS) { + XYval xy = {-3, -4}; + XYval xy_abs = xy.ABS(); + TEST_ASSERT_EQUAL(3, xy_abs.x); + TEST_ASSERT_EQUAL(4, xy_abs.y); +} + +MARLIN_TEST(types, XYval_ROUNDL) { + XYval xy = {3.3f, 4.7f}; + auto xy_round = xy.ROUNDL(); + TEST_ASSERT_EQUAL(3, xy_round.x); + TEST_ASSERT_EQUAL(5, xy_round.y); +} + +MARLIN_TEST(types, XYval_reciprocal) { + XYval xy = {0.5f, 4.0f}; + XYval xy_reciprocal = xy.reciprocal(); + TEST_ASSERT_EQUAL_FLOAT(2.0f, xy_reciprocal.x); + TEST_ASSERT_EQUAL_FLOAT(0.25f, xy_reciprocal.y); +} + +MARLIN_TEST(types, XYZval_const_as_bools) { + const XYZval xyz_const_true = {1, 2, 3}; + TEST_ASSERT_TRUE(xyz_const_true); + + const XYZval xyz_const_false = {0, 0, 0}; + TEST_ASSERT_FALSE(xyz_const_false); +} + +MARLIN_TEST(types, XYZval_non_const_as_bools) { + XYZval xyz_true = {1, 2, 3}; + TEST_ASSERT_TRUE(xyz_true); + + XYZval xyz_false = {0, 0, 0}; + TEST_ASSERT_FALSE(xyz_false); +} + +MARLIN_TEST(types, XYZval_reset) { + XYZval xyz = {1, 2, 3}; + xyz.reset(); + TEST_ASSERT_EQUAL(0, xyz.x); + TEST_ASSERT_EQUAL(0, xyz.y); + TEST_ASSERT_EQUAL(0, xyz.z); +} + +MARLIN_TEST(types, XYZval_set) { + XYZval xyz; + xyz.set(3, 4, 5); + TEST_ASSERT_EQUAL(3, xyz.x); + TEST_ASSERT_EQUAL(4, xyz.y); + TEST_ASSERT_EQUAL(5, xyz.z); +} + +MARLIN_TEST(types, XYZval_magnitude) { + XYZval xyz; + + xyz.set(3.0f, 4.0f, 5.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 7.071f, xyz.magnitude()); + + xyz.set(-3.0f, -4.0f, -5.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 7.071f, xyz.magnitude()); + + xyz.set(-3.0f, 4.0f, 5.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 7.071f, xyz.magnitude()); + + xyz.set(3.0f, -4.0f, 5.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 7.071f, xyz.magnitude()); + + xyz.set(3.0f, 4.0f, -5.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 7.071f, xyz.magnitude()); +} + +MARLIN_TEST(types, XYZval_small_large) { + XYZval xyz; + + xyz.set(3, 4, 5); + TEST_ASSERT_EQUAL(3, xyz.small()); + TEST_ASSERT_EQUAL(5, xyz.large()); + + xyz.set(5, 4, 3); + TEST_ASSERT_EQUAL(3, xyz.small()); + TEST_ASSERT_EQUAL(5, xyz.large()); + + xyz.set(4, 3, 5); + TEST_ASSERT_EQUAL(3, xyz.small()); + TEST_ASSERT_EQUAL(5, xyz.large()); + + xyz.set(3, 5, 4); + TEST_ASSERT_EQUAL(3, xyz.small()); + TEST_ASSERT_EQUAL(5, xyz.large()); + + // Test with negative numbers + xyz.set(-3, -4, -5); + TEST_ASSERT_EQUAL(-5, xyz.small()); + TEST_ASSERT_EQUAL(-3, xyz.large()); + + // Test with mixed negative/positive numbers + xyz.set(-3, 4, 5); + TEST_ASSERT_EQUAL(-3, xyz.small()); + TEST_ASSERT_EQUAL(5, xyz.large()); + + xyz.set(3, -4, 5); + TEST_ASSERT_EQUAL(-4, xyz.small()); + TEST_ASSERT_EQUAL(5, xyz.large()); + + xyz.set(3, 4, -5); + TEST_ASSERT_EQUAL(-5, xyz.small()); + TEST_ASSERT_EQUAL(4, xyz.large()); +} + +MARLIN_TEST(types, XYZval_operators) { + XYZval xyz1 = {2, 3, 4}, xyz2 = {6, 12, 24}; + XYZval xyz3 = xyz1 + xyz2; + TEST_ASSERT_EQUAL(8, xyz3.x); + TEST_ASSERT_EQUAL(15, xyz3.y); + TEST_ASSERT_EQUAL(28, xyz3.z); + xyz3 = xyz1 - xyz2; + TEST_ASSERT_EQUAL(-4, xyz3.x); + TEST_ASSERT_EQUAL(-9, xyz3.y); + TEST_ASSERT_EQUAL(-20, xyz3.z); + xyz3 = xyz1 * xyz2; + TEST_ASSERT_EQUAL(12, xyz3.x); + TEST_ASSERT_EQUAL(36, xyz3.y); + TEST_ASSERT_EQUAL(96, xyz3.z); + xyz3 = xyz2 / xyz1; + TEST_ASSERT_EQUAL(3, xyz3.x); + TEST_ASSERT_EQUAL(4, xyz3.y); + TEST_ASSERT_EQUAL(6, xyz3.z); +} + +MARLIN_TEST(types, XYZval_ABS) { + XYZval xyz = {-3, -4, -5}; + XYZval xyz_abs = xyz.ABS(); + TEST_ASSERT_EQUAL(3, xyz_abs.x); + TEST_ASSERT_EQUAL(4, xyz_abs.y); + TEST_ASSERT_EQUAL(5, xyz_abs.z); +} + +MARLIN_TEST(types, XYZval_ROUNDL) { + XYZval xyz = {3.3f, 4.7f, 5.5f}; + XYZval xyz_round = xyz.ROUNDL(); + TEST_ASSERT_EQUAL(3, xyz_round.x); + TEST_ASSERT_EQUAL(5, xyz_round.y); + TEST_ASSERT_EQUAL(6, xyz_round.z); +} + +MARLIN_TEST(types, XYZval_reciprocal) { + XYZval xyz = {0.5f, 2.0f, 0.33333f}; + XYZval xyz_reciprocal = xyz.reciprocal(); + TEST_ASSERT_EQUAL_FLOAT(2.0f, xyz_reciprocal.x); + TEST_ASSERT_EQUAL_FLOAT(0.5f, xyz_reciprocal.y); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 3.0f, xyz_reciprocal.z); +} + +MARLIN_TEST(types, XYZEval_const_as_bools) { + const XYZEval xyze_const_true = {1, 2, 3, 4}; + TEST_ASSERT_TRUE(xyze_const_true); + + const XYZEval xyze_const_false = {0, 0, 0, 0}; + TEST_ASSERT_FALSE(xyze_const_false); +} + +MARLIN_TEST(types, XYZEval_non_const_as_bools) { + XYZEval xyze_true = {1, 2, 3, 4}; + TEST_ASSERT_TRUE(xyze_true); + + XYZEval xyze_false = {0, 0, 0, 0}; + TEST_ASSERT_FALSE(xyze_false); +} + +MARLIN_TEST(types, XYZEval_reset) { + XYZEval xyze = {1, 2, 3, 4}; + xyze.reset(); + TEST_ASSERT_EQUAL(0, xyze.x); + TEST_ASSERT_EQUAL(0, xyze.y); + TEST_ASSERT_EQUAL(0, xyze.z); + TEST_ASSERT_EQUAL(0, xyze.e); +} + +MARLIN_TEST(types, XYZEval_set) { + XYZEval xyze; + xyze.set(3, 4, 5, 6); + TEST_ASSERT_EQUAL(3, xyze.x); + TEST_ASSERT_EQUAL(4, xyze.y); + TEST_ASSERT_EQUAL(5, xyze.z); + TEST_ASSERT_EQUAL(6, xyze.e); +} + +MARLIN_TEST(types, XYZEval_magnitude) { + XYZEval xyze; + + xyze.set(3.0f, 4.0f, 5.0f, 6.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 9.274f, xyze.magnitude()); + + xyze.set(-3.0f, -4.0f, -5.0f, -6.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 9.274f, xyze.magnitude()); + + xyze.set(-3.0f, 4.0f, 5.0f, 6.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 9.274f, xyze.magnitude()); + + xyze.set(3.0f, -4.0f, 5.0f, 6.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 9.274f, xyze.magnitude()); + + xyze.set(3.0f, 4.0f, -5.0f, 6.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 9.274f, xyze.magnitude()); + + xyze.set(3.0f, 4.0f, 5.0f, -6.0f); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 9.274f, xyze.magnitude()); +} + +MARLIN_TEST(types, XYZEval_small_large) { + XYZEval xyze; + + xyze.set(3, 4, 5, 6); + TEST_ASSERT_EQUAL(3, xyze.small()); + TEST_ASSERT_EQUAL(6, xyze.large()); + + xyze.set(6, 5, 4, 3); + TEST_ASSERT_EQUAL(3, xyze.small()); + TEST_ASSERT_EQUAL(6, xyze.large()); + + xyze.set(4, 3, 6, 5); + TEST_ASSERT_EQUAL(3, xyze.small()); + TEST_ASSERT_EQUAL(6, xyze.large()); + + xyze.set(3, 6, 5, 4); + TEST_ASSERT_EQUAL(3, xyze.small()); + TEST_ASSERT_EQUAL(6, xyze.large()); + + xyze.set(-3, -4, -5, -6); + TEST_ASSERT_EQUAL(-6, xyze.small()); + TEST_ASSERT_EQUAL(-3, xyze.large()); + + xyze.set(-3, 4, 5, 6); + TEST_ASSERT_EQUAL(-3, xyze.small()); + TEST_ASSERT_EQUAL(6, xyze.large()); + + xyze.set(3, -4, 5, 6); + TEST_ASSERT_EQUAL(-4, xyze.small()); + TEST_ASSERT_EQUAL(6, xyze.large()); + + xyze.set(3, 4, -5, 6); + TEST_ASSERT_EQUAL(-5, xyze.small()); + TEST_ASSERT_EQUAL(6, xyze.large()); + + xyze.set(3, 4, 5, -6); + TEST_ASSERT_EQUAL(-6, xyze.small()); + TEST_ASSERT_EQUAL(5, xyze.large()); +} + +MARLIN_TEST(types, XYZEval_operators) { + XYZEval xyze1 = {2, 3, 4, 5}, xyze2 = {6, 12, 24, 48}; + XYZEval xyze3 = xyze1 + xyze2; + TEST_ASSERT_EQUAL(8, xyze3.x); + TEST_ASSERT_EQUAL(15, xyze3.y); + TEST_ASSERT_EQUAL(28, xyze3.z); + TEST_ASSERT_EQUAL(53, xyze3.e); + xyze3 = xyze1 - xyze2; + TEST_ASSERT_EQUAL(-4, xyze3.x); + TEST_ASSERT_EQUAL(-9, xyze3.y); + TEST_ASSERT_EQUAL(-20, xyze3.z); + TEST_ASSERT_EQUAL(-43, xyze3.e); + xyze3 = xyze1 * xyze2; + TEST_ASSERT_EQUAL(12, xyze3.x); + TEST_ASSERT_EQUAL(36, xyze3.y); + TEST_ASSERT_EQUAL(96, xyze3.z); + TEST_ASSERT_EQUAL(240, xyze3.e); + xyze3 = xyze2 / xyze1; + TEST_ASSERT_EQUAL(3, xyze3.x); + TEST_ASSERT_EQUAL(4, xyze3.y); + TEST_ASSERT_EQUAL(6, xyze3.z); + TEST_ASSERT_EQUAL(9, xyze3.e); +} + +MARLIN_TEST(types, XYZEval_ABS) { + XYZEval xyze = {-3, -4, -5, -6}; + XYZEval xyze_abs = xyze.ABS(); + TEST_ASSERT_EQUAL(3, xyze_abs.x); + TEST_ASSERT_EQUAL(4, xyze_abs.y); + TEST_ASSERT_EQUAL(5, xyze_abs.z); + TEST_ASSERT_EQUAL(6, xyze_abs.e); +} + +MARLIN_TEST(types, XYZEval_ROUNDL) { + XYZEval xyze = {3.3f, 4.7f, 5.5f, 6.6f}; + XYZEval xyze_round = xyze.ROUNDL(); + TEST_ASSERT_EQUAL(3, xyze_round.x); + TEST_ASSERT_EQUAL(5, xyze_round.y); + TEST_ASSERT_EQUAL(6, xyze_round.z); + TEST_ASSERT_EQUAL(7, xyze_round.e); +} + +MARLIN_TEST(types, XYZEval_reciprocal) { + XYZEval xyze = {0.5f, 2.0f, 0.33333f, 0.25f}; + XYZEval xyze_reciprocal = xyze.reciprocal(); + TEST_ASSERT_EQUAL_FLOAT(2.0f, xyze_reciprocal.x); + TEST_ASSERT_EQUAL_FLOAT(0.5f, xyze_reciprocal.y); + TEST_ASSERT_FLOAT_WITHIN(0.001f, 3.0f, xyze_reciprocal.z); + TEST_ASSERT_EQUAL_FLOAT(4.0f, xyze_reciprocal.e); +} + +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, Flags_1) { + Flags<1> flags; + + flags.set(0, true); + TEST_ASSERT_EQUAL(1, flags.b); + + flags.reset(); + TEST_ASSERT_EQUAL(0, flags.b); + + flags.set(0, true); + flags.clear(0); + TEST_ASSERT_EQUAL(0, flags.b); + + TEST_ASSERT_EQUAL(false, flags.test(0)); + flags.set(0, true); + TEST_ASSERT_EQUAL(true, flags.test(0)); + + TEST_ASSERT_EQUAL(true, flags[0]); + flags.clear(0); + TEST_ASSERT_EQUAL(false, flags[0]); + + TEST_ASSERT_EQUAL(1, flags.size()); +} + +MARLIN_TEST(types, Flags_8) { + Flags<8> flags; + + flags.reset(); + TEST_ASSERT_EQUAL(0, flags.b); + + flags.set(3, true); + TEST_ASSERT_EQUAL(8, flags.b); + + flags.clear(3); + TEST_ASSERT_EQUAL(0, flags.b); + + flags.set(3, true); + TEST_ASSERT_EQUAL(true, flags.test(3)); + TEST_ASSERT_EQUAL(false, flags.test(2)); + + TEST_ASSERT_EQUAL(true, flags[3]); + TEST_ASSERT_EQUAL(false, flags[2]); + + TEST_ASSERT_EQUAL(1, flags.size()); +} + +MARLIN_TEST(types, Flags_16) { + Flags<16> flags; + + flags.reset(); + TEST_ASSERT_EQUAL(0, flags.b); + + flags.set(0, true); + flags.set(15, true); + TEST_ASSERT_EQUAL(32769, flags.b); + + flags.clear(0); + TEST_ASSERT_EQUAL(32768, flags.b); + + flags.reset(); + flags.set(7, true); + flags.set(15, true); + TEST_ASSERT_EQUAL(true, flags.test(7)); + TEST_ASSERT_EQUAL(false, flags.test(8)); + TEST_ASSERT_EQUAL(true, flags.test(15)); + + TEST_ASSERT_EQUAL(true, flags[7]); + TEST_ASSERT_EQUAL(false, flags[8]); + TEST_ASSERT_EQUAL(true, flags[15]); + + TEST_ASSERT_EQUAL(2, flags.size()); +} + +MARLIN_TEST(types, Flags_32) { + Flags<32> flags; + + flags.reset(); + TEST_ASSERT_EQUAL(0, flags.b); + + flags.set(0, true); + flags.set(31, true); + TEST_ASSERT_EQUAL(2147483649, flags.b); + + flags.clear(0); + flags.clear(31); + TEST_ASSERT_EQUAL(0, flags.b); + + flags.set(0, true); + flags.set(31, true); + TEST_ASSERT_EQUAL(true, flags.test(0)); + TEST_ASSERT_EQUAL(true, flags.test(31)); + TEST_ASSERT_EQUAL(false, flags.test(1)); + TEST_ASSERT_EQUAL(false, flags.test(30)); + + TEST_ASSERT_EQUAL(true, flags[0]); + TEST_ASSERT_EQUAL(true, flags[31]); + TEST_ASSERT_EQUAL(false, flags[1]); + TEST_ASSERT_EQUAL(false, flags[30]); + + TEST_ASSERT_EQUAL(4, flags.size()); +} + +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); +} diff --git a/Marlin/tests/feature/test_runout.cpp b/Marlin/tests/feature/test_runout.cpp new file mode 100644 index 000000000000..2719446437fa --- /dev/null +++ b/Marlin/tests/feature/test_runout.cpp @@ -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 . + * + */ + +#include "../test/unit_tests.h" + +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + +#include + +MARLIN_TEST(runout, poll_runout_states) { + FilamentSensorBase sensor; + // Expected default value is one bit set for each extruder + uint8_t expected = static_cast(~(~0u << NUM_RUNOUT_SENSORS)); + TEST_ASSERT_EQUAL(expected, sensor.poll_runout_states()); +} + +#endif diff --git a/Marlin/tests/gcode/test_gcode.cpp b/Marlin/tests/gcode/test_gcode.cpp new file mode 100644 index 000000000000..be364cb90550 --- /dev/null +++ b/Marlin/tests/gcode/test_gcode.cpp @@ -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 . + * + */ + +#include "../test/unit_tests.h" +#include +#include + +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')); +} diff --git a/README.md b/README.md index ac496aac21cd..373444a1649a 100644 --- a/README.md +++ b/README.md @@ -39,16 +39,16 @@ To build and upload Marlin you will use one of these tools: Marlin is optimized to build with the **PlatformIO IDE** extension for **Visual Studio Code**. You can still build Marlin with **Arduino IDE**, and we hope to improve the Arduino build experience, but at this time PlatformIO is the better choice. +## 8-Bit AVR Boards + +We intend to continue supporting 8-bit AVR boards in perpetuity, maintaining a single codebase that can apply to all machines. We want casual hobbyists and tinkerers and owners of older machines to benefit from the community's innovations just as much as those with fancier machines. Plus, those old AVR-based machines are often the best for your testing and feedback! + ## Hardware Abstraction Layer (HAL) Marlin includes an abstraction layer to provide a common API for all the platforms it targets. This allows Marlin code to address the details of motion and user interface tasks at the lowest and highest levels with no system overhead, tying all events directly to the hardware clock. Every new HAL opens up a world of hardware. At this time we need HALs for RP2040 and the Duet3D family of boards. A HAL that wraps an RTOS is an interesting concept that could be explored. Did you know that Marlin includes a Simulator that can run on Windows, macOS, and Linux? Join the Discord to help move these sub-projects forward! -## 8-Bit AVR Boards - -A core tenet of this project is to keep supporting 8-bit AVR boards while also maintaining a single codebase that applies equally to all machines. We want casual hobbyists to benefit from the community's innovations as much as possible just as much as those with fancier machines. Plus, those old AVR-based machines are often the best for your testing and feedback! - ### Supported Platforms Platform|MCU|Example Boards @@ -71,22 +71,9 @@ A core tenet of this project is to keep supporting 8-bit AVR boards while also m [Teensy 4.1](https://www.pjrc.com/store/teensy41.html)|ARM® Cortex-M7| Linux Native|x86/ARM/etc.|Raspberry Pi -## Submitting Patches - -Proposed patches should be submitted as a Pull Request against the ([bugfix-2.1.x](https://github.com/MarlinFirmware/Marlin/tree/bugfix-2.1.x)) branch. - -- This branch is for fixing bugs and integrating any new features for the duration of the Marlin 2.1.x life-cycle. -- Follow the [Coding Standards](https://marlinfw.org/docs/development/coding_standards.html) to gain points with the maintainers. -- Please submit Feature Requests and Bug Reports to the [Issue Queue](https://github.com/MarlinFirmware/Marlin/issues/new/choose). Support resources are also listed there. -- Whenever you add new features, be sure to add tests to `buildroot/tests` and then run your tests locally, if possible. - - It's optional: Running all the tests on Windows might take a long time, and they will run anyway on GitHub. - - If you're running the tests on Linux (or on WSL with the code on a Linux volume) the speed is much faster. - - You can use `make tests-all-local` or `make tests-single-local TEST_TARGET=...`. - - If you prefer Docker you can use `make tests-all-local-docker` or `make tests-all-local-docker TEST_TARGET=...`. - ## Marlin Support -The Issue Queue is reserved for Bug Reports and Feature Requests. To get help with configuration and troubleshooting, please use the following resources: +The Issue Queue is reserved for Bug Reports and Feature Requests. Please use the following resources for help with configuration and troubleshooting: - [Marlin Documentation](https://marlinfw.org) - Official Marlin documentation - [Marlin Discord](https://discord.gg/n5NJ59y) - Discuss issues with Marlin users and developers @@ -95,60 +82,48 @@ The Issue Queue is reserved for Bug Reports and Feature Requests. To get help wi - Facebook Group ["Marlin Firmware for 3D Printers"](https://www.facebook.com/groups/3Dtechtalk/) - [Marlin Configuration](https://www.youtube.com/results?search_query=marlin+configuration) on YouTube -## Contributors - -Marlin is constantly improving thanks to a huge number of contributors from all over the world bringing their specialties and talents. Huge thanks are due to [all the contributors](https://github.com/MarlinFirmware/Marlin/graphs/contributors) who regularly patch up bugs, help direct traffic, and basically keep Marlin from falling apart. Marlin's continued existence would not be possible without them. - -## Administration +## Contributing Patches -Regular users can open and close their own issues, but only the administrators can do project-related things like add labels, merge changes, set milestones, and kick trolls. The current Marlin admin team consists of: +You can contribute patches by submitting a Pull Request to the ([bugfix-2.1.x](https://github.com/MarlinFirmware/Marlin/tree/bugfix-2.1.x)) branch. - - - -
Project Maintainer
- - 🇺🇸  **Scott Lahteine** -       [@thinkyhead](https://github.com/thinkyhead) -       [  Donate 💸  ](https://www.thinkyhead.com/donate-to-marlin) - - - - 🇺🇸  **Roxanne Neufeld** -       [@Roxy-3D](https://github.com/Roxy-3D) - - 🇺🇸  **Keith Bennett** -       [@thisiskeithb](https://github.com/thisiskeithb) -       [  Donate 💸  ](https://github.com/sponsors/thisiskeithb) - - 🇺🇸  **Jason Smith** -       [@sjasonsmith](https://github.com/sjasonsmith) - - - - 🇧🇷  **Victor Oliveira** -       [@rhapsodyv](https://github.com/rhapsodyv) - - 🇬🇧  **Chris Pepper** -       [@p3p](https://github.com/p3p) - -🇳🇿  **Peter Ellens** -       [@ellensp](https://github.com/ellensp) -       [  Donate 💸  ](https://ko-fi.com/ellensp) +- We use branches named with a "bugfix" or "dev" prefix to fix bugs and integrate new features. +- Follow the [Coding Standards](https://marlinfw.org/docs/development/coding_standards.html) to gain points with the maintainers. +- Please submit Feature Requests and Bug Reports to the [Issue Queue](https://github.com/MarlinFirmware/Marlin/issues/new/choose). See above for user support. +- Whenever you add new features, be sure to add one or more build tests to `buildroot/tests`. Any tests added to a PR will be run within that PR on GitHub servers as soon as they are pushed. To minimize iteration be sure to run your new tests locally, if possible. + - Local build tests: + - All: `make tests-config-all-local` + - Single: `make tests-config-single-local TEST_TARGET=...` + - Local build tests in Docker: + - All: `make tests-config-all-local-docker` + - Single: `make tests-config-all-local-docker TEST_TARGET=...` + - To run all unit test suites: + - Using PIO: `platformio run -t test-marlin` + - Using Make: `make unit-test-all-local` + - Using Docker + make: `maker unit-test-all-local-docker` + - To run a single unit test suite: + - Using PIO: `platformio run -t marlin_` + - Using make: `make unit-test-single-local TEST_TARGET=` + - Using Docker + make: `maker unit-test-single-local-docker TEST_TARGET=` +- If your feature can be unit tested, add one or more unit tests. For more information see our documentation on [Unit Tests](test). - +## Contributors - 🇺🇸  **Bob Kuhn** -       [@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn) +Marlin is constantly improving thanks to a huge number of contributors from all over the world bringing their specialties and talents. Huge thanks are due to [all the contributors](https://github.com/MarlinFirmware/Marlin/graphs/contributors) who regularly patch up bugs, help direct traffic, and basically keep Marlin from falling apart. Marlin's continued existence would not be possible without them. - 🇳🇱  **Erik van der Zalm** -       [@ErikZalm](https://github.com/ErikZalm) -       [  Donate 💸  ](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) +## Project Leadership -
+Name|Role|Link|Donate +----|----|----|---- +🇺🇸 Scott Lahteine|Project Lead|[[@thinkyhead](https://github.com/thinkyhead)]|[💸 Donate](https://marlinfw.org/docs/development/contributing.html#donate) +🇺🇸 Roxanne Neufeld|Admin|[[@Roxy-3D](https://github.com/Roxy-3D)]| +🇺🇸 Keith Bennett|Admin|[[@thisiskeithb](https://github.com/thisiskeithb)]|[💸 Donate](https://github.com/sponsors/thisiskeithb) +🇺🇸 Jason Smith|Admin|[[@sjasonsmith](https://github.com/sjasonsmith)]| +🇧🇷 Victor Oliveira|Admin|[[@rhapsodyv](https://github.com/rhapsodyv)]| +🇬🇧 Chris Pepper|Admin|[[@p3p](https://github.com/p3p)]| +🇳🇿 Peter Ellens|Admin|[[@ellensp](https://github.com/ellensp)]|[💸 Donate](https://ko-fi.com/ellensp) +🇺🇸 Bob Kuhn|Admin|[[@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn)]| +🇳🇱 Erik van der Zalm|Founder|[[@ErikZalm](https://github.com/ErikZalm)]| ## License 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. diff --git a/buildroot/bin/restore_configs b/buildroot/bin/restore_configs index ea998484c243..e1a601679bd1 100755 --- a/buildroot/bin/restore_configs +++ b/buildroot/bin/restore_configs @@ -7,5 +7,6 @@ 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/config.ini 2>/dev/null + git checkout Marlin/src/pins/*/pins_*.h 2>/dev/null fi diff --git a/buildroot/share/PlatformIO/scripts/collect-code-tests.py b/buildroot/share/PlatformIO/scripts/collect-code-tests.py new file mode 100644 index 000000000000..a0e0e86b1176 --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/collect-code-tests.py @@ -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() diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 2e4ab5c92d54..2a5f98dbbfc5 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -71,7 +71,9 @@ def sanity_check_target(): config = env.GetProjectConfig() result = check_envs("env:"+build_env, board_envs, config) - if not result: + # Make sure board is compatible with the build environment. Skip for _test, + # since the board is manipulated as each unit test is executed. + if not result and build_env != "linux_native_test": err = "Error: Build environment '%s' is incompatible with %s. Use one of these environments: %s" % \ ( build_env, motherboard, ", ".join([ e[4:] for e in board_envs if e.startswith("env:") ]) ) raise SystemExit(err) diff --git a/buildroot/share/PlatformIO/scripts/signature.py b/buildroot/share/PlatformIO/scripts/signature.py index 2d024c366287..820e6b7d653c 100755 --- a/buildroot/share/PlatformIO/scripts/signature.py +++ b/buildroot/share/PlatformIO/scripts/signature.py @@ -18,13 +18,13 @@ def enabled_defines(filepath): Each entry is a dictionary with a 'name' and a 'section' key. We end up with: { MOTHERBOARD: { name: "MOTHERBOARD", section: "hardware" }, ... } - The 'name' key might get dropped as redundant, but it's useful for debugging. + TODO: Drop the 'name' key as redundant. For now it's useful for debugging. - Because the option names are the keys, only the last occurrence is retained. - Use the Schema class for a more complete list of options, soon with full parsing. + This list is only used to filter config-defined options from those defined elsewhere. - This list is used to filter what is actually a config-defined option versus - defines from elsewhere. + Because the option names are the keys, only the last occurrence is retained. + This means the actual used value might not be reflected by this function. + The Schema class does more complete parsing for a more accurate list of options. While the Schema class parses the configurations on its own, this script will get the preprocessor output and get the intersection of the enabled options from @@ -44,13 +44,10 @@ def enabled_defines(filepath): # This will avoid false positives from #defines in comments f = re.sub(r'/\*.*?\*/', '', '\n'.join(f), flags=re.DOTALL).split("\n") - a = [] for line in f: sline = line.strip() m = re.match(spatt, sline) # @section ... - if m: - section = m.group(1).strip() - continue + if m: section = m.group(1).strip() ; continue if sline[:7] == "#define": # Extract the key here (we don't care about the value) kv = sline[8:].strip().split() @@ -79,6 +76,7 @@ def compute_build_signature(env): Compute the build signature by extracting all configuration settings and building a unique reversible signature that can be included in the binary. The signature can be reversed to get a 1:1 equivalent configuration file. + Used by common-dependencies.py after filtering build files by feature. ''' if 'BUILD_SIGNATURE' in env: return env.Append(BUILD_SIGNATURE=1) diff --git a/buildroot/share/dwin/bin/DWIN_ICO.py b/buildroot/share/dwin/bin/DWIN_ICO.py index 436a98701de0..4594e5501725 100644 --- a/buildroot/share/dwin/bin/DWIN_ICO.py +++ b/buildroot/share/dwin/bin/DWIN_ICO.py @@ -76,23 +76,19 @@ def splitFile(self, filename, outDir): self._parseHeader(infile) self._splitEntryData(infile, outDir) - return - def _parseHeader(self, infile): maxEntries = 256 count = 0 - validEntries = 0 + icon_nums = _iconNames.keys() while count < maxEntries: rawBytes = infile.read(16) entry = Entry() entry.parseRawData(rawBytes) # check that it is valid: is offset nonzero? - # Special case: treat 39 as valid - if (entry.offset > 0) or (count == 39): - validEntries += 1 + # Special case: treat missing numbers as valid + if (entry.offset > 0) or count not in icon_nums: self.entries.append(entry) count += 1 - return def _splitEntryData(self, infile, outDir): print('Splitting Entry Data...') @@ -110,18 +106,16 @@ def _splitEntryData(self, infile, outDir): if entry.length == 0: count += 1 continue - # Seek file position, read length bytes, and write to new output file. - print('%02d: offset: 0x%06x len: 0x%04x width: %d height: %d' % - (count, entry.offset, entry.length, entry.width, entry.height)) - outfilename = os.path.join(outDir, '%03d-ICON_%s.jpg' % (count, _iconNames7[count])) + outfilename = os.path.join(outDir, '%03d-ICON_%s.jpg' % (count, _iconNames.get(count, "UNKNOWN"))) with open(outfilename, 'wb') as outfile: infile.seek(entry.offset) blob = infile.read(entry.length) outfile.write(blob) - print('Wrote %d bytes to %s' % (entry.length, outfilename)) + # Seek file position, read length bytes, and write to new output file. + print('(%3d: width=%3d height=%3d offset=%6d len=%4d) ... %s' % + (count, entry.width, entry.height, entry.offset, entry.length, os.path.basename(outfilename))) count += 1 - return def createFile(self, iconDir, filename): '''Create a new .ico file from the contents of iconDir. @@ -179,7 +173,6 @@ def _updateHeaderOffsets(self): offset += e.length #print('%03d: (%d x %d) len=%d off=%d' % # (i, e.width, e.height, e.length, e.offset)) - return def _combineAndWriteIcoFile(self, filename): """Write out final .ico file. @@ -198,7 +191,6 @@ def _combineAndWriteIcoFile(self, filename): if 0 == e.length: continue guts = self._getFileContents(e.filename, e.length) outfile.write(guts) - return def _getFileContents(self, filename, length): """Read contents of filename, and return bytes""" @@ -232,7 +224,6 @@ def parseRawData(self, rawEntryBytes): self.height = h self.offset = off self.length = len3 * 65536 + len21 - return def serialize(self): """Convert this Entry's information into a 16-byte @@ -245,97 +236,112 @@ def serialize(self): 0, 0, 0, 0, 0) return rawdata -_iconNames7 = { - 0 : "LOGO_Creality", - 1 : "Print_0", - 2 : "Print_1", - 3 : "Prepare_0", - 4 : "Prepare_1", - 5 : "Control_0", - 6 : "Control_1", - 7 : "Leveling_0", - 8 : "Leveling_1", - 9 : "HotendTemp", - 10 : "BedTemp", - 11 : "Speed", - 12 : "Zoffset", - 13 : "Back", - 14 : "File", - 15 : "PrintTime", - 16 : "RemainTime", - 17 : "Setup_0", - 18 : "Setup_1", - 19 : "Pause_0", - 20 : "Pause_1", - 21 : "Continue_0", - 22 : "Continue_1", - 23 : "Stop_0", - 24 : "Stop_1", - 25 : "Bar", - 26 : "More", - 27 : "Axis", - 28 : "CloseMotor", - 29 : "Homing", - 30 : "SetHome", - 31 : "PLAPreheat", - 32 : "ABSPreheat", - 33 : "Cool", - 34 : "Language", - 35 : "MoveX", - 36 : "MoveY", - 37 : "MoveZ", - 38 : "Extruder", - # Skip 39 - 40 : "Temperature", - 41 : "Motion", - 42 : "WriteEEPROM", - 43 : "ReadEEPROM", - 44 : "ResetEEPROM", - 45 : "Info", - 46 : "SetEndTemp", - 47 : "SetBedTemp", - 48 : "FanSpeed", - 49 : "SetPLAPreheat", - 50 : "SetABSPreheat", - 51 : "MaxSpeed", - 52 : "MaxAccelerated", - 53 : "MaxJerk", - 54 : "Step", - 55 : "PrintSize", - 56 : "Version", - 57 : "Contact", - 58 : "StockConfiguraton", - 59 : "MaxSpeedX", - 60 : "MaxSpeedY", - 61 : "MaxSpeedZ", - 62 : "MaxSpeedE", - 63 : "MaxAccX", - 64 : "MaxAccY", - 65 : "MaxAccZ", - 66 : "MaxAccE", - 67 : "MaxSpeedJerkX", - 68 : "MaxSpeedJerkY", - 69 : "MaxSpeedJerkZ", - 70 : "MaxSpeedJerkE", - 71 : "StepX", - 72 : "StepY", - 73 : "StepZ", - 74 : "StepE", - 75 : "Setspeed", - 76 : "SetZOffset", - 77 : "Rectangle", - 78 : "BLTouch", - 79 : "TempTooLow", - 80 : "AutoLeveling", - 81 : "TempTooHigh", - 82 : "NoTips_C", - 83 : "NoTips_E", - 84 : "Continue_C", - 85 : "Continue_E", - 86 : "Cancel_C", - 87 : "Cancel_E", - 88 : "Confirm_C", - 89 : "Confirm_E", - 90 : "Info_0", - 91 : "Info_1" +_iconNames = { + 0 : "LOGO_Creality", + 1 : "Print_0", + 2 : "Print_1", + 3 : "Prepare_0", + 4 : "Prepare_1", + 5 : "Control_0", + 6 : "Control_1", + 7 : "Leveling_0", + 8 : "Leveling_1", + 9 : "HotendTemp", + 10 : "BedTemp", + 11 : "Speed", + 12 : "Zoffset", + 13 : "Back", + 14 : "File", + 15 : "PrintTime", + 16 : "RemainTime", + 17 : "Setup_0", + 18 : "Setup_1", + 19 : "Pause_0", + 20 : "Pause_1", + 21 : "Continue_0", + 22 : "Continue_1", + 23 : "Stop_0", + 24 : "Stop_1", + 25 : "Bar", + 26 : "More", + 27 : "Axis", + 28 : "CloseMotor", + 29 : "Homing", + 30 : "SetHome", + 31 : "PLAPreheat", + 32 : "ABSPreheat", + 33 : "Cool", + 34 : "Language", + 35 : "MoveX", + 36 : "MoveY", + 37 : "MoveZ", + 38 : "Extruder", + # Skip 39 + 40 : "Temperature", + 41 : "Motion", + 42 : "WriteEEPROM", + 43 : "ReadEEPROM", + 44 : "ResetEEPROM", + 45 : "Info", + 46 : "SetEndTemp", + 47 : "SetBedTemp", + 48 : "FanSpeed", + 49 : "SetPLAPreheat", + 50 : "SetABSPreheat", + 51 : "MaxSpeed", + 52 : "MaxAccelerated", + 53 : "MaxJerk", + 54 : "Step", + 55 : "PrintSize", + 56 : "Version", + 57 : "Contact", + 58 : "StockConfiguraton", + 59 : "MaxSpeedX", + 60 : "MaxSpeedY", + 61 : "MaxSpeedZ", + 62 : "MaxSpeedE", + 63 : "MaxAccX", + 64 : "MaxAccY", + 65 : "MaxAccZ", + 66 : "MaxAccE", + 67 : "MaxSpeedJerkX", + 68 : "MaxSpeedJerkY", + 69 : "MaxSpeedJerkZ", + 70 : "MaxSpeedJerkE", + 71 : "StepX", + 72 : "StepY", + 73 : "StepZ", + 74 : "StepE", + 75 : "Setspeed", + 76 : "SetZOffset", + 77 : "Rectangle", + 78 : "BLTouch", + 79 : "TempTooLow", + 80 : "AutoLeveling", + 81 : "TempTooHigh", + 82 : "NoTips_C", + 83 : "NoTips_E", + 84 : "Continue_C", + 85 : "Continue_E", + 86 : "Cancel_C", + 87 : "Cancel_E", + 88 : "Confirm_C", + 89 : "Confirm_E", + 90 : "Info_0", + 91 : "Info_1", + 92 : "DegreesC", + 93 : "Printer_0", + 200 : "Checkbox_F", + 201 : "Checkbox_T", + 202 : "Fade", + 203 : "Mesh", + 204 : "Tilt", + 205 : "Brightness", + 206 : "Probe", + 249 : "AxisD", + 250 : "AxisBR", + 251 : "AxisTR", + 252 : "AxisBL", + 253 : "AxisTL", + 254 : "AxisC" } diff --git a/buildroot/share/dwin/bin/README.md b/buildroot/share/dwin/bin/README.md index a00d679bf8e1..c78f4eb97f32 100644 --- a/buildroot/share/dwin/bin/README.md +++ b/buildroot/share/dwin/bin/README.md @@ -4,7 +4,7 @@ Tools for processing `.ICO` files used by DWIN displays. ## Introduction -The DWIN LCDs that come with the Creality Ender-3 v2 and other 3D printers contain image and container files stored on them which are used to draw various the UI elements. +The DWIN LCDs that come with the Creality Ender-3 V2 and other 3D printers contain image and container files stored on them which are used to draw various the UI elements. Standard `.JPG` files can be installed for things like the boot screen, and `.ICO` files can contain several images within a structured file format. @@ -48,9 +48,11 @@ Pillow is most easily installed with pip: These tools process an `.ICO` file that you specify. The safest method is to create a folder and copy your `.ICO` file there. For example: +``` $ mkdir hackicons - $ cp 9.ICO hackicons + $ cp 7.ICO hackicons $ cd hackicons +``` The following explanations will refer back to this layout. @@ -58,35 +60,68 @@ The following explanations will refer back to this layout. If you want to edit the individual icons stored in an ICO file (or add more images) you'll first need to extract all the images from the archive using `splitIco.py`. -**Usage:** `splitIco.py #.ICO foldername`. - -**Example:** - -In this example we're extracting the constituent JPEG files from `9.ICO` and storing them in a folder named `icons`. As each file is extracted the script reports its index number, byte offset, size, dimensions, and filename: - - $ cd buildroot/share/dwin - $ ./bin/splitIco.py 9.ICO icons-9 - Splitting 9.ICO into dir icons - Splitting Entry Data... - 00: offset: 0x001000 len: 0x10a2 width: 130 height: 17 - Wrote 4258 bytes to icons/000-ICON_LOGO.jpg - 01: offset: 0x0020a2 len: 0x0eac width: 110 height: 100 - Wrote 3756 bytes to icons/001-ICON_Print_0.jpg - 02: offset: 0x002f4e len: 0x0eaa width: 110 height: 100 - Wrote 3754 bytes to icons/002-ICON_Print_1.jpg - ... - 91: offset: 0x0345fc len: 0x0d89 width: 110 height: 100 - Wrote 3465 bytes to icons/091-ICON_Info_1.jpg +#### Usage: +``` +splitIco.py #.ICO foldername +``` + +#### Splitting .ICO FIle In Windows: +- Create `Split-ICO.bat` file in this folder with the following code: + - `for /f %%f in ('dir *.ICO /B /O:-D') do splitico.py %%f %%f-icons` +- Paste `.ICO` file into this folder +- Run `Split-ICO.bat` +- A new folder should appear containing all icons + +#### Example: + +In this example we're extracting the constituent JPEG files from `7.ICO` and storing them in a folder named `icons-7`. As each file is extracted the script reports its index number, byte offset, size, dimensions, and filename: + +``` +$ cd buildroot/share/dwin +$ ./bin/splitIco.py 7.ICO icons-7 + Splitting 7.ICO into dir icons-7 + Splitting Entry Data... + 00: offset: 0x001000 len: 0x10a2 width: 130 height: 17 + Wrote 4258 bytes to icons-7/000-ICON_LOGO.jpg + 01: offset: 0x0020a2 len: 0x0eac width: 110 height: 100 + Wrote 3756 bytes to icons-7/001-ICON_Print_0.jpg + 02: offset: 0x002f4e len: 0x0eaa width: 110 height: 100 + Wrote 3754 bytes to icons-7/002-ICON_Print_1.jpg + ... + 91: offset: 0x0345fc len: 0x0d89 width: 110 height: 100 + Wrote 3465 bytes to icons-7/091-ICON_Info_1.jpg +``` Once the individual JPEG files have been saved they can be edited using common graphics applications like Photoshop. JPEG files are inherently lossy and will usually contain ugly artifacts, so cleanup may be needed before they are re-exported. Keep the limits of bank size in mind when exporting images and try to find the best balance between compressed size and image quality. ### `makeIco.py` - Combine JPEGs into `ICO` archive -After editing images you'll create a new `9.ICO` archive with `makeIco.py` like so: - - $ cd buildroot/share/dwin - $ ./bin/makeIco.py icons-3 3.ICO - Making .ico file '3.ICO' from contents of 'icons-3' - Scanning icon directory icons-3 - ...Scanned 16 icon files - Scanning done. 16 icons included. +If you want to create an ICO file you'll need to use `makeIco.py`. + +#### Usage: +``` +makeIco.py foldername #.ICO +``` + +#### Making .ICO FIle In Windows: +- Create `Make-ICO.bat` file in this folder with the following code: + - ``` + setlocal enabledelayedexpansion + for /f %%f in ('dir *-icons /B /O:-D') do set f=%%f & makeico.py %%f !f:~0,-7! + ``` +- Paste folder containing all icons into this folder +- Run `Make-ICO.bat` +- A new `.ICO` file should appear + +#### Example: + +After editing images you'll create a new `7.ICO` archive with `makeIco.py` like so: + +``` +$ cd buildroot/share/dwin +$ ./bin/makeIco.py icons-7 7.ICO + Making .ico file '7.ICO' from contents of 'icons-7' + Scanning icon directory icons-7 + ...Scanned 16 icon files + Scanning done. 16 icons included. +``` diff --git a/buildroot/share/dwin/icons-4/016-ICON_Bedline.jpg b/buildroot/share/dwin/icons-4/016-ICON_Bedline.jpg new file mode 100644 index 000000000000..68d65dc5fee0 Binary files /dev/null and b/buildroot/share/dwin/icons-4/016-ICON_Bedline.jpg differ diff --git a/buildroot/share/dwin/icons-4/017-ICON_BedLeveledOff.jpg b/buildroot/share/dwin/icons-4/017-ICON_BedLeveledOff.jpg new file mode 100644 index 000000000000..853fa5159b67 Binary files /dev/null and b/buildroot/share/dwin/icons-4/017-ICON_BedLeveledOff.jpg differ diff --git a/buildroot/share/dwin/icons-4/018-ICON_BedLeveledOn.jpg b/buildroot/share/dwin/icons-4/018-ICON_BedLeveledOn.jpg new file mode 100644 index 000000000000..d495b57c0a66 Binary files /dev/null and b/buildroot/share/dwin/icons-4/018-ICON_BedLeveledOn.jpg differ diff --git a/buildroot/share/dwin/icons-7/009-ICON_HotendTemp.jpg b/buildroot/share/dwin/icons-7/009-ICON_HotendTemp.jpg index 0bf1437c646d..b3551f3c5c64 100644 Binary files a/buildroot/share/dwin/icons-7/009-ICON_HotendTemp.jpg and b/buildroot/share/dwin/icons-7/009-ICON_HotendTemp.jpg differ diff --git a/buildroot/share/dwin/icons-7/010-ICON_BedTemp.jpg b/buildroot/share/dwin/icons-7/010-ICON_BedTemp.jpg index 186d02ad3b92..2d46d13b8417 100644 Binary files a/buildroot/share/dwin/icons-7/010-ICON_BedTemp.jpg and b/buildroot/share/dwin/icons-7/010-ICON_BedTemp.jpg differ diff --git a/buildroot/share/dwin/icons-7/011-ICON_Speed.jpg b/buildroot/share/dwin/icons-7/011-ICON_Speed.jpg index 387c166566b7..83da633221b8 100644 Binary files a/buildroot/share/dwin/icons-7/011-ICON_Speed.jpg and b/buildroot/share/dwin/icons-7/011-ICON_Speed.jpg differ diff --git a/buildroot/share/dwin/icons-7/012-ICON_Zoffset.jpg b/buildroot/share/dwin/icons-7/012-ICON_Zoffset.jpg index 2e74ee3986d9..8956690a7547 100644 Binary files a/buildroot/share/dwin/icons-7/012-ICON_Zoffset.jpg and b/buildroot/share/dwin/icons-7/012-ICON_Zoffset.jpg differ diff --git a/buildroot/share/dwin/icons-7/019-ICON_Pause_0.jpg b/buildroot/share/dwin/icons-7/019-ICON_Pause_0.jpg index 2f6e83110965..227f0dd8f485 100644 Binary files a/buildroot/share/dwin/icons-7/019-ICON_Pause_0.jpg and b/buildroot/share/dwin/icons-7/019-ICON_Pause_0.jpg differ diff --git a/buildroot/share/dwin/icons-7/020-ICON_Pause_1.jpg b/buildroot/share/dwin/icons-7/020-ICON_Pause_1.jpg index 746b943c149f..e54823be72b9 100644 Binary files a/buildroot/share/dwin/icons-7/020-ICON_Pause_1.jpg and b/buildroot/share/dwin/icons-7/020-ICON_Pause_1.jpg differ diff --git a/buildroot/share/dwin/icons-7/030-ICON_SetHome.jpg b/buildroot/share/dwin/icons-7/030-ICON_SetHome.jpg index 14aedc0dd019..bd55f6f929cf 100644 Binary files a/buildroot/share/dwin/icons-7/030-ICON_SetHome.jpg and b/buildroot/share/dwin/icons-7/030-ICON_SetHome.jpg differ diff --git a/buildroot/share/dwin/icons-7/034-ICON_Language.jpg b/buildroot/share/dwin/icons-7/034-ICON_Language.jpg index 055b4c1ae8e6..8cebfa76c7f3 100644 Binary files a/buildroot/share/dwin/icons-7/034-ICON_Language.jpg and b/buildroot/share/dwin/icons-7/034-ICON_Language.jpg differ diff --git a/buildroot/share/dwin/icons-7/035-ICON_MoveX.jpg b/buildroot/share/dwin/icons-7/035-ICON_MoveX.jpg index 54f834caaf12..20f2aab40cc8 100644 Binary files a/buildroot/share/dwin/icons-7/035-ICON_MoveX.jpg and b/buildroot/share/dwin/icons-7/035-ICON_MoveX.jpg differ diff --git a/buildroot/share/dwin/icons-7/036-ICON_MoveY.jpg b/buildroot/share/dwin/icons-7/036-ICON_MoveY.jpg index b82a5b25cd6f..72841e97bd78 100644 Binary files a/buildroot/share/dwin/icons-7/036-ICON_MoveY.jpg and b/buildroot/share/dwin/icons-7/036-ICON_MoveY.jpg differ diff --git a/buildroot/share/dwin/icons-7/037-ICON_MoveZ.jpg b/buildroot/share/dwin/icons-7/037-ICON_MoveZ.jpg index 487d6e4e4436..4af56c25a67e 100644 Binary files a/buildroot/share/dwin/icons-7/037-ICON_MoveZ.jpg and b/buildroot/share/dwin/icons-7/037-ICON_MoveZ.jpg differ diff --git a/buildroot/share/dwin/icons-7/038-ICON_Extruder.jpg b/buildroot/share/dwin/icons-7/038-ICON_Extruder.jpg index 155b9a58576d..69e456c499ae 100644 Binary files a/buildroot/share/dwin/icons-7/038-ICON_Extruder.jpg and b/buildroot/share/dwin/icons-7/038-ICON_Extruder.jpg differ diff --git a/buildroot/share/dwin/icons-7/040-ICON_Temperature.jpg b/buildroot/share/dwin/icons-7/040-ICON_Temperature.jpg index eaea25bbd881..b0eef7e42030 100644 Binary files a/buildroot/share/dwin/icons-7/040-ICON_Temperature.jpg and b/buildroot/share/dwin/icons-7/040-ICON_Temperature.jpg differ diff --git a/buildroot/share/dwin/icons-7/041-ICON_Motion.jpg b/buildroot/share/dwin/icons-7/041-ICON_Motion.jpg index 472a6354e43d..ad083a208b39 100644 Binary files a/buildroot/share/dwin/icons-7/041-ICON_Motion.jpg and b/buildroot/share/dwin/icons-7/041-ICON_Motion.jpg differ diff --git a/buildroot/share/dwin/icons-7/045-ICON_Info.jpg b/buildroot/share/dwin/icons-7/045-ICON_Info.jpg index 34e63e587a1c..9cfcf912c865 100644 Binary files a/buildroot/share/dwin/icons-7/045-ICON_Info.jpg and b/buildroot/share/dwin/icons-7/045-ICON_Info.jpg differ diff --git a/buildroot/share/dwin/icons-7/046-ICON_SetEndTemp.jpg b/buildroot/share/dwin/icons-7/046-ICON_SetEndTemp.jpg index 33f50041836c..7565e5defeb9 100644 Binary files a/buildroot/share/dwin/icons-7/046-ICON_SetEndTemp.jpg and b/buildroot/share/dwin/icons-7/046-ICON_SetEndTemp.jpg differ diff --git a/buildroot/share/dwin/icons-7/047-ICON_SetBedTemp.jpg b/buildroot/share/dwin/icons-7/047-ICON_SetBedTemp.jpg index 09e5072ab9b4..186d02ad3b92 100644 Binary files a/buildroot/share/dwin/icons-7/047-ICON_SetBedTemp.jpg and b/buildroot/share/dwin/icons-7/047-ICON_SetBedTemp.jpg differ diff --git a/buildroot/share/dwin/icons-7/051-ICON_MaxSpeed.jpg b/buildroot/share/dwin/icons-7/051-ICON_MaxSpeed.jpg index eaaa21255b62..d8b416827dd2 100644 Binary files a/buildroot/share/dwin/icons-7/051-ICON_MaxSpeed.jpg and b/buildroot/share/dwin/icons-7/051-ICON_MaxSpeed.jpg differ diff --git a/buildroot/share/dwin/icons-7/052-ICON_MaxAccelerated.jpg b/buildroot/share/dwin/icons-7/052-ICON_MaxAccelerated.jpg index 4e9c3ad6e410..dda2a55659fb 100644 Binary files a/buildroot/share/dwin/icons-7/052-ICON_MaxAccelerated.jpg and b/buildroot/share/dwin/icons-7/052-ICON_MaxAccelerated.jpg differ diff --git a/buildroot/share/dwin/icons-7/053-ICON_MaxJerk.jpg b/buildroot/share/dwin/icons-7/053-ICON_MaxJerk.jpg index 119df1a03d64..05190db4c334 100644 Binary files a/buildroot/share/dwin/icons-7/053-ICON_MaxJerk.jpg and b/buildroot/share/dwin/icons-7/053-ICON_MaxJerk.jpg differ diff --git a/buildroot/share/dwin/icons-7/054-ICON_Step.jpg b/buildroot/share/dwin/icons-7/054-ICON_Step.jpg index 4a0da4a487cd..3f240655a589 100644 Binary files a/buildroot/share/dwin/icons-7/054-ICON_Step.jpg and b/buildroot/share/dwin/icons-7/054-ICON_Step.jpg differ diff --git a/buildroot/share/dwin/icons-7/058-ICON_StockConfiguraton.jpg b/buildroot/share/dwin/icons-7/058-ICON_StockConfiguraton.jpg index 8e2b6fedbe13..7a64b7037817 100644 Binary files a/buildroot/share/dwin/icons-7/058-ICON_StockConfiguraton.jpg and b/buildroot/share/dwin/icons-7/058-ICON_StockConfiguraton.jpg differ diff --git a/buildroot/share/dwin/icons-7/059-ICON_MaxSpeedX.jpg b/buildroot/share/dwin/icons-7/059-ICON_MaxSpeedX.jpg index c60504f326f7..595006354384 100644 Binary files a/buildroot/share/dwin/icons-7/059-ICON_MaxSpeedX.jpg and b/buildroot/share/dwin/icons-7/059-ICON_MaxSpeedX.jpg differ diff --git a/buildroot/share/dwin/icons-7/060-ICON_MaxSpeedY.jpg b/buildroot/share/dwin/icons-7/060-ICON_MaxSpeedY.jpg index c3b3cc7ce18f..f069adeb0287 100644 Binary files a/buildroot/share/dwin/icons-7/060-ICON_MaxSpeedY.jpg and b/buildroot/share/dwin/icons-7/060-ICON_MaxSpeedY.jpg differ diff --git a/buildroot/share/dwin/icons-7/061-ICON_MaxSpeedZ.jpg b/buildroot/share/dwin/icons-7/061-ICON_MaxSpeedZ.jpg index fe79df374681..9b604bca12da 100644 Binary files a/buildroot/share/dwin/icons-7/061-ICON_MaxSpeedZ.jpg and b/buildroot/share/dwin/icons-7/061-ICON_MaxSpeedZ.jpg differ diff --git a/buildroot/share/dwin/icons-7/062-ICON_MaxSpeedE.jpg b/buildroot/share/dwin/icons-7/062-ICON_MaxSpeedE.jpg index 519f1b448c84..1625ed2c6abe 100644 Binary files a/buildroot/share/dwin/icons-7/062-ICON_MaxSpeedE.jpg and b/buildroot/share/dwin/icons-7/062-ICON_MaxSpeedE.jpg differ diff --git a/buildroot/share/dwin/icons-7/063-ICON_MaxAccX.jpg b/buildroot/share/dwin/icons-7/063-ICON_MaxAccX.jpg index 9258c8618fa3..57122f127baf 100644 Binary files a/buildroot/share/dwin/icons-7/063-ICON_MaxAccX.jpg and b/buildroot/share/dwin/icons-7/063-ICON_MaxAccX.jpg differ diff --git a/buildroot/share/dwin/icons-7/064-ICON_MaxAccY.jpg b/buildroot/share/dwin/icons-7/064-ICON_MaxAccY.jpg index 1a163314560c..d7183b716b12 100644 Binary files a/buildroot/share/dwin/icons-7/064-ICON_MaxAccY.jpg and b/buildroot/share/dwin/icons-7/064-ICON_MaxAccY.jpg differ diff --git a/buildroot/share/dwin/icons-7/065-ICON_MaxAccZ.jpg b/buildroot/share/dwin/icons-7/065-ICON_MaxAccZ.jpg index 23255ce0e591..ccf17d2b4142 100644 Binary files a/buildroot/share/dwin/icons-7/065-ICON_MaxAccZ.jpg and b/buildroot/share/dwin/icons-7/065-ICON_MaxAccZ.jpg differ diff --git a/buildroot/share/dwin/icons-7/066-ICON_MaxAccE.jpg b/buildroot/share/dwin/icons-7/066-ICON_MaxAccE.jpg index 5bd3fedd6e15..12bb8c1ea94d 100644 Binary files a/buildroot/share/dwin/icons-7/066-ICON_MaxAccE.jpg and b/buildroot/share/dwin/icons-7/066-ICON_MaxAccE.jpg differ diff --git a/buildroot/share/dwin/icons-7/067-ICON_MaxSpeedJerkX.jpg b/buildroot/share/dwin/icons-7/067-ICON_MaxSpeedJerkX.jpg index c316c750b58c..d00fa1156d44 100644 Binary files a/buildroot/share/dwin/icons-7/067-ICON_MaxSpeedJerkX.jpg and b/buildroot/share/dwin/icons-7/067-ICON_MaxSpeedJerkX.jpg differ diff --git a/buildroot/share/dwin/icons-7/068-ICON_MaxSpeedJerkY.jpg b/buildroot/share/dwin/icons-7/068-ICON_MaxSpeedJerkY.jpg index c7cda895033b..6b8888a910fc 100644 Binary files a/buildroot/share/dwin/icons-7/068-ICON_MaxSpeedJerkY.jpg and b/buildroot/share/dwin/icons-7/068-ICON_MaxSpeedJerkY.jpg differ diff --git a/buildroot/share/dwin/icons-7/069-ICON_MaxSpeedJerkZ.jpg b/buildroot/share/dwin/icons-7/069-ICON_MaxSpeedJerkZ.jpg index be450cd460ac..f06a69ae2ed9 100644 Binary files a/buildroot/share/dwin/icons-7/069-ICON_MaxSpeedJerkZ.jpg and b/buildroot/share/dwin/icons-7/069-ICON_MaxSpeedJerkZ.jpg differ diff --git a/buildroot/share/dwin/icons-7/070-ICON_MaxSpeedJerkE.jpg b/buildroot/share/dwin/icons-7/070-ICON_MaxSpeedJerkE.jpg index 3c926b856519..9a018367fff5 100644 Binary files a/buildroot/share/dwin/icons-7/070-ICON_MaxSpeedJerkE.jpg and b/buildroot/share/dwin/icons-7/070-ICON_MaxSpeedJerkE.jpg differ diff --git a/buildroot/share/dwin/icons-7/071-ICON_StepX.jpg b/buildroot/share/dwin/icons-7/071-ICON_StepX.jpg index f1015b82185f..432b10626c09 100644 Binary files a/buildroot/share/dwin/icons-7/071-ICON_StepX.jpg and b/buildroot/share/dwin/icons-7/071-ICON_StepX.jpg differ diff --git a/buildroot/share/dwin/icons-7/072-ICON_StepY.jpg b/buildroot/share/dwin/icons-7/072-ICON_StepY.jpg index 9bb3e6e6beb7..9348ef042452 100644 Binary files a/buildroot/share/dwin/icons-7/072-ICON_StepY.jpg and b/buildroot/share/dwin/icons-7/072-ICON_StepY.jpg differ diff --git a/buildroot/share/dwin/icons-7/073-ICON_StepZ.jpg b/buildroot/share/dwin/icons-7/073-ICON_StepZ.jpg index 78dce2a36933..93434107e69d 100644 Binary files a/buildroot/share/dwin/icons-7/073-ICON_StepZ.jpg and b/buildroot/share/dwin/icons-7/073-ICON_StepZ.jpg differ diff --git a/buildroot/share/dwin/icons-7/074-ICON_StepE.jpg b/buildroot/share/dwin/icons-7/074-ICON_StepE.jpg index 58eaff565032..9102da951d12 100644 Binary files a/buildroot/share/dwin/icons-7/074-ICON_StepE.jpg and b/buildroot/share/dwin/icons-7/074-ICON_StepE.jpg differ diff --git a/buildroot/share/dwin/icons-7/075-ICON_Setspeed.jpg b/buildroot/share/dwin/icons-7/075-ICON_Setspeed.jpg index 94b808f716a2..a0d15689470a 100644 Binary files a/buildroot/share/dwin/icons-7/075-ICON_Setspeed.jpg and b/buildroot/share/dwin/icons-7/075-ICON_Setspeed.jpg differ diff --git a/buildroot/share/dwin/icons-7/076-ICON_SetZOffset.jpg b/buildroot/share/dwin/icons-7/076-ICON_SetZOffset.jpg index 14aedc0dd019..e9851c75f884 100644 Binary files a/buildroot/share/dwin/icons-7/076-ICON_SetZOffset.jpg and b/buildroot/share/dwin/icons-7/076-ICON_SetZOffset.jpg differ diff --git a/buildroot/share/dwin/icons-7/078-ICON_BLTouch.jpg b/buildroot/share/dwin/icons-7/078-ICON_BLTouch.jpg index b3234d45aa12..fa4b87b8a9b4 100644 Binary files a/buildroot/share/dwin/icons-7/078-ICON_BLTouch.jpg and b/buildroot/share/dwin/icons-7/078-ICON_BLTouch.jpg differ diff --git a/buildroot/share/dwin/icons-7/079-ICON_TempTooLow.jpg b/buildroot/share/dwin/icons-7/079-ICON_TempTooLow.jpg index c403c328f5ed..b4ba9b3af0b6 100644 Binary files a/buildroot/share/dwin/icons-7/079-ICON_TempTooLow.jpg and b/buildroot/share/dwin/icons-7/079-ICON_TempTooLow.jpg differ diff --git a/buildroot/share/dwin/icons-7/081-ICON_TempTooHigh.jpg b/buildroot/share/dwin/icons-7/081-ICON_TempTooHigh.jpg index 07aae4e5ec33..61ca9f41d72f 100644 Binary files a/buildroot/share/dwin/icons-7/081-ICON_TempTooHigh.jpg and b/buildroot/share/dwin/icons-7/081-ICON_TempTooHigh.jpg differ diff --git a/buildroot/share/dwin/icons-7/092-ICON_DegreesC.jpg b/buildroot/share/dwin/icons-7/092-ICON_DegreesC.jpg new file mode 100644 index 000000000000..a5622bf9beac Binary files /dev/null and b/buildroot/share/dwin/icons-7/092-ICON_DegreesC.jpg differ diff --git a/buildroot/share/dwin/icons-7/093-ICON_Printer_0.jpg b/buildroot/share/dwin/icons-7/093-ICON_Printer_0.jpg new file mode 100644 index 000000000000..7175b7194ef5 Binary files /dev/null and b/buildroot/share/dwin/icons-7/093-ICON_Printer_0.jpg differ diff --git a/buildroot/share/dwin/icons-7/200-ICON_Checkbox_F.jpg b/buildroot/share/dwin/icons-7/200-ICON_Checkbox_F.jpg new file mode 100644 index 000000000000..8c2c3481b81b Binary files /dev/null and b/buildroot/share/dwin/icons-7/200-ICON_Checkbox_F.jpg differ diff --git a/buildroot/share/dwin/icons-7/201-ICON_Checkbox_T.jpg b/buildroot/share/dwin/icons-7/201-ICON_Checkbox_T.jpg new file mode 100644 index 000000000000..4eabacad4dc5 Binary files /dev/null and b/buildroot/share/dwin/icons-7/201-ICON_Checkbox_T.jpg differ diff --git a/buildroot/share/dwin/icons-7/202-ICON_Fade.jpg b/buildroot/share/dwin/icons-7/202-ICON_Fade.jpg new file mode 100644 index 000000000000..7d327ae9b9c3 Binary files /dev/null and b/buildroot/share/dwin/icons-7/202-ICON_Fade.jpg differ diff --git a/buildroot/share/dwin/icons-7/203-ICON_Mesh.jpg b/buildroot/share/dwin/icons-7/203-ICON_Mesh.jpg new file mode 100644 index 000000000000..65c94be0dda9 Binary files /dev/null and b/buildroot/share/dwin/icons-7/203-ICON_Mesh.jpg differ diff --git a/buildroot/share/dwin/icons-7/204-ICON_Tilt.jpg b/buildroot/share/dwin/icons-7/204-ICON_Tilt.jpg new file mode 100644 index 000000000000..a1689e05ea11 Binary files /dev/null and b/buildroot/share/dwin/icons-7/204-ICON_Tilt.jpg differ diff --git a/buildroot/share/dwin/icons-7/205-ICON_Brightness.jpg b/buildroot/share/dwin/icons-7/205-ICON_Brightness.jpg new file mode 100644 index 000000000000..22eda81168de Binary files /dev/null and b/buildroot/share/dwin/icons-7/205-ICON_Brightness.jpg differ diff --git a/buildroot/share/dwin/icons-7/206-ICON_Probe.jpg b/buildroot/share/dwin/icons-7/206-ICON_Probe.jpg new file mode 100644 index 000000000000..5de52da60797 Binary files /dev/null and b/buildroot/share/dwin/icons-7/206-ICON_Probe.jpg differ diff --git a/buildroot/share/dwin/icons-7/249-ICON_AxisD.jpg b/buildroot/share/dwin/icons-7/249-ICON_AxisD.jpg new file mode 100644 index 000000000000..14730dfa425c Binary files /dev/null and b/buildroot/share/dwin/icons-7/249-ICON_AxisD.jpg differ diff --git a/buildroot/share/dwin/icons-7/250-ICON_AxisBR.jpg b/buildroot/share/dwin/icons-7/250-ICON_AxisBR.jpg new file mode 100644 index 000000000000..89d5ef05ce21 Binary files /dev/null and b/buildroot/share/dwin/icons-7/250-ICON_AxisBR.jpg differ diff --git a/buildroot/share/dwin/icons-7/251-ICON_AxisTR.jpg b/buildroot/share/dwin/icons-7/251-ICON_AxisTR.jpg new file mode 100644 index 000000000000..716b9f7314c4 Binary files /dev/null and b/buildroot/share/dwin/icons-7/251-ICON_AxisTR.jpg differ diff --git a/buildroot/share/dwin/icons-7/252-ICON_AxisBL.jpg b/buildroot/share/dwin/icons-7/252-ICON_AxisBL.jpg new file mode 100644 index 000000000000..c94915dd2539 Binary files /dev/null and b/buildroot/share/dwin/icons-7/252-ICON_AxisBL.jpg differ diff --git a/buildroot/share/dwin/icons-7/253-ICON_AxisTL.jpg b/buildroot/share/dwin/icons-7/253-ICON_AxisTL.jpg new file mode 100644 index 000000000000..7fb5de6e9c6e Binary files /dev/null and b/buildroot/share/dwin/icons-7/253-ICON_AxisTL.jpg differ diff --git a/buildroot/share/dwin/icons-7/254-ICON_AxisC.jpg b/buildroot/share/dwin/icons-7/254-ICON_AxisC.jpg new file mode 100644 index 000000000000..3dd02c52b0ea Binary files /dev/null and b/buildroot/share/dwin/icons-7/254-ICON_AxisC.jpg differ diff --git a/buildroot/share/git/mfhelp b/buildroot/share/git/mfhelp index 46a0ebfc5333..aff34b866f6b 100755 --- a/buildroot/share/git/mfhelp +++ b/buildroot/share/git/mfhelp @@ -41,6 +41,6 @@ Modify Configuration.h / Configuration_adv.h: Modify pins files: pins_set ............. Set the value of a pin in a pins file - pinsformat.js ........ Node.js script to format pins files + pinsformat.py ........ Python script to format pins files THIS diff --git a/buildroot/share/scripts/pinsformat.js b/buildroot/share/scripts/pinsformat.js deleted file mode 100755 index 16e9dcb88f08..000000000000 --- a/buildroot/share/scripts/pinsformat.js +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/env node - -// -// Formatter script for pins_MYPINS.h files -// -// Usage: mffmt [infile] [outfile] -// -// With no parameters convert STDIN to STDOUT -// - -const fs = require("fs"); - -var do_log = false -function logmsg(msg, line='') { - if (do_log) console.log(msg, line); -} - -// String lpad / rpad -String.prototype.lpad = function(len, chr) { - if (!len) return this; - if (chr === undefined) chr = ' '; - var s = this+'', need = len - s.length; - if (need > 0) s = new Array(need+1).join(chr) + s; - return s; -}; - -String.prototype.rpad = function(len, chr) { - if (!len) return this; - if (chr === undefined) chr = ' '; - var s = this+'', need = len - s.length; - if (need > 0) s += new Array(need+1).join(chr); - return s; -}; - -// Concatenate a string, adding a space if necessary -// to avoid merging two words -String.prototype.concat_with_space = function(str) { - const c = this.substr(-1), d = str.charAt(0); - if (c !== ' ' && c !== '' && d !== ' ' && d !== '') - str = ' ' + str; - return this + str; -}; - -const mpatt = [ '-?\\d{1,3}', 'P[A-I]\\d+', 'P\\d_\\d+', 'Pin[A-Z]\\d\\b' ], - definePatt = new RegExp(`^\\s*(//)?#define\\s+[A-Z_][A-Z0-9_]+\\s+(${mpatt.join('|')})\\s*(//.*)?$`, 'gm'), - ppad = [ 3, 4, 5, 5 ], - col_comment = 50, - col_value_rj = col_comment - 3; - -var mexpr = []; -for (let m of mpatt) mexpr.push(new RegExp('^' + m + '$')); - -const argv = process.argv.slice(2), argc = argv.length; - -var src_file = 0, dst_file; -if (argc > 0) { - let ind = 0; - if (argv[0] == '-v') { do_log = true; ind++; } - dst_file = src_file = argv[ind++]; - if (ind < argc) dst_file = argv[ind]; -} - -// Read from file or STDIN until it terminates -const filtered = process_text(fs.readFileSync(src_file).toString()); -if (dst_file) - fs.writeFileSync(dst_file, filtered); -else - console.log(filtered); - -// Find the pin pattern so non-pin defines can be skipped -function get_pin_pattern(txt) { - var r, m = 0, match_count = [ 0, 0, 0, 0 ]; - var max_match_count = 0, max_match_index = -1; - definePatt.lastIndex = 0; - while ((r = definePatt.exec(txt)) !== null) { - let ind = -1; - if (mexpr.some((p) => { - ind++; - const didmatch = r[2].match(p); - return r[2].match(p); - }) ) { - const m = ++match_count[ind]; - if (m > max_match_count) { - max_match_count = m; - max_match_index = ind; - } - } - } - if (max_match_index === -1) return null; - - return { match:mpatt[max_match_index], pad:ppad[max_match_index] }; -} - -function process_text(txt) { - if (!txt.length) return '(no text)'; - const patt = get_pin_pattern(txt); - if (!patt) return txt; - const pindefPatt = new RegExp(`^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+(${patt.match})\\s*(//.*)?$`), - noPinPatt = new RegExp(`^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+(-1)\\s*(//.*)?$`), - skipPatt1 = new RegExp('^(\\s*(//)?#define)\\s+(AT90USB|USBCON|(BOARD|DAC|FLASH|HAS|IS|USE)_.+|.+_(ADDRESS|AVAILABLE|BAUDRATE|CLOCK|CONNECTION|DEFAULT|ERROR|EXTRUDERS|FREQ|ITEM|MKS_BASE_VERSION|MODULE|NAME|ONLY|ORIENTATION|PERIOD|RANGE|RATE|READ_RETRIES|SERIAL|SIZE|SPI|STATE|STEP|TIMER|VERSION))\\s+(.+)\\s*(//.*)?$'), - skipPatt2 = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+(0x[0-9A-Fa-f]+|\d+|.+[a-z].+)\\s*(//.*)?$'), - skipPatt3 = /^\s*#e(lse|ndif)\b.*$/, - aliasPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+([A-Z_][A-Z0-9_()]+)\\s*(//.*)?$'), - switchPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s*(//.*)?$'), - undefPatt = new RegExp('^(\\s*(//)?#undef)\\s+([A-Z_][A-Z0-9_]+)\\s*(//.*)?$'), - defPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+([-_\\w]+)\\s*(//.*)?$'), - condPatt = new RegExp('^(\\s*(//)?#(if|ifn?def|elif)(\\s+\\S+)*)\\s+(//.*)$'), - commPatt = new RegExp('^\\s{20,}(//.*)?$'); - const col_value_lj = col_comment - patt.pad - 2; - var r, out = '', check_comment_next = false; - txt.split('\n').forEach((line) => { - if (check_comment_next) - check_comment_next = ((r = commPatt.exec(line)) !== null); - - if (check_comment_next) - // Comments in column 45 - line = ''.rpad(col_comment) + r[1]; - - else if (skipPatt1.exec(line) !== null) { - // - // #define SKIP_ME - // - logmsg("skip:", line); - } - else if ((r = pindefPatt.exec(line)) !== null) { - // - // #define MY_PIN [pin] - // - logmsg("pin:", line); - const pinnum = r[4].charAt(0) == 'P' ? r[4] : r[4].lpad(patt.pad); - line = r[1] + ' ' + r[3]; - line = line.rpad(col_value_lj).concat_with_space(pinnum); - if (r[5]) line = line.rpad(col_comment).concat_with_space(r[5]); - } - else if ((r = noPinPatt.exec(line)) !== null) { - // - // #define MY_PIN -1 - // - logmsg("pin -1:", line); - line = r[1] + ' ' + r[3]; - line = line.rpad(col_value_lj).concat_with_space('-1'); - if (r[5]) line = line.rpad(col_comment).concat_with_space(r[5]); - } - else if (skipPatt2.exec(line) !== null || skipPatt3.exec(line) !== null) { - // - // #define SKIP_ME - // #else, #endif - // - logmsg("skip:", line); - } - else if ((r = aliasPatt.exec(line)) !== null) { - // - // #define ALIAS OTHER - // - logmsg("alias:", line); - line = r[1] + ' ' + r[3]; - line = line.concat_with_space(r[4].lpad(col_value_rj + 1 - line.length)); - if (r[5]) line = line.rpad(col_comment).concat_with_space(r[5]); - } - else if ((r = switchPatt.exec(line)) !== null) { - // - // #define SWITCH - // - logmsg("switch:", line); - line = r[1] + ' ' + r[3]; - if (r[4]) line = line.rpad(col_comment).concat_with_space(r[4]); - check_comment_next = true; - } - else if ((r = defPatt.exec(line)) !== null) { - // - // #define ... - // - logmsg("def:", line); - line = r[1] + ' ' + r[3] + ' '; - line = line.concat_with_space(r[4].lpad(col_value_rj + 1 - line.length)); - if (r[5]) line = line.rpad(col_comment - 1) + ' ' + r[5]; - } - else if ((r = undefPatt.exec(line)) !== null) { - // - // #undef ... - // - logmsg("undef:", line); - line = r[1] + ' ' + r[3]; - if (r[4]) line = line.rpad(col_comment).concat_with_space(r[4]); - } - else if ((r = condPatt.exec(line)) !== null) { - // - // #if, #ifdef, #ifndef, #elif ... - // - logmsg("cond:", line); - line = r[1].rpad(col_comment).concat_with_space(r[5]); - check_comment_next = true; - } - out += line + '\n'; - }); - return out.replace(/\n\n+/g, '\n\n').replace(/\n\n$/g, '\n'); -} diff --git a/buildroot/share/scripts/pinsformat.py b/buildroot/share/scripts/pinsformat.py index b49ae4931d09..e4bd69d855f6 100755 --- a/buildroot/share/scripts/pinsformat.py +++ b/buildroot/share/scripts/pinsformat.py @@ -27,6 +27,13 @@ def rpad(astr, fill, c=' '): need = fill - len(astr) return astr if need <= 0 else astr + (need * c) +# Concatenate a string, adding a space if necessary +# to avoid merging two words +def concat_with_space(s1, s2): + if not s1.endswith(' ') and not s2.startswith(' '): + s1 += ' ' + return s1 + s2 + # Pin patterns mpatt = [ r'-?\d{1,3}', r'P[A-I]\d+', r'P\d_\d+', r'Pin[A-Z]\d\b' ] mstr = '|'.join(mpatt) @@ -45,6 +52,7 @@ def format_pins(argv): scnt = 0 for arg in argv: if arg == '-v': + global do_log do_log = True elif scnt == 0: # Get a source file if specified. Default destination is the same file @@ -135,7 +143,7 @@ def tryPindef(d): logmsg("pin:", line) pinnum = r[4] if r[4][0] == 'P' else lpad(r[4], patt['pad']) line = f'{r[1]} {r[3]}' - line = rpad(line, col_value_lj) + pinnum + line = concat_with_space(rpad(line, col_value_lj), pinnum) if r[5]: line = rpad(line, col_comment) + r[5] d['line'] = line return True @@ -149,7 +157,7 @@ def tryNoPin(d): if r == None: return False logmsg("pin -1:", line) line = f'{r[1]} {r[3]}' - line = rpad(line, col_value_lj) + '-1' + line = concat_with_space(rpad(line, col_value_lj), '-1') if r[5]: line = rpad(line, col_comment) + r[5] d['line'] = line return True @@ -179,8 +187,8 @@ def tryAlias(d): if r == None: return False logmsg("alias:", line) line = f'{r[1]} {r[3]}' - line += lpad(r[4], col_value_rj + 1 - len(line)) - if r[5]: line = rpad(line, col_comment) + r[5] + line = concat_with_space(line, lpad(r[4], col_value_rj + 1 - len(line))) + if r[5]: line = concat_with_space(rpad(line, col_comment), r[5]) d['line'] = line return True @@ -193,7 +201,7 @@ def trySwitch(d): if r == None: return False logmsg("switch:", line) line = f'{r[1]} {r[3]}' - if r[4]: line = rpad(line, col_comment) + r[4] + if r[4]: line = concat_with_space(rpad(line, col_comment), r[4]) d['line'] = line d['check_comment_next'] = True return True @@ -207,7 +215,7 @@ def tryDef(d): if r == None: return False logmsg("def:", line) line = f'{r[1]} {r[3]} ' - line += lpad(r[4], col_value_rj + 1 - len(line)) + line = concat_with_space(line, lpad(r[4], col_value_rj + 1 - len(line))) if r[5]: line = rpad(line, col_comment - 1) + ' ' + r[5] d['line'] = line return True @@ -221,7 +229,7 @@ def tryUndef(d): if r == None: return False logmsg("undef:", line) line = f'{r[1]} {r[3]}' - if r[4]: line = rpad(line, col_comment) + r[4] + if r[4]: line = concat_with_space(rpad(line, col_comment), r[4]) d['line'] = line return True @@ -233,7 +241,7 @@ def tryCond(d): r = condPatt.match(line) if r == None: return False logmsg("cond:", line) - line = rpad(r[1], col_comment) + r[5] + line = concat_with_space(rpad(r[1], col_comment), r[5]) d['line'] = line d['check_comment_next'] = True return True diff --git a/buildroot/share/scripts/rle_compress_bitmap.py b/buildroot/share/scripts/rle_compress_bitmap.py index c3f673c61699..12d25a7e4a36 100755 --- a/buildroot/share/scripts/rle_compress_bitmap.py +++ b/buildroot/share/scripts/rle_compress_bitmap.py @@ -10,6 +10,8 @@ import re def addCompressedData(input_file, output_file): + input_lines = input_file.readlines() + input_file.close() ofile = open(output_file, 'wt') datatype = "uint8_t" @@ -18,8 +20,7 @@ def addCompressedData(input_file, output_file): arrname = '' c_data_section = False ; c_skip_data = False ; c_footer = False - while True: - line = input_file.readline() + for line in input_lines: if not line: break if not c_footer: @@ -56,8 +57,6 @@ def addCompressedData(input_file, output_file): arrname = line.split('[')[0].split(' ')[-1] print("Found data array", arrname) - input_file.close() - #print("\nRaw Bitmap Data", raw_data) # @@ -190,11 +189,11 @@ def rle_emit(ofile, arrname, rledata, rawsize, isext): print('Usage: rle_compress_bitmap.py INPUT_FILE OUTPUT_FILE') exit(1) -output_cpp = sys.argv[2] +output_h = sys.argv[2] inname = sys.argv[1].replace('//', '/') try: - input_cpp = open(inname) + input_h = open(inname) print("Processing", inname, "...") - addCompressedData(input_cpp, output_cpp) + addCompressedData(input_h, output_h) except OSError: print("Can't find input file", inname) diff --git a/buildroot/share/scripts/upload.py b/buildroot/share/scripts/upload.py index 9fb927c42685..ae7f7e62617b 100644 --- a/buildroot/share/scripts/upload.py +++ b/buildroot/share/scripts/upload.py @@ -157,14 +157,14 @@ def _RollbackUpload(FirmwareFile): marlin_string_config_h_author = _GetMarlinEnv(MarlinEnv, 'STRING_CONFIG_H_AUTHOR') # Get firmware upload params - upload_firmware_source_name = env['PROGNAME'] + '.bin' if 'PROGNAME' in env else str(source[0]) + upload_firmware_source_path = os.path.join(env["PROJECT_BUILD_DIR"], env["PIOENV"], f"{env['PROGNAME']}.bin") if 'PROGNAME' in env else str(source[0]) # Source firmware filename upload_speed = env['UPLOAD_SPEED'] if 'UPLOAD_SPEED' in env else 115200 # baud rate of serial connection upload_port = _GetUploadPort(env) # Serial port to use # Set local upload params - upload_firmware_target_name = os.path.basename(upload_firmware_source_name) + upload_firmware_target_name = os.path.basename(upload_firmware_source_path) # Target firmware filename upload_timeout = 1000 # Communication timout, lossy/slow connections need higher values upload_blocksize = 512 # Transfer block size. 512 = Autodetect @@ -216,7 +216,7 @@ def _RollbackUpload(FirmwareFile): print(f' LONG_FILENAME_WRITE_SUPPORT : {marlin_longname_write}') print(f' CUSTOM_FIRMWARE_UPLOAD : {marlin_custom_firmware_upload}') print('---- Upload parameters ------------------------') - print(f' Source : {upload_firmware_source_name}') + print(f' Source : {upload_firmware_source_path}') print(f' Target : {upload_firmware_target_name}') print(f' Port : {upload_port} @ {upload_speed} baudrate') print(f' Timeout : {upload_timeout}') @@ -271,14 +271,14 @@ def _RollbackUpload(FirmwareFile): # WARNING! The serial port must be closed here because the serial transfer that follow needs it! # Upload firmware file - debugPrint(f"Copy '{upload_firmware_source_name}' --> '{upload_firmware_target_name}'") + debugPrint(f"Copy '{upload_firmware_source_path}' --> '{upload_firmware_target_name}'") protocol = MarlinBinaryProtocol.Protocol(upload_port, upload_speed, upload_blocksize, float(upload_error_ratio), int(upload_timeout)) #echologger = MarlinBinaryProtocol.EchoProtocol(protocol) protocol.connect() # Mark the rollback (delete broken transfer) from this point on rollback = True filetransfer = MarlinBinaryProtocol.FileTransferProtocol(protocol) - transferOK = filetransfer.copy(upload_firmware_source_name, upload_firmware_target_name, upload_compression, upload_test) + transferOK = filetransfer.copy(upload_firmware_source_path, upload_firmware_target_name, upload_compression, upload_test) protocol.disconnect() # Notify upload completed diff --git a/buildroot/tests/DUE b/buildroot/tests/DUE index 81e60c962345..590d76606c97 100755 --- a/buildroot/tests/DUE +++ b/buildroot/tests/DUE @@ -27,7 +27,7 @@ opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS \ FWRETRACT ARC_SUPPORT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \ PSU_CONTROL AUTO_POWER_CONTROL E_DUAL_STEPPER_DRIVERS \ PIDTEMPBED SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER \ - PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL \ + PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL MAX7219_REINIT_ON_POWERUP \ EXTENSIBLE_UI opt_add EXTUI_EXAMPLE exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), ExtUI, S-Curve, many options." "$3" diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index 1fea3c963f02..44d818b62400 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -28,8 +28,9 @@ opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELI opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU SET_PROGRESS_MANUALLY SET_PROGRESS_PERCENT STATUS_MESSAGE_SCROLLING \ SOUND_MENU_ITEM PRINTCOUNTER NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR \ BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_UBL MESH_EDIT_MENU LCD_BED_TRAMMING \ - LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE -opt_set PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128 BOOTSCREEN_TIMEOUT 1100 + LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE \ + CASE_LIGHT_ENABLE CASE_LIGHT_MENU CASE_LIGHT_NO_BRIGHTNESS +opt_set PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128 BOOTSCREEN_TIMEOUT 1100 CASE_LIGHT_PIN 4 exec_test $1 $2 "Ender-3 S1 - ProUI (PIDTEMP)" "$3" restore_configs diff --git a/docs/Cutter.md b/docs/Cutter.md index 623beb21f4d3..8f4b7e67aa69 100644 --- a/docs/Cutter.md +++ b/docs/Cutter.md @@ -81,7 +81,7 @@ A reduced entry laser power factor is based on the entry step rate to cruise ste block entry laser power = laser power * ( entry step rate / cruise step rate ) -The initial power will be set to no less than the laser_power_floor or the inital power calculation. +The initial power will be set to no less than the laser_power_floor or the initial power calculation. The reduced final power factor is based on the final step rate to cruise step rate ratio for deceleration. diff --git a/ini/features.ini b/ini/features.ini index 1100216867bb..cb3b96c402a2 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -243,7 +243,7 @@ HAS_FANMUX = build_src_filter=+ + FWRETRACT = build_src_filter=+ + HOST_ACTION_COMMANDS = build_src_filter=+ -HOTEND_IDLE_TIMEOUT = build_src_filter=+ + +HOTEND_IDLE_TIMEOUT = build_src_filter=+ + JOYSTICK = build_src_filter=+ BLINKM = build_src_filter=+ HAS_COLOR_LEDS = build_src_filter=+ + @@ -299,7 +299,7 @@ SD_ABORT_ON_ENDSTOP_HIT = build_src_filter=+ HAS_SMART_EFF_MOD = build_src_filter=+ COOLANT_CONTROL|AIR_ASSIST = build_src_filter=+ -AIR_EVACUATION = build_src_filter=+ +AIR_EVACUATION = build_src_filter=+ HAS_SOFTWARE_ENDSTOPS = build_src_filter=+ SERVO_DETACH_GCODE = build_src_filter=+ HAS_DUPLICATION_MODE = build_src_filter=+ @@ -314,7 +314,6 @@ HAS_ZV_SHAPING = build_src_filter=+ GRADIENT_MIX = build_src_filter=+ NONLINEAR_EXTRUSION = build_src_filter=+ -OTA_FIRMWARE_UPDATE = build_src_filter=+ HAS_SAVED_POSITIONS = build_src_filter=+ + PARK_HEAD_ON_PAUSE = build_src_filter=+ FILAMENT_LOAD_UNLOAD_GCODES = build_src_filter=+ @@ -340,6 +339,7 @@ TOUCH_SCREEN_CALIBRATION = build_src_filter=+ GCODE_MOTION_MODES = build_src_filter=+ BABYSTEPPING = build_src_filter=+ + +OTA_FIRMWARE_UPDATE = build_src_filter=+ Z_PROBE_SLED = build_src_filter=+ G38_PROBE_TARGET = build_src_filter=+ MAGNETIC_PARKING_EXTRUDER = build_src_filter=+ diff --git a/ini/hc32.ini b/ini/hc32.ini index 9bf15447e2cd..c9533bad17a0 100644 --- a/ini/hc32.ini +++ b/ini/hc32.ini @@ -33,22 +33,14 @@ build_src_filter = ${common.default_src_filter} + + +# 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} + +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} + 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} diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index fb8e9109cfd8..9c6f751746c3 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -820,7 +820,7 @@ board = marlin_STM32F446ZET_tronxy board_build.ldscript = buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/ldscript.ld board_build.offset = 0x10000 board_build.rename = fmw_tronxy.bin -build_flags = ${stm32_variant.build_flags} +build_flags = ${stm32_variant.build_flags} -DSTM32F4xx -DUSE_USB_HS -DUSE_USB_HS_IN_FS build_unflags = ${stm32_variant.build_unflags} -fno-rtti diff --git a/ini/stm32g0.ini b/ini/stm32g0.ini index 8da5ab230fe1..77bdde7438dd 100644 --- a/ini/stm32g0.ini +++ b/ini/stm32g0.ini @@ -57,6 +57,7 @@ board_build.offset = 0x2000 board_upload.offset_address = 0x08002000 build_flags = ${stm32_variant.build_flags} -DPIN_SERIAL4_RX=PC_11 -DPIN_SERIAL4_TX=PC_10 + -DPIN_SERIAL5_RX=PD_2 -DPIN_SERIAL5_TX=PD_3 -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 -DSTEP_TIMER_IRQ_PRIO=0 diff --git a/test/001-default.ini b/test/001-default.ini new file mode 100644 index 000000000000..b98042cc2dcb --- /dev/null +++ b/test/001-default.ini @@ -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 diff --git a/test/002-extruders_1_runout.ini b/test/002-extruders_1_runout.ini new file mode 100644 index 000000000000..74afa0f02f21 --- /dev/null +++ b/test/002-extruders_1_runout.ini @@ -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 diff --git a/test/003-extruders_3_runout.ini b/test/003-extruders_3_runout.ini new file mode 100644 index 000000000000..4bd91e8b7cae --- /dev/null +++ b/test/003-extruders_3_runout.ini @@ -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 diff --git a/test/README.md b/test/README.md new file mode 100644 index 000000000000..19b4cd7d5949 --- /dev/null +++ b/test/README.md @@ -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`. diff --git a/test/unit_tests.cpp b/test/unit_tests.cpp new file mode 100644 index 000000000000..e22aa529d0d4 --- /dev/null +++ b/test/unit_tests.cpp @@ -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 . + * + */ + +/** + * 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 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; +} diff --git a/test/unit_tests.h b/test/unit_tests.h new file mode 100644 index 000000000000..53bb64074a1f --- /dev/null +++ b/test/unit_tests.h @@ -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 . + * + */ +#pragma once + +#include +#include +#include + +// 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()